From 828a5409df5ccca2859b4b0f7a7d5d01e4aeb978 Mon Sep 17 00:00:00 2001 From: Yuchao Yan Date: Sat, 11 Oct 2025 13:40:52 +0800 Subject: [PATCH 1/4] generate from typespec --- .../packaging_tools/sdk_generator.py | 2 +- sdk/compute/azure-mgmt-compute/CHANGELOG.md | 626 + sdk/compute/azure-mgmt-compute/_metadata.json | 12 +- .../apiview-properties.json | 2431 +- .../azure/mgmt/compute/__init__.py | 6 +- ...ompute_management_client.py => _client.py} | 346 +- .../azure/mgmt/compute/_configuration.py | 20 +- .../azure/mgmt/compute/_patch.py | 4 +- .../azure/mgmt/compute/_utils/__init__.py | 2 +- .../azure/mgmt/compute/_utils/model_base.py | 1237 + .../mgmt/compute/_utils/serialization.py | 4 +- .../azure/mgmt/compute/_utils/utils.py | 40 + .../azure/mgmt/compute/_validation.py | 66 + .../azure/mgmt/compute/_version.py | 7 +- .../azure/mgmt/compute/aio/__init__.py | 6 +- ...ompute_management_client.py => _client.py} | 350 +- .../azure/mgmt/compute/aio/_configuration.py | 20 +- .../azure/mgmt/compute/aio/_patch.py | 4 +- .../mgmt/compute/aio/operations/__init__.py | 173 +- .../_availability_sets_operations.py | 1167 - ..._capacity_reservation_groups_operations.py | 624 - .../_capacity_reservations_operations.py | 764 - ...ud_service_operating_systems_operations.py | 306 - ...cloud_service_role_instances_operations.py | 778 - .../_cloud_service_roles_operations.py | 186 - .../operations/_cloud_services_operations.py | 1779 - ...cloud_services_update_domain_operations.py | 403 - .../_community_galleries_operations.py | 107 - ...unity_gallery_image_versions_operations.py | 201 - .../_community_gallery_images_operations.py | 187 - .../_dedicated_host_groups_operations.py | 581 - .../operations/_dedicated_hosts_operations.py | 1070 - .../operations/_disk_accesses_operations.py | 1330 - .../_disk_encryption_sets_operations.py | 862 - .../_disk_restore_point_operations.py | 575 - .../aio/operations/_disks_operations.py | 1076 - .../aio/operations/_galleries_operations.py | 775 - ...gallery_application_versions_operations.py | 831 - .../_gallery_applications_operations.py | 756 - .../_gallery_image_versions_operations.py | 810 - .../operations/_gallery_images_operations.py | 746 - ...ess_control_profile_versions_operations.py | 834 - ...n_vm_access_control_profiles_operations.py | 768 - .../_gallery_sharing_profile_operations.py | 257 - .../aio/operations/_images_operations.py | 751 - .../operations/_log_analytics_operations.py | 427 - .../compute/aio/operations/_operations.py | 39319 ++++++++++++- .../mgmt/compute/aio/operations/_patch.py | 4 +- .../_proximity_placement_groups_operations.py | 579 - .../operations/_resource_skus_operations.py | 128 - .../_restore_point_collections_operations.py | 652 - .../operations/_restore_points_operations.py | 461 - .../_shared_galleries_operations.py | 181 - ...hared_gallery_image_versions_operations.py | 212 - .../_shared_gallery_images_operations.py | 194 - .../aio/operations/_snapshots_operations.py | 1094 - .../_soft_deleted_resource_operations.py | 137 - .../operations/_ssh_public_keys_operations.py | 710 - .../aio/operations/_usage_operations.py | 121 - ...ual_machine_extension_images_operations.py | 250 - .../_virtual_machine_extensions_operations.py | 739 - ...ual_machine_images_edge_zone_operations.py | 392 - .../_virtual_machine_images_operations.py | 507 - ...virtual_machine_run_commands_operations.py | 878 - ...machine_scale_set_extensions_operations.py | 759 - ...e_scale_set_rolling_upgrades_operations.py | 459 - ...hine_scale_set_vm_extensions_operations.py | 789 - ...ne_scale_set_vm_run_commands_operations.py | 795 - ...irtual_machine_scale_set_vms_operations.py | 2403 - .../_virtual_machine_scale_sets_operations.py | 4130 -- .../_virtual_machine_sizes_operations.py | 121 - .../_virtual_machines_operations.py | 3524 -- .../azure/mgmt/compute/models/__init__.py | 336 +- ...e_management_client_enums.py => _enums.py} | 208 +- .../azure/mgmt/compute/models/_models.py | 24622 ++++++++ .../azure/mgmt/compute/models/_models_py3.py | 28590 ---------- .../azure/mgmt/compute/models/_patch.py | 4 +- .../azure/mgmt/compute/operations/__init__.py | 173 +- .../_availability_sets_operations.py | 1526 - ..._capacity_reservation_groups_operations.py | 846 - .../_capacity_reservations_operations.py | 965 - ...ud_service_operating_systems_operations.py | 419 - ...cloud_service_role_instances_operations.py | 1041 - .../_cloud_service_roles_operations.py | 251 - .../operations/_cloud_services_operations.py | 2165 - ...cloud_services_update_domain_operations.py | 499 - .../_community_galleries_operations.py | 139 - ...unity_gallery_image_versions_operations.py | 272 - .../_community_gallery_images_operations.py | 249 - .../_dedicated_host_groups_operations.py | 777 - .../operations/_dedicated_hosts_operations.py | 1347 - .../operations/_disk_accesses_operations.py | 1686 - .../_disk_encryption_sets_operations.py | 1075 - .../_disk_restore_point_operations.py | 738 - .../compute/operations/_disks_operations.py | 1316 - .../operations/_galleries_operations.py | 966 - ...gallery_application_versions_operations.py | 1032 - .../_gallery_applications_operations.py | 927 - .../_gallery_image_versions_operations.py | 1010 - .../operations/_gallery_images_operations.py | 917 - ...ess_control_profile_versions_operations.py | 1052 - ...n_vm_access_control_profiles_operations.py | 963 - .../_gallery_sharing_profile_operations.py | 296 - .../compute/operations/_images_operations.py | 936 - .../operations/_log_analytics_operations.py | 483 - .../mgmt/compute/operations/_operations.py | 47296 +++++++++++++++- .../azure/mgmt/compute/operations/_patch.py | 4 +- .../_proximity_placement_groups_operations.py | 785 - .../operations/_resource_skus_operations.py | 166 - .../_restore_point_collections_operations.py | 854 - .../operations/_restore_points_operations.py | 591 - .../_shared_galleries_operations.py | 248 - ...hared_gallery_image_versions_operations.py | 291 - .../_shared_gallery_images_operations.py | 266 - .../operations/_snapshots_operations.py | 1330 - .../_soft_deleted_resource_operations.py | 183 - .../operations/_ssh_public_keys_operations.py | 930 - .../compute/operations/_usage_operations.py | 150 - ...ual_machine_extension_images_operations.py | 357 - .../_virtual_machine_extensions_operations.py | 921 - ...ual_machine_images_edge_zone_operations.py | 575 - .../_virtual_machine_images_operations.py | 746 - ...virtual_machine_run_commands_operations.py | 1111 - ...machine_scale_set_extensions_operations.py | 938 - ...e_scale_set_rolling_upgrades_operations.py | 585 - ...hine_scale_set_vm_extensions_operations.py | 998 - ...ne_scale_set_vm_run_commands_operations.py | 1002 - ...irtual_machine_scale_set_vms_operations.py | 3067 - .../_virtual_machine_scale_sets_operations.py | 5054 -- .../_virtual_machine_sizes_operations.py | 150 - .../_virtual_machines_operations.py | 4447 -- ..._migration_to_virtual_machine_scale_set.py | 42 - ...et_convert_to_virtual_machine_scale_set.py | 42 - .../availability_set_create.py | 47 - ...set_create_with_scheduled_event_profile.py | 47 - ...availability_set_delete_maximum_set_gen.py | 42 - ...availability_set_delete_minimum_set_gen.py | 42 - .../availability_set_get_maximum_set_gen.py | 43 - .../availability_set_get_minimum_set_gen.py | 43 - ...et_list_available_sizes_maximum_set_gen.py | 44 - ...et_list_available_sizes_minimum_set_gen.py | 44 - .../availability_set_list_by_subscription.py | 41 - .../availability_set_list_maximum_set_gen.py | 43 - .../availability_set_list_minimum_set_gen.py | 43 - ..._migration_to_virtual_machine_scale_set.py | 47 - ...availability_set_update_maximum_set_gen.py | 59 - ..._migration_to_virtual_machine_scale_set.py | 47 - ...k_capacity_reservation_create_or_update.py | 51 - .../block_capacity_reservation_get.py | 44 - ...city_reservation_group_create_or_update.py | 49 - .../block_capacity_reservation_group_get.py | 43 - ...y_reservation_list_by_reservation_group.py | 44 - .../capacity_reservation_create_or_update.py | 50 - ...city_reservation_delete_maximum_set_gen.py | 43 - ...city_reservation_delete_minimum_set_gen.py | 43 - .../capacity_reservation_get.py | 44 - ...city_reservation_group_create_or_update.py | 56 - ...eservation_group_delete_maximum_set_gen.py | 42 - ...eservation_group_delete_minimum_set_gen.py | 42 - .../capacity_reservation_group_get.py | 43 - ...eservation_group_list_by_resource_group.py | 43 - ..._reservation_group_list_by_subscription.py | 41 - ...by_subscription_with_resource_ids_query.py | 41 - ...eservation_group_update_maximum_set_gen.py | 44 - ...y_reservation_list_by_reservation_group.py | 44 - ...city_reservation_update_maximum_set_gen.py | 62 - ...d_capacity_reservation_create_or_update.py | 50 - .../targeted_capacity_reservation_get.py | 44 - ...city_reservation_group_create_or_update.py | 57 - ...targeted_capacity_reservation_group_get.py | 43 - ...y_reservation_list_by_reservation_group.py | 44 - .../cloud_service_create_with_multi_role.py | 43 - ...rvice_create_with_multi_role_with_zones.py | 43 - .../cloud_service_create_with_single_role.py | 43 - ...create_with_single_role_and_certificate.py | 43 - ...service_create_with_single_role_and_rdp.py | 43 - .../generated_samples/cloud_service_delete.py | 42 - ...rvice_get_instance_view_with_multi_role.py | 43 - ...oud_service_get_with_multi_role_and_rdp.py | 43 - .../cloud_service_list_by_resource_group.py | 43 - .../cloud_service_list_by_subscription.py | 41 - .../cloud_service_os_families_list.py | 43 - .../cloud_service_os_family_get.py | 43 - .../cloud_service_os_version_get.py | 43 - .../cloud_service_os_version_list.py | 43 - .../cloud_service_power_off.py | 42 - .../cloud_service_role_get.py | 44 - .../cloud_service_role_instance_delete.py | 43 - ...e_role_instance_delete_by_cloud_service.py | 42 - .../cloud_service_role_instance_get.py | 44 - ...service_role_instance_get_instance_view.py | 44 - ...e_role_instance_get_remote_desktop_file.py | 44 - .../cloud_service_role_instance_rebuild.py | 43 - ..._role_instance_rebuild_by_cloud_service.py | 42 - .../cloud_service_role_instance_reimage.py | 43 - ..._role_instance_reimage_by_cloud_service.py | 42 - .../cloud_service_role_instance_restart.py | 43 - ..._role_instance_restart_by_cloud_service.py | 42 - .../cloud_service_role_list.py | 44 - .../cloud_service_roles_instance_list.py | 44 - .../generated_samples/cloud_service_start.py | 42 - .../cloud_service_update_domain_get.py | 44 - .../cloud_service_update_domain_list.py | 44 - .../cloud_service_update_domain_update.py | 43 - .../cloud_service_update_to_include_tags.py | 43 - .../community_gallery_get.py | 43 - .../community_gallery_image_get.py | 44 - .../community_gallery_image_list.py | 44 - .../community_gallery_image_version_get.py | 45 - .../community_gallery_image_version_list.py | 45 - .../operations_list_maximum_set_gen.py | 41 - .../operations_list_minimum_set_gen.py | 41 - .../usage_list_maximum_set_gen.py | 43 - .../usage_list_minimum_set_gen.py | 43 - ...tual_machine_sizes_list_maximum_set_gen.py | 43 - ...tual_machine_sizes_list_minimum_set_gen.py | 43 - .../dedicated_host_create_or_update.py | 50 - .../dedicated_host_delete_maximum_set_gen.py | 43 - .../dedicated_host_delete_minimum_set_gen.py | 43 - .../dedicated_host_get.py | 44 - .../dedicated_host_group_create_or_update.py | 49 - ...t_group_create_or_update_with_ultra_ssd.py | 53 - ...cated_host_group_delete_maximum_set_gen.py | 42 - ...cated_host_group_delete_minimum_set_gen.py | 42 - .../dedicated_host_group_get.py | 43 - ..._ultra_ssd_enabled_dedicated_host_group.py | 43 - ..._list_by_resource_group_maximum_set_gen.py | 43 - ..._list_by_resource_group_minimum_set_gen.py | 43 - ...up_list_by_subscription_maximum_set_gen.py | 41 - ...up_list_by_subscription_minimum_set_gen.py | 41 - ...cated_host_group_update_maximum_set_gen.py | 67 - .../dedicated_host_list_available_sizes.py | 45 - ...host_list_by_host_group_maximum_set_gen.py | 44 - ...host_list_by_host_group_minimum_set_gen.py | 44 - .../dedicated_host_redeploy.py | 43 - .../dedicated_host_restart.py | 43 - .../dedicated_host_update_maximum_set_gen.py | 64 - .../dedicated_host_update_resize.py | 45 - .../disk_access_create.py | 44 - .../disk_access_delete.py | 42 - .../disk_access_examples/disk_access_get.py | 43 - .../disk_access_get_with_private_endpoints.py | 43 - .../disk_access_list_by_resource_group.py | 43 - .../disk_access_list_by_subscription.py | 41 - ...ess_private_endpoint_connection_approve.py | 52 - ...cess_private_endpoint_connection_delete.py | 43 - ..._access_private_endpoint_connection_get.py | 44 - ...endpoint_connection_list_by_disk_access.py | 44 - .../disk_access_private_link_resources_get.py | 43 - .../disk_access_update.py | 44 - .../disk_encryption_set_create.py | 56 - ..._key_vault_from_adifferent_subscription.py | 51 - ...e_with_key_vault_from_adifferent_tenant.py | 57 - .../disk_encryption_set_delete.py | 42 - .../disk_encryption_set_get.py | 43 - ...on_set_get_with_auto_key_rotation_error.py | 43 - ...ncryption_set_list_associated_resources.py | 44 - ...k_encryption_set_list_by_resource_group.py | 43 - ...isk_encryption_set_list_by_subscription.py | 41 - .../disk_encryption_set_update.py | 55 - ..._rotation_to_latest_key_version_enabled.py | 51 - ..._latest_key_version_enabled_in_progress.py | 51 - .../disk_examples/disk_begin_get_access.py | 44 - ...sk_begin_get_access_with_vm_guest_state.py | 44 - ...ess_with_vm_guest_state_and_vm_metadata.py | 44 - .../disk_create_by_copying_asnapshot.py | 52 - ...rting_blob_from_adifferent_subscription.py | 53 - ...porting_blob_from_the_same_subscription.py | 52 - ...al_vm_supported_disk_encrypted_with_cmk.py | 59 - .../disk_examples/disk_create_empty.py | 44 - ...n_azure_compute_gallery_community_image.py | 55 - ...ure_compute_gallery_direct_shared_image.py | 55 - ...ate_from_an_azure_compute_gallery_image.py | 55 - ...ate_from_an_elastic_san_volume_snapshot.py | 52 - ...sk_create_from_an_existing_managed_disk.py | 52 - .../disk_create_from_aplatform_image.py | 55 - .../disk_create_from_import_secure.py | 56 - ...ate_from_import_secure_with_vm_metadata.py | 57 - ...disk_create_from_upload_prepared_secure.py | 51 - .../disk_create_in_extended_location.py | 48 - ...sk_create_or_update_availability_policy.py | 51 - .../disk_create_or_update_bursting_enabled.py | 44 - .../disk_create_performance_plus.py | 47 - .../disk_examples/disk_create_upload_disk.py | 47 - .../disk_create_with_data_access_auth_mode.py | 51 - .../disk_create_with_disk_access.py | 52 - .../disk_create_with_disk_encryption_set.py | 53 - .../disk_create_with_logical_sector_size.py | 48 - ...eate_with_optimized_for_frequent_attach.py | 51 - ..._create_with_premium_v2_lrsaccount_type.py | 53 - .../disk_create_with_security_profile.py | 56 - .../disk_create_with_ssdzrs_account_type.py | 48 - .../disk_create_with_ultra_ssd_read_only.py | 54 - .../disk_examples/disk_delete.py | 42 - .../disk_examples/disk_end_get_access.py | 42 - .../disk_examples/disk_get.py | 43 - .../disk_list_by_resource_group.py | 43 - .../disk_list_by_subscription.py | 41 - .../disk_update_add_accelerated_networking.py | 44 - .../disk_update_add_disk_controller_types.py | 44 - .../disk_update_add_purchase_plan.py | 53 - .../disk_update_add_supports_hibernation.py | 44 - .../disk_examples/disk_update_change_tier.py | 44 - .../disk_update_disable_bursting.py | 44 - ...e_disable_optimized_for_frequent_attach.py | 44 - .../disk_update_remove_disk_access.py | 44 - .../disk_update_to_add_architecture.py | 44 - .../disk_restore_point_begin_get_access.py | 46 - .../disk_restore_point_end_get_access.py | 44 - .../disk_restore_point_get.py | 45 - ...ource_resource_is_from_different_region.py | 45 - ..._restore_point_list_by_vm_restore_point.py | 45 - .../community_gallery_create.py | 58 - .../gallery_examples/community_gallery_get.py | 43 - .../gallery_add_to_sharing_profile.py | 53 - .../gallery_application_create.py | 70 - .../gallery_application_delete.py | 43 - .../gallery_application_get.py | 44 - .../gallery_application_list_by_gallery.py | 44 - .../gallery_application_update.py | 69 - .../gallery_application_version_create.py | 87 - .../gallery_application_version_delete.py | 44 - .../gallery_application_version_get.py | 45 - ...ion_version_get_with_replication_status.py | 45 - ...ion_version_list_by_gallery_application.py | 45 - .../gallery_application_version_update.py | 70 - .../gallery_examples/gallery_create.py | 44 - .../gallery_create_soft_deletion_enabled.py | 50 - .../gallery_create_with_managed_identity.py | 53 - .../gallery_create_with_sharing_profile.py | 50 - .../gallery_examples/gallery_delete.py | 42 - .../gallery_enable_community_gallery.py | 44 - .../gallery_examples/gallery_get.py | 43 - ..._get_with_expand_sharing_profile_groups.py | 43 - .../gallery_get_with_managed_identity.py | 43 - .../gallery_get_with_select_permissions.py | 43 - .../gallery_examples/gallery_image_create.py | 53 - .../gallery_examples/gallery_image_delete.py | 43 - .../gallery_examples/gallery_image_get.py | 44 - .../gallery_image_list_by_gallery.py | 44 - .../gallery_examples/gallery_image_update.py | 52 - .../gallery_image_update_features.py | 54 - .../gallery_image_version_create.py | 101 - ...ion_create_with_additional_replica_sets.py | 104 - ..._with_community_image_version_as_source.py | 101 - ...ion_create_with_image_version_as_source.py | 101 - ...on_create_with_shallow_replication_mode.py | 60 - ...version_create_with_snapshots_as_source.py | 105 - ...n_create_with_target_extended_locations.py | 101 - .../gallery_image_version_create_with_vhd.py | 96 - ...e_version_create_with_vhd_uefi_settings.py | 106 - ..._image_version_create_with_vm_as_source.py | 101 - .../gallery_image_version_delete.py | 44 - .../gallery_image_version_get.py | 45 - ...age_version_get_with_replication_status.py | 45 - ...ge_version_get_with_snapshots_as_source.py | 45 - ...age_version_get_with_validation_profile.py | 45 - ...lidation_profile_and_replication_status.py | 45 - ...ry_image_version_get_with_vhd_as_source.py | 45 - ...ery_image_version_list_by_gallery_image.py | 45 - .../gallery_image_version_update.py | 60 - ...age_version_update_restore_soft_deleted.py | 46 - ..._image_version_update_without_source_id.py | 56 - .../gallery_list_by_resource_group.py | 43 - .../gallery_list_by_subscription.py | 41 - .../gallery_reset_sharing_profile.py | 44 - ..._deleted_resource_list_by_artifact_name.py | 46 - .../gallery_examples/gallery_update.py | 44 - ...ery_in_vm_access_control_profile_delete.py | 43 - ...allery_in_vm_access_control_profile_get.py | 44 - ..._access_control_profile_list_by_gallery.py | 44 - ...m_access_control_profile_version_delete.py | 44 - ...n_vm_access_control_profile_version_get.py | 45 - ...by_gallery_in_vm_access_control_profile.py | 45 - ...ge_create_data_disk_from_ablob_included.py | 59 - ...e_data_disk_from_amanaged_disk_included.py | 66 - ...reate_data_disk_from_asnapshot_included.py | 66 - .../image_examples/image_create_from_ablob.py | 56 - ...ate_from_ablob_with_disk_encryption_set.py | 58 - .../image_create_from_amanaged_disk.py | 58 - ..._amanaged_disk_with_disk_encryption_set.py | 60 - .../image_create_from_asnapshot.py | 58 - ...from_asnapshot_with_disk_encryption_set.py | 60 - .../image_examples/image_create_from_avm.py | 51 - .../image_examples/image_get.py | 43 - .../image_list_by_resource_group.py | 43 - .../image_list_by_subscription.py | 41 - .../image_examples/image_update.py | 52 - .../images_delete_maximum_set_gen.py | 42 - .../images_delete_minimum_set_gen.py | 42 - .../log_analytics_request_rate_by_interval.py | 49 - .../log_analytics_throttled_requests.py | 51 - ...ximity_placement_group_create_or_update.py | 48 - .../proximity_placement_group_delete.py | 42 - .../proximity_placement_group_get.py | 43 - ..._placement_group_list_by_resource_group.py | 43 - ...ty_placement_group_list_by_subscription.py | 41 - .../proximity_placement_group_patch.py | 44 - ...store_point_collection_create_or_update.py | 52 - ..._create_or_update_for_cross_region_copy.py | 52 - ...point_collection_delete_maximum_set_gen.py | 42 - ...point_collection_delete_minimum_set_gen.py | 42 - .../restore_point_collection_get.py | 43 - ...ction_get_with_contained_restore_points.py | 43 - ...point_collection_list_by_resource_group.py | 43 - ...e_point_collection_list_by_subscription.py | 41 - ...point_collection_update_maximum_set_gen.py | 51 - .../restore_point_copy_between_regions.py | 51 - .../restore_point_create.py | 53 - .../restore_point_delete_maximum_set_gen.py | 43 - .../restore_point_delete_minimum_set_gen.py | 43 - .../restore_point_get.py | 44 - .../restore_point_get_with_instance_view.py | 44 - .../run_command_examples/run_command_get.py | 43 - .../run_command_examples/run_command_list.py | 43 - .../virtual_machine_run_command.py | 44 - ...al_machine_run_command_create_or_update.py | 59 - .../virtual_machine_run_command_delete.py | 43 - .../virtual_machine_run_command_get.py | 44 - .../virtual_machine_run_command_list.py | 44 - .../virtual_machine_run_command_update.py | 57 - ...irtual_machine_scale_set_vm_run_command.py | 45 - ...ale_set_vm_run_command_create_or_update.py | 64 - ...machine_scale_set_vm_run_command_delete.py | 44 - ...al_machine_scale_set_vm_run_command_get.py | 45 - ...l_machine_scale_set_vm_run_command_list.py | 45 - ...machine_scale_set_vm_run_command_update.py | 53 - .../shared_gallery_get.py | 43 - .../shared_gallery_image_get.py | 44 - .../shared_gallery_image_version_get.py | 45 - .../shared_gallery_image_versions_list.py | 45 - .../shared_gallery_images_list.py | 44 - .../shared_gallery_list.py | 43 - .../skus/list_available_resource_skus.py | 41 - ...ist_available_resource_skus_for_aregion.py | 41 - ...e_resource_skus_with_extended_locations.py | 41 - .../snapshot_begin_get_access.py | 44 - ...naged_blob_from_adifferent_subscription.py | 53 - ...managed_blob_from_the_same_subscription.py | 52 - ...hanced_provisioned_bandwidth_copy_speed.py | 53 - ...ate_from_an_elastic_san_volume_snapshot.py | 52 - ...apshot_create_from_an_existing_snapshot.py | 52 - ...n_existing_snapshot_in_different_region.py | 52 - ...snapshot_create_instant_access_snapshot.py | 53 - .../snapshot_examples/snapshot_delete.py | 42 - .../snapshot_end_get_access.py | 42 - .../snapshot_examples/snapshot_get.py | 43 - .../snapshot_get_incremental_snapshot.py | 43 - .../snapshot_list_by_resource_group.py | 43 - .../snapshot_list_by_subscription.py | 41 - .../snapshot_examples/snapshot_update.py | 47 - ...napshot_update_with_accelerated_network.py | 47 - .../ssh_public_key_create.py | 44 - .../ssh_public_key_delete_maximum_set_gen.py | 42 - .../ssh_public_key_delete_minimum_set_gen.py | 42 - .../ssh_public_key_generate_key_pair.py | 43 - ...nerate_key_pair_encryption_with_ed25519.py | 43 - ...y_generate_key_pair_encryption_with_rsa.py | 43 - .../ssh_public_key_get.py | 43 - ..._list_by_resource_group_maximum_set_gen.py | 43 - ..._list_by_resource_group_minimum_set_gen.py | 43 - ...ey_list_by_subscription_maximum_set_gen.py | 41 - ...ey_list_by_subscription_minimum_set_gen.py | 41 - .../ssh_public_key_update_maximum_set_gen.py | 44 - .../virtual_machine_assess_patches.py | 43 - ...ttach_detach_data_disks_maximum_set_gen.py | 77 - ...ttach_detach_data_disks_minimum_set_gen.py | 55 - ...virtual_machine_capture_maximum_set_gen.py | 44 - ...virtual_machine_capture_minimum_set_gen.py | 44 - ...onvert_to_managed_disks_maximum_set_gen.py | 42 - ...onvert_to_managed_disks_minimum_set_gen.py | 42 - ..._from_an_unmanaged_generalized_os_image.py | 76 - ...ne_create_from_acommunity_gallery_image.py | 73 - ...rtual_machine_create_from_acustom_image.py | 73 - ...e_create_from_ageneralized_shared_image.py | 73 - ...chine_create_from_ashared_gallery_image.py | 73 - ...e_create_from_aspecialized_shared_image.py | 68 - ...l_machine_create_in_an_availability_set.py | 79 - ...customer_assigned_platform_fault_domain.py | 80 - ..._vm_with_automatic_by_platform_settings.py | 87 - ...etting_assessment_mode_of_image_default.py | 80 - ...ith_patch_setting_mode_of_image_default.py | 77 - ..._setting_modes_of_automatic_by_platform.py | 80 - ...age_vm_with_unmanaged_os_and_data_disks.py | 96 - ..._vm_with_automatic_by_platform_settings.py | 88 - ...etting_assessment_mode_of_image_default.py | 81 - ...h_patch_setting_mode_of_automatic_by_os.py | 81 - ...y_platform_and_enable_hot_patching_true.py | 81 - ...ws_vm_with_patch_setting_mode_of_manual.py | 81 - ..._setting_modes_of_automatic_by_platform.py | 81 - ...rtual_machine_create_with_adiff_os_disk.py | 78 - ...using_diff_disk_placement_as_cache_disk.py | 78 - ..._using_diff_disk_placement_as_nvme_disk.py | 78 - ...ng_diff_disk_placement_as_resource_disk.py | 78 - ...ine_create_with_amarketplace_image_plan.py | 77 - ...machine_create_with_application_profile.py | 91 - ...al_machine_create_with_boot_diagnostics.py | 82 - ...achine_create_with_capacity_reservation.py | 82 - ...te_with_data_disks_from_source_resource.py | 102 - ...achine_create_with_disk_controller_type.py | 92 - ...reate_with_disk_encryption_set_resource.py | 105 - ...al_machine_create_with_empty_data_disks.py | 80 - ..._machine_create_with_encryption_at_host.py | 78 - ...machine_create_with_encryption_identity.py | 87 - ...hine_create_with_extensions_time_budget.py | 83 - ...machine_create_with_hibernation_enabled.py | 83 - ...ne_create_with_managed_boot_diagnostics.py | 77 - ...te_with_network_interface_configuration.py | 98 - ...rk_interface_configuration_dns_settings.py | 100 - ...ine_create_with_password_authentication.py | 76 - .../virtual_machine_create_with_placement.py | 78 - ...ual_machine_create_with_premium_storage.py | 76 - ...achine_create_with_proxy_agent_settings.py | 79 - ...ne_create_with_scheduled_events_profile.py | 94 - ...eate_with_security_type_confidential_vm.py | 83 - ...fidential_vm_with_customer_managed_keys.py | 88 - ..._confidential_vm_with_non_persisted_tpm.py | 83 - ..._machine_create_with_ssh_authentication.py | 86 - ...rtual_machine_create_with_uefi_settings.py | 80 - .../virtual_machine_create_with_user_data.py | 83 - ..._machine_create_with_vm_size_properties.py | 86 - ...tual_machine_deallocate_maximum_set_gen.py | 42 - ...tual_machine_deallocate_minimum_set_gen.py | 42 - .../virtual_machine_delete_force.py | 42 - ...ension_create_or_update_maximum_set_gen.py | 82 - ...ension_create_or_update_minimum_set_gen.py | 45 - ...achine_extension_delete_maximum_set_gen.py | 43 - ...achine_extension_delete_minimum_set_gen.py | 43 - ...l_machine_extension_get_maximum_set_gen.py | 44 - ...l_machine_extension_get_minimum_set_gen.py | 44 - ..._machine_extension_list_maximum_set_gen.py | 43 - ..._machine_extension_list_minimum_set_gen.py | 43 - .../virtual_machine_extension_update.py | 60 - .../virtual_machine_generalize.py | 42 - .../virtual_machine_get.py | 43 - ...get_auto_placed_on_dedicated_host_group.py | 43 - .../virtual_machine_get_instance_view.py | 43 - ...iew_auto_placed_on_dedicated_host_group.py | 43 - ...l_machine_get_with_disk_controller_type.py | 43 - ...ual_machine_get_with_vm_size_properties.py | 43 - .../virtual_machine_install_patches.py | 53 - ...irtual_machine_list_all_maximum_set_gen.py | 41 - ...irtual_machine_list_all_minimum_set_gen.py | 41 - ...virtual_machine_list_available_vm_sizes.py | 44 - ...achine_list_by_subscription_by_location.py | 43 - .../virtual_machine_list_maximum_set_gen.py | 43 - .../virtual_machine_list_minimum_set_gen.py | 43 - ...ne_migrate_to_virtual_machine_scale_set.py | 42 - ...ine_perform_maintenance_maximum_set_gen.py | 42 - ...ine_perform_maintenance_minimum_set_gen.py | 42 - ...rtual_machine_power_off_maximum_set_gen.py | 42 - ...rtual_machine_power_off_minimum_set_gen.py | 42 - .../virtual_machine_reapply.py | 42 - ...irtual_machine_redeploy_maximum_set_gen.py | 42 - ...irtual_machine_redeploy_minimum_set_gen.py | 42 - .../virtual_machine_reimage.py | 42 - ...rtual_machine_reimage_non_ephemeral_vms.py | 42 - ...virtual_machine_restart_maximum_set_gen.py | 42 - ...virtual_machine_restart_minimum_set_gen.py | 42 - ..._machine_retrieve_boot_diagnostics_data.py | 43 - .../virtual_machine_simulate_eviction.py | 42 - .../virtual_machine_start_maximum_set_gen.py | 42 - .../virtual_machine_start_minimum_set_gen.py | 42 - ...data_disk_using_to_be_detached_property.py | 79 - ...l_machine_update_force_detach_data_disk.py | 85 - ...ine_extension_image_get_maximum_set_gen.py | 45 - ...ine_extension_image_get_minimum_set_gen.py | 45 - ...ension_image_list_types_maximum_set_gen.py | 43 - ...ension_image_list_types_minimum_set_gen.py | 43 - ...ion_image_list_versions_maximum_set_gen.py | 44 - ...ion_image_list_versions_minimum_set_gen.py | 44 - ...rtual_machine_image_get_maximum_set_gen.py | 46 - ...rtual_machine_image_get_minimum_set_gen.py | 46 - ...tual_machine_image_list_maximum_set_gen.py | 45 - ...tual_machine_image_list_minimum_set_gen.py | 45 - ...chine_image_list_offers_maximum_set_gen.py | 43 - ...chine_image_list_offers_minimum_set_gen.py | 43 - ...e_image_list_publishers_maximum_set_gen.py | 42 - ...e_image_list_publishers_minimum_set_gen.py | 42 - ...machine_image_list_skus_maximum_set_gen.py | 44 - ...machine_image_list_skus_minimum_set_gen.py | 44 - ...ne_images_edge_zone_get_maximum_set_gen.py | 47 - ...ne_images_edge_zone_get_minimum_set_gen.py | 47 - ..._zone_list_by_edge_zone_maximum_set_gen.py | 43 - ..._zone_list_by_edge_zone_minimum_set_gen.py | 43 - ...e_images_edge_zone_list_maximum_set_gen.py | 46 - ...e_images_edge_zone_list_minimum_set_gen.py | 46 - ...s_edge_zone_list_offers_maximum_set_gen.py | 44 - ...s_edge_zone_list_offers_minimum_set_gen.py | 44 - ...ge_zone_list_publishers_maximum_set_gen.py | 43 - ...ge_zone_list_publishers_minimum_set_gen.py | 43 - ...ges_edge_zone_list_skus_maximum_set_gen.py | 45 - ...ges_edge_zone_list_skus_minimum_set_gen.py | 45 - ...es_list_with_properties_maximum_set_gen.py | 46 - ...es_list_with_properties_minimum_set_gen.py | 46 - ...chine_scale_set_approve_rolling_upgrade.py | 42 - ..._single_placement_group_maximum_set_gen.py | 43 - ..._diff_os_disk_using_diff_disk_placement.py | 94 - ..._using_diff_disk_placement_as_nvme_disk.py | 94 - ..._from_an_unmanaged_generalized_os_image.py | 89 - ...ine_scale_set_create_from_acustom_image.py | 89 - ...t_create_from_ageneralized_shared_image.py | 89 - ...t_create_from_aspecialized_shared_image.py | 84 - ...le_tcp_state_tracking_network_interface.py | 112 - ...create_from_with_fpga_network_interface.py | 110 - ...ith_network_interface_with_dns_settings.py | 126 - ..._platform_image_with_unmanaged_os_disks.py | 99 - ...set_create_with_amarketplace_image_plan.py | 93 - ...ale_set_create_with_application_profile.py | 107 - ...scale_set_create_with_automatic_repairs.py | 101 - ..._with_automatic_zone_rebalancing_policy.py | 99 - ...t_create_with_azure_application_gateway.py | 97 - ...ale_set_create_with_azure_load_balancer.py | 106 - ..._scale_set_create_with_boot_diagnostics.py | 98 - ...le_set_create_with_capacity_reservation.py | 97 - ...hine_scale_set_create_with_diff_os_disk.py | 94 - ...le_set_create_with_disk_controller_type.py | 103 - ...reate_with_disk_encryption_set_resource.py | 108 - ...create_with_empty_data_disks_on_each_vm.py | 97 - ...cale_set_create_with_encryption_at_host.py | 94 - ...th_extensions_suppress_failures_enabled.py | 113 - ..._set_create_with_extensions_time_budget.py | 113 - ..._with_high_speed_interconnect_placement.py | 102 - ...et_create_with_managed_boot_diagnostics.py | 93 - ...th_max_instance_percent_per_zone_policy.py | 95 - ...ne_scale_set_create_with_max_zone_count.py | 94 - ...e_with_os_image_scheduled_event_enabled.py | 95 - ...set_create_with_password_authentication.py | 92 - ...machine_scale_set_create_with_placement.py | 93 - ...e_scale_set_create_with_premium_storage.py | 92 - ...ale_set_create_with_priority_mix_policy.py | 99 - ..._with_protected_settings_from_key_vault.py | 118 - ...le_set_create_with_proxy_agent_settings.py | 100 - ...reate_with_resilient_vm_creation_policy.py | 93 - ...reate_with_resilient_vm_deletion_policy.py | 93 - ...e_scale_set_create_with_scale_in_policy.py | 93 - ..._create_with_security_posture_reference.py | 91 - ...eate_with_security_type_confidential_vm.py | 99 - ..._confidential_vm_with_non_persisted_tpm.py | 99 - ..._create_with_service_artifact_reference.py | 91 - ...chine_scale_set_create_with_sku_profile.py | 100 - ...set_create_with_sku_profile_prioritized.py | 104 - ...ale_set_create_with_spot_restore_policy.py | 96 - ...cale_set_create_with_ssh_authentication.py | 102 - ..._with_terminate_scheduled_event_enabled.py | 95 - ...ine_scale_set_create_with_uefi_settings.py | 96 - ...machine_scale_set_create_with_user_data.py | 93 - ...cale_set_create_with_vm_size_properties.py | 94 - ..._set_create_with_vms_in_different_zones.py | 98 - ..._zonal_platform_fault_domain_align_mode.py | 98 - ...ne_scale_set_deallocate_maximum_set_gen.py | 42 - ...ne_scale_set_deallocate_minimum_set_gen.py | 42 - .../virtual_machine_scale_set_delete_force.py | 42 - ...ension_create_or_update_maximum_set_gen.py | 59 - ...le_set_extension_delete_maximum_set_gen.py | 43 - ...le_set_extension_delete_minimum_set_gen.py | 43 - ...scale_set_extension_get_maximum_set_gen.py | 44 - ...scale_set_extension_get_minimum_set_gen.py | 44 - ...cale_set_extension_list_maximum_set_gen.py | 44 - ...cale_set_extension_list_minimum_set_gen.py | 44 - ...ine_scale_set_extension_rolling_upgrade.py | 42 - ...le_set_extension_update_maximum_set_gen.py | 58 - ...form_update_domain_walk_maximum_set_gen.py | 44 - ...form_update_domain_walk_minimum_set_gen.py | 44 - .../virtual_machine_scale_set_get.py | 43 - ...get_auto_placed_on_dedicated_host_group.py | 43 - ...e_set_get_instance_view_maximum_set_gen.py | 43 - ...e_set_get_instance_view_minimum_set_gen.py | 43 - ..._get_os_upgrade_history_maximum_set_gen.py | 44 - ..._get_os_upgrade_history_minimum_set_gen.py | 44 - ...scale_set_get_with_disk_controller_type.py | 43 - ...al_machine_scale_set_get_with_user_data.py | 43 - ...hine_scale_set_list_all_maximum_set_gen.py | 41 - ...hine_scale_set_list_all_minimum_set_gen.py | 41 - ...le_set_list_by_subscription_by_location.py | 43 - ..._machine_scale_set_list_maximum_set_gen.py | 43 - ..._machine_scale_set_list_minimum_set_gen.py | 43 - ...ine_scale_set_list_skus_maximum_set_gen.py | 44 - ...ine_scale_set_list_skus_minimum_set_gen.py | 44 - ...set_perform_maintenance_maximum_set_gen.py | 42 - ...set_perform_maintenance_minimum_set_gen.py | 42 - ...ine_scale_set_power_off_maximum_set_gen.py | 42 - ...ine_scale_set_power_off_minimum_set_gen.py | 42 - ...chine_scale_set_reapply_maximum_set_gen.py | 42 - ...chine_scale_set_reapply_minimum_set_gen.py | 42 - ...hine_scale_set_redeploy_maximum_set_gen.py | 42 - ...hine_scale_set_redeploy_minimum_set_gen.py | 42 - ...e_scale_set_reimage_all_maximum_set_gen.py | 42 - ...e_scale_set_reimage_all_minimum_set_gen.py | 42 - ...chine_scale_set_reimage_maximum_set_gen.py | 42 - ...chine_scale_set_reimage_minimum_set_gen.py | 42 - ...chine_scale_set_restart_maximum_set_gen.py | 42 - ...chine_scale_set_restart_minimum_set_gen.py | 42 - ..._rolling_upgrade_cancel_maximum_set_gen.py | 42 - ..._rolling_upgrade_cancel_minimum_set_gen.py | 42 - ...ling_upgrade_get_latest_maximum_set_gen.py | 43 - ...ling_upgrade_get_latest_minimum_set_gen.py | 43 - ...pgrade_start_os_upgrade_maximum_set_gen.py | 42 - ...pgrade_start_os_upgrade_minimum_set_gen.py | 42 - .../virtual_machine_scale_set_scale_out.py | 43 - ...estration_service_state_maximum_set_gen.py | 43 - ...estration_service_state_minimum_set_gen.py | 43 - ...machine_scale_set_start_maximum_set_gen.py | 42 - ...machine_scale_set_start_minimum_set_gen.py | 42 - ...achine_scale_set_update_maximum_set_gen.py | 271 - ...ne_scale_set_vm_approve_rolling_upgrade.py | 43 - ...ttach_detach_data_disks_maximum_set_gen.py | 76 - ...ttach_detach_data_disks_minimum_set_gen.py | 56 - ...scale_set_vm_deallocate_maximum_set_gen.py | 43 - ...scale_set_vm_deallocate_minimum_set_gen.py | 43 - ...rtual_machine_scale_set_vm_delete_force.py | 43 - ...l_machine_scale_set_vm_extension_create.py | 54 - ...l_machine_scale_set_vm_extension_delete.py | 44 - ...tual_machine_scale_set_vm_extension_get.py | 45 - ...ual_machine_scale_set_vm_extension_list.py | 44 - ...l_machine_scale_set_vm_extension_update.py | 54 - ...iew_auto_placed_on_dedicated_host_group.py | 44 - ...m_get_with_resilient_vm_deletion_status.py | 44 - ...machine_scale_set_vm_get_with_user_data.py | 44 - ...cale_set_vm_get_with_vm_size_properties.py | 44 - ...chine_scale_set_vm_list_maximum_set_gen.py | 44 - ...chine_scale_set_vm_list_minimum_set_gen.py | 44 - ..._scale_set_vm_list_with_resiliency_view.py | 44 - ..._vm_perform_maintenance_maximum_set_gen.py | 43 - ..._vm_perform_maintenance_minimum_set_gen.py | 43 - ..._scale_set_vm_power_off_maximum_set_gen.py | 43 - ..._scale_set_vm_power_off_minimum_set_gen.py | 43 - ...e_scale_set_vm_redeploy_maximum_set_gen.py | 43 - ...e_scale_set_vm_redeploy_minimum_set_gen.py | 43 - ...cale_set_vm_reimage_all_maximum_set_gen.py | 43 - ...cale_set_vm_reimage_all_minimum_set_gen.py | 43 - ...ne_scale_set_vm_reimage_maximum_set_gen.py | 43 - ...ne_scale_set_vm_reimage_minimum_set_gen.py | 43 - ...ne_scale_set_vm_restart_maximum_set_gen.py | 43 - ...ne_scale_set_vm_restart_minimum_set_gen.py | 43 - ...e_set_vm_retrieve_boot_diagnostics_data.py | 44 - ..._machine_scale_set_vm_simulate_eviction.py | 43 - ...hine_scale_set_vm_start_maximum_set_gen.py | 43 - ...hine_scale_set_vm_start_minimum_set_gen.py | 43 - ...ine_scale_set_vm_update_maximum_set_gen.py | 442 - ...ine_scale_set_vm_update_minimum_set_gen.py | 45 - .../generated_tests/conftest.py | 18 +- ...t_compute_availability_sets_operations.py} | 194 +- ...ute_availability_sets_operations_async.py} | 204 +- ...capacity_reservation_groups_operations.py} | 145 +- ...ty_reservation_groups_operations_async.py} | 145 +- ...mpute_capacity_reservations_operations.py} | 117 +- ...capacity_reservations_operations_async.py} | 117 +- ...compute_community_galleries_operations.py} | 9 +- ...e_community_galleries_operations_async.py} | 9 +- ...nity_gallery_image_versions_operations.py} | 24 +- ...allery_image_versions_operations_async.py} | 24 +- ...te_community_gallery_images_operations.py} | 24 +- ...munity_gallery_images_operations_async.py} | 24 +- ...mpute_dedicated_host_groups_operations.py} | 145 +- ...dedicated_host_groups_operations_async.py} | 145 +- ...est_compute_dedicated_hosts_operations.py} | 128 +- ...mpute_dedicated_hosts_operations_async.py} | 128 +- .../test_compute_disk_accesses_operations.py | 137 + ..._compute_disk_accesses_operations_async.py | 144 + ...ompute_disk_encryption_sets_operations.py} | 96 +- ..._disk_encryption_sets_operations_async.py} | 96 +- ...compute_disk_restore_points_operations.py} | 41 +- ...e_disk_restore_points_operations_async.py} | 41 +- ...nc.py => test_compute_disks_operations.py} | 187 +- .../test_compute_disks_operations_async.py | 251 + ...y => test_compute_galleries_operations.py} | 156 +- ...est_compute_galleries_operations_async.py} | 158 +- ...allery_application_versions_operations.py} | 136 +- ...y_application_versions_operations_async.py | 267 + ...ompute_gallery_applications_operations.py} | 131 +- ..._gallery_applications_operations_async.py} | 131 +- ...pute_gallery_image_versions_operations.py} | 192 +- ...gallery_image_versions_operations_async.py | 307 + ...test_compute_gallery_images_operations.py} | 107 +- ...ompute_gallery_images_operations_async.py} | 107 +- ...ss_control_profile_versions_operations.py} | 144 +- ...ntrol_profile_versions_operations_async.py | 203 + ..._vm_access_control_profiles_operations.py} | 39 +- ...cess_control_profiles_operations_async.py} | 39 +- ...s.py => test_compute_images_operations.py} | 139 +- ...> test_compute_images_operations_async.py} | 139 +- ...g_analytics_operation_group_operations.py} | 22 +- ...ytics_operation_group_operations_async.py} | 22 +- ...ud_service_operating_systems_operations.py | 65 - ...vice_operating_systems_operations_async.py | 66 - ...cloud_service_role_instances_operations.py | 122 - ...service_role_instances_operations_async.py | 131 - ...nagement_cloud_service_roles_operations.py | 44 - ...nt_cloud_service_roles_operations_async.py | 45 - ...te_management_cloud_services_operations.py | 172 - ...agement_cloud_services_operations_async.py | 191 - ...cloud_services_update_domain_operations.py | 57 - ...services_update_domain_operations_async.py | 60 - ...ute_management_disk_accesses_operations.py | 208 - ...nagement_disk_accesses_operations_async.py | 223 - ...est_compute_management_disks_operations.py | 250 - ...gallery_application_versions_operations.py | 253 - ...ement_gallery_image_versions_operations.py | 291 - ...ess_control_profile_versions_operations.py | 185 - ...ment_gallery_sharing_profile_operations.py | 32 - ...allery_sharing_profile_operations_async.py | 35 - ...nt_restore_point_collections_operations.py | 464 - ...tore_point_collections_operations_async.py | 467 - ...te_management_restore_points_operations.py | 229 - ...compute_management_snapshots_operations.py | 229 - ...gement_soft_deleted_resource_operations.py | 33 - ..._soft_deleted_resource_operations_async.py | 34 - ...virtual_machine_run_commands_operations.py | 200 - ...e_scale_set_rolling_upgrades_operations.py | 67 - ...e_set_rolling_upgrades_operations_async.py | 74 - ...hine_scale_set_vm_extensions_operations.py | 142 - ...ne_scale_set_vm_run_commands_operations.py | 182 - ...irtual_machine_scale_set_vms_operations.py | 691 - ...t_virtual_machine_scale_sets_operations.py | 873 - ..._management_virtual_machines_operations.py | 1229 - ...erations.py => test_compute_operations.py} | 12 +- ...nc.py => test_compute_operations_async.py} | 12 +- ...private_endpoint_connections_operations.py | 88 + ...e_endpoint_connections_operations_async.py | 93 + ..._proximity_placement_groups_operations.py} | 147 +- ...mity_placement_groups_operations_async.py} | 147 +- ... test_compute_resource_skus_operations.py} | 12 +- ...compute_resource_skus_operations_async.py} | 12 +- ...te_restore_point_collections_operations.py | 469 + ...tore_point_collections_operations_async.py | 472 + ...test_compute_restore_points_operations.py} | 76 +- ...compute_restore_points_operations_async.py | 236 + ...rolling_upgrade_status_infos_operations.py | 30 + ...g_upgrade_status_infos_operations_async.py | 31 + ...st_compute_shared_galleries_operations.py} | 24 +- ...pute_shared_galleries_operations_async.py} | 24 +- ...ared_gallery_image_versions_operations.py} | 24 +- ...allery_image_versions_operations_async.py} | 24 +- ...mpute_shared_gallery_images_operations.py} | 24 +- ...shared_gallery_images_operations_async.py} | 24 +- ...y => test_compute_snapshots_operations.py} | 177 +- ...test_compute_snapshots_operations_async.py | 230 + ...te_ssh_public_key_resources_operations.py} | 78 +- ..._public_key_resources_operations_async.py} | 78 +- ...mpute_usage_operation_group_operations.py} | 13 +- ...usage_operation_group_operations_async.py} | 13 +- ...al_machine_extension_images_operations.py} | 27 +- ...hine_extension_images_operations_async.py} | 27 +- ..._virtual_machine_extensions_operations.py} | 128 +- ...al_machine_extensions_operations_async.py} | 128 +- ...s_edge_zone_operation_group_operations.py} | 33 +- ..._zone_operation_group_operations_async.py} | 33 +- ...hine_images_operation_group_operations.py} | 47 +- ...mages_operation_group_operations_async.py} | 47 +- ...run_commands_operation_group_operations.py | 40 + ...mmands_operation_group_operations_async.py | 41 + ...irtual_machine_run_commands_operations.py} | 143 +- ...l_machine_run_commands_operations_async.py | 183 + ...achine_scale_set_extensions_operations.py} | 89 +- ..._scale_set_extensions_operations_async.py} | 89 +- ...ine_scale_set_vm_extensions_operations.py} | 108 +- ...cale_set_vm_extensions_operations_async.py | 150 + ...e_scale_set_vm_run_commands_operations.py} | 126 +- ...le_set_vm_run_commands_operations_async.py | 188 + ...rtual_machine_scale_set_vms_operations.py} | 602 +- ..._machine_scale_set_vms_operations_async.py | 731 + ...e_scale_sets_operation_group_operations.py | 29 + ...e_sets_operation_group_operations_async.py | 30 + ..._virtual_machine_scale_sets_operations.py} | 665 +- ...ual_machine_scale_sets_operations_async.py | 956 + ...achine_sizes_operation_group_operations.py | 29 + ..._sizes_operation_group_operations_async.py | 30 + ...al_machines_operation_group_operations.py} | 13 +- ...hines_operation_group_operations_async.py} | 13 +- ...st_compute_virtual_machines_operations.py} | 750 +- ...mpute_virtual_machines_operations_async.py | 1269 + sdk/compute/azure-mgmt-compute/pyproject.toml | 4 +- .../tests/test_mgmt_compute_disks.py | 1 + .../tests/test_mgmt_compute_galleries.py | 1 + .../tests/test_mgmt_compute_vm.py | 1 + .../tests/test_mgmt_compute_vmss.py | 1 + .../azure-mgmt-compute/tsp-location.yaml | 9 + 878 files changed, 125486 insertions(+), 164717 deletions(-) rename sdk/compute/azure-mgmt-compute/azure/mgmt/compute/{_compute_management_client.py => _client.py} (77%) create mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/_utils/model_base.py create mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/_utils/utils.py create mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/_validation.py rename sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/{_compute_management_client.py => _client.py} (77%) delete mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/operations/_availability_sets_operations.py delete mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/operations/_capacity_reservation_groups_operations.py delete mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/operations/_capacity_reservations_operations.py delete mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/operations/_cloud_service_operating_systems_operations.py delete mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/operations/_cloud_service_role_instances_operations.py delete mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/operations/_cloud_service_roles_operations.py delete mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/operations/_cloud_services_operations.py delete mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/operations/_cloud_services_update_domain_operations.py delete mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/operations/_community_galleries_operations.py delete mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/operations/_community_gallery_image_versions_operations.py delete mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/operations/_community_gallery_images_operations.py delete mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/operations/_dedicated_host_groups_operations.py delete mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/operations/_dedicated_hosts_operations.py delete mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/operations/_disk_accesses_operations.py delete mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/operations/_disk_encryption_sets_operations.py delete mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/operations/_disk_restore_point_operations.py delete mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/operations/_disks_operations.py delete mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/operations/_galleries_operations.py delete mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/operations/_gallery_application_versions_operations.py delete mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/operations/_gallery_applications_operations.py delete mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/operations/_gallery_image_versions_operations.py delete mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/operations/_gallery_images_operations.py delete mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/operations/_gallery_in_vm_access_control_profile_versions_operations.py delete mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/operations/_gallery_in_vm_access_control_profiles_operations.py delete mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/operations/_gallery_sharing_profile_operations.py delete mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/operations/_images_operations.py delete mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/operations/_log_analytics_operations.py delete mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/operations/_proximity_placement_groups_operations.py delete mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/operations/_resource_skus_operations.py delete mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/operations/_restore_point_collections_operations.py delete mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/operations/_restore_points_operations.py delete mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/operations/_shared_galleries_operations.py delete mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/operations/_shared_gallery_image_versions_operations.py delete mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/operations/_shared_gallery_images_operations.py delete mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/operations/_snapshots_operations.py delete mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/operations/_soft_deleted_resource_operations.py delete mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/operations/_ssh_public_keys_operations.py delete mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/operations/_usage_operations.py delete mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/operations/_virtual_machine_extension_images_operations.py delete mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/operations/_virtual_machine_extensions_operations.py delete mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/operations/_virtual_machine_images_edge_zone_operations.py delete mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/operations/_virtual_machine_images_operations.py delete mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/operations/_virtual_machine_run_commands_operations.py delete mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/operations/_virtual_machine_scale_set_extensions_operations.py delete mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/operations/_virtual_machine_scale_set_rolling_upgrades_operations.py delete mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/operations/_virtual_machine_scale_set_vm_extensions_operations.py delete mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/operations/_virtual_machine_scale_set_vm_run_commands_operations.py delete mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/operations/_virtual_machine_scale_set_vms_operations.py delete mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/operations/_virtual_machine_scale_sets_operations.py delete mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/operations/_virtual_machine_sizes_operations.py delete mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/operations/_virtual_machines_operations.py rename sdk/compute/azure-mgmt-compute/azure/mgmt/compute/models/{_compute_management_client_enums.py => _enums.py} (89%) create mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/models/_models.py delete mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/models/_models_py3.py delete mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/operations/_availability_sets_operations.py delete mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/operations/_capacity_reservation_groups_operations.py delete mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/operations/_capacity_reservations_operations.py delete mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/operations/_cloud_service_operating_systems_operations.py delete mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/operations/_cloud_service_role_instances_operations.py delete mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/operations/_cloud_service_roles_operations.py delete mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/operations/_cloud_services_operations.py delete mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/operations/_cloud_services_update_domain_operations.py delete mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/operations/_community_galleries_operations.py delete mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/operations/_community_gallery_image_versions_operations.py delete mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/operations/_community_gallery_images_operations.py delete mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/operations/_dedicated_host_groups_operations.py delete mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/operations/_dedicated_hosts_operations.py delete mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/operations/_disk_accesses_operations.py delete mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/operations/_disk_encryption_sets_operations.py delete mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/operations/_disk_restore_point_operations.py delete mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/operations/_disks_operations.py delete mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/operations/_galleries_operations.py delete mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/operations/_gallery_application_versions_operations.py delete mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/operations/_gallery_applications_operations.py delete mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/operations/_gallery_image_versions_operations.py delete mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/operations/_gallery_images_operations.py delete mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/operations/_gallery_in_vm_access_control_profile_versions_operations.py delete mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/operations/_gallery_in_vm_access_control_profiles_operations.py delete mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/operations/_gallery_sharing_profile_operations.py delete mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/operations/_images_operations.py delete mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/operations/_log_analytics_operations.py delete mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/operations/_proximity_placement_groups_operations.py delete mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/operations/_resource_skus_operations.py delete mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/operations/_restore_point_collections_operations.py delete mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/operations/_restore_points_operations.py delete mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/operations/_shared_galleries_operations.py delete mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/operations/_shared_gallery_image_versions_operations.py delete mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/operations/_shared_gallery_images_operations.py delete mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/operations/_snapshots_operations.py delete mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/operations/_soft_deleted_resource_operations.py delete mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/operations/_ssh_public_keys_operations.py delete mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/operations/_usage_operations.py delete mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/operations/_virtual_machine_extension_images_operations.py delete mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/operations/_virtual_machine_extensions_operations.py delete mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/operations/_virtual_machine_images_edge_zone_operations.py delete mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/operations/_virtual_machine_images_operations.py delete mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/operations/_virtual_machine_run_commands_operations.py delete mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/operations/_virtual_machine_scale_set_extensions_operations.py delete mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/operations/_virtual_machine_scale_set_rolling_upgrades_operations.py delete mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/operations/_virtual_machine_scale_set_vm_extensions_operations.py delete mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/operations/_virtual_machine_scale_set_vm_run_commands_operations.py delete mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/operations/_virtual_machine_scale_set_vms_operations.py delete mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/operations/_virtual_machine_scale_sets_operations.py delete mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/operations/_virtual_machine_sizes_operations.py delete mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/operations/_virtual_machines_operations.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/availability_set_examples/availability_set_cancel_migration_to_virtual_machine_scale_set.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/availability_set_examples/availability_set_convert_to_virtual_machine_scale_set.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/availability_set_examples/availability_set_create.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/availability_set_examples/availability_set_create_with_scheduled_event_profile.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/availability_set_examples/availability_set_delete_maximum_set_gen.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/availability_set_examples/availability_set_delete_minimum_set_gen.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/availability_set_examples/availability_set_get_maximum_set_gen.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/availability_set_examples/availability_set_get_minimum_set_gen.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/availability_set_examples/availability_set_list_available_sizes_maximum_set_gen.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/availability_set_examples/availability_set_list_available_sizes_minimum_set_gen.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/availability_set_examples/availability_set_list_by_subscription.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/availability_set_examples/availability_set_list_maximum_set_gen.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/availability_set_examples/availability_set_list_minimum_set_gen.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/availability_set_examples/availability_set_start_migration_to_virtual_machine_scale_set.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/availability_set_examples/availability_set_update_maximum_set_gen.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/availability_set_examples/availability_set_validate_migration_to_virtual_machine_scale_set.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/capacity_reservation_examples/block_capacity_reservation_create_or_update.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/capacity_reservation_examples/block_capacity_reservation_get.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/capacity_reservation_examples/block_capacity_reservation_group_create_or_update.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/capacity_reservation_examples/block_capacity_reservation_group_get.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/capacity_reservation_examples/block_capacity_reservation_list_by_reservation_group.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/capacity_reservation_examples/capacity_reservation_create_or_update.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/capacity_reservation_examples/capacity_reservation_delete_maximum_set_gen.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/capacity_reservation_examples/capacity_reservation_delete_minimum_set_gen.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/capacity_reservation_examples/capacity_reservation_get.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/capacity_reservation_examples/capacity_reservation_group_create_or_update.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/capacity_reservation_examples/capacity_reservation_group_delete_maximum_set_gen.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/capacity_reservation_examples/capacity_reservation_group_delete_minimum_set_gen.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/capacity_reservation_examples/capacity_reservation_group_get.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/capacity_reservation_examples/capacity_reservation_group_list_by_resource_group.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/capacity_reservation_examples/capacity_reservation_group_list_by_subscription.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/capacity_reservation_examples/capacity_reservation_group_list_by_subscription_with_resource_ids_query.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/capacity_reservation_examples/capacity_reservation_group_update_maximum_set_gen.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/capacity_reservation_examples/capacity_reservation_list_by_reservation_group.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/capacity_reservation_examples/capacity_reservation_update_maximum_set_gen.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/capacity_reservation_examples/targeted_capacity_reservation_create_or_update.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/capacity_reservation_examples/targeted_capacity_reservation_get.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/capacity_reservation_examples/targeted_capacity_reservation_group_create_or_update.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/capacity_reservation_examples/targeted_capacity_reservation_group_get.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/capacity_reservation_examples/targeted_capacity_reservation_list_by_reservation_group.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/cloud_service_create_with_multi_role.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/cloud_service_create_with_multi_role_with_zones.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/cloud_service_create_with_single_role.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/cloud_service_create_with_single_role_and_certificate.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/cloud_service_create_with_single_role_and_rdp.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/cloud_service_delete.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/cloud_service_get_instance_view_with_multi_role.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/cloud_service_get_with_multi_role_and_rdp.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/cloud_service_list_by_resource_group.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/cloud_service_list_by_subscription.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/cloud_service_os_families_list.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/cloud_service_os_family_get.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/cloud_service_os_version_get.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/cloud_service_os_version_list.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/cloud_service_power_off.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/cloud_service_role_get.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/cloud_service_role_instance_delete.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/cloud_service_role_instance_delete_by_cloud_service.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/cloud_service_role_instance_get.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/cloud_service_role_instance_get_instance_view.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/cloud_service_role_instance_get_remote_desktop_file.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/cloud_service_role_instance_rebuild.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/cloud_service_role_instance_rebuild_by_cloud_service.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/cloud_service_role_instance_reimage.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/cloud_service_role_instance_reimage_by_cloud_service.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/cloud_service_role_instance_restart.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/cloud_service_role_instance_restart_by_cloud_service.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/cloud_service_role_list.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/cloud_service_roles_instance_list.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/cloud_service_start.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/cloud_service_update_domain_get.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/cloud_service_update_domain_list.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/cloud_service_update_domain_update.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/cloud_service_update_to_include_tags.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/community_gallery_examples/community_gallery_get.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/community_gallery_examples/community_gallery_image_get.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/community_gallery_examples/community_gallery_image_list.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/community_gallery_examples/community_gallery_image_version_get.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/community_gallery_examples/community_gallery_image_version_list.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/compute_rp_common_examples/operations_list_maximum_set_gen.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/compute_rp_common_examples/operations_list_minimum_set_gen.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/compute_rp_common_examples/usage_list_maximum_set_gen.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/compute_rp_common_examples/usage_list_minimum_set_gen.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/compute_rp_common_examples/virtual_machine_sizes_list_maximum_set_gen.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/compute_rp_common_examples/virtual_machine_sizes_list_minimum_set_gen.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/dedicated_host_examples/dedicated_host_create_or_update.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/dedicated_host_examples/dedicated_host_delete_maximum_set_gen.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/dedicated_host_examples/dedicated_host_delete_minimum_set_gen.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/dedicated_host_examples/dedicated_host_get.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/dedicated_host_examples/dedicated_host_group_create_or_update.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/dedicated_host_examples/dedicated_host_group_create_or_update_with_ultra_ssd.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/dedicated_host_examples/dedicated_host_group_delete_maximum_set_gen.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/dedicated_host_examples/dedicated_host_group_delete_minimum_set_gen.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/dedicated_host_examples/dedicated_host_group_get.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/dedicated_host_examples/dedicated_host_group_get_ultra_ssd_enabled_dedicated_host_group.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/dedicated_host_examples/dedicated_host_group_list_by_resource_group_maximum_set_gen.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/dedicated_host_examples/dedicated_host_group_list_by_resource_group_minimum_set_gen.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/dedicated_host_examples/dedicated_host_group_list_by_subscription_maximum_set_gen.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/dedicated_host_examples/dedicated_host_group_list_by_subscription_minimum_set_gen.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/dedicated_host_examples/dedicated_host_group_update_maximum_set_gen.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/dedicated_host_examples/dedicated_host_list_available_sizes.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/dedicated_host_examples/dedicated_host_list_by_host_group_maximum_set_gen.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/dedicated_host_examples/dedicated_host_list_by_host_group_minimum_set_gen.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/dedicated_host_examples/dedicated_host_redeploy.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/dedicated_host_examples/dedicated_host_restart.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/dedicated_host_examples/dedicated_host_update_maximum_set_gen.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/dedicated_host_examples/dedicated_host_update_resize.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/disk_access_examples/disk_access_create.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/disk_access_examples/disk_access_delete.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/disk_access_examples/disk_access_get.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/disk_access_examples/disk_access_get_with_private_endpoints.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/disk_access_examples/disk_access_list_by_resource_group.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/disk_access_examples/disk_access_list_by_subscription.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/disk_access_examples/disk_access_private_endpoint_connection_approve.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/disk_access_examples/disk_access_private_endpoint_connection_delete.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/disk_access_examples/disk_access_private_endpoint_connection_get.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/disk_access_examples/disk_access_private_endpoint_connection_list_by_disk_access.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/disk_access_examples/disk_access_private_link_resources_get.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/disk_access_examples/disk_access_update.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/disk_encryption_set_examples/disk_encryption_set_create.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/disk_encryption_set_examples/disk_encryption_set_create_with_key_vault_from_adifferent_subscription.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/disk_encryption_set_examples/disk_encryption_set_create_with_key_vault_from_adifferent_tenant.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/disk_encryption_set_examples/disk_encryption_set_delete.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/disk_encryption_set_examples/disk_encryption_set_get.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/disk_encryption_set_examples/disk_encryption_set_get_with_auto_key_rotation_error.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/disk_encryption_set_examples/disk_encryption_set_list_associated_resources.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/disk_encryption_set_examples/disk_encryption_set_list_by_resource_group.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/disk_encryption_set_examples/disk_encryption_set_list_by_subscription.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/disk_encryption_set_examples/disk_encryption_set_update.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/disk_encryption_set_examples/disk_encryption_set_update_with_rotation_to_latest_key_version_enabled.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/disk_encryption_set_examples/disk_encryption_set_update_with_rotation_to_latest_key_version_enabled_in_progress.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/disk_examples/disk_begin_get_access.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/disk_examples/disk_begin_get_access_with_vm_guest_state.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/disk_examples/disk_begin_get_access_with_vm_guest_state_and_vm_metadata.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/disk_examples/disk_create_by_copying_asnapshot.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/disk_examples/disk_create_by_importing_blob_from_adifferent_subscription.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/disk_examples/disk_create_by_importing_blob_from_the_same_subscription.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/disk_examples/disk_create_confidential_vm_supported_disk_encrypted_with_cmk.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/disk_examples/disk_create_empty.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/disk_examples/disk_create_from_an_azure_compute_gallery_community_image.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/disk_examples/disk_create_from_an_azure_compute_gallery_direct_shared_image.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/disk_examples/disk_create_from_an_azure_compute_gallery_image.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/disk_examples/disk_create_from_an_elastic_san_volume_snapshot.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/disk_examples/disk_create_from_an_existing_managed_disk.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/disk_examples/disk_create_from_aplatform_image.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/disk_examples/disk_create_from_import_secure.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/disk_examples/disk_create_from_import_secure_with_vm_metadata.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/disk_examples/disk_create_from_upload_prepared_secure.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/disk_examples/disk_create_in_extended_location.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/disk_examples/disk_create_or_update_availability_policy.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/disk_examples/disk_create_or_update_bursting_enabled.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/disk_examples/disk_create_performance_plus.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/disk_examples/disk_create_upload_disk.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/disk_examples/disk_create_with_data_access_auth_mode.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/disk_examples/disk_create_with_disk_access.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/disk_examples/disk_create_with_disk_encryption_set.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/disk_examples/disk_create_with_logical_sector_size.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/disk_examples/disk_create_with_optimized_for_frequent_attach.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/disk_examples/disk_create_with_premium_v2_lrsaccount_type.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/disk_examples/disk_create_with_security_profile.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/disk_examples/disk_create_with_ssdzrs_account_type.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/disk_examples/disk_create_with_ultra_ssd_read_only.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/disk_examples/disk_delete.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/disk_examples/disk_end_get_access.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/disk_examples/disk_get.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/disk_examples/disk_list_by_resource_group.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/disk_examples/disk_list_by_subscription.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/disk_examples/disk_update_add_accelerated_networking.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/disk_examples/disk_update_add_disk_controller_types.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/disk_examples/disk_update_add_purchase_plan.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/disk_examples/disk_update_add_supports_hibernation.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/disk_examples/disk_update_change_tier.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/disk_examples/disk_update_disable_bursting.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/disk_examples/disk_update_disable_optimized_for_frequent_attach.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/disk_examples/disk_update_remove_disk_access.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/disk_examples/disk_update_to_add_architecture.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/disk_restore_point_examples/disk_restore_point_begin_get_access.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/disk_restore_point_examples/disk_restore_point_end_get_access.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/disk_restore_point_examples/disk_restore_point_get.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/disk_restore_point_examples/disk_restore_point_get_when_source_resource_is_from_different_region.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/disk_restore_point_examples/disk_restore_point_list_by_vm_restore_point.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/gallery_examples/community_gallery_create.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/gallery_examples/community_gallery_get.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/gallery_examples/gallery_add_to_sharing_profile.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/gallery_examples/gallery_application_create.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/gallery_examples/gallery_application_delete.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/gallery_examples/gallery_application_get.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/gallery_examples/gallery_application_list_by_gallery.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/gallery_examples/gallery_application_update.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/gallery_examples/gallery_application_version_create.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/gallery_examples/gallery_application_version_delete.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/gallery_examples/gallery_application_version_get.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/gallery_examples/gallery_application_version_get_with_replication_status.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/gallery_examples/gallery_application_version_list_by_gallery_application.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/gallery_examples/gallery_application_version_update.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/gallery_examples/gallery_create.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/gallery_examples/gallery_create_soft_deletion_enabled.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/gallery_examples/gallery_create_with_managed_identity.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/gallery_examples/gallery_create_with_sharing_profile.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/gallery_examples/gallery_delete.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/gallery_examples/gallery_enable_community_gallery.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/gallery_examples/gallery_get.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/gallery_examples/gallery_get_with_expand_sharing_profile_groups.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/gallery_examples/gallery_get_with_managed_identity.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/gallery_examples/gallery_get_with_select_permissions.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/gallery_examples/gallery_image_create.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/gallery_examples/gallery_image_delete.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/gallery_examples/gallery_image_get.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/gallery_examples/gallery_image_list_by_gallery.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/gallery_examples/gallery_image_update.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/gallery_examples/gallery_image_update_features.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/gallery_examples/gallery_image_version_create.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/gallery_examples/gallery_image_version_create_with_additional_replica_sets.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/gallery_examples/gallery_image_version_create_with_community_image_version_as_source.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/gallery_examples/gallery_image_version_create_with_image_version_as_source.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/gallery_examples/gallery_image_version_create_with_shallow_replication_mode.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/gallery_examples/gallery_image_version_create_with_snapshots_as_source.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/gallery_examples/gallery_image_version_create_with_target_extended_locations.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/gallery_examples/gallery_image_version_create_with_vhd.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/gallery_examples/gallery_image_version_create_with_vhd_uefi_settings.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/gallery_examples/gallery_image_version_create_with_vm_as_source.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/gallery_examples/gallery_image_version_delete.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/gallery_examples/gallery_image_version_get.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/gallery_examples/gallery_image_version_get_with_replication_status.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/gallery_examples/gallery_image_version_get_with_snapshots_as_source.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/gallery_examples/gallery_image_version_get_with_validation_profile.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/gallery_examples/gallery_image_version_get_with_validation_profile_and_replication_status.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/gallery_examples/gallery_image_version_get_with_vhd_as_source.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/gallery_examples/gallery_image_version_list_by_gallery_image.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/gallery_examples/gallery_image_version_update.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/gallery_examples/gallery_image_version_update_restore_soft_deleted.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/gallery_examples/gallery_image_version_update_without_source_id.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/gallery_examples/gallery_list_by_resource_group.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/gallery_examples/gallery_list_by_subscription.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/gallery_examples/gallery_reset_sharing_profile.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/gallery_examples/gallery_soft_deleted_resource_list_by_artifact_name.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/gallery_examples/gallery_update.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/gallery_resource_profile_examples/gallery_in_vm_access_control_profile_delete.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/gallery_resource_profile_examples/gallery_in_vm_access_control_profile_get.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/gallery_resource_profile_examples/gallery_in_vm_access_control_profile_list_by_gallery.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/gallery_resource_profile_examples/gallery_in_vm_access_control_profile_version_delete.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/gallery_resource_profile_examples/gallery_in_vm_access_control_profile_version_get.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/gallery_resource_profile_examples/gallery_in_vm_access_control_profile_version_list_by_gallery_in_vm_access_control_profile.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/image_examples/image_create_data_disk_from_ablob_included.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/image_examples/image_create_data_disk_from_amanaged_disk_included.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/image_examples/image_create_data_disk_from_asnapshot_included.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/image_examples/image_create_from_ablob.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/image_examples/image_create_from_ablob_with_disk_encryption_set.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/image_examples/image_create_from_amanaged_disk.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/image_examples/image_create_from_amanaged_disk_with_disk_encryption_set.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/image_examples/image_create_from_asnapshot.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/image_examples/image_create_from_asnapshot_with_disk_encryption_set.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/image_examples/image_create_from_avm.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/image_examples/image_get.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/image_examples/image_list_by_resource_group.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/image_examples/image_list_by_subscription.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/image_examples/image_update.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/image_examples/images_delete_maximum_set_gen.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/image_examples/images_delete_minimum_set_gen.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/log_analytic_examples/log_analytics_request_rate_by_interval.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/log_analytic_examples/log_analytics_throttled_requests.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/proximity_placement_group_examples/proximity_placement_group_create_or_update.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/proximity_placement_group_examples/proximity_placement_group_delete.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/proximity_placement_group_examples/proximity_placement_group_get.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/proximity_placement_group_examples/proximity_placement_group_list_by_resource_group.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/proximity_placement_group_examples/proximity_placement_group_list_by_subscription.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/proximity_placement_group_examples/proximity_placement_group_patch.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/restore_point_examples/restore_point_collection_create_or_update.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/restore_point_examples/restore_point_collection_create_or_update_for_cross_region_copy.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/restore_point_examples/restore_point_collection_delete_maximum_set_gen.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/restore_point_examples/restore_point_collection_delete_minimum_set_gen.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/restore_point_examples/restore_point_collection_get.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/restore_point_examples/restore_point_collection_get_with_contained_restore_points.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/restore_point_examples/restore_point_collection_list_by_resource_group.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/restore_point_examples/restore_point_collection_list_by_subscription.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/restore_point_examples/restore_point_collection_update_maximum_set_gen.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/restore_point_examples/restore_point_copy_between_regions.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/restore_point_examples/restore_point_create.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/restore_point_examples/restore_point_delete_maximum_set_gen.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/restore_point_examples/restore_point_delete_minimum_set_gen.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/restore_point_examples/restore_point_get.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/restore_point_examples/restore_point_get_with_instance_view.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/run_command_examples/run_command_get.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/run_command_examples/run_command_list.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/run_command_examples/virtual_machine_run_command.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/run_command_examples/virtual_machine_run_command_create_or_update.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/run_command_examples/virtual_machine_run_command_delete.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/run_command_examples/virtual_machine_run_command_get.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/run_command_examples/virtual_machine_run_command_list.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/run_command_examples/virtual_machine_run_command_update.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/run_command_examples/virtual_machine_scale_set_vm_run_command.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/run_command_examples/virtual_machine_scale_set_vm_run_command_create_or_update.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/run_command_examples/virtual_machine_scale_set_vm_run_command_delete.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/run_command_examples/virtual_machine_scale_set_vm_run_command_get.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/run_command_examples/virtual_machine_scale_set_vm_run_command_list.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/run_command_examples/virtual_machine_scale_set_vm_run_command_update.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/shared_gallery_examples/shared_gallery_get.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/shared_gallery_examples/shared_gallery_image_get.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/shared_gallery_examples/shared_gallery_image_version_get.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/shared_gallery_examples/shared_gallery_image_versions_list.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/shared_gallery_examples/shared_gallery_images_list.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/shared_gallery_examples/shared_gallery_list.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/skus/list_available_resource_skus.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/skus/list_available_resource_skus_for_aregion.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/skus/list_available_resource_skus_with_extended_locations.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/snapshot_examples/snapshot_begin_get_access.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/snapshot_examples/snapshot_create_by_importing_an_unmanaged_blob_from_adifferent_subscription.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/snapshot_examples/snapshot_create_by_importing_an_unmanaged_blob_from_the_same_subscription.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/snapshot_examples/snapshot_create_enhanced_provisioned_bandwidth_copy_speed.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/snapshot_examples/snapshot_create_from_an_elastic_san_volume_snapshot.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/snapshot_examples/snapshot_create_from_an_existing_snapshot.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/snapshot_examples/snapshot_create_from_an_existing_snapshot_in_different_region.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/snapshot_examples/snapshot_create_instant_access_snapshot.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/snapshot_examples/snapshot_delete.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/snapshot_examples/snapshot_end_get_access.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/snapshot_examples/snapshot_get.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/snapshot_examples/snapshot_get_incremental_snapshot.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/snapshot_examples/snapshot_list_by_resource_group.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/snapshot_examples/snapshot_list_by_subscription.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/snapshot_examples/snapshot_update.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/snapshot_examples/snapshot_update_with_accelerated_network.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/ssh_public_key_examples/ssh_public_key_create.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/ssh_public_key_examples/ssh_public_key_delete_maximum_set_gen.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/ssh_public_key_examples/ssh_public_key_delete_minimum_set_gen.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/ssh_public_key_examples/ssh_public_key_generate_key_pair.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/ssh_public_key_examples/ssh_public_key_generate_key_pair_encryption_with_ed25519.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/ssh_public_key_examples/ssh_public_key_generate_key_pair_encryption_with_rsa.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/ssh_public_key_examples/ssh_public_key_get.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/ssh_public_key_examples/ssh_public_key_list_by_resource_group_maximum_set_gen.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/ssh_public_key_examples/ssh_public_key_list_by_resource_group_minimum_set_gen.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/ssh_public_key_examples/ssh_public_key_list_by_subscription_maximum_set_gen.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/ssh_public_key_examples/ssh_public_key_list_by_subscription_minimum_set_gen.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/ssh_public_key_examples/ssh_public_key_update_maximum_set_gen.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_assess_patches.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_attach_detach_data_disks_maximum_set_gen.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_attach_detach_data_disks_minimum_set_gen.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_capture_maximum_set_gen.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_capture_minimum_set_gen.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_convert_to_managed_disks_maximum_set_gen.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_convert_to_managed_disks_minimum_set_gen.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_custom_image_vm_from_an_unmanaged_generalized_os_image.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_from_acommunity_gallery_image.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_from_acustom_image.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_from_ageneralized_shared_image.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_from_ashared_gallery_image.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_from_aspecialized_shared_image.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_in_an_availability_set.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_in_avmss_with_customer_assigned_platform_fault_domain.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_linux_vm_with_automatic_by_platform_settings.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_linux_vm_with_patch_setting_assessment_mode_of_image_default.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_linux_vm_with_patch_setting_mode_of_image_default.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_linux_vm_with_patch_setting_modes_of_automatic_by_platform.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_platform_image_vm_with_unmanaged_os_and_data_disks.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_windows_vm_with_automatic_by_platform_settings.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_windows_vm_with_patch_setting_assessment_mode_of_image_default.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_windows_vm_with_patch_setting_mode_of_automatic_by_os.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_windows_vm_with_patch_setting_mode_of_automatic_by_platform_and_enable_hot_patching_true.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_windows_vm_with_patch_setting_mode_of_manual.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_windows_vm_with_patch_setting_modes_of_automatic_by_platform.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_with_adiff_os_disk.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_with_adiff_os_disk_using_diff_disk_placement_as_cache_disk.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_with_adiff_os_disk_using_diff_disk_placement_as_nvme_disk.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_with_adiff_os_disk_using_diff_disk_placement_as_resource_disk.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_with_amarketplace_image_plan.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_with_application_profile.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_with_boot_diagnostics.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_with_capacity_reservation.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_with_data_disks_from_source_resource.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_with_disk_controller_type.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_with_disk_encryption_set_resource.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_with_empty_data_disks.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_with_encryption_at_host.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_with_encryption_identity.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_with_extensions_time_budget.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_with_hibernation_enabled.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_with_managed_boot_diagnostics.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_with_network_interface_configuration.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_with_network_interface_configuration_dns_settings.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_with_password_authentication.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_with_placement.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_with_premium_storage.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_with_proxy_agent_settings.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_with_scheduled_events_profile.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_with_security_type_confidential_vm.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_with_security_type_confidential_vm_with_customer_managed_keys.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_with_security_type_confidential_vm_with_non_persisted_tpm.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_with_ssh_authentication.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_with_uefi_settings.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_with_user_data.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_with_vm_size_properties.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_deallocate_maximum_set_gen.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_deallocate_minimum_set_gen.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_delete_force.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_extension_create_or_update_maximum_set_gen.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_extension_create_or_update_minimum_set_gen.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_extension_delete_maximum_set_gen.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_extension_delete_minimum_set_gen.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_extension_get_maximum_set_gen.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_extension_get_minimum_set_gen.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_extension_list_maximum_set_gen.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_extension_list_minimum_set_gen.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_extension_update.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_generalize.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_get.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_get_auto_placed_on_dedicated_host_group.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_get_instance_view.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_get_instance_view_auto_placed_on_dedicated_host_group.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_get_with_disk_controller_type.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_get_with_vm_size_properties.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_install_patches.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_list_all_maximum_set_gen.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_list_all_minimum_set_gen.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_list_available_vm_sizes.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_list_by_subscription_by_location.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_list_maximum_set_gen.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_list_minimum_set_gen.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_migrate_to_virtual_machine_scale_set.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_perform_maintenance_maximum_set_gen.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_perform_maintenance_minimum_set_gen.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_power_off_maximum_set_gen.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_power_off_minimum_set_gen.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_reapply.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_redeploy_maximum_set_gen.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_redeploy_minimum_set_gen.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_reimage.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_reimage_non_ephemeral_vms.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_restart_maximum_set_gen.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_restart_minimum_set_gen.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_retrieve_boot_diagnostics_data.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_simulate_eviction.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_start_maximum_set_gen.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_start_minimum_set_gen.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_update_detach_data_disk_using_to_be_detached_property.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_update_force_detach_data_disk.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_extension_image_examples/virtual_machine_extension_image_get_maximum_set_gen.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_extension_image_examples/virtual_machine_extension_image_get_minimum_set_gen.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_extension_image_examples/virtual_machine_extension_image_list_types_maximum_set_gen.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_extension_image_examples/virtual_machine_extension_image_list_types_minimum_set_gen.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_extension_image_examples/virtual_machine_extension_image_list_versions_maximum_set_gen.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_extension_image_examples/virtual_machine_extension_image_list_versions_minimum_set_gen.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_image_examples/virtual_machine_image_get_maximum_set_gen.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_image_examples/virtual_machine_image_get_minimum_set_gen.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_image_examples/virtual_machine_image_list_maximum_set_gen.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_image_examples/virtual_machine_image_list_minimum_set_gen.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_image_examples/virtual_machine_image_list_offers_maximum_set_gen.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_image_examples/virtual_machine_image_list_offers_minimum_set_gen.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_image_examples/virtual_machine_image_list_publishers_maximum_set_gen.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_image_examples/virtual_machine_image_list_publishers_minimum_set_gen.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_image_examples/virtual_machine_image_list_skus_maximum_set_gen.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_image_examples/virtual_machine_image_list_skus_minimum_set_gen.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_image_examples/virtual_machine_images_edge_zone_get_maximum_set_gen.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_image_examples/virtual_machine_images_edge_zone_get_minimum_set_gen.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_image_examples/virtual_machine_images_edge_zone_list_by_edge_zone_maximum_set_gen.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_image_examples/virtual_machine_images_edge_zone_list_by_edge_zone_minimum_set_gen.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_image_examples/virtual_machine_images_edge_zone_list_maximum_set_gen.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_image_examples/virtual_machine_images_edge_zone_list_minimum_set_gen.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_image_examples/virtual_machine_images_edge_zone_list_offers_maximum_set_gen.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_image_examples/virtual_machine_images_edge_zone_list_offers_minimum_set_gen.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_image_examples/virtual_machine_images_edge_zone_list_publishers_maximum_set_gen.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_image_examples/virtual_machine_images_edge_zone_list_publishers_minimum_set_gen.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_image_examples/virtual_machine_images_edge_zone_list_skus_maximum_set_gen.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_image_examples/virtual_machine_images_edge_zone_list_skus_minimum_set_gen.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_image_examples/virtual_machine_images_list_with_properties_maximum_set_gen.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_image_examples/virtual_machine_images_list_with_properties_minimum_set_gen.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_approve_rolling_upgrade.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_convert_to_single_placement_group_maximum_set_gen.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_a_with_diff_os_disk_using_diff_disk_placement.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_a_with_diff_os_disk_using_diff_disk_placement_as_nvme_disk.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_custom_image_from_an_unmanaged_generalized_os_image.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_from_acustom_image.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_from_ageneralized_shared_image.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_from_aspecialized_shared_image.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_from_with_disable_tcp_state_tracking_network_interface.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_from_with_fpga_network_interface.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_from_with_network_interface_with_dns_settings.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_platform_image_with_unmanaged_os_disks.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_amarketplace_image_plan.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_application_profile.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_automatic_repairs.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_automatic_zone_rebalancing_policy.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_azure_application_gateway.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_azure_load_balancer.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_boot_diagnostics.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_capacity_reservation.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_diff_os_disk.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_disk_controller_type.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_disk_encryption_set_resource.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_empty_data_disks_on_each_vm.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_encryption_at_host.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_extensions_suppress_failures_enabled.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_extensions_time_budget.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_high_speed_interconnect_placement.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_managed_boot_diagnostics.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_max_instance_percent_per_zone_policy.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_max_zone_count.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_os_image_scheduled_event_enabled.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_password_authentication.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_placement.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_premium_storage.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_priority_mix_policy.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_protected_settings_from_key_vault.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_proxy_agent_settings.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_resilient_vm_creation_policy.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_resilient_vm_deletion_policy.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_scale_in_policy.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_security_posture_reference.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_security_type_confidential_vm.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_security_type_confidential_vm_with_non_persisted_tpm.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_service_artifact_reference.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_sku_profile.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_sku_profile_prioritized.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_spot_restore_policy.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_ssh_authentication.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_terminate_scheduled_event_enabled.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_uefi_settings.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_user_data.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_vm_size_properties.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_vms_in_different_zones.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_zonal_platform_fault_domain_align_mode.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_deallocate_maximum_set_gen.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_deallocate_minimum_set_gen.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_delete_force.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_extension_create_or_update_maximum_set_gen.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_extension_delete_maximum_set_gen.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_extension_delete_minimum_set_gen.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_extension_get_maximum_set_gen.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_extension_get_minimum_set_gen.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_extension_list_maximum_set_gen.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_extension_list_minimum_set_gen.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_extension_rolling_upgrade.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_extension_update_maximum_set_gen.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_force_recovery_service_fabric_platform_update_domain_walk_maximum_set_gen.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_force_recovery_service_fabric_platform_update_domain_walk_minimum_set_gen.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_get.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_get_auto_placed_on_dedicated_host_group.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_get_instance_view_maximum_set_gen.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_get_instance_view_minimum_set_gen.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_get_os_upgrade_history_maximum_set_gen.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_get_os_upgrade_history_minimum_set_gen.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_get_with_disk_controller_type.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_get_with_user_data.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_list_all_maximum_set_gen.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_list_all_minimum_set_gen.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_list_by_subscription_by_location.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_list_maximum_set_gen.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_list_minimum_set_gen.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_list_skus_maximum_set_gen.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_list_skus_minimum_set_gen.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_perform_maintenance_maximum_set_gen.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_perform_maintenance_minimum_set_gen.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_power_off_maximum_set_gen.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_power_off_minimum_set_gen.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_reapply_maximum_set_gen.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_reapply_minimum_set_gen.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_redeploy_maximum_set_gen.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_redeploy_minimum_set_gen.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_reimage_all_maximum_set_gen.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_reimage_all_minimum_set_gen.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_reimage_maximum_set_gen.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_reimage_minimum_set_gen.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_restart_maximum_set_gen.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_restart_minimum_set_gen.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_rolling_upgrade_cancel_maximum_set_gen.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_rolling_upgrade_cancel_minimum_set_gen.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_rolling_upgrade_get_latest_maximum_set_gen.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_rolling_upgrade_get_latest_minimum_set_gen.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_rolling_upgrade_start_os_upgrade_maximum_set_gen.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_rolling_upgrade_start_os_upgrade_minimum_set_gen.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_scale_out.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_set_orchestration_service_state_maximum_set_gen.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_set_orchestration_service_state_minimum_set_gen.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_start_maximum_set_gen.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_start_minimum_set_gen.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_update_maximum_set_gen.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_approve_rolling_upgrade.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_attach_detach_data_disks_maximum_set_gen.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_attach_detach_data_disks_minimum_set_gen.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_deallocate_maximum_set_gen.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_deallocate_minimum_set_gen.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_delete_force.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_extension_create.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_extension_delete.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_extension_get.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_extension_list.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_extension_update.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_get_instance_view_auto_placed_on_dedicated_host_group.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_get_with_resilient_vm_deletion_status.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_get_with_user_data.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_get_with_vm_size_properties.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_list_maximum_set_gen.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_list_minimum_set_gen.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_list_with_resiliency_view.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_perform_maintenance_maximum_set_gen.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_perform_maintenance_minimum_set_gen.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_power_off_maximum_set_gen.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_power_off_minimum_set_gen.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_redeploy_maximum_set_gen.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_redeploy_minimum_set_gen.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_reimage_all_maximum_set_gen.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_reimage_all_minimum_set_gen.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_reimage_maximum_set_gen.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_reimage_minimum_set_gen.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_restart_maximum_set_gen.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_restart_minimum_set_gen.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_retrieve_boot_diagnostics_data.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_simulate_eviction.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_start_maximum_set_gen.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_start_minimum_set_gen.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_update_maximum_set_gen.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_update_minimum_set_gen.py rename sdk/compute/azure-mgmt-compute/generated_tests/{test_compute_management_availability_sets_operations.py => test_compute_availability_sets_operations.py} (63%) rename sdk/compute/azure-mgmt-compute/generated_tests/{test_compute_management_availability_sets_operations_async.py => test_compute_availability_sets_operations_async.py} (64%) rename sdk/compute/azure-mgmt-compute/generated_tests/{test_compute_management_capacity_reservation_groups_operations.py => test_compute_capacity_reservation_groups_operations.py} (58%) rename sdk/compute/azure-mgmt-compute/generated_tests/{test_compute_management_capacity_reservation_groups_operations_async.py => test_compute_capacity_reservation_groups_operations_async.py} (59%) rename sdk/compute/azure-mgmt-compute/generated_tests/{test_compute_management_capacity_reservations_operations.py => test_compute_capacity_reservations_operations.py} (63%) rename sdk/compute/azure-mgmt-compute/generated_tests/{test_compute_management_capacity_reservations_operations_async.py => test_compute_capacity_reservations_operations_async.py} (63%) rename sdk/compute/azure-mgmt-compute/generated_tests/{test_compute_management_community_galleries_operations.py => test_compute_community_galleries_operations.py} (77%) rename sdk/compute/azure-mgmt-compute/generated_tests/{test_compute_management_community_galleries_operations_async.py => test_compute_community_galleries_operations_async.py} (76%) rename sdk/compute/azure-mgmt-compute/generated_tests/{test_compute_management_community_gallery_image_versions_operations.py => test_compute_community_gallery_image_versions_operations.py} (81%) rename sdk/compute/azure-mgmt-compute/generated_tests/{test_compute_management_community_gallery_image_versions_operations_async.py => test_compute_community_gallery_image_versions_operations_async.py} (81%) rename sdk/compute/azure-mgmt-compute/generated_tests/{test_compute_management_community_gallery_images_operations.py => test_compute_community_gallery_images_operations.py} (80%) rename sdk/compute/azure-mgmt-compute/generated_tests/{test_compute_management_community_gallery_images_operations_async.py => test_compute_community_gallery_images_operations_async.py} (80%) rename sdk/compute/azure-mgmt-compute/generated_tests/{test_compute_management_dedicated_host_groups_operations.py => test_compute_dedicated_host_groups_operations.py} (59%) rename sdk/compute/azure-mgmt-compute/generated_tests/{test_compute_management_dedicated_host_groups_operations_async.py => test_compute_dedicated_host_groups_operations_async.py} (60%) rename sdk/compute/azure-mgmt-compute/generated_tests/{test_compute_management_dedicated_hosts_operations.py => test_compute_dedicated_hosts_operations.py} (69%) rename sdk/compute/azure-mgmt-compute/generated_tests/{test_compute_management_dedicated_hosts_operations_async.py => test_compute_dedicated_hosts_operations_async.py} (68%) create mode 100644 sdk/compute/azure-mgmt-compute/generated_tests/test_compute_disk_accesses_operations.py create mode 100644 sdk/compute/azure-mgmt-compute/generated_tests/test_compute_disk_accesses_operations_async.py rename sdk/compute/azure-mgmt-compute/generated_tests/{test_compute_management_disk_encryption_sets_operations.py => test_compute_disk_encryption_sets_operations.py} (74%) rename sdk/compute/azure-mgmt-compute/generated_tests/{test_compute_management_disk_encryption_sets_operations_async.py => test_compute_disk_encryption_sets_operations_async.py} (74%) rename sdk/compute/azure-mgmt-compute/generated_tests/{test_compute_management_disk_restore_point_operations.py => test_compute_disk_restore_points_operations.py} (65%) rename sdk/compute/azure-mgmt-compute/generated_tests/{test_compute_management_disk_restore_point_operations_async.py => test_compute_disk_restore_points_operations_async.py} (66%) rename sdk/compute/azure-mgmt-compute/generated_tests/{test_compute_management_disks_operations_async.py => test_compute_disks_operations.py} (67%) create mode 100644 sdk/compute/azure-mgmt-compute/generated_tests/test_compute_disks_operations_async.py rename sdk/compute/azure-mgmt-compute/generated_tests/{test_compute_management_galleries_operations.py => test_compute_galleries_operations.py} (55%) rename sdk/compute/azure-mgmt-compute/generated_tests/{test_compute_management_galleries_operations_async.py => test_compute_galleries_operations_async.py} (56%) rename sdk/compute/azure-mgmt-compute/generated_tests/{test_compute_management_gallery_application_versions_operations_async.py => test_compute_gallery_application_versions_operations.py} (77%) create mode 100644 sdk/compute/azure-mgmt-compute/generated_tests/test_compute_gallery_application_versions_operations_async.py rename sdk/compute/azure-mgmt-compute/generated_tests/{test_compute_management_gallery_applications_operations.py => test_compute_gallery_applications_operations.py} (62%) rename sdk/compute/azure-mgmt-compute/generated_tests/{test_compute_management_gallery_applications_operations_async.py => test_compute_gallery_applications_operations_async.py} (61%) rename sdk/compute/azure-mgmt-compute/generated_tests/{test_compute_management_gallery_image_versions_operations_async.py => test_compute_gallery_image_versions_operations.py} (80%) create mode 100644 sdk/compute/azure-mgmt-compute/generated_tests/test_compute_gallery_image_versions_operations_async.py rename sdk/compute/azure-mgmt-compute/generated_tests/{test_compute_management_gallery_images_operations.py => test_compute_gallery_images_operations.py} (62%) rename sdk/compute/azure-mgmt-compute/generated_tests/{test_compute_management_gallery_images_operations_async.py => test_compute_gallery_images_operations_async.py} (62%) rename sdk/compute/azure-mgmt-compute/generated_tests/{test_compute_management_gallery_in_vm_access_control_profile_versions_operations_async.py => test_compute_gallery_in_vm_access_control_profile_versions_operations.py} (66%) create mode 100644 sdk/compute/azure-mgmt-compute/generated_tests/test_compute_gallery_in_vm_access_control_profile_versions_operations_async.py rename sdk/compute/azure-mgmt-compute/generated_tests/{test_compute_management_gallery_in_vm_access_control_profiles_operations.py => test_compute_gallery_in_vm_access_control_profiles_operations.py} (88%) rename sdk/compute/azure-mgmt-compute/generated_tests/{test_compute_management_gallery_in_vm_access_control_profiles_operations_async.py => test_compute_gallery_in_vm_access_control_profiles_operations_async.py} (88%) rename sdk/compute/azure-mgmt-compute/generated_tests/{test_compute_management_images_operations.py => test_compute_images_operations.py} (65%) rename sdk/compute/azure-mgmt-compute/generated_tests/{test_compute_management_images_operations_async.py => test_compute_images_operations_async.py} (65%) rename sdk/compute/azure-mgmt-compute/generated_tests/{test_compute_management_log_analytics_operations.py => test_compute_log_analytics_operation_group_operations.py} (73%) rename sdk/compute/azure-mgmt-compute/generated_tests/{test_compute_management_log_analytics_operations_async.py => test_compute_log_analytics_operation_group_operations_async.py} (74%) delete mode 100644 sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_cloud_service_operating_systems_operations.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_cloud_service_operating_systems_operations_async.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_cloud_service_role_instances_operations.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_cloud_service_role_instances_operations_async.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_cloud_service_roles_operations.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_cloud_service_roles_operations_async.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_cloud_services_operations.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_cloud_services_operations_async.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_cloud_services_update_domain_operations.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_cloud_services_update_domain_operations_async.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_disk_accesses_operations.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_disk_accesses_operations_async.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_disks_operations.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_gallery_application_versions_operations.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_gallery_image_versions_operations.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_gallery_in_vm_access_control_profile_versions_operations.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_gallery_sharing_profile_operations.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_gallery_sharing_profile_operations_async.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_restore_point_collections_operations.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_restore_point_collections_operations_async.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_restore_points_operations.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_snapshots_operations.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_soft_deleted_resource_operations.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_soft_deleted_resource_operations_async.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_virtual_machine_run_commands_operations.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_virtual_machine_scale_set_rolling_upgrades_operations.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_virtual_machine_scale_set_rolling_upgrades_operations_async.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_virtual_machine_scale_set_vm_extensions_operations.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_virtual_machine_scale_set_vm_run_commands_operations.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_virtual_machine_scale_set_vms_operations.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_virtual_machine_scale_sets_operations.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_virtual_machines_operations.py rename sdk/compute/azure-mgmt-compute/generated_tests/{test_compute_management_operations.py => test_compute_operations.py} (72%) rename sdk/compute/azure-mgmt-compute/generated_tests/{test_compute_management_operations_async.py => test_compute_operations_async.py} (72%) create mode 100644 sdk/compute/azure-mgmt-compute/generated_tests/test_compute_private_endpoint_connections_operations.py create mode 100644 sdk/compute/azure-mgmt-compute/generated_tests/test_compute_private_endpoint_connections_operations_async.py rename sdk/compute/azure-mgmt-compute/generated_tests/{test_compute_management_proximity_placement_groups_operations.py => test_compute_proximity_placement_groups_operations.py} (61%) rename sdk/compute/azure-mgmt-compute/generated_tests/{test_compute_management_proximity_placement_groups_operations_async.py => test_compute_proximity_placement_groups_operations_async.py} (61%) rename sdk/compute/azure-mgmt-compute/generated_tests/{test_compute_management_resource_skus_operations.py => test_compute_resource_skus_operations.py} (72%) rename sdk/compute/azure-mgmt-compute/generated_tests/{test_compute_management_resource_skus_operations_async.py => test_compute_resource_skus_operations_async.py} (71%) create mode 100644 sdk/compute/azure-mgmt-compute/generated_tests/test_compute_restore_point_collections_operations.py create mode 100644 sdk/compute/azure-mgmt-compute/generated_tests/test_compute_restore_point_collections_operations_async.py rename sdk/compute/azure-mgmt-compute/generated_tests/{test_compute_management_restore_points_operations_async.py => test_compute_restore_points_operations.py} (84%) create mode 100644 sdk/compute/azure-mgmt-compute/generated_tests/test_compute_restore_points_operations_async.py create mode 100644 sdk/compute/azure-mgmt-compute/generated_tests/test_compute_rolling_upgrade_status_infos_operations.py create mode 100644 sdk/compute/azure-mgmt-compute/generated_tests/test_compute_rolling_upgrade_status_infos_operations_async.py rename sdk/compute/azure-mgmt-compute/generated_tests/{test_compute_management_shared_galleries_operations.py => test_compute_shared_galleries_operations.py} (80%) rename sdk/compute/azure-mgmt-compute/generated_tests/{test_compute_management_shared_galleries_operations_async.py => test_compute_shared_galleries_operations_async.py} (79%) rename sdk/compute/azure-mgmt-compute/generated_tests/{test_compute_management_shared_gallery_image_versions_operations.py => test_compute_shared_gallery_image_versions_operations.py} (81%) rename sdk/compute/azure-mgmt-compute/generated_tests/{test_compute_management_shared_gallery_image_versions_operations_async.py => test_compute_shared_gallery_image_versions_operations_async.py} (81%) rename sdk/compute/azure-mgmt-compute/generated_tests/{test_compute_management_shared_gallery_images_operations.py => test_compute_shared_gallery_images_operations.py} (80%) rename sdk/compute/azure-mgmt-compute/generated_tests/{test_compute_management_shared_gallery_images_operations_async.py => test_compute_shared_gallery_images_operations_async.py} (80%) rename sdk/compute/azure-mgmt-compute/generated_tests/{test_compute_management_snapshots_operations_async.py => test_compute_snapshots_operations.py} (64%) create mode 100644 sdk/compute/azure-mgmt-compute/generated_tests/test_compute_snapshots_operations_async.py rename sdk/compute/azure-mgmt-compute/generated_tests/{test_compute_management_ssh_public_keys_operations.py => test_compute_ssh_public_key_resources_operations.py} (65%) rename sdk/compute/azure-mgmt-compute/generated_tests/{test_compute_management_ssh_public_keys_operations_async.py => test_compute_ssh_public_key_resources_operations_async.py} (65%) rename sdk/compute/azure-mgmt-compute/generated_tests/{test_compute_management_usage_operations.py => test_compute_usage_operation_group_operations.py} (70%) rename sdk/compute/azure-mgmt-compute/generated_tests/{test_compute_management_usage_operations_async.py => test_compute_usage_operation_group_operations_async.py} (70%) rename sdk/compute/azure-mgmt-compute/generated_tests/{test_compute_management_virtual_machine_extension_images_operations.py => test_compute_virtual_machine_extension_images_operations.py} (82%) rename sdk/compute/azure-mgmt-compute/generated_tests/{test_compute_management_virtual_machine_extension_images_operations_async.py => test_compute_virtual_machine_extension_images_operations_async.py} (82%) rename sdk/compute/azure-mgmt-compute/generated_tests/{test_compute_management_virtual_machine_extensions_operations.py => test_compute_virtual_machine_extensions_operations.py} (60%) rename sdk/compute/azure-mgmt-compute/generated_tests/{test_compute_management_virtual_machine_extensions_operations_async.py => test_compute_virtual_machine_extensions_operations_async.py} (59%) rename sdk/compute/azure-mgmt-compute/generated_tests/{test_compute_management_virtual_machine_images_edge_zone_operations.py => test_compute_virtual_machine_images_edge_zone_operation_group_operations.py} (62%) rename sdk/compute/azure-mgmt-compute/generated_tests/{test_compute_management_virtual_machine_images_edge_zone_operations_async.py => test_compute_virtual_machine_images_edge_zone_operation_group_operations_async.py} (71%) rename sdk/compute/azure-mgmt-compute/generated_tests/{test_compute_management_virtual_machine_images_operations.py => test_compute_virtual_machine_images_operation_group_operations.py} (62%) rename sdk/compute/azure-mgmt-compute/generated_tests/{test_compute_management_virtual_machine_images_operations_async.py => test_compute_virtual_machine_images_operation_group_operations_async.py} (61%) create mode 100644 sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machine_run_commands_operation_group_operations.py create mode 100644 sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machine_run_commands_operation_group_operations_async.py rename sdk/compute/azure-mgmt-compute/generated_tests/{test_compute_management_virtual_machine_run_commands_operations_async.py => test_compute_virtual_machine_run_commands_operations.py} (61%) create mode 100644 sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machine_run_commands_operations_async.py rename sdk/compute/azure-mgmt-compute/generated_tests/{test_compute_management_virtual_machine_scale_set_extensions_operations.py => test_compute_virtual_machine_scale_set_extensions_operations.py} (67%) rename sdk/compute/azure-mgmt-compute/generated_tests/{test_compute_management_virtual_machine_scale_set_extensions_operations_async.py => test_compute_virtual_machine_scale_set_extensions_operations_async.py} (67%) rename sdk/compute/azure-mgmt-compute/generated_tests/{test_compute_management_virtual_machine_scale_set_vm_extensions_operations_async.py => test_compute_virtual_machine_scale_set_vm_extensions_operations.py} (61%) create mode 100644 sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machine_scale_set_vm_extensions_operations_async.py rename sdk/compute/azure-mgmt-compute/generated_tests/{test_compute_management_virtual_machine_scale_set_vm_run_commands_operations_async.py => test_compute_virtual_machine_scale_set_vm_run_commands_operations.py} (65%) create mode 100644 sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machine_scale_set_vm_run_commands_operations_async.py rename sdk/compute/azure-mgmt-compute/generated_tests/{test_compute_management_virtual_machine_scale_set_vms_operations_async.py => test_compute_virtual_machine_scale_set_vms_operations.py} (60%) create mode 100644 sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machine_scale_set_vms_operations_async.py create mode 100644 sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machine_scale_sets_operation_group_operations.py create mode 100644 sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machine_scale_sets_operation_group_operations_async.py rename sdk/compute/azure-mgmt-compute/generated_tests/{test_compute_management_virtual_machine_scale_sets_operations_async.py => test_compute_virtual_machine_scale_sets_operations.py} (63%) create mode 100644 sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machine_scale_sets_operations_async.py create mode 100644 sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machine_sizes_operation_group_operations.py create mode 100644 sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machine_sizes_operation_group_operations_async.py rename sdk/compute/azure-mgmt-compute/generated_tests/{test_compute_management_virtual_machine_sizes_operations.py => test_compute_virtual_machines_operation_group_operations.py} (69%) rename sdk/compute/azure-mgmt-compute/generated_tests/{test_compute_management_virtual_machine_sizes_operations_async.py => test_compute_virtual_machines_operation_group_operations_async.py} (69%) rename sdk/compute/azure-mgmt-compute/generated_tests/{test_compute_management_virtual_machines_operations_async.py => test_compute_virtual_machines_operations.py} (72%) create mode 100644 sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machines_operations_async.py create mode 100644 sdk/compute/azure-mgmt-compute/tsp-location.yaml diff --git a/eng/tools/azure-sdk-tools/packaging_tools/sdk_generator.py b/eng/tools/azure-sdk-tools/packaging_tools/sdk_generator.py index 9c7e1b03935f..a0a3073bcbc2 100644 --- a/eng/tools/azure-sdk-tools/packaging_tools/sdk_generator.py +++ b/eng/tools/azure-sdk-tools/packaging_tools/sdk_generator.py @@ -368,7 +368,7 @@ def main(generate_input, generate_output): changelog_generation_start_time = time.time() try: if data.get("enableChangelog", True): - md_output = execute_func_with_timeout(change_log_func) + md_output = execute_func_with_timeout(change_log_func, timeout=3600) else: md_output = "skip changelog generation" except multiprocessing.TimeoutError: diff --git a/sdk/compute/azure-mgmt-compute/CHANGELOG.md b/sdk/compute/azure-mgmt-compute/CHANGELOG.md index 6bcddf970e28..3c4dd04dc68b 100644 --- a/sdk/compute/azure-mgmt-compute/CHANGELOG.md +++ b/sdk/compute/azure-mgmt-compute/CHANGELOG.md @@ -1,5 +1,631 @@ # Release History +## 38.0.0 (2025-10-11) + +### Features Added + + - Model `AvailabilitySetUpdate` added property `properties` + - Model `CapacityReservationGroupUpdate` added property `properties` + - Model `CapacityReservationUpdate` added property `properties` + - Model `CommunityGallery` added property `identifier` + - Model `CommunityGalleryImageVersion` added property `identifier` + - Model `DedicatedHostGroupUpdate` added property `properties` + - Model `DedicatedHostUpdate` added property `properties` + - Model `DiskEncryptionSet` added property `properties` + - Model `GalleryApplicationUpdate` added property `properties` + - Model `GalleryApplicationVersionUpdate` added property `properties` + - Model `GalleryImageUpdate` added property `properties` + - Model `GalleryImageVersionUpdate` added property `properties` + - Model `GalleryInVMAccessControlProfileVersion` added property `properties` + - Model `GalleryInVMAccessControlProfileVersionUpdate` added property `properties` + - Model `GalleryUpdate` added property `properties` + - Model `ImageUpdate` added property `properties` + - Enum `NetworkApiVersion` added member `ENUM_2020_11_01` + - Enum `NetworkApiVersion` added member `ENUM_2022_11_01` + - Model `PirCommunityGalleryResource` added property `identifier` + - Model `PirSharedGalleryResource` added property `identifier` + - Model `ResourceSkuRestrictions` added property `values_property` + - Model `RestorePointCollectionUpdate` added property `properties` + - Model `SharedGallery` added property `identifier` + - Model `SharedGalleryImageVersion` added property `identifier` + - Model `SshPublicKeyUpdateResource` added property `properties` + - Model `Usage` added property `unit` + - Model `UserArtifactManage` added property `update_property` + - Model `VirtualMachineRunCommandUpdate` added property `properties` + - Model `VirtualMachineScaleSetExtension` added property `vm_type` + - Model `VirtualMachineScaleSetExtensionUpdate` added property `properties` + - Model `VirtualMachineScaleSetVMExtension` added property `properties` + - Model `VirtualMachineScaleSetVMExtension` added property `vm_type` + - Model `VirtualMachineScaleSetVMExtensionUpdate` added property `properties` + - Model `VirtualMachineUpdate` added property `properties` + - Added model `ApproveRollingUpgradeParameterBody` + - Added model `CloudError` + - Added model `CommunityGalleryIdentifier` + - Added model `ConvertToVirtualMachineScaleSetParameterBody` + - Added model `DeallocateParameterBody` + - Added model `EncryptionSetProperties` + - Added model `GenerateKeyPairParameterBody` + - Added model `MigrateToVmScaleSetParameterBody` + - Added model `OkResponse` + - Added enum `PassNames` + - Added model `PerformMaintenanceParameterBody` + - Added model `PowerOffParameterBody` + - Added model `RedeployParameterBody` + - Added model `ReimageAllParameterBody` + - Added model `ReimageParameterBody` + - Added model `ReimageParameterBody1` + - Added model `ReimageParameterBody2` + - Added model `RestartParameterBody` + - Added model `SharedGalleryIdentifier` + - Added model `StartParameterBody` + - Model `GalleriesOperations` added method `begin_gallery_sharing_profile_update` + - Model `GalleriesOperations` added method `list_by_artifact_name` + - Model `VirtualMachineScaleSetsOperations` added parameter `etag` in method `begin_create_or_update` + - Model `VirtualMachineScaleSetsOperations` added parameter `match_condition` in method `begin_create_or_update` + - Model `VirtualMachineScaleSetsOperations` added parameter `etag` in method `begin_update` + - Model `VirtualMachineScaleSetsOperations` added parameter `match_condition` in method `begin_update` + - Model `VirtualMachineScaleSetsOperations` added method `begin_cancel` + - Model `VirtualMachineScaleSetsOperations` added method `begin_start_extension_upgrade` + - Model `VirtualMachineScaleSetsOperations` added method `begin_start_os_upgrade` + - Model `VirtualMachinesOperations` added parameter `etag` in method `begin_create_or_update` + - Model `VirtualMachinesOperations` added parameter `match_condition` in method `begin_create_or_update` + - Model `VirtualMachinesOperations` added parameter `etag` in method `begin_update` + - Model `VirtualMachinesOperations` added parameter `match_condition` in method `begin_update` + - Added model `DiskRestorePointsOperations` + - Added model `LogAnalyticsOperationGroupOperations` + - Added model `PrivateEndpointConnectionsOperations` + - Added model `RollingUpgradeStatusInfosOperations` + - Added model `SshPublicKeyResourcesOperations` + - Added model `UsageOperationGroupOperations` + - Added model `VirtualMachineImagesEdgeZoneOperationGroupOperations` + - Added model `VirtualMachineImagesOperationGroupOperations` + - Added model `VirtualMachineRunCommandsOperationGroupOperations` + - Added model `VirtualMachineScaleSetVMSOperations` + - Added model `VirtualMachineScaleSetsOperationGroupOperations` + - Added model `VirtualMachineSizesOperationGroupOperations` + - Added model `VirtualMachinesOperationGroupOperations` + +### Breaking Changes + + - Deleted or renamed client `ComputeManagementClient` + - Method `VirtualMachineExtensionsOperations.list` changed from `asynchronous` to `synchronous` + - Method `VirtualMachineScaleSetVMExtensionsOperations.list` changed from `asynchronous` to `synchronous` + - Model `AvailabilitySetUpdate` deleted or renamed its instance variable `platform_update_domain_count` + - Model `AvailabilitySetUpdate` deleted or renamed its instance variable `platform_fault_domain_count` + - Model `AvailabilitySetUpdate` deleted or renamed its instance variable `virtual_machines` + - Model `AvailabilitySetUpdate` deleted or renamed its instance variable `proximity_placement_group` + - Model `AvailabilitySetUpdate` deleted or renamed its instance variable `statuses` + - Model `AvailabilitySetUpdate` deleted or renamed its instance variable `scheduled_events_policy` + - Model `AvailabilitySetUpdate` deleted or renamed its instance variable `virtual_machine_scale_set_migration_info` + - Model `CapacityReservationGroupUpdate` deleted or renamed its instance variable `capacity_reservations` + - Model `CapacityReservationGroupUpdate` deleted or renamed its instance variable `virtual_machines_associated` + - Model `CapacityReservationGroupUpdate` deleted or renamed its instance variable `instance_view` + - Model `CapacityReservationGroupUpdate` deleted or renamed its instance variable `sharing_profile` + - Model `CapacityReservationGroupUpdate` deleted or renamed its instance variable `reservation_type` + - Model `CapacityReservationUpdate` deleted or renamed its instance variable `reservation_id` + - Model `CapacityReservationUpdate` deleted or renamed its instance variable `platform_fault_domain_count` + - Model `CapacityReservationUpdate` deleted or renamed its instance variable `virtual_machines_associated` + - Model `CapacityReservationUpdate` deleted or renamed its instance variable `provisioning_time` + - Model `CapacityReservationUpdate` deleted or renamed its instance variable `provisioning_state` + - Model `CapacityReservationUpdate` deleted or renamed its instance variable `instance_view` + - Model `CapacityReservationUpdate` deleted or renamed its instance variable `time_created` + - Model `CapacityReservationUpdate` deleted or renamed its instance variable `schedule_profile` + - Model `DedicatedHostGroupUpdate` deleted or renamed its instance variable `platform_fault_domain_count` + - Model `DedicatedHostGroupUpdate` deleted or renamed its instance variable `hosts` + - Model `DedicatedHostGroupUpdate` deleted or renamed its instance variable `instance_view` + - Model `DedicatedHostGroupUpdate` deleted or renamed its instance variable `support_automatic_placement` + - Model `DedicatedHostGroupUpdate` deleted or renamed its instance variable `additional_capabilities` + - Model `DedicatedHostUpdate` deleted or renamed its instance variable `platform_fault_domain` + - Model `DedicatedHostUpdate` deleted or renamed its instance variable `auto_replace_on_failure` + - Model `DedicatedHostUpdate` deleted or renamed its instance variable `host_id` + - Model `DedicatedHostUpdate` deleted or renamed its instance variable `virtual_machines` + - Model `DedicatedHostUpdate` deleted or renamed its instance variable `license_type` + - Model `DedicatedHostUpdate` deleted or renamed its instance variable `provisioning_time` + - Model `DedicatedHostUpdate` deleted or renamed its instance variable `provisioning_state` + - Model `DedicatedHostUpdate` deleted or renamed its instance variable `instance_view` + - Model `DedicatedHostUpdate` deleted or renamed its instance variable `time_created` + - Model `DiskEncryptionSet` deleted or renamed its instance variable `encryption_type` + - Model `DiskEncryptionSet` deleted or renamed its instance variable `active_key` + - Model `DiskEncryptionSet` deleted or renamed its instance variable `previous_keys` + - Model `DiskEncryptionSet` deleted or renamed its instance variable `provisioning_state` + - Model `DiskEncryptionSet` deleted or renamed its instance variable `rotation_to_latest_key_version_enabled` + - Model `DiskEncryptionSet` deleted or renamed its instance variable `last_key_rotation_timestamp` + - Model `DiskEncryptionSet` deleted or renamed its instance variable `auto_key_rotation_error` + - Model `DiskEncryptionSet` deleted or renamed its instance variable `federated_client_id` + - Model `GalleryApplicationUpdate` deleted or renamed its instance variable `description` + - Model `GalleryApplicationUpdate` deleted or renamed its instance variable `eula` + - Model `GalleryApplicationUpdate` deleted or renamed its instance variable `privacy_statement_uri` + - Model `GalleryApplicationUpdate` deleted or renamed its instance variable `release_note_uri` + - Model `GalleryApplicationUpdate` deleted or renamed its instance variable `end_of_life_date` + - Model `GalleryApplicationUpdate` deleted or renamed its instance variable `supported_os_type` + - Model `GalleryApplicationUpdate` deleted or renamed its instance variable `custom_actions` + - Model `GalleryApplicationVersionUpdate` deleted or renamed its instance variable `publishing_profile` + - Model `GalleryApplicationVersionUpdate` deleted or renamed its instance variable `safety_profile` + - Model `GalleryApplicationVersionUpdate` deleted or renamed its instance variable `provisioning_state` + - Model `GalleryApplicationVersionUpdate` deleted or renamed its instance variable `replication_status` + - Model `GalleryImageUpdate` deleted or renamed its instance variable `description` + - Model `GalleryImageUpdate` deleted or renamed its instance variable `eula` + - Model `GalleryImageUpdate` deleted or renamed its instance variable `privacy_statement_uri` + - Model `GalleryImageUpdate` deleted or renamed its instance variable `release_note_uri` + - Model `GalleryImageUpdate` deleted or renamed its instance variable `os_type` + - Model `GalleryImageUpdate` deleted or renamed its instance variable `os_state` + - Model `GalleryImageUpdate` deleted or renamed its instance variable `hyper_v_generation` + - Model `GalleryImageUpdate` deleted or renamed its instance variable `end_of_life_date` + - Model `GalleryImageUpdate` deleted or renamed its instance variable `identifier` + - Model `GalleryImageUpdate` deleted or renamed its instance variable `recommended` + - Model `GalleryImageUpdate` deleted or renamed its instance variable `disallowed` + - Model `GalleryImageUpdate` deleted or renamed its instance variable `purchase_plan` + - Model `GalleryImageUpdate` deleted or renamed its instance variable `provisioning_state` + - Model `GalleryImageUpdate` deleted or renamed its instance variable `features` + - Model `GalleryImageUpdate` deleted or renamed its instance variable `architecture` + - Model `GalleryImageUpdate` deleted or renamed its instance variable `allow_update_image` + - Model `GalleryImageVersionUpdate` deleted or renamed its instance variable `publishing_profile` + - Model `GalleryImageVersionUpdate` deleted or renamed its instance variable `provisioning_state` + - Model `GalleryImageVersionUpdate` deleted or renamed its instance variable `storage_profile` + - Model `GalleryImageVersionUpdate` deleted or renamed its instance variable `safety_profile` + - Model `GalleryImageVersionUpdate` deleted or renamed its instance variable `replication_status` + - Model `GalleryImageVersionUpdate` deleted or renamed its instance variable `security_profile` + - Model `GalleryImageVersionUpdate` deleted or renamed its instance variable `restore` + - Model `GalleryImageVersionUpdate` deleted or renamed its instance variable `validations_profile` + - Model `GalleryInVMAccessControlProfileVersion` deleted or renamed its instance variable `target_locations` + - Model `GalleryInVMAccessControlProfileVersion` deleted or renamed its instance variable `exclude_from_latest` + - Model `GalleryInVMAccessControlProfileVersion` deleted or renamed its instance variable `published_date` + - Model `GalleryInVMAccessControlProfileVersion` deleted or renamed its instance variable `provisioning_state` + - Model `GalleryInVMAccessControlProfileVersion` deleted or renamed its instance variable `replication_status` + - Model `GalleryInVMAccessControlProfileVersion` deleted or renamed its instance variable `mode` + - Model `GalleryInVMAccessControlProfileVersion` deleted or renamed its instance variable `default_access` + - Model `GalleryInVMAccessControlProfileVersion` deleted or renamed its instance variable `rules` + - Model `GalleryInVMAccessControlProfileVersionUpdate` deleted or renamed its instance variable `target_locations` + - Model `GalleryInVMAccessControlProfileVersionUpdate` deleted or renamed its instance variable `exclude_from_latest` + - Model `GalleryInVMAccessControlProfileVersionUpdate` deleted or renamed its instance variable `published_date` + - Model `GalleryInVMAccessControlProfileVersionUpdate` deleted or renamed its instance variable `provisioning_state` + - Model `GalleryInVMAccessControlProfileVersionUpdate` deleted or renamed its instance variable `replication_status` + - Model `GalleryInVMAccessControlProfileVersionUpdate` deleted or renamed its instance variable `mode` + - Model `GalleryInVMAccessControlProfileVersionUpdate` deleted or renamed its instance variable `default_access` + - Model `GalleryInVMAccessControlProfileVersionUpdate` deleted or renamed its instance variable `rules` + - Model `GalleryUpdate` deleted or renamed its instance variable `description` + - Model `GalleryUpdate` deleted or renamed its instance variable `identifier` + - Model `GalleryUpdate` deleted or renamed its instance variable `provisioning_state` + - Model `GalleryUpdate` deleted or renamed its instance variable `sharing_profile` + - Model `GalleryUpdate` deleted or renamed its instance variable `soft_delete_policy` + - Model `GalleryUpdate` deleted or renamed its instance variable `sharing_status` + - Model `ImageUpdate` deleted or renamed its instance variable `source_virtual_machine` + - Model `ImageUpdate` deleted or renamed its instance variable `storage_profile` + - Model `ImageUpdate` deleted or renamed its instance variable `provisioning_state` + - Model `ImageUpdate` deleted or renamed its instance variable `hyper_v_generation` + - Deleted or renamed enum value `NetworkApiVersion.TWO_THOUSAND_TWENTY11_01` + - Deleted or renamed enum value `NetworkApiVersion.TWO_THOUSAND_TWENTY_TWO11_01` + - Model `PirCommunityGalleryResource` deleted or renamed its instance variable `unique_id` + - Model `PirSharedGalleryResource` deleted or renamed its instance variable `unique_id` + - Model `ResourceSkuRestrictions` deleted or renamed its instance variable `values` + - Model `RestorePointCollectionUpdate` deleted or renamed its instance variable `source` + - Model `RestorePointCollectionUpdate` deleted or renamed its instance variable `provisioning_state` + - Model `RestorePointCollectionUpdate` deleted or renamed its instance variable `restore_point_collection_id` + - Model `RestorePointCollectionUpdate` deleted or renamed its instance variable `restore_points` + - Model `SshPublicKeyUpdateResource` deleted or renamed its instance variable `public_key` + - Model `UserArtifactManage` deleted or renamed its instance variable `update` + - Model `VirtualMachineRunCommandUpdate` deleted or renamed its instance variable `source` + - Model `VirtualMachineRunCommandUpdate` deleted or renamed its instance variable `parameters` + - Model `VirtualMachineRunCommandUpdate` deleted or renamed its instance variable `protected_parameters` + - Model `VirtualMachineRunCommandUpdate` deleted or renamed its instance variable `async_execution` + - Model `VirtualMachineRunCommandUpdate` deleted or renamed its instance variable `run_as_user` + - Model `VirtualMachineRunCommandUpdate` deleted or renamed its instance variable `run_as_password` + - Model `VirtualMachineRunCommandUpdate` deleted or renamed its instance variable `timeout_in_seconds` + - Model `VirtualMachineRunCommandUpdate` deleted or renamed its instance variable `output_blob_uri` + - Model `VirtualMachineRunCommandUpdate` deleted or renamed its instance variable `error_blob_uri` + - Model `VirtualMachineRunCommandUpdate` deleted or renamed its instance variable `output_blob_managed_identity` + - Model `VirtualMachineRunCommandUpdate` deleted or renamed its instance variable `error_blob_managed_identity` + - Model `VirtualMachineRunCommandUpdate` deleted or renamed its instance variable `provisioning_state` + - Model `VirtualMachineRunCommandUpdate` deleted or renamed its instance variable `instance_view` + - Model `VirtualMachineRunCommandUpdate` deleted or renamed its instance variable `treat_failure_as_deployment_failure` + - Model `VirtualMachineScaleSetExtensionUpdate` deleted or renamed its instance variable `force_update_tag` + - Model `VirtualMachineScaleSetExtensionUpdate` deleted or renamed its instance variable `publisher` + - Model `VirtualMachineScaleSetExtensionUpdate` deleted or renamed its instance variable `type_properties_type` + - Model `VirtualMachineScaleSetExtensionUpdate` deleted or renamed its instance variable `type_handler_version` + - Model `VirtualMachineScaleSetExtensionUpdate` deleted or renamed its instance variable `auto_upgrade_minor_version` + - Model `VirtualMachineScaleSetExtensionUpdate` deleted or renamed its instance variable `enable_automatic_upgrade` + - Model `VirtualMachineScaleSetExtensionUpdate` deleted or renamed its instance variable `settings` + - Model `VirtualMachineScaleSetExtensionUpdate` deleted or renamed its instance variable `protected_settings` + - Model `VirtualMachineScaleSetExtensionUpdate` deleted or renamed its instance variable `provisioning_state` + - Model `VirtualMachineScaleSetExtensionUpdate` deleted or renamed its instance variable `provision_after_extensions` + - Model `VirtualMachineScaleSetExtensionUpdate` deleted or renamed its instance variable `suppress_failures` + - Model `VirtualMachineScaleSetExtensionUpdate` deleted or renamed its instance variable `protected_settings_from_key_vault` + - Model `VirtualMachineScaleSetVMExtension` deleted or renamed its instance variable `type` + - Model `VirtualMachineScaleSetVMExtension` deleted or renamed its instance variable `force_update_tag` + - Model `VirtualMachineScaleSetVMExtension` deleted or renamed its instance variable `publisher` + - Model `VirtualMachineScaleSetVMExtension` deleted or renamed its instance variable `type_properties_type` + - Model `VirtualMachineScaleSetVMExtension` deleted or renamed its instance variable `type_handler_version` + - Model `VirtualMachineScaleSetVMExtension` deleted or renamed its instance variable `auto_upgrade_minor_version` + - Model `VirtualMachineScaleSetVMExtension` deleted or renamed its instance variable `enable_automatic_upgrade` + - Model `VirtualMachineScaleSetVMExtension` deleted or renamed its instance variable `settings` + - Model `VirtualMachineScaleSetVMExtension` deleted or renamed its instance variable `protected_settings` + - Model `VirtualMachineScaleSetVMExtension` deleted or renamed its instance variable `provisioning_state` + - Model `VirtualMachineScaleSetVMExtension` deleted or renamed its instance variable `instance_view` + - Model `VirtualMachineScaleSetVMExtension` deleted or renamed its instance variable `suppress_failures` + - Model `VirtualMachineScaleSetVMExtension` deleted or renamed its instance variable `protected_settings_from_key_vault` + - Model `VirtualMachineScaleSetVMExtension` deleted or renamed its instance variable `provision_after_extensions` + - Model `VirtualMachineScaleSetVMExtensionUpdate` deleted or renamed its instance variable `force_update_tag` + - Model `VirtualMachineScaleSetVMExtensionUpdate` deleted or renamed its instance variable `publisher` + - Model `VirtualMachineScaleSetVMExtensionUpdate` deleted or renamed its instance variable `type_properties_type` + - Model `VirtualMachineScaleSetVMExtensionUpdate` deleted or renamed its instance variable `type_handler_version` + - Model `VirtualMachineScaleSetVMExtensionUpdate` deleted or renamed its instance variable `auto_upgrade_minor_version` + - Model `VirtualMachineScaleSetVMExtensionUpdate` deleted or renamed its instance variable `enable_automatic_upgrade` + - Model `VirtualMachineScaleSetVMExtensionUpdate` deleted or renamed its instance variable `settings` + - Model `VirtualMachineScaleSetVMExtensionUpdate` deleted or renamed its instance variable `protected_settings` + - Model `VirtualMachineScaleSetVMExtensionUpdate` deleted or renamed its instance variable `suppress_failures` + - Model `VirtualMachineScaleSetVMExtensionUpdate` deleted or renamed its instance variable `protected_settings_from_key_vault` + - Model `VirtualMachineUpdate` deleted or renamed its instance variable `hardware_profile` + - Model `VirtualMachineUpdate` deleted or renamed its instance variable `scheduled_events_policy` + - Model `VirtualMachineUpdate` deleted or renamed its instance variable `storage_profile` + - Model `VirtualMachineUpdate` deleted or renamed its instance variable `additional_capabilities` + - Model `VirtualMachineUpdate` deleted or renamed its instance variable `os_profile` + - Model `VirtualMachineUpdate` deleted or renamed its instance variable `network_profile` + - Model `VirtualMachineUpdate` deleted or renamed its instance variable `security_profile` + - Model `VirtualMachineUpdate` deleted or renamed its instance variable `diagnostics_profile` + - Model `VirtualMachineUpdate` deleted or renamed its instance variable `availability_set` + - Model `VirtualMachineUpdate` deleted or renamed its instance variable `virtual_machine_scale_set` + - Model `VirtualMachineUpdate` deleted or renamed its instance variable `proximity_placement_group` + - Model `VirtualMachineUpdate` deleted or renamed its instance variable `priority` + - Model `VirtualMachineUpdate` deleted or renamed its instance variable `eviction_policy` + - Model `VirtualMachineUpdate` deleted or renamed its instance variable `billing_profile` + - Model `VirtualMachineUpdate` deleted or renamed its instance variable `host` + - Model `VirtualMachineUpdate` deleted or renamed its instance variable `host_group` + - Model `VirtualMachineUpdate` deleted or renamed its instance variable `provisioning_state` + - Model `VirtualMachineUpdate` deleted or renamed its instance variable `instance_view` + - Model `VirtualMachineUpdate` deleted or renamed its instance variable `license_type` + - Model `VirtualMachineUpdate` deleted or renamed its instance variable `vm_id` + - Model `VirtualMachineUpdate` deleted or renamed its instance variable `extensions_time_budget` + - Model `VirtualMachineUpdate` deleted or renamed its instance variable `platform_fault_domain` + - Model `VirtualMachineUpdate` deleted or renamed its instance variable `scheduled_events_profile` + - Model `VirtualMachineUpdate` deleted or renamed its instance variable `user_data` + - Model `VirtualMachineUpdate` deleted or renamed its instance variable `capacity_reservation` + - Model `VirtualMachineUpdate` deleted or renamed its instance variable `application_profile` + - Model `VirtualMachineUpdate` deleted or renamed its instance variable `time_created` + - Deleted or renamed model `AvailabilitySetSkuTypes` + - Deleted or renamed model `CloudService` + - Deleted or renamed model `CloudServiceExtensionProfile` + - Deleted or renamed model `CloudServiceExtensionProperties` + - Deleted or renamed model `CloudServiceInstanceView` + - Deleted or renamed model `CloudServiceNetworkProfile` + - Deleted or renamed model `CloudServiceOsProfile` + - Deleted or renamed model `CloudServiceProperties` + - Deleted or renamed model `CloudServiceRole` + - Deleted or renamed model `CloudServiceRoleProfile` + - Deleted or renamed model `CloudServiceRoleProfileProperties` + - Deleted or renamed model `CloudServiceRoleProperties` + - Deleted or renamed model `CloudServiceRoleSku` + - Deleted or renamed model `CloudServiceSlotType` + - Deleted or renamed model `CloudServiceUpdate` + - Deleted or renamed model `CloudServiceUpgradeMode` + - Deleted or renamed model `CloudServiceVaultAndSecretReference` + - Deleted or renamed model `CloudServiceVaultCertificate` + - Deleted or renamed model `CloudServiceVaultSecretGroup` + - Deleted or renamed model `CommunityGalleryImageList` + - Deleted or renamed model `CommunityGalleryImageVersionList` + - Deleted or renamed model `DiskAccessList` + - Deleted or renamed model `DiskEncryptionSetList` + - Deleted or renamed model `DiskList` + - Deleted or renamed model `DiskRestorePointList` + - Deleted or renamed model `Extension` + - Deleted or renamed model `GalleryApplicationList` + - Deleted or renamed model `GalleryApplicationVersionList` + - Deleted or renamed model `GalleryImageList` + - Deleted or renamed model `GalleryImageVersionList` + - Deleted or renamed model `GalleryInVMAccessControlProfileList` + - Deleted or renamed model `GalleryInVMAccessControlProfileVersionList` + - Deleted or renamed model `GalleryList` + - Deleted or renamed model `GallerySoftDeletedResourceList` + - Deleted or renamed model `InstanceSku` + - Deleted or renamed model `InstanceViewStatusesSummary` + - Deleted or renamed model `ListUsagesResult` + - Deleted or renamed model `LoadBalancerConfiguration` + - Deleted or renamed model `LoadBalancerConfigurationProperties` + - Deleted or renamed model `LoadBalancerFrontendIpConfiguration` + - Deleted or renamed model `LoadBalancerFrontendIpConfigurationProperties` + - Deleted or renamed model `LogAnalyticsOperationResult` + - Deleted or renamed model `LogAnalyticsOutput` + - Deleted or renamed model `OSFamily` + - Deleted or renamed model `OSFamilyProperties` + - Deleted or renamed model `OSVersion` + - Deleted or renamed model `OSVersionProperties` + - Deleted or renamed model `OSVersionPropertiesBase` + - Deleted or renamed model `ResourceInstanceViewStatus` + - Deleted or renamed model `ResourceSkusResult` + - Deleted or renamed model `ResourceUriList` + - Deleted or renamed model `ResourceWithOptionalLocation` + - Deleted or renamed model `RoleInstance` + - Deleted or renamed model `RoleInstanceNetworkProfile` + - Deleted or renamed model `RoleInstanceProperties` + - Deleted or renamed model `RoleInstanceView` + - Deleted or renamed model `RoleInstances` + - Deleted or renamed model `SharedGalleryImageList` + - Deleted or renamed model `SharedGalleryImageVersionList` + - Deleted or renamed model `SharedGalleryList` + - Deleted or renamed model `SnapshotList` + - Deleted or renamed model `StatusCodeCount` + - Deleted or renamed model `UpdateDomain` + - Deleted or renamed model `VirtualMachineScaleSetListOSUpgradeHistory` + - Deleted or renamed model `VirtualMachineScaleSetListSkusResult` + - Deleted or renamed model `VirtualMachineScaleSetListWithLinkResult` + - Method `AvailabilitySetsOperations.create_or_update` inserted a `positional_or_keyword` parameter `resource` + - Method `AvailabilitySetsOperations.create_or_update` deleted or renamed its parameter `parameters` of kind `positional_or_keyword` + - Method `AvailabilitySetsOperations.list_by_subscription` changed its parameter `expand` from `positional_or_keyword` to `keyword_only` + - Method `AvailabilitySetsOperations.start_migration_to_virtual_machine_scale_set` inserted a `positional_or_keyword` parameter `body` + - Method `AvailabilitySetsOperations.start_migration_to_virtual_machine_scale_set` deleted or renamed its parameter `parameters` of kind `positional_or_keyword` + - Method `AvailabilitySetsOperations.update` inserted a `positional_or_keyword` parameter `properties` + - Method `AvailabilitySetsOperations.update` deleted or renamed its parameter `parameters` of kind `positional_or_keyword` + - Method `AvailabilitySetsOperations.validate_migration_to_virtual_machine_scale_set` inserted a `positional_or_keyword` parameter `body` + - Method `AvailabilitySetsOperations.validate_migration_to_virtual_machine_scale_set` deleted or renamed its parameter `parameters` of kind `positional_or_keyword` + - Method `CapacityReservationGroupsOperations.create_or_update` inserted a `positional_or_keyword` parameter `resource` + - Method `CapacityReservationGroupsOperations.create_or_update` deleted or renamed its parameter `parameters` of kind `positional_or_keyword` + - Method `CapacityReservationGroupsOperations.get` changed its parameter `expand` from `positional_or_keyword` to `keyword_only` + - Method `CapacityReservationGroupsOperations.list_by_resource_group` changed its parameter `expand` from `positional_or_keyword` to `keyword_only` + - Method `CapacityReservationGroupsOperations.list_by_subscription` changed its parameter `expand` from `positional_or_keyword` to `keyword_only` + - Method `CapacityReservationGroupsOperations.list_by_subscription` changed its parameter `resource_ids_only` from `positional_or_keyword` to `keyword_only` + - Method `CapacityReservationGroupsOperations.update` inserted a `positional_or_keyword` parameter `properties` + - Method `CapacityReservationGroupsOperations.update` deleted or renamed its parameter `parameters` of kind `positional_or_keyword` + - Method `CapacityReservationsOperations.begin_create_or_update` inserted a `positional_or_keyword` parameter `resource` + - Method `CapacityReservationsOperations.begin_create_or_update` deleted or renamed its parameter `parameters` of kind `positional_or_keyword` + - Method `CapacityReservationsOperations.begin_update` inserted a `positional_or_keyword` parameter `properties` + - Method `CapacityReservationsOperations.begin_update` deleted or renamed its parameter `parameters` of kind `positional_or_keyword` + - Method `CapacityReservationsOperations.get` changed its parameter `expand` from `positional_or_keyword` to `keyword_only` + - Method `DedicatedHostGroupsOperations.create_or_update` inserted a `positional_or_keyword` parameter `resource` + - Method `DedicatedHostGroupsOperations.create_or_update` deleted or renamed its parameter `parameters` of kind `positional_or_keyword` + - Method `DedicatedHostGroupsOperations.get` changed its parameter `expand` from `positional_or_keyword` to `keyword_only` + - Method `DedicatedHostGroupsOperations.update` inserted a `positional_or_keyword` parameter `properties` + - Method `DedicatedHostGroupsOperations.update` deleted or renamed its parameter `parameters` of kind `positional_or_keyword` + - Method `DedicatedHostsOperations.begin_create_or_update` inserted a `positional_or_keyword` parameter `resource` + - Method `DedicatedHostsOperations.begin_create_or_update` deleted or renamed its parameter `parameters` of kind `positional_or_keyword` + - Method `DedicatedHostsOperations.begin_update` inserted a `positional_or_keyword` parameter `properties` + - Method `DedicatedHostsOperations.begin_update` deleted or renamed its parameter `parameters` of kind `positional_or_keyword` + - Method `DedicatedHostsOperations.get` changed its parameter `expand` from `positional_or_keyword` to `keyword_only` + - Method `DiskAccessesOperations.begin_create_or_update` inserted a `positional_or_keyword` parameter `resource` + - Method `DiskAccessesOperations.begin_create_or_update` deleted or renamed its parameter `disk_access` of kind `positional_or_keyword` + - Method `DiskAccessesOperations.begin_update` inserted a `positional_or_keyword` parameter `properties` + - Method `DiskAccessesOperations.begin_update` deleted or renamed its parameter `disk_access` of kind `positional_or_keyword` + - Deleted or renamed method `DiskAccessesOperations.begin_delete_a_private_endpoint_connection` + - Deleted or renamed method `DiskAccessesOperations.begin_update_a_private_endpoint_connection` + - Deleted or renamed method `DiskAccessesOperations.get_a_private_endpoint_connection` + - Deleted or renamed method `DiskAccessesOperations.list_private_endpoint_connections` + - Method `DiskEncryptionSetsOperations.begin_create_or_update` inserted a `positional_or_keyword` parameter `resource` + - Method `DiskEncryptionSetsOperations.begin_create_or_update` deleted or renamed its parameter `disk_encryption_set` of kind `positional_or_keyword` + - Method `DiskEncryptionSetsOperations.begin_update` inserted a `positional_or_keyword` parameter `properties` + - Method `DiskEncryptionSetsOperations.begin_update` deleted or renamed its parameter `disk_encryption_set` of kind `positional_or_keyword` + - Method `DisksOperations.begin_create_or_update` inserted a `positional_or_keyword` parameter `resource` + - Method `DisksOperations.begin_create_or_update` deleted or renamed its parameter `disk` of kind `positional_or_keyword` + - Method `DisksOperations.begin_grant_access` inserted a `positional_or_keyword` parameter `body` + - Method `DisksOperations.begin_grant_access` deleted or renamed its parameter `grant_access_data` of kind `positional_or_keyword` + - Method `DisksOperations.begin_update` inserted a `positional_or_keyword` parameter `properties` + - Method `DisksOperations.begin_update` deleted or renamed its parameter `disk` of kind `positional_or_keyword` + - Method `GalleriesOperations.begin_create_or_update` inserted a `positional_or_keyword` parameter `resource` + - Method `GalleriesOperations.begin_create_or_update` deleted or renamed its parameter `gallery` of kind `positional_or_keyword` + - Method `GalleriesOperations.begin_update` inserted a `positional_or_keyword` parameter `properties` + - Method `GalleriesOperations.begin_update` deleted or renamed its parameter `gallery` of kind `positional_or_keyword` + - Method `GalleriesOperations.get` changed its parameter `select` from `positional_or_keyword` to `keyword_only` + - Method `GalleriesOperations.get` changed its parameter `expand` from `positional_or_keyword` to `keyword_only` + - Method `GalleryApplicationVersionsOperations.begin_create_or_update` inserted a `positional_or_keyword` parameter `resource` + - Method `GalleryApplicationVersionsOperations.begin_create_or_update` deleted or renamed its parameter `gallery_application_version` of kind `positional_or_keyword` + - Method `GalleryApplicationVersionsOperations.begin_update` inserted a `positional_or_keyword` parameter `properties` + - Method `GalleryApplicationVersionsOperations.begin_update` deleted or renamed its parameter `gallery_application_version` of kind `positional_or_keyword` + - Method `GalleryApplicationVersionsOperations.get` changed its parameter `expand` from `positional_or_keyword` to `keyword_only` + - Method `GalleryApplicationsOperations.begin_create_or_update` inserted a `positional_or_keyword` parameter `resource` + - Method `GalleryApplicationsOperations.begin_create_or_update` deleted or renamed its parameter `gallery_application` of kind `positional_or_keyword` + - Method `GalleryApplicationsOperations.begin_update` inserted a `positional_or_keyword` parameter `properties` + - Method `GalleryApplicationsOperations.begin_update` deleted or renamed its parameter `gallery_application` of kind `positional_or_keyword` + - Method `GalleryImageVersionsOperations.begin_create_or_update` inserted a `positional_or_keyword` parameter `resource` + - Method `GalleryImageVersionsOperations.begin_create_or_update` deleted or renamed its parameter `gallery_image_version` of kind `positional_or_keyword` + - Method `GalleryImageVersionsOperations.begin_update` inserted a `positional_or_keyword` parameter `properties` + - Method `GalleryImageVersionsOperations.begin_update` deleted or renamed its parameter `gallery_image_version` of kind `positional_or_keyword` + - Method `GalleryImageVersionsOperations.get` changed its parameter `expand` from `positional_or_keyword` to `keyword_only` + - Method `GalleryImagesOperations.begin_create_or_update` inserted a `positional_or_keyword` parameter `resource` + - Method `GalleryImagesOperations.begin_create_or_update` deleted or renamed its parameter `gallery_image` of kind `positional_or_keyword` + - Method `GalleryImagesOperations.begin_update` inserted a `positional_or_keyword` parameter `properties` + - Method `GalleryImagesOperations.begin_update` deleted or renamed its parameter `gallery_image` of kind `positional_or_keyword` + - Method `GalleryInVMAccessControlProfileVersionsOperations.begin_create_or_update` inserted a `positional_or_keyword` parameter `resource` + - Method `GalleryInVMAccessControlProfileVersionsOperations.begin_create_or_update` deleted or renamed its parameter `gallery_in_vm_access_control_profile_version` of kind `positional_or_keyword` + - Method `GalleryInVMAccessControlProfileVersionsOperations.begin_update` inserted a `positional_or_keyword` parameter `properties` + - Method `GalleryInVMAccessControlProfileVersionsOperations.begin_update` deleted or renamed its parameter `gallery_in_vm_access_control_profile_version` of kind `positional_or_keyword` + - Method `GalleryInVMAccessControlProfilesOperations.begin_create_or_update` inserted a `positional_or_keyword` parameter `resource` + - Method `GalleryInVMAccessControlProfilesOperations.begin_create_or_update` deleted or renamed its parameter `gallery_in_vm_access_control_profile` of kind `positional_or_keyword` + - Method `GalleryInVMAccessControlProfilesOperations.begin_update` inserted a `positional_or_keyword` parameter `properties` + - Method `GalleryInVMAccessControlProfilesOperations.begin_update` deleted or renamed its parameter `gallery_in_vm_access_control_profile` of kind `positional_or_keyword` + - Method `ImagesOperations.begin_create_or_update` inserted a `positional_or_keyword` parameter `resource` + - Method `ImagesOperations.begin_create_or_update` deleted or renamed its parameter `parameters` of kind `positional_or_keyword` + - Method `ImagesOperations.begin_update` inserted a `positional_or_keyword` parameter `properties` + - Method `ImagesOperations.begin_update` deleted or renamed its parameter `parameters` of kind `positional_or_keyword` + - Method `ImagesOperations.get` changed its parameter `expand` from `positional_or_keyword` to `keyword_only` + - Method `ProximityPlacementGroupsOperations.create_or_update` inserted a `positional_or_keyword` parameter `resource` + - Method `ProximityPlacementGroupsOperations.create_or_update` deleted or renamed its parameter `parameters` of kind `positional_or_keyword` + - Method `ProximityPlacementGroupsOperations.get` changed its parameter `include_colocation_status` from `positional_or_keyword` to `keyword_only` + - Method `ProximityPlacementGroupsOperations.update` inserted a `positional_or_keyword` parameter `properties` + - Method `ProximityPlacementGroupsOperations.update` deleted or renamed its parameter `parameters` of kind `positional_or_keyword` + - Method `ResourceSkusOperations.list` changed its parameter `include_extended_locations` from `positional_or_keyword` to `keyword_only` + - Method `RestorePointCollectionsOperations.create_or_update` inserted a `positional_or_keyword` parameter `resource` + - Method `RestorePointCollectionsOperations.create_or_update` deleted or renamed its parameter `parameters` of kind `positional_or_keyword` + - Method `RestorePointCollectionsOperations.get` changed its parameter `expand` from `positional_or_keyword` to `keyword_only` + - Method `RestorePointCollectionsOperations.update` inserted a `positional_or_keyword` parameter `properties` + - Method `RestorePointCollectionsOperations.update` deleted or renamed its parameter `parameters` of kind `positional_or_keyword` + - Method `RestorePointsOperations.begin_create` inserted a `positional_or_keyword` parameter `resource` + - Method `RestorePointsOperations.begin_create` deleted or renamed its parameter `parameters` of kind `positional_or_keyword` + - Method `RestorePointsOperations.get` changed its parameter `expand` from `positional_or_keyword` to `keyword_only` + - Method `SharedGalleriesOperations.list` changed its parameter `shared_to` from `positional_or_keyword` to `keyword_only` + - Method `SharedGalleryImageVersionsOperations.list` changed its parameter `shared_to` from `positional_or_keyword` to `keyword_only` + - Method `SharedGalleryImagesOperations.list` changed its parameter `shared_to` from `positional_or_keyword` to `keyword_only` + - Method `SnapshotsOperations.begin_create_or_update` inserted a `positional_or_keyword` parameter `resource` + - Method `SnapshotsOperations.begin_create_or_update` deleted or renamed its parameter `snapshot` of kind `positional_or_keyword` + - Method `SnapshotsOperations.begin_grant_access` inserted a `positional_or_keyword` parameter `body` + - Method `SnapshotsOperations.begin_grant_access` deleted or renamed its parameter `grant_access_data` of kind `positional_or_keyword` + - Method `SnapshotsOperations.begin_update` inserted a `positional_or_keyword` parameter `properties` + - Method `SnapshotsOperations.begin_update` deleted or renamed its parameter `snapshot` of kind `positional_or_keyword` + - Method `VirtualMachineExtensionImagesOperations.list_versions` changed its parameter `orderby` from `positional_or_keyword` to `keyword_only` + - Method `VirtualMachineExtensionsOperations.begin_create_or_update` inserted a `positional_or_keyword` parameter `resource` + - Method `VirtualMachineExtensionsOperations.begin_create_or_update` deleted or renamed its parameter `extension_parameters` of kind `positional_or_keyword` + - Method `VirtualMachineExtensionsOperations.begin_update` inserted a `positional_or_keyword` parameter `properties` + - Method `VirtualMachineExtensionsOperations.begin_update` deleted or renamed its parameter `extension_parameters` of kind `positional_or_keyword` + - Method `VirtualMachineExtensionsOperations.get` changed its parameter `expand` from `positional_or_keyword` to `keyword_only` + - Method `VirtualMachineExtensionsOperations.list` changed its parameter `expand` from `positional_or_keyword` to `keyword_only` + - Method `VirtualMachineRunCommandsOperations.begin_create_or_update` inserted a `positional_or_keyword` parameter `body` + - Method `VirtualMachineRunCommandsOperations.begin_create_or_update` deleted or renamed its parameter `run_command` of kind `positional_or_keyword` + - Method `VirtualMachineRunCommandsOperations.begin_update` inserted a `positional_or_keyword` parameter `body` + - Method `VirtualMachineRunCommandsOperations.begin_update` deleted or renamed its parameter `run_command` of kind `positional_or_keyword` + - Method `VirtualMachineRunCommandsOperations.get_by_virtual_machine` changed its parameter `expand` from `positional_or_keyword` to `keyword_only` + - Method `VirtualMachineRunCommandsOperations.list_by_virtual_machine` changed its parameter `expand` from `positional_or_keyword` to `keyword_only` + - Deleted or renamed method `VirtualMachineRunCommandsOperations.get` + - Deleted or renamed method `VirtualMachineRunCommandsOperations.list` + - Method `VirtualMachineScaleSetExtensionsOperations.begin_create_or_update` inserted a `positional_or_keyword` parameter `resource` + - Method `VirtualMachineScaleSetExtensionsOperations.begin_create_or_update` deleted or renamed its parameter `extension_parameters` of kind `positional_or_keyword` + - Method `VirtualMachineScaleSetExtensionsOperations.begin_update` inserted a `positional_or_keyword` parameter `properties` + - Method `VirtualMachineScaleSetExtensionsOperations.begin_update` deleted or renamed its parameter `extension_parameters` of kind `positional_or_keyword` + - Method `VirtualMachineScaleSetExtensionsOperations.get` changed its parameter `expand` from `positional_or_keyword` to `keyword_only` + - Method `VirtualMachineScaleSetVMExtensionsOperations.begin_create_or_update` inserted a `positional_or_keyword` parameter `resource` + - Method `VirtualMachineScaleSetVMExtensionsOperations.begin_create_or_update` deleted or renamed its parameter `extension_parameters` of kind `positional_or_keyword` + - Method `VirtualMachineScaleSetVMExtensionsOperations.begin_update` inserted a `positional_or_keyword` parameter `properties` + - Method `VirtualMachineScaleSetVMExtensionsOperations.begin_update` deleted or renamed its parameter `extension_parameters` of kind `positional_or_keyword` + - Method `VirtualMachineScaleSetVMExtensionsOperations.get` changed its parameter `expand` from `positional_or_keyword` to `keyword_only` + - Method `VirtualMachineScaleSetVMExtensionsOperations.list` changed its parameter `expand` from `positional_or_keyword` to `keyword_only` + - Method `VirtualMachineScaleSetVMRunCommandsOperations.begin_create_or_update` inserted a `positional_or_keyword` parameter `body` + - Method `VirtualMachineScaleSetVMRunCommandsOperations.begin_create_or_update` deleted or renamed its parameter `run_command` of kind `positional_or_keyword` + - Method `VirtualMachineScaleSetVMRunCommandsOperations.begin_update` inserted a `positional_or_keyword` parameter `body` + - Method `VirtualMachineScaleSetVMRunCommandsOperations.begin_update` deleted or renamed its parameter `run_command` of kind `positional_or_keyword` + - Method `VirtualMachineScaleSetVMRunCommandsOperations.get` changed its parameter `expand` from `positional_or_keyword` to `keyword_only` + - Method `VirtualMachineScaleSetVMRunCommandsOperations.list` changed its parameter `expand` from `positional_or_keyword` to `keyword_only` + - Method `VirtualMachineScaleSetsOperations.begin_create_or_update` inserted a `positional_or_keyword` parameter `resource` + - Method `VirtualMachineScaleSetsOperations.begin_create_or_update` deleted or renamed its parameter `parameters` of kind `positional_or_keyword` + - Method `VirtualMachineScaleSetsOperations.begin_create_or_update` deleted or renamed its parameter `if_match` of kind `positional_or_keyword` + - Method `VirtualMachineScaleSetsOperations.begin_create_or_update` deleted or renamed its parameter `if_none_match` of kind `positional_or_keyword` + - Method `VirtualMachineScaleSetsOperations.begin_deallocate` changed its parameter `hibernate` from `positional_or_keyword` to `keyword_only` + - Method `VirtualMachineScaleSetsOperations.begin_delete` changed its parameter `force_deletion` from `positional_or_keyword` to `keyword_only` + - Method `VirtualMachineScaleSetsOperations.begin_delete_instances` changed its parameter `force_deletion` from `positional_or_keyword` to `keyword_only` + - Method `VirtualMachineScaleSetsOperations.begin_delete_instances` inserted a `positional_or_keyword` parameter `body` + - Method `VirtualMachineScaleSetsOperations.begin_delete_instances` deleted or renamed its parameter `vm_instance_i_ds` of kind `positional_or_keyword` + - Method `VirtualMachineScaleSetsOperations.begin_power_off` changed its parameter `skip_shutdown` from `positional_or_keyword` to `keyword_only` + - Method `VirtualMachineScaleSetsOperations.begin_scale_out` inserted a `positional_or_keyword` parameter `body` + - Method `VirtualMachineScaleSetsOperations.begin_scale_out` deleted or renamed its parameter `parameters` of kind `positional_or_keyword` + - Method `VirtualMachineScaleSetsOperations.begin_set_orchestration_service_state` inserted a `positional_or_keyword` parameter `body` + - Method `VirtualMachineScaleSetsOperations.begin_set_orchestration_service_state` deleted or renamed its parameter `parameters` of kind `positional_or_keyword` + - Method `VirtualMachineScaleSetsOperations.begin_update` inserted a `positional_or_keyword` parameter `properties` + - Method `VirtualMachineScaleSetsOperations.begin_update` deleted or renamed its parameter `parameters` of kind `positional_or_keyword` + - Method `VirtualMachineScaleSetsOperations.begin_update` deleted or renamed its parameter `if_match` of kind `positional_or_keyword` + - Method `VirtualMachineScaleSetsOperations.begin_update` deleted or renamed its parameter `if_none_match` of kind `positional_or_keyword` + - Method `VirtualMachineScaleSetsOperations.begin_update_instances` inserted a `positional_or_keyword` parameter `body` + - Method `VirtualMachineScaleSetsOperations.begin_update_instances` deleted or renamed its parameter `vm_instance_i_ds` of kind `positional_or_keyword` + - Method `VirtualMachineScaleSetsOperations.convert_to_single_placement_group` inserted a `positional_or_keyword` parameter `body` + - Method `VirtualMachineScaleSetsOperations.convert_to_single_placement_group` deleted or renamed its parameter `parameters` of kind `positional_or_keyword` + - Method `VirtualMachineScaleSetsOperations.force_recovery_service_fabric_platform_update_domain_walk` changed its parameter `platform_update_domain` from `positional_or_keyword` to `keyword_only` + - Method `VirtualMachineScaleSetsOperations.force_recovery_service_fabric_platform_update_domain_walk` changed its parameter `zone` from `positional_or_keyword` to `keyword_only` + - Method `VirtualMachineScaleSetsOperations.force_recovery_service_fabric_platform_update_domain_walk` changed its parameter `placement_group_id` from `positional_or_keyword` to `keyword_only` + - Method `VirtualMachineScaleSetsOperations.get` changed its parameter `expand` from `positional_or_keyword` to `keyword_only` + - Deleted or renamed method `VirtualMachineScaleSetsOperations.list_by_location` + - Method `VirtualMachinesOperations.begin_attach_detach_data_disks` inserted a `positional_or_keyword` parameter `body` + - Method `VirtualMachinesOperations.begin_attach_detach_data_disks` deleted or renamed its parameter `parameters` of kind `positional_or_keyword` + - Method `VirtualMachinesOperations.begin_capture` inserted a `positional_or_keyword` parameter `body` + - Method `VirtualMachinesOperations.begin_capture` deleted or renamed its parameter `parameters` of kind `positional_or_keyword` + - Method `VirtualMachinesOperations.begin_create_or_update` inserted a `positional_or_keyword` parameter `resource` + - Method `VirtualMachinesOperations.begin_create_or_update` deleted or renamed its parameter `parameters` of kind `positional_or_keyword` + - Method `VirtualMachinesOperations.begin_create_or_update` deleted or renamed its parameter `if_match` of kind `positional_or_keyword` + - Method `VirtualMachinesOperations.begin_create_or_update` deleted or renamed its parameter `if_none_match` of kind `positional_or_keyword` + - Method `VirtualMachinesOperations.begin_deallocate` changed its parameter `hibernate` from `positional_or_keyword` to `keyword_only` + - Method `VirtualMachinesOperations.begin_delete` changed its parameter `force_deletion` from `positional_or_keyword` to `keyword_only` + - Method `VirtualMachinesOperations.begin_install_patches` inserted a `positional_or_keyword` parameter `body` + - Method `VirtualMachinesOperations.begin_install_patches` deleted or renamed its parameter `install_patches_input` of kind `positional_or_keyword` + - Method `VirtualMachinesOperations.begin_power_off` changed its parameter `skip_shutdown` from `positional_or_keyword` to `keyword_only` + - Method `VirtualMachinesOperations.begin_run_command` inserted a `positional_or_keyword` parameter `body` + - Method `VirtualMachinesOperations.begin_run_command` deleted or renamed its parameter `parameters` of kind `positional_or_keyword` + - Method `VirtualMachinesOperations.begin_update` inserted a `positional_or_keyword` parameter `properties` + - Method `VirtualMachinesOperations.begin_update` deleted or renamed its parameter `parameters` of kind `positional_or_keyword` + - Method `VirtualMachinesOperations.begin_update` deleted or renamed its parameter `if_match` of kind `positional_or_keyword` + - Method `VirtualMachinesOperations.begin_update` deleted or renamed its parameter `if_none_match` of kind `positional_or_keyword` + - Method `VirtualMachinesOperations.get` changed its parameter `expand` from `positional_or_keyword` to `keyword_only` + - Method `VirtualMachinesOperations.list` changed its parameter `expand` from `positional_or_keyword` to `keyword_only` + - Method `VirtualMachinesOperations.list_all` changed its parameter `status_only` from `positional_or_keyword` to `keyword_only` + - Method `VirtualMachinesOperations.list_all` changed its parameter `expand` from `positional_or_keyword` to `keyword_only` + - Method `VirtualMachinesOperations.retrieve_boot_diagnostics_data` changed its parameter `sas_uri_expiration_time_in_minutes` from `positional_or_keyword` to `keyword_only` + - Deleted or renamed method `VirtualMachinesOperations.list_by_location` + - Deleted or renamed model `CloudServiceOperatingSystemsOperations` + - Deleted or renamed model `CloudServiceRoleInstancesOperations` + - Deleted or renamed model `CloudServiceRolesOperations` + - Deleted or renamed model `CloudServicesOperations` + - Deleted or renamed model `CloudServicesUpdateDomainOperations` + - Deleted or renamed model `DiskRestorePointOperations` + - Deleted or renamed model `GallerySharingProfileOperations` + - Deleted or renamed model `LogAnalyticsOperations` + - Deleted or renamed model `SoftDeletedResourceOperations` + - Deleted or renamed model `SshPublicKeysOperations` + - Deleted or renamed model `UsageOperations` + - Deleted or renamed model `VirtualMachineImagesEdgeZoneOperations` + - Deleted or renamed model `VirtualMachineImagesOperations` + - Deleted or renamed model `VirtualMachineScaleSetRollingUpgradesOperations` + - Deleted or renamed model `VirtualMachineScaleSetVMsOperations` + - Deleted or renamed model `VirtualMachineSizesOperations` + - Method `SnapshotsOperations.begin_grant_access` re-ordered its parameters from `['self', 'resource_group_name', 'snapshot_name', 'grant_access_data', 'kwargs']` to `['self', 'resource_group_name', 'snapshot_name', 'body', 'kwargs']` + - Method `SnapshotsOperations.begin_create_or_update` re-ordered its parameters from `['self', 'resource_group_name', 'snapshot_name', 'snapshot', 'kwargs']` to `['self', 'resource_group_name', 'snapshot_name', 'resource', 'kwargs']` + - Method `SnapshotsOperations.begin_update` re-ordered its parameters from `['self', 'resource_group_name', 'snapshot_name', 'snapshot', 'kwargs']` to `['self', 'resource_group_name', 'snapshot_name', 'properties', 'kwargs']` + - Method `VirtualMachineScaleSetsOperations.begin_update_instances` re-ordered its parameters from `['self', 'resource_group_name', 'vm_scale_set_name', 'vm_instance_i_ds', 'kwargs']` to `['self', 'resource_group_name', 'vm_scale_set_name', 'body', 'kwargs']` + - Method `VirtualMachineScaleSetsOperations.begin_deallocate` re-ordered its parameters from `['self', 'resource_group_name', 'vm_scale_set_name', 'hibernate', 'vm_instance_i_ds', 'kwargs']` to `['self', 'resource_group_name', 'vm_scale_set_name', 'vm_instance_i_ds', 'hibernate', 'kwargs']` + - Method `VirtualMachineScaleSetsOperations.begin_update` re-ordered its parameters from `['self', 'resource_group_name', 'vm_scale_set_name', 'parameters', 'if_match', 'if_none_match', 'kwargs']` to `['self', 'resource_group_name', 'vm_scale_set_name', 'properties', 'etag', 'match_condition', 'kwargs']` + - Method `VirtualMachineScaleSetsOperations.begin_delete_instances` re-ordered its parameters from `['self', 'resource_group_name', 'vm_scale_set_name', 'vm_instance_i_ds', 'force_deletion', 'kwargs']` to `['self', 'resource_group_name', 'vm_scale_set_name', 'body', 'force_deletion', 'kwargs']` + - Method `VirtualMachineScaleSetsOperations.begin_create_or_update` re-ordered its parameters from `['self', 'resource_group_name', 'vm_scale_set_name', 'parameters', 'if_match', 'if_none_match', 'kwargs']` to `['self', 'resource_group_name', 'vm_scale_set_name', 'resource', 'etag', 'match_condition', 'kwargs']` + - Method `VirtualMachineScaleSetsOperations.begin_power_off` re-ordered its parameters from `['self', 'resource_group_name', 'vm_scale_set_name', 'skip_shutdown', 'vm_instance_i_ds', 'kwargs']` to `['self', 'resource_group_name', 'vm_scale_set_name', 'vm_instance_i_ds', 'skip_shutdown', 'kwargs']` + - Method `VirtualMachineScaleSetsOperations.begin_scale_out` re-ordered its parameters from `['self', 'resource_group_name', 'vm_scale_set_name', 'parameters', 'kwargs']` to `['self', 'resource_group_name', 'vm_scale_set_name', 'body', 'kwargs']` + - Method `VirtualMachineScaleSetsOperations.begin_set_orchestration_service_state` re-ordered its parameters from `['self', 'resource_group_name', 'vm_scale_set_name', 'parameters', 'kwargs']` to `['self', 'resource_group_name', 'vm_scale_set_name', 'body', 'kwargs']` + - Method `VirtualMachineScaleSetsOperations.convert_to_single_placement_group` re-ordered its parameters from `['self', 'resource_group_name', 'vm_scale_set_name', 'parameters', 'kwargs']` to `['self', 'resource_group_name', 'vm_scale_set_name', 'body', 'kwargs']` + - Method `RestorePointsOperations.begin_create` re-ordered its parameters from `['self', 'resource_group_name', 'restore_point_collection_name', 'restore_point_name', 'parameters', 'kwargs']` to `['self', 'resource_group_name', 'restore_point_collection_name', 'restore_point_name', 'resource', 'kwargs']` + - Method `DedicatedHostsOperations.begin_create_or_update` re-ordered its parameters from `['self', 'resource_group_name', 'host_group_name', 'host_name', 'parameters', 'kwargs']` to `['self', 'resource_group_name', 'host_group_name', 'host_name', 'resource', 'kwargs']` + - Method `DedicatedHostsOperations.begin_update` re-ordered its parameters from `['self', 'resource_group_name', 'host_group_name', 'host_name', 'parameters', 'kwargs']` to `['self', 'resource_group_name', 'host_group_name', 'host_name', 'properties', 'kwargs']` + - Method `ImagesOperations.begin_create_or_update` re-ordered its parameters from `['self', 'resource_group_name', 'image_name', 'parameters', 'kwargs']` to `['self', 'resource_group_name', 'image_name', 'resource', 'kwargs']` + - Method `ImagesOperations.begin_update` re-ordered its parameters from `['self', 'resource_group_name', 'image_name', 'parameters', 'kwargs']` to `['self', 'resource_group_name', 'image_name', 'properties', 'kwargs']` + - Method `DisksOperations.begin_grant_access` re-ordered its parameters from `['self', 'resource_group_name', 'disk_name', 'grant_access_data', 'kwargs']` to `['self', 'resource_group_name', 'disk_name', 'body', 'kwargs']` + - Method `DisksOperations.begin_create_or_update` re-ordered its parameters from `['self', 'resource_group_name', 'disk_name', 'disk', 'kwargs']` to `['self', 'resource_group_name', 'disk_name', 'resource', 'kwargs']` + - Method `DisksOperations.begin_update` re-ordered its parameters from `['self', 'resource_group_name', 'disk_name', 'disk', 'kwargs']` to `['self', 'resource_group_name', 'disk_name', 'properties', 'kwargs']` + - Method `DiskAccessesOperations.begin_create_or_update` re-ordered its parameters from `['self', 'resource_group_name', 'disk_access_name', 'disk_access', 'kwargs']` to `['self', 'resource_group_name', 'disk_access_name', 'resource', 'kwargs']` + - Method `DiskAccessesOperations.begin_update` re-ordered its parameters from `['self', 'resource_group_name', 'disk_access_name', 'disk_access', 'kwargs']` to `['self', 'resource_group_name', 'disk_access_name', 'properties', 'kwargs']` + - Method `GalleriesOperations.begin_create_or_update` re-ordered its parameters from `['self', 'resource_group_name', 'gallery_name', 'gallery', 'kwargs']` to `['self', 'resource_group_name', 'gallery_name', 'resource', 'kwargs']` + - Method `GalleriesOperations.begin_update` re-ordered its parameters from `['self', 'resource_group_name', 'gallery_name', 'gallery', 'kwargs']` to `['self', 'resource_group_name', 'gallery_name', 'properties', 'kwargs']` + - Method `VirtualMachineRunCommandsOperations.begin_create_or_update` re-ordered its parameters from `['self', 'resource_group_name', 'vm_name', 'run_command_name', 'run_command', 'kwargs']` to `['self', 'resource_group_name', 'vm_name', 'run_command_name', 'body', 'kwargs']` + - Method `VirtualMachineRunCommandsOperations.begin_update` re-ordered its parameters from `['self', 'resource_group_name', 'vm_name', 'run_command_name', 'run_command', 'kwargs']` to `['self', 'resource_group_name', 'vm_name', 'run_command_name', 'body', 'kwargs']` + - Method `GalleryInVMAccessControlProfileVersionsOperations.begin_create_or_update` re-ordered its parameters from `['self', 'resource_group_name', 'gallery_name', 'in_vm_access_control_profile_name', 'in_vm_access_control_profile_version_name', 'gallery_in_vm_access_control_profile_version', 'kwargs']` to `['self', 'resource_group_name', 'gallery_name', 'in_vm_access_control_profile_name', 'in_vm_access_control_profile_version_name', 'resource', 'kwargs']` + - Method `GalleryInVMAccessControlProfileVersionsOperations.begin_update` re-ordered its parameters from `['self', 'resource_group_name', 'gallery_name', 'in_vm_access_control_profile_name', 'in_vm_access_control_profile_version_name', 'gallery_in_vm_access_control_profile_version', 'kwargs']` to `['self', 'resource_group_name', 'gallery_name', 'in_vm_access_control_profile_name', 'in_vm_access_control_profile_version_name', 'properties', 'kwargs']` + - Method `VirtualMachineScaleSetVMRunCommandsOperations.begin_create_or_update` re-ordered its parameters from `['self', 'resource_group_name', 'vm_scale_set_name', 'instance_id', 'run_command_name', 'run_command', 'kwargs']` to `['self', 'resource_group_name', 'vm_scale_set_name', 'instance_id', 'run_command_name', 'body', 'kwargs']` + - Method `VirtualMachineScaleSetVMRunCommandsOperations.begin_update` re-ordered its parameters from `['self', 'resource_group_name', 'vm_scale_set_name', 'instance_id', 'run_command_name', 'run_command', 'kwargs']` to `['self', 'resource_group_name', 'vm_scale_set_name', 'instance_id', 'run_command_name', 'body', 'kwargs']` + - Method `ProximityPlacementGroupsOperations.create_or_update` re-ordered its parameters from `['self', 'resource_group_name', 'proximity_placement_group_name', 'parameters', 'kwargs']` to `['self', 'resource_group_name', 'proximity_placement_group_name', 'resource', 'kwargs']` + - Method `ProximityPlacementGroupsOperations.update` re-ordered its parameters from `['self', 'resource_group_name', 'proximity_placement_group_name', 'parameters', 'kwargs']` to `['self', 'resource_group_name', 'proximity_placement_group_name', 'properties', 'kwargs']` + - Method `GalleryApplicationsOperations.begin_create_or_update` re-ordered its parameters from `['self', 'resource_group_name', 'gallery_name', 'gallery_application_name', 'gallery_application', 'kwargs']` to `['self', 'resource_group_name', 'gallery_name', 'gallery_application_name', 'resource', 'kwargs']` + - Method `GalleryApplicationsOperations.begin_update` re-ordered its parameters from `['self', 'resource_group_name', 'gallery_name', 'gallery_application_name', 'gallery_application', 'kwargs']` to `['self', 'resource_group_name', 'gallery_name', 'gallery_application_name', 'properties', 'kwargs']` + - Method `DiskEncryptionSetsOperations.begin_create_or_update` re-ordered its parameters from `['self', 'resource_group_name', 'disk_encryption_set_name', 'disk_encryption_set', 'kwargs']` to `['self', 'resource_group_name', 'disk_encryption_set_name', 'resource', 'kwargs']` + - Method `DiskEncryptionSetsOperations.begin_update` re-ordered its parameters from `['self', 'resource_group_name', 'disk_encryption_set_name', 'disk_encryption_set', 'kwargs']` to `['self', 'resource_group_name', 'disk_encryption_set_name', 'properties', 'kwargs']` + - Method `CapacityReservationsOperations.begin_create_or_update` re-ordered its parameters from `['self', 'resource_group_name', 'capacity_reservation_group_name', 'capacity_reservation_name', 'parameters', 'kwargs']` to `['self', 'resource_group_name', 'capacity_reservation_group_name', 'capacity_reservation_name', 'resource', 'kwargs']` + - Method `CapacityReservationsOperations.begin_update` re-ordered its parameters from `['self', 'resource_group_name', 'capacity_reservation_group_name', 'capacity_reservation_name', 'parameters', 'kwargs']` to `['self', 'resource_group_name', 'capacity_reservation_group_name', 'capacity_reservation_name', 'properties', 'kwargs']` + - Method `GalleryApplicationVersionsOperations.begin_create_or_update` re-ordered its parameters from `['self', 'resource_group_name', 'gallery_name', 'gallery_application_name', 'gallery_application_version_name', 'gallery_application_version', 'kwargs']` to `['self', 'resource_group_name', 'gallery_name', 'gallery_application_name', 'gallery_application_version_name', 'resource', 'kwargs']` + - Method `GalleryApplicationVersionsOperations.begin_update` re-ordered its parameters from `['self', 'resource_group_name', 'gallery_name', 'gallery_application_name', 'gallery_application_version_name', 'gallery_application_version', 'kwargs']` to `['self', 'resource_group_name', 'gallery_name', 'gallery_application_name', 'gallery_application_version_name', 'properties', 'kwargs']` + - Method `DedicatedHostGroupsOperations.create_or_update` re-ordered its parameters from `['self', 'resource_group_name', 'host_group_name', 'parameters', 'kwargs']` to `['self', 'resource_group_name', 'host_group_name', 'resource', 'kwargs']` + - Method `DedicatedHostGroupsOperations.update` re-ordered its parameters from `['self', 'resource_group_name', 'host_group_name', 'parameters', 'kwargs']` to `['self', 'resource_group_name', 'host_group_name', 'properties', 'kwargs']` + - Method `GalleryImageVersionsOperations.begin_create_or_update` re-ordered its parameters from `['self', 'resource_group_name', 'gallery_name', 'gallery_image_name', 'gallery_image_version_name', 'gallery_image_version', 'kwargs']` to `['self', 'resource_group_name', 'gallery_name', 'gallery_image_name', 'gallery_image_version_name', 'resource', 'kwargs']` + - Method `GalleryImageVersionsOperations.begin_update` re-ordered its parameters from `['self', 'resource_group_name', 'gallery_name', 'gallery_image_name', 'gallery_image_version_name', 'gallery_image_version', 'kwargs']` to `['self', 'resource_group_name', 'gallery_name', 'gallery_image_name', 'gallery_image_version_name', 'properties', 'kwargs']` + - Method `VirtualMachineScaleSetExtensionsOperations.begin_create_or_update` re-ordered its parameters from `['self', 'resource_group_name', 'vm_scale_set_name', 'vmss_extension_name', 'extension_parameters', 'kwargs']` to `['self', 'resource_group_name', 'vm_scale_set_name', 'vmss_extension_name', 'resource', 'kwargs']` + - Method `VirtualMachineScaleSetExtensionsOperations.begin_update` re-ordered its parameters from `['self', 'resource_group_name', 'vm_scale_set_name', 'vmss_extension_name', 'extension_parameters', 'kwargs']` to `['self', 'resource_group_name', 'vm_scale_set_name', 'vmss_extension_name', 'properties', 'kwargs']` + - Method `GalleryImagesOperations.begin_create_or_update` re-ordered its parameters from `['self', 'resource_group_name', 'gallery_name', 'gallery_image_name', 'gallery_image', 'kwargs']` to `['self', 'resource_group_name', 'gallery_name', 'gallery_image_name', 'resource', 'kwargs']` + - Method `GalleryImagesOperations.begin_update` re-ordered its parameters from `['self', 'resource_group_name', 'gallery_name', 'gallery_image_name', 'gallery_image', 'kwargs']` to `['self', 'resource_group_name', 'gallery_name', 'gallery_image_name', 'properties', 'kwargs']` + - Method `GalleryInVMAccessControlProfilesOperations.begin_create_or_update` re-ordered its parameters from `['self', 'resource_group_name', 'gallery_name', 'in_vm_access_control_profile_name', 'gallery_in_vm_access_control_profile', 'kwargs']` to `['self', 'resource_group_name', 'gallery_name', 'in_vm_access_control_profile_name', 'resource', 'kwargs']` + - Method `GalleryInVMAccessControlProfilesOperations.begin_update` re-ordered its parameters from `['self', 'resource_group_name', 'gallery_name', 'in_vm_access_control_profile_name', 'gallery_in_vm_access_control_profile', 'kwargs']` to `['self', 'resource_group_name', 'gallery_name', 'in_vm_access_control_profile_name', 'properties', 'kwargs']` + - Method `AvailabilitySetsOperations.validate_migration_to_virtual_machine_scale_set` re-ordered its parameters from `['self', 'resource_group_name', 'availability_set_name', 'parameters', 'kwargs']` to `['self', 'resource_group_name', 'availability_set_name', 'body', 'kwargs']` + - Method `AvailabilitySetsOperations.update` re-ordered its parameters from `['self', 'resource_group_name', 'availability_set_name', 'parameters', 'kwargs']` to `['self', 'resource_group_name', 'availability_set_name', 'properties', 'kwargs']` + - Method `AvailabilitySetsOperations.create_or_update` re-ordered its parameters from `['self', 'resource_group_name', 'availability_set_name', 'parameters', 'kwargs']` to `['self', 'resource_group_name', 'availability_set_name', 'resource', 'kwargs']` + - Method `AvailabilitySetsOperations.start_migration_to_virtual_machine_scale_set` re-ordered its parameters from `['self', 'resource_group_name', 'availability_set_name', 'parameters', 'kwargs']` to `['self', 'resource_group_name', 'availability_set_name', 'body', 'kwargs']` + - Method `CapacityReservationGroupsOperations.create_or_update` re-ordered its parameters from `['self', 'resource_group_name', 'capacity_reservation_group_name', 'parameters', 'kwargs']` to `['self', 'resource_group_name', 'capacity_reservation_group_name', 'resource', 'kwargs']` + - Method `CapacityReservationGroupsOperations.update` re-ordered its parameters from `['self', 'resource_group_name', 'capacity_reservation_group_name', 'parameters', 'kwargs']` to `['self', 'resource_group_name', 'capacity_reservation_group_name', 'properties', 'kwargs']` + - Method `VirtualMachineScaleSetVMExtensionsOperations.begin_create_or_update` re-ordered its parameters from `['self', 'resource_group_name', 'vm_scale_set_name', 'instance_id', 'vm_extension_name', 'extension_parameters', 'kwargs']` to `['self', 'resource_group_name', 'vm_scale_set_name', 'instance_id', 'vm_extension_name', 'resource', 'kwargs']` + - Method `VirtualMachineScaleSetVMExtensionsOperations.begin_update` re-ordered its parameters from `['self', 'resource_group_name', 'vm_scale_set_name', 'instance_id', 'vm_extension_name', 'extension_parameters', 'kwargs']` to `['self', 'resource_group_name', 'vm_scale_set_name', 'instance_id', 'vm_extension_name', 'properties', 'kwargs']` + - Method `VirtualMachinesOperations.begin_update` re-ordered its parameters from `['self', 'resource_group_name', 'vm_name', 'parameters', 'if_match', 'if_none_match', 'kwargs']` to `['self', 'resource_group_name', 'vm_name', 'properties', 'etag', 'match_condition', 'kwargs']` + - Method `VirtualMachinesOperations.begin_capture` re-ordered its parameters from `['self', 'resource_group_name', 'vm_name', 'parameters', 'kwargs']` to `['self', 'resource_group_name', 'vm_name', 'body', 'kwargs']` + - Method `VirtualMachinesOperations.begin_attach_detach_data_disks` re-ordered its parameters from `['self', 'resource_group_name', 'vm_name', 'parameters', 'kwargs']` to `['self', 'resource_group_name', 'vm_name', 'body', 'kwargs']` + - Method `VirtualMachinesOperations.begin_install_patches` re-ordered its parameters from `['self', 'resource_group_name', 'vm_name', 'install_patches_input', 'kwargs']` to `['self', 'resource_group_name', 'vm_name', 'body', 'kwargs']` + - Method `VirtualMachinesOperations.begin_run_command` re-ordered its parameters from `['self', 'resource_group_name', 'vm_name', 'parameters', 'kwargs']` to `['self', 'resource_group_name', 'vm_name', 'body', 'kwargs']` + - Method `VirtualMachinesOperations.begin_create_or_update` re-ordered its parameters from `['self', 'resource_group_name', 'vm_name', 'parameters', 'if_match', 'if_none_match', 'kwargs']` to `['self', 'resource_group_name', 'vm_name', 'resource', 'etag', 'match_condition', 'kwargs']` + - Method `VirtualMachineExtensionsOperations.begin_create_or_update` re-ordered its parameters from `['self', 'resource_group_name', 'vm_name', 'vm_extension_name', 'extension_parameters', 'kwargs']` to `['self', 'resource_group_name', 'vm_name', 'vm_extension_name', 'resource', 'kwargs']` + - Method `VirtualMachineExtensionsOperations.begin_update` re-ordered its parameters from `['self', 'resource_group_name', 'vm_name', 'vm_extension_name', 'extension_parameters', 'kwargs']` to `['self', 'resource_group_name', 'vm_name', 'vm_extension_name', 'properties', 'kwargs']` + - Method `RestorePointCollectionsOperations.create_or_update` re-ordered its parameters from `['self', 'resource_group_name', 'restore_point_collection_name', 'parameters', 'kwargs']` to `['self', 'resource_group_name', 'restore_point_collection_name', 'resource', 'kwargs']` + - Method `RestorePointCollectionsOperations.update` re-ordered its parameters from `['self', 'resource_group_name', 'restore_point_collection_name', 'parameters', 'kwargs']` to `['self', 'resource_group_name', 'restore_point_collection_name', 'properties', 'kwargs']` + ## 37.0.1 (2025-10-09) ### Bugs Fixed diff --git a/sdk/compute/azure-mgmt-compute/_metadata.json b/sdk/compute/azure-mgmt-compute/_metadata.json index 04201508acac..3acac4a64fc0 100644 --- a/sdk/compute/azure-mgmt-compute/_metadata.json +++ b/sdk/compute/azure-mgmt-compute/_metadata.json @@ -1,11 +1,7 @@ { - "commit": "3ed4c07ba75ceba9b01d5cf2e4bed0ea988d3c52", + "apiVersion": "2025-04-01", + "commit": "0c8dc3a0a993706e0847f04332ea307a8144ae40", "repository_url": "https://github.com/Azure/azure-rest-api-specs", - "autorest": "3.10.2", - "use": [ - "@autorest/python@6.40.0", - "@autorest/modelerfour@4.27.0" - ], - "autorest_command": "autorest specification/compute/resource-manager/readme.md --generate-sample=True --generate-test=True --include-x-ms-examples-original-file=True --package-mode=azure-mgmt --python --python-sdks-folder=/mnt/vss/_work/1/azure-sdk-for-python/sdk --use=@autorest/python@6.40.0 --use=@autorest/modelerfour@4.27.0 --version=3.10.2 --version-tolerant=False", - "readme": "specification/compute/resource-manager/readme.md" + "typespec_src": "specification/compute/Combine.Management", + "emitterVersion": "0.52.1" } \ No newline at end of file diff --git a/sdk/compute/azure-mgmt-compute/apiview-properties.json b/sdk/compute/azure-mgmt-compute/apiview-properties.json index 533b7bed8324..e1cfe4228ad6 100644 --- a/sdk/compute/azure-mgmt-compute/apiview-properties.json +++ b/sdk/compute/azure-mgmt-compute/apiview-properties.json @@ -1,1260 +1,1179 @@ { - "CrossLanguagePackageId": null, + "CrossLanguagePackageId": "Microsoft.Compute", "CrossLanguageDefinitionId": { - "azure.mgmt.compute.models.AccessControlRules": null, - "azure.mgmt.compute.models.AccessControlRulesIdentity": null, - "azure.mgmt.compute.models.AccessControlRulesPrivilege": null, - "azure.mgmt.compute.models.AccessControlRulesRole": null, - "azure.mgmt.compute.models.AccessControlRulesRoleAssignment": null, - "azure.mgmt.compute.models.AccessUri": null, - "azure.mgmt.compute.models.AdditionalCapabilities": null, - "azure.mgmt.compute.models.AdditionalReplicaSet": null, - "azure.mgmt.compute.models.AdditionalUnattendContent": null, - "azure.mgmt.compute.models.AllInstancesDown": null, - "azure.mgmt.compute.models.AlternativeOption": null, - "azure.mgmt.compute.models.ApiEntityReference": null, - "azure.mgmt.compute.models.ApiError": null, - "azure.mgmt.compute.models.ApiErrorBase": null, - "azure.mgmt.compute.models.ApplicationProfile": null, - "azure.mgmt.compute.models.AttachDetachDataDisksRequest": null, - "azure.mgmt.compute.models.AutomaticOSUpgradePolicy": null, - "azure.mgmt.compute.models.AutomaticOSUpgradeProperties": null, - "azure.mgmt.compute.models.AutomaticRepairsPolicy": null, - "azure.mgmt.compute.models.AutomaticZoneRebalancingPolicy": null, - "azure.mgmt.compute.models.AvailabilityPolicy": null, - "azure.mgmt.compute.models.Resource": null, - "azure.mgmt.compute.models.TrackedResource": null, - "azure.mgmt.compute.models.AvailabilitySet": null, - "azure.mgmt.compute.models.AvailabilitySetListResult": null, - "azure.mgmt.compute.models.UpdateResource": null, - "azure.mgmt.compute.models.AvailabilitySetUpdate": null, - "azure.mgmt.compute.models.AvailablePatchSummary": null, - "azure.mgmt.compute.models.BillingProfile": null, - "azure.mgmt.compute.models.BootDiagnostics": null, - "azure.mgmt.compute.models.BootDiagnosticsInstanceView": null, - "azure.mgmt.compute.models.CapacityReservation": null, - "azure.mgmt.compute.models.CapacityReservationGroup": null, - "azure.mgmt.compute.models.CapacityReservationGroupInstanceView": null, - "azure.mgmt.compute.models.CapacityReservationGroupListResult": null, - "azure.mgmt.compute.models.CapacityReservationGroupUpdate": null, - "azure.mgmt.compute.models.CapacityReservationInstanceView": null, - "azure.mgmt.compute.models.CapacityReservationInstanceViewWithName": null, - "azure.mgmt.compute.models.CapacityReservationListResult": null, - "azure.mgmt.compute.models.CapacityReservationProfile": null, - "azure.mgmt.compute.models.CapacityReservationUpdate": null, - "azure.mgmt.compute.models.CapacityReservationUtilization": null, - "azure.mgmt.compute.models.CloudService": null, - "azure.mgmt.compute.models.CloudServiceExtensionProfile": null, - "azure.mgmt.compute.models.CloudServiceExtensionProperties": null, - "azure.mgmt.compute.models.CloudServiceInstanceView": null, - "azure.mgmt.compute.models.CloudServiceListResult": null, - "azure.mgmt.compute.models.CloudServiceNetworkProfile": null, - "azure.mgmt.compute.models.CloudServiceOsProfile": null, - "azure.mgmt.compute.models.CloudServiceProperties": null, - "azure.mgmt.compute.models.CloudServiceRole": null, - "azure.mgmt.compute.models.CloudServiceRoleListResult": null, - "azure.mgmt.compute.models.CloudServiceRoleProfile": null, - "azure.mgmt.compute.models.CloudServiceRoleProfileProperties": null, - "azure.mgmt.compute.models.CloudServiceRoleProperties": null, - "azure.mgmt.compute.models.CloudServiceRoleSku": null, - "azure.mgmt.compute.models.CloudServiceUpdate": null, - "azure.mgmt.compute.models.CloudServiceVaultAndSecretReference": null, - "azure.mgmt.compute.models.CloudServiceVaultCertificate": null, - "azure.mgmt.compute.models.CloudServiceVaultSecretGroup": null, - "azure.mgmt.compute.models.PirCommunityGalleryResource": null, - "azure.mgmt.compute.models.CommunityGallery": null, - "azure.mgmt.compute.models.CommunityGalleryImage": null, - "azure.mgmt.compute.models.CommunityGalleryImageIdentifier": null, - "azure.mgmt.compute.models.CommunityGalleryImageList": null, - "azure.mgmt.compute.models.CommunityGalleryImageVersion": null, - "azure.mgmt.compute.models.CommunityGalleryImageVersionList": null, - "azure.mgmt.compute.models.CommunityGalleryInfo": null, - "azure.mgmt.compute.models.CommunityGalleryMetadata": null, - "azure.mgmt.compute.models.ConvertToVirtualMachineScaleSetInput": null, - "azure.mgmt.compute.models.CopyCompletionError": null, - "azure.mgmt.compute.models.CreationData": null, - "azure.mgmt.compute.models.DataDisk": null, - "azure.mgmt.compute.models.DataDiskImage": null, - "azure.mgmt.compute.models.DiskImageEncryption": null, - "azure.mgmt.compute.models.DataDiskImageEncryption": null, - "azure.mgmt.compute.models.DataDisksToAttach": null, - "azure.mgmt.compute.models.DataDisksToDetach": null, - "azure.mgmt.compute.models.DedicatedHost": null, - "azure.mgmt.compute.models.DedicatedHostAllocatableVM": null, - "azure.mgmt.compute.models.DedicatedHostAvailableCapacity": null, - "azure.mgmt.compute.models.DedicatedHostGroup": null, - "azure.mgmt.compute.models.DedicatedHostGroupInstanceView": null, - "azure.mgmt.compute.models.DedicatedHostGroupListResult": null, - "azure.mgmt.compute.models.DedicatedHostGroupPropertiesAdditionalCapabilities": null, - "azure.mgmt.compute.models.DedicatedHostGroupUpdate": null, - "azure.mgmt.compute.models.DedicatedHostInstanceView": null, - "azure.mgmt.compute.models.DedicatedHostInstanceViewWithName": null, - "azure.mgmt.compute.models.DedicatedHostListResult": null, - "azure.mgmt.compute.models.DedicatedHostSizeListResult": null, - "azure.mgmt.compute.models.DedicatedHostUpdate": null, - "azure.mgmt.compute.models.DefaultVirtualMachineScaleSetInfo": null, - "azure.mgmt.compute.models.DiagnosticsProfile": null, - "azure.mgmt.compute.models.DiffDiskSettings": null, - "azure.mgmt.compute.models.Disallowed": null, - "azure.mgmt.compute.models.DisallowedConfiguration": null, - "azure.mgmt.compute.models.Disk": null, - "azure.mgmt.compute.models.DiskAccess": null, - "azure.mgmt.compute.models.DiskAccessList": null, - "azure.mgmt.compute.models.DiskAccessUpdate": null, - "azure.mgmt.compute.models.DiskEncryptionSet": null, - "azure.mgmt.compute.models.DiskEncryptionSetList": null, - "azure.mgmt.compute.models.SubResource": null, - "azure.mgmt.compute.models.DiskEncryptionSetParameters": null, - "azure.mgmt.compute.models.DiskEncryptionSettings": null, - "azure.mgmt.compute.models.DiskEncryptionSetUpdate": null, - "azure.mgmt.compute.models.DiskInstanceView": null, - "azure.mgmt.compute.models.DiskList": null, - "azure.mgmt.compute.models.DiskPurchasePlan": null, - "azure.mgmt.compute.models.ProxyResource": null, - "azure.mgmt.compute.models.DiskRestorePoint": null, - "azure.mgmt.compute.models.SubResourceReadOnly": null, - "azure.mgmt.compute.models.DiskRestorePointAttributes": null, - "azure.mgmt.compute.models.DiskRestorePointInstanceView": null, - "azure.mgmt.compute.models.DiskRestorePointList": null, - "azure.mgmt.compute.models.DiskRestorePointReplicationStatus": null, - "azure.mgmt.compute.models.DiskSecurityProfile": null, - "azure.mgmt.compute.models.DiskSku": null, - "azure.mgmt.compute.models.DiskUpdate": null, - "azure.mgmt.compute.models.Encryption": null, - "azure.mgmt.compute.models.EncryptionIdentity": null, - "azure.mgmt.compute.models.EncryptionImages": null, - "azure.mgmt.compute.models.EncryptionSetIdentity": null, - "azure.mgmt.compute.models.EncryptionSettingsCollection": null, - "azure.mgmt.compute.models.EncryptionSettingsElement": null, - "azure.mgmt.compute.models.ErrorAdditionalInfo": null, - "azure.mgmt.compute.models.ErrorDetail": null, - "azure.mgmt.compute.models.ErrorResponse": null, - "azure.mgmt.compute.models.EventGridAndResourceGraph": null, - "azure.mgmt.compute.models.ExecutedValidation": null, - "azure.mgmt.compute.models.ExtendedLocation": null, - "azure.mgmt.compute.models.Extension": null, - "azure.mgmt.compute.models.Gallery": null, - "azure.mgmt.compute.models.GalleryApplication": null, - "azure.mgmt.compute.models.GalleryApplicationCustomAction": null, - "azure.mgmt.compute.models.GalleryApplicationCustomActionParameter": null, - "azure.mgmt.compute.models.GalleryApplicationList": null, - "azure.mgmt.compute.models.UpdateResourceDefinition": null, - "azure.mgmt.compute.models.GalleryApplicationUpdate": null, - "azure.mgmt.compute.models.GalleryApplicationVersion": null, - "azure.mgmt.compute.models.GalleryApplicationVersionList": null, - "azure.mgmt.compute.models.GalleryArtifactPublishingProfileBase": null, - "azure.mgmt.compute.models.GalleryApplicationVersionPublishingProfile": null, - "azure.mgmt.compute.models.GalleryArtifactSafetyProfileBase": null, - "azure.mgmt.compute.models.GalleryApplicationVersionSafetyProfile": null, - "azure.mgmt.compute.models.GalleryApplicationVersionUpdate": null, - "azure.mgmt.compute.models.GalleryArtifactVersionSource": null, - "azure.mgmt.compute.models.GalleryArtifactVersionFullSource": null, - "azure.mgmt.compute.models.GalleryDiskImage": null, - "azure.mgmt.compute.models.GalleryDataDiskImage": null, - "azure.mgmt.compute.models.GalleryDiskImageSource": null, - "azure.mgmt.compute.models.GalleryExtendedLocation": null, - "azure.mgmt.compute.models.GalleryIdentifier": null, - "azure.mgmt.compute.models.GalleryIdentity": null, - "azure.mgmt.compute.models.GalleryImage": null, - "azure.mgmt.compute.models.GalleryImageFeature": null, - "azure.mgmt.compute.models.GalleryImageIdentifier": null, - "azure.mgmt.compute.models.GalleryImageList": null, - "azure.mgmt.compute.models.GalleryImageUpdate": null, - "azure.mgmt.compute.models.GalleryImageVersion": null, - "azure.mgmt.compute.models.GalleryImageVersionList": null, - "azure.mgmt.compute.models.GalleryImageVersionPublishingProfile": null, - "azure.mgmt.compute.models.GalleryImageVersionSafetyProfile": null, - "azure.mgmt.compute.models.GalleryImageVersionStorageProfile": null, - "azure.mgmt.compute.models.GalleryImageVersionUefiSettings": null, - "azure.mgmt.compute.models.GalleryImageVersionUpdate": null, - "azure.mgmt.compute.models.GalleryInVMAccessControlProfile": null, - "azure.mgmt.compute.models.GalleryInVMAccessControlProfileList": null, - "azure.mgmt.compute.models.GalleryResourceProfilePropertiesBase": null, - "azure.mgmt.compute.models.GalleryInVMAccessControlProfileProperties": null, - "azure.mgmt.compute.models.GalleryInVMAccessControlProfileUpdate": null, - "azure.mgmt.compute.models.GalleryInVMAccessControlProfileVersion": null, - "azure.mgmt.compute.models.GalleryInVMAccessControlProfileVersionList": null, - "azure.mgmt.compute.models.GalleryResourceProfileVersionPropertiesBase": null, - "azure.mgmt.compute.models.GalleryInVMAccessControlProfileVersionProperties": null, - "azure.mgmt.compute.models.GalleryInVMAccessControlProfileVersionUpdate": null, - "azure.mgmt.compute.models.GalleryList": null, - "azure.mgmt.compute.models.GalleryOSDiskImage": null, - "azure.mgmt.compute.models.GallerySoftDeletedResource": null, - "azure.mgmt.compute.models.GallerySoftDeletedResourceList": null, - "azure.mgmt.compute.models.GalleryTargetExtendedLocation": null, - "azure.mgmt.compute.models.GalleryUpdate": null, - "azure.mgmt.compute.models.GrantAccessData": null, - "azure.mgmt.compute.models.HardwareProfile": null, - "azure.mgmt.compute.models.HostEndpointSettings": null, - "azure.mgmt.compute.models.Image": null, - "azure.mgmt.compute.models.ImageDisk": null, - "azure.mgmt.compute.models.ImageDataDisk": null, - "azure.mgmt.compute.models.ImageDeprecationStatus": null, - "azure.mgmt.compute.models.ImageDiskReference": null, - "azure.mgmt.compute.models.ImageListResult": null, - "azure.mgmt.compute.models.ImageOSDisk": null, - "azure.mgmt.compute.models.ImagePurchasePlan": null, - "azure.mgmt.compute.models.ImageReference": null, - "azure.mgmt.compute.models.ImageStorageProfile": null, - "azure.mgmt.compute.models.ImageUpdate": null, - "azure.mgmt.compute.models.ImageVersionSecurityProfile": null, - "azure.mgmt.compute.models.InnerError": null, - "azure.mgmt.compute.models.InstanceSku": null, - "azure.mgmt.compute.models.InstanceViewStatus": null, - "azure.mgmt.compute.models.InstanceViewStatusesSummary": null, - "azure.mgmt.compute.models.KeyForDiskEncryptionSet": null, - "azure.mgmt.compute.models.KeyVaultAndKeyReference": null, - "azure.mgmt.compute.models.KeyVaultAndSecretReference": null, - "azure.mgmt.compute.models.KeyVaultKeyReference": null, - "azure.mgmt.compute.models.KeyVaultSecretReference": null, - "azure.mgmt.compute.models.LastPatchInstallationSummary": null, - "azure.mgmt.compute.models.LinuxConfiguration": null, - "azure.mgmt.compute.models.LinuxParameters": null, - "azure.mgmt.compute.models.LinuxPatchSettings": null, - "azure.mgmt.compute.models.LinuxVMGuestPatchAutomaticByPlatformSettings": null, - "azure.mgmt.compute.models.ListUsagesResult": null, - "azure.mgmt.compute.models.LoadBalancerConfiguration": null, - "azure.mgmt.compute.models.LoadBalancerConfigurationProperties": null, - "azure.mgmt.compute.models.LoadBalancerFrontendIpConfiguration": null, - "azure.mgmt.compute.models.LoadBalancerFrontendIpConfigurationProperties": null, - "azure.mgmt.compute.models.LogAnalyticsInputBase": null, - "azure.mgmt.compute.models.LogAnalyticsOperationResult": null, - "azure.mgmt.compute.models.LogAnalyticsOutput": null, - "azure.mgmt.compute.models.MaintenanceRedeployStatus": null, - "azure.mgmt.compute.models.ManagedDiskParameters": null, - "azure.mgmt.compute.models.MaxInstancePercentPerZonePolicy": null, - "azure.mgmt.compute.models.MigrateToVirtualMachineScaleSetInput": null, - "azure.mgmt.compute.models.MigrateVMToVirtualMachineScaleSetInput": null, - "azure.mgmt.compute.models.NetworkInterfaceReference": null, - "azure.mgmt.compute.models.NetworkProfile": null, - "azure.mgmt.compute.models.Operation": null, - "azure.mgmt.compute.models.OperationDisplay": null, - "azure.mgmt.compute.models.OperationListResult": null, - "azure.mgmt.compute.models.OrchestrationServiceStateInput": null, - "azure.mgmt.compute.models.OrchestrationServiceSummary": null, - "azure.mgmt.compute.models.OSDisk": null, - "azure.mgmt.compute.models.OSDiskImage": null, - "azure.mgmt.compute.models.OSDiskImageEncryption": null, - "azure.mgmt.compute.models.OSDiskImageSecurityProfile": null, - "azure.mgmt.compute.models.OSFamily": null, - "azure.mgmt.compute.models.OSFamilyListResult": null, - "azure.mgmt.compute.models.OSFamilyProperties": null, - "azure.mgmt.compute.models.OSImageNotificationProfile": null, - "azure.mgmt.compute.models.OSProfile": null, - "azure.mgmt.compute.models.OSProfileProvisioningData": null, - "azure.mgmt.compute.models.OSVersion": null, - "azure.mgmt.compute.models.OSVersionListResult": null, - "azure.mgmt.compute.models.OSVersionProperties": null, - "azure.mgmt.compute.models.OSVersionPropertiesBase": null, - "azure.mgmt.compute.models.PatchInstallationDetail": null, - "azure.mgmt.compute.models.PatchSettings": null, - "azure.mgmt.compute.models.PirResource": null, - "azure.mgmt.compute.models.PirSharedGalleryResource": null, - "azure.mgmt.compute.models.Placement": null, - "azure.mgmt.compute.models.Plan": null, - "azure.mgmt.compute.models.PlatformAttribute": null, - "azure.mgmt.compute.models.PolicyViolation": null, - "azure.mgmt.compute.models.PriorityMixPolicy": null, - "azure.mgmt.compute.models.PrivateEndpoint": null, - "azure.mgmt.compute.models.PrivateEndpointConnection": null, - "azure.mgmt.compute.models.PrivateEndpointConnectionListResult": null, - "azure.mgmt.compute.models.PrivateLinkResource": null, - "azure.mgmt.compute.models.PrivateLinkResourceListResult": null, - "azure.mgmt.compute.models.PrivateLinkServiceConnectionState": null, - "azure.mgmt.compute.models.PropertyUpdatesInProgress": null, - "azure.mgmt.compute.models.ProximityPlacementGroup": null, - "azure.mgmt.compute.models.ProximityPlacementGroupListResult": null, - "azure.mgmt.compute.models.ProximityPlacementGroupPropertiesIntent": null, - "azure.mgmt.compute.models.ProximityPlacementGroupUpdate": null, - "azure.mgmt.compute.models.ProxyAgentSettings": null, - "azure.mgmt.compute.models.PublicIPAddressSku": null, - "azure.mgmt.compute.models.PurchasePlan": null, - "azure.mgmt.compute.models.RecommendedMachineConfiguration": null, - "azure.mgmt.compute.models.RecoveryWalkResponse": null, - "azure.mgmt.compute.models.RegionalReplicationStatus": null, - "azure.mgmt.compute.models.RegionalSharingStatus": null, - "azure.mgmt.compute.models.ReplicationStatus": null, - "azure.mgmt.compute.models.RequestRateByIntervalInput": null, - "azure.mgmt.compute.models.ResiliencyPolicy": null, - "azure.mgmt.compute.models.ResilientVMCreationPolicy": null, - "azure.mgmt.compute.models.ResilientVMDeletionPolicy": null, - "azure.mgmt.compute.models.ResourceInstanceViewStatus": null, - "azure.mgmt.compute.models.ResourceRange": null, - "azure.mgmt.compute.models.ResourceSharingProfile": null, - "azure.mgmt.compute.models.ResourceSku": null, - "azure.mgmt.compute.models.ResourceSkuCapabilities": null, - "azure.mgmt.compute.models.ResourceSkuCapacity": null, - "azure.mgmt.compute.models.ResourceSkuCosts": null, - "azure.mgmt.compute.models.ResourceSkuLocationInfo": null, - "azure.mgmt.compute.models.ResourceSkuRestrictionInfo": null, - "azure.mgmt.compute.models.ResourceSkuRestrictions": null, - "azure.mgmt.compute.models.ResourceSkusResult": null, - "azure.mgmt.compute.models.ResourceSkuZoneDetails": null, - "azure.mgmt.compute.models.ResourceUriList": null, - "azure.mgmt.compute.models.ResourceWithOptionalLocation": null, - "azure.mgmt.compute.models.RestorePoint": null, - "azure.mgmt.compute.models.RestorePointCollection": null, - "azure.mgmt.compute.models.RestorePointCollectionListResult": null, - "azure.mgmt.compute.models.RestorePointCollectionSourceProperties": null, - "azure.mgmt.compute.models.RestorePointCollectionUpdate": null, - "azure.mgmt.compute.models.RestorePointEncryption": null, - "azure.mgmt.compute.models.RestorePointInstanceView": null, - "azure.mgmt.compute.models.RestorePointSourceMetadata": null, - "azure.mgmt.compute.models.RestorePointSourceVMDataDisk": null, - "azure.mgmt.compute.models.RestorePointSourceVMOSDisk": null, - "azure.mgmt.compute.models.RestorePointSourceVMStorageProfile": null, - "azure.mgmt.compute.models.RetrieveBootDiagnosticsDataResult": null, - "azure.mgmt.compute.models.RoleInstance": null, - "azure.mgmt.compute.models.RoleInstanceListResult": null, - "azure.mgmt.compute.models.RoleInstanceNetworkProfile": null, - "azure.mgmt.compute.models.RoleInstanceProperties": null, - "azure.mgmt.compute.models.RoleInstances": null, - "azure.mgmt.compute.models.RoleInstanceView": null, - "azure.mgmt.compute.models.RollbackStatusInfo": null, - "azure.mgmt.compute.models.RollingUpgradePolicy": null, - "azure.mgmt.compute.models.RollingUpgradeProgressInfo": null, - "azure.mgmt.compute.models.RollingUpgradeRunningStatus": null, - "azure.mgmt.compute.models.RollingUpgradeStatusInfo": null, - "azure.mgmt.compute.models.RunCommandDocumentBase": null, - "azure.mgmt.compute.models.RunCommandDocument": null, - "azure.mgmt.compute.models.RunCommandInput": null, - "azure.mgmt.compute.models.RunCommandInputParameter": null, - "azure.mgmt.compute.models.RunCommandListResult": null, - "azure.mgmt.compute.models.RunCommandManagedIdentity": null, - "azure.mgmt.compute.models.RunCommandParameterDefinition": null, - "azure.mgmt.compute.models.RunCommandResult": null, - "azure.mgmt.compute.models.ScaleInPolicy": null, - "azure.mgmt.compute.models.ScheduledEventsAdditionalPublishingTargets": null, - "azure.mgmt.compute.models.ScheduledEventsPolicy": null, - "azure.mgmt.compute.models.ScheduledEventsProfile": null, - "azure.mgmt.compute.models.ScheduleProfile": null, - "azure.mgmt.compute.models.SecurityPostureReference": null, - "azure.mgmt.compute.models.SecurityPostureReferenceUpdate": null, - "azure.mgmt.compute.models.SecurityProfile": null, - "azure.mgmt.compute.models.ServiceArtifactReference": null, - "azure.mgmt.compute.models.SharedGallery": null, - "azure.mgmt.compute.models.SharedGalleryDiskImage": null, - "azure.mgmt.compute.models.SharedGalleryDataDiskImage": null, - "azure.mgmt.compute.models.SharedGalleryImage": null, - "azure.mgmt.compute.models.SharedGalleryImageList": null, - "azure.mgmt.compute.models.SharedGalleryImageVersion": null, - "azure.mgmt.compute.models.SharedGalleryImageVersionList": null, - "azure.mgmt.compute.models.SharedGalleryImageVersionStorageProfile": null, - "azure.mgmt.compute.models.SharedGalleryList": null, - "azure.mgmt.compute.models.SharedGalleryOSDiskImage": null, - "azure.mgmt.compute.models.ShareInfoElement": null, - "azure.mgmt.compute.models.SharingProfile": null, - "azure.mgmt.compute.models.SharingProfileGroup": null, - "azure.mgmt.compute.models.SharingStatus": null, - "azure.mgmt.compute.models.SharingUpdate": null, - "azure.mgmt.compute.models.Sku": null, - "azure.mgmt.compute.models.SkuProfile": null, - "azure.mgmt.compute.models.SkuProfileVMSize": null, - "azure.mgmt.compute.models.Snapshot": null, - "azure.mgmt.compute.models.SnapshotList": null, - "azure.mgmt.compute.models.SnapshotSku": null, - "azure.mgmt.compute.models.SnapshotUpdate": null, - "azure.mgmt.compute.models.SoftDeletePolicy": null, - "azure.mgmt.compute.models.SourceVault": null, - "azure.mgmt.compute.models.SpotRestorePolicy": null, - "azure.mgmt.compute.models.SshConfiguration": null, - "azure.mgmt.compute.models.SshGenerateKeyPairInputParameters": null, - "azure.mgmt.compute.models.SshPublicKey": null, - "azure.mgmt.compute.models.SshPublicKeyGenerateKeyPairResult": null, - "azure.mgmt.compute.models.SshPublicKeyResource": null, - "azure.mgmt.compute.models.SshPublicKeysGroupListResult": null, - "azure.mgmt.compute.models.SshPublicKeyUpdateResource": null, - "azure.mgmt.compute.models.StatusCodeCount": null, - "azure.mgmt.compute.models.StorageProfile": null, - "azure.mgmt.compute.models.SubResourceWithColocationStatus": null, - "azure.mgmt.compute.models.SupportedCapabilities": null, - "azure.mgmt.compute.models.SystemData": null, - "azure.mgmt.compute.models.TargetRegion": null, - "azure.mgmt.compute.models.TerminateNotificationProfile": null, - "azure.mgmt.compute.models.ThrottledRequestsInput": null, - "azure.mgmt.compute.models.UefiKey": null, - "azure.mgmt.compute.models.UefiKeySignatures": null, - "azure.mgmt.compute.models.UefiSettings": null, - "azure.mgmt.compute.models.UpdateDomain": null, - "azure.mgmt.compute.models.UpdateDomainListResult": null, - "azure.mgmt.compute.models.UpgradeOperationHistoricalStatusInfo": null, - "azure.mgmt.compute.models.UpgradeOperationHistoricalStatusInfoProperties": null, - "azure.mgmt.compute.models.UpgradeOperationHistoryStatus": null, - "azure.mgmt.compute.models.UpgradePolicy": null, - "azure.mgmt.compute.models.Usage": null, - "azure.mgmt.compute.models.UsageName": null, - "azure.mgmt.compute.models.UserArtifactManage": null, - "azure.mgmt.compute.models.UserArtifactSettings": null, - "azure.mgmt.compute.models.UserArtifactSource": null, - "azure.mgmt.compute.models.UserAssignedIdentitiesValue": null, - "azure.mgmt.compute.models.UserInitiatedReboot": null, - "azure.mgmt.compute.models.UserInitiatedRedeploy": null, - "azure.mgmt.compute.models.ValidationsProfile": null, - "azure.mgmt.compute.models.VaultCertificate": null, - "azure.mgmt.compute.models.VaultSecretGroup": null, - "azure.mgmt.compute.models.VirtualHardDisk": null, - "azure.mgmt.compute.models.VirtualMachine": null, - "azure.mgmt.compute.models.VirtualMachineAgentInstanceView": null, - "azure.mgmt.compute.models.VirtualMachineAssessPatchesResult": null, - "azure.mgmt.compute.models.VirtualMachineCaptureParameters": null, - "azure.mgmt.compute.models.VirtualMachineCaptureResult": null, - "azure.mgmt.compute.models.VirtualMachineExtension": null, - "azure.mgmt.compute.models.VirtualMachineExtensionHandlerInstanceView": null, - "azure.mgmt.compute.models.VirtualMachineExtensionImage": null, - "azure.mgmt.compute.models.VirtualMachineExtensionInstanceView": null, - "azure.mgmt.compute.models.VirtualMachineExtensionsListResult": null, - "azure.mgmt.compute.models.VirtualMachineExtensionUpdate": null, - "azure.mgmt.compute.models.VirtualMachineHealthStatus": null, - "azure.mgmt.compute.models.VirtualMachineIdentity": null, - "azure.mgmt.compute.models.VirtualMachineImageResource": null, - "azure.mgmt.compute.models.VirtualMachineImage": null, - "azure.mgmt.compute.models.VirtualMachineImageFeature": null, - "azure.mgmt.compute.models.VirtualMachineInstallPatchesParameters": null, - "azure.mgmt.compute.models.VirtualMachineInstallPatchesResult": null, - "azure.mgmt.compute.models.VirtualMachineInstanceView": null, - "azure.mgmt.compute.models.VirtualMachineIpTag": null, - "azure.mgmt.compute.models.VirtualMachineListResult": null, - "azure.mgmt.compute.models.VirtualMachineNetworkInterfaceConfiguration": null, - "azure.mgmt.compute.models.VirtualMachineNetworkInterfaceDnsSettingsConfiguration": null, - "azure.mgmt.compute.models.VirtualMachineNetworkInterfaceIPConfiguration": null, - "azure.mgmt.compute.models.VirtualMachinePatchStatus": null, - "azure.mgmt.compute.models.VirtualMachinePublicIPAddressConfiguration": null, - "azure.mgmt.compute.models.VirtualMachinePublicIPAddressDnsSettingsConfiguration": null, - "azure.mgmt.compute.models.VirtualMachineReimageParameters": null, - "azure.mgmt.compute.models.VirtualMachineRunCommand": null, - "azure.mgmt.compute.models.VirtualMachineRunCommandInstanceView": null, - "azure.mgmt.compute.models.VirtualMachineRunCommandScriptSource": null, - "azure.mgmt.compute.models.VirtualMachineRunCommandsListResult": null, - "azure.mgmt.compute.models.VirtualMachineRunCommandUpdate": null, - "azure.mgmt.compute.models.VirtualMachineScaleSet": null, - "azure.mgmt.compute.models.VirtualMachineScaleSetDataDisk": null, - "azure.mgmt.compute.models.VirtualMachineScaleSetExtension": null, - "azure.mgmt.compute.models.VirtualMachineScaleSetExtensionListResult": null, - "azure.mgmt.compute.models.VirtualMachineScaleSetExtensionProfile": null, - "azure.mgmt.compute.models.VirtualMachineScaleSetExtensionUpdate": null, - "azure.mgmt.compute.models.VirtualMachineScaleSetHardwareProfile": null, - "azure.mgmt.compute.models.VirtualMachineScaleSetIdentity": null, - "azure.mgmt.compute.models.VirtualMachineScaleSetInstanceView": null, - "azure.mgmt.compute.models.VirtualMachineScaleSetInstanceViewStatusesSummary": null, - "azure.mgmt.compute.models.VirtualMachineScaleSetIPConfiguration": null, - "azure.mgmt.compute.models.VirtualMachineScaleSetIpTag": null, - "azure.mgmt.compute.models.VirtualMachineScaleSetListOSUpgradeHistory": null, - "azure.mgmt.compute.models.VirtualMachineScaleSetListResult": null, - "azure.mgmt.compute.models.VirtualMachineScaleSetListSkusResult": null, - "azure.mgmt.compute.models.VirtualMachineScaleSetListWithLinkResult": null, - "azure.mgmt.compute.models.VirtualMachineScaleSetManagedDiskParameters": null, - "azure.mgmt.compute.models.VirtualMachineScaleSetMigrationInfo": null, - "azure.mgmt.compute.models.VirtualMachineScaleSetNetworkConfiguration": null, - "azure.mgmt.compute.models.VirtualMachineScaleSetNetworkConfigurationDnsSettings": null, - "azure.mgmt.compute.models.VirtualMachineScaleSetNetworkProfile": null, - "azure.mgmt.compute.models.VirtualMachineScaleSetOSDisk": null, - "azure.mgmt.compute.models.VirtualMachineScaleSetOSProfile": null, - "azure.mgmt.compute.models.VirtualMachineScaleSetPublicIPAddressConfiguration": null, - "azure.mgmt.compute.models.VirtualMachineScaleSetPublicIPAddressConfigurationDnsSettings": null, - "azure.mgmt.compute.models.VirtualMachineScaleSetVMReimageParameters": null, - "azure.mgmt.compute.models.VirtualMachineScaleSetReimageParameters": null, - "azure.mgmt.compute.models.VirtualMachineScaleSetSku": null, - "azure.mgmt.compute.models.VirtualMachineScaleSetSkuCapacity": null, - "azure.mgmt.compute.models.VirtualMachineScaleSetStorageProfile": null, - "azure.mgmt.compute.models.VirtualMachineScaleSetUpdate": null, - "azure.mgmt.compute.models.VirtualMachineScaleSetUpdateIPConfiguration": null, - "azure.mgmt.compute.models.VirtualMachineScaleSetUpdateNetworkConfiguration": null, - "azure.mgmt.compute.models.VirtualMachineScaleSetUpdateNetworkProfile": null, - "azure.mgmt.compute.models.VirtualMachineScaleSetUpdateOSDisk": null, - "azure.mgmt.compute.models.VirtualMachineScaleSetUpdateOSProfile": null, - "azure.mgmt.compute.models.VirtualMachineScaleSetUpdatePublicIPAddressConfiguration": null, - "azure.mgmt.compute.models.VirtualMachineScaleSetUpdateStorageProfile": null, - "azure.mgmt.compute.models.VirtualMachineScaleSetUpdateVMProfile": null, - "azure.mgmt.compute.models.VirtualMachineScaleSetVM": null, - "azure.mgmt.compute.models.VirtualMachineScaleSetVMExtension": null, - "azure.mgmt.compute.models.VirtualMachineScaleSetVMExtensionsListResult": null, - "azure.mgmt.compute.models.VirtualMachineScaleSetVMExtensionsSummary": null, - "azure.mgmt.compute.models.VirtualMachineScaleSetVMExtensionUpdate": null, - "azure.mgmt.compute.models.VirtualMachineScaleSetVMInstanceIDs": null, - "azure.mgmt.compute.models.VirtualMachineScaleSetVMInstanceRequiredIDs": null, - "azure.mgmt.compute.models.VirtualMachineScaleSetVMInstanceView": null, - "azure.mgmt.compute.models.VirtualMachineScaleSetVMListResult": null, - "azure.mgmt.compute.models.VirtualMachineScaleSetVMNetworkProfileConfiguration": null, - "azure.mgmt.compute.models.VirtualMachineScaleSetVMProfile": null, - "azure.mgmt.compute.models.VirtualMachineScaleSetVMProtectionPolicy": null, - "azure.mgmt.compute.models.VirtualMachineSize": null, - "azure.mgmt.compute.models.VirtualMachineSizeListResult": null, - "azure.mgmt.compute.models.VirtualMachineSoftwarePatchProperties": null, - "azure.mgmt.compute.models.VirtualMachineStatusCodeCount": null, - "azure.mgmt.compute.models.VirtualMachineUpdate": null, - "azure.mgmt.compute.models.VMDiskSecurityProfile": null, - "azure.mgmt.compute.models.VMGalleryApplication": null, - "azure.mgmt.compute.models.VmImagesInEdgeZoneListResult": null, - "azure.mgmt.compute.models.VMScaleSetConvertToSinglePlacementGroupInput": null, - "azure.mgmt.compute.models.VMScaleSetScaleOutInput": null, - "azure.mgmt.compute.models.VMScaleSetScaleOutInputProperties": null, - "azure.mgmt.compute.models.VMSizeProperties": null, - "azure.mgmt.compute.models.WindowsConfiguration": null, - "azure.mgmt.compute.models.WindowsParameters": null, - "azure.mgmt.compute.models.WindowsVMGuestPatchAutomaticByPlatformSettings": null, - "azure.mgmt.compute.models.WinRMConfiguration": null, - "azure.mgmt.compute.models.WinRMListener": null, - "azure.mgmt.compute.models.ZoneAllocationPolicy": null, - "azure.mgmt.compute.models.Origin": null, - "azure.mgmt.compute.models.ActionType": null, - "azure.mgmt.compute.models.StatusLevelTypes": null, - "azure.mgmt.compute.models.CreatedByType": null, - "azure.mgmt.compute.models.ReservationType": null, - "azure.mgmt.compute.models.CachingTypes": null, - "azure.mgmt.compute.models.StorageAccountTypes": null, - "azure.mgmt.compute.models.ExtendedLocationTypes": null, - "azure.mgmt.compute.models.OperatingSystemTypes": null, - "azure.mgmt.compute.models.OperatingSystemStateTypes": null, - "azure.mgmt.compute.models.HyperVGenerationTypes": null, - "azure.mgmt.compute.models.SettingNames": null, - "azure.mgmt.compute.models.ProtocolTypes": null, - "azure.mgmt.compute.models.DiskCreateOptionTypes": null, - "azure.mgmt.compute.models.SecurityEncryptionTypes": null, - "azure.mgmt.compute.models.DiskDeleteOptionTypes": null, - "azure.mgmt.compute.models.PublicIPAddressSkuName": null, - "azure.mgmt.compute.models.PublicIPAddressSkuTier": null, - "azure.mgmt.compute.models.DomainNameLabelScopeTypes": null, - "azure.mgmt.compute.models.IPVersion": null, - "azure.mgmt.compute.models.DeleteOptions": null, - "azure.mgmt.compute.models.NetworkInterfaceAuxiliaryMode": null, - "azure.mgmt.compute.models.NetworkInterfaceAuxiliarySku": null, - "azure.mgmt.compute.models.VirtualMachineScaleSetScaleInRules": null, - "azure.mgmt.compute.models.ResourceIdentityType": null, - "azure.mgmt.compute.models.ZonePlacementPolicyType": null, - "azure.mgmt.compute.models.UpgradeMode": null, - "azure.mgmt.compute.models.RepairAction": null, - "azure.mgmt.compute.models.WindowsVMGuestPatchMode": null, - "azure.mgmt.compute.models.WindowsPatchAssessmentMode": null, - "azure.mgmt.compute.models.WindowsVMGuestPatchAutomaticByPlatformRebootSetting": null, - "azure.mgmt.compute.models.LinuxVMGuestPatchMode": null, - "azure.mgmt.compute.models.LinuxPatchAssessmentMode": null, - "azure.mgmt.compute.models.LinuxVMGuestPatchAutomaticByPlatformRebootSetting": null, - "azure.mgmt.compute.models.DiffDiskOptions": null, - "azure.mgmt.compute.models.DiffDiskPlacement": null, - "azure.mgmt.compute.models.DiskControllerTypes": null, - "azure.mgmt.compute.models.NetworkApiVersion": null, - "azure.mgmt.compute.models.SecurityTypes": null, - "azure.mgmt.compute.models.Mode": null, - "azure.mgmt.compute.models.Modes": null, - "azure.mgmt.compute.models.VirtualMachinePriorityTypes": null, - "azure.mgmt.compute.models.VirtualMachineEvictionPolicyTypes": null, - "azure.mgmt.compute.models.OrchestrationMode": null, - "azure.mgmt.compute.models.RebalanceStrategy": null, - "azure.mgmt.compute.models.RebalanceBehavior": null, - "azure.mgmt.compute.models.ZonalPlatformFaultDomainAlignMode": null, - "azure.mgmt.compute.models.AllocationStrategy": null, - "azure.mgmt.compute.models.HighSpeedInterconnectPlacement": null, - "azure.mgmt.compute.models.DiskDetachOptionTypes": null, - "azure.mgmt.compute.models.IPVersions": null, - "azure.mgmt.compute.models.PublicIPAllocationMethod": null, - "azure.mgmt.compute.models.VirtualMachineSizeTypes": null, - "azure.mgmt.compute.models.HyperVGenerationType": null, - "azure.mgmt.compute.models.MaintenanceOperationResultCodeTypes": null, - "azure.mgmt.compute.models.PatchOperationStatus": null, - "azure.mgmt.compute.models.ProximityPlacementGroupType": null, - "azure.mgmt.compute.models.RestorePointEncryptionType": null, - "azure.mgmt.compute.models.OperatingSystemType": null, - "azure.mgmt.compute.models.ConsistencyModeTypes": null, - "azure.mgmt.compute.models.DedicatedHostLicenseTypes": null, - "azure.mgmt.compute.models.OrchestrationServiceNames": null, - "azure.mgmt.compute.models.OrchestrationServiceState": null, - "azure.mgmt.compute.models.OrchestrationServiceOperationStatus": null, - "azure.mgmt.compute.models.UpgradeState": null, - "azure.mgmt.compute.models.UpgradeOperationInvoker": null, - "azure.mgmt.compute.models.VirtualMachineScaleSetSkuScaleType": null, - "azure.mgmt.compute.models.HyperVGeneration": null, - "azure.mgmt.compute.models.ResilientVMDeletionStatus": null, - "azure.mgmt.compute.models.ScriptShellTypes": null, - "azure.mgmt.compute.models.ExecutionState": null, - "azure.mgmt.compute.models.VMGuestPatchRebootBehavior": null, - "azure.mgmt.compute.models.PatchAssessmentState": null, - "azure.mgmt.compute.models.VMGuestPatchClassificationWindows": null, - "azure.mgmt.compute.models.VMGuestPatchClassificationLinux": null, - "azure.mgmt.compute.models.PatchInstallationState": null, - "azure.mgmt.compute.models.VmDiskTypes": null, - "azure.mgmt.compute.models.ArchitectureTypes": null, - "azure.mgmt.compute.models.ImageState": null, - "azure.mgmt.compute.models.AlternativeType": null, - "azure.mgmt.compute.models.PrivateEndpointServiceConnectionStatus": null, - "azure.mgmt.compute.models.PrivateEndpointConnectionProvisioningState": null, - "azure.mgmt.compute.models.DiskEncryptionSetIdentityType": null, - "azure.mgmt.compute.models.DiskEncryptionSetType": null, - "azure.mgmt.compute.models.DiskStorageAccountTypes": null, - "azure.mgmt.compute.models.Architecture": null, - "azure.mgmt.compute.models.SupportedSecurityOption": null, - "azure.mgmt.compute.models.DiskCreateOption": null, - "azure.mgmt.compute.models.ProvisionedBandwidthCopyOption": null, - "azure.mgmt.compute.models.DiskState": null, - "azure.mgmt.compute.models.EncryptionType": null, - "azure.mgmt.compute.models.NetworkAccessPolicy": null, - "azure.mgmt.compute.models.DiskSecurityTypes": null, - "azure.mgmt.compute.models.PublicNetworkAccess": null, - "azure.mgmt.compute.models.DataAccessAuthMode": null, - "azure.mgmt.compute.models.AvailabilityPolicyDiskDelay": null, - "azure.mgmt.compute.models.SnapshotStorageAccountTypes": null, - "azure.mgmt.compute.models.CopyCompletionErrorReason": null, - "azure.mgmt.compute.models.SnapshotAccessState": null, - "azure.mgmt.compute.models.ExtendedLocationType": null, - "azure.mgmt.compute.models.ResourceSkuRestrictionsType": null, - "azure.mgmt.compute.models.ResourceSkuRestrictionsReasonCode": null, - "azure.mgmt.compute.models.ResourceSkuCapacityScaleType": null, - "azure.mgmt.compute.models.SharingProfileGroupTypes": null, - "azure.mgmt.compute.models.SharingState": null, - "azure.mgmt.compute.models.GalleryProvisioningState": null, - "azure.mgmt.compute.models.GallerySharingPermissionTypes": null, - "azure.mgmt.compute.models.UefiSignatureTemplateName": null, - "azure.mgmt.compute.models.UefiKeyType": null, - "azure.mgmt.compute.models.SharedGalleryHostCaching": null, - "azure.mgmt.compute.models.GalleryApplicationCustomActionParameterType": null, - "azure.mgmt.compute.models.StorageAccountType": null, - "azure.mgmt.compute.models.ConfidentialVMEncryptionType": null, - "azure.mgmt.compute.models.GalleryExtendedLocationType": null, - "azure.mgmt.compute.models.EdgeZoneStorageAccountType": null, - "azure.mgmt.compute.models.ReplicationState": null, - "azure.mgmt.compute.models.ReplicationMode": null, - "azure.mgmt.compute.models.GalleryApplicationScriptRebootBehavior": null, - "azure.mgmt.compute.models.AggregatedReplicationState": null, - "azure.mgmt.compute.models.HostCaching": null, - "azure.mgmt.compute.models.PolicyViolationCategory": null, - "azure.mgmt.compute.models.ValidationStatus": null, - "azure.mgmt.compute.models.EndpointTypes": null, - "azure.mgmt.compute.models.AccessControlRulesMode": null, - "azure.mgmt.compute.models.EndpointAccess": null, - "azure.mgmt.compute.models.SoftDeletedArtifactTypes": null, - "azure.mgmt.compute.models.CloudServiceUpgradeMode": null, - "azure.mgmt.compute.models.CloudServiceSlotType": null, - "azure.mgmt.compute.models.ExpandTypesForGetCapacityReservationGroups": null, - "azure.mgmt.compute.models.ResourceIdOptionsForGetCapacityReservationGroups": null, - "azure.mgmt.compute.models.ExpandTypesForListVMs": null, - "azure.mgmt.compute.models.CapacityReservationGroupInstanceViewTypes": null, - "azure.mgmt.compute.models.CapacityReservationInstanceViewTypes": null, - "azure.mgmt.compute.models.RestorePointCollectionExpandOptions": null, - "azure.mgmt.compute.models.RestorePointExpandOptions": null, - "azure.mgmt.compute.models.SshEncryptionTypes": null, - "azure.mgmt.compute.models.ExpandTypesForGetVMScaleSets": null, - "azure.mgmt.compute.models.OrchestrationServiceStateAction": null, - "azure.mgmt.compute.models.ExpandTypeForListVMs": null, - "azure.mgmt.compute.models.VMGuestPatchRebootSetting": null, - "azure.mgmt.compute.models.VMGuestPatchRebootStatus": null, - "azure.mgmt.compute.models.AccessLevel": null, - "azure.mgmt.compute.models.FileFormat": null, - "azure.mgmt.compute.models.SharedToValues": null, - "azure.mgmt.compute.models.SelectPermissions": null, - "azure.mgmt.compute.models.GalleryExpandParams": null, - "azure.mgmt.compute.models.ReplicationStatusTypes": null, - "azure.mgmt.compute.models.SharingUpdateOperationTypes": null, - "azure.mgmt.compute.models.AvailabilitySetSkuTypes": null, - "azure.mgmt.compute.models.IntervalInMins": null, - "azure.mgmt.compute.models.RollingUpgradeStatusCode": null, - "azure.mgmt.compute.models.RollingUpgradeActionType": null, - "azure.mgmt.compute.models.InstanceViewTypes": null, - "azure.mgmt.compute.operations.Operations.list": null, - "azure.mgmt.compute.aio.operations.Operations.list": null, - "azure.mgmt.compute.operations.AvailabilitySetsOperations.list_by_subscription": null, - "azure.mgmt.compute.aio.operations.AvailabilitySetsOperations.list_by_subscription": null, - "azure.mgmt.compute.operations.AvailabilitySetsOperations.list": null, - "azure.mgmt.compute.aio.operations.AvailabilitySetsOperations.list": null, - "azure.mgmt.compute.operations.AvailabilitySetsOperations.get": null, - "azure.mgmt.compute.aio.operations.AvailabilitySetsOperations.get": null, - "azure.mgmt.compute.operations.AvailabilitySetsOperations.create_or_update": null, - "azure.mgmt.compute.aio.operations.AvailabilitySetsOperations.create_or_update": null, - "azure.mgmt.compute.operations.AvailabilitySetsOperations.update": null, - "azure.mgmt.compute.aio.operations.AvailabilitySetsOperations.update": null, - "azure.mgmt.compute.operations.AvailabilitySetsOperations.delete": null, - "azure.mgmt.compute.aio.operations.AvailabilitySetsOperations.delete": null, - "azure.mgmt.compute.operations.AvailabilitySetsOperations.cancel_migration_to_virtual_machine_scale_set": null, - "azure.mgmt.compute.aio.operations.AvailabilitySetsOperations.cancel_migration_to_virtual_machine_scale_set": null, - "azure.mgmt.compute.operations.AvailabilitySetsOperations.begin_convert_to_virtual_machine_scale_set": null, - "azure.mgmt.compute.aio.operations.AvailabilitySetsOperations.begin_convert_to_virtual_machine_scale_set": null, - "azure.mgmt.compute.operations.AvailabilitySetsOperations.start_migration_to_virtual_machine_scale_set": null, - "azure.mgmt.compute.aio.operations.AvailabilitySetsOperations.start_migration_to_virtual_machine_scale_set": null, - "azure.mgmt.compute.operations.AvailabilitySetsOperations.validate_migration_to_virtual_machine_scale_set": null, - "azure.mgmt.compute.aio.operations.AvailabilitySetsOperations.validate_migration_to_virtual_machine_scale_set": null, - "azure.mgmt.compute.operations.AvailabilitySetsOperations.list_available_sizes": null, - "azure.mgmt.compute.aio.operations.AvailabilitySetsOperations.list_available_sizes": null, - "azure.mgmt.compute.operations.CapacityReservationGroupsOperations.list_by_subscription": null, - "azure.mgmt.compute.aio.operations.CapacityReservationGroupsOperations.list_by_subscription": null, - "azure.mgmt.compute.operations.CapacityReservationGroupsOperations.list_by_resource_group": null, - "azure.mgmt.compute.aio.operations.CapacityReservationGroupsOperations.list_by_resource_group": null, - "azure.mgmt.compute.operations.CapacityReservationGroupsOperations.get": null, - "azure.mgmt.compute.aio.operations.CapacityReservationGroupsOperations.get": null, - "azure.mgmt.compute.operations.CapacityReservationGroupsOperations.create_or_update": null, - "azure.mgmt.compute.aio.operations.CapacityReservationGroupsOperations.create_or_update": null, - "azure.mgmt.compute.operations.CapacityReservationGroupsOperations.update": null, - "azure.mgmt.compute.aio.operations.CapacityReservationGroupsOperations.update": null, - "azure.mgmt.compute.operations.CapacityReservationGroupsOperations.delete": null, - "azure.mgmt.compute.aio.operations.CapacityReservationGroupsOperations.delete": null, - "azure.mgmt.compute.operations.DedicatedHostGroupsOperations.list_by_subscription": null, - "azure.mgmt.compute.aio.operations.DedicatedHostGroupsOperations.list_by_subscription": null, - "azure.mgmt.compute.operations.DedicatedHostGroupsOperations.list_by_resource_group": null, - "azure.mgmt.compute.aio.operations.DedicatedHostGroupsOperations.list_by_resource_group": null, - "azure.mgmt.compute.operations.DedicatedHostGroupsOperations.get": null, - "azure.mgmt.compute.aio.operations.DedicatedHostGroupsOperations.get": null, - "azure.mgmt.compute.operations.DedicatedHostGroupsOperations.create_or_update": null, - "azure.mgmt.compute.aio.operations.DedicatedHostGroupsOperations.create_or_update": null, - "azure.mgmt.compute.operations.DedicatedHostGroupsOperations.update": null, - "azure.mgmt.compute.aio.operations.DedicatedHostGroupsOperations.update": null, - "azure.mgmt.compute.operations.DedicatedHostGroupsOperations.delete": null, - "azure.mgmt.compute.aio.operations.DedicatedHostGroupsOperations.delete": null, - "azure.mgmt.compute.operations.ImagesOperations.list": null, - "azure.mgmt.compute.aio.operations.ImagesOperations.list": null, - "azure.mgmt.compute.operations.ImagesOperations.list_by_resource_group": null, - "azure.mgmt.compute.aio.operations.ImagesOperations.list_by_resource_group": null, - "azure.mgmt.compute.operations.ImagesOperations.get": null, - "azure.mgmt.compute.aio.operations.ImagesOperations.get": null, - "azure.mgmt.compute.operations.ImagesOperations.begin_create_or_update": null, - "azure.mgmt.compute.aio.operations.ImagesOperations.begin_create_or_update": null, - "azure.mgmt.compute.operations.ImagesOperations.begin_update": null, - "azure.mgmt.compute.aio.operations.ImagesOperations.begin_update": null, - "azure.mgmt.compute.operations.ImagesOperations.begin_delete": null, - "azure.mgmt.compute.aio.operations.ImagesOperations.begin_delete": null, - "azure.mgmt.compute.operations.VirtualMachineImagesEdgeZoneOperations.list_publishers": null, - "azure.mgmt.compute.aio.operations.VirtualMachineImagesEdgeZoneOperations.list_publishers": null, - "azure.mgmt.compute.operations.VirtualMachineImagesEdgeZoneOperations.list_offers": null, - "azure.mgmt.compute.aio.operations.VirtualMachineImagesEdgeZoneOperations.list_offers": null, - "azure.mgmt.compute.operations.VirtualMachineImagesEdgeZoneOperations.list_skus": null, - "azure.mgmt.compute.aio.operations.VirtualMachineImagesEdgeZoneOperations.list_skus": null, - "azure.mgmt.compute.operations.VirtualMachineImagesEdgeZoneOperations.list": null, - "azure.mgmt.compute.aio.operations.VirtualMachineImagesEdgeZoneOperations.list": null, - "azure.mgmt.compute.operations.VirtualMachineImagesEdgeZoneOperations.get": null, - "azure.mgmt.compute.aio.operations.VirtualMachineImagesEdgeZoneOperations.get": null, - "azure.mgmt.compute.operations.VirtualMachineImagesOperations.list_by_edge_zone": null, - "azure.mgmt.compute.aio.operations.VirtualMachineImagesOperations.list_by_edge_zone": null, - "azure.mgmt.compute.operations.VirtualMachineImagesOperations.list_publishers": null, - "azure.mgmt.compute.aio.operations.VirtualMachineImagesOperations.list_publishers": null, - "azure.mgmt.compute.operations.VirtualMachineImagesOperations.list_offers": null, - "azure.mgmt.compute.aio.operations.VirtualMachineImagesOperations.list_offers": null, - "azure.mgmt.compute.operations.VirtualMachineImagesOperations.list_skus": null, - "azure.mgmt.compute.aio.operations.VirtualMachineImagesOperations.list_skus": null, - "azure.mgmt.compute.operations.VirtualMachineImagesOperations.list": null, - "azure.mgmt.compute.aio.operations.VirtualMachineImagesOperations.list": null, - "azure.mgmt.compute.operations.VirtualMachineImagesOperations.get": null, - "azure.mgmt.compute.aio.operations.VirtualMachineImagesOperations.get": null, - "azure.mgmt.compute.operations.VirtualMachineImagesOperations.list_with_properties": null, - "azure.mgmt.compute.aio.operations.VirtualMachineImagesOperations.list_with_properties": null, - "azure.mgmt.compute.operations.LogAnalyticsOperations.begin_export_request_rate_by_interval": null, - "azure.mgmt.compute.aio.operations.LogAnalyticsOperations.begin_export_request_rate_by_interval": null, - "azure.mgmt.compute.operations.LogAnalyticsOperations.begin_export_throttled_requests": null, - "azure.mgmt.compute.aio.operations.LogAnalyticsOperations.begin_export_throttled_requests": null, - "azure.mgmt.compute.operations.VirtualMachineExtensionImagesOperations.list_types": null, - "azure.mgmt.compute.aio.operations.VirtualMachineExtensionImagesOperations.list_types": null, - "azure.mgmt.compute.operations.VirtualMachineExtensionImagesOperations.list_versions": null, - "azure.mgmt.compute.aio.operations.VirtualMachineExtensionImagesOperations.list_versions": null, - "azure.mgmt.compute.operations.VirtualMachineExtensionImagesOperations.get": null, - "azure.mgmt.compute.aio.operations.VirtualMachineExtensionImagesOperations.get": null, - "azure.mgmt.compute.operations.VirtualMachineRunCommandsOperations.list": null, - "azure.mgmt.compute.aio.operations.VirtualMachineRunCommandsOperations.list": null, - "azure.mgmt.compute.operations.VirtualMachineRunCommandsOperations.get": null, - "azure.mgmt.compute.aio.operations.VirtualMachineRunCommandsOperations.get": null, - "azure.mgmt.compute.operations.VirtualMachineRunCommandsOperations.list_by_virtual_machine": null, - "azure.mgmt.compute.aio.operations.VirtualMachineRunCommandsOperations.list_by_virtual_machine": null, - "azure.mgmt.compute.operations.VirtualMachineRunCommandsOperations.get_by_virtual_machine": null, - "azure.mgmt.compute.aio.operations.VirtualMachineRunCommandsOperations.get_by_virtual_machine": null, - "azure.mgmt.compute.operations.VirtualMachineRunCommandsOperations.begin_create_or_update": null, - "azure.mgmt.compute.aio.operations.VirtualMachineRunCommandsOperations.begin_create_or_update": null, - "azure.mgmt.compute.operations.VirtualMachineRunCommandsOperations.begin_update": null, - "azure.mgmt.compute.aio.operations.VirtualMachineRunCommandsOperations.begin_update": null, - "azure.mgmt.compute.operations.VirtualMachineRunCommandsOperations.begin_delete": null, - "azure.mgmt.compute.aio.operations.VirtualMachineRunCommandsOperations.begin_delete": null, - "azure.mgmt.compute.operations.UsageOperations.list": null, - "azure.mgmt.compute.aio.operations.UsageOperations.list": null, - "azure.mgmt.compute.operations.VirtualMachineScaleSetsOperations.list_by_location": null, - "azure.mgmt.compute.aio.operations.VirtualMachineScaleSetsOperations.list_by_location": null, - "azure.mgmt.compute.operations.VirtualMachineScaleSetsOperations.list_all": null, - "azure.mgmt.compute.aio.operations.VirtualMachineScaleSetsOperations.list_all": null, - "azure.mgmt.compute.operations.VirtualMachineScaleSetsOperations.list": null, - "azure.mgmt.compute.aio.operations.VirtualMachineScaleSetsOperations.list": null, - "azure.mgmt.compute.operations.VirtualMachineScaleSetsOperations.get": null, - "azure.mgmt.compute.aio.operations.VirtualMachineScaleSetsOperations.get": null, - "azure.mgmt.compute.operations.VirtualMachineScaleSetsOperations.begin_create_or_update": null, - "azure.mgmt.compute.aio.operations.VirtualMachineScaleSetsOperations.begin_create_or_update": null, - "azure.mgmt.compute.operations.VirtualMachineScaleSetsOperations.begin_update": null, - "azure.mgmt.compute.aio.operations.VirtualMachineScaleSetsOperations.begin_update": null, - "azure.mgmt.compute.operations.VirtualMachineScaleSetsOperations.begin_delete": null, - "azure.mgmt.compute.aio.operations.VirtualMachineScaleSetsOperations.begin_delete": null, - "azure.mgmt.compute.operations.VirtualMachineScaleSetsOperations.begin_approve_rolling_upgrade": null, - "azure.mgmt.compute.aio.operations.VirtualMachineScaleSetsOperations.begin_approve_rolling_upgrade": null, - "azure.mgmt.compute.operations.VirtualMachineScaleSetsOperations.convert_to_single_placement_group": null, - "azure.mgmt.compute.aio.operations.VirtualMachineScaleSetsOperations.convert_to_single_placement_group": null, - "azure.mgmt.compute.operations.VirtualMachineScaleSetsOperations.begin_deallocate": null, - "azure.mgmt.compute.aio.operations.VirtualMachineScaleSetsOperations.begin_deallocate": null, - "azure.mgmt.compute.operations.VirtualMachineScaleSetsOperations.begin_delete_instances": null, - "azure.mgmt.compute.aio.operations.VirtualMachineScaleSetsOperations.begin_delete_instances": null, - "azure.mgmt.compute.operations.VirtualMachineScaleSetsOperations.force_recovery_service_fabric_platform_update_domain_walk": null, - "azure.mgmt.compute.aio.operations.VirtualMachineScaleSetsOperations.force_recovery_service_fabric_platform_update_domain_walk": null, - "azure.mgmt.compute.operations.VirtualMachineScaleSetsOperations.get_instance_view": null, - "azure.mgmt.compute.aio.operations.VirtualMachineScaleSetsOperations.get_instance_view": null, - "azure.mgmt.compute.operations.VirtualMachineScaleSetsOperations.begin_update_instances": null, - "azure.mgmt.compute.aio.operations.VirtualMachineScaleSetsOperations.begin_update_instances": null, - "azure.mgmt.compute.operations.VirtualMachineScaleSetsOperations.get_os_upgrade_history": null, - "azure.mgmt.compute.aio.operations.VirtualMachineScaleSetsOperations.get_os_upgrade_history": null, - "azure.mgmt.compute.operations.VirtualMachineScaleSetsOperations.begin_perform_maintenance": null, - "azure.mgmt.compute.aio.operations.VirtualMachineScaleSetsOperations.begin_perform_maintenance": null, - "azure.mgmt.compute.operations.VirtualMachineScaleSetsOperations.begin_power_off": null, - "azure.mgmt.compute.aio.operations.VirtualMachineScaleSetsOperations.begin_power_off": null, - "azure.mgmt.compute.operations.VirtualMachineScaleSetsOperations.begin_reapply": null, - "azure.mgmt.compute.aio.operations.VirtualMachineScaleSetsOperations.begin_reapply": null, - "azure.mgmt.compute.operations.VirtualMachineScaleSetsOperations.begin_redeploy": null, - "azure.mgmt.compute.aio.operations.VirtualMachineScaleSetsOperations.begin_redeploy": null, - "azure.mgmt.compute.operations.VirtualMachineScaleSetsOperations.begin_reimage": null, - "azure.mgmt.compute.aio.operations.VirtualMachineScaleSetsOperations.begin_reimage": null, - "azure.mgmt.compute.operations.VirtualMachineScaleSetsOperations.begin_reimage_all": null, - "azure.mgmt.compute.aio.operations.VirtualMachineScaleSetsOperations.begin_reimage_all": null, - "azure.mgmt.compute.operations.VirtualMachineScaleSetsOperations.begin_restart": null, - "azure.mgmt.compute.aio.operations.VirtualMachineScaleSetsOperations.begin_restart": null, - "azure.mgmt.compute.operations.VirtualMachineScaleSetsOperations.begin_scale_out": null, - "azure.mgmt.compute.aio.operations.VirtualMachineScaleSetsOperations.begin_scale_out": null, - "azure.mgmt.compute.operations.VirtualMachineScaleSetsOperations.begin_set_orchestration_service_state": null, - "azure.mgmt.compute.aio.operations.VirtualMachineScaleSetsOperations.begin_set_orchestration_service_state": null, - "azure.mgmt.compute.operations.VirtualMachineScaleSetsOperations.list_skus": null, - "azure.mgmt.compute.aio.operations.VirtualMachineScaleSetsOperations.list_skus": null, - "azure.mgmt.compute.operations.VirtualMachineScaleSetsOperations.begin_start": null, - "azure.mgmt.compute.aio.operations.VirtualMachineScaleSetsOperations.begin_start": null, - "azure.mgmt.compute.operations.VirtualMachinesOperations.list_by_location": null, - "azure.mgmt.compute.aio.operations.VirtualMachinesOperations.list_by_location": null, - "azure.mgmt.compute.operations.VirtualMachinesOperations.list_all": null, - "azure.mgmt.compute.aio.operations.VirtualMachinesOperations.list_all": null, - "azure.mgmt.compute.operations.VirtualMachinesOperations.list": null, - "azure.mgmt.compute.aio.operations.VirtualMachinesOperations.list": null, - "azure.mgmt.compute.operations.VirtualMachinesOperations.get": null, - "azure.mgmt.compute.aio.operations.VirtualMachinesOperations.get": null, - "azure.mgmt.compute.operations.VirtualMachinesOperations.begin_create_or_update": null, - "azure.mgmt.compute.aio.operations.VirtualMachinesOperations.begin_create_or_update": null, - "azure.mgmt.compute.operations.VirtualMachinesOperations.begin_update": null, - "azure.mgmt.compute.aio.operations.VirtualMachinesOperations.begin_update": null, - "azure.mgmt.compute.operations.VirtualMachinesOperations.begin_delete": null, - "azure.mgmt.compute.aio.operations.VirtualMachinesOperations.begin_delete": null, - "azure.mgmt.compute.operations.VirtualMachinesOperations.begin_assess_patches": null, - "azure.mgmt.compute.aio.operations.VirtualMachinesOperations.begin_assess_patches": null, - "azure.mgmt.compute.operations.VirtualMachinesOperations.begin_attach_detach_data_disks": null, - "azure.mgmt.compute.aio.operations.VirtualMachinesOperations.begin_attach_detach_data_disks": null, - "azure.mgmt.compute.operations.VirtualMachinesOperations.begin_capture": null, - "azure.mgmt.compute.aio.operations.VirtualMachinesOperations.begin_capture": null, - "azure.mgmt.compute.operations.VirtualMachinesOperations.begin_convert_to_managed_disks": null, - "azure.mgmt.compute.aio.operations.VirtualMachinesOperations.begin_convert_to_managed_disks": null, - "azure.mgmt.compute.operations.VirtualMachinesOperations.begin_deallocate": null, - "azure.mgmt.compute.aio.operations.VirtualMachinesOperations.begin_deallocate": null, - "azure.mgmt.compute.operations.VirtualMachinesOperations.generalize": null, - "azure.mgmt.compute.aio.operations.VirtualMachinesOperations.generalize": null, - "azure.mgmt.compute.operations.VirtualMachinesOperations.begin_install_patches": null, - "azure.mgmt.compute.aio.operations.VirtualMachinesOperations.begin_install_patches": null, - "azure.mgmt.compute.operations.VirtualMachinesOperations.instance_view": null, - "azure.mgmt.compute.aio.operations.VirtualMachinesOperations.instance_view": null, - "azure.mgmt.compute.operations.VirtualMachinesOperations.begin_migrate_to_vm_scale_set": null, - "azure.mgmt.compute.aio.operations.VirtualMachinesOperations.begin_migrate_to_vm_scale_set": null, - "azure.mgmt.compute.operations.VirtualMachinesOperations.begin_perform_maintenance": null, - "azure.mgmt.compute.aio.operations.VirtualMachinesOperations.begin_perform_maintenance": null, - "azure.mgmt.compute.operations.VirtualMachinesOperations.begin_power_off": null, - "azure.mgmt.compute.aio.operations.VirtualMachinesOperations.begin_power_off": null, - "azure.mgmt.compute.operations.VirtualMachinesOperations.begin_reapply": null, - "azure.mgmt.compute.aio.operations.VirtualMachinesOperations.begin_reapply": null, - "azure.mgmt.compute.operations.VirtualMachinesOperations.begin_redeploy": null, - "azure.mgmt.compute.aio.operations.VirtualMachinesOperations.begin_redeploy": null, - "azure.mgmt.compute.operations.VirtualMachinesOperations.begin_reimage": null, - "azure.mgmt.compute.aio.operations.VirtualMachinesOperations.begin_reimage": null, - "azure.mgmt.compute.operations.VirtualMachinesOperations.begin_restart": null, - "azure.mgmt.compute.aio.operations.VirtualMachinesOperations.begin_restart": null, - "azure.mgmt.compute.operations.VirtualMachinesOperations.retrieve_boot_diagnostics_data": null, - "azure.mgmt.compute.aio.operations.VirtualMachinesOperations.retrieve_boot_diagnostics_data": null, - "azure.mgmt.compute.operations.VirtualMachinesOperations.begin_run_command": null, - "azure.mgmt.compute.aio.operations.VirtualMachinesOperations.begin_run_command": null, - "azure.mgmt.compute.operations.VirtualMachinesOperations.simulate_eviction": null, - "azure.mgmt.compute.aio.operations.VirtualMachinesOperations.simulate_eviction": null, - "azure.mgmt.compute.operations.VirtualMachinesOperations.begin_start": null, - "azure.mgmt.compute.aio.operations.VirtualMachinesOperations.begin_start": null, - "azure.mgmt.compute.operations.VirtualMachinesOperations.list_available_sizes": null, - "azure.mgmt.compute.aio.operations.VirtualMachinesOperations.list_available_sizes": null, - "azure.mgmt.compute.operations.VirtualMachineSizesOperations.list": null, - "azure.mgmt.compute.aio.operations.VirtualMachineSizesOperations.list": null, - "azure.mgmt.compute.operations.ProximityPlacementGroupsOperations.list_by_subscription": null, - "azure.mgmt.compute.aio.operations.ProximityPlacementGroupsOperations.list_by_subscription": null, - "azure.mgmt.compute.operations.ProximityPlacementGroupsOperations.list_by_resource_group": null, - "azure.mgmt.compute.aio.operations.ProximityPlacementGroupsOperations.list_by_resource_group": null, - "azure.mgmt.compute.operations.ProximityPlacementGroupsOperations.get": null, - "azure.mgmt.compute.aio.operations.ProximityPlacementGroupsOperations.get": null, - "azure.mgmt.compute.operations.ProximityPlacementGroupsOperations.create_or_update": null, - "azure.mgmt.compute.aio.operations.ProximityPlacementGroupsOperations.create_or_update": null, - "azure.mgmt.compute.operations.ProximityPlacementGroupsOperations.update": null, - "azure.mgmt.compute.aio.operations.ProximityPlacementGroupsOperations.update": null, - "azure.mgmt.compute.operations.ProximityPlacementGroupsOperations.delete": null, - "azure.mgmt.compute.aio.operations.ProximityPlacementGroupsOperations.delete": null, - "azure.mgmt.compute.operations.RestorePointCollectionsOperations.list_all": null, - "azure.mgmt.compute.aio.operations.RestorePointCollectionsOperations.list_all": null, - "azure.mgmt.compute.operations.RestorePointCollectionsOperations.list": null, - "azure.mgmt.compute.aio.operations.RestorePointCollectionsOperations.list": null, - "azure.mgmt.compute.operations.RestorePointCollectionsOperations.get": null, - "azure.mgmt.compute.aio.operations.RestorePointCollectionsOperations.get": null, - "azure.mgmt.compute.operations.RestorePointCollectionsOperations.create_or_update": null, - "azure.mgmt.compute.aio.operations.RestorePointCollectionsOperations.create_or_update": null, - "azure.mgmt.compute.operations.RestorePointCollectionsOperations.update": null, - "azure.mgmt.compute.aio.operations.RestorePointCollectionsOperations.update": null, - "azure.mgmt.compute.operations.RestorePointCollectionsOperations.begin_delete": null, - "azure.mgmt.compute.aio.operations.RestorePointCollectionsOperations.begin_delete": null, - "azure.mgmt.compute.operations.SshPublicKeysOperations.list_by_subscription": null, - "azure.mgmt.compute.aio.operations.SshPublicKeysOperations.list_by_subscription": null, - "azure.mgmt.compute.operations.SshPublicKeysOperations.list_by_resource_group": null, - "azure.mgmt.compute.aio.operations.SshPublicKeysOperations.list_by_resource_group": null, - "azure.mgmt.compute.operations.SshPublicKeysOperations.get": null, - "azure.mgmt.compute.aio.operations.SshPublicKeysOperations.get": null, - "azure.mgmt.compute.operations.SshPublicKeysOperations.create": null, - "azure.mgmt.compute.aio.operations.SshPublicKeysOperations.create": null, - "azure.mgmt.compute.operations.SshPublicKeysOperations.update": null, - "azure.mgmt.compute.aio.operations.SshPublicKeysOperations.update": null, - "azure.mgmt.compute.operations.SshPublicKeysOperations.delete": null, - "azure.mgmt.compute.aio.operations.SshPublicKeysOperations.delete": null, - "azure.mgmt.compute.operations.SshPublicKeysOperations.generate_key_pair": null, - "azure.mgmt.compute.aio.operations.SshPublicKeysOperations.generate_key_pair": null, - "azure.mgmt.compute.operations.CapacityReservationsOperations.list_by_capacity_reservation_group": null, - "azure.mgmt.compute.aio.operations.CapacityReservationsOperations.list_by_capacity_reservation_group": null, - "azure.mgmt.compute.operations.CapacityReservationsOperations.get": null, - "azure.mgmt.compute.aio.operations.CapacityReservationsOperations.get": null, - "azure.mgmt.compute.operations.CapacityReservationsOperations.begin_create_or_update": null, - "azure.mgmt.compute.aio.operations.CapacityReservationsOperations.begin_create_or_update": null, - "azure.mgmt.compute.operations.CapacityReservationsOperations.begin_update": null, - "azure.mgmt.compute.aio.operations.CapacityReservationsOperations.begin_update": null, - "azure.mgmt.compute.operations.CapacityReservationsOperations.begin_delete": null, - "azure.mgmt.compute.aio.operations.CapacityReservationsOperations.begin_delete": null, - "azure.mgmt.compute.operations.DedicatedHostsOperations.list_by_host_group": null, - "azure.mgmt.compute.aio.operations.DedicatedHostsOperations.list_by_host_group": null, - "azure.mgmt.compute.operations.DedicatedHostsOperations.get": null, - "azure.mgmt.compute.aio.operations.DedicatedHostsOperations.get": null, - "azure.mgmt.compute.operations.DedicatedHostsOperations.begin_create_or_update": null, - "azure.mgmt.compute.aio.operations.DedicatedHostsOperations.begin_create_or_update": null, - "azure.mgmt.compute.operations.DedicatedHostsOperations.begin_update": null, - "azure.mgmt.compute.aio.operations.DedicatedHostsOperations.begin_update": null, - "azure.mgmt.compute.operations.DedicatedHostsOperations.begin_delete": null, - "azure.mgmt.compute.aio.operations.DedicatedHostsOperations.begin_delete": null, - "azure.mgmt.compute.operations.DedicatedHostsOperations.list_available_sizes": null, - "azure.mgmt.compute.aio.operations.DedicatedHostsOperations.list_available_sizes": null, - "azure.mgmt.compute.operations.DedicatedHostsOperations.begin_redeploy": null, - "azure.mgmt.compute.aio.operations.DedicatedHostsOperations.begin_redeploy": null, - "azure.mgmt.compute.operations.DedicatedHostsOperations.begin_restart": null, - "azure.mgmt.compute.aio.operations.DedicatedHostsOperations.begin_restart": null, - "azure.mgmt.compute.operations.RestorePointsOperations.get": null, - "azure.mgmt.compute.aio.operations.RestorePointsOperations.get": null, - "azure.mgmt.compute.operations.RestorePointsOperations.begin_create": null, - "azure.mgmt.compute.aio.operations.RestorePointsOperations.begin_create": null, - "azure.mgmt.compute.operations.RestorePointsOperations.begin_delete": null, - "azure.mgmt.compute.aio.operations.RestorePointsOperations.begin_delete": null, - "azure.mgmt.compute.operations.VirtualMachineScaleSetRollingUpgradesOperations.begin_start_extension_upgrade": null, - "azure.mgmt.compute.aio.operations.VirtualMachineScaleSetRollingUpgradesOperations.begin_start_extension_upgrade": null, - "azure.mgmt.compute.operations.VirtualMachineScaleSetRollingUpgradesOperations.begin_start_os_upgrade": null, - "azure.mgmt.compute.aio.operations.VirtualMachineScaleSetRollingUpgradesOperations.begin_start_os_upgrade": null, - "azure.mgmt.compute.operations.VirtualMachineScaleSetRollingUpgradesOperations.begin_cancel": null, - "azure.mgmt.compute.aio.operations.VirtualMachineScaleSetRollingUpgradesOperations.begin_cancel": null, - "azure.mgmt.compute.operations.VirtualMachineScaleSetRollingUpgradesOperations.get_latest": null, - "azure.mgmt.compute.aio.operations.VirtualMachineScaleSetRollingUpgradesOperations.get_latest": null, - "azure.mgmt.compute.operations.VirtualMachineScaleSetExtensionsOperations.list": null, - "azure.mgmt.compute.aio.operations.VirtualMachineScaleSetExtensionsOperations.list": null, - "azure.mgmt.compute.operations.VirtualMachineScaleSetExtensionsOperations.get": null, - "azure.mgmt.compute.aio.operations.VirtualMachineScaleSetExtensionsOperations.get": null, - "azure.mgmt.compute.operations.VirtualMachineScaleSetExtensionsOperations.begin_create_or_update": null, - "azure.mgmt.compute.aio.operations.VirtualMachineScaleSetExtensionsOperations.begin_create_or_update": null, - "azure.mgmt.compute.operations.VirtualMachineScaleSetExtensionsOperations.begin_update": null, - "azure.mgmt.compute.aio.operations.VirtualMachineScaleSetExtensionsOperations.begin_update": null, - "azure.mgmt.compute.operations.VirtualMachineScaleSetExtensionsOperations.begin_delete": null, - "azure.mgmt.compute.aio.operations.VirtualMachineScaleSetExtensionsOperations.begin_delete": null, - "azure.mgmt.compute.operations.VirtualMachineScaleSetVMsOperations.list": null, - "azure.mgmt.compute.aio.operations.VirtualMachineScaleSetVMsOperations.list": null, - "azure.mgmt.compute.operations.VirtualMachineScaleSetVMsOperations.get": null, - "azure.mgmt.compute.aio.operations.VirtualMachineScaleSetVMsOperations.get": null, - "azure.mgmt.compute.operations.VirtualMachineScaleSetVMsOperations.begin_update": null, - "azure.mgmt.compute.aio.operations.VirtualMachineScaleSetVMsOperations.begin_update": null, - "azure.mgmt.compute.operations.VirtualMachineScaleSetVMsOperations.begin_delete": null, - "azure.mgmt.compute.aio.operations.VirtualMachineScaleSetVMsOperations.begin_delete": null, - "azure.mgmt.compute.operations.VirtualMachineScaleSetVMsOperations.begin_approve_rolling_upgrade": null, - "azure.mgmt.compute.aio.operations.VirtualMachineScaleSetVMsOperations.begin_approve_rolling_upgrade": null, - "azure.mgmt.compute.operations.VirtualMachineScaleSetVMsOperations.begin_attach_detach_data_disks": null, - "azure.mgmt.compute.aio.operations.VirtualMachineScaleSetVMsOperations.begin_attach_detach_data_disks": null, - "azure.mgmt.compute.operations.VirtualMachineScaleSetVMsOperations.begin_deallocate": null, - "azure.mgmt.compute.aio.operations.VirtualMachineScaleSetVMsOperations.begin_deallocate": null, - "azure.mgmt.compute.operations.VirtualMachineScaleSetVMsOperations.get_instance_view": null, - "azure.mgmt.compute.aio.operations.VirtualMachineScaleSetVMsOperations.get_instance_view": null, - "azure.mgmt.compute.operations.VirtualMachineScaleSetVMsOperations.begin_perform_maintenance": null, - "azure.mgmt.compute.aio.operations.VirtualMachineScaleSetVMsOperations.begin_perform_maintenance": null, - "azure.mgmt.compute.operations.VirtualMachineScaleSetVMsOperations.begin_power_off": null, - "azure.mgmt.compute.aio.operations.VirtualMachineScaleSetVMsOperations.begin_power_off": null, - "azure.mgmt.compute.operations.VirtualMachineScaleSetVMsOperations.begin_redeploy": null, - "azure.mgmt.compute.aio.operations.VirtualMachineScaleSetVMsOperations.begin_redeploy": null, - "azure.mgmt.compute.operations.VirtualMachineScaleSetVMsOperations.begin_reimage": null, - "azure.mgmt.compute.aio.operations.VirtualMachineScaleSetVMsOperations.begin_reimage": null, - "azure.mgmt.compute.operations.VirtualMachineScaleSetVMsOperations.begin_reimage_all": null, - "azure.mgmt.compute.aio.operations.VirtualMachineScaleSetVMsOperations.begin_reimage_all": null, - "azure.mgmt.compute.operations.VirtualMachineScaleSetVMsOperations.begin_restart": null, - "azure.mgmt.compute.aio.operations.VirtualMachineScaleSetVMsOperations.begin_restart": null, - "azure.mgmt.compute.operations.VirtualMachineScaleSetVMsOperations.retrieve_boot_diagnostics_data": null, - "azure.mgmt.compute.aio.operations.VirtualMachineScaleSetVMsOperations.retrieve_boot_diagnostics_data": null, - "azure.mgmt.compute.operations.VirtualMachineScaleSetVMsOperations.begin_run_command": null, - "azure.mgmt.compute.aio.operations.VirtualMachineScaleSetVMsOperations.begin_run_command": null, - "azure.mgmt.compute.operations.VirtualMachineScaleSetVMsOperations.simulate_eviction": null, - "azure.mgmt.compute.aio.operations.VirtualMachineScaleSetVMsOperations.simulate_eviction": null, - "azure.mgmt.compute.operations.VirtualMachineScaleSetVMsOperations.begin_start": null, - "azure.mgmt.compute.aio.operations.VirtualMachineScaleSetVMsOperations.begin_start": null, - "azure.mgmt.compute.operations.VirtualMachineScaleSetVMExtensionsOperations.list": null, - "azure.mgmt.compute.aio.operations.VirtualMachineScaleSetVMExtensionsOperations.list": null, - "azure.mgmt.compute.operations.VirtualMachineScaleSetVMExtensionsOperations.get": null, - "azure.mgmt.compute.aio.operations.VirtualMachineScaleSetVMExtensionsOperations.get": null, - "azure.mgmt.compute.operations.VirtualMachineScaleSetVMExtensionsOperations.begin_create_or_update": null, - "azure.mgmt.compute.aio.operations.VirtualMachineScaleSetVMExtensionsOperations.begin_create_or_update": null, - "azure.mgmt.compute.operations.VirtualMachineScaleSetVMExtensionsOperations.begin_update": null, - "azure.mgmt.compute.aio.operations.VirtualMachineScaleSetVMExtensionsOperations.begin_update": null, - "azure.mgmt.compute.operations.VirtualMachineScaleSetVMExtensionsOperations.begin_delete": null, - "azure.mgmt.compute.aio.operations.VirtualMachineScaleSetVMExtensionsOperations.begin_delete": null, - "azure.mgmt.compute.operations.VirtualMachineScaleSetVMRunCommandsOperations.list": null, - "azure.mgmt.compute.aio.operations.VirtualMachineScaleSetVMRunCommandsOperations.list": null, - "azure.mgmt.compute.operations.VirtualMachineScaleSetVMRunCommandsOperations.get": null, - "azure.mgmt.compute.aio.operations.VirtualMachineScaleSetVMRunCommandsOperations.get": null, - "azure.mgmt.compute.operations.VirtualMachineScaleSetVMRunCommandsOperations.begin_create_or_update": null, - "azure.mgmt.compute.aio.operations.VirtualMachineScaleSetVMRunCommandsOperations.begin_create_or_update": null, - "azure.mgmt.compute.operations.VirtualMachineScaleSetVMRunCommandsOperations.begin_update": null, - "azure.mgmt.compute.aio.operations.VirtualMachineScaleSetVMRunCommandsOperations.begin_update": null, - "azure.mgmt.compute.operations.VirtualMachineScaleSetVMRunCommandsOperations.begin_delete": null, - "azure.mgmt.compute.aio.operations.VirtualMachineScaleSetVMRunCommandsOperations.begin_delete": null, - "azure.mgmt.compute.operations.VirtualMachineExtensionsOperations.list": null, - "azure.mgmt.compute.aio.operations.VirtualMachineExtensionsOperations.list": null, - "azure.mgmt.compute.operations.VirtualMachineExtensionsOperations.get": null, - "azure.mgmt.compute.aio.operations.VirtualMachineExtensionsOperations.get": null, - "azure.mgmt.compute.operations.VirtualMachineExtensionsOperations.begin_create_or_update": null, - "azure.mgmt.compute.aio.operations.VirtualMachineExtensionsOperations.begin_create_or_update": null, - "azure.mgmt.compute.operations.VirtualMachineExtensionsOperations.begin_update": null, - "azure.mgmt.compute.aio.operations.VirtualMachineExtensionsOperations.begin_update": null, - "azure.mgmt.compute.operations.VirtualMachineExtensionsOperations.begin_delete": null, - "azure.mgmt.compute.aio.operations.VirtualMachineExtensionsOperations.begin_delete": null, - "azure.mgmt.compute.operations.DiskAccessesOperations.list": null, - "azure.mgmt.compute.aio.operations.DiskAccessesOperations.list": null, - "azure.mgmt.compute.operations.DiskAccessesOperations.list_by_resource_group": null, - "azure.mgmt.compute.aio.operations.DiskAccessesOperations.list_by_resource_group": null, - "azure.mgmt.compute.operations.DiskAccessesOperations.get": null, - "azure.mgmt.compute.aio.operations.DiskAccessesOperations.get": null, - "azure.mgmt.compute.operations.DiskAccessesOperations.begin_create_or_update": null, - "azure.mgmt.compute.aio.operations.DiskAccessesOperations.begin_create_or_update": null, - "azure.mgmt.compute.operations.DiskAccessesOperations.begin_update": null, - "azure.mgmt.compute.aio.operations.DiskAccessesOperations.begin_update": null, - "azure.mgmt.compute.operations.DiskAccessesOperations.begin_delete": null, - "azure.mgmt.compute.aio.operations.DiskAccessesOperations.begin_delete": null, - "azure.mgmt.compute.operations.DiskAccessesOperations.list_private_endpoint_connections": null, - "azure.mgmt.compute.aio.operations.DiskAccessesOperations.list_private_endpoint_connections": null, - "azure.mgmt.compute.operations.DiskAccessesOperations.get_a_private_endpoint_connection": null, - "azure.mgmt.compute.aio.operations.DiskAccessesOperations.get_a_private_endpoint_connection": null, - "azure.mgmt.compute.operations.DiskAccessesOperations.begin_update_a_private_endpoint_connection": null, - "azure.mgmt.compute.aio.operations.DiskAccessesOperations.begin_update_a_private_endpoint_connection": null, - "azure.mgmt.compute.operations.DiskAccessesOperations.begin_delete_a_private_endpoint_connection": null, - "azure.mgmt.compute.aio.operations.DiskAccessesOperations.begin_delete_a_private_endpoint_connection": null, - "azure.mgmt.compute.operations.DiskAccessesOperations.get_private_link_resources": null, - "azure.mgmt.compute.aio.operations.DiskAccessesOperations.get_private_link_resources": null, - "azure.mgmt.compute.operations.DiskEncryptionSetsOperations.list": null, - "azure.mgmt.compute.aio.operations.DiskEncryptionSetsOperations.list": null, - "azure.mgmt.compute.operations.DiskEncryptionSetsOperations.list_by_resource_group": null, - "azure.mgmt.compute.aio.operations.DiskEncryptionSetsOperations.list_by_resource_group": null, - "azure.mgmt.compute.operations.DiskEncryptionSetsOperations.get": null, - "azure.mgmt.compute.aio.operations.DiskEncryptionSetsOperations.get": null, - "azure.mgmt.compute.operations.DiskEncryptionSetsOperations.begin_create_or_update": null, - "azure.mgmt.compute.aio.operations.DiskEncryptionSetsOperations.begin_create_or_update": null, - "azure.mgmt.compute.operations.DiskEncryptionSetsOperations.begin_update": null, - "azure.mgmt.compute.aio.operations.DiskEncryptionSetsOperations.begin_update": null, - "azure.mgmt.compute.operations.DiskEncryptionSetsOperations.begin_delete": null, - "azure.mgmt.compute.aio.operations.DiskEncryptionSetsOperations.begin_delete": null, - "azure.mgmt.compute.operations.DiskEncryptionSetsOperations.list_associated_resources": null, - "azure.mgmt.compute.aio.operations.DiskEncryptionSetsOperations.list_associated_resources": null, - "azure.mgmt.compute.operations.DisksOperations.list": null, - "azure.mgmt.compute.aio.operations.DisksOperations.list": null, - "azure.mgmt.compute.operations.DisksOperations.list_by_resource_group": null, - "azure.mgmt.compute.aio.operations.DisksOperations.list_by_resource_group": null, - "azure.mgmt.compute.operations.DisksOperations.get": null, - "azure.mgmt.compute.aio.operations.DisksOperations.get": null, - "azure.mgmt.compute.operations.DisksOperations.begin_create_or_update": null, - "azure.mgmt.compute.aio.operations.DisksOperations.begin_create_or_update": null, - "azure.mgmt.compute.operations.DisksOperations.begin_update": null, - "azure.mgmt.compute.aio.operations.DisksOperations.begin_update": null, - "azure.mgmt.compute.operations.DisksOperations.begin_delete": null, - "azure.mgmt.compute.aio.operations.DisksOperations.begin_delete": null, - "azure.mgmt.compute.operations.DisksOperations.begin_grant_access": null, - "azure.mgmt.compute.aio.operations.DisksOperations.begin_grant_access": null, - "azure.mgmt.compute.operations.DisksOperations.begin_revoke_access": null, - "azure.mgmt.compute.aio.operations.DisksOperations.begin_revoke_access": null, - "azure.mgmt.compute.operations.SnapshotsOperations.list": null, - "azure.mgmt.compute.aio.operations.SnapshotsOperations.list": null, - "azure.mgmt.compute.operations.SnapshotsOperations.list_by_resource_group": null, - "azure.mgmt.compute.aio.operations.SnapshotsOperations.list_by_resource_group": null, - "azure.mgmt.compute.operations.SnapshotsOperations.get": null, - "azure.mgmt.compute.aio.operations.SnapshotsOperations.get": null, - "azure.mgmt.compute.operations.SnapshotsOperations.begin_create_or_update": null, - "azure.mgmt.compute.aio.operations.SnapshotsOperations.begin_create_or_update": null, - "azure.mgmt.compute.operations.SnapshotsOperations.begin_update": null, - "azure.mgmt.compute.aio.operations.SnapshotsOperations.begin_update": null, - "azure.mgmt.compute.operations.SnapshotsOperations.begin_delete": null, - "azure.mgmt.compute.aio.operations.SnapshotsOperations.begin_delete": null, - "azure.mgmt.compute.operations.SnapshotsOperations.begin_grant_access": null, - "azure.mgmt.compute.aio.operations.SnapshotsOperations.begin_grant_access": null, - "azure.mgmt.compute.operations.SnapshotsOperations.begin_revoke_access": null, - "azure.mgmt.compute.aio.operations.SnapshotsOperations.begin_revoke_access": null, - "azure.mgmt.compute.operations.DiskRestorePointOperations.list_by_restore_point": null, - "azure.mgmt.compute.aio.operations.DiskRestorePointOperations.list_by_restore_point": null, - "azure.mgmt.compute.operations.DiskRestorePointOperations.get": null, - "azure.mgmt.compute.aio.operations.DiskRestorePointOperations.get": null, - "azure.mgmt.compute.operations.DiskRestorePointOperations.begin_grant_access": null, - "azure.mgmt.compute.aio.operations.DiskRestorePointOperations.begin_grant_access": null, - "azure.mgmt.compute.operations.DiskRestorePointOperations.begin_revoke_access": null, - "azure.mgmt.compute.aio.operations.DiskRestorePointOperations.begin_revoke_access": null, - "azure.mgmt.compute.operations.ResourceSkusOperations.list": null, - "azure.mgmt.compute.aio.operations.ResourceSkusOperations.list": null, - "azure.mgmt.compute.operations.GalleriesOperations.list": null, - "azure.mgmt.compute.aio.operations.GalleriesOperations.list": null, - "azure.mgmt.compute.operations.GalleriesOperations.list_by_resource_group": null, - "azure.mgmt.compute.aio.operations.GalleriesOperations.list_by_resource_group": null, - "azure.mgmt.compute.operations.GalleriesOperations.get": null, - "azure.mgmt.compute.aio.operations.GalleriesOperations.get": null, - "azure.mgmt.compute.operations.GalleriesOperations.begin_create_or_update": null, - "azure.mgmt.compute.aio.operations.GalleriesOperations.begin_create_or_update": null, - "azure.mgmt.compute.operations.GalleriesOperations.begin_update": null, - "azure.mgmt.compute.aio.operations.GalleriesOperations.begin_update": null, - "azure.mgmt.compute.operations.GalleriesOperations.begin_delete": null, - "azure.mgmt.compute.aio.operations.GalleriesOperations.begin_delete": null, - "azure.mgmt.compute.operations.CommunityGalleriesOperations.get": null, - "azure.mgmt.compute.aio.operations.CommunityGalleriesOperations.get": null, - "azure.mgmt.compute.operations.CommunityGalleryImagesOperations.list": null, - "azure.mgmt.compute.aio.operations.CommunityGalleryImagesOperations.list": null, - "azure.mgmt.compute.operations.CommunityGalleryImagesOperations.get": null, - "azure.mgmt.compute.aio.operations.CommunityGalleryImagesOperations.get": null, - "azure.mgmt.compute.operations.CommunityGalleryImageVersionsOperations.list": null, - "azure.mgmt.compute.aio.operations.CommunityGalleryImageVersionsOperations.list": null, - "azure.mgmt.compute.operations.CommunityGalleryImageVersionsOperations.get": null, - "azure.mgmt.compute.aio.operations.CommunityGalleryImageVersionsOperations.get": null, - "azure.mgmt.compute.operations.SharedGalleriesOperations.list": null, - "azure.mgmt.compute.aio.operations.SharedGalleriesOperations.list": null, - "azure.mgmt.compute.operations.SharedGalleriesOperations.get": null, - "azure.mgmt.compute.aio.operations.SharedGalleriesOperations.get": null, - "azure.mgmt.compute.operations.SharedGalleryImagesOperations.list": null, - "azure.mgmt.compute.aio.operations.SharedGalleryImagesOperations.list": null, - "azure.mgmt.compute.operations.SharedGalleryImagesOperations.get": null, - "azure.mgmt.compute.aio.operations.SharedGalleryImagesOperations.get": null, - "azure.mgmt.compute.operations.SharedGalleryImageVersionsOperations.list": null, - "azure.mgmt.compute.aio.operations.SharedGalleryImageVersionsOperations.list": null, - "azure.mgmt.compute.operations.SharedGalleryImageVersionsOperations.get": null, - "azure.mgmt.compute.aio.operations.SharedGalleryImageVersionsOperations.get": null, - "azure.mgmt.compute.operations.GalleryApplicationsOperations.list_by_gallery": null, - "azure.mgmt.compute.aio.operations.GalleryApplicationsOperations.list_by_gallery": null, - "azure.mgmt.compute.operations.GalleryApplicationsOperations.get": null, - "azure.mgmt.compute.aio.operations.GalleryApplicationsOperations.get": null, - "azure.mgmt.compute.operations.GalleryApplicationsOperations.begin_create_or_update": null, - "azure.mgmt.compute.aio.operations.GalleryApplicationsOperations.begin_create_or_update": null, - "azure.mgmt.compute.operations.GalleryApplicationsOperations.begin_update": null, - "azure.mgmt.compute.aio.operations.GalleryApplicationsOperations.begin_update": null, - "azure.mgmt.compute.operations.GalleryApplicationsOperations.begin_delete": null, - "azure.mgmt.compute.aio.operations.GalleryApplicationsOperations.begin_delete": null, - "azure.mgmt.compute.operations.GalleryApplicationVersionsOperations.list_by_gallery_application": null, - "azure.mgmt.compute.aio.operations.GalleryApplicationVersionsOperations.list_by_gallery_application": null, - "azure.mgmt.compute.operations.GalleryApplicationVersionsOperations.get": null, - "azure.mgmt.compute.aio.operations.GalleryApplicationVersionsOperations.get": null, - "azure.mgmt.compute.operations.GalleryApplicationVersionsOperations.begin_create_or_update": null, - "azure.mgmt.compute.aio.operations.GalleryApplicationVersionsOperations.begin_create_or_update": null, - "azure.mgmt.compute.operations.GalleryApplicationVersionsOperations.begin_update": null, - "azure.mgmt.compute.aio.operations.GalleryApplicationVersionsOperations.begin_update": null, - "azure.mgmt.compute.operations.GalleryApplicationVersionsOperations.begin_delete": null, - "azure.mgmt.compute.aio.operations.GalleryApplicationVersionsOperations.begin_delete": null, - "azure.mgmt.compute.operations.GalleryImagesOperations.list_by_gallery": null, - "azure.mgmt.compute.aio.operations.GalleryImagesOperations.list_by_gallery": null, - "azure.mgmt.compute.operations.GalleryImagesOperations.get": null, - "azure.mgmt.compute.aio.operations.GalleryImagesOperations.get": null, - "azure.mgmt.compute.operations.GalleryImagesOperations.begin_create_or_update": null, - "azure.mgmt.compute.aio.operations.GalleryImagesOperations.begin_create_or_update": null, - "azure.mgmt.compute.operations.GalleryImagesOperations.begin_update": null, - "azure.mgmt.compute.aio.operations.GalleryImagesOperations.begin_update": null, - "azure.mgmt.compute.operations.GalleryImagesOperations.begin_delete": null, - "azure.mgmt.compute.aio.operations.GalleryImagesOperations.begin_delete": null, - "azure.mgmt.compute.operations.GalleryImageVersionsOperations.list_by_gallery_image": null, - "azure.mgmt.compute.aio.operations.GalleryImageVersionsOperations.list_by_gallery_image": null, - "azure.mgmt.compute.operations.GalleryImageVersionsOperations.get": null, - "azure.mgmt.compute.aio.operations.GalleryImageVersionsOperations.get": null, - "azure.mgmt.compute.operations.GalleryImageVersionsOperations.begin_create_or_update": null, - "azure.mgmt.compute.aio.operations.GalleryImageVersionsOperations.begin_create_or_update": null, - "azure.mgmt.compute.operations.GalleryImageVersionsOperations.begin_update": null, - "azure.mgmt.compute.aio.operations.GalleryImageVersionsOperations.begin_update": null, - "azure.mgmt.compute.operations.GalleryImageVersionsOperations.begin_delete": null, - "azure.mgmt.compute.aio.operations.GalleryImageVersionsOperations.begin_delete": null, - "azure.mgmt.compute.operations.GalleryInVMAccessControlProfilesOperations.list_by_gallery": null, - "azure.mgmt.compute.aio.operations.GalleryInVMAccessControlProfilesOperations.list_by_gallery": null, - "azure.mgmt.compute.operations.GalleryInVMAccessControlProfilesOperations.get": null, - "azure.mgmt.compute.aio.operations.GalleryInVMAccessControlProfilesOperations.get": null, - "azure.mgmt.compute.operations.GalleryInVMAccessControlProfilesOperations.begin_create_or_update": null, - "azure.mgmt.compute.aio.operations.GalleryInVMAccessControlProfilesOperations.begin_create_or_update": null, - "azure.mgmt.compute.operations.GalleryInVMAccessControlProfilesOperations.begin_update": null, - "azure.mgmt.compute.aio.operations.GalleryInVMAccessControlProfilesOperations.begin_update": null, - "azure.mgmt.compute.operations.GalleryInVMAccessControlProfilesOperations.begin_delete": null, - "azure.mgmt.compute.aio.operations.GalleryInVMAccessControlProfilesOperations.begin_delete": null, - "azure.mgmt.compute.operations.GalleryInVMAccessControlProfileVersionsOperations.list_by_gallery_in_vm_access_control_profile": null, - "azure.mgmt.compute.aio.operations.GalleryInVMAccessControlProfileVersionsOperations.list_by_gallery_in_vm_access_control_profile": null, - "azure.mgmt.compute.operations.GalleryInVMAccessControlProfileVersionsOperations.get": null, - "azure.mgmt.compute.aio.operations.GalleryInVMAccessControlProfileVersionsOperations.get": null, - "azure.mgmt.compute.operations.GalleryInVMAccessControlProfileVersionsOperations.begin_create_or_update": null, - "azure.mgmt.compute.aio.operations.GalleryInVMAccessControlProfileVersionsOperations.begin_create_or_update": null, - "azure.mgmt.compute.operations.GalleryInVMAccessControlProfileVersionsOperations.begin_update": null, - "azure.mgmt.compute.aio.operations.GalleryInVMAccessControlProfileVersionsOperations.begin_update": null, - "azure.mgmt.compute.operations.GalleryInVMAccessControlProfileVersionsOperations.begin_delete": null, - "azure.mgmt.compute.aio.operations.GalleryInVMAccessControlProfileVersionsOperations.begin_delete": null, - "azure.mgmt.compute.operations.GallerySharingProfileOperations.begin_update": null, - "azure.mgmt.compute.aio.operations.GallerySharingProfileOperations.begin_update": null, - "azure.mgmt.compute.operations.SoftDeletedResourceOperations.list_by_artifact_name": null, - "azure.mgmt.compute.aio.operations.SoftDeletedResourceOperations.list_by_artifact_name": null, - "azure.mgmt.compute.operations.CloudServiceRoleInstancesOperations.begin_delete": null, - "azure.mgmt.compute.aio.operations.CloudServiceRoleInstancesOperations.begin_delete": null, - "azure.mgmt.compute.operations.CloudServiceRoleInstancesOperations.get": null, - "azure.mgmt.compute.aio.operations.CloudServiceRoleInstancesOperations.get": null, - "azure.mgmt.compute.operations.CloudServiceRoleInstancesOperations.get_instance_view": null, - "azure.mgmt.compute.aio.operations.CloudServiceRoleInstancesOperations.get_instance_view": null, - "azure.mgmt.compute.operations.CloudServiceRoleInstancesOperations.list": null, - "azure.mgmt.compute.aio.operations.CloudServiceRoleInstancesOperations.list": null, - "azure.mgmt.compute.operations.CloudServiceRoleInstancesOperations.begin_restart": null, - "azure.mgmt.compute.aio.operations.CloudServiceRoleInstancesOperations.begin_restart": null, - "azure.mgmt.compute.operations.CloudServiceRoleInstancesOperations.begin_reimage": null, - "azure.mgmt.compute.aio.operations.CloudServiceRoleInstancesOperations.begin_reimage": null, - "azure.mgmt.compute.operations.CloudServiceRoleInstancesOperations.begin_rebuild": null, - "azure.mgmt.compute.aio.operations.CloudServiceRoleInstancesOperations.begin_rebuild": null, - "azure.mgmt.compute.operations.CloudServiceRoleInstancesOperations.get_remote_desktop_file": null, - "azure.mgmt.compute.aio.operations.CloudServiceRoleInstancesOperations.get_remote_desktop_file": null, - "azure.mgmt.compute.operations.CloudServiceRolesOperations.get": null, - "azure.mgmt.compute.aio.operations.CloudServiceRolesOperations.get": null, - "azure.mgmt.compute.operations.CloudServiceRolesOperations.list": null, - "azure.mgmt.compute.aio.operations.CloudServiceRolesOperations.list": null, - "azure.mgmt.compute.operations.CloudServicesOperations.begin_create_or_update": null, - "azure.mgmt.compute.aio.operations.CloudServicesOperations.begin_create_or_update": null, - "azure.mgmt.compute.operations.CloudServicesOperations.begin_update": null, - "azure.mgmt.compute.aio.operations.CloudServicesOperations.begin_update": null, - "azure.mgmt.compute.operations.CloudServicesOperations.begin_delete": null, - "azure.mgmt.compute.aio.operations.CloudServicesOperations.begin_delete": null, - "azure.mgmt.compute.operations.CloudServicesOperations.get": null, - "azure.mgmt.compute.aio.operations.CloudServicesOperations.get": null, - "azure.mgmt.compute.operations.CloudServicesOperations.get_instance_view": null, - "azure.mgmt.compute.aio.operations.CloudServicesOperations.get_instance_view": null, - "azure.mgmt.compute.operations.CloudServicesOperations.list_all": null, - "azure.mgmt.compute.aio.operations.CloudServicesOperations.list_all": null, - "azure.mgmt.compute.operations.CloudServicesOperations.list": null, - "azure.mgmt.compute.aio.operations.CloudServicesOperations.list": null, - "azure.mgmt.compute.operations.CloudServicesOperations.begin_start": null, - "azure.mgmt.compute.aio.operations.CloudServicesOperations.begin_start": null, - "azure.mgmt.compute.operations.CloudServicesOperations.begin_power_off": null, - "azure.mgmt.compute.aio.operations.CloudServicesOperations.begin_power_off": null, - "azure.mgmt.compute.operations.CloudServicesOperations.begin_restart": null, - "azure.mgmt.compute.aio.operations.CloudServicesOperations.begin_restart": null, - "azure.mgmt.compute.operations.CloudServicesOperations.begin_reimage": null, - "azure.mgmt.compute.aio.operations.CloudServicesOperations.begin_reimage": null, - "azure.mgmt.compute.operations.CloudServicesOperations.begin_rebuild": null, - "azure.mgmt.compute.aio.operations.CloudServicesOperations.begin_rebuild": null, - "azure.mgmt.compute.operations.CloudServicesOperations.begin_delete_instances": null, - "azure.mgmt.compute.aio.operations.CloudServicesOperations.begin_delete_instances": null, - "azure.mgmt.compute.operations.CloudServicesUpdateDomainOperations.begin_walk_update_domain": null, - "azure.mgmt.compute.aio.operations.CloudServicesUpdateDomainOperations.begin_walk_update_domain": null, - "azure.mgmt.compute.operations.CloudServicesUpdateDomainOperations.get_update_domain": null, - "azure.mgmt.compute.aio.operations.CloudServicesUpdateDomainOperations.get_update_domain": null, - "azure.mgmt.compute.operations.CloudServicesUpdateDomainOperations.list_update_domains": null, - "azure.mgmt.compute.aio.operations.CloudServicesUpdateDomainOperations.list_update_domains": null, - "azure.mgmt.compute.operations.CloudServiceOperatingSystemsOperations.get_os_version": null, - "azure.mgmt.compute.aio.operations.CloudServiceOperatingSystemsOperations.get_os_version": null, - "azure.mgmt.compute.operations.CloudServiceOperatingSystemsOperations.list_os_versions": null, - "azure.mgmt.compute.aio.operations.CloudServiceOperatingSystemsOperations.list_os_versions": null, - "azure.mgmt.compute.operations.CloudServiceOperatingSystemsOperations.get_os_family": null, - "azure.mgmt.compute.aio.operations.CloudServiceOperatingSystemsOperations.get_os_family": null, - "azure.mgmt.compute.operations.CloudServiceOperatingSystemsOperations.list_os_families": null, - "azure.mgmt.compute.aio.operations.CloudServiceOperatingSystemsOperations.list_os_families": null + "azure.mgmt.compute.models.AccessControlRules": "Microsoft.Compute.AccessControlRules", + "azure.mgmt.compute.models.AccessControlRulesIdentity": "Microsoft.Compute.AccessControlRulesIdentity", + "azure.mgmt.compute.models.AccessControlRulesPrivilege": "Microsoft.Compute.AccessControlRulesPrivilege", + "azure.mgmt.compute.models.AccessControlRulesRole": "Microsoft.Compute.AccessControlRulesRole", + "azure.mgmt.compute.models.AccessControlRulesRoleAssignment": "Microsoft.Compute.AccessControlRulesRoleAssignment", + "azure.mgmt.compute.models.AccessUri": "Microsoft.Compute.AccessUri", + "azure.mgmt.compute.models.AdditionalCapabilities": "Microsoft.Compute.AdditionalCapabilities", + "azure.mgmt.compute.models.AdditionalReplicaSet": "Microsoft.Compute.AdditionalReplicaSet", + "azure.mgmt.compute.models.AdditionalUnattendContent": "Microsoft.Compute.AdditionalUnattendContent", + "azure.mgmt.compute.models.AllInstancesDown": "Microsoft.Compute.AllInstancesDown", + "azure.mgmt.compute.models.AlternativeOption": "Microsoft.Compute.AlternativeOption", + "azure.mgmt.compute.models.ApiEntityReference": "Microsoft.Compute.ApiEntityReference", + "azure.mgmt.compute.models.ApiError": "Microsoft.Compute.ApiError", + "azure.mgmt.compute.models.ApiErrorBase": "Microsoft.Compute.ApiErrorBase", + "azure.mgmt.compute.models.ApplicationProfile": "Microsoft.Compute.ApplicationProfile", + "azure.mgmt.compute.models.ApproveRollingUpgradeParameterBody": "Microsoft.Compute.approveRollingUpgrade.Parameter.body.anonymous", + "azure.mgmt.compute.models.AttachDetachDataDisksRequest": "Microsoft.Compute.AttachDetachDataDisksRequest", + "azure.mgmt.compute.models.AutomaticOSUpgradePolicy": "Microsoft.Compute.AutomaticOSUpgradePolicy", + "azure.mgmt.compute.models.AutomaticOSUpgradeProperties": "Microsoft.Compute.AutomaticOSUpgradeProperties", + "azure.mgmt.compute.models.AutomaticRepairsPolicy": "Microsoft.Compute.AutomaticRepairsPolicy", + "azure.mgmt.compute.models.AutomaticZoneRebalancingPolicy": "Microsoft.Compute.AutomaticZoneRebalancingPolicy", + "azure.mgmt.compute.models.AvailabilityPolicy": "Microsoft.Compute.AvailabilityPolicy", + "azure.mgmt.compute.models.Resource": "Azure.ResourceManager.CommonTypes.Resource", + "azure.mgmt.compute.models.TrackedResource": "Azure.ResourceManager.CommonTypes.TrackedResource", + "azure.mgmt.compute.models.AvailabilitySet": "Microsoft.Compute.AvailabilitySet", + "azure.mgmt.compute.models.AvailabilitySetProperties": "Microsoft.Compute.AvailabilitySetProperties", + "azure.mgmt.compute.models.UpdateResource": "Microsoft.Compute.UpdateResource", + "azure.mgmt.compute.models.AvailabilitySetUpdate": "Microsoft.Compute.AvailabilitySetUpdate", + "azure.mgmt.compute.models.AvailablePatchSummary": "Microsoft.Compute.AvailablePatchSummary", + "azure.mgmt.compute.models.BillingProfile": "Microsoft.Compute.BillingProfile", + "azure.mgmt.compute.models.BootDiagnostics": "Microsoft.Compute.BootDiagnostics", + "azure.mgmt.compute.models.BootDiagnosticsInstanceView": "Microsoft.Compute.BootDiagnosticsInstanceView", + "azure.mgmt.compute.models.CapacityReservation": "Microsoft.Compute.CapacityReservation", + "azure.mgmt.compute.models.CapacityReservationGroup": "Microsoft.Compute.CapacityReservationGroup", + "azure.mgmt.compute.models.CapacityReservationGroupInstanceView": "Microsoft.Compute.CapacityReservationGroupInstanceView", + "azure.mgmt.compute.models.CapacityReservationGroupProperties": "Microsoft.Compute.CapacityReservationGroupProperties", + "azure.mgmt.compute.models.CapacityReservationGroupUpdate": "Microsoft.Compute.CapacityReservationGroupUpdate", + "azure.mgmt.compute.models.CapacityReservationInstanceView": "Microsoft.Compute.CapacityReservationInstanceView", + "azure.mgmt.compute.models.CapacityReservationInstanceViewWithName": "Microsoft.Compute.CapacityReservationInstanceViewWithName", + "azure.mgmt.compute.models.CapacityReservationProfile": "Microsoft.Compute.CapacityReservationProfile", + "azure.mgmt.compute.models.CapacityReservationProperties": "Microsoft.Compute.CapacityReservationProperties", + "azure.mgmt.compute.models.CapacityReservationUpdate": "Microsoft.Compute.CapacityReservationUpdate", + "azure.mgmt.compute.models.CapacityReservationUtilization": "Microsoft.Compute.CapacityReservationUtilization", + "azure.mgmt.compute.models.CloudError": "Microsoft.Compute.CloudError", + "azure.mgmt.compute.models.PirCommunityGalleryResource": "Microsoft.Compute.PirCommunityGalleryResource", + "azure.mgmt.compute.models.CommunityGallery": "Microsoft.Compute.CommunityGallery", + "azure.mgmt.compute.models.CommunityGalleryIdentifier": "Microsoft.Compute.CommunityGalleryIdentifier", + "azure.mgmt.compute.models.CommunityGalleryImage": "Microsoft.Compute.CommunityGalleryImage", + "azure.mgmt.compute.models.CommunityGalleryImageIdentifier": "Microsoft.Compute.CommunityGalleryImageIdentifier", + "azure.mgmt.compute.models.CommunityGalleryImageProperties": "Microsoft.Compute.CommunityGalleryImageProperties", + "azure.mgmt.compute.models.CommunityGalleryImageVersion": "Microsoft.Compute.CommunityGalleryImageVersion", + "azure.mgmt.compute.models.CommunityGalleryImageVersionProperties": "Microsoft.Compute.CommunityGalleryImageVersionProperties", + "azure.mgmt.compute.models.CommunityGalleryInfo": "Microsoft.Compute.CommunityGalleryInfo", + "azure.mgmt.compute.models.CommunityGalleryMetadata": "Microsoft.Compute.CommunityGalleryMetadata", + "azure.mgmt.compute.models.CommunityGalleryProperties": "Microsoft.Compute.CommunityGalleryProperties", + "azure.mgmt.compute.models.ConvertToVirtualMachineScaleSetInput": "Microsoft.Compute.ConvertToVirtualMachineScaleSetInput", + "azure.mgmt.compute.models.ConvertToVirtualMachineScaleSetParameterBody": "Microsoft.Compute.convertToVirtualMachineScaleSet.Parameter.body.anonymous", + "azure.mgmt.compute.models.CopyCompletionError": "Microsoft.Compute.CopyCompletionError", + "azure.mgmt.compute.models.CreationData": "Microsoft.Compute.CreationData", + "azure.mgmt.compute.models.DataDisk": "Microsoft.Compute.DataDisk", + "azure.mgmt.compute.models.DataDiskImage": "Microsoft.Compute.DataDiskImage", + "azure.mgmt.compute.models.DiskImageEncryption": "Microsoft.Compute.DiskImageEncryption", + "azure.mgmt.compute.models.DataDiskImageEncryption": "Microsoft.Compute.DataDiskImageEncryption", + "azure.mgmt.compute.models.DataDisksToAttach": "Microsoft.Compute.DataDisksToAttach", + "azure.mgmt.compute.models.DataDisksToDetach": "Microsoft.Compute.DataDisksToDetach", + "azure.mgmt.compute.models.DeallocateParameterBody": "Microsoft.Compute.deallocate.Parameter.body.anonymous", + "azure.mgmt.compute.models.DedicatedHost": "Microsoft.Compute.DedicatedHost", + "azure.mgmt.compute.models.DedicatedHostAllocatableVM": "Microsoft.Compute.DedicatedHostAllocatableVM", + "azure.mgmt.compute.models.DedicatedHostAvailableCapacity": "Microsoft.Compute.DedicatedHostAvailableCapacity", + "azure.mgmt.compute.models.DedicatedHostGroup": "Microsoft.Compute.DedicatedHostGroup", + "azure.mgmt.compute.models.DedicatedHostGroupInstanceView": "Microsoft.Compute.DedicatedHostGroupInstanceView", + "azure.mgmt.compute.models.DedicatedHostGroupProperties": "Microsoft.Compute.DedicatedHostGroupProperties", + "azure.mgmt.compute.models.DedicatedHostGroupPropertiesAdditionalCapabilities": "Microsoft.Compute.DedicatedHostGroupPropertiesAdditionalCapabilities", + "azure.mgmt.compute.models.DedicatedHostGroupUpdate": "Microsoft.Compute.DedicatedHostGroupUpdate", + "azure.mgmt.compute.models.DedicatedHostInstanceView": "Microsoft.Compute.DedicatedHostInstanceView", + "azure.mgmt.compute.models.DedicatedHostInstanceViewWithName": "Microsoft.Compute.DedicatedHostInstanceViewWithName", + "azure.mgmt.compute.models.DedicatedHostProperties": "Microsoft.Compute.DedicatedHostProperties", + "azure.mgmt.compute.models.DedicatedHostUpdate": "Microsoft.Compute.DedicatedHostUpdate", + "azure.mgmt.compute.models.DefaultVirtualMachineScaleSetInfo": "Microsoft.Compute.DefaultVirtualMachineScaleSetInfo", + "azure.mgmt.compute.models.DiagnosticsProfile": "Microsoft.Compute.DiagnosticsProfile", + "azure.mgmt.compute.models.DiffDiskSettings": "Microsoft.Compute.DiffDiskSettings", + "azure.mgmt.compute.models.Disallowed": "Microsoft.Compute.Disallowed", + "azure.mgmt.compute.models.DisallowedConfiguration": "Microsoft.Compute.DisallowedConfiguration", + "azure.mgmt.compute.models.Disk": "Microsoft.Compute.Disk", + "azure.mgmt.compute.models.DiskAccess": "Microsoft.Compute.DiskAccess", + "azure.mgmt.compute.models.DiskAccessProperties": "Microsoft.Compute.DiskAccessProperties", + "azure.mgmt.compute.models.DiskAccessUpdate": "Microsoft.Compute.DiskAccessUpdate", + "azure.mgmt.compute.models.DiskEncryptionSet": "Microsoft.Compute.DiskEncryptionSet", + "azure.mgmt.compute.models.SubResource": "Microsoft.Compute.SubResource", + "azure.mgmt.compute.models.DiskEncryptionSetParameters": "Microsoft.Compute.DiskEncryptionSetParameters", + "azure.mgmt.compute.models.DiskEncryptionSettings": "Microsoft.Compute.DiskEncryptionSettings", + "azure.mgmt.compute.models.DiskEncryptionSetUpdate": "Microsoft.Compute.DiskEncryptionSetUpdate", + "azure.mgmt.compute.models.DiskEncryptionSetUpdateProperties": "Microsoft.Compute.DiskEncryptionSetUpdateProperties", + "azure.mgmt.compute.models.DiskInstanceView": "Microsoft.Compute.DiskInstanceView", + "azure.mgmt.compute.models.DiskProperties": "Microsoft.Compute.DiskProperties", + "azure.mgmt.compute.models.DiskPurchasePlan": "Microsoft.Compute.DiskPurchasePlan", + "azure.mgmt.compute.models.ProxyResource": "Azure.ResourceManager.CommonTypes.ProxyResource", + "azure.mgmt.compute.models.DiskRestorePoint": "Microsoft.Compute.DiskRestorePoint", + "azure.mgmt.compute.models.SubResourceReadOnly": "Microsoft.Compute.SubResourceReadOnly", + "azure.mgmt.compute.models.DiskRestorePointAttributes": "Microsoft.Compute.DiskRestorePointAttributes", + "azure.mgmt.compute.models.DiskRestorePointInstanceView": "Microsoft.Compute.DiskRestorePointInstanceView", + "azure.mgmt.compute.models.DiskRestorePointProperties": "Microsoft.Compute.DiskRestorePointProperties", + "azure.mgmt.compute.models.DiskRestorePointReplicationStatus": "Microsoft.Compute.DiskRestorePointReplicationStatus", + "azure.mgmt.compute.models.DiskSecurityProfile": "Microsoft.Compute.DiskSecurityProfile", + "azure.mgmt.compute.models.DiskSku": "Microsoft.Compute.DiskSku", + "azure.mgmt.compute.models.DiskUpdate": "Microsoft.Compute.DiskUpdate", + "azure.mgmt.compute.models.DiskUpdateProperties": "Microsoft.Compute.DiskUpdateProperties", + "azure.mgmt.compute.models.Encryption": "Microsoft.Compute.Encryption", + "azure.mgmt.compute.models.EncryptionIdentity": "Microsoft.Compute.EncryptionIdentity", + "azure.mgmt.compute.models.EncryptionImages": "Microsoft.Compute.EncryptionImages", + "azure.mgmt.compute.models.EncryptionSetIdentity": "Microsoft.Compute.EncryptionSetIdentity", + "azure.mgmt.compute.models.EncryptionSetProperties": "Microsoft.Compute.EncryptionSetProperties", + "azure.mgmt.compute.models.EncryptionSettingsCollection": "Microsoft.Compute.EncryptionSettingsCollection", + "azure.mgmt.compute.models.EncryptionSettingsElement": "Microsoft.Compute.EncryptionSettingsElement", + "azure.mgmt.compute.models.ErrorAdditionalInfo": "Azure.ResourceManager.CommonTypes.ErrorAdditionalInfo", + "azure.mgmt.compute.models.ErrorDetail": "Azure.ResourceManager.CommonTypes.ErrorDetail", + "azure.mgmt.compute.models.ErrorResponse": "Azure.ResourceManager.CommonTypes.ErrorResponse", + "azure.mgmt.compute.models.EventGridAndResourceGraph": "Microsoft.Compute.EventGridAndResourceGraph", + "azure.mgmt.compute.models.ExecutedValidation": "Microsoft.Compute.ExecutedValidation", + "azure.mgmt.compute.models.ExtendedLocation": "Microsoft.Compute.ExtendedLocation", + "azure.mgmt.compute.models.Gallery": "Microsoft.Compute.Gallery", + "azure.mgmt.compute.models.GalleryApplication": "Microsoft.Compute.GalleryApplication", + "azure.mgmt.compute.models.GalleryApplicationCustomAction": "Microsoft.Compute.GalleryApplicationCustomAction", + "azure.mgmt.compute.models.GalleryApplicationCustomActionParameter": "Microsoft.Compute.GalleryApplicationCustomActionParameter", + "azure.mgmt.compute.models.GalleryApplicationProperties": "Microsoft.Compute.GalleryApplicationProperties", + "azure.mgmt.compute.models.UpdateResourceDefinition": "Microsoft.Compute.UpdateResourceDefinition", + "azure.mgmt.compute.models.GalleryApplicationUpdate": "Microsoft.Compute.GalleryApplicationUpdate", + "azure.mgmt.compute.models.GalleryApplicationVersion": "Microsoft.Compute.GalleryApplicationVersion", + "azure.mgmt.compute.models.GalleryApplicationVersionProperties": "Microsoft.Compute.GalleryApplicationVersionProperties", + "azure.mgmt.compute.models.GalleryArtifactPublishingProfileBase": "Microsoft.Compute.GalleryArtifactPublishingProfileBase", + "azure.mgmt.compute.models.GalleryApplicationVersionPublishingProfile": "Microsoft.Compute.GalleryApplicationVersionPublishingProfile", + "azure.mgmt.compute.models.GalleryArtifactSafetyProfileBase": "Microsoft.Compute.GalleryArtifactSafetyProfileBase", + "azure.mgmt.compute.models.GalleryApplicationVersionSafetyProfile": "Microsoft.Compute.GalleryApplicationVersionSafetyProfile", + "azure.mgmt.compute.models.GalleryApplicationVersionUpdate": "Microsoft.Compute.GalleryApplicationVersionUpdate", + "azure.mgmt.compute.models.GalleryArtifactVersionSource": "Microsoft.Compute.GalleryArtifactVersionSource", + "azure.mgmt.compute.models.GalleryArtifactVersionFullSource": "Microsoft.Compute.GalleryArtifactVersionFullSource", + "azure.mgmt.compute.models.GalleryDiskImage": "Microsoft.Compute.GalleryDiskImage", + "azure.mgmt.compute.models.GalleryDataDiskImage": "Microsoft.Compute.GalleryDataDiskImage", + "azure.mgmt.compute.models.GalleryDiskImageSource": "Microsoft.Compute.GalleryDiskImageSource", + "azure.mgmt.compute.models.GalleryExtendedLocation": "Microsoft.Compute.GalleryExtendedLocation", + "azure.mgmt.compute.models.GalleryIdentifier": "Microsoft.Compute.GalleryIdentifier", + "azure.mgmt.compute.models.GalleryIdentity": "Microsoft.Compute.GalleryIdentity", + "azure.mgmt.compute.models.GalleryImage": "Microsoft.Compute.GalleryImage", + "azure.mgmt.compute.models.GalleryImageFeature": "Microsoft.Compute.GalleryImageFeature", + "azure.mgmt.compute.models.GalleryImageIdentifier": "Microsoft.Compute.GalleryImageIdentifier", + "azure.mgmt.compute.models.GalleryImageProperties": "Microsoft.Compute.GalleryImageProperties", + "azure.mgmt.compute.models.GalleryImageUpdate": "Microsoft.Compute.GalleryImageUpdate", + "azure.mgmt.compute.models.GalleryImageVersion": "Microsoft.Compute.GalleryImageVersion", + "azure.mgmt.compute.models.GalleryImageVersionProperties": "Microsoft.Compute.GalleryImageVersionProperties", + "azure.mgmt.compute.models.GalleryImageVersionPublishingProfile": "Microsoft.Compute.GalleryImageVersionPublishingProfile", + "azure.mgmt.compute.models.GalleryImageVersionSafetyProfile": "Microsoft.Compute.GalleryImageVersionSafetyProfile", + "azure.mgmt.compute.models.GalleryImageVersionStorageProfile": "Microsoft.Compute.GalleryImageVersionStorageProfile", + "azure.mgmt.compute.models.GalleryImageVersionUefiSettings": "Microsoft.Compute.GalleryImageVersionUefiSettings", + "azure.mgmt.compute.models.GalleryImageVersionUpdate": "Microsoft.Compute.GalleryImageVersionUpdate", + "azure.mgmt.compute.models.GalleryInVMAccessControlProfile": "Microsoft.Compute.GalleryInVMAccessControlProfile", + "azure.mgmt.compute.models.GalleryResourceProfilePropertiesBase": "Microsoft.Compute.GalleryResourceProfilePropertiesBase", + "azure.mgmt.compute.models.GalleryInVMAccessControlProfileProperties": "Microsoft.Compute.GalleryInVMAccessControlProfileProperties", + "azure.mgmt.compute.models.GalleryInVMAccessControlProfileUpdate": "Microsoft.Compute.GalleryInVMAccessControlProfileUpdate", + "azure.mgmt.compute.models.GalleryInVMAccessControlProfileVersion": "Microsoft.Compute.GalleryInVMAccessControlProfileVersion", + "azure.mgmt.compute.models.GalleryResourceProfileVersionPropertiesBase": "Microsoft.Compute.GalleryResourceProfileVersionPropertiesBase", + "azure.mgmt.compute.models.GalleryInVMAccessControlProfileVersionProperties": "Microsoft.Compute.GalleryInVMAccessControlProfileVersionProperties", + "azure.mgmt.compute.models.GalleryInVMAccessControlProfileVersionUpdate": "Microsoft.Compute.GalleryInVMAccessControlProfileVersionUpdate", + "azure.mgmt.compute.models.GalleryOSDiskImage": "Microsoft.Compute.GalleryOSDiskImage", + "azure.mgmt.compute.models.GalleryProperties": "Microsoft.Compute.GalleryProperties", + "azure.mgmt.compute.models.GallerySoftDeletedResource": "Microsoft.Compute.GallerySoftDeletedResource", + "azure.mgmt.compute.models.GallerySoftDeletedResourceProperties": "Microsoft.Compute.GallerySoftDeletedResourceProperties", + "azure.mgmt.compute.models.GalleryTargetExtendedLocation": "Microsoft.Compute.GalleryTargetExtendedLocation", + "azure.mgmt.compute.models.GalleryUpdate": "Microsoft.Compute.GalleryUpdate", + "azure.mgmt.compute.models.GenerateKeyPairParameterBody": "Microsoft.Compute.generateKeyPair.Parameter.body.anonymous", + "azure.mgmt.compute.models.GrantAccessData": "Microsoft.Compute.GrantAccessData", + "azure.mgmt.compute.models.HardwareProfile": "Microsoft.Compute.HardwareProfile", + "azure.mgmt.compute.models.HostEndpointSettings": "Microsoft.Compute.HostEndpointSettings", + "azure.mgmt.compute.models.Image": "Microsoft.Compute.Image", + "azure.mgmt.compute.models.ImageDisk": "Microsoft.Compute.ImageDisk", + "azure.mgmt.compute.models.ImageDataDisk": "Microsoft.Compute.ImageDataDisk", + "azure.mgmt.compute.models.ImageDeprecationStatus": "Microsoft.Compute.ImageDeprecationStatus", + "azure.mgmt.compute.models.ImageDiskReference": "Microsoft.Compute.ImageDiskReference", + "azure.mgmt.compute.models.ImageOSDisk": "Microsoft.Compute.ImageOSDisk", + "azure.mgmt.compute.models.ImageProperties": "Microsoft.Compute.ImageProperties", + "azure.mgmt.compute.models.ImagePurchasePlan": "Microsoft.Compute.ImagePurchasePlan", + "azure.mgmt.compute.models.ImageReference": "Microsoft.Compute.ImageReference", + "azure.mgmt.compute.models.ImageStorageProfile": "Microsoft.Compute.ImageStorageProfile", + "azure.mgmt.compute.models.ImageUpdate": "Microsoft.Compute.ImageUpdate", + "azure.mgmt.compute.models.ImageVersionSecurityProfile": "Microsoft.Compute.ImageVersionSecurityProfile", + "azure.mgmt.compute.models.InnerError": "Microsoft.Compute.InnerError", + "azure.mgmt.compute.models.InstanceViewStatus": "Microsoft.Compute.InstanceViewStatus", + "azure.mgmt.compute.models.KeyForDiskEncryptionSet": "Microsoft.Compute.KeyForDiskEncryptionSet", + "azure.mgmt.compute.models.KeyVaultAndKeyReference": "Microsoft.Compute.KeyVaultAndKeyReference", + "azure.mgmt.compute.models.KeyVaultAndSecretReference": "Microsoft.Compute.KeyVaultAndSecretReference", + "azure.mgmt.compute.models.KeyVaultKeyReference": "Microsoft.Compute.KeyVaultKeyReference", + "azure.mgmt.compute.models.KeyVaultSecretReference": "Microsoft.Compute.KeyVaultSecretReference", + "azure.mgmt.compute.models.LastPatchInstallationSummary": "Microsoft.Compute.LastPatchInstallationSummary", + "azure.mgmt.compute.models.LinuxConfiguration": "Microsoft.Compute.LinuxConfiguration", + "azure.mgmt.compute.models.LinuxParameters": "Microsoft.Compute.LinuxParameters", + "azure.mgmt.compute.models.LinuxPatchSettings": "Microsoft.Compute.LinuxPatchSettings", + "azure.mgmt.compute.models.LinuxVMGuestPatchAutomaticByPlatformSettings": "Microsoft.Compute.LinuxVMGuestPatchAutomaticByPlatformSettings", + "azure.mgmt.compute.models.LogAnalyticsInputBase": "Microsoft.Compute.LogAnalyticsInputBase", + "azure.mgmt.compute.models.MaintenanceRedeployStatus": "Microsoft.Compute.MaintenanceRedeployStatus", + "azure.mgmt.compute.models.ManagedDiskParameters": "Microsoft.Compute.ManagedDiskParameters", + "azure.mgmt.compute.models.MaxInstancePercentPerZonePolicy": "Microsoft.Compute.MaxInstancePercentPerZonePolicy", + "azure.mgmt.compute.models.MigrateToVirtualMachineScaleSetInput": "Microsoft.Compute.MigrateToVirtualMachineScaleSetInput", + "azure.mgmt.compute.models.MigrateToVmScaleSetParameterBody": "Microsoft.Compute.migrateToVMScaleSet.Parameter.body.anonymous", + "azure.mgmt.compute.models.MigrateVMToVirtualMachineScaleSetInput": "Microsoft.Compute.MigrateVMToVirtualMachineScaleSetInput", + "azure.mgmt.compute.models.NetworkInterfaceReference": "Microsoft.Compute.NetworkInterfaceReference", + "azure.mgmt.compute.models.NetworkInterfaceReferenceProperties": "Microsoft.Compute.NetworkInterfaceReferenceProperties", + "azure.mgmt.compute.models.NetworkProfile": "Microsoft.Compute.NetworkProfile", + "azure.mgmt.compute.models.OkResponse": "TypeSpec.Http.OkResponse", + "azure.mgmt.compute.models.Operation": "Azure.ResourceManager.CommonTypes.Operation", + "azure.mgmt.compute.models.OperationDisplay": "Azure.ResourceManager.CommonTypes.OperationDisplay", + "azure.mgmt.compute.models.OrchestrationServiceStateInput": "Microsoft.Compute.OrchestrationServiceStateInput", + "azure.mgmt.compute.models.OrchestrationServiceSummary": "Microsoft.Compute.OrchestrationServiceSummary", + "azure.mgmt.compute.models.OSDisk": "Microsoft.Compute.OSDisk", + "azure.mgmt.compute.models.OSDiskImage": "Microsoft.Compute.OSDiskImage", + "azure.mgmt.compute.models.OSDiskImageEncryption": "Microsoft.Compute.OSDiskImageEncryption", + "azure.mgmt.compute.models.OSDiskImageSecurityProfile": "Microsoft.Compute.OSDiskImageSecurityProfile", + "azure.mgmt.compute.models.OSImageNotificationProfile": "Microsoft.Compute.OSImageNotificationProfile", + "azure.mgmt.compute.models.OSProfile": "Microsoft.Compute.OSProfile", + "azure.mgmt.compute.models.OSProfileProvisioningData": "Microsoft.Compute.OSProfileProvisioningData", + "azure.mgmt.compute.models.PatchInstallationDetail": "Microsoft.Compute.PatchInstallationDetail", + "azure.mgmt.compute.models.PatchSettings": "Microsoft.Compute.PatchSettings", + "azure.mgmt.compute.models.PerformMaintenanceParameterBody": "Microsoft.Compute.performMaintenance.Parameter.body.anonymous", + "azure.mgmt.compute.models.PirResource": "Microsoft.Compute.PirResource", + "azure.mgmt.compute.models.PirSharedGalleryResource": "Microsoft.Compute.PirSharedGalleryResource", + "azure.mgmt.compute.models.Placement": "Microsoft.Compute.Placement", + "azure.mgmt.compute.models.Plan": "Microsoft.Compute.Plan", + "azure.mgmt.compute.models.PlatformAttribute": "Microsoft.Compute.PlatformAttribute", + "azure.mgmt.compute.models.PolicyViolation": "Microsoft.Compute.PolicyViolation", + "azure.mgmt.compute.models.PowerOffParameterBody": "Microsoft.Compute.powerOff.Parameter.body.anonymous", + "azure.mgmt.compute.models.PriorityMixPolicy": "Microsoft.Compute.PriorityMixPolicy", + "azure.mgmt.compute.models.PrivateEndpoint": "Microsoft.Compute.PrivateEndpoint", + "azure.mgmt.compute.models.PrivateEndpointConnection": "Microsoft.Compute.PrivateEndpointConnection", + "azure.mgmt.compute.models.PrivateEndpointConnectionProperties": "Microsoft.Compute.PrivateEndpointConnectionProperties", + "azure.mgmt.compute.models.PrivateLinkResource": "Microsoft.Compute.PrivateLinkResource", + "azure.mgmt.compute.models.PrivateLinkResourceListResult": "Microsoft.Compute.PrivateLinkResourceListResult", + "azure.mgmt.compute.models.PrivateLinkResourceProperties": "Microsoft.Compute.PrivateLinkResourceProperties", + "azure.mgmt.compute.models.PrivateLinkServiceConnectionState": "Microsoft.Compute.PrivateLinkServiceConnectionState", + "azure.mgmt.compute.models.PropertyUpdatesInProgress": "Microsoft.Compute.PropertyUpdatesInProgress", + "azure.mgmt.compute.models.ProximityPlacementGroup": "Microsoft.Compute.ProximityPlacementGroup", + "azure.mgmt.compute.models.ProximityPlacementGroupProperties": "Microsoft.Compute.ProximityPlacementGroupProperties", + "azure.mgmt.compute.models.ProximityPlacementGroupPropertiesIntent": "Microsoft.Compute.ProximityPlacementGroupPropertiesIntent", + "azure.mgmt.compute.models.ProximityPlacementGroupUpdate": "Microsoft.Compute.ProximityPlacementGroupUpdate", + "azure.mgmt.compute.models.ProxyAgentSettings": "Microsoft.Compute.ProxyAgentSettings", + "azure.mgmt.compute.models.PublicIPAddressSku": "Microsoft.Compute.PublicIPAddressSku", + "azure.mgmt.compute.models.PurchasePlan": "Microsoft.Compute.PurchasePlan", + "azure.mgmt.compute.models.RecommendedMachineConfiguration": "Microsoft.Compute.RecommendedMachineConfiguration", + "azure.mgmt.compute.models.RecoveryWalkResponse": "Microsoft.Compute.RecoveryWalkResponse", + "azure.mgmt.compute.models.RedeployParameterBody": "Microsoft.Compute.redeploy.Parameter.body.anonymous", + "azure.mgmt.compute.models.RegionalReplicationStatus": "Microsoft.Compute.RegionalReplicationStatus", + "azure.mgmt.compute.models.RegionalSharingStatus": "Microsoft.Compute.RegionalSharingStatus", + "azure.mgmt.compute.models.ReimageAllParameterBody": "Microsoft.Compute.reimageAll.Parameter.body.anonymous", + "azure.mgmt.compute.models.ReimageParameterBody": "Microsoft.Compute.reimage.Parameter.body.anonymous", + "azure.mgmt.compute.models.ReimageParameterBody1": "Microsoft.Compute.reimage.Parameter.body.anonymous", + "azure.mgmt.compute.models.ReimageParameterBody2": "Microsoft.Compute.reimage.Parameter.body.anonymous", + "azure.mgmt.compute.models.ReplicationStatus": "Microsoft.Compute.ReplicationStatus", + "azure.mgmt.compute.models.RequestRateByIntervalInput": "Microsoft.Compute.RequestRateByIntervalInput", + "azure.mgmt.compute.models.ResiliencyPolicy": "Microsoft.Compute.ResiliencyPolicy", + "azure.mgmt.compute.models.ResilientVMCreationPolicy": "Microsoft.Compute.ResilientVMCreationPolicy", + "azure.mgmt.compute.models.ResilientVMDeletionPolicy": "Microsoft.Compute.ResilientVMDeletionPolicy", + "azure.mgmt.compute.models.ResourceRange": "Microsoft.Compute.ResourceRange", + "azure.mgmt.compute.models.ResourceSharingProfile": "Microsoft.Compute.ResourceSharingProfile", + "azure.mgmt.compute.models.ResourceSku": "Microsoft.Compute.ResourceSku", + "azure.mgmt.compute.models.ResourceSkuCapabilities": "Microsoft.Compute.ResourceSkuCapabilities", + "azure.mgmt.compute.models.ResourceSkuCapacity": "Microsoft.Compute.ResourceSkuCapacity", + "azure.mgmt.compute.models.ResourceSkuCosts": "Microsoft.Compute.ResourceSkuCosts", + "azure.mgmt.compute.models.ResourceSkuLocationInfo": "Microsoft.Compute.ResourceSkuLocationInfo", + "azure.mgmt.compute.models.ResourceSkuRestrictionInfo": "Microsoft.Compute.ResourceSkuRestrictionInfo", + "azure.mgmt.compute.models.ResourceSkuRestrictions": "Microsoft.Compute.ResourceSkuRestrictions", + "azure.mgmt.compute.models.ResourceSkuZoneDetails": "Microsoft.Compute.ResourceSkuZoneDetails", + "azure.mgmt.compute.models.RestartParameterBody": "Microsoft.Compute.restart.Parameter.body.anonymous", + "azure.mgmt.compute.models.RestorePoint": "Microsoft.Compute.RestorePoint", + "azure.mgmt.compute.models.RestorePointCollection": "Microsoft.Compute.RestorePointCollection", + "azure.mgmt.compute.models.RestorePointCollectionProperties": "Microsoft.Compute.RestorePointCollectionProperties", + "azure.mgmt.compute.models.RestorePointCollectionSourceProperties": "Microsoft.Compute.RestorePointCollectionSourceProperties", + "azure.mgmt.compute.models.RestorePointCollectionUpdate": "Microsoft.Compute.RestorePointCollectionUpdate", + "azure.mgmt.compute.models.RestorePointEncryption": "Microsoft.Compute.RestorePointEncryption", + "azure.mgmt.compute.models.RestorePointInstanceView": "Microsoft.Compute.RestorePointInstanceView", + "azure.mgmt.compute.models.RestorePointProperties": "Microsoft.Compute.RestorePointProperties", + "azure.mgmt.compute.models.RestorePointSourceMetadata": "Microsoft.Compute.RestorePointSourceMetadata", + "azure.mgmt.compute.models.RestorePointSourceVMDataDisk": "Microsoft.Compute.RestorePointSourceVMDataDisk", + "azure.mgmt.compute.models.RestorePointSourceVMOSDisk": "Microsoft.Compute.RestorePointSourceVMOSDisk", + "azure.mgmt.compute.models.RestorePointSourceVMStorageProfile": "Microsoft.Compute.RestorePointSourceVMStorageProfile", + "azure.mgmt.compute.models.RetrieveBootDiagnosticsDataResult": "Microsoft.Compute.RetrieveBootDiagnosticsDataResult", + "azure.mgmt.compute.models.RollbackStatusInfo": "Microsoft.Compute.RollbackStatusInfo", + "azure.mgmt.compute.models.RollingUpgradePolicy": "Microsoft.Compute.RollingUpgradePolicy", + "azure.mgmt.compute.models.RollingUpgradeProgressInfo": "Microsoft.Compute.RollingUpgradeProgressInfo", + "azure.mgmt.compute.models.RollingUpgradeRunningStatus": "Microsoft.Compute.RollingUpgradeRunningStatus", + "azure.mgmt.compute.models.RollingUpgradeStatusInfo": "Microsoft.Compute.RollingUpgradeStatusInfo", + "azure.mgmt.compute.models.RollingUpgradeStatusInfoProperties": "Microsoft.Compute.RollingUpgradeStatusInfoProperties", + "azure.mgmt.compute.models.RunCommandDocumentBase": "Microsoft.Compute.RunCommandDocumentBase", + "azure.mgmt.compute.models.RunCommandDocument": "Microsoft.Compute.RunCommandDocument", + "azure.mgmt.compute.models.RunCommandInput": "Microsoft.Compute.RunCommandInput", + "azure.mgmt.compute.models.RunCommandInputParameter": "Microsoft.Compute.RunCommandInputParameter", + "azure.mgmt.compute.models.RunCommandManagedIdentity": "Microsoft.Compute.RunCommandManagedIdentity", + "azure.mgmt.compute.models.RunCommandParameterDefinition": "Microsoft.Compute.RunCommandParameterDefinition", + "azure.mgmt.compute.models.RunCommandResult": "Microsoft.Compute.RunCommandResult", + "azure.mgmt.compute.models.ScaleInPolicy": "Microsoft.Compute.ScaleInPolicy", + "azure.mgmt.compute.models.ScheduledEventsAdditionalPublishingTargets": "Microsoft.Compute.ScheduledEventsAdditionalPublishingTargets", + "azure.mgmt.compute.models.ScheduledEventsPolicy": "Microsoft.Compute.ScheduledEventsPolicy", + "azure.mgmt.compute.models.ScheduledEventsProfile": "Microsoft.Compute.ScheduledEventsProfile", + "azure.mgmt.compute.models.ScheduleProfile": "Microsoft.Compute.ScheduleProfile", + "azure.mgmt.compute.models.SecurityPostureReference": "Microsoft.Compute.SecurityPostureReference", + "azure.mgmt.compute.models.SecurityPostureReferenceUpdate": "Microsoft.Compute.SecurityPostureReferenceUpdate", + "azure.mgmt.compute.models.SecurityProfile": "Microsoft.Compute.SecurityProfile", + "azure.mgmt.compute.models.ServiceArtifactReference": "Microsoft.Compute.ServiceArtifactReference", + "azure.mgmt.compute.models.SharedGallery": "Microsoft.Compute.SharedGallery", + "azure.mgmt.compute.models.SharedGalleryDiskImage": "Microsoft.Compute.SharedGalleryDiskImage", + "azure.mgmt.compute.models.SharedGalleryDataDiskImage": "Microsoft.Compute.SharedGalleryDataDiskImage", + "azure.mgmt.compute.models.SharedGalleryIdentifier": "Microsoft.Compute.SharedGalleryIdentifier", + "azure.mgmt.compute.models.SharedGalleryImage": "Microsoft.Compute.SharedGalleryImage", + "azure.mgmt.compute.models.SharedGalleryImageProperties": "Microsoft.Compute.SharedGalleryImageProperties", + "azure.mgmt.compute.models.SharedGalleryImageVersion": "Microsoft.Compute.SharedGalleryImageVersion", + "azure.mgmt.compute.models.SharedGalleryImageVersionProperties": "Microsoft.Compute.SharedGalleryImageVersionProperties", + "azure.mgmt.compute.models.SharedGalleryImageVersionStorageProfile": "Microsoft.Compute.SharedGalleryImageVersionStorageProfile", + "azure.mgmt.compute.models.SharedGalleryOSDiskImage": "Microsoft.Compute.SharedGalleryOSDiskImage", + "azure.mgmt.compute.models.SharedGalleryProperties": "Microsoft.Compute.SharedGalleryProperties", + "azure.mgmt.compute.models.ShareInfoElement": "Microsoft.Compute.ShareInfoElement", + "azure.mgmt.compute.models.SharingProfile": "Microsoft.Compute.SharingProfile", + "azure.mgmt.compute.models.SharingProfileGroup": "Microsoft.Compute.SharingProfileGroup", + "azure.mgmt.compute.models.SharingStatus": "Microsoft.Compute.SharingStatus", + "azure.mgmt.compute.models.SharingUpdate": "Microsoft.Compute.SharingUpdate", + "azure.mgmt.compute.models.Sku": "Microsoft.Compute.Sku", + "azure.mgmt.compute.models.SkuProfile": "Microsoft.Compute.SkuProfile", + "azure.mgmt.compute.models.SkuProfileVMSize": "Microsoft.Compute.SkuProfileVMSize", + "azure.mgmt.compute.models.Snapshot": "Microsoft.Compute.Snapshot", + "azure.mgmt.compute.models.SnapshotProperties": "Microsoft.Compute.SnapshotProperties", + "azure.mgmt.compute.models.SnapshotSku": "Microsoft.Compute.SnapshotSku", + "azure.mgmt.compute.models.SnapshotUpdate": "Microsoft.Compute.SnapshotUpdate", + "azure.mgmt.compute.models.SnapshotUpdateProperties": "Microsoft.Compute.SnapshotUpdateProperties", + "azure.mgmt.compute.models.SoftDeletePolicy": "Microsoft.Compute.SoftDeletePolicy", + "azure.mgmt.compute.models.SourceVault": "Microsoft.Compute.SourceVault", + "azure.mgmt.compute.models.SpotRestorePolicy": "Microsoft.Compute.SpotRestorePolicy", + "azure.mgmt.compute.models.SshConfiguration": "Microsoft.Compute.SshConfiguration", + "azure.mgmt.compute.models.SshGenerateKeyPairInputParameters": "Microsoft.Compute.SshGenerateKeyPairInputParameters", + "azure.mgmt.compute.models.SshPublicKey": "Microsoft.Compute.SshPublicKey", + "azure.mgmt.compute.models.SshPublicKeyGenerateKeyPairResult": "Microsoft.Compute.SshPublicKeyGenerateKeyPairResult", + "azure.mgmt.compute.models.SshPublicKeyResource": "Microsoft.Compute.SshPublicKeyResource", + "azure.mgmt.compute.models.SshPublicKeyResourceProperties": "Microsoft.Compute.SshPublicKeyResourceProperties", + "azure.mgmt.compute.models.SshPublicKeyUpdateResource": "Microsoft.Compute.SshPublicKeyUpdateResource", + "azure.mgmt.compute.models.StartParameterBody": "Microsoft.Compute.start.Parameter.body.anonymous", + "azure.mgmt.compute.models.StorageProfile": "Microsoft.Compute.StorageProfile", + "azure.mgmt.compute.models.SubResourceWithColocationStatus": "Microsoft.Compute.SubResourceWithColocationStatus", + "azure.mgmt.compute.models.SupportedCapabilities": "Microsoft.Compute.SupportedCapabilities", + "azure.mgmt.compute.models.SystemData": "Azure.ResourceManager.CommonTypes.SystemData", + "azure.mgmt.compute.models.TargetRegion": "Microsoft.Compute.TargetRegion", + "azure.mgmt.compute.models.TerminateNotificationProfile": "Microsoft.Compute.TerminateNotificationProfile", + "azure.mgmt.compute.models.ThrottledRequestsInput": "Microsoft.Compute.ThrottledRequestsInput", + "azure.mgmt.compute.models.UefiKey": "Microsoft.Compute.UefiKey", + "azure.mgmt.compute.models.UefiKeySignatures": "Microsoft.Compute.UefiKeySignatures", + "azure.mgmt.compute.models.UefiSettings": "Microsoft.Compute.UefiSettings", + "azure.mgmt.compute.models.UpgradeOperationHistoricalStatusInfo": "Microsoft.Compute.UpgradeOperationHistoricalStatusInfo", + "azure.mgmt.compute.models.UpgradeOperationHistoricalStatusInfoProperties": "Microsoft.Compute.UpgradeOperationHistoricalStatusInfoProperties", + "azure.mgmt.compute.models.UpgradeOperationHistoryStatus": "Microsoft.Compute.UpgradeOperationHistoryStatus", + "azure.mgmt.compute.models.UpgradePolicy": "Microsoft.Compute.UpgradePolicy", + "azure.mgmt.compute.models.Usage": "Microsoft.Compute.Usage", + "azure.mgmt.compute.models.UsageName": "Microsoft.Compute.UsageName", + "azure.mgmt.compute.models.UserArtifactManage": "Microsoft.Compute.UserArtifactManage", + "azure.mgmt.compute.models.UserArtifactSettings": "Microsoft.Compute.UserArtifactSettings", + "azure.mgmt.compute.models.UserArtifactSource": "Microsoft.Compute.UserArtifactSource", + "azure.mgmt.compute.models.UserAssignedIdentitiesValue": "Microsoft.Compute.UserAssignedIdentitiesValue", + "azure.mgmt.compute.models.UserInitiatedReboot": "Microsoft.Compute.UserInitiatedReboot", + "azure.mgmt.compute.models.UserInitiatedRedeploy": "Microsoft.Compute.UserInitiatedRedeploy", + "azure.mgmt.compute.models.ValidationsProfile": "Microsoft.Compute.ValidationsProfile", + "azure.mgmt.compute.models.VaultCertificate": "Microsoft.Compute.VaultCertificate", + "azure.mgmt.compute.models.VaultSecretGroup": "Microsoft.Compute.VaultSecretGroup", + "azure.mgmt.compute.models.VirtualHardDisk": "Microsoft.Compute.VirtualHardDisk", + "azure.mgmt.compute.models.VirtualMachine": "Microsoft.Compute.VirtualMachine", + "azure.mgmt.compute.models.VirtualMachineAgentInstanceView": "Microsoft.Compute.VirtualMachineAgentInstanceView", + "azure.mgmt.compute.models.VirtualMachineAssessPatchesResult": "Microsoft.Compute.VirtualMachineAssessPatchesResult", + "azure.mgmt.compute.models.VirtualMachineCaptureParameters": "Microsoft.Compute.VirtualMachineCaptureParameters", + "azure.mgmt.compute.models.VirtualMachineCaptureResult": "Microsoft.Compute.VirtualMachineCaptureResult", + "azure.mgmt.compute.models.VirtualMachineExtension": "Microsoft.Compute.VirtualMachineExtension", + "azure.mgmt.compute.models.VirtualMachineExtensionHandlerInstanceView": "Microsoft.Compute.VirtualMachineExtensionHandlerInstanceView", + "azure.mgmt.compute.models.VirtualMachineExtensionImage": "Microsoft.Compute.VirtualMachineExtensionImage", + "azure.mgmt.compute.models.VirtualMachineExtensionImageProperties": "Microsoft.Compute.VirtualMachineExtensionImageProperties", + "azure.mgmt.compute.models.VirtualMachineExtensionInstanceView": "Microsoft.Compute.VirtualMachineExtensionInstanceView", + "azure.mgmt.compute.models.VirtualMachineExtensionProperties": "Microsoft.Compute.VirtualMachineExtensionProperties", + "azure.mgmt.compute.models.VirtualMachineExtensionUpdate": "Microsoft.Compute.VirtualMachineExtensionUpdate", + "azure.mgmt.compute.models.VirtualMachineExtensionUpdateProperties": "Microsoft.Compute.VirtualMachineExtensionUpdateProperties", + "azure.mgmt.compute.models.VirtualMachineHealthStatus": "Microsoft.Compute.VirtualMachineHealthStatus", + "azure.mgmt.compute.models.VirtualMachineIdentity": "Microsoft.Compute.VirtualMachineIdentity", + "azure.mgmt.compute.models.VirtualMachineImageResource": "Microsoft.Compute.VirtualMachineImageResource", + "azure.mgmt.compute.models.VirtualMachineImage": "Microsoft.Compute.VirtualMachineImage", + "azure.mgmt.compute.models.VirtualMachineImageFeature": "Microsoft.Compute.VirtualMachineImageFeature", + "azure.mgmt.compute.models.VirtualMachineImageProperties": "Microsoft.Compute.VirtualMachineImageProperties", + "azure.mgmt.compute.models.VirtualMachineInstallPatchesParameters": "Microsoft.Compute.VirtualMachineInstallPatchesParameters", + "azure.mgmt.compute.models.VirtualMachineInstallPatchesResult": "Microsoft.Compute.VirtualMachineInstallPatchesResult", + "azure.mgmt.compute.models.VirtualMachineInstanceView": "Microsoft.Compute.VirtualMachineInstanceView", + "azure.mgmt.compute.models.VirtualMachineIpTag": "Microsoft.Compute.VirtualMachineIpTag", + "azure.mgmt.compute.models.VirtualMachineNetworkInterfaceConfiguration": "Microsoft.Compute.VirtualMachineNetworkInterfaceConfiguration", + "azure.mgmt.compute.models.VirtualMachineNetworkInterfaceConfigurationProperties": "Microsoft.Compute.VirtualMachineNetworkInterfaceConfigurationProperties", + "azure.mgmt.compute.models.VirtualMachineNetworkInterfaceDnsSettingsConfiguration": "Microsoft.Compute.VirtualMachineNetworkInterfaceDnsSettingsConfiguration", + "azure.mgmt.compute.models.VirtualMachineNetworkInterfaceIPConfiguration": "Microsoft.Compute.VirtualMachineNetworkInterfaceIPConfiguration", + "azure.mgmt.compute.models.VirtualMachineNetworkInterfaceIPConfigurationProperties": "Microsoft.Compute.VirtualMachineNetworkInterfaceIPConfigurationProperties", + "azure.mgmt.compute.models.VirtualMachinePatchStatus": "Microsoft.Compute.VirtualMachinePatchStatus", + "azure.mgmt.compute.models.VirtualMachineProperties": "Microsoft.Compute.VirtualMachineProperties", + "azure.mgmt.compute.models.VirtualMachinePublicIPAddressConfiguration": "Microsoft.Compute.VirtualMachinePublicIPAddressConfiguration", + "azure.mgmt.compute.models.VirtualMachinePublicIPAddressConfigurationProperties": "Microsoft.Compute.VirtualMachinePublicIPAddressConfigurationProperties", + "azure.mgmt.compute.models.VirtualMachinePublicIPAddressDnsSettingsConfiguration": "Microsoft.Compute.VirtualMachinePublicIPAddressDnsSettingsConfiguration", + "azure.mgmt.compute.models.VirtualMachineReimageParameters": "Microsoft.Compute.VirtualMachineReimageParameters", + "azure.mgmt.compute.models.VirtualMachineRunCommand": "Microsoft.Compute.VirtualMachineRunCommand", + "azure.mgmt.compute.models.VirtualMachineRunCommandInstanceView": "Microsoft.Compute.VirtualMachineRunCommandInstanceView", + "azure.mgmt.compute.models.VirtualMachineRunCommandProperties": "Microsoft.Compute.VirtualMachineRunCommandProperties", + "azure.mgmt.compute.models.VirtualMachineRunCommandScriptSource": "Microsoft.Compute.VirtualMachineRunCommandScriptSource", + "azure.mgmt.compute.models.VirtualMachineRunCommandUpdate": "Microsoft.Compute.VirtualMachineRunCommandUpdate", + "azure.mgmt.compute.models.VirtualMachineScaleSet": "Microsoft.Compute.VirtualMachineScaleSet", + "azure.mgmt.compute.models.VirtualMachineScaleSetDataDisk": "Microsoft.Compute.VirtualMachineScaleSetDataDisk", + "azure.mgmt.compute.models.VirtualMachineScaleSetExtension": "Microsoft.Compute.VirtualMachineScaleSetExtension", + "azure.mgmt.compute.models.VirtualMachineScaleSetExtensionProfile": "Microsoft.Compute.VirtualMachineScaleSetExtensionProfile", + "azure.mgmt.compute.models.VirtualMachineScaleSetExtensionProperties": "Microsoft.Compute.VirtualMachineScaleSetExtensionProperties", + "azure.mgmt.compute.models.VirtualMachineScaleSetExtensionUpdate": "Microsoft.Compute.VirtualMachineScaleSetExtensionUpdate", + "azure.mgmt.compute.models.VirtualMachineScaleSetHardwareProfile": "Microsoft.Compute.VirtualMachineScaleSetHardwareProfile", + "azure.mgmt.compute.models.VirtualMachineScaleSetIdentity": "Microsoft.Compute.VirtualMachineScaleSetIdentity", + "azure.mgmt.compute.models.VirtualMachineScaleSetInstanceView": "Microsoft.Compute.VirtualMachineScaleSetInstanceView", + "azure.mgmt.compute.models.VirtualMachineScaleSetInstanceViewStatusesSummary": "Microsoft.Compute.VirtualMachineScaleSetInstanceViewStatusesSummary", + "azure.mgmt.compute.models.VirtualMachineScaleSetIPConfiguration": "Microsoft.Compute.VirtualMachineScaleSetIPConfiguration", + "azure.mgmt.compute.models.VirtualMachineScaleSetIPConfigurationProperties": "Microsoft.Compute.VirtualMachineScaleSetIPConfigurationProperties", + "azure.mgmt.compute.models.VirtualMachineScaleSetIpTag": "Microsoft.Compute.VirtualMachineScaleSetIpTag", + "azure.mgmt.compute.models.VirtualMachineScaleSetManagedDiskParameters": "Microsoft.Compute.VirtualMachineScaleSetManagedDiskParameters", + "azure.mgmt.compute.models.VirtualMachineScaleSetMigrationInfo": "Microsoft.Compute.VirtualMachineScaleSetMigrationInfo", + "azure.mgmt.compute.models.VirtualMachineScaleSetNetworkConfiguration": "Microsoft.Compute.VirtualMachineScaleSetNetworkConfiguration", + "azure.mgmt.compute.models.VirtualMachineScaleSetNetworkConfigurationDnsSettings": "Microsoft.Compute.VirtualMachineScaleSetNetworkConfigurationDnsSettings", + "azure.mgmt.compute.models.VirtualMachineScaleSetNetworkConfigurationProperties": "Microsoft.Compute.VirtualMachineScaleSetNetworkConfigurationProperties", + "azure.mgmt.compute.models.VirtualMachineScaleSetNetworkProfile": "Microsoft.Compute.VirtualMachineScaleSetNetworkProfile", + "azure.mgmt.compute.models.VirtualMachineScaleSetOSDisk": "Microsoft.Compute.VirtualMachineScaleSetOSDisk", + "azure.mgmt.compute.models.VirtualMachineScaleSetOSProfile": "Microsoft.Compute.VirtualMachineScaleSetOSProfile", + "azure.mgmt.compute.models.VirtualMachineScaleSetProperties": "Microsoft.Compute.VirtualMachineScaleSetProperties", + "azure.mgmt.compute.models.VirtualMachineScaleSetPublicIPAddressConfiguration": "Microsoft.Compute.VirtualMachineScaleSetPublicIPAddressConfiguration", + "azure.mgmt.compute.models.VirtualMachineScaleSetPublicIPAddressConfigurationDnsSettings": "Microsoft.Compute.VirtualMachineScaleSetPublicIPAddressConfigurationDnsSettings", + "azure.mgmt.compute.models.VirtualMachineScaleSetPublicIPAddressConfigurationProperties": "Microsoft.Compute.VirtualMachineScaleSetPublicIPAddressConfigurationProperties", + "azure.mgmt.compute.models.VirtualMachineScaleSetVMReimageParameters": "Microsoft.Compute.VirtualMachineScaleSetVMReimageParameters", + "azure.mgmt.compute.models.VirtualMachineScaleSetReimageParameters": "Microsoft.Compute.VirtualMachineScaleSetReimageParameters", + "azure.mgmt.compute.models.VirtualMachineScaleSetSku": "Microsoft.Compute.VirtualMachineScaleSetSku", + "azure.mgmt.compute.models.VirtualMachineScaleSetSkuCapacity": "Microsoft.Compute.VirtualMachineScaleSetSkuCapacity", + "azure.mgmt.compute.models.VirtualMachineScaleSetStorageProfile": "Microsoft.Compute.VirtualMachineScaleSetStorageProfile", + "azure.mgmt.compute.models.VirtualMachineScaleSetUpdate": "Microsoft.Compute.VirtualMachineScaleSetUpdate", + "azure.mgmt.compute.models.VirtualMachineScaleSetUpdateIPConfiguration": "Microsoft.Compute.VirtualMachineScaleSetUpdateIPConfiguration", + "azure.mgmt.compute.models.VirtualMachineScaleSetUpdateIPConfigurationProperties": "Microsoft.Compute.VirtualMachineScaleSetUpdateIPConfigurationProperties", + "azure.mgmt.compute.models.VirtualMachineScaleSetUpdateNetworkConfiguration": "Microsoft.Compute.VirtualMachineScaleSetUpdateNetworkConfiguration", + "azure.mgmt.compute.models.VirtualMachineScaleSetUpdateNetworkConfigurationProperties": "Microsoft.Compute.VirtualMachineScaleSetUpdateNetworkConfigurationProperties", + "azure.mgmt.compute.models.VirtualMachineScaleSetUpdateNetworkProfile": "Microsoft.Compute.VirtualMachineScaleSetUpdateNetworkProfile", + "azure.mgmt.compute.models.VirtualMachineScaleSetUpdateOSDisk": "Microsoft.Compute.VirtualMachineScaleSetUpdateOSDisk", + "azure.mgmt.compute.models.VirtualMachineScaleSetUpdateOSProfile": "Microsoft.Compute.VirtualMachineScaleSetUpdateOSProfile", + "azure.mgmt.compute.models.VirtualMachineScaleSetUpdateProperties": "Microsoft.Compute.VirtualMachineScaleSetUpdateProperties", + "azure.mgmt.compute.models.VirtualMachineScaleSetUpdatePublicIPAddressConfiguration": "Microsoft.Compute.VirtualMachineScaleSetUpdatePublicIPAddressConfiguration", + "azure.mgmt.compute.models.VirtualMachineScaleSetUpdatePublicIPAddressConfigurationProperties": "Microsoft.Compute.VirtualMachineScaleSetUpdatePublicIPAddressConfigurationProperties", + "azure.mgmt.compute.models.VirtualMachineScaleSetUpdateStorageProfile": "Microsoft.Compute.VirtualMachineScaleSetUpdateStorageProfile", + "azure.mgmt.compute.models.VirtualMachineScaleSetUpdateVMProfile": "Microsoft.Compute.VirtualMachineScaleSetUpdateVMProfile", + "azure.mgmt.compute.models.VirtualMachineScaleSetVM": "Microsoft.Compute.VirtualMachineScaleSetVM", + "azure.mgmt.compute.models.VirtualMachineScaleSetVMExtension": "Microsoft.Compute.VirtualMachineScaleSetVMExtension", + "azure.mgmt.compute.models.VirtualMachineScaleSetVMExtensionsSummary": "Microsoft.Compute.VirtualMachineScaleSetVMExtensionsSummary", + "azure.mgmt.compute.models.VirtualMachineScaleSetVMExtensionUpdate": "Microsoft.Compute.VirtualMachineScaleSetVMExtensionUpdate", + "azure.mgmt.compute.models.VirtualMachineScaleSetVMInstanceIDs": "Microsoft.Compute.VirtualMachineScaleSetVMInstanceIDs", + "azure.mgmt.compute.models.VirtualMachineScaleSetVMInstanceRequiredIDs": "Microsoft.Compute.VirtualMachineScaleSetVMInstanceRequiredIDs", + "azure.mgmt.compute.models.VirtualMachineScaleSetVMInstanceView": "Microsoft.Compute.VirtualMachineScaleSetVMInstanceView", + "azure.mgmt.compute.models.VirtualMachineScaleSetVMNetworkProfileConfiguration": "Microsoft.Compute.VirtualMachineScaleSetVMNetworkProfileConfiguration", + "azure.mgmt.compute.models.VirtualMachineScaleSetVMProfile": "Microsoft.Compute.VirtualMachineScaleSetVMProfile", + "azure.mgmt.compute.models.VirtualMachineScaleSetVMProperties": "Microsoft.Compute.VirtualMachineScaleSetVMProperties", + "azure.mgmt.compute.models.VirtualMachineScaleSetVMProtectionPolicy": "Microsoft.Compute.VirtualMachineScaleSetVMProtectionPolicy", + "azure.mgmt.compute.models.VirtualMachineSize": "Microsoft.Compute.VirtualMachineSize", + "azure.mgmt.compute.models.VirtualMachineSoftwarePatchProperties": "Microsoft.Compute.VirtualMachineSoftwarePatchProperties", + "azure.mgmt.compute.models.VirtualMachineStatusCodeCount": "Microsoft.Compute.VirtualMachineStatusCodeCount", + "azure.mgmt.compute.models.VirtualMachineUpdate": "Microsoft.Compute.VirtualMachineUpdate", + "azure.mgmt.compute.models.VMDiskSecurityProfile": "Microsoft.Compute.VMDiskSecurityProfile", + "azure.mgmt.compute.models.VMGalleryApplication": "Microsoft.Compute.VMGalleryApplication", + "azure.mgmt.compute.models.VmImagesInEdgeZoneListResult": "Microsoft.Compute.VmImagesInEdgeZoneListResult", + "azure.mgmt.compute.models.VMScaleSetConvertToSinglePlacementGroupInput": "Microsoft.Compute.VMScaleSetConvertToSinglePlacementGroupInput", + "azure.mgmt.compute.models.VMScaleSetScaleOutInput": "Microsoft.Compute.VMScaleSetScaleOutInput", + "azure.mgmt.compute.models.VMScaleSetScaleOutInputProperties": "Microsoft.Compute.VMScaleSetScaleOutInputProperties", + "azure.mgmt.compute.models.VMSizeProperties": "Microsoft.Compute.VMSizeProperties", + "azure.mgmt.compute.models.WindowsConfiguration": "Microsoft.Compute.WindowsConfiguration", + "azure.mgmt.compute.models.WindowsParameters": "Microsoft.Compute.WindowsParameters", + "azure.mgmt.compute.models.WindowsVMGuestPatchAutomaticByPlatformSettings": "Microsoft.Compute.WindowsVMGuestPatchAutomaticByPlatformSettings", + "azure.mgmt.compute.models.WinRMConfiguration": "Microsoft.Compute.WinRMConfiguration", + "azure.mgmt.compute.models.WinRMListener": "Microsoft.Compute.WinRMListener", + "azure.mgmt.compute.models.ZoneAllocationPolicy": "Microsoft.Compute.ZoneAllocationPolicy", + "azure.mgmt.compute.models.Origin": "Azure.ResourceManager.CommonTypes.Origin", + "azure.mgmt.compute.models.ActionType": "Azure.ResourceManager.CommonTypes.ActionType", + "azure.mgmt.compute.models.CreatedByType": "Azure.ResourceManager.CommonTypes.createdByType", + "azure.mgmt.compute.models.UpgradeMode": "Microsoft.Compute.UpgradeMode", + "azure.mgmt.compute.models.RepairAction": "Microsoft.Compute.RepairAction", + "azure.mgmt.compute.models.PassNames": "Microsoft.Compute.PassNames", + "azure.mgmt.compute.models.SettingNames": "Microsoft.Compute.SettingNames", + "azure.mgmt.compute.models.WindowsVMGuestPatchMode": "Microsoft.Compute.WindowsVMGuestPatchMode", + "azure.mgmt.compute.models.WindowsPatchAssessmentMode": "Microsoft.Compute.WindowsPatchAssessmentMode", + "azure.mgmt.compute.models.WindowsVMGuestPatchAutomaticByPlatformRebootSetting": "Microsoft.Compute.WindowsVMGuestPatchAutomaticByPlatformRebootSetting", + "azure.mgmt.compute.models.ProtocolTypes": "Microsoft.Compute.ProtocolTypes", + "azure.mgmt.compute.models.LinuxVMGuestPatchMode": "Microsoft.Compute.LinuxVMGuestPatchMode", + "azure.mgmt.compute.models.LinuxPatchAssessmentMode": "Microsoft.Compute.LinuxPatchAssessmentMode", + "azure.mgmt.compute.models.LinuxVMGuestPatchAutomaticByPlatformRebootSetting": "Microsoft.Compute.LinuxVMGuestPatchAutomaticByPlatformRebootSetting", + "azure.mgmt.compute.models.CachingTypes": "Microsoft.Compute.CachingTypes", + "azure.mgmt.compute.models.DiskCreateOptionTypes": "Microsoft.Compute.DiskCreateOptionTypes", + "azure.mgmt.compute.models.DiffDiskOptions": "Microsoft.Compute.DiffDiskOptions", + "azure.mgmt.compute.models.DiffDiskPlacement": "Microsoft.Compute.DiffDiskPlacement", + "azure.mgmt.compute.models.OperatingSystemTypes": "Microsoft.Compute.OperatingSystemTypes", + "azure.mgmt.compute.models.StorageAccountTypes": "Microsoft.Compute.StorageAccountTypes", + "azure.mgmt.compute.models.SecurityEncryptionTypes": "Microsoft.Compute.SecurityEncryptionTypes", + "azure.mgmt.compute.models.DiskDeleteOptionTypes": "Microsoft.Compute.DiskDeleteOptionTypes", + "azure.mgmt.compute.models.DiskControllerTypes": "Microsoft.Compute.DiskControllerTypes", + "azure.mgmt.compute.models.DomainNameLabelScopeTypes": "Microsoft.Compute.DomainNameLabelScopeTypes", + "azure.mgmt.compute.models.IPVersion": "Microsoft.Compute.IPVersion", + "azure.mgmt.compute.models.DeleteOptions": "Microsoft.Compute.DeleteOptions", + "azure.mgmt.compute.models.PublicIPAddressSkuName": "Microsoft.Compute.PublicIPAddressSkuName", + "azure.mgmt.compute.models.PublicIPAddressSkuTier": "Microsoft.Compute.PublicIPAddressSkuTier", + "azure.mgmt.compute.models.NetworkInterfaceAuxiliaryMode": "Microsoft.Compute.NetworkInterfaceAuxiliaryMode", + "azure.mgmt.compute.models.NetworkInterfaceAuxiliarySku": "Microsoft.Compute.NetworkInterfaceAuxiliarySku", + "azure.mgmt.compute.models.NetworkApiVersion": "Microsoft.Compute.NetworkApiVersion", + "azure.mgmt.compute.models.SecurityTypes": "Microsoft.Compute.SecurityTypes", + "azure.mgmt.compute.models.Mode": "Microsoft.Compute.Mode", + "azure.mgmt.compute.models.Modes": "Microsoft.Compute.Modes", + "azure.mgmt.compute.models.VirtualMachinePriorityTypes": "Microsoft.Compute.VirtualMachinePriorityTypes", + "azure.mgmt.compute.models.VirtualMachineEvictionPolicyTypes": "Microsoft.Compute.VirtualMachineEvictionPolicyTypes", + "azure.mgmt.compute.models.VirtualMachineScaleSetScaleInRules": "Microsoft.Compute.VirtualMachineScaleSetScaleInRules", + "azure.mgmt.compute.models.OrchestrationMode": "Microsoft.Compute.OrchestrationMode", + "azure.mgmt.compute.models.RebalanceStrategy": "Microsoft.Compute.RebalanceStrategy", + "azure.mgmt.compute.models.RebalanceBehavior": "Microsoft.Compute.RebalanceBehavior", + "azure.mgmt.compute.models.ZonalPlatformFaultDomainAlignMode": "Microsoft.Compute.ZonalPlatformFaultDomainAlignMode", + "azure.mgmt.compute.models.AllocationStrategy": "Microsoft.Compute.AllocationStrategy", + "azure.mgmt.compute.models.HighSpeedInterconnectPlacement": "Microsoft.Compute.HighSpeedInterconnectPlacement", + "azure.mgmt.compute.models.ResourceIdentityType": "Microsoft.Compute.ResourceIdentityType", + "azure.mgmt.compute.models.ExtendedLocationTypes": "Microsoft.Compute.ExtendedLocationTypes", + "azure.mgmt.compute.models.ZonePlacementPolicyType": "Microsoft.Compute.ZonePlacementPolicyType", + "azure.mgmt.compute.models.ExpandTypesForGetVMScaleSets": "Microsoft.Compute.ExpandTypesForGetVMScaleSets", + "azure.mgmt.compute.models.StatusLevelTypes": "Microsoft.Compute.StatusLevelTypes", + "azure.mgmt.compute.models.OrchestrationServiceNames": "Microsoft.Compute.OrchestrationServiceNames", + "azure.mgmt.compute.models.OrchestrationServiceState": "Microsoft.Compute.OrchestrationServiceState", + "azure.mgmt.compute.models.OrchestrationServiceOperationStatus": "Microsoft.Compute.OrchestrationServiceOperationStatus", + "azure.mgmt.compute.models.UpgradeState": "Microsoft.Compute.UpgradeState", + "azure.mgmt.compute.models.UpgradeOperationInvoker": "Microsoft.Compute.UpgradeOperationInvoker", + "azure.mgmt.compute.models.OrchestrationServiceStateAction": "Microsoft.Compute.OrchestrationServiceStateAction", + "azure.mgmt.compute.models.VirtualMachineScaleSetSkuScaleType": "Microsoft.Compute.VirtualMachineScaleSetSkuScaleType", + "azure.mgmt.compute.models.RollingUpgradeStatusCode": "Microsoft.Compute.RollingUpgradeStatusCode", + "azure.mgmt.compute.models.RollingUpgradeActionType": "Microsoft.Compute.RollingUpgradeActionType", + "azure.mgmt.compute.models.MaintenanceOperationResultCodeTypes": "Microsoft.Compute.MaintenanceOperationResultCodeTypes", + "azure.mgmt.compute.models.HyperVGeneration": "Microsoft.Compute.HyperVGeneration", + "azure.mgmt.compute.models.VirtualMachineSizeTypes": "Microsoft.Compute.VirtualMachineSizeTypes", + "azure.mgmt.compute.models.ResilientVMDeletionStatus": "Microsoft.Compute.ResilientVMDeletionStatus", + "azure.mgmt.compute.models.DiskDetachOptionTypes": "Microsoft.Compute.DiskDetachOptionTypes", + "azure.mgmt.compute.models.IPVersions": "Microsoft.Compute.IPVersions", + "azure.mgmt.compute.models.PublicIPAllocationMethod": "Microsoft.Compute.PublicIPAllocationMethod", + "azure.mgmt.compute.models.InstanceViewTypes": "Microsoft.Compute.InstanceViewTypes", + "azure.mgmt.compute.models.HyperVGenerationType": "Microsoft.Compute.HyperVGenerationType", + "azure.mgmt.compute.models.PatchOperationStatus": "Microsoft.Compute.PatchOperationStatus", + "azure.mgmt.compute.models.ExpandTypeForListVMs": "Microsoft.Compute.ExpandTypeForListVMs", + "azure.mgmt.compute.models.ExpandTypesForListVMs": "Microsoft.Compute.ExpandTypesForListVMs", + "azure.mgmt.compute.models.VMGuestPatchRebootBehavior": "Microsoft.Compute.VMGuestPatchRebootBehavior", + "azure.mgmt.compute.models.PatchAssessmentState": "Microsoft.Compute.PatchAssessmentState", + "azure.mgmt.compute.models.VMGuestPatchRebootStatus": "Microsoft.Compute.VMGuestPatchRebootStatus", + "azure.mgmt.compute.models.PatchInstallationState": "Microsoft.Compute.PatchInstallationState", + "azure.mgmt.compute.models.VMGuestPatchRebootSetting": "Microsoft.Compute.VMGuestPatchRebootSetting", + "azure.mgmt.compute.models.VMGuestPatchClassificationWindows": "Microsoft.Compute.VMGuestPatchClassificationWindows", + "azure.mgmt.compute.models.VMGuestPatchClassificationLinux": "Microsoft.Compute.VMGuestPatchClassificationLinux", + "azure.mgmt.compute.models.ProximityPlacementGroupType": "Microsoft.Compute.ProximityPlacementGroupType", + "azure.mgmt.compute.models.DedicatedHostLicenseTypes": "Microsoft.Compute.DedicatedHostLicenseTypes", + "azure.mgmt.compute.models.SshEncryptionTypes": "Microsoft.Compute.SshEncryptionTypes", + "azure.mgmt.compute.models.OperatingSystemStateTypes": "Microsoft.Compute.OperatingSystemStateTypes", + "azure.mgmt.compute.models.HyperVGenerationTypes": "Microsoft.Compute.HyperVGenerationTypes", + "azure.mgmt.compute.models.OperatingSystemType": "Microsoft.Compute.OperatingSystemType", + "azure.mgmt.compute.models.RestorePointEncryptionType": "Microsoft.Compute.RestorePointEncryptionType", + "azure.mgmt.compute.models.ConsistencyModeTypes": "Microsoft.Compute.ConsistencyModeTypes", + "azure.mgmt.compute.models.RestorePointCollectionExpandOptions": "Microsoft.Compute.RestorePointCollectionExpandOptions", + "azure.mgmt.compute.models.RestorePointExpandOptions": "Microsoft.Compute.RestorePointExpandOptions", + "azure.mgmt.compute.models.ReservationType": "Microsoft.Compute.ReservationType", + "azure.mgmt.compute.models.CapacityReservationGroupInstanceViewTypes": "Microsoft.Compute.CapacityReservationGroupInstanceViewTypes", + "azure.mgmt.compute.models.ExpandTypesForGetCapacityReservationGroups": "Microsoft.Compute.ExpandTypesForGetCapacityReservationGroups", + "azure.mgmt.compute.models.ResourceIdOptionsForGetCapacityReservationGroups": "Microsoft.Compute.ResourceIdOptionsForGetCapacityReservationGroups", + "azure.mgmt.compute.models.CapacityReservationInstanceViewTypes": "Microsoft.Compute.CapacityReservationInstanceViewTypes", + "azure.mgmt.compute.models.ScriptShellTypes": "Microsoft.Compute.ScriptShellTypes", + "azure.mgmt.compute.models.ExecutionState": "Microsoft.Compute.ExecutionState", + "azure.mgmt.compute.models.VmDiskTypes": "Microsoft.Compute.VmDiskTypes", + "azure.mgmt.compute.models.ArchitectureTypes": "Microsoft.Compute.ArchitectureTypes", + "azure.mgmt.compute.models.ImageState": "Microsoft.Compute.ImageState", + "azure.mgmt.compute.models.AlternativeType": "Microsoft.Compute.AlternativeType", + "azure.mgmt.compute.models.IntervalInMins": "Microsoft.Compute.IntervalInMins", + "azure.mgmt.compute.models.Architecture": "Microsoft.Compute.Architecture", + "azure.mgmt.compute.models.SupportedSecurityOption": "Microsoft.Compute.SupportedSecurityOption", + "azure.mgmt.compute.models.DiskCreateOption": "Microsoft.Compute.DiskCreateOption", + "azure.mgmt.compute.models.ProvisionedBandwidthCopyOption": "Microsoft.Compute.ProvisionedBandwidthCopyOption", + "azure.mgmt.compute.models.DiskState": "Microsoft.Compute.DiskState", + "azure.mgmt.compute.models.EncryptionType": "Microsoft.Compute.EncryptionType", + "azure.mgmt.compute.models.NetworkAccessPolicy": "Microsoft.Compute.NetworkAccessPolicy", + "azure.mgmt.compute.models.DiskSecurityTypes": "Microsoft.Compute.DiskSecurityTypes", + "azure.mgmt.compute.models.PublicNetworkAccess": "Microsoft.Compute.PublicNetworkAccess", + "azure.mgmt.compute.models.DataAccessAuthMode": "Microsoft.Compute.DataAccessAuthMode", + "azure.mgmt.compute.models.AvailabilityPolicyDiskDelay": "Microsoft.Compute.AvailabilityPolicyDiskDelay", + "azure.mgmt.compute.models.DiskStorageAccountTypes": "Microsoft.Compute.DiskStorageAccountTypes", + "azure.mgmt.compute.models.AccessLevel": "Microsoft.Compute.AccessLevel", + "azure.mgmt.compute.models.FileFormat": "Microsoft.Compute.FileFormat", + "azure.mgmt.compute.models.PrivateEndpointServiceConnectionStatus": "Microsoft.Compute.PrivateEndpointServiceConnectionStatus", + "azure.mgmt.compute.models.PrivateEndpointConnectionProvisioningState": "Microsoft.Compute.PrivateEndpointConnectionProvisioningState", + "azure.mgmt.compute.models.DiskEncryptionSetType": "Microsoft.Compute.DiskEncryptionSetType", + "azure.mgmt.compute.models.DiskEncryptionSetIdentityType": "Microsoft.Compute.DiskEncryptionSetIdentityType", + "azure.mgmt.compute.models.CopyCompletionErrorReason": "Microsoft.Compute.CopyCompletionErrorReason", + "azure.mgmt.compute.models.SnapshotAccessState": "Microsoft.Compute.SnapshotAccessState", + "azure.mgmt.compute.models.SnapshotStorageAccountTypes": "Microsoft.Compute.SnapshotStorageAccountTypes", + "azure.mgmt.compute.models.GalleryProvisioningState": "Microsoft.Compute.GalleryProvisioningState", + "azure.mgmt.compute.models.GallerySharingPermissionTypes": "Microsoft.Compute.GallerySharingPermissionTypes", + "azure.mgmt.compute.models.SharingProfileGroupTypes": "Microsoft.Compute.SharingProfileGroupTypes", + "azure.mgmt.compute.models.SharingState": "Microsoft.Compute.SharingState", + "azure.mgmt.compute.models.SelectPermissions": "Microsoft.Compute.SelectPermissions", + "azure.mgmt.compute.models.GalleryExpandParams": "Microsoft.Compute.GalleryExpandParams", + "azure.mgmt.compute.models.UefiSignatureTemplateName": "Microsoft.Compute.UefiSignatureTemplateName", + "azure.mgmt.compute.models.UefiKeyType": "Microsoft.Compute.UefiKeyType", + "azure.mgmt.compute.models.SoftDeletedArtifactTypes": "Microsoft.Compute.SoftDeletedArtifactTypes", + "azure.mgmt.compute.models.SharingUpdateOperationTypes": "Microsoft.Compute.SharingUpdateOperationTypes", + "azure.mgmt.compute.models.StorageAccountType": "Microsoft.Compute.StorageAccountType", + "azure.mgmt.compute.models.ConfidentialVMEncryptionType": "Microsoft.Compute.ConfidentialVMEncryptionType", + "azure.mgmt.compute.models.ReplicationMode": "Microsoft.Compute.ReplicationMode", + "azure.mgmt.compute.models.GalleryExtendedLocationType": "Microsoft.Compute.GalleryExtendedLocationType", + "azure.mgmt.compute.models.EdgeZoneStorageAccountType": "Microsoft.Compute.EdgeZoneStorageAccountType", + "azure.mgmt.compute.models.HostCaching": "Microsoft.Compute.HostCaching", + "azure.mgmt.compute.models.PolicyViolationCategory": "Microsoft.Compute.PolicyViolationCategory", + "azure.mgmt.compute.models.AggregatedReplicationState": "Microsoft.Compute.AggregatedReplicationState", + "azure.mgmt.compute.models.ReplicationState": "Microsoft.Compute.ReplicationState", + "azure.mgmt.compute.models.ValidationStatus": "Microsoft.Compute.ValidationStatus", + "azure.mgmt.compute.models.ReplicationStatusTypes": "Microsoft.Compute.ReplicationStatusTypes", + "azure.mgmt.compute.models.GalleryApplicationCustomActionParameterType": "Microsoft.Compute.GalleryApplicationCustomActionParameterType", + "azure.mgmt.compute.models.GalleryApplicationScriptRebootBehavior": "Microsoft.Compute.GalleryApplicationScriptRebootBehavior", + "azure.mgmt.compute.models.EndpointTypes": "Microsoft.Compute.EndpointTypes", + "azure.mgmt.compute.models.AccessControlRulesMode": "Microsoft.Compute.AccessControlRulesMode", + "azure.mgmt.compute.models.EndpointAccess": "Microsoft.Compute.EndpointAccess", + "azure.mgmt.compute.models.SharedToValues": "Microsoft.Compute.SharedToValues", + "azure.mgmt.compute.models.SharedGalleryHostCaching": "Microsoft.Compute.SharedGalleryHostCaching", + "azure.mgmt.compute.models.ResourceSkuCapacityScaleType": "Microsoft.Compute.ResourceSkuCapacityScaleType", + "azure.mgmt.compute.models.ExtendedLocationType": "Microsoft.Compute.ExtendedLocationType", + "azure.mgmt.compute.models.ResourceSkuRestrictionsType": "Microsoft.Compute.ResourceSkuRestrictionsType", + "azure.mgmt.compute.models.ResourceSkuRestrictionsReasonCode": "Microsoft.Compute.ResourceSkuRestrictionsReasonCode", + "azure.mgmt.compute.operations.Operations.list": "Azure.ResourceManager.Legacy.Operations.list", + "azure.mgmt.compute.aio.operations.Operations.list": "Azure.ResourceManager.Legacy.Operations.list", + "azure.mgmt.compute.operations.VirtualMachineScaleSetsOperations.get": "Microsoft.Compute.VirtualMachineScaleSets.get", + "azure.mgmt.compute.aio.operations.VirtualMachineScaleSetsOperations.get": "Microsoft.Compute.VirtualMachineScaleSets.get", + "azure.mgmt.compute.operations.VirtualMachineScaleSetsOperations.begin_create_or_update": "Microsoft.Compute.VirtualMachineScaleSets.createOrUpdate", + "azure.mgmt.compute.aio.operations.VirtualMachineScaleSetsOperations.begin_create_or_update": "Microsoft.Compute.VirtualMachineScaleSets.createOrUpdate", + "azure.mgmt.compute.operations.VirtualMachineScaleSetsOperations.begin_update": "Microsoft.Compute.VirtualMachineScaleSets.update", + "azure.mgmt.compute.aio.operations.VirtualMachineScaleSetsOperations.begin_update": "Microsoft.Compute.VirtualMachineScaleSets.update", + "azure.mgmt.compute.operations.VirtualMachineScaleSetsOperations.begin_delete": "Microsoft.Compute.VirtualMachineScaleSets.delete", + "azure.mgmt.compute.aio.operations.VirtualMachineScaleSetsOperations.begin_delete": "Microsoft.Compute.VirtualMachineScaleSets.delete", + "azure.mgmt.compute.operations.VirtualMachineScaleSetsOperations.list": "Microsoft.Compute.VirtualMachineScaleSets.list", + "azure.mgmt.compute.aio.operations.VirtualMachineScaleSetsOperations.list": "Microsoft.Compute.VirtualMachineScaleSets.list", + "azure.mgmt.compute.operations.VirtualMachineScaleSetsOperations.list_all": "Microsoft.Compute.VirtualMachineScaleSets.listAll", + "azure.mgmt.compute.aio.operations.VirtualMachineScaleSetsOperations.list_all": "Microsoft.Compute.VirtualMachineScaleSets.listAll", + "azure.mgmt.compute.operations.VirtualMachineScaleSetsOperations.begin_approve_rolling_upgrade": "Microsoft.Compute.VirtualMachineScaleSets.approveRollingUpgrade", + "azure.mgmt.compute.aio.operations.VirtualMachineScaleSetsOperations.begin_approve_rolling_upgrade": "Microsoft.Compute.VirtualMachineScaleSets.approveRollingUpgrade", + "azure.mgmt.compute.operations.VirtualMachineScaleSetsOperations.convert_to_single_placement_group": "Microsoft.Compute.VirtualMachineScaleSets.convertToSinglePlacementGroup", + "azure.mgmt.compute.aio.operations.VirtualMachineScaleSetsOperations.convert_to_single_placement_group": "Microsoft.Compute.VirtualMachineScaleSets.convertToSinglePlacementGroup", + "azure.mgmt.compute.operations.VirtualMachineScaleSetsOperations.begin_deallocate": "Microsoft.Compute.VirtualMachineScaleSets.deallocate", + "azure.mgmt.compute.aio.operations.VirtualMachineScaleSetsOperations.begin_deallocate": "Microsoft.Compute.VirtualMachineScaleSets.deallocate", + "azure.mgmt.compute.operations.VirtualMachineScaleSetsOperations.begin_delete_instances": "Microsoft.Compute.VirtualMachineScaleSets.deleteInstances", + "azure.mgmt.compute.aio.operations.VirtualMachineScaleSetsOperations.begin_delete_instances": "Microsoft.Compute.VirtualMachineScaleSets.deleteInstances", + "azure.mgmt.compute.operations.VirtualMachineScaleSetsOperations.force_recovery_service_fabric_platform_update_domain_walk": "Microsoft.Compute.VirtualMachineScaleSets.forceRecoveryServiceFabricPlatformUpdateDomainWalk", + "azure.mgmt.compute.aio.operations.VirtualMachineScaleSetsOperations.force_recovery_service_fabric_platform_update_domain_walk": "Microsoft.Compute.VirtualMachineScaleSets.forceRecoveryServiceFabricPlatformUpdateDomainWalk", + "azure.mgmt.compute.operations.VirtualMachineScaleSetsOperations.get_instance_view": "Microsoft.Compute.VirtualMachineScaleSets.getInstanceView", + "azure.mgmt.compute.aio.operations.VirtualMachineScaleSetsOperations.get_instance_view": "Microsoft.Compute.VirtualMachineScaleSets.getInstanceView", + "azure.mgmt.compute.operations.VirtualMachineScaleSetsOperations.begin_update_instances": "Microsoft.Compute.VirtualMachineScaleSets.updateInstances", + "azure.mgmt.compute.aio.operations.VirtualMachineScaleSetsOperations.begin_update_instances": "Microsoft.Compute.VirtualMachineScaleSets.updateInstances", + "azure.mgmt.compute.operations.VirtualMachineScaleSetsOperations.get_os_upgrade_history": "Microsoft.Compute.VirtualMachineScaleSets.getOSUpgradeHistory", + "azure.mgmt.compute.aio.operations.VirtualMachineScaleSetsOperations.get_os_upgrade_history": "Microsoft.Compute.VirtualMachineScaleSets.getOSUpgradeHistory", + "azure.mgmt.compute.operations.VirtualMachineScaleSetsOperations.begin_perform_maintenance": "Microsoft.Compute.VirtualMachineScaleSets.performMaintenance", + "azure.mgmt.compute.aio.operations.VirtualMachineScaleSetsOperations.begin_perform_maintenance": "Microsoft.Compute.VirtualMachineScaleSets.performMaintenance", + "azure.mgmt.compute.operations.VirtualMachineScaleSetsOperations.begin_power_off": "Microsoft.Compute.VirtualMachineScaleSets.powerOff", + "azure.mgmt.compute.aio.operations.VirtualMachineScaleSetsOperations.begin_power_off": "Microsoft.Compute.VirtualMachineScaleSets.powerOff", + "azure.mgmt.compute.operations.VirtualMachineScaleSetsOperations.begin_reapply": "Microsoft.Compute.VirtualMachineScaleSets.reapply", + "azure.mgmt.compute.aio.operations.VirtualMachineScaleSetsOperations.begin_reapply": "Microsoft.Compute.VirtualMachineScaleSets.reapply", + "azure.mgmt.compute.operations.VirtualMachineScaleSetsOperations.begin_redeploy": "Microsoft.Compute.VirtualMachineScaleSets.redeploy", + "azure.mgmt.compute.aio.operations.VirtualMachineScaleSetsOperations.begin_redeploy": "Microsoft.Compute.VirtualMachineScaleSets.redeploy", + "azure.mgmt.compute.operations.VirtualMachineScaleSetsOperations.begin_reimage": "Microsoft.Compute.VirtualMachineScaleSets.reimage", + "azure.mgmt.compute.aio.operations.VirtualMachineScaleSetsOperations.begin_reimage": "Microsoft.Compute.VirtualMachineScaleSets.reimage", + "azure.mgmt.compute.operations.VirtualMachineScaleSetsOperations.begin_reimage_all": "Microsoft.Compute.VirtualMachineScaleSets.reimageAll", + "azure.mgmt.compute.aio.operations.VirtualMachineScaleSetsOperations.begin_reimage_all": "Microsoft.Compute.VirtualMachineScaleSets.reimageAll", + "azure.mgmt.compute.operations.VirtualMachineScaleSetsOperations.begin_restart": "Microsoft.Compute.VirtualMachineScaleSets.restart", + "azure.mgmt.compute.aio.operations.VirtualMachineScaleSetsOperations.begin_restart": "Microsoft.Compute.VirtualMachineScaleSets.restart", + "azure.mgmt.compute.operations.VirtualMachineScaleSetsOperations.begin_set_orchestration_service_state": "Microsoft.Compute.VirtualMachineScaleSets.setOrchestrationServiceState", + "azure.mgmt.compute.aio.operations.VirtualMachineScaleSetsOperations.begin_set_orchestration_service_state": "Microsoft.Compute.VirtualMachineScaleSets.setOrchestrationServiceState", + "azure.mgmt.compute.operations.VirtualMachineScaleSetsOperations.list_skus": "Microsoft.Compute.VirtualMachineScaleSets.listSkus", + "azure.mgmt.compute.aio.operations.VirtualMachineScaleSetsOperations.list_skus": "Microsoft.Compute.VirtualMachineScaleSets.listSkus", + "azure.mgmt.compute.operations.VirtualMachineScaleSetsOperations.begin_start": "Microsoft.Compute.VirtualMachineScaleSets.start", + "azure.mgmt.compute.aio.operations.VirtualMachineScaleSetsOperations.begin_start": "Microsoft.Compute.VirtualMachineScaleSets.start", + "azure.mgmt.compute.operations.VirtualMachineScaleSetsOperations.begin_start_extension_upgrade": "Microsoft.Compute.VirtualMachineScaleSets.startExtensionUpgrade", + "azure.mgmt.compute.aio.operations.VirtualMachineScaleSetsOperations.begin_start_extension_upgrade": "Microsoft.Compute.VirtualMachineScaleSets.startExtensionUpgrade", + "azure.mgmt.compute.operations.VirtualMachineScaleSetsOperations.begin_start_os_upgrade": "Microsoft.Compute.VirtualMachineScaleSets.startOSUpgrade", + "azure.mgmt.compute.aio.operations.VirtualMachineScaleSetsOperations.begin_start_os_upgrade": "Microsoft.Compute.VirtualMachineScaleSets.startOSUpgrade", + "azure.mgmt.compute.operations.VirtualMachineScaleSetsOperations.begin_cancel": "Microsoft.Compute.VirtualMachineScaleSets.cancel", + "azure.mgmt.compute.aio.operations.VirtualMachineScaleSetsOperations.begin_cancel": "Microsoft.Compute.VirtualMachineScaleSets.cancel", + "azure.mgmt.compute.operations.VirtualMachineScaleSetsOperations.begin_scale_out": "Microsoft.Compute.VirtualMachineScaleSets.scaleOut", + "azure.mgmt.compute.aio.operations.VirtualMachineScaleSetsOperations.begin_scale_out": "Microsoft.Compute.VirtualMachineScaleSets.scaleOut", + "azure.mgmt.compute.operations.RollingUpgradeStatusInfosOperations.get_latest": "Microsoft.Compute.RollingUpgradeStatusInfos.getLatest", + "azure.mgmt.compute.aio.operations.RollingUpgradeStatusInfosOperations.get_latest": "Microsoft.Compute.RollingUpgradeStatusInfos.getLatest", + "azure.mgmt.compute.operations.VirtualMachineScaleSetExtensionsOperations.get": "Microsoft.Compute.VirtualMachineScaleSetExtensions.get", + "azure.mgmt.compute.aio.operations.VirtualMachineScaleSetExtensionsOperations.get": "Microsoft.Compute.VirtualMachineScaleSetExtensions.get", + "azure.mgmt.compute.operations.VirtualMachineScaleSetExtensionsOperations.begin_create_or_update": "Microsoft.Compute.VirtualMachineScaleSetExtensions.createOrUpdate", + "azure.mgmt.compute.aio.operations.VirtualMachineScaleSetExtensionsOperations.begin_create_or_update": "Microsoft.Compute.VirtualMachineScaleSetExtensions.createOrUpdate", + "azure.mgmt.compute.operations.VirtualMachineScaleSetExtensionsOperations.begin_update": "Microsoft.Compute.VirtualMachineScaleSetExtensions.update", + "azure.mgmt.compute.aio.operations.VirtualMachineScaleSetExtensionsOperations.begin_update": "Microsoft.Compute.VirtualMachineScaleSetExtensions.update", + "azure.mgmt.compute.operations.VirtualMachineScaleSetExtensionsOperations.begin_delete": "Microsoft.Compute.VirtualMachineScaleSetExtensions.delete", + "azure.mgmt.compute.aio.operations.VirtualMachineScaleSetExtensionsOperations.begin_delete": "Microsoft.Compute.VirtualMachineScaleSetExtensions.delete", + "azure.mgmt.compute.operations.VirtualMachineScaleSetExtensionsOperations.list": "Microsoft.Compute.VirtualMachineScaleSetExtensions.list", + "azure.mgmt.compute.aio.operations.VirtualMachineScaleSetExtensionsOperations.list": "Microsoft.Compute.VirtualMachineScaleSetExtensions.list", + "azure.mgmt.compute.operations.VirtualMachineScaleSetVMSOperations.get": "Microsoft.Compute.VirtualMachineScaleSetVMS.get", + "azure.mgmt.compute.aio.operations.VirtualMachineScaleSetVMSOperations.get": "Microsoft.Compute.VirtualMachineScaleSetVMS.get", + "azure.mgmt.compute.operations.VirtualMachineScaleSetVMSOperations.begin_update": "Microsoft.Compute.VirtualMachineScaleSetVMS.update", + "azure.mgmt.compute.aio.operations.VirtualMachineScaleSetVMSOperations.begin_update": "Microsoft.Compute.VirtualMachineScaleSetVMS.update", + "azure.mgmt.compute.operations.VirtualMachineScaleSetVMSOperations.begin_delete": "Microsoft.Compute.VirtualMachineScaleSetVMS.delete", + "azure.mgmt.compute.aio.operations.VirtualMachineScaleSetVMSOperations.begin_delete": "Microsoft.Compute.VirtualMachineScaleSetVMS.delete", + "azure.mgmt.compute.operations.VirtualMachineScaleSetVMSOperations.list": "Microsoft.Compute.VirtualMachineScaleSetVMS.list", + "azure.mgmt.compute.aio.operations.VirtualMachineScaleSetVMSOperations.list": "Microsoft.Compute.VirtualMachineScaleSetVMS.list", + "azure.mgmt.compute.operations.VirtualMachineScaleSetVMSOperations.begin_approve_rolling_upgrade": "Microsoft.Compute.VirtualMachineScaleSetVMS.approveRollingUpgrade", + "azure.mgmt.compute.aio.operations.VirtualMachineScaleSetVMSOperations.begin_approve_rolling_upgrade": "Microsoft.Compute.VirtualMachineScaleSetVMS.approveRollingUpgrade", + "azure.mgmt.compute.operations.VirtualMachineScaleSetVMSOperations.begin_deallocate": "Microsoft.Compute.VirtualMachineScaleSetVMS.deallocate", + "azure.mgmt.compute.aio.operations.VirtualMachineScaleSetVMSOperations.begin_deallocate": "Microsoft.Compute.VirtualMachineScaleSetVMS.deallocate", + "azure.mgmt.compute.operations.VirtualMachineScaleSetVMSOperations.get_instance_view": "Microsoft.Compute.VirtualMachineScaleSetVMS.getInstanceView", + "azure.mgmt.compute.aio.operations.VirtualMachineScaleSetVMSOperations.get_instance_view": "Microsoft.Compute.VirtualMachineScaleSetVMS.getInstanceView", + "azure.mgmt.compute.operations.VirtualMachineScaleSetVMSOperations.begin_reimage": "Microsoft.Compute.VirtualMachineScaleSetVMS.reimage", + "azure.mgmt.compute.aio.operations.VirtualMachineScaleSetVMSOperations.begin_reimage": "Microsoft.Compute.VirtualMachineScaleSetVMS.reimage", + "azure.mgmt.compute.operations.VirtualMachineScaleSetVMSOperations.begin_reimage_all": "Microsoft.Compute.VirtualMachineScaleSetVMS.reimageAll", + "azure.mgmt.compute.aio.operations.VirtualMachineScaleSetVMSOperations.begin_reimage_all": "Microsoft.Compute.VirtualMachineScaleSetVMS.reimageAll", + "azure.mgmt.compute.operations.VirtualMachineScaleSetVMSOperations.simulate_eviction": "Microsoft.Compute.VirtualMachineScaleSetVMS.simulateEviction", + "azure.mgmt.compute.aio.operations.VirtualMachineScaleSetVMSOperations.simulate_eviction": "Microsoft.Compute.VirtualMachineScaleSetVMS.simulateEviction", + "azure.mgmt.compute.operations.VirtualMachineScaleSetVMSOperations.begin_attach_detach_data_disks": "Microsoft.Compute.VirtualMachineScaleSetVMS.attachDetachDataDisks", + "azure.mgmt.compute.aio.operations.VirtualMachineScaleSetVMSOperations.begin_attach_detach_data_disks": "Microsoft.Compute.VirtualMachineScaleSetVMS.attachDetachDataDisks", + "azure.mgmt.compute.operations.VirtualMachineScaleSetVMSOperations.begin_perform_maintenance": "Microsoft.Compute.VirtualMachineScaleSetVMS.performMaintenance", + "azure.mgmt.compute.aio.operations.VirtualMachineScaleSetVMSOperations.begin_perform_maintenance": "Microsoft.Compute.VirtualMachineScaleSetVMS.performMaintenance", + "azure.mgmt.compute.operations.VirtualMachineScaleSetVMSOperations.begin_power_off": "Microsoft.Compute.VirtualMachineScaleSetVMS.powerOff", + "azure.mgmt.compute.aio.operations.VirtualMachineScaleSetVMSOperations.begin_power_off": "Microsoft.Compute.VirtualMachineScaleSetVMS.powerOff", + "azure.mgmt.compute.operations.VirtualMachineScaleSetVMSOperations.begin_redeploy": "Microsoft.Compute.VirtualMachineScaleSetVMS.redeploy", + "azure.mgmt.compute.aio.operations.VirtualMachineScaleSetVMSOperations.begin_redeploy": "Microsoft.Compute.VirtualMachineScaleSetVMS.redeploy", + "azure.mgmt.compute.operations.VirtualMachineScaleSetVMSOperations.begin_restart": "Microsoft.Compute.VirtualMachineScaleSetVMS.restart", + "azure.mgmt.compute.aio.operations.VirtualMachineScaleSetVMSOperations.begin_restart": "Microsoft.Compute.VirtualMachineScaleSetVMS.restart", + "azure.mgmt.compute.operations.VirtualMachineScaleSetVMSOperations.retrieve_boot_diagnostics_data": "Microsoft.Compute.VirtualMachineScaleSetVMS.retrieveBootDiagnosticsData", + "azure.mgmt.compute.aio.operations.VirtualMachineScaleSetVMSOperations.retrieve_boot_diagnostics_data": "Microsoft.Compute.VirtualMachineScaleSetVMS.retrieveBootDiagnosticsData", + "azure.mgmt.compute.operations.VirtualMachineScaleSetVMSOperations.begin_start": "Microsoft.Compute.VirtualMachineScaleSetVMS.start", + "azure.mgmt.compute.aio.operations.VirtualMachineScaleSetVMSOperations.begin_start": "Microsoft.Compute.VirtualMachineScaleSetVMS.start", + "azure.mgmt.compute.operations.VirtualMachineScaleSetVMSOperations.begin_run_command": "Microsoft.Compute.VirtualMachineScaleSetVMS.runCommand", + "azure.mgmt.compute.aio.operations.VirtualMachineScaleSetVMSOperations.begin_run_command": "Microsoft.Compute.VirtualMachineScaleSetVMS.runCommand", + "azure.mgmt.compute.operations.VirtualMachineScaleSetVMExtensionsOperations.get": "Microsoft.Compute.VirtualMachineScaleSetVMExtensions.get", + "azure.mgmt.compute.aio.operations.VirtualMachineScaleSetVMExtensionsOperations.get": "Microsoft.Compute.VirtualMachineScaleSetVMExtensions.get", + "azure.mgmt.compute.operations.VirtualMachineScaleSetVMExtensionsOperations.begin_create_or_update": "Microsoft.Compute.VirtualMachineScaleSetVMExtensions.createOrUpdate", + "azure.mgmt.compute.aio.operations.VirtualMachineScaleSetVMExtensionsOperations.begin_create_or_update": "Microsoft.Compute.VirtualMachineScaleSetVMExtensions.createOrUpdate", + "azure.mgmt.compute.operations.VirtualMachineScaleSetVMExtensionsOperations.begin_update": "Microsoft.Compute.VirtualMachineScaleSetVMExtensions.update", + "azure.mgmt.compute.aio.operations.VirtualMachineScaleSetVMExtensionsOperations.begin_update": "Microsoft.Compute.VirtualMachineScaleSetVMExtensions.update", + "azure.mgmt.compute.operations.VirtualMachineScaleSetVMExtensionsOperations.begin_delete": "Microsoft.Compute.VirtualMachineScaleSetVMExtensions.delete", + "azure.mgmt.compute.aio.operations.VirtualMachineScaleSetVMExtensionsOperations.begin_delete": "Microsoft.Compute.VirtualMachineScaleSetVMExtensions.delete", + "azure.mgmt.compute.operations.VirtualMachineScaleSetVMExtensionsOperations.list": "Microsoft.Compute.VirtualMachineScaleSetVMExtensions.list", + "azure.mgmt.compute.aio.operations.VirtualMachineScaleSetVMExtensionsOperations.list": "Microsoft.Compute.VirtualMachineScaleSetVMExtensions.list", + "azure.mgmt.compute.operations.VirtualMachinesOperations.get": "Microsoft.Compute.VirtualMachines.get", + "azure.mgmt.compute.aio.operations.VirtualMachinesOperations.get": "Microsoft.Compute.VirtualMachines.get", + "azure.mgmt.compute.operations.VirtualMachinesOperations.begin_create_or_update": "Microsoft.Compute.VirtualMachines.createOrUpdate", + "azure.mgmt.compute.aio.operations.VirtualMachinesOperations.begin_create_or_update": "Microsoft.Compute.VirtualMachines.createOrUpdate", + "azure.mgmt.compute.operations.VirtualMachinesOperations.begin_update": "Microsoft.Compute.VirtualMachines.update", + "azure.mgmt.compute.aio.operations.VirtualMachinesOperations.begin_update": "Microsoft.Compute.VirtualMachines.update", + "azure.mgmt.compute.operations.VirtualMachinesOperations.begin_delete": "Microsoft.Compute.VirtualMachines.delete", + "azure.mgmt.compute.aio.operations.VirtualMachinesOperations.begin_delete": "Microsoft.Compute.VirtualMachines.delete", + "azure.mgmt.compute.operations.VirtualMachinesOperations.list": "Microsoft.Compute.VirtualMachines.list", + "azure.mgmt.compute.aio.operations.VirtualMachinesOperations.list": "Microsoft.Compute.VirtualMachines.list", + "azure.mgmt.compute.operations.VirtualMachinesOperations.list_all": "Microsoft.Compute.VirtualMachines.listAll", + "azure.mgmt.compute.aio.operations.VirtualMachinesOperations.list_all": "Microsoft.Compute.VirtualMachines.listAll", + "azure.mgmt.compute.operations.VirtualMachinesOperations.begin_assess_patches": "Microsoft.Compute.VirtualMachines.assessPatches", + "azure.mgmt.compute.aio.operations.VirtualMachinesOperations.begin_assess_patches": "Microsoft.Compute.VirtualMachines.assessPatches", + "azure.mgmt.compute.operations.VirtualMachinesOperations.begin_attach_detach_data_disks": "Microsoft.Compute.VirtualMachines.attachDetachDataDisks", + "azure.mgmt.compute.aio.operations.VirtualMachinesOperations.begin_attach_detach_data_disks": "Microsoft.Compute.VirtualMachines.attachDetachDataDisks", + "azure.mgmt.compute.operations.VirtualMachinesOperations.begin_capture": "Microsoft.Compute.VirtualMachines.capture", + "azure.mgmt.compute.aio.operations.VirtualMachinesOperations.begin_capture": "Microsoft.Compute.VirtualMachines.capture", + "azure.mgmt.compute.operations.VirtualMachinesOperations.begin_convert_to_managed_disks": "Microsoft.Compute.VirtualMachines.convertToManagedDisks", + "azure.mgmt.compute.aio.operations.VirtualMachinesOperations.begin_convert_to_managed_disks": "Microsoft.Compute.VirtualMachines.convertToManagedDisks", + "azure.mgmt.compute.operations.VirtualMachinesOperations.begin_deallocate": "Microsoft.Compute.VirtualMachines.deallocate", + "azure.mgmt.compute.aio.operations.VirtualMachinesOperations.begin_deallocate": "Microsoft.Compute.VirtualMachines.deallocate", + "azure.mgmt.compute.operations.VirtualMachinesOperations.generalize": "Microsoft.Compute.VirtualMachines.generalize", + "azure.mgmt.compute.aio.operations.VirtualMachinesOperations.generalize": "Microsoft.Compute.VirtualMachines.generalize", + "azure.mgmt.compute.operations.VirtualMachinesOperations.begin_install_patches": "Microsoft.Compute.VirtualMachines.installPatches", + "azure.mgmt.compute.aio.operations.VirtualMachinesOperations.begin_install_patches": "Microsoft.Compute.VirtualMachines.installPatches", + "azure.mgmt.compute.operations.VirtualMachinesOperations.instance_view": "Microsoft.Compute.VirtualMachines.instanceView", + "azure.mgmt.compute.aio.operations.VirtualMachinesOperations.instance_view": "Microsoft.Compute.VirtualMachines.instanceView", + "azure.mgmt.compute.operations.VirtualMachinesOperations.begin_perform_maintenance": "Microsoft.Compute.VirtualMachines.performMaintenance", + "azure.mgmt.compute.aio.operations.VirtualMachinesOperations.begin_perform_maintenance": "Microsoft.Compute.VirtualMachines.performMaintenance", + "azure.mgmt.compute.operations.VirtualMachinesOperations.begin_power_off": "Microsoft.Compute.VirtualMachines.powerOff", + "azure.mgmt.compute.aio.operations.VirtualMachinesOperations.begin_power_off": "Microsoft.Compute.VirtualMachines.powerOff", + "azure.mgmt.compute.operations.VirtualMachinesOperations.begin_reapply": "Microsoft.Compute.VirtualMachines.reapply", + "azure.mgmt.compute.aio.operations.VirtualMachinesOperations.begin_reapply": "Microsoft.Compute.VirtualMachines.reapply", + "azure.mgmt.compute.operations.VirtualMachinesOperations.begin_redeploy": "Microsoft.Compute.VirtualMachines.redeploy", + "azure.mgmt.compute.aio.operations.VirtualMachinesOperations.begin_redeploy": "Microsoft.Compute.VirtualMachines.redeploy", + "azure.mgmt.compute.operations.VirtualMachinesOperations.begin_reimage": "Microsoft.Compute.VirtualMachines.reimage", + "azure.mgmt.compute.aio.operations.VirtualMachinesOperations.begin_reimage": "Microsoft.Compute.VirtualMachines.reimage", + "azure.mgmt.compute.operations.VirtualMachinesOperations.begin_restart": "Microsoft.Compute.VirtualMachines.restart", + "azure.mgmt.compute.aio.operations.VirtualMachinesOperations.begin_restart": "Microsoft.Compute.VirtualMachines.restart", + "azure.mgmt.compute.operations.VirtualMachinesOperations.retrieve_boot_diagnostics_data": "Microsoft.Compute.VirtualMachines.retrieveBootDiagnosticsData", + "azure.mgmt.compute.aio.operations.VirtualMachinesOperations.retrieve_boot_diagnostics_data": "Microsoft.Compute.VirtualMachines.retrieveBootDiagnosticsData", + "azure.mgmt.compute.operations.VirtualMachinesOperations.simulate_eviction": "Microsoft.Compute.VirtualMachines.simulateEviction", + "azure.mgmt.compute.aio.operations.VirtualMachinesOperations.simulate_eviction": "Microsoft.Compute.VirtualMachines.simulateEviction", + "azure.mgmt.compute.operations.VirtualMachinesOperations.begin_start": "Microsoft.Compute.VirtualMachines.start", + "azure.mgmt.compute.aio.operations.VirtualMachinesOperations.begin_start": "Microsoft.Compute.VirtualMachines.start", + "azure.mgmt.compute.operations.VirtualMachinesOperations.list_available_sizes": "Microsoft.Compute.VirtualMachines.listAvailableSizes", + "azure.mgmt.compute.aio.operations.VirtualMachinesOperations.list_available_sizes": "Microsoft.Compute.VirtualMachines.listAvailableSizes", + "azure.mgmt.compute.operations.VirtualMachinesOperations.begin_run_command": "Microsoft.Compute.VirtualMachines.runCommand", + "azure.mgmt.compute.aio.operations.VirtualMachinesOperations.begin_run_command": "Microsoft.Compute.VirtualMachines.runCommand", + "azure.mgmt.compute.operations.VirtualMachinesOperations.begin_migrate_to_vm_scale_set": "Microsoft.Compute.VirtualMachines.migrateToVMScaleSet", + "azure.mgmt.compute.aio.operations.VirtualMachinesOperations.begin_migrate_to_vm_scale_set": "Microsoft.Compute.VirtualMachines.migrateToVMScaleSet", + "azure.mgmt.compute.operations.VirtualMachineExtensionsOperations.get": "Microsoft.Compute.VirtualMachineExtensions.get", + "azure.mgmt.compute.aio.operations.VirtualMachineExtensionsOperations.get": "Microsoft.Compute.VirtualMachineExtensions.get", + "azure.mgmt.compute.operations.VirtualMachineExtensionsOperations.begin_create_or_update": "Microsoft.Compute.VirtualMachineExtensions.createOrUpdate", + "azure.mgmt.compute.aio.operations.VirtualMachineExtensionsOperations.begin_create_or_update": "Microsoft.Compute.VirtualMachineExtensions.createOrUpdate", + "azure.mgmt.compute.operations.VirtualMachineExtensionsOperations.begin_update": "Microsoft.Compute.VirtualMachineExtensions.update", + "azure.mgmt.compute.aio.operations.VirtualMachineExtensionsOperations.begin_update": "Microsoft.Compute.VirtualMachineExtensions.update", + "azure.mgmt.compute.operations.VirtualMachineExtensionsOperations.begin_delete": "Microsoft.Compute.VirtualMachineExtensions.delete", + "azure.mgmt.compute.aio.operations.VirtualMachineExtensionsOperations.begin_delete": "Microsoft.Compute.VirtualMachineExtensions.delete", + "azure.mgmt.compute.operations.VirtualMachineExtensionsOperations.list": "Microsoft.Compute.VirtualMachineExtensions.list", + "azure.mgmt.compute.aio.operations.VirtualMachineExtensionsOperations.list": "Microsoft.Compute.VirtualMachineExtensions.list", + "azure.mgmt.compute.operations.VirtualMachineExtensionImagesOperations.get": "Microsoft.Compute.VirtualMachineExtensionImages.get", + "azure.mgmt.compute.aio.operations.VirtualMachineExtensionImagesOperations.get": "Microsoft.Compute.VirtualMachineExtensionImages.get", + "azure.mgmt.compute.operations.VirtualMachineExtensionImagesOperations.list_types": "Microsoft.Compute.VirtualMachineExtensionImages.listTypes", + "azure.mgmt.compute.aio.operations.VirtualMachineExtensionImagesOperations.list_types": "Microsoft.Compute.VirtualMachineExtensionImages.listTypes", + "azure.mgmt.compute.operations.VirtualMachineExtensionImagesOperations.list_versions": "Microsoft.Compute.VirtualMachineExtensionImages.listVersions", + "azure.mgmt.compute.aio.operations.VirtualMachineExtensionImagesOperations.list_versions": "Microsoft.Compute.VirtualMachineExtensionImages.listVersions", + "azure.mgmt.compute.operations.AvailabilitySetsOperations.get": "Microsoft.Compute.AvailabilitySets.get", + "azure.mgmt.compute.aio.operations.AvailabilitySetsOperations.get": "Microsoft.Compute.AvailabilitySets.get", + "azure.mgmt.compute.operations.AvailabilitySetsOperations.create_or_update": "Microsoft.Compute.AvailabilitySets.createOrUpdate", + "azure.mgmt.compute.aio.operations.AvailabilitySetsOperations.create_or_update": "Microsoft.Compute.AvailabilitySets.createOrUpdate", + "azure.mgmt.compute.operations.AvailabilitySetsOperations.update": "Microsoft.Compute.AvailabilitySets.update", + "azure.mgmt.compute.aio.operations.AvailabilitySetsOperations.update": "Microsoft.Compute.AvailabilitySets.update", + "azure.mgmt.compute.operations.AvailabilitySetsOperations.delete": "Microsoft.Compute.AvailabilitySets.delete", + "azure.mgmt.compute.aio.operations.AvailabilitySetsOperations.delete": "Microsoft.Compute.AvailabilitySets.delete", + "azure.mgmt.compute.operations.AvailabilitySetsOperations.list": "Microsoft.Compute.AvailabilitySets.list", + "azure.mgmt.compute.aio.operations.AvailabilitySetsOperations.list": "Microsoft.Compute.AvailabilitySets.list", + "azure.mgmt.compute.operations.AvailabilitySetsOperations.list_by_subscription": "Microsoft.Compute.AvailabilitySets.listBySubscription", + "azure.mgmt.compute.aio.operations.AvailabilitySetsOperations.list_by_subscription": "Microsoft.Compute.AvailabilitySets.listBySubscription", + "azure.mgmt.compute.operations.AvailabilitySetsOperations.list_available_sizes": "Microsoft.Compute.AvailabilitySets.listAvailableSizes", + "azure.mgmt.compute.aio.operations.AvailabilitySetsOperations.list_available_sizes": "Microsoft.Compute.AvailabilitySets.listAvailableSizes", + "azure.mgmt.compute.operations.AvailabilitySetsOperations.start_migration_to_virtual_machine_scale_set": "Microsoft.Compute.AvailabilitySets.startMigrationToVirtualMachineScaleSet", + "azure.mgmt.compute.aio.operations.AvailabilitySetsOperations.start_migration_to_virtual_machine_scale_set": "Microsoft.Compute.AvailabilitySets.startMigrationToVirtualMachineScaleSet", + "azure.mgmt.compute.operations.AvailabilitySetsOperations.cancel_migration_to_virtual_machine_scale_set": "Microsoft.Compute.AvailabilitySets.cancelMigrationToVirtualMachineScaleSet", + "azure.mgmt.compute.aio.operations.AvailabilitySetsOperations.cancel_migration_to_virtual_machine_scale_set": "Microsoft.Compute.AvailabilitySets.cancelMigrationToVirtualMachineScaleSet", + "azure.mgmt.compute.operations.AvailabilitySetsOperations.validate_migration_to_virtual_machine_scale_set": "Microsoft.Compute.AvailabilitySets.validateMigrationToVirtualMachineScaleSet", + "azure.mgmt.compute.aio.operations.AvailabilitySetsOperations.validate_migration_to_virtual_machine_scale_set": "Microsoft.Compute.AvailabilitySets.validateMigrationToVirtualMachineScaleSet", + "azure.mgmt.compute.operations.AvailabilitySetsOperations.begin_convert_to_virtual_machine_scale_set": "Microsoft.Compute.AvailabilitySets.convertToVirtualMachineScaleSet", + "azure.mgmt.compute.aio.operations.AvailabilitySetsOperations.begin_convert_to_virtual_machine_scale_set": "Microsoft.Compute.AvailabilitySets.convertToVirtualMachineScaleSet", + "azure.mgmt.compute.operations.ProximityPlacementGroupsOperations.get": "Microsoft.Compute.ProximityPlacementGroups.get", + "azure.mgmt.compute.aio.operations.ProximityPlacementGroupsOperations.get": "Microsoft.Compute.ProximityPlacementGroups.get", + "azure.mgmt.compute.operations.ProximityPlacementGroupsOperations.create_or_update": "Microsoft.Compute.ProximityPlacementGroups.createOrUpdate", + "azure.mgmt.compute.aio.operations.ProximityPlacementGroupsOperations.create_or_update": "Microsoft.Compute.ProximityPlacementGroups.createOrUpdate", + "azure.mgmt.compute.operations.ProximityPlacementGroupsOperations.update": "Microsoft.Compute.ProximityPlacementGroups.update", + "azure.mgmt.compute.aio.operations.ProximityPlacementGroupsOperations.update": "Microsoft.Compute.ProximityPlacementGroups.update", + "azure.mgmt.compute.operations.ProximityPlacementGroupsOperations.delete": "Microsoft.Compute.ProximityPlacementGroups.delete", + "azure.mgmt.compute.aio.operations.ProximityPlacementGroupsOperations.delete": "Microsoft.Compute.ProximityPlacementGroups.delete", + "azure.mgmt.compute.operations.ProximityPlacementGroupsOperations.list_by_resource_group": "Microsoft.Compute.ProximityPlacementGroups.listByResourceGroup", + "azure.mgmt.compute.aio.operations.ProximityPlacementGroupsOperations.list_by_resource_group": "Microsoft.Compute.ProximityPlacementGroups.listByResourceGroup", + "azure.mgmt.compute.operations.ProximityPlacementGroupsOperations.list_by_subscription": "Microsoft.Compute.ProximityPlacementGroups.listBySubscription", + "azure.mgmt.compute.aio.operations.ProximityPlacementGroupsOperations.list_by_subscription": "Microsoft.Compute.ProximityPlacementGroups.listBySubscription", + "azure.mgmt.compute.operations.DedicatedHostGroupsOperations.get": "Microsoft.Compute.DedicatedHostGroups.get", + "azure.mgmt.compute.aio.operations.DedicatedHostGroupsOperations.get": "Microsoft.Compute.DedicatedHostGroups.get", + "azure.mgmt.compute.operations.DedicatedHostGroupsOperations.create_or_update": "Microsoft.Compute.DedicatedHostGroups.createOrUpdate", + "azure.mgmt.compute.aio.operations.DedicatedHostGroupsOperations.create_or_update": "Microsoft.Compute.DedicatedHostGroups.createOrUpdate", + "azure.mgmt.compute.operations.DedicatedHostGroupsOperations.update": "Microsoft.Compute.DedicatedHostGroups.update", + "azure.mgmt.compute.aio.operations.DedicatedHostGroupsOperations.update": "Microsoft.Compute.DedicatedHostGroups.update", + "azure.mgmt.compute.operations.DedicatedHostGroupsOperations.delete": "Microsoft.Compute.DedicatedHostGroups.delete", + "azure.mgmt.compute.aio.operations.DedicatedHostGroupsOperations.delete": "Microsoft.Compute.DedicatedHostGroups.delete", + "azure.mgmt.compute.operations.DedicatedHostGroupsOperations.list_by_resource_group": "Microsoft.Compute.DedicatedHostGroups.listByResourceGroup", + "azure.mgmt.compute.aio.operations.DedicatedHostGroupsOperations.list_by_resource_group": "Microsoft.Compute.DedicatedHostGroups.listByResourceGroup", + "azure.mgmt.compute.operations.DedicatedHostGroupsOperations.list_by_subscription": "Microsoft.Compute.DedicatedHostGroups.listBySubscription", + "azure.mgmt.compute.aio.operations.DedicatedHostGroupsOperations.list_by_subscription": "Microsoft.Compute.DedicatedHostGroups.listBySubscription", + "azure.mgmt.compute.operations.DedicatedHostsOperations.get": "Microsoft.Compute.DedicatedHosts.get", + "azure.mgmt.compute.aio.operations.DedicatedHostsOperations.get": "Microsoft.Compute.DedicatedHosts.get", + "azure.mgmt.compute.operations.DedicatedHostsOperations.begin_create_or_update": "Microsoft.Compute.DedicatedHosts.createOrUpdate", + "azure.mgmt.compute.aio.operations.DedicatedHostsOperations.begin_create_or_update": "Microsoft.Compute.DedicatedHosts.createOrUpdate", + "azure.mgmt.compute.operations.DedicatedHostsOperations.begin_update": "Microsoft.Compute.DedicatedHosts.update", + "azure.mgmt.compute.aio.operations.DedicatedHostsOperations.begin_update": "Microsoft.Compute.DedicatedHosts.update", + "azure.mgmt.compute.operations.DedicatedHostsOperations.begin_delete": "Microsoft.Compute.DedicatedHosts.delete", + "azure.mgmt.compute.aio.operations.DedicatedHostsOperations.begin_delete": "Microsoft.Compute.DedicatedHosts.delete", + "azure.mgmt.compute.operations.DedicatedHostsOperations.list_by_host_group": "Microsoft.Compute.DedicatedHosts.listByHostGroup", + "azure.mgmt.compute.aio.operations.DedicatedHostsOperations.list_by_host_group": "Microsoft.Compute.DedicatedHosts.listByHostGroup", + "azure.mgmt.compute.operations.DedicatedHostsOperations.list_available_sizes": "Microsoft.Compute.DedicatedHosts.listAvailableSizes", + "azure.mgmt.compute.aio.operations.DedicatedHostsOperations.list_available_sizes": "Microsoft.Compute.DedicatedHosts.listAvailableSizes", + "azure.mgmt.compute.operations.DedicatedHostsOperations.begin_redeploy": "Microsoft.Compute.DedicatedHosts.redeploy", + "azure.mgmt.compute.aio.operations.DedicatedHostsOperations.begin_redeploy": "Microsoft.Compute.DedicatedHosts.redeploy", + "azure.mgmt.compute.operations.DedicatedHostsOperations.begin_restart": "Microsoft.Compute.DedicatedHosts.restart", + "azure.mgmt.compute.aio.operations.DedicatedHostsOperations.begin_restart": "Microsoft.Compute.DedicatedHosts.restart", + "azure.mgmt.compute.operations.SshPublicKeyResourcesOperations.get": "Microsoft.Compute.SshPublicKeyResources.get", + "azure.mgmt.compute.aio.operations.SshPublicKeyResourcesOperations.get": "Microsoft.Compute.SshPublicKeyResources.get", + "azure.mgmt.compute.operations.SshPublicKeyResourcesOperations.create": "Microsoft.Compute.SshPublicKeyResources.create", + "azure.mgmt.compute.aio.operations.SshPublicKeyResourcesOperations.create": "Microsoft.Compute.SshPublicKeyResources.create", + "azure.mgmt.compute.operations.SshPublicKeyResourcesOperations.update": "Microsoft.Compute.SshPublicKeyResources.update", + "azure.mgmt.compute.aio.operations.SshPublicKeyResourcesOperations.update": "Microsoft.Compute.SshPublicKeyResources.update", + "azure.mgmt.compute.operations.SshPublicKeyResourcesOperations.delete": "Microsoft.Compute.SshPublicKeyResources.delete", + "azure.mgmt.compute.aio.operations.SshPublicKeyResourcesOperations.delete": "Microsoft.Compute.SshPublicKeyResources.delete", + "azure.mgmt.compute.operations.SshPublicKeyResourcesOperations.list_by_resource_group": "Microsoft.Compute.SshPublicKeyResources.listByResourceGroup", + "azure.mgmt.compute.aio.operations.SshPublicKeyResourcesOperations.list_by_resource_group": "Microsoft.Compute.SshPublicKeyResources.listByResourceGroup", + "azure.mgmt.compute.operations.SshPublicKeyResourcesOperations.list_by_subscription": "Microsoft.Compute.SshPublicKeyResources.listBySubscription", + "azure.mgmt.compute.aio.operations.SshPublicKeyResourcesOperations.list_by_subscription": "Microsoft.Compute.SshPublicKeyResources.listBySubscription", + "azure.mgmt.compute.operations.SshPublicKeyResourcesOperations.generate_key_pair": "Microsoft.Compute.SshPublicKeyResources.generateKeyPair", + "azure.mgmt.compute.aio.operations.SshPublicKeyResourcesOperations.generate_key_pair": "Microsoft.Compute.SshPublicKeyResources.generateKeyPair", + "azure.mgmt.compute.operations.ImagesOperations.get": "Microsoft.Compute.Images.get", + "azure.mgmt.compute.aio.operations.ImagesOperations.get": "Microsoft.Compute.Images.get", + "azure.mgmt.compute.operations.ImagesOperations.begin_create_or_update": "Microsoft.Compute.Images.createOrUpdate", + "azure.mgmt.compute.aio.operations.ImagesOperations.begin_create_or_update": "Microsoft.Compute.Images.createOrUpdate", + "azure.mgmt.compute.operations.ImagesOperations.begin_update": "Microsoft.Compute.Images.update", + "azure.mgmt.compute.aio.operations.ImagesOperations.begin_update": "Microsoft.Compute.Images.update", + "azure.mgmt.compute.operations.ImagesOperations.begin_delete": "Microsoft.Compute.Images.delete", + "azure.mgmt.compute.aio.operations.ImagesOperations.begin_delete": "Microsoft.Compute.Images.delete", + "azure.mgmt.compute.operations.ImagesOperations.list_by_resource_group": "Microsoft.Compute.Images.listByResourceGroup", + "azure.mgmt.compute.aio.operations.ImagesOperations.list_by_resource_group": "Microsoft.Compute.Images.listByResourceGroup", + "azure.mgmt.compute.operations.ImagesOperations.list": "Microsoft.Compute.Images.list", + "azure.mgmt.compute.aio.operations.ImagesOperations.list": "Microsoft.Compute.Images.list", + "azure.mgmt.compute.operations.RestorePointCollectionsOperations.get": "Microsoft.Compute.RestorePointCollections.get", + "azure.mgmt.compute.aio.operations.RestorePointCollectionsOperations.get": "Microsoft.Compute.RestorePointCollections.get", + "azure.mgmt.compute.operations.RestorePointCollectionsOperations.create_or_update": "Microsoft.Compute.RestorePointCollections.createOrUpdate", + "azure.mgmt.compute.aio.operations.RestorePointCollectionsOperations.create_or_update": "Microsoft.Compute.RestorePointCollections.createOrUpdate", + "azure.mgmt.compute.operations.RestorePointCollectionsOperations.update": "Microsoft.Compute.RestorePointCollections.update", + "azure.mgmt.compute.aio.operations.RestorePointCollectionsOperations.update": "Microsoft.Compute.RestorePointCollections.update", + "azure.mgmt.compute.operations.RestorePointCollectionsOperations.begin_delete": "Microsoft.Compute.RestorePointCollections.delete", + "azure.mgmt.compute.aio.operations.RestorePointCollectionsOperations.begin_delete": "Microsoft.Compute.RestorePointCollections.delete", + "azure.mgmt.compute.operations.RestorePointCollectionsOperations.list": "Microsoft.Compute.RestorePointCollections.list", + "azure.mgmt.compute.aio.operations.RestorePointCollectionsOperations.list": "Microsoft.Compute.RestorePointCollections.list", + "azure.mgmt.compute.operations.RestorePointCollectionsOperations.list_all": "Microsoft.Compute.RestorePointCollections.listAll", + "azure.mgmt.compute.aio.operations.RestorePointCollectionsOperations.list_all": "Microsoft.Compute.RestorePointCollections.listAll", + "azure.mgmt.compute.operations.RestorePointsOperations.get": "Microsoft.Compute.RestorePoints.get", + "azure.mgmt.compute.aio.operations.RestorePointsOperations.get": "Microsoft.Compute.RestorePoints.get", + "azure.mgmt.compute.operations.RestorePointsOperations.begin_create": "Microsoft.Compute.RestorePoints.create", + "azure.mgmt.compute.aio.operations.RestorePointsOperations.begin_create": "Microsoft.Compute.RestorePoints.create", + "azure.mgmt.compute.operations.RestorePointsOperations.begin_delete": "Microsoft.Compute.RestorePoints.delete", + "azure.mgmt.compute.aio.operations.RestorePointsOperations.begin_delete": "Microsoft.Compute.RestorePoints.delete", + "azure.mgmt.compute.operations.CapacityReservationGroupsOperations.get": "Microsoft.Compute.CapacityReservationGroups.get", + "azure.mgmt.compute.aio.operations.CapacityReservationGroupsOperations.get": "Microsoft.Compute.CapacityReservationGroups.get", + "azure.mgmt.compute.operations.CapacityReservationGroupsOperations.create_or_update": "Microsoft.Compute.CapacityReservationGroups.createOrUpdate", + "azure.mgmt.compute.aio.operations.CapacityReservationGroupsOperations.create_or_update": "Microsoft.Compute.CapacityReservationGroups.createOrUpdate", + "azure.mgmt.compute.operations.CapacityReservationGroupsOperations.update": "Microsoft.Compute.CapacityReservationGroups.update", + "azure.mgmt.compute.aio.operations.CapacityReservationGroupsOperations.update": "Microsoft.Compute.CapacityReservationGroups.update", + "azure.mgmt.compute.operations.CapacityReservationGroupsOperations.delete": "Microsoft.Compute.CapacityReservationGroups.delete", + "azure.mgmt.compute.aio.operations.CapacityReservationGroupsOperations.delete": "Microsoft.Compute.CapacityReservationGroups.delete", + "azure.mgmt.compute.operations.CapacityReservationGroupsOperations.list_by_resource_group": "Microsoft.Compute.CapacityReservationGroups.listByResourceGroup", + "azure.mgmt.compute.aio.operations.CapacityReservationGroupsOperations.list_by_resource_group": "Microsoft.Compute.CapacityReservationGroups.listByResourceGroup", + "azure.mgmt.compute.operations.CapacityReservationGroupsOperations.list_by_subscription": "Microsoft.Compute.CapacityReservationGroups.listBySubscription", + "azure.mgmt.compute.aio.operations.CapacityReservationGroupsOperations.list_by_subscription": "Microsoft.Compute.CapacityReservationGroups.listBySubscription", + "azure.mgmt.compute.operations.CapacityReservationsOperations.get": "Microsoft.Compute.CapacityReservations.get", + "azure.mgmt.compute.aio.operations.CapacityReservationsOperations.get": "Microsoft.Compute.CapacityReservations.get", + "azure.mgmt.compute.operations.CapacityReservationsOperations.begin_create_or_update": "Microsoft.Compute.CapacityReservations.createOrUpdate", + "azure.mgmt.compute.aio.operations.CapacityReservationsOperations.begin_create_or_update": "Microsoft.Compute.CapacityReservations.createOrUpdate", + "azure.mgmt.compute.operations.CapacityReservationsOperations.begin_update": "Microsoft.Compute.CapacityReservations.update", + "azure.mgmt.compute.aio.operations.CapacityReservationsOperations.begin_update": "Microsoft.Compute.CapacityReservations.update", + "azure.mgmt.compute.operations.CapacityReservationsOperations.begin_delete": "Microsoft.Compute.CapacityReservations.delete", + "azure.mgmt.compute.aio.operations.CapacityReservationsOperations.begin_delete": "Microsoft.Compute.CapacityReservations.delete", + "azure.mgmt.compute.operations.CapacityReservationsOperations.list_by_capacity_reservation_group": "Microsoft.Compute.CapacityReservations.listByCapacityReservationGroup", + "azure.mgmt.compute.aio.operations.CapacityReservationsOperations.list_by_capacity_reservation_group": "Microsoft.Compute.CapacityReservations.listByCapacityReservationGroup", + "azure.mgmt.compute.operations.VirtualMachineRunCommandsOperations.get_by_virtual_machine": "Microsoft.Compute.VirtualMachineRunCommands.getByVirtualMachine", + "azure.mgmt.compute.aio.operations.VirtualMachineRunCommandsOperations.get_by_virtual_machine": "Microsoft.Compute.VirtualMachineRunCommands.getByVirtualMachine", + "azure.mgmt.compute.operations.VirtualMachineRunCommandsOperations.begin_create_or_update": "Microsoft.Compute.VirtualMachineRunCommands.createOrUpdate", + "azure.mgmt.compute.aio.operations.VirtualMachineRunCommandsOperations.begin_create_or_update": "Microsoft.Compute.VirtualMachineRunCommands.createOrUpdate", + "azure.mgmt.compute.operations.VirtualMachineRunCommandsOperations.begin_update": "Microsoft.Compute.VirtualMachineRunCommands.update", + "azure.mgmt.compute.aio.operations.VirtualMachineRunCommandsOperations.begin_update": "Microsoft.Compute.VirtualMachineRunCommands.update", + "azure.mgmt.compute.operations.VirtualMachineRunCommandsOperations.begin_delete": "Microsoft.Compute.VirtualMachineRunCommands.delete", + "azure.mgmt.compute.aio.operations.VirtualMachineRunCommandsOperations.begin_delete": "Microsoft.Compute.VirtualMachineRunCommands.delete", + "azure.mgmt.compute.operations.VirtualMachineRunCommandsOperations.list_by_virtual_machine": "Microsoft.Compute.VirtualMachineRunCommands.listByVirtualMachine", + "azure.mgmt.compute.aio.operations.VirtualMachineRunCommandsOperations.list_by_virtual_machine": "Microsoft.Compute.VirtualMachineRunCommands.listByVirtualMachine", + "azure.mgmt.compute.operations.VirtualMachineScaleSetVMRunCommandsOperations.get": "Microsoft.Compute.VirtualMachineScaleSetVMRunCommands.get", + "azure.mgmt.compute.aio.operations.VirtualMachineScaleSetVMRunCommandsOperations.get": "Microsoft.Compute.VirtualMachineScaleSetVMRunCommands.get", + "azure.mgmt.compute.operations.VirtualMachineScaleSetVMRunCommandsOperations.begin_create_or_update": "Microsoft.Compute.VirtualMachineScaleSetVMRunCommands.createOrUpdate", + "azure.mgmt.compute.aio.operations.VirtualMachineScaleSetVMRunCommandsOperations.begin_create_or_update": "Microsoft.Compute.VirtualMachineScaleSetVMRunCommands.createOrUpdate", + "azure.mgmt.compute.operations.VirtualMachineScaleSetVMRunCommandsOperations.begin_update": "Microsoft.Compute.VirtualMachineScaleSetVMRunCommands.update", + "azure.mgmt.compute.aio.operations.VirtualMachineScaleSetVMRunCommandsOperations.begin_update": "Microsoft.Compute.VirtualMachineScaleSetVMRunCommands.update", + "azure.mgmt.compute.operations.VirtualMachineScaleSetVMRunCommandsOperations.begin_delete": "Microsoft.Compute.VirtualMachineScaleSetVMRunCommands.delete", + "azure.mgmt.compute.aio.operations.VirtualMachineScaleSetVMRunCommandsOperations.begin_delete": "Microsoft.Compute.VirtualMachineScaleSetVMRunCommands.delete", + "azure.mgmt.compute.operations.VirtualMachineScaleSetVMRunCommandsOperations.list": "Microsoft.Compute.VirtualMachineScaleSetVMRunCommands.list", + "azure.mgmt.compute.aio.operations.VirtualMachineScaleSetVMRunCommandsOperations.list": "Microsoft.Compute.VirtualMachineScaleSetVMRunCommands.list", + "azure.mgmt.compute.operations.UsageOperationGroupOperations.list": "Microsoft.Compute.UsageOperationGroup.list", + "azure.mgmt.compute.aio.operations.UsageOperationGroupOperations.list": "Microsoft.Compute.UsageOperationGroup.list", + "azure.mgmt.compute.operations.VirtualMachineSizesOperationGroupOperations.list": "Microsoft.Compute.VirtualMachineSizesOperationGroup.list", + "azure.mgmt.compute.aio.operations.VirtualMachineSizesOperationGroupOperations.list": "Microsoft.Compute.VirtualMachineSizesOperationGroup.list", + "azure.mgmt.compute.operations.VirtualMachineScaleSetsOperationGroupOperations.list_by_location": "Microsoft.Compute.VirtualMachineScaleSetsOperationGroup.listByLocation", + "azure.mgmt.compute.aio.operations.VirtualMachineScaleSetsOperationGroupOperations.list_by_location": "Microsoft.Compute.VirtualMachineScaleSetsOperationGroup.listByLocation", + "azure.mgmt.compute.operations.VirtualMachinesOperationGroupOperations.list_by_location": "Microsoft.Compute.VirtualMachinesOperationGroup.listByLocation", + "azure.mgmt.compute.aio.operations.VirtualMachinesOperationGroupOperations.list_by_location": "Microsoft.Compute.VirtualMachinesOperationGroup.listByLocation", + "azure.mgmt.compute.operations.VirtualMachineImagesEdgeZoneOperationGroupOperations.list_publishers": "Microsoft.Compute.VirtualMachineImagesEdgeZoneOperationGroup.listPublishers", + "azure.mgmt.compute.aio.operations.VirtualMachineImagesEdgeZoneOperationGroupOperations.list_publishers": "Microsoft.Compute.VirtualMachineImagesEdgeZoneOperationGroup.listPublishers", + "azure.mgmt.compute.operations.VirtualMachineImagesEdgeZoneOperationGroupOperations.list_offers": "Microsoft.Compute.VirtualMachineImagesEdgeZoneOperationGroup.listOffers", + "azure.mgmt.compute.aio.operations.VirtualMachineImagesEdgeZoneOperationGroupOperations.list_offers": "Microsoft.Compute.VirtualMachineImagesEdgeZoneOperationGroup.listOffers", + "azure.mgmt.compute.operations.VirtualMachineImagesEdgeZoneOperationGroupOperations.list_skus": "Microsoft.Compute.VirtualMachineImagesEdgeZoneOperationGroup.listSkus", + "azure.mgmt.compute.aio.operations.VirtualMachineImagesEdgeZoneOperationGroupOperations.list_skus": "Microsoft.Compute.VirtualMachineImagesEdgeZoneOperationGroup.listSkus", + "azure.mgmt.compute.operations.VirtualMachineImagesEdgeZoneOperationGroupOperations.list": "Microsoft.Compute.VirtualMachineImagesEdgeZoneOperationGroup.list", + "azure.mgmt.compute.aio.operations.VirtualMachineImagesEdgeZoneOperationGroupOperations.list": "Microsoft.Compute.VirtualMachineImagesEdgeZoneOperationGroup.list", + "azure.mgmt.compute.operations.VirtualMachineImagesEdgeZoneOperationGroupOperations.get": "Microsoft.Compute.VirtualMachineImagesEdgeZoneOperationGroup.get", + "azure.mgmt.compute.aio.operations.VirtualMachineImagesEdgeZoneOperationGroupOperations.get": "Microsoft.Compute.VirtualMachineImagesEdgeZoneOperationGroup.get", + "azure.mgmt.compute.operations.VirtualMachineImagesOperationGroupOperations.list_by_edge_zone": "Microsoft.Compute.VirtualMachineImagesOperationGroup.listByEdgeZone", + "azure.mgmt.compute.aio.operations.VirtualMachineImagesOperationGroupOperations.list_by_edge_zone": "Microsoft.Compute.VirtualMachineImagesOperationGroup.listByEdgeZone", + "azure.mgmt.compute.operations.VirtualMachineImagesOperationGroupOperations.list_publishers": "Microsoft.Compute.VirtualMachineImagesOperationGroup.listPublishers", + "azure.mgmt.compute.aio.operations.VirtualMachineImagesOperationGroupOperations.list_publishers": "Microsoft.Compute.VirtualMachineImagesOperationGroup.listPublishers", + "azure.mgmt.compute.operations.VirtualMachineImagesOperationGroupOperations.list_offers": "Microsoft.Compute.VirtualMachineImagesOperationGroup.listOffers", + "azure.mgmt.compute.aio.operations.VirtualMachineImagesOperationGroupOperations.list_offers": "Microsoft.Compute.VirtualMachineImagesOperationGroup.listOffers", + "azure.mgmt.compute.operations.VirtualMachineImagesOperationGroupOperations.list_skus": "Microsoft.Compute.VirtualMachineImagesOperationGroup.listSkus", + "azure.mgmt.compute.aio.operations.VirtualMachineImagesOperationGroupOperations.list_skus": "Microsoft.Compute.VirtualMachineImagesOperationGroup.listSkus", + "azure.mgmt.compute.operations.VirtualMachineImagesOperationGroupOperations.list": "Microsoft.Compute.VirtualMachineImagesOperationGroup.list", + "azure.mgmt.compute.aio.operations.VirtualMachineImagesOperationGroupOperations.list": "Microsoft.Compute.VirtualMachineImagesOperationGroup.list", + "azure.mgmt.compute.operations.VirtualMachineImagesOperationGroupOperations.list_with_properties": "Microsoft.Compute.VirtualMachineImagesOperationGroup.listWithProperties", + "azure.mgmt.compute.aio.operations.VirtualMachineImagesOperationGroupOperations.list_with_properties": "Microsoft.Compute.VirtualMachineImagesOperationGroup.listWithProperties", + "azure.mgmt.compute.operations.VirtualMachineImagesOperationGroupOperations.get": "Microsoft.Compute.VirtualMachineImagesOperationGroup.get", + "azure.mgmt.compute.aio.operations.VirtualMachineImagesOperationGroupOperations.get": "Microsoft.Compute.VirtualMachineImagesOperationGroup.get", + "azure.mgmt.compute.operations.LogAnalyticsOperationGroupOperations.begin_export_request_rate_by_interval": "Microsoft.Compute.LogAnalyticsOperationGroup.exportRequestRateByInterval", + "azure.mgmt.compute.aio.operations.LogAnalyticsOperationGroupOperations.begin_export_request_rate_by_interval": "Microsoft.Compute.LogAnalyticsOperationGroup.exportRequestRateByInterval", + "azure.mgmt.compute.operations.LogAnalyticsOperationGroupOperations.begin_export_throttled_requests": "Microsoft.Compute.LogAnalyticsOperationGroup.exportThrottledRequests", + "azure.mgmt.compute.aio.operations.LogAnalyticsOperationGroupOperations.begin_export_throttled_requests": "Microsoft.Compute.LogAnalyticsOperationGroup.exportThrottledRequests", + "azure.mgmt.compute.operations.VirtualMachineRunCommandsOperationGroupOperations.list": "Microsoft.Compute.VirtualMachineRunCommandsOperationGroup.list", + "azure.mgmt.compute.aio.operations.VirtualMachineRunCommandsOperationGroupOperations.list": "Microsoft.Compute.VirtualMachineRunCommandsOperationGroup.list", + "azure.mgmt.compute.operations.VirtualMachineRunCommandsOperationGroupOperations.get": "Microsoft.Compute.VirtualMachineRunCommandsOperationGroup.get", + "azure.mgmt.compute.aio.operations.VirtualMachineRunCommandsOperationGroupOperations.get": "Microsoft.Compute.VirtualMachineRunCommandsOperationGroup.get", + "azure.mgmt.compute.operations.DisksOperations.get": "Microsoft.Compute.Disks.get", + "azure.mgmt.compute.aio.operations.DisksOperations.get": "Microsoft.Compute.Disks.get", + "azure.mgmt.compute.operations.DisksOperations.begin_create_or_update": "Microsoft.Compute.Disks.createOrUpdate", + "azure.mgmt.compute.aio.operations.DisksOperations.begin_create_or_update": "Microsoft.Compute.Disks.createOrUpdate", + "azure.mgmt.compute.operations.DisksOperations.begin_update": "Microsoft.Compute.Disks.update", + "azure.mgmt.compute.aio.operations.DisksOperations.begin_update": "Microsoft.Compute.Disks.update", + "azure.mgmt.compute.operations.DisksOperations.begin_delete": "Microsoft.Compute.Disks.delete", + "azure.mgmt.compute.aio.operations.DisksOperations.begin_delete": "Microsoft.Compute.Disks.delete", + "azure.mgmt.compute.operations.DisksOperations.list_by_resource_group": "Microsoft.Compute.Disks.listByResourceGroup", + "azure.mgmt.compute.aio.operations.DisksOperations.list_by_resource_group": "Microsoft.Compute.Disks.listByResourceGroup", + "azure.mgmt.compute.operations.DisksOperations.list": "Microsoft.Compute.Disks.list", + "azure.mgmt.compute.aio.operations.DisksOperations.list": "Microsoft.Compute.Disks.list", + "azure.mgmt.compute.operations.DisksOperations.begin_grant_access": "Microsoft.Compute.Disks.grantAccess", + "azure.mgmt.compute.aio.operations.DisksOperations.begin_grant_access": "Microsoft.Compute.Disks.grantAccess", + "azure.mgmt.compute.operations.DisksOperations.begin_revoke_access": "Microsoft.Compute.Disks.revokeAccess", + "azure.mgmt.compute.aio.operations.DisksOperations.begin_revoke_access": "Microsoft.Compute.Disks.revokeAccess", + "azure.mgmt.compute.operations.DiskAccessesOperations.get": "Microsoft.Compute.DiskAccesses.get", + "azure.mgmt.compute.aio.operations.DiskAccessesOperations.get": "Microsoft.Compute.DiskAccesses.get", + "azure.mgmt.compute.operations.DiskAccessesOperations.begin_create_or_update": "Microsoft.Compute.DiskAccesses.createOrUpdate", + "azure.mgmt.compute.aio.operations.DiskAccessesOperations.begin_create_or_update": "Microsoft.Compute.DiskAccesses.createOrUpdate", + "azure.mgmt.compute.operations.DiskAccessesOperations.begin_update": "Microsoft.Compute.DiskAccesses.update", + "azure.mgmt.compute.aio.operations.DiskAccessesOperations.begin_update": "Microsoft.Compute.DiskAccesses.update", + "azure.mgmt.compute.operations.DiskAccessesOperations.begin_delete": "Microsoft.Compute.DiskAccesses.delete", + "azure.mgmt.compute.aio.operations.DiskAccessesOperations.begin_delete": "Microsoft.Compute.DiskAccesses.delete", + "azure.mgmt.compute.operations.DiskAccessesOperations.list_by_resource_group": "Microsoft.Compute.DiskAccesses.listByResourceGroup", + "azure.mgmt.compute.aio.operations.DiskAccessesOperations.list_by_resource_group": "Microsoft.Compute.DiskAccesses.listByResourceGroup", + "azure.mgmt.compute.operations.DiskAccessesOperations.list": "Microsoft.Compute.DiskAccesses.list", + "azure.mgmt.compute.aio.operations.DiskAccessesOperations.list": "Microsoft.Compute.DiskAccesses.list", + "azure.mgmt.compute.operations.DiskAccessesOperations.get_private_link_resources": "Microsoft.Compute.DiskAccesses.getPrivateLinkResources", + "azure.mgmt.compute.aio.operations.DiskAccessesOperations.get_private_link_resources": "Microsoft.Compute.DiskAccesses.getPrivateLinkResources", + "azure.mgmt.compute.operations.PrivateEndpointConnectionsOperations.get_a_private_endpoint_connection": "Microsoft.Compute.PrivateEndpointConnections.getAPrivateEndpointConnection", + "azure.mgmt.compute.aio.operations.PrivateEndpointConnectionsOperations.get_a_private_endpoint_connection": "Microsoft.Compute.PrivateEndpointConnections.getAPrivateEndpointConnection", + "azure.mgmt.compute.operations.PrivateEndpointConnectionsOperations.begin_update_a_private_endpoint_connection": "Microsoft.Compute.PrivateEndpointConnections.updateAPrivateEndpointConnection", + "azure.mgmt.compute.aio.operations.PrivateEndpointConnectionsOperations.begin_update_a_private_endpoint_connection": "Microsoft.Compute.PrivateEndpointConnections.updateAPrivateEndpointConnection", + "azure.mgmt.compute.operations.PrivateEndpointConnectionsOperations.begin_delete_a_private_endpoint_connection": "Microsoft.Compute.PrivateEndpointConnections.deleteAPrivateEndpointConnection", + "azure.mgmt.compute.aio.operations.PrivateEndpointConnectionsOperations.begin_delete_a_private_endpoint_connection": "Microsoft.Compute.PrivateEndpointConnections.deleteAPrivateEndpointConnection", + "azure.mgmt.compute.operations.PrivateEndpointConnectionsOperations.list_private_endpoint_connections": "Microsoft.Compute.PrivateEndpointConnections.listPrivateEndpointConnections", + "azure.mgmt.compute.aio.operations.PrivateEndpointConnectionsOperations.list_private_endpoint_connections": "Microsoft.Compute.PrivateEndpointConnections.listPrivateEndpointConnections", + "azure.mgmt.compute.operations.DiskEncryptionSetsOperations.get": "Microsoft.Compute.DiskEncryptionSets.get", + "azure.mgmt.compute.aio.operations.DiskEncryptionSetsOperations.get": "Microsoft.Compute.DiskEncryptionSets.get", + "azure.mgmt.compute.operations.DiskEncryptionSetsOperations.begin_create_or_update": "Microsoft.Compute.DiskEncryptionSets.createOrUpdate", + "azure.mgmt.compute.aio.operations.DiskEncryptionSetsOperations.begin_create_or_update": "Microsoft.Compute.DiskEncryptionSets.createOrUpdate", + "azure.mgmt.compute.operations.DiskEncryptionSetsOperations.begin_update": "Microsoft.Compute.DiskEncryptionSets.update", + "azure.mgmt.compute.aio.operations.DiskEncryptionSetsOperations.begin_update": "Microsoft.Compute.DiskEncryptionSets.update", + "azure.mgmt.compute.operations.DiskEncryptionSetsOperations.begin_delete": "Microsoft.Compute.DiskEncryptionSets.delete", + "azure.mgmt.compute.aio.operations.DiskEncryptionSetsOperations.begin_delete": "Microsoft.Compute.DiskEncryptionSets.delete", + "azure.mgmt.compute.operations.DiskEncryptionSetsOperations.list_by_resource_group": "Microsoft.Compute.DiskEncryptionSets.listByResourceGroup", + "azure.mgmt.compute.aio.operations.DiskEncryptionSetsOperations.list_by_resource_group": "Microsoft.Compute.DiskEncryptionSets.listByResourceGroup", + "azure.mgmt.compute.operations.DiskEncryptionSetsOperations.list": "Microsoft.Compute.DiskEncryptionSets.list", + "azure.mgmt.compute.aio.operations.DiskEncryptionSetsOperations.list": "Microsoft.Compute.DiskEncryptionSets.list", + "azure.mgmt.compute.operations.DiskEncryptionSetsOperations.list_associated_resources": "Microsoft.Compute.DiskEncryptionSets.listAssociatedResources", + "azure.mgmt.compute.aio.operations.DiskEncryptionSetsOperations.list_associated_resources": "Microsoft.Compute.DiskEncryptionSets.listAssociatedResources", + "azure.mgmt.compute.operations.DiskRestorePointsOperations.get": "Microsoft.Compute.DiskRestorePoints.get", + "azure.mgmt.compute.aio.operations.DiskRestorePointsOperations.get": "Microsoft.Compute.DiskRestorePoints.get", + "azure.mgmt.compute.operations.DiskRestorePointsOperations.list_by_restore_point": "Microsoft.Compute.DiskRestorePoints.listByRestorePoint", + "azure.mgmt.compute.aio.operations.DiskRestorePointsOperations.list_by_restore_point": "Microsoft.Compute.DiskRestorePoints.listByRestorePoint", + "azure.mgmt.compute.operations.DiskRestorePointsOperations.begin_grant_access": "Microsoft.Compute.DiskRestorePoints.grantAccess", + "azure.mgmt.compute.aio.operations.DiskRestorePointsOperations.begin_grant_access": "Microsoft.Compute.DiskRestorePoints.grantAccess", + "azure.mgmt.compute.operations.DiskRestorePointsOperations.begin_revoke_access": "Microsoft.Compute.DiskRestorePoints.revokeAccess", + "azure.mgmt.compute.aio.operations.DiskRestorePointsOperations.begin_revoke_access": "Microsoft.Compute.DiskRestorePoints.revokeAccess", + "azure.mgmt.compute.operations.SnapshotsOperations.get": "Microsoft.Compute.Snapshots.get", + "azure.mgmt.compute.aio.operations.SnapshotsOperations.get": "Microsoft.Compute.Snapshots.get", + "azure.mgmt.compute.operations.SnapshotsOperations.begin_create_or_update": "Microsoft.Compute.Snapshots.createOrUpdate", + "azure.mgmt.compute.aio.operations.SnapshotsOperations.begin_create_or_update": "Microsoft.Compute.Snapshots.createOrUpdate", + "azure.mgmt.compute.operations.SnapshotsOperations.begin_update": "Microsoft.Compute.Snapshots.update", + "azure.mgmt.compute.aio.operations.SnapshotsOperations.begin_update": "Microsoft.Compute.Snapshots.update", + "azure.mgmt.compute.operations.SnapshotsOperations.begin_delete": "Microsoft.Compute.Snapshots.delete", + "azure.mgmt.compute.aio.operations.SnapshotsOperations.begin_delete": "Microsoft.Compute.Snapshots.delete", + "azure.mgmt.compute.operations.SnapshotsOperations.list_by_resource_group": "Microsoft.Compute.Snapshots.listByResourceGroup", + "azure.mgmt.compute.aio.operations.SnapshotsOperations.list_by_resource_group": "Microsoft.Compute.Snapshots.listByResourceGroup", + "azure.mgmt.compute.operations.SnapshotsOperations.list": "Microsoft.Compute.Snapshots.list", + "azure.mgmt.compute.aio.operations.SnapshotsOperations.list": "Microsoft.Compute.Snapshots.list", + "azure.mgmt.compute.operations.SnapshotsOperations.begin_grant_access": "Microsoft.Compute.Snapshots.grantAccess", + "azure.mgmt.compute.aio.operations.SnapshotsOperations.begin_grant_access": "Microsoft.Compute.Snapshots.grantAccess", + "azure.mgmt.compute.operations.SnapshotsOperations.begin_revoke_access": "Microsoft.Compute.Snapshots.revokeAccess", + "azure.mgmt.compute.aio.operations.SnapshotsOperations.begin_revoke_access": "Microsoft.Compute.Snapshots.revokeAccess", + "azure.mgmt.compute.operations.GalleriesOperations.get": "Microsoft.Compute.Galleries.get", + "azure.mgmt.compute.aio.operations.GalleriesOperations.get": "Microsoft.Compute.Galleries.get", + "azure.mgmt.compute.operations.GalleriesOperations.begin_create_or_update": "Microsoft.Compute.Galleries.createOrUpdate", + "azure.mgmt.compute.aio.operations.GalleriesOperations.begin_create_or_update": "Microsoft.Compute.Galleries.createOrUpdate", + "azure.mgmt.compute.operations.GalleriesOperations.begin_update": "Microsoft.Compute.Galleries.update", + "azure.mgmt.compute.aio.operations.GalleriesOperations.begin_update": "Microsoft.Compute.Galleries.update", + "azure.mgmt.compute.operations.GalleriesOperations.begin_delete": "Microsoft.Compute.Galleries.delete", + "azure.mgmt.compute.aio.operations.GalleriesOperations.begin_delete": "Microsoft.Compute.Galleries.delete", + "azure.mgmt.compute.operations.GalleriesOperations.list_by_resource_group": "Microsoft.Compute.Galleries.listByResourceGroup", + "azure.mgmt.compute.aio.operations.GalleriesOperations.list_by_resource_group": "Microsoft.Compute.Galleries.listByResourceGroup", + "azure.mgmt.compute.operations.GalleriesOperations.list": "Microsoft.Compute.Galleries.list", + "azure.mgmt.compute.aio.operations.GalleriesOperations.list": "Microsoft.Compute.Galleries.list", + "azure.mgmt.compute.operations.GalleriesOperations.list_by_artifact_name": "Microsoft.Compute.Galleries.listByArtifactName", + "azure.mgmt.compute.aio.operations.GalleriesOperations.list_by_artifact_name": "Microsoft.Compute.Galleries.listByArtifactName", + "azure.mgmt.compute.operations.GalleriesOperations.begin_gallery_sharing_profile_update": "Microsoft.Compute.Galleries.gallerySharingProfileUpdate", + "azure.mgmt.compute.aio.operations.GalleriesOperations.begin_gallery_sharing_profile_update": "Microsoft.Compute.Galleries.gallerySharingProfileUpdate", + "azure.mgmt.compute.operations.GalleryImagesOperations.get": "Microsoft.Compute.GalleryImages.get", + "azure.mgmt.compute.aio.operations.GalleryImagesOperations.get": "Microsoft.Compute.GalleryImages.get", + "azure.mgmt.compute.operations.GalleryImagesOperations.begin_create_or_update": "Microsoft.Compute.GalleryImages.createOrUpdate", + "azure.mgmt.compute.aio.operations.GalleryImagesOperations.begin_create_or_update": "Microsoft.Compute.GalleryImages.createOrUpdate", + "azure.mgmt.compute.operations.GalleryImagesOperations.begin_update": "Microsoft.Compute.GalleryImages.update", + "azure.mgmt.compute.aio.operations.GalleryImagesOperations.begin_update": "Microsoft.Compute.GalleryImages.update", + "azure.mgmt.compute.operations.GalleryImagesOperations.begin_delete": "Microsoft.Compute.GalleryImages.delete", + "azure.mgmt.compute.aio.operations.GalleryImagesOperations.begin_delete": "Microsoft.Compute.GalleryImages.delete", + "azure.mgmt.compute.operations.GalleryImagesOperations.list_by_gallery": "Microsoft.Compute.GalleryImages.listByGallery", + "azure.mgmt.compute.aio.operations.GalleryImagesOperations.list_by_gallery": "Microsoft.Compute.GalleryImages.listByGallery", + "azure.mgmt.compute.operations.GalleryImageVersionsOperations.get": "Microsoft.Compute.GalleryImageVersions.get", + "azure.mgmt.compute.aio.operations.GalleryImageVersionsOperations.get": "Microsoft.Compute.GalleryImageVersions.get", + "azure.mgmt.compute.operations.GalleryImageVersionsOperations.begin_create_or_update": "Microsoft.Compute.GalleryImageVersions.createOrUpdate", + "azure.mgmt.compute.aio.operations.GalleryImageVersionsOperations.begin_create_or_update": "Microsoft.Compute.GalleryImageVersions.createOrUpdate", + "azure.mgmt.compute.operations.GalleryImageVersionsOperations.begin_update": "Microsoft.Compute.GalleryImageVersions.update", + "azure.mgmt.compute.aio.operations.GalleryImageVersionsOperations.begin_update": "Microsoft.Compute.GalleryImageVersions.update", + "azure.mgmt.compute.operations.GalleryImageVersionsOperations.begin_delete": "Microsoft.Compute.GalleryImageVersions.delete", + "azure.mgmt.compute.aio.operations.GalleryImageVersionsOperations.begin_delete": "Microsoft.Compute.GalleryImageVersions.delete", + "azure.mgmt.compute.operations.GalleryImageVersionsOperations.list_by_gallery_image": "Microsoft.Compute.GalleryImageVersions.listByGalleryImage", + "azure.mgmt.compute.aio.operations.GalleryImageVersionsOperations.list_by_gallery_image": "Microsoft.Compute.GalleryImageVersions.listByGalleryImage", + "azure.mgmt.compute.operations.GalleryApplicationsOperations.get": "Microsoft.Compute.GalleryApplications.get", + "azure.mgmt.compute.aio.operations.GalleryApplicationsOperations.get": "Microsoft.Compute.GalleryApplications.get", + "azure.mgmt.compute.operations.GalleryApplicationsOperations.begin_create_or_update": "Microsoft.Compute.GalleryApplications.createOrUpdate", + "azure.mgmt.compute.aio.operations.GalleryApplicationsOperations.begin_create_or_update": "Microsoft.Compute.GalleryApplications.createOrUpdate", + "azure.mgmt.compute.operations.GalleryApplicationsOperations.begin_update": "Microsoft.Compute.GalleryApplications.update", + "azure.mgmt.compute.aio.operations.GalleryApplicationsOperations.begin_update": "Microsoft.Compute.GalleryApplications.update", + "azure.mgmt.compute.operations.GalleryApplicationsOperations.begin_delete": "Microsoft.Compute.GalleryApplications.delete", + "azure.mgmt.compute.aio.operations.GalleryApplicationsOperations.begin_delete": "Microsoft.Compute.GalleryApplications.delete", + "azure.mgmt.compute.operations.GalleryApplicationsOperations.list_by_gallery": "Microsoft.Compute.GalleryApplications.listByGallery", + "azure.mgmt.compute.aio.operations.GalleryApplicationsOperations.list_by_gallery": "Microsoft.Compute.GalleryApplications.listByGallery", + "azure.mgmt.compute.operations.GalleryApplicationVersionsOperations.get": "Microsoft.Compute.GalleryApplicationVersions.get", + "azure.mgmt.compute.aio.operations.GalleryApplicationVersionsOperations.get": "Microsoft.Compute.GalleryApplicationVersions.get", + "azure.mgmt.compute.operations.GalleryApplicationVersionsOperations.begin_create_or_update": "Microsoft.Compute.GalleryApplicationVersions.createOrUpdate", + "azure.mgmt.compute.aio.operations.GalleryApplicationVersionsOperations.begin_create_or_update": "Microsoft.Compute.GalleryApplicationVersions.createOrUpdate", + "azure.mgmt.compute.operations.GalleryApplicationVersionsOperations.begin_update": "Microsoft.Compute.GalleryApplicationVersions.update", + "azure.mgmt.compute.aio.operations.GalleryApplicationVersionsOperations.begin_update": "Microsoft.Compute.GalleryApplicationVersions.update", + "azure.mgmt.compute.operations.GalleryApplicationVersionsOperations.begin_delete": "Microsoft.Compute.GalleryApplicationVersions.delete", + "azure.mgmt.compute.aio.operations.GalleryApplicationVersionsOperations.begin_delete": "Microsoft.Compute.GalleryApplicationVersions.delete", + "azure.mgmt.compute.operations.GalleryApplicationVersionsOperations.list_by_gallery_application": "Microsoft.Compute.GalleryApplicationVersions.listByGalleryApplication", + "azure.mgmt.compute.aio.operations.GalleryApplicationVersionsOperations.list_by_gallery_application": "Microsoft.Compute.GalleryApplicationVersions.listByGalleryApplication", + "azure.mgmt.compute.operations.GalleryInVMAccessControlProfilesOperations.get": "Microsoft.Compute.GalleryInVMAccessControlProfiles.get", + "azure.mgmt.compute.aio.operations.GalleryInVMAccessControlProfilesOperations.get": "Microsoft.Compute.GalleryInVMAccessControlProfiles.get", + "azure.mgmt.compute.operations.GalleryInVMAccessControlProfilesOperations.begin_create_or_update": "Microsoft.Compute.GalleryInVMAccessControlProfiles.createOrUpdate", + "azure.mgmt.compute.aio.operations.GalleryInVMAccessControlProfilesOperations.begin_create_or_update": "Microsoft.Compute.GalleryInVMAccessControlProfiles.createOrUpdate", + "azure.mgmt.compute.operations.GalleryInVMAccessControlProfilesOperations.begin_update": "Microsoft.Compute.GalleryInVMAccessControlProfiles.update", + "azure.mgmt.compute.aio.operations.GalleryInVMAccessControlProfilesOperations.begin_update": "Microsoft.Compute.GalleryInVMAccessControlProfiles.update", + "azure.mgmt.compute.operations.GalleryInVMAccessControlProfilesOperations.begin_delete": "Microsoft.Compute.GalleryInVMAccessControlProfiles.delete", + "azure.mgmt.compute.aio.operations.GalleryInVMAccessControlProfilesOperations.begin_delete": "Microsoft.Compute.GalleryInVMAccessControlProfiles.delete", + "azure.mgmt.compute.operations.GalleryInVMAccessControlProfilesOperations.list_by_gallery": "Microsoft.Compute.GalleryInVMAccessControlProfiles.listByGallery", + "azure.mgmt.compute.aio.operations.GalleryInVMAccessControlProfilesOperations.list_by_gallery": "Microsoft.Compute.GalleryInVMAccessControlProfiles.listByGallery", + "azure.mgmt.compute.operations.GalleryInVMAccessControlProfileVersionsOperations.get": "Microsoft.Compute.GalleryInVMAccessControlProfileVersions.get", + "azure.mgmt.compute.aio.operations.GalleryInVMAccessControlProfileVersionsOperations.get": "Microsoft.Compute.GalleryInVMAccessControlProfileVersions.get", + "azure.mgmt.compute.operations.GalleryInVMAccessControlProfileVersionsOperations.begin_create_or_update": "Microsoft.Compute.GalleryInVMAccessControlProfileVersions.createOrUpdate", + "azure.mgmt.compute.aio.operations.GalleryInVMAccessControlProfileVersionsOperations.begin_create_or_update": "Microsoft.Compute.GalleryInVMAccessControlProfileVersions.createOrUpdate", + "azure.mgmt.compute.operations.GalleryInVMAccessControlProfileVersionsOperations.begin_update": "Microsoft.Compute.GalleryInVMAccessControlProfileVersions.update", + "azure.mgmt.compute.aio.operations.GalleryInVMAccessControlProfileVersionsOperations.begin_update": "Microsoft.Compute.GalleryInVMAccessControlProfileVersions.update", + "azure.mgmt.compute.operations.GalleryInVMAccessControlProfileVersionsOperations.begin_delete": "Microsoft.Compute.GalleryInVMAccessControlProfileVersions.delete", + "azure.mgmt.compute.aio.operations.GalleryInVMAccessControlProfileVersionsOperations.begin_delete": "Microsoft.Compute.GalleryInVMAccessControlProfileVersions.delete", + "azure.mgmt.compute.operations.GalleryInVMAccessControlProfileVersionsOperations.list_by_gallery_in_vm_access_control_profile": "Microsoft.Compute.GalleryInVMAccessControlProfileVersions.listByGalleryInVMAccessControlProfile", + "azure.mgmt.compute.aio.operations.GalleryInVMAccessControlProfileVersionsOperations.list_by_gallery_in_vm_access_control_profile": "Microsoft.Compute.GalleryInVMAccessControlProfileVersions.listByGalleryInVMAccessControlProfile", + "azure.mgmt.compute.operations.SharedGalleriesOperations.get": "Microsoft.Compute.SharedGalleries.get", + "azure.mgmt.compute.aio.operations.SharedGalleriesOperations.get": "Microsoft.Compute.SharedGalleries.get", + "azure.mgmt.compute.operations.SharedGalleriesOperations.list": "Microsoft.Compute.SharedGalleries.list", + "azure.mgmt.compute.aio.operations.SharedGalleriesOperations.list": "Microsoft.Compute.SharedGalleries.list", + "azure.mgmt.compute.operations.SharedGalleryImagesOperations.get": "Microsoft.Compute.SharedGalleryImages.get", + "azure.mgmt.compute.aio.operations.SharedGalleryImagesOperations.get": "Microsoft.Compute.SharedGalleryImages.get", + "azure.mgmt.compute.operations.SharedGalleryImagesOperations.list": "Microsoft.Compute.SharedGalleryImages.list", + "azure.mgmt.compute.aio.operations.SharedGalleryImagesOperations.list": "Microsoft.Compute.SharedGalleryImages.list", + "azure.mgmt.compute.operations.SharedGalleryImageVersionsOperations.get": "Microsoft.Compute.SharedGalleryImageVersions.get", + "azure.mgmt.compute.aio.operations.SharedGalleryImageVersionsOperations.get": "Microsoft.Compute.SharedGalleryImageVersions.get", + "azure.mgmt.compute.operations.SharedGalleryImageVersionsOperations.list": "Microsoft.Compute.SharedGalleryImageVersions.list", + "azure.mgmt.compute.aio.operations.SharedGalleryImageVersionsOperations.list": "Microsoft.Compute.SharedGalleryImageVersions.list", + "azure.mgmt.compute.operations.CommunityGalleriesOperations.get": "Microsoft.Compute.CommunityGalleries.get", + "azure.mgmt.compute.aio.operations.CommunityGalleriesOperations.get": "Microsoft.Compute.CommunityGalleries.get", + "azure.mgmt.compute.operations.CommunityGalleryImagesOperations.get": "Microsoft.Compute.CommunityGalleryImages.get", + "azure.mgmt.compute.aio.operations.CommunityGalleryImagesOperations.get": "Microsoft.Compute.CommunityGalleryImages.get", + "azure.mgmt.compute.operations.CommunityGalleryImagesOperations.list": "Microsoft.Compute.CommunityGalleryImages.list", + "azure.mgmt.compute.aio.operations.CommunityGalleryImagesOperations.list": "Microsoft.Compute.CommunityGalleryImages.list", + "azure.mgmt.compute.operations.CommunityGalleryImageVersionsOperations.get": "Microsoft.Compute.CommunityGalleryImageVersions.get", + "azure.mgmt.compute.aio.operations.CommunityGalleryImageVersionsOperations.get": "Microsoft.Compute.CommunityGalleryImageVersions.get", + "azure.mgmt.compute.operations.CommunityGalleryImageVersionsOperations.list": "Microsoft.Compute.CommunityGalleryImageVersions.list", + "azure.mgmt.compute.aio.operations.CommunityGalleryImageVersionsOperations.list": "Microsoft.Compute.CommunityGalleryImageVersions.list", + "azure.mgmt.compute.operations.ResourceSkusOperations.list": "Microsoft.Compute.ResourceSkus.list", + "azure.mgmt.compute.aio.operations.ResourceSkusOperations.list": "Microsoft.Compute.ResourceSkus.list" } } \ No newline at end of file diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/__init__.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/__init__.py index ab7c46e8991d..9489e5eda438 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/__init__.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/__init__.py @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- # pylint: disable=wrong-import-position @@ -12,7 +12,7 @@ if TYPE_CHECKING: from ._patch import * # pylint: disable=unused-wildcard-import -from ._compute_management_client import ComputeManagementClient # type: ignore +from ._client import ComputeClient # type: ignore from ._version import VERSION __version__ = VERSION @@ -25,7 +25,7 @@ from ._patch import patch_sdk as _patch_sdk __all__ = [ - "ComputeManagementClient", + "ComputeClient", ] __all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/_compute_management_client.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/_client.py similarity index 77% rename from sdk/compute/azure-mgmt-compute/azure/mgmt/compute/_compute_management_client.py rename to sdk/compute/azure-mgmt-compute/azure/mgmt/compute/_client.py index 3f16f04a0498..94520f94cb47 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/_compute_management_client.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/_client.py @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -17,18 +17,12 @@ from azure.mgmt.core.policies import ARMAutoResourceProviderRegistrationPolicy from azure.mgmt.core.tools import get_arm_endpoints -from . import models as _models -from ._configuration import ComputeManagementClientConfiguration +from ._configuration import ComputeClientConfiguration from ._utils.serialization import Deserializer, Serializer from .operations import ( AvailabilitySetsOperations, CapacityReservationGroupsOperations, CapacityReservationsOperations, - CloudServiceOperatingSystemsOperations, - CloudServiceRoleInstancesOperations, - CloudServiceRolesOperations, - CloudServicesOperations, - CloudServicesUpdateDomainOperations, CommunityGalleriesOperations, CommunityGalleryImageVersionsOperations, CommunityGalleryImagesOperations, @@ -36,7 +30,7 @@ DedicatedHostsOperations, DiskAccessesOperations, DiskEncryptionSetsOperations, - DiskRestorePointOperations, + DiskRestorePointsOperations, DisksOperations, GalleriesOperations, GalleryApplicationVersionsOperations, @@ -45,33 +39,35 @@ GalleryImagesOperations, GalleryInVMAccessControlProfileVersionsOperations, GalleryInVMAccessControlProfilesOperations, - GallerySharingProfileOperations, ImagesOperations, - LogAnalyticsOperations, + LogAnalyticsOperationGroupOperations, Operations, + PrivateEndpointConnectionsOperations, ProximityPlacementGroupsOperations, ResourceSkusOperations, RestorePointCollectionsOperations, RestorePointsOperations, + RollingUpgradeStatusInfosOperations, SharedGalleriesOperations, SharedGalleryImageVersionsOperations, SharedGalleryImagesOperations, SnapshotsOperations, - SoftDeletedResourceOperations, - SshPublicKeysOperations, - UsageOperations, + SshPublicKeyResourcesOperations, + UsageOperationGroupOperations, VirtualMachineExtensionImagesOperations, VirtualMachineExtensionsOperations, - VirtualMachineImagesEdgeZoneOperations, - VirtualMachineImagesOperations, + VirtualMachineImagesEdgeZoneOperationGroupOperations, + VirtualMachineImagesOperationGroupOperations, + VirtualMachineRunCommandsOperationGroupOperations, VirtualMachineRunCommandsOperations, VirtualMachineScaleSetExtensionsOperations, - VirtualMachineScaleSetRollingUpgradesOperations, VirtualMachineScaleSetVMExtensionsOperations, VirtualMachineScaleSetVMRunCommandsOperations, - VirtualMachineScaleSetVMsOperations, + VirtualMachineScaleSetVMSOperations, + VirtualMachineScaleSetsOperationGroupOperations, VirtualMachineScaleSetsOperations, - VirtualMachineSizesOperations, + VirtualMachineSizesOperationGroupOperations, + VirtualMachinesOperationGroupOperations, VirtualMachinesOperations, ) @@ -80,116 +76,119 @@ from azure.core.credentials import TokenCredential -class ComputeManagementClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes +class ComputeClient: # pylint: disable=too-many-instance-attributes """Compute Client. :ivar operations: Operations operations :vartype operations: azure.mgmt.compute.operations.Operations - :ivar availability_sets: AvailabilitySetsOperations operations - :vartype availability_sets: azure.mgmt.compute.operations.AvailabilitySetsOperations - :ivar capacity_reservation_groups: CapacityReservationGroupsOperations operations - :vartype capacity_reservation_groups: - azure.mgmt.compute.operations.CapacityReservationGroupsOperations - :ivar dedicated_host_groups: DedicatedHostGroupsOperations operations - :vartype dedicated_host_groups: azure.mgmt.compute.operations.DedicatedHostGroupsOperations - :ivar images: ImagesOperations operations - :vartype images: azure.mgmt.compute.operations.ImagesOperations - :ivar virtual_machine_images_edge_zone: VirtualMachineImagesEdgeZoneOperations operations - :vartype virtual_machine_images_edge_zone: - azure.mgmt.compute.operations.VirtualMachineImagesEdgeZoneOperations - :ivar virtual_machine_images: VirtualMachineImagesOperations operations - :vartype virtual_machine_images: azure.mgmt.compute.operations.VirtualMachineImagesOperations - :ivar log_analytics: LogAnalyticsOperations operations - :vartype log_analytics: azure.mgmt.compute.operations.LogAnalyticsOperations - :ivar virtual_machine_extension_images: VirtualMachineExtensionImagesOperations operations - :vartype virtual_machine_extension_images: - azure.mgmt.compute.operations.VirtualMachineExtensionImagesOperations - :ivar virtual_machine_run_commands: VirtualMachineRunCommandsOperations operations - :vartype virtual_machine_run_commands: - azure.mgmt.compute.operations.VirtualMachineRunCommandsOperations - :ivar usage: UsageOperations operations - :vartype usage: azure.mgmt.compute.operations.UsageOperations :ivar virtual_machine_scale_sets: VirtualMachineScaleSetsOperations operations :vartype virtual_machine_scale_sets: azure.mgmt.compute.operations.VirtualMachineScaleSetsOperations + :ivar rolling_upgrade_status_infos: RollingUpgradeStatusInfosOperations operations + :vartype rolling_upgrade_status_infos: + azure.mgmt.compute.operations.RollingUpgradeStatusInfosOperations + :ivar virtual_machine_scale_set_extensions: VirtualMachineScaleSetExtensionsOperations + operations + :vartype virtual_machine_scale_set_extensions: + azure.mgmt.compute.operations.VirtualMachineScaleSetExtensionsOperations + :ivar virtual_machine_scale_set_vms: VirtualMachineScaleSetVMSOperations operations + :vartype virtual_machine_scale_set_vms: + azure.mgmt.compute.operations.VirtualMachineScaleSetVMSOperations + :ivar virtual_machine_scale_set_vm_extensions: VirtualMachineScaleSetVMExtensionsOperations + operations + :vartype virtual_machine_scale_set_vm_extensions: + azure.mgmt.compute.operations.VirtualMachineScaleSetVMExtensionsOperations :ivar virtual_machines: VirtualMachinesOperations operations :vartype virtual_machines: azure.mgmt.compute.operations.VirtualMachinesOperations - :ivar virtual_machine_sizes: VirtualMachineSizesOperations operations - :vartype virtual_machine_sizes: azure.mgmt.compute.operations.VirtualMachineSizesOperations + :ivar virtual_machine_extensions: VirtualMachineExtensionsOperations operations + :vartype virtual_machine_extensions: + azure.mgmt.compute.operations.VirtualMachineExtensionsOperations + :ivar virtual_machine_extension_images: VirtualMachineExtensionImagesOperations operations + :vartype virtual_machine_extension_images: + azure.mgmt.compute.operations.VirtualMachineExtensionImagesOperations + :ivar availability_sets: AvailabilitySetsOperations operations + :vartype availability_sets: azure.mgmt.compute.operations.AvailabilitySetsOperations :ivar proximity_placement_groups: ProximityPlacementGroupsOperations operations :vartype proximity_placement_groups: azure.mgmt.compute.operations.ProximityPlacementGroupsOperations + :ivar dedicated_host_groups: DedicatedHostGroupsOperations operations + :vartype dedicated_host_groups: azure.mgmt.compute.operations.DedicatedHostGroupsOperations + :ivar dedicated_hosts: DedicatedHostsOperations operations + :vartype dedicated_hosts: azure.mgmt.compute.operations.DedicatedHostsOperations + :ivar ssh_public_key_resources: SshPublicKeyResourcesOperations operations + :vartype ssh_public_key_resources: + azure.mgmt.compute.operations.SshPublicKeyResourcesOperations + :ivar images: ImagesOperations operations + :vartype images: azure.mgmt.compute.operations.ImagesOperations :ivar restore_point_collections: RestorePointCollectionsOperations operations :vartype restore_point_collections: azure.mgmt.compute.operations.RestorePointCollectionsOperations - :ivar ssh_public_keys: SshPublicKeysOperations operations - :vartype ssh_public_keys: azure.mgmt.compute.operations.SshPublicKeysOperations - :ivar capacity_reservations: CapacityReservationsOperations operations - :vartype capacity_reservations: azure.mgmt.compute.operations.CapacityReservationsOperations - :ivar dedicated_hosts: DedicatedHostsOperations operations - :vartype dedicated_hosts: azure.mgmt.compute.operations.DedicatedHostsOperations :ivar restore_points: RestorePointsOperations operations :vartype restore_points: azure.mgmt.compute.operations.RestorePointsOperations - :ivar virtual_machine_scale_set_rolling_upgrades: - VirtualMachineScaleSetRollingUpgradesOperations operations - :vartype virtual_machine_scale_set_rolling_upgrades: - azure.mgmt.compute.operations.VirtualMachineScaleSetRollingUpgradesOperations - :ivar virtual_machine_scale_set_extensions: VirtualMachineScaleSetExtensionsOperations - operations - :vartype virtual_machine_scale_set_extensions: - azure.mgmt.compute.operations.VirtualMachineScaleSetExtensionsOperations - :ivar virtual_machine_scale_set_vms: VirtualMachineScaleSetVMsOperations operations - :vartype virtual_machine_scale_set_vms: - azure.mgmt.compute.operations.VirtualMachineScaleSetVMsOperations - :ivar virtual_machine_scale_set_vm_extensions: VirtualMachineScaleSetVMExtensionsOperations - operations - :vartype virtual_machine_scale_set_vm_extensions: - azure.mgmt.compute.operations.VirtualMachineScaleSetVMExtensionsOperations + :ivar capacity_reservation_groups: CapacityReservationGroupsOperations operations + :vartype capacity_reservation_groups: + azure.mgmt.compute.operations.CapacityReservationGroupsOperations + :ivar capacity_reservations: CapacityReservationsOperations operations + :vartype capacity_reservations: azure.mgmt.compute.operations.CapacityReservationsOperations + :ivar virtual_machine_run_commands: VirtualMachineRunCommandsOperations operations + :vartype virtual_machine_run_commands: + azure.mgmt.compute.operations.VirtualMachineRunCommandsOperations :ivar virtual_machine_scale_set_vm_run_commands: VirtualMachineScaleSetVMRunCommandsOperations operations :vartype virtual_machine_scale_set_vm_run_commands: azure.mgmt.compute.operations.VirtualMachineScaleSetVMRunCommandsOperations - :ivar virtual_machine_extensions: VirtualMachineExtensionsOperations operations - :vartype virtual_machine_extensions: - azure.mgmt.compute.operations.VirtualMachineExtensionsOperations + :ivar usage_operation_group: UsageOperationGroupOperations operations + :vartype usage_operation_group: azure.mgmt.compute.operations.UsageOperationGroupOperations + :ivar virtual_machine_sizes_operation_group: VirtualMachineSizesOperationGroupOperations + operations + :vartype virtual_machine_sizes_operation_group: + azure.mgmt.compute.operations.VirtualMachineSizesOperationGroupOperations + :ivar virtual_machine_scale_sets_operation_group: + VirtualMachineScaleSetsOperationGroupOperations operations + :vartype virtual_machine_scale_sets_operation_group: + azure.mgmt.compute.operations.VirtualMachineScaleSetsOperationGroupOperations + :ivar virtual_machines_operation_group: VirtualMachinesOperationGroupOperations operations + :vartype virtual_machines_operation_group: + azure.mgmt.compute.operations.VirtualMachinesOperationGroupOperations + :ivar virtual_machine_images_edge_zone_operation_group: + VirtualMachineImagesEdgeZoneOperationGroupOperations operations + :vartype virtual_machine_images_edge_zone_operation_group: + azure.mgmt.compute.operations.VirtualMachineImagesEdgeZoneOperationGroupOperations + :ivar virtual_machine_images_operation_group: VirtualMachineImagesOperationGroupOperations + operations + :vartype virtual_machine_images_operation_group: + azure.mgmt.compute.operations.VirtualMachineImagesOperationGroupOperations + :ivar log_analytics_operation_group: LogAnalyticsOperationGroupOperations operations + :vartype log_analytics_operation_group: + azure.mgmt.compute.operations.LogAnalyticsOperationGroupOperations + :ivar virtual_machine_run_commands_operation_group: + VirtualMachineRunCommandsOperationGroupOperations operations + :vartype virtual_machine_run_commands_operation_group: + azure.mgmt.compute.operations.VirtualMachineRunCommandsOperationGroupOperations + :ivar disks: DisksOperations operations + :vartype disks: azure.mgmt.compute.operations.DisksOperations :ivar disk_accesses: DiskAccessesOperations operations :vartype disk_accesses: azure.mgmt.compute.operations.DiskAccessesOperations + :ivar private_endpoint_connections: PrivateEndpointConnectionsOperations operations + :vartype private_endpoint_connections: + azure.mgmt.compute.operations.PrivateEndpointConnectionsOperations :ivar disk_encryption_sets: DiskEncryptionSetsOperations operations :vartype disk_encryption_sets: azure.mgmt.compute.operations.DiskEncryptionSetsOperations - :ivar disks: DisksOperations operations - :vartype disks: azure.mgmt.compute.operations.DisksOperations + :ivar disk_restore_points: DiskRestorePointsOperations operations + :vartype disk_restore_points: azure.mgmt.compute.operations.DiskRestorePointsOperations :ivar snapshots: SnapshotsOperations operations :vartype snapshots: azure.mgmt.compute.operations.SnapshotsOperations - :ivar disk_restore_point: DiskRestorePointOperations operations - :vartype disk_restore_point: azure.mgmt.compute.operations.DiskRestorePointOperations - :ivar resource_skus: ResourceSkusOperations operations - :vartype resource_skus: azure.mgmt.compute.operations.ResourceSkusOperations :ivar galleries: GalleriesOperations operations :vartype galleries: azure.mgmt.compute.operations.GalleriesOperations - :ivar community_galleries: CommunityGalleriesOperations operations - :vartype community_galleries: azure.mgmt.compute.operations.CommunityGalleriesOperations - :ivar community_gallery_images: CommunityGalleryImagesOperations operations - :vartype community_gallery_images: - azure.mgmt.compute.operations.CommunityGalleryImagesOperations - :ivar community_gallery_image_versions: CommunityGalleryImageVersionsOperations operations - :vartype community_gallery_image_versions: - azure.mgmt.compute.operations.CommunityGalleryImageVersionsOperations - :ivar shared_galleries: SharedGalleriesOperations operations - :vartype shared_galleries: azure.mgmt.compute.operations.SharedGalleriesOperations - :ivar shared_gallery_images: SharedGalleryImagesOperations operations - :vartype shared_gallery_images: azure.mgmt.compute.operations.SharedGalleryImagesOperations - :ivar shared_gallery_image_versions: SharedGalleryImageVersionsOperations operations - :vartype shared_gallery_image_versions: - azure.mgmt.compute.operations.SharedGalleryImageVersionsOperations + :ivar gallery_images: GalleryImagesOperations operations + :vartype gallery_images: azure.mgmt.compute.operations.GalleryImagesOperations + :ivar gallery_image_versions: GalleryImageVersionsOperations operations + :vartype gallery_image_versions: azure.mgmt.compute.operations.GalleryImageVersionsOperations :ivar gallery_applications: GalleryApplicationsOperations operations :vartype gallery_applications: azure.mgmt.compute.operations.GalleryApplicationsOperations :ivar gallery_application_versions: GalleryApplicationVersionsOperations operations :vartype gallery_application_versions: azure.mgmt.compute.operations.GalleryApplicationVersionsOperations - :ivar gallery_images: GalleryImagesOperations operations - :vartype gallery_images: azure.mgmt.compute.operations.GalleryImagesOperations - :ivar gallery_image_versions: GalleryImageVersionsOperations operations - :vartype gallery_image_versions: azure.mgmt.compute.operations.GalleryImageVersionsOperations :ivar gallery_in_vm_access_control_profiles: GalleryInVMAccessControlProfilesOperations operations :vartype gallery_in_vm_access_control_profiles: @@ -198,32 +197,35 @@ class ComputeManagementClient: # pylint: disable=client-accepts-api-version-key GalleryInVMAccessControlProfileVersionsOperations operations :vartype gallery_in_vm_access_control_profile_versions: azure.mgmt.compute.operations.GalleryInVMAccessControlProfileVersionsOperations - :ivar gallery_sharing_profile: GallerySharingProfileOperations operations - :vartype gallery_sharing_profile: azure.mgmt.compute.operations.GallerySharingProfileOperations - :ivar soft_deleted_resource: SoftDeletedResourceOperations operations - :vartype soft_deleted_resource: azure.mgmt.compute.operations.SoftDeletedResourceOperations - :ivar cloud_service_role_instances: CloudServiceRoleInstancesOperations operations - :vartype cloud_service_role_instances: - azure.mgmt.compute.operations.CloudServiceRoleInstancesOperations - :ivar cloud_service_roles: CloudServiceRolesOperations operations - :vartype cloud_service_roles: azure.mgmt.compute.operations.CloudServiceRolesOperations - :ivar cloud_services: CloudServicesOperations operations - :vartype cloud_services: azure.mgmt.compute.operations.CloudServicesOperations - :ivar cloud_services_update_domain: CloudServicesUpdateDomainOperations operations - :vartype cloud_services_update_domain: - azure.mgmt.compute.operations.CloudServicesUpdateDomainOperations - :ivar cloud_service_operating_systems: CloudServiceOperatingSystemsOperations operations - :vartype cloud_service_operating_systems: - azure.mgmt.compute.operations.CloudServiceOperatingSystemsOperations - :param credential: Credential needed for the client to connect to Azure. Required. + :ivar shared_galleries: SharedGalleriesOperations operations + :vartype shared_galleries: azure.mgmt.compute.operations.SharedGalleriesOperations + :ivar shared_gallery_images: SharedGalleryImagesOperations operations + :vartype shared_gallery_images: azure.mgmt.compute.operations.SharedGalleryImagesOperations + :ivar shared_gallery_image_versions: SharedGalleryImageVersionsOperations operations + :vartype shared_gallery_image_versions: + azure.mgmt.compute.operations.SharedGalleryImageVersionsOperations + :ivar community_galleries: CommunityGalleriesOperations operations + :vartype community_galleries: azure.mgmt.compute.operations.CommunityGalleriesOperations + :ivar community_gallery_images: CommunityGalleryImagesOperations operations + :vartype community_gallery_images: + azure.mgmt.compute.operations.CommunityGalleryImagesOperations + :ivar community_gallery_image_versions: CommunityGalleryImageVersionsOperations operations + :vartype community_gallery_image_versions: + azure.mgmt.compute.operations.CommunityGalleryImageVersionsOperations + :ivar resource_skus: ResourceSkusOperations operations + :vartype resource_skus: azure.mgmt.compute.operations.ResourceSkusOperations + :param credential: Credential used to authenticate requests to the service. Required. :type credential: ~azure.core.credentials.TokenCredential - :param subscription_id: The ID of the target subscription. Required. + :param subscription_id: The ID of the target subscription. The value must be an UUID. Required. :type subscription_id: str - :param base_url: Service URL. Default value is None. + :param base_url: Service host. Default value is None. :type base_url: str :keyword cloud_setting: The cloud setting for which to get the ARM endpoint. Default value is None. :paramtype cloud_setting: ~azure.core.AzureClouds + :keyword api_version: The API version to use for this operation. Default value is "2025-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. """ @@ -237,14 +239,16 @@ def __init__( cloud_setting: Optional["AzureClouds"] = None, **kwargs: Any ) -> None: + _endpoint = "{endpoint}" _cloud = cloud_setting or settings.current.azure_cloud # type: ignore _endpoints = get_arm_endpoints(_cloud) if not base_url: base_url = _endpoints["resource_manager"] credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) - self._config = ComputeManagementClientConfiguration( + self._config = ComputeClientConfiguration( credential=credential, subscription_id=subscription_id, + base_url=cast(str, base_url), cloud_setting=cloud_setting, credential_scopes=credential_scopes, **kwargs @@ -268,148 +272,146 @@ def __init__( policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, self._config.http_logging_policy, ] - self._client: ARMPipelineClient = ARMPipelineClient(base_url=cast(str, base_url), policies=_policies, **kwargs) + self._client: ARMPipelineClient = ARMPipelineClient(base_url=cast(str, _endpoint), policies=_policies, **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 = Serializer() + self._deserialize = Deserializer() self._serialize.client_side_validation = False self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) - self.availability_sets = AvailabilitySetsOperations( - self._client, self._config, self._serialize, self._deserialize - ) - self.capacity_reservation_groups = CapacityReservationGroupsOperations( + self.virtual_machine_scale_sets = VirtualMachineScaleSetsOperations( self._client, self._config, self._serialize, self._deserialize ) - self.dedicated_host_groups = DedicatedHostGroupsOperations( + self.rolling_upgrade_status_infos = RollingUpgradeStatusInfosOperations( self._client, self._config, self._serialize, self._deserialize ) - self.images = ImagesOperations(self._client, self._config, self._serialize, self._deserialize) - self.virtual_machine_images_edge_zone = VirtualMachineImagesEdgeZoneOperations( + self.virtual_machine_scale_set_extensions = VirtualMachineScaleSetExtensionsOperations( self._client, self._config, self._serialize, self._deserialize ) - self.virtual_machine_images = VirtualMachineImagesOperations( + self.virtual_machine_scale_set_vms = VirtualMachineScaleSetVMSOperations( self._client, self._config, self._serialize, self._deserialize ) - self.log_analytics = LogAnalyticsOperations(self._client, self._config, self._serialize, self._deserialize) - self.virtual_machine_extension_images = VirtualMachineExtensionImagesOperations( + self.virtual_machine_scale_set_vm_extensions = VirtualMachineScaleSetVMExtensionsOperations( self._client, self._config, self._serialize, self._deserialize ) - self.virtual_machine_run_commands = VirtualMachineRunCommandsOperations( + self.virtual_machines = VirtualMachinesOperations( self._client, self._config, self._serialize, self._deserialize ) - self.usage = UsageOperations(self._client, self._config, self._serialize, self._deserialize) - self.virtual_machine_scale_sets = VirtualMachineScaleSetsOperations( + self.virtual_machine_extensions = VirtualMachineExtensionsOperations( self._client, self._config, self._serialize, self._deserialize ) - self.virtual_machines = VirtualMachinesOperations( + self.virtual_machine_extension_images = VirtualMachineExtensionImagesOperations( self._client, self._config, self._serialize, self._deserialize ) - self.virtual_machine_sizes = VirtualMachineSizesOperations( + 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.restore_point_collections = RestorePointCollectionsOperations( + self.dedicated_host_groups = DedicatedHostGroupsOperations( self._client, self._config, self._serialize, self._deserialize ) - self.ssh_public_keys = SshPublicKeysOperations(self._client, self._config, self._serialize, self._deserialize) - self.capacity_reservations = CapacityReservationsOperations( + self.dedicated_hosts = DedicatedHostsOperations(self._client, self._config, self._serialize, self._deserialize) + self.ssh_public_key_resources = SshPublicKeyResourcesOperations( self._client, self._config, self._serialize, self._deserialize ) - self.dedicated_hosts = DedicatedHostsOperations(self._client, self._config, self._serialize, self._deserialize) - self.restore_points = RestorePointsOperations(self._client, self._config, self._serialize, self._deserialize) - self.virtual_machine_scale_set_rolling_upgrades = VirtualMachineScaleSetRollingUpgradesOperations( + 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.virtual_machine_scale_set_extensions = VirtualMachineScaleSetExtensionsOperations( + 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.virtual_machine_scale_set_vms = VirtualMachineScaleSetVMsOperations( + self.capacity_reservations = CapacityReservationsOperations( self._client, self._config, self._serialize, self._deserialize ) - self.virtual_machine_scale_set_vm_extensions = VirtualMachineScaleSetVMExtensionsOperations( + self.virtual_machine_run_commands = VirtualMachineRunCommandsOperations( self._client, self._config, self._serialize, self._deserialize ) self.virtual_machine_scale_set_vm_run_commands = VirtualMachineScaleSetVMRunCommandsOperations( self._client, self._config, self._serialize, self._deserialize ) - self.virtual_machine_extensions = VirtualMachineExtensionsOperations( + self.usage_operation_group = UsageOperationGroupOperations( self._client, self._config, self._serialize, self._deserialize ) - self.disk_accesses = DiskAccessesOperations(self._client, self._config, self._serialize, self._deserialize) - self.disk_encryption_sets = DiskEncryptionSetsOperations( + self.virtual_machine_sizes_operation_group = VirtualMachineSizesOperationGroupOperations( self._client, self._config, self._serialize, self._deserialize ) - self.disks = DisksOperations(self._client, self._config, self._serialize, self._deserialize) - self.snapshots = SnapshotsOperations(self._client, self._config, self._serialize, self._deserialize) - self.disk_restore_point = DiskRestorePointOperations( + self.virtual_machine_scale_sets_operation_group = VirtualMachineScaleSetsOperationGroupOperations( self._client, self._config, self._serialize, self._deserialize ) - self.resource_skus = ResourceSkusOperations(self._client, self._config, self._serialize, self._deserialize) - self.galleries = GalleriesOperations(self._client, self._config, self._serialize, self._deserialize) - self.community_galleries = CommunityGalleriesOperations( + self.virtual_machines_operation_group = VirtualMachinesOperationGroupOperations( self._client, self._config, self._serialize, self._deserialize ) - self.community_gallery_images = CommunityGalleryImagesOperations( + self.virtual_machine_images_edge_zone_operation_group = VirtualMachineImagesEdgeZoneOperationGroupOperations( self._client, self._config, self._serialize, self._deserialize ) - self.community_gallery_image_versions = CommunityGalleryImageVersionsOperations( + self.virtual_machine_images_operation_group = VirtualMachineImagesOperationGroupOperations( self._client, self._config, self._serialize, self._deserialize ) - self.shared_galleries = SharedGalleriesOperations( + self.log_analytics_operation_group = LogAnalyticsOperationGroupOperations( self._client, self._config, self._serialize, self._deserialize ) - self.shared_gallery_images = SharedGalleryImagesOperations( + self.virtual_machine_run_commands_operation_group = VirtualMachineRunCommandsOperationGroupOperations( self._client, self._config, self._serialize, self._deserialize ) - self.shared_gallery_image_versions = SharedGalleryImageVersionsOperations( + self.disks = DisksOperations(self._client, self._config, self._serialize, self._deserialize) + self.disk_accesses = DiskAccessesOperations(self._client, self._config, self._serialize, self._deserialize) + self.private_endpoint_connections = PrivateEndpointConnectionsOperations( self._client, self._config, self._serialize, self._deserialize ) - self.gallery_applications = GalleryApplicationsOperations( + self.disk_encryption_sets = DiskEncryptionSetsOperations( self._client, self._config, self._serialize, self._deserialize ) - self.gallery_application_versions = GalleryApplicationVersionsOperations( + self.disk_restore_points = DiskRestorePointsOperations( self._client, self._config, self._serialize, self._deserialize ) + self.snapshots = SnapshotsOperations(self._client, self._config, self._serialize, self._deserialize) + self.galleries = GalleriesOperations(self._client, self._config, self._serialize, self._deserialize) self.gallery_images = GalleryImagesOperations(self._client, self._config, self._serialize, self._deserialize) self.gallery_image_versions = GalleryImageVersionsOperations( self._client, self._config, self._serialize, self._deserialize ) + self.gallery_applications = GalleryApplicationsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.gallery_application_versions = GalleryApplicationVersionsOperations( + self._client, self._config, self._serialize, self._deserialize + ) self.gallery_in_vm_access_control_profiles = GalleryInVMAccessControlProfilesOperations( self._client, self._config, self._serialize, self._deserialize ) self.gallery_in_vm_access_control_profile_versions = GalleryInVMAccessControlProfileVersionsOperations( self._client, self._config, self._serialize, self._deserialize ) - self.gallery_sharing_profile = GallerySharingProfileOperations( + self.shared_galleries = SharedGalleriesOperations( self._client, self._config, self._serialize, self._deserialize ) - self.soft_deleted_resource = SoftDeletedResourceOperations( + self.shared_gallery_images = SharedGalleryImagesOperations( self._client, self._config, self._serialize, self._deserialize ) - self.cloud_service_role_instances = CloudServiceRoleInstancesOperations( + self.shared_gallery_image_versions = SharedGalleryImageVersionsOperations( self._client, self._config, self._serialize, self._deserialize ) - self.cloud_service_roles = CloudServiceRolesOperations( + self.community_galleries = CommunityGalleriesOperations( self._client, self._config, self._serialize, self._deserialize ) - self.cloud_services = CloudServicesOperations(self._client, self._config, self._serialize, self._deserialize) - self.cloud_services_update_domain = CloudServicesUpdateDomainOperations( + self.community_gallery_images = CommunityGalleryImagesOperations( self._client, self._config, self._serialize, self._deserialize ) - self.cloud_service_operating_systems = CloudServiceOperatingSystemsOperations( + self.community_gallery_image_versions = CommunityGalleryImageVersionsOperations( self._client, self._config, self._serialize, self._deserialize ) + self.resource_skus = ResourceSkusOperations(self._client, self._config, self._serialize, self._deserialize) - def _send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: Any) -> HttpResponse: + def send_request(self, request: HttpRequest, *, stream: bool = False, **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) + >>> response = client.send_request(request) For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request @@ -422,7 +424,11 @@ def _send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: """ request_copy = deepcopy(request) - request_copy.url = self._client.format_url(request_copy.url) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + request_copy.url = self._client.format_url(request_copy.url, **path_format_arguments) return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore def close(self) -> None: diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/_configuration.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/_configuration.py index 69e5c0b3fa94..635c3049a07f 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/_configuration.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/_configuration.py @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -18,28 +18,36 @@ from azure.core.credentials import TokenCredential -class ComputeManagementClientConfiguration: # pylint: disable=too-many-instance-attributes - """Configuration for ComputeManagementClient. +class ComputeClientConfiguration: # pylint: disable=too-many-instance-attributes + """Configuration for ComputeClient. 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. Required. + :param credential: Credential used to authenticate requests to the service. Required. :type credential: ~azure.core.credentials.TokenCredential - :param subscription_id: The ID of the target subscription. Required. + :param subscription_id: The ID of the target subscription. The value must be an UUID. Required. :type subscription_id: str + :param base_url: Service host. Default value is "https://management.azure.com". + :type base_url: str :param cloud_setting: The cloud setting for which to get the ARM endpoint. Default value is None. :type cloud_setting: ~azure.core.AzureClouds + :keyword api_version: The API version to use for this operation. Default value is "2025-04-01". + Note that overriding this default value may result in unsupported behavior. + :paramtype api_version: str """ def __init__( self, credential: "TokenCredential", subscription_id: str, + base_url: str = "https://management.azure.com", cloud_setting: Optional["AzureClouds"] = None, **kwargs: Any ) -> None: + api_version: str = kwargs.pop("api_version", "2025-04-01") + if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: @@ -47,7 +55,9 @@ def __init__( self.credential = credential self.subscription_id = subscription_id + self.base_url = base_url self.cloud_setting = cloud_setting + 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.polling_interval = kwargs.get("polling_interval", 30) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/_patch.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/_patch.py index 8bcb627aa475..87676c65a8f0 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/_patch.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/_patch.py @@ -7,9 +7,9 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/_utils/__init__.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/_utils/__init__.py index 0af9b28f6607..8026245c2abc 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/_utils/__init__.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/_utils/__init__.py @@ -1,6 +1,6 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/_utils/model_base.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/_utils/model_base.py new file mode 100644 index 000000000000..12926fa98dcf --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/_utils/model_base.py @@ -0,0 +1,1237 @@ +# pylint: disable=line-too-long,useless-suppression,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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +# pylint: disable=protected-access, broad-except + +import copy +import calendar +import decimal +import functools +import sys +import logging +import base64 +import re +import typing +import enum +import email.utils +from datetime import datetime, date, time, timedelta, timezone +from json import JSONEncoder +import xml.etree.ElementTree as ET +from collections.abc import MutableMapping +from typing_extensions import Self +import isodate +from azure.core.exceptions import DeserializationError +from azure.core import CaseInsensitiveEnumMeta +from azure.core.pipeline import PipelineResponse +from azure.core.serialization import _Null +from azure.core.rest import HttpResponse + +_LOGGER = logging.getLogger(__name__) + +__all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] + +TZ_UTC = timezone.utc +_T = typing.TypeVar("_T") + + +def _timedelta_as_isostr(td: timedelta) -> str: + """Converts a datetime.timedelta object into an ISO 8601 formatted string, e.g. 'P4DT12H30M05S' + + Function adapted from the Tin Can Python project: https://github.com/RusticiSoftware/TinCanPython + + :param timedelta td: The timedelta to convert + :rtype: str + :return: ISO8601 version of this timedelta + """ + + # Split seconds to larger units + seconds = td.total_seconds() + minutes, seconds = divmod(seconds, 60) + hours, minutes = divmod(minutes, 60) + days, hours = divmod(hours, 24) + + days, hours, minutes = list(map(int, (days, hours, minutes))) + seconds = round(seconds, 6) + + # Build date + date_str = "" + if days: + date_str = "%sD" % days + + if hours or minutes or seconds: + # Build time + time_str = "T" + + # Hours + bigger_exists = date_str or hours + if bigger_exists: + time_str += "{:02}H".format(hours) + + # Minutes + bigger_exists = bigger_exists or minutes + if bigger_exists: + time_str += "{:02}M".format(minutes) + + # Seconds + try: + if seconds.is_integer(): + seconds_string = "{:02}".format(int(seconds)) + else: + # 9 chars long w/ leading 0, 6 digits after decimal + seconds_string = "%09.6f" % seconds + # Remove trailing zeros + seconds_string = seconds_string.rstrip("0") + except AttributeError: # int.is_integer() raises + seconds_string = "{:02}".format(seconds) + + time_str += "{}S".format(seconds_string) + else: + time_str = "" + + return "P" + date_str + time_str + + +def _serialize_bytes(o, format: typing.Optional[str] = None) -> str: + encoded = base64.b64encode(o).decode() + if format == "base64url": + return encoded.strip("=").replace("+", "-").replace("/", "_") + return encoded + + +def _serialize_datetime(o, format: typing.Optional[str] = None): + if hasattr(o, "year") and hasattr(o, "hour"): + if format == "rfc7231": + return email.utils.format_datetime(o, usegmt=True) + if format == "unix-timestamp": + return int(calendar.timegm(o.utctimetuple())) + + # astimezone() fails for naive times in Python 2.7, so make make sure o is aware (tzinfo is set) + if not o.tzinfo: + iso_formatted = o.replace(tzinfo=TZ_UTC).isoformat() + else: + iso_formatted = o.astimezone(TZ_UTC).isoformat() + # Replace the trailing "+00:00" UTC offset with "Z" (RFC 3339: https://www.ietf.org/rfc/rfc3339.txt) + return iso_formatted.replace("+00:00", "Z") + # Next try datetime.date or datetime.time + return o.isoformat() + + +def _is_readonly(p): + try: + return p._visibility == ["read"] + except AttributeError: + return False + + +class SdkJSONEncoder(JSONEncoder): + """A JSON encoder that's capable of serializing datetime objects and bytes.""" + + def __init__(self, *args, exclude_readonly: bool = False, format: typing.Optional[str] = None, **kwargs): + super().__init__(*args, **kwargs) + self.exclude_readonly = exclude_readonly + self.format = format + + def default(self, o): # pylint: disable=too-many-return-statements + if _is_model(o): + if self.exclude_readonly: + readonly_props = [p._rest_name for p in o._attr_to_rest_field.values() if _is_readonly(p)] + return {k: v for k, v in o.items() if k not in readonly_props} + return dict(o.items()) + try: + return super(SdkJSONEncoder, self).default(o) + except TypeError: + if isinstance(o, _Null): + return None + if isinstance(o, decimal.Decimal): + return float(o) + if isinstance(o, (bytes, bytearray)): + return _serialize_bytes(o, self.format) + try: + # First try datetime.datetime + return _serialize_datetime(o, self.format) + except AttributeError: + pass + # Last, try datetime.timedelta + try: + return _timedelta_as_isostr(o) + except AttributeError: + # This will be raised when it hits value.total_seconds in the method above + pass + return super(SdkJSONEncoder, self).default(o) + + +_VALID_DATE = re.compile(r"\d{4}[-]\d{2}[-]\d{2}T\d{2}:\d{2}:\d{2}" + r"\.?\d*Z?[-+]?[\d{2}]?:?[\d{2}]?") +_VALID_RFC7231 = re.compile( + r"(Mon|Tue|Wed|Thu|Fri|Sat|Sun),\s\d{2}\s" + r"(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s\d{4}\s\d{2}:\d{2}:\d{2}\sGMT" +) + + +def _deserialize_datetime(attr: typing.Union[str, datetime]) -> datetime: + """Deserialize ISO-8601 formatted string into Datetime object. + + :param str attr: response string to be deserialized. + :rtype: ~datetime.datetime + :returns: The datetime object from that input + """ + if isinstance(attr, datetime): + # i'm already deserialized + return attr + attr = attr.upper() + match = _VALID_DATE.match(attr) + if not match: + raise ValueError("Invalid datetime string: " + attr) + + check_decimal = attr.split(".") + if len(check_decimal) > 1: + decimal_str = "" + for digit in check_decimal[1]: + if digit.isdigit(): + decimal_str += digit + else: + break + if len(decimal_str) > 6: + attr = attr.replace(decimal_str, decimal_str[0:6]) + + date_obj = isodate.parse_datetime(attr) + test_utc = date_obj.utctimetuple() + if test_utc.tm_year > 9999 or test_utc.tm_year < 1: + raise OverflowError("Hit max or min date") + return date_obj + + +def _deserialize_datetime_rfc7231(attr: typing.Union[str, datetime]) -> datetime: + """Deserialize RFC7231 formatted string into Datetime object. + + :param str attr: response string to be deserialized. + :rtype: ~datetime.datetime + :returns: The datetime object from that input + """ + if isinstance(attr, datetime): + # i'm already deserialized + return attr + match = _VALID_RFC7231.match(attr) + if not match: + raise ValueError("Invalid datetime string: " + attr) + + return email.utils.parsedate_to_datetime(attr) + + +def _deserialize_datetime_unix_timestamp(attr: typing.Union[float, datetime]) -> datetime: + """Deserialize unix timestamp into Datetime object. + + :param str attr: response string to be deserialized. + :rtype: ~datetime.datetime + :returns: The datetime object from that input + """ + if isinstance(attr, datetime): + # i'm already deserialized + return attr + return datetime.fromtimestamp(attr, TZ_UTC) + + +def _deserialize_date(attr: typing.Union[str, date]) -> date: + """Deserialize ISO-8601 formatted string into Date object. + :param str attr: response string to be deserialized. + :rtype: date + :returns: The date object from that input + """ + # This must NOT use defaultmonth/defaultday. Using None ensure this raises an exception. + if isinstance(attr, date): + return attr + return isodate.parse_date(attr, defaultmonth=None, defaultday=None) # type: ignore + + +def _deserialize_time(attr: typing.Union[str, time]) -> time: + """Deserialize ISO-8601 formatted string into time object. + + :param str attr: response string to be deserialized. + :rtype: datetime.time + :returns: The time object from that input + """ + if isinstance(attr, time): + return attr + return isodate.parse_time(attr) + + +def _deserialize_bytes(attr): + if isinstance(attr, (bytes, bytearray)): + return attr + return bytes(base64.b64decode(attr)) + + +def _deserialize_bytes_base64(attr): + if isinstance(attr, (bytes, bytearray)): + return attr + padding = "=" * (3 - (len(attr) + 3) % 4) # type: ignore + attr = attr + padding # type: ignore + encoded = attr.replace("-", "+").replace("_", "/") + return bytes(base64.b64decode(encoded)) + + +def _deserialize_duration(attr): + if isinstance(attr, timedelta): + return attr + return isodate.parse_duration(attr) + + +def _deserialize_decimal(attr): + if isinstance(attr, decimal.Decimal): + return attr + return decimal.Decimal(str(attr)) + + +def _deserialize_int_as_str(attr): + if isinstance(attr, int): + return attr + return int(attr) + + +_DESERIALIZE_MAPPING = { + datetime: _deserialize_datetime, + date: _deserialize_date, + time: _deserialize_time, + bytes: _deserialize_bytes, + bytearray: _deserialize_bytes, + timedelta: _deserialize_duration, + typing.Any: lambda x: x, + decimal.Decimal: _deserialize_decimal, +} + +_DESERIALIZE_MAPPING_WITHFORMAT = { + "rfc3339": _deserialize_datetime, + "rfc7231": _deserialize_datetime_rfc7231, + "unix-timestamp": _deserialize_datetime_unix_timestamp, + "base64": _deserialize_bytes, + "base64url": _deserialize_bytes_base64, +} + + +def get_deserializer(annotation: typing.Any, rf: typing.Optional["_RestField"] = None): + if annotation is int and rf and rf._format == "str": + return _deserialize_int_as_str + if rf and rf._format: + return _DESERIALIZE_MAPPING_WITHFORMAT.get(rf._format) + return _DESERIALIZE_MAPPING.get(annotation) # pyright: ignore + + +def _get_type_alias_type(module_name: str, alias_name: str): + types = { + k: v + for k, v in sys.modules[module_name].__dict__.items() + if isinstance(v, typing._GenericAlias) # type: ignore + } + if alias_name not in types: + return alias_name + return types[alias_name] + + +def _get_model(module_name: str, model_name: str): + models = {k: v for k, v in sys.modules[module_name].__dict__.items() if isinstance(v, type)} + module_end = module_name.rsplit(".", 1)[0] + models.update({k: v for k, v in sys.modules[module_end].__dict__.items() if isinstance(v, type)}) + if isinstance(model_name, str): + model_name = model_name.split(".")[-1] + if model_name not in models: + return model_name + return models[model_name] + + +_UNSET = object() + + +class _MyMutableMapping(MutableMapping[str, typing.Any]): + def __init__(self, data: dict[str, typing.Any]) -> None: + self._data = data + + def __contains__(self, key: typing.Any) -> bool: + return key in self._data + + def __getitem__(self, key: str) -> typing.Any: + return self._data.__getitem__(key) + + def __setitem__(self, key: str, value: typing.Any) -> None: + self._data.__setitem__(key, value) + + def __delitem__(self, key: str) -> None: + self._data.__delitem__(key) + + def __iter__(self) -> typing.Iterator[typing.Any]: + return self._data.__iter__() + + def __len__(self) -> int: + return self._data.__len__() + + def __ne__(self, other: typing.Any) -> bool: + return not self.__eq__(other) + + def keys(self) -> typing.KeysView[str]: + """ + :returns: a set-like object providing a view on D's keys + :rtype: ~typing.KeysView + """ + return self._data.keys() + + def values(self) -> typing.ValuesView[typing.Any]: + """ + :returns: an object providing a view on D's values + :rtype: ~typing.ValuesView + """ + return self._data.values() + + def items(self) -> typing.ItemsView[str, typing.Any]: + """ + :returns: set-like object providing a view on D's items + :rtype: ~typing.ItemsView + """ + return self._data.items() + + def get(self, key: str, default: typing.Any = None) -> typing.Any: + """ + Get the value for key if key is in the dictionary, else default. + :param str key: The key to look up. + :param any default: The value to return if key is not in the dictionary. Defaults to None + :returns: D[k] if k in D, else d. + :rtype: any + """ + try: + return self[key] + except KeyError: + return default + + @typing.overload + def pop(self, key: str) -> typing.Any: ... # pylint: disable=arguments-differ + + @typing.overload + def pop(self, key: str, default: _T) -> _T: ... # pylint: disable=signature-differs + + @typing.overload + def pop(self, key: str, default: typing.Any) -> typing.Any: ... # pylint: disable=signature-differs + + def pop(self, key: str, default: typing.Any = _UNSET) -> typing.Any: + """ + Removes specified key and return the corresponding value. + :param str key: The key to pop. + :param any default: The value to return if key is not in the dictionary + :returns: The value corresponding to the key. + :rtype: any + :raises KeyError: If key is not found and default is not given. + """ + if default is _UNSET: + return self._data.pop(key) + return self._data.pop(key, default) + + def popitem(self) -> tuple[str, typing.Any]: + """ + Removes and returns some (key, value) pair + :returns: The (key, value) pair. + :rtype: tuple + :raises KeyError: if D is empty. + """ + return self._data.popitem() + + def clear(self) -> None: + """ + Remove all items from D. + """ + self._data.clear() + + def update(self, *args: typing.Any, **kwargs: typing.Any) -> None: # pylint: disable=arguments-differ + """ + Updates D from mapping/iterable E and F. + :param any args: Either a mapping object or an iterable of key-value pairs. + """ + self._data.update(*args, **kwargs) + + @typing.overload + def setdefault(self, key: str, default: None = None) -> None: ... + + @typing.overload + def setdefault(self, key: str, default: typing.Any) -> typing.Any: ... # pylint: disable=signature-differs + + def setdefault(self, key: str, default: typing.Any = _UNSET) -> typing.Any: + """ + Same as calling D.get(k, d), and setting D[k]=d if k not found + :param str key: The key to look up. + :param any default: The value to set if key is not in the dictionary + :returns: D[k] if k in D, else d. + :rtype: any + """ + if default is _UNSET: + return self._data.setdefault(key) + return self._data.setdefault(key, default) + + def __eq__(self, other: typing.Any) -> bool: + try: + other_model = self.__class__(other) + except Exception: + return False + return self._data == other_model._data + + def __repr__(self) -> str: + return str(self._data) + + +def _is_model(obj: typing.Any) -> bool: + return getattr(obj, "_is_model", False) + + +def _serialize(o, format: typing.Optional[str] = None): # pylint: disable=too-many-return-statements + if isinstance(o, list): + return [_serialize(x, format) for x in o] + if isinstance(o, dict): + return {k: _serialize(v, format) for k, v in o.items()} + if isinstance(o, set): + return {_serialize(x, format) for x in o} + if isinstance(o, tuple): + return tuple(_serialize(x, format) for x in o) + if isinstance(o, (bytes, bytearray)): + return _serialize_bytes(o, format) + if isinstance(o, decimal.Decimal): + return float(o) + if isinstance(o, enum.Enum): + return o.value + if isinstance(o, int): + if format == "str": + return str(o) + return o + try: + # First try datetime.datetime + return _serialize_datetime(o, format) + except AttributeError: + pass + # Last, try datetime.timedelta + try: + return _timedelta_as_isostr(o) + except AttributeError: + # This will be raised when it hits value.total_seconds in the method above + pass + return o + + +def _get_rest_field(attr_to_rest_field: dict[str, "_RestField"], rest_name: str) -> typing.Optional["_RestField"]: + try: + return next(rf for rf in attr_to_rest_field.values() if rf._rest_name == rest_name) + except StopIteration: + return None + + +def _create_value(rf: typing.Optional["_RestField"], value: typing.Any) -> typing.Any: + if not rf: + return _serialize(value, None) + if rf._is_multipart_file_input: + return value + if rf._is_model: + return _deserialize(rf._type, value) + if isinstance(value, ET.Element): + value = _deserialize(rf._type, value) + return _serialize(value, rf._format) + + +class Model(_MyMutableMapping): + _is_model = True + # label whether current class's _attr_to_rest_field has been calculated + # could not see _attr_to_rest_field directly because subclass inherits it from parent class + _calculated: set[str] = set() + + def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: + class_name = self.__class__.__name__ + if len(args) > 1: + raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") + dict_to_pass = { + rest_field._rest_name: rest_field._default + for rest_field in self._attr_to_rest_field.values() + if rest_field._default is not _UNSET + } + if args: # pylint: disable=too-many-nested-blocks + if isinstance(args[0], ET.Element): + existed_attr_keys = [] + model_meta = getattr(self, "_xml", {}) + + for rf in self._attr_to_rest_field.values(): + prop_meta = getattr(rf, "_xml", {}) + xml_name = prop_meta.get("name", rf._rest_name) + xml_ns = prop_meta.get("ns", model_meta.get("ns", None)) + if xml_ns: + xml_name = "{" + xml_ns + "}" + xml_name + + # attribute + if prop_meta.get("attribute", False) and args[0].get(xml_name) is not None: + existed_attr_keys.append(xml_name) + dict_to_pass[rf._rest_name] = _deserialize(rf._type, args[0].get(xml_name)) + continue + + # unwrapped element is array + if prop_meta.get("unwrapped", False): + # unwrapped array could either use prop items meta/prop meta + if prop_meta.get("itemsName"): + xml_name = prop_meta.get("itemsName") + xml_ns = prop_meta.get("itemNs") + if xml_ns: + xml_name = "{" + xml_ns + "}" + xml_name + items = args[0].findall(xml_name) # pyright: ignore + if len(items) > 0: + existed_attr_keys.append(xml_name) + dict_to_pass[rf._rest_name] = _deserialize(rf._type, items) + continue + + # text element is primitive type + if prop_meta.get("text", False): + if args[0].text is not None: + dict_to_pass[rf._rest_name] = _deserialize(rf._type, args[0].text) + continue + + # wrapped element could be normal property or array, it should only have one element + item = args[0].find(xml_name) + if item is not None: + existed_attr_keys.append(xml_name) + dict_to_pass[rf._rest_name] = _deserialize(rf._type, item) + + # rest thing is additional properties + for e in args[0]: + if e.tag not in existed_attr_keys: + dict_to_pass[e.tag] = _convert_element(e) + else: + dict_to_pass.update( + {k: _create_value(_get_rest_field(self._attr_to_rest_field, k), v) for k, v in args[0].items()} + ) + else: + non_attr_kwargs = [k for k in kwargs if k not in self._attr_to_rest_field] + if non_attr_kwargs: + # actual type errors only throw the first wrong keyword arg they see, so following that. + raise TypeError(f"{class_name}.__init__() got an unexpected keyword argument '{non_attr_kwargs[0]}'") + dict_to_pass.update( + { + self._attr_to_rest_field[k]._rest_name: _create_value(self._attr_to_rest_field[k], v) + for k, v in kwargs.items() + if v is not None + } + ) + super().__init__(dict_to_pass) + + def copy(self) -> "Model": + return Model(self.__dict__) + + def __new__(cls, *args: typing.Any, **kwargs: typing.Any) -> Self: + if f"{cls.__module__}.{cls.__qualname__}" not in cls._calculated: + # we know the last nine classes in mro are going to be 'Model', '_MyMutableMapping', 'MutableMapping', + # 'Mapping', 'Collection', 'Sized', 'Iterable', 'Container' and 'object' + mros = cls.__mro__[:-9][::-1] # ignore parents, and reverse the mro order + attr_to_rest_field: dict[str, _RestField] = { # map attribute name to rest_field property + k: v for mro_class in mros for k, v in mro_class.__dict__.items() if k[0] != "_" and hasattr(v, "_type") + } + annotations = { + k: v + for mro_class in mros + if hasattr(mro_class, "__annotations__") + for k, v in mro_class.__annotations__.items() + } + for attr, rf in attr_to_rest_field.items(): + rf._module = cls.__module__ + if not rf._type: + rf._type = rf._get_deserialize_callable_from_annotation(annotations.get(attr, None)) + if not rf._rest_name_input: + rf._rest_name_input = attr + cls._attr_to_rest_field: dict[str, _RestField] = dict(attr_to_rest_field.items()) + cls._calculated.add(f"{cls.__module__}.{cls.__qualname__}") + + return super().__new__(cls) + + def __init_subclass__(cls, discriminator: typing.Optional[str] = None) -> None: + for base in cls.__bases__: + if hasattr(base, "__mapping__"): + base.__mapping__[discriminator or cls.__name__] = cls # type: ignore + + @classmethod + def _get_discriminator(cls, exist_discriminators) -> typing.Optional["_RestField"]: + for v in cls.__dict__.values(): + if isinstance(v, _RestField) and v._is_discriminator and v._rest_name not in exist_discriminators: + return v + return None + + @classmethod + def _deserialize(cls, data, exist_discriminators): + if not hasattr(cls, "__mapping__"): + return cls(data) + discriminator = cls._get_discriminator(exist_discriminators) + if discriminator is None: + return cls(data) + exist_discriminators.append(discriminator._rest_name) + if isinstance(data, ET.Element): + model_meta = getattr(cls, "_xml", {}) + prop_meta = getattr(discriminator, "_xml", {}) + xml_name = prop_meta.get("name", discriminator._rest_name) + xml_ns = prop_meta.get("ns", model_meta.get("ns", None)) + if xml_ns: + xml_name = "{" + xml_ns + "}" + xml_name + + if data.get(xml_name) is not None: + discriminator_value = data.get(xml_name) + else: + discriminator_value = data.find(xml_name).text # pyright: ignore + else: + discriminator_value = data.get(discriminator._rest_name) + mapped_cls = cls.__mapping__.get(discriminator_value, cls) # pyright: ignore # pylint: disable=no-member + return mapped_cls._deserialize(data, exist_discriminators) + + def as_dict(self, *, exclude_readonly: bool = False) -> dict[str, typing.Any]: + """Return a dict that can be turned into json using json.dump. + + :keyword bool exclude_readonly: Whether to remove the readonly properties. + :returns: A dict JSON compatible object + :rtype: dict + """ + + result = {} + readonly_props = [] + if exclude_readonly: + readonly_props = [p._rest_name for p in self._attr_to_rest_field.values() if _is_readonly(p)] + for k, v in self.items(): + if exclude_readonly and k in readonly_props: # pyright: ignore + continue + is_multipart_file_input = False + try: + is_multipart_file_input = next( + rf for rf in self._attr_to_rest_field.values() if rf._rest_name == k + )._is_multipart_file_input + except StopIteration: + pass + result[k] = v if is_multipart_file_input else Model._as_dict_value(v, exclude_readonly=exclude_readonly) + return result + + @staticmethod + def _as_dict_value(v: typing.Any, exclude_readonly: bool = False) -> typing.Any: + if v is None or isinstance(v, _Null): + return None + if isinstance(v, (list, tuple, set)): + return type(v)(Model._as_dict_value(x, exclude_readonly=exclude_readonly) for x in v) + if isinstance(v, dict): + return {dk: Model._as_dict_value(dv, exclude_readonly=exclude_readonly) for dk, dv in v.items()} + return v.as_dict(exclude_readonly=exclude_readonly) if hasattr(v, "as_dict") else v + + +def _deserialize_model(model_deserializer: typing.Optional[typing.Callable], obj): + if _is_model(obj): + return obj + return _deserialize(model_deserializer, obj) + + +def _deserialize_with_optional(if_obj_deserializer: typing.Optional[typing.Callable], obj): + if obj is None: + return obj + return _deserialize_with_callable(if_obj_deserializer, obj) + + +def _deserialize_with_union(deserializers, obj): + for deserializer in deserializers: + try: + return _deserialize(deserializer, obj) + except DeserializationError: + pass + raise DeserializationError() + + +def _deserialize_dict( + value_deserializer: typing.Optional[typing.Callable], + module: typing.Optional[str], + obj: dict[typing.Any, typing.Any], +): + if obj is None: + return obj + if isinstance(obj, ET.Element): + obj = {child.tag: child for child in obj} + return {k: _deserialize(value_deserializer, v, module) for k, v in obj.items()} + + +def _deserialize_multiple_sequence( + entry_deserializers: list[typing.Optional[typing.Callable]], + module: typing.Optional[str], + obj, +): + if obj is None: + return obj + return type(obj)(_deserialize(deserializer, entry, module) for entry, deserializer in zip(obj, entry_deserializers)) + + +def _deserialize_sequence( + deserializer: typing.Optional[typing.Callable], + module: typing.Optional[str], + obj, +): + if obj is None: + return obj + if isinstance(obj, ET.Element): + obj = list(obj) + return type(obj)(_deserialize(deserializer, entry, module) for entry in obj) + + +def _sorted_annotations(types: list[typing.Any]) -> list[typing.Any]: + return sorted( + types, + key=lambda x: hasattr(x, "__name__") and x.__name__.lower() in ("str", "float", "int", "bool"), + ) + + +def _get_deserialize_callable_from_annotation( # pylint: disable=too-many-return-statements, too-many-statements, too-many-branches + annotation: typing.Any, + module: typing.Optional[str], + rf: typing.Optional["_RestField"] = None, +) -> typing.Optional[typing.Callable[[typing.Any], typing.Any]]: + if not annotation: + return None + + # is it a type alias? + if isinstance(annotation, str): + if module is not None: + annotation = _get_type_alias_type(module, annotation) + + # is it a forward ref / in quotes? + if isinstance(annotation, (str, typing.ForwardRef)): + try: + model_name = annotation.__forward_arg__ # type: ignore + except AttributeError: + model_name = annotation + if module is not None: + annotation = _get_model(module, model_name) # type: ignore + + try: + if module and _is_model(annotation): + if rf: + rf._is_model = True + + return functools.partial(_deserialize_model, annotation) # pyright: ignore + except Exception: + pass + + # is it a literal? + try: + if annotation.__origin__ is typing.Literal: # pyright: ignore + return None + except AttributeError: + pass + + # is it optional? + try: + if any(a for a in annotation.__args__ if a == type(None)): # pyright: ignore + if len(annotation.__args__) <= 2: # pyright: ignore + if_obj_deserializer = _get_deserialize_callable_from_annotation( + next(a for a in annotation.__args__ if a != type(None)), module, rf # pyright: ignore + ) + + return functools.partial(_deserialize_with_optional, if_obj_deserializer) + # the type is Optional[Union[...]], we need to remove the None type from the Union + annotation_copy = copy.copy(annotation) + annotation_copy.__args__ = [a for a in annotation_copy.__args__ if a != type(None)] # pyright: ignore + return _get_deserialize_callable_from_annotation(annotation_copy, module, rf) + except AttributeError: + pass + + # is it union? + if getattr(annotation, "__origin__", None) is typing.Union: + # initial ordering is we make `string` the last deserialization option, because it is often them most generic + deserializers = [ + _get_deserialize_callable_from_annotation(arg, module, rf) + for arg in _sorted_annotations(annotation.__args__) # pyright: ignore + ] + + return functools.partial(_deserialize_with_union, deserializers) + + try: + annotation_name = ( + annotation.__name__ if hasattr(annotation, "__name__") else annotation._name # pyright: ignore + ) + if annotation_name.lower() == "dict": + value_deserializer = _get_deserialize_callable_from_annotation( + annotation.__args__[1], module, rf # pyright: ignore + ) + + return functools.partial( + _deserialize_dict, + value_deserializer, + module, + ) + except (AttributeError, IndexError): + pass + try: + annotation_name = ( + annotation.__name__ if hasattr(annotation, "__name__") else annotation._name # pyright: ignore + ) + if annotation_name.lower() in ["list", "set", "tuple", "sequence"]: + if len(annotation.__args__) > 1: # pyright: ignore + entry_deserializers = [ + _get_deserialize_callable_from_annotation(dt, module, rf) + for dt in annotation.__args__ # pyright: ignore + ] + return functools.partial(_deserialize_multiple_sequence, entry_deserializers, module) + deserializer = _get_deserialize_callable_from_annotation( + annotation.__args__[0], module, rf # pyright: ignore + ) + + return functools.partial(_deserialize_sequence, deserializer, module) + except (TypeError, IndexError, AttributeError, SyntaxError): + pass + + def _deserialize_default( + deserializer, + obj, + ): + if obj is None: + return obj + try: + return _deserialize_with_callable(deserializer, obj) + except Exception: + pass + return obj + + if get_deserializer(annotation, rf): + return functools.partial(_deserialize_default, get_deserializer(annotation, rf)) + + return functools.partial(_deserialize_default, annotation) + + +def _deserialize_with_callable( + deserializer: typing.Optional[typing.Callable[[typing.Any], typing.Any]], + value: typing.Any, +): # pylint: disable=too-many-return-statements + try: + if value is None or isinstance(value, _Null): + return None + if isinstance(value, ET.Element): + if deserializer is str: + return value.text or "" + if deserializer is int: + return int(value.text) if value.text else None + if deserializer is float: + return float(value.text) if value.text else None + if deserializer is bool: + return value.text == "true" if value.text else None + if deserializer is None: + return value + if deserializer in [int, float, bool]: + return deserializer(value) + if isinstance(deserializer, CaseInsensitiveEnumMeta): + try: + return deserializer(value) + except ValueError: + # for unknown value, return raw value + return value + if isinstance(deserializer, type) and issubclass(deserializer, Model): + return deserializer._deserialize(value, []) + return typing.cast(typing.Callable[[typing.Any], typing.Any], deserializer)(value) + except Exception as e: + raise DeserializationError() from e + + +def _deserialize( + deserializer: typing.Any, + value: typing.Any, + module: typing.Optional[str] = None, + rf: typing.Optional["_RestField"] = None, + format: typing.Optional[str] = None, +) -> typing.Any: + if isinstance(value, PipelineResponse): + value = value.http_response.json() + if rf is None and format: + rf = _RestField(format=format) + if not isinstance(deserializer, functools.partial): + deserializer = _get_deserialize_callable_from_annotation(deserializer, module, rf) + return _deserialize_with_callable(deserializer, value) + + +def _failsafe_deserialize( + deserializer: typing.Any, + response: HttpResponse, + module: typing.Optional[str] = None, + rf: typing.Optional["_RestField"] = None, + format: typing.Optional[str] = None, +) -> typing.Any: + try: + return _deserialize(deserializer, response.json(), module, rf, format) + except DeserializationError: + _LOGGER.warning( + "Ran into a deserialization error. Ignoring since this is failsafe deserialization", exc_info=True + ) + return None + + +def _failsafe_deserialize_xml( + deserializer: typing.Any, + response: HttpResponse, +) -> typing.Any: + try: + return _deserialize_xml(deserializer, response.text()) + except DeserializationError: + _LOGGER.warning( + "Ran into a deserialization error. Ignoring since this is failsafe deserialization", exc_info=True + ) + return None + + +class _RestField: + def __init__( + self, + *, + name: typing.Optional[str] = None, + type: typing.Optional[typing.Callable] = None, # pylint: disable=redefined-builtin + is_discriminator: bool = False, + visibility: typing.Optional[list[str]] = None, + default: typing.Any = _UNSET, + format: typing.Optional[str] = None, + is_multipart_file_input: bool = False, + xml: typing.Optional[dict[str, typing.Any]] = None, + ): + self._type = type + self._rest_name_input = name + self._module: typing.Optional[str] = None + self._is_discriminator = is_discriminator + self._visibility = visibility + self._is_model = False + self._default = default + self._format = format + self._is_multipart_file_input = is_multipart_file_input + self._xml = xml if xml is not None else {} + + @property + def _class_type(self) -> typing.Any: + return getattr(self._type, "args", [None])[0] + + @property + def _rest_name(self) -> str: + if self._rest_name_input is None: + raise ValueError("Rest name was never set") + return self._rest_name_input + + def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin + # by this point, type and rest_name will have a value bc we default + # them in __new__ of the Model class + item = obj.get(self._rest_name) + if item is None: + return item + if self._is_model: + return item + return _deserialize(self._type, _serialize(item, self._format), rf=self) + + def __set__(self, obj: Model, value) -> None: + if value is None: + # we want to wipe out entries if users set attr to None + try: + obj.__delitem__(self._rest_name) + except KeyError: + pass + return + if self._is_model: + if not _is_model(value): + value = _deserialize(self._type, value) + obj.__setitem__(self._rest_name, value) + return + obj.__setitem__(self._rest_name, _serialize(value, self._format)) + + def _get_deserialize_callable_from_annotation( + self, annotation: typing.Any + ) -> typing.Optional[typing.Callable[[typing.Any], typing.Any]]: + return _get_deserialize_callable_from_annotation(annotation, self._module, self) + + +def rest_field( + *, + name: typing.Optional[str] = None, + type: typing.Optional[typing.Callable] = None, # pylint: disable=redefined-builtin + visibility: typing.Optional[list[str]] = None, + default: typing.Any = _UNSET, + format: typing.Optional[str] = None, + is_multipart_file_input: bool = False, + xml: typing.Optional[dict[str, typing.Any]] = None, +) -> typing.Any: + return _RestField( + name=name, + type=type, + visibility=visibility, + default=default, + format=format, + is_multipart_file_input=is_multipart_file_input, + xml=xml, + ) + + +def rest_discriminator( + *, + name: typing.Optional[str] = None, + type: typing.Optional[typing.Callable] = None, # pylint: disable=redefined-builtin + visibility: typing.Optional[list[str]] = None, + xml: typing.Optional[dict[str, typing.Any]] = None, +) -> typing.Any: + return _RestField(name=name, type=type, is_discriminator=True, visibility=visibility, xml=xml) + + +def serialize_xml(model: Model, exclude_readonly: bool = False) -> str: + """Serialize a model to XML. + + :param Model model: The model to serialize. + :param bool exclude_readonly: Whether to exclude readonly properties. + :returns: The XML representation of the model. + :rtype: str + """ + return ET.tostring(_get_element(model, exclude_readonly), encoding="unicode") # type: ignore + + +def _get_element( + o: typing.Any, + exclude_readonly: bool = False, + parent_meta: typing.Optional[dict[str, typing.Any]] = None, + wrapped_element: typing.Optional[ET.Element] = None, +) -> typing.Union[ET.Element, list[ET.Element]]: + if _is_model(o): + model_meta = getattr(o, "_xml", {}) + + # if prop is a model, then use the prop element directly, else generate a wrapper of model + if wrapped_element is None: + wrapped_element = _create_xml_element( + model_meta.get("name", o.__class__.__name__), + model_meta.get("prefix"), + model_meta.get("ns"), + ) + + readonly_props = [] + if exclude_readonly: + readonly_props = [p._rest_name for p in o._attr_to_rest_field.values() if _is_readonly(p)] + + for k, v in o.items(): + # do not serialize readonly properties + if exclude_readonly and k in readonly_props: + continue + + prop_rest_field = _get_rest_field(o._attr_to_rest_field, k) + if prop_rest_field: + prop_meta = getattr(prop_rest_field, "_xml").copy() + # use the wire name as xml name if no specific name is set + if prop_meta.get("name") is None: + prop_meta["name"] = k + else: + # additional properties will not have rest field, use the wire name as xml name + prop_meta = {"name": k} + + # if no ns for prop, use model's + if prop_meta.get("ns") is None and model_meta.get("ns"): + prop_meta["ns"] = model_meta.get("ns") + prop_meta["prefix"] = model_meta.get("prefix") + + if prop_meta.get("unwrapped", False): + # unwrapped could only set on array + wrapped_element.extend(_get_element(v, exclude_readonly, prop_meta)) + elif prop_meta.get("text", False): + # text could only set on primitive type + wrapped_element.text = _get_primitive_type_value(v) + elif prop_meta.get("attribute", False): + xml_name = prop_meta.get("name", k) + if prop_meta.get("ns"): + ET.register_namespace(prop_meta.get("prefix"), prop_meta.get("ns")) # pyright: ignore + xml_name = "{" + prop_meta.get("ns") + "}" + xml_name # pyright: ignore + # attribute should be primitive type + wrapped_element.set(xml_name, _get_primitive_type_value(v)) + else: + # other wrapped prop element + wrapped_element.append(_get_wrapped_element(v, exclude_readonly, prop_meta)) + return wrapped_element + if isinstance(o, list): + return [_get_element(x, exclude_readonly, parent_meta) for x in o] # type: ignore + if isinstance(o, dict): + result = [] + for k, v in o.items(): + result.append( + _get_wrapped_element( + v, + exclude_readonly, + { + "name": k, + "ns": parent_meta.get("ns") if parent_meta else None, + "prefix": parent_meta.get("prefix") if parent_meta else None, + }, + ) + ) + return result + + # primitive case need to create element based on parent_meta + if parent_meta: + return _get_wrapped_element( + o, + exclude_readonly, + { + "name": parent_meta.get("itemsName", parent_meta.get("name")), + "prefix": parent_meta.get("itemsPrefix", parent_meta.get("prefix")), + "ns": parent_meta.get("itemsNs", parent_meta.get("ns")), + }, + ) + + raise ValueError("Could not serialize value into xml: " + o) + + +def _get_wrapped_element( + v: typing.Any, + exclude_readonly: bool, + meta: typing.Optional[dict[str, typing.Any]], +) -> ET.Element: + wrapped_element = _create_xml_element( + meta.get("name") if meta else None, meta.get("prefix") if meta else None, meta.get("ns") if meta else None + ) + if isinstance(v, (dict, list)): + wrapped_element.extend(_get_element(v, exclude_readonly, meta)) + elif _is_model(v): + _get_element(v, exclude_readonly, meta, wrapped_element) + else: + wrapped_element.text = _get_primitive_type_value(v) + return wrapped_element + + +def _get_primitive_type_value(v) -> str: + if v is True: + return "true" + if v is False: + return "false" + if isinstance(v, _Null): + return "" + return str(v) + + +def _create_xml_element(tag, prefix=None, ns=None): + if prefix and ns: + ET.register_namespace(prefix, ns) + if ns: + return ET.Element("{" + ns + "}" + tag) + return ET.Element(tag) + + +def _deserialize_xml( + deserializer: typing.Any, + value: str, +) -> typing.Any: + element = ET.fromstring(value) # nosec + return _deserialize(deserializer, element) + + +def _convert_element(e: ET.Element): + # dict case + if len(e.attrib) > 0 or len({child.tag for child in e}) > 1: + dict_result: dict[str, typing.Any] = {} + for child in e: + if dict_result.get(child.tag) is not None: + if isinstance(dict_result[child.tag], list): + dict_result[child.tag].append(_convert_element(child)) + else: + dict_result[child.tag] = [dict_result[child.tag], _convert_element(child)] + else: + dict_result[child.tag] = _convert_element(child) + dict_result.update(e.attrib) + return dict_result + # array case + if len(e) > 0: + array_result: list[typing.Any] = [] + for child in e: + array_result.append(_convert_element(child)) + return array_result + # primitive case + return e.text diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/_utils/serialization.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/_utils/serialization.py index 5f250836cf4b..45a3e44e45cb 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/_utils/serialization.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/_utils/serialization.py @@ -3,7 +3,7 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -787,7 +787,7 @@ def serialize_data(self, data, data_type, **kwargs): # If dependencies is empty, try with current data class # It has to be a subclass of Enum anyway - enum_type = self.dependencies.get(data_type, data.__class__) + enum_type = self.dependencies.get(data_type, cast(type, data.__class__)) if issubclass(enum_type, Enum): return Serializer.serialize_enum(data, enum_obj=enum_type) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/_utils/utils.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/_utils/utils.py new file mode 100644 index 000000000000..cbaa624660e4 --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/_utils/utils.py @@ -0,0 +1,40 @@ +# -------------------------------------------------------------------------- +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import Optional + +from azure.core import MatchConditions + + +def quote_etag(etag: Optional[str]) -> Optional[str]: + if not etag or etag == "*": + return etag + if etag.startswith("W/"): + return etag + if etag.startswith('"') and etag.endswith('"'): + return etag + if etag.startswith("'") and etag.endswith("'"): + return etag + return '"' + etag + '"' + + +def prep_if_match(etag: Optional[str], match_condition: Optional[MatchConditions]) -> Optional[str]: + if match_condition == MatchConditions.IfNotModified: + if_match = quote_etag(etag) if etag else None + return if_match + if match_condition == MatchConditions.IfPresent: + return "*" + return None + + +def prep_if_none_match(etag: Optional[str], match_condition: Optional[MatchConditions]) -> Optional[str]: + if match_condition == MatchConditions.IfModified: + if_none_match = quote_etag(etag) if etag else None + return if_none_match + if match_condition == MatchConditions.IfMissing: + return "*" + return None diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/_validation.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/_validation.py new file mode 100644 index 000000000000..f5af3a4eb8a2 --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/_validation.py @@ -0,0 +1,66 @@ +# -------------------------------------------------------------------------- +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import functools + + +def api_version_validation(**kwargs): + params_added_on = kwargs.pop("params_added_on", {}) + method_added_on = kwargs.pop("method_added_on", "") + api_versions_list = kwargs.pop("api_versions_list", []) + + def _index_with_default(value: str, default: int = -1) -> int: + """Get the index of value in lst, or return default if not found. + + :param value: The value to search for in the api_versions_list. + :type value: str + :param default: The default value to return if the value is not found. + :type default: int + :return: The index of the value in the list, or the default value if not found. + :rtype: int + """ + try: + return api_versions_list.index(value) + except ValueError: + return default + + def decorator(func): + @functools.wraps(func) + def wrapper(*args, **kwargs): + try: + # this assumes the client has an _api_version attribute + client = args[0] + client_api_version = client._config.api_version # pylint: disable=protected-access + except AttributeError: + return func(*args, **kwargs) + + if _index_with_default(method_added_on) > _index_with_default(client_api_version): + raise ValueError( + f"'{func.__name__}' is not available in API version " + f"{client_api_version}. Pass service API version {method_added_on} or newer to your client." + ) + + unsupported = { + parameter: api_version + for api_version, parameters in params_added_on.items() + for parameter in parameters + if parameter in kwargs and _index_with_default(api_version) > _index_with_default(client_api_version) + } + if unsupported: + raise ValueError( + "".join( + [ + f"'{param}' is not available in API version {client_api_version}. " + f"Use service API version {version} or newer.\n" + for param, version in unsupported.items() + ] + ) + ) + return func(*args, **kwargs) + + return wrapper + + return decorator diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/_version.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/_version.py index 63ccf87806f7..cfe3cbb30511 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/_version.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/_version.py @@ -1,8 +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. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "37.0.1" +VERSION = "38.0.0" diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/__init__.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/__init__.py index d3fd1ba93379..c8034ef1c9cc 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/__init__.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/__init__.py @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- # pylint: disable=wrong-import-position @@ -12,7 +12,7 @@ if TYPE_CHECKING: from ._patch import * # pylint: disable=unused-wildcard-import -from ._compute_management_client import ComputeManagementClient # type: ignore +from ._client import ComputeClient # type: ignore try: from ._patch import __all__ as _patch_all @@ -22,7 +22,7 @@ from ._patch import patch_sdk as _patch_sdk __all__ = [ - "ComputeManagementClient", + "ComputeClient", ] __all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore 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/_client.py similarity index 77% rename from sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/_compute_management_client.py rename to sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/_client.py index fd91ccce134d..09e0189999bf 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/_client.py @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -17,18 +17,12 @@ from azure.mgmt.core.policies import AsyncARMAutoResourceProviderRegistrationPolicy from azure.mgmt.core.tools import get_arm_endpoints -from .. import models as _models from .._utils.serialization import Deserializer, Serializer -from ._configuration import ComputeManagementClientConfiguration +from ._configuration import ComputeClientConfiguration from .operations import ( AvailabilitySetsOperations, CapacityReservationGroupsOperations, CapacityReservationsOperations, - CloudServiceOperatingSystemsOperations, - CloudServiceRoleInstancesOperations, - CloudServiceRolesOperations, - CloudServicesOperations, - CloudServicesUpdateDomainOperations, CommunityGalleriesOperations, CommunityGalleryImageVersionsOperations, CommunityGalleryImagesOperations, @@ -36,7 +30,7 @@ DedicatedHostsOperations, DiskAccessesOperations, DiskEncryptionSetsOperations, - DiskRestorePointOperations, + DiskRestorePointsOperations, DisksOperations, GalleriesOperations, GalleryApplicationVersionsOperations, @@ -45,33 +39,35 @@ GalleryImagesOperations, GalleryInVMAccessControlProfileVersionsOperations, GalleryInVMAccessControlProfilesOperations, - GallerySharingProfileOperations, ImagesOperations, - LogAnalyticsOperations, + LogAnalyticsOperationGroupOperations, Operations, + PrivateEndpointConnectionsOperations, ProximityPlacementGroupsOperations, ResourceSkusOperations, RestorePointCollectionsOperations, RestorePointsOperations, + RollingUpgradeStatusInfosOperations, SharedGalleriesOperations, SharedGalleryImageVersionsOperations, SharedGalleryImagesOperations, SnapshotsOperations, - SoftDeletedResourceOperations, - SshPublicKeysOperations, - UsageOperations, + SshPublicKeyResourcesOperations, + UsageOperationGroupOperations, VirtualMachineExtensionImagesOperations, VirtualMachineExtensionsOperations, - VirtualMachineImagesEdgeZoneOperations, - VirtualMachineImagesOperations, + VirtualMachineImagesEdgeZoneOperationGroupOperations, + VirtualMachineImagesOperationGroupOperations, + VirtualMachineRunCommandsOperationGroupOperations, VirtualMachineRunCommandsOperations, VirtualMachineScaleSetExtensionsOperations, - VirtualMachineScaleSetRollingUpgradesOperations, VirtualMachineScaleSetVMExtensionsOperations, VirtualMachineScaleSetVMRunCommandsOperations, - VirtualMachineScaleSetVMsOperations, + VirtualMachineScaleSetVMSOperations, + VirtualMachineScaleSetsOperationGroupOperations, VirtualMachineScaleSetsOperations, - VirtualMachineSizesOperations, + VirtualMachineSizesOperationGroupOperations, + VirtualMachinesOperationGroupOperations, VirtualMachinesOperations, ) @@ -80,119 +76,121 @@ from azure.core.credentials_async import AsyncTokenCredential -class ComputeManagementClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes +class ComputeClient: # pylint: disable=too-many-instance-attributes """Compute Client. :ivar operations: Operations operations :vartype operations: azure.mgmt.compute.aio.operations.Operations - :ivar availability_sets: AvailabilitySetsOperations operations - :vartype availability_sets: azure.mgmt.compute.aio.operations.AvailabilitySetsOperations - :ivar capacity_reservation_groups: CapacityReservationGroupsOperations operations - :vartype capacity_reservation_groups: - azure.mgmt.compute.aio.operations.CapacityReservationGroupsOperations - :ivar dedicated_host_groups: DedicatedHostGroupsOperations operations - :vartype dedicated_host_groups: azure.mgmt.compute.aio.operations.DedicatedHostGroupsOperations - :ivar images: ImagesOperations operations - :vartype images: azure.mgmt.compute.aio.operations.ImagesOperations - :ivar virtual_machine_images_edge_zone: VirtualMachineImagesEdgeZoneOperations operations - :vartype virtual_machine_images_edge_zone: - azure.mgmt.compute.aio.operations.VirtualMachineImagesEdgeZoneOperations - :ivar virtual_machine_images: VirtualMachineImagesOperations operations - :vartype virtual_machine_images: - azure.mgmt.compute.aio.operations.VirtualMachineImagesOperations - :ivar log_analytics: LogAnalyticsOperations operations - :vartype log_analytics: azure.mgmt.compute.aio.operations.LogAnalyticsOperations - :ivar virtual_machine_extension_images: VirtualMachineExtensionImagesOperations operations - :vartype virtual_machine_extension_images: - azure.mgmt.compute.aio.operations.VirtualMachineExtensionImagesOperations - :ivar virtual_machine_run_commands: VirtualMachineRunCommandsOperations operations - :vartype virtual_machine_run_commands: - azure.mgmt.compute.aio.operations.VirtualMachineRunCommandsOperations - :ivar usage: UsageOperations operations - :vartype usage: azure.mgmt.compute.aio.operations.UsageOperations :ivar virtual_machine_scale_sets: VirtualMachineScaleSetsOperations operations :vartype virtual_machine_scale_sets: azure.mgmt.compute.aio.operations.VirtualMachineScaleSetsOperations + :ivar rolling_upgrade_status_infos: RollingUpgradeStatusInfosOperations operations + :vartype rolling_upgrade_status_infos: + azure.mgmt.compute.aio.operations.RollingUpgradeStatusInfosOperations + :ivar virtual_machine_scale_set_extensions: VirtualMachineScaleSetExtensionsOperations + operations + :vartype virtual_machine_scale_set_extensions: + azure.mgmt.compute.aio.operations.VirtualMachineScaleSetExtensionsOperations + :ivar virtual_machine_scale_set_vms: VirtualMachineScaleSetVMSOperations operations + :vartype virtual_machine_scale_set_vms: + azure.mgmt.compute.aio.operations.VirtualMachineScaleSetVMSOperations + :ivar virtual_machine_scale_set_vm_extensions: VirtualMachineScaleSetVMExtensionsOperations + operations + :vartype virtual_machine_scale_set_vm_extensions: + azure.mgmt.compute.aio.operations.VirtualMachineScaleSetVMExtensionsOperations :ivar virtual_machines: VirtualMachinesOperations operations :vartype virtual_machines: azure.mgmt.compute.aio.operations.VirtualMachinesOperations - :ivar virtual_machine_sizes: VirtualMachineSizesOperations operations - :vartype virtual_machine_sizes: azure.mgmt.compute.aio.operations.VirtualMachineSizesOperations + :ivar virtual_machine_extensions: VirtualMachineExtensionsOperations operations + :vartype virtual_machine_extensions: + azure.mgmt.compute.aio.operations.VirtualMachineExtensionsOperations + :ivar virtual_machine_extension_images: VirtualMachineExtensionImagesOperations operations + :vartype virtual_machine_extension_images: + azure.mgmt.compute.aio.operations.VirtualMachineExtensionImagesOperations + :ivar availability_sets: AvailabilitySetsOperations operations + :vartype availability_sets: azure.mgmt.compute.aio.operations.AvailabilitySetsOperations :ivar proximity_placement_groups: ProximityPlacementGroupsOperations operations :vartype proximity_placement_groups: azure.mgmt.compute.aio.operations.ProximityPlacementGroupsOperations + :ivar dedicated_host_groups: DedicatedHostGroupsOperations operations + :vartype dedicated_host_groups: azure.mgmt.compute.aio.operations.DedicatedHostGroupsOperations + :ivar dedicated_hosts: DedicatedHostsOperations operations + :vartype dedicated_hosts: azure.mgmt.compute.aio.operations.DedicatedHostsOperations + :ivar ssh_public_key_resources: SshPublicKeyResourcesOperations operations + :vartype ssh_public_key_resources: + azure.mgmt.compute.aio.operations.SshPublicKeyResourcesOperations + :ivar images: ImagesOperations operations + :vartype images: azure.mgmt.compute.aio.operations.ImagesOperations :ivar restore_point_collections: RestorePointCollectionsOperations operations :vartype restore_point_collections: azure.mgmt.compute.aio.operations.RestorePointCollectionsOperations - :ivar ssh_public_keys: SshPublicKeysOperations operations - :vartype ssh_public_keys: azure.mgmt.compute.aio.operations.SshPublicKeysOperations + :ivar restore_points: RestorePointsOperations operations + :vartype restore_points: azure.mgmt.compute.aio.operations.RestorePointsOperations + :ivar capacity_reservation_groups: CapacityReservationGroupsOperations operations + :vartype capacity_reservation_groups: + azure.mgmt.compute.aio.operations.CapacityReservationGroupsOperations :ivar capacity_reservations: CapacityReservationsOperations operations :vartype capacity_reservations: azure.mgmt.compute.aio.operations.CapacityReservationsOperations - :ivar dedicated_hosts: DedicatedHostsOperations operations - :vartype dedicated_hosts: azure.mgmt.compute.aio.operations.DedicatedHostsOperations - :ivar restore_points: RestorePointsOperations operations - :vartype restore_points: azure.mgmt.compute.aio.operations.RestorePointsOperations - :ivar virtual_machine_scale_set_rolling_upgrades: - VirtualMachineScaleSetRollingUpgradesOperations operations - :vartype virtual_machine_scale_set_rolling_upgrades: - azure.mgmt.compute.aio.operations.VirtualMachineScaleSetRollingUpgradesOperations - :ivar virtual_machine_scale_set_extensions: VirtualMachineScaleSetExtensionsOperations - operations - :vartype virtual_machine_scale_set_extensions: - azure.mgmt.compute.aio.operations.VirtualMachineScaleSetExtensionsOperations - :ivar virtual_machine_scale_set_vms: VirtualMachineScaleSetVMsOperations operations - :vartype virtual_machine_scale_set_vms: - azure.mgmt.compute.aio.operations.VirtualMachineScaleSetVMsOperations - :ivar virtual_machine_scale_set_vm_extensions: VirtualMachineScaleSetVMExtensionsOperations - operations - :vartype virtual_machine_scale_set_vm_extensions: - azure.mgmt.compute.aio.operations.VirtualMachineScaleSetVMExtensionsOperations + :ivar virtual_machine_run_commands: VirtualMachineRunCommandsOperations operations + :vartype virtual_machine_run_commands: + azure.mgmt.compute.aio.operations.VirtualMachineRunCommandsOperations :ivar virtual_machine_scale_set_vm_run_commands: VirtualMachineScaleSetVMRunCommandsOperations operations :vartype virtual_machine_scale_set_vm_run_commands: azure.mgmt.compute.aio.operations.VirtualMachineScaleSetVMRunCommandsOperations - :ivar virtual_machine_extensions: VirtualMachineExtensionsOperations operations - :vartype virtual_machine_extensions: - azure.mgmt.compute.aio.operations.VirtualMachineExtensionsOperations + :ivar usage_operation_group: UsageOperationGroupOperations operations + :vartype usage_operation_group: azure.mgmt.compute.aio.operations.UsageOperationGroupOperations + :ivar virtual_machine_sizes_operation_group: VirtualMachineSizesOperationGroupOperations + operations + :vartype virtual_machine_sizes_operation_group: + azure.mgmt.compute.aio.operations.VirtualMachineSizesOperationGroupOperations + :ivar virtual_machine_scale_sets_operation_group: + VirtualMachineScaleSetsOperationGroupOperations operations + :vartype virtual_machine_scale_sets_operation_group: + azure.mgmt.compute.aio.operations.VirtualMachineScaleSetsOperationGroupOperations + :ivar virtual_machines_operation_group: VirtualMachinesOperationGroupOperations operations + :vartype virtual_machines_operation_group: + azure.mgmt.compute.aio.operations.VirtualMachinesOperationGroupOperations + :ivar virtual_machine_images_edge_zone_operation_group: + VirtualMachineImagesEdgeZoneOperationGroupOperations operations + :vartype virtual_machine_images_edge_zone_operation_group: + azure.mgmt.compute.aio.operations.VirtualMachineImagesEdgeZoneOperationGroupOperations + :ivar virtual_machine_images_operation_group: VirtualMachineImagesOperationGroupOperations + operations + :vartype virtual_machine_images_operation_group: + azure.mgmt.compute.aio.operations.VirtualMachineImagesOperationGroupOperations + :ivar log_analytics_operation_group: LogAnalyticsOperationGroupOperations operations + :vartype log_analytics_operation_group: + azure.mgmt.compute.aio.operations.LogAnalyticsOperationGroupOperations + :ivar virtual_machine_run_commands_operation_group: + VirtualMachineRunCommandsOperationGroupOperations operations + :vartype virtual_machine_run_commands_operation_group: + azure.mgmt.compute.aio.operations.VirtualMachineRunCommandsOperationGroupOperations + :ivar disks: DisksOperations operations + :vartype disks: azure.mgmt.compute.aio.operations.DisksOperations :ivar disk_accesses: DiskAccessesOperations operations :vartype disk_accesses: azure.mgmt.compute.aio.operations.DiskAccessesOperations + :ivar private_endpoint_connections: PrivateEndpointConnectionsOperations operations + :vartype private_endpoint_connections: + azure.mgmt.compute.aio.operations.PrivateEndpointConnectionsOperations :ivar disk_encryption_sets: DiskEncryptionSetsOperations operations :vartype disk_encryption_sets: azure.mgmt.compute.aio.operations.DiskEncryptionSetsOperations - :ivar disks: DisksOperations operations - :vartype disks: azure.mgmt.compute.aio.operations.DisksOperations + :ivar disk_restore_points: DiskRestorePointsOperations operations + :vartype disk_restore_points: azure.mgmt.compute.aio.operations.DiskRestorePointsOperations :ivar snapshots: SnapshotsOperations operations :vartype snapshots: azure.mgmt.compute.aio.operations.SnapshotsOperations - :ivar disk_restore_point: DiskRestorePointOperations operations - :vartype disk_restore_point: azure.mgmt.compute.aio.operations.DiskRestorePointOperations - :ivar resource_skus: ResourceSkusOperations operations - :vartype resource_skus: azure.mgmt.compute.aio.operations.ResourceSkusOperations :ivar galleries: GalleriesOperations operations :vartype galleries: azure.mgmt.compute.aio.operations.GalleriesOperations - :ivar community_galleries: CommunityGalleriesOperations operations - :vartype community_galleries: azure.mgmt.compute.aio.operations.CommunityGalleriesOperations - :ivar community_gallery_images: CommunityGalleryImagesOperations operations - :vartype community_gallery_images: - azure.mgmt.compute.aio.operations.CommunityGalleryImagesOperations - :ivar community_gallery_image_versions: CommunityGalleryImageVersionsOperations operations - :vartype community_gallery_image_versions: - azure.mgmt.compute.aio.operations.CommunityGalleryImageVersionsOperations - :ivar shared_galleries: SharedGalleriesOperations operations - :vartype shared_galleries: azure.mgmt.compute.aio.operations.SharedGalleriesOperations - :ivar shared_gallery_images: SharedGalleryImagesOperations operations - :vartype shared_gallery_images: azure.mgmt.compute.aio.operations.SharedGalleryImagesOperations - :ivar shared_gallery_image_versions: SharedGalleryImageVersionsOperations operations - :vartype shared_gallery_image_versions: - azure.mgmt.compute.aio.operations.SharedGalleryImageVersionsOperations - :ivar gallery_applications: GalleryApplicationsOperations operations - :vartype gallery_applications: azure.mgmt.compute.aio.operations.GalleryApplicationsOperations - :ivar gallery_application_versions: GalleryApplicationVersionsOperations operations - :vartype gallery_application_versions: - azure.mgmt.compute.aio.operations.GalleryApplicationVersionsOperations :ivar gallery_images: GalleryImagesOperations operations :vartype gallery_images: azure.mgmt.compute.aio.operations.GalleryImagesOperations :ivar gallery_image_versions: GalleryImageVersionsOperations operations :vartype gallery_image_versions: azure.mgmt.compute.aio.operations.GalleryImageVersionsOperations + :ivar gallery_applications: GalleryApplicationsOperations operations + :vartype gallery_applications: azure.mgmt.compute.aio.operations.GalleryApplicationsOperations + :ivar gallery_application_versions: GalleryApplicationVersionsOperations operations + :vartype gallery_application_versions: + azure.mgmt.compute.aio.operations.GalleryApplicationVersionsOperations :ivar gallery_in_vm_access_control_profiles: GalleryInVMAccessControlProfilesOperations operations :vartype gallery_in_vm_access_control_profiles: @@ -201,33 +199,35 @@ class ComputeManagementClient: # pylint: disable=client-accepts-api-version-key GalleryInVMAccessControlProfileVersionsOperations operations :vartype gallery_in_vm_access_control_profile_versions: azure.mgmt.compute.aio.operations.GalleryInVMAccessControlProfileVersionsOperations - :ivar gallery_sharing_profile: GallerySharingProfileOperations operations - :vartype gallery_sharing_profile: - azure.mgmt.compute.aio.operations.GallerySharingProfileOperations - :ivar soft_deleted_resource: SoftDeletedResourceOperations operations - :vartype soft_deleted_resource: azure.mgmt.compute.aio.operations.SoftDeletedResourceOperations - :ivar cloud_service_role_instances: CloudServiceRoleInstancesOperations operations - :vartype cloud_service_role_instances: - azure.mgmt.compute.aio.operations.CloudServiceRoleInstancesOperations - :ivar cloud_service_roles: CloudServiceRolesOperations operations - :vartype cloud_service_roles: azure.mgmt.compute.aio.operations.CloudServiceRolesOperations - :ivar cloud_services: CloudServicesOperations operations - :vartype cloud_services: azure.mgmt.compute.aio.operations.CloudServicesOperations - :ivar cloud_services_update_domain: CloudServicesUpdateDomainOperations operations - :vartype cloud_services_update_domain: - azure.mgmt.compute.aio.operations.CloudServicesUpdateDomainOperations - :ivar cloud_service_operating_systems: CloudServiceOperatingSystemsOperations operations - :vartype cloud_service_operating_systems: - azure.mgmt.compute.aio.operations.CloudServiceOperatingSystemsOperations - :param credential: Credential needed for the client to connect to Azure. Required. + :ivar shared_galleries: SharedGalleriesOperations operations + :vartype shared_galleries: azure.mgmt.compute.aio.operations.SharedGalleriesOperations + :ivar shared_gallery_images: SharedGalleryImagesOperations operations + :vartype shared_gallery_images: azure.mgmt.compute.aio.operations.SharedGalleryImagesOperations + :ivar shared_gallery_image_versions: SharedGalleryImageVersionsOperations operations + :vartype shared_gallery_image_versions: + azure.mgmt.compute.aio.operations.SharedGalleryImageVersionsOperations + :ivar community_galleries: CommunityGalleriesOperations operations + :vartype community_galleries: azure.mgmt.compute.aio.operations.CommunityGalleriesOperations + :ivar community_gallery_images: CommunityGalleryImagesOperations operations + :vartype community_gallery_images: + azure.mgmt.compute.aio.operations.CommunityGalleryImagesOperations + :ivar community_gallery_image_versions: CommunityGalleryImageVersionsOperations operations + :vartype community_gallery_image_versions: + azure.mgmt.compute.aio.operations.CommunityGalleryImageVersionsOperations + :ivar resource_skus: ResourceSkusOperations operations + :vartype resource_skus: azure.mgmt.compute.aio.operations.ResourceSkusOperations + :param credential: Credential used to authenticate requests to the service. Required. :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param subscription_id: The ID of the target subscription. Required. + :param subscription_id: The ID of the target subscription. The value must be an UUID. Required. :type subscription_id: str - :param base_url: Service URL. Default value is None. + :param base_url: Service host. Default value is None. :type base_url: str :keyword cloud_setting: The cloud setting for which to get the ARM endpoint. Default value is None. :paramtype cloud_setting: ~azure.core.AzureClouds + :keyword api_version: The API version to use for this operation. Default value is "2025-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. """ @@ -241,14 +241,16 @@ def __init__( cloud_setting: Optional["AzureClouds"] = None, **kwargs: Any ) -> None: + _endpoint = "{endpoint}" _cloud = cloud_setting or settings.current.azure_cloud # type: ignore _endpoints = get_arm_endpoints(_cloud) if not base_url: base_url = _endpoints["resource_manager"] credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) - self._config = ComputeManagementClientConfiguration( + self._config = ComputeClientConfiguration( credential=credential, subscription_id=subscription_id, + base_url=cast(str, base_url), cloud_setting=cloud_setting, credential_scopes=credential_scopes, **kwargs @@ -273,143 +275,141 @@ def __init__( self._config.http_logging_policy, ] self._client: AsyncARMPipelineClient = AsyncARMPipelineClient( - base_url=cast(str, base_url), policies=_policies, **kwargs + base_url=cast(str, _endpoint), policies=_policies, **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 = Serializer() + self._deserialize = Deserializer() self._serialize.client_side_validation = False self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) - self.availability_sets = AvailabilitySetsOperations( + self.virtual_machine_scale_sets = VirtualMachineScaleSetsOperations( self._client, self._config, self._serialize, self._deserialize ) - self.capacity_reservation_groups = CapacityReservationGroupsOperations( + self.rolling_upgrade_status_infos = RollingUpgradeStatusInfosOperations( self._client, self._config, self._serialize, self._deserialize ) - self.dedicated_host_groups = DedicatedHostGroupsOperations( - self._client, self._config, self._serialize, self._deserialize - ) - self.images = ImagesOperations(self._client, self._config, self._serialize, self._deserialize) - self.virtual_machine_images_edge_zone = VirtualMachineImagesEdgeZoneOperations( + self.virtual_machine_scale_set_extensions = VirtualMachineScaleSetExtensionsOperations( self._client, self._config, self._serialize, self._deserialize ) - self.virtual_machine_images = VirtualMachineImagesOperations( + self.virtual_machine_scale_set_vms = VirtualMachineScaleSetVMSOperations( self._client, self._config, self._serialize, self._deserialize ) - self.log_analytics = LogAnalyticsOperations(self._client, self._config, self._serialize, self._deserialize) - self.virtual_machine_extension_images = VirtualMachineExtensionImagesOperations( + self.virtual_machine_scale_set_vm_extensions = VirtualMachineScaleSetVMExtensionsOperations( self._client, self._config, self._serialize, self._deserialize ) - self.virtual_machine_run_commands = VirtualMachineRunCommandsOperations( + self.virtual_machines = VirtualMachinesOperations( self._client, self._config, self._serialize, self._deserialize ) - self.usage = UsageOperations(self._client, self._config, self._serialize, self._deserialize) - self.virtual_machine_scale_sets = VirtualMachineScaleSetsOperations( + self.virtual_machine_extensions = VirtualMachineExtensionsOperations( self._client, self._config, self._serialize, self._deserialize ) - self.virtual_machines = VirtualMachinesOperations( + self.virtual_machine_extension_images = VirtualMachineExtensionImagesOperations( self._client, self._config, self._serialize, self._deserialize ) - self.virtual_machine_sizes = VirtualMachineSizesOperations( + 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.restore_point_collections = RestorePointCollectionsOperations( + self.dedicated_host_groups = DedicatedHostGroupsOperations( self._client, self._config, self._serialize, self._deserialize ) - self.ssh_public_keys = SshPublicKeysOperations(self._client, self._config, self._serialize, self._deserialize) - self.capacity_reservations = CapacityReservationsOperations( + self.dedicated_hosts = DedicatedHostsOperations(self._client, self._config, self._serialize, self._deserialize) + self.ssh_public_key_resources = SshPublicKeyResourcesOperations( self._client, self._config, self._serialize, self._deserialize ) - self.dedicated_hosts = DedicatedHostsOperations(self._client, self._config, self._serialize, self._deserialize) - self.restore_points = RestorePointsOperations(self._client, self._config, self._serialize, self._deserialize) - self.virtual_machine_scale_set_rolling_upgrades = VirtualMachineScaleSetRollingUpgradesOperations( + 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.virtual_machine_scale_set_extensions = VirtualMachineScaleSetExtensionsOperations( + 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.virtual_machine_scale_set_vms = VirtualMachineScaleSetVMsOperations( + self.capacity_reservations = CapacityReservationsOperations( self._client, self._config, self._serialize, self._deserialize ) - self.virtual_machine_scale_set_vm_extensions = VirtualMachineScaleSetVMExtensionsOperations( + self.virtual_machine_run_commands = VirtualMachineRunCommandsOperations( self._client, self._config, self._serialize, self._deserialize ) self.virtual_machine_scale_set_vm_run_commands = VirtualMachineScaleSetVMRunCommandsOperations( self._client, self._config, self._serialize, self._deserialize ) - self.virtual_machine_extensions = VirtualMachineExtensionsOperations( + self.usage_operation_group = UsageOperationGroupOperations( self._client, self._config, self._serialize, self._deserialize ) - self.disk_accesses = DiskAccessesOperations(self._client, self._config, self._serialize, self._deserialize) - self.disk_encryption_sets = DiskEncryptionSetsOperations( + self.virtual_machine_sizes_operation_group = VirtualMachineSizesOperationGroupOperations( self._client, self._config, self._serialize, self._deserialize ) - self.disks = DisksOperations(self._client, self._config, self._serialize, self._deserialize) - self.snapshots = SnapshotsOperations(self._client, self._config, self._serialize, self._deserialize) - self.disk_restore_point = DiskRestorePointOperations( + self.virtual_machine_scale_sets_operation_group = VirtualMachineScaleSetsOperationGroupOperations( self._client, self._config, self._serialize, self._deserialize ) - self.resource_skus = ResourceSkusOperations(self._client, self._config, self._serialize, self._deserialize) - self.galleries = GalleriesOperations(self._client, self._config, self._serialize, self._deserialize) - self.community_galleries = CommunityGalleriesOperations( + self.virtual_machines_operation_group = VirtualMachinesOperationGroupOperations( self._client, self._config, self._serialize, self._deserialize ) - self.community_gallery_images = CommunityGalleryImagesOperations( + self.virtual_machine_images_edge_zone_operation_group = VirtualMachineImagesEdgeZoneOperationGroupOperations( self._client, self._config, self._serialize, self._deserialize ) - self.community_gallery_image_versions = CommunityGalleryImageVersionsOperations( + self.virtual_machine_images_operation_group = VirtualMachineImagesOperationGroupOperations( self._client, self._config, self._serialize, self._deserialize ) - self.shared_galleries = SharedGalleriesOperations( + self.log_analytics_operation_group = LogAnalyticsOperationGroupOperations( self._client, self._config, self._serialize, self._deserialize ) - self.shared_gallery_images = SharedGalleryImagesOperations( + self.virtual_machine_run_commands_operation_group = VirtualMachineRunCommandsOperationGroupOperations( self._client, self._config, self._serialize, self._deserialize ) - self.shared_gallery_image_versions = SharedGalleryImageVersionsOperations( + self.disks = DisksOperations(self._client, self._config, self._serialize, self._deserialize) + self.disk_accesses = DiskAccessesOperations(self._client, self._config, self._serialize, self._deserialize) + self.private_endpoint_connections = PrivateEndpointConnectionsOperations( self._client, self._config, self._serialize, self._deserialize ) - self.gallery_applications = GalleryApplicationsOperations( + self.disk_encryption_sets = DiskEncryptionSetsOperations( self._client, self._config, self._serialize, self._deserialize ) - self.gallery_application_versions = GalleryApplicationVersionsOperations( + self.disk_restore_points = DiskRestorePointsOperations( self._client, self._config, self._serialize, self._deserialize ) + self.snapshots = SnapshotsOperations(self._client, self._config, self._serialize, self._deserialize) + self.galleries = GalleriesOperations(self._client, self._config, self._serialize, self._deserialize) self.gallery_images = GalleryImagesOperations(self._client, self._config, self._serialize, self._deserialize) self.gallery_image_versions = GalleryImageVersionsOperations( self._client, self._config, self._serialize, self._deserialize ) + self.gallery_applications = GalleryApplicationsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.gallery_application_versions = GalleryApplicationVersionsOperations( + self._client, self._config, self._serialize, self._deserialize + ) self.gallery_in_vm_access_control_profiles = GalleryInVMAccessControlProfilesOperations( self._client, self._config, self._serialize, self._deserialize ) self.gallery_in_vm_access_control_profile_versions = GalleryInVMAccessControlProfileVersionsOperations( self._client, self._config, self._serialize, self._deserialize ) - self.gallery_sharing_profile = GallerySharingProfileOperations( + self.shared_galleries = SharedGalleriesOperations( self._client, self._config, self._serialize, self._deserialize ) - self.soft_deleted_resource = SoftDeletedResourceOperations( + self.shared_gallery_images = SharedGalleryImagesOperations( self._client, self._config, self._serialize, self._deserialize ) - self.cloud_service_role_instances = CloudServiceRoleInstancesOperations( + self.shared_gallery_image_versions = SharedGalleryImageVersionsOperations( self._client, self._config, self._serialize, self._deserialize ) - self.cloud_service_roles = CloudServiceRolesOperations( + self.community_galleries = CommunityGalleriesOperations( self._client, self._config, self._serialize, self._deserialize ) - self.cloud_services = CloudServicesOperations(self._client, self._config, self._serialize, self._deserialize) - self.cloud_services_update_domain = CloudServicesUpdateDomainOperations( + self.community_gallery_images = CommunityGalleryImagesOperations( self._client, self._config, self._serialize, self._deserialize ) - self.cloud_service_operating_systems = CloudServiceOperatingSystemsOperations( + self.community_gallery_image_versions = CommunityGalleryImageVersionsOperations( self._client, self._config, self._serialize, self._deserialize ) + self.resource_skus = ResourceSkusOperations(self._client, self._config, self._serialize, self._deserialize) - def _send_request( + def send_request( self, request: HttpRequest, *, stream: bool = False, **kwargs: Any ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. @@ -417,7 +417,7 @@ def _send_request( >>> from azure.core.rest import HttpRequest >>> request = HttpRequest("GET", "https://www.example.org/") - >>> response = await client._send_request(request) + >>> response = await client.send_request(request) For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request @@ -430,7 +430,11 @@ def _send_request( """ request_copy = deepcopy(request) - request_copy.url = self._client.format_url(request_copy.url) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + request_copy.url = self._client.format_url(request_copy.url, **path_format_arguments) return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore async def close(self) -> None: diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/_configuration.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/_configuration.py index 3bec9346bc19..636df552acb0 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/_configuration.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/_configuration.py @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -18,28 +18,36 @@ from azure.core.credentials_async import AsyncTokenCredential -class ComputeManagementClientConfiguration: # pylint: disable=too-many-instance-attributes - """Configuration for ComputeManagementClient. +class ComputeClientConfiguration: # pylint: disable=too-many-instance-attributes + """Configuration for ComputeClient. 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. Required. + :param credential: Credential used to authenticate requests to the service. Required. :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param subscription_id: The ID of the target subscription. Required. + :param subscription_id: The ID of the target subscription. The value must be an UUID. Required. :type subscription_id: str + :param base_url: Service host. Default value is "https://management.azure.com". + :type base_url: str :param cloud_setting: The cloud setting for which to get the ARM endpoint. Default value is None. :type cloud_setting: ~azure.core.AzureClouds + :keyword api_version: The API version to use for this operation. Default value is "2025-04-01". + Note that overriding this default value may result in unsupported behavior. + :paramtype api_version: str """ def __init__( self, credential: "AsyncTokenCredential", subscription_id: str, + base_url: str = "https://management.azure.com", cloud_setting: Optional["AzureClouds"] = None, **kwargs: Any ) -> None: + api_version: str = kwargs.pop("api_version", "2025-04-01") + if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: @@ -47,7 +55,9 @@ def __init__( self.credential = credential self.subscription_id = subscription_id + self.base_url = base_url self.cloud_setting = cloud_setting + 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.polling_interval = kwargs.get("polling_interval", 30) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/_patch.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/_patch.py index 8bcb627aa475..87676c65a8f0 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/_patch.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/_patch.py @@ -7,9 +7,9 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/operations/__init__.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/operations/__init__.py index 1526f7d90f57..e7c7e55a0228 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/operations/__init__.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/operations/__init__.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- # pylint: disable=wrong-import-position @@ -14,57 +13,54 @@ from ._patch import * # pylint: disable=unused-wildcard-import from ._operations import Operations # type: ignore -from ._availability_sets_operations import AvailabilitySetsOperations # type: ignore -from ._capacity_reservation_groups_operations import CapacityReservationGroupsOperations # type: ignore -from ._dedicated_host_groups_operations import DedicatedHostGroupsOperations # type: ignore -from ._images_operations import ImagesOperations # type: ignore -from ._virtual_machine_images_edge_zone_operations import VirtualMachineImagesEdgeZoneOperations # type: ignore -from ._virtual_machine_images_operations import VirtualMachineImagesOperations # type: ignore -from ._log_analytics_operations import LogAnalyticsOperations # type: ignore -from ._virtual_machine_extension_images_operations import VirtualMachineExtensionImagesOperations # type: ignore -from ._virtual_machine_run_commands_operations import VirtualMachineRunCommandsOperations # type: ignore -from ._usage_operations import UsageOperations # type: ignore -from ._virtual_machine_scale_sets_operations import VirtualMachineScaleSetsOperations # type: ignore -from ._virtual_machines_operations import VirtualMachinesOperations # type: ignore -from ._virtual_machine_sizes_operations import VirtualMachineSizesOperations # type: ignore -from ._proximity_placement_groups_operations import ProximityPlacementGroupsOperations # type: ignore -from ._restore_point_collections_operations import RestorePointCollectionsOperations # type: ignore -from ._ssh_public_keys_operations import SshPublicKeysOperations # type: ignore -from ._capacity_reservations_operations import CapacityReservationsOperations # type: ignore -from ._dedicated_hosts_operations import DedicatedHostsOperations # type: ignore -from ._restore_points_operations import RestorePointsOperations # type: ignore -from ._virtual_machine_scale_set_rolling_upgrades_operations import VirtualMachineScaleSetRollingUpgradesOperations # type: ignore -from ._virtual_machine_scale_set_extensions_operations import VirtualMachineScaleSetExtensionsOperations # type: ignore -from ._virtual_machine_scale_set_vms_operations import VirtualMachineScaleSetVMsOperations # type: ignore -from ._virtual_machine_scale_set_vm_extensions_operations import VirtualMachineScaleSetVMExtensionsOperations # type: ignore -from ._virtual_machine_scale_set_vm_run_commands_operations import VirtualMachineScaleSetVMRunCommandsOperations # type: ignore -from ._virtual_machine_extensions_operations import VirtualMachineExtensionsOperations # type: ignore -from ._disk_accesses_operations import DiskAccessesOperations # type: ignore -from ._disk_encryption_sets_operations import DiskEncryptionSetsOperations # type: ignore -from ._disks_operations import DisksOperations # type: ignore -from ._snapshots_operations import SnapshotsOperations # type: ignore -from ._disk_restore_point_operations import DiskRestorePointOperations # type: ignore -from ._resource_skus_operations import ResourceSkusOperations # type: ignore -from ._galleries_operations import GalleriesOperations # type: ignore -from ._community_galleries_operations import CommunityGalleriesOperations # type: ignore -from ._community_gallery_images_operations import CommunityGalleryImagesOperations # type: ignore -from ._community_gallery_image_versions_operations import CommunityGalleryImageVersionsOperations # type: ignore -from ._shared_galleries_operations import SharedGalleriesOperations # type: ignore -from ._shared_gallery_images_operations import SharedGalleryImagesOperations # type: ignore -from ._shared_gallery_image_versions_operations import SharedGalleryImageVersionsOperations # type: ignore -from ._gallery_applications_operations import GalleryApplicationsOperations # type: ignore -from ._gallery_application_versions_operations import GalleryApplicationVersionsOperations # type: ignore -from ._gallery_images_operations import GalleryImagesOperations # type: ignore -from ._gallery_image_versions_operations import GalleryImageVersionsOperations # type: ignore -from ._gallery_in_vm_access_control_profiles_operations import GalleryInVMAccessControlProfilesOperations # type: ignore -from ._gallery_in_vm_access_control_profile_versions_operations import GalleryInVMAccessControlProfileVersionsOperations # type: ignore -from ._gallery_sharing_profile_operations import GallerySharingProfileOperations # type: ignore -from ._soft_deleted_resource_operations import SoftDeletedResourceOperations # type: ignore -from ._cloud_service_role_instances_operations import CloudServiceRoleInstancesOperations # type: ignore -from ._cloud_service_roles_operations import CloudServiceRolesOperations # type: ignore -from ._cloud_services_operations import CloudServicesOperations # type: ignore -from ._cloud_services_update_domain_operations import CloudServicesUpdateDomainOperations # type: ignore -from ._cloud_service_operating_systems_operations import CloudServiceOperatingSystemsOperations # type: ignore +from ._operations import VirtualMachineScaleSetsOperations # type: ignore +from ._operations import RollingUpgradeStatusInfosOperations # type: ignore +from ._operations import VirtualMachineScaleSetExtensionsOperations # type: ignore +from ._operations import VirtualMachineScaleSetVMSOperations # type: ignore +from ._operations import VirtualMachineScaleSetVMExtensionsOperations # type: ignore +from ._operations import VirtualMachinesOperations # type: ignore +from ._operations import VirtualMachineExtensionsOperations # type: ignore +from ._operations import VirtualMachineExtensionImagesOperations # type: ignore +from ._operations import AvailabilitySetsOperations # type: ignore +from ._operations import ProximityPlacementGroupsOperations # type: ignore +from ._operations import DedicatedHostGroupsOperations # type: ignore +from ._operations import DedicatedHostsOperations # type: ignore +from ._operations import SshPublicKeyResourcesOperations # type: ignore +from ._operations import ImagesOperations # type: ignore +from ._operations import RestorePointCollectionsOperations # type: ignore +from ._operations import RestorePointsOperations # type: ignore +from ._operations import CapacityReservationGroupsOperations # type: ignore +from ._operations import CapacityReservationsOperations # type: ignore +from ._operations import VirtualMachineRunCommandsOperations # type: ignore +from ._operations import VirtualMachineScaleSetVMRunCommandsOperations # type: ignore +from ._operations import UsageOperationGroupOperations # type: ignore +from ._operations import VirtualMachineSizesOperationGroupOperations # type: ignore +from ._operations import VirtualMachineScaleSetsOperationGroupOperations # type: ignore +from ._operations import VirtualMachinesOperationGroupOperations # type: ignore +from ._operations import VirtualMachineImagesEdgeZoneOperationGroupOperations # type: ignore +from ._operations import VirtualMachineImagesOperationGroupOperations # type: ignore +from ._operations import LogAnalyticsOperationGroupOperations # type: ignore +from ._operations import VirtualMachineRunCommandsOperationGroupOperations # type: ignore +from ._operations import DisksOperations # type: ignore +from ._operations import DiskAccessesOperations # type: ignore +from ._operations import PrivateEndpointConnectionsOperations # type: ignore +from ._operations import DiskEncryptionSetsOperations # type: ignore +from ._operations import DiskRestorePointsOperations # type: ignore +from ._operations import SnapshotsOperations # type: ignore +from ._operations import GalleriesOperations # type: ignore +from ._operations import GalleryImagesOperations # type: ignore +from ._operations import GalleryImageVersionsOperations # type: ignore +from ._operations import GalleryApplicationsOperations # type: ignore +from ._operations import GalleryApplicationVersionsOperations # type: ignore +from ._operations import GalleryInVMAccessControlProfilesOperations # type: ignore +from ._operations import GalleryInVMAccessControlProfileVersionsOperations # type: ignore +from ._operations import SharedGalleriesOperations # type: ignore +from ._operations import SharedGalleryImagesOperations # type: ignore +from ._operations import SharedGalleryImageVersionsOperations # type: ignore +from ._operations import CommunityGalleriesOperations # type: ignore +from ._operations import CommunityGalleryImagesOperations # type: ignore +from ._operations import CommunityGalleryImageVersionsOperations # type: ignore +from ._operations import ResourceSkusOperations # type: ignore from ._patch import __all__ as _patch_all from ._patch import * @@ -72,57 +68,54 @@ __all__ = [ "Operations", - "AvailabilitySetsOperations", - "CapacityReservationGroupsOperations", - "DedicatedHostGroupsOperations", - "ImagesOperations", - "VirtualMachineImagesEdgeZoneOperations", - "VirtualMachineImagesOperations", - "LogAnalyticsOperations", - "VirtualMachineExtensionImagesOperations", - "VirtualMachineRunCommandsOperations", - "UsageOperations", "VirtualMachineScaleSetsOperations", + "RollingUpgradeStatusInfosOperations", + "VirtualMachineScaleSetExtensionsOperations", + "VirtualMachineScaleSetVMSOperations", + "VirtualMachineScaleSetVMExtensionsOperations", "VirtualMachinesOperations", - "VirtualMachineSizesOperations", + "VirtualMachineExtensionsOperations", + "VirtualMachineExtensionImagesOperations", + "AvailabilitySetsOperations", "ProximityPlacementGroupsOperations", - "RestorePointCollectionsOperations", - "SshPublicKeysOperations", - "CapacityReservationsOperations", + "DedicatedHostGroupsOperations", "DedicatedHostsOperations", + "SshPublicKeyResourcesOperations", + "ImagesOperations", + "RestorePointCollectionsOperations", "RestorePointsOperations", - "VirtualMachineScaleSetRollingUpgradesOperations", - "VirtualMachineScaleSetExtensionsOperations", - "VirtualMachineScaleSetVMsOperations", - "VirtualMachineScaleSetVMExtensionsOperations", + "CapacityReservationGroupsOperations", + "CapacityReservationsOperations", + "VirtualMachineRunCommandsOperations", "VirtualMachineScaleSetVMRunCommandsOperations", - "VirtualMachineExtensionsOperations", + "UsageOperationGroupOperations", + "VirtualMachineSizesOperationGroupOperations", + "VirtualMachineScaleSetsOperationGroupOperations", + "VirtualMachinesOperationGroupOperations", + "VirtualMachineImagesEdgeZoneOperationGroupOperations", + "VirtualMachineImagesOperationGroupOperations", + "LogAnalyticsOperationGroupOperations", + "VirtualMachineRunCommandsOperationGroupOperations", + "DisksOperations", "DiskAccessesOperations", + "PrivateEndpointConnectionsOperations", "DiskEncryptionSetsOperations", - "DisksOperations", + "DiskRestorePointsOperations", "SnapshotsOperations", - "DiskRestorePointOperations", - "ResourceSkusOperations", "GalleriesOperations", - "CommunityGalleriesOperations", - "CommunityGalleryImagesOperations", - "CommunityGalleryImageVersionsOperations", - "SharedGalleriesOperations", - "SharedGalleryImagesOperations", - "SharedGalleryImageVersionsOperations", - "GalleryApplicationsOperations", - "GalleryApplicationVersionsOperations", "GalleryImagesOperations", "GalleryImageVersionsOperations", + "GalleryApplicationsOperations", + "GalleryApplicationVersionsOperations", "GalleryInVMAccessControlProfilesOperations", "GalleryInVMAccessControlProfileVersionsOperations", - "GallerySharingProfileOperations", - "SoftDeletedResourceOperations", - "CloudServiceRoleInstancesOperations", - "CloudServiceRolesOperations", - "CloudServicesOperations", - "CloudServicesUpdateDomainOperations", - "CloudServiceOperatingSystemsOperations", + "SharedGalleriesOperations", + "SharedGalleryImagesOperations", + "SharedGalleryImageVersionsOperations", + "CommunityGalleriesOperations", + "CommunityGalleryImagesOperations", + "CommunityGalleryImageVersionsOperations", + "ResourceSkusOperations", ] __all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/operations/_availability_sets_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/operations/_availability_sets_operations.py deleted file mode 100644 index 14b59641da40..000000000000 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/operations/_availability_sets_operations.py +++ /dev/null @@ -1,1167 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from collections.abc import MutableMapping -from io import IOBase -from typing import Any, AsyncIterator, Callable, IO, Optional, TypeVar, Union, cast, overload - -from azure.core import AsyncPipelineClient -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - StreamClosedError, - StreamConsumedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ..._utils.serialization import Deserializer, Serializer -from ...operations._availability_sets_operations import ( - build_cancel_migration_to_virtual_machine_scale_set_request, - build_convert_to_virtual_machine_scale_set_request, - 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_start_migration_to_virtual_machine_scale_set_request, - build_update_request, - build_validate_migration_to_virtual_machine_scale_set_request, -) -from .._configuration import ComputeManagementClientConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] -List = list - - -class AvailabilitySetsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.compute.aio.ComputeManagementClient`'s - :attr:`availability_sets` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list_by_subscription( - self, expand: Optional[str] = None, **kwargs: Any - ) -> AsyncItemPaged["_models.AvailabilitySet"]: - """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 - :return: An iterator like instance of either AvailabilitySet or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.models.AvailabilitySet] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[_models.AvailabilitySetListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_by_subscription_request( - subscription_id=self._config.subscription_id, - expand=expand, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - _request = HttpRequest("GET", next_link) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @distributed_trace - def list(self, resource_group_name: str, **kwargs: Any) -> AsyncItemPaged["_models.AvailabilitySet"]: - """Lists all availability sets in a resource group. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :return: An iterator like instance of either AvailabilitySet or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.models.AvailabilitySet] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[_models.AvailabilitySetListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - _request = HttpRequest("GET", next_link) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @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. The name is case insensitive. - Required. - :type resource_group_name: str - :param availability_set_name: The name of the availability set. Required. - :type availability_set_name: str - :return: AvailabilitySet or the result of cls(response) - :rtype: ~azure.mgmt.compute.models.AvailabilitySet - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[_models.AvailabilitySet] = kwargs.pop("cls", None) - - _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, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("AvailabilitySet", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def create_or_update( - self, - resource_group_name: str, - availability_set_name: str, - parameters: _models.AvailabilitySet, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.AvailabilitySet: - """Create or update an availability set. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param availability_set_name: The name of the availability set. Required. - :type availability_set_name: str - :param parameters: Parameters supplied to the Create Availability Set operation. Required. - :type parameters: ~azure.mgmt.compute.models.AvailabilitySet - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: AvailabilitySet or the result of cls(response) - :rtype: ~azure.mgmt.compute.models.AvailabilitySet - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def create_or_update( - self, - resource_group_name: str, - availability_set_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.AvailabilitySet: - """Create or update an availability set. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param availability_set_name: The name of the availability set. Required. - :type availability_set_name: str - :param parameters: Parameters supplied to the Create Availability Set operation. Required. - :type parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: AvailabilitySet or the result of cls(response) - :rtype: ~azure.mgmt.compute.models.AvailabilitySet - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def create_or_update( - self, - resource_group_name: str, - availability_set_name: str, - parameters: Union[_models.AvailabilitySet, IO[bytes]], - **kwargs: Any - ) -> _models.AvailabilitySet: - """Create or update an availability set. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param availability_set_name: The name of the availability set. Required. - :type availability_set_name: str - :param parameters: Parameters supplied to the Create Availability Set operation. Is either a - AvailabilitySet type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.compute.models.AvailabilitySet or IO[bytes] - :return: AvailabilitySet or the result of cls(response) - :rtype: ~azure.mgmt.compute.models.AvailabilitySet - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AvailabilitySet] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _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, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("AvailabilitySet", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def update( - self, - resource_group_name: str, - availability_set_name: str, - parameters: _models.AvailabilitySetUpdate, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.AvailabilitySet: - """Update an availability set. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param availability_set_name: The name of the availability set. Required. - :type availability_set_name: str - :param parameters: Parameters supplied to the Update Availability Set operation. Required. - :type parameters: ~azure.mgmt.compute.models.AvailabilitySetUpdate - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: AvailabilitySet or the result of cls(response) - :rtype: ~azure.mgmt.compute.models.AvailabilitySet - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def update( - self, - resource_group_name: str, - availability_set_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.AvailabilitySet: - """Update an availability set. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param availability_set_name: The name of the availability set. Required. - :type availability_set_name: str - :param parameters: Parameters supplied to the Update Availability Set operation. Required. - :type parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: AvailabilitySet or the result of cls(response) - :rtype: ~azure.mgmt.compute.models.AvailabilitySet - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def update( - self, - resource_group_name: str, - availability_set_name: str, - parameters: Union[_models.AvailabilitySetUpdate, IO[bytes]], - **kwargs: Any - ) -> _models.AvailabilitySet: - """Update an availability set. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param availability_set_name: The name of the availability set. Required. - :type availability_set_name: str - :param parameters: Parameters supplied to the Update Availability Set operation. Is either a - AvailabilitySetUpdate type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.compute.models.AvailabilitySetUpdate or IO[bytes] - :return: AvailabilitySet or the result of cls(response) - :rtype: ~azure.mgmt.compute.models.AvailabilitySet - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AvailabilitySet] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _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, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("AvailabilitySet", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def delete(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. The name is case insensitive. - Required. - :type resource_group_name: str - :param availability_set_name: The name of the availability set. Required. - :type availability_set_name: str - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - - _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, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 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, {}) # type: ignore - - @distributed_trace_async - async def cancel_migration_to_virtual_machine_scale_set( # pylint: disable=name-too-long - self, resource_group_name: str, availability_set_name: str, **kwargs: Any - ) -> None: - """Cancel the migration operation on an Availability Set. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param availability_set_name: The name of the availability set. Required. - :type availability_set_name: str - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_cancel_migration_to_virtual_machine_scale_set_request( - resource_group_name=resource_group_name, - availability_set_name=availability_set_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [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, {}) # type: ignore - - async def _convert_to_virtual_machine_scale_set_initial( # pylint: disable=name-too-long - self, - resource_group_name: str, - availability_set_name: str, - parameters: Optional[Union[_models.ConvertToVirtualMachineScaleSetInput, IO[bytes]]] = None, - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - content_type = content_type if parameters else None - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" if parameters else None - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - if parameters is not None: - _json = self._serialize.body(parameters, "ConvertToVirtualMachineScaleSetInput") - else: - _json = None - - _request = build_convert_to_virtual_machine_scale_set_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, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [202]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_convert_to_virtual_machine_scale_set( # pylint: disable=name-too-long - self, - resource_group_name: str, - availability_set_name: str, - parameters: Optional[_models.ConvertToVirtualMachineScaleSetInput] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Create a new Flexible Virtual Machine Scale Set and migrate all the Virtual Machines in the - Availability Set. This does not trigger a downtime on the Virtual Machines. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param availability_set_name: The name of the availability set. Required. - :type availability_set_name: str - :param parameters: Parameters supplied to the migrate operation on the availability set. - Default value is None. - :type parameters: ~azure.mgmt.compute.models.ConvertToVirtualMachineScaleSetInput - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_convert_to_virtual_machine_scale_set( # pylint: disable=name-too-long - self, - resource_group_name: str, - availability_set_name: str, - parameters: Optional[IO[bytes]] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Create a new Flexible Virtual Machine Scale Set and migrate all the Virtual Machines in the - Availability Set. This does not trigger a downtime on the Virtual Machines. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param availability_set_name: The name of the availability set. Required. - :type availability_set_name: str - :param parameters: Parameters supplied to the migrate operation on the availability set. - Default value is None. - :type parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_convert_to_virtual_machine_scale_set( # pylint: disable=name-too-long - self, - resource_group_name: str, - availability_set_name: str, - parameters: Optional[Union[_models.ConvertToVirtualMachineScaleSetInput, IO[bytes]]] = None, - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Create a new Flexible Virtual Machine Scale Set and migrate all the Virtual Machines in the - Availability Set. This does not trigger a downtime on the Virtual Machines. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param availability_set_name: The name of the availability set. Required. - :type availability_set_name: str - :param parameters: Parameters supplied to the migrate operation on the availability set. Is - either a ConvertToVirtualMachineScaleSetInput type or a IO[bytes] type. Default value is None. - :type parameters: ~azure.mgmt.compute.models.ConvertToVirtualMachineScaleSetInput or IO[bytes] - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - content_type = content_type if parameters else None - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._convert_to_virtual_machine_scale_set_initial( - resource_group_name=resource_group_name, - availability_set_name=availability_set_name, - parameters=parameters, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @overload - async def start_migration_to_virtual_machine_scale_set( # pylint: disable=name-too-long - self, - resource_group_name: str, - availability_set_name: str, - parameters: _models.MigrateToVirtualMachineScaleSetInput, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> None: - """Start migration operation on an Availability Set to move its Virtual Machines to a Virtual - Machine Scale Set. This should be followed by a migrate operation on each Virtual Machine that - triggers a downtime on the Virtual Machine. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param availability_set_name: The name of the availability set. Required. - :type availability_set_name: str - :param parameters: Parameters supplied to the migrate operation on the availability set. - Required. - :type parameters: ~azure.mgmt.compute.models.MigrateToVirtualMachineScaleSetInput - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def start_migration_to_virtual_machine_scale_set( # pylint: disable=name-too-long - self, - resource_group_name: str, - availability_set_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> None: - """Start migration operation on an Availability Set to move its Virtual Machines to a Virtual - Machine Scale Set. This should be followed by a migrate operation on each Virtual Machine that - triggers a downtime on the Virtual Machine. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param availability_set_name: The name of the availability set. Required. - :type availability_set_name: str - :param parameters: Parameters supplied to the migrate operation on the availability set. - Required. - :type parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def start_migration_to_virtual_machine_scale_set( # pylint: disable=name-too-long - self, - resource_group_name: str, - availability_set_name: str, - parameters: Union[_models.MigrateToVirtualMachineScaleSetInput, IO[bytes]], - **kwargs: Any - ) -> None: - """Start migration operation on an Availability Set to move its Virtual Machines to a Virtual - Machine Scale Set. This should be followed by a migrate operation on each Virtual Machine that - triggers a downtime on the Virtual Machine. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param availability_set_name: The name of the availability set. Required. - :type availability_set_name: str - :param parameters: Parameters supplied to the migrate operation on the availability set. Is - either a MigrateToVirtualMachineScaleSetInput type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.compute.models.MigrateToVirtualMachineScaleSetInput or IO[bytes] - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "MigrateToVirtualMachineScaleSetInput") - - _request = build_start_migration_to_virtual_machine_scale_set_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, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [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, {}) # type: ignore - - @overload - async def validate_migration_to_virtual_machine_scale_set( # pylint: disable=name-too-long - self, - resource_group_name: str, - availability_set_name: str, - parameters: _models.MigrateToVirtualMachineScaleSetInput, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> None: - """Validates that the Virtual Machines in the Availability Set can be migrated to the provided - Virtual Machine Scale Set. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param availability_set_name: The name of the availability set. Required. - :type availability_set_name: str - :param parameters: Parameters supplied to the migrate operation on the availability set. - Required. - :type parameters: ~azure.mgmt.compute.models.MigrateToVirtualMachineScaleSetInput - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def validate_migration_to_virtual_machine_scale_set( # pylint: disable=name-too-long - self, - resource_group_name: str, - availability_set_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> None: - """Validates that the Virtual Machines in the Availability Set can be migrated to the provided - Virtual Machine Scale Set. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param availability_set_name: The name of the availability set. Required. - :type availability_set_name: str - :param parameters: Parameters supplied to the migrate operation on the availability set. - Required. - :type parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def validate_migration_to_virtual_machine_scale_set( # pylint: disable=name-too-long - self, - resource_group_name: str, - availability_set_name: str, - parameters: Union[_models.MigrateToVirtualMachineScaleSetInput, IO[bytes]], - **kwargs: Any - ) -> None: - """Validates that the Virtual Machines in the Availability Set can be migrated to the provided - Virtual Machine Scale Set. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param availability_set_name: The name of the availability set. Required. - :type availability_set_name: str - :param parameters: Parameters supplied to the migrate operation on the availability set. Is - either a MigrateToVirtualMachineScaleSetInput type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.compute.models.MigrateToVirtualMachineScaleSetInput or IO[bytes] - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "MigrateToVirtualMachineScaleSetInput") - - _request = build_validate_migration_to_virtual_machine_scale_set_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, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [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, {}) # type: ignore - - @distributed_trace - def list_available_sizes( - self, resource_group_name: str, availability_set_name: str, **kwargs: Any - ) -> AsyncItemPaged["_models.VirtualMachineSize"]: - """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. The name is case insensitive. - Required. - :type resource_group_name: str - :param availability_set_name: The name of the availability set. Required. - :type availability_set_name: str - :return: An iterator like instance of either VirtualMachineSize or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.models.VirtualMachineSize] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[_models.VirtualMachineSizeListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_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, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - _request = HttpRequest("GET", next_link) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/operations/_capacity_reservation_groups_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/operations/_capacity_reservation_groups_operations.py deleted file mode 100644 index 116d17c7d3ec..000000000000 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/operations/_capacity_reservation_groups_operations.py +++ /dev/null @@ -1,624 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from collections.abc import MutableMapping -from io import IOBase -from typing import Any, Callable, IO, Optional, TypeVar, Union, overload - -from azure.core import AsyncPipelineClient -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ..._utils.serialization import Deserializer, Serializer -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, -) -from .._configuration import ComputeManagementClientConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] -List = list - - -class CapacityReservationGroupsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.compute.aio.ComputeManagementClient`'s - :attr:`capacity_reservation_groups` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list_by_subscription( - self, - expand: Optional[Union[str, _models.ExpandTypesForGetCapacityReservationGroups]] = None, - resource_ids_only: Optional[Union[str, _models.ResourceIdOptionsForGetCapacityReservationGroups]] = None, - **kwargs: Any - ) -> AsyncItemPaged["_models.CapacityReservationGroup"]: - """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. Known values are: - "virtualMachineScaleSetVMs/$ref" and "virtualMachines/$ref". Default value is None. - :type expand: str or ~azure.mgmt.compute.models.ExpandTypesForGetCapacityReservationGroups - :param resource_ids_only: The query option to fetch Capacity Reservation Group Resource Ids. - :code:`
` 'CreatedInSubscription' enables fetching Resource Ids for all capacity reservation - group resources created in the subscription. :code:`
` 'SharedWithSubscription' enables - fetching Resource Ids for all capacity reservation group resources shared with the - subscription. :code:`
` 'All' enables fetching Resource Ids for all capacity reservation - group resources shared with the subscription and created in the subscription. Known values are: - "CreatedInSubscription", "SharedWithSubscription", and "All". Default value is None. - :type resource_ids_only: str or - ~azure.mgmt.compute.models.ResourceIdOptionsForGetCapacityReservationGroups - :return: An iterator like instance of either CapacityReservationGroup or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.models.CapacityReservationGroup] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[_models.CapacityReservationGroupListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_by_subscription_request( - subscription_id=self._config.subscription_id, - expand=expand, - resource_ids_only=resource_ids_only, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - _request = HttpRequest("GET", next_link) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @distributed_trace - def list_by_resource_group( - self, - resource_group_name: str, - expand: Optional[Union[str, _models.ExpandTypesForGetCapacityReservationGroups]] = None, - **kwargs: Any - ) -> AsyncItemPaged["_models.CapacityReservationGroup"]: - """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. The name is case insensitive. - Required. - :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. Known values are: - "virtualMachineScaleSetVMs/$ref" and "virtualMachines/$ref". Default value is None. - :type expand: str or ~azure.mgmt.compute.models.ExpandTypesForGetCapacityReservationGroups - :return: An iterator like instance of either CapacityReservationGroup or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.models.CapacityReservationGroup] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[_models.CapacityReservationGroupListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_by_resource_group_request( - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - expand=expand, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - _request = HttpRequest("GET", next_link) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @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. The name is case insensitive. - Required. - :type resource_group_name: str - :param capacity_reservation_group_name: The name of the capacity reservation group. Required. - :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. "instanceView" Default value is - None. - :type expand: str or ~azure.mgmt.compute.models.CapacityReservationGroupInstanceViewTypes - :return: CapacityReservationGroup or the result of cls(response) - :rtype: ~azure.mgmt.compute.models.CapacityReservationGroup - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[_models.CapacityReservationGroup] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - capacity_reservation_group_name=capacity_reservation_group_name, - subscription_id=self._config.subscription_id, - expand=expand, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("CapacityReservationGroup", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def create_or_update( - self, - resource_group_name: str, - capacity_reservation_group_name: str, - parameters: _models.CapacityReservationGroup, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.CapacityReservationGroup: - """The operation to create or update a capacity reservation group. When updating a capacity - reservation group, only tags and sharing profile may be modified. Please refer to - https://aka.ms/CapacityReservation for more details. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param capacity_reservation_group_name: The name of the capacity reservation group. Required. - :type capacity_reservation_group_name: str - :param parameters: Parameters supplied to the Create capacity reservation Group. Required. - :type parameters: ~azure.mgmt.compute.models.CapacityReservationGroup - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: CapacityReservationGroup or the result of cls(response) - :rtype: ~azure.mgmt.compute.models.CapacityReservationGroup - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def create_or_update( - self, - resource_group_name: str, - capacity_reservation_group_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.CapacityReservationGroup: - """The operation to create or update a capacity reservation group. When updating a capacity - reservation group, only tags and sharing profile may be modified. Please refer to - https://aka.ms/CapacityReservation for more details. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param capacity_reservation_group_name: The name of the capacity reservation group. Required. - :type capacity_reservation_group_name: str - :param parameters: Parameters supplied to the Create capacity reservation Group. Required. - :type parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: CapacityReservationGroup or the result of cls(response) - :rtype: ~azure.mgmt.compute.models.CapacityReservationGroup - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def create_or_update( - self, - resource_group_name: str, - capacity_reservation_group_name: str, - parameters: Union[_models.CapacityReservationGroup, IO[bytes]], - **kwargs: Any - ) -> _models.CapacityReservationGroup: - """The operation to create or update a capacity reservation group. When updating a capacity - reservation group, only tags and sharing profile may be modified. Please refer to - https://aka.ms/CapacityReservation for more details. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param capacity_reservation_group_name: The name of the capacity reservation group. Required. - :type capacity_reservation_group_name: str - :param parameters: Parameters supplied to the Create capacity reservation Group. Is either a - CapacityReservationGroup type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.compute.models.CapacityReservationGroup or IO[bytes] - :return: CapacityReservationGroup or the result of cls(response) - :rtype: ~azure.mgmt.compute.models.CapacityReservationGroup - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CapacityReservationGroup] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _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, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - 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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def update( - self, - resource_group_name: str, - capacity_reservation_group_name: str, - parameters: _models.CapacityReservationGroupUpdate, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.CapacityReservationGroup: - """The operation to update a capacity reservation group. When updating a capacity reservation - group, only tags and sharing profile may be modified. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param capacity_reservation_group_name: The name of the capacity reservation group. Required. - :type capacity_reservation_group_name: str - :param parameters: Parameters supplied to the Update capacity reservation Group operation. - Required. - :type parameters: ~azure.mgmt.compute.models.CapacityReservationGroupUpdate - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: CapacityReservationGroup or the result of cls(response) - :rtype: ~azure.mgmt.compute.models.CapacityReservationGroup - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def update( - self, - resource_group_name: str, - capacity_reservation_group_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.CapacityReservationGroup: - """The operation to update a capacity reservation group. When updating a capacity reservation - group, only tags and sharing profile may be modified. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param capacity_reservation_group_name: The name of the capacity reservation group. Required. - :type capacity_reservation_group_name: str - :param parameters: Parameters supplied to the Update capacity reservation Group operation. - Required. - :type parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: CapacityReservationGroup or the result of cls(response) - :rtype: ~azure.mgmt.compute.models.CapacityReservationGroup - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def update( - self, - resource_group_name: str, - capacity_reservation_group_name: str, - parameters: Union[_models.CapacityReservationGroupUpdate, IO[bytes]], - **kwargs: Any - ) -> _models.CapacityReservationGroup: - """The operation to update a capacity reservation group. When updating a capacity reservation - group, only tags and sharing profile may be modified. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param capacity_reservation_group_name: The name of the capacity reservation group. Required. - :type capacity_reservation_group_name: str - :param parameters: Parameters supplied to the Update capacity reservation Group operation. Is - either a CapacityReservationGroupUpdate type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.compute.models.CapacityReservationGroupUpdate or IO[bytes] - :return: CapacityReservationGroup or the result of cls(response) - :rtype: ~azure.mgmt.compute.models.CapacityReservationGroup - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CapacityReservationGroup] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _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, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("CapacityReservationGroup", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def delete(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. The name is case insensitive. - Required. - :type resource_group_name: str - :param capacity_reservation_group_name: The name of the capacity reservation group. Required. - :type capacity_reservation_group_name: str - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - - _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, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 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, {}) # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/operations/_capacity_reservations_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/operations/_capacity_reservations_operations.py deleted file mode 100644 index fca2399bd3ee..000000000000 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/operations/_capacity_reservations_operations.py +++ /dev/null @@ -1,764 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from collections.abc import MutableMapping -from io import IOBase -from typing import Any, AsyncIterator, Callable, IO, Optional, TypeVar, Union, cast, overload - -from azure.core import AsyncPipelineClient -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - StreamClosedError, - StreamConsumedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ..._utils.serialization import Deserializer, Serializer -from ...operations._capacity_reservations_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_by_capacity_reservation_group_request, - build_update_request, -) -from .._configuration import ComputeManagementClientConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] -List = list - - -class CapacityReservationsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.compute.aio.ComputeManagementClient`'s - :attr:`capacity_reservations` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list_by_capacity_reservation_group( - self, resource_group_name: str, capacity_reservation_group_name: str, **kwargs: Any - ) -> AsyncItemPaged["_models.CapacityReservation"]: - """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. The name is case insensitive. - Required. - :type resource_group_name: str - :param capacity_reservation_group_name: The name of the capacity reservation group. Required. - :type capacity_reservation_group_name: str - :return: An iterator like instance of either CapacityReservation or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.models.CapacityReservation] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[_models.CapacityReservationListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_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, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - _request = HttpRequest("GET", next_link) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @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. The name is case insensitive. - Required. - :type resource_group_name: str - :param capacity_reservation_group_name: The name of the capacity reservation group. Required. - :type capacity_reservation_group_name: str - :param capacity_reservation_name: The name of the capacity reservation. Required. - :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. "instanceView" Default value is None. - :type expand: str or ~azure.mgmt.compute.models.CapacityReservationInstanceViewTypes - :return: CapacityReservation or the result of cls(response) - :rtype: ~azure.mgmt.compute.models.CapacityReservation - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[_models.CapacityReservation] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - capacity_reservation_group_name=capacity_reservation_group_name, - capacity_reservation_name=capacity_reservation_name, - subscription_id=self._config.subscription_id, - expand=expand, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("CapacityReservation", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - capacity_reservation_group_name: str, - capacity_reservation_name: str, - parameters: Union[_models.CapacityReservation, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "CapacityReservation") - - _request = build_create_or_update_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, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 201: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - capacity_reservation_group_name: str, - capacity_reservation_name: str, - parameters: _models.CapacityReservation, - *, - content_type: str = "application/json", - **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. The name is case insensitive. - Required. - :type resource_group_name: str - :param capacity_reservation_group_name: The name of the capacity reservation group. Required. - :type capacity_reservation_group_name: str - :param capacity_reservation_name: The name of the capacity reservation. Required. - :type capacity_reservation_name: str - :param parameters: Parameters supplied to the Create capacity reservation. Required. - :type parameters: ~azure.mgmt.compute.models.CapacityReservation - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either CapacityReservation or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.CapacityReservation] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - capacity_reservation_group_name: str, - capacity_reservation_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **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. The name is case insensitive. - Required. - :type resource_group_name: str - :param capacity_reservation_group_name: The name of the capacity reservation group. Required. - :type capacity_reservation_group_name: str - :param capacity_reservation_name: The name of the capacity reservation. Required. - :type capacity_reservation_name: str - :param parameters: Parameters supplied to the Create capacity reservation. Required. - :type parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either CapacityReservation or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.CapacityReservation] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - capacity_reservation_group_name: str, - capacity_reservation_name: str, - parameters: Union[_models.CapacityReservation, IO[bytes]], - **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. The name is case insensitive. - Required. - :type resource_group_name: str - :param capacity_reservation_group_name: The name of the capacity reservation group. Required. - :type capacity_reservation_group_name: str - :param capacity_reservation_name: The name of the capacity reservation. Required. - :type capacity_reservation_name: str - :param parameters: Parameters supplied to the Create capacity reservation. Is either a - CapacityReservation type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.compute.models.CapacityReservation or IO[bytes] - :return: An instance of AsyncLROPoller that returns either CapacityReservation or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.CapacityReservation] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CapacityReservation] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._create_or_update_initial( - resource_group_name=resource_group_name, - 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, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("CapacityReservation", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.CapacityReservation].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.CapacityReservation]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _update_initial( - self, - resource_group_name: str, - capacity_reservation_group_name: str, - capacity_reservation_name: str, - parameters: Union[_models.CapacityReservationUpdate, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "CapacityReservationUpdate") - - _request = build_update_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, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_update( - self, - resource_group_name: str, - capacity_reservation_group_name: str, - capacity_reservation_name: str, - parameters: _models.CapacityReservationUpdate, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.CapacityReservation]: - """The operation to update a capacity reservation. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param capacity_reservation_group_name: The name of the capacity reservation group. Required. - :type capacity_reservation_group_name: str - :param capacity_reservation_name: The name of the capacity reservation. Required. - :type capacity_reservation_name: str - :param parameters: Parameters supplied to the Update capacity reservation operation. Required. - :type parameters: ~azure.mgmt.compute.models.CapacityReservationUpdate - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either CapacityReservation or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.CapacityReservation] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update( - self, - resource_group_name: str, - capacity_reservation_group_name: str, - capacity_reservation_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.CapacityReservation]: - """The operation to update a capacity reservation. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param capacity_reservation_group_name: The name of the capacity reservation group. Required. - :type capacity_reservation_group_name: str - :param capacity_reservation_name: The name of the capacity reservation. Required. - :type capacity_reservation_name: str - :param parameters: Parameters supplied to the Update capacity reservation operation. Required. - :type parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either CapacityReservation or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.CapacityReservation] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_update( - self, - resource_group_name: str, - capacity_reservation_group_name: str, - capacity_reservation_name: str, - parameters: Union[_models.CapacityReservationUpdate, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.CapacityReservation]: - """The operation to update a capacity reservation. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param capacity_reservation_group_name: The name of the capacity reservation group. Required. - :type capacity_reservation_group_name: str - :param capacity_reservation_name: The name of the capacity reservation. Required. - :type capacity_reservation_name: str - :param parameters: Parameters supplied to the Update capacity reservation operation. Is either - a CapacityReservationUpdate type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.compute.models.CapacityReservationUpdate or IO[bytes] - :return: An instance of AsyncLROPoller that returns either CapacityReservation or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.CapacityReservation] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CapacityReservation] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._update_initial( - resource_group_name=resource_group_name, - 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, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("CapacityReservation", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.CapacityReservation].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.CapacityReservation]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, - resource_group_name: str, - capacity_reservation_group_name: str, - capacity_reservation_name: str, - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_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, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_delete( - 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. Note: Block capacity reservations cannot - be deleted after it has been successfully allocated until the schedule end time. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param capacity_reservation_group_name: The name of the capacity reservation group. Required. - :type capacity_reservation_group_name: str - :param capacity_reservation_name: The name of the capacity reservation. Required. - :type capacity_reservation_name: str - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._delete_initial( - 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, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/operations/_cloud_service_operating_systems_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/operations/_cloud_service_operating_systems_operations.py deleted file mode 100644 index 983b01d22ced..000000000000 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/operations/_cloud_service_operating_systems_operations.py +++ /dev/null @@ -1,306 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from collections.abc import MutableMapping -from typing import Any, Callable, Optional, TypeVar - -from azure.core import AsyncPipelineClient -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ..._utils.serialization import Deserializer, Serializer -from ...operations._cloud_service_operating_systems_operations import ( - build_get_os_family_request, - build_get_os_version_request, - build_list_os_families_request, - build_list_os_versions_request, -) -from .._configuration import ComputeManagementClientConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] -List = list - - -class CloudServiceOperatingSystemsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.compute.aio.ComputeManagementClient`'s - :attr:`cloud_service_operating_systems` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace_async - async def get_os_version(self, location: str, os_version_name: str, **kwargs: Any) -> _models.OSVersion: - """Gets properties of a guest operating system version that can be specified in the XML service - configuration (.cscfg) for a cloud service. - - :param location: Name of the location that the OS version pertains to. Required. - :type location: str - :param os_version_name: Name of the OS version. Required. - :type os_version_name: str - :return: OSVersion or the result of cls(response) - :rtype: ~azure.mgmt.compute.models.OSVersion - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-04")) - cls: ClsType[_models.OSVersion] = kwargs.pop("cls", None) - - _request = build_get_os_version_request( - location=location, - os_version_name=os_version_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("OSVersion", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def list_os_versions(self, location: str, **kwargs: Any) -> AsyncItemPaged["_models.OSVersion"]: - """Gets a list of all guest operating system versions available to be specified in the XML service - configuration (.cscfg) for a cloud service. Use nextLink property in the response to get the - next page of OS versions. Do this till nextLink is null to fetch all the OS versions. - - :param location: Name of the location that the OS versions pertain to. Required. - :type location: str - :return: An iterator like instance of either OSVersion or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.models.OSVersion] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-04")) - cls: ClsType[_models.OSVersionListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_os_versions_request( - location=location, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - _request = HttpRequest("GET", next_link) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("OSVersionListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @distributed_trace_async - async def get_os_family(self, location: str, os_family_name: str, **kwargs: Any) -> _models.OSFamily: - """Gets properties of a guest operating system family that can be specified in the XML service - configuration (.cscfg) for a cloud service. - - :param location: Name of the location that the OS family pertains to. Required. - :type location: str - :param os_family_name: Name of the OS family. Required. - :type os_family_name: str - :return: OSFamily or the result of cls(response) - :rtype: ~azure.mgmt.compute.models.OSFamily - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-04")) - cls: ClsType[_models.OSFamily] = kwargs.pop("cls", None) - - _request = build_get_os_family_request( - location=location, - os_family_name=os_family_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("OSFamily", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def list_os_families(self, location: str, **kwargs: Any) -> AsyncItemPaged["_models.OSFamily"]: - """Gets a list of all guest operating system families available to be specified in the XML service - configuration (.cscfg) for a cloud service. Use nextLink property in the response to get the - next page of OS Families. Do this till nextLink is null to fetch all the OS Families. - - :param location: Name of the location that the OS families pertain to. Required. - :type location: str - :return: An iterator like instance of either OSFamily or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.models.OSFamily] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-04")) - cls: ClsType[_models.OSFamilyListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_os_families_request( - location=location, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - _request = HttpRequest("GET", next_link) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("OSFamilyListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/operations/_cloud_service_role_instances_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/operations/_cloud_service_role_instances_operations.py deleted file mode 100644 index 0c418a0a9a24..000000000000 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/operations/_cloud_service_role_instances_operations.py +++ /dev/null @@ -1,778 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from collections.abc import MutableMapping -from typing import Any, AsyncIterator, Callable, Optional, TypeVar, Union, cast - -from azure.core import AsyncPipelineClient -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - StreamClosedError, - StreamConsumedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ..._utils.serialization import Deserializer, Serializer -from ...operations._cloud_service_role_instances_operations import ( - build_delete_request, - build_get_instance_view_request, - build_get_remote_desktop_file_request, - build_get_request, - build_list_request, - build_rebuild_request, - build_reimage_request, - build_restart_request, -) -from .._configuration import ComputeManagementClientConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] -List = list - - -class CloudServiceRoleInstancesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.compute.aio.ComputeManagementClient`'s - :attr:`cloud_service_role_instances` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - async def _delete_initial( - self, role_instance_name: str, resource_group_name: str, cloud_service_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-04")) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_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, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_delete( - self, role_instance_name: str, resource_group_name: str, cloud_service_name: str, **kwargs: Any - ) -> AsyncLROPoller[None]: - """Deletes a role instance from a cloud service. - - :param role_instance_name: Name of the role instance. Required. - :type role_instance_name: str - :param resource_group_name: Name of the resource group. Required. - :type resource_group_name: str - :param cloud_service_name: Name of the cloud service. Required. - :type cloud_service_name: str - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-04")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._delete_initial( - 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, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace_async - async def get( - self, - role_instance_name: str, - resource_group_name: str, - cloud_service_name: str, - expand: Optional[Union[str, _models.InstanceViewTypes]] = None, - **kwargs: Any - ) -> _models.RoleInstance: - """Gets a role instance from a cloud service. - - :param role_instance_name: Name of the role instance. Required. - :type role_instance_name: str - :param resource_group_name: Name of the resource group. Required. - :type resource_group_name: str - :param cloud_service_name: Name of the cloud service. Required. - :type cloud_service_name: str - :param expand: The expand expression to apply to the operation. 'UserData' is not supported for - cloud services. Known values are: "instanceView", "userData", and "resiliencyView". Default - value is None. - :type expand: str or ~azure.mgmt.compute.models.InstanceViewTypes - :return: RoleInstance or the result of cls(response) - :rtype: ~azure.mgmt.compute.models.RoleInstance - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-04")) - cls: ClsType[_models.RoleInstance] = kwargs.pop("cls", None) - - _request = build_get_request( - role_instance_name=role_instance_name, - resource_group_name=resource_group_name, - cloud_service_name=cloud_service_name, - subscription_id=self._config.subscription_id, - expand=expand, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("RoleInstance", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def get_instance_view( - self, role_instance_name: str, resource_group_name: str, cloud_service_name: str, **kwargs: Any - ) -> _models.RoleInstanceView: - """Retrieves information about the run-time state of a role instance in a cloud service. - - :param role_instance_name: Name of the role instance. Required. - :type role_instance_name: str - :param resource_group_name: Name of the resource group. Required. - :type resource_group_name: str - :param cloud_service_name: Name of the cloud service. Required. - :type cloud_service_name: str - :return: RoleInstanceView or the result of cls(response) - :rtype: ~azure.mgmt.compute.models.RoleInstanceView - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-04")) - cls: ClsType[_models.RoleInstanceView] = kwargs.pop("cls", None) - - _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, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("RoleInstanceView", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def list( - self, - resource_group_name: str, - cloud_service_name: str, - expand: Optional[Union[str, _models.InstanceViewTypes]] = None, - **kwargs: Any - ) -> AsyncItemPaged["_models.RoleInstance"]: - """Gets the list of all role instances in a cloud service. Use nextLink property in the response - to get the next page of role instances. Do this till nextLink is null to fetch all the role - instances. - - :param resource_group_name: Name of the resource group. Required. - :type resource_group_name: str - :param cloud_service_name: Name of the cloud service. Required. - :type cloud_service_name: str - :param expand: The expand expression to apply to the operation. 'UserData' is not supported for - cloud services. Known values are: "instanceView", "userData", and "resiliencyView". Default - value is None. - :type expand: str or ~azure.mgmt.compute.models.InstanceViewTypes - :return: An iterator like instance of either RoleInstance or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.models.RoleInstance] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-04")) - cls: ClsType[_models.RoleInstanceListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - cloud_service_name=cloud_service_name, - subscription_id=self._config.subscription_id, - expand=expand, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - _request = HttpRequest("GET", next_link) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("RoleInstanceListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - async def _restart_initial( - self, role_instance_name: str, resource_group_name: str, cloud_service_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-04")) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_restart_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, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_restart( - self, role_instance_name: str, resource_group_name: str, cloud_service_name: str, **kwargs: Any - ) -> AsyncLROPoller[None]: - """The Reboot Role Instance asynchronous operation requests a reboot of a role instance in the - cloud service. - - :param role_instance_name: Name of the role instance. Required. - :type role_instance_name: str - :param resource_group_name: Name of the resource group. Required. - :type resource_group_name: str - :param cloud_service_name: Name of the cloud service. Required. - :type cloud_service_name: str - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-04")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._restart_initial( - 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, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _reimage_initial( - self, role_instance_name: str, resource_group_name: str, cloud_service_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-04")) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_reimage_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, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_reimage( - self, role_instance_name: str, resource_group_name: str, cloud_service_name: str, **kwargs: Any - ) -> AsyncLROPoller[None]: - """The Reimage Role Instance asynchronous operation reinstalls the operating system on instances - of web roles or worker roles. - - :param role_instance_name: Name of the role instance. Required. - :type role_instance_name: str - :param resource_group_name: Name of the resource group. Required. - :type resource_group_name: str - :param cloud_service_name: Name of the cloud service. Required. - :type cloud_service_name: str - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-04")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._reimage_initial( - 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, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _rebuild_initial( - self, role_instance_name: str, resource_group_name: str, cloud_service_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-04")) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_rebuild_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, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_rebuild( - self, role_instance_name: str, resource_group_name: str, cloud_service_name: str, **kwargs: Any - ) -> AsyncLROPoller[None]: - """The Rebuild Role Instance asynchronous operation reinstalls the operating system on instances - of web roles or worker roles and initializes the storage resources that are used by them. If - you do not want to initialize storage resources, you can use Reimage Role Instance. - - :param role_instance_name: Name of the role instance. Required. - :type role_instance_name: str - :param resource_group_name: Name of the resource group. Required. - :type resource_group_name: str - :param cloud_service_name: Name of the cloud service. Required. - :type cloud_service_name: str - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-04")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._rebuild_initial( - 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, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace_async - async def get_remote_desktop_file( - self, role_instance_name: str, resource_group_name: str, cloud_service_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - """Gets a remote desktop file for a role instance in a cloud service. - - :param role_instance_name: Name of the role instance. Required. - :type role_instance_name: str - :param resource_group_name: Name of the resource group. Required. - :type resource_group_name: str - :param cloud_service_name: Name of the cloud service. Required. - :type cloud_service_name: str - :return: AsyncIterator[bytes] or the result of cls(response) - :rtype: AsyncIterator[bytes] - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-04")) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _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, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/operations/_cloud_service_roles_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/operations/_cloud_service_roles_operations.py deleted file mode 100644 index 1784c8731157..000000000000 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/operations/_cloud_service_roles_operations.py +++ /dev/null @@ -1,186 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from collections.abc import MutableMapping -from typing import Any, Callable, Optional, TypeVar - -from azure.core import AsyncPipelineClient -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ..._utils.serialization import Deserializer, Serializer -from ...operations._cloud_service_roles_operations import build_get_request, build_list_request -from .._configuration import ComputeManagementClientConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] -List = list - - -class CloudServiceRolesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.compute.aio.ComputeManagementClient`'s - :attr:`cloud_service_roles` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace_async - async def get( - self, role_name: str, resource_group_name: str, cloud_service_name: str, **kwargs: Any - ) -> _models.CloudServiceRole: - """Gets a role from a cloud service. - - :param role_name: Name of the role. Required. - :type role_name: str - :param resource_group_name: Name of the resource group. Required. - :type resource_group_name: str - :param cloud_service_name: Name of the cloud service. Required. - :type cloud_service_name: str - :return: CloudServiceRole or the result of cls(response) - :rtype: ~azure.mgmt.compute.models.CloudServiceRole - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-04")) - cls: ClsType[_models.CloudServiceRole] = kwargs.pop("cls", None) - - _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, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("CloudServiceRole", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, cloud_service_name: str, **kwargs: Any - ) -> AsyncItemPaged["_models.CloudServiceRole"]: - """Gets a list of all roles in a cloud service. Use nextLink property in the response to get the - next page of roles. Do this till nextLink is null to fetch all the roles. - - :param resource_group_name: Name of the resource group. Required. - :type resource_group_name: str - :param cloud_service_name: Name of the cloud service. Required. - :type cloud_service_name: str - :return: An iterator like instance of either CloudServiceRole or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.models.CloudServiceRole] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-04")) - cls: ClsType[_models.CloudServiceRoleListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - cloud_service_name=cloud_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - _request = HttpRequest("GET", next_link) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("CloudServiceRoleListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/operations/_cloud_services_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/operations/_cloud_services_operations.py deleted file mode 100644 index 9f68999b8e60..000000000000 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/operations/_cloud_services_operations.py +++ /dev/null @@ -1,1779 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from collections.abc import MutableMapping -from io import IOBase -from typing import Any, AsyncIterator, Callable, IO, Optional, TypeVar, Union, cast, overload - -from azure.core import AsyncPipelineClient -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - StreamClosedError, - StreamConsumedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ..._utils.serialization import Deserializer, Serializer -from ...operations._cloud_services_operations import ( - build_create_or_update_request, - build_delete_instances_request, - build_delete_request, - build_get_instance_view_request, - build_get_request, - build_list_all_request, - build_list_request, - build_power_off_request, - build_rebuild_request, - build_reimage_request, - build_restart_request, - build_start_request, - build_update_request, -) -from .._configuration import ComputeManagementClientConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] -List = list - - -class CloudServicesOperations: # pylint: disable=too-many-public-methods - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.compute.aio.ComputeManagementClient`'s - :attr:`cloud_services` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - async def _create_or_update_initial( - self, - resource_group_name: str, - cloud_service_name: str, - parameters: Optional[Union[_models.CloudService, IO[bytes]]] = None, - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-04")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - content_type = content_type if parameters else None - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" if parameters else None - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - if parameters is not None: - _json = self._serialize.body(parameters, "CloudService") - else: - _json = None - - _request = build_create_or_update_request( - 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, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - cloud_service_name: str, - parameters: Optional[_models.CloudService] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.CloudService]: - """Create or update a cloud service. Please note some properties can be set only during cloud - service creation. - - :param resource_group_name: Name of the resource group. Required. - :type resource_group_name: str - :param cloud_service_name: Name of the cloud service. Required. - :type cloud_service_name: str - :param parameters: The cloud service object. Default value is None. - :type parameters: ~azure.mgmt.compute.models.CloudService - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either CloudService or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.CloudService] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - cloud_service_name: str, - parameters: Optional[IO[bytes]] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.CloudService]: - """Create or update a cloud service. Please note some properties can be set only during cloud - service creation. - - :param resource_group_name: Name of the resource group. Required. - :type resource_group_name: str - :param cloud_service_name: Name of the cloud service. Required. - :type cloud_service_name: str - :param parameters: The cloud service object. Default value is None. - :type parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either CloudService or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.CloudService] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - cloud_service_name: str, - parameters: Optional[Union[_models.CloudService, IO[bytes]]] = None, - **kwargs: Any - ) -> AsyncLROPoller[_models.CloudService]: - """Create or update a cloud service. Please note some properties can be set only during cloud - service creation. - - :param resource_group_name: Name of the resource group. Required. - :type resource_group_name: str - :param cloud_service_name: Name of the cloud service. Required. - :type cloud_service_name: str - :param parameters: The cloud service object. Is either a CloudService type or a IO[bytes] type. - Default value is None. - :type parameters: ~azure.mgmt.compute.models.CloudService or IO[bytes] - :return: An instance of AsyncLROPoller that returns either CloudService or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.CloudService] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-04")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - content_type = content_type if parameters else None - cls: ClsType[_models.CloudService] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._create_or_update_initial( - resource_group_name=resource_group_name, - cloud_service_name=cloud_service_name, - parameters=parameters, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("CloudService", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.CloudService].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.CloudService]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _update_initial( - self, - resource_group_name: str, - cloud_service_name: str, - parameters: Optional[Union[_models.CloudServiceUpdate, IO[bytes]]] = None, - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-04")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - content_type = content_type if parameters else None - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" if parameters else None - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - if parameters is not None: - _json = self._serialize.body(parameters, "CloudServiceUpdate") - else: - _json = None - - _request = build_update_request( - 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, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_update( - self, - resource_group_name: str, - cloud_service_name: str, - parameters: Optional[_models.CloudServiceUpdate] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.CloudService]: - """Update a cloud service. - - :param resource_group_name: Name of the resource group. Required. - :type resource_group_name: str - :param cloud_service_name: Name of the cloud service. Required. - :type cloud_service_name: str - :param parameters: The cloud service object. Default value is None. - :type parameters: ~azure.mgmt.compute.models.CloudServiceUpdate - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either CloudService or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.CloudService] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update( - self, - resource_group_name: str, - cloud_service_name: str, - parameters: Optional[IO[bytes]] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.CloudService]: - """Update a cloud service. - - :param resource_group_name: Name of the resource group. Required. - :type resource_group_name: str - :param cloud_service_name: Name of the cloud service. Required. - :type cloud_service_name: str - :param parameters: The cloud service object. Default value is None. - :type parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either CloudService or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.CloudService] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_update( - self, - resource_group_name: str, - cloud_service_name: str, - parameters: Optional[Union[_models.CloudServiceUpdate, IO[bytes]]] = None, - **kwargs: Any - ) -> AsyncLROPoller[_models.CloudService]: - """Update a cloud service. - - :param resource_group_name: Name of the resource group. Required. - :type resource_group_name: str - :param cloud_service_name: Name of the cloud service. Required. - :type cloud_service_name: str - :param parameters: The cloud service object. Is either a CloudServiceUpdate type or a IO[bytes] - type. Default value is None. - :type parameters: ~azure.mgmt.compute.models.CloudServiceUpdate or IO[bytes] - :return: An instance of AsyncLROPoller that returns either CloudService or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.CloudService] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-04")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - content_type = content_type if parameters else None - cls: ClsType[_models.CloudService] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._update_initial( - resource_group_name=resource_group_name, - cloud_service_name=cloud_service_name, - parameters=parameters, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("CloudService", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.CloudService].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.CloudService]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, cloud_service_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-04")) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - cloud_service_name=cloud_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_delete( - self, resource_group_name: str, cloud_service_name: str, **kwargs: Any - ) -> AsyncLROPoller[None]: - """Deletes a cloud service. - - :param resource_group_name: Name of the resource group. Required. - :type resource_group_name: str - :param cloud_service_name: Name of the cloud service. Required. - :type cloud_service_name: str - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-04")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._delete_initial( - resource_group_name=resource_group_name, - cloud_service_name=cloud_service_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace_async - async def get(self, resource_group_name: str, cloud_service_name: str, **kwargs: Any) -> _models.CloudService: - """Display information about a cloud service. - - :param resource_group_name: Name of the resource group. Required. - :type resource_group_name: str - :param cloud_service_name: Name of the cloud service. Required. - :type cloud_service_name: str - :return: CloudService or the result of cls(response) - :rtype: ~azure.mgmt.compute.models.CloudService - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-04")) - cls: ClsType[_models.CloudService] = kwargs.pop("cls", None) - - _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, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("CloudService", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def get_instance_view( - self, resource_group_name: str, cloud_service_name: str, **kwargs: Any - ) -> _models.CloudServiceInstanceView: - """Gets the status of a cloud service. - - :param resource_group_name: Name of the resource group. Required. - :type resource_group_name: str - :param cloud_service_name: Name of the cloud service. Required. - :type cloud_service_name: str - :return: CloudServiceInstanceView or the result of cls(response) - :rtype: ~azure.mgmt.compute.models.CloudServiceInstanceView - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-04")) - cls: ClsType[_models.CloudServiceInstanceView] = kwargs.pop("cls", None) - - _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, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("CloudServiceInstanceView", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def list_all(self, **kwargs: Any) -> AsyncItemPaged["_models.CloudService"]: - """Gets a list of all cloud services in the subscription, regardless of the associated resource - group. Use nextLink property in the response to get the next page of Cloud Services. Do this - till nextLink is null to fetch all the Cloud Services. - - :return: An iterator like instance of either CloudService or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.models.CloudService] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-04")) - cls: ClsType[_models.CloudServiceListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_all_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - _request = HttpRequest("GET", next_link) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("CloudServiceListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @distributed_trace - def list(self, resource_group_name: str, **kwargs: Any) -> AsyncItemPaged["_models.CloudService"]: - """Gets a list of all cloud services under a resource group. Use nextLink property in the response - to get the next page of Cloud Services. Do this till nextLink is null to fetch all the Cloud - Services. - - :param resource_group_name: Name of the resource group. Required. - :type resource_group_name: str - :return: An iterator like instance of either CloudService or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.models.CloudService] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-04")) - cls: ClsType[_models.CloudServiceListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - _request = HttpRequest("GET", next_link) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("CloudServiceListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - async def _start_initial( - self, resource_group_name: str, cloud_service_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-04")) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_start_request( - resource_group_name=resource_group_name, - cloud_service_name=cloud_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_start( - self, resource_group_name: str, cloud_service_name: str, **kwargs: Any - ) -> AsyncLROPoller[None]: - """Starts the cloud service. - - :param resource_group_name: Name of the resource group. Required. - :type resource_group_name: str - :param cloud_service_name: Name of the cloud service. Required. - :type cloud_service_name: str - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-04")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._start_initial( - resource_group_name=resource_group_name, - cloud_service_name=cloud_service_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _power_off_initial( - self, resource_group_name: str, cloud_service_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-04")) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_power_off_request( - resource_group_name=resource_group_name, - cloud_service_name=cloud_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_power_off( - self, resource_group_name: str, cloud_service_name: str, **kwargs: Any - ) -> AsyncLROPoller[None]: - """Power off the cloud service. Note that resources are still attached and you are getting charged - for the resources. - - :param resource_group_name: Name of the resource group. Required. - :type resource_group_name: str - :param cloud_service_name: Name of the cloud service. Required. - :type cloud_service_name: str - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-04")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._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, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _restart_initial( - self, - resource_group_name: str, - cloud_service_name: str, - parameters: Optional[Union[_models.RoleInstances, IO[bytes]]] = None, - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-04")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - content_type = content_type if parameters else None - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" if parameters else None - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - if parameters is not None: - _json = self._serialize.body(parameters, "RoleInstances") - else: - _json = None - - _request = build_restart_request( - 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, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_restart( - self, - resource_group_name: str, - cloud_service_name: str, - parameters: Optional[_models.RoleInstances] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Restarts one or more role instances in a cloud service. - - :param resource_group_name: Name of the resource group. Required. - :type resource_group_name: str - :param cloud_service_name: Name of the cloud service. Required. - :type cloud_service_name: str - :param parameters: List of cloud service role instance names. Default value is None. - :type parameters: ~azure.mgmt.compute.models.RoleInstances - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_restart( - self, - resource_group_name: str, - cloud_service_name: str, - parameters: Optional[IO[bytes]] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Restarts one or more role instances in a cloud service. - - :param resource_group_name: Name of the resource group. Required. - :type resource_group_name: str - :param cloud_service_name: Name of the cloud service. Required. - :type cloud_service_name: str - :param parameters: List of cloud service role instance names. Default value is None. - :type parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_restart( - self, - resource_group_name: str, - cloud_service_name: str, - parameters: Optional[Union[_models.RoleInstances, IO[bytes]]] = None, - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Restarts one or more role instances in a cloud service. - - :param resource_group_name: Name of the resource group. Required. - :type resource_group_name: str - :param cloud_service_name: Name of the cloud service. Required. - :type cloud_service_name: str - :param parameters: List of cloud service role instance names. Is either a RoleInstances type or - a IO[bytes] type. Default value is None. - :type parameters: ~azure.mgmt.compute.models.RoleInstances or IO[bytes] - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-04")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - content_type = content_type if parameters else None - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._restart_initial( - 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, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _reimage_initial( - self, - resource_group_name: str, - cloud_service_name: str, - parameters: Optional[Union[_models.RoleInstances, IO[bytes]]] = None, - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-04")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - content_type = content_type if parameters else None - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" if parameters else None - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - if parameters is not None: - _json = self._serialize.body(parameters, "RoleInstances") - else: - _json = None - - _request = build_reimage_request( - 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, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_reimage( - self, - resource_group_name: str, - cloud_service_name: str, - parameters: Optional[_models.RoleInstances] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Reimage asynchronous operation reinstalls the operating system on instances of web roles or - worker roles. - - :param resource_group_name: Name of the resource group. Required. - :type resource_group_name: str - :param cloud_service_name: Name of the cloud service. Required. - :type cloud_service_name: str - :param parameters: List of cloud service role instance names. Default value is None. - :type parameters: ~azure.mgmt.compute.models.RoleInstances - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_reimage( - self, - resource_group_name: str, - cloud_service_name: str, - parameters: Optional[IO[bytes]] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Reimage asynchronous operation reinstalls the operating system on instances of web roles or - worker roles. - - :param resource_group_name: Name of the resource group. Required. - :type resource_group_name: str - :param cloud_service_name: Name of the cloud service. Required. - :type cloud_service_name: str - :param parameters: List of cloud service role instance names. Default value is None. - :type parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_reimage( - self, - resource_group_name: str, - cloud_service_name: str, - parameters: Optional[Union[_models.RoleInstances, IO[bytes]]] = None, - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Reimage asynchronous operation reinstalls the operating system on instances of web roles or - worker roles. - - :param resource_group_name: Name of the resource group. Required. - :type resource_group_name: str - :param cloud_service_name: Name of the cloud service. Required. - :type cloud_service_name: str - :param parameters: List of cloud service role instance names. Is either a RoleInstances type or - a IO[bytes] type. Default value is None. - :type parameters: ~azure.mgmt.compute.models.RoleInstances or IO[bytes] - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-04")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - content_type = content_type if parameters else None - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._reimage_initial( - 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, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _rebuild_initial( - self, - resource_group_name: str, - cloud_service_name: str, - parameters: Optional[Union[_models.RoleInstances, IO[bytes]]] = None, - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-04")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - content_type = content_type if parameters else None - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" if parameters else None - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - if parameters is not None: - _json = self._serialize.body(parameters, "RoleInstances") - else: - _json = None - - _request = build_rebuild_request( - 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, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_rebuild( - self, - resource_group_name: str, - cloud_service_name: str, - parameters: Optional[_models.RoleInstances] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Rebuild Role Instances reinstalls the operating system on instances of web roles or worker - roles and initializes the storage resources that are used by them. If you do not want to - initialize storage resources, you can use Reimage Role Instances. - - :param resource_group_name: Name of the resource group. Required. - :type resource_group_name: str - :param cloud_service_name: Name of the cloud service. Required. - :type cloud_service_name: str - :param parameters: List of cloud service role instance names. Default value is None. - :type parameters: ~azure.mgmt.compute.models.RoleInstances - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_rebuild( - self, - resource_group_name: str, - cloud_service_name: str, - parameters: Optional[IO[bytes]] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Rebuild Role Instances reinstalls the operating system on instances of web roles or worker - roles and initializes the storage resources that are used by them. If you do not want to - initialize storage resources, you can use Reimage Role Instances. - - :param resource_group_name: Name of the resource group. Required. - :type resource_group_name: str - :param cloud_service_name: Name of the cloud service. Required. - :type cloud_service_name: str - :param parameters: List of cloud service role instance names. Default value is None. - :type parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_rebuild( - self, - resource_group_name: str, - cloud_service_name: str, - parameters: Optional[Union[_models.RoleInstances, IO[bytes]]] = None, - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Rebuild Role Instances reinstalls the operating system on instances of web roles or worker - roles and initializes the storage resources that are used by them. If you do not want to - initialize storage resources, you can use Reimage Role Instances. - - :param resource_group_name: Name of the resource group. Required. - :type resource_group_name: str - :param cloud_service_name: Name of the cloud service. Required. - :type cloud_service_name: str - :param parameters: List of cloud service role instance names. Is either a RoleInstances type or - a IO[bytes] type. Default value is None. - :type parameters: ~azure.mgmt.compute.models.RoleInstances or IO[bytes] - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-04")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - content_type = content_type if parameters else None - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._rebuild_initial( - 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, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _delete_instances_initial( - self, - resource_group_name: str, - cloud_service_name: str, - parameters: Optional[Union[_models.RoleInstances, IO[bytes]]] = None, - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-04")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - content_type = content_type if parameters else None - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" if parameters else None - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - if parameters is not None: - _json = self._serialize.body(parameters, "RoleInstances") - else: - _json = None - - _request = build_delete_instances_request( - 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, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_delete_instances( - self, - resource_group_name: str, - cloud_service_name: str, - parameters: Optional[_models.RoleInstances] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Deletes role instances in a cloud service. - - :param resource_group_name: Name of the resource group. Required. - :type resource_group_name: str - :param cloud_service_name: Name of the cloud service. Required. - :type cloud_service_name: str - :param parameters: List of cloud service role instance names. Default value is None. - :type parameters: ~azure.mgmt.compute.models.RoleInstances - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_delete_instances( - self, - resource_group_name: str, - cloud_service_name: str, - parameters: Optional[IO[bytes]] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Deletes role instances in a cloud service. - - :param resource_group_name: Name of the resource group. Required. - :type resource_group_name: str - :param cloud_service_name: Name of the cloud service. Required. - :type cloud_service_name: str - :param parameters: List of cloud service role instance names. Default value is None. - :type parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_delete_instances( - self, - resource_group_name: str, - cloud_service_name: str, - parameters: Optional[Union[_models.RoleInstances, IO[bytes]]] = None, - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Deletes role instances in a cloud service. - - :param resource_group_name: Name of the resource group. Required. - :type resource_group_name: str - :param cloud_service_name: Name of the cloud service. Required. - :type cloud_service_name: str - :param parameters: List of cloud service role instance names. Is either a RoleInstances type or - a IO[bytes] type. Default value is None. - :type parameters: ~azure.mgmt.compute.models.RoleInstances or IO[bytes] - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-04")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - content_type = content_type if parameters else None - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._delete_instances_initial( - 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, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/operations/_cloud_services_update_domain_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/operations/_cloud_services_update_domain_operations.py deleted file mode 100644 index 0dd3ac13ac51..000000000000 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/operations/_cloud_services_update_domain_operations.py +++ /dev/null @@ -1,403 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from collections.abc import MutableMapping -from io import IOBase -from typing import Any, AsyncIterator, Callable, IO, Optional, TypeVar, Union, cast, overload - -from azure.core import AsyncPipelineClient -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - StreamClosedError, - StreamConsumedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ..._utils.serialization import Deserializer, Serializer -from ...operations._cloud_services_update_domain_operations import ( - build_get_update_domain_request, - build_list_update_domains_request, - build_walk_update_domain_request, -) -from .._configuration import ComputeManagementClientConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] -List = list - - -class CloudServicesUpdateDomainOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.compute.aio.ComputeManagementClient`'s - :attr:`cloud_services_update_domain` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - async def _walk_update_domain_initial( - self, - resource_group_name: str, - cloud_service_name: str, - update_domain: int, - parameters: Optional[Union[_models.UpdateDomain, IO[bytes]]] = None, - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-04")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - content_type = content_type if parameters else None - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" if parameters else None - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - if parameters is not None: - _json = self._serialize.body(parameters, "UpdateDomain") - else: - _json = None - - _request = build_walk_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, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_walk_update_domain( - self, - resource_group_name: str, - cloud_service_name: str, - update_domain: int, - parameters: Optional[_models.UpdateDomain] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Updates the role instances in the specified update domain. - - :param resource_group_name: Name of the resource group. Required. - :type resource_group_name: str - :param cloud_service_name: Name of the cloud service. Required. - :type cloud_service_name: str - :param update_domain: Specifies an integer value that identifies the update domain. Update - 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. Required. - :type update_domain: int - :param parameters: The update domain object. Default value is None. - :type parameters: ~azure.mgmt.compute.models.UpdateDomain - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_walk_update_domain( - self, - resource_group_name: str, - cloud_service_name: str, - update_domain: int, - parameters: Optional[IO[bytes]] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Updates the role instances in the specified update domain. - - :param resource_group_name: Name of the resource group. Required. - :type resource_group_name: str - :param cloud_service_name: Name of the cloud service. Required. - :type cloud_service_name: str - :param update_domain: Specifies an integer value that identifies the update domain. Update - 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. Required. - :type update_domain: int - :param parameters: The update domain object. Default value is None. - :type parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_walk_update_domain( - self, - resource_group_name: str, - cloud_service_name: str, - update_domain: int, - parameters: Optional[Union[_models.UpdateDomain, IO[bytes]]] = None, - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Updates the role instances in the specified update domain. - - :param resource_group_name: Name of the resource group. Required. - :type resource_group_name: str - :param cloud_service_name: Name of the cloud service. Required. - :type cloud_service_name: str - :param update_domain: Specifies an integer value that identifies the update domain. Update - 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. Required. - :type update_domain: int - :param parameters: The update domain object. Is either a UpdateDomain type or a IO[bytes] type. - Default value is None. - :type parameters: ~azure.mgmt.compute.models.UpdateDomain or IO[bytes] - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-04")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - content_type = content_type if parameters else None - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._walk_update_domain_initial( - resource_group_name=resource_group_name, - 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, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace_async - async def get_update_domain( - self, resource_group_name: str, cloud_service_name: str, update_domain: int, **kwargs: Any - ) -> _models.UpdateDomain: - """Gets the specified update domain of a cloud service. Use nextLink property in the response to - get the next page of update domains. Do this till nextLink is null to fetch all the update - domains. - - :param resource_group_name: Name of the resource group. Required. - :type resource_group_name: str - :param cloud_service_name: Name of the cloud service. Required. - :type cloud_service_name: str - :param update_domain: Specifies an integer value that identifies the update domain. Update - 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. Required. - :type update_domain: int - :return: UpdateDomain or the result of cls(response) - :rtype: ~azure.mgmt.compute.models.UpdateDomain - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-04")) - cls: ClsType[_models.UpdateDomain] = kwargs.pop("cls", None) - - _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, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("UpdateDomain", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def list_update_domains( - self, resource_group_name: str, cloud_service_name: str, **kwargs: Any - ) -> AsyncItemPaged["_models.UpdateDomain"]: - """Gets a list of all update domains in a cloud service. - - :param resource_group_name: Name of the resource group. Required. - :type resource_group_name: str - :param cloud_service_name: Name of the cloud service. Required. - :type cloud_service_name: str - :return: An iterator like instance of either UpdateDomain or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.models.UpdateDomain] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-04")) - cls: ClsType[_models.UpdateDomainListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_update_domains_request( - resource_group_name=resource_group_name, - cloud_service_name=cloud_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - _request = HttpRequest("GET", next_link) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("UpdateDomainListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/operations/_community_galleries_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/operations/_community_galleries_operations.py deleted file mode 100644 index 85b4750503b1..000000000000 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/operations/_community_galleries_operations.py +++ /dev/null @@ -1,107 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from collections.abc import MutableMapping -from typing import Any, Callable, Optional, TypeVar - -from azure.core import AsyncPipelineClient -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ..._utils.serialization import Deserializer, Serializer -from ...operations._community_galleries_operations import build_get_request -from .._configuration import ComputeManagementClientConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] -List = list - - -class CommunityGalleriesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.compute.aio.ComputeManagementClient`'s - :attr:`community_galleries` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace_async - async def get(self, location: str, public_gallery_name: str, **kwargs: Any) -> _models.CommunityGallery: - """Get a community gallery by gallery public name. - - :param location: The name of Azure region. Required. - :type location: str - :param public_gallery_name: The public name of the community gallery. Required. - :type public_gallery_name: str - :return: CommunityGallery or the result of cls(response) - :rtype: ~azure.mgmt.compute.models.CommunityGallery - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-03")) - cls: ClsType[_models.CommunityGallery] = kwargs.pop("cls", None) - - _request = build_get_request( - location=location, - public_gallery_name=public_gallery_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("CommunityGallery", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/operations/_community_gallery_image_versions_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/operations/_community_gallery_image_versions_operations.py deleted file mode 100644 index aa8f47939297..000000000000 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/operations/_community_gallery_image_versions_operations.py +++ /dev/null @@ -1,201 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from collections.abc import MutableMapping -from typing import Any, Callable, Optional, TypeVar - -from azure.core import AsyncPipelineClient -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ..._utils.serialization import Deserializer, Serializer -from ...operations._community_gallery_image_versions_operations import build_get_request, build_list_request -from .._configuration import ComputeManagementClientConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] -List = list - - -class CommunityGalleryImageVersionsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.compute.aio.ComputeManagementClient`'s - :attr:`community_gallery_image_versions` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list( - self, location: str, public_gallery_name: str, gallery_image_name: str, **kwargs: Any - ) -> AsyncItemPaged["_models.CommunityGalleryImageVersion"]: - """List community gallery image versions inside an image. - - :param location: The name of Azure region. Required. - :type location: str - :param public_gallery_name: The public name of the community gallery. Required. - :type public_gallery_name: str - :param gallery_image_name: The name of the community gallery image definition. Required. - :type gallery_image_name: str - :return: An iterator like instance of either CommunityGalleryImageVersion or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.models.CommunityGalleryImageVersion] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-03")) - cls: ClsType[_models.CommunityGalleryImageVersionList] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - location=location, - public_gallery_name=public_gallery_name, - gallery_image_name=gallery_image_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - _request = HttpRequest("GET", next_link) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("CommunityGalleryImageVersionList", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @distributed_trace_async - async def get( - self, - location: str, - public_gallery_name: str, - gallery_image_name: str, - gallery_image_version_name: str, - **kwargs: Any - ) -> _models.CommunityGalleryImageVersion: - """Get a community gallery image version. - - :param location: The name of Azure region. Required. - :type location: str - :param public_gallery_name: The public name of the community gallery. Required. - :type public_gallery_name: str - :param gallery_image_name: The name of the community gallery image definition. Required. - :type gallery_image_name: str - :param gallery_image_version_name: The name of the community gallery image version. Needs to - follow semantic version name pattern: The allowed characters are digit and period. Digits must - be within the range of a 32-bit integer. Format: :code:``.\\ - :code:``.\\ :code:``. Required. - :type gallery_image_version_name: str - :return: CommunityGalleryImageVersion or the result of cls(response) - :rtype: ~azure.mgmt.compute.models.CommunityGalleryImageVersion - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-03")) - cls: ClsType[_models.CommunityGalleryImageVersion] = kwargs.pop("cls", None) - - _request = build_get_request( - location=location, - public_gallery_name=public_gallery_name, - gallery_image_name=gallery_image_name, - gallery_image_version_name=gallery_image_version_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("CommunityGalleryImageVersion", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/operations/_community_gallery_images_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/operations/_community_gallery_images_operations.py deleted file mode 100644 index 013c20d777d5..000000000000 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/operations/_community_gallery_images_operations.py +++ /dev/null @@ -1,187 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from collections.abc import MutableMapping -from typing import Any, Callable, Optional, TypeVar - -from azure.core import AsyncPipelineClient -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ..._utils.serialization import Deserializer, Serializer -from ...operations._community_gallery_images_operations import build_get_request, build_list_request -from .._configuration import ComputeManagementClientConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] -List = list - - -class CommunityGalleryImagesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.compute.aio.ComputeManagementClient`'s - :attr:`community_gallery_images` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list( - self, location: str, public_gallery_name: str, **kwargs: Any - ) -> AsyncItemPaged["_models.CommunityGalleryImage"]: - """List community gallery images inside a gallery. - - :param location: The name of Azure region. Required. - :type location: str - :param public_gallery_name: The public name of the community gallery. Required. - :type public_gallery_name: str - :return: An iterator like instance of either CommunityGalleryImage or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.models.CommunityGalleryImage] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-03")) - cls: ClsType[_models.CommunityGalleryImageList] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - location=location, - public_gallery_name=public_gallery_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - _request = HttpRequest("GET", next_link) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("CommunityGalleryImageList", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @distributed_trace_async - async def get( - self, location: str, public_gallery_name: str, gallery_image_name: str, **kwargs: Any - ) -> _models.CommunityGalleryImage: - """Get a community gallery image. - - :param location: The name of Azure region. Required. - :type location: str - :param public_gallery_name: The public name of the community gallery. Required. - :type public_gallery_name: str - :param gallery_image_name: The name of the community gallery image definition. Required. - :type gallery_image_name: str - :return: CommunityGalleryImage or the result of cls(response) - :rtype: ~azure.mgmt.compute.models.CommunityGalleryImage - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-03")) - cls: ClsType[_models.CommunityGalleryImage] = kwargs.pop("cls", None) - - _request = build_get_request( - location=location, - public_gallery_name=public_gallery_name, - gallery_image_name=gallery_image_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("CommunityGalleryImage", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/operations/_dedicated_host_groups_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/operations/_dedicated_host_groups_operations.py deleted file mode 100644 index e02d26432bcb..000000000000 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/operations/_dedicated_host_groups_operations.py +++ /dev/null @@ -1,581 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from collections.abc import MutableMapping -from io import IOBase -from typing import Any, Callable, IO, Optional, TypeVar, Union, overload - -from azure.core import AsyncPipelineClient -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ..._utils.serialization import Deserializer, Serializer -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, -) -from .._configuration import ComputeManagementClientConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] -List = list - - -class DedicatedHostGroupsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.compute.aio.ComputeManagementClient`'s - :attr:`dedicated_host_groups` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list_by_subscription(self, **kwargs: Any) -> AsyncItemPaged["_models.DedicatedHostGroup"]: - """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. - - :return: An iterator like instance of either DedicatedHostGroup or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.models.DedicatedHostGroup] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[_models.DedicatedHostGroupListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_by_subscription_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - _request = HttpRequest("GET", next_link) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @distributed_trace - def list_by_resource_group( - self, resource_group_name: str, **kwargs: Any - ) -> AsyncItemPaged["_models.DedicatedHostGroup"]: - """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. The name is case insensitive. - Required. - :type resource_group_name: str - :return: An iterator like instance of either DedicatedHostGroup or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.models.DedicatedHostGroup] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[_models.DedicatedHostGroupListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_by_resource_group_request( - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - _request = HttpRequest("GET", next_link) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @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. The name is case insensitive. - Required. - :type resource_group_name: str - :param host_group_name: The name of the dedicated host group. Required. - :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. Known values are: "instanceView", "userData", and - "resiliencyView". Default value is None. - :type expand: str or ~azure.mgmt.compute.models.InstanceViewTypes - :return: DedicatedHostGroup or the result of cls(response) - :rtype: ~azure.mgmt.compute.models.DedicatedHostGroup - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[_models.DedicatedHostGroup] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - host_group_name=host_group_name, - subscription_id=self._config.subscription_id, - expand=expand, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("DedicatedHostGroup", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def create_or_update( - self, - resource_group_name: str, - host_group_name: str, - parameters: _models.DedicatedHostGroup, - *, - content_type: str = "application/json", - **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. The name is case insensitive. - Required. - :type resource_group_name: str - :param host_group_name: The name of the dedicated host group. Required. - :type host_group_name: str - :param parameters: Parameters supplied to the Create Dedicated Host Group. Required. - :type parameters: ~azure.mgmt.compute.models.DedicatedHostGroup - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: DedicatedHostGroup or the result of cls(response) - :rtype: ~azure.mgmt.compute.models.DedicatedHostGroup - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def create_or_update( - self, - resource_group_name: str, - host_group_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **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. The name is case insensitive. - Required. - :type resource_group_name: str - :param host_group_name: The name of the dedicated host group. Required. - :type host_group_name: str - :param parameters: Parameters supplied to the Create Dedicated Host Group. Required. - :type parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: DedicatedHostGroup or the result of cls(response) - :rtype: ~azure.mgmt.compute.models.DedicatedHostGroup - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def create_or_update( - self, - resource_group_name: str, - host_group_name: str, - parameters: Union[_models.DedicatedHostGroup, IO[bytes]], - **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. The name is case insensitive. - Required. - :type resource_group_name: str - :param host_group_name: The name of the dedicated host group. Required. - :type host_group_name: str - :param parameters: Parameters supplied to the Create Dedicated Host Group. Is either a - DedicatedHostGroup type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.compute.models.DedicatedHostGroup or IO[bytes] - :return: DedicatedHostGroup or the result of cls(response) - :rtype: ~azure.mgmt.compute.models.DedicatedHostGroup - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.DedicatedHostGroup] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _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, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - 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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def update( - self, - resource_group_name: str, - host_group_name: str, - parameters: _models.DedicatedHostGroupUpdate, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.DedicatedHostGroup: - """Update an dedicated host group. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param host_group_name: The name of the dedicated host group. Required. - :type host_group_name: str - :param parameters: Parameters supplied to the Update Dedicated Host Group operation. Required. - :type parameters: ~azure.mgmt.compute.models.DedicatedHostGroupUpdate - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: DedicatedHostGroup or the result of cls(response) - :rtype: ~azure.mgmt.compute.models.DedicatedHostGroup - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def update( - self, - resource_group_name: str, - host_group_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.DedicatedHostGroup: - """Update an dedicated host group. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param host_group_name: The name of the dedicated host group. Required. - :type host_group_name: str - :param parameters: Parameters supplied to the Update Dedicated Host Group operation. Required. - :type parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: DedicatedHostGroup or the result of cls(response) - :rtype: ~azure.mgmt.compute.models.DedicatedHostGroup - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def update( - self, - resource_group_name: str, - host_group_name: str, - parameters: Union[_models.DedicatedHostGroupUpdate, IO[bytes]], - **kwargs: Any - ) -> _models.DedicatedHostGroup: - """Update an dedicated host group. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param host_group_name: The name of the dedicated host group. Required. - :type host_group_name: str - :param parameters: Parameters supplied to the Update Dedicated Host Group operation. Is either - a DedicatedHostGroupUpdate type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.compute.models.DedicatedHostGroupUpdate or IO[bytes] - :return: DedicatedHostGroup or the result of cls(response) - :rtype: ~azure.mgmt.compute.models.DedicatedHostGroup - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.DedicatedHostGroup] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _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, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("DedicatedHostGroup", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def delete(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. The name is case insensitive. - Required. - :type resource_group_name: str - :param host_group_name: The name of the dedicated host group. Required. - :type host_group_name: str - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - - _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, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 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, {}) # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/operations/_dedicated_hosts_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/operations/_dedicated_hosts_operations.py deleted file mode 100644 index 3b221393166b..000000000000 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/operations/_dedicated_hosts_operations.py +++ /dev/null @@ -1,1070 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from collections.abc import MutableMapping -from io import IOBase -from typing import Any, AsyncIterator, Callable, IO, Optional, TypeVar, Union, cast, overload - -from azure.core import AsyncPipelineClient -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - StreamClosedError, - StreamConsumedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ..._utils.serialization import Deserializer, Serializer -from ...operations._dedicated_hosts_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_available_sizes_request, - build_list_by_host_group_request, - build_redeploy_request, - build_restart_request, - build_update_request, -) -from .._configuration import ComputeManagementClientConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] -List = list - - -class DedicatedHostsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.compute.aio.ComputeManagementClient`'s - :attr:`dedicated_hosts` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list_by_host_group( - self, resource_group_name: str, host_group_name: str, **kwargs: Any - ) -> AsyncItemPaged["_models.DedicatedHost"]: - """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. The name is case insensitive. - Required. - :type resource_group_name: str - :param host_group_name: The name of the dedicated host group. Required. - :type host_group_name: str - :return: An iterator like instance of either DedicatedHost or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.models.DedicatedHost] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[_models.DedicatedHostListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_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, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - _request = HttpRequest("GET", next_link) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @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. The name is case insensitive. - Required. - :type resource_group_name: str - :param host_group_name: The name of the dedicated host group. Required. - :type host_group_name: str - :param host_name: The name of the dedicated host. Required. - :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. Known values are: "instanceView", "userData", and "resiliencyView". Default value is - None. - :type expand: str or ~azure.mgmt.compute.models.InstanceViewTypes - :return: DedicatedHost or the result of cls(response) - :rtype: ~azure.mgmt.compute.models.DedicatedHost - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[_models.DedicatedHost] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - host_group_name=host_group_name, - host_name=host_name, - subscription_id=self._config.subscription_id, - expand=expand, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("DedicatedHost", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - host_group_name: str, - host_name: str, - parameters: Union[_models.DedicatedHost, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "DedicatedHost") - - _request = build_create_or_update_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, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 201: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - host_group_name: str, - host_name: str, - parameters: _models.DedicatedHost, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.DedicatedHost]: - """Create or update a dedicated host . - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param host_group_name: The name of the dedicated host group. Required. - :type host_group_name: str - :param host_name: The name of the dedicated host. Required. - :type host_name: str - :param parameters: Parameters supplied to the Create Dedicated Host. Required. - :type parameters: ~azure.mgmt.compute.models.DedicatedHost - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either DedicatedHost or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.DedicatedHost] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - host_group_name: str, - host_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.DedicatedHost]: - """Create or update a dedicated host . - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param host_group_name: The name of the dedicated host group. Required. - :type host_group_name: str - :param host_name: The name of the dedicated host. Required. - :type host_name: str - :param parameters: Parameters supplied to the Create Dedicated Host. Required. - :type parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either DedicatedHost or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.DedicatedHost] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - host_group_name: str, - host_name: str, - parameters: Union[_models.DedicatedHost, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.DedicatedHost]: - """Create or update a dedicated host . - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param host_group_name: The name of the dedicated host group. Required. - :type host_group_name: str - :param host_name: The name of the dedicated host. Required. - :type host_name: str - :param parameters: Parameters supplied to the Create Dedicated Host. Is either a DedicatedHost - type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.compute.models.DedicatedHost or IO[bytes] - :return: An instance of AsyncLROPoller that returns either DedicatedHost or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.DedicatedHost] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.DedicatedHost] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._create_or_update_initial( - resource_group_name=resource_group_name, - 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, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("DedicatedHost", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.DedicatedHost].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.DedicatedHost]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _update_initial( - self, - resource_group_name: str, - host_group_name: str, - host_name: str, - parameters: Union[_models.DedicatedHostUpdate, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "DedicatedHostUpdate") - - _request = build_update_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, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_update( - self, - resource_group_name: str, - host_group_name: str, - host_name: str, - parameters: _models.DedicatedHostUpdate, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.DedicatedHost]: - """Update a dedicated host . - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param host_group_name: The name of the dedicated host group. Required. - :type host_group_name: str - :param host_name: The name of the dedicated host. Required. - :type host_name: str - :param parameters: Parameters supplied to the Update Dedicated Host operation. Required. - :type parameters: ~azure.mgmt.compute.models.DedicatedHostUpdate - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either DedicatedHost or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.DedicatedHost] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update( - self, - resource_group_name: str, - host_group_name: str, - host_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.DedicatedHost]: - """Update a dedicated host . - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param host_group_name: The name of the dedicated host group. Required. - :type host_group_name: str - :param host_name: The name of the dedicated host. Required. - :type host_name: str - :param parameters: Parameters supplied to the Update Dedicated Host operation. Required. - :type parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either DedicatedHost or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.DedicatedHost] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_update( - self, - resource_group_name: str, - host_group_name: str, - host_name: str, - parameters: Union[_models.DedicatedHostUpdate, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.DedicatedHost]: - """Update a dedicated host . - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param host_group_name: The name of the dedicated host group. Required. - :type host_group_name: str - :param host_name: The name of the dedicated host. Required. - :type host_name: str - :param parameters: Parameters supplied to the Update Dedicated Host operation. Is either a - DedicatedHostUpdate type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.compute.models.DedicatedHostUpdate or IO[bytes] - :return: An instance of AsyncLROPoller that returns either DedicatedHost or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.DedicatedHost] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.DedicatedHost] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._update_initial( - resource_group_name=resource_group_name, - 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, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - response_headers = {} - response = pipeline_response.http_response - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = self._deserialize("DedicatedHost", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.DedicatedHost].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.DedicatedHost]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, host_group_name: str, host_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_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, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_delete( - 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. The name is case insensitive. - Required. - :type resource_group_name: str - :param host_group_name: The name of the dedicated host group. Required. - :type host_group_name: str - :param host_name: The name of the dedicated host. Required. - :type host_name: str - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._delete_initial( - 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, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list_available_sizes( - self, resource_group_name: str, host_group_name: str, host_name: str, **kwargs: Any - ) -> AsyncItemPaged[str]: - """Lists all available dedicated host sizes to which the specified dedicated host can be resized. - NOTE: The dedicated host sizes provided can be used to only scale up the existing dedicated - host. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param host_group_name: The name of the dedicated host group. Required. - :type host_group_name: str - :param host_name: The name of the dedicated host. Required. - :type host_name: str - :return: An iterator like instance of either str or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[str] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[_models.DedicatedHostSizeListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_available_sizes_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, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - _request = HttpRequest("GET", next_link) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("DedicatedHostSizeListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - async def _redeploy_initial( - self, resource_group_name: str, host_group_name: str, host_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_redeploy_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, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [202]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_redeploy( - self, resource_group_name: str, host_group_name: str, host_name: str, **kwargs: Any - ) -> AsyncLROPoller[None]: - """Redeploy the dedicated host. The operation will complete successfully once the dedicated host - has migrated to a new node and is running. To determine the health of VMs deployed on the - dedicated host after the redeploy check the Resource Health Center in the Azure Portal. Please - refer to https://docs.microsoft.com/azure/service-health/resource-health-overview for more - details. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param host_group_name: The name of the dedicated host group. Required. - :type host_group_name: str - :param host_name: The name of the dedicated host. Required. - :type host_name: str - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._redeploy_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, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _restart_initial( - self, resource_group_name: str, host_group_name: str, host_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_restart_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, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_restart( - 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/azure/service-health/resource-health-overview for more details. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param host_group_name: The name of the dedicated host group. Required. - :type host_group_name: str - :param host_name: The name of the dedicated host. Required. - :type host_name: str - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._restart_initial( - 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, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/operations/_disk_accesses_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/operations/_disk_accesses_operations.py deleted file mode 100644 index c9f9d5080013..000000000000 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/operations/_disk_accesses_operations.py +++ /dev/null @@ -1,1330 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from collections.abc import MutableMapping -from io import IOBase -from typing import Any, AsyncIterator, Callable, IO, Optional, TypeVar, Union, cast, overload - -from azure.core import AsyncPipelineClient -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - StreamClosedError, - StreamConsumedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ..._utils.serialization import Deserializer, Serializer -from ...operations._disk_accesses_operations import ( - build_create_or_update_request, - build_delete_a_private_endpoint_connection_request, - build_delete_request, - build_get_a_private_endpoint_connection_request, - build_get_private_link_resources_request, - build_get_request, - build_list_by_resource_group_request, - build_list_private_endpoint_connections_request, - build_list_request, - build_update_a_private_endpoint_connection_request, - build_update_request, -) -from .._configuration import ComputeManagementClientConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] -List = list - - -class DiskAccessesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.compute.aio.ComputeManagementClient`'s - :attr:`disk_accesses` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list(self, **kwargs: Any) -> AsyncItemPaged["_models.DiskAccess"]: - """Lists all the disk access resources under a subscription. - - :return: An iterator like instance of either DiskAccess or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.models.DiskAccess] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-01-02")) - cls: ClsType[_models.DiskAccessList] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - _request = HttpRequest("GET", next_link) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("DiskAccessList", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @distributed_trace - def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> AsyncItemPaged["_models.DiskAccess"]: - """Lists all the disk access resources under a resource group. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :return: An iterator like instance of either DiskAccess or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.models.DiskAccess] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-01-02")) - cls: ClsType[_models.DiskAccessList] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_by_resource_group_request( - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - _request = HttpRequest("GET", next_link) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("DiskAccessList", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @distributed_trace_async - async def get(self, resource_group_name: str, disk_access_name: str, **kwargs: Any) -> _models.DiskAccess: - """Gets information about a disk access resource. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param disk_access_name: The name of the disk access resource that is being created. The name - can't be changed after the disk encryption set is created. Supported characters for the name - are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. - :type disk_access_name: str - :return: DiskAccess or the result of cls(response) - :rtype: ~azure.mgmt.compute.models.DiskAccess - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-01-02")) - cls: ClsType[_models.DiskAccess] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - disk_access_name=disk_access_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("DiskAccess", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - disk_access_name: str, - disk_access: Union[_models.DiskAccess, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-01-02")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(disk_access, (IOBase, bytes)): - _content = disk_access - else: - _json = self._serialize.body(disk_access, "DiskAccess") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - disk_access_name=disk_access_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - disk_access_name: str, - disk_access: _models.DiskAccess, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.DiskAccess]: - """Creates or updates a disk access resource. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param disk_access_name: The name of the disk access resource that is being created. The name - can't be changed after the disk encryption set is created. Supported characters for the name - are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. - :type disk_access_name: str - :param disk_access: disk access object supplied in the body of the Put disk access operation. - Required. - :type disk_access: ~azure.mgmt.compute.models.DiskAccess - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either DiskAccess or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.DiskAccess] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - disk_access_name: str, - disk_access: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.DiskAccess]: - """Creates or updates a disk access resource. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param disk_access_name: The name of the disk access resource that is being created. The name - can't be changed after the disk encryption set is created. Supported characters for the name - are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. - :type disk_access_name: str - :param disk_access: disk access object supplied in the body of the Put disk access operation. - Required. - :type disk_access: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either DiskAccess or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.DiskAccess] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - disk_access_name: str, - disk_access: Union[_models.DiskAccess, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.DiskAccess]: - """Creates or updates a disk access resource. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param disk_access_name: The name of the disk access resource that is being created. The name - can't be changed after the disk encryption set is created. Supported characters for the name - are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. - :type disk_access_name: str - :param disk_access: disk access object supplied in the body of the Put disk access operation. - Is either a DiskAccess type or a IO[bytes] type. Required. - :type disk_access: ~azure.mgmt.compute.models.DiskAccess or IO[bytes] - :return: An instance of AsyncLROPoller that returns either DiskAccess or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.DiskAccess] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-01-02")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.DiskAccess] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._create_or_update_initial( - resource_group_name=resource_group_name, - disk_access_name=disk_access_name, - disk_access=disk_access, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("DiskAccess", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.DiskAccess].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.DiskAccess]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _update_initial( - self, - resource_group_name: str, - disk_access_name: str, - disk_access: Union[_models.DiskAccessUpdate, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-01-02")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(disk_access, (IOBase, bytes)): - _content = disk_access - else: - _json = self._serialize.body(disk_access, "DiskAccessUpdate") - - _request = build_update_request( - resource_group_name=resource_group_name, - disk_access_name=disk_access_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_update( - self, - resource_group_name: str, - disk_access_name: str, - disk_access: _models.DiskAccessUpdate, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.DiskAccess]: - """Updates (patches) a disk access resource. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param disk_access_name: The name of the disk access resource that is being created. The name - can't be changed after the disk encryption set is created. Supported characters for the name - are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. - :type disk_access_name: str - :param disk_access: disk access object supplied in the body of the Patch disk access operation. - Required. - :type disk_access: ~azure.mgmt.compute.models.DiskAccessUpdate - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either DiskAccess or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.DiskAccess] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update( - self, - resource_group_name: str, - disk_access_name: str, - disk_access: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.DiskAccess]: - """Updates (patches) a disk access resource. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param disk_access_name: The name of the disk access resource that is being created. The name - can't be changed after the disk encryption set is created. Supported characters for the name - are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. - :type disk_access_name: str - :param disk_access: disk access object supplied in the body of the Patch disk access operation. - Required. - :type disk_access: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either DiskAccess or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.DiskAccess] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_update( - self, - resource_group_name: str, - disk_access_name: str, - disk_access: Union[_models.DiskAccessUpdate, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.DiskAccess]: - """Updates (patches) a disk access resource. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param disk_access_name: The name of the disk access resource that is being created. The name - can't be changed after the disk encryption set is created. Supported characters for the name - are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. - :type disk_access_name: str - :param disk_access: disk access object supplied in the body of the Patch disk access operation. - Is either a DiskAccessUpdate type or a IO[bytes] type. Required. - :type disk_access: ~azure.mgmt.compute.models.DiskAccessUpdate or IO[bytes] - :return: An instance of AsyncLROPoller that returns either DiskAccess or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.DiskAccess] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-01-02")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.DiskAccess] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._update_initial( - resource_group_name=resource_group_name, - disk_access_name=disk_access_name, - disk_access=disk_access, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("DiskAccess", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.DiskAccess].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.DiskAccess]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, disk_access_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-01-02")) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - disk_access_name=disk_access_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_delete( - self, resource_group_name: str, disk_access_name: str, **kwargs: Any - ) -> AsyncLROPoller[None]: - """Deletes a disk access resource. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param disk_access_name: The name of the disk access resource that is being created. The name - can't be changed after the disk encryption set is created. Supported characters for the name - are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. - :type disk_access_name: str - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-01-02")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._delete_initial( - resource_group_name=resource_group_name, - disk_access_name=disk_access_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list_private_endpoint_connections( - self, resource_group_name: str, disk_access_name: str, **kwargs: Any - ) -> AsyncItemPaged["_models.PrivateEndpointConnection"]: - """List information about private endpoint connections under a disk access resource. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param disk_access_name: The name of the disk access resource that is being created. The name - can't be changed after the disk encryption set is created. Supported characters for the name - are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. - :type disk_access_name: str - :return: An iterator like instance of either PrivateEndpointConnection or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.models.PrivateEndpointConnection] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-01-02")) - cls: ClsType[_models.PrivateEndpointConnectionListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_private_endpoint_connections_request( - resource_group_name=resource_group_name, - disk_access_name=disk_access_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - _request = HttpRequest("GET", next_link) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("PrivateEndpointConnectionListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @distributed_trace_async - async def get_a_private_endpoint_connection( - self, resource_group_name: str, disk_access_name: str, private_endpoint_connection_name: str, **kwargs: Any - ) -> _models.PrivateEndpointConnection: - """Gets information about a private endpoint connection under a disk access resource. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param disk_access_name: The name of the disk access resource that is being created. The name - can't be changed after the disk encryption set is created. Supported characters for the name - are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. - :type disk_access_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection. Required. - :type private_endpoint_connection_name: str - :return: PrivateEndpointConnection or the result of cls(response) - :rtype: ~azure.mgmt.compute.models.PrivateEndpointConnection - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-01-02")) - cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) - - _request = build_get_a_private_endpoint_connection_request( - resource_group_name=resource_group_name, - disk_access_name=disk_access_name, - private_endpoint_connection_name=private_endpoint_connection_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _update_a_private_endpoint_connection_initial( # pylint: disable=name-too-long - self, - resource_group_name: str, - disk_access_name: str, - private_endpoint_connection_name: str, - private_endpoint_connection: Union[_models.PrivateEndpointConnection, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-01-02")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(private_endpoint_connection, (IOBase, bytes)): - _content = private_endpoint_connection - else: - _json = self._serialize.body(private_endpoint_connection, "PrivateEndpointConnection") - - _request = build_update_a_private_endpoint_connection_request( - resource_group_name=resource_group_name, - disk_access_name=disk_access_name, - private_endpoint_connection_name=private_endpoint_connection_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_update_a_private_endpoint_connection( # pylint: disable=name-too-long - self, - resource_group_name: str, - disk_access_name: str, - private_endpoint_connection_name: str, - private_endpoint_connection: _models.PrivateEndpointConnection, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.PrivateEndpointConnection]: - """Approve or reject a private endpoint connection under disk access resource, this can't be used - to create a new private endpoint connection. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param disk_access_name: The name of the disk access resource that is being created. The name - can't be changed after the disk encryption set is created. Supported characters for the name - are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. - :type disk_access_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection. Required. - :type private_endpoint_connection_name: str - :param private_endpoint_connection: private endpoint connection object supplied in the body of - the Put private endpoint connection operation. Required. - :type private_endpoint_connection: ~azure.mgmt.compute.models.PrivateEndpointConnection - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either PrivateEndpointConnection or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.PrivateEndpointConnection] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update_a_private_endpoint_connection( # pylint: disable=name-too-long - self, - resource_group_name: str, - disk_access_name: str, - private_endpoint_connection_name: str, - private_endpoint_connection: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.PrivateEndpointConnection]: - """Approve or reject a private endpoint connection under disk access resource, this can't be used - to create a new private endpoint connection. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param disk_access_name: The name of the disk access resource that is being created. The name - can't be changed after the disk encryption set is created. Supported characters for the name - are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. - :type disk_access_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection. Required. - :type private_endpoint_connection_name: str - :param private_endpoint_connection: private endpoint connection object supplied in the body of - the Put private endpoint connection operation. Required. - :type private_endpoint_connection: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either PrivateEndpointConnection or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.PrivateEndpointConnection] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_update_a_private_endpoint_connection( # pylint: disable=name-too-long - self, - resource_group_name: str, - disk_access_name: str, - private_endpoint_connection_name: str, - private_endpoint_connection: Union[_models.PrivateEndpointConnection, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.PrivateEndpointConnection]: - """Approve or reject a private endpoint connection under disk access resource, this can't be used - to create a new private endpoint connection. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param disk_access_name: The name of the disk access resource that is being created. The name - can't be changed after the disk encryption set is created. Supported characters for the name - are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. - :type disk_access_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection. Required. - :type private_endpoint_connection_name: str - :param private_endpoint_connection: private endpoint connection object supplied in the body of - the Put private endpoint connection operation. Is either a PrivateEndpointConnection type or a - IO[bytes] type. Required. - :type private_endpoint_connection: ~azure.mgmt.compute.models.PrivateEndpointConnection or - IO[bytes] - :return: An instance of AsyncLROPoller that returns either PrivateEndpointConnection or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.PrivateEndpointConnection] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-01-02")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._update_a_private_endpoint_connection_initial( - resource_group_name=resource_group_name, - disk_access_name=disk_access_name, - private_endpoint_connection_name=private_endpoint_connection_name, - private_endpoint_connection=private_endpoint_connection, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.PrivateEndpointConnection].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.PrivateEndpointConnection]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_a_private_endpoint_connection_initial( # pylint: disable=name-too-long - self, resource_group_name: str, disk_access_name: str, private_endpoint_connection_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-01-02")) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_a_private_endpoint_connection_request( - resource_group_name=resource_group_name, - disk_access_name=disk_access_name, - private_endpoint_connection_name=private_endpoint_connection_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_delete_a_private_endpoint_connection( # pylint: disable=name-too-long - self, resource_group_name: str, disk_access_name: str, private_endpoint_connection_name: str, **kwargs: Any - ) -> AsyncLROPoller[None]: - """Deletes a private endpoint connection under a disk access resource. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param disk_access_name: The name of the disk access resource that is being created. The name - can't be changed after the disk encryption set is created. Supported characters for the name - are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. - :type disk_access_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection. Required. - :type private_endpoint_connection_name: str - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-01-02")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._delete_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, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace_async - async def get_private_link_resources( - self, resource_group_name: str, disk_access_name: str, **kwargs: Any - ) -> _models.PrivateLinkResourceListResult: - """Gets the private link resources possible under disk access resource. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param disk_access_name: The name of the disk access resource that is being created. The name - can't be changed after the disk encryption set is created. Supported characters for the name - are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. - :type disk_access_name: str - :return: PrivateLinkResourceListResult or the result of cls(response) - :rtype: ~azure.mgmt.compute.models.PrivateLinkResourceListResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-01-02")) - cls: ClsType[_models.PrivateLinkResourceListResult] = kwargs.pop("cls", None) - - _request = build_get_private_link_resources_request( - resource_group_name=resource_group_name, - disk_access_name=disk_access_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("PrivateLinkResourceListResult", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/operations/_disk_encryption_sets_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/operations/_disk_encryption_sets_operations.py deleted file mode 100644 index c135d4d0fdf2..000000000000 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/operations/_disk_encryption_sets_operations.py +++ /dev/null @@ -1,862 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from collections.abc import MutableMapping -from io import IOBase -from typing import Any, AsyncIterator, Callable, IO, Optional, TypeVar, Union, cast, overload - -from azure.core import AsyncPipelineClient -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - StreamClosedError, - StreamConsumedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ..._utils.serialization import Deserializer, Serializer -from ...operations._disk_encryption_sets_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_associated_resources_request, - build_list_by_resource_group_request, - build_list_request, - build_update_request, -) -from .._configuration import ComputeManagementClientConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] -List = list - - -class DiskEncryptionSetsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.compute.aio.ComputeManagementClient`'s - :attr:`disk_encryption_sets` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list(self, **kwargs: Any) -> AsyncItemPaged["_models.DiskEncryptionSet"]: - """Lists all the disk encryption sets under a subscription. - - :return: An iterator like instance of either DiskEncryptionSet or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.models.DiskEncryptionSet] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-01-02")) - cls: ClsType[_models.DiskEncryptionSetList] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - _request = HttpRequest("GET", next_link) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("DiskEncryptionSetList", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @distributed_trace - def list_by_resource_group( - self, resource_group_name: str, **kwargs: Any - ) -> AsyncItemPaged["_models.DiskEncryptionSet"]: - """Lists all the disk encryption sets under a resource group. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :return: An iterator like instance of either DiskEncryptionSet or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.models.DiskEncryptionSet] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-01-02")) - cls: ClsType[_models.DiskEncryptionSetList] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_by_resource_group_request( - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - _request = HttpRequest("GET", next_link) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("DiskEncryptionSetList", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @distributed_trace_async - async def get( - self, resource_group_name: str, disk_encryption_set_name: str, **kwargs: Any - ) -> _models.DiskEncryptionSet: - """Gets information about a disk encryption set. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param disk_encryption_set_name: The name of the disk encryption set that is being created. The - name can't be changed after the disk encryption set is created. Supported characters for the - name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. - :type disk_encryption_set_name: str - :return: DiskEncryptionSet or the result of cls(response) - :rtype: ~azure.mgmt.compute.models.DiskEncryptionSet - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-01-02")) - cls: ClsType[_models.DiskEncryptionSet] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - disk_encryption_set_name=disk_encryption_set_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("DiskEncryptionSet", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - disk_encryption_set_name: str, - disk_encryption_set: Union[_models.DiskEncryptionSet, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-01-02")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(disk_encryption_set, (IOBase, bytes)): - _content = disk_encryption_set - else: - _json = self._serialize.body(disk_encryption_set, "DiskEncryptionSet") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - disk_encryption_set_name=disk_encryption_set_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - disk_encryption_set_name: str, - disk_encryption_set: _models.DiskEncryptionSet, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.DiskEncryptionSet]: - """Creates or updates a disk encryption set. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param disk_encryption_set_name: The name of the disk encryption set that is being created. The - name can't be changed after the disk encryption set is created. Supported characters for the - name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. - :type disk_encryption_set_name: str - :param disk_encryption_set: disk encryption set object supplied in the body of the Put disk - encryption set operation. Required. - :type disk_encryption_set: ~azure.mgmt.compute.models.DiskEncryptionSet - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either DiskEncryptionSet or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.DiskEncryptionSet] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - disk_encryption_set_name: str, - disk_encryption_set: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.DiskEncryptionSet]: - """Creates or updates a disk encryption set. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param disk_encryption_set_name: The name of the disk encryption set that is being created. The - name can't be changed after the disk encryption set is created. Supported characters for the - name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. - :type disk_encryption_set_name: str - :param disk_encryption_set: disk encryption set object supplied in the body of the Put disk - encryption set operation. Required. - :type disk_encryption_set: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either DiskEncryptionSet or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.DiskEncryptionSet] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - disk_encryption_set_name: str, - disk_encryption_set: Union[_models.DiskEncryptionSet, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.DiskEncryptionSet]: - """Creates or updates a disk encryption set. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param disk_encryption_set_name: The name of the disk encryption set that is being created. The - name can't be changed after the disk encryption set is created. Supported characters for the - name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. - :type disk_encryption_set_name: str - :param disk_encryption_set: disk encryption set object supplied in the body of the Put disk - encryption set operation. Is either a DiskEncryptionSet type or a IO[bytes] type. Required. - :type disk_encryption_set: ~azure.mgmt.compute.models.DiskEncryptionSet or IO[bytes] - :return: An instance of AsyncLROPoller that returns either DiskEncryptionSet or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.DiskEncryptionSet] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-01-02")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.DiskEncryptionSet] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._create_or_update_initial( - resource_group_name=resource_group_name, - 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, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("DiskEncryptionSet", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.DiskEncryptionSet].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.DiskEncryptionSet]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _update_initial( - self, - resource_group_name: str, - disk_encryption_set_name: str, - disk_encryption_set: Union[_models.DiskEncryptionSetUpdate, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-01-02")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(disk_encryption_set, (IOBase, bytes)): - _content = disk_encryption_set - else: - _json = self._serialize.body(disk_encryption_set, "DiskEncryptionSetUpdate") - - _request = build_update_request( - resource_group_name=resource_group_name, - disk_encryption_set_name=disk_encryption_set_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_update( - self, - resource_group_name: str, - disk_encryption_set_name: str, - disk_encryption_set: _models.DiskEncryptionSetUpdate, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.DiskEncryptionSet]: - """Updates (patches) a disk encryption set. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param disk_encryption_set_name: The name of the disk encryption set that is being created. The - name can't be changed after the disk encryption set is created. Supported characters for the - name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. - :type disk_encryption_set_name: str - :param disk_encryption_set: disk encryption set object supplied in the body of the Patch disk - encryption set operation. Required. - :type disk_encryption_set: ~azure.mgmt.compute.models.DiskEncryptionSetUpdate - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either DiskEncryptionSet or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.DiskEncryptionSet] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update( - self, - resource_group_name: str, - disk_encryption_set_name: str, - disk_encryption_set: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.DiskEncryptionSet]: - """Updates (patches) a disk encryption set. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param disk_encryption_set_name: The name of the disk encryption set that is being created. The - name can't be changed after the disk encryption set is created. Supported characters for the - name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. - :type disk_encryption_set_name: str - :param disk_encryption_set: disk encryption set object supplied in the body of the Patch disk - encryption set operation. Required. - :type disk_encryption_set: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either DiskEncryptionSet or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.DiskEncryptionSet] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_update( - self, - resource_group_name: str, - disk_encryption_set_name: str, - disk_encryption_set: Union[_models.DiskEncryptionSetUpdate, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.DiskEncryptionSet]: - """Updates (patches) a disk encryption set. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param disk_encryption_set_name: The name of the disk encryption set that is being created. The - name can't be changed after the disk encryption set is created. Supported characters for the - name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. - :type disk_encryption_set_name: str - :param disk_encryption_set: disk encryption set object supplied in the body of the Patch disk - encryption set operation. Is either a DiskEncryptionSetUpdate type or a IO[bytes] type. - Required. - :type disk_encryption_set: ~azure.mgmt.compute.models.DiskEncryptionSetUpdate or IO[bytes] - :return: An instance of AsyncLROPoller that returns either DiskEncryptionSet or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.DiskEncryptionSet] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-01-02")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.DiskEncryptionSet] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._update_initial( - resource_group_name=resource_group_name, - 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, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("DiskEncryptionSet", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.DiskEncryptionSet].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.DiskEncryptionSet]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, disk_encryption_set_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-01-02")) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - disk_encryption_set_name=disk_encryption_set_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_delete( - self, resource_group_name: str, disk_encryption_set_name: str, **kwargs: Any - ) -> AsyncLROPoller[None]: - """Deletes a disk encryption set. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param disk_encryption_set_name: The name of the disk encryption set that is being created. The - name can't be changed after the disk encryption set is created. Supported characters for the - name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. - :type disk_encryption_set_name: str - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-01-02")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._delete_initial( - resource_group_name=resource_group_name, - disk_encryption_set_name=disk_encryption_set_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list_associated_resources( - self, resource_group_name: str, disk_encryption_set_name: str, **kwargs: Any - ) -> AsyncItemPaged[str]: - """Lists all resources that are encrypted with this disk encryption set. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param disk_encryption_set_name: The name of the disk encryption set that is being created. The - name can't be changed after the disk encryption set is created. Supported characters for the - name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. - :type disk_encryption_set_name: str - :return: An iterator like instance of either str or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[str] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-01-02")) - cls: ClsType[_models.ResourceUriList] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_associated_resources_request( - resource_group_name=resource_group_name, - disk_encryption_set_name=disk_encryption_set_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - _request = HttpRequest("GET", next_link) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("ResourceUriList", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/operations/_disk_restore_point_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/operations/_disk_restore_point_operations.py deleted file mode 100644 index 3ad112e7da66..000000000000 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/operations/_disk_restore_point_operations.py +++ /dev/null @@ -1,575 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from collections.abc import MutableMapping -from io import IOBase -from typing import Any, AsyncIterator, Callable, IO, Optional, TypeVar, Union, cast, overload - -from azure.core import AsyncPipelineClient -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - StreamClosedError, - StreamConsumedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ..._utils.serialization import Deserializer, Serializer -from ...operations._disk_restore_point_operations import ( - build_get_request, - build_grant_access_request, - build_list_by_restore_point_request, - build_revoke_access_request, -) -from .._configuration import ComputeManagementClientConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] -List = list - - -class DiskRestorePointOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.compute.aio.ComputeManagementClient`'s - :attr:`disk_restore_point` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list_by_restore_point( - self, resource_group_name: str, restore_point_collection_name: str, vm_restore_point_name: str, **kwargs: Any - ) -> AsyncItemPaged["_models.DiskRestorePoint"]: - """Lists diskRestorePoints under a vmRestorePoint. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param restore_point_collection_name: The name of the restore point collection that the disk - restore point belongs. Required. - :type restore_point_collection_name: str - :param vm_restore_point_name: The name of the vm restore point that the disk disk restore point - belongs. Required. - :type vm_restore_point_name: str - :return: An iterator like instance of either DiskRestorePoint or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.models.DiskRestorePoint] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-01-02")) - cls: ClsType[_models.DiskRestorePointList] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_by_restore_point_request( - resource_group_name=resource_group_name, - restore_point_collection_name=restore_point_collection_name, - vm_restore_point_name=vm_restore_point_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - _request = HttpRequest("GET", next_link) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("DiskRestorePointList", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @distributed_trace_async - async def get( - self, - resource_group_name: str, - restore_point_collection_name: str, - vm_restore_point_name: str, - disk_restore_point_name: str, - **kwargs: Any - ) -> _models.DiskRestorePoint: - """Get disk restorePoint resource. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param restore_point_collection_name: The name of the restore point collection that the disk - restore point belongs. Required. - :type restore_point_collection_name: str - :param vm_restore_point_name: The name of the vm restore point that the disk disk restore point - belongs. Required. - :type vm_restore_point_name: str - :param disk_restore_point_name: The name of the DiskRestorePoint. Required. - :type disk_restore_point_name: str - :return: DiskRestorePoint or the result of cls(response) - :rtype: ~azure.mgmt.compute.models.DiskRestorePoint - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-01-02")) - cls: ClsType[_models.DiskRestorePoint] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - restore_point_collection_name=restore_point_collection_name, - vm_restore_point_name=vm_restore_point_name, - disk_restore_point_name=disk_restore_point_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("DiskRestorePoint", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _grant_access_initial( - self, - resource_group_name: str, - restore_point_collection_name: str, - vm_restore_point_name: str, - disk_restore_point_name: str, - grant_access_data: Union[_models.GrantAccessData, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-01-02")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(grant_access_data, (IOBase, bytes)): - _content = grant_access_data - else: - _json = self._serialize.body(grant_access_data, "GrantAccessData") - - _request = build_grant_access_request( - resource_group_name=resource_group_name, - restore_point_collection_name=restore_point_collection_name, - vm_restore_point_name=vm_restore_point_name, - disk_restore_point_name=disk_restore_point_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_grant_access( - self, - resource_group_name: str, - restore_point_collection_name: str, - vm_restore_point_name: str, - disk_restore_point_name: str, - grant_access_data: _models.GrantAccessData, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.AccessUri]: - """Grants access to a diskRestorePoint. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param restore_point_collection_name: The name of the restore point collection that the disk - restore point belongs. Required. - :type restore_point_collection_name: str - :param vm_restore_point_name: The name of the vm restore point that the disk disk restore point - belongs. Required. - :type vm_restore_point_name: str - :param disk_restore_point_name: The name of the DiskRestorePoint. Required. - :type disk_restore_point_name: str - :param grant_access_data: Access data object supplied in the body of the get disk access - operation. Required. - :type grant_access_data: ~azure.mgmt.compute.models.GrantAccessData - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either AccessUri or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.AccessUri] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_grant_access( - self, - resource_group_name: str, - restore_point_collection_name: str, - vm_restore_point_name: str, - disk_restore_point_name: str, - grant_access_data: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.AccessUri]: - """Grants access to a diskRestorePoint. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param restore_point_collection_name: The name of the restore point collection that the disk - restore point belongs. Required. - :type restore_point_collection_name: str - :param vm_restore_point_name: The name of the vm restore point that the disk disk restore point - belongs. Required. - :type vm_restore_point_name: str - :param disk_restore_point_name: The name of the DiskRestorePoint. Required. - :type disk_restore_point_name: str - :param grant_access_data: Access data object supplied in the body of the get disk access - operation. Required. - :type grant_access_data: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either AccessUri or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.AccessUri] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_grant_access( - self, - resource_group_name: str, - restore_point_collection_name: str, - vm_restore_point_name: str, - disk_restore_point_name: str, - grant_access_data: Union[_models.GrantAccessData, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.AccessUri]: - """Grants access to a diskRestorePoint. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param restore_point_collection_name: The name of the restore point collection that the disk - restore point belongs. Required. - :type restore_point_collection_name: str - :param vm_restore_point_name: The name of the vm restore point that the disk disk restore point - belongs. Required. - :type vm_restore_point_name: str - :param disk_restore_point_name: The name of the DiskRestorePoint. Required. - :type disk_restore_point_name: str - :param grant_access_data: Access data object supplied in the body of the get disk access - operation. Is either a GrantAccessData type or a IO[bytes] type. Required. - :type grant_access_data: ~azure.mgmt.compute.models.GrantAccessData or IO[bytes] - :return: An instance of AsyncLROPoller that returns either AccessUri or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.AccessUri] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-01-02")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AccessUri] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._grant_access_initial( - resource_group_name=resource_group_name, - restore_point_collection_name=restore_point_collection_name, - vm_restore_point_name=vm_restore_point_name, - disk_restore_point_name=disk_restore_point_name, - grant_access_data=grant_access_data, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("AccessUri", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.AccessUri].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.AccessUri]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _revoke_access_initial( - self, - resource_group_name: str, - restore_point_collection_name: str, - vm_restore_point_name: str, - disk_restore_point_name: str, - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-01-02")) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_revoke_access_request( - resource_group_name=resource_group_name, - restore_point_collection_name=restore_point_collection_name, - vm_restore_point_name=vm_restore_point_name, - disk_restore_point_name=disk_restore_point_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_revoke_access( - self, - resource_group_name: str, - restore_point_collection_name: str, - vm_restore_point_name: str, - disk_restore_point_name: str, - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Revokes access to a diskRestorePoint. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param restore_point_collection_name: The name of the restore point collection that the disk - restore point belongs. Required. - :type restore_point_collection_name: str - :param vm_restore_point_name: The name of the vm restore point that the disk disk restore point - belongs. Required. - :type vm_restore_point_name: str - :param disk_restore_point_name: The name of the DiskRestorePoint. Required. - :type disk_restore_point_name: str - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-01-02")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._revoke_access_initial( - resource_group_name=resource_group_name, - restore_point_collection_name=restore_point_collection_name, - vm_restore_point_name=vm_restore_point_name, - disk_restore_point_name=disk_restore_point_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/operations/_disks_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/operations/_disks_operations.py deleted file mode 100644 index b2f1bd4ed240..000000000000 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/operations/_disks_operations.py +++ /dev/null @@ -1,1076 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from collections.abc import MutableMapping -from io import IOBase -from typing import Any, AsyncIterator, Callable, IO, Optional, TypeVar, Union, cast, overload - -from azure.core import AsyncPipelineClient -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - StreamClosedError, - StreamConsumedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ..._utils.serialization import Deserializer, Serializer -from ...operations._disks_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_grant_access_request, - build_list_by_resource_group_request, - build_list_request, - build_revoke_access_request, - build_update_request, -) -from .._configuration import ComputeManagementClientConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] -List = list - - -class DisksOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.compute.aio.ComputeManagementClient`'s - :attr:`disks` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list(self, **kwargs: Any) -> AsyncItemPaged["_models.Disk"]: - """Lists all the disks under a subscription. - - :return: An iterator like instance of either Disk or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.models.Disk] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-01-02")) - cls: ClsType[_models.DiskList] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - _request = HttpRequest("GET", next_link) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("DiskList", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @distributed_trace - def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> AsyncItemPaged["_models.Disk"]: - """Lists all the disks under a resource group. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :return: An iterator like instance of either Disk or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.models.Disk] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-01-02")) - cls: ClsType[_models.DiskList] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_by_resource_group_request( - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - _request = HttpRequest("GET", next_link) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("DiskList", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @distributed_trace_async - async def get(self, resource_group_name: str, disk_name: str, **kwargs: Any) -> _models.Disk: - """Gets information about a disk. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param disk_name: The name of the managed disk that is being created. The name can't be changed - after the disk is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The - maximum name length is 80 characters. Required. - :type disk_name: str - :return: Disk or the result of cls(response) - :rtype: ~azure.mgmt.compute.models.Disk - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-01-02")) - cls: ClsType[_models.Disk] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - disk_name=disk_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("Disk", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, resource_group_name: str, disk_name: str, disk: Union[_models.Disk, IO[bytes]], **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-01-02")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(disk, (IOBase, bytes)): - _content = disk - else: - _json = self._serialize.body(disk, "Disk") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - disk_name=disk_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - disk_name: str, - disk: _models.Disk, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.Disk]: - """Creates or updates a disk. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param disk_name: The name of the managed disk that is being created. The name can't be changed - after the disk is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The - maximum name length is 80 characters. Required. - :type disk_name: str - :param disk: Disk object supplied in the body of the Put disk operation. Required. - :type disk: ~azure.mgmt.compute.models.Disk - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either Disk or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.Disk] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - disk_name: str, - disk: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.Disk]: - """Creates or updates a disk. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param disk_name: The name of the managed disk that is being created. The name can't be changed - after the disk is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The - maximum name length is 80 characters. Required. - :type disk_name: str - :param disk: Disk object supplied in the body of the Put disk operation. Required. - :type disk: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either Disk or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.Disk] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, resource_group_name: str, disk_name: str, disk: Union[_models.Disk, IO[bytes]], **kwargs: Any - ) -> AsyncLROPoller[_models.Disk]: - """Creates or updates a disk. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param disk_name: The name of the managed disk that is being created. The name can't be changed - after the disk is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The - maximum name length is 80 characters. Required. - :type disk_name: str - :param disk: Disk object supplied in the body of the Put disk operation. Is either a Disk type - or a IO[bytes] type. Required. - :type disk: ~azure.mgmt.compute.models.Disk or IO[bytes] - :return: An instance of AsyncLROPoller that returns either Disk or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.Disk] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-01-02")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Disk] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._create_or_update_initial( - resource_group_name=resource_group_name, - disk_name=disk_name, - disk=disk, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Disk", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.Disk].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.Disk]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _update_initial( - self, resource_group_name: str, disk_name: str, disk: Union[_models.DiskUpdate, IO[bytes]], **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-01-02")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(disk, (IOBase, bytes)): - _content = disk - else: - _json = self._serialize.body(disk, "DiskUpdate") - - _request = build_update_request( - resource_group_name=resource_group_name, - disk_name=disk_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_update( - self, - resource_group_name: str, - disk_name: str, - disk: _models.DiskUpdate, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.Disk]: - """Updates (patches) a disk. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param disk_name: The name of the managed disk that is being created. The name can't be changed - after the disk is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The - maximum name length is 80 characters. Required. - :type disk_name: str - :param disk: Disk object supplied in the body of the Patch disk operation. Required. - :type disk: ~azure.mgmt.compute.models.DiskUpdate - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either Disk or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.Disk] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update( - self, - resource_group_name: str, - disk_name: str, - disk: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.Disk]: - """Updates (patches) a disk. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param disk_name: The name of the managed disk that is being created. The name can't be changed - after the disk is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The - maximum name length is 80 characters. Required. - :type disk_name: str - :param disk: Disk object supplied in the body of the Patch disk operation. Required. - :type disk: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either Disk or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.Disk] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_update( - self, resource_group_name: str, disk_name: str, disk: Union[_models.DiskUpdate, IO[bytes]], **kwargs: Any - ) -> AsyncLROPoller[_models.Disk]: - """Updates (patches) a disk. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param disk_name: The name of the managed disk that is being created. The name can't be changed - after the disk is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The - maximum name length is 80 characters. Required. - :type disk_name: str - :param disk: Disk object supplied in the body of the Patch disk operation. Is either a - DiskUpdate type or a IO[bytes] type. Required. - :type disk: ~azure.mgmt.compute.models.DiskUpdate or IO[bytes] - :return: An instance of AsyncLROPoller that returns either Disk or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.Disk] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-01-02")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Disk] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._update_initial( - resource_group_name=resource_group_name, - disk_name=disk_name, - disk=disk, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Disk", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.Disk].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.Disk]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial(self, resource_group_name: str, disk_name: str, **kwargs: Any) -> AsyncIterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-01-02")) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - disk_name=disk_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_delete(self, resource_group_name: str, disk_name: str, **kwargs: Any) -> AsyncLROPoller[None]: - """Deletes a disk. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param disk_name: The name of the managed disk that is being created. The name can't be changed - after the disk is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The - maximum name length is 80 characters. Required. - :type disk_name: str - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-01-02")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._delete_initial( - resource_group_name=resource_group_name, - disk_name=disk_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _grant_access_initial( - self, - resource_group_name: str, - disk_name: str, - grant_access_data: Union[_models.GrantAccessData, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-01-02")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(grant_access_data, (IOBase, bytes)): - _content = grant_access_data - else: - _json = self._serialize.body(grant_access_data, "GrantAccessData") - - _request = build_grant_access_request( - resource_group_name=resource_group_name, - disk_name=disk_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_grant_access( - self, - resource_group_name: str, - disk_name: str, - grant_access_data: _models.GrantAccessData, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.AccessUri]: - """Grants access to a disk. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param disk_name: The name of the managed disk that is being created. The name can't be changed - after the disk is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The - maximum name length is 80 characters. Required. - :type disk_name: str - :param grant_access_data: Access data object supplied in the body of the get disk access - operation. Required. - :type grant_access_data: ~azure.mgmt.compute.models.GrantAccessData - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either AccessUri or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.AccessUri] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_grant_access( - self, - resource_group_name: str, - disk_name: str, - grant_access_data: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.AccessUri]: - """Grants access to a disk. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param disk_name: The name of the managed disk that is being created. The name can't be changed - after the disk is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The - maximum name length is 80 characters. Required. - :type disk_name: str - :param grant_access_data: Access data object supplied in the body of the get disk access - operation. Required. - :type grant_access_data: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either AccessUri or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.AccessUri] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_grant_access( - self, - resource_group_name: str, - disk_name: str, - grant_access_data: Union[_models.GrantAccessData, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.AccessUri]: - """Grants access to a disk. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param disk_name: The name of the managed disk that is being created. The name can't be changed - after the disk is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The - maximum name length is 80 characters. Required. - :type disk_name: str - :param grant_access_data: Access data object supplied in the body of the get disk access - operation. Is either a GrantAccessData type or a IO[bytes] type. Required. - :type grant_access_data: ~azure.mgmt.compute.models.GrantAccessData or IO[bytes] - :return: An instance of AsyncLROPoller that returns either AccessUri or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.AccessUri] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-01-02")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AccessUri] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._grant_access_initial( - 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, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("AccessUri", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.AccessUri].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.AccessUri]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _revoke_access_initial( - self, resource_group_name: str, disk_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-01-02")) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_revoke_access_request( - resource_group_name=resource_group_name, - disk_name=disk_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_revoke_access( - self, resource_group_name: str, disk_name: str, **kwargs: Any - ) -> AsyncLROPoller[None]: - """Revokes access to a disk. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param disk_name: The name of the managed disk that is being created. The name can't be changed - after the disk is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The - maximum name length is 80 characters. Required. - :type disk_name: str - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-01-02")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._revoke_access_initial( - resource_group_name=resource_group_name, - disk_name=disk_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/operations/_galleries_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/operations/_galleries_operations.py deleted file mode 100644 index c4e20a657e17..000000000000 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/operations/_galleries_operations.py +++ /dev/null @@ -1,775 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from collections.abc import MutableMapping -from io import IOBase -from typing import Any, AsyncIterator, Callable, IO, Optional, TypeVar, Union, cast, overload - -from azure.core import AsyncPipelineClient -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - StreamClosedError, - StreamConsumedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ..._utils.serialization import Deserializer, Serializer -from ...operations._galleries_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_by_resource_group_request, - build_list_request, - build_update_request, -) -from .._configuration import ComputeManagementClientConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] -List = list - - -class GalleriesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.compute.aio.ComputeManagementClient`'s - :attr:`galleries` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list(self, **kwargs: Any) -> AsyncItemPaged["_models.Gallery"]: - """List galleries under a subscription. - - :return: An iterator like instance of either Gallery or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.models.Gallery] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-03")) - cls: ClsType[_models.GalleryList] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - _request = HttpRequest("GET", next_link) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("GalleryList", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @distributed_trace - def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> AsyncItemPaged["_models.Gallery"]: - """List galleries under a resource group. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :return: An iterator like instance of either Gallery or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.models.Gallery] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-03")) - cls: ClsType[_models.GalleryList] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_by_resource_group_request( - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - _request = HttpRequest("GET", next_link) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("GalleryList", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @distributed_trace_async - async def get( - self, - resource_group_name: str, - gallery_name: str, - select: Optional[Union[str, _models.SelectPermissions]] = None, - expand: Optional[Union[str, _models.GalleryExpandParams]] = None, - **kwargs: Any - ) -> _models.Gallery: - """Retrieves information about a Shared Image Gallery. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :param select: The select expression to apply on the operation. "Permissions" Default value is - None. - :type select: str or ~azure.mgmt.compute.models.SelectPermissions - :param expand: The expand query option to apply on the operation. "SharingProfile/Groups" - Default value is None. - :type expand: str or ~azure.mgmt.compute.models.GalleryExpandParams - :return: Gallery or the result of cls(response) - :rtype: ~azure.mgmt.compute.models.Gallery - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-03")) - cls: ClsType[_models.Gallery] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - gallery_name=gallery_name, - subscription_id=self._config.subscription_id, - select=select, - expand=expand, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("Gallery", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, resource_group_name: str, gallery_name: str, gallery: Union[_models.Gallery, IO[bytes]], **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-03")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(gallery, (IOBase, bytes)): - _content = gallery - else: - _json = self._serialize.body(gallery, "Gallery") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - gallery_name=gallery_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 201: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - gallery_name: str, - gallery: _models.Gallery, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.Gallery]: - """Create or update a Shared Image Gallery. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :param gallery: Parameters supplied to the create or update Shared Image Gallery operation. - Required. - :type gallery: ~azure.mgmt.compute.models.Gallery - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either Gallery or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.Gallery] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - gallery_name: str, - gallery: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.Gallery]: - """Create or update a Shared Image Gallery. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :param gallery: Parameters supplied to the create or update Shared Image Gallery operation. - Required. - :type gallery: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either Gallery or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.Gallery] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, resource_group_name: str, gallery_name: str, gallery: Union[_models.Gallery, IO[bytes]], **kwargs: Any - ) -> AsyncLROPoller[_models.Gallery]: - """Create or update a Shared Image Gallery. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :param gallery: Parameters supplied to the create or update Shared Image Gallery operation. Is - either a Gallery type or a IO[bytes] type. Required. - :type gallery: ~azure.mgmt.compute.models.Gallery or IO[bytes] - :return: An instance of AsyncLROPoller that returns either Gallery or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.Gallery] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-03")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Gallery] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._create_or_update_initial( - resource_group_name=resource_group_name, - gallery_name=gallery_name, - gallery=gallery, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Gallery", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.Gallery].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.Gallery]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _update_initial( - self, - resource_group_name: str, - gallery_name: str, - gallery: Union[_models.GalleryUpdate, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-03")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(gallery, (IOBase, bytes)): - _content = gallery - else: - _json = self._serialize.body(gallery, "GalleryUpdate") - - _request = build_update_request( - resource_group_name=resource_group_name, - gallery_name=gallery_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_update( - self, - resource_group_name: str, - gallery_name: str, - gallery: _models.GalleryUpdate, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.Gallery]: - """Update a Shared Image Gallery. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :param gallery: Parameters supplied to the update Shared Image Gallery operation. Required. - :type gallery: ~azure.mgmt.compute.models.GalleryUpdate - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either Gallery or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.Gallery] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update( - self, - resource_group_name: str, - gallery_name: str, - gallery: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.Gallery]: - """Update a Shared Image Gallery. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :param gallery: Parameters supplied to the update Shared Image Gallery operation. Required. - :type gallery: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either Gallery or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.Gallery] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_update( - self, - resource_group_name: str, - gallery_name: str, - gallery: Union[_models.GalleryUpdate, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.Gallery]: - """Update a Shared Image Gallery. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :param gallery: Parameters supplied to the update Shared Image Gallery operation. Is either a - GalleryUpdate type or a IO[bytes] type. Required. - :type gallery: ~azure.mgmt.compute.models.GalleryUpdate or IO[bytes] - :return: An instance of AsyncLROPoller that returns either Gallery or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.Gallery] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-03")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Gallery] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._update_initial( - resource_group_name=resource_group_name, - gallery_name=gallery_name, - gallery=gallery, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - response_headers = {} - response = pipeline_response.http_response - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = self._deserialize("Gallery", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.Gallery].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.Gallery]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial(self, resource_group_name: str, gallery_name: str, **kwargs: Any) -> AsyncIterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-03")) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - gallery_name=gallery_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_delete(self, resource_group_name: str, gallery_name: str, **kwargs: Any) -> AsyncLROPoller[None]: - """Delete a Shared Image Gallery. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-03")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._delete_initial( - resource_group_name=resource_group_name, - gallery_name=gallery_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/operations/_gallery_application_versions_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/operations/_gallery_application_versions_operations.py deleted file mode 100644 index 14bfdf8cd7fd..000000000000 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/operations/_gallery_application_versions_operations.py +++ /dev/null @@ -1,831 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from collections.abc import MutableMapping -from io import IOBase -from typing import Any, AsyncIterator, Callable, IO, Optional, TypeVar, Union, cast, overload - -from azure.core import AsyncPipelineClient -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - StreamClosedError, - StreamConsumedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ..._utils.serialization import Deserializer, Serializer -from ...operations._gallery_application_versions_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_by_gallery_application_request, - build_update_request, -) -from .._configuration import ComputeManagementClientConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] -List = list - - -class GalleryApplicationVersionsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.compute.aio.ComputeManagementClient`'s - :attr:`gallery_application_versions` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list_by_gallery_application( - self, resource_group_name: str, gallery_name: str, gallery_application_name: str, **kwargs: Any - ) -> AsyncItemPaged["_models.GalleryApplicationVersion"]: - """List gallery Application Versions in a gallery Application Definition. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :param gallery_application_name: The name of the gallery Application Definition to be - retrieved. Required. - :type gallery_application_name: str - :return: An iterator like instance of either GalleryApplicationVersion or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.models.GalleryApplicationVersion] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-03")) - cls: ClsType[_models.GalleryApplicationVersionList] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_by_gallery_application_request( - resource_group_name=resource_group_name, - gallery_name=gallery_name, - gallery_application_name=gallery_application_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - _request = HttpRequest("GET", next_link) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("GalleryApplicationVersionList", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @distributed_trace_async - async def get( - self, - resource_group_name: str, - gallery_name: str, - gallery_application_name: str, - gallery_application_version_name: str, - expand: Optional[Union[str, _models.ReplicationStatusTypes]] = None, - **kwargs: Any - ) -> _models.GalleryApplicationVersion: - """Retrieves information about a gallery Application Version. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :param gallery_application_name: The name of the gallery Application Definition to be - retrieved. Required. - :type gallery_application_name: str - :param gallery_application_version_name: The name of the gallery Application Version to be - retrieved. Required. - :type gallery_application_version_name: str - :param expand: The expand expression to apply on the operation. Known values are: - "ReplicationStatus" and "UefiSettings". Default value is None. - :type expand: str or ~azure.mgmt.compute.models.ReplicationStatusTypes - :return: GalleryApplicationVersion or the result of cls(response) - :rtype: ~azure.mgmt.compute.models.GalleryApplicationVersion - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-03")) - cls: ClsType[_models.GalleryApplicationVersion] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - gallery_name=gallery_name, - gallery_application_name=gallery_application_name, - gallery_application_version_name=gallery_application_version_name, - subscription_id=self._config.subscription_id, - expand=expand, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("GalleryApplicationVersion", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - gallery_name: str, - gallery_application_name: str, - gallery_application_version_name: str, - gallery_application_version: Union[_models.GalleryApplicationVersion, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-03")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(gallery_application_version, (IOBase, bytes)): - _content = gallery_application_version - else: - _json = self._serialize.body(gallery_application_version, "GalleryApplicationVersion") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - gallery_name=gallery_name, - gallery_application_name=gallery_application_name, - gallery_application_version_name=gallery_application_version_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 201: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - gallery_name: str, - gallery_application_name: str, - gallery_application_version_name: str, - gallery_application_version: _models.GalleryApplicationVersion, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.GalleryApplicationVersion]: - """Create or update a gallery Application Version. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :param gallery_application_name: The name of the gallery Application Definition to be - retrieved. Required. - :type gallery_application_name: str - :param gallery_application_version_name: The name of the gallery Application Version to be - retrieved. Required. - :type gallery_application_version_name: str - :param gallery_application_version: Parameters supplied to the create or update gallery - Application Version operation. Required. - :type gallery_application_version: ~azure.mgmt.compute.models.GalleryApplicationVersion - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either GalleryApplicationVersion or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.GalleryApplicationVersion] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - gallery_name: str, - gallery_application_name: str, - gallery_application_version_name: str, - gallery_application_version: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.GalleryApplicationVersion]: - """Create or update a gallery Application Version. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :param gallery_application_name: The name of the gallery Application Definition to be - retrieved. Required. - :type gallery_application_name: str - :param gallery_application_version_name: The name of the gallery Application Version to be - retrieved. Required. - :type gallery_application_version_name: str - :param gallery_application_version: Parameters supplied to the create or update gallery - Application Version operation. Required. - :type gallery_application_version: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either GalleryApplicationVersion or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.GalleryApplicationVersion] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - gallery_name: str, - gallery_application_name: str, - gallery_application_version_name: str, - gallery_application_version: Union[_models.GalleryApplicationVersion, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.GalleryApplicationVersion]: - """Create or update a gallery Application Version. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :param gallery_application_name: The name of the gallery Application Definition to be - retrieved. Required. - :type gallery_application_name: str - :param gallery_application_version_name: The name of the gallery Application Version to be - retrieved. Required. - :type gallery_application_version_name: str - :param gallery_application_version: Parameters supplied to the create or update gallery - Application Version operation. Is either a GalleryApplicationVersion type or a IO[bytes] type. - Required. - :type gallery_application_version: ~azure.mgmt.compute.models.GalleryApplicationVersion or - IO[bytes] - :return: An instance of AsyncLROPoller that returns either GalleryApplicationVersion or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.GalleryApplicationVersion] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-03")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.GalleryApplicationVersion] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._create_or_update_initial( - resource_group_name=resource_group_name, - gallery_name=gallery_name, - 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, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("GalleryApplicationVersion", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.GalleryApplicationVersion].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.GalleryApplicationVersion]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _update_initial( - self, - resource_group_name: str, - gallery_name: str, - gallery_application_name: str, - gallery_application_version_name: str, - gallery_application_version: Union[_models.GalleryApplicationVersionUpdate, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-03")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(gallery_application_version, (IOBase, bytes)): - _content = gallery_application_version - else: - _json = self._serialize.body(gallery_application_version, "GalleryApplicationVersionUpdate") - - _request = build_update_request( - resource_group_name=resource_group_name, - gallery_name=gallery_name, - gallery_application_name=gallery_application_name, - gallery_application_version_name=gallery_application_version_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_update( - self, - resource_group_name: str, - gallery_name: str, - gallery_application_name: str, - gallery_application_version_name: str, - gallery_application_version: _models.GalleryApplicationVersionUpdate, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.GalleryApplicationVersion]: - """Update a gallery Application Version. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :param gallery_application_name: The name of the gallery Application Definition to be - retrieved. Required. - :type gallery_application_name: str - :param gallery_application_version_name: The name of the gallery Application Version to be - retrieved. Required. - :type gallery_application_version_name: str - :param gallery_application_version: Parameters supplied to the update gallery Application - Version operation. Required. - :type gallery_application_version: ~azure.mgmt.compute.models.GalleryApplicationVersionUpdate - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either GalleryApplicationVersion or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.GalleryApplicationVersion] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update( - self, - resource_group_name: str, - gallery_name: str, - gallery_application_name: str, - gallery_application_version_name: str, - gallery_application_version: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.GalleryApplicationVersion]: - """Update a gallery Application Version. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :param gallery_application_name: The name of the gallery Application Definition to be - retrieved. Required. - :type gallery_application_name: str - :param gallery_application_version_name: The name of the gallery Application Version to be - retrieved. Required. - :type gallery_application_version_name: str - :param gallery_application_version: Parameters supplied to the update gallery Application - Version operation. Required. - :type gallery_application_version: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either GalleryApplicationVersion or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.GalleryApplicationVersion] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_update( - self, - resource_group_name: str, - gallery_name: str, - gallery_application_name: str, - gallery_application_version_name: str, - gallery_application_version: Union[_models.GalleryApplicationVersionUpdate, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.GalleryApplicationVersion]: - """Update a gallery Application Version. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :param gallery_application_name: The name of the gallery Application Definition to be - retrieved. Required. - :type gallery_application_name: str - :param gallery_application_version_name: The name of the gallery Application Version to be - retrieved. Required. - :type gallery_application_version_name: str - :param gallery_application_version: Parameters supplied to the update gallery Application - Version operation. Is either a GalleryApplicationVersionUpdate type or a IO[bytes] type. - Required. - :type gallery_application_version: ~azure.mgmt.compute.models.GalleryApplicationVersionUpdate - or IO[bytes] - :return: An instance of AsyncLROPoller that returns either GalleryApplicationVersion or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.GalleryApplicationVersion] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-03")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.GalleryApplicationVersion] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._update_initial( - resource_group_name=resource_group_name, - gallery_name=gallery_name, - 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, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - response_headers = {} - response = pipeline_response.http_response - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = self._deserialize("GalleryApplicationVersion", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.GalleryApplicationVersion].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.GalleryApplicationVersion]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, - resource_group_name: str, - gallery_name: str, - gallery_application_name: str, - gallery_application_version_name: str, - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-03")) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - gallery_name=gallery_name, - gallery_application_name=gallery_application_name, - gallery_application_version_name=gallery_application_version_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_delete( - self, - resource_group_name: str, - gallery_name: str, - gallery_application_name: str, - gallery_application_version_name: str, - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Delete a gallery Application Version. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :param gallery_application_name: The name of the gallery Application Definition to be - retrieved. Required. - :type gallery_application_name: str - :param gallery_application_version_name: The name of the gallery Application Version to be - retrieved. Required. - :type gallery_application_version_name: str - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-03")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._delete_initial( - resource_group_name=resource_group_name, - gallery_name=gallery_name, - gallery_application_name=gallery_application_name, - gallery_application_version_name=gallery_application_version_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/operations/_gallery_applications_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/operations/_gallery_applications_operations.py deleted file mode 100644 index b47635a9c518..000000000000 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/operations/_gallery_applications_operations.py +++ /dev/null @@ -1,756 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from collections.abc import MutableMapping -from io import IOBase -from typing import Any, AsyncIterator, Callable, IO, Optional, TypeVar, Union, cast, overload - -from azure.core import AsyncPipelineClient -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - StreamClosedError, - StreamConsumedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ..._utils.serialization import Deserializer, Serializer -from ...operations._gallery_applications_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_by_gallery_request, - build_update_request, -) -from .._configuration import ComputeManagementClientConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] -List = list - - -class GalleryApplicationsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.compute.aio.ComputeManagementClient`'s - :attr:`gallery_applications` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list_by_gallery( - self, resource_group_name: str, gallery_name: str, **kwargs: Any - ) -> AsyncItemPaged["_models.GalleryApplication"]: - """List gallery Application Definitions in a gallery. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :return: An iterator like instance of either GalleryApplication or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.models.GalleryApplication] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-03")) - cls: ClsType[_models.GalleryApplicationList] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_by_gallery_request( - resource_group_name=resource_group_name, - gallery_name=gallery_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - _request = HttpRequest("GET", next_link) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("GalleryApplicationList", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @distributed_trace_async - async def get( - self, resource_group_name: str, gallery_name: str, gallery_application_name: str, **kwargs: Any - ) -> _models.GalleryApplication: - """Retrieves information about a gallery Application Definition. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :param gallery_application_name: The name of the gallery Application Definition to be - retrieved. Required. - :type gallery_application_name: str - :return: GalleryApplication or the result of cls(response) - :rtype: ~azure.mgmt.compute.models.GalleryApplication - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-03")) - cls: ClsType[_models.GalleryApplication] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - gallery_name=gallery_name, - gallery_application_name=gallery_application_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("GalleryApplication", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - gallery_name: str, - gallery_application_name: str, - gallery_application: Union[_models.GalleryApplication, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-03")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(gallery_application, (IOBase, bytes)): - _content = gallery_application - else: - _json = self._serialize.body(gallery_application, "GalleryApplication") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - gallery_name=gallery_name, - gallery_application_name=gallery_application_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 201: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - gallery_name: str, - gallery_application_name: str, - gallery_application: _models.GalleryApplication, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.GalleryApplication]: - """Create or update a gallery Application Definition. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :param gallery_application_name: The name of the gallery Application Definition to be - retrieved. Required. - :type gallery_application_name: str - :param gallery_application: Parameters supplied to the create or update gallery Application - operation. Required. - :type gallery_application: ~azure.mgmt.compute.models.GalleryApplication - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either GalleryApplication or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.GalleryApplication] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - gallery_name: str, - gallery_application_name: str, - gallery_application: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.GalleryApplication]: - """Create or update a gallery Application Definition. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :param gallery_application_name: The name of the gallery Application Definition to be - retrieved. Required. - :type gallery_application_name: str - :param gallery_application: Parameters supplied to the create or update gallery Application - operation. Required. - :type gallery_application: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either GalleryApplication or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.GalleryApplication] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - gallery_name: str, - gallery_application_name: str, - gallery_application: Union[_models.GalleryApplication, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.GalleryApplication]: - """Create or update a gallery Application Definition. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :param gallery_application_name: The name of the gallery Application Definition to be - retrieved. Required. - :type gallery_application_name: str - :param gallery_application: Parameters supplied to the create or update gallery Application - operation. Is either a GalleryApplication type or a IO[bytes] type. Required. - :type gallery_application: ~azure.mgmt.compute.models.GalleryApplication or IO[bytes] - :return: An instance of AsyncLROPoller that returns either GalleryApplication or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.GalleryApplication] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-03")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.GalleryApplication] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._create_or_update_initial( - resource_group_name=resource_group_name, - 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, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("GalleryApplication", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.GalleryApplication].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.GalleryApplication]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _update_initial( - self, - resource_group_name: str, - gallery_name: str, - gallery_application_name: str, - gallery_application: Union[_models.GalleryApplicationUpdate, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-03")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(gallery_application, (IOBase, bytes)): - _content = gallery_application - else: - _json = self._serialize.body(gallery_application, "GalleryApplicationUpdate") - - _request = build_update_request( - resource_group_name=resource_group_name, - gallery_name=gallery_name, - gallery_application_name=gallery_application_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_update( - self, - resource_group_name: str, - gallery_name: str, - gallery_application_name: str, - gallery_application: _models.GalleryApplicationUpdate, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.GalleryApplication]: - """Update a gallery Application Definition. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :param gallery_application_name: The name of the gallery Application Definition to be - retrieved. Required. - :type gallery_application_name: str - :param gallery_application: Parameters supplied to the update gallery Application operation. - Required. - :type gallery_application: ~azure.mgmt.compute.models.GalleryApplicationUpdate - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either GalleryApplication or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.GalleryApplication] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update( - self, - resource_group_name: str, - gallery_name: str, - gallery_application_name: str, - gallery_application: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.GalleryApplication]: - """Update a gallery Application Definition. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :param gallery_application_name: The name of the gallery Application Definition to be - retrieved. Required. - :type gallery_application_name: str - :param gallery_application: Parameters supplied to the update gallery Application operation. - Required. - :type gallery_application: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either GalleryApplication or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.GalleryApplication] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_update( - self, - resource_group_name: str, - gallery_name: str, - gallery_application_name: str, - gallery_application: Union[_models.GalleryApplicationUpdate, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.GalleryApplication]: - """Update a gallery Application Definition. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :param gallery_application_name: The name of the gallery Application Definition to be - retrieved. Required. - :type gallery_application_name: str - :param gallery_application: Parameters supplied to the update gallery Application operation. Is - either a GalleryApplicationUpdate type or a IO[bytes] type. Required. - :type gallery_application: ~azure.mgmt.compute.models.GalleryApplicationUpdate or IO[bytes] - :return: An instance of AsyncLROPoller that returns either GalleryApplication or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.GalleryApplication] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-03")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.GalleryApplication] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._update_initial( - resource_group_name=resource_group_name, - 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, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - response_headers = {} - response = pipeline_response.http_response - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = self._deserialize("GalleryApplication", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.GalleryApplication].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.GalleryApplication]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, gallery_name: str, gallery_application_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-03")) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - gallery_name=gallery_name, - gallery_application_name=gallery_application_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_delete( - self, resource_group_name: str, gallery_name: str, gallery_application_name: str, **kwargs: Any - ) -> AsyncLROPoller[None]: - """Delete a gallery Application. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :param gallery_application_name: The name of the gallery Application Definition to be - retrieved. Required. - :type gallery_application_name: str - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-03")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._delete_initial( - 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, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/operations/_gallery_image_versions_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/operations/_gallery_image_versions_operations.py deleted file mode 100644 index db63c43b9be4..000000000000 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/operations/_gallery_image_versions_operations.py +++ /dev/null @@ -1,810 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from collections.abc import MutableMapping -from io import IOBase -from typing import Any, AsyncIterator, Callable, IO, Optional, TypeVar, Union, cast, overload - -from azure.core import AsyncPipelineClient -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - StreamClosedError, - StreamConsumedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ..._utils.serialization import Deserializer, Serializer -from ...operations._gallery_image_versions_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_by_gallery_image_request, - build_update_request, -) -from .._configuration import ComputeManagementClientConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] -List = list - - -class GalleryImageVersionsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.compute.aio.ComputeManagementClient`'s - :attr:`gallery_image_versions` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list_by_gallery_image( - self, resource_group_name: str, gallery_name: str, gallery_image_name: str, **kwargs: Any - ) -> AsyncItemPaged["_models.GalleryImageVersion"]: - """List gallery image versions in a gallery image definition. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :param gallery_image_name: The name of the gallery image definition to be retrieved. Required. - :type gallery_image_name: str - :return: An iterator like instance of either GalleryImageVersion or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.models.GalleryImageVersion] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-03")) - cls: ClsType[_models.GalleryImageVersionList] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_by_gallery_image_request( - resource_group_name=resource_group_name, - gallery_name=gallery_name, - gallery_image_name=gallery_image_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - _request = HttpRequest("GET", next_link) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("GalleryImageVersionList", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @distributed_trace_async - async def get( - self, - resource_group_name: str, - gallery_name: str, - gallery_image_name: str, - gallery_image_version_name: str, - expand: Optional[Union[str, _models.ReplicationStatusTypes]] = None, - **kwargs: Any - ) -> _models.GalleryImageVersion: - """Retrieves information about a gallery image version. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :param gallery_image_name: The name of the gallery image definition to be retrieved. Required. - :type gallery_image_name: str - :param gallery_image_version_name: The name of the gallery image version to be retrieved. - Required. - :type gallery_image_version_name: str - :param expand: The expand expression to apply on the operation. Known values are: - "ReplicationStatus" and "UefiSettings". Default value is None. - :type expand: str or ~azure.mgmt.compute.models.ReplicationStatusTypes - :return: GalleryImageVersion or the result of cls(response) - :rtype: ~azure.mgmt.compute.models.GalleryImageVersion - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-03")) - cls: ClsType[_models.GalleryImageVersion] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - gallery_name=gallery_name, - gallery_image_name=gallery_image_name, - gallery_image_version_name=gallery_image_version_name, - subscription_id=self._config.subscription_id, - expand=expand, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("GalleryImageVersion", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - gallery_name: str, - gallery_image_name: str, - gallery_image_version_name: str, - gallery_image_version: Union[_models.GalleryImageVersion, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-03")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(gallery_image_version, (IOBase, bytes)): - _content = gallery_image_version - else: - _json = self._serialize.body(gallery_image_version, "GalleryImageVersion") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - gallery_name=gallery_name, - gallery_image_name=gallery_image_name, - gallery_image_version_name=gallery_image_version_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 201: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - gallery_name: str, - gallery_image_name: str, - gallery_image_version_name: str, - gallery_image_version: _models.GalleryImageVersion, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.GalleryImageVersion]: - """Create or update a gallery image version. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :param gallery_image_name: The name of the gallery image definition to be retrieved. Required. - :type gallery_image_name: str - :param gallery_image_version_name: The name of the gallery image version to be retrieved. - Required. - :type gallery_image_version_name: str - :param gallery_image_version: Parameters supplied to the create or update gallery image version - operation. Required. - :type gallery_image_version: ~azure.mgmt.compute.models.GalleryImageVersion - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either GalleryImageVersion or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.GalleryImageVersion] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - gallery_name: str, - gallery_image_name: str, - gallery_image_version_name: str, - gallery_image_version: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.GalleryImageVersion]: - """Create or update a gallery image version. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :param gallery_image_name: The name of the gallery image definition to be retrieved. Required. - :type gallery_image_name: str - :param gallery_image_version_name: The name of the gallery image version to be retrieved. - Required. - :type gallery_image_version_name: str - :param gallery_image_version: Parameters supplied to the create or update gallery image version - operation. Required. - :type gallery_image_version: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either GalleryImageVersion or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.GalleryImageVersion] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - gallery_name: str, - gallery_image_name: str, - gallery_image_version_name: str, - gallery_image_version: Union[_models.GalleryImageVersion, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.GalleryImageVersion]: - """Create or update a gallery image version. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :param gallery_image_name: The name of the gallery image definition to be retrieved. Required. - :type gallery_image_name: str - :param gallery_image_version_name: The name of the gallery image version to be retrieved. - Required. - :type gallery_image_version_name: str - :param gallery_image_version: Parameters supplied to the create or update gallery image version - operation. Is either a GalleryImageVersion type or a IO[bytes] type. Required. - :type gallery_image_version: ~azure.mgmt.compute.models.GalleryImageVersion or IO[bytes] - :return: An instance of AsyncLROPoller that returns either GalleryImageVersion or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.GalleryImageVersion] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-03")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.GalleryImageVersion] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._create_or_update_initial( - resource_group_name=resource_group_name, - gallery_name=gallery_name, - 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, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("GalleryImageVersion", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.GalleryImageVersion].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.GalleryImageVersion]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _update_initial( - self, - resource_group_name: str, - gallery_name: str, - gallery_image_name: str, - gallery_image_version_name: str, - gallery_image_version: Union[_models.GalleryImageVersionUpdate, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-03")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(gallery_image_version, (IOBase, bytes)): - _content = gallery_image_version - else: - _json = self._serialize.body(gallery_image_version, "GalleryImageVersionUpdate") - - _request = build_update_request( - resource_group_name=resource_group_name, - gallery_name=gallery_name, - gallery_image_name=gallery_image_name, - gallery_image_version_name=gallery_image_version_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_update( - self, - resource_group_name: str, - gallery_name: str, - gallery_image_name: str, - gallery_image_version_name: str, - gallery_image_version: _models.GalleryImageVersionUpdate, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.GalleryImageVersion]: - """Update a gallery image version. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :param gallery_image_name: The name of the gallery image definition to be retrieved. Required. - :type gallery_image_name: str - :param gallery_image_version_name: The name of the gallery image version to be retrieved. - Required. - :type gallery_image_version_name: str - :param gallery_image_version: Parameters supplied to the update gallery image version - operation. Required. - :type gallery_image_version: ~azure.mgmt.compute.models.GalleryImageVersionUpdate - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either GalleryImageVersion or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.GalleryImageVersion] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update( - self, - resource_group_name: str, - gallery_name: str, - gallery_image_name: str, - gallery_image_version_name: str, - gallery_image_version: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.GalleryImageVersion]: - """Update a gallery image version. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :param gallery_image_name: The name of the gallery image definition to be retrieved. Required. - :type gallery_image_name: str - :param gallery_image_version_name: The name of the gallery image version to be retrieved. - Required. - :type gallery_image_version_name: str - :param gallery_image_version: Parameters supplied to the update gallery image version - operation. Required. - :type gallery_image_version: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either GalleryImageVersion or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.GalleryImageVersion] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_update( - self, - resource_group_name: str, - gallery_name: str, - gallery_image_name: str, - gallery_image_version_name: str, - gallery_image_version: Union[_models.GalleryImageVersionUpdate, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.GalleryImageVersion]: - """Update a gallery image version. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :param gallery_image_name: The name of the gallery image definition to be retrieved. Required. - :type gallery_image_name: str - :param gallery_image_version_name: The name of the gallery image version to be retrieved. - Required. - :type gallery_image_version_name: str - :param gallery_image_version: Parameters supplied to the update gallery image version - operation. Is either a GalleryImageVersionUpdate type or a IO[bytes] type. Required. - :type gallery_image_version: ~azure.mgmt.compute.models.GalleryImageVersionUpdate or IO[bytes] - :return: An instance of AsyncLROPoller that returns either GalleryImageVersion or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.GalleryImageVersion] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-03")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.GalleryImageVersion] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._update_initial( - resource_group_name=resource_group_name, - gallery_name=gallery_name, - 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, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - response_headers = {} - response = pipeline_response.http_response - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = self._deserialize("GalleryImageVersion", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.GalleryImageVersion].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.GalleryImageVersion]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, - resource_group_name: str, - gallery_name: str, - gallery_image_name: str, - gallery_image_version_name: str, - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-03")) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - gallery_name=gallery_name, - gallery_image_name=gallery_image_name, - gallery_image_version_name=gallery_image_version_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_delete( - self, - resource_group_name: str, - gallery_name: str, - gallery_image_name: str, - gallery_image_version_name: str, - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Delete a gallery image version. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :param gallery_image_name: The name of the gallery image definition to be retrieved. Required. - :type gallery_image_name: str - :param gallery_image_version_name: The name of the gallery image version to be retrieved. - Required. - :type gallery_image_version_name: str - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-03")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._delete_initial( - resource_group_name=resource_group_name, - gallery_name=gallery_name, - gallery_image_name=gallery_image_name, - gallery_image_version_name=gallery_image_version_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/operations/_gallery_images_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/operations/_gallery_images_operations.py deleted file mode 100644 index 8823fc1c57fa..000000000000 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/operations/_gallery_images_operations.py +++ /dev/null @@ -1,746 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from collections.abc import MutableMapping -from io import IOBase -from typing import Any, AsyncIterator, Callable, IO, Optional, TypeVar, Union, cast, overload - -from azure.core import AsyncPipelineClient -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - StreamClosedError, - StreamConsumedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ..._utils.serialization import Deserializer, Serializer -from ...operations._gallery_images_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_by_gallery_request, - build_update_request, -) -from .._configuration import ComputeManagementClientConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] -List = list - - -class GalleryImagesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.compute.aio.ComputeManagementClient`'s - :attr:`gallery_images` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list_by_gallery( - self, resource_group_name: str, gallery_name: str, **kwargs: Any - ) -> AsyncItemPaged["_models.GalleryImage"]: - """List gallery image definitions in a gallery. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :return: An iterator like instance of either GalleryImage or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.models.GalleryImage] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-03")) - cls: ClsType[_models.GalleryImageList] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_by_gallery_request( - resource_group_name=resource_group_name, - gallery_name=gallery_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - _request = HttpRequest("GET", next_link) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("GalleryImageList", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @distributed_trace_async - async def get( - self, resource_group_name: str, gallery_name: str, gallery_image_name: str, **kwargs: Any - ) -> _models.GalleryImage: - """Retrieves information about a gallery image definition. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :param gallery_image_name: The name of the gallery image definition to be retrieved. Required. - :type gallery_image_name: str - :return: GalleryImage or the result of cls(response) - :rtype: ~azure.mgmt.compute.models.GalleryImage - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-03")) - cls: ClsType[_models.GalleryImage] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - gallery_name=gallery_name, - gallery_image_name=gallery_image_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("GalleryImage", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - gallery_name: str, - gallery_image_name: str, - gallery_image: Union[_models.GalleryImage, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-03")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(gallery_image, (IOBase, bytes)): - _content = gallery_image - else: - _json = self._serialize.body(gallery_image, "GalleryImage") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - gallery_name=gallery_name, - gallery_image_name=gallery_image_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 201: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - gallery_name: str, - gallery_image_name: str, - gallery_image: _models.GalleryImage, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.GalleryImage]: - """Create or update a gallery image definition. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :param gallery_image_name: The name of the gallery image definition to be retrieved. Required. - :type gallery_image_name: str - :param gallery_image: Parameters supplied to the create or update gallery image operation. - Required. - :type gallery_image: ~azure.mgmt.compute.models.GalleryImage - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either GalleryImage or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.GalleryImage] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - gallery_name: str, - gallery_image_name: str, - gallery_image: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.GalleryImage]: - """Create or update a gallery image definition. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :param gallery_image_name: The name of the gallery image definition to be retrieved. Required. - :type gallery_image_name: str - :param gallery_image: Parameters supplied to the create or update gallery image operation. - Required. - :type gallery_image: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either GalleryImage or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.GalleryImage] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - gallery_name: str, - gallery_image_name: str, - gallery_image: Union[_models.GalleryImage, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.GalleryImage]: - """Create or update a gallery image definition. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :param gallery_image_name: The name of the gallery image definition to be retrieved. Required. - :type gallery_image_name: str - :param gallery_image: Parameters supplied to the create or update gallery image operation. Is - either a GalleryImage type or a IO[bytes] type. Required. - :type gallery_image: ~azure.mgmt.compute.models.GalleryImage or IO[bytes] - :return: An instance of AsyncLROPoller that returns either GalleryImage or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.GalleryImage] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-03")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.GalleryImage] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._create_or_update_initial( - resource_group_name=resource_group_name, - 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, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("GalleryImage", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.GalleryImage].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.GalleryImage]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _update_initial( - self, - resource_group_name: str, - gallery_name: str, - gallery_image_name: str, - gallery_image: Union[_models.GalleryImageUpdate, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-03")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(gallery_image, (IOBase, bytes)): - _content = gallery_image - else: - _json = self._serialize.body(gallery_image, "GalleryImageUpdate") - - _request = build_update_request( - resource_group_name=resource_group_name, - gallery_name=gallery_name, - gallery_image_name=gallery_image_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_update( - self, - resource_group_name: str, - gallery_name: str, - gallery_image_name: str, - gallery_image: _models.GalleryImageUpdate, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.GalleryImage]: - """Update a gallery image definition. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :param gallery_image_name: The name of the gallery image definition to be retrieved. Required. - :type gallery_image_name: str - :param gallery_image: Parameters supplied to the update gallery image operation. Required. - :type gallery_image: ~azure.mgmt.compute.models.GalleryImageUpdate - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either GalleryImage or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.GalleryImage] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update( - self, - resource_group_name: str, - gallery_name: str, - gallery_image_name: str, - gallery_image: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.GalleryImage]: - """Update a gallery image definition. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :param gallery_image_name: The name of the gallery image definition to be retrieved. Required. - :type gallery_image_name: str - :param gallery_image: Parameters supplied to the update gallery image operation. Required. - :type gallery_image: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either GalleryImage or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.GalleryImage] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_update( - self, - resource_group_name: str, - gallery_name: str, - gallery_image_name: str, - gallery_image: Union[_models.GalleryImageUpdate, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.GalleryImage]: - """Update a gallery image definition. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :param gallery_image_name: The name of the gallery image definition to be retrieved. Required. - :type gallery_image_name: str - :param gallery_image: Parameters supplied to the update gallery image operation. Is either a - GalleryImageUpdate type or a IO[bytes] type. Required. - :type gallery_image: ~azure.mgmt.compute.models.GalleryImageUpdate or IO[bytes] - :return: An instance of AsyncLROPoller that returns either GalleryImage or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.GalleryImage] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-03")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.GalleryImage] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._update_initial( - resource_group_name=resource_group_name, - 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, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - response_headers = {} - response = pipeline_response.http_response - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = self._deserialize("GalleryImage", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.GalleryImage].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.GalleryImage]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, gallery_name: str, gallery_image_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-03")) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - gallery_name=gallery_name, - gallery_image_name=gallery_image_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_delete( - self, resource_group_name: str, gallery_name: str, gallery_image_name: str, **kwargs: Any - ) -> AsyncLROPoller[None]: - """Delete a gallery image. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :param gallery_image_name: The name of the gallery image definition to be retrieved. Required. - :type gallery_image_name: str - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-03")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._delete_initial( - 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, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/operations/_gallery_in_vm_access_control_profile_versions_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/operations/_gallery_in_vm_access_control_profile_versions_operations.py deleted file mode 100644 index 91c490d54203..000000000000 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/operations/_gallery_in_vm_access_control_profile_versions_operations.py +++ /dev/null @@ -1,834 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from collections.abc import MutableMapping -from io import IOBase -from typing import Any, AsyncIterator, Callable, IO, Optional, TypeVar, Union, cast, overload - -from azure.core import AsyncPipelineClient -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - StreamClosedError, - StreamConsumedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ..._utils.serialization import Deserializer, Serializer -from ...operations._gallery_in_vm_access_control_profile_versions_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_by_gallery_in_vm_access_control_profile_request, - build_update_request, -) -from .._configuration import ComputeManagementClientConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] -List = list - - -class GalleryInVMAccessControlProfileVersionsOperations: # pylint: disable=name-too-long - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.compute.aio.ComputeManagementClient`'s - :attr:`gallery_in_vm_access_control_profile_versions` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list_by_gallery_in_vm_access_control_profile( # pylint: disable=name-too-long - self, resource_group_name: str, gallery_name: str, in_vm_access_control_profile_name: str, **kwargs: Any - ) -> AsyncItemPaged["_models.GalleryInVMAccessControlProfileVersion"]: - """List gallery inVMAccessControlProfile versions in a gallery inVMAccessControlProfile. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :param in_vm_access_control_profile_name: The name of the gallery inVMAccessControlProfile to - be retrieved. Required. - :type in_vm_access_control_profile_name: str - :return: An iterator like instance of either GalleryInVMAccessControlProfileVersion or the - result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.models.GalleryInVMAccessControlProfileVersion] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-03")) - cls: ClsType[_models.GalleryInVMAccessControlProfileVersionList] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_by_gallery_in_vm_access_control_profile_request( - resource_group_name=resource_group_name, - gallery_name=gallery_name, - in_vm_access_control_profile_name=in_vm_access_control_profile_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - _request = HttpRequest("GET", next_link) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("GalleryInVMAccessControlProfileVersionList", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @distributed_trace_async - async def get( - self, - resource_group_name: str, - gallery_name: str, - in_vm_access_control_profile_name: str, - in_vm_access_control_profile_version_name: str, - **kwargs: Any - ) -> _models.GalleryInVMAccessControlProfileVersion: - """Retrieves information about a gallery inVMAccessControlProfile version. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :param in_vm_access_control_profile_name: The name of the gallery inVMAccessControlProfile to - be retrieved. Required. - :type in_vm_access_control_profile_name: str - :param in_vm_access_control_profile_version_name: The name of the gallery - inVMAccessControlProfile version to be retrieved. Required. - :type in_vm_access_control_profile_version_name: str - :return: GalleryInVMAccessControlProfileVersion or the result of cls(response) - :rtype: ~azure.mgmt.compute.models.GalleryInVMAccessControlProfileVersion - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-03")) - cls: ClsType[_models.GalleryInVMAccessControlProfileVersion] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - gallery_name=gallery_name, - in_vm_access_control_profile_name=in_vm_access_control_profile_name, - in_vm_access_control_profile_version_name=in_vm_access_control_profile_version_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("GalleryInVMAccessControlProfileVersion", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - gallery_name: str, - in_vm_access_control_profile_name: str, - in_vm_access_control_profile_version_name: str, - gallery_in_vm_access_control_profile_version: Union[_models.GalleryInVMAccessControlProfileVersion, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-03")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(gallery_in_vm_access_control_profile_version, (IOBase, bytes)): - _content = gallery_in_vm_access_control_profile_version - else: - _json = self._serialize.body( - gallery_in_vm_access_control_profile_version, "GalleryInVMAccessControlProfileVersion" - ) - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - gallery_name=gallery_name, - in_vm_access_control_profile_name=in_vm_access_control_profile_name, - in_vm_access_control_profile_version_name=in_vm_access_control_profile_version_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 201: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - gallery_name: str, - in_vm_access_control_profile_name: str, - in_vm_access_control_profile_version_name: str, - gallery_in_vm_access_control_profile_version: _models.GalleryInVMAccessControlProfileVersion, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.GalleryInVMAccessControlProfileVersion]: - """Create or update a gallery inVMAccessControlProfile version. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :param in_vm_access_control_profile_name: The name of the gallery inVMAccessControlProfile to - be retrieved. Required. - :type in_vm_access_control_profile_name: str - :param in_vm_access_control_profile_version_name: The name of the gallery - inVMAccessControlProfile version to be retrieved. Required. - :type in_vm_access_control_profile_version_name: str - :param gallery_in_vm_access_control_profile_version: Parameters supplied to the create or - update gallery inVMAccessControlProfile version operation. Required. - :type gallery_in_vm_access_control_profile_version: - ~azure.mgmt.compute.models.GalleryInVMAccessControlProfileVersion - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either - GalleryInVMAccessControlProfileVersion or the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.GalleryInVMAccessControlProfileVersion] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - gallery_name: str, - in_vm_access_control_profile_name: str, - in_vm_access_control_profile_version_name: str, - gallery_in_vm_access_control_profile_version: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.GalleryInVMAccessControlProfileVersion]: - """Create or update a gallery inVMAccessControlProfile version. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :param in_vm_access_control_profile_name: The name of the gallery inVMAccessControlProfile to - be retrieved. Required. - :type in_vm_access_control_profile_name: str - :param in_vm_access_control_profile_version_name: The name of the gallery - inVMAccessControlProfile version to be retrieved. Required. - :type in_vm_access_control_profile_version_name: str - :param gallery_in_vm_access_control_profile_version: Parameters supplied to the create or - update gallery inVMAccessControlProfile version operation. Required. - :type gallery_in_vm_access_control_profile_version: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either - GalleryInVMAccessControlProfileVersion or the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.GalleryInVMAccessControlProfileVersion] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - gallery_name: str, - in_vm_access_control_profile_name: str, - in_vm_access_control_profile_version_name: str, - gallery_in_vm_access_control_profile_version: Union[_models.GalleryInVMAccessControlProfileVersion, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.GalleryInVMAccessControlProfileVersion]: - """Create or update a gallery inVMAccessControlProfile version. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :param in_vm_access_control_profile_name: The name of the gallery inVMAccessControlProfile to - be retrieved. Required. - :type in_vm_access_control_profile_name: str - :param in_vm_access_control_profile_version_name: The name of the gallery - inVMAccessControlProfile version to be retrieved. Required. - :type in_vm_access_control_profile_version_name: str - :param gallery_in_vm_access_control_profile_version: Parameters supplied to the create or - update gallery inVMAccessControlProfile version operation. Is either a - GalleryInVMAccessControlProfileVersion type or a IO[bytes] type. Required. - :type gallery_in_vm_access_control_profile_version: - ~azure.mgmt.compute.models.GalleryInVMAccessControlProfileVersion or IO[bytes] - :return: An instance of AsyncLROPoller that returns either - GalleryInVMAccessControlProfileVersion or the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.GalleryInVMAccessControlProfileVersion] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-03")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.GalleryInVMAccessControlProfileVersion] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._create_or_update_initial( - resource_group_name=resource_group_name, - gallery_name=gallery_name, - in_vm_access_control_profile_name=in_vm_access_control_profile_name, - in_vm_access_control_profile_version_name=in_vm_access_control_profile_version_name, - gallery_in_vm_access_control_profile_version=gallery_in_vm_access_control_profile_version, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("GalleryInVMAccessControlProfileVersion", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.GalleryInVMAccessControlProfileVersion].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.GalleryInVMAccessControlProfileVersion]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _update_initial( - self, - resource_group_name: str, - gallery_name: str, - in_vm_access_control_profile_name: str, - in_vm_access_control_profile_version_name: str, - gallery_in_vm_access_control_profile_version: Union[ - _models.GalleryInVMAccessControlProfileVersionUpdate, IO[bytes] - ], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-03")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(gallery_in_vm_access_control_profile_version, (IOBase, bytes)): - _content = gallery_in_vm_access_control_profile_version - else: - _json = self._serialize.body( - gallery_in_vm_access_control_profile_version, "GalleryInVMAccessControlProfileVersionUpdate" - ) - - _request = build_update_request( - resource_group_name=resource_group_name, - gallery_name=gallery_name, - in_vm_access_control_profile_name=in_vm_access_control_profile_name, - in_vm_access_control_profile_version_name=in_vm_access_control_profile_version_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_update( - self, - resource_group_name: str, - gallery_name: str, - in_vm_access_control_profile_name: str, - in_vm_access_control_profile_version_name: str, - gallery_in_vm_access_control_profile_version: _models.GalleryInVMAccessControlProfileVersionUpdate, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.GalleryInVMAccessControlProfileVersion]: - """Update a gallery inVMAccessControlProfile version. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :param in_vm_access_control_profile_name: The name of the gallery inVMAccessControlProfile to - be retrieved. Required. - :type in_vm_access_control_profile_name: str - :param in_vm_access_control_profile_version_name: The name of the gallery - inVMAccessControlProfile version to be retrieved. Required. - :type in_vm_access_control_profile_version_name: str - :param gallery_in_vm_access_control_profile_version: Parameters supplied to the update gallery - inVMAccessControlProfile version operation. Required. - :type gallery_in_vm_access_control_profile_version: - ~azure.mgmt.compute.models.GalleryInVMAccessControlProfileVersionUpdate - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either - GalleryInVMAccessControlProfileVersion or the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.GalleryInVMAccessControlProfileVersion] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update( - self, - resource_group_name: str, - gallery_name: str, - in_vm_access_control_profile_name: str, - in_vm_access_control_profile_version_name: str, - gallery_in_vm_access_control_profile_version: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.GalleryInVMAccessControlProfileVersion]: - """Update a gallery inVMAccessControlProfile version. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :param in_vm_access_control_profile_name: The name of the gallery inVMAccessControlProfile to - be retrieved. Required. - :type in_vm_access_control_profile_name: str - :param in_vm_access_control_profile_version_name: The name of the gallery - inVMAccessControlProfile version to be retrieved. Required. - :type in_vm_access_control_profile_version_name: str - :param gallery_in_vm_access_control_profile_version: Parameters supplied to the update gallery - inVMAccessControlProfile version operation. Required. - :type gallery_in_vm_access_control_profile_version: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either - GalleryInVMAccessControlProfileVersion or the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.GalleryInVMAccessControlProfileVersion] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_update( - self, - resource_group_name: str, - gallery_name: str, - in_vm_access_control_profile_name: str, - in_vm_access_control_profile_version_name: str, - gallery_in_vm_access_control_profile_version: Union[ - _models.GalleryInVMAccessControlProfileVersionUpdate, IO[bytes] - ], - **kwargs: Any - ) -> AsyncLROPoller[_models.GalleryInVMAccessControlProfileVersion]: - """Update a gallery inVMAccessControlProfile version. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :param in_vm_access_control_profile_name: The name of the gallery inVMAccessControlProfile to - be retrieved. Required. - :type in_vm_access_control_profile_name: str - :param in_vm_access_control_profile_version_name: The name of the gallery - inVMAccessControlProfile version to be retrieved. Required. - :type in_vm_access_control_profile_version_name: str - :param gallery_in_vm_access_control_profile_version: Parameters supplied to the update gallery - inVMAccessControlProfile version operation. Is either a - GalleryInVMAccessControlProfileVersionUpdate type or a IO[bytes] type. Required. - :type gallery_in_vm_access_control_profile_version: - ~azure.mgmt.compute.models.GalleryInVMAccessControlProfileVersionUpdate or IO[bytes] - :return: An instance of AsyncLROPoller that returns either - GalleryInVMAccessControlProfileVersion or the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.GalleryInVMAccessControlProfileVersion] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-03")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.GalleryInVMAccessControlProfileVersion] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._update_initial( - resource_group_name=resource_group_name, - gallery_name=gallery_name, - in_vm_access_control_profile_name=in_vm_access_control_profile_name, - in_vm_access_control_profile_version_name=in_vm_access_control_profile_version_name, - gallery_in_vm_access_control_profile_version=gallery_in_vm_access_control_profile_version, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - response_headers = {} - response = pipeline_response.http_response - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = self._deserialize("GalleryInVMAccessControlProfileVersion", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.GalleryInVMAccessControlProfileVersion].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.GalleryInVMAccessControlProfileVersion]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, - resource_group_name: str, - gallery_name: str, - in_vm_access_control_profile_name: str, - in_vm_access_control_profile_version_name: str, - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-03")) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - gallery_name=gallery_name, - in_vm_access_control_profile_name=in_vm_access_control_profile_name, - in_vm_access_control_profile_version_name=in_vm_access_control_profile_version_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [202, 204]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_delete( - self, - resource_group_name: str, - gallery_name: str, - in_vm_access_control_profile_name: str, - in_vm_access_control_profile_version_name: str, - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Delete a gallery inVMAccessControlProfile version. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :param in_vm_access_control_profile_name: The name of the gallery inVMAccessControlProfile to - be retrieved. Required. - :type in_vm_access_control_profile_name: str - :param in_vm_access_control_profile_version_name: The name of the gallery - inVMAccessControlProfile version to be retrieved. Required. - :type in_vm_access_control_profile_version_name: str - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-03")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._delete_initial( - resource_group_name=resource_group_name, - gallery_name=gallery_name, - in_vm_access_control_profile_name=in_vm_access_control_profile_name, - in_vm_access_control_profile_version_name=in_vm_access_control_profile_version_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/operations/_gallery_in_vm_access_control_profiles_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/operations/_gallery_in_vm_access_control_profiles_operations.py deleted file mode 100644 index 660da3b57ad2..000000000000 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/operations/_gallery_in_vm_access_control_profiles_operations.py +++ /dev/null @@ -1,768 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from collections.abc import MutableMapping -from io import IOBase -from typing import Any, AsyncIterator, Callable, IO, Optional, TypeVar, Union, cast, overload - -from azure.core import AsyncPipelineClient -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - StreamClosedError, - StreamConsumedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ..._utils.serialization import Deserializer, Serializer -from ...operations._gallery_in_vm_access_control_profiles_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_by_gallery_request, - build_update_request, -) -from .._configuration import ComputeManagementClientConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] -List = list - - -class GalleryInVMAccessControlProfilesOperations: # pylint: disable=name-too-long - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.compute.aio.ComputeManagementClient`'s - :attr:`gallery_in_vm_access_control_profiles` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list_by_gallery( - self, resource_group_name: str, gallery_name: str, **kwargs: Any - ) -> AsyncItemPaged["_models.GalleryInVMAccessControlProfile"]: - """List gallery inVMAccessControlProfiles in a gallery. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :return: An iterator like instance of either GalleryInVMAccessControlProfile or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.models.GalleryInVMAccessControlProfile] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-03")) - cls: ClsType[_models.GalleryInVMAccessControlProfileList] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_by_gallery_request( - resource_group_name=resource_group_name, - gallery_name=gallery_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - _request = HttpRequest("GET", next_link) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("GalleryInVMAccessControlProfileList", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @distributed_trace_async - async def get( - self, resource_group_name: str, gallery_name: str, in_vm_access_control_profile_name: str, **kwargs: Any - ) -> _models.GalleryInVMAccessControlProfile: - """Retrieves information about a gallery inVMAccessControlProfile. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :param in_vm_access_control_profile_name: The name of the gallery inVMAccessControlProfile to - be retrieved. Required. - :type in_vm_access_control_profile_name: str - :return: GalleryInVMAccessControlProfile or the result of cls(response) - :rtype: ~azure.mgmt.compute.models.GalleryInVMAccessControlProfile - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-03")) - cls: ClsType[_models.GalleryInVMAccessControlProfile] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - gallery_name=gallery_name, - in_vm_access_control_profile_name=in_vm_access_control_profile_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("GalleryInVMAccessControlProfile", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - gallery_name: str, - in_vm_access_control_profile_name: str, - gallery_in_vm_access_control_profile: Union[_models.GalleryInVMAccessControlProfile, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-03")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(gallery_in_vm_access_control_profile, (IOBase, bytes)): - _content = gallery_in_vm_access_control_profile - else: - _json = self._serialize.body(gallery_in_vm_access_control_profile, "GalleryInVMAccessControlProfile") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - gallery_name=gallery_name, - in_vm_access_control_profile_name=in_vm_access_control_profile_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 201: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - gallery_name: str, - in_vm_access_control_profile_name: str, - gallery_in_vm_access_control_profile: _models.GalleryInVMAccessControlProfile, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.GalleryInVMAccessControlProfile]: - """Create or update a gallery inVMAccessControlProfile. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :param in_vm_access_control_profile_name: The name of the gallery inVMAccessControlProfile to - be retrieved. Required. - :type in_vm_access_control_profile_name: str - :param gallery_in_vm_access_control_profile: Parameters supplied to the create or update - gallery inVMAccessControlProfile operation. Required. - :type gallery_in_vm_access_control_profile: - ~azure.mgmt.compute.models.GalleryInVMAccessControlProfile - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either GalleryInVMAccessControlProfile or - the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.GalleryInVMAccessControlProfile] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - gallery_name: str, - in_vm_access_control_profile_name: str, - gallery_in_vm_access_control_profile: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.GalleryInVMAccessControlProfile]: - """Create or update a gallery inVMAccessControlProfile. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :param in_vm_access_control_profile_name: The name of the gallery inVMAccessControlProfile to - be retrieved. Required. - :type in_vm_access_control_profile_name: str - :param gallery_in_vm_access_control_profile: Parameters supplied to the create or update - gallery inVMAccessControlProfile operation. Required. - :type gallery_in_vm_access_control_profile: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either GalleryInVMAccessControlProfile or - the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.GalleryInVMAccessControlProfile] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - gallery_name: str, - in_vm_access_control_profile_name: str, - gallery_in_vm_access_control_profile: Union[_models.GalleryInVMAccessControlProfile, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.GalleryInVMAccessControlProfile]: - """Create or update a gallery inVMAccessControlProfile. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :param in_vm_access_control_profile_name: The name of the gallery inVMAccessControlProfile to - be retrieved. Required. - :type in_vm_access_control_profile_name: str - :param gallery_in_vm_access_control_profile: Parameters supplied to the create or update - gallery inVMAccessControlProfile operation. Is either a GalleryInVMAccessControlProfile type or - a IO[bytes] type. Required. - :type gallery_in_vm_access_control_profile: - ~azure.mgmt.compute.models.GalleryInVMAccessControlProfile or IO[bytes] - :return: An instance of AsyncLROPoller that returns either GalleryInVMAccessControlProfile or - the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.GalleryInVMAccessControlProfile] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-03")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.GalleryInVMAccessControlProfile] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._create_or_update_initial( - resource_group_name=resource_group_name, - gallery_name=gallery_name, - in_vm_access_control_profile_name=in_vm_access_control_profile_name, - gallery_in_vm_access_control_profile=gallery_in_vm_access_control_profile, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("GalleryInVMAccessControlProfile", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.GalleryInVMAccessControlProfile].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.GalleryInVMAccessControlProfile]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _update_initial( - self, - resource_group_name: str, - gallery_name: str, - in_vm_access_control_profile_name: str, - gallery_in_vm_access_control_profile: Union[_models.GalleryInVMAccessControlProfileUpdate, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-03")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(gallery_in_vm_access_control_profile, (IOBase, bytes)): - _content = gallery_in_vm_access_control_profile - else: - _json = self._serialize.body(gallery_in_vm_access_control_profile, "GalleryInVMAccessControlProfileUpdate") - - _request = build_update_request( - resource_group_name=resource_group_name, - gallery_name=gallery_name, - in_vm_access_control_profile_name=in_vm_access_control_profile_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_update( - self, - resource_group_name: str, - gallery_name: str, - in_vm_access_control_profile_name: str, - gallery_in_vm_access_control_profile: _models.GalleryInVMAccessControlProfileUpdate, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.GalleryInVMAccessControlProfile]: - """Update a gallery inVMAccessControlProfile. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :param in_vm_access_control_profile_name: The name of the gallery inVMAccessControlProfile to - be retrieved. Required. - :type in_vm_access_control_profile_name: str - :param gallery_in_vm_access_control_profile: Parameters supplied to the update gallery - inVMAccessControlProfile operation. Required. - :type gallery_in_vm_access_control_profile: - ~azure.mgmt.compute.models.GalleryInVMAccessControlProfileUpdate - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either GalleryInVMAccessControlProfile or - the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.GalleryInVMAccessControlProfile] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update( - self, - resource_group_name: str, - gallery_name: str, - in_vm_access_control_profile_name: str, - gallery_in_vm_access_control_profile: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.GalleryInVMAccessControlProfile]: - """Update a gallery inVMAccessControlProfile. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :param in_vm_access_control_profile_name: The name of the gallery inVMAccessControlProfile to - be retrieved. Required. - :type in_vm_access_control_profile_name: str - :param gallery_in_vm_access_control_profile: Parameters supplied to the update gallery - inVMAccessControlProfile operation. Required. - :type gallery_in_vm_access_control_profile: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either GalleryInVMAccessControlProfile or - the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.GalleryInVMAccessControlProfile] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_update( - self, - resource_group_name: str, - gallery_name: str, - in_vm_access_control_profile_name: str, - gallery_in_vm_access_control_profile: Union[_models.GalleryInVMAccessControlProfileUpdate, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.GalleryInVMAccessControlProfile]: - """Update a gallery inVMAccessControlProfile. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :param in_vm_access_control_profile_name: The name of the gallery inVMAccessControlProfile to - be retrieved. Required. - :type in_vm_access_control_profile_name: str - :param gallery_in_vm_access_control_profile: Parameters supplied to the update gallery - inVMAccessControlProfile operation. Is either a GalleryInVMAccessControlProfileUpdate type or a - IO[bytes] type. Required. - :type gallery_in_vm_access_control_profile: - ~azure.mgmt.compute.models.GalleryInVMAccessControlProfileUpdate or IO[bytes] - :return: An instance of AsyncLROPoller that returns either GalleryInVMAccessControlProfile or - the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.GalleryInVMAccessControlProfile] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-03")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.GalleryInVMAccessControlProfile] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._update_initial( - resource_group_name=resource_group_name, - gallery_name=gallery_name, - in_vm_access_control_profile_name=in_vm_access_control_profile_name, - gallery_in_vm_access_control_profile=gallery_in_vm_access_control_profile, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - response_headers = {} - response = pipeline_response.http_response - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = self._deserialize("GalleryInVMAccessControlProfile", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.GalleryInVMAccessControlProfile].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.GalleryInVMAccessControlProfile]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, gallery_name: str, in_vm_access_control_profile_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-03")) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - gallery_name=gallery_name, - in_vm_access_control_profile_name=in_vm_access_control_profile_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [202, 204]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_delete( - self, resource_group_name: str, gallery_name: str, in_vm_access_control_profile_name: str, **kwargs: Any - ) -> AsyncLROPoller[None]: - """Delete a gallery inVMAccessControlProfile. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :param in_vm_access_control_profile_name: The name of the gallery inVMAccessControlProfile to - be retrieved. Required. - :type in_vm_access_control_profile_name: str - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-03")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._delete_initial( - resource_group_name=resource_group_name, - gallery_name=gallery_name, - in_vm_access_control_profile_name=in_vm_access_control_profile_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/operations/_gallery_sharing_profile_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/operations/_gallery_sharing_profile_operations.py deleted file mode 100644 index 5c6ee476e3b7..000000000000 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/operations/_gallery_sharing_profile_operations.py +++ /dev/null @@ -1,257 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from collections.abc import MutableMapping -from io import IOBase -from typing import Any, AsyncIterator, Callable, IO, Optional, TypeVar, Union, cast, overload - -from azure.core import AsyncPipelineClient -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - StreamClosedError, - StreamConsumedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ..._utils.serialization import Deserializer, Serializer -from ...operations._gallery_sharing_profile_operations import build_update_request -from .._configuration import ComputeManagementClientConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] -List = list - - -class GallerySharingProfileOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.compute.aio.ComputeManagementClient`'s - :attr:`gallery_sharing_profile` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - async def _update_initial( - self, - resource_group_name: str, - gallery_name: str, - sharing_update: Union[_models.SharingUpdate, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-03")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(sharing_update, (IOBase, bytes)): - _content = sharing_update - else: - _json = self._serialize.body(sharing_update, "SharingUpdate") - - _request = build_update_request( - resource_group_name=resource_group_name, - gallery_name=gallery_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_update( - self, - resource_group_name: str, - gallery_name: str, - sharing_update: _models.SharingUpdate, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.SharingUpdate]: - """Update sharing profile of a gallery. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :param sharing_update: Parameters supplied to the update gallery sharing profile. Required. - :type sharing_update: ~azure.mgmt.compute.models.SharingUpdate - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either SharingUpdate or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.SharingUpdate] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update( - self, - resource_group_name: str, - gallery_name: str, - sharing_update: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.SharingUpdate]: - """Update sharing profile of a gallery. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :param sharing_update: Parameters supplied to the update gallery sharing profile. Required. - :type sharing_update: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either SharingUpdate or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.SharingUpdate] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_update( - self, - resource_group_name: str, - gallery_name: str, - sharing_update: Union[_models.SharingUpdate, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.SharingUpdate]: - """Update sharing profile of a gallery. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :param sharing_update: Parameters supplied to the update gallery sharing profile. Is either a - SharingUpdate type or a IO[bytes] type. Required. - :type sharing_update: ~azure.mgmt.compute.models.SharingUpdate or IO[bytes] - :return: An instance of AsyncLROPoller that returns either SharingUpdate or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.SharingUpdate] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-03")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.SharingUpdate] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._update_initial( - resource_group_name=resource_group_name, - gallery_name=gallery_name, - sharing_update=sharing_update, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("SharingUpdate", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.SharingUpdate].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.SharingUpdate]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/operations/_images_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/operations/_images_operations.py deleted file mode 100644 index 86fdd4595487..000000000000 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/operations/_images_operations.py +++ /dev/null @@ -1,751 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from collections.abc import MutableMapping -from io import IOBase -from typing import Any, AsyncIterator, Callable, IO, Optional, TypeVar, Union, cast, overload - -from azure.core import AsyncPipelineClient -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - StreamClosedError, - StreamConsumedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ..._utils.serialization import Deserializer, Serializer -from ...operations._images_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_by_resource_group_request, - build_list_request, - build_update_request, -) -from .._configuration import ComputeManagementClientConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] -List = list - - -class ImagesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.compute.aio.ComputeManagementClient`'s - :attr:`images` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list(self, **kwargs: Any) -> AsyncItemPaged["_models.Image"]: - """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. - - :return: An iterator like instance of either Image or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.models.Image] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[_models.ImageListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - _request = HttpRequest("GET", next_link) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @distributed_trace - def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> AsyncItemPaged["_models.Image"]: - """Gets the list of images under a resource group. Use nextLink property in the response to get - the next page of Images. Do this till nextLink is null to fetch all the Images. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :return: An iterator like instance of either Image or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.models.Image] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[_models.ImageListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_by_resource_group_request( - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - _request = HttpRequest("GET", next_link) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @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. The name is case insensitive. - Required. - :type resource_group_name: str - :param image_name: The name of the image. Required. - :type image_name: str - :param expand: The expand expression to apply on the operation. Default value is None. - :type expand: str - :return: Image or the result of cls(response) - :rtype: ~azure.mgmt.compute.models.Image - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[_models.Image] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - image_name=image_name, - subscription_id=self._config.subscription_id, - expand=expand, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("Image", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, resource_group_name: str, image_name: str, parameters: Union[_models.Image, IO[bytes]], **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "Image") - - _request = build_create_or_update_request( - 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, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 201: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - image_name: str, - parameters: _models.Image, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.Image]: - """Create or update an image. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param image_name: The name of the image. Required. - :type image_name: str - :param parameters: Parameters supplied to the Create Image operation. Required. - :type parameters: ~azure.mgmt.compute.models.Image - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either Image or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.Image] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - image_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.Image]: - """Create or update an image. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param image_name: The name of the image. Required. - :type image_name: str - :param parameters: Parameters supplied to the Create Image operation. Required. - :type parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either Image or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.Image] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, resource_group_name: str, image_name: str, parameters: Union[_models.Image, IO[bytes]], **kwargs: Any - ) -> AsyncLROPoller[_models.Image]: - """Create or update an image. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param image_name: The name of the image. Required. - :type image_name: str - :param parameters: Parameters supplied to the Create Image operation. Is either a Image type or - a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.compute.models.Image or IO[bytes] - :return: An instance of AsyncLROPoller that returns either Image or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.Image] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Image] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._create_or_update_initial( - resource_group_name=resource_group_name, - image_name=image_name, - parameters=parameters, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Image", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.Image].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.Image]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _update_initial( - self, - resource_group_name: str, - image_name: str, - parameters: Union[_models.ImageUpdate, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "ImageUpdate") - - _request = build_update_request( - 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, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 201: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_update( - self, - resource_group_name: str, - image_name: str, - parameters: _models.ImageUpdate, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.Image]: - """Update an image. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param image_name: The name of the image. Required. - :type image_name: str - :param parameters: Parameters supplied to the Update Image operation. Required. - :type parameters: ~azure.mgmt.compute.models.ImageUpdate - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either Image or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.Image] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update( - self, - resource_group_name: str, - image_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.Image]: - """Update an image. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param image_name: The name of the image. Required. - :type image_name: str - :param parameters: Parameters supplied to the Update Image operation. Required. - :type parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either Image or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.Image] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_update( - self, - resource_group_name: str, - image_name: str, - parameters: Union[_models.ImageUpdate, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.Image]: - """Update an image. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param image_name: The name of the image. Required. - :type image_name: str - :param parameters: Parameters supplied to the Update Image operation. Is either a ImageUpdate - type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.compute.models.ImageUpdate or IO[bytes] - :return: An instance of AsyncLROPoller that returns either Image or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.Image] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Image] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._update_initial( - resource_group_name=resource_group_name, - image_name=image_name, - parameters=parameters, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Image", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.Image].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.Image]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial(self, resource_group_name: str, image_name: str, **kwargs: Any) -> AsyncIterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - image_name=image_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_delete(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. The name is case insensitive. - Required. - :type resource_group_name: str - :param image_name: The name of the image. Required. - :type image_name: str - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._delete_initial( - resource_group_name=resource_group_name, - image_name=image_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/operations/_log_analytics_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/operations/_log_analytics_operations.py deleted file mode 100644 index ae1591a6b38e..000000000000 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/operations/_log_analytics_operations.py +++ /dev/null @@ -1,427 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from collections.abc import MutableMapping -from io import IOBase -from typing import Any, AsyncIterator, Callable, IO, Optional, TypeVar, Union, cast, overload - -from azure.core import AsyncPipelineClient -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - StreamClosedError, - StreamConsumedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ..._utils.serialization import Deserializer, Serializer -from ...operations._log_analytics_operations import ( - build_export_request_rate_by_interval_request, - build_export_throttled_requests_request, -) -from .._configuration import ComputeManagementClientConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] -List = list - - -class LogAnalyticsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.compute.aio.ComputeManagementClient`'s - :attr:`log_analytics` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - async def _export_request_rate_by_interval_initial( - self, location: str, parameters: Union[_models.RequestRateByIntervalInput, IO[bytes]], **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "RequestRateByIntervalInput") - - _request = build_export_request_rate_by_interval_request( - location=location, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_export_request_rate_by_interval( - self, - location: str, - parameters: _models.RequestRateByIntervalInput, - *, - content_type: str = "application/json", - **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 name of Azure region. Required. - :type location: str - :param parameters: Parameters supplied to the LogAnalytics getRequestRateByInterval Api. - Required. - :type parameters: ~azure.mgmt.compute.models.RequestRateByIntervalInput - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either LogAnalyticsOperationResult or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.LogAnalyticsOperationResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_export_request_rate_by_interval( - self, location: str, parameters: IO[bytes], *, content_type: str = "application/json", **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 name of Azure region. Required. - :type location: str - :param parameters: Parameters supplied to the LogAnalytics getRequestRateByInterval Api. - Required. - :type parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either LogAnalyticsOperationResult or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.LogAnalyticsOperationResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_export_request_rate_by_interval( - self, location: str, parameters: Union[_models.RequestRateByIntervalInput, IO[bytes]], **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 name of Azure region. Required. - :type location: str - :param parameters: Parameters supplied to the LogAnalytics getRequestRateByInterval Api. Is - either a RequestRateByIntervalInput type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.compute.models.RequestRateByIntervalInput or IO[bytes] - :return: An instance of AsyncLROPoller that returns either LogAnalyticsOperationResult or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.LogAnalyticsOperationResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.LogAnalyticsOperationResult] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._export_request_rate_by_interval_initial( - location=location, - parameters=parameters, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("LogAnalyticsOperationResult", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.LogAnalyticsOperationResult].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.LogAnalyticsOperationResult]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _export_throttled_requests_initial( - self, location: str, parameters: Union[_models.ThrottledRequestsInput, IO[bytes]], **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "ThrottledRequestsInput") - - _request = build_export_throttled_requests_request( - location=location, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_export_throttled_requests( - self, - location: str, - parameters: _models.ThrottledRequestsInput, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.LogAnalyticsOperationResult]: - """Export logs that show total throttled Api requests for this subscription in the given time - window. - - :param location: The name of Azure region. Required. - :type location: str - :param parameters: The request body. Required. - :type parameters: ~azure.mgmt.compute.models.ThrottledRequestsInput - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either LogAnalyticsOperationResult or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.LogAnalyticsOperationResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_export_throttled_requests( - self, location: str, parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.LogAnalyticsOperationResult]: - """Export logs that show total throttled Api requests for this subscription in the given time - window. - - :param location: The name of Azure region. Required. - :type location: str - :param parameters: The request body. Required. - :type parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either LogAnalyticsOperationResult or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.LogAnalyticsOperationResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_export_throttled_requests( - self, location: str, parameters: Union[_models.ThrottledRequestsInput, IO[bytes]], **kwargs: Any - ) -> AsyncLROPoller[_models.LogAnalyticsOperationResult]: - """Export logs that show total throttled Api requests for this subscription in the given time - window. - - :param location: The name of Azure region. Required. - :type location: str - :param parameters: The request body. Is either a ThrottledRequestsInput type or a IO[bytes] - type. Required. - :type parameters: ~azure.mgmt.compute.models.ThrottledRequestsInput or IO[bytes] - :return: An instance of AsyncLROPoller that returns either LogAnalyticsOperationResult or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.LogAnalyticsOperationResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.LogAnalyticsOperationResult] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._export_throttled_requests_initial( - location=location, - parameters=parameters, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("LogAnalyticsOperationResult", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.LogAnalyticsOperationResult].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.LogAnalyticsOperationResult]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/operations/_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/operations/_operations.py index f3bb26d06769..633503f7f0f3 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/operations/_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/operations/_operations.py @@ -1,36 +1,324 @@ +# pylint: disable=line-too-long,useless-suppression,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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from collections.abc import MutableMapping -from typing import Any, Callable, Optional, TypeVar +from io import IOBase +import json +from typing import Any, AsyncIterator, Callable, IO, Optional, TypeVar, Union, cast, overload +import urllib.parse -from azure.core import AsyncPipelineClient +from azure.core import AsyncPipelineClient, MatchConditions from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, ResourceExistsError, + ResourceModifiedError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models +from ..._utils.model_base import SdkJSONEncoder, _deserialize, _failsafe_deserialize from ..._utils.serialization import Deserializer, Serializer -from ...operations._operations import build_list_request -from .._configuration import ComputeManagementClientConfiguration +from ..._validation import api_version_validation +from ...operations._operations import ( + build_availability_sets_cancel_migration_to_virtual_machine_scale_set_request, + build_availability_sets_convert_to_virtual_machine_scale_set_request, + build_availability_sets_create_or_update_request, + build_availability_sets_delete_request, + build_availability_sets_get_request, + build_availability_sets_list_available_sizes_request, + build_availability_sets_list_by_subscription_request, + build_availability_sets_list_request, + build_availability_sets_start_migration_to_virtual_machine_scale_set_request, + build_availability_sets_update_request, + build_availability_sets_validate_migration_to_virtual_machine_scale_set_request, + build_capacity_reservation_groups_create_or_update_request, + build_capacity_reservation_groups_delete_request, + build_capacity_reservation_groups_get_request, + build_capacity_reservation_groups_list_by_resource_group_request, + build_capacity_reservation_groups_list_by_subscription_request, + build_capacity_reservation_groups_update_request, + build_capacity_reservations_create_or_update_request, + build_capacity_reservations_delete_request, + build_capacity_reservations_get_request, + build_capacity_reservations_list_by_capacity_reservation_group_request, + build_capacity_reservations_update_request, + build_community_galleries_get_request, + build_community_gallery_image_versions_get_request, + build_community_gallery_image_versions_list_request, + build_community_gallery_images_get_request, + build_community_gallery_images_list_request, + build_dedicated_host_groups_create_or_update_request, + build_dedicated_host_groups_delete_request, + build_dedicated_host_groups_get_request, + build_dedicated_host_groups_list_by_resource_group_request, + build_dedicated_host_groups_list_by_subscription_request, + build_dedicated_host_groups_update_request, + build_dedicated_hosts_create_or_update_request, + build_dedicated_hosts_delete_request, + build_dedicated_hosts_get_request, + build_dedicated_hosts_list_available_sizes_request, + build_dedicated_hosts_list_by_host_group_request, + build_dedicated_hosts_redeploy_request, + build_dedicated_hosts_restart_request, + build_dedicated_hosts_update_request, + build_disk_accesses_create_or_update_request, + build_disk_accesses_delete_request, + build_disk_accesses_get_private_link_resources_request, + build_disk_accesses_get_request, + build_disk_accesses_list_by_resource_group_request, + build_disk_accesses_list_request, + build_disk_accesses_update_request, + build_disk_encryption_sets_create_or_update_request, + build_disk_encryption_sets_delete_request, + build_disk_encryption_sets_get_request, + build_disk_encryption_sets_list_associated_resources_request, + build_disk_encryption_sets_list_by_resource_group_request, + build_disk_encryption_sets_list_request, + build_disk_encryption_sets_update_request, + build_disk_restore_points_get_request, + build_disk_restore_points_grant_access_request, + build_disk_restore_points_list_by_restore_point_request, + build_disk_restore_points_revoke_access_request, + build_disks_create_or_update_request, + build_disks_delete_request, + build_disks_get_request, + build_disks_grant_access_request, + build_disks_list_by_resource_group_request, + build_disks_list_request, + build_disks_revoke_access_request, + build_disks_update_request, + build_galleries_create_or_update_request, + build_galleries_delete_request, + build_galleries_gallery_sharing_profile_update_request, + build_galleries_get_request, + build_galleries_list_by_artifact_name_request, + build_galleries_list_by_resource_group_request, + build_galleries_list_request, + build_galleries_update_request, + build_gallery_application_versions_create_or_update_request, + build_gallery_application_versions_delete_request, + build_gallery_application_versions_get_request, + build_gallery_application_versions_list_by_gallery_application_request, + build_gallery_application_versions_update_request, + build_gallery_applications_create_or_update_request, + build_gallery_applications_delete_request, + build_gallery_applications_get_request, + build_gallery_applications_list_by_gallery_request, + build_gallery_applications_update_request, + build_gallery_image_versions_create_or_update_request, + build_gallery_image_versions_delete_request, + build_gallery_image_versions_get_request, + build_gallery_image_versions_list_by_gallery_image_request, + build_gallery_image_versions_update_request, + build_gallery_images_create_or_update_request, + build_gallery_images_delete_request, + build_gallery_images_get_request, + build_gallery_images_list_by_gallery_request, + build_gallery_images_update_request, + build_gallery_in_vm_access_control_profile_versions_create_or_update_request, + build_gallery_in_vm_access_control_profile_versions_delete_request, + build_gallery_in_vm_access_control_profile_versions_get_request, + build_gallery_in_vm_access_control_profile_versions_list_by_gallery_in_vm_access_control_profile_request, + build_gallery_in_vm_access_control_profile_versions_update_request, + build_gallery_in_vm_access_control_profiles_create_or_update_request, + build_gallery_in_vm_access_control_profiles_delete_request, + build_gallery_in_vm_access_control_profiles_get_request, + build_gallery_in_vm_access_control_profiles_list_by_gallery_request, + build_gallery_in_vm_access_control_profiles_update_request, + build_images_create_or_update_request, + build_images_delete_request, + build_images_get_request, + build_images_list_by_resource_group_request, + build_images_list_request, + build_images_update_request, + build_log_analytics_operation_group_export_request_rate_by_interval_request, + build_log_analytics_operation_group_export_throttled_requests_request, + build_operations_list_request, + build_private_endpoint_connections_delete_a_private_endpoint_connection_request, + build_private_endpoint_connections_get_a_private_endpoint_connection_request, + build_private_endpoint_connections_list_private_endpoint_connections_request, + build_private_endpoint_connections_update_a_private_endpoint_connection_request, + build_proximity_placement_groups_create_or_update_request, + build_proximity_placement_groups_delete_request, + build_proximity_placement_groups_get_request, + build_proximity_placement_groups_list_by_resource_group_request, + build_proximity_placement_groups_list_by_subscription_request, + build_proximity_placement_groups_update_request, + build_resource_skus_list_request, + build_restore_point_collections_create_or_update_request, + build_restore_point_collections_delete_request, + build_restore_point_collections_get_request, + build_restore_point_collections_list_all_request, + build_restore_point_collections_list_request, + build_restore_point_collections_update_request, + build_restore_points_create_request, + build_restore_points_delete_request, + build_restore_points_get_request, + build_rolling_upgrade_status_infos_get_latest_request, + build_shared_galleries_get_request, + build_shared_galleries_list_request, + build_shared_gallery_image_versions_get_request, + build_shared_gallery_image_versions_list_request, + build_shared_gallery_images_get_request, + build_shared_gallery_images_list_request, + build_snapshots_create_or_update_request, + build_snapshots_delete_request, + build_snapshots_get_request, + build_snapshots_grant_access_request, + build_snapshots_list_by_resource_group_request, + build_snapshots_list_request, + build_snapshots_revoke_access_request, + build_snapshots_update_request, + build_ssh_public_key_resources_create_request, + build_ssh_public_key_resources_delete_request, + build_ssh_public_key_resources_generate_key_pair_request, + build_ssh_public_key_resources_get_request, + build_ssh_public_key_resources_list_by_resource_group_request, + build_ssh_public_key_resources_list_by_subscription_request, + build_ssh_public_key_resources_update_request, + build_usage_operation_group_list_request, + build_virtual_machine_extension_images_get_request, + build_virtual_machine_extension_images_list_types_request, + build_virtual_machine_extension_images_list_versions_request, + build_virtual_machine_extensions_create_or_update_request, + build_virtual_machine_extensions_delete_request, + build_virtual_machine_extensions_get_request, + build_virtual_machine_extensions_list_request, + build_virtual_machine_extensions_update_request, + build_virtual_machine_images_edge_zone_operation_group_get_request, + build_virtual_machine_images_edge_zone_operation_group_list_offers_request, + build_virtual_machine_images_edge_zone_operation_group_list_publishers_request, + build_virtual_machine_images_edge_zone_operation_group_list_request, + build_virtual_machine_images_edge_zone_operation_group_list_skus_request, + build_virtual_machine_images_operation_group_get_request, + build_virtual_machine_images_operation_group_list_by_edge_zone_request, + build_virtual_machine_images_operation_group_list_offers_request, + build_virtual_machine_images_operation_group_list_publishers_request, + build_virtual_machine_images_operation_group_list_request, + build_virtual_machine_images_operation_group_list_skus_request, + build_virtual_machine_images_operation_group_list_with_properties_request, + build_virtual_machine_run_commands_create_or_update_request, + build_virtual_machine_run_commands_delete_request, + build_virtual_machine_run_commands_get_by_virtual_machine_request, + build_virtual_machine_run_commands_list_by_virtual_machine_request, + build_virtual_machine_run_commands_operation_group_get_request, + build_virtual_machine_run_commands_operation_group_list_request, + build_virtual_machine_run_commands_update_request, + build_virtual_machine_scale_set_extensions_create_or_update_request, + build_virtual_machine_scale_set_extensions_delete_request, + build_virtual_machine_scale_set_extensions_get_request, + build_virtual_machine_scale_set_extensions_list_request, + build_virtual_machine_scale_set_extensions_update_request, + build_virtual_machine_scale_set_vm_extensions_create_or_update_request, + build_virtual_machine_scale_set_vm_extensions_delete_request, + build_virtual_machine_scale_set_vm_extensions_get_request, + build_virtual_machine_scale_set_vm_extensions_list_request, + build_virtual_machine_scale_set_vm_extensions_update_request, + build_virtual_machine_scale_set_vm_run_commands_create_or_update_request, + build_virtual_machine_scale_set_vm_run_commands_delete_request, + build_virtual_machine_scale_set_vm_run_commands_get_request, + build_virtual_machine_scale_set_vm_run_commands_list_request, + build_virtual_machine_scale_set_vm_run_commands_update_request, + build_virtual_machine_scale_set_vms_approve_rolling_upgrade_request, + build_virtual_machine_scale_set_vms_attach_detach_data_disks_request, + build_virtual_machine_scale_set_vms_deallocate_request, + build_virtual_machine_scale_set_vms_delete_request, + build_virtual_machine_scale_set_vms_get_instance_view_request, + build_virtual_machine_scale_set_vms_get_request, + build_virtual_machine_scale_set_vms_list_request, + build_virtual_machine_scale_set_vms_perform_maintenance_request, + build_virtual_machine_scale_set_vms_power_off_request, + build_virtual_machine_scale_set_vms_redeploy_request, + build_virtual_machine_scale_set_vms_reimage_all_request, + build_virtual_machine_scale_set_vms_reimage_request, + build_virtual_machine_scale_set_vms_restart_request, + build_virtual_machine_scale_set_vms_retrieve_boot_diagnostics_data_request, + build_virtual_machine_scale_set_vms_run_command_request, + build_virtual_machine_scale_set_vms_simulate_eviction_request, + build_virtual_machine_scale_set_vms_start_request, + build_virtual_machine_scale_set_vms_update_request, + build_virtual_machine_scale_sets_approve_rolling_upgrade_request, + build_virtual_machine_scale_sets_cancel_request, + build_virtual_machine_scale_sets_convert_to_single_placement_group_request, + build_virtual_machine_scale_sets_create_or_update_request, + build_virtual_machine_scale_sets_deallocate_request, + build_virtual_machine_scale_sets_delete_instances_request, + build_virtual_machine_scale_sets_delete_request, + build_virtual_machine_scale_sets_force_recovery_service_fabric_platform_update_domain_walk_request, + build_virtual_machine_scale_sets_get_instance_view_request, + build_virtual_machine_scale_sets_get_os_upgrade_history_request, + build_virtual_machine_scale_sets_get_request, + build_virtual_machine_scale_sets_list_all_request, + build_virtual_machine_scale_sets_list_request, + build_virtual_machine_scale_sets_list_skus_request, + build_virtual_machine_scale_sets_operation_group_list_by_location_request, + build_virtual_machine_scale_sets_perform_maintenance_request, + build_virtual_machine_scale_sets_power_off_request, + build_virtual_machine_scale_sets_reapply_request, + build_virtual_machine_scale_sets_redeploy_request, + build_virtual_machine_scale_sets_reimage_all_request, + build_virtual_machine_scale_sets_reimage_request, + build_virtual_machine_scale_sets_restart_request, + build_virtual_machine_scale_sets_scale_out_request, + build_virtual_machine_scale_sets_set_orchestration_service_state_request, + build_virtual_machine_scale_sets_start_extension_upgrade_request, + build_virtual_machine_scale_sets_start_os_upgrade_request, + build_virtual_machine_scale_sets_start_request, + build_virtual_machine_scale_sets_update_instances_request, + build_virtual_machine_scale_sets_update_request, + build_virtual_machine_sizes_operation_group_list_request, + build_virtual_machines_assess_patches_request, + build_virtual_machines_attach_detach_data_disks_request, + build_virtual_machines_capture_request, + build_virtual_machines_convert_to_managed_disks_request, + build_virtual_machines_create_or_update_request, + build_virtual_machines_deallocate_request, + build_virtual_machines_delete_request, + build_virtual_machines_generalize_request, + build_virtual_machines_get_request, + build_virtual_machines_install_patches_request, + build_virtual_machines_instance_view_request, + build_virtual_machines_list_all_request, + build_virtual_machines_list_available_sizes_request, + build_virtual_machines_list_request, + build_virtual_machines_migrate_to_vm_scale_set_request, + build_virtual_machines_operation_group_list_by_location_request, + build_virtual_machines_perform_maintenance_request, + build_virtual_machines_power_off_request, + build_virtual_machines_reapply_request, + build_virtual_machines_redeploy_request, + build_virtual_machines_reimage_request, + build_virtual_machines_restart_request, + build_virtual_machines_retrieve_boot_diagnostics_data_request, + build_virtual_machines_run_command_request, + build_virtual_machines_simulate_eviction_request, + build_virtual_machines_start_request, + build_virtual_machines_update_request, +) +from .._configuration import ComputeClientConfiguration T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] +JSON = MutableMapping[str, Any] List = list @@ -40,16 +328,14 @@ class Operations: **DO NOT** instantiate this class directly. Instead, you should access the following operations through - :class:`~azure.mgmt.compute.aio.ComputeManagementClient`'s + :class:`~azure.mgmt.compute.aio.ComputeClient`'s :attr:`operations` attribute. """ - models = _models - def __init__(self, *args, **kwargs) -> None: input_args = list(args) self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._config: ComputeClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @@ -57,15 +343,843 @@ def __init__(self, *args, **kwargs) -> None: def list(self, **kwargs: Any) -> AsyncItemPaged["_models.Operation"]: """List the operations for the provider. - :return: An iterator like instance of either Operation or the result of cls(response) + :return: An iterator like instance of Operation :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.models.Operation] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.Operation]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_operations_list_request( + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.Operation], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + +class VirtualMachineScaleSetsOperations: # pylint: disable=too-many-public-methods + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.compute.aio.ComputeClient`'s + :attr:`virtual_machine_scale_sets` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @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. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :keyword 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. "userData" Default value is None. + :paramtype expand: str or ~azure.mgmt.compute.models.ExpandTypesForGetVMScaleSets + :return: VirtualMachineScaleSet. The VirtualMachineScaleSet is compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.VirtualMachineScaleSet + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.VirtualMachineScaleSet] = kwargs.pop("cls", None) + + _request = build_virtual_machine_scale_sets_get_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + expand=expand, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.VirtualMachineScaleSet, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _create_or_update_initial( + self, + resource_group_name: str, + vm_scale_set_name: str, + resource: Union[_models.VirtualMachineScaleSet, JSON, IO[bytes]], + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + if match_condition == MatchConditions.IfNotModified: + error_map[412] = ResourceModifiedError + elif match_condition == MatchConditions.IfPresent: + error_map[412] = ResourceNotFoundError + elif match_condition == MatchConditions.IfMissing: + error_map[412] = ResourceExistsError + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(resource, (IOBase, bytes)): + _content = resource + else: + _content = json.dumps(resource, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_virtual_machine_scale_sets_create_or_update_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + etag=etag, + match_condition=match_condition, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 201: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + vm_scale_set_name: str, + resource: _models.VirtualMachineScaleSet, + *, + content_type: str = "application/json", + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Create or update a VM scale set. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param resource: The scale set object. Required. + :type resource: ~azure.mgmt.compute.models.VirtualMachineScaleSet + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + vm_scale_set_name: str, + resource: JSON, + *, + content_type: str = "application/json", + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Create or update a VM scale set. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param resource: The scale set object. Required. + :type resource: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + vm_scale_set_name: str, + resource: IO[bytes], + *, + content_type: str = "application/json", + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Create or update a VM scale set. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param resource: The scale set object. Required. + :type resource: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + vm_scale_set_name: str, + resource: Union[_models.VirtualMachineScaleSet, JSON, IO[bytes]], + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Create or update a VM scale set. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param resource: The scale set object. Is one of the following types: VirtualMachineScaleSet, + JSON, IO[bytes] Required. + :type resource: ~azure.mgmt.compute.models.VirtualMachineScaleSet or JSON or IO[bytes] + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._create_or_update_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + resource=resource, + etag=etag, + match_condition=match_condition, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + async def _update_initial( + self, + resource_group_name: str, + vm_scale_set_name: str, + properties: Union[_models.VirtualMachineScaleSetUpdate, JSON, IO[bytes]], + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + if match_condition == MatchConditions.IfNotModified: + error_map[412] = ResourceModifiedError + elif match_condition == MatchConditions.IfPresent: + error_map[412] = ResourceNotFoundError + elif match_condition == MatchConditions.IfMissing: + error_map[412] = ResourceExistsError + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(properties, (IOBase, bytes)): + _content = properties + else: + _content = json.dumps(properties, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_virtual_machine_scale_sets_update_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + etag=etag, + match_condition=match_condition, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_update( + self, + resource_group_name: str, + vm_scale_set_name: str, + properties: _models.VirtualMachineScaleSetUpdate, + *, + content_type: str = "application/json", + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Update a VM scale set. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param properties: The scale set object. Required. + :type properties: ~azure.mgmt.compute.models.VirtualMachineScaleSetUpdate + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update( + self, + resource_group_name: str, + vm_scale_set_name: str, + properties: JSON, + *, + content_type: str = "application/json", + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Update a VM scale set. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param properties: The scale set object. Required. + :type properties: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update( + self, + resource_group_name: str, + vm_scale_set_name: str, + properties: IO[bytes], + *, + content_type: str = "application/json", + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Update a VM scale set. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param properties: The scale set object. Required. + :type properties: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_update( + self, + resource_group_name: str, + vm_scale_set_name: str, + properties: Union[_models.VirtualMachineScaleSetUpdate, JSON, IO[bytes]], + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Update a VM scale set. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param properties: The scale set object. Is one of the following types: + VirtualMachineScaleSetUpdate, JSON, IO[bytes] Required. + :type properties: ~azure.mgmt.compute.models.VirtualMachineScaleSetUpdate or JSON or IO[bytes] + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._update_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + properties=properties, + etag=etag, + match_condition=match_condition, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + async def _delete_initial( + self, resource_group_name: str, vm_scale_set_name: str, *, force_deletion: Optional[bool] = None, **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_virtual_machine_scale_sets_delete_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + force_deletion=force_deletion, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_delete( + 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. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :keyword force_deletion: Optional parameter to force delete a VM scale set. (Feature in + Preview). Default value is None. + :paramtype force_deletion: bool + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + force_deletion=force_deletion, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace + def list(self, resource_group_name: str, **kwargs: Any) -> AsyncItemPaged["_models.VirtualMachineScaleSet"]: + """Gets a list of all VM scale sets under a resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :return: An iterator like instance of VirtualMachineScaleSet + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.models.VirtualMachineScaleSet] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) + cls: ClsType[List[_models.VirtualMachineScaleSet]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -78,25 +1192,38183 @@ def list(self, **kwargs: Any) -> AsyncItemPaged["_models.Operation"]: def prepare_request(next_link=None): if not next_link: - _request = build_list_request( - api_version=api_version, + _request = build_virtual_machine_scale_sets_list_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, headers=_headers, params=_params, ) - _request.url = self._client.format_url(_request.url) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) else: - _request = HttpRequest("GET", next_link) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.VirtualMachineScaleSet], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + @distributed_trace + def list_all(self, **kwargs: Any) -> AsyncItemPaged["_models.VirtualMachineScaleSet"]: + """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. + + :return: An iterator like instance of VirtualMachineScaleSet + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.models.VirtualMachineScaleSet] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.VirtualMachineScaleSet]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_virtual_machine_scale_sets_list_all_request( + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.VirtualMachineScaleSet], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + async def _approve_rolling_upgrade_initial( + self, + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional[Union[_models.VirtualMachineScaleSetVMInstanceIDs, JSON, IO[bytes]]] = None, + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + content_type = content_type if vm_instance_i_ds else None + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" if vm_instance_i_ds else None + _content = None + if isinstance(vm_instance_i_ds, (IOBase, bytes)): + _content = vm_instance_i_ds + else: + if vm_instance_i_ds is not None: + _content = json.dumps(vm_instance_i_ds, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + else: + _content = None + + _request = build_virtual_machine_scale_sets_approve_rolling_upgrade_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_approve_rolling_upgrade( + self, + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional[_models.VirtualMachineScaleSetVMInstanceIDs] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Approve upgrade on deferred rolling upgrades for OS disks in the virtual machines in a VM scale + set. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :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.models.VirtualMachineScaleSetVMInstanceIDs + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_approve_rolling_upgrade( + self, + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional[JSON] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Approve upgrade on deferred rolling upgrades for OS disks in the virtual machines in a VM scale + set. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :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: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_approve_rolling_upgrade( + self, + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Approve upgrade on deferred rolling upgrades for OS disks in the virtual machines in a VM scale + set. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :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: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_approve_rolling_upgrade( + self, + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional[Union[_models.VirtualMachineScaleSetVMInstanceIDs, JSON, IO[bytes]]] = None, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Approve upgrade on deferred rolling upgrades for OS disks in the virtual machines in a VM scale + set. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param vm_instance_i_ds: A list of virtual machine instance IDs from the VM scale set. Is one + of the following types: VirtualMachineScaleSetVMInstanceIDs, JSON, IO[bytes] Default value is + None. + :type vm_instance_i_ds: ~azure.mgmt.compute.models.VirtualMachineScaleSetVMInstanceIDs or JSON + or IO[bytes] + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + content_type = content_type if vm_instance_i_ds else None + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._approve_rolling_upgrade_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + vm_instance_i_ds=vm_instance_i_ds, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @overload + async def convert_to_single_placement_group( + self, + resource_group_name: str, + vm_scale_set_name: str, + body: _models.VMScaleSetConvertToSinglePlacementGroupInput, + *, + content_type: str = "application/json", + **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. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param body: The input object for ConvertToSinglePlacementGroup API. Required. + :type body: ~azure.mgmt.compute.models.VMScaleSetConvertToSinglePlacementGroupInput + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def convert_to_single_placement_group( + self, + resource_group_name: str, + vm_scale_set_name: str, + body: JSON, + *, + content_type: str = "application/json", + **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. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param body: The input object for ConvertToSinglePlacementGroup API. Required. + :type body: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def convert_to_single_placement_group( + self, + resource_group_name: str, + vm_scale_set_name: str, + body: IO[bytes], + *, + content_type: str = "application/json", + **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. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param body: The input object for ConvertToSinglePlacementGroup API. Required. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def convert_to_single_placement_group( + self, + resource_group_name: str, + vm_scale_set_name: str, + body: Union[_models.VMScaleSetConvertToSinglePlacementGroupInput, JSON, IO[bytes]], + **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. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param body: The input object for ConvertToSinglePlacementGroup API. Is one of the following + types: VMScaleSetConvertToSinglePlacementGroupInput, JSON, IO[bytes] Required. + :type body: ~azure.mgmt.compute.models.VMScaleSetConvertToSinglePlacementGroupInput or JSON or + IO[bytes] + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_virtual_machine_scale_sets_convert_to_single_placement_group_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + async def _deallocate_initial( + self, + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional[Union[_models.VirtualMachineScaleSetVMInstanceIDs, JSON, IO[bytes]]] = None, + *, + hibernate: Optional[bool] = None, + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + content_type = content_type if vm_instance_i_ds else None + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" if vm_instance_i_ds else None + _content = None + if isinstance(vm_instance_i_ds, (IOBase, bytes)): + _content = vm_instance_i_ds + else: + if vm_instance_i_ds is not None: + _content = json.dumps(vm_instance_i_ds, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + else: + _content = None + + _request = build_virtual_machine_scale_sets_deallocate_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + hibernate=hibernate, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_deallocate( + self, + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional[_models.VirtualMachineScaleSetVMInstanceIDs] = None, + *, + hibernate: Optional[bool] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.OkResponse]: + """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. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :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.models.VirtualMachineScaleSetVMInstanceIDs + :keyword hibernate: Optional parameter to hibernate a virtual machine from the VM scale set. + (This feature is available for VMSS with Flexible OrchestrationMode only). Default value is + None. + :paramtype hibernate: bool + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns OkResponse. The OkResponse is compatible + with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.OkResponse] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_deallocate( + self, + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional[JSON] = None, + *, + hibernate: Optional[bool] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.OkResponse]: + """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. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :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: JSON + :keyword hibernate: Optional parameter to hibernate a virtual machine from the VM scale set. + (This feature is available for VMSS with Flexible OrchestrationMode only). Default value is + None. + :paramtype hibernate: bool + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns OkResponse. The OkResponse is compatible + with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.OkResponse] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_deallocate( + self, + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional[IO[bytes]] = None, + *, + hibernate: Optional[bool] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.OkResponse]: + """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. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :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: IO[bytes] + :keyword hibernate: Optional parameter to hibernate a virtual machine from the VM scale set. + (This feature is available for VMSS with Flexible OrchestrationMode only). Default value is + None. + :paramtype hibernate: bool + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns OkResponse. The OkResponse is compatible + with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.OkResponse] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_deallocate( + self, + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional[Union[_models.VirtualMachineScaleSetVMInstanceIDs, JSON, IO[bytes]]] = None, + *, + hibernate: Optional[bool] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.OkResponse]: + """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. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param vm_instance_i_ds: A list of virtual machine instance IDs from the VM scale set. Is one + of the following types: VirtualMachineScaleSetVMInstanceIDs, JSON, IO[bytes] Default value is + None. + :type vm_instance_i_ds: ~azure.mgmt.compute.models.VirtualMachineScaleSetVMInstanceIDs or JSON + or IO[bytes] + :keyword hibernate: Optional parameter to hibernate a virtual machine from the VM scale set. + (This feature is available for VMSS with Flexible OrchestrationMode only). Default value is + None. + :paramtype hibernate: bool + :return: An instance of AsyncLROPoller that returns OkResponse. The OkResponse is compatible + with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.OkResponse] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + content_type = content_type if vm_instance_i_ds else None + cls: ClsType[_models.OkResponse] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._deallocate_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + vm_instance_i_ds=vm_instance_i_ds, + hibernate=hibernate, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = _deserialize(_models.OkResponse, response.json()) + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.OkResponse].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.OkResponse]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _delete_instances_initial( + self, + resource_group_name: str, + vm_scale_set_name: str, + body: Union[_models.VirtualMachineScaleSetVMInstanceRequiredIDs, JSON, IO[bytes]], + *, + force_deletion: Optional[bool] = None, + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_virtual_machine_scale_sets_delete_instances_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + force_deletion=force_deletion, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_delete_instances( + self, + resource_group_name: str, + vm_scale_set_name: str, + body: _models.VirtualMachineScaleSetVMInstanceRequiredIDs, + *, + force_deletion: Optional[bool] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.OkResponse]: + """Deletes virtual machines in a VM scale set. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param body: A list of virtual machine instance IDs from the VM scale set. Required. + :type body: ~azure.mgmt.compute.models.VirtualMachineScaleSetVMInstanceRequiredIDs + :keyword force_deletion: Optional parameter to force delete virtual machines from the VM scale + set. (Feature in Preview). Default value is None. + :paramtype force_deletion: bool + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns OkResponse. The OkResponse is compatible + with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.OkResponse] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_delete_instances( + self, + resource_group_name: str, + vm_scale_set_name: str, + body: JSON, + *, + force_deletion: Optional[bool] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.OkResponse]: + """Deletes virtual machines in a VM scale set. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param body: A list of virtual machine instance IDs from the VM scale set. Required. + :type body: JSON + :keyword force_deletion: Optional parameter to force delete virtual machines from the VM scale + set. (Feature in Preview). Default value is None. + :paramtype force_deletion: bool + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns OkResponse. The OkResponse is compatible + with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.OkResponse] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_delete_instances( + self, + resource_group_name: str, + vm_scale_set_name: str, + body: IO[bytes], + *, + force_deletion: Optional[bool] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.OkResponse]: + """Deletes virtual machines in a VM scale set. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param body: A list of virtual machine instance IDs from the VM scale set. Required. + :type body: IO[bytes] + :keyword force_deletion: Optional parameter to force delete virtual machines from the VM scale + set. (Feature in Preview). Default value is None. + :paramtype force_deletion: bool + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns OkResponse. The OkResponse is compatible + with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.OkResponse] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_delete_instances( + self, + resource_group_name: str, + vm_scale_set_name: str, + body: Union[_models.VirtualMachineScaleSetVMInstanceRequiredIDs, JSON, IO[bytes]], + *, + force_deletion: Optional[bool] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.OkResponse]: + """Deletes virtual machines in a VM scale set. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param body: A list of virtual machine instance IDs from the VM scale set. Is one of the + following types: VirtualMachineScaleSetVMInstanceRequiredIDs, JSON, IO[bytes] Required. + :type body: ~azure.mgmt.compute.models.VirtualMachineScaleSetVMInstanceRequiredIDs or JSON or + IO[bytes] + :keyword force_deletion: Optional parameter to force delete virtual machines from the VM scale + set. (Feature in Preview). Default value is None. + :paramtype force_deletion: bool + :return: An instance of AsyncLROPoller that returns OkResponse. The OkResponse is compatible + with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.OkResponse] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.OkResponse] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._delete_instances_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + body=body, + force_deletion=force_deletion, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = _deserialize(_models.OkResponse, response.json()) + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.OkResponse].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.OkResponse]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + @distributed_trace_async + async def force_recovery_service_fabric_platform_update_domain_walk( # pylint: disable=name-too-long + 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. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :keyword platform_update_domain: The platform update domain for which a manual recovery walk is + requested. Required. + :paramtype platform_update_domain: int + :keyword zone: The zone in which the manual recovery walk is requested for cross zone virtual + machine scale set. Default value is None. + :paramtype zone: str + :keyword placement_group_id: The placement group id for which the manual recovery walk is + requested. Default value is None. + :paramtype placement_group_id: str + :return: RecoveryWalkResponse. The RecoveryWalkResponse is compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.RecoveryWalkResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.RecoveryWalkResponse] = kwargs.pop("cls", None) + + _request = build_virtual_machine_scale_sets_force_recovery_service_fabric_platform_update_domain_walk_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + platform_update_domain=platform_update_domain, + zone=zone, + placement_group_id=placement_group_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.RecoveryWalkResponse, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # 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. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :return: VirtualMachineScaleSetInstanceView. The VirtualMachineScaleSetInstanceView is + compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.VirtualMachineScaleSetInstanceView + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.VirtualMachineScaleSetInstanceView] = kwargs.pop("cls", None) + + _request = build_virtual_machine_scale_sets_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=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.VirtualMachineScaleSetInstanceView, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _update_instances_initial( + self, + resource_group_name: str, + vm_scale_set_name: str, + body: Union[_models.VirtualMachineScaleSetVMInstanceRequiredIDs, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_virtual_machine_scale_sets_update_instances_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_update_instances( + self, + resource_group_name: str, + vm_scale_set_name: str, + body: _models.VirtualMachineScaleSetVMInstanceRequiredIDs, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.OkResponse]: + """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. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param body: A list of virtual machine instance IDs from the VM scale set. Required. + :type body: ~azure.mgmt.compute.models.VirtualMachineScaleSetVMInstanceRequiredIDs + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns OkResponse. The OkResponse is compatible + with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.OkResponse] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update_instances( + self, + resource_group_name: str, + vm_scale_set_name: str, + body: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.OkResponse]: + """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. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param body: A list of virtual machine instance IDs from the VM scale set. Required. + :type body: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns OkResponse. The OkResponse is compatible + with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.OkResponse] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update_instances( + self, + resource_group_name: str, + vm_scale_set_name: str, + body: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.OkResponse]: + """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. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param body: A list of virtual machine instance IDs from the VM scale set. Required. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns OkResponse. The OkResponse is compatible + with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.OkResponse] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_update_instances( + self, + resource_group_name: str, + vm_scale_set_name: str, + body: Union[_models.VirtualMachineScaleSetVMInstanceRequiredIDs, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.OkResponse]: + """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. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param body: A list of virtual machine instance IDs from the VM scale set. Is one of the + following types: VirtualMachineScaleSetVMInstanceRequiredIDs, JSON, IO[bytes] Required. + :type body: ~azure.mgmt.compute.models.VirtualMachineScaleSetVMInstanceRequiredIDs or JSON or + IO[bytes] + :return: An instance of AsyncLROPoller that returns OkResponse. The OkResponse is compatible + with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.OkResponse] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.OkResponse] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._update_instances_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + body=body, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = _deserialize(_models.OkResponse, response.json()) + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.OkResponse].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.OkResponse]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + @distributed_trace + def get_os_upgrade_history( + self, resource_group_name: str, vm_scale_set_name: str, **kwargs: Any + ) -> AsyncItemPaged["_models.UpgradeOperationHistoricalStatusInfo"]: + """Gets list of OS upgrades on a VM scale set instance. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :return: An iterator like instance of UpgradeOperationHistoricalStatusInfo + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.models.UpgradeOperationHistoricalStatusInfo] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.UpgradeOperationHistoricalStatusInfo]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_virtual_machine_scale_sets_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=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.UpgradeOperationHistoricalStatusInfo], deserialized.get("value", []) + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + async def _perform_maintenance_initial( + self, + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional[Union[_models.VirtualMachineScaleSetVMInstanceIDs, JSON, IO[bytes]]] = None, + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + content_type = content_type if vm_instance_i_ds else None + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" if vm_instance_i_ds else None + _content = None + if isinstance(vm_instance_i_ds, (IOBase, bytes)): + _content = vm_instance_i_ds + else: + if vm_instance_i_ds is not None: + _content = json.dumps(vm_instance_i_ds, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + else: + _content = None + + _request = build_virtual_machine_scale_sets_perform_maintenance_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_perform_maintenance( + self, + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional[_models.VirtualMachineScaleSetVMInstanceIDs] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.OkResponse]: + """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. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :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.models.VirtualMachineScaleSetVMInstanceIDs + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns OkResponse. The OkResponse is compatible + with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.OkResponse] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_perform_maintenance( + self, + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional[JSON] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.OkResponse]: + """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. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :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: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns OkResponse. The OkResponse is compatible + with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.OkResponse] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_perform_maintenance( + self, + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.OkResponse]: + """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. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :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: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns OkResponse. The OkResponse is compatible + with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.OkResponse] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_perform_maintenance( + self, + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional[Union[_models.VirtualMachineScaleSetVMInstanceIDs, JSON, IO[bytes]]] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.OkResponse]: + """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. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param vm_instance_i_ds: A list of virtual machine instance IDs from the VM scale set. Is one + of the following types: VirtualMachineScaleSetVMInstanceIDs, JSON, IO[bytes] Default value is + None. + :type vm_instance_i_ds: ~azure.mgmt.compute.models.VirtualMachineScaleSetVMInstanceIDs or JSON + or IO[bytes] + :return: An instance of AsyncLROPoller that returns OkResponse. The OkResponse is compatible + with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.OkResponse] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + content_type = content_type if vm_instance_i_ds else None + cls: ClsType[_models.OkResponse] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._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, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = _deserialize(_models.OkResponse, response.json()) + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.OkResponse].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.OkResponse]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _power_off_initial( + self, + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional[Union[_models.VirtualMachineScaleSetVMInstanceIDs, JSON, IO[bytes]]] = None, + *, + skip_shutdown: Optional[bool] = None, + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + content_type = content_type if vm_instance_i_ds else None + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" if vm_instance_i_ds else None + _content = None + if isinstance(vm_instance_i_ds, (IOBase, bytes)): + _content = vm_instance_i_ds + else: + if vm_instance_i_ds is not None: + _content = json.dumps(vm_instance_i_ds, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + else: + _content = None + + _request = build_virtual_machine_scale_sets_power_off_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + skip_shutdown=skip_shutdown, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_power_off( + self, + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional[_models.VirtualMachineScaleSetVMInstanceIDs] = None, + *, + skip_shutdown: Optional[bool] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.OkResponse]: + """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. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :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.models.VirtualMachineScaleSetVMInstanceIDs + :keyword 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 None. + :paramtype skip_shutdown: bool + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns OkResponse. The OkResponse is compatible + with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.OkResponse] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_power_off( + self, + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional[JSON] = None, + *, + skip_shutdown: Optional[bool] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.OkResponse]: + """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. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :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: JSON + :keyword 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 None. + :paramtype skip_shutdown: bool + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns OkResponse. The OkResponse is compatible + with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.OkResponse] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_power_off( + self, + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional[IO[bytes]] = None, + *, + skip_shutdown: Optional[bool] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.OkResponse]: + """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. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :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: IO[bytes] + :keyword 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 None. + :paramtype skip_shutdown: bool + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns OkResponse. The OkResponse is compatible + with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.OkResponse] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_power_off( + self, + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional[Union[_models.VirtualMachineScaleSetVMInstanceIDs, JSON, IO[bytes]]] = None, + *, + skip_shutdown: Optional[bool] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.OkResponse]: + """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. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param vm_instance_i_ds: A list of virtual machine instance IDs from the VM scale set. Is one + of the following types: VirtualMachineScaleSetVMInstanceIDs, JSON, IO[bytes] Default value is + None. + :type vm_instance_i_ds: ~azure.mgmt.compute.models.VirtualMachineScaleSetVMInstanceIDs or JSON + or IO[bytes] + :keyword 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 None. + :paramtype skip_shutdown: bool + :return: An instance of AsyncLROPoller that returns OkResponse. The OkResponse is compatible + with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.OkResponse] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + content_type = content_type if vm_instance_i_ds else None + cls: ClsType[_models.OkResponse] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._power_off_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + vm_instance_i_ds=vm_instance_i_ds, + skip_shutdown=skip_shutdown, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = _deserialize(_models.OkResponse, response.json()) + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.OkResponse].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.OkResponse]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _reapply_initial( + self, resource_group_name: str, vm_scale_set_name: str, **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_virtual_machine_scale_sets_reapply_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_reapply( + self, resource_group_name: str, vm_scale_set_name: str, **kwargs: Any + ) -> AsyncLROPoller[_models.OkResponse]: + """Reapplies the Virtual Machine Scale Set Virtual Machine Profile to the Virtual Machine + Instances. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :return: An instance of AsyncLROPoller that returns OkResponse. The OkResponse is compatible + with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.OkResponse] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.OkResponse] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._reapply_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = _deserialize(_models.OkResponse, response.json()) + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.OkResponse].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.OkResponse]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _redeploy_initial( + self, + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional[Union[_models.VirtualMachineScaleSetVMInstanceIDs, JSON, IO[bytes]]] = None, + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + content_type = content_type if vm_instance_i_ds else None + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" if vm_instance_i_ds else None + _content = None + if isinstance(vm_instance_i_ds, (IOBase, bytes)): + _content = vm_instance_i_ds + else: + if vm_instance_i_ds is not None: + _content = json.dumps(vm_instance_i_ds, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + else: + _content = None + + _request = build_virtual_machine_scale_sets_redeploy_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_redeploy( + self, + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional[_models.VirtualMachineScaleSetVMInstanceIDs] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.OkResponse]: + """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. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :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.models.VirtualMachineScaleSetVMInstanceIDs + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns OkResponse. The OkResponse is compatible + with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.OkResponse] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_redeploy( + self, + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional[JSON] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.OkResponse]: + """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. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :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: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns OkResponse. The OkResponse is compatible + with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.OkResponse] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_redeploy( + self, + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.OkResponse]: + """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. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :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: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns OkResponse. The OkResponse is compatible + with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.OkResponse] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_redeploy( + self, + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional[Union[_models.VirtualMachineScaleSetVMInstanceIDs, JSON, IO[bytes]]] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.OkResponse]: + """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. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param vm_instance_i_ds: A list of virtual machine instance IDs from the VM scale set. Is one + of the following types: VirtualMachineScaleSetVMInstanceIDs, JSON, IO[bytes] Default value is + None. + :type vm_instance_i_ds: ~azure.mgmt.compute.models.VirtualMachineScaleSetVMInstanceIDs or JSON + or IO[bytes] + :return: An instance of AsyncLROPoller that returns OkResponse. The OkResponse is compatible + with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.OkResponse] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + content_type = content_type if vm_instance_i_ds else None + cls: ClsType[_models.OkResponse] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._redeploy_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + vm_instance_i_ds=vm_instance_i_ds, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = _deserialize(_models.OkResponse, response.json()) + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.OkResponse].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.OkResponse]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _reimage_initial( + self, + resource_group_name: str, + vm_scale_set_name: str, + vm_scale_set_reimage_input: Optional[ + Union[_models.VirtualMachineScaleSetReimageParameters, JSON, IO[bytes]] + ] = None, + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + content_type = content_type if vm_scale_set_reimage_input else None + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" if vm_scale_set_reimage_input else None + _content = None + if isinstance(vm_scale_set_reimage_input, (IOBase, bytes)): + _content = vm_scale_set_reimage_input + else: + if vm_scale_set_reimage_input is not None: + _content = json.dumps(vm_scale_set_reimage_input, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + else: + _content = None + + _request = build_virtual_machine_scale_sets_reimage_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_reimage( + self, + resource_group_name: str, + vm_scale_set_name: str, + vm_scale_set_reimage_input: Optional[_models.VirtualMachineScaleSetReimageParameters] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.OkResponse]: + """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. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :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.models.VirtualMachineScaleSetReimageParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns OkResponse. The OkResponse is compatible + with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.OkResponse] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_reimage( + self, + resource_group_name: str, + vm_scale_set_name: str, + vm_scale_set_reimage_input: Optional[JSON] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.OkResponse]: + """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. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :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: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns OkResponse. The OkResponse is compatible + with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.OkResponse] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_reimage( + self, + resource_group_name: str, + vm_scale_set_name: str, + vm_scale_set_reimage_input: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.OkResponse]: + """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. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :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: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns OkResponse. The OkResponse is compatible + with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.OkResponse] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_reimage( + self, + resource_group_name: str, + vm_scale_set_name: str, + vm_scale_set_reimage_input: Optional[ + Union[_models.VirtualMachineScaleSetReimageParameters, JSON, IO[bytes]] + ] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.OkResponse]: + """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. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param vm_scale_set_reimage_input: Parameters for Reimaging VM ScaleSet. Is one of the + following types: VirtualMachineScaleSetReimageParameters, JSON, IO[bytes] Default value is + None. + :type vm_scale_set_reimage_input: + ~azure.mgmt.compute.models.VirtualMachineScaleSetReimageParameters or JSON or IO[bytes] + :return: An instance of AsyncLROPoller that returns OkResponse. The OkResponse is compatible + with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.OkResponse] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + content_type = content_type if vm_scale_set_reimage_input else None + cls: ClsType[_models.OkResponse] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._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, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = _deserialize(_models.OkResponse, response.json()) + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.OkResponse].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.OkResponse]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _reimage_all_initial( + self, + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional[Union[_models.VirtualMachineScaleSetVMInstanceIDs, JSON, IO[bytes]]] = None, + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + content_type = content_type if vm_instance_i_ds else None + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" if vm_instance_i_ds else None + _content = None + if isinstance(vm_instance_i_ds, (IOBase, bytes)): + _content = vm_instance_i_ds + else: + if vm_instance_i_ds is not None: + _content = json.dumps(vm_instance_i_ds, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + else: + _content = None + + _request = build_virtual_machine_scale_sets_reimage_all_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_reimage_all( + self, + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional[_models.VirtualMachineScaleSetVMInstanceIDs] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.OkResponse]: + """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. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :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.models.VirtualMachineScaleSetVMInstanceIDs + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns OkResponse. The OkResponse is compatible + with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.OkResponse] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_reimage_all( + self, + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional[JSON] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.OkResponse]: + """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. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :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: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns OkResponse. The OkResponse is compatible + with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.OkResponse] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_reimage_all( + self, + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.OkResponse]: + """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. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :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: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns OkResponse. The OkResponse is compatible + with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.OkResponse] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_reimage_all( + self, + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional[Union[_models.VirtualMachineScaleSetVMInstanceIDs, JSON, IO[bytes]]] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.OkResponse]: + """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. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param vm_instance_i_ds: A list of virtual machine instance IDs from the VM scale set. Is one + of the following types: VirtualMachineScaleSetVMInstanceIDs, JSON, IO[bytes] Default value is + None. + :type vm_instance_i_ds: ~azure.mgmt.compute.models.VirtualMachineScaleSetVMInstanceIDs or JSON + or IO[bytes] + :return: An instance of AsyncLROPoller that returns OkResponse. The OkResponse is compatible + with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.OkResponse] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + content_type = content_type if vm_instance_i_ds else None + cls: ClsType[_models.OkResponse] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._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, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = _deserialize(_models.OkResponse, response.json()) + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.OkResponse].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.OkResponse]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _restart_initial( + self, + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional[Union[_models.VirtualMachineScaleSetVMInstanceIDs, JSON, IO[bytes]]] = None, + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + content_type = content_type if vm_instance_i_ds else None + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" if vm_instance_i_ds else None + _content = None + if isinstance(vm_instance_i_ds, (IOBase, bytes)): + _content = vm_instance_i_ds + else: + if vm_instance_i_ds is not None: + _content = json.dumps(vm_instance_i_ds, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + else: + _content = None + + _request = build_virtual_machine_scale_sets_restart_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_restart( + self, + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional[_models.VirtualMachineScaleSetVMInstanceIDs] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.OkResponse]: + """Restarts one or more virtual machines in a VM scale set. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :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.models.VirtualMachineScaleSetVMInstanceIDs + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns OkResponse. The OkResponse is compatible + with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.OkResponse] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_restart( + self, + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional[JSON] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.OkResponse]: + """Restarts one or more virtual machines in a VM scale set. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :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: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns OkResponse. The OkResponse is compatible + with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.OkResponse] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_restart( + self, + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.OkResponse]: + """Restarts one or more virtual machines in a VM scale set. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :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: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns OkResponse. The OkResponse is compatible + with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.OkResponse] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_restart( + self, + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional[Union[_models.VirtualMachineScaleSetVMInstanceIDs, JSON, IO[bytes]]] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.OkResponse]: + """Restarts one or more virtual machines in a VM scale set. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param vm_instance_i_ds: A list of virtual machine instance IDs from the VM scale set. Is one + of the following types: VirtualMachineScaleSetVMInstanceIDs, JSON, IO[bytes] Default value is + None. + :type vm_instance_i_ds: ~azure.mgmt.compute.models.VirtualMachineScaleSetVMInstanceIDs or JSON + or IO[bytes] + :return: An instance of AsyncLROPoller that returns OkResponse. The OkResponse is compatible + with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.OkResponse] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + content_type = content_type if vm_instance_i_ds else None + cls: ClsType[_models.OkResponse] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._restart_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + vm_instance_i_ds=vm_instance_i_ds, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = _deserialize(_models.OkResponse, response.json()) + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.OkResponse].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.OkResponse]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _set_orchestration_service_state_initial( + self, + resource_group_name: str, + vm_scale_set_name: str, + body: Union[_models.OrchestrationServiceStateInput, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_virtual_machine_scale_sets_set_orchestration_service_state_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_set_orchestration_service_state( + self, + resource_group_name: str, + vm_scale_set_name: str, + body: _models.OrchestrationServiceStateInput, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.OkResponse]: + """Changes ServiceState property for a given service. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param body: The input object for SetOrchestrationServiceState API. Required. + :type body: ~azure.mgmt.compute.models.OrchestrationServiceStateInput + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns OkResponse. The OkResponse is compatible + with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.OkResponse] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_set_orchestration_service_state( + self, + resource_group_name: str, + vm_scale_set_name: str, + body: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.OkResponse]: + """Changes ServiceState property for a given service. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param body: The input object for SetOrchestrationServiceState API. Required. + :type body: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns OkResponse. The OkResponse is compatible + with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.OkResponse] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_set_orchestration_service_state( + self, + resource_group_name: str, + vm_scale_set_name: str, + body: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.OkResponse]: + """Changes ServiceState property for a given service. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param body: The input object for SetOrchestrationServiceState API. Required. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns OkResponse. The OkResponse is compatible + with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.OkResponse] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_set_orchestration_service_state( + self, + resource_group_name: str, + vm_scale_set_name: str, + body: Union[_models.OrchestrationServiceStateInput, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.OkResponse]: + """Changes ServiceState property for a given service. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param body: The input object for SetOrchestrationServiceState API. Is one of the following + types: OrchestrationServiceStateInput, JSON, IO[bytes] Required. + :type body: ~azure.mgmt.compute.models.OrchestrationServiceStateInput or JSON or IO[bytes] + :return: An instance of AsyncLROPoller that returns OkResponse. The OkResponse is compatible + with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.OkResponse] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.OkResponse] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._set_orchestration_service_state_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + body=body, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = _deserialize(_models.OkResponse, response.json()) + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.OkResponse].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.OkResponse]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + @distributed_trace + def list_skus( + self, resource_group_name: str, vm_scale_set_name: str, **kwargs: Any + ) -> AsyncItemPaged["_models.VirtualMachineScaleSetSku"]: + """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. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :return: An iterator like instance of VirtualMachineScaleSetSku + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.models.VirtualMachineScaleSetSku] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.VirtualMachineScaleSetSku]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_virtual_machine_scale_sets_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=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.VirtualMachineScaleSetSku], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + async def _start_initial( + self, + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional[Union[_models.VirtualMachineScaleSetVMInstanceIDs, JSON, IO[bytes]]] = None, + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + content_type = content_type if vm_instance_i_ds else None + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" if vm_instance_i_ds else None + _content = None + if isinstance(vm_instance_i_ds, (IOBase, bytes)): + _content = vm_instance_i_ds + else: + if vm_instance_i_ds is not None: + _content = json.dumps(vm_instance_i_ds, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + else: + _content = None + + _request = build_virtual_machine_scale_sets_start_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_start( + self, + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional[_models.VirtualMachineScaleSetVMInstanceIDs] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.OkResponse]: + """Starts one or more virtual machines in a VM scale set. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :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.models.VirtualMachineScaleSetVMInstanceIDs + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns OkResponse. The OkResponse is compatible + with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.OkResponse] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_start( + self, + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional[JSON] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.OkResponse]: + """Starts one or more virtual machines in a VM scale set. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :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: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns OkResponse. The OkResponse is compatible + with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.OkResponse] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_start( + self, + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.OkResponse]: + """Starts one or more virtual machines in a VM scale set. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :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: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns OkResponse. The OkResponse is compatible + with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.OkResponse] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_start( + self, + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional[Union[_models.VirtualMachineScaleSetVMInstanceIDs, JSON, IO[bytes]]] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.OkResponse]: + """Starts one or more virtual machines in a VM scale set. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param vm_instance_i_ds: A list of virtual machine instance IDs from the VM scale set. Is one + of the following types: VirtualMachineScaleSetVMInstanceIDs, JSON, IO[bytes] Default value is + None. + :type vm_instance_i_ds: ~azure.mgmt.compute.models.VirtualMachineScaleSetVMInstanceIDs or JSON + or IO[bytes] + :return: An instance of AsyncLROPoller that returns OkResponse. The OkResponse is compatible + with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.OkResponse] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + content_type = content_type if vm_instance_i_ds else None + cls: ClsType[_models.OkResponse] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._start_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + vm_instance_i_ds=vm_instance_i_ds, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = _deserialize(_models.OkResponse, response.json()) + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.OkResponse].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.OkResponse]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _start_extension_upgrade_initial( + self, resource_group_name: str, vm_scale_set_name: str, **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_virtual_machine_scale_sets_start_extension_upgrade_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_start_extension_upgrade( + self, resource_group_name: str, vm_scale_set_name: str, **kwargs: Any + ) -> AsyncLROPoller[_models.OkResponse]: + """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. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :return: An instance of AsyncLROPoller that returns OkResponse. The OkResponse is compatible + with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.OkResponse] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.OkResponse] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._start_extension_upgrade_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = _deserialize(_models.OkResponse, response.json()) + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.OkResponse].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.OkResponse]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _start_os_upgrade_initial( + self, resource_group_name: str, vm_scale_set_name: str, **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_virtual_machine_scale_sets_start_os_upgrade_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_start_os_upgrade( + self, resource_group_name: str, vm_scale_set_name: str, **kwargs: Any + ) -> AsyncLROPoller[_models.OkResponse]: + """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. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :return: An instance of AsyncLROPoller that returns OkResponse. The OkResponse is compatible + with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.OkResponse] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.OkResponse] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._start_os_upgrade_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = _deserialize(_models.OkResponse, response.json()) + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.OkResponse].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.OkResponse]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _cancel_initial( + self, resource_group_name: str, vm_scale_set_name: str, **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_virtual_machine_scale_sets_cancel_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_cancel( + self, resource_group_name: str, vm_scale_set_name: str, **kwargs: Any + ) -> AsyncLROPoller[_models.OkResponse]: + """Cancels the current virtual machine scale set rolling upgrade. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :return: An instance of AsyncLROPoller that returns OkResponse. The OkResponse is compatible + with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.OkResponse] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.OkResponse] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._cancel_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = _deserialize(_models.OkResponse, response.json()) + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.OkResponse].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.OkResponse]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + @api_version_validation( + method_added_on="2025-04-01", + params_added_on={ + "2025-04-01": ["api_version", "subscription_id", "resource_group_name", "vm_scale_set_name", "content_type"] + }, + api_versions_list=["2025-04-01"], + ) + async def _scale_out_initial( + self, + resource_group_name: str, + vm_scale_set_name: str, + body: Union[_models.VMScaleSetScaleOutInput, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_virtual_machine_scale_sets_scale_out_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_scale_out( + self, + resource_group_name: str, + vm_scale_set_name: str, + body: _models.VMScaleSetScaleOutInput, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.OkResponse]: + """Scales out one or more virtual machines in a VM scale set. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param body: The input object for ScaleOut API. Required. + :type body: ~azure.mgmt.compute.models.VMScaleSetScaleOutInput + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns OkResponse. The OkResponse is compatible + with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.OkResponse] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_scale_out( + self, + resource_group_name: str, + vm_scale_set_name: str, + body: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.OkResponse]: + """Scales out one or more virtual machines in a VM scale set. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param body: The input object for ScaleOut API. Required. + :type body: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns OkResponse. The OkResponse is compatible + with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.OkResponse] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_scale_out( + self, + resource_group_name: str, + vm_scale_set_name: str, + body: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.OkResponse]: + """Scales out one or more virtual machines in a VM scale set. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param body: The input object for ScaleOut API. Required. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns OkResponse. The OkResponse is compatible + with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.OkResponse] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + @api_version_validation( + method_added_on="2025-04-01", + params_added_on={ + "2025-04-01": ["api_version", "subscription_id", "resource_group_name", "vm_scale_set_name", "content_type"] + }, + api_versions_list=["2025-04-01"], + ) + async def begin_scale_out( + self, + resource_group_name: str, + vm_scale_set_name: str, + body: Union[_models.VMScaleSetScaleOutInput, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.OkResponse]: + """Scales out one or more virtual machines in a VM scale set. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param body: The input object for ScaleOut API. Is one of the following types: + VMScaleSetScaleOutInput, JSON, IO[bytes] Required. + :type body: ~azure.mgmt.compute.models.VMScaleSetScaleOutInput or JSON or IO[bytes] + :return: An instance of AsyncLROPoller that returns OkResponse. The OkResponse is compatible + with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.OkResponse] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.OkResponse] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._scale_out_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + body=body, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = _deserialize(_models.OkResponse, response.json()) + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.OkResponse].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.OkResponse]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + +class RollingUpgradeStatusInfosOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.compute.aio.ComputeClient`'s + :attr:`rolling_upgrade_status_infos` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @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. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :return: RollingUpgradeStatusInfo. The RollingUpgradeStatusInfo is compatible with + MutableMapping + :rtype: ~azure.mgmt.compute.models.RollingUpgradeStatusInfo + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.RollingUpgradeStatusInfo] = kwargs.pop("cls", None) + + _request = build_rolling_upgrade_status_infos_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=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.RollingUpgradeStatusInfo, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + +class VirtualMachineScaleSetExtensionsOperations: # pylint: disable=name-too-long + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.compute.aio.ComputeClient`'s + :attr:`virtual_machine_scale_set_extensions` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @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. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param vmss_extension_name: The name of the VM scale set extension. Required. + :type vmss_extension_name: str + :keyword expand: The expand expression to apply on the operation. Default value is None. + :paramtype expand: str + :return: VirtualMachineScaleSetExtension. The VirtualMachineScaleSetExtension is compatible + with MutableMapping + :rtype: ~azure.mgmt.compute.models.VirtualMachineScaleSetExtension + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.VirtualMachineScaleSetExtension] = kwargs.pop("cls", None) + + _request = build_virtual_machine_scale_set_extensions_get_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + vmss_extension_name=vmss_extension_name, + subscription_id=self._config.subscription_id, + expand=expand, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.VirtualMachineScaleSetExtension, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _create_or_update_initial( + self, + resource_group_name: str, + vm_scale_set_name: str, + vmss_extension_name: str, + resource: Union[_models.VirtualMachineScaleSetExtension, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(resource, (IOBase, bytes)): + _content = resource + else: + _content = json.dumps(resource, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_virtual_machine_scale_set_extensions_create_or_update_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, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 201: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + vm_scale_set_name: str, + vmss_extension_name: str, + resource: _models.VirtualMachineScaleSetExtension, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """The operation to create or update an extension. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param vmss_extension_name: The name of the VM scale set extension. Required. + :type vmss_extension_name: str + :param resource: Parameters supplied to the Create VM scale set Extension operation. Required. + :type resource: ~azure.mgmt.compute.models.VirtualMachineScaleSetExtension + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + vm_scale_set_name: str, + vmss_extension_name: str, + resource: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """The operation to create or update an extension. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param vmss_extension_name: The name of the VM scale set extension. Required. + :type vmss_extension_name: str + :param resource: Parameters supplied to the Create VM scale set Extension operation. Required. + :type resource: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + vm_scale_set_name: str, + vmss_extension_name: str, + resource: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """The operation to create or update an extension. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param vmss_extension_name: The name of the VM scale set extension. Required. + :type vmss_extension_name: str + :param resource: Parameters supplied to the Create VM scale set Extension operation. Required. + :type resource: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + vm_scale_set_name: str, + vmss_extension_name: str, + resource: Union[_models.VirtualMachineScaleSetExtension, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[None]: + """The operation to create or update an extension. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param vmss_extension_name: The name of the VM scale set extension. Required. + :type vmss_extension_name: str + :param resource: Parameters supplied to the Create VM scale set Extension operation. Is one of + the following types: VirtualMachineScaleSetExtension, JSON, IO[bytes] Required. + :type resource: ~azure.mgmt.compute.models.VirtualMachineScaleSetExtension or JSON or IO[bytes] + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._create_or_update_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + vmss_extension_name=vmss_extension_name, + resource=resource, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + async def _update_initial( + self, + resource_group_name: str, + vm_scale_set_name: str, + vmss_extension_name: str, + properties: Union[_models.VirtualMachineScaleSetExtensionUpdate, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(properties, (IOBase, bytes)): + _content = properties + else: + _content = json.dumps(properties, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_virtual_machine_scale_set_extensions_update_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, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 201: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_update( + self, + resource_group_name: str, + vm_scale_set_name: str, + vmss_extension_name: str, + properties: _models.VirtualMachineScaleSetExtensionUpdate, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """The operation to update an extension. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param vmss_extension_name: The name of the VM scale set extension. Required. + :type vmss_extension_name: str + :param properties: Parameters supplied to the Update VM scale set Extension operation. + Required. + :type properties: ~azure.mgmt.compute.models.VirtualMachineScaleSetExtensionUpdate + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update( + self, + resource_group_name: str, + vm_scale_set_name: str, + vmss_extension_name: str, + properties: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """The operation to update an extension. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param vmss_extension_name: The name of the VM scale set extension. Required. + :type vmss_extension_name: str + :param properties: Parameters supplied to the Update VM scale set Extension operation. + Required. + :type properties: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update( + self, + resource_group_name: str, + vm_scale_set_name: str, + vmss_extension_name: str, + properties: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """The operation to update an extension. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param vmss_extension_name: The name of the VM scale set extension. Required. + :type vmss_extension_name: str + :param properties: Parameters supplied to the Update VM scale set Extension operation. + Required. + :type properties: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_update( + self, + resource_group_name: str, + vm_scale_set_name: str, + vmss_extension_name: str, + properties: Union[_models.VirtualMachineScaleSetExtensionUpdate, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[None]: + """The operation to update an extension. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param vmss_extension_name: The name of the VM scale set extension. Required. + :type vmss_extension_name: str + :param properties: Parameters supplied to the Update VM scale set Extension operation. Is one + of the following types: VirtualMachineScaleSetExtensionUpdate, JSON, IO[bytes] Required. + :type properties: ~azure.mgmt.compute.models.VirtualMachineScaleSetExtensionUpdate or JSON or + IO[bytes] + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._update_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + vmss_extension_name=vmss_extension_name, + properties=properties, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + async def _delete_initial( + self, resource_group_name: str, vm_scale_set_name: str, vmss_extension_name: str, **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_virtual_machine_scale_set_extensions_delete_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=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_delete( + 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. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param vmss_extension_name: The name of the VM scale set extension. Required. + :type vmss_extension_name: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + vmss_extension_name=vmss_extension_name, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace + def list( + self, resource_group_name: str, vm_scale_set_name: str, **kwargs: Any + ) -> AsyncItemPaged["_models.VirtualMachineScaleSetExtension"]: + """Gets a list of all extensions in a VM scale set. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :return: An iterator like instance of VirtualMachineScaleSetExtension + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.models.VirtualMachineScaleSetExtension] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.VirtualMachineScaleSetExtension]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_virtual_machine_scale_set_extensions_list_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.VirtualMachineScaleSetExtension], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + +class VirtualMachineScaleSetVMSOperations: # pylint: disable=too-many-public-methods + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.compute.aio.ComputeClient`'s + :attr:`virtual_machine_scale_set_vms` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @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. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. Required. + :type instance_id: str + :keyword 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. Known values are: "instanceView", "userData", and "resiliencyView". Default value is + None. + :paramtype expand: str or ~azure.mgmt.compute.models.InstanceViewTypes + :return: VirtualMachineScaleSetVM. The VirtualMachineScaleSetVM is compatible with + MutableMapping + :rtype: ~azure.mgmt.compute.models.VirtualMachineScaleSetVM + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.VirtualMachineScaleSetVM] = kwargs.pop("cls", None) + + _request = build_virtual_machine_scale_set_vms_get_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + expand=expand, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.VirtualMachineScaleSetVM, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _update_initial( + self, + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + resource: Union[_models.VirtualMachineScaleSetVM, JSON, IO[bytes]], + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + if match_condition == MatchConditions.IfNotModified: + error_map[412] = ResourceModifiedError + elif match_condition == MatchConditions.IfPresent: + error_map[412] = ResourceNotFoundError + elif match_condition == MatchConditions.IfMissing: + error_map[412] = ResourceExistsError + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(resource, (IOBase, bytes)): + _content = resource + else: + _content = json.dumps(resource, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_virtual_machine_scale_set_vms_update_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + etag=etag, + match_condition=match_condition, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_update( + self, + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + resource: _models.VirtualMachineScaleSetVM, + *, + content_type: str = "application/json", + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Updates a virtual machine of a VM scale set. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. Required. + :type instance_id: str + :param resource: Parameters supplied to the Update Virtual Machine Scale Sets VM operation. + Required. + :type resource: ~azure.mgmt.compute.models.VirtualMachineScaleSetVM + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update( + self, + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + resource: JSON, + *, + content_type: str = "application/json", + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Updates a virtual machine of a VM scale set. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. Required. + :type instance_id: str + :param resource: Parameters supplied to the Update Virtual Machine Scale Sets VM operation. + Required. + :type resource: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update( + self, + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + resource: IO[bytes], + *, + content_type: str = "application/json", + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Updates a virtual machine of a VM scale set. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. Required. + :type instance_id: str + :param resource: Parameters supplied to the Update Virtual Machine Scale Sets VM operation. + Required. + :type resource: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_update( + self, + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + resource: Union[_models.VirtualMachineScaleSetVM, JSON, IO[bytes]], + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Updates a virtual machine of a VM scale set. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. Required. + :type instance_id: str + :param resource: Parameters supplied to the Update Virtual Machine Scale Sets VM operation. Is + one of the following types: VirtualMachineScaleSetVM, JSON, IO[bytes] Required. + :type resource: ~azure.mgmt.compute.models.VirtualMachineScaleSetVM or JSON or IO[bytes] + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._update_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + resource=resource, + etag=etag, + match_condition=match_condition, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + async def _delete_initial( + self, + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + *, + force_deletion: Optional[bool] = None, + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_virtual_machine_scale_set_vms_delete_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + force_deletion=force_deletion, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_delete( + 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. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. Required. + :type instance_id: str + :keyword force_deletion: Optional parameter to force delete a virtual machine from a VM scale + set. (Feature in Preview). Default value is None. + :paramtype force_deletion: bool + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + force_deletion=force_deletion, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # 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 + ) -> AsyncItemPaged["_models.VirtualMachineScaleSetVM"]: + """Gets a list of all virtual machines in a VM scale sets. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param virtual_machine_scale_set_name: The name of the VirtualMachineScaleSet. Required. + :type virtual_machine_scale_set_name: str + :keyword 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. + :paramtype filter: str + :keyword select: The list parameters. Allowed values are 'instanceView', + 'instanceView/statuses'. Default value is None. + :paramtype select: str + :keyword expand: The expand expression to apply to the operation. Allowed values are + 'instanceView'. Default value is None. + :paramtype expand: str + :return: An iterator like instance of VirtualMachineScaleSetVM + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.models.VirtualMachineScaleSetVM] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.VirtualMachineScaleSetVM]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_virtual_machine_scale_set_vms_list_request( + resource_group_name=resource_group_name, + virtual_machine_scale_set_name=virtual_machine_scale_set_name, + subscription_id=self._config.subscription_id, + filter=filter, + select=select, + expand=expand, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.VirtualMachineScaleSetVM], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + async def _approve_rolling_upgrade_initial( + self, resource_group_name: str, vm_scale_set_name: str, instance_id: str, **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_virtual_machine_scale_set_vms_approve_rolling_upgrade_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_approve_rolling_upgrade( + self, resource_group_name: str, vm_scale_set_name: str, instance_id: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Approve upgrade on deferred rolling upgrade for OS disk on a VM scale set instance. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. Required. + :type instance_id: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._approve_rolling_upgrade_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + async def _deallocate_initial( + self, resource_group_name: str, vm_scale_set_name: str, instance_id: str, **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_virtual_machine_scale_set_vms_deallocate_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_deallocate( + self, resource_group_name: str, vm_scale_set_name: str, instance_id: str, **kwargs: Any + ) -> AsyncLROPoller[_models.OkResponse]: + """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. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. Required. + :type instance_id: str + :return: An instance of AsyncLROPoller that returns OkResponse. The OkResponse is compatible + with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.OkResponse] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.OkResponse] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._deallocate_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = _deserialize(_models.OkResponse, response.json()) + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.OkResponse].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.OkResponse]( + self._client, raw_result, get_long_running_output, polling_method # 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. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. Required. + :type instance_id: str + :return: VirtualMachineScaleSetVMInstanceView. The VirtualMachineScaleSetVMInstanceView is + compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.VirtualMachineScaleSetVMInstanceView + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.VirtualMachineScaleSetVMInstanceView] = kwargs.pop("cls", None) + + _request = build_virtual_machine_scale_set_vms_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=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.VirtualMachineScaleSetVMInstanceView, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _reimage_initial( + self, + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + vm_scale_set_vm_reimage_input: Optional[ + Union[_models.VirtualMachineScaleSetVMReimageParameters, JSON, IO[bytes]] + ] = None, + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + content_type = content_type if vm_scale_set_vm_reimage_input else None + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" if vm_scale_set_vm_reimage_input else None + _content = None + if isinstance(vm_scale_set_vm_reimage_input, (IOBase, bytes)): + _content = vm_scale_set_vm_reimage_input + else: + if vm_scale_set_vm_reimage_input is not None: + _content = json.dumps(vm_scale_set_vm_reimage_input, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + else: + _content = None + + _request = build_virtual_machine_scale_set_vms_reimage_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_reimage( + self, + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + vm_scale_set_vm_reimage_input: Optional[_models.VirtualMachineScaleSetVMReimageParameters] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.OkResponse]: + """Reimages (upgrade the operating system) a specific virtual machine in a VM scale set. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. Required. + :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.models.VirtualMachineScaleSetVMReimageParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns OkResponse. The OkResponse is compatible + with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.OkResponse] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_reimage( + self, + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + vm_scale_set_vm_reimage_input: Optional[JSON] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.OkResponse]: + """Reimages (upgrade the operating system) a specific virtual machine in a VM scale set. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. Required. + :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: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns OkResponse. The OkResponse is compatible + with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.OkResponse] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_reimage( + self, + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + vm_scale_set_vm_reimage_input: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.OkResponse]: + """Reimages (upgrade the operating system) a specific virtual machine in a VM scale set. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. Required. + :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: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns OkResponse. The OkResponse is compatible + with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.OkResponse] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_reimage( + self, + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + vm_scale_set_vm_reimage_input: Optional[ + Union[_models.VirtualMachineScaleSetVMReimageParameters, JSON, IO[bytes]] + ] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.OkResponse]: + """Reimages (upgrade the operating system) a specific virtual machine in a VM scale set. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. Required. + :type instance_id: str + :param vm_scale_set_vm_reimage_input: Parameters for the Reimaging Virtual machine in ScaleSet. + Is one of the following types: VirtualMachineScaleSetVMReimageParameters, JSON, IO[bytes] + Default value is None. + :type vm_scale_set_vm_reimage_input: + ~azure.mgmt.compute.models.VirtualMachineScaleSetVMReimageParameters or JSON or IO[bytes] + :return: An instance of AsyncLROPoller that returns OkResponse. The OkResponse is compatible + with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.OkResponse] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + content_type = content_type if vm_scale_set_vm_reimage_input else None + cls: ClsType[_models.OkResponse] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._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, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = _deserialize(_models.OkResponse, response.json()) + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.OkResponse].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.OkResponse]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _reimage_all_initial( + self, resource_group_name: str, vm_scale_set_name: str, instance_id: str, **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_virtual_machine_scale_set_vms_reimage_all_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_reimage_all( + self, resource_group_name: str, vm_scale_set_name: str, instance_id: str, **kwargs: Any + ) -> AsyncLROPoller[_models.OkResponse]: + """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. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. Required. + :type instance_id: str + :return: An instance of AsyncLROPoller that returns OkResponse. The OkResponse is compatible + with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.OkResponse] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.OkResponse] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._reimage_all_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = _deserialize(_models.OkResponse, response.json()) + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.OkResponse].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.OkResponse]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + @distributed_trace_async + async def simulate_eviction( + 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. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. Required. + :type instance_id: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_virtual_machine_scale_set_vms_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=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + async def _attach_detach_data_disks_initial( + self, + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + body: Union[_models.AttachDetachDataDisksRequest, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_virtual_machine_scale_set_vms_attach_detach_data_disks_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_attach_detach_data_disks( + self, + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + body: _models.AttachDetachDataDisksRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.StorageProfile]: + """Attach and detach data disks to/from a virtual machine in a VM scale set. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. Required. + :type instance_id: str + :param body: Parameters supplied to the attach and detach data disks operation on a Virtual + Machine Scale Sets VM. Required. + :type body: ~azure.mgmt.compute.models.AttachDetachDataDisksRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns StorageProfile. The StorageProfile is + compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.StorageProfile] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_attach_detach_data_disks( + self, + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + body: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.StorageProfile]: + """Attach and detach data disks to/from a virtual machine in a VM scale set. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. Required. + :type instance_id: str + :param body: Parameters supplied to the attach and detach data disks operation on a Virtual + Machine Scale Sets VM. Required. + :type body: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns StorageProfile. The StorageProfile is + compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.StorageProfile] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_attach_detach_data_disks( + self, + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + body: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.StorageProfile]: + """Attach and detach data disks to/from a virtual machine in a VM scale set. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. Required. + :type instance_id: str + :param body: Parameters supplied to the attach and detach data disks operation on a Virtual + Machine Scale Sets VM. Required. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns StorageProfile. The StorageProfile is + compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.StorageProfile] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_attach_detach_data_disks( + self, + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + body: Union[_models.AttachDetachDataDisksRequest, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.StorageProfile]: + """Attach and detach data disks to/from a virtual machine in a VM scale set. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. Required. + :type instance_id: str + :param body: Parameters supplied to the attach and detach data disks operation on a Virtual + Machine Scale Sets VM. Is one of the following types: AttachDetachDataDisksRequest, JSON, + IO[bytes] Required. + :type body: ~azure.mgmt.compute.models.AttachDetachDataDisksRequest or JSON or IO[bytes] + :return: An instance of AsyncLROPoller that returns StorageProfile. The StorageProfile is + compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.StorageProfile] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.StorageProfile] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._attach_detach_data_disks_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + body=body, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = _deserialize(_models.StorageProfile, response.json()) + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.StorageProfile].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.StorageProfile]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _perform_maintenance_initial( + self, resource_group_name: str, vm_scale_set_name: str, instance_id: str, **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_virtual_machine_scale_set_vms_perform_maintenance_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_perform_maintenance( + self, resource_group_name: str, vm_scale_set_name: str, instance_id: str, **kwargs: Any + ) -> AsyncLROPoller[_models.OkResponse]: + """Performs maintenance on a virtual machine in a VM scale set. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. Required. + :type instance_id: str + :return: An instance of AsyncLROPoller that returns OkResponse. The OkResponse is compatible + with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.OkResponse] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.OkResponse] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._perform_maintenance_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = _deserialize(_models.OkResponse, response.json()) + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.OkResponse].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.OkResponse]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _power_off_initial( + self, + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + *, + skip_shutdown: Optional[bool] = None, + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_virtual_machine_scale_set_vms_power_off_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + skip_shutdown=skip_shutdown, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_power_off( + self, + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + *, + skip_shutdown: Optional[bool] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.OkResponse]: + """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. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. Required. + :type instance_id: str + :keyword 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 None. + :paramtype skip_shutdown: bool + :return: An instance of AsyncLROPoller that returns OkResponse. The OkResponse is compatible + with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.OkResponse] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.OkResponse] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._power_off_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + skip_shutdown=skip_shutdown, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = _deserialize(_models.OkResponse, response.json()) + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.OkResponse].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.OkResponse]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _redeploy_initial( + self, resource_group_name: str, vm_scale_set_name: str, instance_id: str, **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_virtual_machine_scale_set_vms_redeploy_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_redeploy( + self, resource_group_name: str, vm_scale_set_name: str, instance_id: str, **kwargs: Any + ) -> AsyncLROPoller[_models.OkResponse]: + """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. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. Required. + :type instance_id: str + :return: An instance of AsyncLROPoller that returns OkResponse. The OkResponse is compatible + with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.OkResponse] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.OkResponse] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._redeploy_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = _deserialize(_models.OkResponse, response.json()) + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.OkResponse].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.OkResponse]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _restart_initial( + self, resource_group_name: str, vm_scale_set_name: str, instance_id: str, **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_virtual_machine_scale_set_vms_restart_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_restart( + self, resource_group_name: str, vm_scale_set_name: str, instance_id: str, **kwargs: Any + ) -> AsyncLROPoller[_models.OkResponse]: + """Restarts a virtual machine in a VM scale set. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. Required. + :type instance_id: str + :return: An instance of AsyncLROPoller that returns OkResponse. The OkResponse is compatible + with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.OkResponse] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.OkResponse] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._restart_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = _deserialize(_models.OkResponse, response.json()) + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.OkResponse].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.OkResponse]( + self._client, raw_result, get_long_running_output, polling_method # 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. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. Required. + :type instance_id: str + :keyword sas_uri_expiration_time_in_minutes: Expiration duration in minutes for the SAS URIs + with a value between 1 to 1440 minutes. **Note:** If not specified, SAS URIs will be generated + with a default expiration duration of 120 minutes. Default value is None. + :paramtype sas_uri_expiration_time_in_minutes: int + :return: RetrieveBootDiagnosticsDataResult. The RetrieveBootDiagnosticsDataResult is compatible + with MutableMapping + :rtype: ~azure.mgmt.compute.models.RetrieveBootDiagnosticsDataResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.RetrieveBootDiagnosticsDataResult] = kwargs.pop("cls", None) + + _request = build_virtual_machine_scale_set_vms_retrieve_boot_diagnostics_data_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + sas_uri_expiration_time_in_minutes=sas_uri_expiration_time_in_minutes, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.RetrieveBootDiagnosticsDataResult, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _start_initial( + self, resource_group_name: str, vm_scale_set_name: str, instance_id: str, **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_virtual_machine_scale_set_vms_start_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_start( + self, resource_group_name: str, vm_scale_set_name: str, instance_id: str, **kwargs: Any + ) -> AsyncLROPoller[_models.OkResponse]: + """Starts a virtual machine in a VM scale set. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. Required. + :type instance_id: str + :return: An instance of AsyncLROPoller that returns OkResponse. The OkResponse is compatible + with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.OkResponse] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.OkResponse] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._start_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = _deserialize(_models.OkResponse, response.json()) + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.OkResponse].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.OkResponse]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _run_command_initial( + self, + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + body: Union[_models.RunCommandInput, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_virtual_machine_scale_set_vms_run_command_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_run_command( + self, + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + body: _models.RunCommandInput, + *, + content_type: 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. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. Required. + :type instance_id: str + :param body: Parameters supplied to the Run command operation. Required. + :type body: ~azure.mgmt.compute.models.RunCommandInput + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns RunCommandResult. The RunCommandResult is + compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.RunCommandResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_run_command( + self, + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + body: JSON, + *, + content_type: 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. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. Required. + :type instance_id: str + :param body: Parameters supplied to the Run command operation. Required. + :type body: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns RunCommandResult. The RunCommandResult is + compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.RunCommandResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_run_command( + self, + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + body: IO[bytes], + *, + content_type: 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. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. Required. + :type instance_id: str + :param body: Parameters supplied to the Run command operation. Required. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns RunCommandResult. The RunCommandResult is + compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.RunCommandResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_run_command( + self, + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + body: Union[_models.RunCommandInput, JSON, IO[bytes]], + **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. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. Required. + :type instance_id: str + :param body: Parameters supplied to the Run command operation. Is one of the following types: + RunCommandInput, JSON, IO[bytes] Required. + :type body: ~azure.mgmt.compute.models.RunCommandInput or JSON or IO[bytes] + :return: An instance of AsyncLROPoller that returns RunCommandResult. The RunCommandResult is + compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.RunCommandResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.RunCommandResult] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._run_command_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + body=body, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = _deserialize(_models.RunCommandResult, response.json()) + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.RunCommandResult].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.RunCommandResult]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + +class VirtualMachineScaleSetVMExtensionsOperations: # pylint: disable=name-too-long + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.compute.aio.ComputeClient`'s + :attr:`virtual_machine_scale_set_vm_extensions` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @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. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. Required. + :type instance_id: str + :param vm_extension_name: The name of the virtual machine extension. Required. + :type vm_extension_name: str + :keyword expand: The expand expression to apply on the operation. Default value is None. + :paramtype expand: str + :return: VirtualMachineScaleSetVMExtension. The VirtualMachineScaleSetVMExtension is compatible + with MutableMapping + :rtype: ~azure.mgmt.compute.models.VirtualMachineScaleSetVMExtension + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.VirtualMachineScaleSetVMExtension] = kwargs.pop("cls", None) + + _request = build_virtual_machine_scale_set_vm_extensions_get_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + vm_extension_name=vm_extension_name, + subscription_id=self._config.subscription_id, + expand=expand, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.VirtualMachineScaleSetVMExtension, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _create_or_update_initial( + self, + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + vm_extension_name: str, + resource: Union[_models.VirtualMachineScaleSetVMExtension, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(resource, (IOBase, bytes)): + _content = resource + else: + _content = json.dumps(resource, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_virtual_machine_scale_set_vm_extensions_create_or_update_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, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 201: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + vm_extension_name: str, + resource: _models.VirtualMachineScaleSetVMExtension, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """The operation to create or update the VMSS VM extension. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. Required. + :type instance_id: str + :param vm_extension_name: The name of the virtual machine extension. Required. + :type vm_extension_name: str + :param resource: Parameters supplied to the Create Virtual Machine Extension operation. + Required. + :type resource: ~azure.mgmt.compute.models.VirtualMachineScaleSetVMExtension + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + vm_extension_name: str, + resource: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """The operation to create or update the VMSS VM extension. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. Required. + :type instance_id: str + :param vm_extension_name: The name of the virtual machine extension. Required. + :type vm_extension_name: str + :param resource: Parameters supplied to the Create Virtual Machine Extension operation. + Required. + :type resource: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + vm_extension_name: str, + resource: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """The operation to create or update the VMSS VM extension. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. Required. + :type instance_id: str + :param vm_extension_name: The name of the virtual machine extension. Required. + :type vm_extension_name: str + :param resource: Parameters supplied to the Create Virtual Machine Extension operation. + Required. + :type resource: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @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, + resource: Union[_models.VirtualMachineScaleSetVMExtension, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[None]: + """The operation to create or update the VMSS VM extension. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. Required. + :type instance_id: str + :param vm_extension_name: The name of the virtual machine extension. Required. + :type vm_extension_name: str + :param resource: Parameters supplied to the Create Virtual Machine Extension operation. Is one + of the following types: VirtualMachineScaleSetVMExtension, JSON, IO[bytes] Required. + :type resource: ~azure.mgmt.compute.models.VirtualMachineScaleSetVMExtension or JSON or + IO[bytes] + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._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, + resource=resource, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + async def _update_initial( + self, + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + vm_extension_name: str, + properties: Union[_models.VirtualMachineScaleSetVMExtensionUpdate, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(properties, (IOBase, bytes)): + _content = properties + else: + _content = json.dumps(properties, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_virtual_machine_scale_set_vm_extensions_update_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, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_update( + self, + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + vm_extension_name: str, + properties: _models.VirtualMachineScaleSetVMExtensionUpdate, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """The operation to update the VMSS VM extension. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. Required. + :type instance_id: str + :param vm_extension_name: The name of the virtual machine extension. Required. + :type vm_extension_name: str + :param properties: Parameters supplied to the Update Virtual Machine Extension operation. + Required. + :type properties: ~azure.mgmt.compute.models.VirtualMachineScaleSetVMExtensionUpdate + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update( + self, + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + vm_extension_name: str, + properties: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """The operation to update the VMSS VM extension. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. Required. + :type instance_id: str + :param vm_extension_name: The name of the virtual machine extension. Required. + :type vm_extension_name: str + :param properties: Parameters supplied to the Update Virtual Machine Extension operation. + Required. + :type properties: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update( + self, + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + vm_extension_name: str, + properties: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """The operation to update the VMSS VM extension. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. Required. + :type instance_id: str + :param vm_extension_name: The name of the virtual machine extension. Required. + :type vm_extension_name: str + :param properties: Parameters supplied to the Update Virtual Machine Extension operation. + Required. + :type properties: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_update( + self, + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + vm_extension_name: str, + properties: Union[_models.VirtualMachineScaleSetVMExtensionUpdate, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[None]: + """The operation to update the VMSS VM extension. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. Required. + :type instance_id: str + :param vm_extension_name: The name of the virtual machine extension. Required. + :type vm_extension_name: str + :param properties: Parameters supplied to the Update Virtual Machine Extension operation. Is + one of the following types: VirtualMachineScaleSetVMExtensionUpdate, JSON, IO[bytes] Required. + :type properties: ~azure.mgmt.compute.models.VirtualMachineScaleSetVMExtensionUpdate or JSON or + IO[bytes] + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._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, + properties=properties, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + async def _delete_initial( + self, resource_group_name: str, vm_scale_set_name: str, instance_id: str, vm_extension_name: str, **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_virtual_machine_scale_set_vm_extensions_delete_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=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_delete( + 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. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. Required. + :type instance_id: str + :param vm_extension_name: The name of the virtual machine extension. Required. + :type vm_extension_name: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + vm_extension_name=vm_extension_name, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # 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 + ) -> AsyncItemPaged["_models.VirtualMachineScaleSetVMExtension"]: + """The operation to get all extensions of an instance in Virtual Machine Scaleset. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. Required. + :type instance_id: str + :keyword expand: The expand expression to apply on the operation. Default value is None. + :paramtype expand: str + :return: An iterator like instance of VirtualMachineScaleSetVMExtension + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.models.VirtualMachineScaleSetVMExtension] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.VirtualMachineScaleSetVMExtension]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_virtual_machine_scale_set_vm_extensions_list_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + expand=expand, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.VirtualMachineScaleSetVMExtension], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + +class VirtualMachinesOperations: # pylint: disable=too-many-public-methods + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.compute.aio.ComputeClient`'s + :attr:`virtual_machines` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @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. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_name: The name of the virtual machine. Required. + :type vm_name: str + :keyword 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. + Known values are: "instanceView", "userData", and "resiliencyView". Default value is None. + :paramtype expand: str or ~azure.mgmt.compute.models.InstanceViewTypes + :return: VirtualMachine. The VirtualMachine is compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.VirtualMachine + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.VirtualMachine] = kwargs.pop("cls", None) + + _request = build_virtual_machines_get_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + expand=expand, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.VirtualMachine, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _create_or_update_initial( + self, + resource_group_name: str, + vm_name: str, + resource: Union[_models.VirtualMachine, JSON, IO[bytes]], + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + if match_condition == MatchConditions.IfNotModified: + error_map[412] = ResourceModifiedError + elif match_condition == MatchConditions.IfPresent: + error_map[412] = ResourceNotFoundError + elif match_condition == MatchConditions.IfMissing: + error_map[412] = ResourceExistsError + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(resource, (IOBase, bytes)): + _content = resource + else: + _content = json.dumps(resource, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_virtual_machines_create_or_update_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + etag=etag, + match_condition=match_condition, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 201: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + vm_name: str, + resource: _models.VirtualMachine, + *, + content_type: str = "application/json", + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """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. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_name: The name of the virtual machine. Required. + :type vm_name: str + :param resource: Parameters supplied to the Create Virtual Machine operation. Required. + :type resource: ~azure.mgmt.compute.models.VirtualMachine + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + vm_name: str, + resource: JSON, + *, + content_type: str = "application/json", + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """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. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_name: The name of the virtual machine. Required. + :type vm_name: str + :param resource: Parameters supplied to the Create Virtual Machine operation. Required. + :type resource: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + vm_name: str, + resource: IO[bytes], + *, + content_type: str = "application/json", + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """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. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_name: The name of the virtual machine. Required. + :type vm_name: str + :param resource: Parameters supplied to the Create Virtual Machine operation. Required. + :type resource: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + vm_name: str, + resource: Union[_models.VirtualMachine, JSON, IO[bytes]], + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """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. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_name: The name of the virtual machine. Required. + :type vm_name: str + :param resource: Parameters supplied to the Create Virtual Machine operation. Is one of the + following types: VirtualMachine, JSON, IO[bytes] Required. + :type resource: ~azure.mgmt.compute.models.VirtualMachine or JSON or IO[bytes] + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._create_or_update_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + resource=resource, + etag=etag, + match_condition=match_condition, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + async def _update_initial( + self, + resource_group_name: str, + vm_name: str, + properties: Union[_models.VirtualMachineUpdate, JSON, IO[bytes]], + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + if match_condition == MatchConditions.IfNotModified: + error_map[412] = ResourceModifiedError + elif match_condition == MatchConditions.IfPresent: + error_map[412] = ResourceNotFoundError + elif match_condition == MatchConditions.IfMissing: + error_map[412] = ResourceExistsError + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(properties, (IOBase, bytes)): + _content = properties + else: + _content = json.dumps(properties, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_virtual_machines_update_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + etag=etag, + match_condition=match_condition, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_update( + self, + resource_group_name: str, + vm_name: str, + properties: _models.VirtualMachineUpdate, + *, + content_type: str = "application/json", + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """The operation to update a virtual machine. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_name: The name of the virtual machine. Required. + :type vm_name: str + :param properties: Parameters supplied to the Update Virtual Machine operation. Required. + :type properties: ~azure.mgmt.compute.models.VirtualMachineUpdate + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update( + self, + resource_group_name: str, + vm_name: str, + properties: JSON, + *, + content_type: str = "application/json", + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """The operation to update a virtual machine. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_name: The name of the virtual machine. Required. + :type vm_name: str + :param properties: Parameters supplied to the Update Virtual Machine operation. Required. + :type properties: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update( + self, + resource_group_name: str, + vm_name: str, + properties: IO[bytes], + *, + content_type: str = "application/json", + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """The operation to update a virtual machine. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_name: The name of the virtual machine. Required. + :type vm_name: str + :param properties: Parameters supplied to the Update Virtual Machine operation. Required. + :type properties: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_update( + self, + resource_group_name: str, + vm_name: str, + properties: Union[_models.VirtualMachineUpdate, JSON, IO[bytes]], + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """The operation to update a virtual machine. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_name: The name of the virtual machine. Required. + :type vm_name: str + :param properties: Parameters supplied to the Update Virtual Machine operation. Is one of the + following types: VirtualMachineUpdate, JSON, IO[bytes] Required. + :type properties: ~azure.mgmt.compute.models.VirtualMachineUpdate or JSON or IO[bytes] + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._update_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + properties=properties, + etag=etag, + match_condition=match_condition, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + async def _delete_initial( + self, resource_group_name: str, vm_name: str, *, force_deletion: Optional[bool] = None, **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_virtual_machines_delete_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + force_deletion=force_deletion, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_delete( + 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. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_name: The name of the virtual machine. Required. + :type vm_name: str + :keyword force_deletion: Optional parameter to force delete virtual machines. Default value is + None. + :paramtype force_deletion: bool + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + force_deletion=force_deletion, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace + def list( + self, + resource_group_name: str, + *, + filter: Optional[str] = None, + expand: Optional[Union[str, _models.ExpandTypeForListVMs]] = None, + **kwargs: Any + ) -> AsyncItemPaged["_models.VirtualMachine"]: + """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. The name is case insensitive. + Required. + :type resource_group_name: str + :keyword 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. + :paramtype filter: str + :keyword expand: The expand expression to apply on operation. 'instanceView' enables fetching + run time status of all Virtual Machines, this can only be specified if a valid $filter option + is specified. "instanceView" Default value is None. + :paramtype expand: str or ~azure.mgmt.compute.models.ExpandTypeForListVMs + :return: An iterator like instance of VirtualMachine + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.models.VirtualMachine] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.VirtualMachine]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_virtual_machines_list_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + filter=filter, + expand=expand, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.VirtualMachine], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + @distributed_trace + def list_all( + self, + *, + status_only: Optional[str] = None, + filter: Optional[str] = None, + expand: Optional[Union[str, _models.ExpandTypesForListVMs]] = None, + **kwargs: Any + ) -> AsyncItemPaged["_models.VirtualMachine"]: + """Lists all of the virtual machines in the specified subscription. Use the nextLink property in + the response to get the next page of virtual machines. + + :keyword status_only: statusOnly=true enables fetching run time status of all Virtual Machines + in the subscription. Default value is None. + :paramtype status_only: str + :keyword 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. + :paramtype filter: str + :keyword expand: The expand expression to apply on operation. 'instanceView' enables fetching + run time status of all Virtual Machines, this can only be specified if a valid $filter option + is specified. "instanceView" Default value is None. + :paramtype expand: str or ~azure.mgmt.compute.models.ExpandTypesForListVMs + :return: An iterator like instance of VirtualMachine + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.models.VirtualMachine] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.VirtualMachine]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_virtual_machines_list_all_request( + subscription_id=self._config.subscription_id, + status_only=status_only, + filter=filter, + expand=expand, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.VirtualMachine], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + async def _assess_patches_initial( + self, resource_group_name: str, vm_name: str, **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_virtual_machines_assess_patches_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # 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. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_name: The name of the virtual machine. Required. + :type vm_name: str + :return: An instance of AsyncLROPoller that returns VirtualMachineAssessPatchesResult. The + VirtualMachineAssessPatchesResult is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.VirtualMachineAssessPatchesResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.VirtualMachineAssessPatchesResult] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._assess_patches_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = _deserialize(_models.VirtualMachineAssessPatchesResult, response.json()) + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.VirtualMachineAssessPatchesResult].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.VirtualMachineAssessPatchesResult]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _attach_detach_data_disks_initial( + self, + resource_group_name: str, + vm_name: str, + body: Union[_models.AttachDetachDataDisksRequest, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_virtual_machines_attach_detach_data_disks_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_attach_detach_data_disks( + self, + resource_group_name: str, + vm_name: str, + body: _models.AttachDetachDataDisksRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.StorageProfile]: + """Attach and detach data disks to/from the virtual machine. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_name: The name of the virtual machine. Required. + :type vm_name: str + :param body: Parameters supplied to the attach and detach data disks operation on the virtual + machine. Required. + :type body: ~azure.mgmt.compute.models.AttachDetachDataDisksRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns StorageProfile. The StorageProfile is + compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.StorageProfile] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_attach_detach_data_disks( + self, + resource_group_name: str, + vm_name: str, + body: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.StorageProfile]: + """Attach and detach data disks to/from the virtual machine. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_name: The name of the virtual machine. Required. + :type vm_name: str + :param body: Parameters supplied to the attach and detach data disks operation on the virtual + machine. Required. + :type body: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns StorageProfile. The StorageProfile is + compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.StorageProfile] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_attach_detach_data_disks( + self, + resource_group_name: str, + vm_name: str, + body: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.StorageProfile]: + """Attach and detach data disks to/from the virtual machine. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_name: The name of the virtual machine. Required. + :type vm_name: str + :param body: Parameters supplied to the attach and detach data disks operation on the virtual + machine. Required. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns StorageProfile. The StorageProfile is + compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.StorageProfile] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_attach_detach_data_disks( + self, + resource_group_name: str, + vm_name: str, + body: Union[_models.AttachDetachDataDisksRequest, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.StorageProfile]: + """Attach and detach data disks to/from the virtual machine. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_name: The name of the virtual machine. Required. + :type vm_name: str + :param body: Parameters supplied to the attach and detach data disks operation on the virtual + machine. Is one of the following types: AttachDetachDataDisksRequest, JSON, IO[bytes] Required. + :type body: ~azure.mgmt.compute.models.AttachDetachDataDisksRequest or JSON or IO[bytes] + :return: An instance of AsyncLROPoller that returns StorageProfile. The StorageProfile is + compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.StorageProfile] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.StorageProfile] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._attach_detach_data_disks_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + body=body, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = _deserialize(_models.StorageProfile, response.json()) + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.StorageProfile].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.StorageProfile]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _capture_initial( + self, + resource_group_name: str, + vm_name: str, + body: Union[_models.VirtualMachineCaptureParameters, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_virtual_machines_capture_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_capture( + self, + resource_group_name: str, + vm_name: str, + body: _models.VirtualMachineCaptureParameters, + *, + content_type: str = "application/json", + **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. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_name: The name of the virtual machine. Required. + :type vm_name: str + :param body: Parameters supplied to the Capture Virtual Machine operation. Required. + :type body: ~azure.mgmt.compute.models.VirtualMachineCaptureParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns VirtualMachineCaptureResult. The + VirtualMachineCaptureResult is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.VirtualMachineCaptureResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_capture( + self, + resource_group_name: str, + vm_name: str, + body: JSON, + *, + content_type: str = "application/json", + **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. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_name: The name of the virtual machine. Required. + :type vm_name: str + :param body: Parameters supplied to the Capture Virtual Machine operation. Required. + :type body: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns VirtualMachineCaptureResult. The + VirtualMachineCaptureResult is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.VirtualMachineCaptureResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_capture( + self, + resource_group_name: str, + vm_name: str, + body: IO[bytes], + *, + content_type: str = "application/json", + **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. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_name: The name of the virtual machine. Required. + :type vm_name: str + :param body: Parameters supplied to the Capture Virtual Machine operation. Required. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns VirtualMachineCaptureResult. The + VirtualMachineCaptureResult is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.VirtualMachineCaptureResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_capture( + self, + resource_group_name: str, + vm_name: str, + body: Union[_models.VirtualMachineCaptureParameters, JSON, IO[bytes]], + **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. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_name: The name of the virtual machine. Required. + :type vm_name: str + :param body: Parameters supplied to the Capture Virtual Machine operation. Is one of the + following types: VirtualMachineCaptureParameters, JSON, IO[bytes] Required. + :type body: ~azure.mgmt.compute.models.VirtualMachineCaptureParameters or JSON or IO[bytes] + :return: An instance of AsyncLROPoller that returns VirtualMachineCaptureResult. The + VirtualMachineCaptureResult is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.VirtualMachineCaptureResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.VirtualMachineCaptureResult] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._capture_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + body=body, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = _deserialize(_models.VirtualMachineCaptureResult, response.json()) + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.VirtualMachineCaptureResult].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.VirtualMachineCaptureResult]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _convert_to_managed_disks_initial( + self, resource_group_name: str, vm_name: str, **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_virtual_machines_convert_to_managed_disks_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_convert_to_managed_disks( + self, resource_group_name: str, vm_name: str, **kwargs: Any + ) -> AsyncLROPoller[_models.OkResponse]: + """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. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_name: The name of the virtual machine. Required. + :type vm_name: str + :return: An instance of AsyncLROPoller that returns OkResponse. The OkResponse is compatible + with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.OkResponse] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.OkResponse] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._convert_to_managed_disks_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = _deserialize(_models.OkResponse, response.json()) + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.OkResponse].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.OkResponse]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _deallocate_initial( + self, resource_group_name: str, vm_name: str, *, hibernate: Optional[bool] = None, **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_virtual_machines_deallocate_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + hibernate=hibernate, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_deallocate( + self, resource_group_name: str, vm_name: str, *, hibernate: Optional[bool] = None, **kwargs: Any + ) -> AsyncLROPoller[_models.OkResponse]: + """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. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_name: The name of the virtual machine. Required. + :type vm_name: str + :keyword hibernate: Optional parameter to hibernate a virtual machine. Default value is None. + :paramtype hibernate: bool + :return: An instance of AsyncLROPoller that returns OkResponse. The OkResponse is compatible + with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.OkResponse] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.OkResponse] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._deallocate_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + hibernate=hibernate, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = _deserialize(_models.OkResponse, response.json()) + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.OkResponse].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.OkResponse]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + @distributed_trace_async + async def generalize(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. For Windows, please refer to `Create a + managed image of a generalized VM in Azure + `_. 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. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_name: The name of the virtual machine. Required. + :type vm_name: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_virtual_machines_generalize_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + async def _install_patches_initial( + self, + resource_group_name: str, + vm_name: str, + body: Union[_models.VirtualMachineInstallPatchesParameters, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_virtual_machines_install_patches_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_install_patches( + self, + resource_group_name: str, + vm_name: str, + body: _models.VirtualMachineInstallPatchesParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.VirtualMachineInstallPatchesResult]: + """Installs patches on the VM. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_name: The name of the virtual machine. Required. + :type vm_name: str + :param body: Input for InstallPatches as directly received by the API. Required. + :type body: ~azure.mgmt.compute.models.VirtualMachineInstallPatchesParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns VirtualMachineInstallPatchesResult. The + VirtualMachineInstallPatchesResult is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.VirtualMachineInstallPatchesResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_install_patches( + self, + resource_group_name: str, + vm_name: str, + body: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.VirtualMachineInstallPatchesResult]: + """Installs patches on the VM. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_name: The name of the virtual machine. Required. + :type vm_name: str + :param body: Input for InstallPatches as directly received by the API. Required. + :type body: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns VirtualMachineInstallPatchesResult. The + VirtualMachineInstallPatchesResult is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.VirtualMachineInstallPatchesResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_install_patches( + self, + resource_group_name: str, + vm_name: str, + body: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.VirtualMachineInstallPatchesResult]: + """Installs patches on the VM. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_name: The name of the virtual machine. Required. + :type vm_name: str + :param body: Input for InstallPatches as directly received by the API. Required. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns VirtualMachineInstallPatchesResult. The + VirtualMachineInstallPatchesResult is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.VirtualMachineInstallPatchesResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_install_patches( + self, + resource_group_name: str, + vm_name: str, + body: Union[_models.VirtualMachineInstallPatchesParameters, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.VirtualMachineInstallPatchesResult]: + """Installs patches on the VM. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_name: The name of the virtual machine. Required. + :type vm_name: str + :param body: Input for InstallPatches as directly received by the API. Is one of the following + types: VirtualMachineInstallPatchesParameters, JSON, IO[bytes] Required. + :type body: ~azure.mgmt.compute.models.VirtualMachineInstallPatchesParameters or JSON or + IO[bytes] + :return: An instance of AsyncLROPoller that returns VirtualMachineInstallPatchesResult. The + VirtualMachineInstallPatchesResult is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.VirtualMachineInstallPatchesResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.VirtualMachineInstallPatchesResult] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._install_patches_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + body=body, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = _deserialize(_models.VirtualMachineInstallPatchesResult, response.json()) + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.VirtualMachineInstallPatchesResult].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.VirtualMachineInstallPatchesResult]( + self._client, raw_result, get_long_running_output, polling_method # 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. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_name: The name of the virtual machine. Required. + :type vm_name: str + :return: VirtualMachineInstanceView. The VirtualMachineInstanceView is compatible with + MutableMapping + :rtype: ~azure.mgmt.compute.models.VirtualMachineInstanceView + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.VirtualMachineInstanceView] = kwargs.pop("cls", None) + + _request = build_virtual_machines_instance_view_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.VirtualMachineInstanceView, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _perform_maintenance_initial( + self, resource_group_name: str, vm_name: str, **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_virtual_machines_perform_maintenance_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_perform_maintenance( + self, resource_group_name: str, vm_name: str, **kwargs: Any + ) -> AsyncLROPoller[_models.OkResponse]: + """The operation to perform maintenance on a virtual machine. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_name: The name of the virtual machine. Required. + :type vm_name: str + :return: An instance of AsyncLROPoller that returns OkResponse. The OkResponse is compatible + with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.OkResponse] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.OkResponse] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._perform_maintenance_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = _deserialize(_models.OkResponse, response.json()) + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.OkResponse].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.OkResponse]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _power_off_initial( + self, resource_group_name: str, vm_name: str, *, skip_shutdown: Optional[bool] = None, **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_virtual_machines_power_off_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + skip_shutdown=skip_shutdown, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_power_off( + self, resource_group_name: str, vm_name: str, *, skip_shutdown: Optional[bool] = None, **kwargs: Any + ) -> AsyncLROPoller[_models.OkResponse]: + """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. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_name: The name of the virtual machine. Required. + :type vm_name: str + :keyword 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 None. + :paramtype skip_shutdown: bool + :return: An instance of AsyncLROPoller that returns OkResponse. The OkResponse is compatible + with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.OkResponse] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.OkResponse] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._power_off_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + skip_shutdown=skip_shutdown, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = _deserialize(_models.OkResponse, response.json()) + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.OkResponse].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.OkResponse]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _reapply_initial(self, resource_group_name: str, vm_name: str, **kwargs: Any) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_virtual_machines_reapply_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_reapply( + self, resource_group_name: str, vm_name: str, **kwargs: Any + ) -> AsyncLROPoller[_models.OkResponse]: + """The operation to reapply a virtual machine's state. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_name: The name of the virtual machine. Required. + :type vm_name: str + :return: An instance of AsyncLROPoller that returns OkResponse. The OkResponse is compatible + with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.OkResponse] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.OkResponse] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._reapply_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = _deserialize(_models.OkResponse, response.json()) + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.OkResponse].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.OkResponse]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _redeploy_initial(self, resource_group_name: str, vm_name: str, **kwargs: Any) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_virtual_machines_redeploy_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_redeploy( + self, resource_group_name: str, vm_name: str, **kwargs: Any + ) -> AsyncLROPoller[_models.OkResponse]: + """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. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_name: The name of the virtual machine. Required. + :type vm_name: str + :return: An instance of AsyncLROPoller that returns OkResponse. The OkResponse is compatible + with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.OkResponse] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.OkResponse] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._redeploy_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = _deserialize(_models.OkResponse, response.json()) + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.OkResponse].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.OkResponse]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _reimage_initial( + self, + resource_group_name: str, + vm_name: str, + parameters: Optional[Union[_models.VirtualMachineReimageParameters, JSON, IO[bytes]]] = None, + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + content_type = content_type if parameters else None + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" if parameters else None + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + if parameters is not None: + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + else: + _content = None + + _request = build_virtual_machines_reimage_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_reimage( + self, + resource_group_name: str, + vm_name: str, + parameters: Optional[_models.VirtualMachineReimageParameters] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.OkResponse]: + """Reimages (upgrade the operating system) a virtual machine 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. NOTE: The retaining of old OS disk depends on the value of deleteOption of OS disk. If + deleteOption is detach, the old OS disk will be preserved after reimage. If deleteOption is + delete, the old OS disk will be deleted after reimage. The deleteOption of the OS disk should + be updated accordingly before performing the reimage. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_name: The name of the virtual machine. Required. + :type vm_name: str + :param parameters: Parameters supplied to the Reimage Virtual Machine operation. Default value + is None. + :type parameters: ~azure.mgmt.compute.models.VirtualMachineReimageParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns OkResponse. The OkResponse is compatible + with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.OkResponse] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_reimage( + self, + resource_group_name: str, + vm_name: str, + parameters: Optional[JSON] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.OkResponse]: + """Reimages (upgrade the operating system) a virtual machine 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. NOTE: The retaining of old OS disk depends on the value of deleteOption of OS disk. If + deleteOption is detach, the old OS disk will be preserved after reimage. If deleteOption is + delete, the old OS disk will be deleted after reimage. The deleteOption of the OS disk should + be updated accordingly before performing the reimage. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_name: The name of the virtual machine. Required. + :type vm_name: str + :param parameters: Parameters supplied to the Reimage Virtual Machine operation. Default value + is None. + :type parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns OkResponse. The OkResponse is compatible + with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.OkResponse] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_reimage( + self, + resource_group_name: str, + vm_name: str, + parameters: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.OkResponse]: + """Reimages (upgrade the operating system) a virtual machine 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. NOTE: The retaining of old OS disk depends on the value of deleteOption of OS disk. If + deleteOption is detach, the old OS disk will be preserved after reimage. If deleteOption is + delete, the old OS disk will be deleted after reimage. The deleteOption of the OS disk should + be updated accordingly before performing the reimage. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_name: The name of the virtual machine. Required. + :type vm_name: str + :param parameters: Parameters supplied to the Reimage Virtual Machine operation. Default value + is None. + :type parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns OkResponse. The OkResponse is compatible + with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.OkResponse] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_reimage( + self, + resource_group_name: str, + vm_name: str, + parameters: Optional[Union[_models.VirtualMachineReimageParameters, JSON, IO[bytes]]] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.OkResponse]: + """Reimages (upgrade the operating system) a virtual machine 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. NOTE: The retaining of old OS disk depends on the value of deleteOption of OS disk. If + deleteOption is detach, the old OS disk will be preserved after reimage. If deleteOption is + delete, the old OS disk will be deleted after reimage. The deleteOption of the OS disk should + be updated accordingly before performing the reimage. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_name: The name of the virtual machine. Required. + :type vm_name: str + :param parameters: Parameters supplied to the Reimage Virtual Machine operation. Is one of the + following types: VirtualMachineReimageParameters, JSON, IO[bytes] Default value is None. + :type parameters: ~azure.mgmt.compute.models.VirtualMachineReimageParameters or JSON or + IO[bytes] + :return: An instance of AsyncLROPoller that returns OkResponse. The OkResponse is compatible + with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.OkResponse] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + content_type = content_type if parameters else None + cls: ClsType[_models.OkResponse] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._reimage_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + parameters=parameters, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = _deserialize(_models.OkResponse, response.json()) + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.OkResponse].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.OkResponse]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _restart_initial(self, resource_group_name: str, vm_name: str, **kwargs: Any) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_virtual_machines_restart_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_restart( + self, resource_group_name: str, vm_name: str, **kwargs: Any + ) -> AsyncLROPoller[_models.OkResponse]: + """The operation to restart a virtual machine. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_name: The name of the virtual machine. Required. + :type vm_name: str + :return: An instance of AsyncLROPoller that returns OkResponse. The OkResponse is compatible + with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.OkResponse] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.OkResponse] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._restart_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = _deserialize(_models.OkResponse, response.json()) + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.OkResponse].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.OkResponse]( + self._client, raw_result, get_long_running_output, polling_method # 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. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_name: The name of the virtual machine. Required. + :type vm_name: str + :keyword sas_uri_expiration_time_in_minutes: Expiration duration in minutes for the SAS URIs + with a value between 1 to 1440 minutes. **Note:** If not specified, SAS URIs will be generated + with a default expiration duration of 120 minutes. Default value is None. + :paramtype sas_uri_expiration_time_in_minutes: int + :return: RetrieveBootDiagnosticsDataResult. The RetrieveBootDiagnosticsDataResult is compatible + with MutableMapping + :rtype: ~azure.mgmt.compute.models.RetrieveBootDiagnosticsDataResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.RetrieveBootDiagnosticsDataResult] = kwargs.pop("cls", None) + + _request = build_virtual_machines_retrieve_boot_diagnostics_data_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + sas_uri_expiration_time_in_minutes=sas_uri_expiration_time_in_minutes, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.RetrieveBootDiagnosticsDataResult, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def simulate_eviction(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. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_name: The name of the virtual machine. Required. + :type vm_name: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_virtual_machines_simulate_eviction_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + async def _start_initial(self, resource_group_name: str, vm_name: str, **kwargs: Any) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_virtual_machines_start_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_start( + self, resource_group_name: str, vm_name: str, **kwargs: Any + ) -> AsyncLROPoller[_models.OkResponse]: + """The operation to start a virtual machine. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_name: The name of the virtual machine. Required. + :type vm_name: str + :return: An instance of AsyncLROPoller that returns OkResponse. The OkResponse is compatible + with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.OkResponse] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.OkResponse] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._start_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = _deserialize(_models.OkResponse, response.json()) + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.OkResponse].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.OkResponse]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + @distributed_trace + def list_available_sizes( + self, resource_group_name: str, vm_name: str, **kwargs: Any + ) -> AsyncItemPaged["_models.VirtualMachineSize"]: + """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. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_name: The name of the virtual machine. Required. + :type vm_name: str + :return: An iterator like instance of VirtualMachineSize + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.models.VirtualMachineSize] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.VirtualMachineSize]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_virtual_machines_list_available_sizes_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.VirtualMachineSize], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + async def _run_command_initial( + self, + resource_group_name: str, + vm_name: str, + body: Union[_models.RunCommandInput, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_virtual_machines_run_command_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_run_command( + self, + resource_group_name: str, + vm_name: str, + body: _models.RunCommandInput, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.RunCommandResult]: + """Run command on the VM. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_name: The name of the virtual machine. Required. + :type vm_name: str + :param body: Parameters supplied to the Run command operation. Required. + :type body: ~azure.mgmt.compute.models.RunCommandInput + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns RunCommandResult. The RunCommandResult is + compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.RunCommandResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_run_command( + self, + resource_group_name: str, + vm_name: str, + body: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.RunCommandResult]: + """Run command on the VM. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_name: The name of the virtual machine. Required. + :type vm_name: str + :param body: Parameters supplied to the Run command operation. Required. + :type body: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns RunCommandResult. The RunCommandResult is + compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.RunCommandResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_run_command( + self, + resource_group_name: str, + vm_name: str, + body: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.RunCommandResult]: + """Run command on the VM. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_name: The name of the virtual machine. Required. + :type vm_name: str + :param body: Parameters supplied to the Run command operation. Required. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns RunCommandResult. The RunCommandResult is + compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.RunCommandResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_run_command( + self, + resource_group_name: str, + vm_name: str, + body: Union[_models.RunCommandInput, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.RunCommandResult]: + """Run command on the VM. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_name: The name of the virtual machine. Required. + :type vm_name: str + :param body: Parameters supplied to the Run command operation. Is one of the following types: + RunCommandInput, JSON, IO[bytes] Required. + :type body: ~azure.mgmt.compute.models.RunCommandInput or JSON or IO[bytes] + :return: An instance of AsyncLROPoller that returns RunCommandResult. The RunCommandResult is + compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.RunCommandResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.RunCommandResult] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._run_command_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + body=body, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = _deserialize(_models.RunCommandResult, response.json()) + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.RunCommandResult].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.RunCommandResult]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _migrate_to_vm_scale_set_initial( + self, + resource_group_name: str, + vm_name: str, + parameters: Optional[Union[_models.MigrateVMToVirtualMachineScaleSetInput, JSON, IO[bytes]]] = None, + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + content_type = content_type if parameters else None + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" if parameters else None + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + if parameters is not None: + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + else: + _content = None + + _request = build_virtual_machines_migrate_to_vm_scale_set_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_migrate_to_vm_scale_set( + self, + resource_group_name: str, + vm_name: str, + parameters: Optional[_models.MigrateVMToVirtualMachineScaleSetInput] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Migrate a virtual machine from availability set to Flexible Virtual Machine Scale Set. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_name: The name of the virtual machine. Required. + :type vm_name: str + :param parameters: Parameters supplied to the Migrate Virtual Machine operation. Default value + is None. + :type parameters: ~azure.mgmt.compute.models.MigrateVMToVirtualMachineScaleSetInput + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_migrate_to_vm_scale_set( + self, + resource_group_name: str, + vm_name: str, + parameters: Optional[JSON] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Migrate a virtual machine from availability set to Flexible Virtual Machine Scale Set. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_name: The name of the virtual machine. Required. + :type vm_name: str + :param parameters: Parameters supplied to the Migrate Virtual Machine operation. Default value + is None. + :type parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_migrate_to_vm_scale_set( + self, + resource_group_name: str, + vm_name: str, + parameters: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Migrate a virtual machine from availability set to Flexible Virtual Machine Scale Set. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_name: The name of the virtual machine. Required. + :type vm_name: str + :param parameters: Parameters supplied to the Migrate Virtual Machine operation. Default value + is None. + :type parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_migrate_to_vm_scale_set( + self, + resource_group_name: str, + vm_name: str, + parameters: Optional[Union[_models.MigrateVMToVirtualMachineScaleSetInput, JSON, IO[bytes]]] = None, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Migrate a virtual machine from availability set to Flexible Virtual Machine Scale Set. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_name: The name of the virtual machine. Required. + :type vm_name: str + :param parameters: Parameters supplied to the Migrate Virtual Machine operation. Is one of the + following types: MigrateVMToVirtualMachineScaleSetInput, JSON, IO[bytes] Default value is None. + :type parameters: ~azure.mgmt.compute.models.MigrateVMToVirtualMachineScaleSetInput or JSON or + IO[bytes] + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + content_type = content_type if parameters else None + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._migrate_to_vm_scale_set_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + parameters=parameters, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + +class VirtualMachineExtensionsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.compute.aio.ComputeClient`'s + :attr:`virtual_machine_extensions` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @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. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_name: The name of the virtual machine. Required. + :type vm_name: str + :param vm_extension_name: The name of the virtual machine extension. Required. + :type vm_extension_name: str + :keyword expand: The expand expression to apply on the operation. Default value is None. + :paramtype expand: str + :return: VirtualMachineExtension. The VirtualMachineExtension is compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.VirtualMachineExtension + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.VirtualMachineExtension] = kwargs.pop("cls", None) + + _request = build_virtual_machine_extensions_get_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + vm_extension_name=vm_extension_name, + subscription_id=self._config.subscription_id, + expand=expand, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.VirtualMachineExtension, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _create_or_update_initial( + self, + resource_group_name: str, + vm_name: str, + vm_extension_name: str, + resource: Union[_models.VirtualMachineExtension, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(resource, (IOBase, bytes)): + _content = resource + else: + _content = json.dumps(resource, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_virtual_machine_extensions_create_or_update_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + vm_extension_name=vm_extension_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 201: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + vm_name: str, + vm_extension_name: str, + resource: _models.VirtualMachineExtension, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """The operation to create or update the extension. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_name: The name of the virtual machine. Required. + :type vm_name: str + :param vm_extension_name: The name of the virtual machine extension. Required. + :type vm_extension_name: str + :param resource: Parameters supplied to the Create Virtual Machine Extension operation. + Required. + :type resource: ~azure.mgmt.compute.models.VirtualMachineExtension + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + vm_name: str, + vm_extension_name: str, + resource: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """The operation to create or update the extension. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_name: The name of the virtual machine. Required. + :type vm_name: str + :param vm_extension_name: The name of the virtual machine extension. Required. + :type vm_extension_name: str + :param resource: Parameters supplied to the Create Virtual Machine Extension operation. + Required. + :type resource: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + vm_name: str, + vm_extension_name: str, + resource: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """The operation to create or update the extension. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_name: The name of the virtual machine. Required. + :type vm_name: str + :param vm_extension_name: The name of the virtual machine extension. Required. + :type vm_extension_name: str + :param resource: Parameters supplied to the Create Virtual Machine Extension operation. + Required. + :type resource: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + vm_name: str, + vm_extension_name: str, + resource: Union[_models.VirtualMachineExtension, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[None]: + """The operation to create or update the extension. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_name: The name of the virtual machine. Required. + :type vm_name: str + :param vm_extension_name: The name of the virtual machine extension. Required. + :type vm_extension_name: str + :param resource: Parameters supplied to the Create Virtual Machine Extension operation. Is one + of the following types: VirtualMachineExtension, JSON, IO[bytes] Required. + :type resource: ~azure.mgmt.compute.models.VirtualMachineExtension or JSON or IO[bytes] + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._create_or_update_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + vm_extension_name=vm_extension_name, + resource=resource, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + async def _update_initial( + self, + resource_group_name: str, + vm_name: str, + vm_extension_name: str, + properties: Union[_models.VirtualMachineExtensionUpdate, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(properties, (IOBase, bytes)): + _content = properties + else: + _content = json.dumps(properties, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_virtual_machine_extensions_update_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + vm_extension_name=vm_extension_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_update( + self, + resource_group_name: str, + vm_name: str, + vm_extension_name: str, + properties: _models.VirtualMachineExtensionUpdate, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """The operation to update the extension. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_name: The name of the virtual machine. Required. + :type vm_name: str + :param vm_extension_name: The name of the virtual machine extension. Required. + :type vm_extension_name: str + :param properties: Parameters supplied to the Update Virtual Machine Extension operation. + Required. + :type properties: ~azure.mgmt.compute.models.VirtualMachineExtensionUpdate + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update( + self, + resource_group_name: str, + vm_name: str, + vm_extension_name: str, + properties: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """The operation to update the extension. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_name: The name of the virtual machine. Required. + :type vm_name: str + :param vm_extension_name: The name of the virtual machine extension. Required. + :type vm_extension_name: str + :param properties: Parameters supplied to the Update Virtual Machine Extension operation. + Required. + :type properties: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update( + self, + resource_group_name: str, + vm_name: str, + vm_extension_name: str, + properties: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """The operation to update the extension. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_name: The name of the virtual machine. Required. + :type vm_name: str + :param vm_extension_name: The name of the virtual machine extension. Required. + :type vm_extension_name: str + :param properties: Parameters supplied to the Update Virtual Machine Extension operation. + Required. + :type properties: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_update( + self, + resource_group_name: str, + vm_name: str, + vm_extension_name: str, + properties: Union[_models.VirtualMachineExtensionUpdate, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[None]: + """The operation to update the extension. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_name: The name of the virtual machine. Required. + :type vm_name: str + :param vm_extension_name: The name of the virtual machine extension. Required. + :type vm_extension_name: str + :param properties: Parameters supplied to the Update Virtual Machine Extension operation. Is + one of the following types: VirtualMachineExtensionUpdate, JSON, IO[bytes] Required. + :type properties: ~azure.mgmt.compute.models.VirtualMachineExtensionUpdate or JSON or IO[bytes] + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._update_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + vm_extension_name=vm_extension_name, + properties=properties, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + async def _delete_initial( + self, resource_group_name: str, vm_name: str, vm_extension_name: str, **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_virtual_machine_extensions_delete_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=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_delete( + 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. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_name: The name of the virtual machine. Required. + :type vm_name: str + :param vm_extension_name: The name of the virtual machine extension. Required. + :type vm_extension_name: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + vm_extension_name=vm_extension_name, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace + def list( + self, resource_group_name: str, vm_name: str, *, expand: Optional[str] = None, **kwargs: Any + ) -> AsyncItemPaged["_models.VirtualMachineExtension"]: + """The operation to get all extensions of a Virtual Machine. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_name: The name of the virtual machine. Required. + :type vm_name: str + :keyword expand: The expand expression to apply on the operation. Default value is None. + :paramtype expand: str + :return: An iterator like instance of VirtualMachineExtension + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.models.VirtualMachineExtension] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.VirtualMachineExtension]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_virtual_machine_extensions_list_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + expand=expand, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.VirtualMachineExtension], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + +class VirtualMachineExtensionImagesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.compute.aio.ComputeClient`'s + :attr:`virtual_machine_extension_images` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @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 location name. Required. + :type location: str + :param publisher_name: Required. + :type publisher_name: str + :param type: Required. + :type type: str + :param version: Required. + :type version: str + :return: VirtualMachineExtensionImage. The VirtualMachineExtensionImage is compatible with + MutableMapping + :rtype: ~azure.mgmt.compute.models.VirtualMachineExtensionImage + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.VirtualMachineExtensionImage] = kwargs.pop("cls", None) + + _request = build_virtual_machine_extension_images_get_request( + location=location, + publisher_name=publisher_name, + type=type, + version=version, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.VirtualMachineExtensionImage, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # 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 location name. Required. + :type location: str + :param publisher_name: Required. + :type publisher_name: str + :return: list of VirtualMachineExtensionImage + :rtype: list[~azure.mgmt.compute.models.VirtualMachineExtensionImage] + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.VirtualMachineExtensionImage]] = kwargs.pop("cls", None) + + _request = build_virtual_machine_extension_images_list_types_request( + location=location, + publisher_name=publisher_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(List[_models.VirtualMachineExtensionImage], response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # 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 location name. Required. + :type location: str + :param publisher_name: Required. + :type publisher_name: str + :param type: Required. + :type type: str + :keyword filter: The filter to apply on the operation. Default value is None. + :paramtype filter: str + :keyword top: Default value is None. + :paramtype top: int + :keyword orderby: Default value is None. + :paramtype orderby: str + :return: list of VirtualMachineExtensionImage + :rtype: list[~azure.mgmt.compute.models.VirtualMachineExtensionImage] + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.VirtualMachineExtensionImage]] = kwargs.pop("cls", None) + + _request = build_virtual_machine_extension_images_list_versions_request( + location=location, + publisher_name=publisher_name, + type=type, + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + orderby=orderby, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(List[_models.VirtualMachineExtensionImage], response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + +class AvailabilitySetsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.compute.aio.ComputeClient`'s + :attr:`availability_sets` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @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. The name is case insensitive. + Required. + :type resource_group_name: str + :param availability_set_name: The name of the availability set. Required. + :type availability_set_name: str + :return: AvailabilitySet. The AvailabilitySet is compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.AvailabilitySet + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.AvailabilitySet] = kwargs.pop("cls", None) + + _request = build_availability_sets_get_request( + resource_group_name=resource_group_name, + availability_set_name=availability_set_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.AvailabilitySet, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + async def create_or_update( + self, + resource_group_name: str, + availability_set_name: str, + resource: _models.AvailabilitySet, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.AvailabilitySet: + """Create or update an availability set. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param availability_set_name: The name of the availability set. Required. + :type availability_set_name: str + :param resource: Parameters supplied to the Create Availability Set operation. Required. + :type resource: ~azure.mgmt.compute.models.AvailabilitySet + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: AvailabilitySet. The AvailabilitySet is compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.AvailabilitySet + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update( + self, + resource_group_name: str, + availability_set_name: str, + resource: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.AvailabilitySet: + """Create or update an availability set. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param availability_set_name: The name of the availability set. Required. + :type availability_set_name: str + :param resource: Parameters supplied to the Create Availability Set operation. Required. + :type resource: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: AvailabilitySet. The AvailabilitySet is compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.AvailabilitySet + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update( + self, + resource_group_name: str, + availability_set_name: str, + resource: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.AvailabilitySet: + """Create or update an availability set. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param availability_set_name: The name of the availability set. Required. + :type availability_set_name: str + :param resource: Parameters supplied to the Create Availability Set operation. Required. + :type resource: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: AvailabilitySet. The AvailabilitySet is compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.AvailabilitySet + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create_or_update( + self, + resource_group_name: str, + availability_set_name: str, + resource: Union[_models.AvailabilitySet, JSON, IO[bytes]], + **kwargs: Any + ) -> _models.AvailabilitySet: + """Create or update an availability set. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param availability_set_name: The name of the availability set. Required. + :type availability_set_name: str + :param resource: Parameters supplied to the Create Availability Set operation. Is one of the + following types: AvailabilitySet, JSON, IO[bytes] Required. + :type resource: ~azure.mgmt.compute.models.AvailabilitySet or JSON or IO[bytes] + :return: AvailabilitySet. The AvailabilitySet is compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.AvailabilitySet + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AvailabilitySet] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(resource, (IOBase, bytes)): + _content = resource + else: + _content = json.dumps(resource, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_availability_sets_create_or_update_request( + resource_group_name=resource_group_name, + availability_set_name=availability_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.AvailabilitySet, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + async def update( + self, + resource_group_name: str, + availability_set_name: str, + properties: _models.AvailabilitySetUpdate, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.AvailabilitySet: + """Update an availability set. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param availability_set_name: The name of the availability set. Required. + :type availability_set_name: str + :param properties: Parameters supplied to the Update Availability Set operation. Required. + :type properties: ~azure.mgmt.compute.models.AvailabilitySetUpdate + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: AvailabilitySet. The AvailabilitySet is compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.AvailabilitySet + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update( + self, + resource_group_name: str, + availability_set_name: str, + properties: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.AvailabilitySet: + """Update an availability set. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param availability_set_name: The name of the availability set. Required. + :type availability_set_name: str + :param properties: Parameters supplied to the Update Availability Set operation. Required. + :type properties: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: AvailabilitySet. The AvailabilitySet is compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.AvailabilitySet + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update( + self, + resource_group_name: str, + availability_set_name: str, + properties: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.AvailabilitySet: + """Update an availability set. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param availability_set_name: The name of the availability set. Required. + :type availability_set_name: str + :param properties: Parameters supplied to the Update Availability Set operation. Required. + :type properties: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: AvailabilitySet. The AvailabilitySet is compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.AvailabilitySet + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def update( + self, + resource_group_name: str, + availability_set_name: str, + properties: Union[_models.AvailabilitySetUpdate, JSON, IO[bytes]], + **kwargs: Any + ) -> _models.AvailabilitySet: + """Update an availability set. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param availability_set_name: The name of the availability set. Required. + :type availability_set_name: str + :param properties: Parameters supplied to the Update Availability Set operation. Is one of the + following types: AvailabilitySetUpdate, JSON, IO[bytes] Required. + :type properties: ~azure.mgmt.compute.models.AvailabilitySetUpdate or JSON or IO[bytes] + :return: AvailabilitySet. The AvailabilitySet is compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.AvailabilitySet + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AvailabilitySet] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(properties, (IOBase, bytes)): + _content = properties + else: + _content = json.dumps(properties, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_availability_sets_update_request( + resource_group_name=resource_group_name, + availability_set_name=availability_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.AvailabilitySet, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def delete(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. The name is case insensitive. + Required. + :type resource_group_name: str + :param availability_set_name: The name of the availability set. Required. + :type availability_set_name: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_availability_sets_delete_request( + resource_group_name=resource_group_name, + availability_set_name=availability_set_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace + def list(self, resource_group_name: str, **kwargs: Any) -> AsyncItemPaged["_models.AvailabilitySet"]: + """Lists all availability sets in a resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :return: An iterator like instance of AvailabilitySet + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.models.AvailabilitySet] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.AvailabilitySet]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_availability_sets_list_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.AvailabilitySet], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + @distributed_trace + def list_by_subscription( + self, *, expand: Optional[str] = None, **kwargs: Any + ) -> AsyncItemPaged["_models.AvailabilitySet"]: + """Lists all availability sets in a subscription. + + :keyword expand: The expand expression to apply to the operation. Allowed values are + 'instanceView'. Default value is None. + :paramtype expand: str + :return: An iterator like instance of AvailabilitySet + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.models.AvailabilitySet] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.AvailabilitySet]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_availability_sets_list_by_subscription_request( + subscription_id=self._config.subscription_id, + expand=expand, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.AvailabilitySet], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + @distributed_trace + def list_available_sizes( + self, resource_group_name: str, availability_set_name: str, **kwargs: Any + ) -> AsyncItemPaged["_models.VirtualMachineSize"]: + """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. The name is case insensitive. + Required. + :type resource_group_name: str + :param availability_set_name: The name of the availability set. Required. + :type availability_set_name: str + :return: An iterator like instance of VirtualMachineSize + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.models.VirtualMachineSize] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.VirtualMachineSize]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_availability_sets_list_available_sizes_request( + resource_group_name=resource_group_name, + availability_set_name=availability_set_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.VirtualMachineSize], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + @overload + async def start_migration_to_virtual_machine_scale_set( # pylint: disable=name-too-long + self, + resource_group_name: str, + availability_set_name: str, + body: _models.MigrateToVirtualMachineScaleSetInput, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> None: + """Start migration operation on an Availability Set to move its Virtual Machines to a Virtual + Machine Scale Set. This should be followed by a migrate operation on each Virtual Machine that + triggers a downtime on the Virtual Machine. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param availability_set_name: The name of the availability set. Required. + :type availability_set_name: str + :param body: Parameters supplied to the migrate operation on the availability set. Required. + :type body: ~azure.mgmt.compute.models.MigrateToVirtualMachineScaleSetInput + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def start_migration_to_virtual_machine_scale_set( # pylint: disable=name-too-long + self, + resource_group_name: str, + availability_set_name: str, + body: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> None: + """Start migration operation on an Availability Set to move its Virtual Machines to a Virtual + Machine Scale Set. This should be followed by a migrate operation on each Virtual Machine that + triggers a downtime on the Virtual Machine. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param availability_set_name: The name of the availability set. Required. + :type availability_set_name: str + :param body: Parameters supplied to the migrate operation on the availability set. Required. + :type body: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def start_migration_to_virtual_machine_scale_set( # pylint: disable=name-too-long + self, + resource_group_name: str, + availability_set_name: str, + body: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> None: + """Start migration operation on an Availability Set to move its Virtual Machines to a Virtual + Machine Scale Set. This should be followed by a migrate operation on each Virtual Machine that + triggers a downtime on the Virtual Machine. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param availability_set_name: The name of the availability set. Required. + :type availability_set_name: str + :param body: Parameters supplied to the migrate operation on the availability set. Required. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def start_migration_to_virtual_machine_scale_set( # pylint: disable=name-too-long + self, + resource_group_name: str, + availability_set_name: str, + body: Union[_models.MigrateToVirtualMachineScaleSetInput, JSON, IO[bytes]], + **kwargs: Any + ) -> None: + """Start migration operation on an Availability Set to move its Virtual Machines to a Virtual + Machine Scale Set. This should be followed by a migrate operation on each Virtual Machine that + triggers a downtime on the Virtual Machine. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param availability_set_name: The name of the availability set. Required. + :type availability_set_name: str + :param body: Parameters supplied to the migrate operation on the availability set. Is one of + the following types: MigrateToVirtualMachineScaleSetInput, JSON, IO[bytes] Required. + :type body: ~azure.mgmt.compute.models.MigrateToVirtualMachineScaleSetInput or JSON or + IO[bytes] + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_availability_sets_start_migration_to_virtual_machine_scale_set_request( + resource_group_name=resource_group_name, + availability_set_name=availability_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace_async + async def cancel_migration_to_virtual_machine_scale_set( # pylint: disable=name-too-long + self, resource_group_name: str, availability_set_name: str, **kwargs: Any + ) -> None: + """Cancel the migration operation on an Availability Set. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param availability_set_name: The name of the availability set. Required. + :type availability_set_name: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_availability_sets_cancel_migration_to_virtual_machine_scale_set_request( + resource_group_name=resource_group_name, + availability_set_name=availability_set_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @overload + async def validate_migration_to_virtual_machine_scale_set( # pylint: disable=name-too-long + self, + resource_group_name: str, + availability_set_name: str, + body: _models.MigrateToVirtualMachineScaleSetInput, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> None: + """Validates that the Virtual Machines in the Availability Set can be migrated to the provided + Virtual Machine Scale Set. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param availability_set_name: The name of the availability set. Required. + :type availability_set_name: str + :param body: Parameters supplied to the migrate operation on the availability set. Required. + :type body: ~azure.mgmt.compute.models.MigrateToVirtualMachineScaleSetInput + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def validate_migration_to_virtual_machine_scale_set( # pylint: disable=name-too-long + self, + resource_group_name: str, + availability_set_name: str, + body: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> None: + """Validates that the Virtual Machines in the Availability Set can be migrated to the provided + Virtual Machine Scale Set. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param availability_set_name: The name of the availability set. Required. + :type availability_set_name: str + :param body: Parameters supplied to the migrate operation on the availability set. Required. + :type body: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def validate_migration_to_virtual_machine_scale_set( # pylint: disable=name-too-long + self, + resource_group_name: str, + availability_set_name: str, + body: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> None: + """Validates that the Virtual Machines in the Availability Set can be migrated to the provided + Virtual Machine Scale Set. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param availability_set_name: The name of the availability set. Required. + :type availability_set_name: str + :param body: Parameters supplied to the migrate operation on the availability set. Required. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def validate_migration_to_virtual_machine_scale_set( # pylint: disable=name-too-long + self, + resource_group_name: str, + availability_set_name: str, + body: Union[_models.MigrateToVirtualMachineScaleSetInput, JSON, IO[bytes]], + **kwargs: Any + ) -> None: + """Validates that the Virtual Machines in the Availability Set can be migrated to the provided + Virtual Machine Scale Set. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param availability_set_name: The name of the availability set. Required. + :type availability_set_name: str + :param body: Parameters supplied to the migrate operation on the availability set. Is one of + the following types: MigrateToVirtualMachineScaleSetInput, JSON, IO[bytes] Required. + :type body: ~azure.mgmt.compute.models.MigrateToVirtualMachineScaleSetInput or JSON or + IO[bytes] + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_availability_sets_validate_migration_to_virtual_machine_scale_set_request( + resource_group_name=resource_group_name, + availability_set_name=availability_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + async def _convert_to_virtual_machine_scale_set_initial( # pylint: disable=name-too-long + self, + resource_group_name: str, + availability_set_name: str, + parameters: Optional[Union[_models.ConvertToVirtualMachineScaleSetInput, JSON, IO[bytes]]] = None, + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + content_type = content_type if parameters else None + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" if parameters else None + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + if parameters is not None: + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + else: + _content = None + + _request = build_availability_sets_convert_to_virtual_machine_scale_set_request( + resource_group_name=resource_group_name, + availability_set_name=availability_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_convert_to_virtual_machine_scale_set( # pylint: disable=name-too-long + self, + resource_group_name: str, + availability_set_name: str, + parameters: Optional[_models.ConvertToVirtualMachineScaleSetInput] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Create a new Flexible Virtual Machine Scale Set and migrate all the Virtual Machines in the + Availability Set. This does not trigger a downtime on the Virtual Machines. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param availability_set_name: The name of the availability set. Required. + :type availability_set_name: str + :param parameters: Parameters supplied to the migrate operation on the availability set. + Default value is None. + :type parameters: ~azure.mgmt.compute.models.ConvertToVirtualMachineScaleSetInput + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_convert_to_virtual_machine_scale_set( # pylint: disable=name-too-long + self, + resource_group_name: str, + availability_set_name: str, + parameters: Optional[JSON] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Create a new Flexible Virtual Machine Scale Set and migrate all the Virtual Machines in the + Availability Set. This does not trigger a downtime on the Virtual Machines. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param availability_set_name: The name of the availability set. Required. + :type availability_set_name: str + :param parameters: Parameters supplied to the migrate operation on the availability set. + Default value is None. + :type parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_convert_to_virtual_machine_scale_set( # pylint: disable=name-too-long + self, + resource_group_name: str, + availability_set_name: str, + parameters: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Create a new Flexible Virtual Machine Scale Set and migrate all the Virtual Machines in the + Availability Set. This does not trigger a downtime on the Virtual Machines. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param availability_set_name: The name of the availability set. Required. + :type availability_set_name: str + :param parameters: Parameters supplied to the migrate operation on the availability set. + Default value is None. + :type parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_convert_to_virtual_machine_scale_set( # pylint: disable=name-too-long + self, + resource_group_name: str, + availability_set_name: str, + parameters: Optional[Union[_models.ConvertToVirtualMachineScaleSetInput, JSON, IO[bytes]]] = None, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Create a new Flexible Virtual Machine Scale Set and migrate all the Virtual Machines in the + Availability Set. This does not trigger a downtime on the Virtual Machines. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param availability_set_name: The name of the availability set. Required. + :type availability_set_name: str + :param parameters: Parameters supplied to the migrate operation on the availability set. Is one + of the following types: ConvertToVirtualMachineScaleSetInput, JSON, IO[bytes] Default value is + None. + :type parameters: ~azure.mgmt.compute.models.ConvertToVirtualMachineScaleSetInput or JSON or + IO[bytes] + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + content_type = content_type if parameters else None + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._convert_to_virtual_machine_scale_set_initial( + resource_group_name=resource_group_name, + availability_set_name=availability_set_name, + parameters=parameters, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + +class ProximityPlacementGroupsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.compute.aio.ComputeClient`'s + :attr:`proximity_placement_groups` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @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. The name is case insensitive. + Required. + :type resource_group_name: str + :param proximity_placement_group_name: The name of the proximity placement group. Required. + :type proximity_placement_group_name: str + :keyword include_colocation_status: includeColocationStatus=true enables fetching the + colocation status of all the resources in the proximity placement group. Default value is None. + :paramtype include_colocation_status: str + :return: ProximityPlacementGroup. The ProximityPlacementGroup is compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.ProximityPlacementGroup + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.ProximityPlacementGroup] = kwargs.pop("cls", None) + + _request = build_proximity_placement_groups_get_request( + resource_group_name=resource_group_name, + proximity_placement_group_name=proximity_placement_group_name, + subscription_id=self._config.subscription_id, + include_colocation_status=include_colocation_status, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.ProximityPlacementGroup, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + async def create_or_update( + self, + resource_group_name: str, + proximity_placement_group_name: str, + resource: _models.ProximityPlacementGroup, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ProximityPlacementGroup: + """Create or update a proximity placement group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param proximity_placement_group_name: The name of the proximity placement group. Required. + :type proximity_placement_group_name: str + :param resource: Parameters supplied to the Create Proximity Placement Group operation. + Required. + :type resource: ~azure.mgmt.compute.models.ProximityPlacementGroup + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: ProximityPlacementGroup. The ProximityPlacementGroup is compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.ProximityPlacementGroup + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update( + self, + resource_group_name: str, + proximity_placement_group_name: str, + resource: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ProximityPlacementGroup: + """Create or update a proximity placement group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param proximity_placement_group_name: The name of the proximity placement group. Required. + :type proximity_placement_group_name: str + :param resource: Parameters supplied to the Create Proximity Placement Group operation. + Required. + :type resource: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: ProximityPlacementGroup. The ProximityPlacementGroup is compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.ProximityPlacementGroup + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update( + self, + resource_group_name: str, + proximity_placement_group_name: str, + resource: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ProximityPlacementGroup: + """Create or update a proximity placement group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param proximity_placement_group_name: The name of the proximity placement group. Required. + :type proximity_placement_group_name: str + :param resource: Parameters supplied to the Create Proximity Placement Group operation. + Required. + :type resource: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: ProximityPlacementGroup. The ProximityPlacementGroup is compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.ProximityPlacementGroup + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create_or_update( + self, + resource_group_name: str, + proximity_placement_group_name: str, + resource: Union[_models.ProximityPlacementGroup, JSON, IO[bytes]], + **kwargs: Any + ) -> _models.ProximityPlacementGroup: + """Create or update a proximity placement group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param proximity_placement_group_name: The name of the proximity placement group. Required. + :type proximity_placement_group_name: str + :param resource: Parameters supplied to the Create Proximity Placement Group operation. Is one + of the following types: ProximityPlacementGroup, JSON, IO[bytes] Required. + :type resource: ~azure.mgmt.compute.models.ProximityPlacementGroup or JSON or IO[bytes] + :return: ProximityPlacementGroup. The ProximityPlacementGroup is compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.ProximityPlacementGroup + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ProximityPlacementGroup] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(resource, (IOBase, bytes)): + _content = resource + else: + _content = json.dumps(resource, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_proximity_placement_groups_create_or_update_request( + resource_group_name=resource_group_name, + proximity_placement_group_name=proximity_placement_group_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.ProximityPlacementGroup, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + async def update( + self, + resource_group_name: str, + proximity_placement_group_name: str, + properties: _models.ProximityPlacementGroupUpdate, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ProximityPlacementGroup: + """Update a proximity placement group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param proximity_placement_group_name: The name of the proximity placement group. Required. + :type proximity_placement_group_name: str + :param properties: Parameters supplied to the Update Proximity Placement Group operation. + Required. + :type properties: ~azure.mgmt.compute.models.ProximityPlacementGroupUpdate + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: ProximityPlacementGroup. The ProximityPlacementGroup is compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.ProximityPlacementGroup + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update( + self, + resource_group_name: str, + proximity_placement_group_name: str, + properties: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ProximityPlacementGroup: + """Update a proximity placement group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param proximity_placement_group_name: The name of the proximity placement group. Required. + :type proximity_placement_group_name: str + :param properties: Parameters supplied to the Update Proximity Placement Group operation. + Required. + :type properties: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: ProximityPlacementGroup. The ProximityPlacementGroup is compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.ProximityPlacementGroup + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update( + self, + resource_group_name: str, + proximity_placement_group_name: str, + properties: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ProximityPlacementGroup: + """Update a proximity placement group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param proximity_placement_group_name: The name of the proximity placement group. Required. + :type proximity_placement_group_name: str + :param properties: Parameters supplied to the Update Proximity Placement Group operation. + Required. + :type properties: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: ProximityPlacementGroup. The ProximityPlacementGroup is compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.ProximityPlacementGroup + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def update( + self, + resource_group_name: str, + proximity_placement_group_name: str, + properties: Union[_models.ProximityPlacementGroupUpdate, JSON, IO[bytes]], + **kwargs: Any + ) -> _models.ProximityPlacementGroup: + """Update a proximity placement group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param proximity_placement_group_name: The name of the proximity placement group. Required. + :type proximity_placement_group_name: str + :param properties: Parameters supplied to the Update Proximity Placement Group operation. Is + one of the following types: ProximityPlacementGroupUpdate, JSON, IO[bytes] Required. + :type properties: ~azure.mgmt.compute.models.ProximityPlacementGroupUpdate or JSON or IO[bytes] + :return: ProximityPlacementGroup. The ProximityPlacementGroup is compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.ProximityPlacementGroup + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ProximityPlacementGroup] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(properties, (IOBase, bytes)): + _content = properties + else: + _content = json.dumps(properties, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_proximity_placement_groups_update_request( + resource_group_name=resource_group_name, + proximity_placement_group_name=proximity_placement_group_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.ProximityPlacementGroup, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def delete(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. The name is case insensitive. + Required. + :type resource_group_name: str + :param proximity_placement_group_name: The name of the proximity placement group. Required. + :type proximity_placement_group_name: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_proximity_placement_groups_delete_request( + resource_group_name=resource_group_name, + proximity_placement_group_name=proximity_placement_group_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace + def list_by_resource_group( + self, resource_group_name: str, **kwargs: Any + ) -> AsyncItemPaged["_models.ProximityPlacementGroup"]: + """Lists all proximity placement groups in a resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :return: An iterator like instance of ProximityPlacementGroup + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.models.ProximityPlacementGroup] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.ProximityPlacementGroup]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_proximity_placement_groups_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.ProximityPlacementGroup], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + @distributed_trace + def list_by_subscription(self, **kwargs: Any) -> AsyncItemPaged["_models.ProximityPlacementGroup"]: + """Lists all proximity placement groups in a subscription. + + :return: An iterator like instance of ProximityPlacementGroup + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.models.ProximityPlacementGroup] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.ProximityPlacementGroup]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_proximity_placement_groups_list_by_subscription_request( + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.ProximityPlacementGroup], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + +class DedicatedHostGroupsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.compute.aio.ComputeClient`'s + :attr:`dedicated_host_groups` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @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. The name is case insensitive. + Required. + :type resource_group_name: str + :param host_group_name: The name of the dedicated host group. Required. + :type host_group_name: str + :keyword 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. Known values are: "instanceView", "userData", and + "resiliencyView". Default value is None. + :paramtype expand: str or ~azure.mgmt.compute.models.InstanceViewTypes + :return: DedicatedHostGroup. The DedicatedHostGroup is compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.DedicatedHostGroup + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.DedicatedHostGroup] = kwargs.pop("cls", None) + + _request = build_dedicated_host_groups_get_request( + resource_group_name=resource_group_name, + host_group_name=host_group_name, + subscription_id=self._config.subscription_id, + expand=expand, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.DedicatedHostGroup, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + async def create_or_update( + self, + resource_group_name: str, + host_group_name: str, + resource: _models.DedicatedHostGroup, + *, + content_type: str = "application/json", + **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. The name is case insensitive. + Required. + :type resource_group_name: str + :param host_group_name: The name of the dedicated host group. Required. + :type host_group_name: str + :param resource: Parameters supplied to the Create Dedicated Host Group. Required. + :type resource: ~azure.mgmt.compute.models.DedicatedHostGroup + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: DedicatedHostGroup. The DedicatedHostGroup is compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.DedicatedHostGroup + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update( + self, + resource_group_name: str, + host_group_name: str, + resource: JSON, + *, + content_type: str = "application/json", + **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. The name is case insensitive. + Required. + :type resource_group_name: str + :param host_group_name: The name of the dedicated host group. Required. + :type host_group_name: str + :param resource: Parameters supplied to the Create Dedicated Host Group. Required. + :type resource: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: DedicatedHostGroup. The DedicatedHostGroup is compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.DedicatedHostGroup + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update( + self, + resource_group_name: str, + host_group_name: str, + resource: IO[bytes], + *, + content_type: str = "application/json", + **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. The name is case insensitive. + Required. + :type resource_group_name: str + :param host_group_name: The name of the dedicated host group. Required. + :type host_group_name: str + :param resource: Parameters supplied to the Create Dedicated Host Group. Required. + :type resource: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: DedicatedHostGroup. The DedicatedHostGroup is compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.DedicatedHostGroup + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create_or_update( + self, + resource_group_name: str, + host_group_name: str, + resource: Union[_models.DedicatedHostGroup, JSON, IO[bytes]], + **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. The name is case insensitive. + Required. + :type resource_group_name: str + :param host_group_name: The name of the dedicated host group. Required. + :type host_group_name: str + :param resource: Parameters supplied to the Create Dedicated Host Group. Is one of the + following types: DedicatedHostGroup, JSON, IO[bytes] Required. + :type resource: ~azure.mgmt.compute.models.DedicatedHostGroup or JSON or IO[bytes] + :return: DedicatedHostGroup. The DedicatedHostGroup is compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.DedicatedHostGroup + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.DedicatedHostGroup] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(resource, (IOBase, bytes)): + _content = resource + else: + _content = json.dumps(resource, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_dedicated_host_groups_create_or_update_request( + resource_group_name=resource_group_name, + host_group_name=host_group_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.DedicatedHostGroup, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + async def update( + self, + resource_group_name: str, + host_group_name: str, + properties: _models.DedicatedHostGroupUpdate, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.DedicatedHostGroup: + """Update an dedicated host group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param host_group_name: The name of the dedicated host group. Required. + :type host_group_name: str + :param properties: Parameters supplied to the Update Dedicated Host Group operation. Required. + :type properties: ~azure.mgmt.compute.models.DedicatedHostGroupUpdate + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: DedicatedHostGroup. The DedicatedHostGroup is compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.DedicatedHostGroup + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update( + self, + resource_group_name: str, + host_group_name: str, + properties: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.DedicatedHostGroup: + """Update an dedicated host group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param host_group_name: The name of the dedicated host group. Required. + :type host_group_name: str + :param properties: Parameters supplied to the Update Dedicated Host Group operation. Required. + :type properties: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: DedicatedHostGroup. The DedicatedHostGroup is compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.DedicatedHostGroup + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update( + self, + resource_group_name: str, + host_group_name: str, + properties: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.DedicatedHostGroup: + """Update an dedicated host group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param host_group_name: The name of the dedicated host group. Required. + :type host_group_name: str + :param properties: Parameters supplied to the Update Dedicated Host Group operation. Required. + :type properties: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: DedicatedHostGroup. The DedicatedHostGroup is compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.DedicatedHostGroup + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def update( + self, + resource_group_name: str, + host_group_name: str, + properties: Union[_models.DedicatedHostGroupUpdate, JSON, IO[bytes]], + **kwargs: Any + ) -> _models.DedicatedHostGroup: + """Update an dedicated host group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param host_group_name: The name of the dedicated host group. Required. + :type host_group_name: str + :param properties: Parameters supplied to the Update Dedicated Host Group operation. Is one of + the following types: DedicatedHostGroupUpdate, JSON, IO[bytes] Required. + :type properties: ~azure.mgmt.compute.models.DedicatedHostGroupUpdate or JSON or IO[bytes] + :return: DedicatedHostGroup. The DedicatedHostGroup is compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.DedicatedHostGroup + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.DedicatedHostGroup] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(properties, (IOBase, bytes)): + _content = properties + else: + _content = json.dumps(properties, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_dedicated_host_groups_update_request( + resource_group_name=resource_group_name, + host_group_name=host_group_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.DedicatedHostGroup, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def delete(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. The name is case insensitive. + Required. + :type resource_group_name: str + :param host_group_name: The name of the dedicated host group. Required. + :type host_group_name: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_dedicated_host_groups_delete_request( + resource_group_name=resource_group_name, + host_group_name=host_group_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace + def list_by_resource_group( + self, resource_group_name: str, **kwargs: Any + ) -> AsyncItemPaged["_models.DedicatedHostGroup"]: + """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. The name is case insensitive. + Required. + :type resource_group_name: str + :return: An iterator like instance of DedicatedHostGroup + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.models.DedicatedHostGroup] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.DedicatedHostGroup]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_dedicated_host_groups_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.DedicatedHostGroup], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + @distributed_trace + def list_by_subscription(self, **kwargs: Any) -> AsyncItemPaged["_models.DedicatedHostGroup"]: + """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. + + :return: An iterator like instance of DedicatedHostGroup + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.models.DedicatedHostGroup] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.DedicatedHostGroup]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_dedicated_host_groups_list_by_subscription_request( + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.DedicatedHostGroup], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + +class DedicatedHostsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.compute.aio.ComputeClient`'s + :attr:`dedicated_hosts` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @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. The name is case insensitive. + Required. + :type resource_group_name: str + :param host_group_name: The name of the dedicated host group. Required. + :type host_group_name: str + :param host_name: The name of the dedicated host. Required. + :type host_name: str + :keyword 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. Known values are: "instanceView", "userData", and "resiliencyView". Default value is + None. + :paramtype expand: str or ~azure.mgmt.compute.models.InstanceViewTypes + :return: DedicatedHost. The DedicatedHost is compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.DedicatedHost + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.DedicatedHost] = kwargs.pop("cls", None) + + _request = build_dedicated_hosts_get_request( + resource_group_name=resource_group_name, + host_group_name=host_group_name, + host_name=host_name, + subscription_id=self._config.subscription_id, + expand=expand, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.DedicatedHost, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _create_or_update_initial( + self, + resource_group_name: str, + host_group_name: str, + host_name: str, + resource: Union[_models.DedicatedHost, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(resource, (IOBase, bytes)): + _content = resource + else: + _content = json.dumps(resource, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_dedicated_hosts_create_or_update_request( + resource_group_name=resource_group_name, + host_group_name=host_group_name, + host_name=host_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 201: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + host_group_name: str, + host_name: str, + resource: _models.DedicatedHost, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Create or update a dedicated host . + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param host_group_name: The name of the dedicated host group. Required. + :type host_group_name: str + :param host_name: The name of the dedicated host. Required. + :type host_name: str + :param resource: Parameters supplied to the Create Dedicated Host. Required. + :type resource: ~azure.mgmt.compute.models.DedicatedHost + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + host_group_name: str, + host_name: str, + resource: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Create or update a dedicated host . + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param host_group_name: The name of the dedicated host group. Required. + :type host_group_name: str + :param host_name: The name of the dedicated host. Required. + :type host_name: str + :param resource: Parameters supplied to the Create Dedicated Host. Required. + :type resource: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + host_group_name: str, + host_name: str, + resource: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Create or update a dedicated host . + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param host_group_name: The name of the dedicated host group. Required. + :type host_group_name: str + :param host_name: The name of the dedicated host. Required. + :type host_name: str + :param resource: Parameters supplied to the Create Dedicated Host. Required. + :type resource: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + host_group_name: str, + host_name: str, + resource: Union[_models.DedicatedHost, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Create or update a dedicated host . + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param host_group_name: The name of the dedicated host group. Required. + :type host_group_name: str + :param host_name: The name of the dedicated host. Required. + :type host_name: str + :param resource: Parameters supplied to the Create Dedicated Host. Is one of the following + types: DedicatedHost, JSON, IO[bytes] Required. + :type resource: ~azure.mgmt.compute.models.DedicatedHost or JSON or IO[bytes] + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._create_or_update_initial( + resource_group_name=resource_group_name, + host_group_name=host_group_name, + host_name=host_name, + resource=resource, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + async def _update_initial( + self, + resource_group_name: str, + host_group_name: str, + host_name: str, + properties: Union[_models.DedicatedHostUpdate, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(properties, (IOBase, bytes)): + _content = properties + else: + _content = json.dumps(properties, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_dedicated_hosts_update_request( + resource_group_name=resource_group_name, + host_group_name=host_group_name, + host_name=host_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_update( + self, + resource_group_name: str, + host_group_name: str, + host_name: str, + properties: _models.DedicatedHostUpdate, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Update a dedicated host . + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param host_group_name: The name of the dedicated host group. Required. + :type host_group_name: str + :param host_name: The name of the dedicated host. Required. + :type host_name: str + :param properties: Parameters supplied to the Update Dedicated Host operation. Required. + :type properties: ~azure.mgmt.compute.models.DedicatedHostUpdate + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update( + self, + resource_group_name: str, + host_group_name: str, + host_name: str, + properties: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Update a dedicated host . + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param host_group_name: The name of the dedicated host group. Required. + :type host_group_name: str + :param host_name: The name of the dedicated host. Required. + :type host_name: str + :param properties: Parameters supplied to the Update Dedicated Host operation. Required. + :type properties: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update( + self, + resource_group_name: str, + host_group_name: str, + host_name: str, + properties: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Update a dedicated host . + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param host_group_name: The name of the dedicated host group. Required. + :type host_group_name: str + :param host_name: The name of the dedicated host. Required. + :type host_name: str + :param properties: Parameters supplied to the Update Dedicated Host operation. Required. + :type properties: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_update( + self, + resource_group_name: str, + host_group_name: str, + host_name: str, + properties: Union[_models.DedicatedHostUpdate, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Update a dedicated host . + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param host_group_name: The name of the dedicated host group. Required. + :type host_group_name: str + :param host_name: The name of the dedicated host. Required. + :type host_name: str + :param properties: Parameters supplied to the Update Dedicated Host operation. Is one of the + following types: DedicatedHostUpdate, JSON, IO[bytes] Required. + :type properties: ~azure.mgmt.compute.models.DedicatedHostUpdate or JSON or IO[bytes] + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._update_initial( + resource_group_name=resource_group_name, + host_group_name=host_group_name, + host_name=host_name, + properties=properties, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + async def _delete_initial( + self, resource_group_name: str, host_group_name: str, host_name: str, **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_dedicated_hosts_delete_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=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_delete( + 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. The name is case insensitive. + Required. + :type resource_group_name: str + :param host_group_name: The name of the dedicated host group. Required. + :type host_group_name: str + :param host_name: The name of the dedicated host. Required. + :type host_name: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + host_group_name=host_group_name, + host_name=host_name, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace + def list_by_host_group( + self, resource_group_name: str, host_group_name: str, **kwargs: Any + ) -> AsyncItemPaged["_models.DedicatedHost"]: + """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. The name is case insensitive. + Required. + :type resource_group_name: str + :param host_group_name: The name of the dedicated host group. Required. + :type host_group_name: str + :return: An iterator like instance of DedicatedHost + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.models.DedicatedHost] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.DedicatedHost]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_dedicated_hosts_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=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.DedicatedHost], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + @distributed_trace + def list_available_sizes( + self, resource_group_name: str, host_group_name: str, host_name: str, **kwargs: Any + ) -> AsyncItemPaged[str]: + """Lists all available dedicated host sizes to which the specified dedicated host can be resized. + NOTE: The dedicated host sizes provided can be used to only scale up the existing dedicated + host. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param host_group_name: The name of the dedicated host group. Required. + :type host_group_name: str + :param host_name: The name of the dedicated host. Required. + :type host_name: str + :return: An iterator like instance of str + :rtype: ~azure.core.async_paging.AsyncItemPaged[str] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[str]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_dedicated_hosts_list_available_sizes_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=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[str], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + async def _redeploy_initial( + self, resource_group_name: str, host_group_name: str, host_name: str, **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_dedicated_hosts_redeploy_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=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_redeploy( + self, resource_group_name: str, host_group_name: str, host_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Redeploy the dedicated host. The operation will complete successfully once the dedicated host + has migrated to a new node and is running. To determine the health of VMs deployed on the + dedicated host after the redeploy check the Resource Health Center in the Azure Portal. Please + refer to `https://docs.microsoft.com/azure/service-health/resource-health-overview + `_ for more details. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param host_group_name: The name of the dedicated host group. Required. + :type host_group_name: str + :param host_name: The name of the dedicated host. Required. + :type host_name: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._redeploy_initial( + resource_group_name=resource_group_name, + host_group_name=host_group_name, + host_name=host_name, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + async def _restart_initial( + self, resource_group_name: str, host_group_name: str, host_name: str, **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_dedicated_hosts_restart_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=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_restart( + 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/azure/service-health/resource-health-overview + `_ for more details. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param host_group_name: The name of the dedicated host group. Required. + :type host_group_name: str + :param host_name: The name of the dedicated host. Required. + :type host_name: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._restart_initial( + resource_group_name=resource_group_name, + host_group_name=host_group_name, + host_name=host_name, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + +class SshPublicKeyResourcesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.compute.aio.ComputeClient`'s + :attr:`ssh_public_key_resources` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @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. The name is case insensitive. + Required. + :type resource_group_name: str + :param ssh_public_key_name: The name of the SSH public key. Required. + :type ssh_public_key_name: str + :return: SshPublicKeyResource. The SshPublicKeyResource is compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.SshPublicKeyResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.SshPublicKeyResource] = kwargs.pop("cls", None) + + _request = build_ssh_public_key_resources_get_request( + resource_group_name=resource_group_name, + ssh_public_key_name=ssh_public_key_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.SshPublicKeyResource, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + async def create( + self, + resource_group_name: str, + ssh_public_key_name: str, + resource: _models.SshPublicKeyResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SshPublicKeyResource: + """Creates a new SSH public key resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param ssh_public_key_name: The name of the SSH public key. Required. + :type ssh_public_key_name: str + :param resource: Parameters supplied to create the SSH public key. Required. + :type resource: ~azure.mgmt.compute.models.SshPublicKeyResource + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: SshPublicKeyResource. The SshPublicKeyResource is compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.SshPublicKeyResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create( + self, + resource_group_name: str, + ssh_public_key_name: str, + resource: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SshPublicKeyResource: + """Creates a new SSH public key resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param ssh_public_key_name: The name of the SSH public key. Required. + :type ssh_public_key_name: str + :param resource: Parameters supplied to create the SSH public key. Required. + :type resource: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: SshPublicKeyResource. The SshPublicKeyResource is compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.SshPublicKeyResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create( + self, + resource_group_name: str, + ssh_public_key_name: str, + resource: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SshPublicKeyResource: + """Creates a new SSH public key resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param ssh_public_key_name: The name of the SSH public key. Required. + :type ssh_public_key_name: str + :param resource: Parameters supplied to create the SSH public key. Required. + :type resource: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: SshPublicKeyResource. The SshPublicKeyResource is compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.SshPublicKeyResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create( + self, + resource_group_name: str, + ssh_public_key_name: str, + resource: Union[_models.SshPublicKeyResource, JSON, IO[bytes]], + **kwargs: Any + ) -> _models.SshPublicKeyResource: + """Creates a new SSH public key resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param ssh_public_key_name: The name of the SSH public key. Required. + :type ssh_public_key_name: str + :param resource: Parameters supplied to create the SSH public key. Is one of the following + types: SshPublicKeyResource, JSON, IO[bytes] Required. + :type resource: ~azure.mgmt.compute.models.SshPublicKeyResource or JSON or IO[bytes] + :return: SshPublicKeyResource. The SshPublicKeyResource is compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.SshPublicKeyResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SshPublicKeyResource] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(resource, (IOBase, bytes)): + _content = resource + else: + _content = json.dumps(resource, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_ssh_public_key_resources_create_request( + resource_group_name=resource_group_name, + ssh_public_key_name=ssh_public_key_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.SshPublicKeyResource, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + async def update( + self, + resource_group_name: str, + ssh_public_key_name: str, + properties: _models.SshPublicKeyUpdateResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SshPublicKeyResource: + """Updates a new SSH public key resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param ssh_public_key_name: The name of the SSH public key. Required. + :type ssh_public_key_name: str + :param properties: Parameters supplied to update the SSH public key. Required. + :type properties: ~azure.mgmt.compute.models.SshPublicKeyUpdateResource + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: SshPublicKeyResource. The SshPublicKeyResource is compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.SshPublicKeyResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update( + self, + resource_group_name: str, + ssh_public_key_name: str, + properties: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SshPublicKeyResource: + """Updates a new SSH public key resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param ssh_public_key_name: The name of the SSH public key. Required. + :type ssh_public_key_name: str + :param properties: Parameters supplied to update the SSH public key. Required. + :type properties: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: SshPublicKeyResource. The SshPublicKeyResource is compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.SshPublicKeyResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update( + self, + resource_group_name: str, + ssh_public_key_name: str, + properties: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SshPublicKeyResource: + """Updates a new SSH public key resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param ssh_public_key_name: The name of the SSH public key. Required. + :type ssh_public_key_name: str + :param properties: Parameters supplied to update the SSH public key. Required. + :type properties: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: SshPublicKeyResource. The SshPublicKeyResource is compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.SshPublicKeyResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def update( + self, + resource_group_name: str, + ssh_public_key_name: str, + properties: Union[_models.SshPublicKeyUpdateResource, JSON, IO[bytes]], + **kwargs: Any + ) -> _models.SshPublicKeyResource: + """Updates a new SSH public key resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param ssh_public_key_name: The name of the SSH public key. Required. + :type ssh_public_key_name: str + :param properties: Parameters supplied to update the SSH public key. Is one of the following + types: SshPublicKeyUpdateResource, JSON, IO[bytes] Required. + :type properties: ~azure.mgmt.compute.models.SshPublicKeyUpdateResource or JSON or IO[bytes] + :return: SshPublicKeyResource. The SshPublicKeyResource is compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.SshPublicKeyResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SshPublicKeyResource] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(properties, (IOBase, bytes)): + _content = properties + else: + _content = json.dumps(properties, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_ssh_public_key_resources_update_request( + resource_group_name=resource_group_name, + ssh_public_key_name=ssh_public_key_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.SshPublicKeyResource, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def delete(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. The name is case insensitive. + Required. + :type resource_group_name: str + :param ssh_public_key_name: The name of the SSH public key. Required. + :type ssh_public_key_name: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_ssh_public_key_resources_delete_request( + resource_group_name=resource_group_name, + ssh_public_key_name=ssh_public_key_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace + def list_by_resource_group( + self, resource_group_name: str, **kwargs: Any + ) -> AsyncItemPaged["_models.SshPublicKeyResource"]: + """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. The name is case insensitive. + Required. + :type resource_group_name: str + :return: An iterator like instance of SshPublicKeyResource + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.models.SshPublicKeyResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.SshPublicKeyResource]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_ssh_public_key_resources_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.SshPublicKeyResource], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + @distributed_trace + def list_by_subscription(self, **kwargs: Any) -> AsyncItemPaged["_models.SshPublicKeyResource"]: + """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. + + :return: An iterator like instance of SshPublicKeyResource + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.models.SshPublicKeyResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.SshPublicKeyResource]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_ssh_public_key_resources_list_by_subscription_request( + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.SshPublicKeyResource], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + @overload + async def generate_key_pair( + self, + resource_group_name: str, + ssh_public_key_name: str, + parameters: Optional[_models.SshGenerateKeyPairInputParameters] = None, + *, + content_type: str = "application/json", + **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. The name is case insensitive. + Required. + :type resource_group_name: str + :param ssh_public_key_name: The name of the SSH public key. Required. + :type ssh_public_key_name: str + :param parameters: Parameters supplied to generate the SSH public key. Default value is None. + :type parameters: ~azure.mgmt.compute.models.SshGenerateKeyPairInputParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: SshPublicKeyGenerateKeyPairResult. The SshPublicKeyGenerateKeyPairResult is compatible + with MutableMapping + :rtype: ~azure.mgmt.compute.models.SshPublicKeyGenerateKeyPairResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def generate_key_pair( + self, + resource_group_name: str, + ssh_public_key_name: str, + parameters: Optional[JSON] = None, + *, + content_type: str = "application/json", + **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. The name is case insensitive. + Required. + :type resource_group_name: str + :param ssh_public_key_name: The name of the SSH public key. Required. + :type ssh_public_key_name: str + :param parameters: Parameters supplied to generate the SSH public key. Default value is None. + :type parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: SshPublicKeyGenerateKeyPairResult. The SshPublicKeyGenerateKeyPairResult is compatible + with MutableMapping + :rtype: ~azure.mgmt.compute.models.SshPublicKeyGenerateKeyPairResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def generate_key_pair( + self, + resource_group_name: str, + ssh_public_key_name: str, + parameters: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + **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. The name is case insensitive. + Required. + :type resource_group_name: str + :param ssh_public_key_name: The name of the SSH public key. Required. + :type ssh_public_key_name: str + :param parameters: Parameters supplied to generate the SSH public key. Default value is None. + :type parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: SshPublicKeyGenerateKeyPairResult. The SshPublicKeyGenerateKeyPairResult is compatible + with MutableMapping + :rtype: ~azure.mgmt.compute.models.SshPublicKeyGenerateKeyPairResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def generate_key_pair( + self, + resource_group_name: str, + ssh_public_key_name: str, + parameters: Optional[Union[_models.SshGenerateKeyPairInputParameters, JSON, IO[bytes]]] = None, + **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. The name is case insensitive. + Required. + :type resource_group_name: str + :param ssh_public_key_name: The name of the SSH public key. Required. + :type ssh_public_key_name: str + :param parameters: Parameters supplied to generate the SSH public key. Is one of the following + types: SshGenerateKeyPairInputParameters, JSON, IO[bytes] Default value is None. + :type parameters: ~azure.mgmt.compute.models.SshGenerateKeyPairInputParameters or JSON or + IO[bytes] + :return: SshPublicKeyGenerateKeyPairResult. The SshPublicKeyGenerateKeyPairResult is compatible + with MutableMapping + :rtype: ~azure.mgmt.compute.models.SshPublicKeyGenerateKeyPairResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + content_type = content_type if parameters else None + cls: ClsType[_models.SshPublicKeyGenerateKeyPairResult] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" if parameters else None + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + if parameters is not None: + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + else: + _content = None + + _request = build_ssh_public_key_resources_generate_key_pair_request( + resource_group_name=resource_group_name, + ssh_public_key_name=ssh_public_key_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.SshPublicKeyGenerateKeyPairResult, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + +class ImagesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.compute.aio.ComputeClient`'s + :attr:`images` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @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. The name is case insensitive. + Required. + :type resource_group_name: str + :param image_name: The name of the image. Required. + :type image_name: str + :keyword expand: The expand expression to apply on the operation. Default value is None. + :paramtype expand: str + :return: Image. The Image is compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.Image + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.Image] = kwargs.pop("cls", None) + + _request = build_images_get_request( + resource_group_name=resource_group_name, + image_name=image_name, + subscription_id=self._config.subscription_id, + expand=expand, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.Image, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _create_or_update_initial( + self, resource_group_name: str, image_name: str, resource: Union[_models.Image, JSON, IO[bytes]], **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(resource, (IOBase, bytes)): + _content = resource + else: + _content = json.dumps(resource, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_images_create_or_update_request( + resource_group_name=resource_group_name, + image_name=image_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 201: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + image_name: str, + resource: _models.Image, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Create or update an image. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param image_name: The name of the image. Required. + :type image_name: str + :param resource: Parameters supplied to the Create Image operation. Required. + :type resource: ~azure.mgmt.compute.models.Image + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + image_name: str, + resource: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Create or update an image. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param image_name: The name of the image. Required. + :type image_name: str + :param resource: Parameters supplied to the Create Image operation. Required. + :type resource: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + image_name: str, + resource: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Create or update an image. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param image_name: The name of the image. Required. + :type image_name: str + :param resource: Parameters supplied to the Create Image operation. Required. + :type resource: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, resource_group_name: str, image_name: str, resource: Union[_models.Image, JSON, IO[bytes]], **kwargs: Any + ) -> AsyncLROPoller[None]: + """Create or update an image. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param image_name: The name of the image. Required. + :type image_name: str + :param resource: Parameters supplied to the Create Image operation. Is one of the following + types: Image, JSON, IO[bytes] Required. + :type resource: ~azure.mgmt.compute.models.Image or JSON or IO[bytes] + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._create_or_update_initial( + resource_group_name=resource_group_name, + image_name=image_name, + resource=resource, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + async def _update_initial( + self, + resource_group_name: str, + image_name: str, + properties: Union[_models.ImageUpdate, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(properties, (IOBase, bytes)): + _content = properties + else: + _content = json.dumps(properties, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_images_update_request( + resource_group_name=resource_group_name, + image_name=image_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 201: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_update( + self, + resource_group_name: str, + image_name: str, + properties: _models.ImageUpdate, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Update an image. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param image_name: The name of the image. Required. + :type image_name: str + :param properties: Parameters supplied to the Update Image operation. Required. + :type properties: ~azure.mgmt.compute.models.ImageUpdate + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update( + self, + resource_group_name: str, + image_name: str, + properties: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Update an image. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param image_name: The name of the image. Required. + :type image_name: str + :param properties: Parameters supplied to the Update Image operation. Required. + :type properties: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update( + self, + resource_group_name: str, + image_name: str, + properties: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Update an image. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param image_name: The name of the image. Required. + :type image_name: str + :param properties: Parameters supplied to the Update Image operation. Required. + :type properties: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_update( + self, + resource_group_name: str, + image_name: str, + properties: Union[_models.ImageUpdate, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Update an image. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param image_name: The name of the image. Required. + :type image_name: str + :param properties: Parameters supplied to the Update Image operation. Is one of the following + types: ImageUpdate, JSON, IO[bytes] Required. + :type properties: ~azure.mgmt.compute.models.ImageUpdate or JSON or IO[bytes] + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._update_initial( + resource_group_name=resource_group_name, + image_name=image_name, + properties=properties, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + async def _delete_initial(self, resource_group_name: str, image_name: str, **kwargs: Any) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_images_delete_request( + resource_group_name=resource_group_name, + image_name=image_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_delete(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. The name is case insensitive. + Required. + :type resource_group_name: str + :param image_name: The name of the image. Required. + :type image_name: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + image_name=image_name, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace + def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> AsyncItemPaged["_models.Image"]: + """Gets the list of images under a resource group. Use nextLink property in the response to get + the next page of Images. Do this till nextLink is null to fetch all the Images. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :return: An iterator like instance of Image + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.models.Image] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.Image]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_images_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.Image], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + @distributed_trace + def list(self, **kwargs: Any) -> AsyncItemPaged["_models.Image"]: + """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. + + :return: An iterator like instance of Image + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.models.Image] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.Image]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_images_list_request( + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.Image], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + +class RestorePointCollectionsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.compute.aio.ComputeClient`'s + :attr:`restore_point_collections` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @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. The name is case insensitive. + Required. + :type resource_group_name: str + :param restore_point_collection_name: The name of the restore point collection. Required. + :type restore_point_collection_name: str + :keyword expand: The expand expression to apply on the operation. If expand=restorePoints, + server will return all contained restore points in the restorePointCollection. "restorePoints" + Default value is None. + :paramtype expand: str or ~azure.mgmt.compute.models.RestorePointCollectionExpandOptions + :return: RestorePointCollection. The RestorePointCollection is compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.RestorePointCollection + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.RestorePointCollection] = kwargs.pop("cls", None) + + _request = build_restore_point_collections_get_request( + resource_group_name=resource_group_name, + restore_point_collection_name=restore_point_collection_name, + subscription_id=self._config.subscription_id, + expand=expand, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.RestorePointCollection, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + async def create_or_update( + self, + resource_group_name: str, + restore_point_collection_name: str, + resource: _models.RestorePointCollection, + *, + content_type: str = "application/json", + **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. The name is case insensitive. + Required. + :type resource_group_name: str + :param restore_point_collection_name: The name of the restore point collection. Required. + :type restore_point_collection_name: str + :param resource: Parameters supplied to the Create or Update restore point collection + operation. Required. + :type resource: ~azure.mgmt.compute.models.RestorePointCollection + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: RestorePointCollection. The RestorePointCollection is compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.RestorePointCollection + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update( + self, + resource_group_name: str, + restore_point_collection_name: str, + resource: JSON, + *, + content_type: str = "application/json", + **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. The name is case insensitive. + Required. + :type resource_group_name: str + :param restore_point_collection_name: The name of the restore point collection. Required. + :type restore_point_collection_name: str + :param resource: Parameters supplied to the Create or Update restore point collection + operation. Required. + :type resource: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: RestorePointCollection. The RestorePointCollection is compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.RestorePointCollection + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update( + self, + resource_group_name: str, + restore_point_collection_name: str, + resource: IO[bytes], + *, + content_type: str = "application/json", + **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. The name is case insensitive. + Required. + :type resource_group_name: str + :param restore_point_collection_name: The name of the restore point collection. Required. + :type restore_point_collection_name: str + :param resource: Parameters supplied to the Create or Update restore point collection + operation. Required. + :type resource: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: RestorePointCollection. The RestorePointCollection is compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.RestorePointCollection + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create_or_update( + self, + resource_group_name: str, + restore_point_collection_name: str, + resource: Union[_models.RestorePointCollection, JSON, IO[bytes]], + **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. The name is case insensitive. + Required. + :type resource_group_name: str + :param restore_point_collection_name: The name of the restore point collection. Required. + :type restore_point_collection_name: str + :param resource: Parameters supplied to the Create or Update restore point collection + operation. Is one of the following types: RestorePointCollection, JSON, IO[bytes] Required. + :type resource: ~azure.mgmt.compute.models.RestorePointCollection or JSON or IO[bytes] + :return: RestorePointCollection. The RestorePointCollection is compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.RestorePointCollection + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.RestorePointCollection] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(resource, (IOBase, bytes)): + _content = resource + else: + _content = json.dumps(resource, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_restore_point_collections_create_or_update_request( + resource_group_name=resource_group_name, + restore_point_collection_name=restore_point_collection_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.RestorePointCollection, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + async def update( + self, + resource_group_name: str, + restore_point_collection_name: str, + properties: _models.RestorePointCollectionUpdate, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.RestorePointCollection: + """The operation to update the restore point collection. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param restore_point_collection_name: The name of the restore point collection. Required. + :type restore_point_collection_name: str + :param properties: Parameters supplied to the Update restore point collection operation. + Required. + :type properties: ~azure.mgmt.compute.models.RestorePointCollectionUpdate + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: RestorePointCollection. The RestorePointCollection is compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.RestorePointCollection + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update( + self, + resource_group_name: str, + restore_point_collection_name: str, + properties: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.RestorePointCollection: + """The operation to update the restore point collection. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param restore_point_collection_name: The name of the restore point collection. Required. + :type restore_point_collection_name: str + :param properties: Parameters supplied to the Update restore point collection operation. + Required. + :type properties: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: RestorePointCollection. The RestorePointCollection is compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.RestorePointCollection + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update( + self, + resource_group_name: str, + restore_point_collection_name: str, + properties: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.RestorePointCollection: + """The operation to update the restore point collection. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param restore_point_collection_name: The name of the restore point collection. Required. + :type restore_point_collection_name: str + :param properties: Parameters supplied to the Update restore point collection operation. + Required. + :type properties: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: RestorePointCollection. The RestorePointCollection is compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.RestorePointCollection + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def update( + self, + resource_group_name: str, + restore_point_collection_name: str, + properties: Union[_models.RestorePointCollectionUpdate, JSON, IO[bytes]], + **kwargs: Any + ) -> _models.RestorePointCollection: + """The operation to update the restore point collection. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param restore_point_collection_name: The name of the restore point collection. Required. + :type restore_point_collection_name: str + :param properties: Parameters supplied to the Update restore point collection operation. Is one + of the following types: RestorePointCollectionUpdate, JSON, IO[bytes] Required. + :type properties: ~azure.mgmt.compute.models.RestorePointCollectionUpdate or JSON or IO[bytes] + :return: RestorePointCollection. The RestorePointCollection is compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.RestorePointCollection + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.RestorePointCollection] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(properties, (IOBase, bytes)): + _content = properties + else: + _content = json.dumps(properties, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_restore_point_collections_update_request( + resource_group_name=resource_group_name, + restore_point_collection_name=restore_point_collection_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.RestorePointCollection, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _delete_initial( + self, resource_group_name: str, restore_point_collection_name: str, **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_restore_point_collections_delete_request( + resource_group_name=resource_group_name, + restore_point_collection_name=restore_point_collection_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_delete( + 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. The name is case insensitive. + Required. + :type resource_group_name: str + :param restore_point_collection_name: The name of the restore point collection. Required. + :type restore_point_collection_name: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + restore_point_collection_name=restore_point_collection_name, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace + def list(self, resource_group_name: str, **kwargs: Any) -> AsyncItemPaged["_models.RestorePointCollection"]: + """Gets the list of restore point collections in a resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :return: An iterator like instance of RestorePointCollection + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.models.RestorePointCollection] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.RestorePointCollection]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_restore_point_collections_list_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.RestorePointCollection], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + @distributed_trace + def list_all(self, **kwargs: Any) -> AsyncItemPaged["_models.RestorePointCollection"]: + """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. + + :return: An iterator like instance of RestorePointCollection + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.models.RestorePointCollection] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.RestorePointCollection]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_restore_point_collections_list_all_request( + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.RestorePointCollection], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + +class RestorePointsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.compute.aio.ComputeClient`'s + :attr:`restore_points` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @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. The name is case insensitive. + Required. + :type resource_group_name: str + :param restore_point_collection_name: The name of the restore point collection. Required. + :type restore_point_collection_name: str + :param restore_point_name: The name of the restore point. Required. + :type restore_point_name: str + :keyword expand: The expand expression to apply on the operation. 'InstanceView' retrieves + information about the run-time state of a restore point. "instanceView" Default value is None. + :paramtype expand: str or ~azure.mgmt.compute.models.RestorePointExpandOptions + :return: RestorePoint. The RestorePoint is compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.RestorePoint + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.RestorePoint] = kwargs.pop("cls", None) + + _request = build_restore_points_get_request( + resource_group_name=resource_group_name, + restore_point_collection_name=restore_point_collection_name, + restore_point_name=restore_point_name, + subscription_id=self._config.subscription_id, + expand=expand, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.RestorePoint, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _create_initial( + self, + resource_group_name: str, + restore_point_collection_name: str, + restore_point_name: str, + resource: Union[_models.RestorePoint, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(resource, (IOBase, bytes)): + _content = resource + else: + _content = json.dumps(resource, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_restore_points_create_request( + resource_group_name=resource_group_name, + restore_point_collection_name=restore_point_collection_name, + restore_point_name=restore_point_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_create( + self, + resource_group_name: str, + restore_point_collection_name: str, + restore_point_name: str, + resource: _models.RestorePoint, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """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. The name is case insensitive. + Required. + :type resource_group_name: str + :param restore_point_collection_name: The name of the restore point collection. Required. + :type restore_point_collection_name: str + :param restore_point_name: The name of the restore point. Required. + :type restore_point_name: str + :param resource: Parameters supplied to the Create restore point operation. Required. + :type resource: ~azure.mgmt.compute.models.RestorePoint + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create( + self, + resource_group_name: str, + restore_point_collection_name: str, + restore_point_name: str, + resource: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """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. The name is case insensitive. + Required. + :type resource_group_name: str + :param restore_point_collection_name: The name of the restore point collection. Required. + :type restore_point_collection_name: str + :param restore_point_name: The name of the restore point. Required. + :type restore_point_name: str + :param resource: Parameters supplied to the Create restore point operation. Required. + :type resource: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create( + self, + resource_group_name: str, + restore_point_collection_name: str, + restore_point_name: str, + resource: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """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. The name is case insensitive. + Required. + :type resource_group_name: str + :param restore_point_collection_name: The name of the restore point collection. Required. + :type restore_point_collection_name: str + :param restore_point_name: The name of the restore point. Required. + :type restore_point_name: str + :param resource: Parameters supplied to the Create restore point operation. Required. + :type resource: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create( + self, + resource_group_name: str, + restore_point_collection_name: str, + restore_point_name: str, + resource: Union[_models.RestorePoint, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[None]: + """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. The name is case insensitive. + Required. + :type resource_group_name: str + :param restore_point_collection_name: The name of the restore point collection. Required. + :type restore_point_collection_name: str + :param restore_point_name: The name of the restore point. Required. + :type restore_point_name: str + :param resource: Parameters supplied to the Create restore point operation. Is one of the + following types: RestorePoint, JSON, IO[bytes] Required. + :type resource: ~azure.mgmt.compute.models.RestorePoint or JSON or IO[bytes] + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._create_initial( + resource_group_name=resource_group_name, + restore_point_collection_name=restore_point_collection_name, + restore_point_name=restore_point_name, + resource=resource, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + async def _delete_initial( + self, resource_group_name: str, restore_point_collection_name: str, restore_point_name: str, **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_restore_points_delete_request( + resource_group_name=resource_group_name, + restore_point_collection_name=restore_point_collection_name, + restore_point_name=restore_point_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_delete( + 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. The name is case insensitive. + Required. + :type resource_group_name: str + :param restore_point_collection_name: The name of the restore point collection. Required. + :type restore_point_collection_name: str + :param restore_point_name: The name of the restore point. Required. + :type restore_point_name: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + restore_point_collection_name=restore_point_collection_name, + restore_point_name=restore_point_name, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + +class CapacityReservationGroupsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.compute.aio.ComputeClient`'s + :attr:`capacity_reservation_groups` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @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. The name is case insensitive. + Required. + :type resource_group_name: str + :param capacity_reservation_group_name: The name of the capacity reservation group. Required. + :type capacity_reservation_group_name: str + :keyword 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. "instanceView" Default value is + None. + :paramtype expand: str or ~azure.mgmt.compute.models.CapacityReservationGroupInstanceViewTypes + :return: CapacityReservationGroup. The CapacityReservationGroup is compatible with + MutableMapping + :rtype: ~azure.mgmt.compute.models.CapacityReservationGroup + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.CapacityReservationGroup] = kwargs.pop("cls", None) + + _request = build_capacity_reservation_groups_get_request( + resource_group_name=resource_group_name, + capacity_reservation_group_name=capacity_reservation_group_name, + subscription_id=self._config.subscription_id, + expand=expand, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.CapacityReservationGroup, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + async def create_or_update( + self, + resource_group_name: str, + capacity_reservation_group_name: str, + resource: _models.CapacityReservationGroup, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.CapacityReservationGroup: + """The operation to create or update a capacity reservation group. When updating a capacity + reservation group, only tags and sharing profile may be modified. Please refer to + `https://aka.ms/CapacityReservation `_ for more details. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param capacity_reservation_group_name: The name of the capacity reservation group. Required. + :type capacity_reservation_group_name: str + :param resource: Parameters supplied to the Create capacity reservation Group. Required. + :type resource: ~azure.mgmt.compute.models.CapacityReservationGroup + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: CapacityReservationGroup. The CapacityReservationGroup is compatible with + MutableMapping + :rtype: ~azure.mgmt.compute.models.CapacityReservationGroup + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update( + self, + resource_group_name: str, + capacity_reservation_group_name: str, + resource: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.CapacityReservationGroup: + """The operation to create or update a capacity reservation group. When updating a capacity + reservation group, only tags and sharing profile may be modified. Please refer to + `https://aka.ms/CapacityReservation `_ for more details. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param capacity_reservation_group_name: The name of the capacity reservation group. Required. + :type capacity_reservation_group_name: str + :param resource: Parameters supplied to the Create capacity reservation Group. Required. + :type resource: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: CapacityReservationGroup. The CapacityReservationGroup is compatible with + MutableMapping + :rtype: ~azure.mgmt.compute.models.CapacityReservationGroup + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update( + self, + resource_group_name: str, + capacity_reservation_group_name: str, + resource: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.CapacityReservationGroup: + """The operation to create or update a capacity reservation group. When updating a capacity + reservation group, only tags and sharing profile may be modified. Please refer to + `https://aka.ms/CapacityReservation `_ for more details. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param capacity_reservation_group_name: The name of the capacity reservation group. Required. + :type capacity_reservation_group_name: str + :param resource: Parameters supplied to the Create capacity reservation Group. Required. + :type resource: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: CapacityReservationGroup. The CapacityReservationGroup is compatible with + MutableMapping + :rtype: ~azure.mgmt.compute.models.CapacityReservationGroup + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create_or_update( + self, + resource_group_name: str, + capacity_reservation_group_name: str, + resource: Union[_models.CapacityReservationGroup, JSON, IO[bytes]], + **kwargs: Any + ) -> _models.CapacityReservationGroup: + """The operation to create or update a capacity reservation group. When updating a capacity + reservation group, only tags and sharing profile may be modified. Please refer to + `https://aka.ms/CapacityReservation `_ for more details. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param capacity_reservation_group_name: The name of the capacity reservation group. Required. + :type capacity_reservation_group_name: str + :param resource: Parameters supplied to the Create capacity reservation Group. Is one of the + following types: CapacityReservationGroup, JSON, IO[bytes] Required. + :type resource: ~azure.mgmt.compute.models.CapacityReservationGroup or JSON or IO[bytes] + :return: CapacityReservationGroup. The CapacityReservationGroup is compatible with + MutableMapping + :rtype: ~azure.mgmt.compute.models.CapacityReservationGroup + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CapacityReservationGroup] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(resource, (IOBase, bytes)): + _content = resource + else: + _content = json.dumps(resource, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_capacity_reservation_groups_create_or_update_request( + resource_group_name=resource_group_name, + capacity_reservation_group_name=capacity_reservation_group_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.CapacityReservationGroup, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + async def update( + self, + resource_group_name: str, + capacity_reservation_group_name: str, + properties: _models.CapacityReservationGroupUpdate, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.CapacityReservationGroup: + """The operation to update a capacity reservation group. When updating a capacity reservation + group, only tags and sharing profile may be modified. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param capacity_reservation_group_name: The name of the capacity reservation group. Required. + :type capacity_reservation_group_name: str + :param properties: Parameters supplied to the Update capacity reservation Group operation. + Required. + :type properties: ~azure.mgmt.compute.models.CapacityReservationGroupUpdate + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: CapacityReservationGroup. The CapacityReservationGroup is compatible with + MutableMapping + :rtype: ~azure.mgmt.compute.models.CapacityReservationGroup + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update( + self, + resource_group_name: str, + capacity_reservation_group_name: str, + properties: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.CapacityReservationGroup: + """The operation to update a capacity reservation group. When updating a capacity reservation + group, only tags and sharing profile may be modified. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param capacity_reservation_group_name: The name of the capacity reservation group. Required. + :type capacity_reservation_group_name: str + :param properties: Parameters supplied to the Update capacity reservation Group operation. + Required. + :type properties: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: CapacityReservationGroup. The CapacityReservationGroup is compatible with + MutableMapping + :rtype: ~azure.mgmt.compute.models.CapacityReservationGroup + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update( + self, + resource_group_name: str, + capacity_reservation_group_name: str, + properties: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.CapacityReservationGroup: + """The operation to update a capacity reservation group. When updating a capacity reservation + group, only tags and sharing profile may be modified. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param capacity_reservation_group_name: The name of the capacity reservation group. Required. + :type capacity_reservation_group_name: str + :param properties: Parameters supplied to the Update capacity reservation Group operation. + Required. + :type properties: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: CapacityReservationGroup. The CapacityReservationGroup is compatible with + MutableMapping + :rtype: ~azure.mgmt.compute.models.CapacityReservationGroup + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def update( + self, + resource_group_name: str, + capacity_reservation_group_name: str, + properties: Union[_models.CapacityReservationGroupUpdate, JSON, IO[bytes]], + **kwargs: Any + ) -> _models.CapacityReservationGroup: + """The operation to update a capacity reservation group. When updating a capacity reservation + group, only tags and sharing profile may be modified. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param capacity_reservation_group_name: The name of the capacity reservation group. Required. + :type capacity_reservation_group_name: str + :param properties: Parameters supplied to the Update capacity reservation Group operation. Is + one of the following types: CapacityReservationGroupUpdate, JSON, IO[bytes] Required. + :type properties: ~azure.mgmt.compute.models.CapacityReservationGroupUpdate or JSON or + IO[bytes] + :return: CapacityReservationGroup. The CapacityReservationGroup is compatible with + MutableMapping + :rtype: ~azure.mgmt.compute.models.CapacityReservationGroup + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CapacityReservationGroup] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(properties, (IOBase, bytes)): + _content = properties + else: + _content = json.dumps(properties, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_capacity_reservation_groups_update_request( + resource_group_name=resource_group_name, + capacity_reservation_group_name=capacity_reservation_group_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.CapacityReservationGroup, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def delete(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. The name is case insensitive. + Required. + :type resource_group_name: str + :param capacity_reservation_group_name: The name of the capacity reservation group. Required. + :type capacity_reservation_group_name: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_capacity_reservation_groups_delete_request( + resource_group_name=resource_group_name, + capacity_reservation_group_name=capacity_reservation_group_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace + def list_by_resource_group( + self, + resource_group_name: str, + *, + expand: Optional[Union[str, _models.ExpandTypesForGetCapacityReservationGroups]] = None, + **kwargs: Any + ) -> AsyncItemPaged["_models.CapacityReservationGroup"]: + """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. The name is case insensitive. + Required. + :type resource_group_name: str + :keyword 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. Known values are: + "virtualMachineScaleSetVMs/$ref" and "virtualMachines/$ref". Default value is None. + :paramtype expand: str or ~azure.mgmt.compute.models.ExpandTypesForGetCapacityReservationGroups + :return: An iterator like instance of CapacityReservationGroup + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.models.CapacityReservationGroup] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.CapacityReservationGroup]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_capacity_reservation_groups_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + expand=expand, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.CapacityReservationGroup], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + @distributed_trace + def list_by_subscription( + self, + *, + expand: Optional[Union[str, _models.ExpandTypesForGetCapacityReservationGroups]] = None, + resource_ids_only: Optional[Union[str, _models.ResourceIdOptionsForGetCapacityReservationGroups]] = None, + **kwargs: Any + ) -> AsyncItemPaged["_models.CapacityReservationGroup"]: + """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. + + :keyword 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. Known values are: + "virtualMachineScaleSetVMs/$ref" and "virtualMachines/$ref". Default value is None. + :paramtype expand: str or ~azure.mgmt.compute.models.ExpandTypesForGetCapacityReservationGroups + :keyword resource_ids_only: The query option to fetch Capacity Reservation Group Resource Ids. +
'CreatedInSubscription' enables fetching Resource Ids for all capacity reservation group + resources created in the subscription.
'SharedWithSubscription' enables fetching Resource + Ids for all capacity reservation group resources shared with the subscription.
'All' + enables fetching Resource Ids for all capacity reservation group resources shared with the + subscription and created in the subscription. Known values are: "CreatedInSubscription", + "SharedWithSubscription", and "All". Default value is None. + :paramtype resource_ids_only: str or + ~azure.mgmt.compute.models.ResourceIdOptionsForGetCapacityReservationGroups + :return: An iterator like instance of CapacityReservationGroup + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.models.CapacityReservationGroup] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.CapacityReservationGroup]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_capacity_reservation_groups_list_by_subscription_request( + subscription_id=self._config.subscription_id, + expand=expand, + resource_ids_only=resource_ids_only, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.CapacityReservationGroup], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + +class CapacityReservationsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.compute.aio.ComputeClient`'s + :attr:`capacity_reservations` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @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. The name is case insensitive. + Required. + :type resource_group_name: str + :param capacity_reservation_group_name: The name of the capacity reservation group. Required. + :type capacity_reservation_group_name: str + :param capacity_reservation_name: The name of the capacity reservation. Required. + :type capacity_reservation_name: str + :keyword 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. "instanceView" Default value is None. + :paramtype expand: str or ~azure.mgmt.compute.models.CapacityReservationInstanceViewTypes + :return: CapacityReservation. The CapacityReservation is compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.CapacityReservation + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.CapacityReservation] = kwargs.pop("cls", None) + + _request = build_capacity_reservations_get_request( + resource_group_name=resource_group_name, + capacity_reservation_group_name=capacity_reservation_group_name, + capacity_reservation_name=capacity_reservation_name, + subscription_id=self._config.subscription_id, + expand=expand, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.CapacityReservation, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _create_or_update_initial( + self, + resource_group_name: str, + capacity_reservation_group_name: str, + capacity_reservation_name: str, + resource: Union[_models.CapacityReservation, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(resource, (IOBase, bytes)): + _content = resource + else: + _content = json.dumps(resource, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_capacity_reservations_create_or_update_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, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 201: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + capacity_reservation_group_name: str, + capacity_reservation_name: str, + resource: _models.CapacityReservation, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """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. The name is case insensitive. + Required. + :type resource_group_name: str + :param capacity_reservation_group_name: The name of the capacity reservation group. Required. + :type capacity_reservation_group_name: str + :param capacity_reservation_name: The name of the capacity reservation. Required. + :type capacity_reservation_name: str + :param resource: Parameters supplied to the Create capacity reservation. Required. + :type resource: ~azure.mgmt.compute.models.CapacityReservation + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + capacity_reservation_group_name: str, + capacity_reservation_name: str, + resource: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """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. The name is case insensitive. + Required. + :type resource_group_name: str + :param capacity_reservation_group_name: The name of the capacity reservation group. Required. + :type capacity_reservation_group_name: str + :param capacity_reservation_name: The name of the capacity reservation. Required. + :type capacity_reservation_name: str + :param resource: Parameters supplied to the Create capacity reservation. Required. + :type resource: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + capacity_reservation_group_name: str, + capacity_reservation_name: str, + resource: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """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. The name is case insensitive. + Required. + :type resource_group_name: str + :param capacity_reservation_group_name: The name of the capacity reservation group. Required. + :type capacity_reservation_group_name: str + :param capacity_reservation_name: The name of the capacity reservation. Required. + :type capacity_reservation_name: str + :param resource: Parameters supplied to the Create capacity reservation. Required. + :type resource: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + capacity_reservation_group_name: str, + capacity_reservation_name: str, + resource: Union[_models.CapacityReservation, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[None]: + """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. The name is case insensitive. + Required. + :type resource_group_name: str + :param capacity_reservation_group_name: The name of the capacity reservation group. Required. + :type capacity_reservation_group_name: str + :param capacity_reservation_name: The name of the capacity reservation. Required. + :type capacity_reservation_name: str + :param resource: Parameters supplied to the Create capacity reservation. Is one of the + following types: CapacityReservation, JSON, IO[bytes] Required. + :type resource: ~azure.mgmt.compute.models.CapacityReservation or JSON or IO[bytes] + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._create_or_update_initial( + resource_group_name=resource_group_name, + capacity_reservation_group_name=capacity_reservation_group_name, + capacity_reservation_name=capacity_reservation_name, + resource=resource, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + async def _update_initial( + self, + resource_group_name: str, + capacity_reservation_group_name: str, + capacity_reservation_name: str, + properties: Union[_models.CapacityReservationUpdate, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(properties, (IOBase, bytes)): + _content = properties + else: + _content = json.dumps(properties, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_capacity_reservations_update_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, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_update( + self, + resource_group_name: str, + capacity_reservation_group_name: str, + capacity_reservation_name: str, + properties: _models.CapacityReservationUpdate, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """The operation to update a capacity reservation. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param capacity_reservation_group_name: The name of the capacity reservation group. Required. + :type capacity_reservation_group_name: str + :param capacity_reservation_name: The name of the capacity reservation. Required. + :type capacity_reservation_name: str + :param properties: Parameters supplied to the Update capacity reservation operation. Required. + :type properties: ~azure.mgmt.compute.models.CapacityReservationUpdate + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update( + self, + resource_group_name: str, + capacity_reservation_group_name: str, + capacity_reservation_name: str, + properties: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """The operation to update a capacity reservation. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param capacity_reservation_group_name: The name of the capacity reservation group. Required. + :type capacity_reservation_group_name: str + :param capacity_reservation_name: The name of the capacity reservation. Required. + :type capacity_reservation_name: str + :param properties: Parameters supplied to the Update capacity reservation operation. Required. + :type properties: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update( + self, + resource_group_name: str, + capacity_reservation_group_name: str, + capacity_reservation_name: str, + properties: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """The operation to update a capacity reservation. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param capacity_reservation_group_name: The name of the capacity reservation group. Required. + :type capacity_reservation_group_name: str + :param capacity_reservation_name: The name of the capacity reservation. Required. + :type capacity_reservation_name: str + :param properties: Parameters supplied to the Update capacity reservation operation. Required. + :type properties: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_update( + self, + resource_group_name: str, + capacity_reservation_group_name: str, + capacity_reservation_name: str, + properties: Union[_models.CapacityReservationUpdate, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[None]: + """The operation to update a capacity reservation. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param capacity_reservation_group_name: The name of the capacity reservation group. Required. + :type capacity_reservation_group_name: str + :param capacity_reservation_name: The name of the capacity reservation. Required. + :type capacity_reservation_name: str + :param properties: Parameters supplied to the Update capacity reservation operation. Is one of + the following types: CapacityReservationUpdate, JSON, IO[bytes] Required. + :type properties: ~azure.mgmt.compute.models.CapacityReservationUpdate or JSON or IO[bytes] + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._update_initial( + resource_group_name=resource_group_name, + capacity_reservation_group_name=capacity_reservation_group_name, + capacity_reservation_name=capacity_reservation_name, + properties=properties, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + async def _delete_initial( + self, + resource_group_name: str, + capacity_reservation_group_name: str, + capacity_reservation_name: str, + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_capacity_reservations_delete_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=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_delete( + 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. + Note: Block capacity reservations cannot be deleted after it has been successfully allocated + until the schedule end time. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param capacity_reservation_group_name: The name of the capacity reservation group. Required. + :type capacity_reservation_group_name: str + :param capacity_reservation_name: The name of the capacity reservation. Required. + :type capacity_reservation_name: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + capacity_reservation_group_name=capacity_reservation_group_name, + capacity_reservation_name=capacity_reservation_name, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace + def list_by_capacity_reservation_group( + self, resource_group_name: str, capacity_reservation_group_name: str, **kwargs: Any + ) -> AsyncItemPaged["_models.CapacityReservation"]: + """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. The name is case insensitive. + Required. + :type resource_group_name: str + :param capacity_reservation_group_name: The name of the capacity reservation group. Required. + :type capacity_reservation_group_name: str + :return: An iterator like instance of CapacityReservation + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.models.CapacityReservation] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.CapacityReservation]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_capacity_reservations_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=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.CapacityReservation], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + +class VirtualMachineRunCommandsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.compute.aio.ComputeClient`'s + :attr:`virtual_machine_run_commands` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @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. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_name: The name of the VirtualMachine. Required. + :type vm_name: str + :param run_command_name: The name of the VirtualMachineRunCommand. Required. + :type run_command_name: str + :keyword expand: The expand expression to apply on the operation. Default value is None. + :paramtype expand: str + :return: VirtualMachineRunCommand. The VirtualMachineRunCommand is compatible with + MutableMapping + :rtype: ~azure.mgmt.compute.models.VirtualMachineRunCommand + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.VirtualMachineRunCommand] = kwargs.pop("cls", None) + + _request = build_virtual_machine_run_commands_get_by_virtual_machine_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + run_command_name=run_command_name, + subscription_id=self._config.subscription_id, + expand=expand, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.VirtualMachineRunCommand, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _create_or_update_initial( + self, + resource_group_name: str, + vm_name: str, + run_command_name: str, + body: Union[_models.VirtualMachineRunCommand, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_virtual_machine_run_commands_create_or_update_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + run_command_name=run_command_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 201: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + vm_name: str, + run_command_name: str, + body: _models.VirtualMachineRunCommand, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """The operation to create or update the run command. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_name: The name of the VirtualMachine. Required. + :type vm_name: str + :param run_command_name: The name of the VirtualMachineRunCommand. Required. + :type run_command_name: str + :param body: Parameters supplied to the Create Virtual Machine RunCommand operation. Required. + :type body: ~azure.mgmt.compute.models.VirtualMachineRunCommand + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + vm_name: str, + run_command_name: str, + body: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """The operation to create or update the run command. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_name: The name of the VirtualMachine. Required. + :type vm_name: str + :param run_command_name: The name of the VirtualMachineRunCommand. Required. + :type run_command_name: str + :param body: Parameters supplied to the Create Virtual Machine RunCommand operation. Required. + :type body: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + vm_name: str, + run_command_name: str, + body: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """The operation to create or update the run command. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_name: The name of the VirtualMachine. Required. + :type vm_name: str + :param run_command_name: The name of the VirtualMachineRunCommand. Required. + :type run_command_name: str + :param body: Parameters supplied to the Create Virtual Machine RunCommand operation. Required. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + vm_name: str, + run_command_name: str, + body: Union[_models.VirtualMachineRunCommand, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[None]: + """The operation to create or update the run command. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_name: The name of the VirtualMachine. Required. + :type vm_name: str + :param run_command_name: The name of the VirtualMachineRunCommand. Required. + :type run_command_name: str + :param body: Parameters supplied to the Create Virtual Machine RunCommand operation. Is one of + the following types: VirtualMachineRunCommand, JSON, IO[bytes] Required. + :type body: ~azure.mgmt.compute.models.VirtualMachineRunCommand or JSON or IO[bytes] + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._create_or_update_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + run_command_name=run_command_name, + body=body, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + async def _update_initial( + self, + resource_group_name: str, + vm_name: str, + run_command_name: str, + body: Union[_models.VirtualMachineRunCommandUpdate, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_virtual_machine_run_commands_update_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + run_command_name=run_command_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_update( + self, + resource_group_name: str, + vm_name: str, + run_command_name: str, + body: _models.VirtualMachineRunCommandUpdate, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """The operation to update the run command. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_name: The name of the VirtualMachine. Required. + :type vm_name: str + :param run_command_name: The name of the VirtualMachineRunCommand. Required. + :type run_command_name: str + :param body: Parameters supplied to the Update Virtual Machine RunCommand operation. Required. + :type body: ~azure.mgmt.compute.models.VirtualMachineRunCommandUpdate + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update( + self, + resource_group_name: str, + vm_name: str, + run_command_name: str, + body: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """The operation to update the run command. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_name: The name of the VirtualMachine. Required. + :type vm_name: str + :param run_command_name: The name of the VirtualMachineRunCommand. Required. + :type run_command_name: str + :param body: Parameters supplied to the Update Virtual Machine RunCommand operation. Required. + :type body: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update( + self, + resource_group_name: str, + vm_name: str, + run_command_name: str, + body: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """The operation to update the run command. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_name: The name of the VirtualMachine. Required. + :type vm_name: str + :param run_command_name: The name of the VirtualMachineRunCommand. Required. + :type run_command_name: str + :param body: Parameters supplied to the Update Virtual Machine RunCommand operation. Required. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_update( + self, + resource_group_name: str, + vm_name: str, + run_command_name: str, + body: Union[_models.VirtualMachineRunCommandUpdate, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[None]: + """The operation to update the run command. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_name: The name of the VirtualMachine. Required. + :type vm_name: str + :param run_command_name: The name of the VirtualMachineRunCommand. Required. + :type run_command_name: str + :param body: Parameters supplied to the Update Virtual Machine RunCommand operation. Is one of + the following types: VirtualMachineRunCommandUpdate, JSON, IO[bytes] Required. + :type body: ~azure.mgmt.compute.models.VirtualMachineRunCommandUpdate or JSON or IO[bytes] + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._update_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + run_command_name=run_command_name, + body=body, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + async def _delete_initial( + self, resource_group_name: str, vm_name: str, run_command_name: str, **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_virtual_machine_run_commands_delete_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=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_delete( + 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. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_name: The name of the VirtualMachine. Required. + :type vm_name: str + :param run_command_name: The name of the VirtualMachineRunCommand. Required. + :type run_command_name: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + run_command_name=run_command_name, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace + def list_by_virtual_machine( + self, resource_group_name: str, vm_name: str, *, expand: Optional[str] = None, **kwargs: Any + ) -> AsyncItemPaged["_models.VirtualMachineRunCommand"]: + """The operation to get all run commands of a Virtual Machine. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_name: The name of the VirtualMachine. Required. + :type vm_name: str + :keyword expand: The expand expression to apply on the operation. Default value is None. + :paramtype expand: str + :return: An iterator like instance of VirtualMachineRunCommand + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.models.VirtualMachineRunCommand] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.VirtualMachineRunCommand]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_virtual_machine_run_commands_list_by_virtual_machine_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + expand=expand, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.VirtualMachineRunCommand], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + +class VirtualMachineScaleSetVMRunCommandsOperations: # pylint: disable=name-too-long + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.compute.aio.ComputeClient`'s + :attr:`virtual_machine_scale_set_vm_run_commands` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @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. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VirtualMachineScaleSet. Required. + :type vm_scale_set_name: str + :param instance_id: The name of the VirtualMachineScaleSetVM. Required. + :type instance_id: str + :param run_command_name: The name of the VirtualMachineRunCommand. Required. + :type run_command_name: str + :keyword expand: The expand expression to apply on the operation. Default value is None. + :paramtype expand: str + :return: VirtualMachineRunCommand. The VirtualMachineRunCommand is compatible with + MutableMapping + :rtype: ~azure.mgmt.compute.models.VirtualMachineRunCommand + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.VirtualMachineRunCommand] = kwargs.pop("cls", None) + + _request = build_virtual_machine_scale_set_vm_run_commands_get_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + run_command_name=run_command_name, + subscription_id=self._config.subscription_id, + expand=expand, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.VirtualMachineRunCommand, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _create_or_update_initial( + self, + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + run_command_name: str, + body: Union[_models.VirtualMachineRunCommand, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_virtual_machine_scale_set_vm_run_commands_create_or_update_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, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 201: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + run_command_name: str, + body: _models.VirtualMachineRunCommand, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """The operation to create or update the VMSS VM run command. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VirtualMachineScaleSet. Required. + :type vm_scale_set_name: str + :param instance_id: The name of the VirtualMachineScaleSetVM. Required. + :type instance_id: str + :param run_command_name: The name of the VirtualMachineRunCommand. Required. + :type run_command_name: str + :param body: Parameters supplied to the Create Virtual Machine RunCommand operation. Required. + :type body: ~azure.mgmt.compute.models.VirtualMachineRunCommand + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + run_command_name: str, + body: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """The operation to create or update the VMSS VM run command. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VirtualMachineScaleSet. Required. + :type vm_scale_set_name: str + :param instance_id: The name of the VirtualMachineScaleSetVM. Required. + :type instance_id: str + :param run_command_name: The name of the VirtualMachineRunCommand. Required. + :type run_command_name: str + :param body: Parameters supplied to the Create Virtual Machine RunCommand operation. Required. + :type body: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + run_command_name: str, + body: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """The operation to create or update the VMSS VM run command. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VirtualMachineScaleSet. Required. + :type vm_scale_set_name: str + :param instance_id: The name of the VirtualMachineScaleSetVM. Required. + :type instance_id: str + :param run_command_name: The name of the VirtualMachineRunCommand. Required. + :type run_command_name: str + :param body: Parameters supplied to the Create Virtual Machine RunCommand operation. Required. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @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, + body: Union[_models.VirtualMachineRunCommand, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[None]: + """The operation to create or update the VMSS VM run command. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VirtualMachineScaleSet. Required. + :type vm_scale_set_name: str + :param instance_id: The name of the VirtualMachineScaleSetVM. Required. + :type instance_id: str + :param run_command_name: The name of the VirtualMachineRunCommand. Required. + :type run_command_name: str + :param body: Parameters supplied to the Create Virtual Machine RunCommand operation. Is one of + the following types: VirtualMachineRunCommand, JSON, IO[bytes] Required. + :type body: ~azure.mgmt.compute.models.VirtualMachineRunCommand or JSON or IO[bytes] + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._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, + body=body, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + async def _update_initial( + self, + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + run_command_name: str, + body: Union[_models.VirtualMachineRunCommandUpdate, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_virtual_machine_scale_set_vm_run_commands_update_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, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_update( + self, + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + run_command_name: str, + body: _models.VirtualMachineRunCommandUpdate, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """The operation to update the VMSS VM run command. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VirtualMachineScaleSet. Required. + :type vm_scale_set_name: str + :param instance_id: The name of the VirtualMachineScaleSetVM. Required. + :type instance_id: str + :param run_command_name: The name of the VirtualMachineRunCommand. Required. + :type run_command_name: str + :param body: Resource create parameters. Required. + :type body: ~azure.mgmt.compute.models.VirtualMachineRunCommandUpdate + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update( + self, + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + run_command_name: str, + body: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """The operation to update the VMSS VM run command. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VirtualMachineScaleSet. Required. + :type vm_scale_set_name: str + :param instance_id: The name of the VirtualMachineScaleSetVM. Required. + :type instance_id: str + :param run_command_name: The name of the VirtualMachineRunCommand. Required. + :type run_command_name: str + :param body: Resource create parameters. Required. + :type body: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update( + self, + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + run_command_name: str, + body: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """The operation to update the VMSS VM run command. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VirtualMachineScaleSet. Required. + :type vm_scale_set_name: str + :param instance_id: The name of the VirtualMachineScaleSetVM. Required. + :type instance_id: str + :param run_command_name: The name of the VirtualMachineRunCommand. Required. + :type run_command_name: str + :param body: Resource create parameters. Required. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_update( + self, + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + run_command_name: str, + body: Union[_models.VirtualMachineRunCommandUpdate, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[None]: + """The operation to update the VMSS VM run command. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VirtualMachineScaleSet. Required. + :type vm_scale_set_name: str + :param instance_id: The name of the VirtualMachineScaleSetVM. Required. + :type instance_id: str + :param run_command_name: The name of the VirtualMachineRunCommand. Required. + :type run_command_name: str + :param body: Resource create parameters. Is one of the following types: + VirtualMachineRunCommandUpdate, JSON, IO[bytes] Required. + :type body: ~azure.mgmt.compute.models.VirtualMachineRunCommandUpdate or JSON or IO[bytes] + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._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, + body=body, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + async def _delete_initial( + self, resource_group_name: str, vm_scale_set_name: str, instance_id: str, run_command_name: str, **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_virtual_machine_scale_set_vm_run_commands_delete_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=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_delete( + 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. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VirtualMachineScaleSet. Required. + :type vm_scale_set_name: str + :param instance_id: The name of the VirtualMachineScaleSetVM. Required. + :type instance_id: str + :param run_command_name: The name of the VirtualMachineRunCommand. Required. + :type run_command_name: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + run_command_name=run_command_name, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # 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 + ) -> AsyncItemPaged["_models.VirtualMachineRunCommand"]: + """The operation to get all run commands of an instance in Virtual Machine Scaleset. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VirtualMachineScaleSet. Required. + :type vm_scale_set_name: str + :param instance_id: The name of the VirtualMachineScaleSetVM. Required. + :type instance_id: str + :keyword expand: The expand expression to apply on the operation. Default value is None. + :paramtype expand: str + :return: An iterator like instance of VirtualMachineRunCommand + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.models.VirtualMachineRunCommand] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.VirtualMachineRunCommand]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_virtual_machine_scale_set_vm_run_commands_list_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + expand=expand, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.VirtualMachineRunCommand], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + +class UsageOperationGroupOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.compute.aio.ComputeClient`'s + :attr:`usage_operation_group` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list(self, location: str, **kwargs: Any) -> AsyncItemPaged["_models.Usage"]: + """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 name. Required. + :type location: str + :return: An iterator like instance of Usage + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.models.Usage] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.Usage]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_usage_operation_group_list_request( + location=location, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.Usage], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + +class VirtualMachineSizesOperationGroupOperations: # pylint: disable=name-too-long + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.compute.aio.ComputeClient`'s + :attr:`virtual_machine_sizes_operation_group` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list(self, location: str, **kwargs: Any) -> AsyncItemPaged["_models.VirtualMachineSize"]: + """This API is deprecated. Use `Resources Skus + `_. + + :param location: The location name. Required. + :type location: str + :return: An iterator like instance of VirtualMachineSize + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.models.VirtualMachineSize] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.VirtualMachineSize]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_virtual_machine_sizes_operation_group_list_request( + location=location, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.VirtualMachineSize], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + +class VirtualMachineScaleSetsOperationGroupOperations: # pylint: disable=name-too-long + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.compute.aio.ComputeClient`'s + :attr:`virtual_machine_scale_sets_operation_group` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list_by_location(self, location: str, **kwargs: Any) -> AsyncItemPaged["_models.VirtualMachineScaleSet"]: + """Gets all the VM scale sets under the specified subscription for the specified location. + + :param location: The location name. Required. + :type location: str + :return: An iterator like instance of VirtualMachineScaleSet + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.models.VirtualMachineScaleSet] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.VirtualMachineScaleSet]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_virtual_machine_scale_sets_operation_group_list_by_location_request( + location=location, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.VirtualMachineScaleSet], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + +class VirtualMachinesOperationGroupOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.compute.aio.ComputeClient`'s + :attr:`virtual_machines_operation_group` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list_by_location(self, location: str, **kwargs: Any) -> AsyncItemPaged["_models.VirtualMachine"]: + """Gets all the virtual machines under the specified subscription for the specified location. + + :param location: The location name. Required. + :type location: str + :return: An iterator like instance of VirtualMachine + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.models.VirtualMachine] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.VirtualMachine]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_virtual_machines_operation_group_list_by_location_request( + location=location, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.VirtualMachine], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + +class VirtualMachineImagesEdgeZoneOperationGroupOperations: # pylint: disable=name-too-long + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.compute.aio.ComputeClient`'s + :attr:`virtual_machine_images_edge_zone_operation_group` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @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 location name. Required. + :type location: str + :param edge_zone: The name of the edge zone. Required. + :type edge_zone: str + :return: list of VirtualMachineImageResource + :rtype: list[~azure.mgmt.compute.models.VirtualMachineImageResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.VirtualMachineImageResource]] = kwargs.pop("cls", None) + + _request = build_virtual_machine_images_edge_zone_operation_group_list_publishers_request( + location=location, + edge_zone=edge_zone, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(List[_models.VirtualMachineImageResource], response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # 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 location name. Required. + :type location: str + :param edge_zone: The name of the edge zone. Required. + :type edge_zone: str + :param publisher_name: A valid image publisher. Required. + :type publisher_name: str + :return: list of VirtualMachineImageResource + :rtype: list[~azure.mgmt.compute.models.VirtualMachineImageResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.VirtualMachineImageResource]] = kwargs.pop("cls", None) + + _request = build_virtual_machine_images_edge_zone_operation_group_list_offers_request( + location=location, + edge_zone=edge_zone, + publisher_name=publisher_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(List[_models.VirtualMachineImageResource], response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # 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 location name. Required. + :type location: str + :param edge_zone: The name of the edge zone. Required. + :type edge_zone: str + :param publisher_name: A valid image publisher. Required. + :type publisher_name: str + :param offer: A valid image publisher offer. Required. + :type offer: str + :return: list of VirtualMachineImageResource + :rtype: list[~azure.mgmt.compute.models.VirtualMachineImageResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.VirtualMachineImageResource]] = kwargs.pop("cls", None) + + _request = build_virtual_machine_images_edge_zone_operation_group_list_skus_request( + location=location, + edge_zone=edge_zone, + publisher_name=publisher_name, + offer=offer, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(List[_models.VirtualMachineImageResource], response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # 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 location name. Required. + :type location: str + :param edge_zone: The name of the edge zone. Required. + :type edge_zone: str + :param publisher_name: A valid image publisher. Required. + :type publisher_name: str + :param offer: A valid image publisher offer. Required. + :type offer: str + :param skus: A valid image SKU. Required. + :type skus: str + :keyword expand: The expand expression to apply on the operation. Default value is None. + :paramtype expand: str + :keyword top: An integer value specifying the number of images to return that matches supplied + values. Default value is None. + :paramtype top: int + :keyword orderby: Specifies the order of the results returned. Formatted as an OData query. + Default value is None. + :paramtype orderby: str + :return: list of VirtualMachineImageResource + :rtype: list[~azure.mgmt.compute.models.VirtualMachineImageResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.VirtualMachineImageResource]] = kwargs.pop("cls", None) + + _request = build_virtual_machine_images_edge_zone_operation_group_list_request( + location=location, + edge_zone=edge_zone, + publisher_name=publisher_name, + offer=offer, + skus=skus, + subscription_id=self._config.subscription_id, + expand=expand, + top=top, + orderby=orderby, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(List[_models.VirtualMachineImageResource], response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @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 the Azure region. Required. + :type location: str + :param edge_zone: The name of the edge zone. Required. + :type edge_zone: str + :param publisher_name: A valid image publisher. Required. + :type publisher_name: str + :param offer: A valid image publisher offer. Required. + :type offer: str + :param skus: A valid image SKU. Required. + :type skus: str + :param version: A valid image SKU version. Required. + :type version: str + :return: VirtualMachineImage. The VirtualMachineImage is compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.VirtualMachineImage + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.VirtualMachineImage] = kwargs.pop("cls", None) + + _request = build_virtual_machine_images_edge_zone_operation_group_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=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.VirtualMachineImage, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + +class VirtualMachineImagesOperationGroupOperations: # pylint: disable=name-too-long + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.compute.aio.ComputeClient`'s + :attr:`virtual_machine_images_operation_group` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace_async + async def list_by_edge_zone( + self, location: str, edge_zone: str, **kwargs: Any + ) -> _models.VmImagesInEdgeZoneListResult: + """Gets a list of all virtual machine image versions for the specified edge zone. + + :param location: The location name. Required. + :type location: str + :param edge_zone: The name of the edge zone. Required. + :type edge_zone: str + :return: VmImagesInEdgeZoneListResult. The VmImagesInEdgeZoneListResult is compatible with + MutableMapping + :rtype: ~azure.mgmt.compute.models.VmImagesInEdgeZoneListResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.VmImagesInEdgeZoneListResult] = kwargs.pop("cls", None) + + _request = build_virtual_machine_images_operation_group_list_by_edge_zone_request( + location=location, + edge_zone=edge_zone, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.VmImagesInEdgeZoneListResult, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # 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 location name. Required. + :type location: str + :return: list of VirtualMachineImageResource + :rtype: list[~azure.mgmt.compute.models.VirtualMachineImageResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.VirtualMachineImageResource]] = kwargs.pop("cls", None) + + _request = build_virtual_machine_images_operation_group_list_publishers_request( + location=location, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(List[_models.VirtualMachineImageResource], response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # 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 location name. Required. + :type location: str + :param publisher_name: A valid image publisher. Required. + :type publisher_name: str + :return: list of VirtualMachineImageResource + :rtype: list[~azure.mgmt.compute.models.VirtualMachineImageResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.VirtualMachineImageResource]] = kwargs.pop("cls", None) + + _request = build_virtual_machine_images_operation_group_list_offers_request( + location=location, + publisher_name=publisher_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(List[_models.VirtualMachineImageResource], response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # 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 location name. Required. + :type location: str + :param publisher_name: A valid image publisher. Required. + :type publisher_name: str + :param offer: A valid image publisher offer. Required. + :type offer: str + :return: list of VirtualMachineImageResource + :rtype: list[~azure.mgmt.compute.models.VirtualMachineImageResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.VirtualMachineImageResource]] = kwargs.pop("cls", None) + + _request = build_virtual_machine_images_operation_group_list_skus_request( + location=location, + publisher_name=publisher_name, + offer=offer, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(List[_models.VirtualMachineImageResource], response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # 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 location name. Required. + :type location: str + :param publisher_name: A valid image publisher. Required. + :type publisher_name: str + :param offer: A valid image publisher offer. Required. + :type offer: str + :param skus: A valid image SKU. Required. + :type skus: str + :keyword expand: The expand expression to apply on the operation. Default value is None. + :paramtype expand: str + :keyword top: Default value is None. + :paramtype top: int + :keyword orderby: Default value is None. + :paramtype orderby: str + :return: list of VirtualMachineImageResource + :rtype: list[~azure.mgmt.compute.models.VirtualMachineImageResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.VirtualMachineImageResource]] = kwargs.pop("cls", None) + + _request = build_virtual_machine_images_operation_group_list_request( + location=location, + publisher_name=publisher_name, + offer=offer, + skus=skus, + subscription_id=self._config.subscription_id, + expand=expand, + top=top, + orderby=orderby, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(List[_models.VirtualMachineImageResource], response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def list_with_properties( + self, + location: str, + publisher_name: str, + offer: str, + skus: str, + *, + expand: str, + top: Optional[int] = None, + orderby: Optional[str] = None, + **kwargs: Any + ) -> List[_models.VirtualMachineImage]: + """list_with_properties. + + :param location: The location name. Required. + :type location: str + :param publisher_name: A valid image publisher. Required. + :type publisher_name: str + :param offer: A valid image publisher offer. Required. + :type offer: str + :param skus: A valid image SKU. Required. + :type skus: str + :keyword expand: The expand expression to apply on the operation. Required. + :paramtype expand: str + :keyword top: Default value is None. + :paramtype top: int + :keyword orderby: Default value is None. + :paramtype orderby: str + :return: list of VirtualMachineImage + :rtype: list[~azure.mgmt.compute.models.VirtualMachineImage] + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.VirtualMachineImage]] = kwargs.pop("cls", None) + + _request = build_virtual_machine_images_operation_group_list_with_properties_request( + location=location, + publisher_name=publisher_name, + offer=offer, + skus=skus, + subscription_id=self._config.subscription_id, + expand=expand, + top=top, + orderby=orderby, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(List[_models.VirtualMachineImage], response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @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 the Azure region. Required. + :type location: str + :param publisher_name: A valid image publisher. Required. + :type publisher_name: str + :param offer: A valid image publisher offer. Required. + :type offer: str + :param skus: A valid image SKU. Required. + :type skus: str + :param version: A valid image SKU version. Required. + :type version: str + :return: VirtualMachineImage. The VirtualMachineImage is compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.VirtualMachineImage + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.VirtualMachineImage] = kwargs.pop("cls", None) + + _request = build_virtual_machine_images_operation_group_get_request( + location=location, + publisher_name=publisher_name, + offer=offer, + skus=skus, + version=version, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.VirtualMachineImage, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + +class LogAnalyticsOperationGroupOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.compute.aio.ComputeClient`'s + :attr:`log_analytics_operation_group` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + async def _export_request_rate_by_interval_initial( + self, location: str, body: Union[_models.RequestRateByIntervalInput, JSON, IO[bytes]], **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_log_analytics_operation_group_export_request_rate_by_interval_request( + location=location, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_export_request_rate_by_interval( + self, + location: str, + body: _models.RequestRateByIntervalInput, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Export logs that show Api requests made by this subscription in the given time window to show + throttling activities. + + :param location: The location name. Required. + :type location: str + :param body: Parameters supplied to the LogAnalytics getRequestRateByInterval Api. Required. + :type body: ~azure.mgmt.compute.models.RequestRateByIntervalInput + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_export_request_rate_by_interval( + self, location: str, body: JSON, *, content_type: str = "application/json", **kwargs: Any + ) -> AsyncLROPoller[None]: + """Export logs that show Api requests made by this subscription in the given time window to show + throttling activities. + + :param location: The location name. Required. + :type location: str + :param body: Parameters supplied to the LogAnalytics getRequestRateByInterval Api. Required. + :type body: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_export_request_rate_by_interval( + self, location: str, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any + ) -> AsyncLROPoller[None]: + """Export logs that show Api requests made by this subscription in the given time window to show + throttling activities. + + :param location: The location name. Required. + :type location: str + :param body: Parameters supplied to the LogAnalytics getRequestRateByInterval Api. Required. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_export_request_rate_by_interval( + self, location: str, body: Union[_models.RequestRateByIntervalInput, JSON, IO[bytes]], **kwargs: Any + ) -> AsyncLROPoller[None]: + """Export logs that show Api requests made by this subscription in the given time window to show + throttling activities. + + :param location: The location name. Required. + :type location: str + :param body: Parameters supplied to the LogAnalytics getRequestRateByInterval Api. Is one of + the following types: RequestRateByIntervalInput, JSON, IO[bytes] Required. + :type body: ~azure.mgmt.compute.models.RequestRateByIntervalInput or JSON or IO[bytes] + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._export_request_rate_by_interval_initial( + location=location, + body=body, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + async def _export_throttled_requests_initial( + self, location: str, body: Union[_models.ThrottledRequestsInput, JSON, IO[bytes]], **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_log_analytics_operation_group_export_throttled_requests_request( + location=location, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_export_throttled_requests( + self, + location: str, + body: _models.ThrottledRequestsInput, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Export logs that show total throttled Api requests for this subscription in the given time + window. + + :param location: The location name. Required. + :type location: str + :param body: The request body. Required. + :type body: ~azure.mgmt.compute.models.ThrottledRequestsInput + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_export_throttled_requests( + self, location: str, body: JSON, *, content_type: str = "application/json", **kwargs: Any + ) -> AsyncLROPoller[None]: + """Export logs that show total throttled Api requests for this subscription in the given time + window. + + :param location: The location name. Required. + :type location: str + :param body: The request body. Required. + :type body: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_export_throttled_requests( + self, location: str, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any + ) -> AsyncLROPoller[None]: + """Export logs that show total throttled Api requests for this subscription in the given time + window. + + :param location: The location name. Required. + :type location: str + :param body: The request body. Required. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_export_throttled_requests( + self, location: str, body: Union[_models.ThrottledRequestsInput, JSON, IO[bytes]], **kwargs: Any + ) -> AsyncLROPoller[None]: + """Export logs that show total throttled Api requests for this subscription in the given time + window. + + :param location: The location name. Required. + :type location: str + :param body: The request body. Is one of the following types: ThrottledRequestsInput, JSON, + IO[bytes] Required. + :type body: ~azure.mgmt.compute.models.ThrottledRequestsInput or JSON or IO[bytes] + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._export_throttled_requests_initial( + location=location, + body=body, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + +class VirtualMachineRunCommandsOperationGroupOperations: # pylint: disable=name-too-long + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.compute.aio.ComputeClient`'s + :attr:`virtual_machine_run_commands_operation_group` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list(self, location: str, **kwargs: Any) -> AsyncItemPaged["_models.RunCommandDocumentBase"]: + """Lists all available run commands for a subscription in a location. + + :param location: The location name. Required. + :type location: str + :return: An iterator like instance of RunCommandDocumentBase + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.models.RunCommandDocumentBase] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.RunCommandDocumentBase]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_virtual_machine_run_commands_operation_group_list_request( + location=location, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.RunCommandDocumentBase], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + @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 name of the Azure region. Required. + :type location: str + :param command_id: Specifies a commandId of predefined built-in script. Command IDs available + for Linux are listed at `https://aka.ms/RunCommandManagedLinux#available-commands + `_, Windows at + `https://aka.ms/RunCommandManagedWindows#available-commands + `_. Required. + :type command_id: str + :return: RunCommandDocument. The RunCommandDocument is compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.RunCommandDocument + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.RunCommandDocument] = kwargs.pop("cls", None) + + _request = build_virtual_machine_run_commands_operation_group_get_request( + location=location, + command_id=command_id, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.RunCommandDocument, response.json()) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + +class DisksOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.compute.aio.ComputeClient`'s + :attr:`disks` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace_async + async def get(self, resource_group_name: str, disk_name: str, **kwargs: Any) -> _models.Disk: + """Gets information about a disk. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param disk_name: The name of the managed disk that is being created. The name can't be changed + after the disk is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The + maximum name length is 80 characters. Required. + :type disk_name: str + :return: Disk. The Disk is compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.Disk + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.Disk] = kwargs.pop("cls", None) + + _request = build_disks_get_request( + resource_group_name=resource_group_name, + disk_name=disk_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.Disk, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _create_or_update_initial( + self, resource_group_name: str, disk_name: str, resource: Union[_models.Disk, JSON, IO[bytes]], **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(resource, (IOBase, bytes)): + _content = resource + else: + _content = json.dumps(resource, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_disks_create_or_update_request( + resource_group_name=resource_group_name, + disk_name=disk_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + disk_name: str, + resource: _models.Disk, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Creates or updates a disk. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param disk_name: The name of the managed disk that is being created. The name can't be changed + after the disk is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The + maximum name length is 80 characters. Required. + :type disk_name: str + :param resource: Disk object supplied in the body of the Put disk operation. Required. + :type resource: ~azure.mgmt.compute.models.Disk + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + disk_name: str, + resource: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Creates or updates a disk. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param disk_name: The name of the managed disk that is being created. The name can't be changed + after the disk is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The + maximum name length is 80 characters. Required. + :type disk_name: str + :param resource: Disk object supplied in the body of the Put disk operation. Required. + :type resource: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + disk_name: str, + resource: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Creates or updates a disk. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param disk_name: The name of the managed disk that is being created. The name can't be changed + after the disk is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The + maximum name length is 80 characters. Required. + :type disk_name: str + :param resource: Disk object supplied in the body of the Put disk operation. Required. + :type resource: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, resource_group_name: str, disk_name: str, resource: Union[_models.Disk, JSON, IO[bytes]], **kwargs: Any + ) -> AsyncLROPoller[None]: + """Creates or updates a disk. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param disk_name: The name of the managed disk that is being created. The name can't be changed + after the disk is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The + maximum name length is 80 characters. Required. + :type disk_name: str + :param resource: Disk object supplied in the body of the Put disk operation. Is one of the + following types: Disk, JSON, IO[bytes] Required. + :type resource: ~azure.mgmt.compute.models.Disk or JSON or IO[bytes] + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._create_or_update_initial( + resource_group_name=resource_group_name, + disk_name=disk_name, + resource=resource, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + async def _update_initial( + self, + resource_group_name: str, + disk_name: str, + properties: Union[_models.DiskUpdate, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(properties, (IOBase, bytes)): + _content = properties + else: + _content = json.dumps(properties, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_disks_update_request( + resource_group_name=resource_group_name, + disk_name=disk_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_update( + self, + resource_group_name: str, + disk_name: str, + properties: _models.DiskUpdate, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Updates (patches) a disk. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param disk_name: The name of the managed disk that is being created. The name can't be changed + after the disk is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The + maximum name length is 80 characters. Required. + :type disk_name: str + :param properties: Disk object supplied in the body of the Patch disk operation. Required. + :type properties: ~azure.mgmt.compute.models.DiskUpdate + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update( + self, + resource_group_name: str, + disk_name: str, + properties: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Updates (patches) a disk. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param disk_name: The name of the managed disk that is being created. The name can't be changed + after the disk is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The + maximum name length is 80 characters. Required. + :type disk_name: str + :param properties: Disk object supplied in the body of the Patch disk operation. Required. + :type properties: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update( + self, + resource_group_name: str, + disk_name: str, + properties: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Updates (patches) a disk. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param disk_name: The name of the managed disk that is being created. The name can't be changed + after the disk is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The + maximum name length is 80 characters. Required. + :type disk_name: str + :param properties: Disk object supplied in the body of the Patch disk operation. Required. + :type properties: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_update( + self, + resource_group_name: str, + disk_name: str, + properties: Union[_models.DiskUpdate, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Updates (patches) a disk. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param disk_name: The name of the managed disk that is being created. The name can't be changed + after the disk is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The + maximum name length is 80 characters. Required. + :type disk_name: str + :param properties: Disk object supplied in the body of the Patch disk operation. Is one of the + following types: DiskUpdate, JSON, IO[bytes] Required. + :type properties: ~azure.mgmt.compute.models.DiskUpdate or JSON or IO[bytes] + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._update_initial( + resource_group_name=resource_group_name, + disk_name=disk_name, + properties=properties, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + async def _delete_initial(self, resource_group_name: str, disk_name: str, **kwargs: Any) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_disks_delete_request( + resource_group_name=resource_group_name, + disk_name=disk_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_delete(self, resource_group_name: str, disk_name: str, **kwargs: Any) -> AsyncLROPoller[None]: + """Deletes a disk. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param disk_name: The name of the managed disk that is being created. The name can't be changed + after the disk is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The + maximum name length is 80 characters. Required. + :type disk_name: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + disk_name=disk_name, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace + def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> AsyncItemPaged["_models.Disk"]: + """Lists all the disks under a resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :return: An iterator like instance of Disk + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.models.Disk] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.Disk]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_disks_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.Disk], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + @distributed_trace + def list(self, **kwargs: Any) -> AsyncItemPaged["_models.Disk"]: + """Lists all the disks under a subscription. + + :return: An iterator like instance of Disk + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.models.Disk] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.Disk]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_disks_list_request( + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.Disk], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + async def _grant_access_initial( + self, + resource_group_name: str, + disk_name: str, + body: Union[_models.GrantAccessData, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_disks_grant_access_request( + resource_group_name=resource_group_name, + disk_name=disk_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_grant_access( + self, + resource_group_name: str, + disk_name: str, + body: _models.GrantAccessData, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.AccessUri]: + """Grants access to a disk. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param disk_name: The name of the managed disk that is being created. The name can't be changed + after the disk is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The + maximum name length is 80 characters. Required. + :type disk_name: str + :param body: Access data object supplied in the body of the get disk access operation. + Required. + :type body: ~azure.mgmt.compute.models.GrantAccessData + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns AccessUri. The AccessUri is compatible with + MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.AccessUri] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_grant_access( + self, + resource_group_name: str, + disk_name: str, + body: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.AccessUri]: + """Grants access to a disk. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param disk_name: The name of the managed disk that is being created. The name can't be changed + after the disk is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The + maximum name length is 80 characters. Required. + :type disk_name: str + :param body: Access data object supplied in the body of the get disk access operation. + Required. + :type body: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns AccessUri. The AccessUri is compatible with + MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.AccessUri] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_grant_access( + self, + resource_group_name: str, + disk_name: str, + body: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.AccessUri]: + """Grants access to a disk. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param disk_name: The name of the managed disk that is being created. The name can't be changed + after the disk is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The + maximum name length is 80 characters. Required. + :type disk_name: str + :param body: Access data object supplied in the body of the get disk access operation. + Required. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns AccessUri. The AccessUri is compatible with + MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.AccessUri] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_grant_access( + self, + resource_group_name: str, + disk_name: str, + body: Union[_models.GrantAccessData, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.AccessUri]: + """Grants access to a disk. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param disk_name: The name of the managed disk that is being created. The name can't be changed + after the disk is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The + maximum name length is 80 characters. Required. + :type disk_name: str + :param body: Access data object supplied in the body of the get disk access operation. Is one + of the following types: GrantAccessData, JSON, IO[bytes] Required. + :type body: ~azure.mgmt.compute.models.GrantAccessData or JSON or IO[bytes] + :return: An instance of AsyncLROPoller that returns AccessUri. The AccessUri is compatible with + MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.AccessUri] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AccessUri] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._grant_access_initial( + resource_group_name=resource_group_name, + disk_name=disk_name, + body=body, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = _deserialize(_models.AccessUri, response.json()) + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.AccessUri].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.AccessUri]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _revoke_access_initial( + self, resource_group_name: str, disk_name: str, **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_disks_revoke_access_request( + resource_group_name=resource_group_name, + disk_name=disk_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_revoke_access( + self, resource_group_name: str, disk_name: str, **kwargs: Any + ) -> AsyncLROPoller[_models.OkResponse]: + """Revokes access to a disk. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param disk_name: The name of the managed disk that is being created. The name can't be changed + after the disk is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The + maximum name length is 80 characters. Required. + :type disk_name: str + :return: An instance of AsyncLROPoller that returns OkResponse. The OkResponse is compatible + with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.OkResponse] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.OkResponse] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._revoke_access_initial( + resource_group_name=resource_group_name, + disk_name=disk_name, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = _deserialize(_models.OkResponse, response.json()) + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.OkResponse].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.OkResponse]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + +class DiskAccessesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.compute.aio.ComputeClient`'s + :attr:`disk_accesses` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace_async + async def get(self, resource_group_name: str, disk_access_name: str, **kwargs: Any) -> _models.DiskAccess: + """Gets information about a disk access resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param disk_access_name: The name of the disk access resource that is being created. The name + can't be changed after the disk encryption set is created. Supported characters for the name + are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. + :type disk_access_name: str + :return: DiskAccess. The DiskAccess is compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.DiskAccess + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.DiskAccess] = kwargs.pop("cls", None) + + _request = build_disk_accesses_get_request( + resource_group_name=resource_group_name, + disk_access_name=disk_access_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.DiskAccess, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _create_or_update_initial( + self, + resource_group_name: str, + disk_access_name: str, + resource: Union[_models.DiskAccess, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(resource, (IOBase, bytes)): + _content = resource + else: + _content = json.dumps(resource, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_disk_accesses_create_or_update_request( + resource_group_name=resource_group_name, + disk_access_name=disk_access_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + disk_access_name: str, + resource: _models.DiskAccess, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Creates or updates a disk access resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param disk_access_name: The name of the disk access resource that is being created. The name + can't be changed after the disk encryption set is created. Supported characters for the name + are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. + :type disk_access_name: str + :param resource: disk access object supplied in the body of the Put disk access operation. + Required. + :type resource: ~azure.mgmt.compute.models.DiskAccess + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + disk_access_name: str, + resource: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Creates or updates a disk access resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param disk_access_name: The name of the disk access resource that is being created. The name + can't be changed after the disk encryption set is created. Supported characters for the name + are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. + :type disk_access_name: str + :param resource: disk access object supplied in the body of the Put disk access operation. + Required. + :type resource: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + disk_access_name: str, + resource: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Creates or updates a disk access resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param disk_access_name: The name of the disk access resource that is being created. The name + can't be changed after the disk encryption set is created. Supported characters for the name + are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. + :type disk_access_name: str + :param resource: disk access object supplied in the body of the Put disk access operation. + Required. + :type resource: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + disk_access_name: str, + resource: Union[_models.DiskAccess, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Creates or updates a disk access resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param disk_access_name: The name of the disk access resource that is being created. The name + can't be changed after the disk encryption set is created. Supported characters for the name + are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. + :type disk_access_name: str + :param resource: disk access object supplied in the body of the Put disk access operation. Is + one of the following types: DiskAccess, JSON, IO[bytes] Required. + :type resource: ~azure.mgmt.compute.models.DiskAccess or JSON or IO[bytes] + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._create_or_update_initial( + resource_group_name=resource_group_name, + disk_access_name=disk_access_name, + resource=resource, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + async def _update_initial( + self, + resource_group_name: str, + disk_access_name: str, + properties: Union[_models.DiskAccessUpdate, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(properties, (IOBase, bytes)): + _content = properties + else: + _content = json.dumps(properties, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_disk_accesses_update_request( + resource_group_name=resource_group_name, + disk_access_name=disk_access_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_update( + self, + resource_group_name: str, + disk_access_name: str, + properties: _models.DiskAccessUpdate, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Updates (patches) a disk access resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param disk_access_name: The name of the disk access resource that is being created. The name + can't be changed after the disk encryption set is created. Supported characters for the name + are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. + :type disk_access_name: str + :param properties: disk access object supplied in the body of the Patch disk access operation. + Required. + :type properties: ~azure.mgmt.compute.models.DiskAccessUpdate + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update( + self, + resource_group_name: str, + disk_access_name: str, + properties: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Updates (patches) a disk access resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param disk_access_name: The name of the disk access resource that is being created. The name + can't be changed after the disk encryption set is created. Supported characters for the name + are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. + :type disk_access_name: str + :param properties: disk access object supplied in the body of the Patch disk access operation. + Required. + :type properties: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update( + self, + resource_group_name: str, + disk_access_name: str, + properties: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Updates (patches) a disk access resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param disk_access_name: The name of the disk access resource that is being created. The name + can't be changed after the disk encryption set is created. Supported characters for the name + are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. + :type disk_access_name: str + :param properties: disk access object supplied in the body of the Patch disk access operation. + Required. + :type properties: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_update( + self, + resource_group_name: str, + disk_access_name: str, + properties: Union[_models.DiskAccessUpdate, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Updates (patches) a disk access resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param disk_access_name: The name of the disk access resource that is being created. The name + can't be changed after the disk encryption set is created. Supported characters for the name + are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. + :type disk_access_name: str + :param properties: disk access object supplied in the body of the Patch disk access operation. + Is one of the following types: DiskAccessUpdate, JSON, IO[bytes] Required. + :type properties: ~azure.mgmt.compute.models.DiskAccessUpdate or JSON or IO[bytes] + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._update_initial( + resource_group_name=resource_group_name, + disk_access_name=disk_access_name, + properties=properties, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + async def _delete_initial( + self, resource_group_name: str, disk_access_name: str, **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_disk_accesses_delete_request( + resource_group_name=resource_group_name, + disk_access_name=disk_access_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_delete( + self, resource_group_name: str, disk_access_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes a disk access resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param disk_access_name: The name of the disk access resource that is being created. The name + can't be changed after the disk encryption set is created. Supported characters for the name + are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. + :type disk_access_name: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + disk_access_name=disk_access_name, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace + def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> AsyncItemPaged["_models.DiskAccess"]: + """Lists all the disk access resources under a resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :return: An iterator like instance of DiskAccess + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.models.DiskAccess] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.DiskAccess]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_disk_accesses_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.DiskAccess], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + @distributed_trace + def list(self, **kwargs: Any) -> AsyncItemPaged["_models.DiskAccess"]: + """Lists all the disk access resources under a subscription. + + :return: An iterator like instance of DiskAccess + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.models.DiskAccess] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.DiskAccess]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_disk_accesses_list_request( + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.DiskAccess], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + @distributed_trace_async + async def get_private_link_resources( + self, resource_group_name: str, disk_access_name: str, **kwargs: Any + ) -> _models.PrivateLinkResourceListResult: + """Gets the private link resources possible under disk access resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param disk_access_name: The name of the disk access resource that is being created. The name + can't be changed after the disk encryption set is created. Supported characters for the name + are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. + :type disk_access_name: str + :return: PrivateLinkResourceListResult. The PrivateLinkResourceListResult is compatible with + MutableMapping + :rtype: ~azure.mgmt.compute.models.PrivateLinkResourceListResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.PrivateLinkResourceListResult] = kwargs.pop("cls", None) + + _request = build_disk_accesses_get_private_link_resources_request( + resource_group_name=resource_group_name, + disk_access_name=disk_access_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.PrivateLinkResourceListResult, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + +class PrivateEndpointConnectionsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.compute.aio.ComputeClient`'s + :attr:`private_endpoint_connections` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace_async + async def get_a_private_endpoint_connection( + self, resource_group_name: str, disk_access_name: str, private_endpoint_connection_name: str, **kwargs: Any + ) -> _models.PrivateEndpointConnection: + """Gets information about a private endpoint connection under a disk access resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param disk_access_name: The name of the disk access resource that is being created. The name + can't be changed after the disk encryption set is created. Supported characters for the name + are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. + :type disk_access_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. + :type private_endpoint_connection_name: str + :return: PrivateEndpointConnection. The PrivateEndpointConnection is compatible with + MutableMapping + :rtype: ~azure.mgmt.compute.models.PrivateEndpointConnection + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) + + _request = build_private_endpoint_connections_get_a_private_endpoint_connection_request( + resource_group_name=resource_group_name, + disk_access_name=disk_access_name, + private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.PrivateEndpointConnection, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _update_a_private_endpoint_connection_initial( # pylint: disable=name-too-long + self, + resource_group_name: str, + disk_access_name: str, + private_endpoint_connection_name: str, + resource: Union[_models.PrivateEndpointConnection, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(resource, (IOBase, bytes)): + _content = resource + else: + _content = json.dumps(resource, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_private_endpoint_connections_update_a_private_endpoint_connection_request( + resource_group_name=resource_group_name, + disk_access_name=disk_access_name, + private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_update_a_private_endpoint_connection( # pylint: disable=name-too-long + self, + resource_group_name: str, + disk_access_name: str, + private_endpoint_connection_name: str, + resource: _models.PrivateEndpointConnection, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Approve or reject a private endpoint connection under disk access resource, this can't be used + to create a new private endpoint connection. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param disk_access_name: The name of the disk access resource that is being created. The name + can't be changed after the disk encryption set is created. Supported characters for the name + are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. + :type disk_access_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. + :type private_endpoint_connection_name: str + :param resource: private endpoint connection object supplied in the body of the Put private + endpoint connection operation. Required. + :type resource: ~azure.mgmt.compute.models.PrivateEndpointConnection + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update_a_private_endpoint_connection( # pylint: disable=name-too-long + self, + resource_group_name: str, + disk_access_name: str, + private_endpoint_connection_name: str, + resource: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Approve or reject a private endpoint connection under disk access resource, this can't be used + to create a new private endpoint connection. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param disk_access_name: The name of the disk access resource that is being created. The name + can't be changed after the disk encryption set is created. Supported characters for the name + are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. + :type disk_access_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. + :type private_endpoint_connection_name: str + :param resource: private endpoint connection object supplied in the body of the Put private + endpoint connection operation. Required. + :type resource: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update_a_private_endpoint_connection( # pylint: disable=name-too-long + self, + resource_group_name: str, + disk_access_name: str, + private_endpoint_connection_name: str, + resource: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Approve or reject a private endpoint connection under disk access resource, this can't be used + to create a new private endpoint connection. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param disk_access_name: The name of the disk access resource that is being created. The name + can't be changed after the disk encryption set is created. Supported characters for the name + are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. + :type disk_access_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. + :type private_endpoint_connection_name: str + :param resource: private endpoint connection object supplied in the body of the Put private + endpoint connection operation. Required. + :type resource: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_update_a_private_endpoint_connection( # pylint: disable=name-too-long + self, + resource_group_name: str, + disk_access_name: str, + private_endpoint_connection_name: str, + resource: Union[_models.PrivateEndpointConnection, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Approve or reject a private endpoint connection under disk access resource, this can't be used + to create a new private endpoint connection. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param disk_access_name: The name of the disk access resource that is being created. The name + can't be changed after the disk encryption set is created. Supported characters for the name + are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. + :type disk_access_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. + :type private_endpoint_connection_name: str + :param resource: private endpoint connection object supplied in the body of the Put private + endpoint connection operation. Is one of the following types: PrivateEndpointConnection, JSON, + IO[bytes] Required. + :type resource: ~azure.mgmt.compute.models.PrivateEndpointConnection or JSON or IO[bytes] + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._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, + resource=resource, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + async def _delete_a_private_endpoint_connection_initial( # pylint: disable=name-too-long + self, resource_group_name: str, disk_access_name: str, private_endpoint_connection_name: str, **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_private_endpoint_connections_delete_a_private_endpoint_connection_request( + resource_group_name=resource_group_name, + disk_access_name=disk_access_name, + private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_delete_a_private_endpoint_connection( # pylint: disable=name-too-long + self, resource_group_name: str, disk_access_name: str, private_endpoint_connection_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes a private endpoint connection under a disk access resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param disk_access_name: The name of the disk access resource that is being created. The name + can't be changed after the disk encryption set is created. Supported characters for the name + are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. + :type disk_access_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. + :type private_endpoint_connection_name: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._delete_a_private_endpoint_connection_initial( + resource_group_name=resource_group_name, + disk_access_name=disk_access_name, + private_endpoint_connection_name=private_endpoint_connection_name, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace + def list_private_endpoint_connections( + self, resource_group_name: str, disk_access_name: str, **kwargs: Any + ) -> AsyncItemPaged["_models.PrivateEndpointConnection"]: + """List information about private endpoint connections under a disk access resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param disk_access_name: The name of the disk access resource that is being created. The name + can't be changed after the disk encryption set is created. Supported characters for the name + are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. + :type disk_access_name: str + :return: An iterator like instance of PrivateEndpointConnection + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.models.PrivateEndpointConnection] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.PrivateEndpointConnection]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_private_endpoint_connections_list_private_endpoint_connections_request( + resource_group_name=resource_group_name, + disk_access_name=disk_access_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.PrivateEndpointConnection], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + +class DiskEncryptionSetsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.compute.aio.ComputeClient`'s + :attr:`disk_encryption_sets` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace_async + async def get( + self, resource_group_name: str, disk_encryption_set_name: str, **kwargs: Any + ) -> _models.DiskEncryptionSet: + """Gets information about a disk encryption set. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param disk_encryption_set_name: The name of the disk encryption set that is being created. The + name can't be changed after the disk encryption set is created. Supported characters for the + name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. + :type disk_encryption_set_name: str + :return: DiskEncryptionSet. The DiskEncryptionSet is compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.DiskEncryptionSet + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.DiskEncryptionSet] = kwargs.pop("cls", None) + + _request = build_disk_encryption_sets_get_request( + resource_group_name=resource_group_name, + disk_encryption_set_name=disk_encryption_set_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.DiskEncryptionSet, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _create_or_update_initial( + self, + resource_group_name: str, + disk_encryption_set_name: str, + resource: Union[_models.DiskEncryptionSet, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(resource, (IOBase, bytes)): + _content = resource + else: + _content = json.dumps(resource, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_disk_encryption_sets_create_or_update_request( + resource_group_name=resource_group_name, + disk_encryption_set_name=disk_encryption_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + disk_encryption_set_name: str, + resource: _models.DiskEncryptionSet, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Creates or updates a disk encryption set. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param disk_encryption_set_name: The name of the disk encryption set that is being created. The + name can't be changed after the disk encryption set is created. Supported characters for the + name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. + :type disk_encryption_set_name: str + :param resource: disk encryption set object supplied in the body of the Put disk encryption set + operation. Required. + :type resource: ~azure.mgmt.compute.models.DiskEncryptionSet + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + disk_encryption_set_name: str, + resource: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Creates or updates a disk encryption set. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param disk_encryption_set_name: The name of the disk encryption set that is being created. The + name can't be changed after the disk encryption set is created. Supported characters for the + name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. + :type disk_encryption_set_name: str + :param resource: disk encryption set object supplied in the body of the Put disk encryption set + operation. Required. + :type resource: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + disk_encryption_set_name: str, + resource: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Creates or updates a disk encryption set. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param disk_encryption_set_name: The name of the disk encryption set that is being created. The + name can't be changed after the disk encryption set is created. Supported characters for the + name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. + :type disk_encryption_set_name: str + :param resource: disk encryption set object supplied in the body of the Put disk encryption set + operation. Required. + :type resource: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + disk_encryption_set_name: str, + resource: Union[_models.DiskEncryptionSet, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Creates or updates a disk encryption set. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param disk_encryption_set_name: The name of the disk encryption set that is being created. The + name can't be changed after the disk encryption set is created. Supported characters for the + name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. + :type disk_encryption_set_name: str + :param resource: disk encryption set object supplied in the body of the Put disk encryption set + operation. Is one of the following types: DiskEncryptionSet, JSON, IO[bytes] Required. + :type resource: ~azure.mgmt.compute.models.DiskEncryptionSet or JSON or IO[bytes] + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._create_or_update_initial( + resource_group_name=resource_group_name, + disk_encryption_set_name=disk_encryption_set_name, + resource=resource, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + async def _update_initial( + self, + resource_group_name: str, + disk_encryption_set_name: str, + properties: Union[_models.DiskEncryptionSetUpdate, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(properties, (IOBase, bytes)): + _content = properties + else: + _content = json.dumps(properties, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_disk_encryption_sets_update_request( + resource_group_name=resource_group_name, + disk_encryption_set_name=disk_encryption_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_update( + self, + resource_group_name: str, + disk_encryption_set_name: str, + properties: _models.DiskEncryptionSetUpdate, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Updates (patches) a disk encryption set. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param disk_encryption_set_name: The name of the disk encryption set that is being created. The + name can't be changed after the disk encryption set is created. Supported characters for the + name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. + :type disk_encryption_set_name: str + :param properties: disk encryption set object supplied in the body of the Patch disk encryption + set operation. Required. + :type properties: ~azure.mgmt.compute.models.DiskEncryptionSetUpdate + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update( + self, + resource_group_name: str, + disk_encryption_set_name: str, + properties: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Updates (patches) a disk encryption set. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param disk_encryption_set_name: The name of the disk encryption set that is being created. The + name can't be changed after the disk encryption set is created. Supported characters for the + name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. + :type disk_encryption_set_name: str + :param properties: disk encryption set object supplied in the body of the Patch disk encryption + set operation. Required. + :type properties: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update( + self, + resource_group_name: str, + disk_encryption_set_name: str, + properties: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Updates (patches) a disk encryption set. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param disk_encryption_set_name: The name of the disk encryption set that is being created. The + name can't be changed after the disk encryption set is created. Supported characters for the + name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. + :type disk_encryption_set_name: str + :param properties: disk encryption set object supplied in the body of the Patch disk encryption + set operation. Required. + :type properties: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_update( + self, + resource_group_name: str, + disk_encryption_set_name: str, + properties: Union[_models.DiskEncryptionSetUpdate, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Updates (patches) a disk encryption set. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param disk_encryption_set_name: The name of the disk encryption set that is being created. The + name can't be changed after the disk encryption set is created. Supported characters for the + name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. + :type disk_encryption_set_name: str + :param properties: disk encryption set object supplied in the body of the Patch disk encryption + set operation. Is one of the following types: DiskEncryptionSetUpdate, JSON, IO[bytes] + Required. + :type properties: ~azure.mgmt.compute.models.DiskEncryptionSetUpdate or JSON or IO[bytes] + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._update_initial( + resource_group_name=resource_group_name, + disk_encryption_set_name=disk_encryption_set_name, + properties=properties, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + async def _delete_initial( + self, resource_group_name: str, disk_encryption_set_name: str, **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_disk_encryption_sets_delete_request( + resource_group_name=resource_group_name, + disk_encryption_set_name=disk_encryption_set_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_delete( + self, resource_group_name: str, disk_encryption_set_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes a disk encryption set. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param disk_encryption_set_name: The name of the disk encryption set that is being created. The + name can't be changed after the disk encryption set is created. Supported characters for the + name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. + :type disk_encryption_set_name: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + disk_encryption_set_name=disk_encryption_set_name, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace + def list_by_resource_group( + self, resource_group_name: str, **kwargs: Any + ) -> AsyncItemPaged["_models.DiskEncryptionSet"]: + """Lists all the disk encryption sets under a resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :return: An iterator like instance of DiskEncryptionSet + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.models.DiskEncryptionSet] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.DiskEncryptionSet]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_disk_encryption_sets_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.DiskEncryptionSet], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + @distributed_trace + def list(self, **kwargs: Any) -> AsyncItemPaged["_models.DiskEncryptionSet"]: + """Lists all the disk encryption sets under a subscription. + + :return: An iterator like instance of DiskEncryptionSet + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.models.DiskEncryptionSet] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.DiskEncryptionSet]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_disk_encryption_sets_list_request( + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.DiskEncryptionSet], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + @distributed_trace + def list_associated_resources( + self, resource_group_name: str, disk_encryption_set_name: str, **kwargs: Any + ) -> AsyncItemPaged[str]: + """Lists all resources that are encrypted with this disk encryption set. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param disk_encryption_set_name: The name of the disk encryption set that is being created. The + name can't be changed after the disk encryption set is created. Supported characters for the + name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. + :type disk_encryption_set_name: str + :return: An iterator like instance of str + :rtype: ~azure.core.async_paging.AsyncItemPaged[str] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[str]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_disk_encryption_sets_list_associated_resources_request( + resource_group_name=resource_group_name, + disk_encryption_set_name=disk_encryption_set_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[str], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + +class DiskRestorePointsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.compute.aio.ComputeClient`'s + :attr:`disk_restore_points` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace_async + async def get( + self, + resource_group_name: str, + restore_point_collection_name: str, + vm_restore_point_name: str, + disk_restore_point_name: str, + **kwargs: Any + ) -> _models.DiskRestorePoint: + """Get disk restorePoint resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param restore_point_collection_name: The name of the restore point collection that the disk + restore point belongs. Required. + :type restore_point_collection_name: str + :param vm_restore_point_name: The name of the vm restore point that the disk disk restore point + belongs. Required. + :type vm_restore_point_name: str + :param disk_restore_point_name: The name of the DiskRestorePoint. Required. + :type disk_restore_point_name: str + :return: DiskRestorePoint. The DiskRestorePoint is compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.DiskRestorePoint + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.DiskRestorePoint] = kwargs.pop("cls", None) + + _request = build_disk_restore_points_get_request( + resource_group_name=resource_group_name, + restore_point_collection_name=restore_point_collection_name, + vm_restore_point_name=vm_restore_point_name, + disk_restore_point_name=disk_restore_point_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.DiskRestorePoint, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list_by_restore_point( + self, resource_group_name: str, restore_point_collection_name: str, vm_restore_point_name: str, **kwargs: Any + ) -> AsyncItemPaged["_models.DiskRestorePoint"]: + """Lists diskRestorePoints under a vmRestorePoint. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param restore_point_collection_name: The name of the restore point collection that the disk + restore point belongs. Required. + :type restore_point_collection_name: str + :param vm_restore_point_name: The name of the vm restore point that the disk disk restore point + belongs. Required. + :type vm_restore_point_name: str + :return: An iterator like instance of DiskRestorePoint + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.models.DiskRestorePoint] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.DiskRestorePoint]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_disk_restore_points_list_by_restore_point_request( + resource_group_name=resource_group_name, + restore_point_collection_name=restore_point_collection_name, + vm_restore_point_name=vm_restore_point_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.DiskRestorePoint], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + async def _grant_access_initial( + self, + resource_group_name: str, + restore_point_collection_name: str, + vm_restore_point_name: str, + disk_restore_point_name: str, + body: Union[_models.GrantAccessData, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_disk_restore_points_grant_access_request( + resource_group_name=resource_group_name, + restore_point_collection_name=restore_point_collection_name, + vm_restore_point_name=vm_restore_point_name, + disk_restore_point_name=disk_restore_point_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_grant_access( + self, + resource_group_name: str, + restore_point_collection_name: str, + vm_restore_point_name: str, + disk_restore_point_name: str, + body: _models.GrantAccessData, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.AccessUri]: + """Grants access to a diskRestorePoint. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param restore_point_collection_name: The name of the restore point collection that the disk + restore point belongs. Required. + :type restore_point_collection_name: str + :param vm_restore_point_name: The name of the vm restore point that the disk disk restore point + belongs. Required. + :type vm_restore_point_name: str + :param disk_restore_point_name: The name of the DiskRestorePoint. Required. + :type disk_restore_point_name: str + :param body: Access data object supplied in the body of the get disk access operation. + Required. + :type body: ~azure.mgmt.compute.models.GrantAccessData + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns AccessUri. The AccessUri is compatible with + MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.AccessUri] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_grant_access( + self, + resource_group_name: str, + restore_point_collection_name: str, + vm_restore_point_name: str, + disk_restore_point_name: str, + body: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.AccessUri]: + """Grants access to a diskRestorePoint. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param restore_point_collection_name: The name of the restore point collection that the disk + restore point belongs. Required. + :type restore_point_collection_name: str + :param vm_restore_point_name: The name of the vm restore point that the disk disk restore point + belongs. Required. + :type vm_restore_point_name: str + :param disk_restore_point_name: The name of the DiskRestorePoint. Required. + :type disk_restore_point_name: str + :param body: Access data object supplied in the body of the get disk access operation. + Required. + :type body: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns AccessUri. The AccessUri is compatible with + MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.AccessUri] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_grant_access( + self, + resource_group_name: str, + restore_point_collection_name: str, + vm_restore_point_name: str, + disk_restore_point_name: str, + body: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.AccessUri]: + """Grants access to a diskRestorePoint. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param restore_point_collection_name: The name of the restore point collection that the disk + restore point belongs. Required. + :type restore_point_collection_name: str + :param vm_restore_point_name: The name of the vm restore point that the disk disk restore point + belongs. Required. + :type vm_restore_point_name: str + :param disk_restore_point_name: The name of the DiskRestorePoint. Required. + :type disk_restore_point_name: str + :param body: Access data object supplied in the body of the get disk access operation. + Required. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns AccessUri. The AccessUri is compatible with + MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.AccessUri] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_grant_access( + self, + resource_group_name: str, + restore_point_collection_name: str, + vm_restore_point_name: str, + disk_restore_point_name: str, + body: Union[_models.GrantAccessData, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.AccessUri]: + """Grants access to a diskRestorePoint. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param restore_point_collection_name: The name of the restore point collection that the disk + restore point belongs. Required. + :type restore_point_collection_name: str + :param vm_restore_point_name: The name of the vm restore point that the disk disk restore point + belongs. Required. + :type vm_restore_point_name: str + :param disk_restore_point_name: The name of the DiskRestorePoint. Required. + :type disk_restore_point_name: str + :param body: Access data object supplied in the body of the get disk access operation. Is one + of the following types: GrantAccessData, JSON, IO[bytes] Required. + :type body: ~azure.mgmt.compute.models.GrantAccessData or JSON or IO[bytes] + :return: An instance of AsyncLROPoller that returns AccessUri. The AccessUri is compatible with + MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.AccessUri] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AccessUri] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._grant_access_initial( + resource_group_name=resource_group_name, + restore_point_collection_name=restore_point_collection_name, + vm_restore_point_name=vm_restore_point_name, + disk_restore_point_name=disk_restore_point_name, + body=body, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = _deserialize(_models.AccessUri, response.json()) + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.AccessUri].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.AccessUri]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _revoke_access_initial( + self, + resource_group_name: str, + restore_point_collection_name: str, + vm_restore_point_name: str, + disk_restore_point_name: str, + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_disk_restore_points_revoke_access_request( + resource_group_name=resource_group_name, + restore_point_collection_name=restore_point_collection_name, + vm_restore_point_name=vm_restore_point_name, + disk_restore_point_name=disk_restore_point_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_revoke_access( + self, + resource_group_name: str, + restore_point_collection_name: str, + vm_restore_point_name: str, + disk_restore_point_name: str, + **kwargs: Any + ) -> AsyncLROPoller[_models.OkResponse]: + """Revokes access to a diskRestorePoint. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param restore_point_collection_name: The name of the restore point collection that the disk + restore point belongs. Required. + :type restore_point_collection_name: str + :param vm_restore_point_name: The name of the vm restore point that the disk disk restore point + belongs. Required. + :type vm_restore_point_name: str + :param disk_restore_point_name: The name of the DiskRestorePoint. Required. + :type disk_restore_point_name: str + :return: An instance of AsyncLROPoller that returns OkResponse. The OkResponse is compatible + with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.OkResponse] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.OkResponse] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._revoke_access_initial( + resource_group_name=resource_group_name, + restore_point_collection_name=restore_point_collection_name, + vm_restore_point_name=vm_restore_point_name, + disk_restore_point_name=disk_restore_point_name, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = _deserialize(_models.OkResponse, response.json()) + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.OkResponse].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.OkResponse]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + +class SnapshotsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.compute.aio.ComputeClient`'s + :attr:`snapshots` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace_async + async def get(self, resource_group_name: str, snapshot_name: str, **kwargs: Any) -> _models.Snapshot: + """Gets information about a snapshot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param snapshot_name: The name of the snapshot that is being created. The name can't be changed + after the snapshot is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. + The max name length is 80 characters. Required. + :type snapshot_name: str + :return: Snapshot. The Snapshot is compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.Snapshot + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.Snapshot] = kwargs.pop("cls", None) + + _request = build_snapshots_get_request( + resource_group_name=resource_group_name, + snapshot_name=snapshot_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.Snapshot, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _create_or_update_initial( + self, + resource_group_name: str, + snapshot_name: str, + resource: Union[_models.Snapshot, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(resource, (IOBase, bytes)): + _content = resource + else: + _content = json.dumps(resource, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_snapshots_create_or_update_request( + resource_group_name=resource_group_name, + snapshot_name=snapshot_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + snapshot_name: str, + resource: _models.Snapshot, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Creates or updates a snapshot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param snapshot_name: The name of the snapshot that is being created. The name can't be changed + after the snapshot is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. + The max name length is 80 characters. Required. + :type snapshot_name: str + :param resource: Snapshot object supplied in the body of the Put disk operation. Required. + :type resource: ~azure.mgmt.compute.models.Snapshot + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + snapshot_name: str, + resource: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Creates or updates a snapshot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param snapshot_name: The name of the snapshot that is being created. The name can't be changed + after the snapshot is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. + The max name length is 80 characters. Required. + :type snapshot_name: str + :param resource: Snapshot object supplied in the body of the Put disk operation. Required. + :type resource: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + snapshot_name: str, + resource: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Creates or updates a snapshot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param snapshot_name: The name of the snapshot that is being created. The name can't be changed + after the snapshot is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. + The max name length is 80 characters. Required. + :type snapshot_name: str + :param resource: Snapshot object supplied in the body of the Put disk operation. Required. + :type resource: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + snapshot_name: str, + resource: Union[_models.Snapshot, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Creates or updates a snapshot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param snapshot_name: The name of the snapshot that is being created. The name can't be changed + after the snapshot is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. + The max name length is 80 characters. Required. + :type snapshot_name: str + :param resource: Snapshot object supplied in the body of the Put disk operation. Is one of the + following types: Snapshot, JSON, IO[bytes] Required. + :type resource: ~azure.mgmt.compute.models.Snapshot or JSON or IO[bytes] + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._create_or_update_initial( + resource_group_name=resource_group_name, + snapshot_name=snapshot_name, + resource=resource, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + async def _update_initial( + self, + resource_group_name: str, + snapshot_name: str, + properties: Union[_models.SnapshotUpdate, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(properties, (IOBase, bytes)): + _content = properties + else: + _content = json.dumps(properties, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_snapshots_update_request( + resource_group_name=resource_group_name, + snapshot_name=snapshot_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_update( + self, + resource_group_name: str, + snapshot_name: str, + properties: _models.SnapshotUpdate, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Updates (patches) a snapshot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param snapshot_name: The name of the snapshot that is being created. The name can't be changed + after the snapshot is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. + The max name length is 80 characters. Required. + :type snapshot_name: str + :param properties: Snapshot object supplied in the body of the Patch snapshot operation. + Required. + :type properties: ~azure.mgmt.compute.models.SnapshotUpdate + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update( + self, + resource_group_name: str, + snapshot_name: str, + properties: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Updates (patches) a snapshot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param snapshot_name: The name of the snapshot that is being created. The name can't be changed + after the snapshot is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. + The max name length is 80 characters. Required. + :type snapshot_name: str + :param properties: Snapshot object supplied in the body of the Patch snapshot operation. + Required. + :type properties: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update( + self, + resource_group_name: str, + snapshot_name: str, + properties: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Updates (patches) a snapshot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param snapshot_name: The name of the snapshot that is being created. The name can't be changed + after the snapshot is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. + The max name length is 80 characters. Required. + :type snapshot_name: str + :param properties: Snapshot object supplied in the body of the Patch snapshot operation. + Required. + :type properties: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_update( + self, + resource_group_name: str, + snapshot_name: str, + properties: Union[_models.SnapshotUpdate, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Updates (patches) a snapshot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param snapshot_name: The name of the snapshot that is being created. The name can't be changed + after the snapshot is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. + The max name length is 80 characters. Required. + :type snapshot_name: str + :param properties: Snapshot object supplied in the body of the Patch snapshot operation. Is one + of the following types: SnapshotUpdate, JSON, IO[bytes] Required. + :type properties: ~azure.mgmt.compute.models.SnapshotUpdate or JSON or IO[bytes] + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._update_initial( + resource_group_name=resource_group_name, + snapshot_name=snapshot_name, + properties=properties, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + async def _delete_initial( + self, resource_group_name: str, snapshot_name: str, **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_snapshots_delete_request( + resource_group_name=resource_group_name, + snapshot_name=snapshot_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_delete(self, resource_group_name: str, snapshot_name: str, **kwargs: Any) -> AsyncLROPoller[None]: + """Deletes a snapshot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param snapshot_name: The name of the snapshot that is being created. The name can't be changed + after the snapshot is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. + The max name length is 80 characters. Required. + :type snapshot_name: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + snapshot_name=snapshot_name, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace + def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> AsyncItemPaged["_models.Snapshot"]: + """Lists snapshots under a resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :return: An iterator like instance of Snapshot + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.models.Snapshot] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.Snapshot]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_snapshots_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.Snapshot], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + @distributed_trace + def list(self, **kwargs: Any) -> AsyncItemPaged["_models.Snapshot"]: + """Lists snapshots under a subscription. + + :return: An iterator like instance of Snapshot + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.models.Snapshot] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.Snapshot]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_snapshots_list_request( + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.Snapshot], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + async def _grant_access_initial( + self, + resource_group_name: str, + snapshot_name: str, + body: Union[_models.GrantAccessData, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_snapshots_grant_access_request( + resource_group_name=resource_group_name, + snapshot_name=snapshot_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_grant_access( + self, + resource_group_name: str, + snapshot_name: str, + body: _models.GrantAccessData, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.AccessUri]: + """Grants access to a snapshot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param snapshot_name: The name of the snapshot that is being created. The name can't be changed + after the snapshot is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. + The max name length is 80 characters. Required. + :type snapshot_name: str + :param body: Access data object supplied in the body of the get snapshot access operation. + Required. + :type body: ~azure.mgmt.compute.models.GrantAccessData + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns AccessUri. The AccessUri is compatible with + MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.AccessUri] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_grant_access( + self, + resource_group_name: str, + snapshot_name: str, + body: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.AccessUri]: + """Grants access to a snapshot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param snapshot_name: The name of the snapshot that is being created. The name can't be changed + after the snapshot is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. + The max name length is 80 characters. Required. + :type snapshot_name: str + :param body: Access data object supplied in the body of the get snapshot access operation. + Required. + :type body: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns AccessUri. The AccessUri is compatible with + MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.AccessUri] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_grant_access( + self, + resource_group_name: str, + snapshot_name: str, + body: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.AccessUri]: + """Grants access to a snapshot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param snapshot_name: The name of the snapshot that is being created. The name can't be changed + after the snapshot is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. + The max name length is 80 characters. Required. + :type snapshot_name: str + :param body: Access data object supplied in the body of the get snapshot access operation. + Required. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns AccessUri. The AccessUri is compatible with + MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.AccessUri] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_grant_access( + self, + resource_group_name: str, + snapshot_name: str, + body: Union[_models.GrantAccessData, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.AccessUri]: + """Grants access to a snapshot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param snapshot_name: The name of the snapshot that is being created. The name can't be changed + after the snapshot is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. + The max name length is 80 characters. Required. + :type snapshot_name: str + :param body: Access data object supplied in the body of the get snapshot access operation. Is + one of the following types: GrantAccessData, JSON, IO[bytes] Required. + :type body: ~azure.mgmt.compute.models.GrantAccessData or JSON or IO[bytes] + :return: An instance of AsyncLROPoller that returns AccessUri. The AccessUri is compatible with + MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.AccessUri] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AccessUri] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._grant_access_initial( + resource_group_name=resource_group_name, + snapshot_name=snapshot_name, + body=body, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = _deserialize(_models.AccessUri, response.json()) + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.AccessUri].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.AccessUri]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _revoke_access_initial( + self, resource_group_name: str, snapshot_name: str, **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_snapshots_revoke_access_request( + resource_group_name=resource_group_name, + snapshot_name=snapshot_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_revoke_access( + self, resource_group_name: str, snapshot_name: str, **kwargs: Any + ) -> AsyncLROPoller[_models.OkResponse]: + """Revokes access to a snapshot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param snapshot_name: The name of the snapshot that is being created. The name can't be changed + after the snapshot is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. + The max name length is 80 characters. Required. + :type snapshot_name: str + :return: An instance of AsyncLROPoller that returns OkResponse. The OkResponse is compatible + with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.OkResponse] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.OkResponse] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._revoke_access_initial( + resource_group_name=resource_group_name, + snapshot_name=snapshot_name, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = _deserialize(_models.OkResponse, response.json()) + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.OkResponse].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.OkResponse]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + +class GalleriesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.compute.aio.ComputeClient`'s + :attr:`galleries` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace_async + async def get( + self, + resource_group_name: str, + gallery_name: str, + *, + select: Optional[Union[str, _models.SelectPermissions]] = None, + expand: Optional[Union[str, _models.GalleryExpandParams]] = None, + **kwargs: Any + ) -> _models.Gallery: + """Retrieves information about a Shared Image Gallery. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :keyword select: The select expression to apply on the operation. "Permissions" Default value + is None. + :paramtype select: str or ~azure.mgmt.compute.models.SelectPermissions + :keyword expand: The expand query option to apply on the operation. "SharingProfile/Groups" + Default value is None. + :paramtype expand: str or ~azure.mgmt.compute.models.GalleryExpandParams + :return: Gallery. The Gallery is compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.Gallery + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.Gallery] = kwargs.pop("cls", None) + + _request = build_galleries_get_request( + resource_group_name=resource_group_name, + gallery_name=gallery_name, + subscription_id=self._config.subscription_id, + select=select, + expand=expand, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.Gallery, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _create_or_update_initial( + self, + resource_group_name: str, + gallery_name: str, + resource: Union[_models.Gallery, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(resource, (IOBase, bytes)): + _content = resource + else: + _content = json.dumps(resource, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_galleries_create_or_update_request( + resource_group_name=resource_group_name, + gallery_name=gallery_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 201: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + gallery_name: str, + resource: _models.Gallery, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Create or update a Shared Image Gallery. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param resource: Parameters supplied to the create or update Shared Image Gallery operation. + Required. + :type resource: ~azure.mgmt.compute.models.Gallery + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + gallery_name: str, + resource: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Create or update a Shared Image Gallery. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param resource: Parameters supplied to the create or update Shared Image Gallery operation. + Required. + :type resource: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + gallery_name: str, + resource: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Create or update a Shared Image Gallery. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param resource: Parameters supplied to the create or update Shared Image Gallery operation. + Required. + :type resource: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + gallery_name: str, + resource: Union[_models.Gallery, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Create or update a Shared Image Gallery. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param resource: Parameters supplied to the create or update Shared Image Gallery operation. Is + one of the following types: Gallery, JSON, IO[bytes] Required. + :type resource: ~azure.mgmt.compute.models.Gallery or JSON or IO[bytes] + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._create_or_update_initial( + resource_group_name=resource_group_name, + gallery_name=gallery_name, + resource=resource, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + async def _update_initial( + self, + resource_group_name: str, + gallery_name: str, + properties: Union[_models.GalleryUpdate, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(properties, (IOBase, bytes)): + _content = properties + else: + _content = json.dumps(properties, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_galleries_update_request( + resource_group_name=resource_group_name, + gallery_name=gallery_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_update( + self, + resource_group_name: str, + gallery_name: str, + properties: _models.GalleryUpdate, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Update a Shared Image Gallery. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param properties: Parameters supplied to the update Shared Image Gallery operation. Required. + :type properties: ~azure.mgmt.compute.models.GalleryUpdate + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update( + self, + resource_group_name: str, + gallery_name: str, + properties: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Update a Shared Image Gallery. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param properties: Parameters supplied to the update Shared Image Gallery operation. Required. + :type properties: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update( + self, + resource_group_name: str, + gallery_name: str, + properties: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Update a Shared Image Gallery. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param properties: Parameters supplied to the update Shared Image Gallery operation. Required. + :type properties: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_update( + self, + resource_group_name: str, + gallery_name: str, + properties: Union[_models.GalleryUpdate, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Update a Shared Image Gallery. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param properties: Parameters supplied to the update Shared Image Gallery operation. Is one of + the following types: GalleryUpdate, JSON, IO[bytes] Required. + :type properties: ~azure.mgmt.compute.models.GalleryUpdate or JSON or IO[bytes] + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._update_initial( + resource_group_name=resource_group_name, + gallery_name=gallery_name, + properties=properties, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + async def _delete_initial(self, resource_group_name: str, gallery_name: str, **kwargs: Any) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_galleries_delete_request( + resource_group_name=resource_group_name, + gallery_name=gallery_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_delete(self, resource_group_name: str, gallery_name: str, **kwargs: Any) -> AsyncLROPoller[None]: + """Delete a Shared Image Gallery. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + gallery_name=gallery_name, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace + def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> AsyncItemPaged["_models.Gallery"]: + """List galleries under a resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :return: An iterator like instance of Gallery + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.models.Gallery] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.Gallery]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_galleries_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.Gallery], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + @distributed_trace + def list(self, **kwargs: Any) -> AsyncItemPaged["_models.Gallery"]: + """List galleries under a subscription. + + :return: An iterator like instance of Gallery + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.models.Gallery] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.Gallery]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_galleries_list_request( + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.Gallery], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + @distributed_trace + def list_by_artifact_name( + self, resource_group_name: str, gallery_name: str, artifact_type: str, artifact_name: str, **kwargs: Any + ) -> AsyncItemPaged["_models.GallerySoftDeletedResource"]: + """List soft-deleted resources of an artifact in the gallery, such as soft-deleted gallery image + version of an image. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param artifact_type: The type of the artifact to be listed, such as gallery image version. + Required. + :type artifact_type: str + :param artifact_name: The artifact name to be listed. If artifact type is Images, then the + artifact name should be the gallery image name. Required. + :type artifact_name: str + :return: An iterator like instance of GallerySoftDeletedResource + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.models.GallerySoftDeletedResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.GallerySoftDeletedResource]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_galleries_list_by_artifact_name_request( + resource_group_name=resource_group_name, + gallery_name=gallery_name, + artifact_type=artifact_type, + artifact_name=artifact_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.GallerySoftDeletedResource], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + async def _gallery_sharing_profile_update_initial( + self, + resource_group_name: str, + gallery_name: str, + body: Union[_models.SharingUpdate, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_galleries_gallery_sharing_profile_update_request( + resource_group_name=resource_group_name, + gallery_name=gallery_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_gallery_sharing_profile_update( + self, + resource_group_name: str, + gallery_name: str, + body: _models.SharingUpdate, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Update sharing profile of a gallery. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param body: Parameters supplied to the update gallery sharing profile. Required. + :type body: ~azure.mgmt.compute.models.SharingUpdate + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_gallery_sharing_profile_update( + self, + resource_group_name: str, + gallery_name: str, + body: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Update sharing profile of a gallery. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param body: Parameters supplied to the update gallery sharing profile. Required. + :type body: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_gallery_sharing_profile_update( + self, + resource_group_name: str, + gallery_name: str, + body: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Update sharing profile of a gallery. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param body: Parameters supplied to the update gallery sharing profile. Required. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_gallery_sharing_profile_update( + self, + resource_group_name: str, + gallery_name: str, + body: Union[_models.SharingUpdate, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Update sharing profile of a gallery. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param body: Parameters supplied to the update gallery sharing profile. Is one of the following + types: SharingUpdate, JSON, IO[bytes] Required. + :type body: ~azure.mgmt.compute.models.SharingUpdate or JSON or IO[bytes] + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._gallery_sharing_profile_update_initial( + resource_group_name=resource_group_name, + gallery_name=gallery_name, + body=body, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + +class GalleryImagesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.compute.aio.ComputeClient`'s + :attr:`gallery_images` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace_async + async def get( + self, resource_group_name: str, gallery_name: str, gallery_image_name: str, **kwargs: Any + ) -> _models.GalleryImage: + """Retrieves information about a gallery image definition. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param gallery_image_name: The name of the gallery image definition to be retrieved. Required. + :type gallery_image_name: str + :return: GalleryImage. The GalleryImage is compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.GalleryImage + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.GalleryImage] = kwargs.pop("cls", None) + + _request = build_gallery_images_get_request( + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_image_name=gallery_image_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.GalleryImage, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _create_or_update_initial( + self, + resource_group_name: str, + gallery_name: str, + gallery_image_name: str, + resource: Union[_models.GalleryImage, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(resource, (IOBase, bytes)): + _content = resource + else: + _content = json.dumps(resource, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_gallery_images_create_or_update_request( + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_image_name=gallery_image_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 201: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + gallery_name: str, + gallery_image_name: str, + resource: _models.GalleryImage, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Create or update a gallery image definition. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param gallery_image_name: The name of the gallery image definition to be retrieved. Required. + :type gallery_image_name: str + :param resource: Parameters supplied to the create or update gallery image operation. Required. + :type resource: ~azure.mgmt.compute.models.GalleryImage + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + gallery_name: str, + gallery_image_name: str, + resource: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Create or update a gallery image definition. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param gallery_image_name: The name of the gallery image definition to be retrieved. Required. + :type gallery_image_name: str + :param resource: Parameters supplied to the create or update gallery image operation. Required. + :type resource: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + gallery_name: str, + gallery_image_name: str, + resource: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Create or update a gallery image definition. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param gallery_image_name: The name of the gallery image definition to be retrieved. Required. + :type gallery_image_name: str + :param resource: Parameters supplied to the create or update gallery image operation. Required. + :type resource: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + gallery_name: str, + gallery_image_name: str, + resource: Union[_models.GalleryImage, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Create or update a gallery image definition. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param gallery_image_name: The name of the gallery image definition to be retrieved. Required. + :type gallery_image_name: str + :param resource: Parameters supplied to the create or update gallery image operation. Is one of + the following types: GalleryImage, JSON, IO[bytes] Required. + :type resource: ~azure.mgmt.compute.models.GalleryImage or JSON or IO[bytes] + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._create_or_update_initial( + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_image_name=gallery_image_name, + resource=resource, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + async def _update_initial( + self, + resource_group_name: str, + gallery_name: str, + gallery_image_name: str, + properties: Union[_models.GalleryImageUpdate, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(properties, (IOBase, bytes)): + _content = properties + else: + _content = json.dumps(properties, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_gallery_images_update_request( + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_image_name=gallery_image_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_update( + self, + resource_group_name: str, + gallery_name: str, + gallery_image_name: str, + properties: _models.GalleryImageUpdate, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Update a gallery image definition. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param gallery_image_name: The name of the gallery image definition to be retrieved. Required. + :type gallery_image_name: str + :param properties: Parameters supplied to the update gallery image operation. Required. + :type properties: ~azure.mgmt.compute.models.GalleryImageUpdate + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update( + self, + resource_group_name: str, + gallery_name: str, + gallery_image_name: str, + properties: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Update a gallery image definition. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param gallery_image_name: The name of the gallery image definition to be retrieved. Required. + :type gallery_image_name: str + :param properties: Parameters supplied to the update gallery image operation. Required. + :type properties: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update( + self, + resource_group_name: str, + gallery_name: str, + gallery_image_name: str, + properties: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Update a gallery image definition. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param gallery_image_name: The name of the gallery image definition to be retrieved. Required. + :type gallery_image_name: str + :param properties: Parameters supplied to the update gallery image operation. Required. + :type properties: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_update( + self, + resource_group_name: str, + gallery_name: str, + gallery_image_name: str, + properties: Union[_models.GalleryImageUpdate, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Update a gallery image definition. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param gallery_image_name: The name of the gallery image definition to be retrieved. Required. + :type gallery_image_name: str + :param properties: Parameters supplied to the update gallery image operation. Is one of the + following types: GalleryImageUpdate, JSON, IO[bytes] Required. + :type properties: ~azure.mgmt.compute.models.GalleryImageUpdate or JSON or IO[bytes] + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._update_initial( + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_image_name=gallery_image_name, + properties=properties, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + async def _delete_initial( + self, resource_group_name: str, gallery_name: str, gallery_image_name: str, **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_gallery_images_delete_request( + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_image_name=gallery_image_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_delete( + self, resource_group_name: str, gallery_name: str, gallery_image_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Delete a gallery image. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param gallery_image_name: The name of the gallery image definition to be retrieved. Required. + :type gallery_image_name: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_image_name=gallery_image_name, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace + def list_by_gallery( + self, resource_group_name: str, gallery_name: str, **kwargs: Any + ) -> AsyncItemPaged["_models.GalleryImage"]: + """List gallery image definitions in a gallery. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :return: An iterator like instance of GalleryImage + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.models.GalleryImage] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.GalleryImage]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_gallery_images_list_by_gallery_request( + resource_group_name=resource_group_name, + gallery_name=gallery_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.GalleryImage], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + +class GalleryImageVersionsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.compute.aio.ComputeClient`'s + :attr:`gallery_image_versions` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace_async + async def get( + self, + resource_group_name: str, + gallery_name: str, + gallery_image_name: str, + gallery_image_version_name: str, + *, + expand: Optional[Union[str, _models.ReplicationStatusTypes]] = None, + **kwargs: Any + ) -> _models.GalleryImageVersion: + """Retrieves information about a gallery image version. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param gallery_image_name: The name of the gallery image definition to be retrieved. Required. + :type gallery_image_name: str + :param gallery_image_version_name: The name of the gallery image version to be retrieved. + Required. + :type gallery_image_version_name: str + :keyword expand: The expand expression to apply on the operation. Known values are: + "ReplicationStatus" and "UefiSettings". Default value is None. + :paramtype expand: str or ~azure.mgmt.compute.models.ReplicationStatusTypes + :return: GalleryImageVersion. The GalleryImageVersion is compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.GalleryImageVersion + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.GalleryImageVersion] = kwargs.pop("cls", None) + + _request = build_gallery_image_versions_get_request( + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_image_name=gallery_image_name, + gallery_image_version_name=gallery_image_version_name, + subscription_id=self._config.subscription_id, + expand=expand, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.GalleryImageVersion, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _create_or_update_initial( + self, + resource_group_name: str, + gallery_name: str, + gallery_image_name: str, + gallery_image_version_name: str, + resource: Union[_models.GalleryImageVersion, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(resource, (IOBase, bytes)): + _content = resource + else: + _content = json.dumps(resource, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_gallery_image_versions_create_or_update_request( + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_image_name=gallery_image_name, + gallery_image_version_name=gallery_image_version_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 201: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + gallery_name: str, + gallery_image_name: str, + gallery_image_version_name: str, + resource: _models.GalleryImageVersion, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Create or update a gallery image version. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param gallery_image_name: The name of the gallery image definition to be retrieved. Required. + :type gallery_image_name: str + :param gallery_image_version_name: The name of the gallery image version to be retrieved. + Required. + :type gallery_image_version_name: str + :param resource: Parameters supplied to the create or update gallery image version operation. + Required. + :type resource: ~azure.mgmt.compute.models.GalleryImageVersion + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + gallery_name: str, + gallery_image_name: str, + gallery_image_version_name: str, + resource: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Create or update a gallery image version. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param gallery_image_name: The name of the gallery image definition to be retrieved. Required. + :type gallery_image_name: str + :param gallery_image_version_name: The name of the gallery image version to be retrieved. + Required. + :type gallery_image_version_name: str + :param resource: Parameters supplied to the create or update gallery image version operation. + Required. + :type resource: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + gallery_name: str, + gallery_image_name: str, + gallery_image_version_name: str, + resource: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Create or update a gallery image version. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param gallery_image_name: The name of the gallery image definition to be retrieved. Required. + :type gallery_image_name: str + :param gallery_image_version_name: The name of the gallery image version to be retrieved. + Required. + :type gallery_image_version_name: str + :param resource: Parameters supplied to the create or update gallery image version operation. + Required. + :type resource: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + gallery_name: str, + gallery_image_name: str, + gallery_image_version_name: str, + resource: Union[_models.GalleryImageVersion, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Create or update a gallery image version. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param gallery_image_name: The name of the gallery image definition to be retrieved. Required. + :type gallery_image_name: str + :param gallery_image_version_name: The name of the gallery image version to be retrieved. + Required. + :type gallery_image_version_name: str + :param resource: Parameters supplied to the create or update gallery image version operation. + Is one of the following types: GalleryImageVersion, JSON, IO[bytes] Required. + :type resource: ~azure.mgmt.compute.models.GalleryImageVersion or JSON or IO[bytes] + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._create_or_update_initial( + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_image_name=gallery_image_name, + gallery_image_version_name=gallery_image_version_name, + resource=resource, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + async def _update_initial( + self, + resource_group_name: str, + gallery_name: str, + gallery_image_name: str, + gallery_image_version_name: str, + properties: Union[_models.GalleryImageVersionUpdate, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(properties, (IOBase, bytes)): + _content = properties + else: + _content = json.dumps(properties, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_gallery_image_versions_update_request( + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_image_name=gallery_image_name, + gallery_image_version_name=gallery_image_version_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_update( + self, + resource_group_name: str, + gallery_name: str, + gallery_image_name: str, + gallery_image_version_name: str, + properties: _models.GalleryImageVersionUpdate, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Update a gallery image version. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param gallery_image_name: The name of the gallery image definition to be retrieved. Required. + :type gallery_image_name: str + :param gallery_image_version_name: The name of the gallery image version to be retrieved. + Required. + :type gallery_image_version_name: str + :param properties: Parameters supplied to the update gallery image version operation. Required. + :type properties: ~azure.mgmt.compute.models.GalleryImageVersionUpdate + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update( + self, + resource_group_name: str, + gallery_name: str, + gallery_image_name: str, + gallery_image_version_name: str, + properties: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Update a gallery image version. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param gallery_image_name: The name of the gallery image definition to be retrieved. Required. + :type gallery_image_name: str + :param gallery_image_version_name: The name of the gallery image version to be retrieved. + Required. + :type gallery_image_version_name: str + :param properties: Parameters supplied to the update gallery image version operation. Required. + :type properties: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update( + self, + resource_group_name: str, + gallery_name: str, + gallery_image_name: str, + gallery_image_version_name: str, + properties: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Update a gallery image version. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param gallery_image_name: The name of the gallery image definition to be retrieved. Required. + :type gallery_image_name: str + :param gallery_image_version_name: The name of the gallery image version to be retrieved. + Required. + :type gallery_image_version_name: str + :param properties: Parameters supplied to the update gallery image version operation. Required. + :type properties: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_update( + self, + resource_group_name: str, + gallery_name: str, + gallery_image_name: str, + gallery_image_version_name: str, + properties: Union[_models.GalleryImageVersionUpdate, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Update a gallery image version. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param gallery_image_name: The name of the gallery image definition to be retrieved. Required. + :type gallery_image_name: str + :param gallery_image_version_name: The name of the gallery image version to be retrieved. + Required. + :type gallery_image_version_name: str + :param properties: Parameters supplied to the update gallery image version operation. Is one of + the following types: GalleryImageVersionUpdate, JSON, IO[bytes] Required. + :type properties: ~azure.mgmt.compute.models.GalleryImageVersionUpdate or JSON or IO[bytes] + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._update_initial( + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_image_name=gallery_image_name, + gallery_image_version_name=gallery_image_version_name, + properties=properties, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + async def _delete_initial( + self, + resource_group_name: str, + gallery_name: str, + gallery_image_name: str, + gallery_image_version_name: str, + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_gallery_image_versions_delete_request( + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_image_name=gallery_image_name, + gallery_image_version_name=gallery_image_version_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_delete( + self, + resource_group_name: str, + gallery_name: str, + gallery_image_name: str, + gallery_image_version_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Delete a gallery image version. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param gallery_image_name: The name of the gallery image definition to be retrieved. Required. + :type gallery_image_name: str + :param gallery_image_version_name: The name of the gallery image version to be retrieved. + Required. + :type gallery_image_version_name: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_image_name=gallery_image_name, + gallery_image_version_name=gallery_image_version_name, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace + def list_by_gallery_image( + self, resource_group_name: str, gallery_name: str, gallery_image_name: str, **kwargs: Any + ) -> AsyncItemPaged["_models.GalleryImageVersion"]: + """List gallery image versions in a gallery image definition. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param gallery_image_name: The name of the gallery image definition to be retrieved. Required. + :type gallery_image_name: str + :return: An iterator like instance of GalleryImageVersion + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.models.GalleryImageVersion] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.GalleryImageVersion]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_gallery_image_versions_list_by_gallery_image_request( + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_image_name=gallery_image_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.GalleryImageVersion], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + +class GalleryApplicationsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.compute.aio.ComputeClient`'s + :attr:`gallery_applications` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace_async + async def get( + self, resource_group_name: str, gallery_name: str, gallery_application_name: str, **kwargs: Any + ) -> _models.GalleryApplication: + """Retrieves information about a gallery Application Definition. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param gallery_application_name: The name of the gallery Application Definition to be + retrieved. Required. + :type gallery_application_name: str + :return: GalleryApplication. The GalleryApplication is compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.GalleryApplication + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.GalleryApplication] = kwargs.pop("cls", None) + + _request = build_gallery_applications_get_request( + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_application_name=gallery_application_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.GalleryApplication, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _create_or_update_initial( + self, + resource_group_name: str, + gallery_name: str, + gallery_application_name: str, + resource: Union[_models.GalleryApplication, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(resource, (IOBase, bytes)): + _content = resource + else: + _content = json.dumps(resource, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_gallery_applications_create_or_update_request( + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_application_name=gallery_application_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 201: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + gallery_name: str, + gallery_application_name: str, + resource: _models.GalleryApplication, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Create or update a gallery Application Definition. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param gallery_application_name: The name of the gallery Application Definition to be + retrieved. Required. + :type gallery_application_name: str + :param resource: Parameters supplied to the create or update gallery Application operation. + Required. + :type resource: ~azure.mgmt.compute.models.GalleryApplication + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + gallery_name: str, + gallery_application_name: str, + resource: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Create or update a gallery Application Definition. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param gallery_application_name: The name of the gallery Application Definition to be + retrieved. Required. + :type gallery_application_name: str + :param resource: Parameters supplied to the create or update gallery Application operation. + Required. + :type resource: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + gallery_name: str, + gallery_application_name: str, + resource: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Create or update a gallery Application Definition. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param gallery_application_name: The name of the gallery Application Definition to be + retrieved. Required. + :type gallery_application_name: str + :param resource: Parameters supplied to the create or update gallery Application operation. + Required. + :type resource: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + gallery_name: str, + gallery_application_name: str, + resource: Union[_models.GalleryApplication, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Create or update a gallery Application Definition. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param gallery_application_name: The name of the gallery Application Definition to be + retrieved. Required. + :type gallery_application_name: str + :param resource: Parameters supplied to the create or update gallery Application operation. Is + one of the following types: GalleryApplication, JSON, IO[bytes] Required. + :type resource: ~azure.mgmt.compute.models.GalleryApplication or JSON or IO[bytes] + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._create_or_update_initial( + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_application_name=gallery_application_name, + resource=resource, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + async def _update_initial( + self, + resource_group_name: str, + gallery_name: str, + gallery_application_name: str, + properties: Union[_models.GalleryApplicationUpdate, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(properties, (IOBase, bytes)): + _content = properties + else: + _content = json.dumps(properties, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_gallery_applications_update_request( + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_application_name=gallery_application_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_update( + self, + resource_group_name: str, + gallery_name: str, + gallery_application_name: str, + properties: _models.GalleryApplicationUpdate, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Update a gallery Application Definition. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param gallery_application_name: The name of the gallery Application Definition to be + retrieved. Required. + :type gallery_application_name: str + :param properties: Parameters supplied to the update gallery Application operation. Required. + :type properties: ~azure.mgmt.compute.models.GalleryApplicationUpdate + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update( + self, + resource_group_name: str, + gallery_name: str, + gallery_application_name: str, + properties: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Update a gallery Application Definition. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param gallery_application_name: The name of the gallery Application Definition to be + retrieved. Required. + :type gallery_application_name: str + :param properties: Parameters supplied to the update gallery Application operation. Required. + :type properties: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update( + self, + resource_group_name: str, + gallery_name: str, + gallery_application_name: str, + properties: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Update a gallery Application Definition. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param gallery_application_name: The name of the gallery Application Definition to be + retrieved. Required. + :type gallery_application_name: str + :param properties: Parameters supplied to the update gallery Application operation. Required. + :type properties: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_update( + self, + resource_group_name: str, + gallery_name: str, + gallery_application_name: str, + properties: Union[_models.GalleryApplicationUpdate, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Update a gallery Application Definition. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param gallery_application_name: The name of the gallery Application Definition to be + retrieved. Required. + :type gallery_application_name: str + :param properties: Parameters supplied to the update gallery Application operation. Is one of + the following types: GalleryApplicationUpdate, JSON, IO[bytes] Required. + :type properties: ~azure.mgmt.compute.models.GalleryApplicationUpdate or JSON or IO[bytes] + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._update_initial( + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_application_name=gallery_application_name, + properties=properties, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + async def _delete_initial( + self, resource_group_name: str, gallery_name: str, gallery_application_name: str, **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_gallery_applications_delete_request( + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_application_name=gallery_application_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_delete( + self, resource_group_name: str, gallery_name: str, gallery_application_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Delete a gallery Application. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param gallery_application_name: The name of the gallery Application Definition to be + retrieved. Required. + :type gallery_application_name: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_application_name=gallery_application_name, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace + def list_by_gallery( + self, resource_group_name: str, gallery_name: str, **kwargs: Any + ) -> AsyncItemPaged["_models.GalleryApplication"]: + """List gallery Application Definitions in a gallery. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :return: An iterator like instance of GalleryApplication + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.models.GalleryApplication] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.GalleryApplication]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_gallery_applications_list_by_gallery_request( + resource_group_name=resource_group_name, + gallery_name=gallery_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.GalleryApplication], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + +class GalleryApplicationVersionsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.compute.aio.ComputeClient`'s + :attr:`gallery_application_versions` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace_async + async def get( + self, + resource_group_name: str, + gallery_name: str, + gallery_application_name: str, + gallery_application_version_name: str, + *, + expand: Optional[Union[str, _models.ReplicationStatusTypes]] = None, + **kwargs: Any + ) -> _models.GalleryApplicationVersion: + """Retrieves information about a gallery Application Version. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param gallery_application_name: The name of the gallery Application Definition to be + retrieved. Required. + :type gallery_application_name: str + :param gallery_application_version_name: The name of the gallery Application Version to be + retrieved. Required. + :type gallery_application_version_name: str + :keyword expand: The expand expression to apply on the operation. Known values are: + "ReplicationStatus" and "UefiSettings". Default value is None. + :paramtype expand: str or ~azure.mgmt.compute.models.ReplicationStatusTypes + :return: GalleryApplicationVersion. The GalleryApplicationVersion is compatible with + MutableMapping + :rtype: ~azure.mgmt.compute.models.GalleryApplicationVersion + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.GalleryApplicationVersion] = kwargs.pop("cls", None) + + _request = build_gallery_application_versions_get_request( + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_application_name=gallery_application_name, + gallery_application_version_name=gallery_application_version_name, + subscription_id=self._config.subscription_id, + expand=expand, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.GalleryApplicationVersion, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _create_or_update_initial( + self, + resource_group_name: str, + gallery_name: str, + gallery_application_name: str, + gallery_application_version_name: str, + resource: Union[_models.GalleryApplicationVersion, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(resource, (IOBase, bytes)): + _content = resource + else: + _content = json.dumps(resource, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_gallery_application_versions_create_or_update_request( + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_application_name=gallery_application_name, + gallery_application_version_name=gallery_application_version_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 201: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + gallery_name: str, + gallery_application_name: str, + gallery_application_version_name: str, + resource: _models.GalleryApplicationVersion, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.GalleryApplicationVersion]: + """Create or update a gallery Application Version. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param gallery_application_name: The name of the gallery Application Definition to be + retrieved. Required. + :type gallery_application_name: str + :param gallery_application_version_name: The name of the gallery Application Version to be + retrieved. Required. + :type gallery_application_version_name: str + :param resource: Parameters supplied to the create or update gallery Application Version + operation. Required. + :type resource: ~azure.mgmt.compute.models.GalleryApplicationVersion + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns GalleryApplicationVersion. The + GalleryApplicationVersion is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.GalleryApplicationVersion] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + gallery_name: str, + gallery_application_name: str, + gallery_application_version_name: str, + resource: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.GalleryApplicationVersion]: + """Create or update a gallery Application Version. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param gallery_application_name: The name of the gallery Application Definition to be + retrieved. Required. + :type gallery_application_name: str + :param gallery_application_version_name: The name of the gallery Application Version to be + retrieved. Required. + :type gallery_application_version_name: str + :param resource: Parameters supplied to the create or update gallery Application Version + operation. Required. + :type resource: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns GalleryApplicationVersion. The + GalleryApplicationVersion is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.GalleryApplicationVersion] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + gallery_name: str, + gallery_application_name: str, + gallery_application_version_name: str, + resource: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.GalleryApplicationVersion]: + """Create or update a gallery Application Version. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param gallery_application_name: The name of the gallery Application Definition to be + retrieved. Required. + :type gallery_application_name: str + :param gallery_application_version_name: The name of the gallery Application Version to be + retrieved. Required. + :type gallery_application_version_name: str + :param resource: Parameters supplied to the create or update gallery Application Version + operation. Required. + :type resource: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns GalleryApplicationVersion. The + GalleryApplicationVersion is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.GalleryApplicationVersion] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + gallery_name: str, + gallery_application_name: str, + gallery_application_version_name: str, + resource: Union[_models.GalleryApplicationVersion, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.GalleryApplicationVersion]: + """Create or update a gallery Application Version. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param gallery_application_name: The name of the gallery Application Definition to be + retrieved. Required. + :type gallery_application_name: str + :param gallery_application_version_name: The name of the gallery Application Version to be + retrieved. Required. + :type gallery_application_version_name: str + :param resource: Parameters supplied to the create or update gallery Application Version + operation. Is one of the following types: GalleryApplicationVersion, JSON, IO[bytes] Required. + :type resource: ~azure.mgmt.compute.models.GalleryApplicationVersion or JSON or IO[bytes] + :return: An instance of AsyncLROPoller that returns GalleryApplicationVersion. The + GalleryApplicationVersion is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.GalleryApplicationVersion] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.GalleryApplicationVersion] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._create_or_update_initial( + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_application_name=gallery_application_name, + gallery_application_version_name=gallery_application_version_name, + resource=resource, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.GalleryApplicationVersion, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.GalleryApplicationVersion].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.GalleryApplicationVersion]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _update_initial( + self, + resource_group_name: str, + gallery_name: str, + gallery_application_name: str, + gallery_application_version_name: str, + properties: Union[_models.GalleryApplicationVersionUpdate, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(properties, (IOBase, bytes)): + _content = properties + else: + _content = json.dumps(properties, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_gallery_application_versions_update_request( + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_application_name=gallery_application_name, + gallery_application_version_name=gallery_application_version_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_update( + self, + resource_group_name: str, + gallery_name: str, + gallery_application_name: str, + gallery_application_version_name: str, + properties: _models.GalleryApplicationVersionUpdate, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Update a gallery Application Version. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param gallery_application_name: The name of the gallery Application Definition to be + retrieved. Required. + :type gallery_application_name: str + :param gallery_application_version_name: The name of the gallery Application Version to be + retrieved. Required. + :type gallery_application_version_name: str + :param properties: Parameters supplied to the update gallery Application Version operation. + Required. + :type properties: ~azure.mgmt.compute.models.GalleryApplicationVersionUpdate + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update( + self, + resource_group_name: str, + gallery_name: str, + gallery_application_name: str, + gallery_application_version_name: str, + properties: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Update a gallery Application Version. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param gallery_application_name: The name of the gallery Application Definition to be + retrieved. Required. + :type gallery_application_name: str + :param gallery_application_version_name: The name of the gallery Application Version to be + retrieved. Required. + :type gallery_application_version_name: str + :param properties: Parameters supplied to the update gallery Application Version operation. + Required. + :type properties: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update( + self, + resource_group_name: str, + gallery_name: str, + gallery_application_name: str, + gallery_application_version_name: str, + properties: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Update a gallery Application Version. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param gallery_application_name: The name of the gallery Application Definition to be + retrieved. Required. + :type gallery_application_name: str + :param gallery_application_version_name: The name of the gallery Application Version to be + retrieved. Required. + :type gallery_application_version_name: str + :param properties: Parameters supplied to the update gallery Application Version operation. + Required. + :type properties: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_update( + self, + resource_group_name: str, + gallery_name: str, + gallery_application_name: str, + gallery_application_version_name: str, + properties: Union[_models.GalleryApplicationVersionUpdate, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Update a gallery Application Version. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param gallery_application_name: The name of the gallery Application Definition to be + retrieved. Required. + :type gallery_application_name: str + :param gallery_application_version_name: The name of the gallery Application Version to be + retrieved. Required. + :type gallery_application_version_name: str + :param properties: Parameters supplied to the update gallery Application Version operation. Is + one of the following types: GalleryApplicationVersionUpdate, JSON, IO[bytes] Required. + :type properties: ~azure.mgmt.compute.models.GalleryApplicationVersionUpdate or JSON or + IO[bytes] + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._update_initial( + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_application_name=gallery_application_name, + gallery_application_version_name=gallery_application_version_name, + properties=properties, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + async def _delete_initial( + self, + resource_group_name: str, + gallery_name: str, + gallery_application_name: str, + gallery_application_version_name: str, + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_gallery_application_versions_delete_request( + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_application_name=gallery_application_name, + gallery_application_version_name=gallery_application_version_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_delete( + self, + resource_group_name: str, + gallery_name: str, + gallery_application_name: str, + gallery_application_version_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Delete a gallery Application Version. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param gallery_application_name: The name of the gallery Application Definition to be + retrieved. Required. + :type gallery_application_name: str + :param gallery_application_version_name: The name of the gallery Application Version to be + retrieved. Required. + :type gallery_application_version_name: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_application_name=gallery_application_name, + gallery_application_version_name=gallery_application_version_name, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace + def list_by_gallery_application( + self, resource_group_name: str, gallery_name: str, gallery_application_name: str, **kwargs: Any + ) -> AsyncItemPaged["_models.GalleryApplicationVersion"]: + """List gallery Application Versions in a gallery Application Definition. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param gallery_application_name: The name of the gallery Application Definition to be + retrieved. Required. + :type gallery_application_name: str + :return: An iterator like instance of GalleryApplicationVersion + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.models.GalleryApplicationVersion] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.GalleryApplicationVersion]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_gallery_application_versions_list_by_gallery_application_request( + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_application_name=gallery_application_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.GalleryApplicationVersion], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + +class GalleryInVMAccessControlProfilesOperations: # pylint: disable=name-too-long + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.compute.aio.ComputeClient`'s + :attr:`gallery_in_vm_access_control_profiles` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace_async + async def get( + self, resource_group_name: str, gallery_name: str, in_vm_access_control_profile_name: str, **kwargs: Any + ) -> _models.GalleryInVMAccessControlProfile: + """Retrieves information about a gallery inVMAccessControlProfile. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param in_vm_access_control_profile_name: The name of the gallery inVMAccessControlProfile to + be retrieved. Required. + :type in_vm_access_control_profile_name: str + :return: GalleryInVMAccessControlProfile. The GalleryInVMAccessControlProfile is compatible + with MutableMapping + :rtype: ~azure.mgmt.compute.models.GalleryInVMAccessControlProfile + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.GalleryInVMAccessControlProfile] = kwargs.pop("cls", None) + + _request = build_gallery_in_vm_access_control_profiles_get_request( + resource_group_name=resource_group_name, + gallery_name=gallery_name, + in_vm_access_control_profile_name=in_vm_access_control_profile_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.GalleryInVMAccessControlProfile, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _create_or_update_initial( + self, + resource_group_name: str, + gallery_name: str, + in_vm_access_control_profile_name: str, + resource: Union[_models.GalleryInVMAccessControlProfile, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(resource, (IOBase, bytes)): + _content = resource + else: + _content = json.dumps(resource, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_gallery_in_vm_access_control_profiles_create_or_update_request( + resource_group_name=resource_group_name, + gallery_name=gallery_name, + in_vm_access_control_profile_name=in_vm_access_control_profile_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 201: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + gallery_name: str, + in_vm_access_control_profile_name: str, + resource: _models.GalleryInVMAccessControlProfile, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Create or update a gallery inVMAccessControlProfile. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param in_vm_access_control_profile_name: The name of the gallery inVMAccessControlProfile to + be retrieved. Required. + :type in_vm_access_control_profile_name: str + :param resource: Parameters supplied to the create or update gallery inVMAccessControlProfile + operation. Required. + :type resource: ~azure.mgmt.compute.models.GalleryInVMAccessControlProfile + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + gallery_name: str, + in_vm_access_control_profile_name: str, + resource: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Create or update a gallery inVMAccessControlProfile. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param in_vm_access_control_profile_name: The name of the gallery inVMAccessControlProfile to + be retrieved. Required. + :type in_vm_access_control_profile_name: str + :param resource: Parameters supplied to the create or update gallery inVMAccessControlProfile + operation. Required. + :type resource: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + gallery_name: str, + in_vm_access_control_profile_name: str, + resource: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Create or update a gallery inVMAccessControlProfile. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param in_vm_access_control_profile_name: The name of the gallery inVMAccessControlProfile to + be retrieved. Required. + :type in_vm_access_control_profile_name: str + :param resource: Parameters supplied to the create or update gallery inVMAccessControlProfile + operation. Required. + :type resource: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + gallery_name: str, + in_vm_access_control_profile_name: str, + resource: Union[_models.GalleryInVMAccessControlProfile, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Create or update a gallery inVMAccessControlProfile. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param in_vm_access_control_profile_name: The name of the gallery inVMAccessControlProfile to + be retrieved. Required. + :type in_vm_access_control_profile_name: str + :param resource: Parameters supplied to the create or update gallery inVMAccessControlProfile + operation. Is one of the following types: GalleryInVMAccessControlProfile, JSON, IO[bytes] + Required. + :type resource: ~azure.mgmt.compute.models.GalleryInVMAccessControlProfile or JSON or IO[bytes] + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._create_or_update_initial( + resource_group_name=resource_group_name, + gallery_name=gallery_name, + in_vm_access_control_profile_name=in_vm_access_control_profile_name, + resource=resource, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + async def _update_initial( + self, + resource_group_name: str, + gallery_name: str, + in_vm_access_control_profile_name: str, + properties: Union[_models.GalleryInVMAccessControlProfileUpdate, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(properties, (IOBase, bytes)): + _content = properties + else: + _content = json.dumps(properties, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_gallery_in_vm_access_control_profiles_update_request( + resource_group_name=resource_group_name, + gallery_name=gallery_name, + in_vm_access_control_profile_name=in_vm_access_control_profile_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_update( + self, + resource_group_name: str, + gallery_name: str, + in_vm_access_control_profile_name: str, + properties: _models.GalleryInVMAccessControlProfileUpdate, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Update a gallery inVMAccessControlProfile. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param in_vm_access_control_profile_name: The name of the gallery inVMAccessControlProfile to + be retrieved. Required. + :type in_vm_access_control_profile_name: str + :param properties: Parameters supplied to the update gallery inVMAccessControlProfile + operation. Required. + :type properties: ~azure.mgmt.compute.models.GalleryInVMAccessControlProfileUpdate + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update( + self, + resource_group_name: str, + gallery_name: str, + in_vm_access_control_profile_name: str, + properties: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Update a gallery inVMAccessControlProfile. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param in_vm_access_control_profile_name: The name of the gallery inVMAccessControlProfile to + be retrieved. Required. + :type in_vm_access_control_profile_name: str + :param properties: Parameters supplied to the update gallery inVMAccessControlProfile + operation. Required. + :type properties: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update( + self, + resource_group_name: str, + gallery_name: str, + in_vm_access_control_profile_name: str, + properties: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Update a gallery inVMAccessControlProfile. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param in_vm_access_control_profile_name: The name of the gallery inVMAccessControlProfile to + be retrieved. Required. + :type in_vm_access_control_profile_name: str + :param properties: Parameters supplied to the update gallery inVMAccessControlProfile + operation. Required. + :type properties: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_update( + self, + resource_group_name: str, + gallery_name: str, + in_vm_access_control_profile_name: str, + properties: Union[_models.GalleryInVMAccessControlProfileUpdate, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Update a gallery inVMAccessControlProfile. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param in_vm_access_control_profile_name: The name of the gallery inVMAccessControlProfile to + be retrieved. Required. + :type in_vm_access_control_profile_name: str + :param properties: Parameters supplied to the update gallery inVMAccessControlProfile + operation. Is one of the following types: GalleryInVMAccessControlProfileUpdate, JSON, + IO[bytes] Required. + :type properties: ~azure.mgmt.compute.models.GalleryInVMAccessControlProfileUpdate or JSON or + IO[bytes] + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._update_initial( + resource_group_name=resource_group_name, + gallery_name=gallery_name, + in_vm_access_control_profile_name=in_vm_access_control_profile_name, + properties=properties, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + async def _delete_initial( + self, resource_group_name: str, gallery_name: str, in_vm_access_control_profile_name: str, **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_gallery_in_vm_access_control_profiles_delete_request( + resource_group_name=resource_group_name, + gallery_name=gallery_name, + in_vm_access_control_profile_name=in_vm_access_control_profile_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_delete( + self, resource_group_name: str, gallery_name: str, in_vm_access_control_profile_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Delete a gallery inVMAccessControlProfile. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param in_vm_access_control_profile_name: The name of the gallery inVMAccessControlProfile to + be retrieved. Required. + :type in_vm_access_control_profile_name: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + gallery_name=gallery_name, + in_vm_access_control_profile_name=in_vm_access_control_profile_name, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace + def list_by_gallery( + self, resource_group_name: str, gallery_name: str, **kwargs: Any + ) -> AsyncItemPaged["_models.GalleryInVMAccessControlProfile"]: + """List gallery inVMAccessControlProfiles in a gallery. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :return: An iterator like instance of GalleryInVMAccessControlProfile + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.models.GalleryInVMAccessControlProfile] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.GalleryInVMAccessControlProfile]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_gallery_in_vm_access_control_profiles_list_by_gallery_request( + resource_group_name=resource_group_name, + gallery_name=gallery_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.GalleryInVMAccessControlProfile], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + +class GalleryInVMAccessControlProfileVersionsOperations: # pylint: disable=name-too-long + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.compute.aio.ComputeClient`'s + :attr:`gallery_in_vm_access_control_profile_versions` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace_async + async def get( + self, + resource_group_name: str, + gallery_name: str, + in_vm_access_control_profile_name: str, + in_vm_access_control_profile_version_name: str, + **kwargs: Any + ) -> _models.GalleryInVMAccessControlProfileVersion: + """Retrieves information about a gallery inVMAccessControlProfile version. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param in_vm_access_control_profile_name: The name of the gallery inVMAccessControlProfile to + be retrieved. Required. + :type in_vm_access_control_profile_name: str + :param in_vm_access_control_profile_version_name: The name of the gallery + inVMAccessControlProfile version to be retrieved. Required. + :type in_vm_access_control_profile_version_name: str + :return: GalleryInVMAccessControlProfileVersion. The GalleryInVMAccessControlProfileVersion is + compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.GalleryInVMAccessControlProfileVersion + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.GalleryInVMAccessControlProfileVersion] = kwargs.pop("cls", None) + + _request = build_gallery_in_vm_access_control_profile_versions_get_request( + resource_group_name=resource_group_name, + gallery_name=gallery_name, + in_vm_access_control_profile_name=in_vm_access_control_profile_name, + in_vm_access_control_profile_version_name=in_vm_access_control_profile_version_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.GalleryInVMAccessControlProfileVersion, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _create_or_update_initial( + self, + resource_group_name: str, + gallery_name: str, + in_vm_access_control_profile_name: str, + in_vm_access_control_profile_version_name: str, + resource: Union[_models.GalleryInVMAccessControlProfileVersion, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(resource, (IOBase, bytes)): + _content = resource + else: + _content = json.dumps(resource, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_gallery_in_vm_access_control_profile_versions_create_or_update_request( + resource_group_name=resource_group_name, + gallery_name=gallery_name, + in_vm_access_control_profile_name=in_vm_access_control_profile_name, + in_vm_access_control_profile_version_name=in_vm_access_control_profile_version_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 201: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + gallery_name: str, + in_vm_access_control_profile_name: str, + in_vm_access_control_profile_version_name: str, + resource: _models.GalleryInVMAccessControlProfileVersion, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Create or update a gallery inVMAccessControlProfile version. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param in_vm_access_control_profile_name: The name of the gallery inVMAccessControlProfile to + be retrieved. Required. + :type in_vm_access_control_profile_name: str + :param in_vm_access_control_profile_version_name: The name of the gallery + inVMAccessControlProfile version to be retrieved. Required. + :type in_vm_access_control_profile_version_name: str + :param resource: Parameters supplied to the create or update gallery inVMAccessControlProfile + version operation. Required. + :type resource: ~azure.mgmt.compute.models.GalleryInVMAccessControlProfileVersion + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + gallery_name: str, + in_vm_access_control_profile_name: str, + in_vm_access_control_profile_version_name: str, + resource: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Create or update a gallery inVMAccessControlProfile version. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param in_vm_access_control_profile_name: The name of the gallery inVMAccessControlProfile to + be retrieved. Required. + :type in_vm_access_control_profile_name: str + :param in_vm_access_control_profile_version_name: The name of the gallery + inVMAccessControlProfile version to be retrieved. Required. + :type in_vm_access_control_profile_version_name: str + :param resource: Parameters supplied to the create or update gallery inVMAccessControlProfile + version operation. Required. + :type resource: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + gallery_name: str, + in_vm_access_control_profile_name: str, + in_vm_access_control_profile_version_name: str, + resource: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Create or update a gallery inVMAccessControlProfile version. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param in_vm_access_control_profile_name: The name of the gallery inVMAccessControlProfile to + be retrieved. Required. + :type in_vm_access_control_profile_name: str + :param in_vm_access_control_profile_version_name: The name of the gallery + inVMAccessControlProfile version to be retrieved. Required. + :type in_vm_access_control_profile_version_name: str + :param resource: Parameters supplied to the create or update gallery inVMAccessControlProfile + version operation. Required. + :type resource: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + gallery_name: str, + in_vm_access_control_profile_name: str, + in_vm_access_control_profile_version_name: str, + resource: Union[_models.GalleryInVMAccessControlProfileVersion, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Create or update a gallery inVMAccessControlProfile version. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param in_vm_access_control_profile_name: The name of the gallery inVMAccessControlProfile to + be retrieved. Required. + :type in_vm_access_control_profile_name: str + :param in_vm_access_control_profile_version_name: The name of the gallery + inVMAccessControlProfile version to be retrieved. Required. + :type in_vm_access_control_profile_version_name: str + :param resource: Parameters supplied to the create or update gallery inVMAccessControlProfile + version operation. Is one of the following types: GalleryInVMAccessControlProfileVersion, JSON, + IO[bytes] Required. + :type resource: ~azure.mgmt.compute.models.GalleryInVMAccessControlProfileVersion or JSON or + IO[bytes] + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._create_or_update_initial( + resource_group_name=resource_group_name, + gallery_name=gallery_name, + in_vm_access_control_profile_name=in_vm_access_control_profile_name, + in_vm_access_control_profile_version_name=in_vm_access_control_profile_version_name, + resource=resource, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + async def _update_initial( + self, + resource_group_name: str, + gallery_name: str, + in_vm_access_control_profile_name: str, + in_vm_access_control_profile_version_name: str, + properties: Union[_models.GalleryInVMAccessControlProfileVersionUpdate, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(properties, (IOBase, bytes)): + _content = properties + else: + _content = json.dumps(properties, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_gallery_in_vm_access_control_profile_versions_update_request( + resource_group_name=resource_group_name, + gallery_name=gallery_name, + in_vm_access_control_profile_name=in_vm_access_control_profile_name, + in_vm_access_control_profile_version_name=in_vm_access_control_profile_version_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_update( + self, + resource_group_name: str, + gallery_name: str, + in_vm_access_control_profile_name: str, + in_vm_access_control_profile_version_name: str, + properties: _models.GalleryInVMAccessControlProfileVersionUpdate, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Update a gallery inVMAccessControlProfile version. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param in_vm_access_control_profile_name: The name of the gallery inVMAccessControlProfile to + be retrieved. Required. + :type in_vm_access_control_profile_name: str + :param in_vm_access_control_profile_version_name: The name of the gallery + inVMAccessControlProfile version to be retrieved. Required. + :type in_vm_access_control_profile_version_name: str + :param properties: Parameters supplied to the update gallery inVMAccessControlProfile version + operation. Required. + :type properties: ~azure.mgmt.compute.models.GalleryInVMAccessControlProfileVersionUpdate + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update( + self, + resource_group_name: str, + gallery_name: str, + in_vm_access_control_profile_name: str, + in_vm_access_control_profile_version_name: str, + properties: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Update a gallery inVMAccessControlProfile version. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param in_vm_access_control_profile_name: The name of the gallery inVMAccessControlProfile to + be retrieved. Required. + :type in_vm_access_control_profile_name: str + :param in_vm_access_control_profile_version_name: The name of the gallery + inVMAccessControlProfile version to be retrieved. Required. + :type in_vm_access_control_profile_version_name: str + :param properties: Parameters supplied to the update gallery inVMAccessControlProfile version + operation. Required. + :type properties: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update( + self, + resource_group_name: str, + gallery_name: str, + in_vm_access_control_profile_name: str, + in_vm_access_control_profile_version_name: str, + properties: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Update a gallery inVMAccessControlProfile version. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param in_vm_access_control_profile_name: The name of the gallery inVMAccessControlProfile to + be retrieved. Required. + :type in_vm_access_control_profile_name: str + :param in_vm_access_control_profile_version_name: The name of the gallery + inVMAccessControlProfile version to be retrieved. Required. + :type in_vm_access_control_profile_version_name: str + :param properties: Parameters supplied to the update gallery inVMAccessControlProfile version + operation. Required. + :type properties: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_update( + self, + resource_group_name: str, + gallery_name: str, + in_vm_access_control_profile_name: str, + in_vm_access_control_profile_version_name: str, + properties: Union[_models.GalleryInVMAccessControlProfileVersionUpdate, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Update a gallery inVMAccessControlProfile version. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param in_vm_access_control_profile_name: The name of the gallery inVMAccessControlProfile to + be retrieved. Required. + :type in_vm_access_control_profile_name: str + :param in_vm_access_control_profile_version_name: The name of the gallery + inVMAccessControlProfile version to be retrieved. Required. + :type in_vm_access_control_profile_version_name: str + :param properties: Parameters supplied to the update gallery inVMAccessControlProfile version + operation. Is one of the following types: GalleryInVMAccessControlProfileVersionUpdate, JSON, + IO[bytes] Required. + :type properties: ~azure.mgmt.compute.models.GalleryInVMAccessControlProfileVersionUpdate or + JSON or IO[bytes] + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._update_initial( + resource_group_name=resource_group_name, + gallery_name=gallery_name, + in_vm_access_control_profile_name=in_vm_access_control_profile_name, + in_vm_access_control_profile_version_name=in_vm_access_control_profile_version_name, + properties=properties, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + async def _delete_initial( + self, + resource_group_name: str, + gallery_name: str, + in_vm_access_control_profile_name: str, + in_vm_access_control_profile_version_name: str, + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_gallery_in_vm_access_control_profile_versions_delete_request( + resource_group_name=resource_group_name, + gallery_name=gallery_name, + in_vm_access_control_profile_name=in_vm_access_control_profile_name, + in_vm_access_control_profile_version_name=in_vm_access_control_profile_version_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_delete( + self, + resource_group_name: str, + gallery_name: str, + in_vm_access_control_profile_name: str, + in_vm_access_control_profile_version_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Delete a gallery inVMAccessControlProfile version. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param in_vm_access_control_profile_name: The name of the gallery inVMAccessControlProfile to + be retrieved. Required. + :type in_vm_access_control_profile_name: str + :param in_vm_access_control_profile_version_name: The name of the gallery + inVMAccessControlProfile version to be retrieved. Required. + :type in_vm_access_control_profile_version_name: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + gallery_name=gallery_name, + in_vm_access_control_profile_name=in_vm_access_control_profile_name, + in_vm_access_control_profile_version_name=in_vm_access_control_profile_version_name, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace + def list_by_gallery_in_vm_access_control_profile( # pylint: disable=name-too-long + self, resource_group_name: str, gallery_name: str, in_vm_access_control_profile_name: str, **kwargs: Any + ) -> AsyncItemPaged["_models.GalleryInVMAccessControlProfileVersion"]: + """List gallery inVMAccessControlProfile versions in a gallery inVMAccessControlProfile. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param in_vm_access_control_profile_name: The name of the gallery inVMAccessControlProfile to + be retrieved. Required. + :type in_vm_access_control_profile_name: str + :return: An iterator like instance of GalleryInVMAccessControlProfileVersion + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.models.GalleryInVMAccessControlProfileVersion] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.GalleryInVMAccessControlProfileVersion]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_gallery_in_vm_access_control_profile_versions_list_by_gallery_in_vm_access_control_profile_request( + resource_group_name=resource_group_name, + gallery_name=gallery_name, + in_vm_access_control_profile_name=in_vm_access_control_profile_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.GalleryInVMAccessControlProfileVersion], deserialized.get("value", []) + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + +class SharedGalleriesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.compute.aio.ComputeClient`'s + :attr:`shared_galleries` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace_async + async def get(self, location: str, gallery_unique_name: str, **kwargs: Any) -> _models.SharedGallery: + """Get a shared gallery by subscription id or tenant id. + + :param location: The name of the Azure region. Required. + :type location: str + :param gallery_unique_name: The unique name of the Shared Gallery. Required. + :type gallery_unique_name: str + :return: SharedGallery. The SharedGallery is compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.SharedGallery + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.SharedGallery] = kwargs.pop("cls", None) + + _request = build_shared_galleries_get_request( + location=location, + gallery_unique_name=gallery_unique_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.SharedGallery, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list( + self, location: str, *, shared_to: Optional[Union[str, _models.SharedToValues]] = None, **kwargs: Any + ) -> AsyncItemPaged["_models.SharedGallery"]: + """List shared galleries by subscription id or tenant id. + + :param location: The name of the Azure region. Required. + :type location: str + :keyword shared_to: The query parameter to decide what shared galleries to fetch when doing + listing operations. "tenant" Default value is None. + :paramtype shared_to: str or ~azure.mgmt.compute.models.SharedToValues + :return: An iterator like instance of SharedGallery + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.models.SharedGallery] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.SharedGallery]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_shared_galleries_list_request( + location=location, + subscription_id=self._config.subscription_id, + shared_to=shared_to, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.SharedGallery], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + +class SharedGalleryImagesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.compute.aio.ComputeClient`'s + :attr:`shared_gallery_images` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace_async + async def get( + self, location: str, gallery_unique_name: str, gallery_image_name: str, **kwargs: Any + ) -> _models.SharedGalleryImage: + """Get a shared gallery image by subscription id or tenant id. + + :param location: The name of the Azure region. Required. + :type location: str + :param gallery_unique_name: The unique name of the Shared Gallery. Required. + :type gallery_unique_name: str + :param gallery_image_name: The name of the Shared Gallery Image Definition from which the Image + Versions are to be listed. Required. + :type gallery_image_name: str + :return: SharedGalleryImage. The SharedGalleryImage is compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.SharedGalleryImage + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.SharedGalleryImage] = kwargs.pop("cls", None) + + _request = build_shared_gallery_images_get_request( + location=location, + gallery_unique_name=gallery_unique_name, + gallery_image_name=gallery_image_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.SharedGalleryImage, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list( + self, + location: str, + gallery_unique_name: str, + *, + shared_to: Optional[Union[str, _models.SharedToValues]] = None, + **kwargs: Any + ) -> AsyncItemPaged["_models.SharedGalleryImage"]: + """List shared gallery images by subscription id or tenant id. + + :param location: The name of the Azure region. Required. + :type location: str + :param gallery_unique_name: The unique name of the Shared Gallery. Required. + :type gallery_unique_name: str + :keyword shared_to: The query parameter to decide what shared galleries to fetch when doing + listing operations. "tenant" Default value is None. + :paramtype shared_to: str or ~azure.mgmt.compute.models.SharedToValues + :return: An iterator like instance of SharedGalleryImage + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.models.SharedGalleryImage] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.SharedGalleryImage]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_shared_gallery_images_list_request( + location=location, + gallery_unique_name=gallery_unique_name, + subscription_id=self._config.subscription_id, + shared_to=shared_to, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.SharedGalleryImage], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + +class SharedGalleryImageVersionsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.compute.aio.ComputeClient`'s + :attr:`shared_gallery_image_versions` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace_async + async def get( + self, + location: str, + gallery_unique_name: str, + gallery_image_name: str, + gallery_image_version_name: str, + **kwargs: Any + ) -> _models.SharedGalleryImageVersion: + """Get a shared gallery image version by subscription id or tenant id. + + :param location: The name of the Azure region. Required. + :type location: str + :param gallery_unique_name: The unique name of the Shared Gallery. Required. + :type gallery_unique_name: str + :param gallery_image_name: The name of the Shared Gallery Image Definition from which the Image + Versions are to be listed. Required. + :type gallery_image_name: str + :param gallery_image_version_name: The name of the gallery image version to be created. Needs + to follow semantic version name pattern: The allowed characters are digit and period. Digits + must be within the range of a 32-bit integer. Format: ... + Required. + :type gallery_image_version_name: str + :return: SharedGalleryImageVersion. The SharedGalleryImageVersion is compatible with + MutableMapping + :rtype: ~azure.mgmt.compute.models.SharedGalleryImageVersion + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.SharedGalleryImageVersion] = kwargs.pop("cls", None) + + _request = build_shared_gallery_image_versions_get_request( + location=location, + gallery_unique_name=gallery_unique_name, + gallery_image_name=gallery_image_name, + gallery_image_version_name=gallery_image_version_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.SharedGalleryImageVersion, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list( + self, + location: str, + gallery_unique_name: str, + gallery_image_name: str, + *, + shared_to: Optional[Union[str, _models.SharedToValues]] = None, + **kwargs: Any + ) -> AsyncItemPaged["_models.SharedGalleryImageVersion"]: + """List shared gallery image versions by subscription id or tenant id. + + :param location: The name of the Azure region. Required. + :type location: str + :param gallery_unique_name: The unique name of the Shared Gallery. Required. + :type gallery_unique_name: str + :param gallery_image_name: The name of the Shared Gallery Image Definition from which the Image + Versions are to be listed. Required. + :type gallery_image_name: str + :keyword shared_to: The query parameter to decide what shared galleries to fetch when doing + listing operations. "tenant" Default value is None. + :paramtype shared_to: str or ~azure.mgmt.compute.models.SharedToValues + :return: An iterator like instance of SharedGalleryImageVersion + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.models.SharedGalleryImageVersion] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.SharedGalleryImageVersion]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_shared_gallery_image_versions_list_request( + location=location, + gallery_unique_name=gallery_unique_name, + gallery_image_name=gallery_image_name, + subscription_id=self._config.subscription_id, + shared_to=shared_to, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.SharedGalleryImageVersion], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + +class CommunityGalleriesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.compute.aio.ComputeClient`'s + :attr:`community_galleries` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace_async + async def get(self, location: str, public_gallery_name: str, **kwargs: Any) -> _models.CommunityGallery: + """Get a community gallery by gallery public name. + + :param location: The name of the Azure region. Required. + :type location: str + :param public_gallery_name: The public name of the community gallery. Required. + :type public_gallery_name: str + :return: CommunityGallery. The CommunityGallery is compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.CommunityGallery + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.CommunityGallery] = kwargs.pop("cls", None) + + _request = build_community_galleries_get_request( + location=location, + public_gallery_name=public_gallery_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.CommunityGallery, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + +class CommunityGalleryImagesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.compute.aio.ComputeClient`'s + :attr:`community_gallery_images` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace_async + async def get( + self, location: str, public_gallery_name: str, gallery_image_name: str, **kwargs: Any + ) -> _models.CommunityGalleryImage: + """Get a community gallery image. + + :param location: The name of the Azure region. Required. + :type location: str + :param public_gallery_name: The public name of the community gallery. Required. + :type public_gallery_name: str + :param gallery_image_name: The name of the community gallery image definition. Required. + :type gallery_image_name: str + :return: CommunityGalleryImage. The CommunityGalleryImage is compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.CommunityGalleryImage + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.CommunityGalleryImage] = kwargs.pop("cls", None) + + _request = build_community_gallery_images_get_request( + location=location, + public_gallery_name=public_gallery_name, + gallery_image_name=gallery_image_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.CommunityGalleryImage, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list( + self, location: str, public_gallery_name: str, **kwargs: Any + ) -> AsyncItemPaged["_models.CommunityGalleryImage"]: + """List community gallery images inside a gallery. + + :param location: The name of the Azure region. Required. + :type location: str + :param public_gallery_name: The public name of the community gallery. Required. + :type public_gallery_name: str + :return: An iterator like instance of CommunityGalleryImage + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.models.CommunityGalleryImage] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.CommunityGalleryImage]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_community_gallery_images_list_request( + location=location, + public_gallery_name=public_gallery_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.CommunityGalleryImage], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + +class CommunityGalleryImageVersionsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.compute.aio.ComputeClient`'s + :attr:`community_gallery_image_versions` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace_async + async def get( + self, + location: str, + public_gallery_name: str, + gallery_image_name: str, + gallery_image_version_name: str, + **kwargs: Any + ) -> _models.CommunityGalleryImageVersion: + """Get a community gallery image version. + + :param location: The name of the Azure region. Required. + :type location: str + :param public_gallery_name: The public name of the community gallery. Required. + :type public_gallery_name: str + :param gallery_image_name: The name of the community gallery image definition. Required. + :type gallery_image_name: str + :param gallery_image_version_name: The name of the community gallery image version. Needs to + follow semantic version name pattern: The allowed characters are digit and period. Digits must + be within the range of a 32-bit integer. Format: ... + Required. + :type gallery_image_version_name: str + :return: CommunityGalleryImageVersion. The CommunityGalleryImageVersion is compatible with + MutableMapping + :rtype: ~azure.mgmt.compute.models.CommunityGalleryImageVersion + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.CommunityGalleryImageVersion] = kwargs.pop("cls", None) + + _request = build_community_gallery_image_versions_get_request( + location=location, + public_gallery_name=public_gallery_name, + gallery_image_name=gallery_image_name, + gallery_image_version_name=gallery_image_version_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.CommunityGalleryImageVersion, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list( + self, location: str, public_gallery_name: str, gallery_image_name: str, **kwargs: Any + ) -> AsyncItemPaged["_models.CommunityGalleryImageVersion"]: + """List community gallery image versions inside an image. + + :param location: The name of the Azure region. Required. + :type location: str + :param public_gallery_name: The public name of the community gallery. Required. + :type public_gallery_name: str + :param gallery_image_name: The name of the community gallery image definition. Required. + :type gallery_image_name: str + :return: An iterator like instance of CommunityGalleryImageVersion + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.models.CommunityGalleryImageVersion] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.CommunityGalleryImageVersion]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_community_gallery_image_versions_list_request( + location=location, + public_gallery_name=public_gallery_name, + gallery_image_name=gallery_image_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.CommunityGalleryImageVersion], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + +class ResourceSkusOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.compute.aio.ComputeClient`'s + :attr:`resource_skus` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list( + self, *, filter: Optional[str] = None, include_extended_locations: Optional[str] = None, **kwargs: Any + ) -> AsyncItemPaged["_models.ResourceSku"]: + """Gets the list of Microsoft.Compute SKUs available for your Subscription. + + :keyword filter: The filter to apply on the operation. Only **location** filter is supported + currently. Default value is None. + :paramtype filter: str + :keyword include_extended_locations: To Include Extended Locations information or not in the + response. Default value is None. + :paramtype include_extended_locations: str + :return: An iterator like instance of ResourceSku + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.models.ResourceSku] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.ResourceSku]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_resource_skus_list_request( + subscription_id=self._config.subscription_id, + filter=filter, + include_extended_locations=include_extended_locations, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + return _request async def extract_data(pipeline_response): - deserialized = self._deserialize("OperationListResult", pipeline_response) - list_of_elem = deserialized.value + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.ResourceSku], deserialized.get("value", [])) if cls: list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) async def get_next(next_link=None): _request = prepare_request(next_link) @@ -109,7 +39381,8 @@ async def get_next(next_link=None): if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + error = _failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/operations/_patch.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/operations/_patch.py index 8bcb627aa475..87676c65a8f0 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/operations/_patch.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/operations/_patch.py @@ -7,9 +7,9 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/operations/_proximity_placement_groups_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/operations/_proximity_placement_groups_operations.py deleted file mode 100644 index c22b1865f31c..000000000000 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/operations/_proximity_placement_groups_operations.py +++ /dev/null @@ -1,579 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from collections.abc import MutableMapping -from io import IOBase -from typing import Any, Callable, IO, Optional, TypeVar, Union, overload - -from azure.core import AsyncPipelineClient -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ..._utils.serialization import Deserializer, Serializer -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, -) -from .._configuration import ComputeManagementClientConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] -List = list - - -class ProximityPlacementGroupsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.compute.aio.ComputeManagementClient`'s - :attr:`proximity_placement_groups` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list_by_subscription(self, **kwargs: Any) -> AsyncItemPaged["_models.ProximityPlacementGroup"]: - """Lists all proximity placement groups in a subscription. - - :return: An iterator like instance of either ProximityPlacementGroup or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.models.ProximityPlacementGroup] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[_models.ProximityPlacementGroupListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_by_subscription_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - _request = HttpRequest("GET", next_link) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @distributed_trace - def list_by_resource_group( - self, resource_group_name: str, **kwargs: Any - ) -> AsyncItemPaged["_models.ProximityPlacementGroup"]: - """Lists all proximity placement groups in a resource group. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :return: An iterator like instance of either ProximityPlacementGroup or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.models.ProximityPlacementGroup] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[_models.ProximityPlacementGroupListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_by_resource_group_request( - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - _request = HttpRequest("GET", next_link) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @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. The name is case insensitive. - Required. - :type resource_group_name: str - :param proximity_placement_group_name: The name of the proximity placement group. Required. - :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 - :return: ProximityPlacementGroup or the result of cls(response) - :rtype: ~azure.mgmt.compute.models.ProximityPlacementGroup - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[_models.ProximityPlacementGroup] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - proximity_placement_group_name=proximity_placement_group_name, - subscription_id=self._config.subscription_id, - include_colocation_status=include_colocation_status, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("ProximityPlacementGroup", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def create_or_update( - self, - resource_group_name: str, - proximity_placement_group_name: str, - parameters: _models.ProximityPlacementGroup, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.ProximityPlacementGroup: - """Create or update a proximity placement group. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param proximity_placement_group_name: The name of the proximity placement group. Required. - :type proximity_placement_group_name: str - :param parameters: Parameters supplied to the Create Proximity Placement Group operation. - Required. - :type parameters: ~azure.mgmt.compute.models.ProximityPlacementGroup - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: ProximityPlacementGroup or the result of cls(response) - :rtype: ~azure.mgmt.compute.models.ProximityPlacementGroup - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def create_or_update( - self, - resource_group_name: str, - proximity_placement_group_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.ProximityPlacementGroup: - """Create or update a proximity placement group. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param proximity_placement_group_name: The name of the proximity placement group. Required. - :type proximity_placement_group_name: str - :param parameters: Parameters supplied to the Create Proximity Placement Group operation. - Required. - :type parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: ProximityPlacementGroup or the result of cls(response) - :rtype: ~azure.mgmt.compute.models.ProximityPlacementGroup - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def create_or_update( - self, - resource_group_name: str, - proximity_placement_group_name: str, - parameters: Union[_models.ProximityPlacementGroup, IO[bytes]], - **kwargs: Any - ) -> _models.ProximityPlacementGroup: - """Create or update a proximity placement group. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param proximity_placement_group_name: The name of the proximity placement group. Required. - :type proximity_placement_group_name: str - :param parameters: Parameters supplied to the Create Proximity Placement Group operation. Is - either a ProximityPlacementGroup type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.compute.models.ProximityPlacementGroup or IO[bytes] - :return: ProximityPlacementGroup or the result of cls(response) - :rtype: ~azure.mgmt.compute.models.ProximityPlacementGroup - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ProximityPlacementGroup] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _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, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - 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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def update( - self, - resource_group_name: str, - proximity_placement_group_name: str, - parameters: _models.ProximityPlacementGroupUpdate, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.ProximityPlacementGroup: - """Update a proximity placement group. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param proximity_placement_group_name: The name of the proximity placement group. Required. - :type proximity_placement_group_name: str - :param parameters: Parameters supplied to the Update Proximity Placement Group operation. - Required. - :type parameters: ~azure.mgmt.compute.models.ProximityPlacementGroupUpdate - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: ProximityPlacementGroup or the result of cls(response) - :rtype: ~azure.mgmt.compute.models.ProximityPlacementGroup - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def update( - self, - resource_group_name: str, - proximity_placement_group_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.ProximityPlacementGroup: - """Update a proximity placement group. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param proximity_placement_group_name: The name of the proximity placement group. Required. - :type proximity_placement_group_name: str - :param parameters: Parameters supplied to the Update Proximity Placement Group operation. - Required. - :type parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: ProximityPlacementGroup or the result of cls(response) - :rtype: ~azure.mgmt.compute.models.ProximityPlacementGroup - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def update( - self, - resource_group_name: str, - proximity_placement_group_name: str, - parameters: Union[_models.ProximityPlacementGroupUpdate, IO[bytes]], - **kwargs: Any - ) -> _models.ProximityPlacementGroup: - """Update a proximity placement group. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param proximity_placement_group_name: The name of the proximity placement group. Required. - :type proximity_placement_group_name: str - :param parameters: Parameters supplied to the Update Proximity Placement Group operation. Is - either a ProximityPlacementGroupUpdate type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.compute.models.ProximityPlacementGroupUpdate or IO[bytes] - :return: ProximityPlacementGroup or the result of cls(response) - :rtype: ~azure.mgmt.compute.models.ProximityPlacementGroup - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ProximityPlacementGroup] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _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, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("ProximityPlacementGroup", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def delete(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. The name is case insensitive. - Required. - :type resource_group_name: str - :param proximity_placement_group_name: The name of the proximity placement group. Required. - :type proximity_placement_group_name: str - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - - _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, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/operations/_resource_skus_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/operations/_resource_skus_operations.py deleted file mode 100644 index bb08824c2720..000000000000 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/operations/_resource_skus_operations.py +++ /dev/null @@ -1,128 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from collections.abc import MutableMapping -from typing import Any, Callable, Optional, TypeVar - -from azure.core import AsyncPipelineClient -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ..._utils.serialization import Deserializer, Serializer -from ...operations._resource_skus_operations import build_list_request -from .._configuration import ComputeManagementClientConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] -List = list - - -class ResourceSkusOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.compute.aio.ComputeManagementClient`'s - :attr:`resource_skus` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list( - self, filter: Optional[str] = None, include_extended_locations: Optional[str] = None, **kwargs: Any - ) -> AsyncItemPaged["_models.ResourceSku"]: - """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. Default value is None. - :type filter: str - :param include_extended_locations: To Include Extended Locations information or not in the - response. Default value is None. - :type include_extended_locations: str - :return: An iterator like instance of either ResourceSku or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.models.ResourceSku] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) - cls: ClsType[_models.ResourceSkusResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - subscription_id=self._config.subscription_id, - filter=filter, - include_extended_locations=include_extended_locations, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - _request = HttpRequest("GET", next_link) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("ResourceSkusResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/operations/_restore_point_collections_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/operations/_restore_point_collections_operations.py deleted file mode 100644 index fbbe59c6cd24..000000000000 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/operations/_restore_point_collections_operations.py +++ /dev/null @@ -1,652 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from collections.abc import MutableMapping -from io import IOBase -from typing import Any, AsyncIterator, Callable, IO, Optional, TypeVar, Union, cast, overload - -from azure.core import AsyncPipelineClient -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - StreamClosedError, - StreamConsumedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ..._utils.serialization import Deserializer, Serializer -from ...operations._restore_point_collections_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_all_request, - build_list_request, - build_update_request, -) -from .._configuration import ComputeManagementClientConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] -List = list - - -class RestorePointCollectionsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.compute.aio.ComputeManagementClient`'s - :attr:`restore_point_collections` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list_all(self, **kwargs: Any) -> AsyncItemPaged["_models.RestorePointCollection"]: - """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. - - :return: An iterator like instance of either RestorePointCollection or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.models.RestorePointCollection] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[_models.RestorePointCollectionListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_all_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - _request = HttpRequest("GET", next_link) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @distributed_trace - def list(self, resource_group_name: str, **kwargs: Any) -> AsyncItemPaged["_models.RestorePointCollection"]: - """Gets the list of restore point collections in a resource group. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :return: An iterator like instance of either RestorePointCollection or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.models.RestorePointCollection] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[_models.RestorePointCollectionListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - _request = HttpRequest("GET", next_link) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @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. The name is case insensitive. - Required. - :type resource_group_name: str - :param restore_point_collection_name: The name of the restore point collection. Required. - :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. "restorePoints" Default - value is None. - :type expand: str or ~azure.mgmt.compute.models.RestorePointCollectionExpandOptions - :return: RestorePointCollection or the result of cls(response) - :rtype: ~azure.mgmt.compute.models.RestorePointCollection - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[_models.RestorePointCollection] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - restore_point_collection_name=restore_point_collection_name, - subscription_id=self._config.subscription_id, - expand=expand, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("RestorePointCollection", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def create_or_update( - self, - resource_group_name: str, - restore_point_collection_name: str, - parameters: _models.RestorePointCollection, - *, - content_type: str = "application/json", - **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. The name is case insensitive. - Required. - :type resource_group_name: str - :param restore_point_collection_name: The name of the restore point collection. Required. - :type restore_point_collection_name: str - :param parameters: Parameters supplied to the Create or Update restore point collection - operation. Required. - :type parameters: ~azure.mgmt.compute.models.RestorePointCollection - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: RestorePointCollection or the result of cls(response) - :rtype: ~azure.mgmt.compute.models.RestorePointCollection - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def create_or_update( - self, - resource_group_name: str, - restore_point_collection_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **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. The name is case insensitive. - Required. - :type resource_group_name: str - :param restore_point_collection_name: The name of the restore point collection. Required. - :type restore_point_collection_name: str - :param parameters: Parameters supplied to the Create or Update restore point collection - operation. Required. - :type parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: RestorePointCollection or the result of cls(response) - :rtype: ~azure.mgmt.compute.models.RestorePointCollection - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def create_or_update( - self, - resource_group_name: str, - restore_point_collection_name: str, - parameters: Union[_models.RestorePointCollection, IO[bytes]], - **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. The name is case insensitive. - Required. - :type resource_group_name: str - :param restore_point_collection_name: The name of the restore point collection. Required. - :type restore_point_collection_name: str - :param parameters: Parameters supplied to the Create or Update restore point collection - operation. Is either a RestorePointCollection type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.compute.models.RestorePointCollection or IO[bytes] - :return: RestorePointCollection or the result of cls(response) - :rtype: ~azure.mgmt.compute.models.RestorePointCollection - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.RestorePointCollection] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "RestorePointCollection") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - restore_point_collection_name=restore_point_collection_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - 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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def update( - self, - resource_group_name: str, - restore_point_collection_name: str, - parameters: _models.RestorePointCollectionUpdate, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.RestorePointCollection: - """The operation to update the restore point collection. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param restore_point_collection_name: The name of the restore point collection. Required. - :type restore_point_collection_name: str - :param parameters: Parameters supplied to the Update restore point collection operation. - Required. - :type parameters: ~azure.mgmt.compute.models.RestorePointCollectionUpdate - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: RestorePointCollection or the result of cls(response) - :rtype: ~azure.mgmt.compute.models.RestorePointCollection - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def update( - self, - resource_group_name: str, - restore_point_collection_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.RestorePointCollection: - """The operation to update the restore point collection. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param restore_point_collection_name: The name of the restore point collection. Required. - :type restore_point_collection_name: str - :param parameters: Parameters supplied to the Update restore point collection operation. - Required. - :type parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: RestorePointCollection or the result of cls(response) - :rtype: ~azure.mgmt.compute.models.RestorePointCollection - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def update( - self, - resource_group_name: str, - restore_point_collection_name: str, - parameters: Union[_models.RestorePointCollectionUpdate, IO[bytes]], - **kwargs: Any - ) -> _models.RestorePointCollection: - """The operation to update the restore point collection. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param restore_point_collection_name: The name of the restore point collection. Required. - :type restore_point_collection_name: str - :param parameters: Parameters supplied to the Update restore point collection operation. Is - either a RestorePointCollectionUpdate type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.compute.models.RestorePointCollectionUpdate or IO[bytes] - :return: RestorePointCollection or the result of cls(response) - :rtype: ~azure.mgmt.compute.models.RestorePointCollection - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.RestorePointCollection] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "RestorePointCollectionUpdate") - - _request = build_update_request( - resource_group_name=resource_group_name, - restore_point_collection_name=restore_point_collection_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("RestorePointCollection", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _delete_initial( - self, resource_group_name: str, restore_point_collection_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - restore_point_collection_name=restore_point_collection_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_delete( - 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. The name is case insensitive. - Required. - :type resource_group_name: str - :param restore_point_collection_name: The name of the restore point collection. Required. - :type restore_point_collection_name: str - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._delete_initial( - resource_group_name=resource_group_name, - restore_point_collection_name=restore_point_collection_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/operations/_restore_points_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/operations/_restore_points_operations.py deleted file mode 100644 index 7e654e2febae..000000000000 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/operations/_restore_points_operations.py +++ /dev/null @@ -1,461 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from collections.abc import MutableMapping -from io import IOBase -from typing import Any, AsyncIterator, Callable, IO, Optional, TypeVar, Union, cast, overload - -from azure.core import AsyncPipelineClient -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - StreamClosedError, - StreamConsumedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ..._utils.serialization import Deserializer, Serializer -from ...operations._restore_points_operations import build_create_request, build_delete_request, build_get_request -from .._configuration import ComputeManagementClientConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] -List = list - - -class RestorePointsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.compute.aio.ComputeManagementClient`'s - :attr:`restore_points` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @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. The name is case insensitive. - Required. - :type resource_group_name: str - :param restore_point_collection_name: The name of the restore point collection. Required. - :type restore_point_collection_name: str - :param restore_point_name: The name of the restore point. Required. - :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. "instanceView" Default value is None. - :type expand: str or ~azure.mgmt.compute.models.RestorePointExpandOptions - :return: RestorePoint or the result of cls(response) - :rtype: ~azure.mgmt.compute.models.RestorePoint - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[_models.RestorePoint] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - restore_point_collection_name=restore_point_collection_name, - restore_point_name=restore_point_name, - subscription_id=self._config.subscription_id, - expand=expand, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("RestorePoint", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_initial( - self, - resource_group_name: str, - restore_point_collection_name: str, - restore_point_name: str, - parameters: Union[_models.RestorePoint, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "RestorePoint") - - _request = build_create_request( - resource_group_name=resource_group_name, - restore_point_collection_name=restore_point_collection_name, - restore_point_name=restore_point_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [201]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create( - self, - resource_group_name: str, - restore_point_collection_name: str, - restore_point_name: str, - parameters: _models.RestorePoint, - *, - content_type: str = "application/json", - **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. The name is case insensitive. - Required. - :type resource_group_name: str - :param restore_point_collection_name: The name of the restore point collection. Required. - :type restore_point_collection_name: str - :param restore_point_name: The name of the restore point. Required. - :type restore_point_name: str - :param parameters: Parameters supplied to the Create restore point operation. Required. - :type parameters: ~azure.mgmt.compute.models.RestorePoint - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either RestorePoint or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.RestorePoint] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create( - self, - resource_group_name: str, - restore_point_collection_name: str, - restore_point_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **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. The name is case insensitive. - Required. - :type resource_group_name: str - :param restore_point_collection_name: The name of the restore point collection. Required. - :type restore_point_collection_name: str - :param restore_point_name: The name of the restore point. Required. - :type restore_point_name: str - :param parameters: Parameters supplied to the Create restore point operation. Required. - :type parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either RestorePoint or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.RestorePoint] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create( - self, - resource_group_name: str, - restore_point_collection_name: str, - restore_point_name: str, - parameters: Union[_models.RestorePoint, IO[bytes]], - **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. The name is case insensitive. - Required. - :type resource_group_name: str - :param restore_point_collection_name: The name of the restore point collection. Required. - :type restore_point_collection_name: str - :param restore_point_name: The name of the restore point. Required. - :type restore_point_name: str - :param parameters: Parameters supplied to the Create restore point operation. Is either a - RestorePoint type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.compute.models.RestorePoint or IO[bytes] - :return: An instance of AsyncLROPoller that returns either RestorePoint or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.RestorePoint] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.RestorePoint] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._create_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, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - response_headers = {} - response = pipeline_response.http_response - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = self._deserialize("RestorePoint", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.RestorePoint].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.RestorePoint]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, restore_point_collection_name: str, restore_point_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - restore_point_collection_name=restore_point_collection_name, - restore_point_name=restore_point_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_delete( - 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. The name is case insensitive. - Required. - :type resource_group_name: str - :param restore_point_collection_name: The name of the restore point collection. Required. - :type restore_point_collection_name: str - :param restore_point_name: The name of the restore point. Required. - :type restore_point_name: str - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._delete_initial( - 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, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/operations/_shared_galleries_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/operations/_shared_galleries_operations.py deleted file mode 100644 index b52c4f3387fe..000000000000 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/operations/_shared_galleries_operations.py +++ /dev/null @@ -1,181 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from collections.abc import MutableMapping -from typing import Any, Callable, Optional, TypeVar, Union - -from azure.core import AsyncPipelineClient -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ..._utils.serialization import Deserializer, Serializer -from ...operations._shared_galleries_operations import build_get_request, build_list_request -from .._configuration import ComputeManagementClientConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] -List = list - - -class SharedGalleriesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.compute.aio.ComputeManagementClient`'s - :attr:`shared_galleries` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list( - self, location: str, shared_to: Optional[Union[str, _models.SharedToValues]] = None, **kwargs: Any - ) -> AsyncItemPaged["_models.SharedGallery"]: - """List shared galleries by subscription id or tenant id. - - :param location: The name of Azure region. Required. - :type location: str - :param shared_to: The query parameter to decide what shared galleries to fetch when doing - listing operations. "tenant" Default value is None. - :type shared_to: str or ~azure.mgmt.compute.models.SharedToValues - :return: An iterator like instance of either SharedGallery or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.models.SharedGallery] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-03")) - cls: ClsType[_models.SharedGalleryList] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - location=location, - subscription_id=self._config.subscription_id, - shared_to=shared_to, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - _request = HttpRequest("GET", next_link) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("SharedGalleryList", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @distributed_trace_async - async def get(self, location: str, gallery_unique_name: str, **kwargs: Any) -> _models.SharedGallery: - """Get a shared gallery by subscription id or tenant id. - - :param location: The name of Azure region. Required. - :type location: str - :param gallery_unique_name: The unique name of the Shared Gallery. Required. - :type gallery_unique_name: str - :return: SharedGallery or the result of cls(response) - :rtype: ~azure.mgmt.compute.models.SharedGallery - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-03")) - cls: ClsType[_models.SharedGallery] = kwargs.pop("cls", None) - - _request = build_get_request( - location=location, - gallery_unique_name=gallery_unique_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("SharedGallery", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/operations/_shared_gallery_image_versions_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/operations/_shared_gallery_image_versions_operations.py deleted file mode 100644 index ca53cf36d9d5..000000000000 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/operations/_shared_gallery_image_versions_operations.py +++ /dev/null @@ -1,212 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from collections.abc import MutableMapping -from typing import Any, Callable, Optional, TypeVar, Union - -from azure.core import AsyncPipelineClient -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ..._utils.serialization import Deserializer, Serializer -from ...operations._shared_gallery_image_versions_operations import build_get_request, build_list_request -from .._configuration import ComputeManagementClientConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] -List = list - - -class SharedGalleryImageVersionsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.compute.aio.ComputeManagementClient`'s - :attr:`shared_gallery_image_versions` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list( - self, - location: str, - gallery_unique_name: str, - gallery_image_name: str, - shared_to: Optional[Union[str, _models.SharedToValues]] = None, - **kwargs: Any - ) -> AsyncItemPaged["_models.SharedGalleryImageVersion"]: - """List shared gallery image versions by subscription id or tenant id. - - :param location: The name of Azure region. Required. - :type location: str - :param gallery_unique_name: The unique name of the Shared Gallery. Required. - :type gallery_unique_name: str - :param gallery_image_name: The name of the Shared Gallery Image Definition from which the Image - Versions are to be listed. Required. - :type gallery_image_name: str - :param shared_to: The query parameter to decide what shared galleries to fetch when doing - listing operations. "tenant" Default value is None. - :type shared_to: str or ~azure.mgmt.compute.models.SharedToValues - :return: An iterator like instance of either SharedGalleryImageVersion or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.models.SharedGalleryImageVersion] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-03")) - cls: ClsType[_models.SharedGalleryImageVersionList] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - location=location, - gallery_unique_name=gallery_unique_name, - gallery_image_name=gallery_image_name, - subscription_id=self._config.subscription_id, - shared_to=shared_to, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - _request = HttpRequest("GET", next_link) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("SharedGalleryImageVersionList", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @distributed_trace_async - async def get( - self, - location: str, - gallery_unique_name: str, - gallery_image_name: str, - gallery_image_version_name: str, - **kwargs: Any - ) -> _models.SharedGalleryImageVersion: - """Get a shared gallery image version by subscription id or tenant id. - - :param location: The name of Azure region. Required. - :type location: str - :param gallery_unique_name: The unique name of the Shared Gallery. Required. - :type gallery_unique_name: str - :param gallery_image_name: The name of the Shared Gallery Image Definition from which the Image - Versions are to be listed. Required. - :type gallery_image_name: str - :param gallery_image_version_name: The name of the gallery image version to be created. Needs - to follow semantic version name pattern: The allowed characters are digit and period. Digits - must be within the range of a 32-bit integer. Format: :code:``.\\ - :code:``.\\ :code:``. Required. - :type gallery_image_version_name: str - :return: SharedGalleryImageVersion or the result of cls(response) - :rtype: ~azure.mgmt.compute.models.SharedGalleryImageVersion - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-03")) - cls: ClsType[_models.SharedGalleryImageVersion] = kwargs.pop("cls", None) - - _request = build_get_request( - location=location, - gallery_unique_name=gallery_unique_name, - gallery_image_name=gallery_image_name, - gallery_image_version_name=gallery_image_version_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("SharedGalleryImageVersion", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/operations/_shared_gallery_images_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/operations/_shared_gallery_images_operations.py deleted file mode 100644 index eecc67e41225..000000000000 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/operations/_shared_gallery_images_operations.py +++ /dev/null @@ -1,194 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from collections.abc import MutableMapping -from typing import Any, Callable, Optional, TypeVar, Union - -from azure.core import AsyncPipelineClient -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ..._utils.serialization import Deserializer, Serializer -from ...operations._shared_gallery_images_operations import build_get_request, build_list_request -from .._configuration import ComputeManagementClientConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] -List = list - - -class SharedGalleryImagesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.compute.aio.ComputeManagementClient`'s - :attr:`shared_gallery_images` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list( - self, - location: str, - gallery_unique_name: str, - shared_to: Optional[Union[str, _models.SharedToValues]] = None, - **kwargs: Any - ) -> AsyncItemPaged["_models.SharedGalleryImage"]: - """List shared gallery images by subscription id or tenant id. - - :param location: The name of Azure region. Required. - :type location: str - :param gallery_unique_name: The unique name of the Shared Gallery. Required. - :type gallery_unique_name: str - :param shared_to: The query parameter to decide what shared galleries to fetch when doing - listing operations. "tenant" Default value is None. - :type shared_to: str or ~azure.mgmt.compute.models.SharedToValues - :return: An iterator like instance of either SharedGalleryImage or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.models.SharedGalleryImage] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-03")) - cls: ClsType[_models.SharedGalleryImageList] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - location=location, - gallery_unique_name=gallery_unique_name, - subscription_id=self._config.subscription_id, - shared_to=shared_to, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - _request = HttpRequest("GET", next_link) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("SharedGalleryImageList", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @distributed_trace_async - async def get( - self, location: str, gallery_unique_name: str, gallery_image_name: str, **kwargs: Any - ) -> _models.SharedGalleryImage: - """Get a shared gallery image by subscription id or tenant id. - - :param location: The name of Azure region. Required. - :type location: str - :param gallery_unique_name: The unique name of the Shared Gallery. Required. - :type gallery_unique_name: str - :param gallery_image_name: The name of the Shared Gallery Image Definition from which the Image - Versions are to be listed. Required. - :type gallery_image_name: str - :return: SharedGalleryImage or the result of cls(response) - :rtype: ~azure.mgmt.compute.models.SharedGalleryImage - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-03")) - cls: ClsType[_models.SharedGalleryImage] = kwargs.pop("cls", None) - - _request = build_get_request( - location=location, - gallery_unique_name=gallery_unique_name, - gallery_image_name=gallery_image_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("SharedGalleryImage", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/operations/_snapshots_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/operations/_snapshots_operations.py deleted file mode 100644 index 45ccd92b4008..000000000000 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/operations/_snapshots_operations.py +++ /dev/null @@ -1,1094 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from collections.abc import MutableMapping -from io import IOBase -from typing import Any, AsyncIterator, Callable, IO, Optional, TypeVar, Union, cast, overload - -from azure.core import AsyncPipelineClient -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - StreamClosedError, - StreamConsumedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ..._utils.serialization import Deserializer, Serializer -from ...operations._snapshots_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_grant_access_request, - build_list_by_resource_group_request, - build_list_request, - build_revoke_access_request, - build_update_request, -) -from .._configuration import ComputeManagementClientConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] -List = list - - -class SnapshotsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.compute.aio.ComputeManagementClient`'s - :attr:`snapshots` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list(self, **kwargs: Any) -> AsyncItemPaged["_models.Snapshot"]: - """Lists snapshots under a subscription. - - :return: An iterator like instance of either Snapshot or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.models.Snapshot] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-01-02")) - cls: ClsType[_models.SnapshotList] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - _request = HttpRequest("GET", next_link) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("SnapshotList", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @distributed_trace - def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> AsyncItemPaged["_models.Snapshot"]: - """Lists snapshots under a resource group. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :return: An iterator like instance of either Snapshot or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.models.Snapshot] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-01-02")) - cls: ClsType[_models.SnapshotList] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_by_resource_group_request( - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - _request = HttpRequest("GET", next_link) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("SnapshotList", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @distributed_trace_async - async def get(self, resource_group_name: str, snapshot_name: str, **kwargs: Any) -> _models.Snapshot: - """Gets information about a snapshot. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param snapshot_name: The name of the snapshot that is being created. The name can't be changed - after the snapshot is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. - The max name length is 80 characters. Required. - :type snapshot_name: str - :return: Snapshot or the result of cls(response) - :rtype: ~azure.mgmt.compute.models.Snapshot - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-01-02")) - cls: ClsType[_models.Snapshot] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - snapshot_name=snapshot_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("Snapshot", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, resource_group_name: str, snapshot_name: str, snapshot: Union[_models.Snapshot, IO[bytes]], **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-01-02")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(snapshot, (IOBase, bytes)): - _content = snapshot - else: - _json = self._serialize.body(snapshot, "Snapshot") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - snapshot_name=snapshot_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - snapshot_name: str, - snapshot: _models.Snapshot, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.Snapshot]: - """Creates or updates a snapshot. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param snapshot_name: The name of the snapshot that is being created. The name can't be changed - after the snapshot is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. - The max name length is 80 characters. Required. - :type snapshot_name: str - :param snapshot: Snapshot object supplied in the body of the Put disk operation. Required. - :type snapshot: ~azure.mgmt.compute.models.Snapshot - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either Snapshot or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.Snapshot] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - snapshot_name: str, - snapshot: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.Snapshot]: - """Creates or updates a snapshot. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param snapshot_name: The name of the snapshot that is being created. The name can't be changed - after the snapshot is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. - The max name length is 80 characters. Required. - :type snapshot_name: str - :param snapshot: Snapshot object supplied in the body of the Put disk operation. Required. - :type snapshot: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either Snapshot or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.Snapshot] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, resource_group_name: str, snapshot_name: str, snapshot: Union[_models.Snapshot, IO[bytes]], **kwargs: Any - ) -> AsyncLROPoller[_models.Snapshot]: - """Creates or updates a snapshot. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param snapshot_name: The name of the snapshot that is being created. The name can't be changed - after the snapshot is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. - The max name length is 80 characters. Required. - :type snapshot_name: str - :param snapshot: Snapshot object supplied in the body of the Put disk operation. Is either a - Snapshot type or a IO[bytes] type. Required. - :type snapshot: ~azure.mgmt.compute.models.Snapshot or IO[bytes] - :return: An instance of AsyncLROPoller that returns either Snapshot or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.Snapshot] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-01-02")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Snapshot] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._create_or_update_initial( - resource_group_name=resource_group_name, - snapshot_name=snapshot_name, - snapshot=snapshot, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Snapshot", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.Snapshot].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.Snapshot]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _update_initial( - self, - resource_group_name: str, - snapshot_name: str, - snapshot: Union[_models.SnapshotUpdate, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-01-02")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(snapshot, (IOBase, bytes)): - _content = snapshot - else: - _json = self._serialize.body(snapshot, "SnapshotUpdate") - - _request = build_update_request( - resource_group_name=resource_group_name, - snapshot_name=snapshot_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_update( - self, - resource_group_name: str, - snapshot_name: str, - snapshot: _models.SnapshotUpdate, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.Snapshot]: - """Updates (patches) a snapshot. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param snapshot_name: The name of the snapshot that is being created. The name can't be changed - after the snapshot is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. - The max name length is 80 characters. Required. - :type snapshot_name: str - :param snapshot: Snapshot object supplied in the body of the Patch snapshot operation. - Required. - :type snapshot: ~azure.mgmt.compute.models.SnapshotUpdate - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either Snapshot or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.Snapshot] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update( - self, - resource_group_name: str, - snapshot_name: str, - snapshot: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.Snapshot]: - """Updates (patches) a snapshot. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param snapshot_name: The name of the snapshot that is being created. The name can't be changed - after the snapshot is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. - The max name length is 80 characters. Required. - :type snapshot_name: str - :param snapshot: Snapshot object supplied in the body of the Patch snapshot operation. - Required. - :type snapshot: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either Snapshot or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.Snapshot] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_update( - self, - resource_group_name: str, - snapshot_name: str, - snapshot: Union[_models.SnapshotUpdate, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.Snapshot]: - """Updates (patches) a snapshot. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param snapshot_name: The name of the snapshot that is being created. The name can't be changed - after the snapshot is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. - The max name length is 80 characters. Required. - :type snapshot_name: str - :param snapshot: Snapshot object supplied in the body of the Patch snapshot operation. Is - either a SnapshotUpdate type or a IO[bytes] type. Required. - :type snapshot: ~azure.mgmt.compute.models.SnapshotUpdate or IO[bytes] - :return: An instance of AsyncLROPoller that returns either Snapshot or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.Snapshot] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-01-02")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Snapshot] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._update_initial( - resource_group_name=resource_group_name, - snapshot_name=snapshot_name, - snapshot=snapshot, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Snapshot", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.Snapshot].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.Snapshot]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, snapshot_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-01-02")) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - snapshot_name=snapshot_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_delete(self, resource_group_name: str, snapshot_name: str, **kwargs: Any) -> AsyncLROPoller[None]: - """Deletes a snapshot. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param snapshot_name: The name of the snapshot that is being created. The name can't be changed - after the snapshot is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. - The max name length is 80 characters. Required. - :type snapshot_name: str - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-01-02")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._delete_initial( - resource_group_name=resource_group_name, - snapshot_name=snapshot_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _grant_access_initial( - self, - resource_group_name: str, - snapshot_name: str, - grant_access_data: Union[_models.GrantAccessData, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-01-02")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(grant_access_data, (IOBase, bytes)): - _content = grant_access_data - else: - _json = self._serialize.body(grant_access_data, "GrantAccessData") - - _request = build_grant_access_request( - resource_group_name=resource_group_name, - snapshot_name=snapshot_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_grant_access( - self, - resource_group_name: str, - snapshot_name: str, - grant_access_data: _models.GrantAccessData, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.AccessUri]: - """Grants access to a snapshot. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param snapshot_name: The name of the snapshot that is being created. The name can't be changed - after the snapshot is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. - The max name length is 80 characters. Required. - :type snapshot_name: str - :param grant_access_data: Access data object supplied in the body of the get snapshot access - operation. Required. - :type grant_access_data: ~azure.mgmt.compute.models.GrantAccessData - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either AccessUri or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.AccessUri] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_grant_access( - self, - resource_group_name: str, - snapshot_name: str, - grant_access_data: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.AccessUri]: - """Grants access to a snapshot. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param snapshot_name: The name of the snapshot that is being created. The name can't be changed - after the snapshot is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. - The max name length is 80 characters. Required. - :type snapshot_name: str - :param grant_access_data: Access data object supplied in the body of the get snapshot access - operation. Required. - :type grant_access_data: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either AccessUri or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.AccessUri] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_grant_access( - self, - resource_group_name: str, - snapshot_name: str, - grant_access_data: Union[_models.GrantAccessData, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.AccessUri]: - """Grants access to a snapshot. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param snapshot_name: The name of the snapshot that is being created. The name can't be changed - after the snapshot is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. - The max name length is 80 characters. Required. - :type snapshot_name: str - :param grant_access_data: Access data object supplied in the body of the get snapshot access - operation. Is either a GrantAccessData type or a IO[bytes] type. Required. - :type grant_access_data: ~azure.mgmt.compute.models.GrantAccessData or IO[bytes] - :return: An instance of AsyncLROPoller that returns either AccessUri or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.AccessUri] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-01-02")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AccessUri] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._grant_access_initial( - 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, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("AccessUri", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.AccessUri].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.AccessUri]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _revoke_access_initial( - self, resource_group_name: str, snapshot_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-01-02")) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_revoke_access_request( - resource_group_name=resource_group_name, - snapshot_name=snapshot_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_revoke_access( - self, resource_group_name: str, snapshot_name: str, **kwargs: Any - ) -> AsyncLROPoller[None]: - """Revokes access to a snapshot. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param snapshot_name: The name of the snapshot that is being created. The name can't be changed - after the snapshot is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. - The max name length is 80 characters. Required. - :type snapshot_name: str - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-01-02")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._revoke_access_initial( - resource_group_name=resource_group_name, - snapshot_name=snapshot_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/operations/_soft_deleted_resource_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/operations/_soft_deleted_resource_operations.py deleted file mode 100644 index 76def0df278f..000000000000 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/operations/_soft_deleted_resource_operations.py +++ /dev/null @@ -1,137 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from collections.abc import MutableMapping -from typing import Any, Callable, Optional, TypeVar - -from azure.core import AsyncPipelineClient -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ..._utils.serialization import Deserializer, Serializer -from ...operations._soft_deleted_resource_operations import build_list_by_artifact_name_request -from .._configuration import ComputeManagementClientConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] -List = list - - -class SoftDeletedResourceOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.compute.aio.ComputeManagementClient`'s - :attr:`soft_deleted_resource` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list_by_artifact_name( - self, resource_group_name: str, gallery_name: str, artifact_type: str, artifact_name: str, **kwargs: Any - ) -> AsyncItemPaged["_models.GallerySoftDeletedResource"]: - """List soft-deleted resources of an artifact in the gallery, such as soft-deleted gallery image - version of an image. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :param artifact_type: The type of the artifact to be listed, such as gallery image version. - Required. - :type artifact_type: str - :param artifact_name: The artifact name to be listed. If artifact type is Images, then the - artifact name should be the gallery image name. Required. - :type artifact_name: str - :return: An iterator like instance of either GallerySoftDeletedResource or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.models.GallerySoftDeletedResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-03")) - cls: ClsType[_models.GallerySoftDeletedResourceList] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_by_artifact_name_request( - resource_group_name=resource_group_name, - gallery_name=gallery_name, - artifact_type=artifact_type, - artifact_name=artifact_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - _request = HttpRequest("GET", next_link) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("GallerySoftDeletedResourceList", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/operations/_ssh_public_keys_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/operations/_ssh_public_keys_operations.py deleted file mode 100644 index 1150e4e22cb6..000000000000 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/operations/_ssh_public_keys_operations.py +++ /dev/null @@ -1,710 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from collections.abc import MutableMapping -from io import IOBase -from typing import Any, Callable, IO, Optional, TypeVar, Union, overload - -from azure.core import AsyncPipelineClient -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ..._utils.serialization import Deserializer, Serializer -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, -) -from .._configuration import ComputeManagementClientConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] -List = list - - -class SshPublicKeysOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.compute.aio.ComputeManagementClient`'s - :attr:`ssh_public_keys` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list_by_subscription(self, **kwargs: Any) -> AsyncItemPaged["_models.SshPublicKeyResource"]: - """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. - - :return: An iterator like instance of either SshPublicKeyResource or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.models.SshPublicKeyResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[_models.SshPublicKeysGroupListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_by_subscription_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - _request = HttpRequest("GET", next_link) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @distributed_trace - def list_by_resource_group( - self, resource_group_name: str, **kwargs: Any - ) -> AsyncItemPaged["_models.SshPublicKeyResource"]: - """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. The name is case insensitive. - Required. - :type resource_group_name: str - :return: An iterator like instance of either SshPublicKeyResource or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.models.SshPublicKeyResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[_models.SshPublicKeysGroupListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_by_resource_group_request( - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - _request = HttpRequest("GET", next_link) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @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. The name is case insensitive. - Required. - :type resource_group_name: str - :param ssh_public_key_name: The name of the SSH public key. Required. - :type ssh_public_key_name: str - :return: SshPublicKeyResource or the result of cls(response) - :rtype: ~azure.mgmt.compute.models.SshPublicKeyResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[_models.SshPublicKeyResource] = kwargs.pop("cls", None) - - _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, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("SshPublicKeyResource", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def create( - self, - resource_group_name: str, - ssh_public_key_name: str, - parameters: _models.SshPublicKeyResource, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.SshPublicKeyResource: - """Creates a new SSH public key resource. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param ssh_public_key_name: The name of the SSH public key. Required. - :type ssh_public_key_name: str - :param parameters: Parameters supplied to create the SSH public key. Required. - :type parameters: ~azure.mgmt.compute.models.SshPublicKeyResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: SshPublicKeyResource or the result of cls(response) - :rtype: ~azure.mgmt.compute.models.SshPublicKeyResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def create( - self, - resource_group_name: str, - ssh_public_key_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.SshPublicKeyResource: - """Creates a new SSH public key resource. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param ssh_public_key_name: The name of the SSH public key. Required. - :type ssh_public_key_name: str - :param parameters: Parameters supplied to create the SSH public key. Required. - :type parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: SshPublicKeyResource or the result of cls(response) - :rtype: ~azure.mgmt.compute.models.SshPublicKeyResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def create( - self, - resource_group_name: str, - ssh_public_key_name: str, - parameters: Union[_models.SshPublicKeyResource, IO[bytes]], - **kwargs: Any - ) -> _models.SshPublicKeyResource: - """Creates a new SSH public key resource. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param ssh_public_key_name: The name of the SSH public key. Required. - :type ssh_public_key_name: str - :param parameters: Parameters supplied to create the SSH public key. Is either a - SshPublicKeyResource type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.compute.models.SshPublicKeyResource or IO[bytes] - :return: SshPublicKeyResource or the result of cls(response) - :rtype: ~azure.mgmt.compute.models.SshPublicKeyResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.SshPublicKeyResource] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _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, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - 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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def update( - self, - resource_group_name: str, - ssh_public_key_name: str, - parameters: _models.SshPublicKeyUpdateResource, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.SshPublicKeyResource: - """Updates a new SSH public key resource. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param ssh_public_key_name: The name of the SSH public key. Required. - :type ssh_public_key_name: str - :param parameters: Parameters supplied to update the SSH public key. Required. - :type parameters: ~azure.mgmt.compute.models.SshPublicKeyUpdateResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: SshPublicKeyResource or the result of cls(response) - :rtype: ~azure.mgmt.compute.models.SshPublicKeyResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def update( - self, - resource_group_name: str, - ssh_public_key_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.SshPublicKeyResource: - """Updates a new SSH public key resource. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param ssh_public_key_name: The name of the SSH public key. Required. - :type ssh_public_key_name: str - :param parameters: Parameters supplied to update the SSH public key. Required. - :type parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: SshPublicKeyResource or the result of cls(response) - :rtype: ~azure.mgmt.compute.models.SshPublicKeyResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def update( - self, - resource_group_name: str, - ssh_public_key_name: str, - parameters: Union[_models.SshPublicKeyUpdateResource, IO[bytes]], - **kwargs: Any - ) -> _models.SshPublicKeyResource: - """Updates a new SSH public key resource. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param ssh_public_key_name: The name of the SSH public key. Required. - :type ssh_public_key_name: str - :param parameters: Parameters supplied to update the SSH public key. Is either a - SshPublicKeyUpdateResource type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.compute.models.SshPublicKeyUpdateResource or IO[bytes] - :return: SshPublicKeyResource or the result of cls(response) - :rtype: ~azure.mgmt.compute.models.SshPublicKeyResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.SshPublicKeyResource] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _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, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("SshPublicKeyResource", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def delete(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. The name is case insensitive. - Required. - :type resource_group_name: str - :param ssh_public_key_name: The name of the SSH public key. Required. - :type ssh_public_key_name: str - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - - _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, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 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, {}) # type: ignore - - @overload - async def generate_key_pair( - self, - resource_group_name: str, - ssh_public_key_name: str, - parameters: Optional[_models.SshGenerateKeyPairInputParameters] = None, - *, - content_type: str = "application/json", - **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. The name is case insensitive. - Required. - :type resource_group_name: str - :param ssh_public_key_name: The name of the SSH public key. Required. - :type ssh_public_key_name: str - :param parameters: Parameters supplied to generate the SSH public key. Default value is None. - :type parameters: ~azure.mgmt.compute.models.SshGenerateKeyPairInputParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: SshPublicKeyGenerateKeyPairResult or the result of cls(response) - :rtype: ~azure.mgmt.compute.models.SshPublicKeyGenerateKeyPairResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def generate_key_pair( - self, - resource_group_name: str, - ssh_public_key_name: str, - parameters: Optional[IO[bytes]] = None, - *, - content_type: str = "application/json", - **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. The name is case insensitive. - Required. - :type resource_group_name: str - :param ssh_public_key_name: The name of the SSH public key. Required. - :type ssh_public_key_name: str - :param parameters: Parameters supplied to generate the SSH public key. Default value is None. - :type parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: SshPublicKeyGenerateKeyPairResult or the result of cls(response) - :rtype: ~azure.mgmt.compute.models.SshPublicKeyGenerateKeyPairResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def generate_key_pair( - self, - resource_group_name: str, - ssh_public_key_name: str, - parameters: Optional[Union[_models.SshGenerateKeyPairInputParameters, IO[bytes]]] = None, - **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. The name is case insensitive. - Required. - :type resource_group_name: str - :param ssh_public_key_name: The name of the SSH public key. Required. - :type ssh_public_key_name: str - :param parameters: Parameters supplied to generate the SSH public key. Is either a - SshGenerateKeyPairInputParameters type or a IO[bytes] type. Default value is None. - :type parameters: ~azure.mgmt.compute.models.SshGenerateKeyPairInputParameters or IO[bytes] - :return: SshPublicKeyGenerateKeyPairResult or the result of cls(response) - :rtype: ~azure.mgmt.compute.models.SshPublicKeyGenerateKeyPairResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - content_type = content_type if parameters else None - cls: ClsType[_models.SshPublicKeyGenerateKeyPairResult] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" if parameters else None - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - if parameters is not None: - _json = self._serialize.body(parameters, "SshGenerateKeyPairInputParameters") - else: - _json = None - - _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, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("SshPublicKeyGenerateKeyPairResult", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/operations/_usage_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/operations/_usage_operations.py deleted file mode 100644 index 6dbf95b15ed7..000000000000 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/operations/_usage_operations.py +++ /dev/null @@ -1,121 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from collections.abc import MutableMapping -from typing import Any, Callable, Optional, TypeVar - -from azure.core import AsyncPipelineClient -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ..._utils.serialization import Deserializer, Serializer -from ...operations._usage_operations import build_list_request -from .._configuration import ComputeManagementClientConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] -List = list - - -class UsageOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.compute.aio.ComputeManagementClient`'s - :attr:`usage` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list(self, location: str, **kwargs: Any) -> AsyncItemPaged["_models.Usage"]: - """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 name of Azure region. Required. - :type location: str - :return: An iterator like instance of either Usage or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.models.Usage] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[_models.ListUsagesResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - location=location, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - _request = HttpRequest("GET", next_link) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/operations/_virtual_machine_extension_images_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/operations/_virtual_machine_extension_images_operations.py deleted file mode 100644 index 4efa690856e6..000000000000 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/operations/_virtual_machine_extension_images_operations.py +++ /dev/null @@ -1,250 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from collections.abc import MutableMapping -from typing import Any, Callable, Optional, TypeVar - -from azure.core import AsyncPipelineClient -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ..._utils.serialization import Deserializer, Serializer -from ...operations._virtual_machine_extension_images_operations import ( - build_get_request, - build_list_types_request, - build_list_versions_request, -) -from .._configuration import ComputeManagementClientConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] -List = list - - -class VirtualMachineExtensionImagesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.compute.aio.ComputeManagementClient`'s - :attr:`virtual_machine_extension_images` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @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 Azure region. Required. - :type location: str - :param publisher_name: Required. - :type publisher_name: str - :return: list of VirtualMachineExtensionImage or the result of cls(response) - :rtype: list[~azure.mgmt.compute.models.VirtualMachineExtensionImage] - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[List[_models.VirtualMachineExtensionImage]] = kwargs.pop("cls", None) - - _request = build_list_types_request( - location=location, - publisher_name=publisher_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("[VirtualMachineExtensionImage]", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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 Azure region. Required. - :type location: str - :param publisher_name: Required. - :type publisher_name: str - :param type: Required. - :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 - :return: list of VirtualMachineExtensionImage or the result of cls(response) - :rtype: list[~azure.mgmt.compute.models.VirtualMachineExtensionImage] - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[List[_models.VirtualMachineExtensionImage]] = kwargs.pop("cls", None) - - _request = build_list_versions_request( - location=location, - publisher_name=publisher_name, - type=type, - subscription_id=self._config.subscription_id, - filter=filter, - top=top, - orderby=orderby, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("[VirtualMachineExtensionImage]", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @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 Azure region. Required. - :type location: str - :param publisher_name: Required. - :type publisher_name: str - :param type: Required. - :type type: str - :param version: Required. - :type version: str - :return: VirtualMachineExtensionImage or the result of cls(response) - :rtype: ~azure.mgmt.compute.models.VirtualMachineExtensionImage - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[_models.VirtualMachineExtensionImage] = kwargs.pop("cls", None) - - _request = build_get_request( - location=location, - publisher_name=publisher_name, - type=type, - version=version, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("VirtualMachineExtensionImage", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/operations/_virtual_machine_extensions_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/operations/_virtual_machine_extensions_operations.py deleted file mode 100644 index 34c879fd6281..000000000000 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/operations/_virtual_machine_extensions_operations.py +++ /dev/null @@ -1,739 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from collections.abc import MutableMapping -from io import IOBase -from typing import Any, AsyncIterator, Callable, IO, Optional, TypeVar, Union, cast, overload - -from azure.core import AsyncPipelineClient -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - StreamClosedError, - StreamConsumedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ..._utils.serialization import Deserializer, Serializer -from ...operations._virtual_machine_extensions_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_request, - build_update_request, -) -from .._configuration import ComputeManagementClientConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] -List = list - - -class VirtualMachineExtensionsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.compute.aio.ComputeManagementClient`'s - :attr:`virtual_machine_extensions` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @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. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_name: The name of the virtual machine. Required. - :type vm_name: str - :param expand: The expand expression to apply on the operation. Default value is None. - :type expand: str - :return: VirtualMachineExtensionsListResult or the result of cls(response) - :rtype: ~azure.mgmt.compute.models.VirtualMachineExtensionsListResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[_models.VirtualMachineExtensionsListResult] = kwargs.pop("cls", None) - - _request = build_list_request( - resource_group_name=resource_group_name, - vm_name=vm_name, - subscription_id=self._config.subscription_id, - expand=expand, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("VirtualMachineExtensionsListResult", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_name: The name of the virtual machine. Required. - :type vm_name: str - :param vm_extension_name: The name of the virtual machine extension. Required. - :type vm_extension_name: str - :param expand: The expand expression to apply on the operation. Default value is None. - :type expand: str - :return: VirtualMachineExtension or the result of cls(response) - :rtype: ~azure.mgmt.compute.models.VirtualMachineExtension - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[_models.VirtualMachineExtension] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - vm_name=vm_name, - vm_extension_name=vm_extension_name, - subscription_id=self._config.subscription_id, - expand=expand, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("VirtualMachineExtension", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - vm_name: str, - vm_extension_name: str, - extension_parameters: Union[_models.VirtualMachineExtension, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(extension_parameters, (IOBase, bytes)): - _content = extension_parameters - else: - _json = self._serialize.body(extension_parameters, "VirtualMachineExtension") - - _request = build_create_or_update_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, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 201: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - vm_name: str, - vm_extension_name: str, - extension_parameters: _models.VirtualMachineExtension, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.VirtualMachineExtension]: - """The operation to create or update the extension. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_name: The name of the virtual machine. Required. - :type vm_name: str - :param vm_extension_name: The name of the virtual machine extension. Required. - :type vm_extension_name: str - :param extension_parameters: Parameters supplied to the Create Virtual Machine Extension - operation. Required. - :type extension_parameters: ~azure.mgmt.compute.models.VirtualMachineExtension - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either VirtualMachineExtension or the - result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.VirtualMachineExtension] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - vm_name: str, - vm_extension_name: str, - extension_parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.VirtualMachineExtension]: - """The operation to create or update the extension. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_name: The name of the virtual machine. Required. - :type vm_name: str - :param vm_extension_name: The name of the virtual machine extension. Required. - :type vm_extension_name: str - :param extension_parameters: Parameters supplied to the Create Virtual Machine Extension - operation. Required. - :type extension_parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either VirtualMachineExtension or the - result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.VirtualMachineExtension] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - vm_name: str, - vm_extension_name: str, - extension_parameters: Union[_models.VirtualMachineExtension, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.VirtualMachineExtension]: - """The operation to create or update the extension. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_name: The name of the virtual machine. Required. - :type vm_name: str - :param vm_extension_name: The name of the virtual machine extension. Required. - :type vm_extension_name: str - :param extension_parameters: Parameters supplied to the Create Virtual Machine Extension - operation. Is either a VirtualMachineExtension type or a IO[bytes] type. Required. - :type extension_parameters: ~azure.mgmt.compute.models.VirtualMachineExtension or IO[bytes] - :return: An instance of AsyncLROPoller that returns either VirtualMachineExtension or the - result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.VirtualMachineExtension] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.VirtualMachineExtension] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._create_or_update_initial( - resource_group_name=resource_group_name, - 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, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("VirtualMachineExtension", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.VirtualMachineExtension].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.VirtualMachineExtension]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _update_initial( - self, - resource_group_name: str, - vm_name: str, - vm_extension_name: str, - extension_parameters: Union[_models.VirtualMachineExtensionUpdate, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(extension_parameters, (IOBase, bytes)): - _content = extension_parameters - else: - _json = self._serialize.body(extension_parameters, "VirtualMachineExtensionUpdate") - - _request = build_update_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, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_update( - self, - resource_group_name: str, - vm_name: str, - vm_extension_name: str, - extension_parameters: _models.VirtualMachineExtensionUpdate, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.VirtualMachineExtension]: - """The operation to update the extension. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_name: The name of the virtual machine. Required. - :type vm_name: str - :param vm_extension_name: The name of the virtual machine extension. Required. - :type vm_extension_name: str - :param extension_parameters: Parameters supplied to the Update Virtual Machine Extension - operation. Required. - :type extension_parameters: ~azure.mgmt.compute.models.VirtualMachineExtensionUpdate - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either VirtualMachineExtension or the - result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.VirtualMachineExtension] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update( - self, - resource_group_name: str, - vm_name: str, - vm_extension_name: str, - extension_parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.VirtualMachineExtension]: - """The operation to update the extension. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_name: The name of the virtual machine. Required. - :type vm_name: str - :param vm_extension_name: The name of the virtual machine extension. Required. - :type vm_extension_name: str - :param extension_parameters: Parameters supplied to the Update Virtual Machine Extension - operation. Required. - :type extension_parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either VirtualMachineExtension or the - result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.VirtualMachineExtension] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_update( - self, - resource_group_name: str, - vm_name: str, - vm_extension_name: str, - extension_parameters: Union[_models.VirtualMachineExtensionUpdate, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.VirtualMachineExtension]: - """The operation to update the extension. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_name: The name of the virtual machine. Required. - :type vm_name: str - :param vm_extension_name: The name of the virtual machine extension. Required. - :type vm_extension_name: str - :param extension_parameters: Parameters supplied to the Update Virtual Machine Extension - operation. Is either a VirtualMachineExtensionUpdate type or a IO[bytes] type. Required. - :type extension_parameters: ~azure.mgmt.compute.models.VirtualMachineExtensionUpdate or - IO[bytes] - :return: An instance of AsyncLROPoller that returns either VirtualMachineExtension or the - result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.VirtualMachineExtension] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.VirtualMachineExtension] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._update_initial( - resource_group_name=resource_group_name, - 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, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - response_headers = {} - response = pipeline_response.http_response - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = self._deserialize("VirtualMachineExtension", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.VirtualMachineExtension].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.VirtualMachineExtension]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, vm_name: str, vm_extension_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_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, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_delete( - 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. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_name: The name of the virtual machine. Required. - :type vm_name: str - :param vm_extension_name: The name of the virtual machine extension. Required. - :type vm_extension_name: str - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._delete_initial( - 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, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/operations/_virtual_machine_images_edge_zone_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/operations/_virtual_machine_images_edge_zone_operations.py deleted file mode 100644 index c9bb9aa28aaa..000000000000 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/operations/_virtual_machine_images_edge_zone_operations.py +++ /dev/null @@ -1,392 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from collections.abc import MutableMapping -from typing import Any, Callable, Optional, TypeVar - -from azure.core import AsyncPipelineClient -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ..._utils.serialization import Deserializer, Serializer -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, -) -from .._configuration import ComputeManagementClientConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] -List = list - - -class VirtualMachineImagesEdgeZoneOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.compute.aio.ComputeManagementClient`'s - :attr:`virtual_machine_images_edge_zone` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @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 Azure region. Required. - :type location: str - :param edge_zone: The name of the edge zone. Required. - :type edge_zone: str - :return: list of VirtualMachineImageResource or the result of cls(response) - :rtype: list[~azure.mgmt.compute.models.VirtualMachineImageResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[List[_models.VirtualMachineImageResource]] = kwargs.pop("cls", None) - - _request = build_list_publishers_request( - location=location, - edge_zone=edge_zone, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("[VirtualMachineImageResource]", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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 Azure region. Required. - :type location: str - :param edge_zone: The name of the edge zone. Required. - :type edge_zone: str - :param publisher_name: A valid image publisher. Required. - :type publisher_name: str - :return: list of VirtualMachineImageResource or the result of cls(response) - :rtype: list[~azure.mgmt.compute.models.VirtualMachineImageResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[List[_models.VirtualMachineImageResource]] = kwargs.pop("cls", None) - - _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, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("[VirtualMachineImageResource]", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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 Azure region. Required. - :type location: str - :param edge_zone: The name of the edge zone. Required. - :type edge_zone: str - :param publisher_name: A valid image publisher. Required. - :type publisher_name: str - :param offer: A valid image publisher offer. Required. - :type offer: str - :return: list of VirtualMachineImageResource or the result of cls(response) - :rtype: list[~azure.mgmt.compute.models.VirtualMachineImageResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[List[_models.VirtualMachineImageResource]] = kwargs.pop("cls", None) - - _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, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("[VirtualMachineImageResource]", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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 Azure region. Required. - :type location: str - :param edge_zone: The name of the edge zone. Required. - :type edge_zone: str - :param publisher_name: A valid image publisher. Required. - :type publisher_name: str - :param offer: A valid image publisher offer. Required. - :type offer: str - :param skus: A valid image SKU. Required. - :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 - :return: list of VirtualMachineImageResource or the result of cls(response) - :rtype: list[~azure.mgmt.compute.models.VirtualMachineImageResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[List[_models.VirtualMachineImageResource]] = kwargs.pop("cls", None) - - _request = build_list_request( - location=location, - edge_zone=edge_zone, - publisher_name=publisher_name, - offer=offer, - skus=skus, - subscription_id=self._config.subscription_id, - expand=expand, - top=top, - orderby=orderby, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("[VirtualMachineImageResource]", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @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 Azure region. Required. - :type location: str - :param edge_zone: The name of the edge zone. Required. - :type edge_zone: str - :param publisher_name: A valid image publisher. Required. - :type publisher_name: str - :param offer: A valid image publisher offer. Required. - :type offer: str - :param skus: A valid image SKU. Required. - :type skus: str - :param version: A valid image SKU version. Required. - :type version: str - :return: VirtualMachineImage or the result of cls(response) - :rtype: ~azure.mgmt.compute.models.VirtualMachineImage - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[_models.VirtualMachineImage] = kwargs.pop("cls", None) - - _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, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("VirtualMachineImage", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/operations/_virtual_machine_images_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/operations/_virtual_machine_images_operations.py deleted file mode 100644 index e29b4464cc90..000000000000 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/operations/_virtual_machine_images_operations.py +++ /dev/null @@ -1,507 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from collections.abc import MutableMapping -from typing import Any, Callable, Optional, TypeVar - -from azure.core import AsyncPipelineClient -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ..._utils.serialization import Deserializer, Serializer -from ...operations._virtual_machine_images_operations import ( - build_get_request, - build_list_by_edge_zone_request, - build_list_offers_request, - build_list_publishers_request, - build_list_request, - build_list_skus_request, - build_list_with_properties_request, -) -from .._configuration import ComputeManagementClientConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] -List = list - - -class VirtualMachineImagesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.compute.aio.ComputeManagementClient`'s - :attr:`virtual_machine_images` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace_async - async def list_by_edge_zone( - self, location: str, edge_zone: str, **kwargs: Any - ) -> _models.VmImagesInEdgeZoneListResult: - """Gets a list of all virtual machine image versions for the specified edge zone. - - :param location: The name of Azure region. Required. - :type location: str - :param edge_zone: The name of the edge zone. Required. - :type edge_zone: str - :return: VmImagesInEdgeZoneListResult or the result of cls(response) - :rtype: ~azure.mgmt.compute.models.VmImagesInEdgeZoneListResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[_models.VmImagesInEdgeZoneListResult] = kwargs.pop("cls", None) - - _request = build_list_by_edge_zone_request( - location=location, - edge_zone=edge_zone, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("VmImagesInEdgeZoneListResult", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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 Azure region. Required. - :type location: str - :return: list of VirtualMachineImageResource or the result of cls(response) - :rtype: list[~azure.mgmt.compute.models.VirtualMachineImageResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[List[_models.VirtualMachineImageResource]] = kwargs.pop("cls", None) - - _request = build_list_publishers_request( - location=location, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("[VirtualMachineImageResource]", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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 Azure region. Required. - :type location: str - :param publisher_name: A valid image publisher. Required. - :type publisher_name: str - :return: list of VirtualMachineImageResource or the result of cls(response) - :rtype: list[~azure.mgmt.compute.models.VirtualMachineImageResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[List[_models.VirtualMachineImageResource]] = kwargs.pop("cls", None) - - _request = build_list_offers_request( - location=location, - publisher_name=publisher_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("[VirtualMachineImageResource]", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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 Azure region. Required. - :type location: str - :param publisher_name: A valid image publisher. Required. - :type publisher_name: str - :param offer: A valid image publisher offer. Required. - :type offer: str - :return: list of VirtualMachineImageResource or the result of cls(response) - :rtype: list[~azure.mgmt.compute.models.VirtualMachineImageResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[List[_models.VirtualMachineImageResource]] = kwargs.pop("cls", None) - - _request = build_list_skus_request( - location=location, - publisher_name=publisher_name, - offer=offer, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("[VirtualMachineImageResource]", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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 Azure region. Required. - :type location: str - :param publisher_name: A valid image publisher. Required. - :type publisher_name: str - :param offer: A valid image publisher offer. Required. - :type offer: str - :param skus: A valid image SKU. Required. - :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 - :return: list of VirtualMachineImageResource or the result of cls(response) - :rtype: list[~azure.mgmt.compute.models.VirtualMachineImageResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[List[_models.VirtualMachineImageResource]] = kwargs.pop("cls", None) - - _request = build_list_request( - location=location, - publisher_name=publisher_name, - offer=offer, - skus=skus, - subscription_id=self._config.subscription_id, - expand=expand, - top=top, - orderby=orderby, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("[VirtualMachineImageResource]", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @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 Azure region. Required. - :type location: str - :param publisher_name: A valid image publisher. Required. - :type publisher_name: str - :param offer: A valid image publisher offer. Required. - :type offer: str - :param skus: A valid image SKU. Required. - :type skus: str - :param version: A valid image SKU version. Required. - :type version: str - :return: VirtualMachineImage or the result of cls(response) - :rtype: ~azure.mgmt.compute.models.VirtualMachineImage - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[_models.VirtualMachineImage] = kwargs.pop("cls", None) - - _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, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("VirtualMachineImage", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def list_with_properties( - self, - location: str, - publisher_name: str, - offer: str, - skus: str, - expand: str, - top: Optional[int] = None, - orderby: Optional[str] = None, - **kwargs: Any - ) -> List[_models.VirtualMachineImage]: - """list_with_properties. - - :param location: The name of Azure region. Required. - :type location: str - :param publisher_name: A valid image publisher. Required. - :type publisher_name: str - :param offer: A valid image publisher offer. Required. - :type offer: str - :param skus: A valid image SKU. Required. - :type skus: str - :param expand: The expand expression to apply on the operation. Required. - :type expand: str - :param top: Default value is None. - :type top: int - :param orderby: Default value is None. - :type orderby: str - :return: list of VirtualMachineImage or the result of cls(response) - :rtype: list[~azure.mgmt.compute.models.VirtualMachineImage] - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[List[_models.VirtualMachineImage]] = kwargs.pop("cls", None) - - _request = build_list_with_properties_request( - location=location, - publisher_name=publisher_name, - offer=offer, - skus=skus, - subscription_id=self._config.subscription_id, - expand=expand, - top=top, - orderby=orderby, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("[VirtualMachineImage]", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/operations/_virtual_machine_run_commands_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/operations/_virtual_machine_run_commands_operations.py deleted file mode 100644 index 71e38d7bb3b2..000000000000 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/operations/_virtual_machine_run_commands_operations.py +++ /dev/null @@ -1,878 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from collections.abc import MutableMapping -from io import IOBase -from typing import Any, AsyncIterator, Callable, IO, Optional, TypeVar, Union, cast, overload - -from azure.core import AsyncPipelineClient -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - StreamClosedError, - StreamConsumedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ..._utils.serialization import Deserializer, Serializer -from ...operations._virtual_machine_run_commands_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_by_virtual_machine_request, - build_get_request, - build_list_by_virtual_machine_request, - build_list_request, - build_update_request, -) -from .._configuration import ComputeManagementClientConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] -List = list - - -class VirtualMachineRunCommandsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.compute.aio.ComputeManagementClient`'s - :attr:`virtual_machine_run_commands` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list(self, location: str, **kwargs: Any) -> AsyncItemPaged["_models.RunCommandDocumentBase"]: - """Lists all available run commands for a subscription in a location. - - :param location: The name of Azure region. Required. - :type location: str - :return: An iterator like instance of either RunCommandDocumentBase or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.models.RunCommandDocumentBase] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[_models.RunCommandListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - location=location, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - _request = HttpRequest("GET", next_link) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @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 name of Azure region. Required. - :type location: str - :param command_id: Specifies a commandId of predefined built-in script. Command IDs available - for Linux are listed at https://aka.ms/RunCommandManagedLinux#available-commands, Windows at - https://aka.ms/RunCommandManagedWindows#available-commands. Required. - :type command_id: str - :return: RunCommandDocument or the result of cls(response) - :rtype: ~azure.mgmt.compute.models.RunCommandDocument - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[_models.RunCommandDocument] = kwargs.pop("cls", None) - - _request = build_get_request( - location=location, - command_id=command_id, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("RunCommandDocument", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def list_by_virtual_machine( - self, resource_group_name: str, vm_name: str, expand: Optional[str] = None, **kwargs: Any - ) -> AsyncItemPaged["_models.VirtualMachineRunCommand"]: - """The operation to get all run commands of a Virtual Machine. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_name: The name of the VirtualMachine. Required. - :type vm_name: str - :param expand: The expand expression to apply on the operation. Default value is None. - :type expand: str - :return: An iterator like instance of either VirtualMachineRunCommand or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.models.VirtualMachineRunCommand] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[_models.VirtualMachineRunCommandsListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_by_virtual_machine_request( - resource_group_name=resource_group_name, - vm_name=vm_name, - subscription_id=self._config.subscription_id, - expand=expand, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - _request = HttpRequest("GET", next_link) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @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. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_name: The name of the VirtualMachine. Required. - :type vm_name: str - :param run_command_name: The name of the VirtualMachineRunCommand. Required. - :type run_command_name: str - :param expand: The expand expression to apply on the operation. Default value is None. - :type expand: str - :return: VirtualMachineRunCommand or the result of cls(response) - :rtype: ~azure.mgmt.compute.models.VirtualMachineRunCommand - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[_models.VirtualMachineRunCommand] = kwargs.pop("cls", None) - - _request = build_get_by_virtual_machine_request( - resource_group_name=resource_group_name, - vm_name=vm_name, - run_command_name=run_command_name, - subscription_id=self._config.subscription_id, - expand=expand, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("VirtualMachineRunCommand", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - vm_name: str, - run_command_name: str, - run_command: Union[_models.VirtualMachineRunCommand, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(run_command, (IOBase, bytes)): - _content = run_command - else: - _json = self._serialize.body(run_command, "VirtualMachineRunCommand") - - _request = build_create_or_update_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, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 201: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - vm_name: str, - run_command_name: str, - run_command: _models.VirtualMachineRunCommand, - *, - content_type: 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. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_name: The name of the VirtualMachine. Required. - :type vm_name: str - :param run_command_name: The name of the VirtualMachineRunCommand. Required. - :type run_command_name: str - :param run_command: Parameters supplied to the Create Virtual Machine RunCommand operation. - Required. - :type run_command: ~azure.mgmt.compute.models.VirtualMachineRunCommand - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either VirtualMachineRunCommand or the - result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.VirtualMachineRunCommand] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - vm_name: str, - run_command_name: str, - run_command: IO[bytes], - *, - content_type: 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. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_name: The name of the VirtualMachine. Required. - :type vm_name: str - :param run_command_name: The name of the VirtualMachineRunCommand. Required. - :type run_command_name: str - :param run_command: Parameters supplied to the Create Virtual Machine RunCommand operation. - Required. - :type run_command: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either VirtualMachineRunCommand or the - result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.VirtualMachineRunCommand] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - vm_name: str, - run_command_name: str, - run_command: Union[_models.VirtualMachineRunCommand, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.VirtualMachineRunCommand]: - """The operation to create or update the run command. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_name: The name of the VirtualMachine. Required. - :type vm_name: str - :param run_command_name: The name of the VirtualMachineRunCommand. Required. - :type run_command_name: str - :param run_command: Parameters supplied to the Create Virtual Machine RunCommand operation. Is - either a VirtualMachineRunCommand type or a IO[bytes] type. Required. - :type run_command: ~azure.mgmt.compute.models.VirtualMachineRunCommand or IO[bytes] - :return: An instance of AsyncLROPoller that returns either VirtualMachineRunCommand or the - result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.VirtualMachineRunCommand] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.VirtualMachineRunCommand] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._create_or_update_initial( - resource_group_name=resource_group_name, - vm_name=vm_name, - run_command_name=run_command_name, - run_command=run_command, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("VirtualMachineRunCommand", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.VirtualMachineRunCommand].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.VirtualMachineRunCommand]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _update_initial( - self, - resource_group_name: str, - vm_name: str, - run_command_name: str, - run_command: Union[_models.VirtualMachineRunCommandUpdate, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(run_command, (IOBase, bytes)): - _content = run_command - else: - _json = self._serialize.body(run_command, "VirtualMachineRunCommandUpdate") - - _request = build_update_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, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_update( - self, - resource_group_name: str, - vm_name: str, - run_command_name: str, - run_command: _models.VirtualMachineRunCommandUpdate, - *, - content_type: 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. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_name: The name of the VirtualMachine. Required. - :type vm_name: str - :param run_command_name: The name of the VirtualMachineRunCommand. Required. - :type run_command_name: str - :param run_command: Parameters supplied to the Update Virtual Machine RunCommand operation. - Required. - :type run_command: ~azure.mgmt.compute.models.VirtualMachineRunCommandUpdate - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either VirtualMachineRunCommand or the - result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.VirtualMachineRunCommand] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update( - self, - resource_group_name: str, - vm_name: str, - run_command_name: str, - run_command: IO[bytes], - *, - content_type: 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. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_name: The name of the VirtualMachine. Required. - :type vm_name: str - :param run_command_name: The name of the VirtualMachineRunCommand. Required. - :type run_command_name: str - :param run_command: Parameters supplied to the Update Virtual Machine RunCommand operation. - Required. - :type run_command: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either VirtualMachineRunCommand or the - result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.VirtualMachineRunCommand] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_update( - self, - resource_group_name: str, - vm_name: str, - run_command_name: str, - run_command: Union[_models.VirtualMachineRunCommandUpdate, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.VirtualMachineRunCommand]: - """The operation to update the run command. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_name: The name of the VirtualMachine. Required. - :type vm_name: str - :param run_command_name: The name of the VirtualMachineRunCommand. Required. - :type run_command_name: str - :param run_command: Parameters supplied to the Update Virtual Machine RunCommand operation. Is - either a VirtualMachineRunCommandUpdate type or a IO[bytes] type. Required. - :type run_command: ~azure.mgmt.compute.models.VirtualMachineRunCommandUpdate or IO[bytes] - :return: An instance of AsyncLROPoller that returns either VirtualMachineRunCommand or the - result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.VirtualMachineRunCommand] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.VirtualMachineRunCommand] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._update_initial( - resource_group_name=resource_group_name, - vm_name=vm_name, - run_command_name=run_command_name, - run_command=run_command, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - response_headers = {} - response = pipeline_response.http_response - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = self._deserialize("VirtualMachineRunCommand", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.VirtualMachineRunCommand].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.VirtualMachineRunCommand]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, vm_name: str, run_command_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_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, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_delete( - 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. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_name: The name of the VirtualMachine. Required. - :type vm_name: str - :param run_command_name: The name of the VirtualMachineRunCommand. Required. - :type run_command_name: str - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._delete_initial( - 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, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/operations/_virtual_machine_scale_set_extensions_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/operations/_virtual_machine_scale_set_extensions_operations.py deleted file mode 100644 index 4479d6eddff6..000000000000 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/operations/_virtual_machine_scale_set_extensions_operations.py +++ /dev/null @@ -1,759 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from collections.abc import MutableMapping -from io import IOBase -from typing import Any, AsyncIterator, Callable, IO, Optional, TypeVar, Union, cast, overload - -from azure.core import AsyncPipelineClient -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - StreamClosedError, - StreamConsumedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ..._utils.serialization import Deserializer, Serializer -from ...operations._virtual_machine_scale_set_extensions_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_request, - build_update_request, -) -from .._configuration import ComputeManagementClientConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] -List = list - - -class VirtualMachineScaleSetExtensionsOperations: # pylint: disable=name-too-long - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.compute.aio.ComputeManagementClient`'s - :attr:`virtual_machine_scale_set_extensions` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list( - self, resource_group_name: str, vm_scale_set_name: str, **kwargs: Any - ) -> AsyncItemPaged["_models.VirtualMachineScaleSetExtension"]: - """Gets a list of all extensions in a VM scale set. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :return: An iterator like instance of either VirtualMachineScaleSetExtension or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.models.VirtualMachineScaleSetExtension] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[_models.VirtualMachineScaleSetExtensionListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - _request = HttpRequest("GET", next_link) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @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. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param vmss_extension_name: The name of the VM scale set extension. Required. - :type vmss_extension_name: str - :param expand: The expand expression to apply on the operation. Default value is None. - :type expand: str - :return: VirtualMachineScaleSetExtension or the result of cls(response) - :rtype: ~azure.mgmt.compute.models.VirtualMachineScaleSetExtension - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[_models.VirtualMachineScaleSetExtension] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, - vmss_extension_name=vmss_extension_name, - subscription_id=self._config.subscription_id, - expand=expand, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("VirtualMachineScaleSetExtension", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - vm_scale_set_name: str, - vmss_extension_name: str, - extension_parameters: Union[_models.VirtualMachineScaleSetExtension, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(extension_parameters, (IOBase, bytes)): - _content = extension_parameters - else: - _json = self._serialize.body(extension_parameters, "VirtualMachineScaleSetExtension") - - _request = build_create_or_update_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, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 201: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - vm_scale_set_name: str, - vmss_extension_name: str, - extension_parameters: _models.VirtualMachineScaleSetExtension, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.VirtualMachineScaleSetExtension]: - """The operation to create or update an extension. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param vmss_extension_name: The name of the VM scale set extension. Required. - :type vmss_extension_name: str - :param extension_parameters: Parameters supplied to the Create VM scale set Extension - operation. Required. - :type extension_parameters: ~azure.mgmt.compute.models.VirtualMachineScaleSetExtension - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either VirtualMachineScaleSetExtension or - the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.VirtualMachineScaleSetExtension] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - vm_scale_set_name: str, - vmss_extension_name: str, - extension_parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.VirtualMachineScaleSetExtension]: - """The operation to create or update an extension. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param vmss_extension_name: The name of the VM scale set extension. Required. - :type vmss_extension_name: str - :param extension_parameters: Parameters supplied to the Create VM scale set Extension - operation. Required. - :type extension_parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either VirtualMachineScaleSetExtension or - the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.VirtualMachineScaleSetExtension] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @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: Union[_models.VirtualMachineScaleSetExtension, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.VirtualMachineScaleSetExtension]: - """The operation to create or update an extension. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param vmss_extension_name: The name of the VM scale set extension. Required. - :type vmss_extension_name: str - :param extension_parameters: Parameters supplied to the Create VM scale set Extension - operation. Is either a VirtualMachineScaleSetExtension type or a IO[bytes] type. Required. - :type extension_parameters: ~azure.mgmt.compute.models.VirtualMachineScaleSetExtension or - IO[bytes] - :return: An instance of AsyncLROPoller that returns either VirtualMachineScaleSetExtension or - the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.VirtualMachineScaleSetExtension] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.VirtualMachineScaleSetExtension] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._create_or_update_initial( - resource_group_name=resource_group_name, - 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, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("VirtualMachineScaleSetExtension", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.VirtualMachineScaleSetExtension].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.VirtualMachineScaleSetExtension]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _update_initial( - self, - resource_group_name: str, - vm_scale_set_name: str, - vmss_extension_name: str, - extension_parameters: Union[_models.VirtualMachineScaleSetExtensionUpdate, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(extension_parameters, (IOBase, bytes)): - _content = extension_parameters - else: - _json = self._serialize.body(extension_parameters, "VirtualMachineScaleSetExtensionUpdate") - - _request = build_update_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, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 201: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_update( - self, - resource_group_name: str, - vm_scale_set_name: str, - vmss_extension_name: str, - extension_parameters: _models.VirtualMachineScaleSetExtensionUpdate, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.VirtualMachineScaleSetExtension]: - """The operation to update an extension. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param vmss_extension_name: The name of the VM scale set extension. Required. - :type vmss_extension_name: str - :param extension_parameters: Parameters supplied to the Update VM scale set Extension - operation. Required. - :type extension_parameters: ~azure.mgmt.compute.models.VirtualMachineScaleSetExtensionUpdate - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either VirtualMachineScaleSetExtension or - the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.VirtualMachineScaleSetExtension] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update( - self, - resource_group_name: str, - vm_scale_set_name: str, - vmss_extension_name: str, - extension_parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.VirtualMachineScaleSetExtension]: - """The operation to update an extension. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param vmss_extension_name: The name of the VM scale set extension. Required. - :type vmss_extension_name: str - :param extension_parameters: Parameters supplied to the Update VM scale set Extension - operation. Required. - :type extension_parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either VirtualMachineScaleSetExtension or - the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.VirtualMachineScaleSetExtension] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_update( - self, - resource_group_name: str, - vm_scale_set_name: str, - vmss_extension_name: str, - extension_parameters: Union[_models.VirtualMachineScaleSetExtensionUpdate, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.VirtualMachineScaleSetExtension]: - """The operation to update an extension. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param vmss_extension_name: The name of the VM scale set extension. Required. - :type vmss_extension_name: str - :param extension_parameters: Parameters supplied to the Update VM scale set Extension - operation. Is either a VirtualMachineScaleSetExtensionUpdate type or a IO[bytes] type. - Required. - :type extension_parameters: ~azure.mgmt.compute.models.VirtualMachineScaleSetExtensionUpdate or - IO[bytes] - :return: An instance of AsyncLROPoller that returns either VirtualMachineScaleSetExtension or - the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.VirtualMachineScaleSetExtension] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.VirtualMachineScaleSetExtension] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._update_initial( - resource_group_name=resource_group_name, - 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, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("VirtualMachineScaleSetExtension", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.VirtualMachineScaleSetExtension].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.VirtualMachineScaleSetExtension]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, vm_scale_set_name: str, vmss_extension_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_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, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_delete( - 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. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param vmss_extension_name: The name of the VM scale set extension. Required. - :type vmss_extension_name: str - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._delete_initial( - 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, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/operations/_virtual_machine_scale_set_rolling_upgrades_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/operations/_virtual_machine_scale_set_rolling_upgrades_operations.py deleted file mode 100644 index 26c843af12a7..000000000000 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/operations/_virtual_machine_scale_set_rolling_upgrades_operations.py +++ /dev/null @@ -1,459 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from collections.abc import MutableMapping -from typing import Any, AsyncIterator, Callable, Optional, TypeVar, Union, cast - -from azure.core import AsyncPipelineClient -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - StreamClosedError, - StreamConsumedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ..._utils.serialization import Deserializer, Serializer -from ...operations._virtual_machine_scale_set_rolling_upgrades_operations import ( - build_cancel_request, - build_get_latest_request, - build_start_extension_upgrade_request, - build_start_os_upgrade_request, -) -from .._configuration import ComputeManagementClientConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] -List = list - - -class VirtualMachineScaleSetRollingUpgradesOperations: # pylint: disable=name-too-long - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.compute.aio.ComputeManagementClient`'s - :attr:`virtual_machine_scale_set_rolling_upgrades` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - async def _start_extension_upgrade_initial( - self, resource_group_name: str, vm_scale_set_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_start_extension_upgrade_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, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_start_extension_upgrade( - 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. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._start_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, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _start_os_upgrade_initial( - self, resource_group_name: str, vm_scale_set_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_start_os_upgrade_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, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_start_os_upgrade( - 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. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._start_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, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _cancel_initial( - self, resource_group_name: str, vm_scale_set_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_cancel_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, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_cancel( - 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. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._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, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # 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. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :return: RollingUpgradeStatusInfo or the result of cls(response) - :rtype: ~azure.mgmt.compute.models.RollingUpgradeStatusInfo - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[_models.RollingUpgradeStatusInfo] = kwargs.pop("cls", None) - - _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, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("RollingUpgradeStatusInfo", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/operations/_virtual_machine_scale_set_vm_extensions_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/operations/_virtual_machine_scale_set_vm_extensions_operations.py deleted file mode 100644 index 0b3526fb03ee..000000000000 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/operations/_virtual_machine_scale_set_vm_extensions_operations.py +++ /dev/null @@ -1,789 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from collections.abc import MutableMapping -from io import IOBase -from typing import Any, AsyncIterator, Callable, IO, Optional, TypeVar, Union, cast, overload - -from azure.core import AsyncPipelineClient -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - StreamClosedError, - StreamConsumedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ..._utils.serialization import Deserializer, Serializer -from ...operations._virtual_machine_scale_set_vm_extensions_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_request, - build_update_request, -) -from .._configuration import ComputeManagementClientConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] -List = list - - -class VirtualMachineScaleSetVMExtensionsOperations: # pylint: disable=name-too-long - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.compute.aio.ComputeManagementClient`'s - :attr:`virtual_machine_scale_set_vm_extensions` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @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. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param instance_id: The instance ID of the virtual machine. Required. - :type instance_id: str - :param expand: The expand expression to apply on the operation. Default value is None. - :type expand: str - :return: VirtualMachineScaleSetVMExtensionsListResult or the result of cls(response) - :rtype: ~azure.mgmt.compute.models.VirtualMachineScaleSetVMExtensionsListResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[_models.VirtualMachineScaleSetVMExtensionsListResult] = kwargs.pop("cls", None) - - _request = build_list_request( - resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, - instance_id=instance_id, - subscription_id=self._config.subscription_id, - expand=expand, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize( - "VirtualMachineScaleSetVMExtensionsListResult", pipeline_response.http_response - ) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param instance_id: The instance ID of the virtual machine. Required. - :type instance_id: str - :param vm_extension_name: The name of the virtual machine extension. Required. - :type vm_extension_name: str - :param expand: The expand expression to apply on the operation. Default value is None. - :type expand: str - :return: VirtualMachineScaleSetVMExtension or the result of cls(response) - :rtype: ~azure.mgmt.compute.models.VirtualMachineScaleSetVMExtension - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[_models.VirtualMachineScaleSetVMExtension] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, - instance_id=instance_id, - vm_extension_name=vm_extension_name, - subscription_id=self._config.subscription_id, - expand=expand, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("VirtualMachineScaleSetVMExtension", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - 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: Union[_models.VirtualMachineScaleSetVMExtension, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(extension_parameters, (IOBase, bytes)): - _content = extension_parameters - else: - _json = self._serialize.body(extension_parameters, "VirtualMachineScaleSetVMExtension") - - _request = build_create_or_update_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, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 201: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - 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, - *, - content_type: str = "application/json", - **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. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param instance_id: The instance ID of the virtual machine. Required. - :type instance_id: str - :param vm_extension_name: The name of the virtual machine extension. Required. - :type vm_extension_name: str - :param extension_parameters: Parameters supplied to the Create Virtual Machine Extension - operation. Required. - :type extension_parameters: ~azure.mgmt.compute.models.VirtualMachineScaleSetVMExtension - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either VirtualMachineScaleSetVMExtension or - the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.VirtualMachineScaleSetVMExtension] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - 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: IO[bytes], - *, - content_type: str = "application/json", - **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. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param instance_id: The instance ID of the virtual machine. Required. - :type instance_id: str - :param vm_extension_name: The name of the virtual machine extension. Required. - :type vm_extension_name: str - :param extension_parameters: Parameters supplied to the Create Virtual Machine Extension - operation. Required. - :type extension_parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either VirtualMachineScaleSetVMExtension or - the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.VirtualMachineScaleSetVMExtension] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @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: Union[_models.VirtualMachineScaleSetVMExtension, IO[bytes]], - **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. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param instance_id: The instance ID of the virtual machine. Required. - :type instance_id: str - :param vm_extension_name: The name of the virtual machine extension. Required. - :type vm_extension_name: str - :param extension_parameters: Parameters supplied to the Create Virtual Machine Extension - operation. Is either a VirtualMachineScaleSetVMExtension type or a IO[bytes] type. Required. - :type extension_parameters: ~azure.mgmt.compute.models.VirtualMachineScaleSetVMExtension or - IO[bytes] - :return: An instance of AsyncLROPoller that returns either VirtualMachineScaleSetVMExtension or - the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.VirtualMachineScaleSetVMExtension] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.VirtualMachineScaleSetVMExtension] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._create_or_update_initial( - resource_group_name=resource_group_name, - 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, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("VirtualMachineScaleSetVMExtension", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.VirtualMachineScaleSetVMExtension].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.VirtualMachineScaleSetVMExtension]( - self._client, raw_result, get_long_running_output, polling_method # 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: Union[_models.VirtualMachineScaleSetVMExtensionUpdate, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(extension_parameters, (IOBase, bytes)): - _content = extension_parameters - else: - _json = self._serialize.body(extension_parameters, "VirtualMachineScaleSetVMExtensionUpdate") - - _request = build_update_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, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - 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, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.VirtualMachineScaleSetVMExtension]: - """The operation to update the VMSS VM extension. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param instance_id: The instance ID of the virtual machine. Required. - :type instance_id: str - :param vm_extension_name: The name of the virtual machine extension. Required. - :type vm_extension_name: str - :param extension_parameters: Parameters supplied to the Update Virtual Machine Extension - operation. Required. - :type extension_parameters: ~azure.mgmt.compute.models.VirtualMachineScaleSetVMExtensionUpdate - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either VirtualMachineScaleSetVMExtension or - the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.VirtualMachineScaleSetVMExtension] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update( - self, - resource_group_name: str, - vm_scale_set_name: str, - instance_id: str, - vm_extension_name: str, - extension_parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.VirtualMachineScaleSetVMExtension]: - """The operation to update the VMSS VM extension. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param instance_id: The instance ID of the virtual machine. Required. - :type instance_id: str - :param vm_extension_name: The name of the virtual machine extension. Required. - :type vm_extension_name: str - :param extension_parameters: Parameters supplied to the Update Virtual Machine Extension - operation. Required. - :type extension_parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either VirtualMachineScaleSetVMExtension or - the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.VirtualMachineScaleSetVMExtension] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @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: Union[_models.VirtualMachineScaleSetVMExtensionUpdate, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.VirtualMachineScaleSetVMExtension]: - """The operation to update the VMSS VM extension. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param instance_id: The instance ID of the virtual machine. Required. - :type instance_id: str - :param vm_extension_name: The name of the virtual machine extension. Required. - :type vm_extension_name: str - :param extension_parameters: Parameters supplied to the Update Virtual Machine Extension - operation. Is either a VirtualMachineScaleSetVMExtensionUpdate type or a IO[bytes] type. - Required. - :type extension_parameters: ~azure.mgmt.compute.models.VirtualMachineScaleSetVMExtensionUpdate - or IO[bytes] - :return: An instance of AsyncLROPoller that returns either VirtualMachineScaleSetVMExtension or - the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.VirtualMachineScaleSetVMExtension] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.VirtualMachineScaleSetVMExtension] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._update_initial( - resource_group_name=resource_group_name, - 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, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - response_headers = {} - response = pipeline_response.http_response - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = self._deserialize("VirtualMachineScaleSetVMExtension", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.VirtualMachineScaleSetVMExtension].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.VirtualMachineScaleSetVMExtension]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, vm_scale_set_name: str, instance_id: str, vm_extension_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_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, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_delete( - 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. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param instance_id: The instance ID of the virtual machine. Required. - :type instance_id: str - :param vm_extension_name: The name of the virtual machine extension. Required. - :type vm_extension_name: str - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._delete_initial( - 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, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/operations/_virtual_machine_scale_set_vm_run_commands_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/operations/_virtual_machine_scale_set_vm_run_commands_operations.py deleted file mode 100644 index 0e0ad3884a05..000000000000 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/operations/_virtual_machine_scale_set_vm_run_commands_operations.py +++ /dev/null @@ -1,795 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from collections.abc import MutableMapping -from io import IOBase -from typing import Any, AsyncIterator, Callable, IO, Optional, TypeVar, Union, cast, overload - -from azure.core import AsyncPipelineClient -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - StreamClosedError, - StreamConsumedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ..._utils.serialization import Deserializer, Serializer -from ...operations._virtual_machine_scale_set_vm_run_commands_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_request, - build_update_request, -) -from .._configuration import ComputeManagementClientConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] -List = list - - -class VirtualMachineScaleSetVMRunCommandsOperations: # pylint: disable=name-too-long - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.compute.aio.ComputeManagementClient`'s - :attr:`virtual_machine_scale_set_vm_run_commands` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list( - self, - resource_group_name: str, - vm_scale_set_name: str, - instance_id: str, - expand: Optional[str] = None, - **kwargs: Any - ) -> AsyncItemPaged["_models.VirtualMachineRunCommand"]: - """The operation to get all run commands of an instance in Virtual Machine Scaleset. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VirtualMachineScaleSet. Required. - :type vm_scale_set_name: str - :param instance_id: The name of the VirtualMachineScaleSetVM. Required. - :type instance_id: str - :param expand: The expand expression to apply on the operation. Default value is None. - :type expand: str - :return: An iterator like instance of either VirtualMachineRunCommand or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.models.VirtualMachineRunCommand] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[_models.VirtualMachineRunCommandsListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, - instance_id=instance_id, - subscription_id=self._config.subscription_id, - expand=expand, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - _request = HttpRequest("GET", next_link) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @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. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VirtualMachineScaleSet. Required. - :type vm_scale_set_name: str - :param instance_id: The name of the VirtualMachineScaleSetVM. Required. - :type instance_id: str - :param run_command_name: The name of the VirtualMachineRunCommand. Required. - :type run_command_name: str - :param expand: The expand expression to apply on the operation. Default value is None. - :type expand: str - :return: VirtualMachineRunCommand or the result of cls(response) - :rtype: ~azure.mgmt.compute.models.VirtualMachineRunCommand - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[_models.VirtualMachineRunCommand] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, - instance_id=instance_id, - run_command_name=run_command_name, - subscription_id=self._config.subscription_id, - expand=expand, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("VirtualMachineRunCommand", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - 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: Union[_models.VirtualMachineRunCommand, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(run_command, (IOBase, bytes)): - _content = run_command - else: - _json = self._serialize.body(run_command, "VirtualMachineRunCommand") - - _request = build_create_or_update_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, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 201: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - 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: 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. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VirtualMachineScaleSet. Required. - :type vm_scale_set_name: str - :param instance_id: The name of the VirtualMachineScaleSetVM. Required. - :type instance_id: str - :param run_command_name: The name of the VirtualMachineRunCommand. Required. - :type run_command_name: str - :param run_command: Parameters supplied to the Create Virtual Machine RunCommand operation. - Required. - :type run_command: ~azure.mgmt.compute.models.VirtualMachineRunCommand - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either VirtualMachineRunCommand or the - result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.VirtualMachineRunCommand] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - 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: IO[bytes], - *, - content_type: 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. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VirtualMachineScaleSet. Required. - :type vm_scale_set_name: str - :param instance_id: The name of the VirtualMachineScaleSetVM. Required. - :type instance_id: str - :param run_command_name: The name of the VirtualMachineRunCommand. Required. - :type run_command_name: str - :param run_command: Parameters supplied to the Create Virtual Machine RunCommand operation. - Required. - :type run_command: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either VirtualMachineRunCommand or the - result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.VirtualMachineRunCommand] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @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: Union[_models.VirtualMachineRunCommand, IO[bytes]], - **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. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VirtualMachineScaleSet. Required. - :type vm_scale_set_name: str - :param instance_id: The name of the VirtualMachineScaleSetVM. Required. - :type instance_id: str - :param run_command_name: The name of the VirtualMachineRunCommand. Required. - :type run_command_name: str - :param run_command: Parameters supplied to the Create Virtual Machine RunCommand operation. Is - either a VirtualMachineRunCommand type or a IO[bytes] type. Required. - :type run_command: ~azure.mgmt.compute.models.VirtualMachineRunCommand or IO[bytes] - :return: An instance of AsyncLROPoller that returns either VirtualMachineRunCommand or the - result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.VirtualMachineRunCommand] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.VirtualMachineRunCommand] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._create_or_update_initial( - resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, - instance_id=instance_id, - run_command_name=run_command_name, - run_command=run_command, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("VirtualMachineRunCommand", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.VirtualMachineRunCommand].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.VirtualMachineRunCommand]( - self._client, raw_result, get_long_running_output, polling_method # 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: Union[_models.VirtualMachineRunCommandUpdate, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(run_command, (IOBase, bytes)): - _content = run_command - else: - _json = self._serialize.body(run_command, "VirtualMachineRunCommandUpdate") - - _request = build_update_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, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - 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: 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. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VirtualMachineScaleSet. Required. - :type vm_scale_set_name: str - :param instance_id: The name of the VirtualMachineScaleSetVM. Required. - :type instance_id: str - :param run_command_name: The name of the VirtualMachineRunCommand. Required. - :type run_command_name: str - :param run_command: Resource create parameters. Required. - :type run_command: ~azure.mgmt.compute.models.VirtualMachineRunCommandUpdate - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either VirtualMachineRunCommand or the - result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.VirtualMachineRunCommand] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update( - self, - resource_group_name: str, - vm_scale_set_name: str, - instance_id: str, - run_command_name: str, - run_command: IO[bytes], - *, - content_type: 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. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VirtualMachineScaleSet. Required. - :type vm_scale_set_name: str - :param instance_id: The name of the VirtualMachineScaleSetVM. Required. - :type instance_id: str - :param run_command_name: The name of the VirtualMachineRunCommand. Required. - :type run_command_name: str - :param run_command: Resource create parameters. Required. - :type run_command: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either VirtualMachineRunCommand or the - result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.VirtualMachineRunCommand] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @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: Union[_models.VirtualMachineRunCommandUpdate, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.VirtualMachineRunCommand]: - """The operation to update the VMSS VM run command. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VirtualMachineScaleSet. Required. - :type vm_scale_set_name: str - :param instance_id: The name of the VirtualMachineScaleSetVM. Required. - :type instance_id: str - :param run_command_name: The name of the VirtualMachineRunCommand. Required. - :type run_command_name: str - :param run_command: Resource create parameters. Is either a VirtualMachineRunCommandUpdate type - or a IO[bytes] type. Required. - :type run_command: ~azure.mgmt.compute.models.VirtualMachineRunCommandUpdate or IO[bytes] - :return: An instance of AsyncLROPoller that returns either VirtualMachineRunCommand or the - result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.VirtualMachineRunCommand] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.VirtualMachineRunCommand] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._update_initial( - resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, - instance_id=instance_id, - run_command_name=run_command_name, - run_command=run_command, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - response_headers = {} - response = pipeline_response.http_response - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = self._deserialize("VirtualMachineRunCommand", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.VirtualMachineRunCommand].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.VirtualMachineRunCommand]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, vm_scale_set_name: str, instance_id: str, run_command_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_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, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_delete( - 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. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VirtualMachineScaleSet. Required. - :type vm_scale_set_name: str - :param instance_id: The name of the VirtualMachineScaleSetVM. Required. - :type instance_id: str - :param run_command_name: The name of the VirtualMachineRunCommand. Required. - :type run_command_name: str - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._delete_initial( - 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, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/operations/_virtual_machine_scale_set_vms_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/operations/_virtual_machine_scale_set_vms_operations.py deleted file mode 100644 index aa67e4809e3d..000000000000 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/operations/_virtual_machine_scale_set_vms_operations.py +++ /dev/null @@ -1,2403 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from collections.abc import MutableMapping -from io import IOBase -from typing import Any, AsyncIterator, Callable, IO, Optional, TypeVar, Union, cast, overload - -from azure.core import AsyncPipelineClient -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - StreamClosedError, - StreamConsumedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ..._utils.serialization import Deserializer, Serializer -from ...operations._virtual_machine_scale_set_vms_operations import ( - build_approve_rolling_upgrade_request, - build_attach_detach_data_disks_request, - build_deallocate_request, - build_delete_request, - build_get_instance_view_request, - build_get_request, - build_list_request, - build_perform_maintenance_request, - build_power_off_request, - build_redeploy_request, - build_reimage_all_request, - build_reimage_request, - build_restart_request, - build_retrieve_boot_diagnostics_data_request, - build_run_command_request, - build_simulate_eviction_request, - build_start_request, - build_update_request, -) -from .._configuration import ComputeManagementClientConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] -List = list - - -class VirtualMachineScaleSetVMsOperations: # pylint: disable=too-many-public-methods - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.compute.aio.ComputeManagementClient`'s - :attr:`virtual_machine_scale_set_vms` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @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 - ) -> AsyncItemPaged["_models.VirtualMachineScaleSetVM"]: - """Gets a list of all virtual machines in a VM scale sets. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param virtual_machine_scale_set_name: The name of the VirtualMachineScaleSet. Required. - :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 - :return: An iterator like instance of either VirtualMachineScaleSetVM or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.models.VirtualMachineScaleSetVM] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[_models.VirtualMachineScaleSetVMListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - virtual_machine_scale_set_name=virtual_machine_scale_set_name, - subscription_id=self._config.subscription_id, - filter=filter, - select=select, - expand=expand, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - _request = HttpRequest("GET", next_link) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @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. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param instance_id: The instance ID of the virtual machine. Required. - :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. Known values are: "instanceView", "userData", and "resiliencyView". Default value is - None. - :type expand: str or ~azure.mgmt.compute.models.InstanceViewTypes - :return: VirtualMachineScaleSetVM or the result of cls(response) - :rtype: ~azure.mgmt.compute.models.VirtualMachineScaleSetVM - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[_models.VirtualMachineScaleSetVM] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, - instance_id=instance_id, - subscription_id=self._config.subscription_id, - expand=expand, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("VirtualMachineScaleSetVM", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _update_initial( - self, - resource_group_name: str, - vm_scale_set_name: str, - instance_id: str, - parameters: Union[_models.VirtualMachineScaleSetVM, IO[bytes]], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "VirtualMachineScaleSetVM") - - _request = build_update_request( - resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, - instance_id=instance_id, - subscription_id=self._config.subscription_id, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_update( - self, - resource_group_name: str, - vm_scale_set_name: str, - instance_id: str, - parameters: _models.VirtualMachineScaleSetVM, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.VirtualMachineScaleSetVM]: - """Updates a virtual machine of a VM scale set. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param instance_id: The instance ID of the virtual machine. Required. - :type instance_id: str - :param parameters: Parameters supplied to the Update Virtual Machine Scale Sets VM operation. - Required. - :type parameters: ~azure.mgmt.compute.models.VirtualMachineScaleSetVM - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing record set. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either VirtualMachineScaleSetVM or the - result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.VirtualMachineScaleSetVM] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update( - self, - resource_group_name: str, - vm_scale_set_name: str, - instance_id: str, - parameters: IO[bytes], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.VirtualMachineScaleSetVM]: - """Updates a virtual machine of a VM scale set. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param instance_id: The instance ID of the virtual machine. Required. - :type instance_id: str - :param parameters: Parameters supplied to the Update Virtual Machine Scale Sets VM operation. - Required. - :type parameters: IO[bytes] - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing record set. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either VirtualMachineScaleSetVM or the - result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.VirtualMachineScaleSetVM] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_update( - self, - resource_group_name: str, - vm_scale_set_name: str, - instance_id: str, - parameters: Union[_models.VirtualMachineScaleSetVM, IO[bytes]], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any - ) -> AsyncLROPoller[_models.VirtualMachineScaleSetVM]: - """Updates a virtual machine of a VM scale set. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param instance_id: The instance ID of the virtual machine. Required. - :type instance_id: str - :param parameters: Parameters supplied to the Update Virtual Machine Scale Sets VM operation. - Is either a VirtualMachineScaleSetVM type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.compute.models.VirtualMachineScaleSetVM or IO[bytes] - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing record set. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :return: An instance of AsyncLROPoller that returns either VirtualMachineScaleSetVM or the - result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.VirtualMachineScaleSetVM] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.VirtualMachineScaleSetVM] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._update_initial( - resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, - instance_id=instance_id, - parameters=parameters, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("VirtualMachineScaleSetVM", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.VirtualMachineScaleSetVM].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.VirtualMachineScaleSetVM]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, - resource_group_name: str, - vm_scale_set_name: str, - instance_id: str, - force_deletion: Optional[bool] = None, - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, - instance_id=instance_id, - subscription_id=self._config.subscription_id, - force_deletion=force_deletion, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_delete( - 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. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param instance_id: The instance ID of the virtual machine. Required. - :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 - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._delete_initial( - 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, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _approve_rolling_upgrade_initial( - self, resource_group_name: str, vm_scale_set_name: str, instance_id: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_approve_rolling_upgrade_request( - resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, - instance_id=instance_id, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [202]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_approve_rolling_upgrade( - self, resource_group_name: str, vm_scale_set_name: str, instance_id: str, **kwargs: Any - ) -> AsyncLROPoller[None]: - """Approve upgrade on deferred rolling upgrade for OS disk on a VM scale set instance. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param instance_id: The instance ID of the virtual machine. Required. - :type instance_id: str - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._approve_rolling_upgrade_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, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _attach_detach_data_disks_initial( - self, - resource_group_name: str, - vm_scale_set_name: str, - instance_id: str, - parameters: Union[_models.AttachDetachDataDisksRequest, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "AttachDetachDataDisksRequest") - - _request = build_attach_detach_data_disks_request( - resource_group_name=resource_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, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_attach_detach_data_disks( - self, - resource_group_name: str, - vm_scale_set_name: str, - instance_id: str, - parameters: _models.AttachDetachDataDisksRequest, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.StorageProfile]: - """Attach and detach data disks to/from a virtual machine in a VM scale set. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param instance_id: The instance ID of the virtual machine. Required. - :type instance_id: str - :param parameters: Parameters supplied to the attach and detach data disks operation on a - Virtual Machine Scale Sets VM. Required. - :type parameters: ~azure.mgmt.compute.models.AttachDetachDataDisksRequest - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either StorageProfile or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.StorageProfile] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_attach_detach_data_disks( - self, - resource_group_name: str, - vm_scale_set_name: str, - instance_id: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.StorageProfile]: - """Attach and detach data disks to/from a virtual machine in a VM scale set. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param instance_id: The instance ID of the virtual machine. Required. - :type instance_id: str - :param parameters: Parameters supplied to the attach and detach data disks operation on a - Virtual Machine Scale Sets VM. Required. - :type parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either StorageProfile or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.StorageProfile] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_attach_detach_data_disks( - self, - resource_group_name: str, - vm_scale_set_name: str, - instance_id: str, - parameters: Union[_models.AttachDetachDataDisksRequest, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.StorageProfile]: - """Attach and detach data disks to/from a virtual machine in a VM scale set. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param instance_id: The instance ID of the virtual machine. Required. - :type instance_id: str - :param parameters: Parameters supplied to the attach and detach data disks operation on a - Virtual Machine Scale Sets VM. Is either a AttachDetachDataDisksRequest type or a IO[bytes] - type. Required. - :type parameters: ~azure.mgmt.compute.models.AttachDetachDataDisksRequest or IO[bytes] - :return: An instance of AsyncLROPoller that returns either StorageProfile or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.StorageProfile] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.StorageProfile] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._attach_detach_data_disks_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, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("StorageProfile", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.StorageProfile].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.StorageProfile]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _deallocate_initial( - self, resource_group_name: str, vm_scale_set_name: str, instance_id: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_deallocate_request( - resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, - instance_id=instance_id, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_deallocate( - 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. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param instance_id: The instance ID of the virtual machine. Required. - :type instance_id: str - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._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, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # 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. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param instance_id: The instance ID of the virtual machine. Required. - :type instance_id: str - :return: VirtualMachineScaleSetVMInstanceView or the result of cls(response) - :rtype: ~azure.mgmt.compute.models.VirtualMachineScaleSetVMInstanceView - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[_models.VirtualMachineScaleSetVMInstanceView] = kwargs.pop("cls", None) - - _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, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("VirtualMachineScaleSetVMInstanceView", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _perform_maintenance_initial( - self, resource_group_name: str, vm_scale_set_name: str, instance_id: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_perform_maintenance_request( - resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, - instance_id=instance_id, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_perform_maintenance( - 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. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param instance_id: The instance ID of the virtual machine. Required. - :type instance_id: str - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._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, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _power_off_initial( - self, - resource_group_name: str, - vm_scale_set_name: str, - instance_id: str, - skip_shutdown: Optional[bool] = None, - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_power_off_request( - resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, - instance_id=instance_id, - subscription_id=self._config.subscription_id, - skip_shutdown=skip_shutdown, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_power_off( - self, - resource_group_name: str, - vm_scale_set_name: str, - instance_id: str, - skip_shutdown: Optional[bool] = None, - **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. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param instance_id: The instance ID of the virtual machine. Required. - :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 None. - :type skip_shutdown: bool - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._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, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _redeploy_initial( - self, resource_group_name: str, vm_scale_set_name: str, instance_id: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_redeploy_request( - resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, - instance_id=instance_id, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_redeploy( - 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. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param instance_id: The instance ID of the virtual machine. Required. - :type instance_id: str - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._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, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _reimage_initial( - self, - resource_group_name: str, - vm_scale_set_name: str, - instance_id: str, - vm_scale_set_vm_reimage_input: Optional[ - Union[_models.VirtualMachineScaleSetVMReimageParameters, IO[bytes]] - ] = None, - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - content_type = content_type if vm_scale_set_vm_reimage_input else None - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" if vm_scale_set_vm_reimage_input else None - _json = None - _content = None - if isinstance(vm_scale_set_vm_reimage_input, (IOBase, bytes)): - _content = vm_scale_set_vm_reimage_input - else: - 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( - resource_group_name=resource_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, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_reimage( - self, - resource_group_name: str, - vm_scale_set_name: str, - instance_id: str, - vm_scale_set_vm_reimage_input: Optional[_models.VirtualMachineScaleSetVMReimageParameters] = None, - *, - content_type: str = "application/json", - **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. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param instance_id: The instance ID of the virtual machine. Required. - :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.models.VirtualMachineScaleSetVMReimageParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_reimage( - self, - resource_group_name: str, - vm_scale_set_name: str, - instance_id: str, - vm_scale_set_vm_reimage_input: Optional[IO[bytes]] = None, - *, - content_type: str = "application/json", - **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. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param instance_id: The instance ID of the virtual machine. Required. - :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: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_reimage( - self, - resource_group_name: str, - vm_scale_set_name: str, - instance_id: str, - vm_scale_set_vm_reimage_input: Optional[ - Union[_models.VirtualMachineScaleSetVMReimageParameters, IO[bytes]] - ] = 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. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param instance_id: The instance ID of the virtual machine. Required. - :type instance_id: str - :param vm_scale_set_vm_reimage_input: Parameters for the Reimaging Virtual machine in ScaleSet. - Is either a VirtualMachineScaleSetVMReimageParameters type or a IO[bytes] type. Default value - is None. - :type vm_scale_set_vm_reimage_input: - ~azure.mgmt.compute.models.VirtualMachineScaleSetVMReimageParameters or IO[bytes] - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - content_type = content_type if vm_scale_set_vm_reimage_input else None - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._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, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _reimage_all_initial( - self, resource_group_name: str, vm_scale_set_name: str, instance_id: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_reimage_all_request( - resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, - instance_id=instance_id, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_reimage_all( - 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. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param instance_id: The instance ID of the virtual machine. Required. - :type instance_id: str - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._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, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _restart_initial( - self, resource_group_name: str, vm_scale_set_name: str, instance_id: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_restart_request( - resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, - instance_id=instance_id, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_restart( - 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. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param instance_id: The instance ID of the virtual machine. Required. - :type instance_id: str - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._restart_initial( - resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, - instance_id=instance_id, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # 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. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param instance_id: The instance ID of the virtual machine. Required. - :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. **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 - :return: RetrieveBootDiagnosticsDataResult or the result of cls(response) - :rtype: ~azure.mgmt.compute.models.RetrieveBootDiagnosticsDataResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[_models.RetrieveBootDiagnosticsDataResult] = kwargs.pop("cls", None) - - _request = build_retrieve_boot_diagnostics_data_request( - resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, - instance_id=instance_id, - subscription_id=self._config.subscription_id, - sas_uri_expiration_time_in_minutes=sas_uri_expiration_time_in_minutes, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("RetrieveBootDiagnosticsDataResult", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _run_command_initial( - self, - resource_group_name: str, - vm_scale_set_name: str, - instance_id: str, - parameters: Union[_models.RunCommandInput, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "RunCommandInput") - - _request = build_run_command_request( - resource_group_name=resource_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, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_run_command( - self, - resource_group_name: str, - vm_scale_set_name: str, - instance_id: str, - parameters: _models.RunCommandInput, - *, - content_type: 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. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param instance_id: The instance ID of the virtual machine. Required. - :type instance_id: str - :param parameters: Parameters supplied to the Run command operation. Required. - :type parameters: ~azure.mgmt.compute.models.RunCommandInput - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either RunCommandResult or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.RunCommandResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_run_command( - self, - resource_group_name: str, - vm_scale_set_name: str, - instance_id: str, - parameters: IO[bytes], - *, - content_type: 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. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param instance_id: The instance ID of the virtual machine. Required. - :type instance_id: str - :param parameters: Parameters supplied to the Run command operation. Required. - :type parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either RunCommandResult or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.RunCommandResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_run_command( - self, - resource_group_name: str, - vm_scale_set_name: str, - instance_id: str, - parameters: Union[_models.RunCommandInput, IO[bytes]], - **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. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param instance_id: The instance ID of the virtual machine. Required. - :type instance_id: str - :param parameters: Parameters supplied to the Run command operation. Is either a - RunCommandInput type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.compute.models.RunCommandInput or IO[bytes] - :return: An instance of AsyncLROPoller that returns either RunCommandResult or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.RunCommandResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.RunCommandResult] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._run_command_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, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("RunCommandResult", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.RunCommandResult].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.RunCommandResult]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @distributed_trace_async - async def simulate_eviction( - 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. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param instance_id: The instance ID of the virtual machine. Required. - :type instance_id: str - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - - _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, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [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, {}) # type: ignore - - async def _start_initial( - self, resource_group_name: str, vm_scale_set_name: str, instance_id: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_start_request( - resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, - instance_id=instance_id, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_start( - 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. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param instance_id: The instance ID of the virtual machine. Required. - :type instance_id: str - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._start_initial( - resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, - instance_id=instance_id, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/operations/_virtual_machine_scale_sets_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/operations/_virtual_machine_scale_sets_operations.py deleted file mode 100644 index 78c9b2c00986..000000000000 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/operations/_virtual_machine_scale_sets_operations.py +++ /dev/null @@ -1,4130 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression,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 collections.abc import MutableMapping -from io import IOBase -from typing import Any, AsyncIterator, Callable, IO, Optional, TypeVar, Union, cast, overload - -from azure.core import AsyncPipelineClient -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - StreamClosedError, - StreamConsumedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ..._utils.serialization import Deserializer, Serializer -from ...operations._virtual_machine_scale_sets_operations import ( - build_approve_rolling_upgrade_request, - build_convert_to_single_placement_group_request, - build_create_or_update_request, - build_deallocate_request, - build_delete_instances_request, - build_delete_request, - 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, - build_power_off_request, - build_reapply_request, - build_redeploy_request, - build_reimage_all_request, - build_reimage_request, - build_restart_request, - build_scale_out_request, - build_set_orchestration_service_state_request, - build_start_request, - build_update_instances_request, - build_update_request, -) -from .._configuration import ComputeManagementClientConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] -List = list - - -class VirtualMachineScaleSetsOperations: # pylint: disable=too-many-public-methods - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.compute.aio.ComputeManagementClient`'s - :attr:`virtual_machine_scale_sets` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list_by_location(self, location: str, **kwargs: Any) -> AsyncItemPaged["_models.VirtualMachineScaleSet"]: - """Gets all the VM scale sets under the specified subscription for the specified location. - - :param location: The name of Azure region. Required. - :type location: str - :return: An iterator like instance of either VirtualMachineScaleSet or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.models.VirtualMachineScaleSet] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[_models.VirtualMachineScaleSetListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_by_location_request( - location=location, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - _request = HttpRequest("GET", next_link) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @distributed_trace - def list_all(self, **kwargs: Any) -> AsyncItemPaged["_models.VirtualMachineScaleSet"]: - """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. - - :return: An iterator like instance of either VirtualMachineScaleSet or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.models.VirtualMachineScaleSet] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[_models.VirtualMachineScaleSetListWithLinkResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_all_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - _request = HttpRequest("GET", next_link) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @distributed_trace - def list(self, resource_group_name: str, **kwargs: Any) -> AsyncItemPaged["_models.VirtualMachineScaleSet"]: - """Gets a list of all VM scale sets under a resource group. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :return: An iterator like instance of either VirtualMachineScaleSet or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.models.VirtualMachineScaleSet] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[_models.VirtualMachineScaleSetListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - _request = HttpRequest("GET", next_link) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @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. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :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. "userData" Default value is None. - :type expand: str or ~azure.mgmt.compute.models.ExpandTypesForGetVMScaleSets - :return: VirtualMachineScaleSet or the result of cls(response) - :rtype: ~azure.mgmt.compute.models.VirtualMachineScaleSet - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[_models.VirtualMachineScaleSet] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, - subscription_id=self._config.subscription_id, - expand=expand, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("VirtualMachineScaleSet", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - vm_scale_set_name: str, - parameters: Union[_models.VirtualMachineScaleSet, IO[bytes]], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "VirtualMachineScaleSet") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 201: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - vm_scale_set_name: str, - parameters: _models.VirtualMachineScaleSet, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.VirtualMachineScaleSet]: - """Create or update a VM scale set. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param parameters: The scale set object. Required. - :type parameters: ~azure.mgmt.compute.models.VirtualMachineScaleSet - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing record set. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either VirtualMachineScaleSet or the result - of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.VirtualMachineScaleSet] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - vm_scale_set_name: str, - parameters: IO[bytes], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.VirtualMachineScaleSet]: - """Create or update a VM scale set. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param parameters: The scale set object. Required. - :type parameters: IO[bytes] - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing record set. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either VirtualMachineScaleSet or the result - of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.VirtualMachineScaleSet] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - vm_scale_set_name: str, - parameters: Union[_models.VirtualMachineScaleSet, IO[bytes]], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any - ) -> AsyncLROPoller[_models.VirtualMachineScaleSet]: - """Create or update a VM scale set. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param parameters: The scale set object. Is either a VirtualMachineScaleSet type or a IO[bytes] - type. Required. - :type parameters: ~azure.mgmt.compute.models.VirtualMachineScaleSet or IO[bytes] - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing record set. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :return: An instance of AsyncLROPoller that returns either VirtualMachineScaleSet or the result - of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.VirtualMachineScaleSet] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.VirtualMachineScaleSet] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._create_or_update_initial( - resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, - parameters=parameters, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("VirtualMachineScaleSet", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.VirtualMachineScaleSet].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.VirtualMachineScaleSet]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _update_initial( - self, - resource_group_name: str, - vm_scale_set_name: str, - parameters: Union[_models.VirtualMachineScaleSetUpdate, IO[bytes]], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "VirtualMachineScaleSetUpdate") - - _request = build_update_request( - resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_update( - self, - resource_group_name: str, - vm_scale_set_name: str, - parameters: _models.VirtualMachineScaleSetUpdate, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.VirtualMachineScaleSet]: - """Update a VM scale set. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param parameters: The scale set object. Required. - :type parameters: ~azure.mgmt.compute.models.VirtualMachineScaleSetUpdate - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing record set. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either VirtualMachineScaleSet or the result - of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.VirtualMachineScaleSet] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update( - self, - resource_group_name: str, - vm_scale_set_name: str, - parameters: IO[bytes], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.VirtualMachineScaleSet]: - """Update a VM scale set. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param parameters: The scale set object. Required. - :type parameters: IO[bytes] - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing record set. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either VirtualMachineScaleSet or the result - of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.VirtualMachineScaleSet] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_update( - self, - resource_group_name: str, - vm_scale_set_name: str, - parameters: Union[_models.VirtualMachineScaleSetUpdate, IO[bytes]], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any - ) -> AsyncLROPoller[_models.VirtualMachineScaleSet]: - """Update a VM scale set. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param parameters: The scale set object. Is either a VirtualMachineScaleSetUpdate type or a - IO[bytes] type. Required. - :type parameters: ~azure.mgmt.compute.models.VirtualMachineScaleSetUpdate or IO[bytes] - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing record set. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :return: An instance of AsyncLROPoller that returns either VirtualMachineScaleSet or the result - of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.VirtualMachineScaleSet] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.VirtualMachineScaleSet] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._update_initial( - resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, - parameters=parameters, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - response_headers = {} - response = pipeline_response.http_response - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = self._deserialize("VirtualMachineScaleSet", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.VirtualMachineScaleSet].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.VirtualMachineScaleSet]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, vm_scale_set_name: str, force_deletion: Optional[bool] = None, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, - subscription_id=self._config.subscription_id, - force_deletion=force_deletion, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_delete( - 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. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :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 - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._delete_initial( - 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, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _approve_rolling_upgrade_initial( - self, - resource_group_name: str, - vm_scale_set_name: str, - vm_instance_i_ds: Optional[Union[_models.VirtualMachineScaleSetVMInstanceIDs, IO[bytes]]] = None, - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - content_type = content_type if vm_instance_i_ds else None - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" if vm_instance_i_ds else None - _json = None - _content = None - if isinstance(vm_instance_i_ds, (IOBase, bytes)): - _content = vm_instance_i_ds - else: - if vm_instance_i_ds is not None: - _json = self._serialize.body(vm_instance_i_ds, "VirtualMachineScaleSetVMInstanceIDs") - else: - _json = None - - _request = build_approve_rolling_upgrade_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, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [202]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_approve_rolling_upgrade( - self, - resource_group_name: str, - vm_scale_set_name: str, - vm_instance_i_ds: Optional[_models.VirtualMachineScaleSetVMInstanceIDs] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Approve upgrade on deferred rolling upgrades for OS disks in the virtual machines in a VM scale - set. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :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.models.VirtualMachineScaleSetVMInstanceIDs - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_approve_rolling_upgrade( - self, - resource_group_name: str, - vm_scale_set_name: str, - vm_instance_i_ds: Optional[IO[bytes]] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Approve upgrade on deferred rolling upgrades for OS disks in the virtual machines in a VM scale - set. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :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: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_approve_rolling_upgrade( - self, - resource_group_name: str, - vm_scale_set_name: str, - vm_instance_i_ds: Optional[Union[_models.VirtualMachineScaleSetVMInstanceIDs, IO[bytes]]] = None, - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Approve upgrade on deferred rolling upgrades for OS disks in the virtual machines in a VM scale - set. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param vm_instance_i_ds: A list of virtual machine instance IDs from the VM scale set. Is - either a VirtualMachineScaleSetVMInstanceIDs type or a IO[bytes] type. Default value is None. - :type vm_instance_i_ds: ~azure.mgmt.compute.models.VirtualMachineScaleSetVMInstanceIDs or - IO[bytes] - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - content_type = content_type if vm_instance_i_ds else None - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._approve_rolling_upgrade_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, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @overload - async def convert_to_single_placement_group( - self, - resource_group_name: str, - vm_scale_set_name: str, - parameters: _models.VMScaleSetConvertToSinglePlacementGroupInput, - *, - content_type: str = "application/json", - **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. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param parameters: The input object for ConvertToSinglePlacementGroup API. Required. - :type parameters: ~azure.mgmt.compute.models.VMScaleSetConvertToSinglePlacementGroupInput - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def convert_to_single_placement_group( - self, - resource_group_name: str, - vm_scale_set_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **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. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param parameters: The input object for ConvertToSinglePlacementGroup API. Required. - :type parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def convert_to_single_placement_group( - self, - resource_group_name: str, - vm_scale_set_name: str, - parameters: Union[_models.VMScaleSetConvertToSinglePlacementGroupInput, IO[bytes]], - **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. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param parameters: The input object for ConvertToSinglePlacementGroup API. Is either a - VMScaleSetConvertToSinglePlacementGroupInput type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.compute.models.VMScaleSetConvertToSinglePlacementGroupInput or - IO[bytes] - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _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, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - async def _deallocate_initial( - self, - resource_group_name: str, - vm_scale_set_name: str, - hibernate: Optional[bool] = None, - vm_instance_i_ds: Optional[Union[_models.VirtualMachineScaleSetVMInstanceIDs, IO[bytes]]] = None, - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - content_type = content_type if vm_instance_i_ds else None - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" if vm_instance_i_ds else None - _json = None - _content = None - if isinstance(vm_instance_i_ds, (IOBase, bytes)): - _content = vm_instance_i_ds - else: - if vm_instance_i_ds is not None: - _json = self._serialize.body(vm_instance_i_ds, "VirtualMachineScaleSetVMInstanceIDs") - else: - _json = None - - _request = build_deallocate_request( - resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, - subscription_id=self._config.subscription_id, - hibernate=hibernate, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_deallocate( - self, - resource_group_name: str, - vm_scale_set_name: str, - hibernate: Optional[bool] = None, - vm_instance_i_ds: Optional[_models.VirtualMachineScaleSetVMInstanceIDs] = None, - *, - content_type: str = "application/json", - **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. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param hibernate: Optional parameter to hibernate a virtual machine from the VM scale set. - (This feature is available for VMSS with Flexible OrchestrationMode only). Default value is - None. - :type hibernate: 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.models.VirtualMachineScaleSetVMInstanceIDs - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_deallocate( - self, - resource_group_name: str, - vm_scale_set_name: str, - hibernate: Optional[bool] = None, - vm_instance_i_ds: Optional[IO[bytes]] = None, - *, - content_type: str = "application/json", - **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. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param hibernate: Optional parameter to hibernate a virtual machine from the VM scale set. - (This feature is available for VMSS with Flexible OrchestrationMode only). Default value is - None. - :type hibernate: 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: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_deallocate( - self, - resource_group_name: str, - vm_scale_set_name: str, - hibernate: Optional[bool] = None, - vm_instance_i_ds: Optional[Union[_models.VirtualMachineScaleSetVMInstanceIDs, IO[bytes]]] = 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. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param hibernate: Optional parameter to hibernate a virtual machine from the VM scale set. - (This feature is available for VMSS with Flexible OrchestrationMode only). Default value is - None. - :type hibernate: bool - :param vm_instance_i_ds: A list of virtual machine instance IDs from the VM scale set. Is - either a VirtualMachineScaleSetVMInstanceIDs type or a IO[bytes] type. Default value is None. - :type vm_instance_i_ds: ~azure.mgmt.compute.models.VirtualMachineScaleSetVMInstanceIDs or - IO[bytes] - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - content_type = content_type if vm_instance_i_ds else None - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._deallocate_initial( - resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, - hibernate=hibernate, - vm_instance_i_ds=vm_instance_i_ds, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _delete_instances_initial( - self, - resource_group_name: str, - vm_scale_set_name: str, - vm_instance_i_ds: Union[_models.VirtualMachineScaleSetVMInstanceRequiredIDs, IO[bytes]], - force_deletion: Optional[bool] = None, - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(vm_instance_i_ds, (IOBase, bytes)): - _content = vm_instance_i_ds - else: - _json = self._serialize.body(vm_instance_i_ds, "VirtualMachineScaleSetVMInstanceRequiredIDs") - - _request = build_delete_instances_request( - resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, - subscription_id=self._config.subscription_id, - force_deletion=force_deletion, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_delete_instances( - self, - resource_group_name: str, - vm_scale_set_name: str, - vm_instance_i_ds: _models.VirtualMachineScaleSetVMInstanceRequiredIDs, - force_deletion: Optional[bool] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Deletes virtual machines in a VM scale set. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param vm_instance_i_ds: A list of virtual machine instance IDs from the VM scale set. - Required. - :type vm_instance_i_ds: ~azure.mgmt.compute.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 content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_delete_instances( - self, - resource_group_name: str, - vm_scale_set_name: str, - vm_instance_i_ds: IO[bytes], - force_deletion: Optional[bool] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Deletes virtual machines in a VM scale set. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param vm_instance_i_ds: A list of virtual machine instance IDs from the VM scale set. - Required. - :type vm_instance_i_ds: IO[bytes] - :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 content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_delete_instances( - self, - resource_group_name: str, - vm_scale_set_name: str, - vm_instance_i_ds: Union[_models.VirtualMachineScaleSetVMInstanceRequiredIDs, IO[bytes]], - 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. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param vm_instance_i_ds: A list of virtual machine instance IDs from the VM scale set. Is - either a VirtualMachineScaleSetVMInstanceRequiredIDs type or a IO[bytes] type. Required. - :type vm_instance_i_ds: ~azure.mgmt.compute.models.VirtualMachineScaleSetVMInstanceRequiredIDs - or IO[bytes] - :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 - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._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, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace_async - async def force_recovery_service_fabric_platform_update_domain_walk( # pylint: disable=name-too-long - 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. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param platform_update_domain: The platform update domain for which a manual recovery walk is - requested. Required. - :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 - :return: RecoveryWalkResponse or the result of cls(response) - :rtype: ~azure.mgmt.compute.models.RecoveryWalkResponse - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[_models.RecoveryWalkResponse] = kwargs.pop("cls", None) - - _request = build_force_recovery_service_fabric_platform_update_domain_walk_request( - resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, - subscription_id=self._config.subscription_id, - platform_update_domain=platform_update_domain, - zone=zone, - placement_group_id=placement_group_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("RecoveryWalkResponse", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :return: VirtualMachineScaleSetInstanceView or the result of cls(response) - :rtype: ~azure.mgmt.compute.models.VirtualMachineScaleSetInstanceView - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[_models.VirtualMachineScaleSetInstanceView] = kwargs.pop("cls", None) - - _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, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("VirtualMachineScaleSetInstanceView", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _update_instances_initial( - self, - resource_group_name: str, - vm_scale_set_name: str, - vm_instance_i_ds: Union[_models.VirtualMachineScaleSetVMInstanceRequiredIDs, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(vm_instance_i_ds, (IOBase, bytes)): - _content = vm_instance_i_ds - else: - _json = self._serialize.body(vm_instance_i_ds, "VirtualMachineScaleSetVMInstanceRequiredIDs") - - _request = build_update_instances_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, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_update_instances( - self, - resource_group_name: str, - vm_scale_set_name: str, - vm_instance_i_ds: _models.VirtualMachineScaleSetVMInstanceRequiredIDs, - *, - content_type: str = "application/json", - **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. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param vm_instance_i_ds: A list of virtual machine instance IDs from the VM scale set. - Required. - :type vm_instance_i_ds: ~azure.mgmt.compute.models.VirtualMachineScaleSetVMInstanceRequiredIDs - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update_instances( - self, - resource_group_name: str, - vm_scale_set_name: str, - vm_instance_i_ds: IO[bytes], - *, - content_type: str = "application/json", - **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. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param vm_instance_i_ds: A list of virtual machine instance IDs from the VM scale set. - Required. - :type vm_instance_i_ds: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_update_instances( - self, - resource_group_name: str, - vm_scale_set_name: str, - vm_instance_i_ds: Union[_models.VirtualMachineScaleSetVMInstanceRequiredIDs, IO[bytes]], - **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. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param vm_instance_i_ds: A list of virtual machine instance IDs from the VM scale set. Is - either a VirtualMachineScaleSetVMInstanceRequiredIDs type or a IO[bytes] type. Required. - :type vm_instance_i_ds: ~azure.mgmt.compute.models.VirtualMachineScaleSetVMInstanceRequiredIDs - or IO[bytes] - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._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, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def get_os_upgrade_history( - self, resource_group_name: str, vm_scale_set_name: str, **kwargs: Any - ) -> AsyncItemPaged["_models.UpgradeOperationHistoricalStatusInfo"]: - """Gets list of OS upgrades on a VM scale set instance. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :return: An iterator like instance of either UpgradeOperationHistoricalStatusInfo or the result - of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.models.UpgradeOperationHistoricalStatusInfo] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[_models.VirtualMachineScaleSetListOSUpgradeHistory] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_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, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - _request = HttpRequest("GET", next_link) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - async def _perform_maintenance_initial( - self, - resource_group_name: str, - vm_scale_set_name: str, - vm_instance_i_ds: Optional[Union[_models.VirtualMachineScaleSetVMInstanceIDs, IO[bytes]]] = None, - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - content_type = content_type if vm_instance_i_ds else None - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" if vm_instance_i_ds else None - _json = None - _content = None - if isinstance(vm_instance_i_ds, (IOBase, bytes)): - _content = vm_instance_i_ds - else: - 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( - resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_perform_maintenance( - self, - resource_group_name: str, - vm_scale_set_name: str, - vm_instance_i_ds: Optional[_models.VirtualMachineScaleSetVMInstanceIDs] = None, - *, - content_type: str = "application/json", - **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. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :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.models.VirtualMachineScaleSetVMInstanceIDs - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_perform_maintenance( - self, - resource_group_name: str, - vm_scale_set_name: str, - vm_instance_i_ds: Optional[IO[bytes]] = None, - *, - content_type: str = "application/json", - **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. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :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: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_perform_maintenance( - self, - resource_group_name: str, - vm_scale_set_name: str, - vm_instance_i_ds: Optional[Union[_models.VirtualMachineScaleSetVMInstanceIDs, IO[bytes]]] = 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. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param vm_instance_i_ds: A list of virtual machine instance IDs from the VM scale set. Is - either a VirtualMachineScaleSetVMInstanceIDs type or a IO[bytes] type. Default value is None. - :type vm_instance_i_ds: ~azure.mgmt.compute.models.VirtualMachineScaleSetVMInstanceIDs or - IO[bytes] - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - content_type = content_type if vm_instance_i_ds else None - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._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, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _power_off_initial( - self, - resource_group_name: str, - vm_scale_set_name: str, - skip_shutdown: Optional[bool] = None, - vm_instance_i_ds: Optional[Union[_models.VirtualMachineScaleSetVMInstanceIDs, IO[bytes]]] = None, - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - content_type = content_type if vm_instance_i_ds else None - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" if vm_instance_i_ds else None - _json = None - _content = None - if isinstance(vm_instance_i_ds, (IOBase, bytes)): - _content = vm_instance_i_ds - else: - 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( - resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, - subscription_id=self._config.subscription_id, - skip_shutdown=skip_shutdown, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_power_off( - self, - resource_group_name: str, - vm_scale_set_name: str, - skip_shutdown: Optional[bool] = None, - vm_instance_i_ds: Optional[_models.VirtualMachineScaleSetVMInstanceIDs] = None, - *, - content_type: str = "application/json", - **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. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :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 None. - :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.models.VirtualMachineScaleSetVMInstanceIDs - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_power_off( - self, - resource_group_name: str, - vm_scale_set_name: str, - skip_shutdown: Optional[bool] = None, - vm_instance_i_ds: Optional[IO[bytes]] = None, - *, - content_type: str = "application/json", - **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. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :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 None. - :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: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_power_off( - self, - resource_group_name: str, - vm_scale_set_name: str, - skip_shutdown: Optional[bool] = None, - vm_instance_i_ds: Optional[Union[_models.VirtualMachineScaleSetVMInstanceIDs, IO[bytes]]] = 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. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :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 None. - :type skip_shutdown: bool - :param vm_instance_i_ds: A list of virtual machine instance IDs from the VM scale set. Is - either a VirtualMachineScaleSetVMInstanceIDs type or a IO[bytes] type. Default value is None. - :type vm_instance_i_ds: ~azure.mgmt.compute.models.VirtualMachineScaleSetVMInstanceIDs or - IO[bytes] - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - content_type = content_type if vm_instance_i_ds else None - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._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, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _reapply_initial( - self, resource_group_name: str, vm_scale_set_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_reapply_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, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_reapply( - self, resource_group_name: str, vm_scale_set_name: str, **kwargs: Any - ) -> AsyncLROPoller[None]: - """Reapplies the Virtual Machine Scale Set Virtual Machine Profile to the Virtual Machine - Instances. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._reapply_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, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _redeploy_initial( - self, - resource_group_name: str, - vm_scale_set_name: str, - vm_instance_i_ds: Optional[Union[_models.VirtualMachineScaleSetVMInstanceIDs, IO[bytes]]] = None, - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - content_type = content_type if vm_instance_i_ds else None - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" if vm_instance_i_ds else None - _json = None - _content = None - if isinstance(vm_instance_i_ds, (IOBase, bytes)): - _content = vm_instance_i_ds - else: - if vm_instance_i_ds is not None: - _json = self._serialize.body(vm_instance_i_ds, "VirtualMachineScaleSetVMInstanceIDs") - else: - _json = None - - _request = build_redeploy_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, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_redeploy( - self, - resource_group_name: str, - vm_scale_set_name: str, - vm_instance_i_ds: Optional[_models.VirtualMachineScaleSetVMInstanceIDs] = None, - *, - content_type: str = "application/json", - **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. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :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.models.VirtualMachineScaleSetVMInstanceIDs - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_redeploy( - self, - resource_group_name: str, - vm_scale_set_name: str, - vm_instance_i_ds: Optional[IO[bytes]] = None, - *, - content_type: str = "application/json", - **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. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :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: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_redeploy( - self, - resource_group_name: str, - vm_scale_set_name: str, - vm_instance_i_ds: Optional[Union[_models.VirtualMachineScaleSetVMInstanceIDs, IO[bytes]]] = 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. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param vm_instance_i_ds: A list of virtual machine instance IDs from the VM scale set. Is - either a VirtualMachineScaleSetVMInstanceIDs type or a IO[bytes] type. Default value is None. - :type vm_instance_i_ds: ~azure.mgmt.compute.models.VirtualMachineScaleSetVMInstanceIDs or - IO[bytes] - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - content_type = content_type if vm_instance_i_ds else None - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._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, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _reimage_initial( - self, - resource_group_name: str, - vm_scale_set_name: str, - vm_scale_set_reimage_input: Optional[Union[_models.VirtualMachineScaleSetReimageParameters, IO[bytes]]] = None, - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - content_type = content_type if vm_scale_set_reimage_input else None - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" if vm_scale_set_reimage_input else None - _json = None - _content = None - if isinstance(vm_scale_set_reimage_input, (IOBase, bytes)): - _content = vm_scale_set_reimage_input - else: - 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( - resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_reimage( - self, - resource_group_name: str, - vm_scale_set_name: str, - vm_scale_set_reimage_input: Optional[_models.VirtualMachineScaleSetReimageParameters] = None, - *, - content_type: str = "application/json", - **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. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :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.models.VirtualMachineScaleSetReimageParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_reimage( - self, - resource_group_name: str, - vm_scale_set_name: str, - vm_scale_set_reimage_input: Optional[IO[bytes]] = None, - *, - content_type: str = "application/json", - **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. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :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: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_reimage( - self, - resource_group_name: str, - vm_scale_set_name: str, - vm_scale_set_reimage_input: Optional[Union[_models.VirtualMachineScaleSetReimageParameters, IO[bytes]]] = 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. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param vm_scale_set_reimage_input: Parameters for Reimaging VM ScaleSet. Is either a - VirtualMachineScaleSetReimageParameters type or a IO[bytes] type. Default value is None. - :type vm_scale_set_reimage_input: - ~azure.mgmt.compute.models.VirtualMachineScaleSetReimageParameters or IO[bytes] - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - content_type = content_type if vm_scale_set_reimage_input else None - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._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, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _reimage_all_initial( - self, - resource_group_name: str, - vm_scale_set_name: str, - vm_instance_i_ds: Optional[Union[_models.VirtualMachineScaleSetVMInstanceIDs, IO[bytes]]] = None, - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - content_type = content_type if vm_instance_i_ds else None - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" if vm_instance_i_ds else None - _json = None - _content = None - if isinstance(vm_instance_i_ds, (IOBase, bytes)): - _content = vm_instance_i_ds - else: - 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( - resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_reimage_all( - self, - resource_group_name: str, - vm_scale_set_name: str, - vm_instance_i_ds: Optional[_models.VirtualMachineScaleSetVMInstanceIDs] = None, - *, - content_type: str = "application/json", - **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. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :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.models.VirtualMachineScaleSetVMInstanceIDs - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_reimage_all( - self, - resource_group_name: str, - vm_scale_set_name: str, - vm_instance_i_ds: Optional[IO[bytes]] = None, - *, - content_type: str = "application/json", - **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. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :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: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_reimage_all( - self, - resource_group_name: str, - vm_scale_set_name: str, - vm_instance_i_ds: Optional[Union[_models.VirtualMachineScaleSetVMInstanceIDs, IO[bytes]]] = 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. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param vm_instance_i_ds: A list of virtual machine instance IDs from the VM scale set. Is - either a VirtualMachineScaleSetVMInstanceIDs type or a IO[bytes] type. Default value is None. - :type vm_instance_i_ds: ~azure.mgmt.compute.models.VirtualMachineScaleSetVMInstanceIDs or - IO[bytes] - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - content_type = content_type if vm_instance_i_ds else None - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._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, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _restart_initial( - self, - resource_group_name: str, - vm_scale_set_name: str, - vm_instance_i_ds: Optional[Union[_models.VirtualMachineScaleSetVMInstanceIDs, IO[bytes]]] = None, - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - content_type = content_type if vm_instance_i_ds else None - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" if vm_instance_i_ds else None - _json = None - _content = None - if isinstance(vm_instance_i_ds, (IOBase, bytes)): - _content = vm_instance_i_ds - else: - if vm_instance_i_ds is not None: - _json = self._serialize.body(vm_instance_i_ds, "VirtualMachineScaleSetVMInstanceIDs") - else: - _json = None - - _request = build_restart_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, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_restart( - self, - resource_group_name: str, - vm_scale_set_name: str, - vm_instance_i_ds: Optional[_models.VirtualMachineScaleSetVMInstanceIDs] = None, - *, - content_type: str = "application/json", - **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. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :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.models.VirtualMachineScaleSetVMInstanceIDs - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_restart( - self, - resource_group_name: str, - vm_scale_set_name: str, - vm_instance_i_ds: Optional[IO[bytes]] = None, - *, - content_type: str = "application/json", - **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. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :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: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_restart( - self, - resource_group_name: str, - vm_scale_set_name: str, - vm_instance_i_ds: Optional[Union[_models.VirtualMachineScaleSetVMInstanceIDs, IO[bytes]]] = 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. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param vm_instance_i_ds: A list of virtual machine instance IDs from the VM scale set. Is - either a VirtualMachineScaleSetVMInstanceIDs type or a IO[bytes] type. Default value is None. - :type vm_instance_i_ds: ~azure.mgmt.compute.models.VirtualMachineScaleSetVMInstanceIDs or - IO[bytes] - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - content_type = content_type if vm_instance_i_ds else None - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._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, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _scale_out_initial( - self, - resource_group_name: str, - vm_scale_set_name: str, - parameters: Union[_models.VMScaleSetScaleOutInput, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "VMScaleSetScaleOutInput") - - _request = build_scale_out_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, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_scale_out( - self, - resource_group_name: str, - vm_scale_set_name: str, - parameters: _models.VMScaleSetScaleOutInput, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Scales out one or more virtual machines in a VM scale set. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param parameters: The input object for ScaleOut API. Required. - :type parameters: ~azure.mgmt.compute.models.VMScaleSetScaleOutInput - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_scale_out( - self, - resource_group_name: str, - vm_scale_set_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Scales out one or more virtual machines in a VM scale set. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param parameters: The input object for ScaleOut API. Required. - :type parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_scale_out( - self, - resource_group_name: str, - vm_scale_set_name: str, - parameters: Union[_models.VMScaleSetScaleOutInput, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Scales out one or more virtual machines in a VM scale set. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param parameters: The input object for ScaleOut API. Is either a VMScaleSetScaleOutInput type - or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.compute.models.VMScaleSetScaleOutInput or IO[bytes] - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._scale_out_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, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _set_orchestration_service_state_initial( - self, - resource_group_name: str, - vm_scale_set_name: str, - parameters: Union[_models.OrchestrationServiceStateInput, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "OrchestrationServiceStateInput") - - _request = build_set_orchestration_service_state_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, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_set_orchestration_service_state( - self, - resource_group_name: str, - vm_scale_set_name: str, - parameters: _models.OrchestrationServiceStateInput, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Changes ServiceState property for a given service. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param parameters: The input object for SetOrchestrationServiceState API. Required. - :type parameters: ~azure.mgmt.compute.models.OrchestrationServiceStateInput - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_set_orchestration_service_state( - self, - resource_group_name: str, - vm_scale_set_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Changes ServiceState property for a given service. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param parameters: The input object for SetOrchestrationServiceState API. Required. - :type parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_set_orchestration_service_state( - self, - resource_group_name: str, - vm_scale_set_name: str, - parameters: Union[_models.OrchestrationServiceStateInput, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Changes ServiceState property for a given service. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param parameters: The input object for SetOrchestrationServiceState API. Is either a - OrchestrationServiceStateInput type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.compute.models.OrchestrationServiceStateInput or IO[bytes] - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._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, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list_skus( - self, resource_group_name: str, vm_scale_set_name: str, **kwargs: Any - ) -> AsyncItemPaged["_models.VirtualMachineScaleSetSku"]: - """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. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :return: An iterator like instance of either VirtualMachineScaleSetSku or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.models.VirtualMachineScaleSetSku] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[_models.VirtualMachineScaleSetListSkusResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_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, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - _request = HttpRequest("GET", next_link) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - async def _start_initial( - self, - resource_group_name: str, - vm_scale_set_name: str, - vm_instance_i_ds: Optional[Union[_models.VirtualMachineScaleSetVMInstanceIDs, IO[bytes]]] = None, - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - content_type = content_type if vm_instance_i_ds else None - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" if vm_instance_i_ds else None - _json = None - _content = None - if isinstance(vm_instance_i_ds, (IOBase, bytes)): - _content = vm_instance_i_ds - else: - if vm_instance_i_ds is not None: - _json = self._serialize.body(vm_instance_i_ds, "VirtualMachineScaleSetVMInstanceIDs") - else: - _json = None - - _request = build_start_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, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_start( - self, - resource_group_name: str, - vm_scale_set_name: str, - vm_instance_i_ds: Optional[_models.VirtualMachineScaleSetVMInstanceIDs] = None, - *, - content_type: str = "application/json", - **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. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :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.models.VirtualMachineScaleSetVMInstanceIDs - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_start( - self, - resource_group_name: str, - vm_scale_set_name: str, - vm_instance_i_ds: Optional[IO[bytes]] = None, - *, - content_type: str = "application/json", - **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. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :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: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_start( - self, - resource_group_name: str, - vm_scale_set_name: str, - vm_instance_i_ds: Optional[Union[_models.VirtualMachineScaleSetVMInstanceIDs, IO[bytes]]] = 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. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param vm_instance_i_ds: A list of virtual machine instance IDs from the VM scale set. Is - either a VirtualMachineScaleSetVMInstanceIDs type or a IO[bytes] type. Default value is None. - :type vm_instance_i_ds: ~azure.mgmt.compute.models.VirtualMachineScaleSetVMInstanceIDs or - IO[bytes] - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - content_type = content_type if vm_instance_i_ds else None - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._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, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/operations/_virtual_machine_sizes_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/operations/_virtual_machine_sizes_operations.py deleted file mode 100644 index 3bfe04e07bd3..000000000000 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/operations/_virtual_machine_sizes_operations.py +++ /dev/null @@ -1,121 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from collections.abc import MutableMapping -from typing import Any, Callable, Optional, TypeVar - -from azure.core import AsyncPipelineClient -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ..._utils.serialization import Deserializer, Serializer -from ...operations._virtual_machine_sizes_operations import build_list_request -from .._configuration import ComputeManagementClientConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] -List = list - - -class VirtualMachineSizesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.compute.aio.ComputeManagementClient`'s - :attr:`virtual_machine_sizes` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list(self, location: str, **kwargs: Any) -> AsyncItemPaged["_models.VirtualMachineSize"]: - """This API is deprecated. Use `Resources Skus - `_. - - :param location: The name of Azure region. Required. - :type location: str - :return: An iterator like instance of either VirtualMachineSize or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.models.VirtualMachineSize] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[_models.VirtualMachineSizeListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - location=location, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - _request = HttpRequest("GET", next_link) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/operations/_virtual_machines_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/operations/_virtual_machines_operations.py deleted file mode 100644 index cf66998a4be7..000000000000 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/operations/_virtual_machines_operations.py +++ /dev/null @@ -1,3524 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression,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 collections.abc import MutableMapping -from io import IOBase -from typing import Any, AsyncIterator, Callable, IO, Optional, TypeVar, Union, cast, overload - -from azure.core import AsyncPipelineClient -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - StreamClosedError, - StreamConsumedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ..._utils.serialization import Deserializer, Serializer -from ...operations._virtual_machines_operations import ( - build_assess_patches_request, - build_attach_detach_data_disks_request, - build_capture_request, - build_convert_to_managed_disks_request, - build_create_or_update_request, - build_deallocate_request, - build_delete_request, - build_generalize_request, - build_get_request, - build_install_patches_request, - build_instance_view_request, - build_list_all_request, - build_list_available_sizes_request, - build_list_by_location_request, - build_list_request, - build_migrate_to_vm_scale_set_request, - build_perform_maintenance_request, - build_power_off_request, - build_reapply_request, - build_redeploy_request, - build_reimage_request, - build_restart_request, - build_retrieve_boot_diagnostics_data_request, - build_run_command_request, - build_simulate_eviction_request, - build_start_request, - build_update_request, -) -from .._configuration import ComputeManagementClientConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] -List = list - - -class VirtualMachinesOperations: # pylint: disable=too-many-public-methods - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.compute.aio.ComputeManagementClient`'s - :attr:`virtual_machines` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list_by_location(self, location: str, **kwargs: Any) -> AsyncItemPaged["_models.VirtualMachine"]: - """Gets all the virtual machines under the specified subscription for the specified location. - - :param location: The name of Azure region. Required. - :type location: str - :return: An iterator like instance of either VirtualMachine or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.models.VirtualMachine] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[_models.VirtualMachineListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_by_location_request( - location=location, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - _request = HttpRequest("GET", next_link) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @distributed_trace - def list_all( - self, - status_only: Optional[str] = None, - filter: Optional[str] = None, - expand: Optional[Union[str, _models.ExpandTypesForListVMs]] = None, - **kwargs: Any - ) -> AsyncItemPaged["_models.VirtualMachine"]: - """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 - :param expand: The expand expression to apply on operation. 'instanceView' enables fetching run - time status of all Virtual Machines, this can only be specified if a valid $filter option is - specified. "instanceView" Default value is None. - :type expand: str or ~azure.mgmt.compute.models.ExpandTypesForListVMs - :return: An iterator like instance of either VirtualMachine or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.models.VirtualMachine] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[_models.VirtualMachineListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_all_request( - subscription_id=self._config.subscription_id, - status_only=status_only, - filter=filter, - expand=expand, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - _request = HttpRequest("GET", next_link) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @distributed_trace - def list( - self, - resource_group_name: str, - filter: Optional[str] = None, - expand: Optional[Union[str, _models.ExpandTypeForListVMs]] = None, - **kwargs: Any - ) -> AsyncItemPaged["_models.VirtualMachine"]: - """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. The name is case insensitive. - Required. - :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 - :param expand: The expand expression to apply on operation. 'instanceView' enables fetching run - time status of all Virtual Machines, this can only be specified if a valid $filter option is - specified. "instanceView" Default value is None. - :type expand: str or ~azure.mgmt.compute.models.ExpandTypeForListVMs - :return: An iterator like instance of either VirtualMachine or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.models.VirtualMachine] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[_models.VirtualMachineListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - filter=filter, - expand=expand, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - _request = HttpRequest("GET", next_link) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @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. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_name: The name of the virtual machine. Required. - :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. - Known values are: "instanceView", "userData", and "resiliencyView". Default value is None. - :type expand: str or ~azure.mgmt.compute.models.InstanceViewTypes - :return: VirtualMachine or the result of cls(response) - :rtype: ~azure.mgmt.compute.models.VirtualMachine - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[_models.VirtualMachine] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - vm_name=vm_name, - subscription_id=self._config.subscription_id, - expand=expand, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("VirtualMachine", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - vm_name: str, - parameters: Union[_models.VirtualMachine, IO[bytes]], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "VirtualMachine") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - vm_name=vm_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 201: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - vm_name: str, - parameters: _models.VirtualMachine, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - *, - content_type: str = "application/json", - **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. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_name: The name of the virtual machine. Required. - :type vm_name: str - :param parameters: Parameters supplied to the Create Virtual Machine operation. Required. - :type parameters: ~azure.mgmt.compute.models.VirtualMachine - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing record set. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either VirtualMachine or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.VirtualMachine] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - vm_name: str, - parameters: IO[bytes], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - *, - content_type: str = "application/json", - **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. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_name: The name of the virtual machine. Required. - :type vm_name: str - :param parameters: Parameters supplied to the Create Virtual Machine operation. Required. - :type parameters: IO[bytes] - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing record set. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either VirtualMachine or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.VirtualMachine] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - vm_name: str, - parameters: Union[_models.VirtualMachine, IO[bytes]], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **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. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_name: The name of the virtual machine. Required. - :type vm_name: str - :param parameters: Parameters supplied to the Create Virtual Machine operation. Is either a - VirtualMachine type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.compute.models.VirtualMachine or IO[bytes] - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing record set. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :return: An instance of AsyncLROPoller that returns either VirtualMachine or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.VirtualMachine] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.VirtualMachine] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._create_or_update_initial( - resource_group_name=resource_group_name, - vm_name=vm_name, - parameters=parameters, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("VirtualMachine", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.VirtualMachine].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.VirtualMachine]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _update_initial( - self, - resource_group_name: str, - vm_name: str, - parameters: Union[_models.VirtualMachineUpdate, IO[bytes]], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "VirtualMachineUpdate") - - _request = build_update_request( - resource_group_name=resource_group_name, - vm_name=vm_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_update( - self, - resource_group_name: str, - vm_name: str, - parameters: _models.VirtualMachineUpdate, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.VirtualMachine]: - """The operation to update a virtual machine. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_name: The name of the virtual machine. Required. - :type vm_name: str - :param parameters: Parameters supplied to the Update Virtual Machine operation. Required. - :type parameters: ~azure.mgmt.compute.models.VirtualMachineUpdate - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing record set. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either VirtualMachine or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.VirtualMachine] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update( - self, - resource_group_name: str, - vm_name: str, - parameters: IO[bytes], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.VirtualMachine]: - """The operation to update a virtual machine. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_name: The name of the virtual machine. Required. - :type vm_name: str - :param parameters: Parameters supplied to the Update Virtual Machine operation. Required. - :type parameters: IO[bytes] - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing record set. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either VirtualMachine or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.VirtualMachine] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_update( - self, - resource_group_name: str, - vm_name: str, - parameters: Union[_models.VirtualMachineUpdate, IO[bytes]], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any - ) -> AsyncLROPoller[_models.VirtualMachine]: - """The operation to update a virtual machine. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_name: The name of the virtual machine. Required. - :type vm_name: str - :param parameters: Parameters supplied to the Update Virtual Machine operation. Is either a - VirtualMachineUpdate type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.compute.models.VirtualMachineUpdate or IO[bytes] - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing record set. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :return: An instance of AsyncLROPoller that returns either VirtualMachine or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.VirtualMachine] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.VirtualMachine] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._update_initial( - resource_group_name=resource_group_name, - vm_name=vm_name, - parameters=parameters, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - response_headers = {} - response = pipeline_response.http_response - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = self._deserialize("VirtualMachine", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.VirtualMachine].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.VirtualMachine]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, vm_name: str, force_deletion: Optional[bool] = None, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - vm_name=vm_name, - subscription_id=self._config.subscription_id, - force_deletion=force_deletion, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_delete( - 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. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_name: The name of the virtual machine. Required. - :type vm_name: str - :param force_deletion: Optional parameter to force delete virtual machines. Default value is - None. - :type force_deletion: bool - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._delete_initial( - resource_group_name=resource_group_name, - vm_name=vm_name, - force_deletion=force_deletion, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _assess_patches_initial( - self, resource_group_name: str, vm_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_assess_patches_request( - resource_group_name=resource_group_name, - vm_name=vm_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # 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. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_name: The name of the virtual machine. Required. - :type vm_name: str - :return: An instance of AsyncLROPoller that returns either VirtualMachineAssessPatchesResult or - the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.VirtualMachineAssessPatchesResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[_models.VirtualMachineAssessPatchesResult] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._assess_patches_initial( - resource_group_name=resource_group_name, - vm_name=vm_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("VirtualMachineAssessPatchesResult", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.VirtualMachineAssessPatchesResult].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.VirtualMachineAssessPatchesResult]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _attach_detach_data_disks_initial( - self, - resource_group_name: str, - vm_name: str, - parameters: Union[_models.AttachDetachDataDisksRequest, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "AttachDetachDataDisksRequest") - - _request = build_attach_detach_data_disks_request( - 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, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_attach_detach_data_disks( - self, - resource_group_name: str, - vm_name: str, - parameters: _models.AttachDetachDataDisksRequest, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.StorageProfile]: - """Attach and detach data disks to/from the virtual machine. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_name: The name of the virtual machine. Required. - :type vm_name: str - :param parameters: Parameters supplied to the attach and detach data disks operation on the - virtual machine. Required. - :type parameters: ~azure.mgmt.compute.models.AttachDetachDataDisksRequest - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either StorageProfile or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.StorageProfile] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_attach_detach_data_disks( - self, - resource_group_name: str, - vm_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.StorageProfile]: - """Attach and detach data disks to/from the virtual machine. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_name: The name of the virtual machine. Required. - :type vm_name: str - :param parameters: Parameters supplied to the attach and detach data disks operation on the - virtual machine. Required. - :type parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either StorageProfile or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.StorageProfile] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_attach_detach_data_disks( - self, - resource_group_name: str, - vm_name: str, - parameters: Union[_models.AttachDetachDataDisksRequest, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.StorageProfile]: - """Attach and detach data disks to/from the virtual machine. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_name: The name of the virtual machine. Required. - :type vm_name: str - :param parameters: Parameters supplied to the attach and detach data disks operation on the - virtual machine. Is either a AttachDetachDataDisksRequest type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.compute.models.AttachDetachDataDisksRequest or IO[bytes] - :return: An instance of AsyncLROPoller that returns either StorageProfile or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.StorageProfile] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.StorageProfile] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._attach_detach_data_disks_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, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("StorageProfile", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.StorageProfile].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.StorageProfile]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _capture_initial( - self, - resource_group_name: str, - vm_name: str, - parameters: Union[_models.VirtualMachineCaptureParameters, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "VirtualMachineCaptureParameters") - - _request = build_capture_request( - 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, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_capture( - self, - resource_group_name: str, - vm_name: str, - parameters: _models.VirtualMachineCaptureParameters, - *, - content_type: str = "application/json", - **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. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_name: The name of the virtual machine. Required. - :type vm_name: str - :param parameters: Parameters supplied to the Capture Virtual Machine operation. Required. - :type parameters: ~azure.mgmt.compute.models.VirtualMachineCaptureParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either VirtualMachineCaptureResult or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.VirtualMachineCaptureResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_capture( - self, - resource_group_name: str, - vm_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **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. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_name: The name of the virtual machine. Required. - :type vm_name: str - :param parameters: Parameters supplied to the Capture Virtual Machine operation. Required. - :type parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either VirtualMachineCaptureResult or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.VirtualMachineCaptureResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_capture( - self, - resource_group_name: str, - vm_name: str, - parameters: Union[_models.VirtualMachineCaptureParameters, IO[bytes]], - **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. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_name: The name of the virtual machine. Required. - :type vm_name: str - :param parameters: Parameters supplied to the Capture Virtual Machine operation. Is either a - VirtualMachineCaptureParameters type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.compute.models.VirtualMachineCaptureParameters or IO[bytes] - :return: An instance of AsyncLROPoller that returns either VirtualMachineCaptureResult or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.VirtualMachineCaptureResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.VirtualMachineCaptureResult] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._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, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("VirtualMachineCaptureResult", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.VirtualMachineCaptureResult].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.VirtualMachineCaptureResult]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _convert_to_managed_disks_initial( - self, resource_group_name: str, vm_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_convert_to_managed_disks_request( - resource_group_name=resource_group_name, - vm_name=vm_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_convert_to_managed_disks( - 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. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_name: The name of the virtual machine. Required. - :type vm_name: str - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._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, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _deallocate_initial( - self, resource_group_name: str, vm_name: str, hibernate: Optional[bool] = None, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_deallocate_request( - resource_group_name=resource_group_name, - vm_name=vm_name, - subscription_id=self._config.subscription_id, - hibernate=hibernate, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_deallocate( - 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. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_name: The name of the virtual machine. Required. - :type vm_name: str - :param hibernate: Optional parameter to hibernate a virtual machine. Default value is None. - :type hibernate: bool - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._deallocate_initial( - resource_group_name=resource_group_name, - vm_name=vm_name, - hibernate=hibernate, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace_async - async def generalize(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. For Windows, please refer to `Create a - managed image of a generalized VM in Azure - `_. 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. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_name: The name of the virtual machine. Required. - :type vm_name: str - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_generalize_request( - resource_group_name=resource_group_name, - vm_name=vm_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - async def _install_patches_initial( - self, - resource_group_name: str, - vm_name: str, - install_patches_input: Union[_models.VirtualMachineInstallPatchesParameters, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(install_patches_input, (IOBase, bytes)): - _content = install_patches_input - else: - _json = self._serialize.body(install_patches_input, "VirtualMachineInstallPatchesParameters") - - _request = build_install_patches_request( - resource_group_name=resource_group_name, - vm_name=vm_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_install_patches( - self, - resource_group_name: str, - vm_name: str, - install_patches_input: _models.VirtualMachineInstallPatchesParameters, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.VirtualMachineInstallPatchesResult]: - """Installs patches on the VM. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_name: The name of the virtual machine. Required. - :type vm_name: str - :param install_patches_input: Input for InstallPatches as directly received by the API. - Required. - :type install_patches_input: ~azure.mgmt.compute.models.VirtualMachineInstallPatchesParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either VirtualMachineInstallPatchesResult - or the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.VirtualMachineInstallPatchesResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_install_patches( - self, - resource_group_name: str, - vm_name: str, - install_patches_input: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.VirtualMachineInstallPatchesResult]: - """Installs patches on the VM. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_name: The name of the virtual machine. Required. - :type vm_name: str - :param install_patches_input: Input for InstallPatches as directly received by the API. - Required. - :type install_patches_input: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either VirtualMachineInstallPatchesResult - or the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.VirtualMachineInstallPatchesResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_install_patches( - self, - resource_group_name: str, - vm_name: str, - install_patches_input: Union[_models.VirtualMachineInstallPatchesParameters, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.VirtualMachineInstallPatchesResult]: - """Installs patches on the VM. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_name: The name of the virtual machine. Required. - :type vm_name: str - :param install_patches_input: Input for InstallPatches as directly received by the API. Is - either a VirtualMachineInstallPatchesParameters type or a IO[bytes] type. Required. - :type install_patches_input: ~azure.mgmt.compute.models.VirtualMachineInstallPatchesParameters - or IO[bytes] - :return: An instance of AsyncLROPoller that returns either VirtualMachineInstallPatchesResult - or the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.VirtualMachineInstallPatchesResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.VirtualMachineInstallPatchesResult] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._install_patches_initial( - resource_group_name=resource_group_name, - vm_name=vm_name, - install_patches_input=install_patches_input, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("VirtualMachineInstallPatchesResult", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.VirtualMachineInstallPatchesResult].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.VirtualMachineInstallPatchesResult]( - self._client, raw_result, get_long_running_output, polling_method # 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. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_name: The name of the virtual machine. Required. - :type vm_name: str - :return: VirtualMachineInstanceView or the result of cls(response) - :rtype: ~azure.mgmt.compute.models.VirtualMachineInstanceView - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[_models.VirtualMachineInstanceView] = kwargs.pop("cls", None) - - _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, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("VirtualMachineInstanceView", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _migrate_to_vm_scale_set_initial( - self, - resource_group_name: str, - vm_name: str, - parameters: Optional[Union[_models.MigrateVMToVirtualMachineScaleSetInput, IO[bytes]]] = None, - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - content_type = content_type if parameters else None - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" if parameters else None - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - if parameters is not None: - _json = self._serialize.body(parameters, "MigrateVMToVirtualMachineScaleSetInput") - else: - _json = None - - _request = build_migrate_to_vm_scale_set_request( - 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, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [202]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_migrate_to_vm_scale_set( - self, - resource_group_name: str, - vm_name: str, - parameters: Optional[_models.MigrateVMToVirtualMachineScaleSetInput] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Migrate a virtual machine from availability set to Flexible Virtual Machine Scale Set. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_name: The name of the virtual machine. Required. - :type vm_name: str - :param parameters: Parameters supplied to the Migrate Virtual Machine operation. Default value - is None. - :type parameters: ~azure.mgmt.compute.models.MigrateVMToVirtualMachineScaleSetInput - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_migrate_to_vm_scale_set( - self, - resource_group_name: str, - vm_name: str, - parameters: Optional[IO[bytes]] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Migrate a virtual machine from availability set to Flexible Virtual Machine Scale Set. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_name: The name of the virtual machine. Required. - :type vm_name: str - :param parameters: Parameters supplied to the Migrate Virtual Machine operation. Default value - is None. - :type parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_migrate_to_vm_scale_set( - self, - resource_group_name: str, - vm_name: str, - parameters: Optional[Union[_models.MigrateVMToVirtualMachineScaleSetInput, IO[bytes]]] = None, - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Migrate a virtual machine from availability set to Flexible Virtual Machine Scale Set. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_name: The name of the virtual machine. Required. - :type vm_name: str - :param parameters: Parameters supplied to the Migrate Virtual Machine operation. Is either a - MigrateVMToVirtualMachineScaleSetInput type or a IO[bytes] type. Default value is None. - :type parameters: ~azure.mgmt.compute.models.MigrateVMToVirtualMachineScaleSetInput or - IO[bytes] - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - content_type = content_type if parameters else None - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._migrate_to_vm_scale_set_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, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _perform_maintenance_initial( - self, resource_group_name: str, vm_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_perform_maintenance_request( - resource_group_name=resource_group_name, - vm_name=vm_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_perform_maintenance( - 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. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_name: The name of the virtual machine. Required. - :type vm_name: str - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._perform_maintenance_initial( - resource_group_name=resource_group_name, - vm_name=vm_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _power_off_initial( - self, resource_group_name: str, vm_name: str, skip_shutdown: Optional[bool] = None, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_power_off_request( - resource_group_name=resource_group_name, - vm_name=vm_name, - subscription_id=self._config.subscription_id, - skip_shutdown=skip_shutdown, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_power_off( - self, resource_group_name: str, vm_name: str, skip_shutdown: Optional[bool] = None, **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. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_name: The name of the virtual machine. Required. - :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 None. - :type skip_shutdown: bool - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._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, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _reapply_initial(self, resource_group_name: str, vm_name: str, **kwargs: Any) -> AsyncIterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_reapply_request( - resource_group_name=resource_group_name, - vm_name=vm_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_reapply(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. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_name: The name of the virtual machine. Required. - :type vm_name: str - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._reapply_initial( - resource_group_name=resource_group_name, - vm_name=vm_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _redeploy_initial(self, resource_group_name: str, vm_name: str, **kwargs: Any) -> AsyncIterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_redeploy_request( - resource_group_name=resource_group_name, - vm_name=vm_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_redeploy(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. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_name: The name of the virtual machine. Required. - :type vm_name: str - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._redeploy_initial( - resource_group_name=resource_group_name, - vm_name=vm_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _reimage_initial( - self, - resource_group_name: str, - vm_name: str, - parameters: Optional[Union[_models.VirtualMachineReimageParameters, IO[bytes]]] = None, - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - content_type = content_type if parameters else None - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" if parameters else None - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - if parameters is not None: - _json = self._serialize.body(parameters, "VirtualMachineReimageParameters") - else: - _json = None - - _request = build_reimage_request( - 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, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_reimage( - self, - resource_group_name: str, - vm_name: str, - parameters: Optional[_models.VirtualMachineReimageParameters] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Reimages (upgrade the operating system) a virtual machine 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. NOTE: The retaining of old OS disk depends on the value of deleteOption of OS disk. If - deleteOption is detach, the old OS disk will be preserved after reimage. If deleteOption is - delete, the old OS disk will be deleted after reimage. The deleteOption of the OS disk should - be updated accordingly before performing the reimage. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_name: The name of the virtual machine. Required. - :type vm_name: str - :param parameters: Parameters supplied to the Reimage Virtual Machine operation. Default value - is None. - :type parameters: ~azure.mgmt.compute.models.VirtualMachineReimageParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_reimage( - self, - resource_group_name: str, - vm_name: str, - parameters: Optional[IO[bytes]] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Reimages (upgrade the operating system) a virtual machine 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. NOTE: The retaining of old OS disk depends on the value of deleteOption of OS disk. If - deleteOption is detach, the old OS disk will be preserved after reimage. If deleteOption is - delete, the old OS disk will be deleted after reimage. The deleteOption of the OS disk should - be updated accordingly before performing the reimage. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_name: The name of the virtual machine. Required. - :type vm_name: str - :param parameters: Parameters supplied to the Reimage Virtual Machine operation. Default value - is None. - :type parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_reimage( - self, - resource_group_name: str, - vm_name: str, - parameters: Optional[Union[_models.VirtualMachineReimageParameters, IO[bytes]]] = None, - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Reimages (upgrade the operating system) a virtual machine 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. NOTE: The retaining of old OS disk depends on the value of deleteOption of OS disk. If - deleteOption is detach, the old OS disk will be preserved after reimage. If deleteOption is - delete, the old OS disk will be deleted after reimage. The deleteOption of the OS disk should - be updated accordingly before performing the reimage. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_name: The name of the virtual machine. Required. - :type vm_name: str - :param parameters: Parameters supplied to the Reimage Virtual Machine operation. Is either a - VirtualMachineReimageParameters type or a IO[bytes] type. Default value is None. - :type parameters: ~azure.mgmt.compute.models.VirtualMachineReimageParameters or IO[bytes] - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - content_type = content_type if parameters else None - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._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, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _restart_initial(self, resource_group_name: str, vm_name: str, **kwargs: Any) -> AsyncIterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_restart_request( - resource_group_name=resource_group_name, - vm_name=vm_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_restart(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. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_name: The name of the virtual machine. Required. - :type vm_name: str - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._restart_initial( - resource_group_name=resource_group_name, - vm_name=vm_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # 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. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_name: The name of the virtual machine. Required. - :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. **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 - :return: RetrieveBootDiagnosticsDataResult or the result of cls(response) - :rtype: ~azure.mgmt.compute.models.RetrieveBootDiagnosticsDataResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[_models.RetrieveBootDiagnosticsDataResult] = kwargs.pop("cls", None) - - _request = build_retrieve_boot_diagnostics_data_request( - resource_group_name=resource_group_name, - vm_name=vm_name, - subscription_id=self._config.subscription_id, - sas_uri_expiration_time_in_minutes=sas_uri_expiration_time_in_minutes, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("RetrieveBootDiagnosticsDataResult", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _run_command_initial( - self, - resource_group_name: str, - vm_name: str, - parameters: Union[_models.RunCommandInput, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "RunCommandInput") - - _request = build_run_command_request( - 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, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_run_command( - self, - resource_group_name: str, - vm_name: str, - parameters: _models.RunCommandInput, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.RunCommandResult]: - """Run command on the VM. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_name: The name of the virtual machine. Required. - :type vm_name: str - :param parameters: Parameters supplied to the Run command operation. Required. - :type parameters: ~azure.mgmt.compute.models.RunCommandInput - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either RunCommandResult or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.RunCommandResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_run_command( - self, - resource_group_name: str, - vm_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.RunCommandResult]: - """Run command on the VM. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_name: The name of the virtual machine. Required. - :type vm_name: str - :param parameters: Parameters supplied to the Run command operation. Required. - :type parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either RunCommandResult or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.RunCommandResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_run_command( - self, - resource_group_name: str, - vm_name: str, - parameters: Union[_models.RunCommandInput, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.RunCommandResult]: - """Run command on the VM. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_name: The name of the virtual machine. Required. - :type vm_name: str - :param parameters: Parameters supplied to the Run command operation. Is either a - RunCommandInput type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.compute.models.RunCommandInput or IO[bytes] - :return: An instance of AsyncLROPoller that returns either RunCommandResult or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.RunCommandResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.RunCommandResult] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._run_command_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, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("RunCommandResult", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.RunCommandResult].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.RunCommandResult]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @distributed_trace_async - async def simulate_eviction(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. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_name: The name of the virtual machine. Required. - :type vm_name: str - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - - _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, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [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, {}) # type: ignore - - async def _start_initial(self, resource_group_name: str, vm_name: str, **kwargs: Any) -> AsyncIterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_start_request( - resource_group_name=resource_group_name, - vm_name=vm_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_start(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. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_name: The name of the virtual machine. Required. - :type vm_name: str - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._start_initial( - resource_group_name=resource_group_name, - vm_name=vm_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list_available_sizes( - self, resource_group_name: str, vm_name: str, **kwargs: Any - ) -> AsyncItemPaged["_models.VirtualMachineSize"]: - """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. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_name: The name of the virtual machine. Required. - :type vm_name: str - :return: An iterator like instance of either VirtualMachineSize or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.models.VirtualMachineSize] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[_models.VirtualMachineSizeListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_available_sizes_request( - resource_group_name=resource_group_name, - vm_name=vm_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - _request = HttpRequest("GET", next_link) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/models/__init__.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/models/__init__.py index 9c31ff5883f1..8c17bc4732c2 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/models/__init__.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/models/__init__.py @@ -3,7 +3,7 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- # pylint: disable=wrong-import-position @@ -14,7 +14,7 @@ from ._patch import * # pylint: disable=unused-wildcard-import -from ._models_py3 import ( # type: ignore +from ._models import ( # type: ignore AccessControlRules, AccessControlRulesIdentity, AccessControlRulesPrivilege, @@ -30,6 +30,7 @@ ApiError, ApiErrorBase, ApplicationProfile, + ApproveRollingUpgradeParameterBody, AttachDetachDataDisksRequest, AutomaticOSUpgradePolicy, AutomaticOSUpgradeProperties, @@ -37,7 +38,7 @@ AutomaticZoneRebalancingPolicy, AvailabilityPolicy, AvailabilitySet, - AvailabilitySetListResult, + AvailabilitySetProperties, AvailabilitySetUpdate, AvailablePatchSummary, BillingProfile, @@ -46,41 +47,27 @@ CapacityReservation, CapacityReservationGroup, CapacityReservationGroupInstanceView, - CapacityReservationGroupListResult, + CapacityReservationGroupProperties, CapacityReservationGroupUpdate, CapacityReservationInstanceView, CapacityReservationInstanceViewWithName, - CapacityReservationListResult, CapacityReservationProfile, + CapacityReservationProperties, CapacityReservationUpdate, CapacityReservationUtilization, - CloudService, - CloudServiceExtensionProfile, - CloudServiceExtensionProperties, - CloudServiceInstanceView, - CloudServiceListResult, - CloudServiceNetworkProfile, - CloudServiceOsProfile, - CloudServiceProperties, - CloudServiceRole, - CloudServiceRoleListResult, - CloudServiceRoleProfile, - CloudServiceRoleProfileProperties, - CloudServiceRoleProperties, - CloudServiceRoleSku, - CloudServiceUpdate, - CloudServiceVaultAndSecretReference, - CloudServiceVaultCertificate, - CloudServiceVaultSecretGroup, + CloudError, CommunityGallery, + CommunityGalleryIdentifier, CommunityGalleryImage, CommunityGalleryImageIdentifier, - CommunityGalleryImageList, + CommunityGalleryImageProperties, CommunityGalleryImageVersion, - CommunityGalleryImageVersionList, + CommunityGalleryImageVersionProperties, CommunityGalleryInfo, CommunityGalleryMetadata, + CommunityGalleryProperties, ConvertToVirtualMachineScaleSetInput, + ConvertToVirtualMachineScaleSetParameterBody, CopyCompletionError, CreationData, DataDisk, @@ -88,18 +75,18 @@ DataDiskImageEncryption, DataDisksToAttach, DataDisksToDetach, + DeallocateParameterBody, DedicatedHost, DedicatedHostAllocatableVM, DedicatedHostAvailableCapacity, DedicatedHostGroup, DedicatedHostGroupInstanceView, - DedicatedHostGroupListResult, + DedicatedHostGroupProperties, DedicatedHostGroupPropertiesAdditionalCapabilities, DedicatedHostGroupUpdate, DedicatedHostInstanceView, DedicatedHostInstanceViewWithName, - DedicatedHostListResult, - DedicatedHostSizeListResult, + DedicatedHostProperties, DedicatedHostUpdate, DefaultVirtualMachineScaleSetInfo, DiagnosticsProfile, @@ -108,29 +95,31 @@ DisallowedConfiguration, Disk, DiskAccess, - DiskAccessList, + DiskAccessProperties, DiskAccessUpdate, DiskEncryptionSet, - DiskEncryptionSetList, DiskEncryptionSetParameters, DiskEncryptionSetUpdate, + DiskEncryptionSetUpdateProperties, DiskEncryptionSettings, DiskImageEncryption, DiskInstanceView, - DiskList, + DiskProperties, DiskPurchasePlan, DiskRestorePoint, DiskRestorePointAttributes, DiskRestorePointInstanceView, - DiskRestorePointList, + DiskRestorePointProperties, DiskRestorePointReplicationStatus, DiskSecurityProfile, DiskSku, DiskUpdate, + DiskUpdateProperties, Encryption, EncryptionIdentity, EncryptionImages, EncryptionSetIdentity, + EncryptionSetProperties, EncryptionSettingsCollection, EncryptionSettingsElement, ErrorAdditionalInfo, @@ -139,15 +128,14 @@ EventGridAndResourceGraph, ExecutedValidation, ExtendedLocation, - Extension, Gallery, GalleryApplication, GalleryApplicationCustomAction, GalleryApplicationCustomActionParameter, - GalleryApplicationList, + GalleryApplicationProperties, GalleryApplicationUpdate, GalleryApplicationVersion, - GalleryApplicationVersionList, + GalleryApplicationVersionProperties, GalleryApplicationVersionPublishingProfile, GalleryApplicationVersionSafetyProfile, GalleryApplicationVersionUpdate, @@ -164,31 +152,30 @@ GalleryImage, GalleryImageFeature, GalleryImageIdentifier, - GalleryImageList, + GalleryImageProperties, GalleryImageUpdate, GalleryImageVersion, - GalleryImageVersionList, + GalleryImageVersionProperties, GalleryImageVersionPublishingProfile, GalleryImageVersionSafetyProfile, GalleryImageVersionStorageProfile, GalleryImageVersionUefiSettings, GalleryImageVersionUpdate, GalleryInVMAccessControlProfile, - GalleryInVMAccessControlProfileList, GalleryInVMAccessControlProfileProperties, GalleryInVMAccessControlProfileUpdate, GalleryInVMAccessControlProfileVersion, - GalleryInVMAccessControlProfileVersionList, GalleryInVMAccessControlProfileVersionProperties, GalleryInVMAccessControlProfileVersionUpdate, - GalleryList, GalleryOSDiskImage, + GalleryProperties, GalleryResourceProfilePropertiesBase, GalleryResourceProfileVersionPropertiesBase, GallerySoftDeletedResource, - GallerySoftDeletedResourceList, + GallerySoftDeletedResourceProperties, GalleryTargetExtendedLocation, GalleryUpdate, + GenerateKeyPairParameterBody, GrantAccessData, HardwareProfile, HostEndpointSettings, @@ -197,17 +184,15 @@ ImageDeprecationStatus, ImageDisk, ImageDiskReference, - ImageListResult, ImageOSDisk, + ImageProperties, ImagePurchasePlan, ImageReference, ImageStorageProfile, ImageUpdate, ImageVersionSecurityProfile, InnerError, - InstanceSku, InstanceViewStatus, - InstanceViewStatusesSummary, KeyForDiskEncryptionSet, KeyVaultAndKeyReference, KeyVaultAndSecretReference, @@ -218,42 +203,31 @@ LinuxParameters, LinuxPatchSettings, LinuxVMGuestPatchAutomaticByPlatformSettings, - ListUsagesResult, - LoadBalancerConfiguration, - LoadBalancerConfigurationProperties, - LoadBalancerFrontendIpConfiguration, - LoadBalancerFrontendIpConfigurationProperties, LogAnalyticsInputBase, - LogAnalyticsOperationResult, - LogAnalyticsOutput, MaintenanceRedeployStatus, ManagedDiskParameters, MaxInstancePercentPerZonePolicy, MigrateToVirtualMachineScaleSetInput, + MigrateToVmScaleSetParameterBody, MigrateVMToVirtualMachineScaleSetInput, NetworkInterfaceReference, + NetworkInterfaceReferenceProperties, NetworkProfile, OSDisk, OSDiskImage, OSDiskImageEncryption, OSDiskImageSecurityProfile, - OSFamily, - OSFamilyListResult, - OSFamilyProperties, OSImageNotificationProfile, OSProfile, OSProfileProvisioningData, - OSVersion, - OSVersionListResult, - OSVersionProperties, - OSVersionPropertiesBase, + OkResponse, Operation, OperationDisplay, - OperationListResult, OrchestrationServiceStateInput, OrchestrationServiceSummary, PatchInstallationDetail, PatchSettings, + PerformMaintenanceParameterBody, PirCommunityGalleryResource, PirResource, PirSharedGalleryResource, @@ -261,16 +235,18 @@ Plan, PlatformAttribute, PolicyViolation, + PowerOffParameterBody, PriorityMixPolicy, PrivateEndpoint, PrivateEndpointConnection, - PrivateEndpointConnectionListResult, + PrivateEndpointConnectionProperties, PrivateLinkResource, PrivateLinkResourceListResult, + PrivateLinkResourceProperties, PrivateLinkServiceConnectionState, PropertyUpdatesInProgress, ProximityPlacementGroup, - ProximityPlacementGroupListResult, + ProximityPlacementGroupProperties, ProximityPlacementGroupPropertiesIntent, ProximityPlacementGroupUpdate, ProxyAgentSettings, @@ -279,15 +255,19 @@ PurchasePlan, RecommendedMachineConfiguration, RecoveryWalkResponse, + RedeployParameterBody, RegionalReplicationStatus, RegionalSharingStatus, + ReimageAllParameterBody, + ReimageParameterBody, + ReimageParameterBody1, + ReimageParameterBody2, ReplicationStatus, RequestRateByIntervalInput, ResiliencyPolicy, ResilientVMCreationPolicy, ResilientVMDeletionPolicy, Resource, - ResourceInstanceViewStatus, ResourceRange, ResourceSharingProfile, ResourceSku, @@ -298,37 +278,30 @@ ResourceSkuRestrictionInfo, ResourceSkuRestrictions, ResourceSkuZoneDetails, - ResourceSkusResult, - ResourceUriList, - ResourceWithOptionalLocation, + RestartParameterBody, RestorePoint, RestorePointCollection, - RestorePointCollectionListResult, + RestorePointCollectionProperties, RestorePointCollectionSourceProperties, RestorePointCollectionUpdate, RestorePointEncryption, RestorePointInstanceView, + RestorePointProperties, RestorePointSourceMetadata, RestorePointSourceVMDataDisk, RestorePointSourceVMOSDisk, RestorePointSourceVMStorageProfile, RetrieveBootDiagnosticsDataResult, - RoleInstance, - RoleInstanceListResult, - RoleInstanceNetworkProfile, - RoleInstanceProperties, - RoleInstanceView, - RoleInstances, RollbackStatusInfo, RollingUpgradePolicy, RollingUpgradeProgressInfo, RollingUpgradeRunningStatus, RollingUpgradeStatusInfo, + RollingUpgradeStatusInfoProperties, RunCommandDocument, RunCommandDocumentBase, RunCommandInput, RunCommandInputParameter, - RunCommandListResult, RunCommandManagedIdentity, RunCommandParameterDefinition, RunCommandResult, @@ -345,13 +318,14 @@ SharedGallery, SharedGalleryDataDiskImage, SharedGalleryDiskImage, + SharedGalleryIdentifier, SharedGalleryImage, - SharedGalleryImageList, + SharedGalleryImageProperties, SharedGalleryImageVersion, - SharedGalleryImageVersionList, + SharedGalleryImageVersionProperties, SharedGalleryImageVersionStorageProfile, - SharedGalleryList, SharedGalleryOSDiskImage, + SharedGalleryProperties, SharingProfile, SharingProfileGroup, SharingStatus, @@ -360,9 +334,10 @@ SkuProfile, SkuProfileVMSize, Snapshot, - SnapshotList, + SnapshotProperties, SnapshotSku, SnapshotUpdate, + SnapshotUpdateProperties, SoftDeletePolicy, SourceVault, SpotRestorePolicy, @@ -371,9 +346,9 @@ SshPublicKey, SshPublicKeyGenerateKeyPairResult, SshPublicKeyResource, + SshPublicKeyResourceProperties, SshPublicKeyUpdateResource, - SshPublicKeysGroupListResult, - StatusCodeCount, + StartParameterBody, StorageProfile, SubResource, SubResourceReadOnly, @@ -387,8 +362,6 @@ UefiKey, UefiKeySignatures, UefiSettings, - UpdateDomain, - UpdateDomainListResult, UpdateResource, UpdateResourceDefinition, UpgradeOperationHistoricalStatusInfo, @@ -421,84 +394,92 @@ VirtualMachineExtension, VirtualMachineExtensionHandlerInstanceView, VirtualMachineExtensionImage, + VirtualMachineExtensionImageProperties, VirtualMachineExtensionInstanceView, + VirtualMachineExtensionProperties, VirtualMachineExtensionUpdate, - VirtualMachineExtensionsListResult, + VirtualMachineExtensionUpdateProperties, VirtualMachineHealthStatus, VirtualMachineIdentity, VirtualMachineImage, VirtualMachineImageFeature, + VirtualMachineImageProperties, VirtualMachineImageResource, VirtualMachineInstallPatchesParameters, VirtualMachineInstallPatchesResult, VirtualMachineInstanceView, VirtualMachineIpTag, - VirtualMachineListResult, VirtualMachineNetworkInterfaceConfiguration, + VirtualMachineNetworkInterfaceConfigurationProperties, VirtualMachineNetworkInterfaceDnsSettingsConfiguration, VirtualMachineNetworkInterfaceIPConfiguration, + VirtualMachineNetworkInterfaceIPConfigurationProperties, VirtualMachinePatchStatus, + VirtualMachineProperties, VirtualMachinePublicIPAddressConfiguration, + VirtualMachinePublicIPAddressConfigurationProperties, VirtualMachinePublicIPAddressDnsSettingsConfiguration, VirtualMachineReimageParameters, VirtualMachineRunCommand, VirtualMachineRunCommandInstanceView, + VirtualMachineRunCommandProperties, VirtualMachineRunCommandScriptSource, VirtualMachineRunCommandUpdate, - VirtualMachineRunCommandsListResult, VirtualMachineScaleSet, VirtualMachineScaleSetDataDisk, VirtualMachineScaleSetExtension, - VirtualMachineScaleSetExtensionListResult, VirtualMachineScaleSetExtensionProfile, + VirtualMachineScaleSetExtensionProperties, VirtualMachineScaleSetExtensionUpdate, VirtualMachineScaleSetHardwareProfile, VirtualMachineScaleSetIPConfiguration, + VirtualMachineScaleSetIPConfigurationProperties, VirtualMachineScaleSetIdentity, VirtualMachineScaleSetInstanceView, VirtualMachineScaleSetInstanceViewStatusesSummary, VirtualMachineScaleSetIpTag, - VirtualMachineScaleSetListOSUpgradeHistory, - VirtualMachineScaleSetListResult, - VirtualMachineScaleSetListSkusResult, - VirtualMachineScaleSetListWithLinkResult, VirtualMachineScaleSetManagedDiskParameters, VirtualMachineScaleSetMigrationInfo, VirtualMachineScaleSetNetworkConfiguration, VirtualMachineScaleSetNetworkConfigurationDnsSettings, + VirtualMachineScaleSetNetworkConfigurationProperties, VirtualMachineScaleSetNetworkProfile, VirtualMachineScaleSetOSDisk, VirtualMachineScaleSetOSProfile, + VirtualMachineScaleSetProperties, VirtualMachineScaleSetPublicIPAddressConfiguration, VirtualMachineScaleSetPublicIPAddressConfigurationDnsSettings, + VirtualMachineScaleSetPublicIPAddressConfigurationProperties, VirtualMachineScaleSetReimageParameters, VirtualMachineScaleSetSku, VirtualMachineScaleSetSkuCapacity, VirtualMachineScaleSetStorageProfile, VirtualMachineScaleSetUpdate, VirtualMachineScaleSetUpdateIPConfiguration, + VirtualMachineScaleSetUpdateIPConfigurationProperties, VirtualMachineScaleSetUpdateNetworkConfiguration, + VirtualMachineScaleSetUpdateNetworkConfigurationProperties, VirtualMachineScaleSetUpdateNetworkProfile, VirtualMachineScaleSetUpdateOSDisk, VirtualMachineScaleSetUpdateOSProfile, + VirtualMachineScaleSetUpdateProperties, VirtualMachineScaleSetUpdatePublicIPAddressConfiguration, + VirtualMachineScaleSetUpdatePublicIPAddressConfigurationProperties, VirtualMachineScaleSetUpdateStorageProfile, VirtualMachineScaleSetUpdateVMProfile, VirtualMachineScaleSetVM, VirtualMachineScaleSetVMExtension, VirtualMachineScaleSetVMExtensionUpdate, - VirtualMachineScaleSetVMExtensionsListResult, VirtualMachineScaleSetVMExtensionsSummary, VirtualMachineScaleSetVMInstanceIDs, VirtualMachineScaleSetVMInstanceRequiredIDs, VirtualMachineScaleSetVMInstanceView, - VirtualMachineScaleSetVMListResult, VirtualMachineScaleSetVMNetworkProfileConfiguration, VirtualMachineScaleSetVMProfile, + VirtualMachineScaleSetVMProperties, VirtualMachineScaleSetVMProtectionPolicy, VirtualMachineScaleSetVMReimageParameters, VirtualMachineSize, - VirtualMachineSizeListResult, VirtualMachineSoftwarePatchProperties, VirtualMachineStatusCodeCount, VirtualMachineUpdate, @@ -511,7 +492,7 @@ ZoneAllocationPolicy, ) -from ._compute_management_client_enums import ( # type: ignore +from ._enums import ( # type: ignore AccessControlRulesMode, AccessLevel, ActionType, @@ -521,12 +502,9 @@ Architecture, ArchitectureTypes, AvailabilityPolicyDiskDelay, - AvailabilitySetSkuTypes, CachingTypes, CapacityReservationGroupInstanceViewTypes, CapacityReservationInstanceViewTypes, - CloudServiceSlotType, - CloudServiceUpgradeMode, ConfidentialVMEncryptionType, ConsistencyModeTypes, CopyCompletionErrorReason, @@ -594,6 +572,7 @@ OrchestrationServiceState, OrchestrationServiceStateAction, Origin, + PassNames, PatchAssessmentState, PatchInstallationState, PatchOperationStatus, @@ -686,6 +665,7 @@ "ApiError", "ApiErrorBase", "ApplicationProfile", + "ApproveRollingUpgradeParameterBody", "AttachDetachDataDisksRequest", "AutomaticOSUpgradePolicy", "AutomaticOSUpgradeProperties", @@ -693,7 +673,7 @@ "AutomaticZoneRebalancingPolicy", "AvailabilityPolicy", "AvailabilitySet", - "AvailabilitySetListResult", + "AvailabilitySetProperties", "AvailabilitySetUpdate", "AvailablePatchSummary", "BillingProfile", @@ -702,41 +682,27 @@ "CapacityReservation", "CapacityReservationGroup", "CapacityReservationGroupInstanceView", - "CapacityReservationGroupListResult", + "CapacityReservationGroupProperties", "CapacityReservationGroupUpdate", "CapacityReservationInstanceView", "CapacityReservationInstanceViewWithName", - "CapacityReservationListResult", "CapacityReservationProfile", + "CapacityReservationProperties", "CapacityReservationUpdate", "CapacityReservationUtilization", - "CloudService", - "CloudServiceExtensionProfile", - "CloudServiceExtensionProperties", - "CloudServiceInstanceView", - "CloudServiceListResult", - "CloudServiceNetworkProfile", - "CloudServiceOsProfile", - "CloudServiceProperties", - "CloudServiceRole", - "CloudServiceRoleListResult", - "CloudServiceRoleProfile", - "CloudServiceRoleProfileProperties", - "CloudServiceRoleProperties", - "CloudServiceRoleSku", - "CloudServiceUpdate", - "CloudServiceVaultAndSecretReference", - "CloudServiceVaultCertificate", - "CloudServiceVaultSecretGroup", + "CloudError", "CommunityGallery", + "CommunityGalleryIdentifier", "CommunityGalleryImage", "CommunityGalleryImageIdentifier", - "CommunityGalleryImageList", + "CommunityGalleryImageProperties", "CommunityGalleryImageVersion", - "CommunityGalleryImageVersionList", + "CommunityGalleryImageVersionProperties", "CommunityGalleryInfo", "CommunityGalleryMetadata", + "CommunityGalleryProperties", "ConvertToVirtualMachineScaleSetInput", + "ConvertToVirtualMachineScaleSetParameterBody", "CopyCompletionError", "CreationData", "DataDisk", @@ -744,18 +710,18 @@ "DataDiskImageEncryption", "DataDisksToAttach", "DataDisksToDetach", + "DeallocateParameterBody", "DedicatedHost", "DedicatedHostAllocatableVM", "DedicatedHostAvailableCapacity", "DedicatedHostGroup", "DedicatedHostGroupInstanceView", - "DedicatedHostGroupListResult", + "DedicatedHostGroupProperties", "DedicatedHostGroupPropertiesAdditionalCapabilities", "DedicatedHostGroupUpdate", "DedicatedHostInstanceView", "DedicatedHostInstanceViewWithName", - "DedicatedHostListResult", - "DedicatedHostSizeListResult", + "DedicatedHostProperties", "DedicatedHostUpdate", "DefaultVirtualMachineScaleSetInfo", "DiagnosticsProfile", @@ -764,29 +730,31 @@ "DisallowedConfiguration", "Disk", "DiskAccess", - "DiskAccessList", + "DiskAccessProperties", "DiskAccessUpdate", "DiskEncryptionSet", - "DiskEncryptionSetList", "DiskEncryptionSetParameters", "DiskEncryptionSetUpdate", + "DiskEncryptionSetUpdateProperties", "DiskEncryptionSettings", "DiskImageEncryption", "DiskInstanceView", - "DiskList", + "DiskProperties", "DiskPurchasePlan", "DiskRestorePoint", "DiskRestorePointAttributes", "DiskRestorePointInstanceView", - "DiskRestorePointList", + "DiskRestorePointProperties", "DiskRestorePointReplicationStatus", "DiskSecurityProfile", "DiskSku", "DiskUpdate", + "DiskUpdateProperties", "Encryption", "EncryptionIdentity", "EncryptionImages", "EncryptionSetIdentity", + "EncryptionSetProperties", "EncryptionSettingsCollection", "EncryptionSettingsElement", "ErrorAdditionalInfo", @@ -795,15 +763,14 @@ "EventGridAndResourceGraph", "ExecutedValidation", "ExtendedLocation", - "Extension", "Gallery", "GalleryApplication", "GalleryApplicationCustomAction", "GalleryApplicationCustomActionParameter", - "GalleryApplicationList", + "GalleryApplicationProperties", "GalleryApplicationUpdate", "GalleryApplicationVersion", - "GalleryApplicationVersionList", + "GalleryApplicationVersionProperties", "GalleryApplicationVersionPublishingProfile", "GalleryApplicationVersionSafetyProfile", "GalleryApplicationVersionUpdate", @@ -820,31 +787,30 @@ "GalleryImage", "GalleryImageFeature", "GalleryImageIdentifier", - "GalleryImageList", + "GalleryImageProperties", "GalleryImageUpdate", "GalleryImageVersion", - "GalleryImageVersionList", + "GalleryImageVersionProperties", "GalleryImageVersionPublishingProfile", "GalleryImageVersionSafetyProfile", "GalleryImageVersionStorageProfile", "GalleryImageVersionUefiSettings", "GalleryImageVersionUpdate", "GalleryInVMAccessControlProfile", - "GalleryInVMAccessControlProfileList", "GalleryInVMAccessControlProfileProperties", "GalleryInVMAccessControlProfileUpdate", "GalleryInVMAccessControlProfileVersion", - "GalleryInVMAccessControlProfileVersionList", "GalleryInVMAccessControlProfileVersionProperties", "GalleryInVMAccessControlProfileVersionUpdate", - "GalleryList", "GalleryOSDiskImage", + "GalleryProperties", "GalleryResourceProfilePropertiesBase", "GalleryResourceProfileVersionPropertiesBase", "GallerySoftDeletedResource", - "GallerySoftDeletedResourceList", + "GallerySoftDeletedResourceProperties", "GalleryTargetExtendedLocation", "GalleryUpdate", + "GenerateKeyPairParameterBody", "GrantAccessData", "HardwareProfile", "HostEndpointSettings", @@ -853,17 +819,15 @@ "ImageDeprecationStatus", "ImageDisk", "ImageDiskReference", - "ImageListResult", "ImageOSDisk", + "ImageProperties", "ImagePurchasePlan", "ImageReference", "ImageStorageProfile", "ImageUpdate", "ImageVersionSecurityProfile", "InnerError", - "InstanceSku", "InstanceViewStatus", - "InstanceViewStatusesSummary", "KeyForDiskEncryptionSet", "KeyVaultAndKeyReference", "KeyVaultAndSecretReference", @@ -874,42 +838,31 @@ "LinuxParameters", "LinuxPatchSettings", "LinuxVMGuestPatchAutomaticByPlatformSettings", - "ListUsagesResult", - "LoadBalancerConfiguration", - "LoadBalancerConfigurationProperties", - "LoadBalancerFrontendIpConfiguration", - "LoadBalancerFrontendIpConfigurationProperties", "LogAnalyticsInputBase", - "LogAnalyticsOperationResult", - "LogAnalyticsOutput", "MaintenanceRedeployStatus", "ManagedDiskParameters", "MaxInstancePercentPerZonePolicy", "MigrateToVirtualMachineScaleSetInput", + "MigrateToVmScaleSetParameterBody", "MigrateVMToVirtualMachineScaleSetInput", "NetworkInterfaceReference", + "NetworkInterfaceReferenceProperties", "NetworkProfile", "OSDisk", "OSDiskImage", "OSDiskImageEncryption", "OSDiskImageSecurityProfile", - "OSFamily", - "OSFamilyListResult", - "OSFamilyProperties", "OSImageNotificationProfile", "OSProfile", "OSProfileProvisioningData", - "OSVersion", - "OSVersionListResult", - "OSVersionProperties", - "OSVersionPropertiesBase", + "OkResponse", "Operation", "OperationDisplay", - "OperationListResult", "OrchestrationServiceStateInput", "OrchestrationServiceSummary", "PatchInstallationDetail", "PatchSettings", + "PerformMaintenanceParameterBody", "PirCommunityGalleryResource", "PirResource", "PirSharedGalleryResource", @@ -917,16 +870,18 @@ "Plan", "PlatformAttribute", "PolicyViolation", + "PowerOffParameterBody", "PriorityMixPolicy", "PrivateEndpoint", "PrivateEndpointConnection", - "PrivateEndpointConnectionListResult", + "PrivateEndpointConnectionProperties", "PrivateLinkResource", "PrivateLinkResourceListResult", + "PrivateLinkResourceProperties", "PrivateLinkServiceConnectionState", "PropertyUpdatesInProgress", "ProximityPlacementGroup", - "ProximityPlacementGroupListResult", + "ProximityPlacementGroupProperties", "ProximityPlacementGroupPropertiesIntent", "ProximityPlacementGroupUpdate", "ProxyAgentSettings", @@ -935,15 +890,19 @@ "PurchasePlan", "RecommendedMachineConfiguration", "RecoveryWalkResponse", + "RedeployParameterBody", "RegionalReplicationStatus", "RegionalSharingStatus", + "ReimageAllParameterBody", + "ReimageParameterBody", + "ReimageParameterBody1", + "ReimageParameterBody2", "ReplicationStatus", "RequestRateByIntervalInput", "ResiliencyPolicy", "ResilientVMCreationPolicy", "ResilientVMDeletionPolicy", "Resource", - "ResourceInstanceViewStatus", "ResourceRange", "ResourceSharingProfile", "ResourceSku", @@ -954,37 +913,30 @@ "ResourceSkuRestrictionInfo", "ResourceSkuRestrictions", "ResourceSkuZoneDetails", - "ResourceSkusResult", - "ResourceUriList", - "ResourceWithOptionalLocation", + "RestartParameterBody", "RestorePoint", "RestorePointCollection", - "RestorePointCollectionListResult", + "RestorePointCollectionProperties", "RestorePointCollectionSourceProperties", "RestorePointCollectionUpdate", "RestorePointEncryption", "RestorePointInstanceView", + "RestorePointProperties", "RestorePointSourceMetadata", "RestorePointSourceVMDataDisk", "RestorePointSourceVMOSDisk", "RestorePointSourceVMStorageProfile", "RetrieveBootDiagnosticsDataResult", - "RoleInstance", - "RoleInstanceListResult", - "RoleInstanceNetworkProfile", - "RoleInstanceProperties", - "RoleInstanceView", - "RoleInstances", "RollbackStatusInfo", "RollingUpgradePolicy", "RollingUpgradeProgressInfo", "RollingUpgradeRunningStatus", "RollingUpgradeStatusInfo", + "RollingUpgradeStatusInfoProperties", "RunCommandDocument", "RunCommandDocumentBase", "RunCommandInput", "RunCommandInputParameter", - "RunCommandListResult", "RunCommandManagedIdentity", "RunCommandParameterDefinition", "RunCommandResult", @@ -1001,13 +953,14 @@ "SharedGallery", "SharedGalleryDataDiskImage", "SharedGalleryDiskImage", + "SharedGalleryIdentifier", "SharedGalleryImage", - "SharedGalleryImageList", + "SharedGalleryImageProperties", "SharedGalleryImageVersion", - "SharedGalleryImageVersionList", + "SharedGalleryImageVersionProperties", "SharedGalleryImageVersionStorageProfile", - "SharedGalleryList", "SharedGalleryOSDiskImage", + "SharedGalleryProperties", "SharingProfile", "SharingProfileGroup", "SharingStatus", @@ -1016,9 +969,10 @@ "SkuProfile", "SkuProfileVMSize", "Snapshot", - "SnapshotList", + "SnapshotProperties", "SnapshotSku", "SnapshotUpdate", + "SnapshotUpdateProperties", "SoftDeletePolicy", "SourceVault", "SpotRestorePolicy", @@ -1027,9 +981,9 @@ "SshPublicKey", "SshPublicKeyGenerateKeyPairResult", "SshPublicKeyResource", + "SshPublicKeyResourceProperties", "SshPublicKeyUpdateResource", - "SshPublicKeysGroupListResult", - "StatusCodeCount", + "StartParameterBody", "StorageProfile", "SubResource", "SubResourceReadOnly", @@ -1043,8 +997,6 @@ "UefiKey", "UefiKeySignatures", "UefiSettings", - "UpdateDomain", - "UpdateDomainListResult", "UpdateResource", "UpdateResourceDefinition", "UpgradeOperationHistoricalStatusInfo", @@ -1077,84 +1029,92 @@ "VirtualMachineExtension", "VirtualMachineExtensionHandlerInstanceView", "VirtualMachineExtensionImage", + "VirtualMachineExtensionImageProperties", "VirtualMachineExtensionInstanceView", + "VirtualMachineExtensionProperties", "VirtualMachineExtensionUpdate", - "VirtualMachineExtensionsListResult", + "VirtualMachineExtensionUpdateProperties", "VirtualMachineHealthStatus", "VirtualMachineIdentity", "VirtualMachineImage", "VirtualMachineImageFeature", + "VirtualMachineImageProperties", "VirtualMachineImageResource", "VirtualMachineInstallPatchesParameters", "VirtualMachineInstallPatchesResult", "VirtualMachineInstanceView", "VirtualMachineIpTag", - "VirtualMachineListResult", "VirtualMachineNetworkInterfaceConfiguration", + "VirtualMachineNetworkInterfaceConfigurationProperties", "VirtualMachineNetworkInterfaceDnsSettingsConfiguration", "VirtualMachineNetworkInterfaceIPConfiguration", + "VirtualMachineNetworkInterfaceIPConfigurationProperties", "VirtualMachinePatchStatus", + "VirtualMachineProperties", "VirtualMachinePublicIPAddressConfiguration", + "VirtualMachinePublicIPAddressConfigurationProperties", "VirtualMachinePublicIPAddressDnsSettingsConfiguration", "VirtualMachineReimageParameters", "VirtualMachineRunCommand", "VirtualMachineRunCommandInstanceView", + "VirtualMachineRunCommandProperties", "VirtualMachineRunCommandScriptSource", "VirtualMachineRunCommandUpdate", - "VirtualMachineRunCommandsListResult", "VirtualMachineScaleSet", "VirtualMachineScaleSetDataDisk", "VirtualMachineScaleSetExtension", - "VirtualMachineScaleSetExtensionListResult", "VirtualMachineScaleSetExtensionProfile", + "VirtualMachineScaleSetExtensionProperties", "VirtualMachineScaleSetExtensionUpdate", "VirtualMachineScaleSetHardwareProfile", "VirtualMachineScaleSetIPConfiguration", + "VirtualMachineScaleSetIPConfigurationProperties", "VirtualMachineScaleSetIdentity", "VirtualMachineScaleSetInstanceView", "VirtualMachineScaleSetInstanceViewStatusesSummary", "VirtualMachineScaleSetIpTag", - "VirtualMachineScaleSetListOSUpgradeHistory", - "VirtualMachineScaleSetListResult", - "VirtualMachineScaleSetListSkusResult", - "VirtualMachineScaleSetListWithLinkResult", "VirtualMachineScaleSetManagedDiskParameters", "VirtualMachineScaleSetMigrationInfo", "VirtualMachineScaleSetNetworkConfiguration", "VirtualMachineScaleSetNetworkConfigurationDnsSettings", + "VirtualMachineScaleSetNetworkConfigurationProperties", "VirtualMachineScaleSetNetworkProfile", "VirtualMachineScaleSetOSDisk", "VirtualMachineScaleSetOSProfile", + "VirtualMachineScaleSetProperties", "VirtualMachineScaleSetPublicIPAddressConfiguration", "VirtualMachineScaleSetPublicIPAddressConfigurationDnsSettings", + "VirtualMachineScaleSetPublicIPAddressConfigurationProperties", "VirtualMachineScaleSetReimageParameters", "VirtualMachineScaleSetSku", "VirtualMachineScaleSetSkuCapacity", "VirtualMachineScaleSetStorageProfile", "VirtualMachineScaleSetUpdate", "VirtualMachineScaleSetUpdateIPConfiguration", + "VirtualMachineScaleSetUpdateIPConfigurationProperties", "VirtualMachineScaleSetUpdateNetworkConfiguration", + "VirtualMachineScaleSetUpdateNetworkConfigurationProperties", "VirtualMachineScaleSetUpdateNetworkProfile", "VirtualMachineScaleSetUpdateOSDisk", "VirtualMachineScaleSetUpdateOSProfile", + "VirtualMachineScaleSetUpdateProperties", "VirtualMachineScaleSetUpdatePublicIPAddressConfiguration", + "VirtualMachineScaleSetUpdatePublicIPAddressConfigurationProperties", "VirtualMachineScaleSetUpdateStorageProfile", "VirtualMachineScaleSetUpdateVMProfile", "VirtualMachineScaleSetVM", "VirtualMachineScaleSetVMExtension", "VirtualMachineScaleSetVMExtensionUpdate", - "VirtualMachineScaleSetVMExtensionsListResult", "VirtualMachineScaleSetVMExtensionsSummary", "VirtualMachineScaleSetVMInstanceIDs", "VirtualMachineScaleSetVMInstanceRequiredIDs", "VirtualMachineScaleSetVMInstanceView", - "VirtualMachineScaleSetVMListResult", "VirtualMachineScaleSetVMNetworkProfileConfiguration", "VirtualMachineScaleSetVMProfile", + "VirtualMachineScaleSetVMProperties", "VirtualMachineScaleSetVMProtectionPolicy", "VirtualMachineScaleSetVMReimageParameters", "VirtualMachineSize", - "VirtualMachineSizeListResult", "VirtualMachineSoftwarePatchProperties", "VirtualMachineStatusCodeCount", "VirtualMachineUpdate", @@ -1174,12 +1134,9 @@ "Architecture", "ArchitectureTypes", "AvailabilityPolicyDiskDelay", - "AvailabilitySetSkuTypes", "CachingTypes", "CapacityReservationGroupInstanceViewTypes", "CapacityReservationInstanceViewTypes", - "CloudServiceSlotType", - "CloudServiceUpgradeMode", "ConfidentialVMEncryptionType", "ConsistencyModeTypes", "CopyCompletionErrorReason", @@ -1247,6 +1204,7 @@ "OrchestrationServiceState", "OrchestrationServiceStateAction", "Origin", + "PassNames", "PatchAssessmentState", "PatchInstallationState", "PatchOperationStatus", diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/models/_compute_management_client_enums.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/models/_enums.py similarity index 89% rename from sdk/compute/azure-mgmt-compute/azure/mgmt/compute/models/_compute_management_client_enums.py rename to sdk/compute/azure-mgmt-compute/azure/mgmt/compute/models/_enums.py index bd22cdaf6304..6d51b88a9255 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/models/_compute_management_client_enums.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/models/_enums.py @@ -3,7 +3,7 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -30,9 +30,12 @@ class AccessLevel(str, Enum, metaclass=CaseInsensitiveEnumMeta): class ActionType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs.""" + """Extensible enum. Indicates the action type. "Internal" refers to actions that are for internal + only APIs. + """ INTERNAL = "Internal" + """Actions are for internal-only APIs.""" class AggregatedReplicationState(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -63,7 +66,7 @@ class AlternativeType(str, Enum, metaclass=CaseInsensitiveEnumMeta): class Architecture(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The architecture of the image. Applicable to OS disks only.""" + """CPU architecture supported by an OS disk.""" X64 = "x64" ARM64 = "Arm64" @@ -85,15 +88,6 @@ class AvailabilityPolicyDiskDelay(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Upon a disk io failure or slow response, try detaching then reattaching the disk.""" -class AvailabilitySetSkuTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """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(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Specifies the caching requirements. Possible values are: **None,** **ReadOnly,** **ReadWrite.** The default values are: **None for Standard storage. ReadOnly for Premium storage**. @@ -105,45 +99,17 @@ class CachingTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): class CapacityReservationGroupInstanceViewTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """CapacityReservationGroupInstanceViewTypes.""" + """Type of CapacityReservationGroupInstanceViewTypes.""" INSTANCE_VIEW = "instanceView" class CapacityReservationInstanceViewTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """CapacityReservationInstanceViewTypes.""" + """Type of CapacityReservationInstanceViewTypes.""" INSTANCE_VIEW = "instanceView" -class CloudServiceSlotType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Slot type for the cloud service. - Possible values are :code:`
`\\ :code:`
`\\ **Production**\\ :code:`
`\\ - :code:`
`\\ **Staging**\\ :code:`
`\\ :code:`
` - If not specified, the default value is Production. - """ - - PRODUCTION = "Production" - STAGING = "Staging" - - -class CloudServiceUpgradeMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Update mode for the cloud service. Role instances are allocated to update domains when the - service is deployed. Updates can be initiated manually in each update domain or initiated - automatically in all update domains. - Possible Values are :code:`
`\\ :code:`
`\\ **Auto**\\ :code:`
`\\ :code:`
`\\ **Manual** :code:`
`\\ :code:`
`\\ **Simultaneous**\\ :code:`
`\\ - :code:`
` - If not specified, the default value is Auto. If set to Manual, PUT UpdateDomain must be called - to apply the update. If set to Auto, the update is automatically applied to each update domain - in sequence. - """ - - AUTO = "Auto" - MANUAL = "Manual" - SIMULTANEOUS = "Simultaneous" - - class ConfidentialVMEncryptionType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """confidential VM encryption types.""" @@ -156,7 +122,7 @@ class ConfidentialVMEncryptionType(str, Enum, metaclass=CaseInsensitiveEnumMeta) class ConsistencyModeTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): """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. + `https://aka.ms/RestorePoints `_ for more details. """ CRASH_CONSISTENT = "CrashConsistent" @@ -175,12 +141,16 @@ class CopyCompletionErrorReason(str, Enum, metaclass=CaseInsensitiveEnumMeta): class CreatedByType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The type of identity that created the resource.""" + """The kind of entity that created the resource.""" USER = "User" + """The entity was created by a user.""" APPLICATION = "Application" + """The entity was created by an application.""" MANAGED_IDENTITY = "ManagedIdentity" + """The entity was created by a managed identity.""" KEY = "Key" + """The entity was created by a key.""" class DataAccessAuthMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -223,9 +193,11 @@ class DiffDiskPlacement(str, Enum, metaclass=CaseInsensitiveEnumMeta): user in the request to choose the location i.e, cache disk, resource disk or nvme 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 + `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. + `https://docs.microsoft.com/azure/virtual-machines/linux/ephemeral-os-disks#size-requirements + `_. Minimum api-version for NvmeDisk: 2024-03-01. """ @@ -237,11 +209,14 @@ class DiffDiskPlacement(str, Enum, metaclass=CaseInsensitiveEnumMeta): class DiskControllerTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Specifies the disk controller type configured for the VM and VirtualMachineScaleSet. This property is only supported for virtual machines whose operating system disk and VM sku supports - Generation 2 (https://docs.microsoft.com/en-us/azure/virtual-machines/generation-2), please - check the HyperVGenerations capability returned as part of VM sku capabilities in the response - of Microsoft.Compute SKUs api for the region contains V2 - (https://docs.microsoft.com/rest/api/compute/resourceskus/list). For more information about - Disk Controller Types supported please refer to https://aka.ms/azure-diskcontrollertypes. + Generation 2 (`https://docs.microsoft.com/en-us/azure/virtual-machines/generation-2 + `_), please check the + HyperVGenerations capability returned as part of VM sku capabilities in the response of + Microsoft.Compute SKUs api for the region contains V2 + (`https://docs.microsoft.com/rest/api/compute/resourceskus/list + `_). For more information about + Disk Controller Types supported please refer to `https://aka.ms/azure-diskcontrollertypes + `_. """ SCSI = "SCSI" @@ -285,9 +260,6 @@ class DiskCreateOption(str, Enum, metaclass=CaseInsensitiveEnumMeta): Trusted Launch VM.""" COPY_FROM_SAN_SNAPSHOT = "CopyFromSanSnapshot" """Create a new disk by exporting from elastic san volume snapshot""" - IMPORT_ENUM = "Import" - """Create a disk by importing from a blob specified by a sourceUri in a storage account specified - by storageAccountId.""" class DiskCreateOptionTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -493,26 +465,26 @@ class ExecutionState(str, Enum, metaclass=CaseInsensitiveEnumMeta): class ExpandTypeForListVMs(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """ExpandTypeForListVMs.""" + """Type of ExpandTypeForListVMs.""" INSTANCE_VIEW = "instanceView" class ExpandTypesForGetCapacityReservationGroups(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """ExpandTypesForGetCapacityReservationGroups.""" + """Type of ExpandTypesForGetCapacityReservationGroups.""" VIRTUAL_MACHINE_SCALE_SET_VMS_REF = "virtualMachineScaleSetVMs/$ref" VIRTUAL_MACHINES_REF = "virtualMachines/$ref" class ExpandTypesForGetVMScaleSets(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """ExpandTypesForGetVMScaleSets.""" + """Type of ExpandTypesForGetVMScaleSets.""" USER_DATA = "userData" class ExpandTypesForListVMs(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """ExpandTypesForListVMs.""" + """Type of ExpandTypesForListVMs.""" INSTANCE_VIEW = "instanceView" @@ -558,7 +530,7 @@ class GalleryApplicationScriptRebootBehavior(str, Enum, metaclass=CaseInsensitiv class GalleryExpandParams(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """GalleryExpandParams.""" + """Type of GalleryExpandParams.""" SHARING_PROFILE_GROUPS = "SharingProfile/Groups" @@ -609,7 +581,7 @@ class HostCaching(str, Enum, metaclass=CaseInsensitiveEnumMeta): class HyperVGeneration(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The hypervisor generation of the Virtual Machine. Applicable to OS disks only.""" + """The hypervisor generation of the Virtual Machine [V1, V2].""" V1 = "V1" V2 = "V2" @@ -638,7 +610,7 @@ class ImageState(str, Enum, metaclass=CaseInsensitiveEnumMeta): class InstanceViewTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """InstanceViewTypes.""" + """Type of InstanceViewTypes.""" INSTANCE_VIEW = "instanceView" USER_DATA = "userData" @@ -675,11 +647,10 @@ class IPVersions(str, Enum, metaclass=CaseInsensitiveEnumMeta): class LinuxPatchAssessmentMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """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. + """Specifies the mode of VM Guest Patch Assessment for the IaaS virtual machine.

+ Possible values are:

**ImageDefault** - You control the timing of patch assessments + on a virtual machine.

**AutomaticByPlatform** - The platform will trigger periodic + patch assessments. The property provisionVMAgent must be true. """ IMAGE_DEFAULT = "ImageDefault" @@ -697,11 +668,10 @@ class LinuxVMGuestPatchAutomaticByPlatformRebootSetting(str, Enum, metaclass=Cas class LinuxVMGuestPatchMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): """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. + to virtual machine scale set with OrchestrationMode as Flexible.

Possible values + are:

**ImageDefault** - The virtual machine's default patching configuration is + used.

**AutomaticByPlatform** - The virtual machine will be automatically updated + by the platform. The property provisionVMAgent must be true. """ IMAGE_DEFAULT = "ImageDefault" @@ -756,8 +726,8 @@ class NetworkApiVersion(str, Enum, metaclass=CaseInsensitiveEnumMeta): Network Interface Configurations. """ - TWO_THOUSAND_TWENTY11_01 = "2020-11-01" - TWO_THOUSAND_TWENTY_TWO11_01 = "2022-11-01" + ENUM_2020_11_01 = "2020-11-01" + ENUM_2022_11_01 = "2022-11-01" class NetworkInterfaceAuxiliaryMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -779,12 +749,12 @@ class NetworkInterfaceAuxiliarySku(str, Enum, metaclass=CaseInsensitiveEnumMeta) class OperatingSystemStateTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """This property allows the user to specify whether the virtual machines created under this image - are 'Generalized' or 'Specialized'. - """ + """The OS State. For managed images, use Generalized.""" GENERALIZED = "Generalized" + """Generalized image. Needs to be provisioned during deployment time.""" SPECIALIZED = "Specialized" + """Specialized image. Contains already provisioned OS Disk.""" class OperatingSystemType(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -795,8 +765,8 @@ class OperatingSystemType(str, Enum, metaclass=CaseInsensitiveEnumMeta): class OperatingSystemTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """This property allows you to specify the supported type of the OS that application is built for. - Possible values are: **Windows,** **Linux.**. + """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. Possible values are: **Windows,** **Linux.**. """ WINDOWS = "Windows" @@ -848,8 +818,17 @@ class Origin(str, Enum, metaclass=CaseInsensitiveEnumMeta): """ USER = "user" + """Indicates the operation is initiated by a user.""" SYSTEM = "system" + """Indicates the operation is initiated by a system.""" USER_SYSTEM = "user,system" + """Indicates the operation is initiated by a user or system.""" + + +class PassNames(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Type of PassNames.""" + + OOBE_SYSTEM = "OobeSystem" class PatchAssessmentState(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -946,7 +925,6 @@ class PublicIPAddressSkuTier(str, Enum, metaclass=CaseInsensitiveEnumMeta): REGIONAL = "Regional" GLOBAL = "Global" - GLOBAL_ENUM = "Global" class PublicIPAllocationMethod(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -1014,7 +992,7 @@ class ReplicationState(str, Enum, metaclass=CaseInsensitiveEnumMeta): class ReplicationStatusTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """ReplicationStatusTypes.""" + """Type of ReplicationStatusTypes.""" REPLICATION_STATUS = "ReplicationStatus" UEFI_SETTINGS = "UefiSettings" @@ -1045,9 +1023,9 @@ class ResilientVMDeletionStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): class ResourceIdentityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The type of identity used for the gallery. The type 'SystemAssigned, UserAssigned' includes - both an implicitly created identity and a set of user assigned identities. The type 'None' will - remove all identities from the gallery. + """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" @@ -1057,7 +1035,7 @@ class ResourceIdentityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): class ResourceIdOptionsForGetCapacityReservationGroups(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """ResourceIdOptionsForGetCapacityReservationGroups.""" + """Type of ResourceIdOptionsForGetCapacityReservationGroups.""" CREATED_IN_SUBSCRIPTION = "CreatedInSubscription" SHARED_WITH_SUBSCRIPTION = "SharedWithSubscription" @@ -1087,7 +1065,7 @@ class ResourceSkuRestrictionsType(str, Enum, metaclass=CaseInsensitiveEnumMeta): class RestorePointCollectionExpandOptions(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """RestorePointCollectionExpandOptions.""" + """Type of RestorePointCollectionExpandOptions.""" RESTORE_POINTS = "restorePoints" @@ -1106,7 +1084,7 @@ class RestorePointEncryptionType(str, Enum, metaclass=CaseInsensitiveEnumMeta): class RestorePointExpandOptions(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """RestorePointExpandOptions.""" + """Type of RestorePointExpandOptions.""" INSTANCE_VIEW = "instanceView" @@ -1159,7 +1137,7 @@ class SecurityTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): class SelectPermissions(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """SelectPermissions.""" + """Type of SelectPermissions.""" PERMISSIONS = "Permissions" @@ -1182,7 +1160,7 @@ class SharedGalleryHostCaching(str, Enum, metaclass=CaseInsensitiveEnumMeta): class SharedToValues(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """SharedToValues.""" + """Type of SharedToValues.""" TENANT = "tenant" @@ -1284,8 +1262,10 @@ class StorageAccountTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): 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. + `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" @@ -1324,11 +1304,11 @@ class UefiSignatureTemplateName(str, Enum, metaclass=CaseInsensitiveEnumMeta): class UpgradeMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """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. + """Specifies the mode of an upgrade to virtual machines in the scale set.

Possible + values are:

**Manual** - You control the application of updates to virtual + machines in the scale set. You do this by using the manualUpgrade action.

+ **Automatic** - All virtual machines in the scale set are automatically updated at the same + time. """ AUTOMATIC = "Automatic" @@ -1380,7 +1360,7 @@ class VirtualMachinePriorityTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): class VirtualMachineScaleSetScaleInRules(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """VirtualMachineScaleSetScaleInRules.""" + """Type of VirtualMachineScaleSetScaleInRules.""" DEFAULT = "Default" OLDEST_VM = "OldestVM" @@ -1398,10 +1378,10 @@ class VirtualMachineSizeTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Specifies the size of the virtual machine. The enum data type is currently deprecated and will be removed by December 23rd 2023. The recommended way to get the list of available sizes is using these APIs: `List all available virtual machine sizes in an availability set - `_\\ , `List - all available virtual machine sizes in a region - `_\\ , `List all available - virtual machine sizes for resizing + `_, `List all + available virtual machine sizes in a region + `_, `List all available virtual + machine sizes for resizing `_. For more information about virtual machine sizes, see `Sizes for virtual machines `_. The available VM sizes depend on @@ -1584,7 +1564,7 @@ class VmDiskTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): class VMGuestPatchClassificationLinux(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """VMGuestPatchClassificationLinux.""" + """Type of VMGuestPatchClassificationLinux.""" CRITICAL = "Critical" SECURITY = "Security" @@ -1592,7 +1572,7 @@ class VMGuestPatchClassificationLinux(str, Enum, metaclass=CaseInsensitiveEnumMe class VMGuestPatchClassificationWindows(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """VMGuestPatchClassificationWindows.""" + """Type of VMGuestPatchClassificationWindows.""" CRITICAL = "Critical" SECURITY = "Security" @@ -1633,11 +1613,10 @@ class VMGuestPatchRebootStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): class WindowsPatchAssessmentMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """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. + """Specifies the mode of VM Guest patch assessment for the IaaS virtual machine.

+ Possible values are:

**ImageDefault** - You control the timing of patch assessments + on a virtual machine.

**AutomaticByPlatform** - The platform will trigger periodic + patch assessments. The property provisionVMAgent must be true. """ IMAGE_DEFAULT = "ImageDefault" @@ -1655,15 +1634,14 @@ class WindowsVMGuestPatchAutomaticByPlatformRebootSetting(str, Enum, metaclass=C class WindowsVMGuestPatchMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): """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:`
` + to virtual machine scale set with OrchestrationMode as Flexible.

Possible values + are:

**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

**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. + WindowsConfiguration.enableAutomaticUpdates must be true.

**AutomaticByPlatform** + - the virtual machine will automatically updated by the platform. The properties + provisionVMAgent and WindowsConfiguration.enableAutomaticUpdates must be true. """ MANUAL = "Manual" diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/models/_models.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/models/_models.py new file mode 100644 index 000000000000..d456f9284270 --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/models/_models.py @@ -0,0 +1,24622 @@ +# pylint: disable=line-too-long,useless-suppression,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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +# pylint: disable=useless-super-delegation + +import datetime +from typing import Any, Literal, Mapping, Optional, TYPE_CHECKING, Union, overload + +from .._utils.model_base import Model as _Model, rest_field + +if TYPE_CHECKING: + from .. import models as _models + + +class AccessControlRules(_Model): + """This is the Access Control Rules specification for an inVMAccessControlProfile version. + + :ivar privileges: A list of privileges. + :vartype privileges: list[~azure.mgmt.compute.models.AccessControlRulesPrivilege] + :ivar roles: A list of roles. + :vartype roles: list[~azure.mgmt.compute.models.AccessControlRulesRole] + :ivar identities: A list of identities. + :vartype identities: list[~azure.mgmt.compute.models.AccessControlRulesIdentity] + :ivar role_assignments: A list of role assignments. + :vartype role_assignments: list[~azure.mgmt.compute.models.AccessControlRulesRoleAssignment] + """ + + privileges: Optional[list["_models.AccessControlRulesPrivilege"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """A list of privileges.""" + roles: Optional[list["_models.AccessControlRulesRole"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """A list of roles.""" + identities: Optional[list["_models.AccessControlRulesIdentity"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """A list of identities.""" + role_assignments: Optional[list["_models.AccessControlRulesRoleAssignment"]] = rest_field( + name="roleAssignments", visibility=["read", "create", "update", "delete", "query"] + ) + """A list of role assignments.""" + + @overload + def __init__( + self, + *, + privileges: Optional[list["_models.AccessControlRulesPrivilege"]] = None, + roles: Optional[list["_models.AccessControlRulesRole"]] = None, + identities: Optional[list["_models.AccessControlRulesIdentity"]] = None, + role_assignments: Optional[list["_models.AccessControlRulesRoleAssignment"]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class AccessControlRulesIdentity(_Model): + """The properties of an Access Control Rule Identity. + + :ivar name: The name of the identity. Required. + :vartype name: str + :ivar user_name: The username corresponding to this identity. + :vartype user_name: str + :ivar group_name: The groupName corresponding to this identity. + :vartype group_name: str + :ivar exe_path: The path to the executable. + :vartype exe_path: str + :ivar process_name: The process name of the executable. + :vartype process_name: str + """ + + name: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The name of the identity. Required.""" + user_name: Optional[str] = rest_field(name="userName", visibility=["read", "create", "update", "delete", "query"]) + """The username corresponding to this identity.""" + group_name: Optional[str] = rest_field(name="groupName", visibility=["read", "create", "update", "delete", "query"]) + """The groupName corresponding to this identity.""" + exe_path: Optional[str] = rest_field(name="exePath", visibility=["read", "create", "update", "delete", "query"]) + """The path to the executable.""" + process_name: Optional[str] = rest_field( + name="processName", visibility=["read", "create", "update", "delete", "query"] + ) + """The process name of the executable.""" + + @overload + def __init__( + self, + *, + name: str, + user_name: Optional[str] = None, + group_name: Optional[str] = None, + exe_path: Optional[str] = None, + process_name: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class AccessControlRulesPrivilege(_Model): + """The properties of an Access Control Rule Privilege. + + :ivar name: The name of the privilege. Required. + :vartype name: str + :ivar path: The HTTP path corresponding to the privilege. Required. + :vartype path: str + :ivar query_parameters: The query parameters to match in the path. + :vartype query_parameters: dict[str, str] + """ + + name: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The name of the privilege. Required.""" + path: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The HTTP path corresponding to the privilege. Required.""" + query_parameters: Optional[dict[str, str]] = rest_field( + name="queryParameters", visibility=["read", "create", "update", "delete", "query"] + ) + """The query parameters to match in the path.""" + + @overload + def __init__( + self, + *, + name: str, + path: str, + query_parameters: Optional[dict[str, str]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class AccessControlRulesRole(_Model): + """The properties of an Access Control Rule Role. + + :ivar name: The name of the role. Required. + :vartype name: str + :ivar privileges: A list of privileges needed by this role. Required. + :vartype privileges: list[str] + """ + + name: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The name of the role. Required.""" + privileges: list[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """A list of privileges needed by this role. Required.""" + + @overload + def __init__( + self, + *, + name: str, + privileges: list[str], + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class AccessControlRulesRoleAssignment(_Model): + """The properties of an Access Control Rule RoleAssignment. + + :ivar role: The name of the role. Required. + :vartype role: str + :ivar identities: A list of identities that can access the privileges defined by the role. + Required. + :vartype identities: list[str] + """ + + role: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The name of the role. Required.""" + identities: list[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """A list of identities that can access the privileges defined by the role. Required.""" + + @overload + def __init__( + self, + *, + role: str, + identities: list[str], + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class AccessUri(_Model): + """A disk access SAS uri. + + :ivar access_sas: A SAS uri for accessing a disk. + :vartype access_sas: str + :ivar security_data_access_sas: A SAS uri for accessing a VM guest state. + :vartype security_data_access_sas: str + :ivar security_metadata_access_sas: A SAS uri for accessing a VM metadata. + :vartype security_metadata_access_sas: str + """ + + access_sas: Optional[str] = rest_field(name="accessSAS", visibility=["read"]) + """A SAS uri for accessing a disk.""" + security_data_access_sas: Optional[str] = rest_field(name="securityDataAccessSAS", visibility=["read"]) + """A SAS uri for accessing a VM guest state.""" + security_metadata_access_sas: Optional[str] = rest_field(name="securityMetadataAccessSAS", visibility=["read"]) + """A SAS uri for accessing a VM metadata.""" + + +class AdditionalCapabilities(_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 + """ + + ultra_ssd_enabled: Optional[bool] = rest_field( + name="ultraSSDEnabled", visibility=["read", "create", "update", "delete", "query"] + ) + """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.""" + hibernation_enabled: Optional[bool] = rest_field( + name="hibernationEnabled", visibility=["read", "create", "update", "delete", "query"] + ) + """The flag that enables or disables hibernation capability on the VM.""" + + @overload + def __init__( + self, + *, + ultra_ssd_enabled: Optional[bool] = None, + hibernation_enabled: Optional[bool] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class AdditionalReplicaSet(_Model): + """Describes the additional replica set information. + + :ivar storage_account_type: Specifies the storage account type to be used to create the direct + drive replicas. Known values are: "Standard_LRS", "Standard_ZRS", "Premium_LRS", and + "PremiumV2_LRS". + :vartype storage_account_type: str or ~azure.mgmt.compute.models.StorageAccountType + :ivar regional_replica_count: The number of direct drive replicas of the Image Version to be + created.This Property is updatable. + :vartype regional_replica_count: int + """ + + storage_account_type: Optional[Union[str, "_models.StorageAccountType"]] = rest_field( + name="storageAccountType", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies the storage account type to be used to create the direct drive replicas. Known values + are: \"Standard_LRS\", \"Standard_ZRS\", \"Premium_LRS\", and \"PremiumV2_LRS\".""" + regional_replica_count: Optional[int] = rest_field( + name="regionalReplicaCount", visibility=["read", "create", "update", "delete", "query"] + ) + """The number of direct drive replicas of the Image Version to be created.This Property is + updatable.""" + + @overload + def __init__( + self, + *, + storage_account_type: Optional[Union[str, "_models.StorageAccountType"]] = None, + regional_replica_count: Optional[int] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class AdditionalUnattendContent(_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. "OobeSystem" + :vartype pass_name: str or ~azure.mgmt.compute.models.PassNames + :ivar component_name: The component name. Currently, the only allowable value is + Microsoft-Windows-Shell-Setup. Default value is "Microsoft-Windows-Shell-Setup". + :vartype component_name: str + :ivar setting_name: Specifies the name of the setting to which the content applies. Possible + values are: FirstLogonCommands and AutoLogon. Known values are: "AutoLogon" and + "FirstLogonCommands". + :vartype setting_name: str or ~azure.mgmt.compute.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 + """ + + pass_name: Optional[Union[str, "_models.PassNames"]] = rest_field( + name="passName", visibility=["read", "create", "update", "delete", "query"] + ) + """The pass name. Currently, the only allowable value is OobeSystem. \"OobeSystem\"""" + component_name: Optional[Literal["Microsoft-Windows-Shell-Setup"]] = rest_field( + name="componentName", visibility=["read", "create", "update", "delete", "query"] + ) + """The component name. Currently, the only allowable value is Microsoft-Windows-Shell-Setup. + Default value is \"Microsoft-Windows-Shell-Setup\".""" + setting_name: Optional[Union[str, "_models.SettingNames"]] = rest_field( + name="settingName", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies the name of the setting to which the content applies. Possible values are: + FirstLogonCommands and AutoLogon. Known values are: \"AutoLogon\" and \"FirstLogonCommands\".""" + content: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """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.""" + + @overload + def __init__( + self, + *, + pass_name: Optional[Union[str, "_models.PassNames"]] = None, + component_name: Optional[Literal["Microsoft-Windows-Shell-Setup"]] = None, + setting_name: Optional[Union[str, "_models.SettingNames"]] = None, + content: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class AllInstancesDown(_Model): + """Specifies if Scheduled Events should be auto-approved when all instances are down. + + :ivar automatically_approve: Specifies if Scheduled Events should be auto-approved when all + instances are down. + its default value is true. + :vartype automatically_approve: bool + """ + + automatically_approve: Optional[bool] = rest_field( + name="automaticallyApprove", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies if Scheduled Events should be auto-approved when all instances are down. + its default value is true.""" + + @overload + def __init__( + self, + *, + automatically_approve: Optional[bool] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class AlternativeOption(_Model): + """Describes the alternative option specified by the Publisher for this image when this image is + deprecated. + + :ivar type: Describes the type of the alternative option. Known values are: "None", "Offer", + and "Plan". + :vartype type: str or ~azure.mgmt.compute.models.AlternativeType + :ivar value: Indicates the alternative option value specified by the Publisher. This is the + Offer name when the type is Offer or the Plan name when the type is Plan. + :vartype value: str + """ + + type: Optional[Union[str, "_models.AlternativeType"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Describes the type of the alternative option. Known values are: \"None\", \"Offer\", and + \"Plan\".""" + value: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Indicates the alternative option value specified by the Publisher. This is the Offer name when + the type is Offer or the Plan name when the type is Plan.""" + + @overload + def __init__( + self, + *, + type: Optional[Union[str, "_models.AlternativeType"]] = None, + value: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ApiEntityReference(_Model): + """The API entity reference. + + :ivar id: The ARM resource id in the form of + /subscriptions/{SubscriptionId}/resourceGroups/{ResourceGroupName}/... + :vartype id: str + """ + + id: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The ARM resource id in the form of + /subscriptions/{SubscriptionId}/resourceGroups/{ResourceGroupName}/...""" + + @overload + def __init__( + self, + *, + id: Optional[str] = None, # pylint: disable=redefined-builtin + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ApiError(_Model): + """Api error. + + :ivar details: The Api error details. + :vartype details: list[~azure.mgmt.compute.models.ApiErrorBase] + :ivar innererror: The Api inner error. + :vartype innererror: ~azure.mgmt.compute.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 + """ + + details: Optional[list["_models.ApiErrorBase"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The Api error details.""" + innererror: Optional["_models.InnerError"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The Api inner error.""" + code: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The error code.""" + target: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The target of the particular error.""" + message: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The error message.""" + + @overload + def __init__( + self, + *, + details: Optional[list["_models.ApiErrorBase"]] = None, + innererror: Optional["_models.InnerError"] = None, + code: Optional[str] = None, + target: Optional[str] = None, + message: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ApiErrorBase(_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 + """ + + code: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The error code.""" + target: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The target of the particular error.""" + message: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The error message.""" + + @overload + def __init__( + self, + *, + code: Optional[str] = None, + target: Optional[str] = None, + message: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ApplicationProfile(_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.models.VMGalleryApplication] + """ + + gallery_applications: Optional[list["_models.VMGalleryApplication"]] = rest_field( + name="galleryApplications", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies the gallery applications that should be made available to the VM/VMSS.""" + + @overload + def __init__( + self, + *, + gallery_applications: Optional[list["_models.VMGalleryApplication"]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ApproveRollingUpgradeParameterBody(_Model): + """ApproveRollingUpgradeParameterBody. + + :ivar vm_instance_i_ds: A list of virtual machine instance IDs from the VM scale set. + :vartype vm_instance_i_ds: ~azure.mgmt.compute.models.VirtualMachineScaleSetVMInstanceIDs + """ + + vm_instance_i_ds: Optional["_models.VirtualMachineScaleSetVMInstanceIDs"] = rest_field( + name="vmInstanceIDs", visibility=["read", "create", "update", "delete", "query"] + ) + """A list of virtual machine instance IDs from the VM scale set.""" + + @overload + def __init__( + self, + *, + vm_instance_i_ds: Optional["_models.VirtualMachineScaleSetVMInstanceIDs"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class AttachDetachDataDisksRequest(_Model): + """Specifies the input for attaching and detaching a list of managed data disks. + + :ivar data_disks_to_attach: The list of managed data disks to be attached. + :vartype data_disks_to_attach: list[~azure.mgmt.compute.models.DataDisksToAttach] + :ivar data_disks_to_detach: The list of managed data disks to be detached. + :vartype data_disks_to_detach: list[~azure.mgmt.compute.models.DataDisksToDetach] + """ + + data_disks_to_attach: Optional[list["_models.DataDisksToAttach"]] = rest_field( + name="dataDisksToAttach", visibility=["read", "create", "update", "delete", "query"] + ) + """The list of managed data disks to be attached.""" + data_disks_to_detach: Optional[list["_models.DataDisksToDetach"]] = rest_field( + name="dataDisksToDetach", visibility=["read", "create", "update", "delete", "query"] + ) + """The list of managed data disks to be detached.""" + + @overload + def __init__( + self, + *, + data_disks_to_attach: Optional[list["_models.DataDisksToAttach"]] = None, + data_disks_to_detach: Optional[list["_models.DataDisksToDetach"]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class AutomaticOSUpgradePolicy(_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. 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 + :ivar os_rolling_upgrade_deferral: Indicates whether Auto OS Upgrade should undergo deferral. + Deferred OS upgrades will send advanced notifications on a per-VM basis that an OS upgrade from + rolling upgrades is incoming, via the IMDS tag 'Platform.PendingOSUpgrade'. The upgrade then + defers until the upgrade is approved via an ApproveRollingUpgrade call. + :vartype os_rolling_upgrade_deferral: bool + """ + + enable_automatic_os_upgrade: Optional[bool] = rest_field( + name="enableAutomaticOSUpgrade", visibility=["read", "create", "update", "delete", "query"] + ) + """Indicates whether OS upgrades should automatically be applied to scale set instances in a + rolling fashion when a newer version of the OS image becomes available. Default value is false. + If this is set to true for Windows based scale sets, `enableAutomaticUpdates + `_ + is automatically set to false and cannot be set to true.""" + disable_automatic_rollback: Optional[bool] = rest_field( + name="disableAutomaticRollback", visibility=["read", "create", "update", "delete", "query"] + ) + """Whether OS image rollback feature should be disabled. Default value is false.""" + use_rolling_upgrade_policy: Optional[bool] = rest_field( + name="useRollingUpgradePolicy", visibility=["read", "create", "update", "delete", "query"] + ) + """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.""" + os_rolling_upgrade_deferral: Optional[bool] = rest_field( + name="osRollingUpgradeDeferral", visibility=["read", "create", "update", "delete", "query"] + ) + """Indicates whether Auto OS Upgrade should undergo deferral. Deferred OS upgrades will send + advanced notifications on a per-VM basis that an OS upgrade from rolling upgrades is incoming, + via the IMDS tag 'Platform.PendingOSUpgrade'. The upgrade then defers until the upgrade is + approved via an ApproveRollingUpgrade call.""" + + @overload + def __init__( + self, + *, + enable_automatic_os_upgrade: Optional[bool] = None, + disable_automatic_rollback: Optional[bool] = None, + use_rolling_upgrade_policy: Optional[bool] = None, + os_rolling_upgrade_deferral: Optional[bool] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class AutomaticOSUpgradeProperties(_Model): + """Describes automatic OS upgrade properties on the image. + + :ivar automatic_os_upgrade_supported: Specifies whether automatic OS upgrade is supported on + the image. Required. + :vartype automatic_os_upgrade_supported: bool + """ + + automatic_os_upgrade_supported: bool = rest_field( + name="automaticOSUpgradeSupported", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies whether automatic OS upgrade is supported on the image. Required.""" + + @overload + def __init__( + self, + *, + automatic_os_upgrade_supported: bool, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class AutomaticRepairsPolicy(_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. Known values + are: "Replace", "Restart", and "Reimage". + :vartype repair_action: str or ~azure.mgmt.compute.models.RepairAction + """ + + enabled: Optional[bool] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Specifies whether automatic repairs should be enabled on the virtual machine scale set. The + default value is false.""" + grace_period: Optional[str] = rest_field( + name="gracePeriod", visibility=["read", "create", "update", "delete", "query"] + ) + """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).""" + repair_action: Optional[Union[str, "_models.RepairAction"]] = rest_field( + name="repairAction", visibility=["read", "create", "update", "delete", "query"] + ) + """Type of repair action (replace, restart, reimage) that will be used for repairing unhealthy + virtual machines in the scale set. Default value is replace. Known values are: \"Replace\", + \"Restart\", and \"Reimage\".""" + + @overload + def __init__( + self, + *, + enabled: Optional[bool] = None, + grace_period: Optional[str] = None, + repair_action: Optional[Union[str, "_models.RepairAction"]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class AutomaticZoneRebalancingPolicy(_Model): + """The configuration parameters used while performing automatic AZ balancing. + + :ivar enabled: Specifies whether Automatic AZ Balancing should be enabled on the virtual + machine scale set. The default value is false. + :vartype enabled: bool + :ivar rebalance_strategy: Type of rebalance strategy that will be used for rebalancing virtual + machines in the scale set across availability zones. Default and only supported value for now + is Recreate. "Recreate" + :vartype rebalance_strategy: str or ~azure.mgmt.compute.models.RebalanceStrategy + :ivar rebalance_behavior: Type of rebalance behavior that will be used for recreating virtual + machines in the scale set across availability zones. Default and only supported value for now + is CreateBeforeDelete. "CreateBeforeDelete" + :vartype rebalance_behavior: str or ~azure.mgmt.compute.models.RebalanceBehavior + """ + + enabled: Optional[bool] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Specifies whether Automatic AZ Balancing should be enabled on the virtual machine scale set. + The default value is false.""" + rebalance_strategy: Optional[Union[str, "_models.RebalanceStrategy"]] = rest_field( + name="rebalanceStrategy", visibility=["read", "create", "update", "delete", "query"] + ) + """Type of rebalance strategy that will be used for rebalancing virtual machines in the scale set + across availability zones. Default and only supported value for now is Recreate. \"Recreate\"""" + rebalance_behavior: Optional[Union[str, "_models.RebalanceBehavior"]] = rest_field( + name="rebalanceBehavior", visibility=["read", "create", "update", "delete", "query"] + ) + """Type of rebalance behavior that will be used for recreating virtual machines in the scale set + across availability zones. Default and only supported value for now is CreateBeforeDelete. + \"CreateBeforeDelete\"""" + + @overload + def __init__( + self, + *, + enabled: Optional[bool] = None, + rebalance_strategy: Optional[Union[str, "_models.RebalanceStrategy"]] = None, + rebalance_behavior: Optional[Union[str, "_models.RebalanceBehavior"]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class AvailabilityPolicy(_Model): + """In the case of an availability or connectivity issue with the data disk, specify the behavior + of your VM. + + :ivar action_on_disk_delay: Determines on how to handle disks with slow I/O. Known values are: + "None" and "AutomaticReattach". + :vartype action_on_disk_delay: str or ~azure.mgmt.compute.models.AvailabilityPolicyDiskDelay + """ + + action_on_disk_delay: Optional[Union[str, "_models.AvailabilityPolicyDiskDelay"]] = rest_field( + name="actionOnDiskDelay", visibility=["read", "create", "update", "delete", "query"] + ) + """Determines on how to handle disks with slow I/O. Known values are: \"None\" and + \"AutomaticReattach\".""" + + @overload + def __init__( + self, + *, + action_on_disk_delay: Optional[Union[str, "_models.AvailabilityPolicyDiskDelay"]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class Resource(_Model): + """Resource. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.compute.models.SystemData + """ + + id: Optional[str] = rest_field(visibility=["read"]) + """Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}.""" + name: Optional[str] = rest_field(visibility=["read"]) + """The name of the resource.""" + type: Optional[str] = rest_field(visibility=["read"]) + """The type of the resource. E.g. \"Microsoft.Compute/virtualMachines\" or + \"Microsoft.Storage/storageAccounts\".""" + system_data: Optional["_models.SystemData"] = rest_field(name="systemData", visibility=["read"]) + """Azure Resource Manager metadata containing createdBy and modifiedBy information.""" + + +class TrackedResource(Resource): + """Tracked Resource. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.compute.models.SystemData + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar location: The geo-location where the resource lives. Required. + :vartype location: str + """ + + tags: Optional[dict[str, str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Resource tags.""" + location: str = rest_field(visibility=["read", "create"]) + """The geo-location where the resource lives. Required.""" + + @overload + def __init__( + self, + *, + location: str, + tags: Optional[dict[str, str]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class AvailabilitySet(TrackedResource): + """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 `_. For + more information on Azure planned maintenance, see `Maintenance and updates for Virtual + Machines in Azure + `_. Currently, a VM + can only be added to an availability set at creation time. An existing VM cannot be added to an + availability set. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.compute.models.SystemData + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar location: The geo-location where the resource lives. Required. + :vartype location: str + :ivar properties: The instance view of a resource. + :vartype properties: ~azure.mgmt.compute.models.AvailabilitySetProperties + :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.models.Sku + """ + + properties: Optional["_models.AvailabilitySetProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The instance view of a resource.""" + sku: Optional["_models.Sku"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """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'.""" + + @overload + def __init__( + self, + *, + location: str, + tags: Optional[dict[str, str]] = None, + properties: Optional["_models.AvailabilitySetProperties"] = None, + sku: Optional["_models.Sku"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class AvailabilitySetProperties(_Model): + """The instance view of a resource. + + :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.models.SubResource] + :ivar proximity_placement_group: Specifies information about the proximity placement group that + the availability set should be assigned to. Minimum api-version: 2018-04-01. + :vartype proximity_placement_group: ~azure.mgmt.compute.models.SubResource + :ivar statuses: The resource status information. + :vartype statuses: list[~azure.mgmt.compute.models.InstanceViewStatus] + :ivar scheduled_events_policy: Specifies Redeploy, Reboot and + ScheduledEventsAdditionalPublishingTargets Scheduled Event related configurations for the + availability set. + :vartype scheduled_events_policy: ~azure.mgmt.compute.models.ScheduledEventsPolicy + :ivar virtual_machine_scale_set_migration_info: Describes the migration properties on the + Availability Set. + :vartype virtual_machine_scale_set_migration_info: + ~azure.mgmt.compute.models.VirtualMachineScaleSetMigrationInfo + """ + + platform_update_domain_count: Optional[int] = rest_field( + name="platformUpdateDomainCount", visibility=["read", "create", "update", "delete", "query"] + ) + """Update Domain count.""" + platform_fault_domain_count: Optional[int] = rest_field( + name="platformFaultDomainCount", visibility=["read", "create", "update", "delete", "query"] + ) + """Fault Domain count.""" + virtual_machines: Optional[list["_models.SubResource"]] = rest_field( + name="virtualMachines", visibility=["read", "create", "update", "delete", "query"] + ) + """A list of references to all virtual machines in the availability set.""" + proximity_placement_group: Optional["_models.SubResource"] = rest_field( + name="proximityPlacementGroup", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies information about the proximity placement group that the availability set should be + assigned to. Minimum api-version: 2018-04-01.""" + statuses: Optional[list["_models.InstanceViewStatus"]] = rest_field(visibility=["read"]) + """The resource status information.""" + scheduled_events_policy: Optional["_models.ScheduledEventsPolicy"] = rest_field( + name="scheduledEventsPolicy", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies Redeploy, Reboot and ScheduledEventsAdditionalPublishingTargets Scheduled Event + related configurations for the availability set.""" + virtual_machine_scale_set_migration_info: Optional["_models.VirtualMachineScaleSetMigrationInfo"] = rest_field( + name="virtualMachineScaleSetMigrationInfo", visibility=["read"] + ) + """Describes the migration properties on the Availability Set.""" + + @overload + def __init__( + self, + *, + platform_update_domain_count: Optional[int] = None, + platform_fault_domain_count: Optional[int] = None, + virtual_machines: Optional[list["_models.SubResource"]] = None, + proximity_placement_group: Optional["_models.SubResource"] = None, + scheduled_events_policy: Optional["_models.ScheduledEventsPolicy"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class UpdateResource(_Model): + """The Update Resource model definition. + + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + """ + + tags: Optional[dict[str, str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Resource tags.""" + + @overload + def __init__( + self, + *, + tags: Optional[dict[str, str]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class AvailabilitySetUpdate(UpdateResource): + """Specifies information about the availability set that the virtual machine should be assigned + to. Only tags may be updated. + + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar properties: The instance view of a resource. + :vartype properties: ~azure.mgmt.compute.models.AvailabilitySetProperties + :ivar sku: Sku of the availability set. + :vartype sku: ~azure.mgmt.compute.models.Sku + """ + + properties: Optional["_models.AvailabilitySetProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The instance view of a resource.""" + sku: Optional["_models.Sku"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Sku of the availability set.""" + + @overload + def __init__( + self, + *, + tags: Optional[dict[str, str]] = None, + properties: Optional["_models.AvailabilitySetProperties"] = None, + sku: Optional["_models.Sku"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class AvailablePatchSummary(_Model): + """Describes the properties of an virtual machine instance view for available patch summary. + + :ivar status: The overall success or failure status of the operation. It remains "InProgress" + until the operation completes. At that point it will become "Unknown", "Failed", "Succeeded", + or "CompletedWithWarnings.". Known values are: "Unknown", "InProgress", "Failed", "Succeeded", + and "CompletedWithWarnings". + :vartype status: str or ~azure.mgmt.compute.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.models.ApiError + """ + + status: Optional[Union[str, "_models.PatchOperationStatus"]] = rest_field(visibility=["read"]) + """The overall success or failure status of the operation. It remains \"InProgress\" until the + operation completes. At that point it will become \"Unknown\", \"Failed\", \"Succeeded\", or + \"CompletedWithWarnings.\". Known values are: \"Unknown\", \"InProgress\", \"Failed\", + \"Succeeded\", and \"CompletedWithWarnings\".""" + assessment_activity_id: Optional[str] = rest_field(name="assessmentActivityId", visibility=["read"]) + """The activity ID of the operation that produced this result. It is used to correlate across CRP + and extension logs.""" + reboot_pending: Optional[bool] = rest_field(name="rebootPending", visibility=["read"]) + """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.""" + critical_and_security_patch_count: Optional[int] = rest_field( + name="criticalAndSecurityPatchCount", visibility=["read"] + ) + """The number of critical or security patches that have been detected as available and not yet + installed.""" + other_patch_count: Optional[int] = rest_field(name="otherPatchCount", visibility=["read"]) + """The number of all available patches excluding critical and security.""" + start_time: Optional[datetime.datetime] = rest_field(name="startTime", visibility=["read"], format="rfc3339") + """The UTC timestamp when the operation began.""" + last_modified_time: Optional[datetime.datetime] = rest_field( + name="lastModifiedTime", visibility=["read"], format="rfc3339" + ) + """The UTC timestamp when the operation began.""" + error: Optional["_models.ApiError"] = rest_field(visibility=["read"]) + """The errors that were encountered during execution of the operation. The details array contains + the list of them.""" + + +class BillingProfile(_Model): + """Specifies the billing related details of a Azure Spot VM or VMSS. 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.

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.

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.

Possible + values are:

- Any decimal value greater than zero. Example: 0.01538

-1 – + indicates default price to be up-to on-demand.

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.

Minimum api-version: 2019-03-01. + :vartype max_price: float + """ + + max_price: Optional[float] = rest_field(name="maxPrice", visibility=["read", "create", "update", "delete", "query"]) + """Specifies the maximum price you are willing to pay for a Azure Spot VM/VMSS. This price is in + US Dollars.

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. +

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.

Possible values are: +

- Any decimal value greater than zero. Example: 0.01538

-1 – indicates + default price to be up-to on-demand.

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.

Minimum api-version: 2019-03-01.""" + + @overload + def __init__( + self, + *, + max_price: Optional[float] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class BootDiagnostics(_Model): + """Boot Diagnostics is a debugging feature which allows you to view Console Output and Screenshot + to diagnose VM status. You can easily view the output of your console log. 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. If storageUri is not specified while enabling boot diagnostics, managed storage + will be used. + :vartype storage_uri: str + """ + + enabled: Optional[bool] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Whether boot diagnostics should be enabled on the Virtual Machine.""" + storage_uri: Optional[str] = rest_field( + name="storageUri", visibility=["read", "create", "update", "delete", "query"] + ) + """Uri of the storage account to use for placing the console output and screenshot. If storageUri + is not specified while enabling boot diagnostics, managed storage will be used.""" + + @overload + def __init__( + self, + *, + enabled: Optional[bool] = None, + storage_uri: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class BootDiagnosticsInstanceView(_Model): + """The instance view of a virtual machine boot diagnostics. + + :ivar console_screenshot_blob_uri: The console screenshot blob URI. **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. **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. **Note:** It will be set only + if there are errors encountered in enabling boot diagnostics. + :vartype status: ~azure.mgmt.compute.models.InstanceViewStatus + """ + + console_screenshot_blob_uri: Optional[str] = rest_field(name="consoleScreenshotBlobUri", visibility=["read"]) + """The console screenshot blob URI. **Note:** This will **not** be set if boot diagnostics is + currently enabled with managed storage.""" + serial_console_log_blob_uri: Optional[str] = rest_field(name="serialConsoleLogBlobUri", visibility=["read"]) + """The serial console log blob Uri. **Note:** This will **not** be set if boot diagnostics is + currently enabled with managed storage.""" + status: Optional["_models.InstanceViewStatus"] = rest_field(visibility=["read"]) + """The boot diagnostics status information for the VM. **Note:** It will be set only if there are + errors encountered in enabling boot diagnostics.""" + + +class CapacityReservation(TrackedResource): + """Specifies information about the capacity reservation. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.compute.models.SystemData + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar location: The geo-location where the resource lives. Required. + :vartype location: str + :ivar properties: Properties of the Capacity reservation. + :vartype properties: ~azure.mgmt.compute.models.CapacityReservationProperties + :ivar sku: SKU of the resource for which capacity needs be reserved. The SKU name and capacity + is required to be set. For Block capacity reservations, sku.capacity can only accept values 1, + 2, 4, 8, 16, 32, 64. Currently VM Skus with the capability called + 'CapacityReservationSupported' set to true are supported. When 'CapacityReservationSupported' + is true, the SKU capability also specifies the 'SupportedCapacityReservationTypes', which lists + the types of capacity reservations (such as Targeted or Block) that the SKU supports. Refer to + List Microsoft.Compute SKUs in a region + (`https://docs.microsoft.com/rest/api/compute/resourceskus/list + `_) for supported values. + Required. + :vartype sku: ~azure.mgmt.compute.models.Sku + :ivar zones: The availability zones. + :vartype zones: list[str] + """ + + properties: Optional["_models.CapacityReservationProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Properties of the Capacity reservation.""" + sku: "_models.Sku" = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """SKU of the resource for which capacity needs be reserved. The SKU name and capacity is required + to be set. For Block capacity reservations, sku.capacity can only accept values 1, 2, 4, 8, + 16, 32, 64. Currently VM Skus with the capability called 'CapacityReservationSupported' set to + true are supported. When 'CapacityReservationSupported' is true, the SKU capability also + specifies the 'SupportedCapacityReservationTypes', which lists the types of capacity + reservations (such as Targeted or Block) that the SKU supports. Refer to List Microsoft.Compute + SKUs in a region (`https://docs.microsoft.com/rest/api/compute/resourceskus/list + `_) for supported values. + Required.""" + zones: Optional[list[str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The availability zones.""" + + @overload + def __init__( + self, + *, + location: str, + sku: "_models.Sku", + tags: Optional[dict[str, str]] = None, + properties: Optional["_models.CapacityReservationProperties"] = None, + zones: Optional[list[str]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class CapacityReservationGroup(TrackedResource): + """Specifies information about the capacity reservation group that the capacity reservations + should be assigned to. 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. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.compute.models.SystemData + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar location: The geo-location where the resource lives. Required. + :vartype location: str + :ivar properties: capacity reservation group Properties. + :vartype properties: ~azure.mgmt.compute.models.CapacityReservationGroupProperties + :ivar zones: The availability zones. + :vartype zones: list[str] + """ + + properties: Optional["_models.CapacityReservationGroupProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """capacity reservation group Properties.""" + zones: Optional[list[str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The availability zones.""" + + @overload + def __init__( + self, + *, + location: str, + tags: Optional[dict[str, str]] = None, + properties: Optional["_models.CapacityReservationGroupProperties"] = None, + zones: Optional[list[str]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class CapacityReservationGroupInstanceView(_Model): + """CapacityReservationGroupInstanceView. + + :ivar capacity_reservations: List of instance view of the capacity reservations under the + capacity reservation group. + :vartype capacity_reservations: + list[~azure.mgmt.compute.models.CapacityReservationInstanceViewWithName] + :ivar shared_subscription_ids: List of the subscriptions that the capacity reservation group is + shared with. **Note:** Minimum api-version: 2023-09-01. Please refer to + `https://aka.ms/computereservationsharing `_ for more + details. + :vartype shared_subscription_ids: list[~azure.mgmt.compute.models.SubResourceReadOnly] + """ + + capacity_reservations: Optional[list["_models.CapacityReservationInstanceViewWithName"]] = rest_field( + name="capacityReservations", visibility=["read"] + ) + """List of instance view of the capacity reservations under the capacity reservation group.""" + shared_subscription_ids: Optional[list["_models.SubResourceReadOnly"]] = rest_field( + name="sharedSubscriptionIds", visibility=["read"] + ) + """List of the subscriptions that the capacity reservation group is shared with. **Note:** Minimum + api-version: 2023-09-01. Please refer to `https://aka.ms/computereservationsharing + `_ for more details.""" + + +class CapacityReservationGroupProperties(_Model): + """capacity reservation group Properties. + + :ivar capacity_reservations: A list of all capacity reservation resource ids that belong to + capacity reservation group. + :vartype capacity_reservations: list[~azure.mgmt.compute.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.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.models.CapacityReservationGroupInstanceView + :ivar sharing_profile: Specifies the settings to enable sharing across subscriptions for the + capacity reservation group resource. The capacity reservation group resource can generally be + shared across subscriptions belonging to a single Azure AAD tenant or across AAD tenants if + there is a trust relationship established between the tenants. Block capacity reservation does + not support sharing across subscriptions. **Note:** Minimum api-version: 2023-09-01. Please + refer to `https://aka.ms/computereservationsharing `_ + for more details. + :vartype sharing_profile: ~azure.mgmt.compute.models.ResourceSharingProfile + :ivar reservation_type: Indicates the type of capacity reservation. Allowed values are 'Block' + for block capacity reservations and 'Targeted' for reservations that enable a VM to consume a + specific capacity reservation when a capacity reservation group is provided. The reservation + type is immutable and cannot be changed after it is assigned. Known values are: "Targeted" and + "Block". + :vartype reservation_type: str or ~azure.mgmt.compute.models.ReservationType + """ + + capacity_reservations: Optional[list["_models.SubResourceReadOnly"]] = rest_field( + name="capacityReservations", visibility=["read"] + ) + """A list of all capacity reservation resource ids that belong to capacity reservation group.""" + virtual_machines_associated: Optional[list["_models.SubResourceReadOnly"]] = rest_field( + name="virtualMachinesAssociated", visibility=["read"] + ) + """A list of references to all virtual machines associated to the capacity reservation group.""" + instance_view: Optional["_models.CapacityReservationGroupInstanceView"] = rest_field( + name="instanceView", visibility=["read"] + ) + """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.""" + sharing_profile: Optional["_models.ResourceSharingProfile"] = rest_field( + name="sharingProfile", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies the settings to enable sharing across subscriptions for the capacity reservation + group resource. The capacity reservation group resource can generally be shared across + subscriptions belonging to a single Azure AAD tenant or across AAD tenants if there is a trust + relationship established between the tenants. Block capacity reservation does not support + sharing across subscriptions. **Note:** Minimum api-version: 2023-09-01. Please refer to + `https://aka.ms/computereservationsharing `_ for more + details.""" + reservation_type: Optional[Union[str, "_models.ReservationType"]] = rest_field( + name="reservationType", visibility=["read", "create", "update", "delete", "query"] + ) + """Indicates the type of capacity reservation. Allowed values are 'Block' for block capacity + reservations and 'Targeted' for reservations that enable a VM to consume a specific capacity + reservation when a capacity reservation group is provided. The reservation type is immutable + and cannot be changed after it is assigned. Known values are: \"Targeted\" and \"Block\".""" + + @overload + def __init__( + self, + *, + sharing_profile: Optional["_models.ResourceSharingProfile"] = None, + reservation_type: Optional[Union[str, "_models.ReservationType"]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class CapacityReservationGroupUpdate(UpdateResource): + """Specifies information about the capacity reservation group. Only tags can be updated. + + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar properties: capacity reservation group Properties. + :vartype properties: ~azure.mgmt.compute.models.CapacityReservationGroupProperties + """ + + properties: Optional["_models.CapacityReservationGroupProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """capacity reservation group Properties.""" + + @overload + def __init__( + self, + *, + tags: Optional[dict[str, str]] = None, + properties: Optional["_models.CapacityReservationGroupProperties"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class CapacityReservationInstanceView(_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.models.CapacityReservationUtilization + :ivar statuses: The resource status information. + :vartype statuses: list[~azure.mgmt.compute.models.InstanceViewStatus] + """ + + utilization_info: Optional["_models.CapacityReservationUtilization"] = rest_field( + name="utilizationInfo", visibility=["read", "create", "update", "delete", "query"] + ) + """Unutilized capacity of the capacity reservation.""" + statuses: Optional[list["_models.InstanceViewStatus"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The resource status information.""" + + @overload + def __init__( + self, + *, + utilization_info: Optional["_models.CapacityReservationUtilization"] = None, + statuses: Optional[list["_models.InstanceViewStatus"]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +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. + + :ivar utilization_info: Unutilized capacity of the capacity reservation. + :vartype utilization_info: ~azure.mgmt.compute.models.CapacityReservationUtilization + :ivar statuses: The resource status information. + :vartype statuses: list[~azure.mgmt.compute.models.InstanceViewStatus] + :ivar name: The name of the capacity reservation. + :vartype name: str + """ + + name: Optional[str] = rest_field(visibility=["read"]) + """The name of the capacity reservation.""" + + @overload + def __init__( + self, + *, + utilization_info: Optional["_models.CapacityReservationUtilization"] = None, + statuses: Optional[list["_models.InstanceViewStatus"]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class CapacityReservationProfile(_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.models.SubResource + """ + + capacity_reservation_group: Optional["_models.SubResource"] = rest_field( + name="capacityReservationGroup", visibility=["read", "create", "update", "delete", "query"] + ) + """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.""" + + @overload + def __init__( + self, + *, + capacity_reservation_group: Optional["_models.SubResource"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class CapacityReservationProperties(_Model): + """Properties of the Capacity reservation. + + :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 platform_fault_domain_count: Specifies the value of fault domain count that Capacity + Reservation supports for requested VM size. **Note:** The fault domain count specified for a + resource (like virtual machines scale set) must be less than or equal to this value if it + deploys using capacity reservation. Minimum api-version: 2022-08-01. + :vartype platform_fault_domain_count: int + :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.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.models.CapacityReservationInstanceView + :ivar time_created: Specifies the time at which the Capacity Reservation resource was created. + Minimum api-version: 2021-11-01. + :vartype time_created: ~datetime.datetime + :ivar schedule_profile: Defines the schedule for Block-type capacity reservations. Specifies + the schedule during which capacity reservation is active and VM or VMSS resource can be + allocated using reservation. This property is required and only supported when the capacity + reservation group type is 'Block'. The scheduleProfile, start, and end fields are immutable + after creation. Minimum API version: 2025-04-01. Please refer to + `https://aka.ms/blockcapacityreservation `_ for more + details. + :vartype schedule_profile: ~azure.mgmt.compute.models.ScheduleProfile + """ + + reservation_id: Optional[str] = rest_field(name="reservationId", visibility=["read"]) + """A unique id generated and assigned to the capacity reservation by the platform which does not + change throughout the lifetime of the resource.""" + platform_fault_domain_count: Optional[int] = rest_field(name="platformFaultDomainCount", visibility=["read"]) + """Specifies the value of fault domain count that Capacity Reservation supports for requested VM + size. **Note:** The fault domain count specified for a resource (like virtual machines scale + set) must be less than or equal to this value if it deploys using capacity reservation. Minimum + api-version: 2022-08-01.""" + virtual_machines_associated: Optional[list["_models.SubResourceReadOnly"]] = rest_field( + name="virtualMachinesAssociated", visibility=["read"] + ) + """A list of all virtual machine resource ids that are associated with the capacity reservation.""" + provisioning_time: Optional[datetime.datetime] = rest_field( + name="provisioningTime", visibility=["read"], format="rfc3339" + ) + """The date time when the capacity reservation was last updated.""" + provisioning_state: Optional[str] = rest_field(name="provisioningState", visibility=["read"]) + """The provisioning state, which only appears in the response.""" + instance_view: Optional["_models.CapacityReservationInstanceView"] = rest_field( + name="instanceView", visibility=["read"] + ) + """The Capacity reservation instance view.""" + time_created: Optional[datetime.datetime] = rest_field(name="timeCreated", visibility=["read"], format="rfc3339") + """Specifies the time at which the Capacity Reservation resource was created. Minimum api-version: + 2021-11-01.""" + schedule_profile: Optional["_models.ScheduleProfile"] = rest_field( + name="scheduleProfile", visibility=["read", "create", "update", "delete", "query"] + ) + """Defines the schedule for Block-type capacity reservations. Specifies the schedule during which + capacity reservation is active and VM or VMSS resource can be allocated using reservation. This + property is required and only supported when the capacity reservation group type is 'Block'. + The scheduleProfile, start, and end fields are immutable after creation. Minimum API version: + 2025-04-01. Please refer to `https://aka.ms/blockcapacityreservation + `_ for more details.""" + + @overload + def __init__( + self, + *, + schedule_profile: Optional["_models.ScheduleProfile"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class CapacityReservationUpdate(UpdateResource): + """Specifies information about the capacity reservation. sku.capacity cannot be updated for Block + Capacity Reservation. Tags can be update for all Capacity Reservation Types. + + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar properties: Properties of the Capacity reservation. + :vartype properties: ~azure.mgmt.compute.models.CapacityReservationProperties + :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. When 'CapacityReservationSupported' + is true, the SKU capability also specifies the 'SupportedCapacityReservationTypes', which lists + the types of capacity reservations (such as Targeted or Block) that the SKU supports. Refer to + List Microsoft.Compute SKUs in a region + (`https://docs.microsoft.com/rest/api/compute/resourceskus/list + `_) for supported values. + **Note:** The SKU name and capacity cannot be updated for Block capacity reservations. + :vartype sku: ~azure.mgmt.compute.models.Sku + """ + + properties: Optional["_models.CapacityReservationProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Properties of the Capacity reservation.""" + sku: Optional["_models.Sku"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """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. When 'CapacityReservationSupported' is true, the SKU capability also + specifies the 'SupportedCapacityReservationTypes', which lists the types of capacity + reservations (such as Targeted or Block) that the SKU supports. Refer to List Microsoft.Compute + SKUs in a region (`https://docs.microsoft.com/rest/api/compute/resourceskus/list + `_) for supported values. + **Note:** The SKU name and capacity cannot be updated for Block capacity reservations.""" + + @overload + def __init__( + self, + *, + tags: Optional[dict[str, str]] = None, + properties: Optional["_models.CapacityReservationProperties"] = None, + sku: Optional["_models.Sku"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class CapacityReservationUtilization(_Model): + """Represents the capacity reservation utilization in terms of resources allocated. + + :ivar current_capacity: The value provides the current capacity of the VM size which was + reserved successfully and for which the customer is getting billed. Minimum api-version: + 2022-08-01. + :vartype current_capacity: int + :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.models.SubResourceReadOnly] + """ + + current_capacity: Optional[int] = rest_field(name="currentCapacity", visibility=["read"]) + """The value provides the current capacity of the VM size which was reserved successfully and for + which the customer is getting billed. Minimum api-version: 2022-08-01.""" + virtual_machines_allocated: Optional[list["_models.SubResourceReadOnly"]] = rest_field( + name="virtualMachinesAllocated", visibility=["read"] + ) + """A list of all virtual machines resource ids allocated against the capacity reservation.""" + + +class CloudError(_Model): + """An error response from the Compute service. + + :ivar error: Api error. + :vartype error: ~azure.mgmt.compute.models.ApiError + """ + + error: Optional["_models.ApiError"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Api error.""" + + @overload + def __init__( + self, + *, + error: Optional["_models.ApiError"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class PirCommunityGalleryResource(_Model): + """Base information about the community gallery resource in azure compute gallery. + + :ivar name: Resource name. + :vartype name: str + :ivar location: Resource location. + :vartype location: str + :ivar type: Resource type. + :vartype type: str + :ivar identifier: The identifier information of community gallery. + :vartype identifier: ~azure.mgmt.compute.models.CommunityGalleryIdentifier + """ + + name: Optional[str] = rest_field(visibility=["read"]) + """Resource name.""" + location: Optional[str] = rest_field(visibility=["read"]) + """Resource location.""" + type: Optional[str] = rest_field(visibility=["read"]) + """Resource type.""" + identifier: Optional["_models.CommunityGalleryIdentifier"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The identifier information of community gallery.""" + + @overload + def __init__( + self, + *, + identifier: Optional["_models.CommunityGalleryIdentifier"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class CommunityGallery(PirCommunityGalleryResource): + """Specifies information about the Community Gallery that you want to create or update. + + :ivar name: Resource name. + :vartype name: str + :ivar location: Resource location. + :vartype location: str + :ivar type: Resource type. + :vartype type: str + :ivar identifier: The identifier information of community gallery. + :vartype identifier: ~azure.mgmt.compute.models.CommunityGalleryIdentifier + :ivar properties: Describes the properties of a community gallery. + :vartype properties: ~azure.mgmt.compute.models.CommunityGalleryProperties + """ + + properties: Optional["_models.CommunityGalleryProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Describes the properties of a community gallery.""" + + @overload + def __init__( + self, + *, + identifier: Optional["_models.CommunityGalleryIdentifier"] = None, + properties: Optional["_models.CommunityGalleryProperties"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class CommunityGalleryIdentifier(_Model): + """The identifier information of community gallery. + + :ivar unique_id: The unique id of this community gallery. + :vartype unique_id: str + """ + + unique_id: Optional[str] = rest_field(name="uniqueId", visibility=["read", "create", "update", "delete", "query"]) + """The unique id of this community gallery.""" + + @overload + def __init__( + self, + *, + unique_id: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class CommunityGalleryImage(PirCommunityGalleryResource): + """Specifies information about the gallery image definition that you want to create or update. + + :ivar name: Resource name. + :vartype name: str + :ivar location: Resource location. + :vartype location: str + :ivar type: Resource type. + :vartype type: str + :ivar identifier: The identifier information of community gallery. + :vartype identifier: ~azure.mgmt.compute.models.CommunityGalleryIdentifier + :ivar properties: Describes the properties of a gallery image definition. + :vartype properties: ~azure.mgmt.compute.models.CommunityGalleryImageProperties + """ + + properties: Optional["_models.CommunityGalleryImageProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Describes the properties of a gallery image definition.""" + + @overload + def __init__( + self, + *, + identifier: Optional["_models.CommunityGalleryIdentifier"] = None, + properties: Optional["_models.CommunityGalleryImageProperties"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class CommunityGalleryImageIdentifier(_Model): + """This is the community gallery image definition identifier. + + :ivar publisher: The name of the gallery image definition publisher. + :vartype publisher: str + :ivar offer: The name of the gallery image definition offer. + :vartype offer: str + :ivar sku: The name of the gallery image definition SKU. + :vartype sku: str + """ + + publisher: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The name of the gallery image definition publisher.""" + offer: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The name of the gallery image definition offer.""" + sku: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The name of the gallery image definition SKU.""" + + @overload + def __init__( + self, + *, + publisher: Optional[str] = None, + offer: Optional[str] = None, + sku: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class CommunityGalleryImageProperties(_Model): + """Describes the properties of a gallery image definition. + + :ivar os_type: This property allows you to specify the type of the OS that is included in the + disk when creating a VM from a managed image. Possible values are: **Windows,** **Linux.**. + Required. Known values are: "Windows" and "Linux". + :vartype os_type: str or ~azure.mgmt.compute.models.OperatingSystemTypes + :ivar os_state: This property allows the user to specify whether the virtual machines created + under this image are 'Generalized' or 'Specialized'. Required. Known values are: "Generalized" + and "Specialized". + :vartype os_state: str or ~azure.mgmt.compute.models.OperatingSystemStateTypes + :ivar end_of_life_date: The end of life date of the gallery image definition. This property can + be used for decommissioning purposes. This property is updatable. + :vartype end_of_life_date: ~datetime.datetime + :ivar identifier: This is the community gallery image definition identifier. Required. + :vartype identifier: ~azure.mgmt.compute.models.CommunityGalleryImageIdentifier + :ivar recommended: The properties describe the recommended machine configuration for this Image + Definition. These properties are updatable. + :vartype recommended: ~azure.mgmt.compute.models.RecommendedMachineConfiguration + :ivar disallowed: Describes the disallowed disk types. + :vartype disallowed: ~azure.mgmt.compute.models.Disallowed + :ivar hyper_v_generation: The hypervisor generation of the Virtual Machine. Applicable to OS + disks only. Known values are: "V1" and "V2". + :vartype hyper_v_generation: str or ~azure.mgmt.compute.models.HyperVGeneration + :ivar features: A list of gallery image features. + :vartype features: list[~azure.mgmt.compute.models.GalleryImageFeature] + :ivar purchase_plan: Describes the gallery image definition purchase plan. This is used by + marketplace images. + :vartype purchase_plan: ~azure.mgmt.compute.models.ImagePurchasePlan + :ivar architecture: The architecture of the image. Applicable to OS disks only. Known values + are: "x64" and "Arm64". + :vartype architecture: str or ~azure.mgmt.compute.models.Architecture + :ivar privacy_statement_uri: Privacy statement URI for the current community gallery image. + :vartype privacy_statement_uri: str + :ivar eula: The end-user license agreement for the current community gallery image. + :vartype eula: str + :ivar disclaimer: The disclaimer for a community gallery resource. + :vartype disclaimer: str + :ivar artifact_tags: The artifact tags of a community gallery resource. + :vartype artifact_tags: dict[str, str] + """ + + os_type: Union[str, "_models.OperatingSystemTypes"] = rest_field( + name="osType", visibility=["read", "create", "update", "delete", "query"] + ) + """This property allows you to specify the type of the OS that is included in the disk when + creating a VM from a managed image. Possible values are: **Windows,** **Linux.**. Required. + Known values are: \"Windows\" and \"Linux\".""" + os_state: Union[str, "_models.OperatingSystemStateTypes"] = rest_field( + name="osState", visibility=["read", "create", "update", "delete", "query"] + ) + """This property allows the user to specify whether the virtual machines created under this image + are 'Generalized' or 'Specialized'. Required. Known values are: \"Generalized\" and + \"Specialized\".""" + end_of_life_date: Optional[datetime.datetime] = rest_field( + name="endOfLifeDate", visibility=["read", "create", "update", "delete", "query"], format="rfc3339" + ) + """The end of life date of the gallery image definition. This property can be used for + decommissioning purposes. This property is updatable.""" + identifier: "_models.CommunityGalleryImageIdentifier" = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """This is the community gallery image definition identifier. Required.""" + recommended: Optional["_models.RecommendedMachineConfiguration"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The properties describe the recommended machine configuration for this Image Definition. These + properties are updatable.""" + disallowed: Optional["_models.Disallowed"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Describes the disallowed disk types.""" + hyper_v_generation: Optional[Union[str, "_models.HyperVGeneration"]] = rest_field( + name="hyperVGeneration", visibility=["read", "create", "update", "delete", "query"] + ) + """The hypervisor generation of the Virtual Machine. Applicable to OS disks only. Known values + are: \"V1\" and \"V2\".""" + features: Optional[list["_models.GalleryImageFeature"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """A list of gallery image features.""" + purchase_plan: Optional["_models.ImagePurchasePlan"] = rest_field( + name="purchasePlan", visibility=["read", "create", "update", "delete", "query"] + ) + """Describes the gallery image definition purchase plan. This is used by marketplace images.""" + architecture: Optional[Union[str, "_models.Architecture"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The architecture of the image. Applicable to OS disks only. Known values are: \"x64\" and + \"Arm64\".""" + privacy_statement_uri: Optional[str] = rest_field( + name="privacyStatementUri", visibility=["read", "create", "update", "delete", "query"] + ) + """Privacy statement URI for the current community gallery image.""" + eula: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The end-user license agreement for the current community gallery image.""" + disclaimer: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The disclaimer for a community gallery resource.""" + artifact_tags: Optional[dict[str, str]] = rest_field( + name="artifactTags", visibility=["read", "create", "update", "delete", "query"] + ) + """The artifact tags of a community gallery resource.""" + + @overload + def __init__( + self, + *, + os_type: Union[str, "_models.OperatingSystemTypes"], + os_state: Union[str, "_models.OperatingSystemStateTypes"], + identifier: "_models.CommunityGalleryImageIdentifier", + end_of_life_date: Optional[datetime.datetime] = None, + recommended: Optional["_models.RecommendedMachineConfiguration"] = None, + disallowed: Optional["_models.Disallowed"] = None, + hyper_v_generation: Optional[Union[str, "_models.HyperVGeneration"]] = None, + features: Optional[list["_models.GalleryImageFeature"]] = None, + purchase_plan: Optional["_models.ImagePurchasePlan"] = None, + architecture: Optional[Union[str, "_models.Architecture"]] = None, + privacy_statement_uri: Optional[str] = None, + eula: Optional[str] = None, + disclaimer: Optional[str] = None, + artifact_tags: Optional[dict[str, str]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class CommunityGalleryImageVersion(PirCommunityGalleryResource): + """Specifies information about the gallery image version that you want to create or update. + + :ivar name: Resource name. + :vartype name: str + :ivar location: Resource location. + :vartype location: str + :ivar type: Resource type. + :vartype type: str + :ivar identifier: The identifier information of community gallery. + :vartype identifier: ~azure.mgmt.compute.models.CommunityGalleryIdentifier + :ivar properties: Describes the properties of a gallery image version. + :vartype properties: ~azure.mgmt.compute.models.CommunityGalleryImageVersionProperties + """ + + properties: Optional["_models.CommunityGalleryImageVersionProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Describes the properties of a gallery image version.""" + + @overload + def __init__( + self, + *, + identifier: Optional["_models.CommunityGalleryIdentifier"] = None, + properties: Optional["_models.CommunityGalleryImageVersionProperties"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class CommunityGalleryImageVersionProperties(_Model): + """Describes the properties of a gallery image version. + + :ivar published_date: The published date of the gallery image version Definition. This property + can be used for decommissioning purposes. This property is updatable. + :vartype published_date: ~datetime.datetime + :ivar end_of_life_date: The end of life date of the gallery image version Definition. This + property can be used for decommissioning purposes. This property is updatable. + :vartype end_of_life_date: ~datetime.datetime + :ivar exclude_from_latest: If set to true, Virtual Machines deployed from the latest version of + the Image Definition won't use this Image Version. + :vartype exclude_from_latest: bool + :ivar storage_profile: Describes the storage profile of the image version. + :vartype storage_profile: ~azure.mgmt.compute.models.SharedGalleryImageVersionStorageProfile + :ivar disclaimer: The disclaimer for a community gallery resource. + :vartype disclaimer: str + :ivar artifact_tags: The artifact tags of a community gallery resource. + :vartype artifact_tags: dict[str, str] + """ + + published_date: Optional[datetime.datetime] = rest_field( + name="publishedDate", visibility=["read", "create", "update", "delete", "query"], format="rfc3339" + ) + """The published date of the gallery image version Definition. This property can be used for + decommissioning purposes. This property is updatable.""" + end_of_life_date: Optional[datetime.datetime] = rest_field( + name="endOfLifeDate", visibility=["read", "create", "update", "delete", "query"], format="rfc3339" + ) + """The end of life date of the gallery image version Definition. This property can be used for + decommissioning purposes. This property is updatable.""" + exclude_from_latest: Optional[bool] = rest_field( + name="excludeFromLatest", visibility=["read", "create", "update", "delete", "query"] + ) + """If set to true, Virtual Machines deployed from the latest version of the Image Definition won't + use this Image Version.""" + storage_profile: Optional["_models.SharedGalleryImageVersionStorageProfile"] = rest_field( + name="storageProfile", visibility=["read", "create", "update", "delete", "query"] + ) + """Describes the storage profile of the image version.""" + disclaimer: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The disclaimer for a community gallery resource.""" + artifact_tags: Optional[dict[str, str]] = rest_field( + name="artifactTags", visibility=["read", "create", "update", "delete", "query"] + ) + """The artifact tags of a community gallery resource.""" + + @overload + def __init__( + self, + *, + published_date: Optional[datetime.datetime] = None, + end_of_life_date: Optional[datetime.datetime] = None, + exclude_from_latest: Optional[bool] = None, + storage_profile: Optional["_models.SharedGalleryImageVersionStorageProfile"] = None, + disclaimer: Optional[str] = None, + artifact_tags: Optional[dict[str, str]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class CommunityGalleryInfo(_Model): + """Information of community gallery if current gallery is shared to community. + + :ivar publisher_uri: The link to the publisher website. Visible to all users. + :vartype publisher_uri: str + :ivar publisher_contact: Community gallery publisher support email. The email address of the + publisher. Visible to all users. + :vartype publisher_contact: str + :ivar eula: End-user license agreement for community gallery image. + :vartype eula: str + :ivar public_name_prefix: The prefix of the gallery name that will be displayed publicly. + Visible to all users. + :vartype public_name_prefix: str + :ivar community_gallery_enabled: Contains info about whether community gallery sharing is + enabled. + :vartype community_gallery_enabled: bool + :ivar public_names: Community gallery public name list. + :vartype public_names: list[str] + """ + + publisher_uri: Optional[str] = rest_field( + name="publisherUri", visibility=["read", "create", "update", "delete", "query"] + ) + """The link to the publisher website. Visible to all users.""" + publisher_contact: Optional[str] = rest_field( + name="publisherContact", visibility=["read", "create", "update", "delete", "query"] + ) + """Community gallery publisher support email. The email address of the publisher. Visible to all + users.""" + eula: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """End-user license agreement for community gallery image.""" + public_name_prefix: Optional[str] = rest_field( + name="publicNamePrefix", visibility=["read", "create", "update", "delete", "query"] + ) + """The prefix of the gallery name that will be displayed publicly. Visible to all users.""" + community_gallery_enabled: Optional[bool] = rest_field(name="communityGalleryEnabled", visibility=["read"]) + """Contains info about whether community gallery sharing is enabled.""" + public_names: Optional[list[str]] = rest_field(name="publicNames", visibility=["read"]) + """Community gallery public name list.""" + + @overload + def __init__( + self, + *, + publisher_uri: Optional[str] = None, + publisher_contact: Optional[str] = None, + eula: Optional[str] = None, + public_name_prefix: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class CommunityGalleryMetadata(_Model): + """The metadata of community gallery. + + :ivar publisher_uri: The publisher URI of this community gallery. + :vartype publisher_uri: str + :ivar publisher_contact: The publisher email id of this community gallery. Required. + :vartype publisher_contact: str + :ivar eula: The end-user license agreement for this community gallery. + :vartype eula: str + :ivar public_names: A list of public names the gallery has. Required. + :vartype public_names: list[str] + :ivar privacy_statement_uri: The link for the privacy statement of this community gallery from + the gallery publisher. + :vartype privacy_statement_uri: str + """ + + publisher_uri: Optional[str] = rest_field( + name="publisherUri", visibility=["read", "create", "update", "delete", "query"] + ) + """The publisher URI of this community gallery.""" + publisher_contact: str = rest_field( + name="publisherContact", visibility=["read", "create", "update", "delete", "query"] + ) + """The publisher email id of this community gallery. Required.""" + eula: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The end-user license agreement for this community gallery.""" + public_names: list[str] = rest_field(name="publicNames", visibility=["read", "create", "update", "delete", "query"]) + """A list of public names the gallery has. Required.""" + privacy_statement_uri: Optional[str] = rest_field( + name="privacyStatementUri", visibility=["read", "create", "update", "delete", "query"] + ) + """The link for the privacy statement of this community gallery from the gallery publisher.""" + + @overload + def __init__( + self, + *, + publisher_contact: str, + public_names: list[str], + publisher_uri: Optional[str] = None, + eula: Optional[str] = None, + privacy_statement_uri: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class CommunityGalleryProperties(_Model): + """Describes the properties of a community gallery. + + :ivar disclaimer: The disclaimer for a community gallery resource. + :vartype disclaimer: str + :ivar artifact_tags: The artifact tags of a community gallery resource. + :vartype artifact_tags: dict[str, str] + :ivar community_metadata: The metadata of community gallery. + :vartype community_metadata: ~azure.mgmt.compute.models.CommunityGalleryMetadata + """ + + disclaimer: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The disclaimer for a community gallery resource.""" + artifact_tags: Optional[dict[str, str]] = rest_field( + name="artifactTags", visibility=["read", "create", "update", "delete", "query"] + ) + """The artifact tags of a community gallery resource.""" + community_metadata: Optional["_models.CommunityGalleryMetadata"] = rest_field( + name="communityMetadata", visibility=["read", "create", "update", "delete", "query"] + ) + """The metadata of community gallery.""" + + @overload + def __init__( + self, + *, + disclaimer: Optional[str] = None, + artifact_tags: Optional[dict[str, str]] = None, + community_metadata: Optional["_models.CommunityGalleryMetadata"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ConvertToVirtualMachineScaleSetInput(_Model): + """Describes the Virtual Machine Scale Set to convert from Availability Set. + + :ivar virtual_machine_scale_set_name: Specifies information about the Virtual Machine Scale Set + that the Availability Set should be converted to. + :vartype virtual_machine_scale_set_name: str + """ + + virtual_machine_scale_set_name: Optional[str] = rest_field( + name="virtualMachineScaleSetName", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies information about the Virtual Machine Scale Set that the Availability Set should be + converted to.""" + + @overload + def __init__( + self, + *, + virtual_machine_scale_set_name: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ConvertToVirtualMachineScaleSetParameterBody(_Model): # pylint: disable=name-too-long + """ConvertToVirtualMachineScaleSetParameterBody. + + :ivar parameters: Parameters supplied to the migrate operation on the availability set. + :vartype parameters: ~azure.mgmt.compute.models.ConvertToVirtualMachineScaleSetInput + """ + + parameters: Optional["_models.ConvertToVirtualMachineScaleSetInput"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Parameters supplied to the migrate operation on the availability set.""" + + @overload + def __init__( + self, + *, + parameters: Optional["_models.ConvertToVirtualMachineScaleSetInput"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class CopyCompletionError(_Model): + """Indicates the error details if the background copy of a resource created via the CopyStart + operation fails. + + :ivar error_code: Indicates the error code if the background copy of a resource created via the + CopyStart operation fails. Required. "CopySourceNotFound" + :vartype error_code: str or ~azure.mgmt.compute.models.CopyCompletionErrorReason + :ivar error_message: Indicates the error message if the background copy of a resource created + via the CopyStart operation fails. Required. + :vartype error_message: str + """ + + error_code: Union[str, "_models.CopyCompletionErrorReason"] = rest_field( + name="errorCode", visibility=["read", "create", "update", "delete", "query"] + ) + """Indicates the error code if the background copy of a resource created via the CopyStart + operation fails. Required. \"CopySourceNotFound\"""" + error_message: str = rest_field(name="errorMessage", visibility=["read", "create", "update", "delete", "query"]) + """Indicates the error message if the background copy of a resource created via the CopyStart + operation fails. Required.""" + + @overload + def __init__( + self, + *, + error_code: Union[str, "_models.CopyCompletionErrorReason"], + error_message: str, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class CreationData(_Model): + """Data used when creating a disk. + + :ivar create_option: This enumerates the possible sources of a disk's creation. Required. Known + values are: "Empty", "Attach", "FromImage", "Import", "Copy", "Restore", "Upload", "CopyStart", + "ImportSecure", "UploadPreparedSecure", and "CopyFromSanSnapshot". + :vartype create_option: str or ~azure.mgmt.compute.models.DiskCreateOption + :ivar storage_account_id: Required if createOption is Import. The Azure Resource Manager + identifier of the storage account containing the blob to import as a disk. + :vartype storage_account_id: str + :ivar image_reference: Disk source information for PIR or user images. + :vartype image_reference: ~azure.mgmt.compute.models.ImageDiskReference + :ivar gallery_image_reference: Required if creating from a Gallery Image. The + id/sharedGalleryImageId/communityGalleryImageId of the ImageDiskReference will be the ARM id of + the shared galley image version from which to create a disk. + :vartype gallery_image_reference: ~azure.mgmt.compute.models.ImageDiskReference + :ivar source_uri: If createOption is Import, this is the URI of a blob to be imported into a + managed disk. + :vartype source_uri: str + :ivar source_resource_id: If createOption is Copy, this is the ARM id of the source snapshot or + disk. + :vartype source_resource_id: str + :ivar source_unique_id: If this field is set, this is the unique id identifying the source of + this resource. + :vartype source_unique_id: str + :ivar upload_size_bytes: If createOption is Upload, this is the size of the contents of the + upload including the VHD footer. This value should be between 20972032 (20 MiB + 512 bytes for + the VHD footer) and 35183298347520 bytes (32 TiB + 512 bytes for the VHD footer). + :vartype upload_size_bytes: int + :ivar logical_sector_size: Logical sector size in bytes for Ultra disks. Supported values are + 512 ad 4096. 4096 is the default. + :vartype logical_sector_size: int + :ivar security_data_uri: If createOption is ImportSecure, this is the URI of a blob to be + imported into VM guest state. + :vartype security_data_uri: str + :ivar security_metadata_uri: If createOption is ImportSecure, this is the URI of a blob to be + imported into VM metadata for Confidential VM. + :vartype security_metadata_uri: str + :ivar performance_plus: Set this flag to true to get a boost on the performance target of the + disk deployed, see here on the respective performance target. This flag can only be set on disk + creation time and cannot be disabled after enabled. + :vartype performance_plus: bool + :ivar elastic_san_resource_id: Required if createOption is CopyFromSanSnapshot. This is the ARM + id of the source elastic san volume snapshot. + :vartype elastic_san_resource_id: str + :ivar provisioned_bandwidth_copy_speed: If this field is set on a snapshot and createOption is + CopyStart, the snapshot will be copied at a quicker speed. Known values are: "None" and + "Enhanced". + :vartype provisioned_bandwidth_copy_speed: str or + ~azure.mgmt.compute.models.ProvisionedBandwidthCopyOption + :ivar instant_access_duration_minutes: For snapshots created from Premium SSD v2 or Ultra disk, + this property determines the time in minutes the snapshot is retained for instant access to + enable faster restore. + :vartype instant_access_duration_minutes: int + """ + + create_option: Union[str, "_models.DiskCreateOption"] = rest_field( + name="createOption", visibility=["read", "create", "update", "delete", "query"] + ) + """This enumerates the possible sources of a disk's creation. Required. Known values are: + \"Empty\", \"Attach\", \"FromImage\", \"Import\", \"Copy\", \"Restore\", \"Upload\", + \"CopyStart\", \"ImportSecure\", \"UploadPreparedSecure\", and \"CopyFromSanSnapshot\".""" + storage_account_id: Optional[str] = rest_field( + name="storageAccountId", visibility=["read", "create", "update", "delete", "query"] + ) + """Required if createOption is Import. The Azure Resource Manager identifier of the storage + account containing the blob to import as a disk.""" + image_reference: Optional["_models.ImageDiskReference"] = rest_field( + name="imageReference", visibility=["read", "create", "update", "delete", "query"] + ) + """Disk source information for PIR or user images.""" + gallery_image_reference: Optional["_models.ImageDiskReference"] = rest_field( + name="galleryImageReference", visibility=["read", "create", "update", "delete", "query"] + ) + """Required if creating from a Gallery Image. The id/sharedGalleryImageId/communityGalleryImageId + of the ImageDiskReference will be the ARM id of the shared galley image version from which to + create a disk.""" + source_uri: Optional[str] = rest_field(name="sourceUri", visibility=["read", "create", "update", "delete", "query"]) + """If createOption is Import, this is the URI of a blob to be imported into a managed disk.""" + source_resource_id: Optional[str] = rest_field( + name="sourceResourceId", visibility=["read", "create", "update", "delete", "query"] + ) + """If createOption is Copy, this is the ARM id of the source snapshot or disk.""" + source_unique_id: Optional[str] = rest_field(name="sourceUniqueId", visibility=["read"]) + """If this field is set, this is the unique id identifying the source of this resource.""" + upload_size_bytes: Optional[int] = rest_field( + name="uploadSizeBytes", visibility=["read", "create", "update", "delete", "query"] + ) + """If createOption is Upload, this is the size of the contents of the upload including the VHD + footer. This value should be between 20972032 (20 MiB + 512 bytes for the VHD footer) and + 35183298347520 bytes (32 TiB + 512 bytes for the VHD footer).""" + logical_sector_size: Optional[int] = rest_field( + name="logicalSectorSize", visibility=["read", "create", "update", "delete", "query"] + ) + """Logical sector size in bytes for Ultra disks. Supported values are 512 ad 4096. 4096 is the + default.""" + security_data_uri: Optional[str] = rest_field( + name="securityDataUri", visibility=["read", "create", "update", "delete", "query"] + ) + """If createOption is ImportSecure, this is the URI of a blob to be imported into VM guest state.""" + security_metadata_uri: Optional[str] = rest_field( + name="securityMetadataUri", visibility=["read", "create", "update", "delete", "query"] + ) + """If createOption is ImportSecure, this is the URI of a blob to be imported into VM metadata for + Confidential VM.""" + performance_plus: Optional[bool] = rest_field( + name="performancePlus", visibility=["read", "create", "update", "delete", "query"] + ) + """Set this flag to true to get a boost on the performance target of the disk deployed, see here + on the respective performance target. This flag can only be set on disk creation time and + cannot be disabled after enabled.""" + elastic_san_resource_id: Optional[str] = rest_field( + name="elasticSanResourceId", visibility=["read", "create", "update", "delete", "query"] + ) + """Required if createOption is CopyFromSanSnapshot. This is the ARM id of the source elastic san + volume snapshot.""" + provisioned_bandwidth_copy_speed: Optional[Union[str, "_models.ProvisionedBandwidthCopyOption"]] = rest_field( + name="provisionedBandwidthCopySpeed", visibility=["read", "create", "update", "delete", "query"] + ) + """If this field is set on a snapshot and createOption is CopyStart, the snapshot will be copied + at a quicker speed. Known values are: \"None\" and \"Enhanced\".""" + instant_access_duration_minutes: Optional[int] = rest_field( + name="instantAccessDurationMinutes", visibility=["read", "create", "update", "delete", "query"] + ) + """For snapshots created from Premium SSD v2 or Ultra disk, this property determines the time in + minutes the snapshot is retained for instant access to enable faster restore.""" + + @overload + def __init__( + self, + *, + create_option: Union[str, "_models.DiskCreateOption"], + storage_account_id: Optional[str] = None, + image_reference: Optional["_models.ImageDiskReference"] = None, + gallery_image_reference: Optional["_models.ImageDiskReference"] = None, + source_uri: Optional[str] = None, + source_resource_id: Optional[str] = None, + upload_size_bytes: Optional[int] = None, + logical_sector_size: Optional[int] = None, + security_data_uri: Optional[str] = None, + security_metadata_uri: Optional[str] = None, + performance_plus: Optional[bool] = None, + elastic_san_resource_id: Optional[str] = None, + provisioned_bandwidth_copy_speed: Optional[Union[str, "_models.ProvisionedBandwidthCopyOption"]] = None, + instant_access_duration_minutes: Optional[int] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class DataDisk(_Model): + """Describes a data disk. + + :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. + Required. + :vartype lun: int + :ivar name: The disk name. + :vartype name: str + :ivar vhd: The virtual hard disk. + :vartype vhd: ~azure.mgmt.compute.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.models.VirtualHardDisk + :ivar caching: Specifies the caching requirements. Possible values are: **None,** **ReadOnly,** + **ReadWrite.** The defaulting behavior is: **None for Standard storage. ReadOnly for Premium + storage.**. Known values are: "None", "ReadOnly", and "ReadWrite". + :vartype caching: str or ~azure.mgmt.compute.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: Specifies how the virtual machine disk should be created. Possible values + are **Attach:** This value is used when you are using a specialized disk to create the virtual + machine. **FromImage:** This value is used when you are using an image to create the virtual + machine data disk. If you are using a platform image, you should also use the imageReference + element described above. If you are using a marketplace image, you should also use the plan + element previously described. **Empty:** This value is used when creating an empty data disk. + **Copy:** This value is used to create a data disk from a snapshot or another disk. + **Restore:** This value is used to create a data disk from a disk restore point. Required. + Known values are: "FromImage", "Empty", "Attach", "Copy", and "Restore". + :vartype create_option: str or ~azure.mgmt.compute.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. The property 'diskSizeGB' is + the number of bytes x 1024^3 for the disk and the value cannot be larger than 1023. + :vartype disk_size_gb: int + :ivar managed_disk: The managed disk parameters. + :vartype managed_disk: ~azure.mgmt.compute.models.ManagedDiskParameters + :ivar source_resource: The source resource identifier. It can be a snapshot, or disk restore + point from which to create a disk. + :vartype source_resource: ~azure.mgmt.compute.models.ApiEntityReference + :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: int + :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: int + :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.** 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. **This feature is still in preview**. To force-detach a data disk + update toBeDetached to 'true' along with setting detachOption: 'ForceDetach'. "ForceDetach" + :vartype detach_option: str or ~azure.mgmt.compute.models.DiskDetachOptionTypes + :ivar delete_option: Specifies whether data disk should be deleted or detached upon VM + deletion. Possible values are: **Delete.** If this value is used, the data disk is deleted when + VM is deleted. **Detach.** If this value is used, the data disk is retained after VM is + deleted. The default value is set to **Detach**. Known values are: "Delete" and "Detach". + :vartype delete_option: str or ~azure.mgmt.compute.models.DiskDeleteOptionTypes + """ + + lun: int = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """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. Required.""" + name: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The disk name.""" + vhd: Optional["_models.VirtualHardDisk"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The virtual hard disk.""" + image: Optional["_models.VirtualHardDisk"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """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.""" + caching: Optional[Union[str, "_models.CachingTypes"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies the caching requirements. Possible values are: **None,** **ReadOnly,** **ReadWrite.** + The defaulting behavior is: **None for Standard storage. ReadOnly for Premium storage.**. Known + values are: \"None\", \"ReadOnly\", and \"ReadWrite\".""" + write_accelerator_enabled: Optional[bool] = rest_field( + name="writeAcceleratorEnabled", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies whether writeAccelerator should be enabled or disabled on the disk.""" + create_option: Union[str, "_models.DiskCreateOptionTypes"] = rest_field( + name="createOption", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies how the virtual machine disk should be created. Possible values are **Attach:** This + value is used when you are using a specialized disk to create the virtual machine. + **FromImage:** This value is used when you are using an image to create the virtual machine + data disk. If you are using a platform image, you should also use the imageReference element + described above. If you are using a marketplace image, you should also use the plan element + previously described. **Empty:** This value is used when creating an empty data disk. **Copy:** + This value is used to create a data disk from a snapshot or another disk. **Restore:** This + value is used to create a data disk from a disk restore point. Required. Known values are: + \"FromImage\", \"Empty\", \"Attach\", \"Copy\", and \"Restore\".""" + disk_size_gb: Optional[int] = rest_field( + name="diskSizeGB", visibility=["read", "create", "update", "delete", "query"] + ) + """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. The property 'diskSizeGB' is the number of + bytes x 1024^3 for the disk and the value cannot be larger than 1023.""" + managed_disk: Optional["_models.ManagedDiskParameters"] = rest_field( + name="managedDisk", visibility=["read", "create", "update", "delete", "query"] + ) + """The managed disk parameters.""" + source_resource: Optional["_models.ApiEntityReference"] = rest_field( + name="sourceResource", visibility=["read", "create", "update", "delete", "query"] + ) + """The source resource identifier. It can be a snapshot, or disk restore point from which to + create a disk.""" + to_be_detached: Optional[bool] = rest_field( + name="toBeDetached", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies whether the data disk is in process of detachment from the + VirtualMachine/VirtualMachineScaleset.""" + disk_iops_read_write: Optional[int] = rest_field(name="diskIOPSReadWrite", visibility=["read"]) + """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.""" + disk_m_bps_read_write: Optional[int] = rest_field(name="diskMBpsReadWrite", visibility=["read"]) + """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.""" + detach_option: Optional[Union[str, "_models.DiskDetachOptionTypes"]] = rest_field( + name="detachOption", visibility=["read", "create", "update", "delete", "query"] + ) + """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.** + 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. **This feature is still in preview**. To force-detach a data disk + update toBeDetached to 'true' along with setting detachOption: 'ForceDetach'. \"ForceDetach\"""" + delete_option: Optional[Union[str, "_models.DiskDeleteOptionTypes"]] = rest_field( + name="deleteOption", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies whether data disk should be deleted or detached upon VM deletion. Possible values + are: **Delete.** If this value is used, the data disk is deleted when VM is deleted. + **Detach.** If this value is used, the data disk is retained after VM is deleted. The default + value is set to **Detach**. Known values are: \"Delete\" and \"Detach\".""" + + @overload + def __init__( + self, + *, + lun: int, + create_option: Union[str, "_models.DiskCreateOptionTypes"], + name: Optional[str] = None, + vhd: Optional["_models.VirtualHardDisk"] = None, + image: Optional["_models.VirtualHardDisk"] = None, + caching: Optional[Union[str, "_models.CachingTypes"]] = None, + write_accelerator_enabled: Optional[bool] = None, + disk_size_gb: Optional[int] = None, + managed_disk: Optional["_models.ManagedDiskParameters"] = None, + source_resource: Optional["_models.ApiEntityReference"] = None, + to_be_detached: Optional[bool] = None, + detach_option: Optional[Union[str, "_models.DiskDetachOptionTypes"]] = None, + delete_option: Optional[Union[str, "_models.DiskDeleteOptionTypes"]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class DataDiskImage(_Model): + """Contains the data disk images information. + + :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 + """ + + lun: Optional[int] = rest_field(visibility=["read"]) + """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.""" + + +class DiskImageEncryption(_Model): + """This is the disk image encryption base class. + + :ivar disk_encryption_set_id: A relative URI containing the resource ID of the disk encryption + set. + :vartype disk_encryption_set_id: str + """ + + disk_encryption_set_id: Optional[str] = rest_field( + name="diskEncryptionSetId", visibility=["read", "create", "update", "delete", "query"] + ) + """A relative URI containing the resource ID of the disk encryption set.""" + + @overload + def __init__( + self, + *, + disk_encryption_set_id: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class DataDiskImageEncryption(DiskImageEncryption): + """Contains encryption settings for a data disk image. + + :ivar disk_encryption_set_id: A relative URI containing the resource ID of the disk encryption + set. + :vartype disk_encryption_set_id: str + :ivar lun: This property specifies the logical unit number of the data disk. This value is used + to identify data disks within the Virtual Machine and therefore must be unique for each data + disk attached to the Virtual Machine. Required. + :vartype lun: int + """ + + lun: int = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """This property specifies the logical unit number of the data disk. This value is used to + identify data disks within the Virtual Machine and therefore must be unique for each data disk + attached to the Virtual Machine. Required.""" + + @overload + def __init__( + self, + *, + lun: int, + disk_encryption_set_id: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class DataDisksToAttach(_Model): + """Describes the data disk to be attached. + + :ivar disk_id: ID of the managed data disk. Required. + :vartype disk_id: str + :ivar lun: 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. If not + specified, lun would be auto assigned. + :vartype lun: int + :ivar caching: Specifies the caching requirements. Possible values are: **None,** **ReadOnly,** + **ReadWrite.** The defaulting behavior is: **None for Standard storage. ReadOnly for Premium + storage.**. Known values are: "None", "ReadOnly", and "ReadWrite". + :vartype caching: str or ~azure.mgmt.compute.models.CachingTypes + :ivar delete_option: Specifies whether data disk should be deleted or detached upon VM + deletion. Possible values are: **Delete.** If this value is used, the data disk is deleted when + VM is deleted. **Detach.** If this value is used, the data disk is retained after VM is + deleted. The default value is set to **Detach**. Known values are: "Delete" and "Detach". + :vartype delete_option: str or ~azure.mgmt.compute.models.DiskDeleteOptionTypes + :ivar disk_encryption_set: Specifies the customer managed disk encryption set resource id for + the managed disk. + :vartype disk_encryption_set: ~azure.mgmt.compute.models.DiskEncryptionSetParameters + :ivar write_accelerator_enabled: Specifies whether writeAccelerator should be enabled or + disabled on the disk. + :vartype write_accelerator_enabled: bool + """ + + disk_id: str = rest_field(name="diskId", visibility=["read", "create", "update", "delete", "query"]) + """ID of the managed data disk. Required.""" + lun: Optional[int] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """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. If not specified, lun + would be auto assigned.""" + caching: Optional[Union[str, "_models.CachingTypes"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies the caching requirements. Possible values are: **None,** **ReadOnly,** **ReadWrite.** + The defaulting behavior is: **None for Standard storage. ReadOnly for Premium storage.**. Known + values are: \"None\", \"ReadOnly\", and \"ReadWrite\".""" + delete_option: Optional[Union[str, "_models.DiskDeleteOptionTypes"]] = rest_field( + name="deleteOption", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies whether data disk should be deleted or detached upon VM deletion. Possible values + are: **Delete.** If this value is used, the data disk is deleted when VM is deleted. + **Detach.** If this value is used, the data disk is retained after VM is deleted. The default + value is set to **Detach**. Known values are: \"Delete\" and \"Detach\".""" + disk_encryption_set: Optional["_models.DiskEncryptionSetParameters"] = rest_field( + name="diskEncryptionSet", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies the customer managed disk encryption set resource id for the managed disk.""" + write_accelerator_enabled: Optional[bool] = rest_field( + name="writeAcceleratorEnabled", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies whether writeAccelerator should be enabled or disabled on the disk.""" + + @overload + def __init__( + self, + *, + disk_id: str, + lun: Optional[int] = None, + caching: Optional[Union[str, "_models.CachingTypes"]] = None, + delete_option: Optional[Union[str, "_models.DiskDeleteOptionTypes"]] = None, + disk_encryption_set: Optional["_models.DiskEncryptionSetParameters"] = None, + write_accelerator_enabled: Optional[bool] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class DataDisksToDetach(_Model): + """Describes the data disk to be detached. + + :ivar disk_id: ID of the managed data disk. Required. + :vartype disk_id: str + :ivar detach_option: Supported options available for Detach of a disk from a VM. Refer to + DetachOption object reference for more details. "ForceDetach" + :vartype detach_option: str or ~azure.mgmt.compute.models.DiskDetachOptionTypes + """ + + disk_id: str = rest_field(name="diskId", visibility=["read", "create", "update", "delete", "query"]) + """ID of the managed data disk. Required.""" + detach_option: Optional[Union[str, "_models.DiskDetachOptionTypes"]] = rest_field( + name="detachOption", visibility=["read", "create", "update", "delete", "query"] + ) + """Supported options available for Detach of a disk from a VM. Refer to DetachOption object + reference for more details. \"ForceDetach\"""" + + @overload + def __init__( + self, + *, + disk_id: str, + detach_option: Optional[Union[str, "_models.DiskDetachOptionTypes"]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class DeallocateParameterBody(_Model): + """DeallocateParameterBody. + + :ivar vm_instance_i_ds: A list of virtual machine instance IDs from the VM scale set. + :vartype vm_instance_i_ds: ~azure.mgmt.compute.models.VirtualMachineScaleSetVMInstanceIDs + """ + + vm_instance_i_ds: Optional["_models.VirtualMachineScaleSetVMInstanceIDs"] = rest_field( + name="vmInstanceIDs", visibility=["read", "create", "update", "delete", "query"] + ) + """A list of virtual machine instance IDs from the VM scale set.""" + + @overload + def __init__( + self, + *, + vm_instance_i_ds: Optional["_models.VirtualMachineScaleSetVMInstanceIDs"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class DedicatedHost(TrackedResource): + """Specifies information about the Dedicated host. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.compute.models.SystemData + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar location: The geo-location where the resource lives. Required. + :vartype location: str + :ivar properties: Properties of the dedicated host. + :vartype properties: ~azure.mgmt.compute.models.DedicatedHostProperties + :ivar sku: 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. Required. + :vartype sku: ~azure.mgmt.compute.models.Sku + """ + + properties: Optional["_models.DedicatedHostProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Properties of the dedicated host.""" + sku: "_models.Sku" = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """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. Required.""" + + @overload + def __init__( + self, + *, + location: str, + sku: "_models.Sku", + tags: Optional[dict[str, str]] = None, + properties: Optional["_models.DedicatedHostProperties"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class DedicatedHostAllocatableVM(_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 + """ + + vm_size: Optional[str] = rest_field(name="vmSize", visibility=["read", "create", "update", "delete", "query"]) + """VM size in terms of which the unutilized capacity is represented.""" + count: Optional[float] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Maximum number of VMs of size vmSize that can fit in the dedicated host's remaining capacity.""" + + @overload + def __init__( + self, + *, + vm_size: Optional[str] = None, + count: Optional[float] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class DedicatedHostAvailableCapacity(_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.models.DedicatedHostAllocatableVM] + """ + + allocatable_v_ms: Optional[list["_models.DedicatedHostAllocatableVM"]] = rest_field( + name="allocatableVMs", visibility=["read", "create", "update", "delete", "query"] + ) + """The unutilized capacity of the dedicated host represented in terms of each VM size that is + allowed to be deployed to the dedicated host.""" + + @overload + def __init__( + self, + *, + allocatable_v_ms: Optional[list["_models.DedicatedHostAllocatableVM"]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class DedicatedHostGroup(TrackedResource): + """Specifies information about the dedicated host group that the dedicated hosts should be + assigned to. 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. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.compute.models.SystemData + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar location: The geo-location where the resource lives. Required. + :vartype location: str + :ivar properties: Dedicated Host Group Properties. + :vartype properties: ~azure.mgmt.compute.models.DedicatedHostGroupProperties + :ivar zones: The availability zones. + :vartype zones: list[str] + """ + + properties: Optional["_models.DedicatedHostGroupProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Dedicated Host Group Properties.""" + zones: Optional[list[str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The availability zones.""" + + @overload + def __init__( + self, + *, + location: str, + tags: Optional[dict[str, str]] = None, + properties: Optional["_models.DedicatedHostGroupProperties"] = None, + zones: Optional[list[str]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class DedicatedHostGroupInstanceView(_Model): + """DedicatedHostGroupInstanceView. + + :ivar hosts: List of instance view of the dedicated hosts under the dedicated host group. + :vartype hosts: list[~azure.mgmt.compute.models.DedicatedHostInstanceViewWithName] + """ + + hosts: Optional[list["_models.DedicatedHostInstanceViewWithName"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """List of instance view of the dedicated hosts under the dedicated host group.""" + + @overload + def __init__( + self, + *, + hosts: Optional[list["_models.DedicatedHostInstanceViewWithName"]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class DedicatedHostGroupProperties(_Model): + """Dedicated Host Group Properties. + + :ivar platform_fault_domain_count: Number of fault domains that the host group can span. + Required. + :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.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.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. Minimum api-version: 2020-06-01. + :vartype support_automatic_placement: bool + :ivar additional_capabilities: Enables or disables a capability on the dedicated host group. + Minimum api-version: 2022-03-01. + :vartype additional_capabilities: + ~azure.mgmt.compute.models.DedicatedHostGroupPropertiesAdditionalCapabilities + """ + + platform_fault_domain_count: int = rest_field( + name="platformFaultDomainCount", visibility=["read", "create", "update", "delete", "query"] + ) + """Number of fault domains that the host group can span. Required.""" + hosts: Optional[list["_models.SubResourceReadOnly"]] = rest_field(visibility=["read"]) + """A list of references to all dedicated hosts in the dedicated host group.""" + instance_view: Optional["_models.DedicatedHostGroupInstanceView"] = rest_field( + name="instanceView", visibility=["read"] + ) + """The dedicated host group instance view, which has the list of instance view of the dedicated + hosts under the dedicated host group.""" + support_automatic_placement: Optional[bool] = rest_field( + name="supportAutomaticPlacement", visibility=["read", "create", "update", "delete", "query"] + ) + """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. Minimum api-version: 2020-06-01.""" + additional_capabilities: Optional["_models.DedicatedHostGroupPropertiesAdditionalCapabilities"] = rest_field( + name="additionalCapabilities", visibility=["read", "create", "update", "delete", "query"] + ) + """Enables or disables a capability on the dedicated host group. Minimum api-version: 2022-03-01.""" + + @overload + def __init__( + self, + *, + platform_fault_domain_count: int, + support_automatic_placement: Optional[bool] = None, + additional_capabilities: Optional["_models.DedicatedHostGroupPropertiesAdditionalCapabilities"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class DedicatedHostGroupPropertiesAdditionalCapabilities(_Model): # pylint: disable=name-too-long + """Enables or disables a capability on the dedicated host group. 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. **Note:** The ultraSSDEnabled setting can only be enabled for + Host Groups that are created as zonal. Minimum api-version: 2022-03-01. + :vartype ultra_ssd_enabled: bool + """ + + ultra_ssd_enabled: Optional[bool] = rest_field( + name="ultraSSDEnabled", visibility=["read", "create", "update", "delete", "query"] + ) + """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. **Note:** The ultraSSDEnabled setting can only be enabled for + Host Groups that are created as zonal. Minimum api-version: 2022-03-01.""" + + @overload + def __init__( + self, + *, + ultra_ssd_enabled: Optional[bool] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class DedicatedHostGroupUpdate(UpdateResource): + """Specifies information about the dedicated host group that the dedicated host should be assigned + to. Only tags may be updated. + + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar properties: Dedicated Host Group Properties. + :vartype properties: ~azure.mgmt.compute.models.DedicatedHostGroupProperties + :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] + """ + + properties: Optional["_models.DedicatedHostGroupProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Dedicated Host Group Properties.""" + zones: Optional[list[str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """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.""" + + @overload + def __init__( + self, + *, + tags: Optional[dict[str, str]] = None, + properties: Optional["_models.DedicatedHostGroupProperties"] = None, + zones: Optional[list[str]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class DedicatedHostInstanceView(_Model): + """The instance view of a dedicated host. + + :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.models.DedicatedHostAvailableCapacity + :ivar statuses: The resource status information. + :vartype statuses: list[~azure.mgmt.compute.models.InstanceViewStatus] + """ + + asset_id: Optional[str] = rest_field(name="assetId", visibility=["read"]) + """Specifies the unique id of the dedicated physical machine on which the dedicated host resides.""" + available_capacity: Optional["_models.DedicatedHostAvailableCapacity"] = rest_field( + name="availableCapacity", visibility=["read", "create", "update", "delete", "query"] + ) + """Unutilized capacity of the dedicated host.""" + statuses: Optional[list["_models.InstanceViewStatus"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The resource status information.""" + + @overload + def __init__( + self, + *, + available_capacity: Optional["_models.DedicatedHostAvailableCapacity"] = None, + statuses: Optional[list["_models.InstanceViewStatus"]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +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. + + :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.models.DedicatedHostAvailableCapacity + :ivar statuses: The resource status information. + :vartype statuses: list[~azure.mgmt.compute.models.InstanceViewStatus] + :ivar name: The name of the dedicated host. + :vartype name: str + """ + + name: Optional[str] = rest_field(visibility=["read"]) + """The name of the dedicated host.""" + + @overload + def __init__( + self, + *, + available_capacity: Optional["_models.DedicatedHostAvailableCapacity"] = None, + statuses: Optional[list["_models.InstanceViewStatus"]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class DedicatedHostProperties(_Model): + """Properties of the dedicated host. + + :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. 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.models.SubResourceReadOnly] + :ivar license_type: Specifies the software license type that will be applied to the VMs + deployed on the dedicated host. Possible values are: **None,** **Windows_Server_Hybrid,** + **Windows_Server_Perpetual.** The default value is: **None.**. Known values are: "None", + "Windows_Server_Hybrid", and "Windows_Server_Perpetual". + :vartype license_type: str or ~azure.mgmt.compute.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.models.DedicatedHostInstanceView + :ivar time_created: Specifies the time at which the Dedicated Host resource was created. + Minimum api-version: 2021-11-01. + :vartype time_created: ~datetime.datetime + """ + + platform_fault_domain: Optional[int] = rest_field( + name="platformFaultDomain", visibility=["read", "create", "update", "delete", "query"] + ) + """Fault domain of the dedicated host within a dedicated host group.""" + auto_replace_on_failure: Optional[bool] = rest_field( + name="autoReplaceOnFailure", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies whether the dedicated host should be replaced automatically in case of a failure. The + value is defaulted to 'true' when not provided.""" + host_id: Optional[str] = rest_field(name="hostId", visibility=["read"]) + """A unique id generated and assigned to the dedicated host by the platform. Does not change + throughout the lifetime of the host.""" + virtual_machines: Optional[list["_models.SubResourceReadOnly"]] = rest_field( + name="virtualMachines", visibility=["read"] + ) + """A list of references to all virtual machines in the Dedicated Host.""" + license_type: Optional[Union[str, "_models.DedicatedHostLicenseTypes"]] = rest_field( + name="licenseType", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies the software license type that will be applied to the VMs deployed on the dedicated + host. Possible values are: **None,** **Windows_Server_Hybrid,** **Windows_Server_Perpetual.** + The default value is: **None.**. Known values are: \"None\", \"Windows_Server_Hybrid\", and + \"Windows_Server_Perpetual\".""" + provisioning_time: Optional[datetime.datetime] = rest_field( + name="provisioningTime", visibility=["read"], format="rfc3339" + ) + """The date when the host was first provisioned.""" + provisioning_state: Optional[str] = rest_field(name="provisioningState", visibility=["read"]) + """The provisioning state, which only appears in the response.""" + instance_view: Optional["_models.DedicatedHostInstanceView"] = rest_field(name="instanceView", visibility=["read"]) + """The dedicated host instance view.""" + time_created: Optional[datetime.datetime] = rest_field(name="timeCreated", visibility=["read"], format="rfc3339") + """Specifies the time at which the Dedicated Host resource was created. Minimum api-version: + 2021-11-01.""" + + @overload + def __init__( + self, + *, + platform_fault_domain: Optional[int] = None, + auto_replace_on_failure: Optional[bool] = None, + license_type: Optional[Union[str, "_models.DedicatedHostLicenseTypes"]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class DedicatedHostUpdate(UpdateResource): + """Specifies information about the dedicated host. Only tags, autoReplaceOnFailure and licenseType + may be updated. + + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar properties: Properties of the dedicated host. + :vartype properties: ~azure.mgmt.compute.models.DedicatedHostProperties + :ivar sku: [List all available dedicated host sizes for resizing] + (`https://docs.microsoft.com/rest/api/compute/dedicated-hosts/listavailablesizes + `_). Resizing + can be only used to scale up DedicatedHost. Only name is required to be set. + :vartype sku: ~azure.mgmt.compute.models.Sku + """ + + properties: Optional["_models.DedicatedHostProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Properties of the dedicated host.""" + sku: Optional["_models.Sku"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """[List all available dedicated host sizes for resizing] + (`https://docs.microsoft.com/rest/api/compute/dedicated-hosts/listavailablesizes + `_). Resizing + can be only used to scale up DedicatedHost. Only name is required to be set.""" + + @overload + def __init__( + self, + *, + tags: Optional[dict[str, str]] = None, + properties: Optional["_models.DedicatedHostProperties"] = None, + sku: Optional["_models.Sku"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class DefaultVirtualMachineScaleSetInfo(_Model): + """Indicates the target Virtual Machine ScaleSet properties upon triggering a seamless migration + without downtime of the VMs via the ConvertToVirtualMachineScaleSet API. + + :ivar constrained_maximum_capacity: Indicates if the the maximum capacity of the default + migrated Virtual Machine Scale Set after its migration will be constrained to a limited number + of VMs. + :vartype constrained_maximum_capacity: bool + :ivar default_virtual_machine_scale_set: The default Virtual Machine ScaleSet Uri that the + Availability Set will be moved to upon triggering a seamless migration via the + ConvertToVirtualMachineScaleSet API. + :vartype default_virtual_machine_scale_set: ~azure.mgmt.compute.models.SubResource + """ + + constrained_maximum_capacity: Optional[bool] = rest_field(name="constrainedMaximumCapacity", visibility=["read"]) + """Indicates if the the maximum capacity of the default migrated Virtual Machine Scale Set after + its migration will be constrained to a limited number of VMs.""" + default_virtual_machine_scale_set: Optional["_models.SubResource"] = rest_field( + name="defaultVirtualMachineScaleSet", visibility=["read"] + ) + """The default Virtual Machine ScaleSet Uri that the Availability Set will be moved to upon + triggering a seamless migration via the ConvertToVirtualMachineScaleSet API.""" + + +class DiagnosticsProfile(_Model): + """Specifies the boot diagnostic settings state. 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. **NOTE**: If storageUri is being specified + then ensure that the storage account is in the same region and subscription as the VM. You can + easily view the output of your console log. Azure also enables you to see a screenshot of the + VM from the hypervisor. + :vartype boot_diagnostics: ~azure.mgmt.compute.models.BootDiagnostics + """ + + boot_diagnostics: Optional["_models.BootDiagnostics"] = rest_field( + name="bootDiagnostics", visibility=["read", "create", "update", "delete", "query"] + ) + """Boot Diagnostics is a debugging feature which allows you to view Console Output and Screenshot + to diagnose VM status. **NOTE**: If storageUri is being specified then ensure that the storage + account is in the same region and subscription as the VM. You can easily view the output of + your console log. Azure also enables you to see a screenshot of the VM from the hypervisor.""" + + @overload + def __init__( + self, + *, + boot_diagnostics: Optional["_models.BootDiagnostics"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class DiffDiskSettings(_Model): + """Describes the parameters of ephemeral disk settings that can be specified for operating system + disk. **Note:** The ephemeral disk settings can only be specified for managed disk. + + :ivar option: Specifies the ephemeral disk settings for operating system disk. "Local" + :vartype option: str or ~azure.mgmt.compute.models.DiffDiskOptions + :ivar placement: Specifies the ephemeral disk placement for operating system disk. Possible + values are: **CacheDisk,** **ResourceDisk,** **NvmeDisk.** The defaulting behavior is: + **CacheDisk** if one is configured for the VM size otherwise **ResourceDisk** or **NvmeDisk** + is used. Refer to the 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. Minimum api-version for NvmeDisk: 2024-03-01. Known values are: + "CacheDisk", "ResourceDisk", and "NvmeDisk". + :vartype placement: str or ~azure.mgmt.compute.models.DiffDiskPlacement + """ + + option: Optional[Union[str, "_models.DiffDiskOptions"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies the ephemeral disk settings for operating system disk. \"Local\"""" + placement: Optional[Union[str, "_models.DiffDiskPlacement"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies the ephemeral disk placement for operating system disk. Possible values are: + **CacheDisk,** **ResourceDisk,** **NvmeDisk.** The defaulting behavior is: **CacheDisk** if one + is configured for the VM size otherwise **ResourceDisk** or **NvmeDisk** is used. Refer to the + 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. Minimum api-version for NvmeDisk: 2024-03-01. Known values are: + \"CacheDisk\", \"ResourceDisk\", and \"NvmeDisk\".""" + + @overload + def __init__( + self, + *, + option: Optional[Union[str, "_models.DiffDiskOptions"]] = None, + placement: Optional[Union[str, "_models.DiffDiskPlacement"]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class Disallowed(_Model): + """Describes the disallowed disk types. + + :ivar disk_types: A list of disk types. + :vartype disk_types: list[str] + """ + + disk_types: Optional[list[str]] = rest_field( + name="diskTypes", visibility=["read", "create", "update", "delete", "query"] + ) + """A list of disk types.""" + + @overload + def __init__( + self, + *, + disk_types: Optional[list[str]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class DisallowedConfiguration(_Model): + """Specifies the disallowed configuration for a virtual machine image. + + :ivar vm_disk_type: VM disk types which are disallowed. Known values are: "None" and + "Unmanaged". + :vartype vm_disk_type: str or ~azure.mgmt.compute.models.VmDiskTypes + """ + + vm_disk_type: Optional[Union[str, "_models.VmDiskTypes"]] = rest_field( + name="vmDiskType", visibility=["read", "create", "update", "delete", "query"] + ) + """VM disk types which are disallowed. Known values are: \"None\" and \"Unmanaged\".""" + + @overload + def __init__( + self, + *, + vm_disk_type: Optional[Union[str, "_models.VmDiskTypes"]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class Disk(TrackedResource): + """Disk resource. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.compute.models.SystemData + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar location: The geo-location where the resource lives. Required. + :vartype location: str + :ivar properties: Disk resource properties. + :vartype properties: ~azure.mgmt.compute.models.DiskProperties + :ivar managed_by: A relative URI containing the ID of the VM that has the disk attached. + :vartype managed_by: str + :ivar managed_by_extended: List of relative URIs containing the IDs of the VMs that have the + disk attached. maxShares should be set to a value greater than one for disks to allow attaching + them to multiple VMs. + :vartype managed_by_extended: list[str] + :ivar sku: The disks sku name. Can be Standard_LRS, Premium_LRS, StandardSSD_LRS, UltraSSD_LRS, + Premium_ZRS, StandardSSD_ZRS, or PremiumV2_LRS. + :vartype sku: ~azure.mgmt.compute.models.DiskSku + :ivar zones: The Logical zone list for Disk. + :vartype zones: list[str] + :ivar extended_location: The extended location where the disk will be created. Extended + location cannot be changed. + :vartype extended_location: ~azure.mgmt.compute.models.ExtendedLocation + """ + + properties: Optional["_models.DiskProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Disk resource properties.""" + managed_by: Optional[str] = rest_field(name="managedBy", visibility=["read"]) + """A relative URI containing the ID of the VM that has the disk attached.""" + managed_by_extended: Optional[list[str]] = rest_field(name="managedByExtended", visibility=["read"]) + """List of relative URIs containing the IDs of the VMs that have the disk attached. maxShares + should be set to a value greater than one for disks to allow attaching them to multiple VMs.""" + sku: Optional["_models.DiskSku"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The disks sku name. Can be Standard_LRS, Premium_LRS, StandardSSD_LRS, UltraSSD_LRS, + Premium_ZRS, StandardSSD_ZRS, or PremiumV2_LRS.""" + zones: Optional[list[str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The Logical zone list for Disk.""" + extended_location: Optional["_models.ExtendedLocation"] = rest_field( + name="extendedLocation", visibility=["read", "create", "update", "delete", "query"] + ) + """The extended location where the disk will be created. Extended location cannot be changed.""" + + @overload + def __init__( + self, + *, + location: str, + tags: Optional[dict[str, str]] = None, + properties: Optional["_models.DiskProperties"] = None, + sku: Optional["_models.DiskSku"] = None, + zones: Optional[list[str]] = None, + extended_location: Optional["_models.ExtendedLocation"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class DiskAccess(TrackedResource): + """disk access resource. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.compute.models.SystemData + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar location: The geo-location where the resource lives. Required. + :vartype location: str + :ivar properties: + :vartype properties: ~azure.mgmt.compute.models.DiskAccessProperties + :ivar extended_location: The extended location where the disk access will be created. Extended + location cannot be changed. + :vartype extended_location: ~azure.mgmt.compute.models.ExtendedLocation + """ + + properties: Optional["_models.DiskAccessProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + extended_location: Optional["_models.ExtendedLocation"] = rest_field( + name="extendedLocation", visibility=["read", "create", "update", "delete", "query"] + ) + """The extended location where the disk access will be created. Extended location cannot be + changed.""" + + @overload + def __init__( + self, + *, + location: str, + tags: Optional[dict[str, str]] = None, + properties: Optional["_models.DiskAccessProperties"] = None, + extended_location: Optional["_models.ExtendedLocation"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class DiskAccessProperties(_Model): + """DiskAccessProperties. + + :ivar private_endpoint_connections: A readonly collection of private endpoint connections + created on the disk. Currently only one endpoint connection is supported. + :vartype private_endpoint_connections: + list[~azure.mgmt.compute.models.PrivateEndpointConnection] + :ivar provisioning_state: The disk access resource provisioning state. + :vartype provisioning_state: str + :ivar time_created: The time when the disk access was created. + :vartype time_created: ~datetime.datetime + """ + + private_endpoint_connections: Optional[list["_models.PrivateEndpointConnection"]] = rest_field( + name="privateEndpointConnections", visibility=["read"] + ) + """A readonly collection of private endpoint connections created on the disk. Currently only one + endpoint connection is supported.""" + provisioning_state: Optional[str] = rest_field(name="provisioningState", visibility=["read"]) + """The disk access resource provisioning state.""" + time_created: Optional[datetime.datetime] = rest_field(name="timeCreated", visibility=["read"], format="rfc3339") + """The time when the disk access was created.""" + + +class DiskAccessUpdate(_Model): + """Used for updating a disk access resource. + + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + """ + + tags: Optional[dict[str, str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Resource tags.""" + + @overload + def __init__( + self, + *, + tags: Optional[dict[str, str]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class DiskEncryptionSet(TrackedResource): + """disk encryption set resource. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.compute.models.SystemData + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar location: The geo-location where the resource lives. Required. + :vartype location: str + :ivar properties: + :vartype properties: ~azure.mgmt.compute.models.EncryptionSetProperties + :ivar identity: The managed identity for the disk encryption set. It should be given permission + on the key vault before it can be used to encrypt disks. + :vartype identity: ~azure.mgmt.compute.models.EncryptionSetIdentity + """ + + properties: Optional["_models.EncryptionSetProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + identity: Optional["_models.EncryptionSetIdentity"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The managed identity for the disk encryption set. It should be given permission on the key + vault before it can be used to encrypt disks.""" + + @overload + def __init__( + self, + *, + location: str, + tags: Optional[dict[str, str]] = None, + properties: Optional["_models.EncryptionSetProperties"] = None, + identity: Optional["_models.EncryptionSetIdentity"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class SubResource(_Model): + """SubResource. + + :ivar id: Resource Id. + :vartype id: str + """ + + id: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Resource Id.""" + + @overload + def __init__( + self, + *, + id: Optional[str] = None, # pylint: disable=redefined-builtin + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class DiskEncryptionSetParameters(SubResource): + """Describes the parameter of customer managed disk encryption set resource id that can be + specified for disk. **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 + """ + + @overload + def __init__( + self, + *, + id: Optional[str] = None, # pylint: disable=redefined-builtin + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class DiskEncryptionSettings(_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.models.KeyVaultSecretReference + :ivar key_encryption_key: Specifies the location of the key encryption key in Key Vault. + :vartype key_encryption_key: ~azure.mgmt.compute.models.KeyVaultKeyReference + :ivar enabled: Specifies whether disk encryption should be enabled on the virtual machine. + :vartype enabled: bool + """ + + disk_encryption_key: Optional["_models.KeyVaultSecretReference"] = rest_field( + name="diskEncryptionKey", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies the location of the disk encryption key, which is a Key Vault Secret.""" + key_encryption_key: Optional["_models.KeyVaultKeyReference"] = rest_field( + name="keyEncryptionKey", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies the location of the key encryption key in Key Vault.""" + enabled: Optional[bool] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Specifies whether disk encryption should be enabled on the virtual machine.""" + + @overload + def __init__( + self, + *, + disk_encryption_key: Optional["_models.KeyVaultSecretReference"] = None, + key_encryption_key: Optional["_models.KeyVaultKeyReference"] = None, + enabled: Optional[bool] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class DiskEncryptionSetUpdate(_Model): + """disk encryption set update resource. + + :ivar properties: disk encryption set resource update properties. + :vartype properties: ~azure.mgmt.compute.models.DiskEncryptionSetUpdateProperties + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar identity: The managed identity for the disk encryption set. It should be given permission + on the key vault before it can be used to encrypt disks. + :vartype identity: ~azure.mgmt.compute.models.EncryptionSetIdentity + """ + + properties: Optional["_models.DiskEncryptionSetUpdateProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """disk encryption set resource update properties.""" + tags: Optional[dict[str, str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Resource tags.""" + identity: Optional["_models.EncryptionSetIdentity"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The managed identity for the disk encryption set. It should be given permission on the key + vault before it can be used to encrypt disks.""" + + @overload + def __init__( + self, + *, + properties: Optional["_models.DiskEncryptionSetUpdateProperties"] = None, + tags: Optional[dict[str, str]] = None, + identity: Optional["_models.EncryptionSetIdentity"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class DiskEncryptionSetUpdateProperties(_Model): + """disk encryption set resource update properties. + + :ivar encryption_type: The type of key used to encrypt the data of the disk. Known values are: + "EncryptionAtRestWithCustomerKey", "EncryptionAtRestWithPlatformAndCustomerKeys", and + "ConfidentialVmEncryptedWithCustomerKey". + :vartype encryption_type: str or ~azure.mgmt.compute.models.DiskEncryptionSetType + :ivar active_key: Key Vault Key Url to be used for server side encryption of Managed Disks and + Snapshots. + :vartype active_key: ~azure.mgmt.compute.models.KeyForDiskEncryptionSet + :ivar rotation_to_latest_key_version_enabled: Set this flag to true to enable auto-updating of + this disk encryption set to the latest key version. + :vartype rotation_to_latest_key_version_enabled: bool + :ivar federated_client_id: Multi-tenant application client id to access key vault in a + different tenant. Setting the value to 'None' will clear the property. + :vartype federated_client_id: str + """ + + encryption_type: Optional[Union[str, "_models.DiskEncryptionSetType"]] = rest_field( + name="encryptionType", visibility=["read", "create", "update", "delete", "query"] + ) + """The type of key used to encrypt the data of the disk. Known values are: + \"EncryptionAtRestWithCustomerKey\", \"EncryptionAtRestWithPlatformAndCustomerKeys\", and + \"ConfidentialVmEncryptedWithCustomerKey\".""" + active_key: Optional["_models.KeyForDiskEncryptionSet"] = rest_field( + name="activeKey", visibility=["read", "create", "update", "delete", "query"] + ) + """Key Vault Key Url to be used for server side encryption of Managed Disks and Snapshots.""" + rotation_to_latest_key_version_enabled: Optional[bool] = rest_field( + name="rotationToLatestKeyVersionEnabled", visibility=["read", "create", "update", "delete", "query"] + ) + """Set this flag to true to enable auto-updating of this disk encryption set to the latest key + version.""" + federated_client_id: Optional[str] = rest_field( + name="federatedClientId", visibility=["read", "create", "update", "delete", "query"] + ) + """Multi-tenant application client id to access key vault in a different tenant. Setting the value + to 'None' will clear the property.""" + + @overload + def __init__( + self, + *, + encryption_type: Optional[Union[str, "_models.DiskEncryptionSetType"]] = None, + active_key: Optional["_models.KeyForDiskEncryptionSet"] = None, + rotation_to_latest_key_version_enabled: Optional[bool] = None, + federated_client_id: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class DiskInstanceView(_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.

Minimum + api-version: 2015-06-15. + :vartype encryption_settings: list[~azure.mgmt.compute.models.DiskEncryptionSettings] + :ivar statuses: The resource status information. + :vartype statuses: list[~azure.mgmt.compute.models.InstanceViewStatus] + """ + + name: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The disk name.""" + encryption_settings: Optional[list["_models.DiskEncryptionSettings"]] = rest_field( + name="encryptionSettings", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies the encryption settings for the OS Disk.

Minimum api-version: 2015-06-15.""" + statuses: Optional[list["_models.InstanceViewStatus"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The resource status information.""" + + @overload + def __init__( + self, + *, + name: Optional[str] = None, + encryption_settings: Optional[list["_models.DiskEncryptionSettings"]] = None, + statuses: Optional[list["_models.InstanceViewStatus"]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class DiskProperties(_Model): + """Disk resource properties. + + :ivar time_created: The time when the disk was created. + :vartype time_created: ~datetime.datetime + :ivar os_type: The Operating System type. Known values are: "Windows" and "Linux". + :vartype os_type: str or ~azure.mgmt.compute.models.OperatingSystemTypes + :ivar hyper_v_generation: The hypervisor generation of the Virtual Machine. Applicable to OS + disks only. Known values are: "V1" and "V2". + :vartype hyper_v_generation: str or ~azure.mgmt.compute.models.HyperVGeneration + :ivar purchase_plan: Purchase plan information for the the image from which the OS disk was + created. E.g. - {name: 2019-Datacenter, publisher: MicrosoftWindowsServer, product: + WindowsServer}. + :vartype purchase_plan: ~azure.mgmt.compute.models.DiskPurchasePlan + :ivar supported_capabilities: List of supported capabilities for the image from which the OS + disk was created. + :vartype supported_capabilities: ~azure.mgmt.compute.models.SupportedCapabilities + :ivar creation_data: Disk source information. CreationData information cannot be changed after + the disk has been created. Required. + :vartype creation_data: ~azure.mgmt.compute.models.CreationData + :ivar disk_size_gb: If creationData.createOption is Empty, this field is mandatory and it + indicates the size of the disk to create. If this field is present for updates or creation with + other options, it indicates a resize. Resizes are only allowed if the disk is not attached to a + running VM, and can only increase the disk's size. + :vartype disk_size_gb: int + :ivar disk_size_bytes: The size of the disk in bytes. This field is read only. + :vartype disk_size_bytes: int + :ivar unique_id: Unique Guid identifying the resource. + :vartype unique_id: str + :ivar encryption_settings_collection: Encryption settings collection used for Azure Disk + Encryption, can contain multiple encryption settings per disk or snapshot. + :vartype encryption_settings_collection: + ~azure.mgmt.compute.models.EncryptionSettingsCollection + :ivar provisioning_state: The disk provisioning state. + :vartype provisioning_state: str + :ivar disk_iops_read_write: The number of IOPS allowed for this disk; only settable for + UltraSSD disks. One operation can transfer between 4k and 256k bytes. + :vartype disk_iops_read_write: int + :ivar disk_m_bps_read_write: The bandwidth allowed for this disk; only settable for UltraSSD + disks. MBps means millions of bytes per second - MB here uses the ISO notation, of powers of + 10. + :vartype disk_m_bps_read_write: int + :ivar disk_iops_read_only: The total number of IOPS that will be allowed across all VMs + mounting the shared disk as ReadOnly. One operation can transfer between 4k and 256k bytes. + :vartype disk_iops_read_only: int + :ivar disk_m_bps_read_only: The total throughput (MBps) that will be allowed across all VMs + mounting the shared disk as ReadOnly. MBps means millions of bytes per second - MB here uses + the ISO notation, of powers of 10. + :vartype disk_m_bps_read_only: int + :ivar disk_state: The state of the disk. Known values are: "Unattached", "Attached", + "Reserved", "Frozen", "ActiveSAS", "ActiveSASFrozen", "ReadyToUpload", and "ActiveUpload". + :vartype disk_state: str or ~azure.mgmt.compute.models.DiskState + :ivar encryption: Encryption property can be used to encrypt data at rest with customer managed + keys or platform managed keys. + :vartype encryption: ~azure.mgmt.compute.models.Encryption + :ivar max_shares: The maximum number of VMs that can attach to the disk at the same time. Value + greater than one indicates a disk that can be mounted on multiple VMs at the same time. + :vartype max_shares: int + :ivar share_info: Details of the list of all VMs that have the disk attached. maxShares should + be set to a value greater than one for disks to allow attaching them to multiple VMs. + :vartype share_info: list[~azure.mgmt.compute.models.ShareInfoElement] + :ivar network_access_policy: Policy for accessing the disk via network. Known values are: + "AllowAll", "AllowPrivate", and "DenyAll". + :vartype network_access_policy: str or ~azure.mgmt.compute.models.NetworkAccessPolicy + :ivar disk_access_id: ARM id of the DiskAccess resource for using private endpoints on disks. + :vartype disk_access_id: str + :ivar bursting_enabled_time: Latest time when bursting was last enabled on a disk. + :vartype bursting_enabled_time: ~datetime.datetime + :ivar tier: Performance tier of the disk (e.g, P4, S10) as described here: + `https://azure.microsoft.com/en-us/pricing/details/managed-disks/ + `_. Does not apply to Ultra + disks. + :vartype tier: str + :ivar bursting_enabled: Set to true to enable bursting beyond the provisioned performance + target of the disk. Bursting is disabled by default. Does not apply to Ultra disks. + :vartype bursting_enabled: bool + :ivar property_updates_in_progress: Properties of the disk for which update is pending. + :vartype property_updates_in_progress: ~azure.mgmt.compute.models.PropertyUpdatesInProgress + :ivar supports_hibernation: Indicates the OS on a disk supports hibernation. + :vartype supports_hibernation: bool + :ivar security_profile: Contains the security related information for the resource. + :vartype security_profile: ~azure.mgmt.compute.models.DiskSecurityProfile + :ivar completion_percent: Percentage complete for the background copy when a resource is + created via the CopyStart operation. + :vartype completion_percent: float + :ivar public_network_access: Policy for controlling export on the disk. Known values are: + "Enabled" and "Disabled". + :vartype public_network_access: str or ~azure.mgmt.compute.models.PublicNetworkAccess + :ivar data_access_auth_mode: Additional authentication requirements when exporting or uploading + to a disk or snapshot. Known values are: "AzureActiveDirectory" and "None". + :vartype data_access_auth_mode: str or ~azure.mgmt.compute.models.DataAccessAuthMode + :ivar optimized_for_frequent_attach: Setting this property to true improves reliability and + performance of data disks that are frequently (more than 5 times a day) by detached from one + virtual machine and attached to another. This property should not be set for disks that are not + detached and attached frequently as it causes the disks to not align with the fault domain of + the virtual machine. + :vartype optimized_for_frequent_attach: bool + :ivar last_ownership_update_time: The UTC time when the ownership state of the disk was last + changed i.e., the time the disk was last attached or detached from a VM or the time when the VM + to which the disk was attached was deallocated or started. + :vartype last_ownership_update_time: ~datetime.datetime + :ivar availability_policy: Determines how platform treats disk failures. + :vartype availability_policy: ~azure.mgmt.compute.models.AvailabilityPolicy + """ + + time_created: Optional[datetime.datetime] = rest_field(name="timeCreated", visibility=["read"], format="rfc3339") + """The time when the disk was created.""" + os_type: Optional[Union[str, "_models.OperatingSystemTypes"]] = rest_field( + name="osType", visibility=["read", "create", "update", "delete", "query"] + ) + """The Operating System type. Known values are: \"Windows\" and \"Linux\".""" + hyper_v_generation: Optional[Union[str, "_models.HyperVGeneration"]] = rest_field( + name="hyperVGeneration", visibility=["read", "create", "update", "delete", "query"] + ) + """The hypervisor generation of the Virtual Machine. Applicable to OS disks only. Known values + are: \"V1\" and \"V2\".""" + purchase_plan: Optional["_models.DiskPurchasePlan"] = rest_field( + name="purchasePlan", visibility=["read", "create", "update", "delete", "query"] + ) + """Purchase plan information for the the image from which the OS disk was created. E.g. - {name: + 2019-Datacenter, publisher: MicrosoftWindowsServer, product: WindowsServer}.""" + supported_capabilities: Optional["_models.SupportedCapabilities"] = rest_field( + name="supportedCapabilities", visibility=["read", "create", "update", "delete", "query"] + ) + """List of supported capabilities for the image from which the OS disk was created.""" + creation_data: "_models.CreationData" = rest_field( + name="creationData", visibility=["read", "create", "update", "delete", "query"] + ) + """Disk source information. CreationData information cannot be changed after the disk has been + created. Required.""" + disk_size_gb: Optional[int] = rest_field( + name="diskSizeGB", visibility=["read", "create", "update", "delete", "query"] + ) + """If creationData.createOption is Empty, this field is mandatory and it indicates the size of the + disk to create. If this field is present for updates or creation with other options, it + indicates a resize. Resizes are only allowed if the disk is not attached to a running VM, and + can only increase the disk's size.""" + disk_size_bytes: Optional[int] = rest_field(name="diskSizeBytes", visibility=["read"]) + """The size of the disk in bytes. This field is read only.""" + unique_id: Optional[str] = rest_field(name="uniqueId", visibility=["read"]) + """Unique Guid identifying the resource.""" + encryption_settings_collection: Optional["_models.EncryptionSettingsCollection"] = rest_field( + name="encryptionSettingsCollection", visibility=["read", "create", "update", "delete", "query"] + ) + """Encryption settings collection used for Azure Disk Encryption, can contain multiple encryption + settings per disk or snapshot.""" + provisioning_state: Optional[str] = rest_field(name="provisioningState", visibility=["read"]) + """The disk provisioning state.""" + disk_iops_read_write: Optional[int] = rest_field( + name="diskIOPSReadWrite", visibility=["read", "create", "update", "delete", "query"] + ) + """The number of IOPS allowed for this disk; only settable for UltraSSD disks. One operation can + transfer between 4k and 256k bytes.""" + disk_m_bps_read_write: Optional[int] = rest_field( + name="diskMBpsReadWrite", visibility=["read", "create", "update", "delete", "query"] + ) + """The bandwidth allowed for this disk; only settable for UltraSSD disks. MBps means millions of + bytes per second - MB here uses the ISO notation, of powers of 10.""" + disk_iops_read_only: Optional[int] = rest_field( + name="diskIOPSReadOnly", visibility=["read", "create", "update", "delete", "query"] + ) + """The total number of IOPS that will be allowed across all VMs mounting the shared disk as + ReadOnly. One operation can transfer between 4k and 256k bytes.""" + disk_m_bps_read_only: Optional[int] = rest_field( + name="diskMBpsReadOnly", visibility=["read", "create", "update", "delete", "query"] + ) + """The total throughput (MBps) that will be allowed across all VMs mounting the shared disk as + ReadOnly. MBps means millions of bytes per second - MB here uses the ISO notation, of powers of + 10.""" + disk_state: Optional[Union[str, "_models.DiskState"]] = rest_field(name="diskState", visibility=["read"]) + """The state of the disk. Known values are: \"Unattached\", \"Attached\", \"Reserved\", + \"Frozen\", \"ActiveSAS\", \"ActiveSASFrozen\", \"ReadyToUpload\", and \"ActiveUpload\".""" + encryption: Optional["_models.Encryption"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Encryption property can be used to encrypt data at rest with customer managed keys or platform + managed keys.""" + max_shares: Optional[int] = rest_field(name="maxShares", visibility=["read", "create", "update", "delete", "query"]) + """The maximum number of VMs that can attach to the disk at the same time. Value greater than one + indicates a disk that can be mounted on multiple VMs at the same time.""" + share_info: Optional[list["_models.ShareInfoElement"]] = rest_field(name="shareInfo", visibility=["read"]) + """Details of the list of all VMs that have the disk attached. maxShares should be set to a value + greater than one for disks to allow attaching them to multiple VMs.""" + network_access_policy: Optional[Union[str, "_models.NetworkAccessPolicy"]] = rest_field( + name="networkAccessPolicy", visibility=["read", "create", "update", "delete", "query"] + ) + """Policy for accessing the disk via network. Known values are: \"AllowAll\", \"AllowPrivate\", + and \"DenyAll\".""" + disk_access_id: Optional[str] = rest_field( + name="diskAccessId", visibility=["read", "create", "update", "delete", "query"] + ) + """ARM id of the DiskAccess resource for using private endpoints on disks.""" + bursting_enabled_time: Optional[datetime.datetime] = rest_field( + name="burstingEnabledTime", visibility=["read"], format="rfc3339" + ) + """Latest time when bursting was last enabled on a disk.""" + tier: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Performance tier of the disk (e.g, P4, S10) as described here: + `https://azure.microsoft.com/en-us/pricing/details/managed-disks/ + `_. Does not apply to Ultra + disks.""" + bursting_enabled: Optional[bool] = rest_field( + name="burstingEnabled", visibility=["read", "create", "update", "delete", "query"] + ) + """Set to true to enable bursting beyond the provisioned performance target of the disk. Bursting + is disabled by default. Does not apply to Ultra disks.""" + property_updates_in_progress: Optional["_models.PropertyUpdatesInProgress"] = rest_field( + name="propertyUpdatesInProgress", visibility=["read"] + ) + """Properties of the disk for which update is pending.""" + supports_hibernation: Optional[bool] = rest_field( + name="supportsHibernation", visibility=["read", "create", "update", "delete", "query"] + ) + """Indicates the OS on a disk supports hibernation.""" + security_profile: Optional["_models.DiskSecurityProfile"] = rest_field( + name="securityProfile", visibility=["read", "create", "update", "delete", "query"] + ) + """Contains the security related information for the resource.""" + completion_percent: Optional[float] = rest_field( + name="completionPercent", visibility=["read", "create", "update", "delete", "query"] + ) + """Percentage complete for the background copy when a resource is created via the CopyStart + operation.""" + public_network_access: Optional[Union[str, "_models.PublicNetworkAccess"]] = rest_field( + name="publicNetworkAccess", visibility=["read", "create", "update", "delete", "query"] + ) + """Policy for controlling export on the disk. Known values are: \"Enabled\" and \"Disabled\".""" + data_access_auth_mode: Optional[Union[str, "_models.DataAccessAuthMode"]] = rest_field( + name="dataAccessAuthMode", visibility=["read", "create", "update", "delete", "query"] + ) + """Additional authentication requirements when exporting or uploading to a disk or snapshot. Known + values are: \"AzureActiveDirectory\" and \"None\".""" + optimized_for_frequent_attach: Optional[bool] = rest_field( + name="optimizedForFrequentAttach", visibility=["read", "create", "update", "delete", "query"] + ) + """Setting this property to true improves reliability and performance of data disks that are + frequently (more than 5 times a day) by detached from one virtual machine and attached to + another. This property should not be set for disks that are not detached and attached + frequently as it causes the disks to not align with the fault domain of the virtual machine.""" + last_ownership_update_time: Optional[datetime.datetime] = rest_field( + name="LastOwnershipUpdateTime", visibility=["read"], format="rfc3339" + ) + """The UTC time when the ownership state of the disk was last changed i.e., the time the disk was + last attached or detached from a VM or the time when the VM to which the disk was attached was + deallocated or started.""" + availability_policy: Optional["_models.AvailabilityPolicy"] = rest_field( + name="availabilityPolicy", visibility=["read", "create", "update", "delete", "query"] + ) + """Determines how platform treats disk failures.""" + + @overload + def __init__( # pylint: disable=too-many-locals + self, + *, + creation_data: "_models.CreationData", + os_type: Optional[Union[str, "_models.OperatingSystemTypes"]] = None, + hyper_v_generation: Optional[Union[str, "_models.HyperVGeneration"]] = None, + purchase_plan: Optional["_models.DiskPurchasePlan"] = None, + supported_capabilities: Optional["_models.SupportedCapabilities"] = None, + disk_size_gb: Optional[int] = None, + encryption_settings_collection: Optional["_models.EncryptionSettingsCollection"] = None, + disk_iops_read_write: Optional[int] = None, + disk_m_bps_read_write: Optional[int] = None, + disk_iops_read_only: Optional[int] = None, + disk_m_bps_read_only: Optional[int] = None, + encryption: Optional["_models.Encryption"] = None, + max_shares: Optional[int] = None, + network_access_policy: Optional[Union[str, "_models.NetworkAccessPolicy"]] = None, + disk_access_id: Optional[str] = None, + tier: Optional[str] = None, + bursting_enabled: Optional[bool] = None, + supports_hibernation: Optional[bool] = None, + security_profile: Optional["_models.DiskSecurityProfile"] = None, + completion_percent: Optional[float] = None, + public_network_access: Optional[Union[str, "_models.PublicNetworkAccess"]] = None, + data_access_auth_mode: Optional[Union[str, "_models.DataAccessAuthMode"]] = None, + optimized_for_frequent_attach: Optional[bool] = None, + availability_policy: Optional["_models.AvailabilityPolicy"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class DiskPurchasePlan(_Model): + """Used for establishing the purchase context of any 3rd Party artifact through MarketPlace. + + :ivar name: The plan ID. Required. + :vartype name: str + :ivar publisher: The publisher ID. Required. + :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. Required. + :vartype product: str + :ivar promotion_code: The Offer Promotion Code. + :vartype promotion_code: str + """ + + name: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The plan ID. Required.""" + publisher: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The publisher ID. Required.""" + product: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Specifies the product of the image from the marketplace. This is the same value as Offer under + the imageReference element. Required.""" + promotion_code: Optional[str] = rest_field( + name="promotionCode", visibility=["read", "create", "update", "delete", "query"] + ) + """The Offer Promotion Code.""" + + @overload + def __init__( + self, + *, + name: str, + publisher: str, + product: str, + promotion_code: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ProxyResource(Resource): + """Proxy Resource. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.compute.models.SystemData + """ + + +class DiskRestorePoint(ProxyResource): + """Properties of disk restore point. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.compute.models.SystemData + :ivar properties: Properties of an incremental disk restore point. + :vartype properties: ~azure.mgmt.compute.models.DiskRestorePointProperties + """ + + properties: Optional["_models.DiskRestorePointProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Properties of an incremental disk restore point.""" + + @overload + def __init__( + self, + *, + properties: Optional["_models.DiskRestorePointProperties"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class SubResourceReadOnly(_Model): + """SubResourceReadOnly. + + :ivar id: Resource Id. + :vartype id: str + """ + + id: Optional[str] = rest_field(visibility=["read"]) + """Resource Id.""" + + +class DiskRestorePointAttributes(SubResourceReadOnly): + """Disk Restore Point details. + + :ivar id: Resource Id. + :vartype id: str + :ivar encryption: Encryption at rest settings for disk restore point. It is an optional + property that can be specified in the input while creating a restore point. + :vartype encryption: ~azure.mgmt.compute.models.RestorePointEncryption + :ivar source_disk_restore_point: Resource Id of the source disk restore point. + :vartype source_disk_restore_point: ~azure.mgmt.compute.models.ApiEntityReference + """ + + encryption: Optional["_models.RestorePointEncryption"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Encryption at rest settings for disk restore point. It is an optional property that can be + specified in the input while creating a restore point.""" + source_disk_restore_point: Optional["_models.ApiEntityReference"] = rest_field( + name="sourceDiskRestorePoint", visibility=["read", "create", "update", "delete", "query"] + ) + """Resource Id of the source disk restore point.""" + + @overload + def __init__( + self, + *, + encryption: Optional["_models.RestorePointEncryption"] = None, + source_disk_restore_point: Optional["_models.ApiEntityReference"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class DiskRestorePointInstanceView(_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.models.DiskRestorePointReplicationStatus + """ + + id: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Disk restore point Id.""" + replication_status: Optional["_models.DiskRestorePointReplicationStatus"] = rest_field( + name="replicationStatus", visibility=["read", "create", "update", "delete", "query"] + ) + """The disk restore point replication status information.""" + + @overload + def __init__( + self, + *, + id: Optional[str] = None, # pylint: disable=redefined-builtin + replication_status: Optional["_models.DiskRestorePointReplicationStatus"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class DiskRestorePointProperties(_Model): + """Properties of an incremental disk restore point. + + :ivar time_created: The timestamp of restorePoint creation. + :vartype time_created: ~datetime.datetime + :ivar source_resource_id: arm id of source disk or source disk restore point. + :vartype source_resource_id: str + :ivar os_type: The Operating System type. Known values are: "Windows" and "Linux". + :vartype os_type: str or ~azure.mgmt.compute.models.OperatingSystemTypes + :ivar hyper_v_generation: The hypervisor generation of the Virtual Machine. Applicable to OS + disks only. Known values are: "V1" and "V2". + :vartype hyper_v_generation: str or ~azure.mgmt.compute.models.HyperVGeneration + :ivar purchase_plan: Purchase plan information for the the image from which the OS disk was + created. + :vartype purchase_plan: ~azure.mgmt.compute.models.DiskPurchasePlan + :ivar supported_capabilities: List of supported capabilities for the image from which the OS + disk was created. + :vartype supported_capabilities: ~azure.mgmt.compute.models.SupportedCapabilities + :ivar family_id: id of the backing snapshot's MIS family. + :vartype family_id: str + :ivar source_unique_id: unique incarnation id of the source disk. + :vartype source_unique_id: str + :ivar encryption: Encryption property can be used to encrypt data at rest with customer managed + keys or platform managed keys. + :vartype encryption: ~azure.mgmt.compute.models.Encryption + :ivar supports_hibernation: Indicates the OS on a disk supports hibernation. + :vartype supports_hibernation: bool + :ivar network_access_policy: Policy for accessing the disk via network. Known values are: + "AllowAll", "AllowPrivate", and "DenyAll". + :vartype network_access_policy: str or ~azure.mgmt.compute.models.NetworkAccessPolicy + :ivar public_network_access: Policy for controlling export on the disk. Known values are: + "Enabled" and "Disabled". + :vartype public_network_access: str or ~azure.mgmt.compute.models.PublicNetworkAccess + :ivar disk_access_id: ARM id of the DiskAccess resource for using private endpoints on disks. + :vartype disk_access_id: str + :ivar completion_percent: Percentage complete for the background copy of disk restore point + when source resource is from a different region. + :vartype completion_percent: float + :ivar replication_state: Replication state of disk restore point when source resource is from a + different region. + :vartype replication_state: str + :ivar source_resource_location: Location of source disk or source disk restore point when + source resource is from a different region. + :vartype source_resource_location: str + :ivar security_profile: Contains the security related information for the resource. + :vartype security_profile: ~azure.mgmt.compute.models.DiskSecurityProfile + :ivar logical_sector_size: Logical sector size in bytes for disk restore points of UltraSSD_LRS + and PremiumV2_LRS disks. Supported values are 512 and 4096. 4096 is the default. + :vartype logical_sector_size: int + """ + + time_created: Optional[datetime.datetime] = rest_field(name="timeCreated", visibility=["read"], format="rfc3339") + """The timestamp of restorePoint creation.""" + source_resource_id: Optional[str] = rest_field(name="sourceResourceId", visibility=["read"]) + """arm id of source disk or source disk restore point.""" + os_type: Optional[Union[str, "_models.OperatingSystemTypes"]] = rest_field(name="osType", visibility=["read"]) + """The Operating System type. Known values are: \"Windows\" and \"Linux\".""" + hyper_v_generation: Optional[Union[str, "_models.HyperVGeneration"]] = rest_field( + name="hyperVGeneration", visibility=["read", "create", "update", "delete", "query"] + ) + """The hypervisor generation of the Virtual Machine. Applicable to OS disks only. Known values + are: \"V1\" and \"V2\".""" + purchase_plan: Optional["_models.DiskPurchasePlan"] = rest_field( + name="purchasePlan", visibility=["read", "create", "update", "delete", "query"] + ) + """Purchase plan information for the the image from which the OS disk was created.""" + supported_capabilities: Optional["_models.SupportedCapabilities"] = rest_field( + name="supportedCapabilities", visibility=["read", "create", "update", "delete", "query"] + ) + """List of supported capabilities for the image from which the OS disk was created.""" + family_id: Optional[str] = rest_field(name="familyId", visibility=["read"]) + """id of the backing snapshot's MIS family.""" + source_unique_id: Optional[str] = rest_field(name="sourceUniqueId", visibility=["read"]) + """unique incarnation id of the source disk.""" + encryption: Optional["_models.Encryption"] = rest_field(visibility=["read"]) + """Encryption property can be used to encrypt data at rest with customer managed keys or platform + managed keys.""" + supports_hibernation: Optional[bool] = rest_field( + name="supportsHibernation", visibility=["read", "create", "update", "delete", "query"] + ) + """Indicates the OS on a disk supports hibernation.""" + network_access_policy: Optional[Union[str, "_models.NetworkAccessPolicy"]] = rest_field( + name="networkAccessPolicy", visibility=["read", "create", "update", "delete", "query"] + ) + """Policy for accessing the disk via network. Known values are: \"AllowAll\", \"AllowPrivate\", + and \"DenyAll\".""" + public_network_access: Optional[Union[str, "_models.PublicNetworkAccess"]] = rest_field( + name="publicNetworkAccess", visibility=["read", "create", "update", "delete", "query"] + ) + """Policy for controlling export on the disk. Known values are: \"Enabled\" and \"Disabled\".""" + disk_access_id: Optional[str] = rest_field( + name="diskAccessId", visibility=["read", "create", "update", "delete", "query"] + ) + """ARM id of the DiskAccess resource for using private endpoints on disks.""" + completion_percent: Optional[float] = rest_field( + name="completionPercent", visibility=["read", "create", "update", "delete", "query"] + ) + """Percentage complete for the background copy of disk restore point when source resource is from + a different region.""" + replication_state: Optional[str] = rest_field(name="replicationState", visibility=["read"]) + """Replication state of disk restore point when source resource is from a different region.""" + source_resource_location: Optional[str] = rest_field(name="sourceResourceLocation", visibility=["read"]) + """Location of source disk or source disk restore point when source resource is from a different + region.""" + security_profile: Optional["_models.DiskSecurityProfile"] = rest_field( + name="securityProfile", visibility=["read", "create", "update", "delete", "query"] + ) + """Contains the security related information for the resource.""" + logical_sector_size: Optional[int] = rest_field(name="logicalSectorSize", visibility=["read"]) + """Logical sector size in bytes for disk restore points of UltraSSD_LRS and PremiumV2_LRS disks. + Supported values are 512 and 4096. 4096 is the default.""" + + @overload + def __init__( + self, + *, + hyper_v_generation: Optional[Union[str, "_models.HyperVGeneration"]] = None, + purchase_plan: Optional["_models.DiskPurchasePlan"] = None, + supported_capabilities: Optional["_models.SupportedCapabilities"] = None, + supports_hibernation: Optional[bool] = None, + network_access_policy: Optional[Union[str, "_models.NetworkAccessPolicy"]] = None, + public_network_access: Optional[Union[str, "_models.PublicNetworkAccess"]] = None, + disk_access_id: Optional[str] = None, + completion_percent: Optional[float] = None, + security_profile: Optional["_models.DiskSecurityProfile"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class DiskRestorePointReplicationStatus(_Model): + """The instance view of a disk restore point. + + :ivar status: The resource status information. + :vartype status: ~azure.mgmt.compute.models.InstanceViewStatus + :ivar completion_percent: Replication completion percentage. + :vartype completion_percent: int + """ + + status: Optional["_models.InstanceViewStatus"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The resource status information.""" + completion_percent: Optional[int] = rest_field( + name="completionPercent", visibility=["read", "create", "update", "delete", "query"] + ) + """Replication completion percentage.""" + + @overload + def __init__( + self, + *, + status: Optional["_models.InstanceViewStatus"] = None, + completion_percent: Optional[int] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class DiskSecurityProfile(_Model): + """Contains the security related information for the resource. + + :ivar security_type: Specifies the SecurityType of the VM. Applicable for OS disks only. Known + values are: "TrustedLaunch", "ConfidentialVM_VMGuestStateOnlyEncryptedWithPlatformKey", + "ConfidentialVM_DiskEncryptedWithPlatformKey", "ConfidentialVM_DiskEncryptedWithCustomerKey", + and "ConfidentialVM_NonPersistedTPM". + :vartype security_type: str or ~azure.mgmt.compute.models.DiskSecurityTypes + :ivar secure_vm_disk_encryption_set_id: ResourceId of the disk encryption set associated to + Confidential VM supported disk encrypted with customer managed key. + :vartype secure_vm_disk_encryption_set_id: str + """ + + security_type: Optional[Union[str, "_models.DiskSecurityTypes"]] = rest_field( + name="securityType", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies the SecurityType of the VM. Applicable for OS disks only. Known values are: + \"TrustedLaunch\", \"ConfidentialVM_VMGuestStateOnlyEncryptedWithPlatformKey\", + \"ConfidentialVM_DiskEncryptedWithPlatformKey\", + \"ConfidentialVM_DiskEncryptedWithCustomerKey\", and \"ConfidentialVM_NonPersistedTPM\".""" + secure_vm_disk_encryption_set_id: Optional[str] = rest_field( + name="secureVMDiskEncryptionSetId", visibility=["read", "create", "update", "delete", "query"] + ) + """ResourceId of the disk encryption set associated to Confidential VM supported disk encrypted + with customer managed key.""" + + @overload + def __init__( + self, + *, + security_type: Optional[Union[str, "_models.DiskSecurityTypes"]] = None, + secure_vm_disk_encryption_set_id: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class DiskSku(_Model): + """The disks sku name. Can be Standard_LRS, Premium_LRS, StandardSSD_LRS, UltraSSD_LRS, + Premium_ZRS, StandardSSD_ZRS, or PremiumV2_LRS. + + :ivar name: The sku name. Known values are: "Standard_LRS", "Premium_LRS", "StandardSSD_LRS", + "UltraSSD_LRS", "Premium_ZRS", "StandardSSD_ZRS", and "PremiumV2_LRS". + :vartype name: str or ~azure.mgmt.compute.models.DiskStorageAccountTypes + :ivar tier: The sku tier. + :vartype tier: str + """ + + name: Optional[Union[str, "_models.DiskStorageAccountTypes"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The sku name. Known values are: \"Standard_LRS\", \"Premium_LRS\", \"StandardSSD_LRS\", + \"UltraSSD_LRS\", \"Premium_ZRS\", \"StandardSSD_ZRS\", and \"PremiumV2_LRS\".""" + tier: Optional[str] = rest_field(visibility=["read"]) + """The sku tier.""" + + @overload + def __init__( + self, + *, + name: Optional[Union[str, "_models.DiskStorageAccountTypes"]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class DiskUpdate(_Model): + """Disk update resource. + + :ivar properties: Disk resource update properties. + :vartype properties: ~azure.mgmt.compute.models.DiskUpdateProperties + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar sku: The disks sku name. Can be Standard_LRS, Premium_LRS, StandardSSD_LRS, UltraSSD_LRS, + Premium_ZRS, StandardSSD_ZRS, or PremiumV2_LRS. + :vartype sku: ~azure.mgmt.compute.models.DiskSku + """ + + properties: Optional["_models.DiskUpdateProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Disk resource update properties.""" + tags: Optional[dict[str, str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Resource tags.""" + sku: Optional["_models.DiskSku"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The disks sku name. Can be Standard_LRS, Premium_LRS, StandardSSD_LRS, UltraSSD_LRS, + Premium_ZRS, StandardSSD_ZRS, or PremiumV2_LRS.""" + + @overload + def __init__( + self, + *, + properties: Optional["_models.DiskUpdateProperties"] = None, + tags: Optional[dict[str, str]] = None, + sku: Optional["_models.DiskSku"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class DiskUpdateProperties(_Model): + """Disk resource update properties. + + :ivar os_type: the Operating System type. Known values are: "Windows" and "Linux". + :vartype os_type: str or ~azure.mgmt.compute.models.OperatingSystemTypes + :ivar disk_size_gb: If creationData.createOption is Empty, this field is mandatory and it + indicates the size of the disk to create. If this field is present for updates or creation with + other options, it indicates a resize. Resizes are only allowed if the disk is not attached to a + running VM, and can only increase the disk's size. + :vartype disk_size_gb: int + :ivar encryption_settings_collection: Encryption settings collection used be Azure Disk + Encryption, can contain multiple encryption settings per disk or snapshot. + :vartype encryption_settings_collection: + ~azure.mgmt.compute.models.EncryptionSettingsCollection + :ivar disk_iops_read_write: The number of IOPS allowed for this disk; only settable for + UltraSSD disks. One operation can transfer between 4k and 256k bytes. + :vartype disk_iops_read_write: int + :ivar disk_m_bps_read_write: The bandwidth allowed for this disk; only settable for UltraSSD + disks. MBps means millions of bytes per second - MB here uses the ISO notation, of powers of + 10. + :vartype disk_m_bps_read_write: int + :ivar disk_iops_read_only: The total number of IOPS that will be allowed across all VMs + mounting the shared disk as ReadOnly. One operation can transfer between 4k and 256k bytes. + :vartype disk_iops_read_only: int + :ivar disk_m_bps_read_only: The total throughput (MBps) that will be allowed across all VMs + mounting the shared disk as ReadOnly. MBps means millions of bytes per second - MB here uses + the ISO notation, of powers of 10. + :vartype disk_m_bps_read_only: int + :ivar max_shares: The maximum number of VMs that can attach to the disk at the same time. Value + greater than one indicates a disk that can be mounted on multiple VMs at the same time. + :vartype max_shares: int + :ivar encryption: Encryption property can be used to encrypt data at rest with customer managed + keys or platform managed keys. + :vartype encryption: ~azure.mgmt.compute.models.Encryption + :ivar network_access_policy: Policy for accessing the disk via network. Known values are: + "AllowAll", "AllowPrivate", and "DenyAll". + :vartype network_access_policy: str or ~azure.mgmt.compute.models.NetworkAccessPolicy + :ivar disk_access_id: ARM id of the DiskAccess resource for using private endpoints on disks. + :vartype disk_access_id: str + :ivar tier: Performance tier of the disk (e.g, P4, S10) as described here: + `https://azure.microsoft.com/en-us/pricing/details/managed-disks/ + `_. Does not apply to Ultra + disks. + :vartype tier: str + :ivar bursting_enabled: Set to true to enable bursting beyond the provisioned performance + target of the disk. Bursting is disabled by default. Does not apply to Ultra disks. + :vartype bursting_enabled: bool + :ivar purchase_plan: Purchase plan information to be added on the OS disk. + :vartype purchase_plan: ~azure.mgmt.compute.models.DiskPurchasePlan + :ivar supported_capabilities: List of supported capabilities to be added on the OS disk. + :vartype supported_capabilities: ~azure.mgmt.compute.models.SupportedCapabilities + :ivar property_updates_in_progress: Properties of the disk for which update is pending. + :vartype property_updates_in_progress: ~azure.mgmt.compute.models.PropertyUpdatesInProgress + :ivar supports_hibernation: Indicates the OS on a disk supports hibernation. + :vartype supports_hibernation: bool + :ivar public_network_access: Policy for controlling export on the disk. Known values are: + "Enabled" and "Disabled". + :vartype public_network_access: str or ~azure.mgmt.compute.models.PublicNetworkAccess + :ivar data_access_auth_mode: Additional authentication requirements when exporting or uploading + to a disk or snapshot. Known values are: "AzureActiveDirectory" and "None". + :vartype data_access_auth_mode: str or ~azure.mgmt.compute.models.DataAccessAuthMode + :ivar optimized_for_frequent_attach: Setting this property to true improves reliability and + performance of data disks that are frequently (more than 5 times a day) by detached from one + virtual machine and attached to another. This property should not be set for disks that are not + detached and attached frequently as it causes the disks to not align with the fault domain of + the virtual machine. + :vartype optimized_for_frequent_attach: bool + :ivar availability_policy: Determines how platform treats disk failures. + :vartype availability_policy: ~azure.mgmt.compute.models.AvailabilityPolicy + """ + + os_type: Optional[Union[str, "_models.OperatingSystemTypes"]] = rest_field( + name="osType", visibility=["read", "create", "update", "delete", "query"] + ) + """the Operating System type. Known values are: \"Windows\" and \"Linux\".""" + disk_size_gb: Optional[int] = rest_field( + name="diskSizeGB", visibility=["read", "create", "update", "delete", "query"] + ) + """If creationData.createOption is Empty, this field is mandatory and it indicates the size of the + disk to create. If this field is present for updates or creation with other options, it + indicates a resize. Resizes are only allowed if the disk is not attached to a running VM, and + can only increase the disk's size.""" + encryption_settings_collection: Optional["_models.EncryptionSettingsCollection"] = rest_field( + name="encryptionSettingsCollection", visibility=["read", "create", "update", "delete", "query"] + ) + """Encryption settings collection used be Azure Disk Encryption, can contain multiple encryption + settings per disk or snapshot.""" + disk_iops_read_write: Optional[int] = rest_field( + name="diskIOPSReadWrite", visibility=["read", "create", "update", "delete", "query"] + ) + """The number of IOPS allowed for this disk; only settable for UltraSSD disks. One operation can + transfer between 4k and 256k bytes.""" + disk_m_bps_read_write: Optional[int] = rest_field( + name="diskMBpsReadWrite", visibility=["read", "create", "update", "delete", "query"] + ) + """The bandwidth allowed for this disk; only settable for UltraSSD disks. MBps means millions of + bytes per second - MB here uses the ISO notation, of powers of 10.""" + disk_iops_read_only: Optional[int] = rest_field( + name="diskIOPSReadOnly", visibility=["read", "create", "update", "delete", "query"] + ) + """The total number of IOPS that will be allowed across all VMs mounting the shared disk as + ReadOnly. One operation can transfer between 4k and 256k bytes.""" + disk_m_bps_read_only: Optional[int] = rest_field( + name="diskMBpsReadOnly", visibility=["read", "create", "update", "delete", "query"] + ) + """The total throughput (MBps) that will be allowed across all VMs mounting the shared disk as + ReadOnly. MBps means millions of bytes per second - MB here uses the ISO notation, of powers of + 10.""" + max_shares: Optional[int] = rest_field(name="maxShares", visibility=["read", "create", "update", "delete", "query"]) + """The maximum number of VMs that can attach to the disk at the same time. Value greater than one + indicates a disk that can be mounted on multiple VMs at the same time.""" + encryption: Optional["_models.Encryption"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Encryption property can be used to encrypt data at rest with customer managed keys or platform + managed keys.""" + network_access_policy: Optional[Union[str, "_models.NetworkAccessPolicy"]] = rest_field( + name="networkAccessPolicy", visibility=["read", "create", "update", "delete", "query"] + ) + """Policy for accessing the disk via network. Known values are: \"AllowAll\", \"AllowPrivate\", + and \"DenyAll\".""" + disk_access_id: Optional[str] = rest_field( + name="diskAccessId", visibility=["read", "create", "update", "delete", "query"] + ) + """ARM id of the DiskAccess resource for using private endpoints on disks.""" + tier: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Performance tier of the disk (e.g, P4, S10) as described here: + `https://azure.microsoft.com/en-us/pricing/details/managed-disks/ + `_. Does not apply to Ultra + disks.""" + bursting_enabled: Optional[bool] = rest_field( + name="burstingEnabled", visibility=["read", "create", "update", "delete", "query"] + ) + """Set to true to enable bursting beyond the provisioned performance target of the disk. Bursting + is disabled by default. Does not apply to Ultra disks.""" + purchase_plan: Optional["_models.DiskPurchasePlan"] = rest_field( + name="purchasePlan", visibility=["read", "create", "update", "delete", "query"] + ) + """Purchase plan information to be added on the OS disk.""" + supported_capabilities: Optional["_models.SupportedCapabilities"] = rest_field( + name="supportedCapabilities", visibility=["read", "create", "update", "delete", "query"] + ) + """List of supported capabilities to be added on the OS disk.""" + property_updates_in_progress: Optional["_models.PropertyUpdatesInProgress"] = rest_field( + name="propertyUpdatesInProgress", visibility=["read"] + ) + """Properties of the disk for which update is pending.""" + supports_hibernation: Optional[bool] = rest_field( + name="supportsHibernation", visibility=["read", "create", "update", "delete", "query"] + ) + """Indicates the OS on a disk supports hibernation.""" + public_network_access: Optional[Union[str, "_models.PublicNetworkAccess"]] = rest_field( + name="publicNetworkAccess", visibility=["read", "create", "update", "delete", "query"] + ) + """Policy for controlling export on the disk. Known values are: \"Enabled\" and \"Disabled\".""" + data_access_auth_mode: Optional[Union[str, "_models.DataAccessAuthMode"]] = rest_field( + name="dataAccessAuthMode", visibility=["read", "create", "update", "delete", "query"] + ) + """Additional authentication requirements when exporting or uploading to a disk or snapshot. Known + values are: \"AzureActiveDirectory\" and \"None\".""" + optimized_for_frequent_attach: Optional[bool] = rest_field( + name="optimizedForFrequentAttach", visibility=["read", "create", "update", "delete", "query"] + ) + """Setting this property to true improves reliability and performance of data disks that are + frequently (more than 5 times a day) by detached from one virtual machine and attached to + another. This property should not be set for disks that are not detached and attached + frequently as it causes the disks to not align with the fault domain of the virtual machine.""" + availability_policy: Optional["_models.AvailabilityPolicy"] = rest_field( + name="availabilityPolicy", visibility=["read", "create", "update", "delete", "query"] + ) + """Determines how platform treats disk failures.""" + + @overload + def __init__( + self, + *, + os_type: Optional[Union[str, "_models.OperatingSystemTypes"]] = None, + disk_size_gb: Optional[int] = None, + encryption_settings_collection: Optional["_models.EncryptionSettingsCollection"] = None, + disk_iops_read_write: Optional[int] = None, + disk_m_bps_read_write: Optional[int] = None, + disk_iops_read_only: Optional[int] = None, + disk_m_bps_read_only: Optional[int] = None, + max_shares: Optional[int] = None, + encryption: Optional["_models.Encryption"] = None, + network_access_policy: Optional[Union[str, "_models.NetworkAccessPolicy"]] = None, + disk_access_id: Optional[str] = None, + tier: Optional[str] = None, + bursting_enabled: Optional[bool] = None, + purchase_plan: Optional["_models.DiskPurchasePlan"] = None, + supported_capabilities: Optional["_models.SupportedCapabilities"] = None, + supports_hibernation: Optional[bool] = None, + public_network_access: Optional[Union[str, "_models.PublicNetworkAccess"]] = None, + data_access_auth_mode: Optional[Union[str, "_models.DataAccessAuthMode"]] = None, + optimized_for_frequent_attach: Optional[bool] = None, + availability_policy: Optional["_models.AvailabilityPolicy"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class Encryption(_Model): + """Encryption at rest settings for disk or snapshot. + + :ivar disk_encryption_set_id: ResourceId of the disk encryption set to use for enabling + encryption at rest. + :vartype disk_encryption_set_id: str + :ivar type: The type of key used to encrypt the data of the disk. Known values are: + "EncryptionAtRestWithPlatformKey", "EncryptionAtRestWithCustomerKey", and + "EncryptionAtRestWithPlatformAndCustomerKeys". + :vartype type: str or ~azure.mgmt.compute.models.EncryptionType + """ + + disk_encryption_set_id: Optional[str] = rest_field( + name="diskEncryptionSetId", visibility=["read", "create", "update", "delete", "query"] + ) + """ResourceId of the disk encryption set to use for enabling encryption at rest.""" + type: Optional[Union[str, "_models.EncryptionType"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The type of key used to encrypt the data of the disk. Known values are: + \"EncryptionAtRestWithPlatformKey\", \"EncryptionAtRestWithCustomerKey\", and + \"EncryptionAtRestWithPlatformAndCustomerKeys\".""" + + @overload + def __init__( + self, + *, + disk_encryption_set_id: Optional[str] = None, + type: Optional[Union[str, "_models.EncryptionType"]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class EncryptionIdentity(_Model): + """Specifies the Managed Identity used by ADE to get access token for keyvault operations. + + :ivar user_assigned_identity_resource_id: Specifies ARM Resource ID of one of the user + identities associated with the VM. + :vartype user_assigned_identity_resource_id: str + """ + + user_assigned_identity_resource_id: Optional[str] = rest_field( + name="userAssignedIdentityResourceId", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies ARM Resource ID of one of the user identities associated with the VM.""" + + @overload + def __init__( + self, + *, + user_assigned_identity_resource_id: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class EncryptionImages(_Model): + """Optional. Allows users to provide customer managed keys for encrypting the OS and data disks in + the gallery artifact. + + :ivar os_disk_image: Contains encryption settings for an OS disk image. + :vartype os_disk_image: ~azure.mgmt.compute.models.OSDiskImageEncryption + :ivar data_disk_images: A list of encryption specifications for data disk images. + :vartype data_disk_images: list[~azure.mgmt.compute.models.DataDiskImageEncryption] + """ + + os_disk_image: Optional["_models.OSDiskImageEncryption"] = rest_field( + name="osDiskImage", visibility=["read", "create", "update", "delete", "query"] + ) + """Contains encryption settings for an OS disk image.""" + data_disk_images: Optional[list["_models.DataDiskImageEncryption"]] = rest_field( + name="dataDiskImages", visibility=["read", "create", "update", "delete", "query"] + ) + """A list of encryption specifications for data disk images.""" + + @overload + def __init__( + self, + *, + os_disk_image: Optional["_models.OSDiskImageEncryption"] = None, + data_disk_images: Optional[list["_models.DataDiskImageEncryption"]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class EncryptionSetIdentity(_Model): + """The managed identity for the disk encryption set. It should be given permission on the key + vault before it can be used to encrypt disks. + + :ivar type: The type of Managed Identity used by the DiskEncryptionSet. Only SystemAssigned is + supported for new creations. Disk Encryption Sets can be updated with Identity type None during + migration of subscription to a new Azure Active Directory tenant; it will cause the encrypted + resources to lose access to the keys. Known values are: "SystemAssigned", "UserAssigned", + "SystemAssigned, UserAssigned", and "None". + :vartype type: str or ~azure.mgmt.compute.models.DiskEncryptionSetIdentityType + :ivar principal_id: The object id of the Managed Identity Resource. This will be sent to the RP + from ARM via the x-ms-identity-principal-id header in the PUT request if the resource has a + systemAssigned(implicit) identity. + :vartype principal_id: str + :ivar tenant_id: The tenant id of the Managed Identity Resource. This will be sent to the RP + from ARM via the x-ms-client-tenant-id header in the PUT request if the resource has a + systemAssigned(implicit) identity. + :vartype tenant_id: str + :ivar user_assigned_identities: The list of user identities associated with the disk encryption + 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.models.UserAssignedIdentitiesValue] + """ + + type: Optional[Union[str, "_models.DiskEncryptionSetIdentityType"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The type of Managed Identity used by the DiskEncryptionSet. Only SystemAssigned is supported + for new creations. Disk Encryption Sets can be updated with Identity type None during migration + of subscription to a new Azure Active Directory tenant; it will cause the encrypted resources + to lose access to the keys. Known values are: \"SystemAssigned\", \"UserAssigned\", + \"SystemAssigned, UserAssigned\", and \"None\".""" + principal_id: Optional[str] = rest_field(name="principalId", visibility=["read"]) + """The object id of the Managed Identity Resource. This will be sent to the RP from ARM via the + x-ms-identity-principal-id header in the PUT request if the resource has a + systemAssigned(implicit) identity.""" + tenant_id: Optional[str] = rest_field(name="tenantId", visibility=["read"]) + """The tenant id of the Managed Identity Resource. This will be sent to the RP from ARM via the + x-ms-client-tenant-id header in the PUT request if the resource has a systemAssigned(implicit) + identity.""" + user_assigned_identities: Optional[dict[str, "_models.UserAssignedIdentitiesValue"]] = rest_field( + name="userAssignedIdentities", visibility=["read", "create", "update", "delete", "query"] + ) + """The list of user identities associated with the disk encryption set. The user identity + dictionary key references will be ARM resource ids in the form: + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'.""" + + @overload + def __init__( + self, + *, + type: Optional[Union[str, "_models.DiskEncryptionSetIdentityType"]] = None, + user_assigned_identities: Optional[dict[str, "_models.UserAssignedIdentitiesValue"]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class EncryptionSetProperties(_Model): + """EncryptionSetProperties. + + :ivar encryption_type: The type of key used to encrypt the data of the disk. Known values are: + "EncryptionAtRestWithCustomerKey", "EncryptionAtRestWithPlatformAndCustomerKeys", and + "ConfidentialVmEncryptedWithCustomerKey". + :vartype encryption_type: str or ~azure.mgmt.compute.models.DiskEncryptionSetType + :ivar active_key: The key vault key which is currently used by this disk encryption set. + :vartype active_key: ~azure.mgmt.compute.models.KeyForDiskEncryptionSet + :ivar previous_keys: A readonly collection of key vault keys previously used by this disk + encryption set while a key rotation is in progress. It will be empty if there is no ongoing key + rotation. + :vartype previous_keys: list[~azure.mgmt.compute.models.KeyForDiskEncryptionSet] + :ivar provisioning_state: The disk encryption set provisioning state. + :vartype provisioning_state: str + :ivar rotation_to_latest_key_version_enabled: Set this flag to true to enable auto-updating of + this disk encryption set to the latest key version. + :vartype rotation_to_latest_key_version_enabled: bool + :ivar last_key_rotation_timestamp: The time when the active key of this disk encryption set was + updated. + :vartype last_key_rotation_timestamp: ~datetime.datetime + :ivar auto_key_rotation_error: The error that was encountered during auto-key rotation. If an + error is present, then auto-key rotation will not be attempted until the error on this disk + encryption set is fixed. + :vartype auto_key_rotation_error: ~azure.mgmt.compute.models.ApiError + :ivar federated_client_id: Multi-tenant application client id to access key vault in a + different tenant. Setting the value to 'None' will clear the property. + :vartype federated_client_id: str + """ + + encryption_type: Optional[Union[str, "_models.DiskEncryptionSetType"]] = rest_field( + name="encryptionType", visibility=["read", "create", "update", "delete", "query"] + ) + """The type of key used to encrypt the data of the disk. Known values are: + \"EncryptionAtRestWithCustomerKey\", \"EncryptionAtRestWithPlatformAndCustomerKeys\", and + \"ConfidentialVmEncryptedWithCustomerKey\".""" + active_key: Optional["_models.KeyForDiskEncryptionSet"] = rest_field( + name="activeKey", visibility=["read", "create", "update", "delete", "query"] + ) + """The key vault key which is currently used by this disk encryption set.""" + previous_keys: Optional[list["_models.KeyForDiskEncryptionSet"]] = rest_field( + name="previousKeys", visibility=["read"] + ) + """A readonly collection of key vault keys previously used by this disk encryption set while a key + rotation is in progress. It will be empty if there is no ongoing key rotation.""" + provisioning_state: Optional[str] = rest_field(name="provisioningState", visibility=["read"]) + """The disk encryption set provisioning state.""" + rotation_to_latest_key_version_enabled: Optional[bool] = rest_field( + name="rotationToLatestKeyVersionEnabled", visibility=["read", "create", "update", "delete", "query"] + ) + """Set this flag to true to enable auto-updating of this disk encryption set to the latest key + version.""" + last_key_rotation_timestamp: Optional[datetime.datetime] = rest_field( + name="lastKeyRotationTimestamp", visibility=["read"], format="rfc3339" + ) + """The time when the active key of this disk encryption set was updated.""" + auto_key_rotation_error: Optional["_models.ApiError"] = rest_field(name="autoKeyRotationError", visibility=["read"]) + """The error that was encountered during auto-key rotation. If an error is present, then auto-key + rotation will not be attempted until the error on this disk encryption set is fixed.""" + federated_client_id: Optional[str] = rest_field( + name="federatedClientId", visibility=["read", "create", "update", "delete", "query"] + ) + """Multi-tenant application client id to access key vault in a different tenant. Setting the value + to 'None' will clear the property.""" + + @overload + def __init__( + self, + *, + encryption_type: Optional[Union[str, "_models.DiskEncryptionSetType"]] = None, + active_key: Optional["_models.KeyForDiskEncryptionSet"] = None, + rotation_to_latest_key_version_enabled: Optional[bool] = None, + federated_client_id: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class EncryptionSettingsCollection(_Model): + """Encryption settings for disk or snapshot. + + :ivar enabled: Set this flag to true and provide DiskEncryptionKey and optional + KeyEncryptionKey to enable encryption. Set this flag to false and remove DiskEncryptionKey and + KeyEncryptionKey to disable encryption. If EncryptionSettings is null in the request object, + the existing settings remain unchanged. Required. + :vartype enabled: bool + :ivar encryption_settings: A collection of encryption settings, one for each disk volume. + :vartype encryption_settings: list[~azure.mgmt.compute.models.EncryptionSettingsElement] + :ivar encryption_settings_version: Describes what type of encryption is used for the disks. + Once this field is set, it cannot be overwritten. '1.0' corresponds to Azure Disk Encryption + with AAD app.'1.1' corresponds to Azure Disk Encryption. + :vartype encryption_settings_version: str + """ + + enabled: bool = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Set this flag to true and provide DiskEncryptionKey and optional KeyEncryptionKey to enable + encryption. Set this flag to false and remove DiskEncryptionKey and KeyEncryptionKey to disable + encryption. If EncryptionSettings is null in the request object, the existing settings remain + unchanged. Required.""" + encryption_settings: Optional[list["_models.EncryptionSettingsElement"]] = rest_field( + name="encryptionSettings", visibility=["read", "create", "update", "delete", "query"] + ) + """A collection of encryption settings, one for each disk volume.""" + encryption_settings_version: Optional[str] = rest_field( + name="encryptionSettingsVersion", visibility=["read", "create", "update", "delete", "query"] + ) + """Describes what type of encryption is used for the disks. Once this field is set, it cannot be + overwritten. '1.0' corresponds to Azure Disk Encryption with AAD app.'1.1' corresponds to Azure + Disk Encryption.""" + + @overload + def __init__( + self, + *, + enabled: bool, + encryption_settings: Optional[list["_models.EncryptionSettingsElement"]] = None, + encryption_settings_version: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class EncryptionSettingsElement(_Model): + """Encryption settings for one disk volume. + + :ivar disk_encryption_key: Key Vault Secret Url and vault id of the disk encryption key. + :vartype disk_encryption_key: ~azure.mgmt.compute.models.KeyVaultAndSecretReference + :ivar key_encryption_key: Key Vault Key Url and vault id of the key encryption key. + KeyEncryptionKey is optional and when provided is used to unwrap the disk encryption key. + :vartype key_encryption_key: ~azure.mgmt.compute.models.KeyVaultAndKeyReference + """ + + disk_encryption_key: Optional["_models.KeyVaultAndSecretReference"] = rest_field( + name="diskEncryptionKey", visibility=["read", "create", "update", "delete", "query"] + ) + """Key Vault Secret Url and vault id of the disk encryption key.""" + key_encryption_key: Optional["_models.KeyVaultAndKeyReference"] = rest_field( + name="keyEncryptionKey", visibility=["read", "create", "update", "delete", "query"] + ) + """Key Vault Key Url and vault id of the key encryption key. KeyEncryptionKey is optional and when + provided is used to unwrap the disk encryption key.""" + + @overload + def __init__( + self, + *, + disk_encryption_key: Optional["_models.KeyVaultAndSecretReference"] = None, + key_encryption_key: Optional["_models.KeyVaultAndKeyReference"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ErrorAdditionalInfo(_Model): + """The resource management error additional info. + + :ivar type: The additional info type. + :vartype type: str + :ivar info: The additional info. + :vartype info: any + """ + + type: Optional[str] = rest_field(visibility=["read"]) + """The additional info type.""" + info: Optional[Any] = rest_field(visibility=["read"]) + """The additional info.""" + + +class ErrorDetail(_Model): + """The error detail. + + :ivar code: The error code. + :vartype code: str + :ivar message: The error message. + :vartype message: str + :ivar target: The error target. + :vartype target: str + :ivar details: The error details. + :vartype details: list[~azure.mgmt.compute.models.ErrorDetail] + :ivar additional_info: The error additional info. + :vartype additional_info: list[~azure.mgmt.compute.models.ErrorAdditionalInfo] + """ + + code: Optional[str] = rest_field(visibility=["read"]) + """The error code.""" + message: Optional[str] = rest_field(visibility=["read"]) + """The error message.""" + target: Optional[str] = rest_field(visibility=["read"]) + """The error target.""" + details: Optional[list["_models.ErrorDetail"]] = rest_field(visibility=["read"]) + """The error details.""" + additional_info: Optional[list["_models.ErrorAdditionalInfo"]] = rest_field( + name="additionalInfo", visibility=["read"] + ) + """The error additional info.""" + + +class ErrorResponse(_Model): + """Error response. + + :ivar error: The error object. + :vartype error: ~azure.mgmt.compute.models.ErrorDetail + """ + + error: Optional["_models.ErrorDetail"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The error object.""" + + @overload + def __init__( + self, + *, + error: Optional["_models.ErrorDetail"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class EventGridAndResourceGraph(_Model): + """Specifies eventGridAndResourceGraph related Scheduled Event related configurations. + + :ivar enable: Specifies if event grid and resource graph is enabled for Scheduled event related + configurations. + :vartype enable: bool + :ivar scheduled_events_api_version: Specifies the api-version to determine which Scheduled + Events configuration schema version will be delivered. + :vartype scheduled_events_api_version: str + """ + + enable: Optional[bool] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Specifies if event grid and resource graph is enabled for Scheduled event related + configurations.""" + scheduled_events_api_version: Optional[str] = rest_field( + name="scheduledEventsApiVersion", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies the api-version to determine which Scheduled Events configuration schema version will + be delivered.""" + + @overload + def __init__( + self, + *, + enable: Optional[bool] = None, + scheduled_events_api_version: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ExecutedValidation(_Model): + """This is the executed Validation. + + :ivar type: This property specifies the type of image version validation. + :vartype type: str + :ivar status: This property specifies the status of the validationProfile of the image version. + Known values are: "Unknown", "Failed", and "Succeeded". + :vartype status: str or ~azure.mgmt.compute.models.ValidationStatus + :ivar version: This property specifies the valid version of the validation. + :vartype version: str + :ivar execution_time: This property specifies the starting timestamp. + :vartype execution_time: ~datetime.datetime + """ + + type: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """This property specifies the type of image version validation.""" + status: Optional[Union[str, "_models.ValidationStatus"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """This property specifies the status of the validationProfile of the image version. Known values + are: \"Unknown\", \"Failed\", and \"Succeeded\".""" + version: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """This property specifies the valid version of the validation.""" + execution_time: Optional[datetime.datetime] = rest_field( + name="executionTime", visibility=["read", "create", "update", "delete", "query"], format="rfc3339" + ) + """This property specifies the starting timestamp.""" + + @overload + def __init__( + self, + *, + type: Optional[str] = None, + status: Optional[Union[str, "_models.ValidationStatus"]] = None, + version: Optional[str] = None, + execution_time: Optional[datetime.datetime] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ExtendedLocation(_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. "EdgeZone" + :vartype type: str or ~azure.mgmt.compute.models.ExtendedLocationTypes + """ + + name: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The name of the extended location.""" + type: Optional[Union[str, "_models.ExtendedLocationTypes"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The type of the extended location. \"EdgeZone\"""" + + @overload + def __init__( + self, + *, + name: Optional[str] = None, + type: Optional[Union[str, "_models.ExtendedLocationTypes"]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class Gallery(TrackedResource): + """Specifies information about the Shared Image Gallery that you want to create or update. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.compute.models.SystemData + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar location: The geo-location where the resource lives. Required. + :vartype location: str + :ivar properties: Describes the properties of a Shared Image Gallery. + :vartype properties: ~azure.mgmt.compute.models.GalleryProperties + :ivar identity: The identity of the gallery, if configured. + :vartype identity: ~azure.mgmt.compute.models.GalleryIdentity + """ + + properties: Optional["_models.GalleryProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Describes the properties of a Shared Image Gallery.""" + identity: Optional["_models.GalleryIdentity"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The identity of the gallery, if configured.""" + + @overload + def __init__( + self, + *, + location: str, + tags: Optional[dict[str, str]] = None, + properties: Optional["_models.GalleryProperties"] = None, + identity: Optional["_models.GalleryIdentity"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class GalleryApplication(TrackedResource): + """Specifies information about the gallery Application Definition that you want to create or + update. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.compute.models.SystemData + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar location: The geo-location where the resource lives. Required. + :vartype location: str + :ivar properties: Describes the properties of a gallery Application Definition. + :vartype properties: ~azure.mgmt.compute.models.GalleryApplicationProperties + """ + + properties: Optional["_models.GalleryApplicationProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Describes the properties of a gallery Application Definition.""" + + @overload + def __init__( + self, + *, + location: str, + tags: Optional[dict[str, str]] = None, + properties: Optional["_models.GalleryApplicationProperties"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class GalleryApplicationCustomAction(_Model): + """A custom action that can be performed with a Gallery Application Version. + + :ivar name: The name of the custom action. Must be unique within the Gallery Application + Version. Required. + :vartype name: str + :ivar script: The script to run when executing this custom action. Required. + :vartype script: str + :ivar description: Description to help the users understand what this custom action does. + :vartype description: str + :ivar parameters: The parameters that this custom action uses. + :vartype parameters: list[~azure.mgmt.compute.models.GalleryApplicationCustomActionParameter] + """ + + name: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The name of the custom action. Must be unique within the Gallery Application Version. + Required.""" + script: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The script to run when executing this custom action. Required.""" + description: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Description to help the users understand what this custom action does.""" + parameters: Optional[list["_models.GalleryApplicationCustomActionParameter"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The parameters that this custom action uses.""" + + @overload + def __init__( + self, + *, + name: str, + script: str, + description: Optional[str] = None, + parameters: Optional[list["_models.GalleryApplicationCustomActionParameter"]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class GalleryApplicationCustomActionParameter(_Model): + """The definition of a parameter that can be passed to a custom action of a Gallery Application + Version. + + :ivar name: The name of the custom action. Must be unique within the Gallery Application + Version. Required. + :vartype name: str + :ivar required: Indicates whether this parameter must be passed when running the custom action. + :vartype required: bool + :ivar type: Specifies the type of the custom action parameter. Possible values are: String, + ConfigurationDataBlob or LogOutputBlob. Known values are: "String", "ConfigurationDataBlob", + and "LogOutputBlob". + :vartype type: str or ~azure.mgmt.compute.models.GalleryApplicationCustomActionParameterType + :ivar default_value: The default value of the parameter. Only applies to string types. + :vartype default_value: str + :ivar description: A description to help users understand what this parameter means. + :vartype description: str + """ + + name: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The name of the custom action. Must be unique within the Gallery Application Version. + Required.""" + required: Optional[bool] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Indicates whether this parameter must be passed when running the custom action.""" + type: Optional[Union[str, "_models.GalleryApplicationCustomActionParameterType"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies the type of the custom action parameter. Possible values are: String, + ConfigurationDataBlob or LogOutputBlob. Known values are: \"String\", + \"ConfigurationDataBlob\", and \"LogOutputBlob\".""" + default_value: Optional[str] = rest_field( + name="defaultValue", visibility=["read", "create", "update", "delete", "query"] + ) + """The default value of the parameter. Only applies to string types.""" + description: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """A description to help users understand what this parameter means.""" + + @overload + def __init__( + self, + *, + name: str, + required: Optional[bool] = None, + type: Optional[Union[str, "_models.GalleryApplicationCustomActionParameterType"]] = None, + default_value: Optional[str] = None, + description: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class GalleryApplicationProperties(_Model): + """Describes the properties of a gallery Application Definition. + + :ivar description: The description of this gallery Application Definition resource. This + property is updatable. + :vartype description: str + :ivar eula: The Eula agreement for the gallery Application Definition. + :vartype eula: str + :ivar privacy_statement_uri: The privacy statement uri. + :vartype privacy_statement_uri: str + :ivar release_note_uri: The release note uri. + :vartype release_note_uri: str + :ivar end_of_life_date: The end of life date of the gallery Application Definition. This + property can be used for decommissioning purposes. This property is updatable. + :vartype end_of_life_date: ~datetime.datetime + :ivar supported_os_type: This property allows you to specify the supported type of the OS that + application is built for. Possible values are: **Windows,** **Linux.**. Required. Known values + are: "Windows" and "Linux". + :vartype supported_os_type: str or ~azure.mgmt.compute.models.OperatingSystemTypes + :ivar custom_actions: A list of custom actions that can be performed with all of the Gallery + Application Versions within this Gallery Application. + :vartype custom_actions: list[~azure.mgmt.compute.models.GalleryApplicationCustomAction] + """ + + description: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The description of this gallery Application Definition resource. This property is updatable.""" + eula: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The Eula agreement for the gallery Application Definition.""" + privacy_statement_uri: Optional[str] = rest_field( + name="privacyStatementUri", visibility=["read", "create", "update", "delete", "query"] + ) + """The privacy statement uri.""" + release_note_uri: Optional[str] = rest_field( + name="releaseNoteUri", visibility=["read", "create", "update", "delete", "query"] + ) + """The release note uri.""" + end_of_life_date: Optional[datetime.datetime] = rest_field( + name="endOfLifeDate", visibility=["read", "create", "update", "delete", "query"], format="rfc3339" + ) + """The end of life date of the gallery Application Definition. This property can be used for + decommissioning purposes. This property is updatable.""" + supported_os_type: Union[str, "_models.OperatingSystemTypes"] = rest_field( + name="supportedOSType", visibility=["read", "create", "update", "delete", "query"] + ) + """This property allows you to specify the supported type of the OS that application is built for. + Possible values are: **Windows,** **Linux.**. Required. Known values are: \"Windows\" and + \"Linux\".""" + custom_actions: Optional[list["_models.GalleryApplicationCustomAction"]] = rest_field( + name="customActions", visibility=["read", "create", "update", "delete", "query"] + ) + """A list of custom actions that can be performed with all of the Gallery Application Versions + within this Gallery Application.""" + + @overload + def __init__( + self, + *, + supported_os_type: Union[str, "_models.OperatingSystemTypes"], + description: Optional[str] = None, + eula: Optional[str] = None, + privacy_statement_uri: Optional[str] = None, + release_note_uri: Optional[str] = None, + end_of_life_date: Optional[datetime.datetime] = None, + custom_actions: Optional[list["_models.GalleryApplicationCustomAction"]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class UpdateResourceDefinition(_Model): + """The Update Resource model definition. + + :ivar id: Resource Id. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + """ + + id: Optional[str] = rest_field(visibility=["read"]) + """Resource Id.""" + name: Optional[str] = rest_field(visibility=["read"]) + """Resource name.""" + type: Optional[str] = rest_field(visibility=["read"]) + """Resource type.""" + tags: Optional[dict[str, str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Resource tags.""" + + @overload + def __init__( + self, + *, + tags: Optional[dict[str, str]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class GalleryApplicationUpdate(UpdateResourceDefinition): + """Specifies information about the gallery Application Definition that you want to update. + + :ivar id: Resource Id. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar properties: Describes the properties of a gallery Application Definition. + :vartype properties: ~azure.mgmt.compute.models.GalleryApplicationProperties + """ + + properties: Optional["_models.GalleryApplicationProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Describes the properties of a gallery Application Definition.""" + + @overload + def __init__( + self, + *, + tags: Optional[dict[str, str]] = None, + properties: Optional["_models.GalleryApplicationProperties"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class GalleryApplicationVersion(TrackedResource): + """Specifies information about the gallery Application Version that you want to create or update. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.compute.models.SystemData + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar location: The geo-location where the resource lives. Required. + :vartype location: str + :ivar properties: Describes the properties of a gallery image version. + :vartype properties: ~azure.mgmt.compute.models.GalleryApplicationVersionProperties + """ + + properties: Optional["_models.GalleryApplicationVersionProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Describes the properties of a gallery image version.""" + + @overload + def __init__( + self, + *, + location: str, + tags: Optional[dict[str, str]] = None, + properties: Optional["_models.GalleryApplicationVersionProperties"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class GalleryApplicationVersionProperties(_Model): + """Describes the properties of a gallery image version. + + :ivar publishing_profile: The publishing profile of a gallery image version. Required. + :vartype publishing_profile: + ~azure.mgmt.compute.models.GalleryApplicationVersionPublishingProfile + :ivar safety_profile: The safety profile of the Gallery Application Version. + :vartype safety_profile: ~azure.mgmt.compute.models.GalleryApplicationVersionSafetyProfile + :ivar provisioning_state: The provisioning state, which only appears in the response. Known + values are: "Creating", "Updating", "Failed", "Succeeded", "Deleting", and "Migrating". + :vartype provisioning_state: str or ~azure.mgmt.compute.models.GalleryProvisioningState + :ivar replication_status: This is the replication status of the gallery image version. + :vartype replication_status: ~azure.mgmt.compute.models.ReplicationStatus + """ + + publishing_profile: "_models.GalleryApplicationVersionPublishingProfile" = rest_field( + name="publishingProfile", visibility=["read", "create", "update", "delete", "query"] + ) + """The publishing profile of a gallery image version. Required.""" + safety_profile: Optional["_models.GalleryApplicationVersionSafetyProfile"] = rest_field( + name="safetyProfile", visibility=["read", "create", "update", "delete", "query"] + ) + """The safety profile of the Gallery Application Version.""" + provisioning_state: Optional[Union[str, "_models.GalleryProvisioningState"]] = rest_field( + name="provisioningState", visibility=["read"] + ) + """The provisioning state, which only appears in the response. Known values are: \"Creating\", + \"Updating\", \"Failed\", \"Succeeded\", \"Deleting\", and \"Migrating\".""" + replication_status: Optional["_models.ReplicationStatus"] = rest_field( + name="replicationStatus", visibility=["read"] + ) + """This is the replication status of the gallery image version.""" + + @overload + def __init__( + self, + *, + publishing_profile: "_models.GalleryApplicationVersionPublishingProfile", + safety_profile: Optional["_models.GalleryApplicationVersionSafetyProfile"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class GalleryArtifactPublishingProfileBase(_Model): + """Describes the basic gallery artifact publishing profile. + + :ivar target_regions: The target regions where the Image Version is going to be replicated to. + This property is updatable. + :vartype target_regions: list[~azure.mgmt.compute.models.TargetRegion] + :ivar replica_count: The number of replicas of the Image Version to be created per region. This + property would take effect for a region when regionalReplicaCount is not specified. This + property is updatable. + :vartype replica_count: int + :ivar exclude_from_latest: If set to true, Virtual Machines deployed from the latest version of + the Image Definition won't use this Image Version. + :vartype exclude_from_latest: bool + :ivar published_date: The timestamp for when the gallery image version is published. + :vartype published_date: ~datetime.datetime + :ivar end_of_life_date: The end of life date of the gallery image version. This property can be + used for decommissioning purposes. This property is updatable. + :vartype end_of_life_date: ~datetime.datetime + :ivar storage_account_type: Specifies the storage account type to be used to store the image. + This property is not updatable. Known values are: "Standard_LRS", "Standard_ZRS", + "Premium_LRS", and "PremiumV2_LRS". + :vartype storage_account_type: str or ~azure.mgmt.compute.models.StorageAccountType + :ivar replication_mode: Optional parameter which specifies the mode to be used for replication. + This property is not updatable. Known values are: "Full" and "Shallow". + :vartype replication_mode: str or ~azure.mgmt.compute.models.ReplicationMode + :ivar target_extended_locations: The target extended locations where the Image Version is going + to be replicated to. This property is updatable. + :vartype target_extended_locations: + list[~azure.mgmt.compute.models.GalleryTargetExtendedLocation] + """ + + target_regions: Optional[list["_models.TargetRegion"]] = rest_field( + name="targetRegions", visibility=["read", "create", "update", "delete", "query"] + ) + """The target regions where the Image Version is going to be replicated to. This property is + updatable.""" + replica_count: Optional[int] = rest_field( + name="replicaCount", visibility=["read", "create", "update", "delete", "query"] + ) + """The number of replicas of the Image Version to be created per region. This property would take + effect for a region when regionalReplicaCount is not specified. This property is updatable.""" + exclude_from_latest: Optional[bool] = rest_field( + name="excludeFromLatest", visibility=["read", "create", "update", "delete", "query"] + ) + """If set to true, Virtual Machines deployed from the latest version of the Image Definition won't + use this Image Version.""" + published_date: Optional[datetime.datetime] = rest_field( + name="publishedDate", visibility=["read"], format="rfc3339" + ) + """The timestamp for when the gallery image version is published.""" + end_of_life_date: Optional[datetime.datetime] = rest_field( + name="endOfLifeDate", visibility=["read", "create", "update", "delete", "query"], format="rfc3339" + ) + """The end of life date of the gallery image version. This property can be used for + decommissioning purposes. This property is updatable.""" + storage_account_type: Optional[Union[str, "_models.StorageAccountType"]] = rest_field( + name="storageAccountType", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies the storage account type to be used to store the image. This property is not + updatable. Known values are: \"Standard_LRS\", \"Standard_ZRS\", \"Premium_LRS\", and + \"PremiumV2_LRS\".""" + replication_mode: Optional[Union[str, "_models.ReplicationMode"]] = rest_field( + name="replicationMode", visibility=["read", "create", "update", "delete", "query"] + ) + """Optional parameter which specifies the mode to be used for replication. This property is not + updatable. Known values are: \"Full\" and \"Shallow\".""" + target_extended_locations: Optional[list["_models.GalleryTargetExtendedLocation"]] = rest_field( + name="targetExtendedLocations", visibility=["read", "create", "update", "delete", "query"] + ) + """The target extended locations where the Image Version is going to be replicated to. This + property is updatable.""" + + @overload + def __init__( + self, + *, + target_regions: Optional[list["_models.TargetRegion"]] = None, + replica_count: Optional[int] = None, + exclude_from_latest: Optional[bool] = None, + end_of_life_date: Optional[datetime.datetime] = None, + storage_account_type: Optional[Union[str, "_models.StorageAccountType"]] = None, + replication_mode: Optional[Union[str, "_models.ReplicationMode"]] = None, + target_extended_locations: Optional[list["_models.GalleryTargetExtendedLocation"]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class GalleryApplicationVersionPublishingProfile(GalleryArtifactPublishingProfileBase): # pylint: disable=name-too-long + """The publishing profile of a gallery image version. + + :ivar target_regions: The target regions where the Image Version is going to be replicated to. + This property is updatable. + :vartype target_regions: list[~azure.mgmt.compute.models.TargetRegion] + :ivar replica_count: The number of replicas of the Image Version to be created per region. This + property would take effect for a region when regionalReplicaCount is not specified. This + property is updatable. + :vartype replica_count: int + :ivar exclude_from_latest: If set to true, Virtual Machines deployed from the latest version of + the Image Definition won't use this Image Version. + :vartype exclude_from_latest: bool + :ivar published_date: The timestamp for when the gallery image version is published. + :vartype published_date: ~datetime.datetime + :ivar end_of_life_date: The end of life date of the gallery image version. This property can be + used for decommissioning purposes. This property is updatable. + :vartype end_of_life_date: ~datetime.datetime + :ivar storage_account_type: Specifies the storage account type to be used to store the image. + This property is not updatable. Known values are: "Standard_LRS", "Standard_ZRS", + "Premium_LRS", and "PremiumV2_LRS". + :vartype storage_account_type: str or ~azure.mgmt.compute.models.StorageAccountType + :ivar replication_mode: Optional parameter which specifies the mode to be used for replication. + This property is not updatable. Known values are: "Full" and "Shallow". + :vartype replication_mode: str or ~azure.mgmt.compute.models.ReplicationMode + :ivar target_extended_locations: The target extended locations where the Image Version is going + to be replicated to. This property is updatable. + :vartype target_extended_locations: + list[~azure.mgmt.compute.models.GalleryTargetExtendedLocation] + :ivar source: The source image from which the Image Version is going to be created. Required. + :vartype source: ~azure.mgmt.compute.models.UserArtifactSource + :ivar manage_actions: + :vartype manage_actions: ~azure.mgmt.compute.models.UserArtifactManage + :ivar settings: Additional settings for the VM app that contains the target package and config + file name when it is deployed to target VM or VM scale set. + :vartype settings: ~azure.mgmt.compute.models.UserArtifactSettings + :ivar advanced_settings: Optional. Additional settings to pass to the vm-application-manager + extension. For advanced use only. + :vartype advanced_settings: dict[str, str] + :ivar enable_health_check: Optional. Whether or not this application reports health. + :vartype enable_health_check: bool + :ivar custom_actions: A list of custom actions that can be performed with this Gallery + Application Version. + :vartype custom_actions: list[~azure.mgmt.compute.models.GalleryApplicationCustomAction] + """ + + source: "_models.UserArtifactSource" = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The source image from which the Image Version is going to be created. Required.""" + manage_actions: Optional["_models.UserArtifactManage"] = rest_field( + name="manageActions", visibility=["read", "create", "update", "delete", "query"] + ) + settings: Optional["_models.UserArtifactSettings"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Additional settings for the VM app that contains the target package and config file name when + it is deployed to target VM or VM scale set.""" + advanced_settings: Optional[dict[str, str]] = rest_field( + name="advancedSettings", visibility=["read", "create", "update", "delete", "query"] + ) + """Optional. Additional settings to pass to the vm-application-manager extension. For advanced use + only.""" + enable_health_check: Optional[bool] = rest_field( + name="enableHealthCheck", visibility=["read", "create", "update", "delete", "query"] + ) + """Optional. Whether or not this application reports health.""" + custom_actions: Optional[list["_models.GalleryApplicationCustomAction"]] = rest_field( + name="customActions", visibility=["read", "create", "update", "delete", "query"] + ) + """A list of custom actions that can be performed with this Gallery Application Version.""" + + @overload + def __init__( + self, + *, + source: "_models.UserArtifactSource", + target_regions: Optional[list["_models.TargetRegion"]] = None, + replica_count: Optional[int] = None, + exclude_from_latest: Optional[bool] = None, + end_of_life_date: Optional[datetime.datetime] = None, + storage_account_type: Optional[Union[str, "_models.StorageAccountType"]] = None, + replication_mode: Optional[Union[str, "_models.ReplicationMode"]] = None, + target_extended_locations: Optional[list["_models.GalleryTargetExtendedLocation"]] = None, + manage_actions: Optional["_models.UserArtifactManage"] = None, + settings: Optional["_models.UserArtifactSettings"] = None, + advanced_settings: Optional[dict[str, str]] = None, + enable_health_check: Optional[bool] = None, + custom_actions: Optional[list["_models.GalleryApplicationCustomAction"]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class GalleryArtifactSafetyProfileBase(_Model): + """This is the safety profile of the Gallery Artifact Version. + + :ivar allow_deletion_of_replicated_locations: Indicates whether or not removing this Gallery + Image Version from replicated regions is allowed. + :vartype allow_deletion_of_replicated_locations: bool + """ + + allow_deletion_of_replicated_locations: Optional[bool] = rest_field( + name="allowDeletionOfReplicatedLocations", visibility=["read", "create", "update", "delete", "query"] + ) + """Indicates whether or not removing this Gallery Image Version from replicated regions is + allowed.""" + + @overload + def __init__( + self, + *, + allow_deletion_of_replicated_locations: Optional[bool] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class GalleryApplicationVersionSafetyProfile(GalleryArtifactSafetyProfileBase): + """The safety profile of the Gallery Application Version. + + :ivar allow_deletion_of_replicated_locations: Indicates whether or not removing this Gallery + Image Version from replicated regions is allowed. + :vartype allow_deletion_of_replicated_locations: bool + """ + + @overload + def __init__( + self, + *, + allow_deletion_of_replicated_locations: Optional[bool] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class GalleryApplicationVersionUpdate(UpdateResourceDefinition): + """Specifies information about the gallery Application Version that you want to update. + + :ivar id: Resource Id. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar properties: Describes the properties of a gallery image version. + :vartype properties: ~azure.mgmt.compute.models.GalleryApplicationVersionProperties + """ + + properties: Optional["_models.GalleryApplicationVersionProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Describes the properties of a gallery image version.""" + + @overload + def __init__( + self, + *, + tags: Optional[dict[str, str]] = None, + properties: Optional["_models.GalleryApplicationVersionProperties"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class GalleryArtifactVersionSource(_Model): + """The gallery artifact version source. + + :ivar id: The id of the gallery artifact version source. + :vartype id: str + """ + + id: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The id of the gallery artifact version source.""" + + @overload + def __init__( + self, + *, + id: Optional[str] = None, # pylint: disable=redefined-builtin + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class GalleryArtifactVersionFullSource(GalleryArtifactVersionSource): + """The source of the gallery artifact version. + + :ivar id: The id of the gallery artifact version source. + :vartype id: str + :ivar community_gallery_image_id: The resource Id of the source Community Gallery Image. Only + required when using Community Gallery Image as a source. + :vartype community_gallery_image_id: str + :ivar virtual_machine_id: The resource Id of the source virtual machine. Only required when + capturing a virtual machine to source this Gallery Image Version. + :vartype virtual_machine_id: str + """ + + community_gallery_image_id: Optional[str] = rest_field( + name="communityGalleryImageId", visibility=["read", "create", "update", "delete", "query"] + ) + """The resource Id of the source Community Gallery Image. Only required when using Community + Gallery Image as a source.""" + virtual_machine_id: Optional[str] = rest_field( + name="virtualMachineId", visibility=["read", "create", "update", "delete", "query"] + ) + """The resource Id of the source virtual machine. Only required when capturing a virtual machine + to source this Gallery Image Version.""" + + @overload + def __init__( + self, + *, + id: Optional[str] = None, # pylint: disable=redefined-builtin + community_gallery_image_id: Optional[str] = None, + virtual_machine_id: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class GalleryDiskImage(_Model): + """This is the disk image base class. + + :ivar size_in_gb: This property indicates the size of the VHD to be created. + :vartype size_in_gb: int + :ivar host_caching: The host caching of the disk. Valid values are 'None', 'ReadOnly', and + 'ReadWrite'. Known values are: "None", "ReadOnly", and "ReadWrite". + :vartype host_caching: str or ~azure.mgmt.compute.models.HostCaching + :ivar source: The source for the disk image. + :vartype source: ~azure.mgmt.compute.models.GalleryDiskImageSource + """ + + size_in_gb: Optional[int] = rest_field(name="sizeInGB", visibility=["read"]) + """This property indicates the size of the VHD to be created.""" + host_caching: Optional[Union[str, "_models.HostCaching"]] = rest_field( + name="hostCaching", visibility=["read", "create", "update", "delete", "query"] + ) + """The host caching of the disk. Valid values are 'None', 'ReadOnly', and 'ReadWrite'. Known + values are: \"None\", \"ReadOnly\", and \"ReadWrite\".""" + source: Optional["_models.GalleryDiskImageSource"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The source for the disk image.""" + + @overload + def __init__( + self, + *, + host_caching: Optional[Union[str, "_models.HostCaching"]] = None, + source: Optional["_models.GalleryDiskImageSource"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class GalleryDataDiskImage(GalleryDiskImage): + """This is the data disk image. + + :ivar size_in_gb: This property indicates the size of the VHD to be created. + :vartype size_in_gb: int + :ivar host_caching: The host caching of the disk. Valid values are 'None', 'ReadOnly', and + 'ReadWrite'. Known values are: "None", "ReadOnly", and "ReadWrite". + :vartype host_caching: str or ~azure.mgmt.compute.models.HostCaching + :ivar source: The source for the disk image. + :vartype source: ~azure.mgmt.compute.models.GalleryDiskImageSource + :ivar lun: This property specifies the logical unit number of the data disk. This value is used + to identify data disks within the Virtual Machine and therefore must be unique for each data + disk attached to the Virtual Machine. Required. + :vartype lun: int + """ + + lun: int = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """This property specifies the logical unit number of the data disk. This value is used to + identify data disks within the Virtual Machine and therefore must be unique for each data disk + attached to the Virtual Machine. Required.""" + + @overload + def __init__( + self, + *, + lun: int, + host_caching: Optional[Union[str, "_models.HostCaching"]] = None, + source: Optional["_models.GalleryDiskImageSource"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class GalleryDiskImageSource(GalleryArtifactVersionSource): + """The source for the disk image. + + :ivar id: The id of the gallery artifact version source. + :vartype id: str + :ivar uri: The uri of the gallery artifact version source. Currently used to specify vhd/blob + source. + :vartype uri: str + :ivar storage_account_id: The Storage Account Id that contains the vhd blob being used as a + source for this artifact version. + :vartype storage_account_id: str + """ + + uri: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The uri of the gallery artifact version source. Currently used to specify vhd/blob source.""" + storage_account_id: Optional[str] = rest_field( + name="storageAccountId", visibility=["read", "create", "update", "delete", "query"] + ) + """The Storage Account Id that contains the vhd blob being used as a source for this artifact + version.""" + + @overload + def __init__( + self, + *, + id: Optional[str] = None, # pylint: disable=redefined-builtin + uri: Optional[str] = None, + storage_account_id: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class GalleryExtendedLocation(_Model): + """The name of the extended location. + + :ivar name: + :vartype name: str + :ivar type: It is type of the extended location. Known values are: "EdgeZone" and "Unknown". + :vartype type: str or ~azure.mgmt.compute.models.GalleryExtendedLocationType + """ + + name: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + type: Optional[Union[str, "_models.GalleryExtendedLocationType"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """It is type of the extended location. Known values are: \"EdgeZone\" and \"Unknown\".""" + + @overload + def __init__( + self, + *, + name: Optional[str] = None, + type: Optional[Union[str, "_models.GalleryExtendedLocationType"]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class GalleryIdentifier(_Model): + """Describes the gallery unique name. + + :ivar unique_name: The unique name of the Shared Image Gallery. This name is generated + automatically by Azure. + :vartype unique_name: str + """ + + unique_name: Optional[str] = rest_field(name="uniqueName", visibility=["read"]) + """The unique name of the Shared Image Gallery. This name is generated automatically by Azure.""" + + +class GalleryIdentity(_Model): + """Identity for the virtual machine. + + :ivar principal_id: The principal id of the gallery identity. This property will only be + provided for a system assigned identity. + :vartype principal_id: str + :ivar tenant_id: The AAD tenant id of the gallery identity. This property will only be provided + for a system assigned identity. + :vartype tenant_id: str + :ivar type: The type of identity used for the gallery. The type 'SystemAssigned, UserAssigned' + includes both an implicitly created identity and a set of user assigned identities. The type + 'None' will remove all identities from the gallery. Known values are: "SystemAssigned", + "UserAssigned", "SystemAssigned, UserAssigned", and "None". + :vartype type: str or ~azure.mgmt.compute.models.ResourceIdentityType + :ivar user_assigned_identities: The list of user identities associated with the gallery. 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.models.UserAssignedIdentitiesValue] + """ + + principal_id: Optional[str] = rest_field(name="principalId", visibility=["read"]) + """The principal id of the gallery identity. This property will only be provided for a system + assigned identity.""" + tenant_id: Optional[str] = rest_field(name="tenantId", visibility=["read"]) + """The AAD tenant id of the gallery identity. This property will only be provided for a system + assigned identity.""" + type: Optional[Union[str, "_models.ResourceIdentityType"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The type of identity used for the gallery. The type 'SystemAssigned, UserAssigned' includes + both an implicitly created identity and a set of user assigned identities. The type 'None' will + remove all identities from the gallery. Known values are: \"SystemAssigned\", \"UserAssigned\", + \"SystemAssigned, UserAssigned\", and \"None\".""" + user_assigned_identities: Optional[dict[str, "_models.UserAssignedIdentitiesValue"]] = rest_field( + name="userAssignedIdentities", visibility=["read", "create", "update", "delete", "query"] + ) + """The list of user identities associated with the gallery. The user identity dictionary key + references will be ARM resource ids in the form: + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'.""" + + @overload + def __init__( + self, + *, + type: Optional[Union[str, "_models.ResourceIdentityType"]] = None, + user_assigned_identities: Optional[dict[str, "_models.UserAssignedIdentitiesValue"]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class GalleryImage(TrackedResource): + """Specifies information about the gallery image definition that you want to create or update. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.compute.models.SystemData + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar location: The geo-location where the resource lives. Required. + :vartype location: str + :ivar properties: Describes the properties of a gallery image definition. + :vartype properties: ~azure.mgmt.compute.models.GalleryImageProperties + """ + + properties: Optional["_models.GalleryImageProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Describes the properties of a gallery image definition.""" + + @overload + def __init__( + self, + *, + location: str, + tags: Optional[dict[str, str]] = None, + properties: Optional["_models.GalleryImageProperties"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class GalleryImageFeature(_Model): + """A feature for gallery image. + + :ivar name: The name of the gallery image feature. + :vartype name: str + :ivar value: The value of the gallery image feature. + :vartype value: str + :ivar starts_at_version: The minimum gallery image version which supports this feature. + :vartype starts_at_version: str + """ + + name: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The name of the gallery image feature.""" + value: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The value of the gallery image feature.""" + starts_at_version: Optional[str] = rest_field( + name="startsAtVersion", visibility=["read", "create", "update", "delete", "query"] + ) + """The minimum gallery image version which supports this feature.""" + + @overload + def __init__( + self, + *, + name: Optional[str] = None, + value: Optional[str] = None, + starts_at_version: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class GalleryImageIdentifier(_Model): + """This is the gallery image definition identifier. + + :ivar publisher: The name of the gallery image definition publisher. Required. + :vartype publisher: str + :ivar offer: The name of the gallery image definition offer. Required. + :vartype offer: str + :ivar sku: The name of the gallery image definition SKU. Required. + :vartype sku: str + """ + + publisher: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The name of the gallery image definition publisher. Required.""" + offer: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The name of the gallery image definition offer. Required.""" + sku: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The name of the gallery image definition SKU. Required.""" + + @overload + def __init__( + self, + *, + publisher: str, + offer: str, + sku: str, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class GalleryImageProperties(_Model): + """Describes the properties of a gallery image definition. + + :ivar description: The description of this gallery image definition resource. This property is + updatable. + :vartype description: str + :ivar eula: The Eula agreement for the gallery image definition. + :vartype eula: str + :ivar privacy_statement_uri: The privacy statement uri. + :vartype privacy_statement_uri: str + :ivar release_note_uri: The release note uri. + :vartype release_note_uri: str + :ivar os_type: This property allows you to specify the type of the OS that is included in the + disk when creating a VM from a managed image. Possible values are: **Windows,** **Linux.**. + Required. Known values are: "Windows" and "Linux". + :vartype os_type: str or ~azure.mgmt.compute.models.OperatingSystemTypes + :ivar os_state: This property allows the user to specify whether the virtual machines created + under this image are 'Generalized' or 'Specialized'. Required. Known values are: "Generalized" + and "Specialized". + :vartype os_state: str or ~azure.mgmt.compute.models.OperatingSystemStateTypes + :ivar hyper_v_generation: The hypervisor generation of the Virtual Machine. Applicable to OS + disks only. Known values are: "V1" and "V2". + :vartype hyper_v_generation: str or ~azure.mgmt.compute.models.HyperVGeneration + :ivar end_of_life_date: The end of life date of the gallery image definition. This property can + be used for decommissioning purposes. This property is updatable. + :vartype end_of_life_date: ~datetime.datetime + :ivar identifier: This is the gallery image definition identifier. Required. + :vartype identifier: ~azure.mgmt.compute.models.GalleryImageIdentifier + :ivar recommended: The properties describe the recommended machine configuration for this Image + Definition. These properties are updatable. + :vartype recommended: ~azure.mgmt.compute.models.RecommendedMachineConfiguration + :ivar disallowed: Describes the disallowed disk types. + :vartype disallowed: ~azure.mgmt.compute.models.Disallowed + :ivar purchase_plan: Describes the gallery image definition purchase plan. This is used by + marketplace images. + :vartype purchase_plan: ~azure.mgmt.compute.models.ImagePurchasePlan + :ivar provisioning_state: The provisioning state, which only appears in the response. Known + values are: "Creating", "Updating", "Failed", "Succeeded", "Deleting", and "Migrating". + :vartype provisioning_state: str or ~azure.mgmt.compute.models.GalleryProvisioningState + :ivar features: A list of gallery image features. + :vartype features: list[~azure.mgmt.compute.models.GalleryImageFeature] + :ivar architecture: The architecture of the image. Applicable to OS disks only. Known values + are: "x64" and "Arm64". + :vartype architecture: str or ~azure.mgmt.compute.models.Architecture + :ivar allow_update_image: Optional. Must be set to true if the gallery image features are being + updated. + :vartype allow_update_image: bool + """ + + description: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The description of this gallery image definition resource. This property is updatable.""" + eula: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The Eula agreement for the gallery image definition.""" + privacy_statement_uri: Optional[str] = rest_field( + name="privacyStatementUri", visibility=["read", "create", "update", "delete", "query"] + ) + """The privacy statement uri.""" + release_note_uri: Optional[str] = rest_field( + name="releaseNoteUri", visibility=["read", "create", "update", "delete", "query"] + ) + """The release note uri.""" + os_type: Union[str, "_models.OperatingSystemTypes"] = rest_field( + name="osType", visibility=["read", "create", "update", "delete", "query"] + ) + """This property allows you to specify the type of the OS that is included in the disk when + creating a VM from a managed image. Possible values are: **Windows,** **Linux.**. Required. + Known values are: \"Windows\" and \"Linux\".""" + os_state: Union[str, "_models.OperatingSystemStateTypes"] = rest_field( + name="osState", visibility=["read", "create", "update", "delete", "query"] + ) + """This property allows the user to specify whether the virtual machines created under this image + are 'Generalized' or 'Specialized'. Required. Known values are: \"Generalized\" and + \"Specialized\".""" + hyper_v_generation: Optional[Union[str, "_models.HyperVGeneration"]] = rest_field( + name="hyperVGeneration", visibility=["read", "create", "update", "delete", "query"] + ) + """The hypervisor generation of the Virtual Machine. Applicable to OS disks only. Known values + are: \"V1\" and \"V2\".""" + end_of_life_date: Optional[datetime.datetime] = rest_field( + name="endOfLifeDate", visibility=["read", "create", "update", "delete", "query"], format="rfc3339" + ) + """The end of life date of the gallery image definition. This property can be used for + decommissioning purposes. This property is updatable.""" + identifier: "_models.GalleryImageIdentifier" = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """This is the gallery image definition identifier. Required.""" + recommended: Optional["_models.RecommendedMachineConfiguration"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The properties describe the recommended machine configuration for this Image Definition. These + properties are updatable.""" + disallowed: Optional["_models.Disallowed"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Describes the disallowed disk types.""" + purchase_plan: Optional["_models.ImagePurchasePlan"] = rest_field( + name="purchasePlan", visibility=["read", "create", "update", "delete", "query"] + ) + """Describes the gallery image definition purchase plan. This is used by marketplace images.""" + provisioning_state: Optional[Union[str, "_models.GalleryProvisioningState"]] = rest_field( + name="provisioningState", visibility=["read"] + ) + """The provisioning state, which only appears in the response. Known values are: \"Creating\", + \"Updating\", \"Failed\", \"Succeeded\", \"Deleting\", and \"Migrating\".""" + features: Optional[list["_models.GalleryImageFeature"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """A list of gallery image features.""" + architecture: Optional[Union[str, "_models.Architecture"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The architecture of the image. Applicable to OS disks only. Known values are: \"x64\" and + \"Arm64\".""" + allow_update_image: Optional[bool] = rest_field( + name="allowUpdateImage", visibility=["read", "create", "update", "delete", "query"] + ) + """Optional. Must be set to true if the gallery image features are being updated.""" + + @overload + def __init__( + self, + *, + os_type: Union[str, "_models.OperatingSystemTypes"], + os_state: Union[str, "_models.OperatingSystemStateTypes"], + identifier: "_models.GalleryImageIdentifier", + description: Optional[str] = None, + eula: Optional[str] = None, + privacy_statement_uri: Optional[str] = None, + release_note_uri: Optional[str] = None, + hyper_v_generation: Optional[Union[str, "_models.HyperVGeneration"]] = None, + end_of_life_date: Optional[datetime.datetime] = None, + recommended: Optional["_models.RecommendedMachineConfiguration"] = None, + disallowed: Optional["_models.Disallowed"] = None, + purchase_plan: Optional["_models.ImagePurchasePlan"] = None, + features: Optional[list["_models.GalleryImageFeature"]] = None, + architecture: Optional[Union[str, "_models.Architecture"]] = None, + allow_update_image: Optional[bool] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class GalleryImageUpdate(UpdateResourceDefinition): + """Specifies information about the gallery image definition that you want to update. + + :ivar id: Resource Id. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar properties: Describes the properties of a gallery image definition. + :vartype properties: ~azure.mgmt.compute.models.GalleryImageProperties + """ + + properties: Optional["_models.GalleryImageProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Describes the properties of a gallery image definition.""" + + @overload + def __init__( + self, + *, + tags: Optional[dict[str, str]] = None, + properties: Optional["_models.GalleryImageProperties"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class GalleryImageVersion(TrackedResource): + """Specifies information about the gallery image version that you want to create or update. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.compute.models.SystemData + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar location: The geo-location where the resource lives. Required. + :vartype location: str + :ivar properties: Describes the properties of a gallery image version. + :vartype properties: ~azure.mgmt.compute.models.GalleryImageVersionProperties + """ + + properties: Optional["_models.GalleryImageVersionProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Describes the properties of a gallery image version.""" + + @overload + def __init__( + self, + *, + location: str, + tags: Optional[dict[str, str]] = None, + properties: Optional["_models.GalleryImageVersionProperties"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class GalleryImageVersionProperties(_Model): + """Describes the properties of a gallery image version. + + :ivar publishing_profile: The publishing profile of a gallery image Version. + :vartype publishing_profile: ~azure.mgmt.compute.models.GalleryImageVersionPublishingProfile + :ivar provisioning_state: The provisioning state, which only appears in the response. Known + values are: "Creating", "Updating", "Failed", "Succeeded", "Deleting", and "Migrating". + :vartype provisioning_state: str or ~azure.mgmt.compute.models.GalleryProvisioningState + :ivar storage_profile: This is the storage profile of a Gallery Image Version. Required. + :vartype storage_profile: ~azure.mgmt.compute.models.GalleryImageVersionStorageProfile + :ivar safety_profile: This is the safety profile of the Gallery Image Version. + :vartype safety_profile: ~azure.mgmt.compute.models.GalleryImageVersionSafetyProfile + :ivar replication_status: This is the replication status of the gallery image version. + :vartype replication_status: ~azure.mgmt.compute.models.ReplicationStatus + :ivar security_profile: The security profile of a gallery image version. + :vartype security_profile: ~azure.mgmt.compute.models.ImageVersionSecurityProfile + :ivar restore: Indicates if this is a soft-delete resource restoration request. + :vartype restore: bool + :ivar validations_profile: This is the validations profile of a Gallery Image Version. + :vartype validations_profile: ~azure.mgmt.compute.models.ValidationsProfile + """ + + publishing_profile: Optional["_models.GalleryImageVersionPublishingProfile"] = rest_field( + name="publishingProfile", visibility=["read", "create", "update", "delete", "query"] + ) + """The publishing profile of a gallery image Version.""" + provisioning_state: Optional[Union[str, "_models.GalleryProvisioningState"]] = rest_field( + name="provisioningState", visibility=["read"] + ) + """The provisioning state, which only appears in the response. Known values are: \"Creating\", + \"Updating\", \"Failed\", \"Succeeded\", \"Deleting\", and \"Migrating\".""" + storage_profile: "_models.GalleryImageVersionStorageProfile" = rest_field( + name="storageProfile", visibility=["read", "create", "update", "delete", "query"] + ) + """This is the storage profile of a Gallery Image Version. Required.""" + safety_profile: Optional["_models.GalleryImageVersionSafetyProfile"] = rest_field( + name="safetyProfile", visibility=["read", "create", "update", "delete", "query"] + ) + """This is the safety profile of the Gallery Image Version.""" + replication_status: Optional["_models.ReplicationStatus"] = rest_field( + name="replicationStatus", visibility=["read"] + ) + """This is the replication status of the gallery image version.""" + security_profile: Optional["_models.ImageVersionSecurityProfile"] = rest_field( + name="securityProfile", visibility=["read", "create", "update", "delete", "query"] + ) + """The security profile of a gallery image version.""" + restore: Optional[bool] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Indicates if this is a soft-delete resource restoration request.""" + validations_profile: Optional["_models.ValidationsProfile"] = rest_field( + name="validationsProfile", visibility=["read"] + ) + """This is the validations profile of a Gallery Image Version.""" + + @overload + def __init__( + self, + *, + storage_profile: "_models.GalleryImageVersionStorageProfile", + publishing_profile: Optional["_models.GalleryImageVersionPublishingProfile"] = None, + safety_profile: Optional["_models.GalleryImageVersionSafetyProfile"] = None, + security_profile: Optional["_models.ImageVersionSecurityProfile"] = None, + restore: Optional[bool] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class GalleryImageVersionPublishingProfile(GalleryArtifactPublishingProfileBase): + """The publishing profile of a gallery image Version. + + :ivar target_regions: The target regions where the Image Version is going to be replicated to. + This property is updatable. + :vartype target_regions: list[~azure.mgmt.compute.models.TargetRegion] + :ivar replica_count: The number of replicas of the Image Version to be created per region. This + property would take effect for a region when regionalReplicaCount is not specified. This + property is updatable. + :vartype replica_count: int + :ivar exclude_from_latest: If set to true, Virtual Machines deployed from the latest version of + the Image Definition won't use this Image Version. + :vartype exclude_from_latest: bool + :ivar published_date: The timestamp for when the gallery image version is published. + :vartype published_date: ~datetime.datetime + :ivar end_of_life_date: The end of life date of the gallery image version. This property can be + used for decommissioning purposes. This property is updatable. + :vartype end_of_life_date: ~datetime.datetime + :ivar storage_account_type: Specifies the storage account type to be used to store the image. + This property is not updatable. Known values are: "Standard_LRS", "Standard_ZRS", + "Premium_LRS", and "PremiumV2_LRS". + :vartype storage_account_type: str or ~azure.mgmt.compute.models.StorageAccountType + :ivar replication_mode: Optional parameter which specifies the mode to be used for replication. + This property is not updatable. Known values are: "Full" and "Shallow". + :vartype replication_mode: str or ~azure.mgmt.compute.models.ReplicationMode + :ivar target_extended_locations: The target extended locations where the Image Version is going + to be replicated to. This property is updatable. + :vartype target_extended_locations: + list[~azure.mgmt.compute.models.GalleryTargetExtendedLocation] + """ + + @overload + def __init__( + self, + *, + target_regions: Optional[list["_models.TargetRegion"]] = None, + replica_count: Optional[int] = None, + exclude_from_latest: Optional[bool] = None, + end_of_life_date: Optional[datetime.datetime] = None, + storage_account_type: Optional[Union[str, "_models.StorageAccountType"]] = None, + replication_mode: Optional[Union[str, "_models.ReplicationMode"]] = None, + target_extended_locations: Optional[list["_models.GalleryTargetExtendedLocation"]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class GalleryImageVersionSafetyProfile(GalleryArtifactSafetyProfileBase): + """This is the safety profile of the Gallery Image Version. + + :ivar allow_deletion_of_replicated_locations: Indicates whether or not removing this Gallery + Image Version from replicated regions is allowed. + :vartype allow_deletion_of_replicated_locations: bool + :ivar reported_for_policy_violation: Indicates whether this image has been reported as + violating Microsoft's policies. + :vartype reported_for_policy_violation: bool + :ivar policy_violations: A list of Policy Violations that have been reported for this Gallery + Image Version. + :vartype policy_violations: list[~azure.mgmt.compute.models.PolicyViolation] + :ivar block_deletion_before_end_of_life: Indicates whether or not the deletion is blocked for + this Gallery Image Version if its End Of Life has not expired. + :vartype block_deletion_before_end_of_life: bool + """ + + reported_for_policy_violation: Optional[bool] = rest_field(name="reportedForPolicyViolation", visibility=["read"]) + """Indicates whether this image has been reported as violating Microsoft's policies.""" + policy_violations: Optional[list["_models.PolicyViolation"]] = rest_field( + name="policyViolations", visibility=["read"] + ) + """A list of Policy Violations that have been reported for this Gallery Image Version.""" + block_deletion_before_end_of_life: Optional[bool] = rest_field( + name="blockDeletionBeforeEndOfLife", visibility=["read", "create", "update", "delete", "query"] + ) + """Indicates whether or not the deletion is blocked for this Gallery Image Version if its End Of + Life has not expired.""" + + @overload + def __init__( + self, + *, + allow_deletion_of_replicated_locations: Optional[bool] = None, + block_deletion_before_end_of_life: Optional[bool] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class GalleryImageVersionStorageProfile(_Model): + """This is the storage profile of a Gallery Image Version. + + :ivar source: The source of the gallery artifact version. + :vartype source: ~azure.mgmt.compute.models.GalleryArtifactVersionFullSource + :ivar os_disk_image: This is the OS disk image. + :vartype os_disk_image: ~azure.mgmt.compute.models.GalleryOSDiskImage + :ivar data_disk_images: A list of data disk images. + :vartype data_disk_images: list[~azure.mgmt.compute.models.GalleryDataDiskImage] + """ + + source: Optional["_models.GalleryArtifactVersionFullSource"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The source of the gallery artifact version.""" + os_disk_image: Optional["_models.GalleryOSDiskImage"] = rest_field( + name="osDiskImage", visibility=["read", "create", "update", "delete", "query"] + ) + """This is the OS disk image.""" + data_disk_images: Optional[list["_models.GalleryDataDiskImage"]] = rest_field( + name="dataDiskImages", visibility=["read", "create", "update", "delete", "query"] + ) + """A list of data disk images.""" + + @overload + def __init__( + self, + *, + source: Optional["_models.GalleryArtifactVersionFullSource"] = None, + os_disk_image: Optional["_models.GalleryOSDiskImage"] = None, + data_disk_images: Optional[list["_models.GalleryDataDiskImage"]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class GalleryImageVersionUefiSettings(_Model): + """Contains UEFI settings for the image version. + + :ivar signature_template_names: The name of the template(s) that contains default UEFI key + signatures that will be added to the image. + :vartype signature_template_names: list[str or + ~azure.mgmt.compute.models.UefiSignatureTemplateName] + :ivar additional_signatures: Additional UEFI key signatures that will be added to the image in + addition to the signature templates. + :vartype additional_signatures: ~azure.mgmt.compute.models.UefiKeySignatures + """ + + signature_template_names: Optional[list[Union[str, "_models.UefiSignatureTemplateName"]]] = rest_field( + name="signatureTemplateNames", visibility=["read", "create", "update", "delete", "query"] + ) + """The name of the template(s) that contains default UEFI key signatures that will be added to the + image.""" + additional_signatures: Optional["_models.UefiKeySignatures"] = rest_field( + name="additionalSignatures", visibility=["read", "create", "update", "delete", "query"] + ) + """Additional UEFI key signatures that will be added to the image in addition to the signature + templates.""" + + @overload + def __init__( + self, + *, + signature_template_names: Optional[list[Union[str, "_models.UefiSignatureTemplateName"]]] = None, + additional_signatures: Optional["_models.UefiKeySignatures"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class GalleryImageVersionUpdate(UpdateResourceDefinition): + """Specifies information about the gallery image version that you want to update. + + :ivar id: Resource Id. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar properties: Describes the properties of a gallery image version. + :vartype properties: ~azure.mgmt.compute.models.GalleryImageVersionProperties + """ + + properties: Optional["_models.GalleryImageVersionProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Describes the properties of a gallery image version.""" + + @overload + def __init__( + self, + *, + tags: Optional[dict[str, str]] = None, + properties: Optional["_models.GalleryImageVersionProperties"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class GalleryInVMAccessControlProfile(TrackedResource): + """Specifies information about the gallery inVMAccessControlProfile that you want to create or + update. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.compute.models.SystemData + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar location: The geo-location where the resource lives. Required. + :vartype location: str + :ivar properties: Describes the properties of a gallery inVMAccessControlProfile. + :vartype properties: ~azure.mgmt.compute.models.GalleryInVMAccessControlProfileProperties + """ + + properties: Optional["_models.GalleryInVMAccessControlProfileProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Describes the properties of a gallery inVMAccessControlProfile.""" + + @overload + def __init__( + self, + *, + location: str, + tags: Optional[dict[str, str]] = None, + properties: Optional["_models.GalleryInVMAccessControlProfileProperties"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class GalleryResourceProfilePropertiesBase(_Model): + """The properties of a gallery ResourceProfile. + + :ivar provisioning_state: The provisioning state, which only appears in the response. Known + values are: "Creating", "Updating", "Failed", "Succeeded", "Deleting", and "Migrating". + :vartype provisioning_state: str or ~azure.mgmt.compute.models.GalleryProvisioningState + """ + + provisioning_state: Optional[Union[str, "_models.GalleryProvisioningState"]] = rest_field( + name="provisioningState", visibility=["read"] + ) + """The provisioning state, which only appears in the response. Known values are: \"Creating\", + \"Updating\", \"Failed\", \"Succeeded\", \"Deleting\", and \"Migrating\".""" + + +class GalleryInVMAccessControlProfileProperties(GalleryResourceProfilePropertiesBase): # pylint: disable=name-too-long + """Describes the properties of a gallery inVMAccessControlProfile. + + :ivar provisioning_state: The provisioning state, which only appears in the response. Known + values are: "Creating", "Updating", "Failed", "Succeeded", "Deleting", and "Migrating". + :vartype provisioning_state: str or ~azure.mgmt.compute.models.GalleryProvisioningState + :ivar description: The description of this gallery inVMAccessControlProfile resources. This + property is updatable. + :vartype description: str + :ivar os_type: This property allows you to specify the OS type of the VMs/VMSS for which this + profile can be used against. Possible values are: 'Windows' or 'Linux'. Required. Known values + are: "Windows" and "Linux". + :vartype os_type: str or ~azure.mgmt.compute.models.OperatingSystemTypes + :ivar applicable_host_endpoint: This property allows you to specify the Endpoint type for which + this profile is defining the access control for. Possible values are: 'WireServer' or 'IMDS'. + Required. Known values are: "WireServer" and "IMDS". + :vartype applicable_host_endpoint: str or ~azure.mgmt.compute.models.EndpointTypes + """ + + description: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The description of this gallery inVMAccessControlProfile resources. This property is updatable.""" + os_type: Union[str, "_models.OperatingSystemTypes"] = rest_field( + name="osType", visibility=["read", "create", "update", "delete", "query"] + ) + """This property allows you to specify the OS type of the VMs/VMSS for which this profile can be + used against. Possible values are: 'Windows' or 'Linux'. Required. Known values are: + \"Windows\" and \"Linux\".""" + applicable_host_endpoint: Union[str, "_models.EndpointTypes"] = rest_field( + name="applicableHostEndpoint", visibility=["read", "create", "update", "delete", "query"] + ) + """This property allows you to specify the Endpoint type for which this profile is defining the + access control for. Possible values are: 'WireServer' or 'IMDS'. Required. Known values are: + \"WireServer\" and \"IMDS\".""" + + @overload + def __init__( + self, + *, + os_type: Union[str, "_models.OperatingSystemTypes"], + applicable_host_endpoint: Union[str, "_models.EndpointTypes"], + description: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class GalleryInVMAccessControlProfileUpdate(UpdateResourceDefinition): + """Specifies information about the gallery inVMAccessControlProfile that you want to update. + + :ivar id: Resource Id. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar properties: Describes the properties of a gallery inVMAccessControlProfile. + :vartype properties: ~azure.mgmt.compute.models.GalleryInVMAccessControlProfileProperties + """ + + properties: Optional["_models.GalleryInVMAccessControlProfileProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Describes the properties of a gallery inVMAccessControlProfile.""" + + @overload + def __init__( + self, + *, + tags: Optional[dict[str, str]] = None, + properties: Optional["_models.GalleryInVMAccessControlProfileProperties"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class GalleryInVMAccessControlProfileVersion(TrackedResource): + """Specifies information about the gallery inVMAccessControlProfile version that you want to + create or update. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.compute.models.SystemData + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar location: The geo-location where the resource lives. Required. + :vartype location: str + :ivar properties: Describes the properties of an inVMAccessControlProfile version. + :vartype properties: + ~azure.mgmt.compute.models.GalleryInVMAccessControlProfileVersionProperties + """ + + properties: Optional["_models.GalleryInVMAccessControlProfileVersionProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Describes the properties of an inVMAccessControlProfile version.""" + + @overload + def __init__( + self, + *, + location: str, + tags: Optional[dict[str, str]] = None, + properties: Optional["_models.GalleryInVMAccessControlProfileVersionProperties"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class GalleryResourceProfileVersionPropertiesBase(_Model): # pylint: disable=name-too-long + """The properties of a gallery ResourceProfile version. + + :ivar target_locations: The target regions where the Resource Profile version is going to be + replicated to. This property is updatable. + :vartype target_locations: list[~azure.mgmt.compute.models.TargetRegion] + :ivar exclude_from_latest: If set to true, Virtual Machines deployed from the latest version of + the Resource Profile won't use this Profile version. + :vartype exclude_from_latest: bool + :ivar published_date: The timestamp for when the Resource Profile Version is published. + :vartype published_date: ~datetime.datetime + :ivar provisioning_state: The provisioning state, which only appears in the response. Known + values are: "Creating", "Updating", "Failed", "Succeeded", "Deleting", and "Migrating". + :vartype provisioning_state: str or ~azure.mgmt.compute.models.GalleryProvisioningState + :ivar replication_status: This is the replication status of the gallery image version. + :vartype replication_status: ~azure.mgmt.compute.models.ReplicationStatus + """ + + target_locations: Optional[list["_models.TargetRegion"]] = rest_field( + name="targetLocations", visibility=["read", "create", "update", "delete", "query"] + ) + """The target regions where the Resource Profile version is going to be replicated to. This + property is updatable.""" + exclude_from_latest: Optional[bool] = rest_field( + name="excludeFromLatest", visibility=["read", "create", "update", "delete", "query"] + ) + """If set to true, Virtual Machines deployed from the latest version of the Resource Profile won't + use this Profile version.""" + published_date: Optional[datetime.datetime] = rest_field( + name="publishedDate", visibility=["read"], format="rfc3339" + ) + """The timestamp for when the Resource Profile Version is published.""" + provisioning_state: Optional[Union[str, "_models.GalleryProvisioningState"]] = rest_field( + name="provisioningState", visibility=["read"] + ) + """The provisioning state, which only appears in the response. Known values are: \"Creating\", + \"Updating\", \"Failed\", \"Succeeded\", \"Deleting\", and \"Migrating\".""" + replication_status: Optional["_models.ReplicationStatus"] = rest_field( + name="replicationStatus", visibility=["read"] + ) + """This is the replication status of the gallery image version.""" + + @overload + def __init__( + self, + *, + target_locations: Optional[list["_models.TargetRegion"]] = None, + exclude_from_latest: Optional[bool] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class GalleryInVMAccessControlProfileVersionProperties( + GalleryResourceProfileVersionPropertiesBase +): # pylint: disable=name-too-long + """Describes the properties of an inVMAccessControlProfile version. + + :ivar target_locations: The target regions where the Resource Profile version is going to be + replicated to. This property is updatable. + :vartype target_locations: list[~azure.mgmt.compute.models.TargetRegion] + :ivar exclude_from_latest: If set to true, Virtual Machines deployed from the latest version of + the Resource Profile won't use this Profile version. + :vartype exclude_from_latest: bool + :ivar published_date: The timestamp for when the Resource Profile Version is published. + :vartype published_date: ~datetime.datetime + :ivar provisioning_state: The provisioning state, which only appears in the response. Known + values are: "Creating", "Updating", "Failed", "Succeeded", "Deleting", and "Migrating". + :vartype provisioning_state: str or ~azure.mgmt.compute.models.GalleryProvisioningState + :ivar replication_status: This is the replication status of the gallery image version. + :vartype replication_status: ~azure.mgmt.compute.models.ReplicationStatus + :ivar mode: This property allows you to specify whether the access control rules are in Audit + mode, in Enforce mode or Disabled. Possible values are: 'Audit', 'Enforce' or 'Disabled'. + Required. Known values are: "Audit", "Enforce", and "Disabled". + :vartype mode: str or ~azure.mgmt.compute.models.AccessControlRulesMode + :ivar default_access: This property allows you to specify if the requests will be allowed to + access the host endpoints. Possible values are: 'Allow', 'Deny'. Required. Known values are: + "Allow" and "Deny". + :vartype default_access: str or ~azure.mgmt.compute.models.EndpointAccess + :ivar rules: This is the Access Control Rules specification for an inVMAccessControlProfile + version. + :vartype rules: ~azure.mgmt.compute.models.AccessControlRules + """ + + mode: Union[str, "_models.AccessControlRulesMode"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """This property allows you to specify whether the access control rules are in Audit mode, in + Enforce mode or Disabled. Possible values are: 'Audit', 'Enforce' or 'Disabled'. Required. + Known values are: \"Audit\", \"Enforce\", and \"Disabled\".""" + default_access: Union[str, "_models.EndpointAccess"] = rest_field( + name="defaultAccess", visibility=["read", "create", "update", "delete", "query"] + ) + """This property allows you to specify if the requests will be allowed to access the host + endpoints. Possible values are: 'Allow', 'Deny'. Required. Known values are: \"Allow\" and + \"Deny\".""" + rules: Optional["_models.AccessControlRules"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """This is the Access Control Rules specification for an inVMAccessControlProfile version.""" + + @overload + def __init__( + self, + *, + mode: Union[str, "_models.AccessControlRulesMode"], + default_access: Union[str, "_models.EndpointAccess"], + target_locations: Optional[list["_models.TargetRegion"]] = None, + exclude_from_latest: Optional[bool] = None, + rules: Optional["_models.AccessControlRules"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class GalleryInVMAccessControlProfileVersionUpdate(UpdateResourceDefinition): # pylint: disable=name-too-long + """Specifies information about the gallery inVMAccessControlProfile version that you want to + update. + + :ivar id: Resource Id. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar properties: Describes the properties of an inVMAccessControlProfile version. + :vartype properties: + ~azure.mgmt.compute.models.GalleryInVMAccessControlProfileVersionProperties + """ + + properties: Optional["_models.GalleryInVMAccessControlProfileVersionProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Describes the properties of an inVMAccessControlProfile version.""" + + @overload + def __init__( + self, + *, + tags: Optional[dict[str, str]] = None, + properties: Optional["_models.GalleryInVMAccessControlProfileVersionProperties"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class GalleryOSDiskImage(GalleryDiskImage): + """This is the OS disk image. + + :ivar size_in_gb: This property indicates the size of the VHD to be created. + :vartype size_in_gb: int + :ivar host_caching: The host caching of the disk. Valid values are 'None', 'ReadOnly', and + 'ReadWrite'. Known values are: "None", "ReadOnly", and "ReadWrite". + :vartype host_caching: str or ~azure.mgmt.compute.models.HostCaching + :ivar source: The source for the disk image. + :vartype source: ~azure.mgmt.compute.models.GalleryDiskImageSource + """ + + @overload + def __init__( + self, + *, + host_caching: Optional[Union[str, "_models.HostCaching"]] = None, + source: Optional["_models.GalleryDiskImageSource"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class GalleryProperties(_Model): + """Describes the properties of a Shared Image Gallery. + + :ivar description: The description of this Shared Image Gallery resource. This property is + updatable. + :vartype description: str + :ivar identifier: Describes the gallery unique name. + :vartype identifier: ~azure.mgmt.compute.models.GalleryIdentifier + :ivar provisioning_state: The provisioning state, which only appears in the response. Known + values are: "Creating", "Updating", "Failed", "Succeeded", "Deleting", and "Migrating". + :vartype provisioning_state: str or ~azure.mgmt.compute.models.GalleryProvisioningState + :ivar sharing_profile: Profile for gallery sharing to subscription or tenant. + :vartype sharing_profile: ~azure.mgmt.compute.models.SharingProfile + :ivar soft_delete_policy: Contains information about the soft deletion policy of the gallery. + :vartype soft_delete_policy: ~azure.mgmt.compute.models.SoftDeletePolicy + :ivar sharing_status: Sharing status of current gallery. + :vartype sharing_status: ~azure.mgmt.compute.models.SharingStatus + """ + + description: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The description of this Shared Image Gallery resource. This property is updatable.""" + identifier: Optional["_models.GalleryIdentifier"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Describes the gallery unique name.""" + provisioning_state: Optional[Union[str, "_models.GalleryProvisioningState"]] = rest_field( + name="provisioningState", visibility=["read"] + ) + """The provisioning state, which only appears in the response. Known values are: \"Creating\", + \"Updating\", \"Failed\", \"Succeeded\", \"Deleting\", and \"Migrating\".""" + sharing_profile: Optional["_models.SharingProfile"] = rest_field( + name="sharingProfile", visibility=["read", "create", "update", "delete", "query"] + ) + """Profile for gallery sharing to subscription or tenant.""" + soft_delete_policy: Optional["_models.SoftDeletePolicy"] = rest_field( + name="softDeletePolicy", visibility=["read", "create", "update", "delete", "query"] + ) + """Contains information about the soft deletion policy of the gallery.""" + sharing_status: Optional["_models.SharingStatus"] = rest_field(name="sharingStatus", visibility=["read"]) + """Sharing status of current gallery.""" + + @overload + def __init__( + self, + *, + description: Optional[str] = None, + identifier: Optional["_models.GalleryIdentifier"] = None, + sharing_profile: Optional["_models.SharingProfile"] = None, + soft_delete_policy: Optional["_models.SoftDeletePolicy"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class GallerySoftDeletedResource(TrackedResource): + """The details information of soft-deleted resource. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.compute.models.SystemData + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar location: The geo-location where the resource lives. Required. + :vartype location: str + :ivar properties: Describes the properties of a soft-deleted resource. + :vartype properties: ~azure.mgmt.compute.models.GallerySoftDeletedResourceProperties + """ + + properties: Optional["_models.GallerySoftDeletedResourceProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Describes the properties of a soft-deleted resource.""" + + @overload + def __init__( + self, + *, + location: str, + tags: Optional[dict[str, str]] = None, + properties: Optional["_models.GallerySoftDeletedResourceProperties"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class GallerySoftDeletedResourceProperties(_Model): + """Describes the properties of a soft-deleted resource. + + :ivar resource_arm_id: arm id of the soft-deleted resource. + :vartype resource_arm_id: str + :ivar soft_deleted_artifact_type: artifact type of the soft-deleted resource. "Images" + :vartype soft_deleted_artifact_type: str or ~azure.mgmt.compute.models.SoftDeletedArtifactTypes + :ivar soft_deleted_time: The timestamp for when the resource is soft-deleted. In dateTime + offset format. + :vartype soft_deleted_time: str + """ + + resource_arm_id: Optional[str] = rest_field( + name="resourceArmId", visibility=["read", "create", "update", "delete", "query"] + ) + """arm id of the soft-deleted resource.""" + soft_deleted_artifact_type: Optional[Union[str, "_models.SoftDeletedArtifactTypes"]] = rest_field( + name="softDeletedArtifactType", visibility=["read", "create", "update", "delete", "query"] + ) + """artifact type of the soft-deleted resource. \"Images\"""" + soft_deleted_time: Optional[str] = rest_field( + name="softDeletedTime", visibility=["read", "create", "update", "delete", "query"] + ) + """The timestamp for when the resource is soft-deleted. In dateTime offset format.""" + + @overload + def __init__( + self, + *, + resource_arm_id: Optional[str] = None, + soft_deleted_artifact_type: Optional[Union[str, "_models.SoftDeletedArtifactTypes"]] = None, + soft_deleted_time: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class GalleryTargetExtendedLocation(_Model): + """GalleryTargetExtendedLocation. + + :ivar name: The name of the region. + :vartype name: str + :ivar extended_location: The name of the extended location. + :vartype extended_location: ~azure.mgmt.compute.models.GalleryExtendedLocation + :ivar extended_location_replica_count: The number of replicas of the Image Version to be + created per extended location. This property is updatable. + :vartype extended_location_replica_count: int + :ivar storage_account_type: Specifies the storage account type to be used to store the image. + This property is not updatable. Known values are: "Standard_LRS", "Standard_ZRS", + "StandardSSD_LRS", and "Premium_LRS". + :vartype storage_account_type: str or ~azure.mgmt.compute.models.EdgeZoneStorageAccountType + :ivar encryption: Optional. Allows users to provide customer managed keys for encrypting the OS + and data disks in the gallery artifact. + :vartype encryption: ~azure.mgmt.compute.models.EncryptionImages + """ + + name: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The name of the region.""" + extended_location: Optional["_models.GalleryExtendedLocation"] = rest_field( + name="extendedLocation", visibility=["read", "create", "update", "delete", "query"] + ) + """The name of the extended location.""" + extended_location_replica_count: Optional[int] = rest_field( + name="extendedLocationReplicaCount", visibility=["read", "create", "update", "delete", "query"] + ) + """The number of replicas of the Image Version to be created per extended location. This property + is updatable.""" + storage_account_type: Optional[Union[str, "_models.EdgeZoneStorageAccountType"]] = rest_field( + name="storageAccountType", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies the storage account type to be used to store the image. This property is not + updatable. Known values are: \"Standard_LRS\", \"Standard_ZRS\", \"StandardSSD_LRS\", and + \"Premium_LRS\".""" + encryption: Optional["_models.EncryptionImages"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Optional. Allows users to provide customer managed keys for encrypting the OS and data disks in + the gallery artifact.""" + + @overload + def __init__( + self, + *, + name: Optional[str] = None, + extended_location: Optional["_models.GalleryExtendedLocation"] = None, + extended_location_replica_count: Optional[int] = None, + storage_account_type: Optional[Union[str, "_models.EdgeZoneStorageAccountType"]] = None, + encryption: Optional["_models.EncryptionImages"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class GalleryUpdate(UpdateResourceDefinition): + """Specifies information about the Shared Image Gallery that you want to update. + + :ivar id: Resource Id. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar properties: Describes the properties of a Shared Image Gallery. + :vartype properties: ~azure.mgmt.compute.models.GalleryProperties + :ivar identity: The identity of the gallery, if configured. + :vartype identity: ~azure.mgmt.compute.models.GalleryIdentity + """ + + properties: Optional["_models.GalleryProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Describes the properties of a Shared Image Gallery.""" + identity: Optional["_models.GalleryIdentity"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The identity of the gallery, if configured.""" + + @overload + def __init__( + self, + *, + tags: Optional[dict[str, str]] = None, + properties: Optional["_models.GalleryProperties"] = None, + identity: Optional["_models.GalleryIdentity"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class GenerateKeyPairParameterBody(_Model): + """GenerateKeyPairParameterBody. + + :ivar parameters: Parameters supplied to generate the SSH public key. + :vartype parameters: ~azure.mgmt.compute.models.SshGenerateKeyPairInputParameters + """ + + parameters: Optional["_models.SshGenerateKeyPairInputParameters"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Parameters supplied to generate the SSH public key.""" + + @overload + def __init__( + self, + *, + parameters: Optional["_models.SshGenerateKeyPairInputParameters"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class GrantAccessData(_Model): + """Data used for requesting a SAS. + + :ivar access: The Access Level, accepted values include None, Read, Write. Required. Known + values are: "None", "Read", and "Write". + :vartype access: str or ~azure.mgmt.compute.models.AccessLevel + :ivar duration_in_seconds: Time duration in seconds until the SAS access expires. Required. + :vartype duration_in_seconds: int + :ivar get_secure_vm_guest_state_sas: Set this flag to true to get additional SAS for VM guest + state. + :vartype get_secure_vm_guest_state_sas: bool + :ivar file_format: Used to specify the file format when making request for SAS on a VHDX file + format snapshot. Known values are: "VHD" and "VHDX". + :vartype file_format: str or ~azure.mgmt.compute.models.FileFormat + """ + + access: Union[str, "_models.AccessLevel"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The Access Level, accepted values include None, Read, Write. Required. Known values are: + \"None\", \"Read\", and \"Write\".""" + duration_in_seconds: int = rest_field( + name="durationInSeconds", visibility=["read", "create", "update", "delete", "query"] + ) + """Time duration in seconds until the SAS access expires. Required.""" + get_secure_vm_guest_state_sas: Optional[bool] = rest_field( + name="getSecureVMGuestStateSAS", visibility=["read", "create", "update", "delete", "query"] + ) + """Set this flag to true to get additional SAS for VM guest state.""" + file_format: Optional[Union[str, "_models.FileFormat"]] = rest_field( + name="fileFormat", visibility=["read", "create", "update", "delete", "query"] + ) + """Used to specify the file format when making request for SAS on a VHDX file format snapshot. + Known values are: \"VHD\" and \"VHDX\".""" + + @overload + def __init__( + self, + *, + access: Union[str, "_models.AccessLevel"], + duration_in_seconds: int, + get_secure_vm_guest_state_sas: Optional[bool] = None, + file_format: Optional[Union[str, "_models.FileFormat"]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class HardwareProfile(_Model): + """Specifies the hardware settings for the virtual machine. + + :ivar vm_size: Specifies the size of the virtual machine. The enum data type is currently + deprecated and will be removed by December 23rd 2023. The recommended way to get the list of + available sizes is using these APIs: `List all available virtual machine sizes in an + availability set + `_, `List all + available virtual machine sizes in a region + `_, `List all available virtual + machine sizes for resizing + `_. For more + information about virtual machine sizes, see `Sizes for virtual machines + `_. The available VM sizes depend on + region and availability set. Known values are: "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", and + "Standard_NV24". + :vartype vm_size: str or ~azure.mgmt.compute.models.VirtualMachineSizeTypes + :ivar vm_size_properties: Specifies the properties for customizing the size of the virtual + machine. Minimum api-version: 2021-07-01. This feature is still in preview mode and is not + supported for VirtualMachineScaleSet. Please follow the instructions in `VM Customization + `_ for more details. + :vartype vm_size_properties: ~azure.mgmt.compute.models.VMSizeProperties + """ + + vm_size: Optional[Union[str, "_models.VirtualMachineSizeTypes"]] = rest_field( + name="vmSize", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies the size of the virtual machine. The enum data type is currently deprecated and will + be removed by December 23rd 2023. The recommended way to get the list of available sizes is + using these APIs: `List all available virtual machine sizes in an availability set + `_, `List all + available virtual machine sizes in a region + `_, `List all available virtual + machine sizes for resizing + `_. For more + information about virtual machine sizes, see `Sizes for virtual machines + `_. The available VM sizes depend on + region and availability set. Known values are: \"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\", and + \"Standard_NV24\".""" + vm_size_properties: Optional["_models.VMSizeProperties"] = rest_field( + name="vmSizeProperties", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies the properties for customizing the size of the virtual machine. Minimum api-version: + 2021-07-01. This feature is still in preview mode and is not supported for + VirtualMachineScaleSet. Please follow the instructions in `VM Customization + `_ for more details.""" + + @overload + def __init__( + self, + *, + vm_size: Optional[Union[str, "_models.VirtualMachineSizeTypes"]] = None, + vm_size_properties: Optional["_models.VMSizeProperties"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class HostEndpointSettings(_Model): + """Specifies particular host endpoint settings. + + :ivar mode: Specifies the execution mode. In Audit mode, the system acts as if it is enforcing + the access control policy, including emitting access denial entries in the logs but it does not + actually deny any requests to host endpoints. In Enforce mode, the system will enforce the + access control and it is the recommended mode of operation. Known values are: "Audit", + "Enforce", and "Disabled". + :vartype mode: str or ~azure.mgmt.compute.models.Modes + :ivar in_vm_access_control_profile_reference_id: Specifies the InVMAccessControlProfileVersion + resource id in the format of + /subscriptions/{SubscriptionId}/resourceGroups/{ResourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/inVMAccessControlProfiles/{profile}/versions/{version}. + :vartype in_vm_access_control_profile_reference_id: str + """ + + mode: Optional[Union[str, "_models.Modes"]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Specifies the execution mode. In Audit mode, the system acts as if it is enforcing the access + control policy, including emitting access denial entries in the logs but it does not actually + deny any requests to host endpoints. In Enforce mode, the system will enforce the access + control and it is the recommended mode of operation. Known values are: \"Audit\", \"Enforce\", + and \"Disabled\".""" + in_vm_access_control_profile_reference_id: Optional[str] = rest_field( + name="inVMAccessControlProfileReferenceId", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies the InVMAccessControlProfileVersion resource id in the format of + /subscriptions/{SubscriptionId}/resourceGroups/{ResourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/inVMAccessControlProfiles/{profile}/versions/{version}.""" + + @overload + def __init__( + self, + *, + mode: Optional[Union[str, "_models.Modes"]] = None, + in_vm_access_control_profile_reference_id: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class Image(TrackedResource): + """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. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.compute.models.SystemData + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar location: The geo-location where the resource lives. Required. + :vartype location: str + :ivar properties: Describes the properties of an Image. + :vartype properties: ~azure.mgmt.compute.models.ImageProperties + :ivar extended_location: The extended location of the Image. + :vartype extended_location: ~azure.mgmt.compute.models.ExtendedLocation + """ + + properties: Optional["_models.ImageProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Describes the properties of an Image.""" + extended_location: Optional["_models.ExtendedLocation"] = rest_field( + name="extendedLocation", visibility=["read", "create", "update", "delete", "query"] + ) + """The extended location of the Image.""" + + @overload + def __init__( + self, + *, + location: str, + tags: Optional[dict[str, str]] = None, + properties: Optional["_models.ImageProperties"] = None, + extended_location: Optional["_models.ExtendedLocation"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ImageDisk(_Model): + """Describes a image disk. + + :ivar snapshot: The snapshot. + :vartype snapshot: ~azure.mgmt.compute.models.SubResource + :ivar managed_disk: The managedDisk. + :vartype managed_disk: ~azure.mgmt.compute.models.SubResource + :ivar blob_uri: The Virtual Hard Disk. + :vartype blob_uri: str + :ivar caching: Specifies the caching requirements. Possible values are: **None,** **ReadOnly,** + **ReadWrite.** The default values are: **None for Standard storage. ReadOnly for Premium + storage.**. Known values are: "None", "ReadOnly", and "ReadWrite". + :vartype caching: str or ~azure.mgmt.compute.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. 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. Known values + are: "Standard_LRS", "Premium_LRS", "StandardSSD_LRS", "UltraSSD_LRS", "Premium_ZRS", + "StandardSSD_ZRS", and "PremiumV2_LRS". + :vartype storage_account_type: str or ~azure.mgmt.compute.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.models.DiskEncryptionSetParameters + """ + + snapshot: Optional["_models.SubResource"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The snapshot.""" + managed_disk: Optional["_models.SubResource"] = rest_field( + name="managedDisk", visibility=["read", "create", "update", "delete", "query"] + ) + """The managedDisk.""" + blob_uri: Optional[str] = rest_field(name="blobUri", visibility=["read", "create", "update", "delete", "query"]) + """The Virtual Hard Disk.""" + caching: Optional[Union[str, "_models.CachingTypes"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies the caching requirements. Possible values are: **None,** **ReadOnly,** **ReadWrite.** + The default values are: **None for Standard storage. ReadOnly for Premium storage.**. Known + values are: \"None\", \"ReadOnly\", and \"ReadWrite\".""" + disk_size_gb: Optional[int] = rest_field( + name="diskSizeGB", visibility=["read", "create", "update", "delete", "query"] + ) + """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. This value cannot be larger than 1023 GB.""" + storage_account_type: Optional[Union[str, "_models.StorageAccountTypes"]] = rest_field( + name="storageAccountType", visibility=["read", "create", "update", "delete", "query"] + ) + """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. Known values are: \"Standard_LRS\", + \"Premium_LRS\", \"StandardSSD_LRS\", \"UltraSSD_LRS\", \"Premium_ZRS\", \"StandardSSD_ZRS\", + and \"PremiumV2_LRS\".""" + disk_encryption_set: Optional["_models.DiskEncryptionSetParameters"] = rest_field( + name="diskEncryptionSet", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies the customer managed disk encryption set resource id for the managed image disk.""" + + @overload + def __init__( + self, + *, + snapshot: Optional["_models.SubResource"] = None, + managed_disk: Optional["_models.SubResource"] = None, + blob_uri: Optional[str] = None, + caching: Optional[Union[str, "_models.CachingTypes"]] = None, + disk_size_gb: Optional[int] = None, + storage_account_type: Optional[Union[str, "_models.StorageAccountTypes"]] = None, + disk_encryption_set: Optional["_models.DiskEncryptionSetParameters"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ImageDataDisk(ImageDisk): + """Describes a data disk. + + :ivar snapshot: The snapshot. + :vartype snapshot: ~azure.mgmt.compute.models.SubResource + :ivar managed_disk: The managedDisk. + :vartype managed_disk: ~azure.mgmt.compute.models.SubResource + :ivar blob_uri: The Virtual Hard Disk. + :vartype blob_uri: str + :ivar caching: Specifies the caching requirements. Possible values are: **None,** **ReadOnly,** + **ReadWrite.** The default values are: **None for Standard storage. ReadOnly for Premium + storage.**. Known values are: "None", "ReadOnly", and "ReadWrite". + :vartype caching: str or ~azure.mgmt.compute.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. 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. Known values + are: "Standard_LRS", "Premium_LRS", "StandardSSD_LRS", "UltraSSD_LRS", "Premium_ZRS", + "StandardSSD_ZRS", and "PremiumV2_LRS". + :vartype storage_account_type: str or ~azure.mgmt.compute.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.models.DiskEncryptionSetParameters + :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. + Required. + :vartype lun: int + """ + + lun: int = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """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. Required.""" + + @overload + def __init__( + self, + *, + lun: int, + snapshot: Optional["_models.SubResource"] = None, + managed_disk: Optional["_models.SubResource"] = None, + blob_uri: Optional[str] = None, + caching: Optional[Union[str, "_models.CachingTypes"]] = None, + disk_size_gb: Optional[int] = None, + storage_account_type: Optional[Union[str, "_models.StorageAccountTypes"]] = None, + disk_encryption_set: Optional["_models.DiskEncryptionSetParameters"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ImageDeprecationStatus(_Model): + """Describes image deprecation status properties on the image. + + :ivar image_state: Describes the state of the image. Known values are: "Active", + "ScheduledForDeprecation", and "Deprecated". + :vartype image_state: str or ~azure.mgmt.compute.models.ImageState + :ivar scheduled_deprecation_time: The time, in future, at which this image will be marked as + deprecated. This scheduled time is chosen by the Publisher. + :vartype scheduled_deprecation_time: ~datetime.datetime + :ivar alternative_option: Describes the alternative option specified by the Publisher for this + image when this image is deprecated. + :vartype alternative_option: ~azure.mgmt.compute.models.AlternativeOption + """ + + image_state: Optional[Union[str, "_models.ImageState"]] = rest_field( + name="imageState", visibility=["read", "create", "update", "delete", "query"] + ) + """Describes the state of the image. Known values are: \"Active\", \"ScheduledForDeprecation\", + and \"Deprecated\".""" + scheduled_deprecation_time: Optional[datetime.datetime] = rest_field( + name="scheduledDeprecationTime", visibility=["read", "create", "update", "delete", "query"], format="rfc3339" + ) + """The time, in future, at which this image will be marked as deprecated. This scheduled time is + chosen by the Publisher.""" + alternative_option: Optional["_models.AlternativeOption"] = rest_field( + name="alternativeOption", visibility=["read", "create", "update", "delete", "query"] + ) + """Describes the alternative option specified by the Publisher for this image when this image is + deprecated.""" + + @overload + def __init__( + self, + *, + image_state: Optional[Union[str, "_models.ImageState"]] = None, + scheduled_deprecation_time: Optional[datetime.datetime] = None, + alternative_option: Optional["_models.AlternativeOption"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ImageDiskReference(_Model): + """The source image used for creating the disk. + + :ivar id: A relative uri containing either a Platform Image Repository, user image, or Azure + Compute Gallery image reference. + :vartype id: str + :ivar shared_gallery_image_id: A relative uri containing a direct shared Azure Compute Gallery + image reference. + :vartype shared_gallery_image_id: str + :ivar community_gallery_image_id: A relative uri containing a community Azure Compute Gallery + image reference. + :vartype community_gallery_image_id: str + :ivar lun: If the disk is created from an image's data disk, this is an index that indicates + which of the data disks in the image to use. For OS disks, this field is null. + :vartype lun: int + """ + + id: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """A relative uri containing either a Platform Image Repository, user image, or Azure Compute + Gallery image reference.""" + shared_gallery_image_id: Optional[str] = rest_field( + name="sharedGalleryImageId", visibility=["read", "create", "update", "delete", "query"] + ) + """A relative uri containing a direct shared Azure Compute Gallery image reference.""" + community_gallery_image_id: Optional[str] = rest_field( + name="communityGalleryImageId", visibility=["read", "create", "update", "delete", "query"] + ) + """A relative uri containing a community Azure Compute Gallery image reference.""" + lun: Optional[int] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """If the disk is created from an image's data disk, this is an index that indicates which of the + data disks in the image to use. For OS disks, this field is null.""" + + @overload + def __init__( + self, + *, + id: Optional[str] = None, # pylint: disable=redefined-builtin + shared_gallery_image_id: Optional[str] = None, + community_gallery_image_id: Optional[str] = None, + lun: Optional[int] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ImageOSDisk(ImageDisk): + """Describes an Operating System disk. + + :ivar snapshot: The snapshot. + :vartype snapshot: ~azure.mgmt.compute.models.SubResource + :ivar managed_disk: The managedDisk. + :vartype managed_disk: ~azure.mgmt.compute.models.SubResource + :ivar blob_uri: The Virtual Hard Disk. + :vartype blob_uri: str + :ivar caching: Specifies the caching requirements. Possible values are: **None,** **ReadOnly,** + **ReadWrite.** The default values are: **None for Standard storage. ReadOnly for Premium + storage.**. Known values are: "None", "ReadOnly", and "ReadWrite". + :vartype caching: str or ~azure.mgmt.compute.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. 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. Known values + are: "Standard_LRS", "Premium_LRS", "StandardSSD_LRS", "UltraSSD_LRS", "Premium_ZRS", + "StandardSSD_ZRS", and "PremiumV2_LRS". + :vartype storage_account_type: str or ~azure.mgmt.compute.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.models.DiskEncryptionSetParameters + :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 a custom image. Possible values are: **Windows,** **Linux.**. + Required. Known values are: "Windows" and "Linux". + :vartype os_type: str or ~azure.mgmt.compute.models.OperatingSystemTypes + :ivar os_state: The OS State. For managed images, use Generalized. Required. Known values are: + "Generalized" and "Specialized". + :vartype os_state: str or ~azure.mgmt.compute.models.OperatingSystemStateTypes + """ + + os_type: Union[str, "_models.OperatingSystemTypes"] = rest_field( + name="osType", visibility=["read", "create", "update", "delete", "query"] + ) + """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. Possible values are: **Windows,** **Linux.**. Required. Known values + are: \"Windows\" and \"Linux\".""" + os_state: Union[str, "_models.OperatingSystemStateTypes"] = rest_field( + name="osState", visibility=["read", "create", "update", "delete", "query"] + ) + """The OS State. For managed images, use Generalized. Required. Known values are: \"Generalized\" + and \"Specialized\".""" + + @overload + def __init__( + self, + *, + os_type: Union[str, "_models.OperatingSystemTypes"], + os_state: Union[str, "_models.OperatingSystemStateTypes"], + snapshot: Optional["_models.SubResource"] = None, + managed_disk: Optional["_models.SubResource"] = None, + blob_uri: Optional[str] = None, + caching: Optional[Union[str, "_models.CachingTypes"]] = None, + disk_size_gb: Optional[int] = None, + storage_account_type: Optional[Union[str, "_models.StorageAccountTypes"]] = None, + disk_encryption_set: Optional["_models.DiskEncryptionSetParameters"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ImageProperties(_Model): + """Describes the properties of an Image. + + :ivar source_virtual_machine: The source virtual machine from which Image is created. + :vartype source_virtual_machine: ~azure.mgmt.compute.models.SubResource + :ivar storage_profile: Specifies the storage settings for the virtual machine disks. + :vartype storage_profile: ~azure.mgmt.compute.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. Known + values are: "V1" and "V2". + :vartype hyper_v_generation: str or ~azure.mgmt.compute.models.HyperVGenerationTypes + """ + + source_virtual_machine: Optional["_models.SubResource"] = rest_field( + name="sourceVirtualMachine", visibility=["read", "create", "update", "delete", "query"] + ) + """The source virtual machine from which Image is created.""" + storage_profile: Optional["_models.ImageStorageProfile"] = rest_field( + name="storageProfile", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies the storage settings for the virtual machine disks.""" + provisioning_state: Optional[str] = rest_field(name="provisioningState", visibility=["read"]) + """The provisioning state.""" + hyper_v_generation: Optional[Union[str, "_models.HyperVGenerationTypes"]] = rest_field( + name="hyperVGeneration", visibility=["read", "create", "update", "delete", "query"] + ) + """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. Known values are: \"V1\" and + \"V2\".""" + + @overload + def __init__( + self, + *, + source_virtual_machine: Optional["_models.SubResource"] = None, + storage_profile: Optional["_models.ImageStorageProfile"] = None, + hyper_v_generation: Optional[Union[str, "_models.HyperVGenerationTypes"]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ImagePurchasePlan(_Model): + """Describes the gallery image definition purchase plan. This is used by marketplace images. + + :ivar name: The plan ID. + :vartype name: str + :ivar publisher: The publisher ID. + :vartype publisher: str + :ivar product: The product ID. + :vartype product: str + """ + + name: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The plan ID.""" + publisher: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The publisher ID.""" + product: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The product ID.""" + + @overload + def __init__( + self, + *, + name: Optional[str] = None, + publisher: Optional[str] = None, + product: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +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. + + :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 + """ + + publisher: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The image publisher.""" + offer: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Specifies the offer of the platform image or marketplace image used to create the virtual + machine.""" + sku: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The image SKU.""" + version: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """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.""" + exact_version: Optional[str] = rest_field(name="exactVersion", visibility=["read"]) + """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'.""" + shared_gallery_image_id: Optional[str] = rest_field( + name="sharedGalleryImageId", visibility=["read", "create", "update", "delete", "query"] + ) + """Specified the shared gallery image unique id for vm deployment. This can be fetched from shared + gallery image GET call.""" + community_gallery_image_id: Optional[str] = rest_field( + name="communityGalleryImageId", visibility=["read", "create", "update", "delete", "query"] + ) + """Specified the community gallery image unique id for vm deployment. This can be fetched from + community gallery image GET call.""" + + @overload + def __init__( + self, + *, + id: Optional[str] = None, # pylint: disable=redefined-builtin + 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, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ImageStorageProfile(_Model): + """Describes a storage profile. + + :ivar os_disk: Specifies information about the operating system disk used by the virtual + machine.

For more information about disks, see `About disks and VHDs for Azure virtual + machines `_. + :vartype os_disk: ~azure.mgmt.compute.models.ImageOSDisk + :ivar data_disks: Specifies the parameters that are used to add a data disk to a virtual + machine.

For more information about disks, see `About disks and VHDs for Azure virtual + machines `_. + :vartype data_disks: list[~azure.mgmt.compute.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 + """ + + os_disk: Optional["_models.ImageOSDisk"] = rest_field( + name="osDisk", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies information about the operating system disk used by the virtual machine.

For + more information about disks, see `About disks and VHDs for Azure virtual machines + `_.""" + data_disks: Optional[list["_models.ImageDataDisk"]] = rest_field( + name="dataDisks", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies the parameters that are used to add a data disk to a virtual machine.

For + more information about disks, see `About disks and VHDs for Azure virtual machines + `_.""" + zone_resilient: Optional[bool] = rest_field( + name="zoneResilient", visibility=["read", "create", "update", "delete", "query"] + ) + """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).""" + + @overload + def __init__( + self, + *, + os_disk: Optional["_models.ImageOSDisk"] = None, + data_disks: Optional[list["_models.ImageDataDisk"]] = None, + zone_resilient: Optional[bool] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ImageUpdate(UpdateResource): + """The source user image virtual hard disk. Only tags may be updated. + + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar properties: Describes the properties of an Image. + :vartype properties: ~azure.mgmt.compute.models.ImageProperties + """ + + properties: Optional["_models.ImageProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Describes the properties of an Image.""" + + @overload + def __init__( + self, + *, + tags: Optional[dict[str, str]] = None, + properties: Optional["_models.ImageProperties"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ImageVersionSecurityProfile(_Model): + """The security profile of a gallery image version. + + :ivar uefi_settings: Contains UEFI settings for the image version. + :vartype uefi_settings: ~azure.mgmt.compute.models.GalleryImageVersionUefiSettings + """ + + uefi_settings: Optional["_models.GalleryImageVersionUefiSettings"] = rest_field( + name="uefiSettings", visibility=["read", "create", "update", "delete", "query"] + ) + """Contains UEFI settings for the image version.""" + + @overload + def __init__( + self, + *, + uefi_settings: Optional["_models.GalleryImageVersionUefiSettings"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class InnerError(_Model): + """Inner error details. + + :ivar exceptiontype: The exception type. + :vartype exceptiontype: str + :ivar errordetail: The internal error message or exception dump. + :vartype errordetail: str + """ + + exceptiontype: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The exception type.""" + errordetail: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The internal error message or exception dump.""" + + @overload + def __init__( + self, + *, + exceptiontype: Optional[str] = None, + errordetail: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class InstanceViewStatus(_Model): + """Instance view status. + + :ivar code: The status code. + :vartype code: str + :ivar level: The level code. Known values are: "Info", "Warning", and "Error". + :vartype level: str or ~azure.mgmt.compute.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 + """ + + code: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The status code.""" + level: Optional[Union[str, "_models.StatusLevelTypes"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The level code. Known values are: \"Info\", \"Warning\", and \"Error\".""" + display_status: Optional[str] = rest_field( + name="displayStatus", visibility=["read", "create", "update", "delete", "query"] + ) + """The short localizable label for the status.""" + message: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The detailed status message, including for alerts and error messages.""" + time: Optional[datetime.datetime] = rest_field( + visibility=["read", "create", "update", "delete", "query"], format="rfc3339" + ) + """The time of the status.""" + + @overload + def __init__( + self, + *, + code: Optional[str] = None, + level: Optional[Union[str, "_models.StatusLevelTypes"]] = None, + display_status: Optional[str] = None, + message: Optional[str] = None, + time: Optional[datetime.datetime] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class KeyForDiskEncryptionSet(_Model): + """Key Vault Key Url to be used for server side encryption of Managed Disks and Snapshots. + + :ivar source_vault: Resource id of the KeyVault containing the key or secret. This property is + optional and cannot be used if the KeyVault subscription is not the same as the Disk Encryption + Set subscription. + :vartype source_vault: ~azure.mgmt.compute.models.SourceVault + :ivar key_url: Fully versioned Key Url pointing to a key in KeyVault. Version segment of the + Url is required regardless of rotationToLatestKeyVersionEnabled value. Required. + :vartype key_url: str + """ + + source_vault: Optional["_models.SourceVault"] = rest_field( + name="sourceVault", visibility=["read", "create", "update", "delete", "query"] + ) + """Resource id of the KeyVault containing the key or secret. This property is optional and cannot + be used if the KeyVault subscription is not the same as the Disk Encryption Set subscription.""" + key_url: str = rest_field(name="keyUrl", visibility=["read", "create", "update", "delete", "query"]) + """Fully versioned Key Url pointing to a key in KeyVault. Version segment of the Url is required + regardless of rotationToLatestKeyVersionEnabled value. Required.""" + + @overload + def __init__( + self, + *, + key_url: str, + source_vault: Optional["_models.SourceVault"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class KeyVaultAndKeyReference(_Model): + """Key Vault Key Url and vault id of KeK, KeK is optional and when provided is used to unwrap the + encryptionKey. + + :ivar source_vault: Resource id of the KeyVault containing the key or secret. Required. + :vartype source_vault: ~azure.mgmt.compute.models.SourceVault + :ivar key_url: Url pointing to a key or secret in KeyVault. Required. + :vartype key_url: str + """ + + source_vault: "_models.SourceVault" = rest_field( + name="sourceVault", visibility=["read", "create", "update", "delete", "query"] + ) + """Resource id of the KeyVault containing the key or secret. Required.""" + key_url: str = rest_field(name="keyUrl", visibility=["read", "create", "update", "delete", "query"]) + """Url pointing to a key or secret in KeyVault. Required.""" + + @overload + def __init__( + self, + *, + source_vault: "_models.SourceVault", + key_url: str, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class KeyVaultAndSecretReference(_Model): + """Key Vault Secret Url and vault id of the encryption key. + + :ivar source_vault: Resource id of the KeyVault containing the key or secret. Required. + :vartype source_vault: ~azure.mgmt.compute.models.SourceVault + :ivar secret_url: Url pointing to a key or secret in KeyVault. Required. + :vartype secret_url: str + """ + + source_vault: "_models.SourceVault" = rest_field( + name="sourceVault", visibility=["read", "create", "update", "delete", "query"] + ) + """Resource id of the KeyVault containing the key or secret. Required.""" + secret_url: str = rest_field(name="secretUrl", visibility=["read", "create", "update", "delete", "query"]) + """Url pointing to a key or secret in KeyVault. Required.""" + + @overload + def __init__( + self, + *, + source_vault: "_models.SourceVault", + secret_url: str, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class KeyVaultKeyReference(_Model): + """Describes a reference to Key Vault Key. + + :ivar key_url: The URL referencing a key encryption key in Key Vault. Required. + :vartype key_url: str + :ivar source_vault: The relative URL of the Key Vault containing the key. Required. + :vartype source_vault: ~azure.mgmt.compute.models.SubResource + """ + + key_url: str = rest_field(name="keyUrl", visibility=["read", "create", "update", "delete", "query"]) + """The URL referencing a key encryption key in Key Vault. Required.""" + source_vault: "_models.SubResource" = rest_field( + name="sourceVault", visibility=["read", "create", "update", "delete", "query"] + ) + """The relative URL of the Key Vault containing the key. Required.""" + + @overload + def __init__( + self, + *, + key_url: str, + source_vault: "_models.SubResource", + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class KeyVaultSecretReference(_Model): + """Describes a reference to Key Vault Secret. + + :ivar secret_url: The URL referencing a secret in a Key Vault. Required. + :vartype secret_url: str + :ivar source_vault: The relative URL of the Key Vault containing the secret. Required. + :vartype source_vault: ~azure.mgmt.compute.models.SubResource + """ + + secret_url: str = rest_field(name="secretUrl", visibility=["read", "create", "update", "delete", "query"]) + """The URL referencing a secret in a Key Vault. Required.""" + source_vault: "_models.SubResource" = rest_field( + name="sourceVault", visibility=["read", "create", "update", "delete", "query"] + ) + """The relative URL of the Key Vault containing the secret. Required.""" + + @overload + def __init__( + self, + *, + secret_url: str, + source_vault: "_models.SubResource", + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class LastPatchInstallationSummary(_Model): + """Describes the properties of the last installed patch summary. + + :ivar status: The overall success or failure status of the operation. It remains "InProgress" + until the operation completes. At that point it will become "Unknown", "Failed", "Succeeded", + or "CompletedWithWarnings.". Known values are: "Unknown", "InProgress", "Failed", "Succeeded", + and "CompletedWithWarnings". + :vartype status: str or ~azure.mgmt.compute.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.models.ApiError + """ + + status: Optional[Union[str, "_models.PatchOperationStatus"]] = rest_field(visibility=["read"]) + """The overall success or failure status of the operation. It remains \"InProgress\" until the + operation completes. At that point it will become \"Unknown\", \"Failed\", \"Succeeded\", or + \"CompletedWithWarnings.\". Known values are: \"Unknown\", \"InProgress\", \"Failed\", + \"Succeeded\", and \"CompletedWithWarnings\".""" + installation_activity_id: Optional[str] = rest_field(name="installationActivityId", visibility=["read"]) + """The activity ID of the operation that produced this result. It is used to correlate across CRP + and extension logs.""" + maintenance_window_exceeded: Optional[bool] = rest_field(name="maintenanceWindowExceeded", visibility=["read"]) + """Describes whether the operation ran out of time before it completed all its intended actions.""" + not_selected_patch_count: Optional[int] = rest_field(name="notSelectedPatchCount", visibility=["read"]) + """The number of all available patches but not going to be installed because it didn't match a + classification or inclusion list entry.""" + excluded_patch_count: Optional[int] = rest_field(name="excludedPatchCount", visibility=["read"]) + """The number of all available patches but excluded explicitly by a customer-specified exclusion + list match.""" + pending_patch_count: Optional[int] = rest_field(name="pendingPatchCount", visibility=["read"]) + """The number of all available patches expected to be installed over the course of the patch + installation operation.""" + installed_patch_count: Optional[int] = rest_field(name="installedPatchCount", visibility=["read"]) + """The count of patches that successfully installed.""" + failed_patch_count: Optional[int] = rest_field(name="failedPatchCount", visibility=["read"]) + """The count of patches that failed installation.""" + start_time: Optional[datetime.datetime] = rest_field(name="startTime", visibility=["read"], format="rfc3339") + """The UTC timestamp when the operation began.""" + last_modified_time: Optional[datetime.datetime] = rest_field( + name="lastModifiedTime", visibility=["read"], format="rfc3339" + ) + """The UTC timestamp when the operation began.""" + error: Optional["_models.ApiError"] = rest_field(visibility=["read"]) + """The errors that were encountered during execution of the operation. The details array contains + the list of them.""" + + +class LinuxConfiguration(_Model): + """Specifies the Linux operating system settings on the virtual machine. 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.models.SshConfiguration + :ivar provision_vm_agent: Indicates whether virtual machine agent should be provisioned on the + virtual machine. 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.models.LinuxPatchSettings + :ivar enable_vm_agent_platform_updates: Indicates whether VMAgent Platform Updates is enabled + for the Linux virtual machine. Default value is false. + :vartype enable_vm_agent_platform_updates: bool + """ + + disable_password_authentication: Optional[bool] = rest_field( + name="disablePasswordAuthentication", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies whether password authentication should be disabled.""" + ssh: Optional["_models.SshConfiguration"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Specifies the ssh key configuration for a Linux OS.""" + provision_vm_agent: Optional[bool] = rest_field( + name="provisionVMAgent", visibility=["read", "create", "update", "delete", "query"] + ) + """Indicates whether virtual machine agent should be provisioned on the virtual machine. 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.""" + patch_settings: Optional["_models.LinuxPatchSettings"] = rest_field( + name="patchSettings", visibility=["read", "create", "update", "delete", "query"] + ) + """[Preview Feature] Specifies settings related to VM Guest Patching on Linux.""" + enable_vm_agent_platform_updates: Optional[bool] = rest_field( + name="enableVMAgentPlatformUpdates", visibility=["read", "create", "update", "delete", "query"] + ) + """Indicates whether VMAgent Platform Updates is enabled for the Linux virtual machine. Default + value is false.""" + + @overload + def __init__( + self, + *, + disable_password_authentication: Optional[bool] = None, + ssh: Optional["_models.SshConfiguration"] = None, + provision_vm_agent: Optional[bool] = None, + patch_settings: Optional["_models.LinuxPatchSettings"] = None, + enable_vm_agent_platform_updates: Optional[bool] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class LinuxParameters(_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.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 + """ + + classifications_to_include: Optional[list[Union[str, "_models.VMGuestPatchClassificationLinux"]]] = rest_field( + name="classificationsToInclude", visibility=["read", "create", "update", "delete", "query"] + ) + """The update classifications to select when installing patches for Linux.""" + package_name_masks_to_include: Optional[list[str]] = rest_field( + name="packageNameMasksToInclude", visibility=["read", "create", "update", "delete", "query"] + ) + """packages to include in the patch operation. Format: packageName_packageVersion.""" + package_name_masks_to_exclude: Optional[list[str]] = rest_field( + name="packageNameMasksToExclude", visibility=["read", "create", "update", "delete", "query"] + ) + """packages to exclude in the patch operation. Format: packageName_packageVersion.""" + maintenance_run_id: Optional[str] = rest_field( + name="maintenanceRunId", visibility=["read", "create", "update", "delete", "query"] + ) + """This is used as a maintenance run identifier for Auto VM Guest Patching in Linux.""" + + @overload + def __init__( + self, + *, + classifications_to_include: Optional[list[Union[str, "_models.VMGuestPatchClassificationLinux"]]] = None, + package_name_masks_to_include: Optional[list[str]] = None, + package_name_masks_to_exclude: Optional[list[str]] = None, + maintenance_run_id: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class LinuxPatchSettings(_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.

Possible values are:

**ImageDefault** - The virtual machine's default patching + configuration is used.

**AutomaticByPlatform** - The virtual machine will be + automatically updated by the platform. The property provisionVMAgent must be true. Known values + are: "ImageDefault" and "AutomaticByPlatform". + :vartype patch_mode: str or ~azure.mgmt.compute.models.LinuxVMGuestPatchMode + :ivar assessment_mode: Specifies the mode of VM Guest Patch Assessment for the IaaS virtual + machine.

Possible values are:

**ImageDefault** - You control the timing + of patch assessments on a virtual machine.

**AutomaticByPlatform** - The platform + will trigger periodic patch assessments. The property provisionVMAgent must be true. Known + values are: "ImageDefault" and "AutomaticByPlatform". + :vartype assessment_mode: str or ~azure.mgmt.compute.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.models.LinuxVMGuestPatchAutomaticByPlatformSettings + """ + + patch_mode: Optional[Union[str, "_models.LinuxVMGuestPatchMode"]] = rest_field( + name="patchMode", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies the mode of VM Guest Patching to IaaS virtual machine or virtual machines associated + to virtual machine scale set with OrchestrationMode as Flexible.

Possible values + are:

**ImageDefault** - The virtual machine's default patching configuration is + used.

**AutomaticByPlatform** - The virtual machine will be automatically updated + by the platform. The property provisionVMAgent must be true. Known values are: \"ImageDefault\" + and \"AutomaticByPlatform\".""" + assessment_mode: Optional[Union[str, "_models.LinuxPatchAssessmentMode"]] = rest_field( + name="assessmentMode", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies the mode of VM Guest Patch Assessment for the IaaS virtual machine.

+ Possible values are:

**ImageDefault** - You control the timing of patch assessments + on a virtual machine.

**AutomaticByPlatform** - The platform will trigger periodic + patch assessments. The property provisionVMAgent must be true. Known values are: + \"ImageDefault\" and \"AutomaticByPlatform\".""" + automatic_by_platform_settings: Optional["_models.LinuxVMGuestPatchAutomaticByPlatformSettings"] = rest_field( + name="automaticByPlatformSettings", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies additional settings for patch mode AutomaticByPlatform in VM Guest Patching on Linux.""" + + @overload + def __init__( + self, + *, + patch_mode: Optional[Union[str, "_models.LinuxVMGuestPatchMode"]] = None, + assessment_mode: Optional[Union[str, "_models.LinuxPatchAssessmentMode"]] = None, + automatic_by_platform_settings: Optional["_models.LinuxVMGuestPatchAutomaticByPlatformSettings"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class LinuxVMGuestPatchAutomaticByPlatformSettings(_Model): # pylint: disable=name-too-long + """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. Known values are: "Unknown", "IfRequired", "Never", and "Always". + :vartype reboot_setting: str or + ~azure.mgmt.compute.models.LinuxVMGuestPatchAutomaticByPlatformRebootSetting + :ivar bypass_platform_safety_checks_on_user_schedule: Enables customer to schedule patching + without accidental upgrades. + :vartype bypass_platform_safety_checks_on_user_schedule: bool + """ + + reboot_setting: Optional[Union[str, "_models.LinuxVMGuestPatchAutomaticByPlatformRebootSetting"]] = rest_field( + name="rebootSetting", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies the reboot setting for all AutomaticByPlatform patch installation operations. Known + values are: \"Unknown\", \"IfRequired\", \"Never\", and \"Always\".""" + bypass_platform_safety_checks_on_user_schedule: Optional[bool] = rest_field( + name="bypassPlatformSafetyChecksOnUserSchedule", visibility=["read", "create", "update", "delete", "query"] + ) + """Enables customer to schedule patching without accidental upgrades.""" + + @overload + def __init__( + self, + *, + reboot_setting: Optional[Union[str, "_models.LinuxVMGuestPatchAutomaticByPlatformRebootSetting"]] = None, + bypass_platform_safety_checks_on_user_schedule: Optional[bool] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class LogAnalyticsInputBase(_Model): + """Api input base class for LogAnalytics Api. + + :ivar blob_container_sas_uri: SAS Uri of the logging blob container to which LogAnalytics Api + writes output logs to. Required. + :vartype blob_container_sas_uri: str + :ivar from_time: From time of the query. Required. + :vartype from_time: ~datetime.datetime + :ivar to_time: To time of the query. Required. + :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 + """ + + blob_container_sas_uri: str = rest_field( + name="blobContainerSasUri", visibility=["read", "create", "update", "delete", "query"] + ) + """SAS Uri of the logging blob container to which LogAnalytics Api writes output logs to. + Required.""" + from_time: datetime.datetime = rest_field( + name="fromTime", visibility=["read", "create", "update", "delete", "query"], format="rfc3339" + ) + """From time of the query. Required.""" + to_time: datetime.datetime = rest_field( + name="toTime", visibility=["read", "create", "update", "delete", "query"], format="rfc3339" + ) + """To time of the query. Required.""" + group_by_throttle_policy: Optional[bool] = rest_field( + name="groupByThrottlePolicy", visibility=["read", "create", "update", "delete", "query"] + ) + """Group query result by Throttle Policy applied.""" + group_by_operation_name: Optional[bool] = rest_field( + name="groupByOperationName", visibility=["read", "create", "update", "delete", "query"] + ) + """Group query result by Operation Name.""" + group_by_resource_name: Optional[bool] = rest_field( + name="groupByResourceName", visibility=["read", "create", "update", "delete", "query"] + ) + """Group query result by Resource Name.""" + group_by_client_application_id: Optional[bool] = rest_field( + name="groupByClientApplicationId", visibility=["read", "create", "update", "delete", "query"] + ) + """Group query result by Client Application ID.""" + group_by_user_agent: Optional[bool] = rest_field( + name="groupByUserAgent", visibility=["read", "create", "update", "delete", "query"] + ) + """Group query result by User Agent.""" + + @overload + 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, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class MaintenanceRedeployStatus(_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. Known values are: + "None", "RetryLater", "MaintenanceAborted", and "MaintenanceCompleted". + :vartype last_operation_result_code: str or + ~azure.mgmt.compute.models.MaintenanceOperationResultCodeTypes + :ivar last_operation_message: Message returned for the last Maintenance Operation. + :vartype last_operation_message: str + """ + + is_customer_initiated_maintenance_allowed: Optional[bool] = rest_field( + name="isCustomerInitiatedMaintenanceAllowed", visibility=["read", "create", "update", "delete", "query"] + ) + """True, if customer is allowed to perform Maintenance.""" + pre_maintenance_window_start_time: Optional[datetime.datetime] = rest_field( + name="preMaintenanceWindowStartTime", + visibility=["read", "create", "update", "delete", "query"], + format="rfc3339", + ) + """Start Time for the Pre Maintenance Window.""" + pre_maintenance_window_end_time: Optional[datetime.datetime] = rest_field( + name="preMaintenanceWindowEndTime", visibility=["read", "create", "update", "delete", "query"], format="rfc3339" + ) + """End Time for the Pre Maintenance Window.""" + maintenance_window_start_time: Optional[datetime.datetime] = rest_field( + name="maintenanceWindowStartTime", visibility=["read", "create", "update", "delete", "query"], format="rfc3339" + ) + """Start Time for the Maintenance Window.""" + maintenance_window_end_time: Optional[datetime.datetime] = rest_field( + name="maintenanceWindowEndTime", visibility=["read", "create", "update", "delete", "query"], format="rfc3339" + ) + """End Time for the Maintenance Window.""" + last_operation_result_code: Optional[Union[str, "_models.MaintenanceOperationResultCodeTypes"]] = rest_field( + name="lastOperationResultCode", visibility=["read", "create", "update", "delete", "query"] + ) + """The Last Maintenance Operation Result Code. Known values are: \"None\", \"RetryLater\", + \"MaintenanceAborted\", and \"MaintenanceCompleted\".""" + last_operation_message: Optional[str] = rest_field( + name="lastOperationMessage", visibility=["read", "create", "update", "delete", "query"] + ) + """Message returned for the last Maintenance Operation.""" + + @overload + 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, "_models.MaintenanceOperationResultCodeTypes"]] = None, + last_operation_message: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +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. Known values + are: "Standard_LRS", "Premium_LRS", "StandardSSD_LRS", "UltraSSD_LRS", "Premium_ZRS", + "StandardSSD_ZRS", and "PremiumV2_LRS". + :vartype storage_account_type: str or ~azure.mgmt.compute.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.models.DiskEncryptionSetParameters + :ivar security_profile: Specifies the security profile for the managed disk. + :vartype security_profile: ~azure.mgmt.compute.models.VMDiskSecurityProfile + """ + + storage_account_type: Optional[Union[str, "_models.StorageAccountTypes"]] = rest_field( + name="storageAccountType", visibility=["read", "create", "update", "delete", "query"] + ) + """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. Known values are: \"Standard_LRS\", + \"Premium_LRS\", \"StandardSSD_LRS\", \"UltraSSD_LRS\", \"Premium_ZRS\", \"StandardSSD_ZRS\", + and \"PremiumV2_LRS\".""" + disk_encryption_set: Optional["_models.DiskEncryptionSetParameters"] = rest_field( + name="diskEncryptionSet", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies the customer managed disk encryption set resource id for the managed disk.""" + security_profile: Optional["_models.VMDiskSecurityProfile"] = rest_field( + name="securityProfile", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies the security profile for the managed disk.""" + + @overload + def __init__( + self, + *, + id: Optional[str] = None, # pylint: disable=redefined-builtin + storage_account_type: Optional[Union[str, "_models.StorageAccountTypes"]] = None, + disk_encryption_set: Optional["_models.DiskEncryptionSetParameters"] = None, + security_profile: Optional["_models.VMDiskSecurityProfile"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class MaxInstancePercentPerZonePolicy(_Model): + """The configuration parameters used to limit the number of virtual machines per availability zone + in the virtual machine scale set. + + :ivar enabled: Specifies whether maxInstancePercentPerZonePolicy should be enabled on the + virtual machine scale set. + :vartype enabled: bool + :ivar value: Limit on the number of instances in each zone as a percentage of the total + capacity of the virtual machine scale set. + :vartype value: int + """ + + enabled: Optional[bool] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Specifies whether maxInstancePercentPerZonePolicy should be enabled on the virtual machine + scale set.""" + value: Optional[int] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Limit on the number of instances in each zone as a percentage of the total capacity of the + virtual machine scale set.""" + + @overload + def __init__( + self, + *, + enabled: Optional[bool] = None, + value: Optional[int] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class MigrateToVirtualMachineScaleSetInput(_Model): + """Describes the Virtual Machine Scale Set to migrate from Availability Set. + + :ivar virtual_machine_scale_set_flexible: Specifies information about the Virtual Machine Scale + Set that the Availability Set should be migrated to. Minimum api‐version: 2024‐11‐01. Required. + :vartype virtual_machine_scale_set_flexible: ~azure.mgmt.compute.models.SubResource + """ + + virtual_machine_scale_set_flexible: "_models.SubResource" = rest_field( + name="virtualMachineScaleSetFlexible", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies information about the Virtual Machine Scale Set that the Availability Set should be + migrated to. Minimum api‐version: 2024‐11‐01. Required.""" + + @overload + def __init__( + self, + *, + virtual_machine_scale_set_flexible: "_models.SubResource", + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class MigrateToVmScaleSetParameterBody(_Model): + """MigrateToVmScaleSetParameterBody. + + :ivar parameters: Parameters supplied to the Migrate Virtual Machine operation. + :vartype parameters: ~azure.mgmt.compute.models.MigrateVMToVirtualMachineScaleSetInput + """ + + parameters: Optional["_models.MigrateVMToVirtualMachineScaleSetInput"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Parameters supplied to the Migrate Virtual Machine operation.""" + + @overload + def __init__( + self, + *, + parameters: Optional["_models.MigrateVMToVirtualMachineScaleSetInput"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class MigrateVMToVirtualMachineScaleSetInput(_Model): + """The input of virtual machine migration from Availability Set to Flexible Virtual Machine Scale + Set. + + :ivar target_zone: The target zone of VM migration to Flexible Virtual Machine Scale Set. + :vartype target_zone: str + :ivar target_fault_domain: The target compute fault domain of VM migration to Flexible Virtual + Machine Scale Set. + :vartype target_fault_domain: int + :ivar target_vm_size: The target Virtual Machine size of VM migration to Flexible Virtual + Machine Scale Set. + :vartype target_vm_size: str + """ + + target_zone: Optional[str] = rest_field( + name="targetZone", visibility=["read", "create", "update", "delete", "query"] + ) + """The target zone of VM migration to Flexible Virtual Machine Scale Set.""" + target_fault_domain: Optional[int] = rest_field( + name="targetFaultDomain", visibility=["read", "create", "update", "delete", "query"] + ) + """The target compute fault domain of VM migration to Flexible Virtual Machine Scale Set.""" + target_vm_size: Optional[str] = rest_field( + name="targetVMSize", visibility=["read", "create", "update", "delete", "query"] + ) + """The target Virtual Machine size of VM migration to Flexible Virtual Machine Scale Set.""" + + @overload + def __init__( + self, + *, + target_zone: Optional[str] = None, + target_fault_domain: Optional[int] = None, + target_vm_size: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class NetworkInterfaceReference(SubResource): + """Describes a network interface reference. + + :ivar id: Resource Id. + :vartype id: str + :ivar properties: Describes a network interface reference properties. + :vartype properties: ~azure.mgmt.compute.models.NetworkInterfaceReferenceProperties + """ + + properties: Optional["_models.NetworkInterfaceReferenceProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Describes a network interface reference properties.""" + + @overload + def __init__( + self, + *, + id: Optional[str] = None, # pylint: disable=redefined-builtin + properties: Optional["_models.NetworkInterfaceReferenceProperties"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class NetworkInterfaceReferenceProperties(_Model): + """Describes a network interface reference properties. + + :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. + Known values are: "Delete" and "Detach". + :vartype delete_option: str or ~azure.mgmt.compute.models.DeleteOptions + """ + + primary: Optional[bool] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Specifies the primary network interface in case the virtual machine has more than 1 network + interface.""" + delete_option: Optional[Union[str, "_models.DeleteOptions"]] = rest_field( + name="deleteOption", visibility=["read", "create", "update", "delete", "query"] + ) + """Specify what happens to the network interface when the VM is deleted. Known values are: + \"Delete\" and \"Detach\".""" + + @overload + def __init__( + self, + *, + primary: Optional[bool] = None, + delete_option: Optional[Union[str, "_models.DeleteOptions"]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class NetworkProfile(_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.models.NetworkInterfaceReference] + :ivar network_api_version: specifies the Microsoft.Network API version used when creating + networking resources in the Network Interface Configurations. Known values are: "2020-11-01" + and "2022-11-01". + :vartype network_api_version: str or ~azure.mgmt.compute.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.models.VirtualMachineNetworkInterfaceConfiguration] + """ + + network_interfaces: Optional[list["_models.NetworkInterfaceReference"]] = rest_field( + name="networkInterfaces", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies the list of resource Ids for the network interfaces associated with the virtual + machine.""" + network_api_version: Optional[Union[str, "_models.NetworkApiVersion"]] = rest_field( + name="networkApiVersion", visibility=["read", "create", "update", "delete", "query"] + ) + """specifies the Microsoft.Network API version used when creating networking resources in the + Network Interface Configurations. Known values are: \"2020-11-01\" and \"2022-11-01\".""" + network_interface_configurations: Optional[list["_models.VirtualMachineNetworkInterfaceConfiguration"]] = ( + rest_field(name="networkInterfaceConfigurations", visibility=["read", "create", "update", "delete", "query"]) + ) + """Specifies the networking configurations that will be used to create the virtual machine + networking resources.""" + + @overload + def __init__( + self, + *, + network_interfaces: Optional[list["_models.NetworkInterfaceReference"]] = None, + network_api_version: Optional[Union[str, "_models.NetworkApiVersion"]] = None, + network_interface_configurations: Optional[list["_models.VirtualMachineNetworkInterfaceConfiguration"]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class OkResponse(_Model): + """The request has succeeded.""" + + +class Operation(_Model): + """REST API Operation. + + :ivar name: The name of the operation, as per Resource-Based Access Control (RBAC). Examples: + "Microsoft.Compute/virtualMachines/write", "Microsoft.Compute/virtualMachines/capture/action". + :vartype name: str + :ivar is_data_action: Whether the operation applies to data-plane. This is "true" for + data-plane operations and "false" for Azure Resource Manager/control-plane operations. + :vartype is_data_action: bool + :ivar display: Localized display information for this particular operation. + :vartype display: ~azure.mgmt.compute.models.OperationDisplay + :ivar origin: The intended executor of the operation; as in Resource Based Access Control + (RBAC) and audit logs UX. Default value is "user,system". Known values are: "user", "system", + and "user,system". + :vartype origin: str or ~azure.mgmt.compute.models.Origin + :ivar action_type: Extensible enum. Indicates the action type. "Internal" refers to actions + that are for internal only APIs. "Internal" + :vartype action_type: str or ~azure.mgmt.compute.models.ActionType + """ + + name: Optional[str] = rest_field(visibility=["read"]) + """The name of the operation, as per Resource-Based Access Control (RBAC). Examples: + \"Microsoft.Compute/virtualMachines/write\", + \"Microsoft.Compute/virtualMachines/capture/action\".""" + is_data_action: Optional[bool] = rest_field(name="isDataAction", visibility=["read"]) + """Whether the operation applies to data-plane. This is \"true\" for data-plane operations and + \"false\" for Azure Resource Manager/control-plane operations.""" + display: Optional["_models.OperationDisplay"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Localized display information for this particular operation.""" + origin: Optional[Union[str, "_models.Origin"]] = rest_field(visibility=["read"]) + """The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit + logs UX. Default value is \"user,system\". Known values are: \"user\", \"system\", and + \"user,system\".""" + action_type: Optional[Union[str, "_models.ActionType"]] = rest_field(name="actionType", visibility=["read"]) + """Extensible enum. Indicates the action type. \"Internal\" refers to actions that are for + internal only APIs. \"Internal\"""" + + @overload + def __init__( + self, + *, + display: Optional["_models.OperationDisplay"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class OperationDisplay(_Model): + """Localized display information for and operation. + + :ivar provider: The localized friendly form of the resource provider name, e.g. "Microsoft + Monitoring Insights" or "Microsoft Compute". + :vartype provider: str + :ivar resource: The localized friendly name of the resource type related to this operation. + E.g. "Virtual Machines" or "Job Schedule Collections". + :vartype resource: str + :ivar operation: The concise, localized friendly name for the operation; suitable for + dropdowns. E.g. "Create or Update Virtual Machine", "Restart Virtual Machine". + :vartype operation: str + :ivar description: The short, localized friendly description of the operation; suitable for + tool tips and detailed views. + :vartype description: str + """ + + provider: Optional[str] = rest_field(visibility=["read"]) + """The localized friendly form of the resource provider name, e.g. \"Microsoft Monitoring + Insights\" or \"Microsoft Compute\".""" + resource: Optional[str] = rest_field(visibility=["read"]) + """The localized friendly name of the resource type related to this operation. E.g. \"Virtual + Machines\" or \"Job Schedule Collections\".""" + operation: Optional[str] = rest_field(visibility=["read"]) + """The concise, localized friendly name for the operation; suitable for dropdowns. E.g. \"Create + or Update Virtual Machine\", \"Restart Virtual Machine\".""" + description: Optional[str] = rest_field(visibility=["read"]) + """The short, localized friendly description of the operation; suitable for tool tips and detailed + views.""" + + +class OrchestrationServiceStateInput(_Model): + """The input for OrchestrationServiceState. + + :ivar service_name: The name of the service. Required. Known values are: "AutomaticRepairs" and + "AutomaticZoneRebalancing". + :vartype service_name: str or ~azure.mgmt.compute.models.OrchestrationServiceNames + :ivar action: The action to be performed. Required. Known values are: "Resume" and "Suspend". + :vartype action: str or ~azure.mgmt.compute.models.OrchestrationServiceStateAction + """ + + service_name: Union[str, "_models.OrchestrationServiceNames"] = rest_field( + name="serviceName", visibility=["read", "create", "update", "delete", "query"] + ) + """The name of the service. Required. Known values are: \"AutomaticRepairs\" and + \"AutomaticZoneRebalancing\".""" + action: Union[str, "_models.OrchestrationServiceStateAction"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The action to be performed. Required. Known values are: \"Resume\" and \"Suspend\".""" + + @overload + def __init__( + self, + *, + service_name: Union[str, "_models.OrchestrationServiceNames"], + action: Union[str, "_models.OrchestrationServiceStateAction"], + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class OrchestrationServiceSummary(_Model): + """Summary for an orchestration service of a virtual machine scale set. + + :ivar service_name: The name of the service. Known values are: "AutomaticRepairs" and + "AutomaticZoneRebalancing". + :vartype service_name: str or ~azure.mgmt.compute.models.OrchestrationServiceNames + :ivar service_state: The current state of the service. Known values are: "NotRunning", + "Running", and "Suspended". + :vartype service_state: str or ~azure.mgmt.compute.models.OrchestrationServiceState + :ivar latest_operation_status: The latest operation status of the service. Minimum API version + for this property is 2025-04-01. Known values are: "InProgress" and "Completed". + :vartype latest_operation_status: str or + ~azure.mgmt.compute.models.OrchestrationServiceOperationStatus + :ivar last_status_change_time: The last UTC time when the operation status changed. Minimum API + version for this property is 2025-04-01. + :vartype last_status_change_time: ~datetime.datetime + """ + + service_name: Optional[Union[str, "_models.OrchestrationServiceNames"]] = rest_field( + name="serviceName", visibility=["read"] + ) + """The name of the service. Known values are: \"AutomaticRepairs\" and + \"AutomaticZoneRebalancing\".""" + service_state: Optional[Union[str, "_models.OrchestrationServiceState"]] = rest_field( + name="serviceState", visibility=["read"] + ) + """The current state of the service. Known values are: \"NotRunning\", \"Running\", and + \"Suspended\".""" + latest_operation_status: Optional[Union[str, "_models.OrchestrationServiceOperationStatus"]] = rest_field( + name="latestOperationStatus", visibility=["read"] + ) + """The latest operation status of the service. Minimum API version for this property is + 2025-04-01. Known values are: \"InProgress\" and \"Completed\".""" + last_status_change_time: Optional[datetime.datetime] = rest_field( + name="lastStatusChangeTime", visibility=["read"], format="rfc3339" + ) + """The last UTC time when the operation status changed. Minimum API version for this property is + 2025-04-01.""" + + +class OSDisk(_Model): + """Specifies information about the operating system disk used by the virtual machine. For more + information about disks, see `About disks and VHDs for Azure virtual machines + `_. + + :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. Possible values are: **Windows,** + **Linux.**. Known values are: "Windows" and "Linux". + :vartype os_type: str or ~azure.mgmt.compute.models.OperatingSystemTypes + :ivar encryption_settings: Specifies the encryption settings for the OS Disk. Minimum + api-version: 2015-06-15. + :vartype encryption_settings: ~azure.mgmt.compute.models.DiskEncryptionSettings + :ivar name: The disk name. + :vartype name: str + :ivar vhd: The virtual hard disk. + :vartype vhd: ~azure.mgmt.compute.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.models.VirtualHardDisk + :ivar caching: Specifies the caching requirements. Possible values are: **None,** **ReadOnly,** + **ReadWrite.** The defaulting behavior is: **None for Standard storage. ReadOnly for Premium + storage.**. Known values are: "None", "ReadOnly", and "ReadWrite". + :vartype caching: str or ~azure.mgmt.compute.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.models.DiffDiskSettings + :ivar create_option: Specifies how the virtual machine disk should be created. Possible values + are **Attach:** This value is used when you are using a specialized disk to create the virtual + machine. **FromImage:** This value is used when you are using an image to create the virtual + machine. If you are using a platform image, you should also use the imageReference element + described above. If you are using a marketplace image, you should also use the plan element + previously described. Required. Known values are: "FromImage", "Empty", "Attach", "Copy", and + "Restore". + :vartype create_option: str or ~azure.mgmt.compute.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. The property 'diskSizeGB' is + the number of bytes x 1024^3 for the disk and the value cannot be larger than 1023. + :vartype disk_size_gb: int + :ivar managed_disk: The managed disk parameters. + :vartype managed_disk: ~azure.mgmt.compute.models.ManagedDiskParameters + :ivar delete_option: Specifies whether OS Disk should be deleted or detached upon VM deletion. + Possible values are: **Delete.** If this value is used, the OS disk is deleted when VM is + deleted. **Detach.** If this value is used, the os disk is retained after VM is deleted. The + default value is set to **Detach**. For an ephemeral OS Disk, the default value is set to + **Delete**. The user cannot change the delete option for an ephemeral OS Disk. Known values + are: "Delete" and "Detach". + :vartype delete_option: str or ~azure.mgmt.compute.models.DiskDeleteOptionTypes + """ + + os_type: Optional[Union[str, "_models.OperatingSystemTypes"]] = rest_field( + name="osType", visibility=["read", "create", "update", "delete", "query"] + ) + """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. Possible values are: **Windows,** **Linux.**. Known + values are: \"Windows\" and \"Linux\".""" + encryption_settings: Optional["_models.DiskEncryptionSettings"] = rest_field( + name="encryptionSettings", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies the encryption settings for the OS Disk. Minimum api-version: 2015-06-15.""" + name: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The disk name.""" + vhd: Optional["_models.VirtualHardDisk"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The virtual hard disk.""" + image: Optional["_models.VirtualHardDisk"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """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.""" + caching: Optional[Union[str, "_models.CachingTypes"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies the caching requirements. Possible values are: **None,** **ReadOnly,** **ReadWrite.** + The defaulting behavior is: **None for Standard storage. ReadOnly for Premium storage.**. Known + values are: \"None\", \"ReadOnly\", and \"ReadWrite\".""" + write_accelerator_enabled: Optional[bool] = rest_field( + name="writeAcceleratorEnabled", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies whether writeAccelerator should be enabled or disabled on the disk.""" + diff_disk_settings: Optional["_models.DiffDiskSettings"] = rest_field( + name="diffDiskSettings", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies the ephemeral Disk Settings for the operating system disk used by the virtual + machine.""" + create_option: Union[str, "_models.DiskCreateOptionTypes"] = rest_field( + name="createOption", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies how the virtual machine disk should be created. Possible values are **Attach:** This + value is used when you are using a specialized disk to create the virtual machine. + **FromImage:** This value is used when you are using an image to create the virtual machine. If + you are using a platform image, you should also use the imageReference element described above. + If you are using a marketplace image, you should also use the plan element previously + described. Required. Known values are: \"FromImage\", \"Empty\", \"Attach\", \"Copy\", and + \"Restore\".""" + disk_size_gb: Optional[int] = rest_field( + name="diskSizeGB", visibility=["read", "create", "update", "delete", "query"] + ) + """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. The property 'diskSizeGB' is the number of + bytes x 1024^3 for the disk and the value cannot be larger than 1023.""" + managed_disk: Optional["_models.ManagedDiskParameters"] = rest_field( + name="managedDisk", visibility=["read", "create", "update", "delete", "query"] + ) + """The managed disk parameters.""" + delete_option: Optional[Union[str, "_models.DiskDeleteOptionTypes"]] = rest_field( + name="deleteOption", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies whether OS Disk should be deleted or detached upon VM deletion. Possible values are: + **Delete.** If this value is used, the OS disk is deleted when VM is deleted. **Detach.** If + this value is used, the os disk is retained after VM is deleted. The default value is set to + **Detach**. For an ephemeral OS Disk, the default value is set to **Delete**. The user cannot + change the delete option for an ephemeral OS Disk. Known values are: \"Delete\" and \"Detach\".""" + + @overload + def __init__( + self, + *, + create_option: Union[str, "_models.DiskCreateOptionTypes"], + os_type: Optional[Union[str, "_models.OperatingSystemTypes"]] = None, + encryption_settings: Optional["_models.DiskEncryptionSettings"] = None, + name: Optional[str] = None, + vhd: Optional["_models.VirtualHardDisk"] = None, + image: Optional["_models.VirtualHardDisk"] = None, + caching: Optional[Union[str, "_models.CachingTypes"]] = None, + write_accelerator_enabled: Optional[bool] = None, + diff_disk_settings: Optional["_models.DiffDiskSettings"] = None, + disk_size_gb: Optional[int] = None, + managed_disk: Optional["_models.ManagedDiskParameters"] = None, + delete_option: Optional[Union[str, "_models.DiskDeleteOptionTypes"]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class OSDiskImage(_Model): + """Contains the os disk image information. + + :ivar operating_system: The operating system of the osDiskImage. Required. Known values are: + "Windows" and "Linux". + :vartype operating_system: str or ~azure.mgmt.compute.models.OperatingSystemTypes + """ + + operating_system: Union[str, "_models.OperatingSystemTypes"] = rest_field( + name="operatingSystem", visibility=["read", "create", "update", "delete", "query"] + ) + """The operating system of the osDiskImage. Required. Known values are: \"Windows\" and \"Linux\".""" + + @overload + def __init__( + self, + *, + operating_system: Union[str, "_models.OperatingSystemTypes"], + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class OSDiskImageEncryption(DiskImageEncryption): + """Contains encryption settings for an OS disk image. + + :ivar disk_encryption_set_id: A relative URI containing the resource ID of the disk encryption + set. + :vartype disk_encryption_set_id: str + :ivar security_profile: This property specifies the security profile of an OS disk image. + :vartype security_profile: ~azure.mgmt.compute.models.OSDiskImageSecurityProfile + """ + + security_profile: Optional["_models.OSDiskImageSecurityProfile"] = rest_field( + name="securityProfile", visibility=["read", "create", "update", "delete", "query"] + ) + """This property specifies the security profile of an OS disk image.""" + + @overload + def __init__( + self, + *, + disk_encryption_set_id: Optional[str] = None, + security_profile: Optional["_models.OSDiskImageSecurityProfile"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class OSDiskImageSecurityProfile(_Model): + """Contains security profile for an OS disk image. + + :ivar confidential_vm_encryption_type: confidential VM encryption types. Known values are: + "EncryptedVMGuestStateOnlyWithPmk", "EncryptedWithPmk", "EncryptedWithCmk", and + "NonPersistedTPM". + :vartype confidential_vm_encryption_type: str or + ~azure.mgmt.compute.models.ConfidentialVMEncryptionType + :ivar secure_vm_disk_encryption_set_id: secure VM disk encryption set id. + :vartype secure_vm_disk_encryption_set_id: str + """ + + confidential_vm_encryption_type: Optional[Union[str, "_models.ConfidentialVMEncryptionType"]] = rest_field( + name="confidentialVMEncryptionType", visibility=["read", "create", "update", "delete", "query"] + ) + """confidential VM encryption types. Known values are: \"EncryptedVMGuestStateOnlyWithPmk\", + \"EncryptedWithPmk\", \"EncryptedWithCmk\", and \"NonPersistedTPM\".""" + secure_vm_disk_encryption_set_id: Optional[str] = rest_field( + name="secureVMDiskEncryptionSetId", visibility=["read", "create", "update", "delete", "query"] + ) + """secure VM disk encryption set id.""" + + @overload + def __init__( + self, + *, + confidential_vm_encryption_type: Optional[Union[str, "_models.ConfidentialVMEncryptionType"]] = None, + secure_vm_disk_encryption_set_id: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class OSImageNotificationProfile(_Model): + """OSImageNotificationProfile. + + :ivar not_before_timeout: Length of time a Virtual Machine being reimaged or having its OS + upgraded will have to potentially approve the OS Image Scheduled Event before the event is auto + approved (timed out). The configuration is specified in ISO 8601 format, and the value must be + 15 minutes (PT15M). + :vartype not_before_timeout: str + :ivar enable: Specifies whether the OS Image Scheduled event is enabled or disabled. + :vartype enable: bool + """ + + not_before_timeout: Optional[str] = rest_field( + name="notBeforeTimeout", visibility=["read", "create", "update", "delete", "query"] + ) + """Length of time a Virtual Machine being reimaged or having its OS upgraded will have to + potentially approve the OS Image Scheduled Event before the event is auto approved (timed out). + The configuration is specified in ISO 8601 format, and the value must be 15 minutes (PT15M).""" + enable: Optional[bool] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Specifies whether the OS Image Scheduled event is enabled or disabled.""" + + @overload + def __init__( + self, + *, + not_before_timeout: Optional[str] = None, + enable: Optional[bool] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class OSProfile(_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. This name cannot be + updated after the VM is created. **Max-length (Windows):** 15 characters. **Max-length + (Linux):** 64 characters. 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.

This property + cannot be updated after the VM is created.

**Windows-only restriction:** Cannot end in + "."

**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".

**Minimum-length + (Linux):** 1 character

**Max-length (Linux):** 64 characters

**Max-length + (Windows):** 20 characters. + :vartype admin_username: str + :ivar admin_password: Specifies the password of the administrator account.

+ **Minimum-length (Windows):** 8 characters

**Minimum-length (Linux):** 6 characters +

**Max-length (Windows):** 123 characters

**Max-length (Linux):** 72 + characters

**Complexity requirements:** 3 out of 4 conditions below need to be + fulfilled
Has lower characters
Has upper characters
Has a digit
Has a + special character (Regex match [\\W_])

**Disallowed values:** "abc@123", "P@$$w0rd", + "P@ssw0rd", "P@ssword123", "Pa$$word", "pass@word1", "Password!", "Password1", "Password22", + "iloveyou!"

For resetting the password, see `How to reset the Remote Desktop service + or its login password in a Windows VM + `_

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. **Note: Do not pass any secrets or passwords in + customData property.** This property cannot be updated after the VM is created. The property + 'customData' is passed to the VM to be saved as a file, for more information see `Custom Data + on Azure VMs `_. + 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.models.WindowsConfiguration + :ivar linux_configuration: Specifies the Linux operating system settings on the virtual + machine. For a list of supported Linux distributions, see `Linux on Azure-Endorsed + Distributions `_. + :vartype linux_configuration: ~azure.mgmt.compute.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.models.VaultSecretGroup] + :ivar allow_extension_operations: Specifies whether extension operations should be allowed on + the virtual machine. 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 + """ + + computer_name: Optional[str] = rest_field( + name="computerName", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies the host OS name of the virtual machine. This name cannot be updated after the VM is + created. **Max-length (Windows):** 15 characters. **Max-length (Linux):** 64 characters. For + naming conventions and restrictions see `Azure infrastructure services implementation + guidelines + `_.""" + admin_username: Optional[str] = rest_field( + name="adminUsername", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies the name of the administrator account.

This property cannot be updated after + the VM is created.

**Windows-only restriction:** Cannot end in \".\"

+ **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\".

**Minimum-length (Linux):** 1 character

**Max-length + (Linux):** 64 characters

**Max-length (Windows):** 20 characters.""" + admin_password: Optional[str] = rest_field( + name="adminPassword", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies the password of the administrator account.

**Minimum-length (Windows):** 8 + characters

**Minimum-length (Linux):** 6 characters

**Max-length (Windows):** + 123 characters

**Max-length (Linux):** 72 characters

**Complexity + requirements:** 3 out of 4 conditions below need to be fulfilled
Has lower characters +
Has upper characters
Has a digit
Has a special character (Regex match [\W_]) +

**Disallowed values:** \"abc@123\", \"P@$$w0rd\", \"P@ssw0rd\", \"P@ssword123\", + \"Pa$$word\", \"pass@word1\", \"Password!\", \"Password1\", \"Password22\", \"iloveyou!\" +

For resetting the password, see `How to reset the Remote Desktop service or its login + password in a Windows VM + `_

For + resetting root password, see `Manage users, SSH, and check or repair disks on Azure Linux VMs + using the VMAccess Extension + `_.""" + custom_data: Optional[str] = rest_field( + name="customData", visibility=["read", "create", "update", "delete", "query"] + ) + """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. **Note: Do not pass any secrets or passwords in customData property.** + This property cannot be updated after the VM is created. The property 'customData' is passed to + the VM to be saved as a file, for more information see `Custom Data on Azure VMs + `_. For using + cloud-init for your Linux VM, see `Using cloud-init to customize a Linux VM during creation + `_.""" + windows_configuration: Optional["_models.WindowsConfiguration"] = rest_field( + name="windowsConfiguration", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies Windows operating system settings on the virtual machine.""" + linux_configuration: Optional["_models.LinuxConfiguration"] = rest_field( + name="linuxConfiguration", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies the Linux operating system settings on the virtual machine. For a list of supported + Linux distributions, see `Linux on Azure-Endorsed Distributions + `_.""" + secrets: Optional[list["_models.VaultSecretGroup"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """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 + `_.""" + allow_extension_operations: Optional[bool] = rest_field( + name="allowExtensionOperations", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies whether extension operations should be allowed on the virtual machine. This may only + be set to False when no extensions are present on the virtual machine.""" + require_guest_provision_signal: Optional[bool] = rest_field( + name="requireGuestProvisionSignal", visibility=["read", "create", "update", "delete", "query"] + ) + """Optional property which must either be set to True or omitted.""" + + @overload + 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["_models.WindowsConfiguration"] = None, + linux_configuration: Optional["_models.LinuxConfiguration"] = None, + secrets: Optional[list["_models.VaultSecretGroup"]] = None, + allow_extension_operations: Optional[bool] = None, + require_guest_provision_signal: Optional[bool] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class OSProfileProvisioningData(_Model): + """Additional parameters for Reimaging Non-Ephemeral Virtual Machine. + + :ivar admin_password: Specifies the password of the administrator account.

+ **Minimum-length (Windows):** 8 characters

**Minimum-length (Linux):** 6 characters +

**Max-length (Windows):** 123 characters

**Max-length (Linux):** 72 + characters

**Complexity requirements:** 3 out of 4 conditions below need to be + fulfilled
Has lower characters
Has upper characters
Has a digit
Has a + special character (Regex match [\\W_])

**Disallowed values:** "abc@123", "P@$$w0rd", + "P@ssw0rd", "P@ssword123", "Pa$$word", "pass@word1", "Password!", "Password1", "Password22", + "iloveyou!"

For resetting the password, see `How to reset the Remote Desktop service + or its login password in a Windows VM + `_

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. **Note: Do not pass any secrets or passwords in + customData property.** This property cannot be updated after the VM is created. The property + customData is passed to the VM to be saved as a file, for more information see `Custom Data on + Azure VMs `_. If + using cloud-init for your Linux VM, see `Using cloud-init to customize a Linux VM during + creation `_. + :vartype custom_data: str + """ + + admin_password: Optional[str] = rest_field( + name="adminPassword", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies the password of the administrator account.

**Minimum-length (Windows):** 8 + characters

**Minimum-length (Linux):** 6 characters

**Max-length (Windows):** + 123 characters

**Max-length (Linux):** 72 characters

**Complexity + requirements:** 3 out of 4 conditions below need to be fulfilled
Has lower characters +
Has upper characters
Has a digit
Has a special character (Regex match [\W_]) +

**Disallowed values:** \"abc@123\", \"P@$$w0rd\", \"P@ssw0rd\", \"P@ssword123\", + \"Pa$$word\", \"pass@word1\", \"Password!\", \"Password1\", \"Password22\", \"iloveyou!\" +

For resetting the password, see `How to reset the Remote Desktop service or its login + password in a Windows VM + `_

For + resetting root password, see `Manage users, SSH, and check or repair disks on Azure Linux VMs + using the VMAccess Extension + `_.""" + custom_data: Optional[str] = rest_field( + name="customData", visibility=["read", "create", "update", "delete", "query"] + ) + """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. **Note: Do not pass any secrets or passwords in customData property.** + This property cannot be updated after the VM is created. The property customData is passed to + the VM to be saved as a file, for more information see `Custom Data on Azure VMs + `_. If using + cloud-init for your Linux VM, see `Using cloud-init to customize a Linux VM during creation + `_.""" + + @overload + def __init__( + self, + *, + admin_password: Optional[str] = None, + custom_data: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class PatchInstallationDetail(_Model): + """Information about a specific patch that was encountered during an installation action. + + :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. + Known values are: "Unknown", "Installed", "Failed", "Excluded", "NotSelected", and "Pending". + :vartype installation_state: str or ~azure.mgmt.compute.models.PatchInstallationState + """ + + patch_id: Optional[str] = rest_field(name="patchId", visibility=["read"]) + """A unique identifier for the patch.""" + name: Optional[str] = rest_field(visibility=["read"]) + """The friendly name of the patch.""" + version: Optional[str] = rest_field(visibility=["read"]) + """The version string of the package. It may conform to Semantic Versioning. Only applies to + Linux.""" + kb_id: Optional[str] = rest_field(name="kbId", visibility=["read"]) + """The KBID of the patch. Only applies to Windows patches.""" + classifications: Optional[list[str]] = rest_field(visibility=["read"]) + """The classification(s) of the patch as provided by the patch publisher.""" + installation_state: Optional[Union[str, "_models.PatchInstallationState"]] = rest_field( + name="installationState", visibility=["read"] + ) + """The state of the patch after the installation operation completed. Known values are: + \"Unknown\", \"Installed\", \"Failed\", \"Excluded\", \"NotSelected\", and \"Pending\".""" + + +class PatchSettings(_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.

Possible values are:

**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

**AutomaticByOS** - The virtual machine will automatically be updated by + the OS. The property WindowsConfiguration.enableAutomaticUpdates must be true.

+ **AutomaticByPlatform** - the virtual machine will automatically updated by the platform. The + properties provisionVMAgent and WindowsConfiguration.enableAutomaticUpdates must be true. Known + values are: "Manual", "AutomaticByOS", and "AutomaticByPlatform". + :vartype patch_mode: str or ~azure.mgmt.compute.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.

Possible values are:

**ImageDefault** - You control the timing + of patch assessments on a virtual machine.

**AutomaticByPlatform** - The platform + will trigger periodic patch assessments. The property provisionVMAgent must be true. Known + values are: "ImageDefault" and "AutomaticByPlatform". + :vartype assessment_mode: str or ~azure.mgmt.compute.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.models.WindowsVMGuestPatchAutomaticByPlatformSettings + """ + + patch_mode: Optional[Union[str, "_models.WindowsVMGuestPatchMode"]] = rest_field( + name="patchMode", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies the mode of VM Guest Patching to IaaS virtual machine or virtual machines associated + to virtual machine scale set with OrchestrationMode as Flexible.

Possible values + are:

**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

+ **AutomaticByOS** - The virtual machine will automatically be updated by the OS. The property + WindowsConfiguration.enableAutomaticUpdates must be true.

**AutomaticByPlatform** + - the virtual machine will automatically updated by the platform. The properties + provisionVMAgent and WindowsConfiguration.enableAutomaticUpdates must be true. Known values + are: \"Manual\", \"AutomaticByOS\", and \"AutomaticByPlatform\".""" + enable_hotpatching: Optional[bool] = rest_field( + name="enableHotpatching", visibility=["read", "create", "update", "delete", "query"] + ) + """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'.""" + assessment_mode: Optional[Union[str, "_models.WindowsPatchAssessmentMode"]] = rest_field( + name="assessmentMode", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies the mode of VM Guest patch assessment for the IaaS virtual machine.

+ Possible values are:

**ImageDefault** - You control the timing of patch assessments + on a virtual machine.

**AutomaticByPlatform** - The platform will trigger periodic + patch assessments. The property provisionVMAgent must be true. Known values are: + \"ImageDefault\" and \"AutomaticByPlatform\".""" + automatic_by_platform_settings: Optional["_models.WindowsVMGuestPatchAutomaticByPlatformSettings"] = rest_field( + name="automaticByPlatformSettings", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies additional settings for patch mode AutomaticByPlatform in VM Guest Patching on + Windows.""" + + @overload + def __init__( + self, + *, + patch_mode: Optional[Union[str, "_models.WindowsVMGuestPatchMode"]] = None, + enable_hotpatching: Optional[bool] = None, + assessment_mode: Optional[Union[str, "_models.WindowsPatchAssessmentMode"]] = None, + automatic_by_platform_settings: Optional["_models.WindowsVMGuestPatchAutomaticByPlatformSettings"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class PerformMaintenanceParameterBody(_Model): + """PerformMaintenanceParameterBody. + + :ivar vm_instance_i_ds: A list of virtual machine instance IDs from the VM scale set. + :vartype vm_instance_i_ds: ~azure.mgmt.compute.models.VirtualMachineScaleSetVMInstanceIDs + """ + + vm_instance_i_ds: Optional["_models.VirtualMachineScaleSetVMInstanceIDs"] = rest_field( + name="vmInstanceIDs", visibility=["read", "create", "update", "delete", "query"] + ) + """A list of virtual machine instance IDs from the VM scale set.""" + + @overload + def __init__( + self, + *, + vm_instance_i_ds: Optional["_models.VirtualMachineScaleSetVMInstanceIDs"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class PirResource(_Model): + """The Resource model definition. + + :ivar name: Resource name. + :vartype name: str + :ivar location: Resource location. + :vartype location: str + """ + + name: Optional[str] = rest_field(visibility=["read"]) + """Resource name.""" + location: Optional[str] = rest_field(visibility=["read"]) + """Resource location.""" + + +class PirSharedGalleryResource(PirResource): + """Base information about the shared gallery resource in pir. + + :ivar name: Resource name. + :vartype name: str + :ivar location: Resource location. + :vartype location: str + :ivar identifier: The identifier information of shared gallery. + :vartype identifier: ~azure.mgmt.compute.models.SharedGalleryIdentifier + """ + + identifier: Optional["_models.SharedGalleryIdentifier"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The identifier information of shared gallery.""" + + @overload + def __init__( + self, + *, + identifier: Optional["_models.SharedGalleryIdentifier"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class Placement(_Model): + """Describes the user-defined constraints for resource hardware placement. + + :ivar zone_placement_policy: Specifies the policy for resource's placement in availability + zone. Possible values are: **Any** (used for Virtual Machines), **Auto** (used for Virtual + Machine Scale Sets) - An availability zone will be automatically picked by system as part of + resource creation. Known values are: "Any" and "Auto". + :vartype zone_placement_policy: str or ~azure.mgmt.compute.models.ZonePlacementPolicyType + :ivar include_zones: This property supplements the 'zonePlacementPolicy' property. If + 'zonePlacementPolicy' is set to 'Any'/'Auto', availability zone selected by the system must be + present in the list of availability zones passed with 'includeZones'. If 'includeZones' is not + provided, all availability zones in region will be considered for selection. + :vartype include_zones: list[str] + :ivar exclude_zones: This property supplements the 'zonePlacementPolicy' property. If + 'zonePlacementPolicy' is set to 'Any'/'Auto', availability zone selected by the system must not + be present in the list of availability zones passed with 'excludeZones'. If 'excludeZones' is + not provided, all availability zones in region will be considered for selection. + :vartype exclude_zones: list[str] + """ + + zone_placement_policy: Optional[Union[str, "_models.ZonePlacementPolicyType"]] = rest_field( + name="zonePlacementPolicy", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies the policy for resource's placement in availability zone. Possible values are: + **Any** (used for Virtual Machines), **Auto** (used for Virtual Machine Scale Sets) - An + availability zone will be automatically picked by system as part of resource creation. Known + values are: \"Any\" and \"Auto\".""" + include_zones: Optional[list[str]] = rest_field( + name="includeZones", visibility=["read", "create", "update", "delete", "query"] + ) + """This property supplements the 'zonePlacementPolicy' property. If 'zonePlacementPolicy' is set + to 'Any'/'Auto', availability zone selected by the system must be present in the list of + availability zones passed with 'includeZones'. If 'includeZones' is not provided, all + availability zones in region will be considered for selection.""" + exclude_zones: Optional[list[str]] = rest_field( + name="excludeZones", visibility=["read", "create", "update", "delete", "query"] + ) + """This property supplements the 'zonePlacementPolicy' property. If 'zonePlacementPolicy' is set + to 'Any'/'Auto', availability zone selected by the system must not be present in the list of + availability zones passed with 'excludeZones'. If 'excludeZones' is not provided, all + availability zones in region will be considered for selection.""" + + @overload + def __init__( + self, + *, + zone_placement_policy: Optional[Union[str, "_models.ZonePlacementPolicyType"]] = None, + include_zones: Optional[list[str]] = None, + exclude_zones: Optional[list[str]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class Plan(_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 + """ + + name: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The plan ID.""" + publisher: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The publisher ID.""" + product: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Specifies the product of the image from the marketplace. This is the same value as Offer under + the imageReference element.""" + promotion_code: Optional[str] = rest_field( + name="promotionCode", visibility=["read", "create", "update", "delete", "query"] + ) + """The promotion code.""" + + @overload + def __init__( + self, + *, + name: Optional[str] = None, + publisher: Optional[str] = None, + product: Optional[str] = None, + promotion_code: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class PlatformAttribute(_Model): + """This is the platform attribute of the image version. + + :ivar name: This property specifies the name of the platformAttribute. It is read-only. + :vartype name: str + :ivar value: This property specifies the value of the corresponding name property. It is + read-only. + :vartype value: str + """ + + name: Optional[str] = rest_field(visibility=["read"]) + """This property specifies the name of the platformAttribute. It is read-only.""" + value: Optional[str] = rest_field(visibility=["read"]) + """This property specifies the value of the corresponding name property. It is read-only.""" + + +class PolicyViolation(_Model): + """A policy violation reported against a gallery artifact. + + :ivar category: Describes the nature of the policy violation. Known values are: "Other", + "ImageFlaggedUnsafe", "CopyrightValidation", and "IpTheft". + :vartype category: str or ~azure.mgmt.compute.models.PolicyViolationCategory + :ivar details: Describes specific details about why this policy violation was reported. + :vartype details: str + """ + + category: Optional[Union[str, "_models.PolicyViolationCategory"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Describes the nature of the policy violation. Known values are: \"Other\", + \"ImageFlaggedUnsafe\", \"CopyrightValidation\", and \"IpTheft\".""" + details: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Describes specific details about why this policy violation was reported.""" + + @overload + def __init__( + self, + *, + category: Optional[Union[str, "_models.PolicyViolationCategory"]] = None, + details: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class PowerOffParameterBody(_Model): + """PowerOffParameterBody. + + :ivar vm_instance_i_ds: A list of virtual machine instance IDs from the VM scale set. + :vartype vm_instance_i_ds: ~azure.mgmt.compute.models.VirtualMachineScaleSetVMInstanceIDs + """ + + vm_instance_i_ds: Optional["_models.VirtualMachineScaleSetVMInstanceIDs"] = rest_field( + name="vmInstanceIDs", visibility=["read", "create", "update", "delete", "query"] + ) + """A list of virtual machine instance IDs from the VM scale set.""" + + @overload + def __init__( + self, + *, + vm_instance_i_ds: Optional["_models.VirtualMachineScaleSetVMInstanceIDs"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class PriorityMixPolicy(_Model): + """Specifies the target splits for Spot and Regular priority VMs within a scale set with flexible + orchestration mode. With this property the customer is able to specify the base number of + regular priority VMs created as the VMSS flex instance scales out and the split between Spot + and Regular priority VMs after this base target has been reached. + + :ivar base_regular_priority_count: The base number of regular priority VMs that will be created + in this scale set as it scales out. + :vartype base_regular_priority_count: int + :ivar regular_priority_percentage_above_base: The percentage of VM instances, after the base + regular priority count has been reached, that are expected to use regular priority. + :vartype regular_priority_percentage_above_base: int + """ + + base_regular_priority_count: Optional[int] = rest_field( + name="baseRegularPriorityCount", visibility=["read", "create", "update", "delete", "query"] + ) + """The base number of regular priority VMs that will be created in this scale set as it scales + out.""" + regular_priority_percentage_above_base: Optional[int] = rest_field( + name="regularPriorityPercentageAboveBase", visibility=["read", "create", "update", "delete", "query"] + ) + """The percentage of VM instances, after the base regular priority count has been reached, that + are expected to use regular priority.""" + + @overload + def __init__( + self, + *, + base_regular_priority_count: Optional[int] = None, + regular_priority_percentage_above_base: Optional[int] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class PrivateEndpoint(_Model): + """The Private Endpoint resource. + + :ivar id: The ARM identifier for Private Endpoint. + :vartype id: str + """ + + id: Optional[str] = rest_field(visibility=["read"]) + """The ARM identifier for Private Endpoint.""" + + +class PrivateEndpointConnection(ProxyResource): + """The Private Endpoint Connection resource. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.compute.models.SystemData + :ivar properties: Resource properties. + :vartype properties: ~azure.mgmt.compute.models.PrivateEndpointConnectionProperties + """ + + properties: Optional["_models.PrivateEndpointConnectionProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Resource properties.""" + + @overload + def __init__( + self, + *, + properties: Optional["_models.PrivateEndpointConnectionProperties"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class PrivateEndpointConnectionProperties(_Model): + """Properties of the PrivateEndpointConnectProperties. + + :ivar private_endpoint: The resource of private end point. + :vartype private_endpoint: ~azure.mgmt.compute.models.PrivateEndpoint + :ivar private_link_service_connection_state: A collection of information about the state of the + connection between DiskAccess and Virtual Network. Required. + :vartype private_link_service_connection_state: + ~azure.mgmt.compute.models.PrivateLinkServiceConnectionState + :ivar provisioning_state: The provisioning state of the private endpoint connection resource. + Known values are: "Succeeded", "Creating", "Deleting", and "Failed". + :vartype provisioning_state: str or + ~azure.mgmt.compute.models.PrivateEndpointConnectionProvisioningState + """ + + private_endpoint: Optional["_models.PrivateEndpoint"] = rest_field(name="privateEndpoint", visibility=["read"]) + """The resource of private end point.""" + private_link_service_connection_state: "_models.PrivateLinkServiceConnectionState" = rest_field( + name="privateLinkServiceConnectionState", visibility=["read", "create", "update", "delete", "query"] + ) + """A collection of information about the state of the connection between DiskAccess and Virtual + Network. Required.""" + provisioning_state: Optional[Union[str, "_models.PrivateEndpointConnectionProvisioningState"]] = rest_field( + name="provisioningState", visibility=["read"] + ) + """The provisioning state of the private endpoint connection resource. Known values are: + \"Succeeded\", \"Creating\", \"Deleting\", and \"Failed\".""" + + @overload + def __init__( + self, + *, + private_link_service_connection_state: "_models.PrivateLinkServiceConnectionState", + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class PrivateLinkResource(_Model): + """A private link resource. + + :ivar properties: Resource properties. + :vartype properties: ~azure.mgmt.compute.models.PrivateLinkResourceProperties + :ivar id: private link resource Id. + :vartype id: str + :ivar name: private link resource name. + :vartype name: str + :ivar type: private link resource type. + :vartype type: str + """ + + properties: Optional["_models.PrivateLinkResourceProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Resource properties.""" + id: Optional[str] = rest_field(visibility=["read"]) + """private link resource Id.""" + name: Optional[str] = rest_field(visibility=["read"]) + """private link resource name.""" + type: Optional[str] = rest_field(visibility=["read"]) + """private link resource type.""" + + @overload + def __init__( + self, + *, + properties: Optional["_models.PrivateLinkResourceProperties"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class PrivateLinkResourceListResult(_Model): + """A list of private link resources. + + :ivar value: Array of private link resources. + :vartype value: list[~azure.mgmt.compute.models.PrivateLinkResource] + """ + + value: Optional[list["_models.PrivateLinkResource"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Array of private link resources.""" + + @overload + def __init__( + self, + *, + value: Optional[list["_models.PrivateLinkResource"]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class PrivateLinkResourceProperties(_Model): + """Properties of a private link resource. + + :ivar group_id: The private link resource group id. + :vartype group_id: str + :ivar required_members: The private link resource required member names. + :vartype required_members: list[str] + :ivar required_zone_names: The private link resource DNS zone name. + :vartype required_zone_names: list[str] + """ + + group_id: Optional[str] = rest_field(name="groupId", visibility=["read"]) + """The private link resource group id.""" + required_members: Optional[list[str]] = rest_field(name="requiredMembers", visibility=["read"]) + """The private link resource required member names.""" + required_zone_names: Optional[list[str]] = rest_field( + name="requiredZoneNames", visibility=["read", "create", "update", "delete", "query"] + ) + """The private link resource DNS zone name.""" + + @overload + def __init__( + self, + *, + required_zone_names: Optional[list[str]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class PrivateLinkServiceConnectionState(_Model): + """A collection of information about the state of the connection between service consumer and + provider. + + :ivar status: Indicates whether the connection has been Approved/Rejected/Removed by the owner + of the service. Known values are: "Pending", "Approved", and "Rejected". + :vartype status: str or ~azure.mgmt.compute.models.PrivateEndpointServiceConnectionStatus + :ivar description: The reason for approval/rejection of the connection. + :vartype description: str + :ivar actions_required: A message indicating if changes on the service provider require any + updates on the consumer. + :vartype actions_required: str + """ + + status: Optional[Union[str, "_models.PrivateEndpointServiceConnectionStatus"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Indicates whether the connection has been Approved/Rejected/Removed by the owner of the + service. Known values are: \"Pending\", \"Approved\", and \"Rejected\".""" + description: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The reason for approval/rejection of the connection.""" + actions_required: Optional[str] = rest_field( + name="actionsRequired", visibility=["read", "create", "update", "delete", "query"] + ) + """A message indicating if changes on the service provider require any updates on the consumer.""" + + @overload + def __init__( + self, + *, + status: Optional[Union[str, "_models.PrivateEndpointServiceConnectionStatus"]] = None, + description: Optional[str] = None, + actions_required: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class PropertyUpdatesInProgress(_Model): + """Properties of the disk for which update is pending. + + :ivar target_tier: The target performance tier of the disk if a tier change operation is in + progress. + :vartype target_tier: str + """ + + target_tier: Optional[str] = rest_field( + name="targetTier", visibility=["read", "create", "update", "delete", "query"] + ) + """The target performance tier of the disk if a tier change operation is in progress.""" + + @overload + def __init__( + self, + *, + target_tier: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ProximityPlacementGroup(TrackedResource): + """Specifies information about the proximity placement group. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.compute.models.SystemData + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar location: The geo-location where the resource lives. Required. + :vartype location: str + :ivar properties: Describes the properties of a Proximity Placement Group. + :vartype properties: ~azure.mgmt.compute.models.ProximityPlacementGroupProperties + :ivar zones: The availability zones. + :vartype zones: list[str] + """ + + properties: Optional["_models.ProximityPlacementGroupProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Describes the properties of a Proximity Placement Group.""" + zones: Optional[list[str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The availability zones.""" + + @overload + def __init__( + self, + *, + location: str, + tags: Optional[dict[str, str]] = None, + properties: Optional["_models.ProximityPlacementGroupProperties"] = None, + zones: Optional[list[str]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ProximityPlacementGroupProperties(_Model): + """Describes the properties of a Proximity Placement Group. + + :ivar proximity_placement_group_type: Specifies the type of the proximity placement group. + Possible values are: **Standard** : Co-locate resources within an Azure region or Availability + Zone. **Ultra** : For future use. Known values are: "Standard" and "Ultra". + :vartype proximity_placement_group_type: str or + ~azure.mgmt.compute.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.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.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.models.SubResourceWithColocationStatus] + :ivar colocation_status: Describes colocation status of the Proximity Placement Group. + :vartype colocation_status: ~azure.mgmt.compute.models.InstanceViewStatus + :ivar intent: Specifies the user intent of the proximity placement group. + :vartype intent: ~azure.mgmt.compute.models.ProximityPlacementGroupPropertiesIntent + """ + + proximity_placement_group_type: Optional[Union[str, "_models.ProximityPlacementGroupType"]] = rest_field( + name="proximityPlacementGroupType", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies the type of the proximity placement group. Possible values are: **Standard** : + Co-locate resources within an Azure region or Availability Zone. **Ultra** : For future use. + Known values are: \"Standard\" and \"Ultra\".""" + virtual_machines: Optional[list["_models.SubResourceWithColocationStatus"]] = rest_field( + name="virtualMachines", visibility=["read"] + ) + """A list of references to all virtual machines in the proximity placement group.""" + virtual_machine_scale_sets: Optional[list["_models.SubResourceWithColocationStatus"]] = rest_field( + name="virtualMachineScaleSets", visibility=["read"] + ) + """A list of references to all virtual machine scale sets in the proximity placement group.""" + availability_sets: Optional[list["_models.SubResourceWithColocationStatus"]] = rest_field( + name="availabilitySets", visibility=["read"] + ) + """A list of references to all availability sets in the proximity placement group.""" + colocation_status: Optional["_models.InstanceViewStatus"] = rest_field( + name="colocationStatus", visibility=["read", "create", "update", "delete", "query"] + ) + """Describes colocation status of the Proximity Placement Group.""" + intent: Optional["_models.ProximityPlacementGroupPropertiesIntent"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies the user intent of the proximity placement group.""" + + @overload + def __init__( + self, + *, + proximity_placement_group_type: Optional[Union[str, "_models.ProximityPlacementGroupType"]] = None, + colocation_status: Optional["_models.InstanceViewStatus"] = None, + intent: Optional["_models.ProximityPlacementGroupPropertiesIntent"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ProximityPlacementGroupPropertiesIntent(_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] + """ + + vm_sizes: Optional[list[str]] = rest_field( + name="vmSizes", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies possible sizes of virtual machines that can be created in the proximity placement + group.""" + + @overload + def __init__( + self, + *, + vm_sizes: Optional[list[str]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ProximityPlacementGroupUpdate(UpdateResource): + """Specifies information about the proximity placement group. + + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + """ + + @overload + def __init__( + self, + *, + tags: Optional[dict[str, str]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ProxyAgentSettings(_Model): + """Specifies ProxyAgent settings for the virtual machine or virtual machine scale set. Minimum + api-version: 2023-09-01. + + :ivar enabled: Specifies whether ProxyAgent feature should be enabled on the virtual machine or + virtual machine scale set. + :vartype enabled: bool + :ivar mode: Specifies the mode that ProxyAgent will execute on. Warning: this property has been + deprecated, please specify 'mode' under particular hostendpoint setting. Known values are: + "Audit" and "Enforce". + :vartype mode: str or ~azure.mgmt.compute.models.Mode + :ivar key_incarnation_id: Increase the value of this property allows users to reset the key + used for securing communication channel between guest and host. + :vartype key_incarnation_id: int + :ivar wire_server: Specifies the Wire Server endpoint settings while creating the virtual + machine or virtual machine scale set. Minimum api-version: 2024-03-01. + :vartype wire_server: ~azure.mgmt.compute.models.HostEndpointSettings + :ivar imds: Specifies the IMDS endpoint settings while creating the virtual machine or virtual + machine scale set. Minimum api-version: 2024-03-01. + :vartype imds: ~azure.mgmt.compute.models.HostEndpointSettings + :ivar add_proxy_agent_extension: Specify whether to implicitly install the ProxyAgent + Extension. This option is currently applicable only for Linux Os. + :vartype add_proxy_agent_extension: bool + """ + + enabled: Optional[bool] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Specifies whether ProxyAgent feature should be enabled on the virtual machine or virtual + machine scale set.""" + mode: Optional[Union[str, "_models.Mode"]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Specifies the mode that ProxyAgent will execute on. Warning: this property has been deprecated, + please specify 'mode' under particular hostendpoint setting. Known values are: \"Audit\" and + \"Enforce\".""" + key_incarnation_id: Optional[int] = rest_field( + name="keyIncarnationId", visibility=["read", "create", "update", "delete", "query"] + ) + """Increase the value of this property allows users to reset the key used for securing + communication channel between guest and host.""" + wire_server: Optional["_models.HostEndpointSettings"] = rest_field( + name="wireServer", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies the Wire Server endpoint settings while creating the virtual machine or virtual + machine scale set. Minimum api-version: 2024-03-01.""" + imds: Optional["_models.HostEndpointSettings"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies the IMDS endpoint settings while creating the virtual machine or virtual machine + scale set. Minimum api-version: 2024-03-01.""" + add_proxy_agent_extension: Optional[bool] = rest_field( + name="addProxyAgentExtension", visibility=["read", "create", "update", "delete", "query"] + ) + """Specify whether to implicitly install the ProxyAgent Extension. This option is currently + applicable only for Linux Os.""" + + @overload + def __init__( + self, + *, + enabled: Optional[bool] = None, + mode: Optional[Union[str, "_models.Mode"]] = None, + key_incarnation_id: Optional[int] = None, + wire_server: Optional["_models.HostEndpointSettings"] = None, + imds: Optional["_models.HostEndpointSettings"] = None, + add_proxy_agent_extension: Optional[bool] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class PublicIPAddressSku(_Model): + """Describes the public IP Sku. It can only be set with OrchestrationMode as Flexible. + + :ivar name: Specify public IP sku name. Known values are: "Basic" and "Standard". + :vartype name: str or ~azure.mgmt.compute.models.PublicIPAddressSkuName + :ivar tier: Specify public IP sku tier. Known values are: "Regional" and "Global". + :vartype tier: str or ~azure.mgmt.compute.models.PublicIPAddressSkuTier + """ + + name: Optional[Union[str, "_models.PublicIPAddressSkuName"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Specify public IP sku name. Known values are: \"Basic\" and \"Standard\".""" + tier: Optional[Union[str, "_models.PublicIPAddressSkuTier"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Specify public IP sku tier. Known values are: \"Regional\" and \"Global\".""" + + @overload + def __init__( + self, + *, + name: Optional[Union[str, "_models.PublicIPAddressSkuName"]] = None, + tier: Optional[Union[str, "_models.PublicIPAddressSkuTier"]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class PurchasePlan(_Model): + """Used for establishing the purchase context of any 3rd Party artifact through MarketPlace. + + :ivar publisher: The publisher ID. Required. + :vartype publisher: str + :ivar name: The plan ID. Required. + :vartype name: str + :ivar product: Specifies the product of the image from the marketplace. This is the same value + as Offer under the imageReference element. Required. + :vartype product: str + """ + + publisher: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The publisher ID. Required.""" + name: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The plan ID. Required.""" + product: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Specifies the product of the image from the marketplace. This is the same value as Offer under + the imageReference element. Required.""" + + @overload + def __init__( + self, + *, + publisher: str, + name: str, + product: str, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class RecommendedMachineConfiguration(_Model): + """The properties describe the recommended machine configuration for this Image Definition. These + properties are updatable. + + :ivar v_cp_us: Describes the resource range. + :vartype v_cp_us: ~azure.mgmt.compute.models.ResourceRange + :ivar memory: Describes the resource range. + :vartype memory: ~azure.mgmt.compute.models.ResourceRange + """ + + v_cp_us: Optional["_models.ResourceRange"] = rest_field( + name="vCPUs", visibility=["read", "create", "update", "delete", "query"] + ) + """Describes the resource range.""" + memory: Optional["_models.ResourceRange"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Describes the resource range.""" + + @overload + def __init__( + self, + *, + v_cp_us: Optional["_models.ResourceRange"] = None, + memory: Optional["_models.ResourceRange"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class RecoveryWalkResponse(_Model): + """Response after calling a manual recovery walk. + + :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 + """ + + walk_performed: Optional[bool] = rest_field(name="walkPerformed", visibility=["read"]) + """Whether the recovery walk was performed.""" + next_platform_update_domain: Optional[int] = rest_field(name="nextPlatformUpdateDomain", visibility=["read"]) + """The next update domain that needs to be walked. Null means walk spanning all update domains has + been completed.""" + + +class RedeployParameterBody(_Model): + """RedeployParameterBody. + + :ivar vm_instance_i_ds: A list of virtual machine instance IDs from the VM scale set. + :vartype vm_instance_i_ds: ~azure.mgmt.compute.models.VirtualMachineScaleSetVMInstanceIDs + """ + + vm_instance_i_ds: Optional["_models.VirtualMachineScaleSetVMInstanceIDs"] = rest_field( + name="vmInstanceIDs", visibility=["read", "create", "update", "delete", "query"] + ) + """A list of virtual machine instance IDs from the VM scale set.""" + + @overload + def __init__( + self, + *, + vm_instance_i_ds: Optional["_models.VirtualMachineScaleSetVMInstanceIDs"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class RegionalReplicationStatus(_Model): + """This is the regional replication status. + + :ivar region: The region to which the gallery image version is being replicated to. + :vartype region: str + :ivar state: This is the regional replication state. Known values are: "Unknown", + "Replicating", "Completed", and "Failed". + :vartype state: str or ~azure.mgmt.compute.models.ReplicationState + :ivar details: The details of the replication status. + :vartype details: str + :ivar progress: It indicates progress of the replication job. + :vartype progress: int + """ + + region: Optional[str] = rest_field(visibility=["read"]) + """The region to which the gallery image version is being replicated to.""" + state: Optional[Union[str, "_models.ReplicationState"]] = rest_field(visibility=["read"]) + """This is the regional replication state. Known values are: \"Unknown\", \"Replicating\", + \"Completed\", and \"Failed\".""" + details: Optional[str] = rest_field(visibility=["read"]) + """The details of the replication status.""" + progress: Optional[int] = rest_field(visibility=["read"]) + """It indicates progress of the replication job.""" + + +class RegionalSharingStatus(_Model): + """Gallery regional sharing status. + + :ivar region: Region name. + :vartype region: str + :ivar state: Gallery sharing state in current region. Known values are: "Succeeded", + "InProgress", "Failed", and "Unknown". + :vartype state: str or ~azure.mgmt.compute.models.SharingState + :ivar details: Details of gallery regional sharing failure. + :vartype details: str + """ + + region: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Region name.""" + state: Optional[Union[str, "_models.SharingState"]] = rest_field(visibility=["read"]) + """Gallery sharing state in current region. Known values are: \"Succeeded\", \"InProgress\", + \"Failed\", and \"Unknown\".""" + details: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Details of gallery regional sharing failure.""" + + @overload + def __init__( + self, + *, + region: Optional[str] = None, + details: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ReimageAllParameterBody(_Model): + """ReimageAllParameterBody. + + :ivar vm_instance_i_ds: A list of virtual machine instance IDs from the VM scale set. + :vartype vm_instance_i_ds: ~azure.mgmt.compute.models.VirtualMachineScaleSetVMInstanceIDs + """ + + vm_instance_i_ds: Optional["_models.VirtualMachineScaleSetVMInstanceIDs"] = rest_field( + name="vmInstanceIDs", visibility=["read", "create", "update", "delete", "query"] + ) + """A list of virtual machine instance IDs from the VM scale set.""" + + @overload + def __init__( + self, + *, + vm_instance_i_ds: Optional["_models.VirtualMachineScaleSetVMInstanceIDs"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ReimageParameterBody(_Model): + """ReimageParameterBody. + + :ivar vm_scale_set_reimage_input: Parameters for Reimaging VM ScaleSet. + :vartype vm_scale_set_reimage_input: + ~azure.mgmt.compute.models.VirtualMachineScaleSetReimageParameters + """ + + vm_scale_set_reimage_input: Optional["_models.VirtualMachineScaleSetReimageParameters"] = rest_field( + name="vmScaleSetReimageInput", visibility=["read", "create", "update", "delete", "query"] + ) + """Parameters for Reimaging VM ScaleSet.""" + + @overload + def __init__( + self, + *, + vm_scale_set_reimage_input: Optional["_models.VirtualMachineScaleSetReimageParameters"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ReimageParameterBody1(_Model): + """ReimageParameterBody1. + + :ivar vm_scale_set_vm_reimage_input: Parameters for the Reimaging Virtual machine in ScaleSet. + :vartype vm_scale_set_vm_reimage_input: + ~azure.mgmt.compute.models.VirtualMachineScaleSetVMReimageParameters + """ + + vm_scale_set_vm_reimage_input: Optional["_models.VirtualMachineScaleSetVMReimageParameters"] = rest_field( + name="vmScaleSetVMReimageInput", visibility=["read", "create", "update", "delete", "query"] + ) + """Parameters for the Reimaging Virtual machine in ScaleSet.""" + + @overload + def __init__( + self, + *, + vm_scale_set_vm_reimage_input: Optional["_models.VirtualMachineScaleSetVMReimageParameters"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ReimageParameterBody2(_Model): + """ReimageParameterBody2. + + :ivar parameters: Parameters supplied to the Reimage Virtual Machine operation. + :vartype parameters: ~azure.mgmt.compute.models.VirtualMachineReimageParameters + """ + + parameters: Optional["_models.VirtualMachineReimageParameters"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Parameters supplied to the Reimage Virtual Machine operation.""" + + @overload + def __init__( + self, + *, + parameters: Optional["_models.VirtualMachineReimageParameters"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ReplicationStatus(_Model): + """This is the replication status of the gallery image version. + + :ivar aggregated_state: This is the aggregated replication status based on all the regional + replication status flags. Known values are: "Unknown", "InProgress", "Completed", and "Failed". + :vartype aggregated_state: str or ~azure.mgmt.compute.models.AggregatedReplicationState + :ivar summary: This is a summary of replication status for each region. + :vartype summary: list[~azure.mgmt.compute.models.RegionalReplicationStatus] + """ + + aggregated_state: Optional[Union[str, "_models.AggregatedReplicationState"]] = rest_field( + name="aggregatedState", visibility=["read"] + ) + """This is the aggregated replication status based on all the regional replication status flags. + Known values are: \"Unknown\", \"InProgress\", \"Completed\", and \"Failed\".""" + summary: Optional[list["_models.RegionalReplicationStatus"]] = rest_field(visibility=["read"]) + """This is a summary of replication status for each region.""" + + +class RequestRateByIntervalInput(LogAnalyticsInputBase): + """Api request input for LogAnalytics getRequestRateByInterval Api. + + :ivar blob_container_sas_uri: SAS Uri of the logging blob container to which LogAnalytics Api + writes output logs to. Required. + :vartype blob_container_sas_uri: str + :ivar from_time: From time of the query. Required. + :vartype from_time: ~datetime.datetime + :ivar to_time: To time of the query. Required. + :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: Interval value in minutes used to create LogAnalytics call rate logs. + Required. Known values are: "ThreeMins", "FiveMins", "ThirtyMins", and "SixtyMins". + :vartype interval_length: str or ~azure.mgmt.compute.models.IntervalInMins + """ + + interval_length: Union[str, "_models.IntervalInMins"] = rest_field( + name="intervalLength", visibility=["read", "create", "update", "delete", "query"] + ) + """Interval value in minutes used to create LogAnalytics call rate logs. Required. Known values + are: \"ThreeMins\", \"FiveMins\", \"ThirtyMins\", and \"SixtyMins\".""" + + @overload + def __init__( + self, + *, + blob_container_sas_uri: str, + from_time: datetime.datetime, + to_time: datetime.datetime, + interval_length: Union[str, "_models.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, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ResiliencyPolicy(_Model): + """Describes an resiliency policy - AutomaticZoneRebalancingPolicy, ResilientVMCreationPolicy + and/or ResilientVMDeletionPolicy. + + :ivar resilient_vm_creation_policy: The configuration parameters used while performing + resilient VM creation. + :vartype resilient_vm_creation_policy: ~azure.mgmt.compute.models.ResilientVMCreationPolicy + :ivar resilient_vm_deletion_policy: The configuration parameters used while performing + resilient VM deletion. + :vartype resilient_vm_deletion_policy: ~azure.mgmt.compute.models.ResilientVMDeletionPolicy + :ivar automatic_zone_rebalancing_policy: The configuration parameters used while performing + automatic AZ balancing. + :vartype automatic_zone_rebalancing_policy: + ~azure.mgmt.compute.models.AutomaticZoneRebalancingPolicy + :ivar zone_allocation_policy: The configuration parameters used while performing zone + allocation. + :vartype zone_allocation_policy: ~azure.mgmt.compute.models.ZoneAllocationPolicy + """ + + resilient_vm_creation_policy: Optional["_models.ResilientVMCreationPolicy"] = rest_field( + name="resilientVMCreationPolicy", visibility=["read", "create", "update", "delete", "query"] + ) + """The configuration parameters used while performing resilient VM creation.""" + resilient_vm_deletion_policy: Optional["_models.ResilientVMDeletionPolicy"] = rest_field( + name="resilientVMDeletionPolicy", visibility=["read", "create", "update", "delete", "query"] + ) + """The configuration parameters used while performing resilient VM deletion.""" + automatic_zone_rebalancing_policy: Optional["_models.AutomaticZoneRebalancingPolicy"] = rest_field( + name="automaticZoneRebalancingPolicy", visibility=["read", "create", "update", "delete", "query"] + ) + """The configuration parameters used while performing automatic AZ balancing.""" + zone_allocation_policy: Optional["_models.ZoneAllocationPolicy"] = rest_field( + name="zoneAllocationPolicy", visibility=["read", "create", "update", "delete", "query"] + ) + """The configuration parameters used while performing zone allocation.""" + + @overload + def __init__( + self, + *, + resilient_vm_creation_policy: Optional["_models.ResilientVMCreationPolicy"] = None, + resilient_vm_deletion_policy: Optional["_models.ResilientVMDeletionPolicy"] = None, + automatic_zone_rebalancing_policy: Optional["_models.AutomaticZoneRebalancingPolicy"] = None, + zone_allocation_policy: Optional["_models.ZoneAllocationPolicy"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ResilientVMCreationPolicy(_Model): + """The configuration parameters used while performing resilient VM creation. + + :ivar enabled: Specifies whether resilient VM creation should be enabled on the virtual machine + scale set. The default value is false. + :vartype enabled: bool + """ + + enabled: Optional[bool] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Specifies whether resilient VM creation should be enabled on the virtual machine scale set. The + default value is false.""" + + @overload + def __init__( + self, + *, + enabled: Optional[bool] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ResilientVMDeletionPolicy(_Model): + """The configuration parameters used while performing resilient VM deletion. + + :ivar enabled: Specifies whether resilient VM deletion should be enabled on the virtual machine + scale set. The default value is false. + :vartype enabled: bool + """ + + enabled: Optional[bool] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Specifies whether resilient VM deletion should be enabled on the virtual machine scale set. The + default value is false.""" + + @overload + def __init__( + self, + *, + enabled: Optional[bool] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ResourceRange(_Model): + """Describes the resource range. + + :ivar min: The minimum number of the resource. + :vartype min: int + :ivar max: The maximum number of the resource. + :vartype max: int + """ + + min: Optional[int] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The minimum number of the resource.""" + max: Optional[int] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The maximum number of the resource.""" + + @overload + def __init__( + self, + *, + min: Optional[int] = None, # pylint: disable=redefined-builtin + max: Optional[int] = None, # pylint: disable=redefined-builtin + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ResourceSharingProfile(_Model): + """ResourceSharingProfile. + + :ivar subscription_ids: Specifies an array of subscription resource IDs that capacity + reservation group is shared with. Block Capacity Reservations does not support sharing across + subscriptions. **Note:** Minimum api-version: 2023-09-01. Please refer to + `https://aka.ms/computereservationsharing `_ for more + details. + :vartype subscription_ids: list[~azure.mgmt.compute.models.SubResource] + """ + + subscription_ids: Optional[list["_models.SubResource"]] = rest_field( + name="subscriptionIds", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies an array of subscription resource IDs that capacity reservation group is shared with. + Block Capacity Reservations does not support sharing across subscriptions. **Note:** Minimum + api-version: 2023-09-01. Please refer to `https://aka.ms/computereservationsharing + `_ for more details.""" + + @overload + def __init__( + self, + *, + subscription_ids: Optional[list["_models.SubResource"]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ResourceSku(_Model): + """Describes an available Compute SKU. + + :ivar resource_type: The type of resource the SKU applies to. + :vartype resource_type: str + :ivar name: The name of SKU. + :vartype name: str + :ivar tier: Specifies the tier of virtual machines in a scale set.

Possible + Values:

**Standard**

**Basic**. + :vartype tier: str + :ivar size: The Size of the SKU. + :vartype size: str + :ivar family: The Family of this particular SKU. + :vartype family: str + :ivar kind: The Kind of resources that are supported in this SKU. + :vartype kind: str + :ivar capacity: Specifies the number of virtual machines in the scale set. + :vartype capacity: ~azure.mgmt.compute.models.ResourceSkuCapacity + :ivar locations: The set of locations that the SKU is available. + :vartype locations: list[str] + :ivar location_info: A list of locations and availability zones in those locations where the + SKU is available. + :vartype location_info: list[~azure.mgmt.compute.models.ResourceSkuLocationInfo] + :ivar api_versions: The api versions that support this SKU. + :vartype api_versions: list[str] + :ivar costs: Metadata for retrieving price info. + :vartype costs: list[~azure.mgmt.compute.models.ResourceSkuCosts] + :ivar capabilities: A name value pair to describe the capability. + :vartype capabilities: list[~azure.mgmt.compute.models.ResourceSkuCapabilities] + :ivar restrictions: The restrictions because of which SKU cannot be used. This is empty if + there are no restrictions. + :vartype restrictions: list[~azure.mgmt.compute.models.ResourceSkuRestrictions] + """ + + resource_type: Optional[str] = rest_field(name="resourceType", visibility=["read"]) + """The type of resource the SKU applies to.""" + name: Optional[str] = rest_field(visibility=["read"]) + """The name of SKU.""" + tier: Optional[str] = rest_field(visibility=["read"]) + """Specifies the tier of virtual machines in a scale set.

Possible Values:

+ **Standard**

**Basic**.""" + size: Optional[str] = rest_field(visibility=["read"]) + """The Size of the SKU.""" + family: Optional[str] = rest_field(visibility=["read"]) + """The Family of this particular SKU.""" + kind: Optional[str] = rest_field(visibility=["read"]) + """The Kind of resources that are supported in this SKU.""" + capacity: Optional["_models.ResourceSkuCapacity"] = rest_field(visibility=["read"]) + """Specifies the number of virtual machines in the scale set.""" + locations: Optional[list[str]] = rest_field(visibility=["read"]) + """The set of locations that the SKU is available.""" + location_info: Optional[list["_models.ResourceSkuLocationInfo"]] = rest_field( + name="locationInfo", visibility=["read"] + ) + """A list of locations and availability zones in those locations where the SKU is available.""" + api_versions: Optional[list[str]] = rest_field(name="apiVersions", visibility=["read"]) + """The api versions that support this SKU.""" + costs: Optional[list["_models.ResourceSkuCosts"]] = rest_field(visibility=["read"]) + """Metadata for retrieving price info.""" + capabilities: Optional[list["_models.ResourceSkuCapabilities"]] = rest_field(visibility=["read"]) + """A name value pair to describe the capability.""" + restrictions: Optional[list["_models.ResourceSkuRestrictions"]] = rest_field(visibility=["read"]) + """The restrictions because of which SKU cannot be used. This is empty if there are no + restrictions.""" + + +class ResourceSkuCapabilities(_Model): + """Describes The SKU capabilities object. + + :ivar name: An invariant to describe the feature. + :vartype name: str + :ivar value: An invariant if the feature is measured by quantity. + :vartype value: str + """ + + name: Optional[str] = rest_field(visibility=["read"]) + """An invariant to describe the feature.""" + value: Optional[str] = rest_field(visibility=["read"]) + """An invariant if the feature is measured by quantity.""" + + +class ResourceSkuCapacity(_Model): + """Describes scaling information of a SKU. + + :ivar minimum: The minimum capacity. + :vartype minimum: int + :ivar maximum: The maximum capacity that can be set. + :vartype maximum: int + :ivar default: The default capacity. + :vartype default: int + :ivar scale_type: The scale type applicable to the sku. Known values are: "Automatic", + "Manual", and "None". + :vartype scale_type: str or ~azure.mgmt.compute.models.ResourceSkuCapacityScaleType + """ + + minimum: Optional[int] = rest_field(visibility=["read"]) + """The minimum capacity.""" + maximum: Optional[int] = rest_field(visibility=["read"]) + """The maximum capacity that can be set.""" + default: Optional[int] = rest_field(visibility=["read"]) + """The default capacity.""" + scale_type: Optional[Union[str, "_models.ResourceSkuCapacityScaleType"]] = rest_field( + name="scaleType", visibility=["read"] + ) + """The scale type applicable to the sku. Known values are: \"Automatic\", \"Manual\", and + \"None\".""" + + +class ResourceSkuCosts(_Model): + """Describes metadata for retrieving price info. + + :ivar meter_id: Used for querying price from commerce. + :vartype meter_id: str + :ivar quantity: The multiplier is needed to extend the base metered cost. + :vartype quantity: int + :ivar extended_unit: An invariant to show the extended unit. + :vartype extended_unit: str + """ + + meter_id: Optional[str] = rest_field(name="meterID", visibility=["read"]) + """Used for querying price from commerce.""" + quantity: Optional[int] = rest_field(visibility=["read"]) + """The multiplier is needed to extend the base metered cost.""" + extended_unit: Optional[str] = rest_field(name="extendedUnit", visibility=["read"]) + """An invariant to show the extended unit.""" + + +class ResourceSkuLocationInfo(_Model): + """Describes an available Compute SKU Location Information. + + :ivar location: Location of the SKU. + :vartype location: str + :ivar zones: List of availability zones where the SKU is supported. + :vartype zones: list[str] + :ivar zone_details: Details of capabilities available to a SKU in specific zones. + :vartype zone_details: list[~azure.mgmt.compute.models.ResourceSkuZoneDetails] + :ivar extended_locations: The names of extended locations. + :vartype extended_locations: list[str] + :ivar type: The type of the extended location. "EdgeZone" + :vartype type: str or ~azure.mgmt.compute.models.ExtendedLocationType + """ + + location: Optional[str] = rest_field(visibility=["read"]) + """Location of the SKU.""" + zones: Optional[list[str]] = rest_field(visibility=["read"]) + """List of availability zones where the SKU is supported.""" + zone_details: Optional[list["_models.ResourceSkuZoneDetails"]] = rest_field(name="zoneDetails", visibility=["read"]) + """Details of capabilities available to a SKU in specific zones.""" + extended_locations: Optional[list[str]] = rest_field(name="extendedLocations", visibility=["read"]) + """The names of extended locations.""" + type: Optional[Union[str, "_models.ExtendedLocationType"]] = rest_field(visibility=["read"]) + """The type of the extended location. \"EdgeZone\"""" + + +class ResourceSkuRestrictionInfo(_Model): + """Describes an available Compute SKU Restriction Information. + + :ivar locations: Locations where the SKU is restricted. + :vartype locations: list[str] + :ivar zones: List of availability zones where the SKU is restricted. + :vartype zones: list[str] + """ + + locations: Optional[list[str]] = rest_field(visibility=["read"]) + """Locations where the SKU is restricted.""" + zones: Optional[list[str]] = rest_field(visibility=["read"]) + """List of availability zones where the SKU is restricted.""" + + +class ResourceSkuRestrictions(_Model): + """Describes scaling information of a SKU. + + :ivar type: The type of restrictions. Known values are: "Location" and "Zone". + :vartype type: str or ~azure.mgmt.compute.models.ResourceSkuRestrictionsType + :ivar values_property: The value of restrictions. If the restriction type is set to location. + This would be different locations where the SKU is restricted. + :vartype values_property: list[str] + :ivar restriction_info: The information about the restriction where the SKU cannot be used. + :vartype restriction_info: ~azure.mgmt.compute.models.ResourceSkuRestrictionInfo + :ivar reason_code: The reason for restriction. Known values are: "QuotaId" and + "NotAvailableForSubscription". + :vartype reason_code: str or ~azure.mgmt.compute.models.ResourceSkuRestrictionsReasonCode + """ + + type: Optional[Union[str, "_models.ResourceSkuRestrictionsType"]] = rest_field(visibility=["read"]) + """The type of restrictions. Known values are: \"Location\" and \"Zone\".""" + values_property: Optional[list[str]] = rest_field(name="values", visibility=["read"]) + """The value of restrictions. If the restriction type is set to location. This would be different + locations where the SKU is restricted.""" + restriction_info: Optional["_models.ResourceSkuRestrictionInfo"] = rest_field( + name="restrictionInfo", visibility=["read"] + ) + """The information about the restriction where the SKU cannot be used.""" + reason_code: Optional[Union[str, "_models.ResourceSkuRestrictionsReasonCode"]] = rest_field( + name="reasonCode", visibility=["read"] + ) + """The reason for restriction. Known values are: \"QuotaId\" and \"NotAvailableForSubscription\".""" + + +class ResourceSkuZoneDetails(_Model): + """Describes The zonal capabilities of a SKU. + + :ivar name: The set of zones that the SKU is available in with the specified capabilities. + :vartype name: list[str] + :ivar capabilities: A list of capabilities that are available for the SKU in the specified list + of zones. + :vartype capabilities: list[~azure.mgmt.compute.models.ResourceSkuCapabilities] + """ + + name: Optional[list[str]] = rest_field(visibility=["read"]) + """The set of zones that the SKU is available in with the specified capabilities.""" + capabilities: Optional[list["_models.ResourceSkuCapabilities"]] = rest_field(visibility=["read"]) + """A list of capabilities that are available for the SKU in the specified list of zones.""" + + +class RestartParameterBody(_Model): + """RestartParameterBody. + + :ivar vm_instance_i_ds: A list of virtual machine instance IDs from the VM scale set. + :vartype vm_instance_i_ds: ~azure.mgmt.compute.models.VirtualMachineScaleSetVMInstanceIDs + """ + + vm_instance_i_ds: Optional["_models.VirtualMachineScaleSetVMInstanceIDs"] = rest_field( + name="vmInstanceIDs", visibility=["read", "create", "update", "delete", "query"] + ) + """A list of virtual machine instance IDs from the VM scale set.""" + + @overload + def __init__( + self, + *, + vm_instance_i_ds: Optional["_models.VirtualMachineScaleSetVMInstanceIDs"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class RestorePoint(ProxyResource): + """Restore Point details. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.compute.models.SystemData + :ivar properties: The restore point properties. + :vartype properties: ~azure.mgmt.compute.models.RestorePointProperties + """ + + properties: Optional["_models.RestorePointProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The restore point properties.""" + + @overload + def __init__( + self, + *, + properties: Optional["_models.RestorePointProperties"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class RestorePointCollection(TrackedResource): + """Create or update Restore Point collection parameters. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.compute.models.SystemData + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar location: The geo-location where the resource lives. Required. + :vartype location: str + :ivar properties: The restore point collection properties. + :vartype properties: ~azure.mgmt.compute.models.RestorePointCollectionProperties + """ + + properties: Optional["_models.RestorePointCollectionProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The restore point collection properties.""" + + @overload + def __init__( + self, + *, + location: str, + tags: Optional[dict[str, str]] = None, + properties: Optional["_models.RestorePointCollectionProperties"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class RestorePointCollectionProperties(_Model): + """The restore point collection properties. + + :ivar source: The properties of the source resource that this restore point collection is + created from. + :vartype source: ~azure.mgmt.compute.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.models.RestorePoint] + """ + + source: Optional["_models.RestorePointCollectionSourceProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The properties of the source resource that this restore point collection is created from.""" + provisioning_state: Optional[str] = rest_field(name="provisioningState", visibility=["read"]) + """The provisioning state of the restore point collection.""" + restore_point_collection_id: Optional[str] = rest_field(name="restorePointCollectionId", visibility=["read"]) + """The unique id of the restore point collection.""" + restore_points: Optional[list["_models.RestorePoint"]] = rest_field(name="restorePoints", visibility=["read"]) + """A list containing all restore points created under this restore point collection.""" + + @overload + def __init__( + self, + *, + source: Optional["_models.RestorePointCollectionSourceProperties"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class RestorePointCollectionSourceProperties(_Model): + """The properties of the source resource that this restore point collection is created from. + + :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 + """ + + location: Optional[str] = rest_field(visibility=["read"]) + """Location of the source resource used to create this restore point collection.""" + id: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Resource Id of the source resource used to create this restore point collection.""" + + @overload + def __init__( + self, + *, + id: Optional[str] = None, # pylint: disable=redefined-builtin + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class RestorePointCollectionUpdate(UpdateResource): + """Update Restore Point collection parameters. + + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar properties: The restore point collection properties. + :vartype properties: ~azure.mgmt.compute.models.RestorePointCollectionProperties + """ + + properties: Optional["_models.RestorePointCollectionProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The restore point collection properties.""" + + @overload + def __init__( + self, + *, + tags: Optional[dict[str, str]] = None, + properties: Optional["_models.RestorePointCollectionProperties"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class RestorePointEncryption(_Model): + """Encryption at rest settings for disk restore point. It is an optional property that can be + specified in the input while creating a restore point. + + :ivar disk_encryption_set: Describes the parameter of customer managed disk encryption set + resource id that can be specified for disk. **Note:** The disk encryption set resource id can + only be specified for managed disk. Please refer `https://aka.ms/mdssewithcmkoverview + `_ for more details. + :vartype disk_encryption_set: ~azure.mgmt.compute.models.DiskEncryptionSetParameters + :ivar type: The type of key used to encrypt the data of the disk restore point. Known values + are: "EncryptionAtRestWithPlatformKey", "EncryptionAtRestWithCustomerKey", and + "EncryptionAtRestWithPlatformAndCustomerKeys". + :vartype type: str or ~azure.mgmt.compute.models.RestorePointEncryptionType + """ + + disk_encryption_set: Optional["_models.DiskEncryptionSetParameters"] = rest_field( + name="diskEncryptionSet", visibility=["read", "create", "update", "delete", "query"] + ) + """Describes the parameter of customer managed disk encryption set resource id that can be + specified for disk. **Note:** The disk encryption set resource id can only be specified for + managed disk. Please refer `https://aka.ms/mdssewithcmkoverview + `_ for more details.""" + type: Optional[Union[str, "_models.RestorePointEncryptionType"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The type of key used to encrypt the data of the disk restore point. Known values are: + \"EncryptionAtRestWithPlatformKey\", \"EncryptionAtRestWithCustomerKey\", and + \"EncryptionAtRestWithPlatformAndCustomerKeys\".""" + + @overload + def __init__( + self, + *, + disk_encryption_set: Optional["_models.DiskEncryptionSetParameters"] = None, + type: Optional[Union[str, "_models.RestorePointEncryptionType"]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class RestorePointInstanceView(_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.models.DiskRestorePointInstanceView] + :ivar statuses: The resource status information. + :vartype statuses: list[~azure.mgmt.compute.models.InstanceViewStatus] + """ + + disk_restore_points: Optional[list["_models.DiskRestorePointInstanceView"]] = rest_field( + name="diskRestorePoints", visibility=["read", "create", "update", "delete", "query"] + ) + """The disk restore points information.""" + statuses: Optional[list["_models.InstanceViewStatus"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The resource status information.""" + + @overload + def __init__( + self, + *, + disk_restore_points: Optional[list["_models.DiskRestorePointInstanceView"]] = None, + statuses: Optional[list["_models.InstanceViewStatus"]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class RestorePointProperties(_Model): + """The restore point properties. + + :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.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.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. Known values are: "CrashConsistent", "FileSystemConsistent", and + "ApplicationConsistent". + :vartype consistency_mode: str or ~azure.mgmt.compute.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.models.ApiEntityReference + :ivar instance_view: The restore point instance view. + :vartype instance_view: ~azure.mgmt.compute.models.RestorePointInstanceView + """ + + exclude_disks: Optional[list["_models.ApiEntityReference"]] = rest_field( + name="excludeDisks", visibility=["read", "create", "update", "delete", "query"] + ) + """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.""" + source_metadata: Optional["_models.RestorePointSourceMetadata"] = rest_field( + name="sourceMetadata", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets the details of the VM captured at the time of the restore point creation.""" + provisioning_state: Optional[str] = rest_field(name="provisioningState", visibility=["read"]) + """Gets the provisioning state of the restore point.""" + consistency_mode: Optional[Union[str, "_models.ConsistencyModeTypes"]] = rest_field( + name="consistencyMode", visibility=["read", "create", "update", "delete", "query"] + ) + """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. Known values + are: \"CrashConsistent\", \"FileSystemConsistent\", and \"ApplicationConsistent\".""" + time_created: Optional[datetime.datetime] = rest_field( + name="timeCreated", visibility=["read", "create", "update", "delete", "query"], format="rfc3339" + ) + """Gets the creation time of the restore point.""" + source_restore_point: Optional["_models.ApiEntityReference"] = rest_field( + name="sourceRestorePoint", visibility=["read", "create", "update", "delete", "query"] + ) + """Resource Id of the source restore point from which a copy needs to be created.""" + instance_view: Optional["_models.RestorePointInstanceView"] = rest_field(name="instanceView", visibility=["read"]) + """The restore point instance view.""" + + @overload + def __init__( + self, + *, + exclude_disks: Optional[list["_models.ApiEntityReference"]] = None, + source_metadata: Optional["_models.RestorePointSourceMetadata"] = None, + consistency_mode: Optional[Union[str, "_models.ConsistencyModeTypes"]] = None, + time_created: Optional[datetime.datetime] = None, + source_restore_point: Optional["_models.ApiEntityReference"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class RestorePointSourceMetadata(_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.models.HardwareProfile + :ivar storage_profile: Gets the storage profile. + :vartype storage_profile: ~azure.mgmt.compute.models.RestorePointSourceVMStorageProfile + :ivar os_profile: Gets the OS profile. + :vartype os_profile: ~azure.mgmt.compute.models.OSProfile + :ivar diagnostics_profile: Gets the diagnostics profile. + :vartype diagnostics_profile: ~azure.mgmt.compute.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.models.SecurityProfile + :ivar location: Location of the VM from which the restore point was created. + :vartype location: str + :ivar user_data: UserData associated with the source VM for which restore point is captured, + which is a base-64 encoded value. + :vartype user_data: str + :ivar hyper_v_generation: HyperVGeneration of the source VM for which restore point is + captured. Known values are: "V1" and "V2". + :vartype hyper_v_generation: str or ~azure.mgmt.compute.models.HyperVGenerationTypes + """ + + hardware_profile: Optional["_models.HardwareProfile"] = rest_field(name="hardwareProfile", visibility=["read"]) + """Gets the hardware profile.""" + storage_profile: Optional["_models.RestorePointSourceVMStorageProfile"] = rest_field( + name="storageProfile", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets the storage profile.""" + os_profile: Optional["_models.OSProfile"] = rest_field(name="osProfile", visibility=["read"]) + """Gets the OS profile.""" + diagnostics_profile: Optional["_models.DiagnosticsProfile"] = rest_field( + name="diagnosticsProfile", visibility=["read"] + ) + """Gets the diagnostics profile.""" + license_type: Optional[str] = rest_field(name="licenseType", visibility=["read"]) + """Gets the license type, which is for bring your own license scenario.""" + vm_id: Optional[str] = rest_field(name="vmId", visibility=["read"]) + """Gets the virtual machine unique id.""" + security_profile: Optional["_models.SecurityProfile"] = rest_field(name="securityProfile", visibility=["read"]) + """Gets the security profile.""" + location: Optional[str] = rest_field(visibility=["read"]) + """Location of the VM from which the restore point was created.""" + user_data: Optional[str] = rest_field(name="userData", visibility=["read"]) + """UserData associated with the source VM for which restore point is captured, which is a base-64 + encoded value.""" + hyper_v_generation: Optional[Union[str, "_models.HyperVGenerationTypes"]] = rest_field( + name="hyperVGeneration", visibility=["read"] + ) + """HyperVGeneration of the source VM for which restore point is captured. Known values are: \"V1\" + and \"V2\".""" + + @overload + def __init__( + self, + *, + storage_profile: Optional["_models.RestorePointSourceVMStorageProfile"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class RestorePointSourceVMDataDisk(_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. Known values are: "None", "ReadOnly", and "ReadWrite". + :vartype caching: str or ~azure.mgmt.compute.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: Contains the managed disk details. + :vartype managed_disk: ~azure.mgmt.compute.models.ManagedDiskParameters + :ivar disk_restore_point: Contains Disk Restore Point properties. + :vartype disk_restore_point: ~azure.mgmt.compute.models.DiskRestorePointAttributes + :ivar write_accelerator_enabled: Shows true if the disk is write-accelerator enabled. + :vartype write_accelerator_enabled: bool + """ + + lun: Optional[int] = rest_field(visibility=["read"]) + """Gets the logical unit number.""" + name: Optional[str] = rest_field(visibility=["read"]) + """Gets the disk name.""" + caching: Optional[Union[str, "_models.CachingTypes"]] = rest_field(visibility=["read"]) + """Gets the caching type. Known values are: \"None\", \"ReadOnly\", and \"ReadWrite\".""" + disk_size_gb: Optional[int] = rest_field(name="diskSizeGB", visibility=["read"]) + """Gets the initial disk size in GB for blank data disks, and the new desired size for existing OS + and Data disks.""" + managed_disk: Optional["_models.ManagedDiskParameters"] = rest_field( + name="managedDisk", visibility=["read", "create", "update", "delete", "query"] + ) + """Contains the managed disk details.""" + disk_restore_point: Optional["_models.DiskRestorePointAttributes"] = rest_field( + name="diskRestorePoint", visibility=["read", "create", "update", "delete", "query"] + ) + """Contains Disk Restore Point properties.""" + write_accelerator_enabled: Optional[bool] = rest_field(name="writeAcceleratorEnabled", visibility=["read"]) + """Shows true if the disk is write-accelerator enabled.""" + + @overload + def __init__( + self, + *, + managed_disk: Optional["_models.ManagedDiskParameters"] = None, + disk_restore_point: Optional["_models.DiskRestorePointAttributes"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class RestorePointSourceVMOSDisk(_Model): + """Describes an Operating System disk. + + :ivar os_type: Gets the Operating System type. Known values are: "Windows" and "Linux". + :vartype os_type: str or ~azure.mgmt.compute.models.OperatingSystemType + :ivar encryption_settings: Gets the disk encryption settings. + :vartype encryption_settings: ~azure.mgmt.compute.models.DiskEncryptionSettings + :ivar name: Gets the disk name. + :vartype name: str + :ivar caching: Gets the caching type. Known values are: "None", "ReadOnly", and "ReadWrite". + :vartype caching: str or ~azure.mgmt.compute.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.models.ManagedDiskParameters + :ivar disk_restore_point: Contains Disk Restore Point properties. + :vartype disk_restore_point: ~azure.mgmt.compute.models.DiskRestorePointAttributes + :ivar write_accelerator_enabled: Shows true if the disk is write-accelerator enabled. + :vartype write_accelerator_enabled: bool + """ + + os_type: Optional[Union[str, "_models.OperatingSystemType"]] = rest_field(name="osType", visibility=["read"]) + """Gets the Operating System type. Known values are: \"Windows\" and \"Linux\".""" + encryption_settings: Optional["_models.DiskEncryptionSettings"] = rest_field( + name="encryptionSettings", visibility=["read"] + ) + """Gets the disk encryption settings.""" + name: Optional[str] = rest_field(visibility=["read"]) + """Gets the disk name.""" + caching: Optional[Union[str, "_models.CachingTypes"]] = rest_field(visibility=["read"]) + """Gets the caching type. Known values are: \"None\", \"ReadOnly\", and \"ReadWrite\".""" + disk_size_gb: Optional[int] = rest_field(name="diskSizeGB", visibility=["read"]) + """Gets the disk size in GB.""" + managed_disk: Optional["_models.ManagedDiskParameters"] = rest_field( + name="managedDisk", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets the managed disk details.""" + disk_restore_point: Optional["_models.DiskRestorePointAttributes"] = rest_field( + name="diskRestorePoint", visibility=["read", "create", "update", "delete", "query"] + ) + """Contains Disk Restore Point properties.""" + write_accelerator_enabled: Optional[bool] = rest_field(name="writeAcceleratorEnabled", visibility=["read"]) + """Shows true if the disk is write-accelerator enabled.""" + + @overload + def __init__( + self, + *, + managed_disk: Optional["_models.ManagedDiskParameters"] = None, + disk_restore_point: Optional["_models.DiskRestorePointAttributes"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class RestorePointSourceVMStorageProfile(_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.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.models.RestorePointSourceVMDataDisk] + :ivar disk_controller_type: Gets the disk controller type of the VM captured at the time of the + restore point creation. Known values are: "SCSI" and "NVMe". + :vartype disk_controller_type: str or ~azure.mgmt.compute.models.DiskControllerTypes + """ + + os_disk: Optional["_models.RestorePointSourceVMOSDisk"] = rest_field( + name="osDisk", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets the OS disk of the VM captured at the time of the restore point creation.""" + data_disks: Optional[list["_models.RestorePointSourceVMDataDisk"]] = rest_field( + name="dataDisks", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets the data disks of the VM captured at the time of the restore point creation.""" + disk_controller_type: Optional[Union[str, "_models.DiskControllerTypes"]] = rest_field( + name="diskControllerType", visibility=["read"] + ) + """Gets the disk controller type of the VM captured at the time of the restore point creation. + Known values are: \"SCSI\" and \"NVMe\".""" + + @overload + def __init__( + self, + *, + os_disk: Optional["_models.RestorePointSourceVMOSDisk"] = None, + data_disks: Optional[list["_models.RestorePointSourceVMDataDisk"]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class RetrieveBootDiagnosticsDataResult(_Model): + """The SAS URIs of the console screenshot and serial log blobs. + + :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 + """ + + console_screenshot_blob_uri: Optional[str] = rest_field(name="consoleScreenshotBlobUri", visibility=["read"]) + """The console screenshot blob URI.""" + serial_console_log_blob_uri: Optional[str] = rest_field(name="serialConsoleLogBlobUri", visibility=["read"]) + """The serial console log blob URI.""" + + +class RollbackStatusInfo(_Model): + """Information about rollback on failed VM instances after a OS Upgrade operation. + + :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.models.ApiError + """ + + successfully_rolledback_instance_count: Optional[int] = rest_field( + name="successfullyRolledbackInstanceCount", visibility=["read"] + ) + """The number of instances which have been successfully rolled back.""" + failed_rolledback_instance_count: Optional[int] = rest_field( + name="failedRolledbackInstanceCount", visibility=["read"] + ) + """The number of instances which failed to rollback.""" + rollback_error: Optional["_models.ApiError"] = rest_field(name="rollbackError", visibility=["read"]) + """Error details if OS rollback failed.""" + + +class RollingUpgradePolicy(_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 + :ivar rollback_failed_instances_on_policy_breach: Rollback failed instances to previous model + if the Rolling Upgrade policy is violated. + :vartype rollback_failed_instances_on_policy_breach: bool + :ivar max_surge: Create new virtual machines to upgrade the scale set, rather than updating the + existing virtual machines. Existing virtual machines will be deleted once the new virtual + machines are created for each batch. + :vartype max_surge: bool + """ + + max_batch_instance_percent: Optional[int] = rest_field( + name="maxBatchInstancePercent", visibility=["read", "create", "update", "delete", "query"] + ) + """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%.""" + max_unhealthy_instance_percent: Optional[int] = rest_field( + name="maxUnhealthyInstancePercent", visibility=["read", "create", "update", "delete", "query"] + ) + """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%.""" + max_unhealthy_upgraded_instance_percent: Optional[int] = rest_field( + name="maxUnhealthyUpgradedInstancePercent", visibility=["read", "create", "update", "delete", "query"] + ) + """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%.""" + pause_time_between_batches: Optional[str] = rest_field( + name="pauseTimeBetweenBatches", visibility=["read", "create", "update", "delete", "query"] + ) + """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).""" + enable_cross_zone_upgrade: Optional[bool] = rest_field( + name="enableCrossZoneUpgrade", visibility=["read", "create", "update", "delete", "query"] + ) + """Allow VMSS to ignore AZ boundaries when constructing upgrade batches. Take into consideration + the Update Domain and maxBatchInstancePercent to determine the batch size.""" + prioritize_unhealthy_instances: Optional[bool] = rest_field( + name="prioritizeUnhealthyInstances", visibility=["read", "create", "update", "delete", "query"] + ) + """Upgrade all unhealthy instances in a scale set before any healthy instances.""" + rollback_failed_instances_on_policy_breach: Optional[bool] = rest_field( + name="rollbackFailedInstancesOnPolicyBreach", visibility=["read", "create", "update", "delete", "query"] + ) + """Rollback failed instances to previous model if the Rolling Upgrade policy is violated.""" + max_surge: Optional[bool] = rest_field(name="maxSurge", visibility=["read", "create", "update", "delete", "query"]) + """Create new virtual machines to upgrade the scale set, rather than updating the existing virtual + machines. Existing virtual machines will be deleted once the new virtual machines are created + for each batch.""" + + @overload + 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, + rollback_failed_instances_on_policy_breach: Optional[bool] = None, + max_surge: Optional[bool] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class RollingUpgradeProgressInfo(_Model): + """Information about the number of virtual machine instances in each upgrade state. + + :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 + """ + + successful_instance_count: Optional[int] = rest_field(name="successfulInstanceCount", visibility=["read"]) + """The number of instances that have been successfully upgraded.""" + failed_instance_count: Optional[int] = rest_field(name="failedInstanceCount", visibility=["read"]) + """The number of instances that have failed to be upgraded successfully.""" + in_progress_instance_count: Optional[int] = rest_field(name="inProgressInstanceCount", visibility=["read"]) + """The number of instances that are currently being upgraded.""" + pending_instance_count: Optional[int] = rest_field(name="pendingInstanceCount", visibility=["read"]) + """The number of instances that have not yet begun to be upgraded.""" + + +class RollingUpgradeRunningStatus(_Model): + """Information about the current running state of the overall upgrade. + + :ivar code: Code indicating the current status of the upgrade. Known values are: + "RollingForward", "Cancelled", "Completed", and "Faulted". + :vartype code: str or ~azure.mgmt.compute.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. Known values are: "Start" + and "Cancel". + :vartype last_action: str or ~azure.mgmt.compute.models.RollingUpgradeActionType + :ivar last_action_time: Last action time of the upgrade. + :vartype last_action_time: ~datetime.datetime + """ + + code: Optional[Union[str, "_models.RollingUpgradeStatusCode"]] = rest_field(visibility=["read"]) + """Code indicating the current status of the upgrade. Known values are: \"RollingForward\", + \"Cancelled\", \"Completed\", and \"Faulted\".""" + start_time: Optional[datetime.datetime] = rest_field(name="startTime", visibility=["read"], format="rfc3339") + """Start time of the upgrade.""" + last_action: Optional[Union[str, "_models.RollingUpgradeActionType"]] = rest_field( + name="lastAction", visibility=["read"] + ) + """The last action performed on the rolling upgrade. Known values are: \"Start\" and \"Cancel\".""" + last_action_time: Optional[datetime.datetime] = rest_field( + name="lastActionTime", visibility=["read"], format="rfc3339" + ) + """Last action time of the upgrade.""" + + +class RollingUpgradeStatusInfo(TrackedResource): + """The status of the latest virtual machine scale set rolling upgrade. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.compute.models.SystemData + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar location: The geo-location where the resource lives. Required. + :vartype location: str + :ivar properties: The status of the latest virtual machine scale set rolling upgrade. + :vartype properties: ~azure.mgmt.compute.models.RollingUpgradeStatusInfoProperties + """ + + properties: Optional["_models.RollingUpgradeStatusInfoProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The status of the latest virtual machine scale set rolling upgrade.""" + + @overload + def __init__( + self, + *, + location: str, + tags: Optional[dict[str, str]] = None, + properties: Optional["_models.RollingUpgradeStatusInfoProperties"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class RollingUpgradeStatusInfoProperties(_Model): + """The status of the latest virtual machine scale set rolling upgrade. + + :ivar policy: The rolling upgrade policies applied for this upgrade. + :vartype policy: ~azure.mgmt.compute.models.RollingUpgradePolicy + :ivar running_status: Information about the current running state of the overall upgrade. + :vartype running_status: ~azure.mgmt.compute.models.RollingUpgradeRunningStatus + :ivar progress: Information about the number of virtual machine instances in each upgrade + state. + :vartype progress: ~azure.mgmt.compute.models.RollingUpgradeProgressInfo + :ivar error: Error details for this upgrade, if there are any. + :vartype error: ~azure.mgmt.compute.models.ApiError + """ + + policy: Optional["_models.RollingUpgradePolicy"] = rest_field(visibility=["read"]) + """The rolling upgrade policies applied for this upgrade.""" + running_status: Optional["_models.RollingUpgradeRunningStatus"] = rest_field( + name="runningStatus", visibility=["read"] + ) + """Information about the current running state of the overall upgrade.""" + progress: Optional["_models.RollingUpgradeProgressInfo"] = rest_field(visibility=["read"]) + """Information about the number of virtual machine instances in each upgrade state.""" + error: Optional["_models.ApiError"] = rest_field(visibility=["read"]) + """Error details for this upgrade, if there are any.""" + + +class RunCommandDocumentBase(_Model): + """Describes the properties of a Run Command metadata. + + :ivar schema: The VM run command schema. Required. + :vartype schema: str + :ivar id: The VM run command id. Required. + :vartype id: str + :ivar os_type: The Operating System type. Required. Known values are: "Windows" and "Linux". + :vartype os_type: str or ~azure.mgmt.compute.models.OperatingSystemTypes + :ivar label: The VM run command label. Required. + :vartype label: str + :ivar description: The VM run command description. Required. + :vartype description: str + """ + + schema: str = rest_field(name="$schema", visibility=["read", "create", "update", "delete", "query"]) + """The VM run command schema. Required.""" + id: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The VM run command id. Required.""" + os_type: Union[str, "_models.OperatingSystemTypes"] = rest_field( + name="osType", visibility=["read", "create", "update", "delete", "query"] + ) + """The Operating System type. Required. Known values are: \"Windows\" and \"Linux\".""" + label: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The VM run command label. Required.""" + description: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The VM run command description. Required.""" + + @overload + def __init__( + self, + *, + schema: str, + id: str, # pylint: disable=redefined-builtin + os_type: Union[str, "_models.OperatingSystemTypes"], + label: str, + description: str, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class RunCommandDocument(RunCommandDocumentBase): + """Describes the properties of a Run Command. + + :ivar schema: The VM run command schema. Required. + :vartype schema: str + :ivar id: The VM run command id. Required. + :vartype id: str + :ivar os_type: The Operating System type. Required. Known values are: "Windows" and "Linux". + :vartype os_type: str or ~azure.mgmt.compute.models.OperatingSystemTypes + :ivar label: The VM run command label. Required. + :vartype label: str + :ivar description: The VM run command description. Required. + :vartype description: str + :ivar script: The script to be executed. Required. + :vartype script: list[str] + :ivar parameters: The parameters used by the script. + :vartype parameters: list[~azure.mgmt.compute.models.RunCommandParameterDefinition] + """ + + script: list[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The script to be executed. Required.""" + parameters: Optional[list["_models.RunCommandParameterDefinition"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The parameters used by the script.""" + + @overload + def __init__( + self, + *, + schema: str, + id: str, # pylint: disable=redefined-builtin + os_type: Union[str, "_models.OperatingSystemTypes"], + label: str, + description: str, + script: list[str], + parameters: Optional[list["_models.RunCommandParameterDefinition"]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class RunCommandInput(_Model): + """Capture Virtual Machine parameters. + + :ivar command_id: Specifies a commandId of predefined built-in script. Command IDs available + for Linux are listed at `https://aka.ms/RunCommandManagedLinux#available-commands + `_, Windows at + `https://aka.ms/RunCommandManagedWindows#available-commands + `_. Required. + :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.models.RunCommandInputParameter] + """ + + command_id: str = rest_field(name="commandId", visibility=["read", "create", "update", "delete", "query"]) + """Specifies a commandId of predefined built-in script. Command IDs available for Linux are listed + at `https://aka.ms/RunCommandManagedLinux#available-commands + `_, Windows at + `https://aka.ms/RunCommandManagedWindows#available-commands + `_. Required.""" + script: Optional[list[str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Optional. The script to be executed. When this value is given, the given script will override + the default script of the command.""" + parameters: Optional[list["_models.RunCommandInputParameter"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The run command parameters.""" + + @overload + def __init__( + self, + *, + command_id: str, + script: Optional[list[str]] = None, + parameters: Optional[list["_models.RunCommandInputParameter"]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class RunCommandInputParameter(_Model): + """Describes the properties of a run command parameter. + + :ivar name: The run command parameter name. Required. + :vartype name: str + :ivar value: The run command parameter value. Required. + :vartype value: str + """ + + name: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The run command parameter name. Required.""" + value: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The run command parameter value. Required.""" + + @overload + def __init__( + self, + *, + name: str, + value: str, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class RunCommandManagedIdentity(_Model): + """Contains clientId or objectId (use only one, not both) of a user-assigned managed identity that + has access to storage blob used in Run Command. Use an empty RunCommandManagedIdentity object + in case of system-assigned identity. Make sure the Azure storage blob exists in case of + scriptUri, and managed identity has been given access to blob's container with 'Storage Blob + Data Reader' role assignment with scriptUri blob and 'Storage Blob Data Contributor' for Append + blobs(outputBlobUri, errorBlobUri). In case of user assigned identity, make sure you add it + under VM's identity. For more info on managed identity and Run Command, refer + `https://aka.ms/ManagedIdentity `_ and + `https://aka.ms/RunCommandManaged `_. + + :ivar client_id: Client Id (GUID value) of the user-assigned managed identity. ObjectId should + not be used if this is provided. + :vartype client_id: str + :ivar object_id: Object Id (GUID value) of the user-assigned managed identity. ClientId should + not be used if this is provided. + :vartype object_id: str + """ + + client_id: Optional[str] = rest_field(name="clientId", visibility=["read", "create", "update", "delete", "query"]) + """Client Id (GUID value) of the user-assigned managed identity. ObjectId should not be used if + this is provided.""" + object_id: Optional[str] = rest_field(name="objectId", visibility=["read", "create", "update", "delete", "query"]) + """Object Id (GUID value) of the user-assigned managed identity. ClientId should not be used if + this is provided.""" + + @overload + def __init__( + self, + *, + client_id: Optional[str] = None, + object_id: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class RunCommandParameterDefinition(_Model): + """Describes the properties of a run command parameter. + + :ivar name: The run command parameter name. Required. + :vartype name: str + :ivar type: The run command parameter type. Required. + :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 + """ + + name: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The run command parameter name. Required.""" + type: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The run command parameter type. Required.""" + default_value: Optional[str] = rest_field( + name="defaultValue", visibility=["read", "create", "update", "delete", "query"] + ) + """The run command parameter default value.""" + required: Optional[bool] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The run command parameter required.""" + + @overload + def __init__( + self, + *, + name: str, + type: str, + default_value: Optional[str] = None, + required: Optional[bool] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class RunCommandResult(_Model): + """RunCommandResult. + + :ivar value: Run command operation response. + :vartype value: list[~azure.mgmt.compute.models.InstanceViewStatus] + """ + + value: Optional[list["_models.InstanceViewStatus"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Run command operation response.""" + + @overload + def __init__( + self, + *, + value: Optional[list["_models.InstanceViewStatus"]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ScaleInPolicy(_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.

+ Possible values are:

**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. +

**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.

+ **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.

. + :vartype rules: list[str or ~azure.mgmt.compute.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 + :ivar prioritize_unhealthy_v_ms: This property allows you to prioritize the deletion of + unhealthy and inactive VMs when a virtual machine scale set is being scaled-in.(Feature in + Preview). + :vartype prioritize_unhealthy_v_ms: bool + """ + + rules: Optional[list[Union[str, "_models.VirtualMachineScaleSetScaleInRules"]]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The rules to be followed when scaling-in a virtual machine scale set.

Possible values + are:

**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.

**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.

**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.

.""" + force_deletion: Optional[bool] = rest_field( + name="forceDeletion", visibility=["read", "create", "update", "delete", "query"] + ) + """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).""" + prioritize_unhealthy_v_ms: Optional[bool] = rest_field( + name="prioritizeUnhealthyVMs", visibility=["read", "create", "update", "delete", "query"] + ) + """This property allows you to prioritize the deletion of unhealthy and inactive VMs when a + virtual machine scale set is being scaled-in.(Feature in Preview).""" + + @overload + def __init__( + self, + *, + rules: Optional[list[Union[str, "_models.VirtualMachineScaleSetScaleInRules"]]] = None, + force_deletion: Optional[bool] = None, + prioritize_unhealthy_v_ms: Optional[bool] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ScheduledEventsAdditionalPublishingTargets(_Model): # pylint: disable=name-too-long + """ScheduledEventsAdditionalPublishingTargets. + + :ivar event_grid_and_resource_graph: The configuration parameters used while creating + eventGridAndResourceGraph Scheduled Event setting. + :vartype event_grid_and_resource_graph: ~azure.mgmt.compute.models.EventGridAndResourceGraph + """ + + event_grid_and_resource_graph: Optional["_models.EventGridAndResourceGraph"] = rest_field( + name="eventGridAndResourceGraph", visibility=["read", "create", "update", "delete", "query"] + ) + """The configuration parameters used while creating eventGridAndResourceGraph Scheduled Event + setting.""" + + @overload + def __init__( + self, + *, + event_grid_and_resource_graph: Optional["_models.EventGridAndResourceGraph"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ScheduledEventsPolicy(_Model): + """Specifies Redeploy, Reboot and ScheduledEventsAdditionalPublishingTargets Scheduled Event + related configurations. + + :ivar user_initiated_redeploy: The configuration parameters used while creating + userInitiatedRedeploy scheduled event setting creation. + :vartype user_initiated_redeploy: ~azure.mgmt.compute.models.UserInitiatedRedeploy + :ivar user_initiated_reboot: The configuration parameters used while creating + userInitiatedReboot scheduled event setting creation. + :vartype user_initiated_reboot: ~azure.mgmt.compute.models.UserInitiatedReboot + :ivar scheduled_events_additional_publishing_targets: The configuration parameters used while + publishing scheduledEventsAdditionalPublishingTargets. + :vartype scheduled_events_additional_publishing_targets: + ~azure.mgmt.compute.models.ScheduledEventsAdditionalPublishingTargets + :ivar all_instances_down: The configuration parameters used while creating AllInstancesDown + scheduled event setting creation. + :vartype all_instances_down: ~azure.mgmt.compute.models.AllInstancesDown + """ + + user_initiated_redeploy: Optional["_models.UserInitiatedRedeploy"] = rest_field( + name="userInitiatedRedeploy", visibility=["read", "create", "update", "delete", "query"] + ) + """The configuration parameters used while creating userInitiatedRedeploy scheduled event setting + creation.""" + user_initiated_reboot: Optional["_models.UserInitiatedReboot"] = rest_field( + name="userInitiatedReboot", visibility=["read", "create", "update", "delete", "query"] + ) + """The configuration parameters used while creating userInitiatedReboot scheduled event setting + creation.""" + scheduled_events_additional_publishing_targets: Optional["_models.ScheduledEventsAdditionalPublishingTargets"] = ( + rest_field( + name="scheduledEventsAdditionalPublishingTargets", + visibility=["read", "create", "update", "delete", "query"], + ) + ) + """The configuration parameters used while publishing scheduledEventsAdditionalPublishingTargets.""" + all_instances_down: Optional["_models.AllInstancesDown"] = rest_field( + name="allInstancesDown", visibility=["read", "create", "update", "delete", "query"] + ) + """The configuration parameters used while creating AllInstancesDown scheduled event setting + creation.""" + + @overload + def __init__( + self, + *, + user_initiated_redeploy: Optional["_models.UserInitiatedRedeploy"] = None, + user_initiated_reboot: Optional["_models.UserInitiatedReboot"] = None, + scheduled_events_additional_publishing_targets: Optional[ + "_models.ScheduledEventsAdditionalPublishingTargets" + ] = None, + all_instances_down: Optional["_models.AllInstancesDown"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ScheduledEventsProfile(_Model): + """ScheduledEventsProfile. + + :ivar terminate_notification_profile: Specifies Terminate Scheduled Event related + configurations. + :vartype terminate_notification_profile: + ~azure.mgmt.compute.models.TerminateNotificationProfile + :ivar os_image_notification_profile: Specifies OS Image Scheduled Event related configurations. + :vartype os_image_notification_profile: ~azure.mgmt.compute.models.OSImageNotificationProfile + """ + + terminate_notification_profile: Optional["_models.TerminateNotificationProfile"] = rest_field( + name="terminateNotificationProfile", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies Terminate Scheduled Event related configurations.""" + os_image_notification_profile: Optional["_models.OSImageNotificationProfile"] = rest_field( + name="osImageNotificationProfile", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies OS Image Scheduled Event related configurations.""" + + @overload + def __init__( + self, + *, + terminate_notification_profile: Optional["_models.TerminateNotificationProfile"] = None, + os_image_notification_profile: Optional["_models.OSImageNotificationProfile"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ScheduleProfile(_Model): + """Defines the schedule for Block-type capacity reservations. Specifies the schedule during which + capacity reservation is active and VM or VMSS resource can be allocated using reservation. This + property is required and only supported when the capacity reservation group type is 'Block'. + The scheduleProfile, start, and end fields are immutable after creation. Minimum API version: + 2025-04-01. Please refer to `https://aka.ms/blockcapacityreservation + `_ for more details. + + :ivar start: The required start date for block capacity reservations. Must be today or within + 56 days in the future. For same-day scheduling, requests must be submitted before 11:30 AM UTC. + Example: 2025-06-27. + :vartype start: str + :ivar end: The required end date for block capacity reservations. Must be after the start date, + with a duration of either 1–14 whole days or 3–26 whole weeks. Example: 2025-06-28. + :vartype end: str + """ + + start: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The required start date for block capacity reservations. Must be today or within 56 days in the + future. For same-day scheduling, requests must be submitted before 11:30 AM UTC. Example: + 2025-06-27.""" + end: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The required end date for block capacity reservations. Must be after the start date, with a + duration of either 1–14 whole days or 3–26 whole weeks. Example: 2025-06-28.""" + + @overload + def __init__( + self, + *, + start: Optional[str] = None, + end: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class SecurityPostureReference(_Model): + """Specifies the security posture to be used in the scale set. Minimum api-version: 2023-03-01. + + :ivar id: The security posture reference id in the form of + /CommunityGalleries/{communityGalleryName}/securityPostures/{securityPostureName}/versions/{major.minor.patch}|latest. + Required. + :vartype id: str + :ivar exclude_extensions: The list of virtual machine extension names to exclude when applying + the security posture. + :vartype exclude_extensions: list[str] + :ivar is_overridable: Whether the security posture can be overridden by the user. + :vartype is_overridable: bool + """ + + id: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The security posture reference id in the form of + /CommunityGalleries/{communityGalleryName}/securityPostures/{securityPostureName}/versions/{major.minor.patch}|latest. + Required.""" + exclude_extensions: Optional[list[str]] = rest_field( + name="excludeExtensions", visibility=["read", "create", "update", "delete", "query"] + ) + """The list of virtual machine extension names to exclude when applying the security posture.""" + is_overridable: Optional[bool] = rest_field( + name="isOverridable", visibility=["read", "create", "update", "delete", "query"] + ) + """Whether the security posture can be overridden by the user.""" + + @overload + def __init__( + self, + *, + id: str, # pylint: disable=redefined-builtin + exclude_extensions: Optional[list[str]] = None, + is_overridable: Optional[bool] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class SecurityPostureReferenceUpdate(_Model): + """Specifies the security posture to be used in the scale set. Minimum api-version: 2023-03-01. + + :ivar id: The security posture reference id in the form of + /CommunityGalleries/{communityGalleryName}/securityPostures/{securityPostureName}/versions/{major.minor.patch}|latest. + :vartype id: str + :ivar exclude_extensions: The list of virtual machine extension names to exclude when applying + the security posture. + :vartype exclude_extensions: list[str] + :ivar is_overridable: Whether the security posture can be overridden by the user. + :vartype is_overridable: bool + """ + + id: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The security posture reference id in the form of + /CommunityGalleries/{communityGalleryName}/securityPostures/{securityPostureName}/versions/{major.minor.patch}|latest.""" + exclude_extensions: Optional[list[str]] = rest_field( + name="excludeExtensions", visibility=["read", "create", "update", "delete", "query"] + ) + """The list of virtual machine extension names to exclude when applying the security posture.""" + is_overridable: Optional[bool] = rest_field( + name="isOverridable", visibility=["read", "create", "update", "delete", "query"] + ) + """Whether the security posture can be overridden by the user.""" + + @overload + def __init__( + self, + *, + id: Optional[str] = None, # pylint: disable=redefined-builtin + exclude_extensions: Optional[list[str]] = None, + is_overridable: Optional[bool] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class SecurityProfile(_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. Minimum api-version: 2020-12-01. + :vartype uefi_settings: ~azure.mgmt.compute.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. The default behavior + is: 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. The default behavior is: UefiSettings will not be + enabled unless this property is set. Known values are: "TrustedLaunch" and "ConfidentialVM". + :vartype security_type: str or ~azure.mgmt.compute.models.SecurityTypes + :ivar encryption_identity: Specifies the Managed Identity used by ADE to get access token for + keyvault operations. + :vartype encryption_identity: ~azure.mgmt.compute.models.EncryptionIdentity + :ivar proxy_agent_settings: Specifies ProxyAgent settings while creating the virtual machine. + Minimum api-version: 2023-09-01. + :vartype proxy_agent_settings: ~azure.mgmt.compute.models.ProxyAgentSettings + """ + + uefi_settings: Optional["_models.UefiSettings"] = rest_field( + name="uefiSettings", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies the security settings like secure boot and vTPM used while creating the virtual + machine. Minimum api-version: 2020-12-01.""" + encryption_at_host: Optional[bool] = rest_field( + name="encryptionAtHost", visibility=["read", "create", "update", "delete", "query"] + ) + """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. The default behavior is: The Encryption at + host will be disabled unless this property is set to true for the resource.""" + security_type: Optional[Union[str, "_models.SecurityTypes"]] = rest_field( + name="securityType", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies the SecurityType of the virtual machine. It has to be set to any specified value to + enable UefiSettings. The default behavior is: UefiSettings will not be enabled unless this + property is set. Known values are: \"TrustedLaunch\" and \"ConfidentialVM\".""" + encryption_identity: Optional["_models.EncryptionIdentity"] = rest_field( + name="encryptionIdentity", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies the Managed Identity used by ADE to get access token for keyvault operations.""" + proxy_agent_settings: Optional["_models.ProxyAgentSettings"] = rest_field( + name="proxyAgentSettings", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies ProxyAgent settings while creating the virtual machine. Minimum api-version: + 2023-09-01.""" + + @overload + def __init__( + self, + *, + uefi_settings: Optional["_models.UefiSettings"] = None, + encryption_at_host: Optional[bool] = None, + security_type: Optional[Union[str, "_models.SecurityTypes"]] = None, + encryption_identity: Optional["_models.EncryptionIdentity"] = None, + proxy_agent_settings: Optional["_models.ProxyAgentSettings"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ServiceArtifactReference(_Model): + """Specifies the service artifact reference id used to set same image version for all virtual + machines in the scale set when using 'latest' image version. Minimum api-version: 2022-11-01. + + :ivar id: The service artifact reference id in the form of + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/galleries/{galleryName}/serviceArtifacts/{serviceArtifactName}/vmArtifactsProfiles/{vmArtifactsProfilesName}. + :vartype id: str + """ + + id: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The service artifact reference id in the form of + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/galleries/{galleryName}/serviceArtifacts/{serviceArtifactName}/vmArtifactsProfiles/{vmArtifactsProfilesName}.""" + + @overload + def __init__( + self, + *, + id: Optional[str] = None, # pylint: disable=redefined-builtin + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class SharedGallery(PirSharedGalleryResource): + """Specifies information about the Shared Gallery that you want to create or update. + + :ivar name: Resource name. + :vartype name: str + :ivar location: Resource location. + :vartype location: str + :ivar identifier: The identifier information of shared gallery. + :vartype identifier: ~azure.mgmt.compute.models.SharedGalleryIdentifier + :ivar properties: Specifies the properties of a shared gallery. + :vartype properties: ~azure.mgmt.compute.models.SharedGalleryProperties + """ + + properties: Optional["_models.SharedGalleryProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies the properties of a shared gallery.""" + + @overload + def __init__( + self, + *, + identifier: Optional["_models.SharedGalleryIdentifier"] = None, + properties: Optional["_models.SharedGalleryProperties"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class SharedGalleryDiskImage(_Model): + """This is the disk image base class. + + :ivar disk_size_gb: This property indicates the size of the VHD to be created. + :vartype disk_size_gb: int + :ivar host_caching: The host caching of the disk. Valid values are 'None', 'ReadOnly', and + 'ReadWrite'. Known values are: "None", "ReadOnly", and "ReadWrite". + :vartype host_caching: str or ~azure.mgmt.compute.models.SharedGalleryHostCaching + """ + + disk_size_gb: Optional[int] = rest_field(name="diskSizeGB", visibility=["read"]) + """This property indicates the size of the VHD to be created.""" + host_caching: Optional[Union[str, "_models.SharedGalleryHostCaching"]] = rest_field( + name="hostCaching", visibility=["read", "create", "update", "delete", "query"] + ) + """The host caching of the disk. Valid values are 'None', 'ReadOnly', and 'ReadWrite'. Known + values are: \"None\", \"ReadOnly\", and \"ReadWrite\".""" + + @overload + def __init__( + self, + *, + host_caching: Optional[Union[str, "_models.SharedGalleryHostCaching"]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class SharedGalleryDataDiskImage(SharedGalleryDiskImage): + """This is the data disk image. + + :ivar disk_size_gb: This property indicates the size of the VHD to be created. + :vartype disk_size_gb: int + :ivar host_caching: The host caching of the disk. Valid values are 'None', 'ReadOnly', and + 'ReadWrite'. Known values are: "None", "ReadOnly", and "ReadWrite". + :vartype host_caching: str or ~azure.mgmt.compute.models.SharedGalleryHostCaching + :ivar lun: This property specifies the logical unit number of the data disk. This value is used + to identify data disks within the Virtual Machine and therefore must be unique for each data + disk attached to the Virtual Machine. Required. + :vartype lun: int + """ + + lun: int = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """This property specifies the logical unit number of the data disk. This value is used to + identify data disks within the Virtual Machine and therefore must be unique for each data disk + attached to the Virtual Machine. Required.""" + + @overload + def __init__( + self, + *, + lun: int, + host_caching: Optional[Union[str, "_models.SharedGalleryHostCaching"]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class SharedGalleryIdentifier(_Model): + """The identifier information of shared gallery. + + :ivar unique_id: The unique id of this shared gallery. + :vartype unique_id: str + """ + + unique_id: Optional[str] = rest_field(name="uniqueId", visibility=["read", "create", "update", "delete", "query"]) + """The unique id of this shared gallery.""" + + @overload + def __init__( + self, + *, + unique_id: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class SharedGalleryImage(PirSharedGalleryResource): + """Specifies information about the gallery image definition that you want to create or update. + + :ivar name: Resource name. + :vartype name: str + :ivar location: Resource location. + :vartype location: str + :ivar identifier: The identifier information of shared gallery. + :vartype identifier: ~azure.mgmt.compute.models.SharedGalleryIdentifier + :ivar properties: Describes the properties of a gallery image definition. + :vartype properties: ~azure.mgmt.compute.models.SharedGalleryImageProperties + """ + + properties: Optional["_models.SharedGalleryImageProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Describes the properties of a gallery image definition.""" + + @overload + def __init__( + self, + *, + identifier: Optional["_models.SharedGalleryIdentifier"] = None, + properties: Optional["_models.SharedGalleryImageProperties"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class SharedGalleryImageProperties(_Model): + """Describes the properties of a gallery image definition. + + :ivar os_type: This property allows you to specify the type of the OS that is included in the + disk when creating a VM from a managed image. Possible values are: **Windows,** **Linux.**. + Required. Known values are: "Windows" and "Linux". + :vartype os_type: str or ~azure.mgmt.compute.models.OperatingSystemTypes + :ivar os_state: This property allows the user to specify whether the virtual machines created + under this image are 'Generalized' or 'Specialized'. Required. Known values are: "Generalized" + and "Specialized". + :vartype os_state: str or ~azure.mgmt.compute.models.OperatingSystemStateTypes + :ivar end_of_life_date: The end of life date of the gallery image definition. This property can + be used for decommissioning purposes. This property is updatable. + :vartype end_of_life_date: ~datetime.datetime + :ivar identifier: This is the gallery image definition identifier. Required. + :vartype identifier: ~azure.mgmt.compute.models.GalleryImageIdentifier + :ivar recommended: The properties describe the recommended machine configuration for this Image + Definition. These properties are updatable. + :vartype recommended: ~azure.mgmt.compute.models.RecommendedMachineConfiguration + :ivar disallowed: Describes the disallowed disk types. + :vartype disallowed: ~azure.mgmt.compute.models.Disallowed + :ivar hyper_v_generation: The hypervisor generation of the Virtual Machine. Applicable to OS + disks only. Known values are: "V1" and "V2". + :vartype hyper_v_generation: str or ~azure.mgmt.compute.models.HyperVGeneration + :ivar features: A list of gallery image features. + :vartype features: list[~azure.mgmt.compute.models.GalleryImageFeature] + :ivar purchase_plan: Describes the gallery image definition purchase plan. This is used by + marketplace images. + :vartype purchase_plan: ~azure.mgmt.compute.models.ImagePurchasePlan + :ivar architecture: The architecture of the image. Applicable to OS disks only. Known values + are: "x64" and "Arm64". + :vartype architecture: str or ~azure.mgmt.compute.models.Architecture + :ivar privacy_statement_uri: Privacy statement uri for the current community gallery image. + :vartype privacy_statement_uri: str + :ivar eula: End-user license agreement for the current community gallery image. + :vartype eula: str + :ivar artifact_tags: The artifact tags of a shared gallery resource. + :vartype artifact_tags: dict[str, str] + """ + + os_type: Union[str, "_models.OperatingSystemTypes"] = rest_field( + name="osType", visibility=["read", "create", "update", "delete", "query"] + ) + """This property allows you to specify the type of the OS that is included in the disk when + creating a VM from a managed image. Possible values are: **Windows,** **Linux.**. Required. + Known values are: \"Windows\" and \"Linux\".""" + os_state: Union[str, "_models.OperatingSystemStateTypes"] = rest_field( + name="osState", visibility=["read", "create", "update", "delete", "query"] + ) + """This property allows the user to specify whether the virtual machines created under this image + are 'Generalized' or 'Specialized'. Required. Known values are: \"Generalized\" and + \"Specialized\".""" + end_of_life_date: Optional[datetime.datetime] = rest_field( + name="endOfLifeDate", visibility=["read", "create", "update", "delete", "query"], format="rfc3339" + ) + """The end of life date of the gallery image definition. This property can be used for + decommissioning purposes. This property is updatable.""" + identifier: "_models.GalleryImageIdentifier" = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """This is the gallery image definition identifier. Required.""" + recommended: Optional["_models.RecommendedMachineConfiguration"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The properties describe the recommended machine configuration for this Image Definition. These + properties are updatable.""" + disallowed: Optional["_models.Disallowed"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Describes the disallowed disk types.""" + hyper_v_generation: Optional[Union[str, "_models.HyperVGeneration"]] = rest_field( + name="hyperVGeneration", visibility=["read", "create", "update", "delete", "query"] + ) + """The hypervisor generation of the Virtual Machine. Applicable to OS disks only. Known values + are: \"V1\" and \"V2\".""" + features: Optional[list["_models.GalleryImageFeature"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """A list of gallery image features.""" + purchase_plan: Optional["_models.ImagePurchasePlan"] = rest_field( + name="purchasePlan", visibility=["read", "create", "update", "delete", "query"] + ) + """Describes the gallery image definition purchase plan. This is used by marketplace images.""" + architecture: Optional[Union[str, "_models.Architecture"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The architecture of the image. Applicable to OS disks only. Known values are: \"x64\" and + \"Arm64\".""" + privacy_statement_uri: Optional[str] = rest_field( + name="privacyStatementUri", visibility=["read", "create", "update", "delete", "query"] + ) + """Privacy statement uri for the current community gallery image.""" + eula: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """End-user license agreement for the current community gallery image.""" + artifact_tags: Optional[dict[str, str]] = rest_field( + name="artifactTags", visibility=["read", "create", "update", "delete", "query"] + ) + """The artifact tags of a shared gallery resource.""" + + @overload + def __init__( + self, + *, + os_type: Union[str, "_models.OperatingSystemTypes"], + os_state: Union[str, "_models.OperatingSystemStateTypes"], + identifier: "_models.GalleryImageIdentifier", + end_of_life_date: Optional[datetime.datetime] = None, + recommended: Optional["_models.RecommendedMachineConfiguration"] = None, + disallowed: Optional["_models.Disallowed"] = None, + hyper_v_generation: Optional[Union[str, "_models.HyperVGeneration"]] = None, + features: Optional[list["_models.GalleryImageFeature"]] = None, + purchase_plan: Optional["_models.ImagePurchasePlan"] = None, + architecture: Optional[Union[str, "_models.Architecture"]] = None, + privacy_statement_uri: Optional[str] = None, + eula: Optional[str] = None, + artifact_tags: Optional[dict[str, str]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class SharedGalleryImageVersion(PirSharedGalleryResource): + """Specifies information about the gallery image version that you want to create or update. + + :ivar name: Resource name. + :vartype name: str + :ivar location: Resource location. + :vartype location: str + :ivar identifier: The identifier information of shared gallery. + :vartype identifier: ~azure.mgmt.compute.models.SharedGalleryIdentifier + :ivar properties: Describes the properties of a gallery image version. + :vartype properties: ~azure.mgmt.compute.models.SharedGalleryImageVersionProperties + """ + + properties: Optional["_models.SharedGalleryImageVersionProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Describes the properties of a gallery image version.""" + + @overload + def __init__( + self, + *, + identifier: Optional["_models.SharedGalleryIdentifier"] = None, + properties: Optional["_models.SharedGalleryImageVersionProperties"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class SharedGalleryImageVersionProperties(_Model): + """Describes the properties of a gallery image version. + + :ivar published_date: The published date of the gallery image version Definition. This property + can be used for decommissioning purposes. This property is updatable. + :vartype published_date: ~datetime.datetime + :ivar end_of_life_date: The end of life date of the gallery image version Definition. This + property can be used for decommissioning purposes. This property is updatable. + :vartype end_of_life_date: ~datetime.datetime + :ivar exclude_from_latest: If set to true, Virtual Machines deployed from the latest version of + the Image Definition won't use this Image Version. + :vartype exclude_from_latest: bool + :ivar storage_profile: Describes the storage profile of the image version. + :vartype storage_profile: ~azure.mgmt.compute.models.SharedGalleryImageVersionStorageProfile + :ivar artifact_tags: The artifact tags of a shared gallery resource. + :vartype artifact_tags: dict[str, str] + """ + + published_date: Optional[datetime.datetime] = rest_field( + name="publishedDate", visibility=["read", "create", "update", "delete", "query"], format="rfc3339" + ) + """The published date of the gallery image version Definition. This property can be used for + decommissioning purposes. This property is updatable.""" + end_of_life_date: Optional[datetime.datetime] = rest_field( + name="endOfLifeDate", visibility=["read", "create", "update", "delete", "query"], format="rfc3339" + ) + """The end of life date of the gallery image version Definition. This property can be used for + decommissioning purposes. This property is updatable.""" + exclude_from_latest: Optional[bool] = rest_field( + name="excludeFromLatest", visibility=["read", "create", "update", "delete", "query"] + ) + """If set to true, Virtual Machines deployed from the latest version of the Image Definition won't + use this Image Version.""" + storage_profile: Optional["_models.SharedGalleryImageVersionStorageProfile"] = rest_field( + name="storageProfile", visibility=["read", "create", "update", "delete", "query"] + ) + """Describes the storage profile of the image version.""" + artifact_tags: Optional[dict[str, str]] = rest_field( + name="artifactTags", visibility=["read", "create", "update", "delete", "query"] + ) + """The artifact tags of a shared gallery resource.""" + + @overload + def __init__( + self, + *, + published_date: Optional[datetime.datetime] = None, + end_of_life_date: Optional[datetime.datetime] = None, + exclude_from_latest: Optional[bool] = None, + storage_profile: Optional["_models.SharedGalleryImageVersionStorageProfile"] = None, + artifact_tags: Optional[dict[str, str]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class SharedGalleryImageVersionStorageProfile(_Model): + """This is the storage profile of a Gallery Image Version. + + :ivar os_disk_image: This is the OS disk image. + :vartype os_disk_image: ~azure.mgmt.compute.models.SharedGalleryOSDiskImage + :ivar data_disk_images: A list of data disk images. + :vartype data_disk_images: list[~azure.mgmt.compute.models.SharedGalleryDataDiskImage] + """ + + os_disk_image: Optional["_models.SharedGalleryOSDiskImage"] = rest_field( + name="osDiskImage", visibility=["read", "create", "update", "delete", "query"] + ) + """This is the OS disk image.""" + data_disk_images: Optional[list["_models.SharedGalleryDataDiskImage"]] = rest_field( + name="dataDiskImages", visibility=["read", "create", "update", "delete", "query"] + ) + """A list of data disk images.""" + + @overload + def __init__( + self, + *, + os_disk_image: Optional["_models.SharedGalleryOSDiskImage"] = None, + data_disk_images: Optional[list["_models.SharedGalleryDataDiskImage"]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class SharedGalleryOSDiskImage(SharedGalleryDiskImage): + """This is the OS disk image. + + :ivar disk_size_gb: This property indicates the size of the VHD to be created. + :vartype disk_size_gb: int + :ivar host_caching: The host caching of the disk. Valid values are 'None', 'ReadOnly', and + 'ReadWrite'. Known values are: "None", "ReadOnly", and "ReadWrite". + :vartype host_caching: str or ~azure.mgmt.compute.models.SharedGalleryHostCaching + """ + + @overload + def __init__( + self, + *, + host_caching: Optional[Union[str, "_models.SharedGalleryHostCaching"]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class SharedGalleryProperties(_Model): + """Specifies the properties of a shared gallery. + + :ivar artifact_tags: The artifact tags of a shared gallery resource. + :vartype artifact_tags: dict[str, str] + """ + + artifact_tags: Optional[dict[str, str]] = rest_field(name="artifactTags", visibility=["read"]) + """The artifact tags of a shared gallery resource.""" + + +class ShareInfoElement(_Model): + """ShareInfoElement. + + :ivar vm_uri: A relative URI containing the ID of the VM that has the disk attached. + :vartype vm_uri: str + """ + + vm_uri: Optional[str] = rest_field(name="vmUri", visibility=["read"]) + """A relative URI containing the ID of the VM that has the disk attached.""" + + +class SharingProfile(_Model): + """Profile for gallery sharing to subscription or tenant. + + :ivar permissions: This property allows you to specify the permission of sharing gallery. + Possible values are: **Private,** **Groups,** **Community.**. Known values are: "Private", + "Groups", and "Community". + :vartype permissions: str or ~azure.mgmt.compute.models.GallerySharingPermissionTypes + :ivar groups: A list of sharing profile groups. + :vartype groups: list[~azure.mgmt.compute.models.SharingProfileGroup] + :ivar community_gallery_info: Information of community gallery if current gallery is shared to + community. + :vartype community_gallery_info: ~azure.mgmt.compute.models.CommunityGalleryInfo + """ + + permissions: Optional[Union[str, "_models.GallerySharingPermissionTypes"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """This property allows you to specify the permission of sharing gallery. Possible values are: + **Private,** **Groups,** **Community.**. Known values are: \"Private\", \"Groups\", and + \"Community\".""" + groups: Optional[list["_models.SharingProfileGroup"]] = rest_field(visibility=["read"]) + """A list of sharing profile groups.""" + community_gallery_info: Optional["_models.CommunityGalleryInfo"] = rest_field( + name="communityGalleryInfo", visibility=["read", "create", "update", "delete", "query"] + ) + """Information of community gallery if current gallery is shared to community.""" + + @overload + def __init__( + self, + *, + permissions: Optional[Union[str, "_models.GallerySharingPermissionTypes"]] = None, + community_gallery_info: Optional["_models.CommunityGalleryInfo"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class SharingProfileGroup(_Model): + """Group of the gallery sharing profile. + + :ivar type: This property allows you to specify the type of sharing group. Possible values are: + **Subscriptions,** **AADTenants.**. Known values are: "Subscriptions" and "AADTenants". + :vartype type: str or ~azure.mgmt.compute.models.SharingProfileGroupTypes + :ivar ids: A list of subscription/tenant ids the gallery is aimed to be shared to. + :vartype ids: list[str] + """ + + type: Optional[Union[str, "_models.SharingProfileGroupTypes"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """This property allows you to specify the type of sharing group. Possible values are: + **Subscriptions,** **AADTenants.**. Known values are: \"Subscriptions\" and \"AADTenants\".""" + ids: Optional[list[str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """A list of subscription/tenant ids the gallery is aimed to be shared to.""" + + @overload + def __init__( + self, + *, + type: Optional[Union[str, "_models.SharingProfileGroupTypes"]] = None, + ids: Optional[list[str]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class SharingStatus(_Model): + """Sharing status of current gallery. + + :ivar aggregated_state: Aggregated sharing state of current gallery. Known values are: + "Succeeded", "InProgress", "Failed", and "Unknown". + :vartype aggregated_state: str or ~azure.mgmt.compute.models.SharingState + :ivar summary: Summary of all regional sharing status. + :vartype summary: list[~azure.mgmt.compute.models.RegionalSharingStatus] + """ + + aggregated_state: Optional[Union[str, "_models.SharingState"]] = rest_field( + name="aggregatedState", visibility=["read"] + ) + """Aggregated sharing state of current gallery. Known values are: \"Succeeded\", \"InProgress\", + \"Failed\", and \"Unknown\".""" + summary: Optional[list["_models.RegionalSharingStatus"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Summary of all regional sharing status.""" + + @overload + def __init__( + self, + *, + summary: Optional[list["_models.RegionalSharingStatus"]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class SharingUpdate(_Model): + """Specifies information about the gallery sharing profile update. + + :ivar operation_type: This property allows you to specify the operation type of gallery sharing + update. Possible values are: **Add,** **Remove,** **Reset.**. Required. Known values are: + "Add", "Remove", "Reset", and "EnableCommunity". + :vartype operation_type: str or ~azure.mgmt.compute.models.SharingUpdateOperationTypes + :ivar groups: A list of sharing profile groups. + :vartype groups: list[~azure.mgmt.compute.models.SharingProfileGroup] + """ + + operation_type: Union[str, "_models.SharingUpdateOperationTypes"] = rest_field( + name="operationType", visibility=["read", "create", "update", "delete", "query"] + ) + """This property allows you to specify the operation type of gallery sharing update. Possible + values are: **Add,** **Remove,** **Reset.**. Required. Known values are: \"Add\", \"Remove\", + \"Reset\", and \"EnableCommunity\".""" + groups: Optional[list["_models.SharingProfileGroup"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """A list of sharing profile groups.""" + + @overload + def __init__( + self, + *, + operation_type: Union[str, "_models.SharingUpdateOperationTypes"], + groups: Optional[list["_models.SharingProfileGroup"]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class Sku(_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.

Possible + Values:

**Standard**

**Basic**. + :vartype tier: str + :ivar capacity: Specifies the number of virtual machines in the scale set. + :vartype capacity: int + """ + + name: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The sku name.""" + tier: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Specifies the tier of virtual machines in a scale set.

Possible Values:

+ **Standard**

**Basic**.""" + capacity: Optional[int] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Specifies the number of virtual machines in the scale set.""" + + @overload + def __init__( + self, + *, + name: Optional[str] = None, + tier: Optional[str] = None, + capacity: Optional[int] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class SkuProfile(_Model): + """Specifies the sku profile for the virtual machine scale set. With this property the customer is + able to specify a list of VM sizes and an allocation strategy. + + :ivar vm_sizes: Specifies the VM sizes for the virtual machine scale set. + :vartype vm_sizes: list[~azure.mgmt.compute.models.SkuProfileVMSize] + :ivar allocation_strategy: Specifies the allocation strategy for the virtual machine scale set + based on which the VMs will be allocated. Known values are: "LowestPrice", "CapacityOptimized", + and "Prioritized". + :vartype allocation_strategy: str or ~azure.mgmt.compute.models.AllocationStrategy + """ + + vm_sizes: Optional[list["_models.SkuProfileVMSize"]] = rest_field( + name="vmSizes", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies the VM sizes for the virtual machine scale set.""" + allocation_strategy: Optional[Union[str, "_models.AllocationStrategy"]] = rest_field( + name="allocationStrategy", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies the allocation strategy for the virtual machine scale set based on which the VMs will + be allocated. Known values are: \"LowestPrice\", \"CapacityOptimized\", and \"Prioritized\".""" + + @overload + def __init__( + self, + *, + vm_sizes: Optional[list["_models.SkuProfileVMSize"]] = None, + allocation_strategy: Optional[Union[str, "_models.AllocationStrategy"]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class SkuProfileVMSize(_Model): + """Specifies the VM Size. + + :ivar name: Specifies the name of the VM Size. + :vartype name: str + :ivar rank: Specifies the rank (a.k.a priority) associated with the VM Size. + :vartype rank: int + """ + + name: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Specifies the name of the VM Size.""" + rank: Optional[int] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Specifies the rank (a.k.a priority) associated with the VM Size.""" + + @overload + def __init__( + self, + *, + name: Optional[str] = None, + rank: Optional[int] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class Snapshot(TrackedResource): + """Snapshot resource. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.compute.models.SystemData + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar location: The geo-location where the resource lives. Required. + :vartype location: str + :ivar properties: Snapshot resource properties. + :vartype properties: ~azure.mgmt.compute.models.SnapshotProperties + :ivar managed_by: Unused. Always Null. + :vartype managed_by: str + :ivar sku: The snapshots sku name. Can be Standard_LRS, Premium_LRS, or Standard_ZRS. This is + an optional parameter for incremental snapshot and the default behavior is the SKU will be set + to the same sku as the previous snapshot. + :vartype sku: ~azure.mgmt.compute.models.SnapshotSku + :ivar extended_location: The extended location where the snapshot will be created. Extended + location cannot be changed. + :vartype extended_location: ~azure.mgmt.compute.models.ExtendedLocation + """ + + properties: Optional["_models.SnapshotProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Snapshot resource properties.""" + managed_by: Optional[str] = rest_field(name="managedBy", visibility=["read"]) + """Unused. Always Null.""" + sku: Optional["_models.SnapshotSku"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The snapshots sku name. Can be Standard_LRS, Premium_LRS, or Standard_ZRS. This is an optional + parameter for incremental snapshot and the default behavior is the SKU will be set to the same + sku as the previous snapshot.""" + extended_location: Optional["_models.ExtendedLocation"] = rest_field( + name="extendedLocation", visibility=["read", "create", "update", "delete", "query"] + ) + """The extended location where the snapshot will be created. Extended location cannot be changed.""" + + @overload + def __init__( + self, + *, + location: str, + tags: Optional[dict[str, str]] = None, + properties: Optional["_models.SnapshotProperties"] = None, + sku: Optional["_models.SnapshotSku"] = None, + extended_location: Optional["_models.ExtendedLocation"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class SnapshotProperties(_Model): + """Snapshot resource properties. + + :ivar time_created: The time when the snapshot was created. + :vartype time_created: ~datetime.datetime + :ivar os_type: The Operating System type. Known values are: "Windows" and "Linux". + :vartype os_type: str or ~azure.mgmt.compute.models.OperatingSystemTypes + :ivar hyper_v_generation: The hypervisor generation of the Virtual Machine. Applicable to OS + disks only. Known values are: "V1" and "V2". + :vartype hyper_v_generation: str or ~azure.mgmt.compute.models.HyperVGeneration + :ivar purchase_plan: Purchase plan information for the image from which the source disk for the + snapshot was originally created. + :vartype purchase_plan: ~azure.mgmt.compute.models.DiskPurchasePlan + :ivar supported_capabilities: List of supported capabilities for the image from which the + source disk from the snapshot was originally created. + :vartype supported_capabilities: ~azure.mgmt.compute.models.SupportedCapabilities + :ivar creation_data: Disk source information. CreationData information cannot be changed after + the disk has been created. Required. + :vartype creation_data: ~azure.mgmt.compute.models.CreationData + :ivar disk_size_gb: If creationData.createOption is Empty, this field is mandatory and it + indicates the size of the disk to create. If this field is present for updates or creation with + other options, it indicates a resize. Resizes are only allowed if the disk is not attached to a + running VM, and can only increase the disk's size. + :vartype disk_size_gb: int + :ivar disk_size_bytes: The size of the disk in bytes. This field is read only. + :vartype disk_size_bytes: int + :ivar disk_state: The state of the snapshot. Known values are: "Unattached", "Attached", + "Reserved", "Frozen", "ActiveSAS", "ActiveSASFrozen", "ReadyToUpload", and "ActiveUpload". + :vartype disk_state: str or ~azure.mgmt.compute.models.DiskState + :ivar unique_id: Unique Guid identifying the resource. + :vartype unique_id: str + :ivar encryption_settings_collection: Encryption settings collection used be Azure Disk + Encryption, can contain multiple encryption settings per disk or snapshot. + :vartype encryption_settings_collection: + ~azure.mgmt.compute.models.EncryptionSettingsCollection + :ivar provisioning_state: The disk provisioning state. + :vartype provisioning_state: str + :ivar incremental: Whether a snapshot is incremental. Incremental snapshots on the same disk + occupy less space than full snapshots and can be diffed. + :vartype incremental: bool + :ivar incremental_snapshot_family_id: Incremental snapshots for a disk share an incremental + snapshot family id. The Get Page Range Diff API can only be called on incremental snapshots + with the same family id. + :vartype incremental_snapshot_family_id: str + :ivar encryption: Encryption property can be used to encrypt data at rest with customer managed + keys or platform managed keys. + :vartype encryption: ~azure.mgmt.compute.models.Encryption + :ivar network_access_policy: Policy for accessing the disk via network. Known values are: + "AllowAll", "AllowPrivate", and "DenyAll". + :vartype network_access_policy: str or ~azure.mgmt.compute.models.NetworkAccessPolicy + :ivar disk_access_id: ARM id of the DiskAccess resource for using private endpoints on disks. + :vartype disk_access_id: str + :ivar security_profile: Contains the security related information for the resource. + :vartype security_profile: ~azure.mgmt.compute.models.DiskSecurityProfile + :ivar supports_hibernation: Indicates the OS on a snapshot supports hibernation. + :vartype supports_hibernation: bool + :ivar public_network_access: Policy for controlling export on the disk. Known values are: + "Enabled" and "Disabled". + :vartype public_network_access: str or ~azure.mgmt.compute.models.PublicNetworkAccess + :ivar completion_percent: Percentage complete for the background copy when a resource is + created via the CopyStart operation. + :vartype completion_percent: float + :ivar copy_completion_error: Indicates the error details if the background copy of a resource + created via the CopyStart operation fails. + :vartype copy_completion_error: ~azure.mgmt.compute.models.CopyCompletionError + :ivar data_access_auth_mode: Additional authentication requirements when exporting or uploading + to a disk or snapshot. Known values are: "AzureActiveDirectory" and "None". + :vartype data_access_auth_mode: str or ~azure.mgmt.compute.models.DataAccessAuthMode + :ivar snapshot_access_state: The state of snapshot which determines the access availability of + the snapshot. Known values are: "Unknown", "Pending", "Available", "InstantAccess", and + "AvailableWithInstantAccess". + :vartype snapshot_access_state: str or ~azure.mgmt.compute.models.SnapshotAccessState + """ + + time_created: Optional[datetime.datetime] = rest_field(name="timeCreated", visibility=["read"], format="rfc3339") + """The time when the snapshot was created.""" + os_type: Optional[Union[str, "_models.OperatingSystemTypes"]] = rest_field( + name="osType", visibility=["read", "create", "update", "delete", "query"] + ) + """The Operating System type. Known values are: \"Windows\" and \"Linux\".""" + hyper_v_generation: Optional[Union[str, "_models.HyperVGeneration"]] = rest_field( + name="hyperVGeneration", visibility=["read", "create", "update", "delete", "query"] + ) + """The hypervisor generation of the Virtual Machine. Applicable to OS disks only. Known values + are: \"V1\" and \"V2\".""" + purchase_plan: Optional["_models.DiskPurchasePlan"] = rest_field( + name="purchasePlan", visibility=["read", "create", "update", "delete", "query"] + ) + """Purchase plan information for the image from which the source disk for the snapshot was + originally created.""" + supported_capabilities: Optional["_models.SupportedCapabilities"] = rest_field( + name="supportedCapabilities", visibility=["read", "create", "update", "delete", "query"] + ) + """List of supported capabilities for the image from which the source disk from the snapshot was + originally created.""" + creation_data: "_models.CreationData" = rest_field( + name="creationData", visibility=["read", "create", "update", "delete", "query"] + ) + """Disk source information. CreationData information cannot be changed after the disk has been + created. Required.""" + disk_size_gb: Optional[int] = rest_field( + name="diskSizeGB", visibility=["read", "create", "update", "delete", "query"] + ) + """If creationData.createOption is Empty, this field is mandatory and it indicates the size of the + disk to create. If this field is present for updates or creation with other options, it + indicates a resize. Resizes are only allowed if the disk is not attached to a running VM, and + can only increase the disk's size.""" + disk_size_bytes: Optional[int] = rest_field(name="diskSizeBytes", visibility=["read"]) + """The size of the disk in bytes. This field is read only.""" + disk_state: Optional[Union[str, "_models.DiskState"]] = rest_field(name="diskState", visibility=["read"]) + """The state of the snapshot. Known values are: \"Unattached\", \"Attached\", \"Reserved\", + \"Frozen\", \"ActiveSAS\", \"ActiveSASFrozen\", \"ReadyToUpload\", and \"ActiveUpload\".""" + unique_id: Optional[str] = rest_field(name="uniqueId", visibility=["read"]) + """Unique Guid identifying the resource.""" + encryption_settings_collection: Optional["_models.EncryptionSettingsCollection"] = rest_field( + name="encryptionSettingsCollection", visibility=["read", "create", "update", "delete", "query"] + ) + """Encryption settings collection used be Azure Disk Encryption, can contain multiple encryption + settings per disk or snapshot.""" + provisioning_state: Optional[str] = rest_field(name="provisioningState", visibility=["read"]) + """The disk provisioning state.""" + incremental: Optional[bool] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Whether a snapshot is incremental. Incremental snapshots on the same disk occupy less space + than full snapshots and can be diffed.""" + incremental_snapshot_family_id: Optional[str] = rest_field(name="incrementalSnapshotFamilyId", visibility=["read"]) + """Incremental snapshots for a disk share an incremental snapshot family id. The Get Page Range + Diff API can only be called on incremental snapshots with the same family id.""" + encryption: Optional["_models.Encryption"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Encryption property can be used to encrypt data at rest with customer managed keys or platform + managed keys.""" + network_access_policy: Optional[Union[str, "_models.NetworkAccessPolicy"]] = rest_field( + name="networkAccessPolicy", visibility=["read", "create", "update", "delete", "query"] + ) + """Policy for accessing the disk via network. Known values are: \"AllowAll\", \"AllowPrivate\", + and \"DenyAll\".""" + disk_access_id: Optional[str] = rest_field( + name="diskAccessId", visibility=["read", "create", "update", "delete", "query"] + ) + """ARM id of the DiskAccess resource for using private endpoints on disks.""" + security_profile: Optional["_models.DiskSecurityProfile"] = rest_field( + name="securityProfile", visibility=["read", "create", "update", "delete", "query"] + ) + """Contains the security related information for the resource.""" + supports_hibernation: Optional[bool] = rest_field( + name="supportsHibernation", visibility=["read", "create", "update", "delete", "query"] + ) + """Indicates the OS on a snapshot supports hibernation.""" + public_network_access: Optional[Union[str, "_models.PublicNetworkAccess"]] = rest_field( + name="publicNetworkAccess", visibility=["read", "create", "update", "delete", "query"] + ) + """Policy for controlling export on the disk. Known values are: \"Enabled\" and \"Disabled\".""" + completion_percent: Optional[float] = rest_field( + name="completionPercent", visibility=["read", "create", "update", "delete", "query"] + ) + """Percentage complete for the background copy when a resource is created via the CopyStart + operation.""" + copy_completion_error: Optional["_models.CopyCompletionError"] = rest_field( + name="copyCompletionError", visibility=["read", "create", "update", "delete", "query"] + ) + """Indicates the error details if the background copy of a resource created via the CopyStart + operation fails.""" + data_access_auth_mode: Optional[Union[str, "_models.DataAccessAuthMode"]] = rest_field( + name="dataAccessAuthMode", visibility=["read", "create", "update", "delete", "query"] + ) + """Additional authentication requirements when exporting or uploading to a disk or snapshot. Known + values are: \"AzureActiveDirectory\" and \"None\".""" + snapshot_access_state: Optional[Union[str, "_models.SnapshotAccessState"]] = rest_field( + name="snapshotAccessState", visibility=["read"] + ) + """The state of snapshot which determines the access availability of the snapshot. Known values + are: \"Unknown\", \"Pending\", \"Available\", \"InstantAccess\", and + \"AvailableWithInstantAccess\".""" + + @overload + def __init__( # pylint: disable=too-many-locals + self, + *, + creation_data: "_models.CreationData", + os_type: Optional[Union[str, "_models.OperatingSystemTypes"]] = None, + hyper_v_generation: Optional[Union[str, "_models.HyperVGeneration"]] = None, + purchase_plan: Optional["_models.DiskPurchasePlan"] = None, + supported_capabilities: Optional["_models.SupportedCapabilities"] = None, + disk_size_gb: Optional[int] = None, + encryption_settings_collection: Optional["_models.EncryptionSettingsCollection"] = None, + incremental: Optional[bool] = None, + encryption: Optional["_models.Encryption"] = None, + network_access_policy: Optional[Union[str, "_models.NetworkAccessPolicy"]] = None, + disk_access_id: Optional[str] = None, + security_profile: Optional["_models.DiskSecurityProfile"] = None, + supports_hibernation: Optional[bool] = None, + public_network_access: Optional[Union[str, "_models.PublicNetworkAccess"]] = None, + completion_percent: Optional[float] = None, + copy_completion_error: Optional["_models.CopyCompletionError"] = None, + data_access_auth_mode: Optional[Union[str, "_models.DataAccessAuthMode"]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class SnapshotSku(_Model): + """The snapshots sku name. Can be Standard_LRS, Premium_LRS, or Standard_ZRS. This is an optional + parameter for incremental snapshot and the default behavior is the SKU will be set to the same + sku as the previous snapshot. + + :ivar name: The sku name. Known values are: "Standard_LRS", "Premium_LRS", and "Standard_ZRS". + :vartype name: str or ~azure.mgmt.compute.models.SnapshotStorageAccountTypes + :ivar tier: The sku tier. + :vartype tier: str + """ + + name: Optional[Union[str, "_models.SnapshotStorageAccountTypes"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The sku name. Known values are: \"Standard_LRS\", \"Premium_LRS\", and \"Standard_ZRS\".""" + tier: Optional[str] = rest_field(visibility=["read"]) + """The sku tier.""" + + @overload + def __init__( + self, + *, + name: Optional[Union[str, "_models.SnapshotStorageAccountTypes"]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class SnapshotUpdate(_Model): + """Snapshot update resource. + + :ivar properties: Snapshot resource update properties. + :vartype properties: ~azure.mgmt.compute.models.SnapshotUpdateProperties + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar sku: The snapshots sku name. Can be Standard_LRS, Premium_LRS, or Standard_ZRS. This is + an optional parameter for incremental snapshot and the default behavior is the SKU will be set + to the same sku as the previous snapshot. + :vartype sku: ~azure.mgmt.compute.models.SnapshotSku + """ + + properties: Optional["_models.SnapshotUpdateProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Snapshot resource update properties.""" + tags: Optional[dict[str, str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Resource tags.""" + sku: Optional["_models.SnapshotSku"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The snapshots sku name. Can be Standard_LRS, Premium_LRS, or Standard_ZRS. This is an optional + parameter for incremental snapshot and the default behavior is the SKU will be set to the same + sku as the previous snapshot.""" + + @overload + def __init__( + self, + *, + properties: Optional["_models.SnapshotUpdateProperties"] = None, + tags: Optional[dict[str, str]] = None, + sku: Optional["_models.SnapshotSku"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class SnapshotUpdateProperties(_Model): + """Snapshot resource update properties. + + :ivar os_type: the Operating System type. Known values are: "Windows" and "Linux". + :vartype os_type: str or ~azure.mgmt.compute.models.OperatingSystemTypes + :ivar disk_size_gb: If creationData.createOption is Empty, this field is mandatory and it + indicates the size of the disk to create. If this field is present for updates or creation with + other options, it indicates a resize. Resizes are only allowed if the disk is not attached to a + running VM, and can only increase the disk's size. + :vartype disk_size_gb: int + :ivar encryption_settings_collection: Encryption settings collection used be Azure Disk + Encryption, can contain multiple encryption settings per disk or snapshot. + :vartype encryption_settings_collection: + ~azure.mgmt.compute.models.EncryptionSettingsCollection + :ivar encryption: Encryption property can be used to encrypt data at rest with customer managed + keys or platform managed keys. + :vartype encryption: ~azure.mgmt.compute.models.Encryption + :ivar network_access_policy: Policy for accessing the disk via network. Known values are: + "AllowAll", "AllowPrivate", and "DenyAll". + :vartype network_access_policy: str or ~azure.mgmt.compute.models.NetworkAccessPolicy + :ivar disk_access_id: ARM id of the DiskAccess resource for using private endpoints on disks. + :vartype disk_access_id: str + :ivar supports_hibernation: Indicates the OS on a snapshot supports hibernation. + :vartype supports_hibernation: bool + :ivar public_network_access: Policy for controlling export on the disk. Known values are: + "Enabled" and "Disabled". + :vartype public_network_access: str or ~azure.mgmt.compute.models.PublicNetworkAccess + :ivar data_access_auth_mode: Additional authentication requirements when exporting or uploading + to a disk or snapshot. Known values are: "AzureActiveDirectory" and "None". + :vartype data_access_auth_mode: str or ~azure.mgmt.compute.models.DataAccessAuthMode + :ivar supported_capabilities: List of supported capabilities for the image from which the OS + disk was created. + :vartype supported_capabilities: ~azure.mgmt.compute.models.SupportedCapabilities + :ivar snapshot_access_state: The state of snapshot which determines the access availability of + the snapshot. Known values are: "Unknown", "Pending", "Available", "InstantAccess", and + "AvailableWithInstantAccess". + :vartype snapshot_access_state: str or ~azure.mgmt.compute.models.SnapshotAccessState + """ + + os_type: Optional[Union[str, "_models.OperatingSystemTypes"]] = rest_field( + name="osType", visibility=["read", "create", "update", "delete", "query"] + ) + """the Operating System type. Known values are: \"Windows\" and \"Linux\".""" + disk_size_gb: Optional[int] = rest_field( + name="diskSizeGB", visibility=["read", "create", "update", "delete", "query"] + ) + """If creationData.createOption is Empty, this field is mandatory and it indicates the size of the + disk to create. If this field is present for updates or creation with other options, it + indicates a resize. Resizes are only allowed if the disk is not attached to a running VM, and + can only increase the disk's size.""" + encryption_settings_collection: Optional["_models.EncryptionSettingsCollection"] = rest_field( + name="encryptionSettingsCollection", visibility=["read", "create", "update", "delete", "query"] + ) + """Encryption settings collection used be Azure Disk Encryption, can contain multiple encryption + settings per disk or snapshot.""" + encryption: Optional["_models.Encryption"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Encryption property can be used to encrypt data at rest with customer managed keys or platform + managed keys.""" + network_access_policy: Optional[Union[str, "_models.NetworkAccessPolicy"]] = rest_field( + name="networkAccessPolicy", visibility=["read", "create", "update", "delete", "query"] + ) + """Policy for accessing the disk via network. Known values are: \"AllowAll\", \"AllowPrivate\", + and \"DenyAll\".""" + disk_access_id: Optional[str] = rest_field( + name="diskAccessId", visibility=["read", "create", "update", "delete", "query"] + ) + """ARM id of the DiskAccess resource for using private endpoints on disks.""" + supports_hibernation: Optional[bool] = rest_field( + name="supportsHibernation", visibility=["read", "create", "update", "delete", "query"] + ) + """Indicates the OS on a snapshot supports hibernation.""" + public_network_access: Optional[Union[str, "_models.PublicNetworkAccess"]] = rest_field( + name="publicNetworkAccess", visibility=["read", "create", "update", "delete", "query"] + ) + """Policy for controlling export on the disk. Known values are: \"Enabled\" and \"Disabled\".""" + data_access_auth_mode: Optional[Union[str, "_models.DataAccessAuthMode"]] = rest_field( + name="dataAccessAuthMode", visibility=["read", "create", "update", "delete", "query"] + ) + """Additional authentication requirements when exporting or uploading to a disk or snapshot. Known + values are: \"AzureActiveDirectory\" and \"None\".""" + supported_capabilities: Optional["_models.SupportedCapabilities"] = rest_field( + name="supportedCapabilities", visibility=["read", "create", "update", "delete", "query"] + ) + """List of supported capabilities for the image from which the OS disk was created.""" + snapshot_access_state: Optional[Union[str, "_models.SnapshotAccessState"]] = rest_field( + name="snapshotAccessState", visibility=["read"] + ) + """The state of snapshot which determines the access availability of the snapshot. Known values + are: \"Unknown\", \"Pending\", \"Available\", \"InstantAccess\", and + \"AvailableWithInstantAccess\".""" + + @overload + def __init__( + self, + *, + os_type: Optional[Union[str, "_models.OperatingSystemTypes"]] = None, + disk_size_gb: Optional[int] = None, + encryption_settings_collection: Optional["_models.EncryptionSettingsCollection"] = None, + encryption: Optional["_models.Encryption"] = None, + network_access_policy: Optional[Union[str, "_models.NetworkAccessPolicy"]] = None, + disk_access_id: Optional[str] = None, + supports_hibernation: Optional[bool] = None, + public_network_access: Optional[Union[str, "_models.PublicNetworkAccess"]] = None, + data_access_auth_mode: Optional[Union[str, "_models.DataAccessAuthMode"]] = None, + supported_capabilities: Optional["_models.SupportedCapabilities"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class SoftDeletePolicy(_Model): + """Contains information about the soft deletion policy of the gallery. + + :ivar is_soft_delete_enabled: Enables soft-deletion for resources in this gallery, allowing + them to be recovered within retention time. + :vartype is_soft_delete_enabled: bool + """ + + is_soft_delete_enabled: Optional[bool] = rest_field( + name="isSoftDeleteEnabled", visibility=["read", "create", "update", "delete", "query"] + ) + """Enables soft-deletion for resources in this gallery, allowing them to be recovered within + retention time.""" + + @overload + def __init__( + self, + *, + is_soft_delete_enabled: Optional[bool] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class SourceVault(_Model): + """The vault id is an Azure Resource Manager Resource id in the form + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}. + + :ivar id: Resource Id. + :vartype id: str + """ + + id: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Resource Id.""" + + @overload + def __init__( + self, + *, + id: Optional[str] = None, # pylint: disable=redefined-builtin + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class SpotRestorePolicy(_Model): + """Specifies the Spot-Try-Restore properties for the virtual machine scale set. 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 + """ + + enabled: Optional[bool] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """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.""" + restore_timeout: Optional[str] = rest_field( + name="restoreTimeout", visibility=["read", "create", "update", "delete", "query"] + ) + """Timeout value expressed as an ISO 8601 time duration after which the platform will not try to + restore the VMSS SPOT instances.""" + + @overload + def __init__( + self, + *, + enabled: Optional[bool] = None, + restore_timeout: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class SshConfiguration(_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.models.SshPublicKey] + """ + + public_keys: Optional[list["_models.SshPublicKey"]] = rest_field( + name="publicKeys", visibility=["read", "create", "update", "delete", "query"] + ) + """The list of SSH public keys used to authenticate with linux based VMs.""" + + @overload + def __init__( + self, + *, + public_keys: Optional[list["_models.SshPublicKey"]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class SshGenerateKeyPairInputParameters(_Model): + """Parameters for GenerateSshKeyPair. + + :ivar encryption_type: The encryption type of the SSH keys to be generated. See + SshEncryptionTypes for possible set of values. If not provided, will default to RSA. Known + values are: "RSA" and "Ed25519". + :vartype encryption_type: str or ~azure.mgmt.compute.models.SshEncryptionTypes + """ + + encryption_type: Optional[Union[str, "_models.SshEncryptionTypes"]] = rest_field( + name="encryptionType", visibility=["read", "create", "update", "delete", "query"] + ) + """The encryption type of the SSH keys to be generated. See SshEncryptionTypes for possible set of + values. If not provided, will default to RSA. Known values are: \"RSA\" and \"Ed25519\".""" + + @overload + def __init__( + self, + *, + encryption_type: Optional[Union[str, "_models.SshEncryptionTypes"]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class SshPublicKey(_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. 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 + """ + + path: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """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.""" + key_data: Optional[str] = rest_field(name="keyData", visibility=["read", "create", "update", "delete", "query"]) + """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. 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 + `_).""" + + @overload + def __init__( + self, + *, + path: Optional[str] = None, + key_data: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class SshPublicKeyGenerateKeyPairResult(_Model): + """Response from generation of an SSH key pair. + + :ivar private_key: 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. Required. + :vartype private_key: str + :ivar public_key: Public key portion of the key pair used to authenticate to a virtual machine + through ssh. The public key is in ssh-rsa format. Required. + :vartype public_key: str + :ivar id: The ARM resource id in the form of + /subscriptions/{SubscriptionId}/resourceGroups/{ResourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{SshPublicKeyName}. + Required. + :vartype id: str + """ + + private_key: str = rest_field(name="privateKey", visibility=["read", "create", "update", "delete", "query"]) + """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. Required.""" + public_key: str = rest_field(name="publicKey", visibility=["read", "create", "update", "delete", "query"]) + """Public key portion of the key pair used to authenticate to a virtual machine through ssh. The + public key is in ssh-rsa format. Required.""" + id: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The ARM resource id in the form of + /subscriptions/{SubscriptionId}/resourceGroups/{ResourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{SshPublicKeyName}. + Required.""" + + @overload + def __init__( + self, + *, + private_key: str, + public_key: str, + id: str, # pylint: disable=redefined-builtin + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class SshPublicKeyResource(TrackedResource): + """Specifies information about the SSH public key. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.compute.models.SystemData + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar location: The geo-location where the resource lives. Required. + :vartype location: str + :ivar properties: Properties of the SSH public key. + :vartype properties: ~azure.mgmt.compute.models.SshPublicKeyResourceProperties + """ + + properties: Optional["_models.SshPublicKeyResourceProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Properties of the SSH public key.""" + + @overload + def __init__( + self, + *, + location: str, + tags: Optional[dict[str, str]] = None, + properties: Optional["_models.SshPublicKeyResourceProperties"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class SshPublicKeyResourceProperties(_Model): + """Properties of the SSH public key. + + :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 + """ + + public_key: Optional[str] = rest_field(name="publicKey", visibility=["read", "create", "update", "delete", "query"]) + """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.""" + + @overload + def __init__( + self, + *, + public_key: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class SshPublicKeyUpdateResource(UpdateResource): + """Specifies information about the SSH public key. + + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar properties: Properties of the SSH public key. + :vartype properties: ~azure.mgmt.compute.models.SshPublicKeyResourceProperties + """ + + properties: Optional["_models.SshPublicKeyResourceProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Properties of the SSH public key.""" + + @overload + def __init__( + self, + *, + tags: Optional[dict[str, str]] = None, + properties: Optional["_models.SshPublicKeyResourceProperties"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class StartParameterBody(_Model): + """StartParameterBody. + + :ivar vm_instance_i_ds: A list of virtual machine instance IDs from the VM scale set. + :vartype vm_instance_i_ds: ~azure.mgmt.compute.models.VirtualMachineScaleSetVMInstanceIDs + """ + + vm_instance_i_ds: Optional["_models.VirtualMachineScaleSetVMInstanceIDs"] = rest_field( + name="vmInstanceIDs", visibility=["read", "create", "update", "delete", "query"] + ) + """A list of virtual machine instance IDs from the VM scale set.""" + + @overload + def __init__( + self, + *, + vm_instance_i_ds: Optional["_models.VirtualMachineScaleSetVMInstanceIDs"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class StorageProfile(_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.models.ImageReference + :ivar os_disk: Specifies information about the operating system disk used by the virtual + machine. For more information about disks, see `About disks and VHDs for Azure virtual machines + `_. + :vartype os_disk: ~azure.mgmt.compute.models.OSDisk + :ivar data_disks: Specifies the parameters that are used to add a data disk to a virtual + machine. For more information about disks, see `About disks and VHDs for Azure virtual machines + `_. + :vartype data_disks: list[~azure.mgmt.compute.models.DataDisk] + :ivar disk_controller_type: Specifies the disk controller type configured for the VM. **Note:** + This property will be set to the default disk controller type if not specified provided virtual + machine is being created with 'hyperVGeneration' set to V2 based on the capabilities of the + operating system disk and VM size from the the specified minimum api version. You need to + deallocate the VM before updating its disk controller type unless you are updating the VM size + in the VM configuration which implicitly deallocates and reallocates the VM. Minimum + api-version: 2022-08-01. Known values are: "SCSI" and "NVMe". + :vartype disk_controller_type: str or ~azure.mgmt.compute.models.DiskControllerTypes + :ivar align_regional_disks_to_vm_zone: Specifies whether the regional disks should be + aligned/moved to the VM zone. This is applicable only for VMs with placement property set. + Please note that this change is irreversible. Minimum api-version: 2024-11-01. + :vartype align_regional_disks_to_vm_zone: bool + """ + + image_reference: Optional["_models.ImageReference"] = rest_field( + name="imageReference", visibility=["read", "create", "update", "delete", "query"] + ) + """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.""" + os_disk: Optional["_models.OSDisk"] = rest_field( + name="osDisk", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies information about the operating system disk used by the virtual machine. For more + information about disks, see `About disks and VHDs for Azure virtual machines + `_.""" + data_disks: Optional[list["_models.DataDisk"]] = rest_field( + name="dataDisks", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies the parameters that are used to add a data disk to a virtual machine. For more + information about disks, see `About disks and VHDs for Azure virtual machines + `_.""" + disk_controller_type: Optional[Union[str, "_models.DiskControllerTypes"]] = rest_field( + name="diskControllerType", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies the disk controller type configured for the VM. **Note:** This property will be set + to the default disk controller type if not specified provided virtual machine is being created + with 'hyperVGeneration' set to V2 based on the capabilities of the operating system disk and VM + size from the the specified minimum api version. You need to deallocate the VM before updating + its disk controller type unless you are updating the VM size in the VM configuration which + implicitly deallocates and reallocates the VM. Minimum api-version: 2022-08-01. Known values + are: \"SCSI\" and \"NVMe\".""" + align_regional_disks_to_vm_zone: Optional[bool] = rest_field( + name="alignRegionalDisksToVMZone", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies whether the regional disks should be aligned/moved to the VM zone. This is applicable + only for VMs with placement property set. Please note that this change is irreversible. Minimum + api-version: 2024-11-01.""" + + @overload + def __init__( + self, + *, + image_reference: Optional["_models.ImageReference"] = None, + os_disk: Optional["_models.OSDisk"] = None, + data_disks: Optional[list["_models.DataDisk"]] = None, + disk_controller_type: Optional[Union[str, "_models.DiskControllerTypes"]] = None, + align_regional_disks_to_vm_zone: Optional[bool] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +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.models.InstanceViewStatus + """ + + colocation_status: Optional["_models.InstanceViewStatus"] = rest_field( + name="colocationStatus", visibility=["read", "create", "update", "delete", "query"] + ) + """Describes colocation status of a resource in the Proximity Placement Group.""" + + @overload + def __init__( + self, + *, + id: Optional[str] = None, # pylint: disable=redefined-builtin + colocation_status: Optional["_models.InstanceViewStatus"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class SupportedCapabilities(_Model): + """List of supported capabilities persisted on the disk resource for VM use. + + :ivar disk_controller_types: The disk controllers that an OS disk supports. If set it can be + SCSI or SCSI, NVME or NVME, SCSI. + :vartype disk_controller_types: str + :ivar accelerated_network: True if the image from which the OS disk is created supports + accelerated networking. + :vartype accelerated_network: bool + :ivar architecture: CPU architecture supported by an OS disk. Known values are: "x64" and + "Arm64". + :vartype architecture: str or ~azure.mgmt.compute.models.Architecture + :ivar supported_security_option: Refers to the security capability of the disk supported to + create a Trusted launch or Confidential VM. Known values are: "TrustedLaunchSupported" and + "TrustedLaunchAndConfidentialVMSupported". + :vartype supported_security_option: str or ~azure.mgmt.compute.models.SupportedSecurityOption + """ + + disk_controller_types: Optional[str] = rest_field( + name="diskControllerTypes", visibility=["read", "create", "update", "delete", "query"] + ) + """The disk controllers that an OS disk supports. If set it can be SCSI or SCSI, NVME or NVME, + SCSI.""" + accelerated_network: Optional[bool] = rest_field( + name="acceleratedNetwork", visibility=["read", "create", "update", "delete", "query"] + ) + """True if the image from which the OS disk is created supports accelerated networking.""" + architecture: Optional[Union[str, "_models.Architecture"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """CPU architecture supported by an OS disk. Known values are: \"x64\" and \"Arm64\".""" + supported_security_option: Optional[Union[str, "_models.SupportedSecurityOption"]] = rest_field( + name="supportedSecurityOption", visibility=["read", "create", "update", "delete", "query"] + ) + """Refers to the security capability of the disk supported to create a Trusted launch or + Confidential VM. Known values are: \"TrustedLaunchSupported\" and + \"TrustedLaunchAndConfidentialVMSupported\".""" + + @overload + def __init__( + self, + *, + disk_controller_types: Optional[str] = None, + accelerated_network: Optional[bool] = None, + architecture: Optional[Union[str, "_models.Architecture"]] = None, + supported_security_option: Optional[Union[str, "_models.SupportedSecurityOption"]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class SystemData(_Model): + """Metadata pertaining to creation and last modification of the resource. + + :ivar created_by: The identity that created the resource. + :vartype created_by: str + :ivar created_by_type: The type of identity that created the resource. Known values are: + "User", "Application", "ManagedIdentity", and "Key". + :vartype created_by_type: str or ~azure.mgmt.compute.models.CreatedByType + :ivar created_at: The timestamp of resource creation (UTC). + :vartype created_at: ~datetime.datetime + :ivar last_modified_by: The identity that last modified the resource. + :vartype last_modified_by: str + :ivar last_modified_by_type: The type of identity that last modified the resource. Known values + are: "User", "Application", "ManagedIdentity", and "Key". + :vartype last_modified_by_type: str or ~azure.mgmt.compute.models.CreatedByType + :ivar last_modified_at: The timestamp of resource last modification (UTC). + :vartype last_modified_at: ~datetime.datetime + """ + + created_by: Optional[str] = rest_field(name="createdBy", visibility=["read", "create", "update", "delete", "query"]) + """The identity that created the resource.""" + created_by_type: Optional[Union[str, "_models.CreatedByType"]] = rest_field( + name="createdByType", visibility=["read", "create", "update", "delete", "query"] + ) + """The type of identity that created the resource. Known values are: \"User\", \"Application\", + \"ManagedIdentity\", and \"Key\".""" + created_at: Optional[datetime.datetime] = rest_field( + name="createdAt", visibility=["read", "create", "update", "delete", "query"], format="rfc3339" + ) + """The timestamp of resource creation (UTC).""" + last_modified_by: Optional[str] = rest_field( + name="lastModifiedBy", visibility=["read", "create", "update", "delete", "query"] + ) + """The identity that last modified the resource.""" + last_modified_by_type: Optional[Union[str, "_models.CreatedByType"]] = rest_field( + name="lastModifiedByType", visibility=["read", "create", "update", "delete", "query"] + ) + """The type of identity that last modified the resource. Known values are: \"User\", + \"Application\", \"ManagedIdentity\", and \"Key\".""" + last_modified_at: Optional[datetime.datetime] = rest_field( + name="lastModifiedAt", visibility=["read", "create", "update", "delete", "query"], format="rfc3339" + ) + """The timestamp of resource last modification (UTC).""" + + @overload + def __init__( + self, + *, + created_by: Optional[str] = None, + created_by_type: Optional[Union[str, "_models.CreatedByType"]] = None, + created_at: Optional[datetime.datetime] = None, + last_modified_by: Optional[str] = None, + last_modified_by_type: Optional[Union[str, "_models.CreatedByType"]] = None, + last_modified_at: Optional[datetime.datetime] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class TargetRegion(_Model): + """Describes the target region information. + + :ivar name: The name of the region. Required. + :vartype name: str + :ivar regional_replica_count: The number of replicas of the Image Version to be created per + region. This property is updatable. + :vartype regional_replica_count: int + :ivar storage_account_type: Specifies the storage account type to be used to store the image. + This property is not updatable. Known values are: "Standard_LRS", "Standard_ZRS", + "Premium_LRS", and "PremiumV2_LRS". + :vartype storage_account_type: str or ~azure.mgmt.compute.models.StorageAccountType + :ivar encryption: Optional. Allows users to provide customer managed keys for encrypting the OS + and data disks in the gallery artifact. + :vartype encryption: ~azure.mgmt.compute.models.EncryptionImages + :ivar exclude_from_latest: Contains the flag setting to hide an image when users specify + version='latest'. + :vartype exclude_from_latest: bool + :ivar additional_replica_sets: List of storage sku with replica count to create direct drive + replicas. + :vartype additional_replica_sets: list[~azure.mgmt.compute.models.AdditionalReplicaSet] + """ + + name: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The name of the region. Required.""" + regional_replica_count: Optional[int] = rest_field( + name="regionalReplicaCount", visibility=["read", "create", "update", "delete", "query"] + ) + """The number of replicas of the Image Version to be created per region. This property is + updatable.""" + storage_account_type: Optional[Union[str, "_models.StorageAccountType"]] = rest_field( + name="storageAccountType", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies the storage account type to be used to store the image. This property is not + updatable. Known values are: \"Standard_LRS\", \"Standard_ZRS\", \"Premium_LRS\", and + \"PremiumV2_LRS\".""" + encryption: Optional["_models.EncryptionImages"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Optional. Allows users to provide customer managed keys for encrypting the OS and data disks in + the gallery artifact.""" + exclude_from_latest: Optional[bool] = rest_field( + name="excludeFromLatest", visibility=["read", "create", "update", "delete", "query"] + ) + """Contains the flag setting to hide an image when users specify version='latest'.""" + additional_replica_sets: Optional[list["_models.AdditionalReplicaSet"]] = rest_field( + name="additionalReplicaSets", visibility=["read", "create", "update", "delete", "query"] + ) + """List of storage sku with replica count to create direct drive replicas.""" + + @overload + def __init__( + self, + *, + name: str, + regional_replica_count: Optional[int] = None, + storage_account_type: Optional[Union[str, "_models.StorageAccountType"]] = None, + encryption: Optional["_models.EncryptionImages"] = None, + exclude_from_latest: Optional[bool] = None, + additional_replica_sets: Optional[list["_models.AdditionalReplicaSet"]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class TerminateNotificationProfile(_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 + """ + + not_before_timeout: Optional[str] = rest_field( + name="notBeforeTimeout", visibility=["read", "create", "update", "delete", "query"] + ) + """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).""" + enable: Optional[bool] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Specifies whether the Terminate Scheduled event is enabled or disabled.""" + + @overload + def __init__( + self, + *, + not_before_timeout: Optional[str] = None, + enable: Optional[bool] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ThrottledRequestsInput(LogAnalyticsInputBase): + """Api request input for LogAnalytics getThrottledRequests Api. + + :ivar blob_container_sas_uri: SAS Uri of the logging blob container to which LogAnalytics Api + writes output logs to. Required. + :vartype blob_container_sas_uri: str + :ivar from_time: From time of the query. Required. + :vartype from_time: ~datetime.datetime + :ivar to_time: To time of the query. Required. + :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 + """ + + @overload + 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, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class UefiKey(_Model): + """A UEFI key signature. + + :ivar type: The type of key signature. Known values are: "sha256" and "x509". + :vartype type: str or ~azure.mgmt.compute.models.UefiKeyType + :ivar value: The value of the key signature. + :vartype value: list[str] + """ + + type: Optional[Union[str, "_models.UefiKeyType"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The type of key signature. Known values are: \"sha256\" and \"x509\".""" + value: Optional[list[str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The value of the key signature.""" + + @overload + def __init__( + self, + *, + type: Optional[Union[str, "_models.UefiKeyType"]] = None, + value: Optional[list[str]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class UefiKeySignatures(_Model): + """Additional UEFI key signatures that will be added to the image in addition to the signature + templates. + + :ivar pk: The Platform Key of this image version. + :vartype pk: ~azure.mgmt.compute.models.UefiKey + :ivar kek: The Key Encryption Keys of this image version. + :vartype kek: list[~azure.mgmt.compute.models.UefiKey] + :ivar db: The database of UEFI keys for this image version. + :vartype db: list[~azure.mgmt.compute.models.UefiKey] + :ivar dbx: The database of revoked UEFI keys for this image version. + :vartype dbx: list[~azure.mgmt.compute.models.UefiKey] + """ + + pk: Optional["_models.UefiKey"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The Platform Key of this image version.""" + kek: Optional[list["_models.UefiKey"]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The Key Encryption Keys of this image version.""" + db: Optional[list["_models.UefiKey"]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The database of UEFI keys for this image version.""" + dbx: Optional[list["_models.UefiKey"]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The database of revoked UEFI keys for this image version.""" + + @overload + def __init__( + self, + *, + pk: Optional["_models.UefiKey"] = None, + kek: Optional[list["_models.UefiKey"]] = None, + db: Optional[list["_models.UefiKey"]] = None, + dbx: Optional[list["_models.UefiKey"]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class UefiSettings(_Model): + """Specifies the security settings like secure boot and vTPM used while creating the virtual + machine. Minimum api-version: 2020-12-01. + + :ivar secure_boot_enabled: Specifies whether secure boot should be enabled on the virtual + machine. 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. Minimum + api-version: 2020-12-01. + :vartype v_tpm_enabled: bool + """ + + secure_boot_enabled: Optional[bool] = rest_field( + name="secureBootEnabled", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies whether secure boot should be enabled on the virtual machine. Minimum api-version: + 2020-12-01.""" + v_tpm_enabled: Optional[bool] = rest_field( + name="vTpmEnabled", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies whether vTPM should be enabled on the virtual machine. Minimum api-version: + 2020-12-01.""" + + @overload + def __init__( + self, + *, + secure_boot_enabled: Optional[bool] = None, + v_tpm_enabled: Optional[bool] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class UpgradeOperationHistoricalStatusInfo(_Model): + """Virtual Machine Scale Set OS Upgrade History operation response. + + :ivar properties: Information about the properties of the upgrade operation. + :vartype properties: ~azure.mgmt.compute.models.UpgradeOperationHistoricalStatusInfoProperties + :ivar type: Resource type. + :vartype type: str + :ivar location: Resource location. + :vartype location: str + """ + + properties: Optional["_models.UpgradeOperationHistoricalStatusInfoProperties"] = rest_field(visibility=["read"]) + """Information about the properties of the upgrade operation.""" + type: Optional[str] = rest_field(visibility=["read"]) + """Resource type.""" + location: Optional[str] = rest_field(visibility=["read"]) + """Resource location.""" + + +class UpgradeOperationHistoricalStatusInfoProperties(_Model): # pylint: disable=name-too-long + """Describes each OS upgrade on the Virtual Machine Scale Set. + + :ivar running_status: Information about the overall status of the upgrade operation. + :vartype running_status: ~azure.mgmt.compute.models.UpgradeOperationHistoryStatus + :ivar progress: Counts of the VMs in each state. + :vartype progress: ~azure.mgmt.compute.models.RollingUpgradeProgressInfo + :ivar error: Error Details for this upgrade if there are any. + :vartype error: ~azure.mgmt.compute.models.ApiError + :ivar started_by: Invoker of the Upgrade Operation. Known values are: "Unknown", "User", and + "Platform". + :vartype started_by: str or ~azure.mgmt.compute.models.UpgradeOperationInvoker + :ivar target_image_reference: Image Reference details. + :vartype target_image_reference: ~azure.mgmt.compute.models.ImageReference + :ivar rollback_info: Information about OS rollback if performed. + :vartype rollback_info: ~azure.mgmt.compute.models.RollbackStatusInfo + """ + + running_status: Optional["_models.UpgradeOperationHistoryStatus"] = rest_field( + name="runningStatus", visibility=["read"] + ) + """Information about the overall status of the upgrade operation.""" + progress: Optional["_models.RollingUpgradeProgressInfo"] = rest_field(visibility=["read"]) + """Counts of the VMs in each state.""" + error: Optional["_models.ApiError"] = rest_field(visibility=["read"]) + """Error Details for this upgrade if there are any.""" + started_by: Optional[Union[str, "_models.UpgradeOperationInvoker"]] = rest_field( + name="startedBy", visibility=["read"] + ) + """Invoker of the Upgrade Operation. Known values are: \"Unknown\", \"User\", and \"Platform\".""" + target_image_reference: Optional["_models.ImageReference"] = rest_field( + name="targetImageReference", visibility=["read"] + ) + """Image Reference details.""" + rollback_info: Optional["_models.RollbackStatusInfo"] = rest_field(name="rollbackInfo", visibility=["read"]) + """Information about OS rollback if performed.""" + + +class UpgradeOperationHistoryStatus(_Model): + """Information about the current running state of the overall upgrade. + + :ivar code: Code indicating the current status of the upgrade. Known values are: + "RollingForward", "Cancelled", "Completed", and "Faulted". + :vartype code: str or ~azure.mgmt.compute.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 + """ + + code: Optional[Union[str, "_models.UpgradeState"]] = rest_field(visibility=["read"]) + """Code indicating the current status of the upgrade. Known values are: \"RollingForward\", + \"Cancelled\", \"Completed\", and \"Faulted\".""" + start_time: Optional[datetime.datetime] = rest_field(name="startTime", visibility=["read"], format="rfc3339") + """Start time of the upgrade.""" + end_time: Optional[datetime.datetime] = rest_field(name="endTime", visibility=["read"], format="rfc3339") + """End time of the upgrade.""" + + +class UpgradePolicy(_Model): + """Describes an upgrade policy - automatic, manual, or rolling. + + :ivar mode: Specifies the mode of an upgrade to virtual machines in the scale set.

+ Possible values are:

**Manual** - You control the application of updates to + virtual machines in the scale set. You do this by using the manualUpgrade action.

+ **Automatic** - All virtual machines in the scale set are automatically updated at the same + time. Known values are: "Automatic", "Manual", and "Rolling". + :vartype mode: str or ~azure.mgmt.compute.models.UpgradeMode + :ivar rolling_upgrade_policy: The configuration parameters used while performing a rolling + upgrade. + :vartype rolling_upgrade_policy: ~azure.mgmt.compute.models.RollingUpgradePolicy + :ivar automatic_os_upgrade_policy: Configuration parameters used for performing automatic OS + Upgrade. + :vartype automatic_os_upgrade_policy: ~azure.mgmt.compute.models.AutomaticOSUpgradePolicy + """ + + mode: Optional[Union[str, "_models.UpgradeMode"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies the mode of an upgrade to virtual machines in the scale set.

Possible + values are:

**Manual** - You control the application of updates to virtual + machines in the scale set. You do this by using the manualUpgrade action.

+ **Automatic** - All virtual machines in the scale set are automatically updated at the same + time. Known values are: \"Automatic\", \"Manual\", and \"Rolling\".""" + rolling_upgrade_policy: Optional["_models.RollingUpgradePolicy"] = rest_field( + name="rollingUpgradePolicy", visibility=["read", "create", "update", "delete", "query"] + ) + """The configuration parameters used while performing a rolling upgrade.""" + automatic_os_upgrade_policy: Optional["_models.AutomaticOSUpgradePolicy"] = rest_field( + name="automaticOSUpgradePolicy", visibility=["read", "create", "update", "delete", "query"] + ) + """Configuration parameters used for performing automatic OS Upgrade.""" + + @overload + def __init__( + self, + *, + mode: Optional[Union[str, "_models.UpgradeMode"]] = None, + rolling_upgrade_policy: Optional["_models.RollingUpgradePolicy"] = None, + automatic_os_upgrade_policy: Optional["_models.AutomaticOSUpgradePolicy"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class Usage(_Model): + """Describes Compute Resource Usage. + + :ivar unit: An enum describing the unit of usage measurement. Required. Default value is + "Count". + :vartype unit: str + :ivar current_value: The current usage of the resource. Required. + :vartype current_value: int + :ivar limit: The maximum permitted usage of the resource. Required. + :vartype limit: int + :ivar name: The name of the type of usage. Required. + :vartype name: ~azure.mgmt.compute.models.UsageName + """ + + unit: Literal["Count"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """An enum describing the unit of usage measurement. Required. Default value is \"Count\".""" + current_value: int = rest_field(name="currentValue", visibility=["read", "create", "update", "delete", "query"]) + """The current usage of the resource. Required.""" + limit: int = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The maximum permitted usage of the resource. Required.""" + name: "_models.UsageName" = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The name of the type of usage. Required.""" + + @overload + def __init__( + self, + *, + current_value: int, + limit: int, + name: "_models.UsageName", + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + self.unit: Literal["Count"] = "Count" + + +class UsageName(_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 + """ + + value: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The name of the resource.""" + localized_value: Optional[str] = rest_field( + name="localizedValue", visibility=["read", "create", "update", "delete", "query"] + ) + """The localized name of the resource.""" + + @overload + def __init__( + self, + *, + value: Optional[str] = None, + localized_value: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class UserArtifactManage(_Model): + """UserArtifactManage. + + :ivar install: Required. The path and arguments to install the gallery application. This is + limited to 4096 characters. Required. + :vartype install: str + :ivar remove: Required. The path and arguments to remove the gallery application. This is + limited to 4096 characters. Required. + :vartype remove: str + :ivar update_property: Optional. The path and arguments to update the gallery application. If + not present, then update operation will invoke remove command on the previous version and + install command on the current version of the gallery application. This is limited to 4096 + characters. + :vartype update_property: str + """ + + install: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Required. The path and arguments to install the gallery application. This is limited to 4096 + characters. Required.""" + remove: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Required. The path and arguments to remove the gallery application. This is limited to 4096 + characters. Required.""" + update_property: Optional[str] = rest_field( + name="update", visibility=["read", "create", "update", "delete", "query"] + ) + """Optional. The path and arguments to update the gallery application. If not present, then update + operation will invoke remove command on the previous version and install command on the current + version of the gallery application. This is limited to 4096 characters.""" + + @overload + def __init__( + self, + *, + install: str, + remove: str, + update_property: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class UserArtifactSettings(_Model): + """Additional settings for the VM app that contains the target package and config file name when + it is deployed to target VM or VM scale set. + + :ivar package_file_name: Optional. The name to assign the downloaded package file on the VM. + This is limited to 4096 characters. If not specified, the package file will be named the same + as the Gallery Application name. + :vartype package_file_name: str + :ivar config_file_name: Optional. The name to assign the downloaded config file on the VM. This + is limited to 4096 characters. If not specified, the config file will be named the Gallery + Application name appended with "_config". + :vartype config_file_name: str + :ivar script_behavior_after_reboot: Optional. The action to be taken with regards to + install/update/remove of the gallery application in the event of a reboot. Known values are: + "None" and "Rerun". + :vartype script_behavior_after_reboot: str or + ~azure.mgmt.compute.models.GalleryApplicationScriptRebootBehavior + """ + + package_file_name: Optional[str] = rest_field( + name="packageFileName", visibility=["read", "create", "update", "delete", "query"] + ) + """Optional. The name to assign the downloaded package file on the VM. This is limited to 4096 + characters. If not specified, the package file will be named the same as the Gallery + Application name.""" + config_file_name: Optional[str] = rest_field( + name="configFileName", visibility=["read", "create", "update", "delete", "query"] + ) + """Optional. The name to assign the downloaded config file on the VM. This is limited to 4096 + characters. If not specified, the config file will be named the Gallery Application name + appended with \"_config\".""" + script_behavior_after_reboot: Optional[Union[str, "_models.GalleryApplicationScriptRebootBehavior"]] = rest_field( + name="scriptBehaviorAfterReboot", visibility=["read", "create", "update", "delete", "query"] + ) + """Optional. The action to be taken with regards to install/update/remove of the gallery + application in the event of a reboot. Known values are: \"None\" and \"Rerun\".""" + + @overload + def __init__( + self, + *, + package_file_name: Optional[str] = None, + config_file_name: Optional[str] = None, + script_behavior_after_reboot: Optional[Union[str, "_models.GalleryApplicationScriptRebootBehavior"]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class UserArtifactSource(_Model): + """The source image from which the Image Version is going to be created. + + :ivar media_link: Required. The mediaLink of the artifact, must be a readable storage page + blob. Required. + :vartype media_link: str + :ivar default_configuration_link: Optional. The defaultConfigurationLink of the artifact, must + be a readable storage page blob. + :vartype default_configuration_link: str + """ + + media_link: str = rest_field(name="mediaLink", visibility=["read", "create", "update", "delete", "query"]) + """Required. The mediaLink of the artifact, must be a readable storage page blob. Required.""" + default_configuration_link: Optional[str] = rest_field( + name="defaultConfigurationLink", visibility=["read", "create", "update", "delete", "query"] + ) + """Optional. The defaultConfigurationLink of the artifact, must be a readable storage page blob.""" + + @overload + def __init__( + self, + *, + media_link: str, + default_configuration_link: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class UserAssignedIdentitiesValue(_Model): + """UserAssignedIdentitiesValue. + + :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 + """ + + principal_id: Optional[str] = rest_field(name="principalId", visibility=["read"]) + """The principal id of user assigned identity.""" + client_id: Optional[str] = rest_field(name="clientId", visibility=["read"]) + """The client id of user assigned identity.""" + + +class UserInitiatedReboot(_Model): + """Specifies Reboot related Scheduled Event related configurations. + + :ivar automatically_approve: Specifies Reboot Scheduled Event related configurations. + :vartype automatically_approve: bool + """ + + automatically_approve: Optional[bool] = rest_field( + name="automaticallyApprove", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies Reboot Scheduled Event related configurations.""" + + @overload + def __init__( + self, + *, + automatically_approve: Optional[bool] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class UserInitiatedRedeploy(_Model): + """Specifies Redeploy related Scheduled Event related configurations. + + :ivar automatically_approve: Specifies Redeploy Scheduled Event related configurations. + :vartype automatically_approve: bool + """ + + automatically_approve: Optional[bool] = rest_field( + name="automaticallyApprove", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies Redeploy Scheduled Event related configurations.""" + + @overload + def __init__( + self, + *, + automatically_approve: Optional[bool] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ValidationsProfile(_Model): + """This is the validations profile of a Gallery Image Version. + + :ivar validation_etag: The published time of the image version. + :vartype validation_etag: str + :ivar executed_validations: + :vartype executed_validations: list[~azure.mgmt.compute.models.ExecutedValidation] + :ivar platform_attributes: This specifies the pub, offer, sku and version of the image version + metadata. + :vartype platform_attributes: list[~azure.mgmt.compute.models.PlatformAttribute] + """ + + validation_etag: Optional[str] = rest_field( + name="validationEtag", visibility=["read", "create", "update", "delete", "query"] + ) + """The published time of the image version.""" + executed_validations: Optional[list["_models.ExecutedValidation"]] = rest_field( + name="executedValidations", visibility=["read", "create", "update", "delete", "query"] + ) + platform_attributes: Optional[list["_models.PlatformAttribute"]] = rest_field( + name="platformAttributes", visibility=["read", "create", "update", "delete", "query"] + ) + """This specifies the pub, offer, sku and version of the image version metadata.""" + + @overload + def __init__( + self, + *, + validation_etag: Optional[str] = None, + executed_validations: Optional[list["_models.ExecutedValidation"]] = None, + platform_attributes: Optional[list["_models.PlatformAttribute"]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class VaultCertificate(_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:

{
"data":"",
"dataType":"pfx",
+ "password":""
}
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. 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 + """ + + certificate_url: Optional[str] = rest_field( + name="certificateUrl", visibility=["read", "create", "update", "delete", "query"] + ) + """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:

{
\"data\":\"\",
+ \"dataType\":\"pfx\",
\"password\":\"\"
}
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 + `_.""" + certificate_store: Optional[str] = rest_field( + name="certificateStore", visibility=["read", "create", "update", "delete", "query"] + ) + """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. 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.""" + + @overload + def __init__( + self, + *, + certificate_url: Optional[str] = None, + certificate_store: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class VaultSecretGroup(_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.models.SubResource + :ivar vault_certificates: The list of key vault references in SourceVault which contain + certificates. + :vartype vault_certificates: list[~azure.mgmt.compute.models.VaultCertificate] + """ + + source_vault: Optional["_models.SubResource"] = rest_field( + name="sourceVault", visibility=["read", "create", "update", "delete", "query"] + ) + """The relative URL of the Key Vault containing all of the certificates in VaultCertificates.""" + vault_certificates: Optional[list["_models.VaultCertificate"]] = rest_field( + name="vaultCertificates", visibility=["read", "create", "update", "delete", "query"] + ) + """The list of key vault references in SourceVault which contain certificates.""" + + @overload + def __init__( + self, + *, + source_vault: Optional["_models.SubResource"] = None, + vault_certificates: Optional[list["_models.VaultCertificate"]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class VirtualHardDisk(_Model): + """Describes the uri of a disk. + + :ivar uri: Specifies the virtual hard disk's uri. + :vartype uri: str + """ + + uri: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Specifies the virtual hard disk's uri.""" + + @overload + def __init__( + self, + *, + uri: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class VirtualMachine(TrackedResource): + """Describes a Virtual Machine. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.compute.models.SystemData + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar location: The geo-location where the resource lives. Required. + :vartype location: str + :ivar properties: Describes the properties of a Virtual Machine. + :vartype properties: ~azure.mgmt.compute.models.VirtualMachineProperties + :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.models.Plan + :ivar resources: The virtual machine child extension resources. + :vartype resources: list[~azure.mgmt.compute.models.VirtualMachineExtension] + :ivar identity: The identity of the virtual machine, if configured. + :vartype identity: ~azure.mgmt.compute.models.VirtualMachineIdentity + :ivar zones: The availability zones. + :vartype zones: list[str] + :ivar extended_location: The extended location of the Virtual Machine. + :vartype extended_location: ~azure.mgmt.compute.models.ExtendedLocation + :ivar managed_by: ManagedBy is set to Virtual Machine Scale Set(VMSS) flex ARM resourceID, if + the VM is part of the VMSS. This property is used by platform for internal resource group + delete optimization. + :vartype managed_by: str + :ivar etag: Etag is property returned in Create/Update/Get response of the VM, so that customer + can supply it in the header to ensure optimistic updates. + :vartype etag: str + :ivar placement: Placement section specifies the user-defined constraints for virtual machine + hardware placement. This property cannot be changed once VM is provisioned. Minimum + api-version: 2024-11-01. + :vartype placement: ~azure.mgmt.compute.models.Placement + """ + + properties: Optional["_models.VirtualMachineProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Describes the properties of a Virtual Machine.""" + plan: Optional["_models.Plan"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """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**.""" + resources: Optional[list["_models.VirtualMachineExtension"]] = rest_field(visibility=["read"]) + """The virtual machine child extension resources.""" + identity: Optional["_models.VirtualMachineIdentity"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The identity of the virtual machine, if configured.""" + zones: Optional[list[str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The availability zones.""" + extended_location: Optional["_models.ExtendedLocation"] = rest_field( + name="extendedLocation", visibility=["read", "create", "update", "delete", "query"] + ) + """The extended location of the Virtual Machine.""" + managed_by: Optional[str] = rest_field(name="managedBy", visibility=["read"]) + """ManagedBy is set to Virtual Machine Scale Set(VMSS) flex ARM resourceID, if the VM is part of + the VMSS. This property is used by platform for internal resource group delete optimization.""" + etag: Optional[str] = rest_field(visibility=["read"]) + """Etag is property returned in Create/Update/Get response of the VM, so that customer can supply + it in the header to ensure optimistic updates.""" + placement: Optional["_models.Placement"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Placement section specifies the user-defined constraints for virtual machine hardware + placement. This property cannot be changed once VM is provisioned. Minimum api-version: + 2024-11-01.""" + + @overload + def __init__( + self, + *, + location: str, + tags: Optional[dict[str, str]] = None, + properties: Optional["_models.VirtualMachineProperties"] = None, + plan: Optional["_models.Plan"] = None, + identity: Optional["_models.VirtualMachineIdentity"] = None, + zones: Optional[list[str]] = None, + extended_location: Optional["_models.ExtendedLocation"] = None, + placement: Optional["_models.Placement"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class VirtualMachineAgentInstanceView(_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.models.VirtualMachineExtensionHandlerInstanceView] + :ivar statuses: The resource status information. + :vartype statuses: list[~azure.mgmt.compute.models.InstanceViewStatus] + """ + + vm_agent_version: Optional[str] = rest_field( + name="vmAgentVersion", visibility=["read", "create", "update", "delete", "query"] + ) + """The VM Agent full version.""" + extension_handlers: Optional[list["_models.VirtualMachineExtensionHandlerInstanceView"]] = rest_field( + name="extensionHandlers", visibility=["read", "create", "update", "delete", "query"] + ) + """The virtual machine extension handler instance view.""" + statuses: Optional[list["_models.InstanceViewStatus"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The resource status information.""" + + @overload + def __init__( + self, + *, + vm_agent_version: Optional[str] = None, + extension_handlers: Optional[list["_models.VirtualMachineExtensionHandlerInstanceView"]] = None, + statuses: Optional[list["_models.InstanceViewStatus"]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class VirtualMachineAssessPatchesResult(_Model): + """Describes the properties of an AssessPatches result. + + :ivar status: The overall success or failure status of the operation. It remains "InProgress" + until the operation completes. At that point it will become "Unknown", "Failed", "Succeeded", + or "CompletedWithWarnings.". Known values are: "Unknown", "InProgress", "Failed", "Succeeded", + and "CompletedWithWarnings". + :vartype status: str or ~azure.mgmt.compute.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.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.models.ApiError + """ + + status: Optional[Union[str, "_models.PatchOperationStatus"]] = rest_field(visibility=["read"]) + """The overall success or failure status of the operation. It remains \"InProgress\" until the + operation completes. At that point it will become \"Unknown\", \"Failed\", \"Succeeded\", or + \"CompletedWithWarnings.\". Known values are: \"Unknown\", \"InProgress\", \"Failed\", + \"Succeeded\", and \"CompletedWithWarnings\".""" + assessment_activity_id: Optional[str] = rest_field(name="assessmentActivityId", visibility=["read"]) + """The activity ID of the operation that produced this result. It is used to correlate across CRP + and extension logs.""" + reboot_pending: Optional[bool] = rest_field(name="rebootPending", visibility=["read"]) + """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.""" + critical_and_security_patch_count: Optional[int] = rest_field( + name="criticalAndSecurityPatchCount", visibility=["read"] + ) + """The number of critical or security patches that have been detected as available and not yet + installed.""" + other_patch_count: Optional[int] = rest_field(name="otherPatchCount", visibility=["read"]) + """The number of all available patches excluding critical and security.""" + start_date_time: Optional[datetime.datetime] = rest_field( + name="startDateTime", visibility=["read"], format="rfc3339" + ) + """The UTC timestamp when the operation began.""" + available_patches: Optional[list["_models.VirtualMachineSoftwarePatchProperties"]] = rest_field( + name="availablePatches", visibility=["read"] + ) + """The list of patches that have been detected as available for installation.""" + error: Optional["_models.ApiError"] = rest_field(visibility=["read"]) + """The errors that were encountered during execution of the operation. The details array contains + the list of them.""" + + +class VirtualMachineCaptureParameters(_Model): + """Capture Virtual Machine parameters. + + :ivar vhd_prefix: The captured virtual hard disk's name prefix. Required. + :vartype vhd_prefix: str + :ivar destination_container_name: The destination container name. Required. + :vartype destination_container_name: str + :ivar overwrite_vhds: Specifies whether to overwrite the destination virtual hard disk, in case + of conflict. Required. + :vartype overwrite_vhds: bool + """ + + vhd_prefix: str = rest_field(name="vhdPrefix", visibility=["read", "create", "update", "delete", "query"]) + """The captured virtual hard disk's name prefix. Required.""" + destination_container_name: str = rest_field( + name="destinationContainerName", visibility=["read", "create", "update", "delete", "query"] + ) + """The destination container name. Required.""" + overwrite_vhds: bool = rest_field(name="overwriteVhds", visibility=["read", "create", "update", "delete", "query"]) + """Specifies whether to overwrite the destination virtual hard disk, in case of conflict. + Required.""" + + @overload + def __init__( + self, + *, + vhd_prefix: str, + destination_container_name: str, + overwrite_vhds: bool, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class VirtualMachineCaptureResult(SubResource): + """Output of virtual machine capture operation. + + :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] + """ + + schema: Optional[str] = rest_field(name="$schema", visibility=["read"]) + """the schema of the captured virtual machine.""" + content_version: Optional[str] = rest_field(name="contentVersion", visibility=["read"]) + """the version of the content.""" + parameters: Optional[Any] = rest_field(visibility=["read"]) + """parameters of the captured virtual machine.""" + resources: Optional[list[Any]] = rest_field(visibility=["read"]) + """a list of resource items of the captured virtual machine.""" + + @overload + def __init__( + self, + *, + id: Optional[str] = None, # pylint: disable=redefined-builtin + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class VirtualMachineExtension(TrackedResource): + """Describes a Virtual Machine Extension. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.compute.models.SystemData + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar location: The geo-location where the resource lives. Required. + :vartype location: str + :ivar properties: Describes the properties of a Virtual Machine Extension. + :vartype properties: ~azure.mgmt.compute.models.VirtualMachineExtensionProperties + """ + + properties: Optional["_models.VirtualMachineExtensionProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Describes the properties of a Virtual Machine Extension.""" + + @overload + def __init__( + self, + *, + location: str, + tags: Optional[dict[str, str]] = None, + properties: Optional["_models.VirtualMachineExtensionProperties"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class VirtualMachineExtensionHandlerInstanceView(_Model): # pylint: disable=name-too-long + """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.models.InstanceViewStatus + """ + + type: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Specifies the type of the extension; an example is \"CustomScriptExtension\".""" + type_handler_version: Optional[str] = rest_field( + name="typeHandlerVersion", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies the version of the script handler.""" + status: Optional["_models.InstanceViewStatus"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The extension handler status.""" + + @overload + def __init__( + self, + *, + type: Optional[str] = None, + type_handler_version: Optional[str] = None, + status: Optional["_models.InstanceViewStatus"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class VirtualMachineExtensionImage(TrackedResource): + """Describes a Virtual Machine Extension Image. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.compute.models.SystemData + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar location: The geo-location where the resource lives. Required. + :vartype location: str + :ivar properties: Describes the properties of a Virtual Machine Extension Image. + :vartype properties: ~azure.mgmt.compute.models.VirtualMachineExtensionImageProperties + """ + + properties: Optional["_models.VirtualMachineExtensionImageProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Describes the properties of a Virtual Machine Extension Image.""" + + @overload + def __init__( + self, + *, + location: str, + tags: Optional[dict[str, str]] = None, + properties: Optional["_models.VirtualMachineExtensionImageProperties"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class VirtualMachineExtensionImageProperties(_Model): + """Describes the properties of a Virtual Machine Extension Image. + + :ivar operating_system: The operating system this extension supports. Required. + :vartype operating_system: str + :ivar compute_role: The type of role (IaaS or PaaS) this extension supports. Required. + :vartype compute_role: str + :ivar handler_schema: The schema defined by publisher, where extension consumers should provide + settings in a matching schema. Required. + :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 + """ + + operating_system: str = rest_field( + name="operatingSystem", visibility=["read", "create", "update", "delete", "query"] + ) + """The operating system this extension supports. Required.""" + compute_role: str = rest_field(name="computeRole", visibility=["read", "create", "update", "delete", "query"]) + """The type of role (IaaS or PaaS) this extension supports. Required.""" + handler_schema: str = rest_field(name="handlerSchema", visibility=["read", "create", "update", "delete", "query"]) + """The schema defined by publisher, where extension consumers should provide settings in a + matching schema. Required.""" + vm_scale_set_enabled: Optional[bool] = rest_field( + name="vmScaleSetEnabled", visibility=["read", "create", "update", "delete", "query"] + ) + """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.""" + supports_multiple_extensions: Optional[bool] = rest_field( + name="supportsMultipleExtensions", visibility=["read", "create", "update", "delete", "query"] + ) + """Whether the handler can support multiple extensions.""" + + @overload + def __init__( + self, + *, + operating_system: str, + compute_role: str, + handler_schema: str, + vm_scale_set_enabled: Optional[bool] = None, + supports_multiple_extensions: Optional[bool] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class VirtualMachineExtensionInstanceView(_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.models.InstanceViewStatus] + :ivar statuses: The resource status information. + :vartype statuses: list[~azure.mgmt.compute.models.InstanceViewStatus] + """ + + name: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The virtual machine extension name.""" + type: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Specifies the type of the extension; an example is \"CustomScriptExtension\".""" + type_handler_version: Optional[str] = rest_field( + name="typeHandlerVersion", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies the version of the script handler.""" + substatuses: Optional[list["_models.InstanceViewStatus"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The resource status information.""" + statuses: Optional[list["_models.InstanceViewStatus"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The resource status information.""" + + @overload + def __init__( + self, + *, + name: Optional[str] = None, + type: Optional[str] = None, + type_handler_version: Optional[str] = None, + substatuses: Optional[list["_models.InstanceViewStatus"]] = None, + statuses: Optional[list["_models.InstanceViewStatus"]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class VirtualMachineExtensionProperties(_Model): + """Describes the properties of a Virtual Machine Extension. + + :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 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.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: ~azure.mgmt.compute.models.KeyVaultSecretReference + :ivar provision_after_extensions: Collection of extension names after which this extension + needs to be provisioned. + :vartype provision_after_extensions: list[str] + """ + + force_update_tag: Optional[str] = rest_field( + name="forceUpdateTag", visibility=["read", "create", "update", "delete", "query"] + ) + """How the extension handler should be forced to update even if the extension configuration has + not changed.""" + publisher: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The name of the extension handler publisher.""" + type: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Specifies the type of the extension; an example is \"CustomScriptExtension\".""" + type_handler_version: Optional[str] = rest_field( + name="typeHandlerVersion", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies the version of the script handler.""" + auto_upgrade_minor_version: Optional[bool] = rest_field( + name="autoUpgradeMinorVersion", visibility=["read", "create", "update", "delete", "query"] + ) + """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.""" + enable_automatic_upgrade: Optional[bool] = rest_field( + name="enableAutomaticUpgrade", visibility=["read", "create", "update", "delete", "query"] + ) + """Indicates whether the extension should be automatically upgraded by the platform if there is a + newer version of the extension available.""" + settings: Optional[Any] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Json formatted public settings for the extension.""" + protected_settings: Optional[Any] = rest_field( + name="protectedSettings", visibility=["read", "create", "update", "delete", "query"] + ) + """The extension can contain either protectedSettings or protectedSettingsFromKeyVault or no + protected settings at all.""" + provisioning_state: Optional[str] = rest_field(name="provisioningState", visibility=["read"]) + """The provisioning state, which only appears in the response.""" + instance_view: Optional["_models.VirtualMachineExtensionInstanceView"] = rest_field( + name="instanceView", visibility=["read", "create", "update", "delete", "query"] + ) + """The virtual machine extension instance view.""" + suppress_failures: Optional[bool] = rest_field( + name="suppressFailures", visibility=["read", "create", "update", "delete", "query"] + ) + """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.""" + protected_settings_from_key_vault: Optional["_models.KeyVaultSecretReference"] = rest_field( + name="protectedSettingsFromKeyVault", visibility=["read", "create", "update", "delete", "query"] + ) + """The extensions protected settings that are passed by reference, and consumed from key vault.""" + provision_after_extensions: Optional[list[str]] = rest_field( + name="provisionAfterExtensions", visibility=["read", "create", "update", "delete", "query"] + ) + """Collection of extension names after which this extension needs to be provisioned.""" + + @overload + def __init__( + self, + *, + 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, + instance_view: Optional["_models.VirtualMachineExtensionInstanceView"] = None, + suppress_failures: Optional[bool] = None, + protected_settings_from_key_vault: Optional["_models.KeyVaultSecretReference"] = None, + provision_after_extensions: Optional[list[str]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class VirtualMachineExtensionUpdate(UpdateResource): + """Describes a Virtual Machine Extension. + + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar properties: Describes the properties of a Virtual Machine Extension. + :vartype properties: ~azure.mgmt.compute.models.VirtualMachineExtensionUpdateProperties + """ + + properties: Optional["_models.VirtualMachineExtensionUpdateProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Describes the properties of a Virtual Machine Extension.""" + + @overload + def __init__( + self, + *, + tags: Optional[dict[str, str]] = None, + properties: Optional["_models.VirtualMachineExtensionUpdateProperties"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class VirtualMachineExtensionUpdateProperties(_Model): + """Describes the properties of a Virtual Machine Extension. + + :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: ~azure.mgmt.compute.models.KeyVaultSecretReference + """ + + force_update_tag: Optional[str] = rest_field( + name="forceUpdateTag", visibility=["read", "create", "update", "delete", "query"] + ) + """How the extension handler should be forced to update even if the extension configuration has + not changed.""" + publisher: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The name of the extension handler publisher.""" + type: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Specifies the type of the extension; an example is \"CustomScriptExtension\".""" + type_handler_version: Optional[str] = rest_field( + name="typeHandlerVersion", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies the version of the script handler.""" + auto_upgrade_minor_version: Optional[bool] = rest_field( + name="autoUpgradeMinorVersion", visibility=["read", "create", "update", "delete", "query"] + ) + """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.""" + enable_automatic_upgrade: Optional[bool] = rest_field( + name="enableAutomaticUpgrade", visibility=["read", "create", "update", "delete", "query"] + ) + """Indicates whether the extension should be automatically upgraded by the platform if there is a + newer version of the extension available.""" + settings: Optional[Any] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Json formatted public settings for the extension.""" + protected_settings: Optional[Any] = rest_field( + name="protectedSettings", visibility=["read", "create", "update", "delete", "query"] + ) + """The extension can contain either protectedSettings or protectedSettingsFromKeyVault or no + protected settings at all.""" + suppress_failures: Optional[bool] = rest_field( + name="suppressFailures", visibility=["read", "create", "update", "delete", "query"] + ) + """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.""" + protected_settings_from_key_vault: Optional["_models.KeyVaultSecretReference"] = rest_field( + name="protectedSettingsFromKeyVault", visibility=["read", "create", "update", "delete", "query"] + ) + """The extensions protected settings that are passed by reference, and consumed from key vault.""" + + @overload + def __init__( + self, + *, + 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["_models.KeyVaultSecretReference"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class VirtualMachineHealthStatus(_Model): + """The health status of the VM. + + :ivar status: The health status information for the VM. + :vartype status: ~azure.mgmt.compute.models.InstanceViewStatus + """ + + status: Optional["_models.InstanceViewStatus"] = rest_field(visibility=["read"]) + """The health status information for the VM.""" + + +class VirtualMachineIdentity(_Model): + """Identity for the virtual machine. + + :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. Known values + are: "SystemAssigned", "UserAssigned", "SystemAssigned, UserAssigned", and "None". + :vartype type: str or ~azure.mgmt.compute.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.models.UserAssignedIdentitiesValue] + """ + + principal_id: Optional[str] = rest_field(name="principalId", visibility=["read"]) + """The principal id of virtual machine identity. This property will only be provided for a system + assigned identity.""" + tenant_id: Optional[str] = rest_field(name="tenantId", visibility=["read"]) + """The tenant id associated with the virtual machine. This property will only be provided for a + system assigned identity.""" + type: Optional[Union[str, "_models.ResourceIdentityType"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """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. Known values are: + \"SystemAssigned\", \"UserAssigned\", \"SystemAssigned, UserAssigned\", and \"None\".""" + user_assigned_identities: Optional[dict[str, "_models.UserAssignedIdentitiesValue"]] = rest_field( + name="userAssignedIdentities", visibility=["read", "create", "update", "delete", "query"] + ) + """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}'.""" + + @overload + def __init__( + self, + *, + type: Optional[Union[str, "_models.ResourceIdentityType"]] = None, + user_assigned_identities: Optional[dict[str, "_models.UserAssignedIdentitiesValue"]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class VirtualMachineImageResource(SubResource): + """Virtual machine image resource information. + + :ivar id: Resource Id. + :vartype id: str + :ivar name: The name of the resource. Required. + :vartype name: str + :ivar location: The supported Azure location of the resource. Required. + :vartype location: str + :ivar 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.models.ExtendedLocation + """ + + name: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The name of the resource. Required.""" + location: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The supported Azure location of the resource. Required.""" + tags: Optional[dict[str, str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Specifies the tags that are assigned to the virtual machine. For more information about using + tags, see `Using tags to organize your Azure resources + `_.""" + extended_location: Optional["_models.ExtendedLocation"] = rest_field( + name="extendedLocation", visibility=["read", "create", "update", "delete", "query"] + ) + """The extended location of the Virtual Machine.""" + + @overload + def __init__( + self, + *, + name: str, + location: str, + id: Optional[str] = None, # pylint: disable=redefined-builtin + tags: Optional[dict[str, str]] = None, + extended_location: Optional["_models.ExtendedLocation"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class VirtualMachineImage(VirtualMachineImageResource): + """Describes a Virtual Machine Image. + + :ivar id: Resource Id. + :vartype id: str + :ivar name: The name of the resource. Required. + :vartype name: str + :ivar location: The supported Azure location of the resource. Required. + :vartype location: str + :ivar 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.models.ExtendedLocation + :ivar properties: Describes the properties of a Virtual Machine Image. + :vartype properties: ~azure.mgmt.compute.models.VirtualMachineImageProperties + """ + + properties: Optional["_models.VirtualMachineImageProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Describes the properties of a Virtual Machine Image.""" + + @overload + def __init__( + self, + *, + name: str, + location: str, + id: Optional[str] = None, # pylint: disable=redefined-builtin + tags: Optional[dict[str, str]] = None, + extended_location: Optional["_models.ExtendedLocation"] = None, + properties: Optional["_models.VirtualMachineImageProperties"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class VirtualMachineImageFeature(_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 + """ + + name: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The name of the feature.""" + value: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The corresponding value for the feature.""" + + @overload + def __init__( + self, + *, + name: Optional[str] = None, + value: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class VirtualMachineImageProperties(_Model): + """Describes the properties of a Virtual Machine Image. + + :ivar plan: Used for establishing the purchase context of any 3rd Party artifact through + MarketPlace. + :vartype plan: ~azure.mgmt.compute.models.PurchasePlan + :ivar os_disk_image: Contains the os disk image information. + :vartype os_disk_image: ~azure.mgmt.compute.models.OSDiskImage + :ivar data_disk_images: The list of data disk images information. + :vartype data_disk_images: list[~azure.mgmt.compute.models.DataDiskImage] + :ivar automatic_os_upgrade_properties: Describes automatic OS upgrade properties on the image. + :vartype automatic_os_upgrade_properties: + ~azure.mgmt.compute.models.AutomaticOSUpgradeProperties + :ivar hyper_v_generation: Specifies the HyperVGeneration Type. Known values are: "V1" and "V2". + :vartype hyper_v_generation: str or ~azure.mgmt.compute.models.HyperVGenerationTypes + :ivar disallowed: Specifies disallowed configuration for the VirtualMachine created from the + image. + :vartype disallowed: ~azure.mgmt.compute.models.DisallowedConfiguration + :ivar features: + :vartype features: list[~azure.mgmt.compute.models.VirtualMachineImageFeature] + :ivar architecture: Specifies the Architecture Type. Known values are: "x64" and "Arm64". + :vartype architecture: str or ~azure.mgmt.compute.models.ArchitectureTypes + :ivar image_deprecation_status: Describes image deprecation status properties on the image. + :vartype image_deprecation_status: ~azure.mgmt.compute.models.ImageDeprecationStatus + """ + + plan: Optional["_models.PurchasePlan"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Used for establishing the purchase context of any 3rd Party artifact through MarketPlace.""" + os_disk_image: Optional["_models.OSDiskImage"] = rest_field( + name="osDiskImage", visibility=["read", "create", "update", "delete", "query"] + ) + """Contains the os disk image information.""" + data_disk_images: Optional[list["_models.DataDiskImage"]] = rest_field( + name="dataDiskImages", visibility=["read", "create", "update", "delete", "query"] + ) + """The list of data disk images information.""" + automatic_os_upgrade_properties: Optional["_models.AutomaticOSUpgradeProperties"] = rest_field( + name="automaticOSUpgradeProperties", visibility=["read", "create", "update", "delete", "query"] + ) + """Describes automatic OS upgrade properties on the image.""" + hyper_v_generation: Optional[Union[str, "_models.HyperVGenerationTypes"]] = rest_field( + name="hyperVGeneration", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies the HyperVGeneration Type. Known values are: \"V1\" and \"V2\".""" + disallowed: Optional["_models.DisallowedConfiguration"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies disallowed configuration for the VirtualMachine created from the image.""" + features: Optional[list["_models.VirtualMachineImageFeature"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + architecture: Optional[Union[str, "_models.ArchitectureTypes"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies the Architecture Type. Known values are: \"x64\" and \"Arm64\".""" + image_deprecation_status: Optional["_models.ImageDeprecationStatus"] = rest_field( + name="imageDeprecationStatus", visibility=["read", "create", "update", "delete", "query"] + ) + """Describes image deprecation status properties on the image.""" + + @overload + def __init__( + self, + *, + plan: Optional["_models.PurchasePlan"] = None, + os_disk_image: Optional["_models.OSDiskImage"] = None, + data_disk_images: Optional[list["_models.DataDiskImage"]] = None, + automatic_os_upgrade_properties: Optional["_models.AutomaticOSUpgradeProperties"] = None, + hyper_v_generation: Optional[Union[str, "_models.HyperVGenerationTypes"]] = None, + disallowed: Optional["_models.DisallowedConfiguration"] = None, + features: Optional[list["_models.VirtualMachineImageFeature"]] = None, + architecture: Optional[Union[str, "_models.ArchitectureTypes"]] = None, + image_deprecation_status: Optional["_models.ImageDeprecationStatus"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class VirtualMachineInstallPatchesParameters(_Model): + """Input for InstallPatches as directly received by the API. + + :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: ~datetime.timedelta + :ivar reboot_setting: Defines when it is acceptable to reboot a VM during a software update + operation. Required. Known values are: "IfRequired", "Never", and "Always". + :vartype reboot_setting: str or ~azure.mgmt.compute.models.VMGuestPatchRebootSetting + :ivar windows_parameters: Input for InstallPatches on a Windows VM, as directly received by the + API. + :vartype windows_parameters: ~azure.mgmt.compute.models.WindowsParameters + :ivar linux_parameters: Input for InstallPatches on a Linux VM, as directly received by the + API. + :vartype linux_parameters: ~azure.mgmt.compute.models.LinuxParameters + """ + + maximum_duration: Optional[datetime.timedelta] = rest_field( + name="maximumDuration", visibility=["read", "create", "update", "delete", "query"] + ) + """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).""" + reboot_setting: Union[str, "_models.VMGuestPatchRebootSetting"] = rest_field( + name="rebootSetting", visibility=["read", "create", "update", "delete", "query"] + ) + """Defines when it is acceptable to reboot a VM during a software update operation. Required. + Known values are: \"IfRequired\", \"Never\", and \"Always\".""" + windows_parameters: Optional["_models.WindowsParameters"] = rest_field( + name="windowsParameters", visibility=["read", "create", "update", "delete", "query"] + ) + """Input for InstallPatches on a Windows VM, as directly received by the API.""" + linux_parameters: Optional["_models.LinuxParameters"] = rest_field( + name="linuxParameters", visibility=["read", "create", "update", "delete", "query"] + ) + """Input for InstallPatches on a Linux VM, as directly received by the API.""" + + @overload + def __init__( + self, + *, + reboot_setting: Union[str, "_models.VMGuestPatchRebootSetting"], + maximum_duration: Optional[datetime.timedelta] = None, + windows_parameters: Optional["_models.WindowsParameters"] = None, + linux_parameters: Optional["_models.LinuxParameters"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class VirtualMachineInstallPatchesResult(_Model): + """The result summary of an installation operation. + + :ivar status: The overall success or failure status of the operation. It remains "InProgress" + until the operation completes. At that point it will become "Failed", "Succeeded", "Unknown" or + "CompletedWithWarnings.". Known values are: "Unknown", "InProgress", "Failed", "Succeeded", and + "CompletedWithWarnings". + :vartype status: str or ~azure.mgmt.compute.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. Known + values are: "Unknown", "NotNeeded", "Required", "Started", "Failed", and "Completed". + :vartype reboot_status: str or ~azure.mgmt.compute.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.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.models.ApiError + """ + + status: Optional[Union[str, "_models.PatchOperationStatus"]] = rest_field(visibility=["read"]) + """The overall success or failure status of the operation. It remains \"InProgress\" until the + operation completes. At that point it will become \"Failed\", \"Succeeded\", \"Unknown\" or + \"CompletedWithWarnings.\". Known values are: \"Unknown\", \"InProgress\", \"Failed\", + \"Succeeded\", and \"CompletedWithWarnings\".""" + installation_activity_id: Optional[str] = rest_field(name="installationActivityId", visibility=["read"]) + """The activity ID of the operation that produced this result. It is used to correlate across CRP + and extension logs.""" + reboot_status: Optional[Union[str, "_models.VMGuestPatchRebootStatus"]] = rest_field( + name="rebootStatus", visibility=["read"] + ) + """The reboot state of the VM following completion of the operation. Known values are: + \"Unknown\", \"NotNeeded\", \"Required\", \"Started\", \"Failed\", and \"Completed\".""" + maintenance_window_exceeded: Optional[bool] = rest_field(name="maintenanceWindowExceeded", visibility=["read"]) + """Whether the operation ran out of time before it completed all its intended actions.""" + excluded_patch_count: Optional[int] = rest_field(name="excludedPatchCount", visibility=["read"]) + """The number of patches that were not installed due to the user blocking their installation.""" + not_selected_patch_count: Optional[int] = rest_field(name="notSelectedPatchCount", visibility=["read"]) + """The number of patches that were detected as available for install, but did not meet the + operation's criteria.""" + pending_patch_count: Optional[int] = rest_field(name="pendingPatchCount", visibility=["read"]) + """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.""" + installed_patch_count: Optional[int] = rest_field(name="installedPatchCount", visibility=["read"]) + """The number of patches successfully installed.""" + failed_patch_count: Optional[int] = rest_field(name="failedPatchCount", visibility=["read"]) + """The number of patches that could not be installed due to some issue. See errors for details.""" + patches: Optional[list["_models.PatchInstallationDetail"]] = rest_field(visibility=["read"]) + """The patches that were installed during the operation.""" + start_date_time: Optional[datetime.datetime] = rest_field( + name="startDateTime", visibility=["read"], format="rfc3339" + ) + """The UTC timestamp when the operation began.""" + error: Optional["_models.ApiError"] = rest_field(visibility=["read"]) + """The errors that were encountered during execution of the operation. The details array contains + the list of them.""" + + +class VirtualMachineInstanceView(_Model): + """The instance view of a virtual machine. + + :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. Known + values are: "V1" and "V2". + :vartype hyper_v_generation: str or ~azure.mgmt.compute.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.models.VirtualMachineAgentInstanceView + :ivar maintenance_redeploy_status: The Maintenance Operation status on the virtual machine. + :vartype maintenance_redeploy_status: ~azure.mgmt.compute.models.MaintenanceRedeployStatus + :ivar disks: The virtual machine disk information. + :vartype disks: list[~azure.mgmt.compute.models.DiskInstanceView] + :ivar extensions: The extensions information. + :vartype extensions: list[~azure.mgmt.compute.models.VirtualMachineExtensionInstanceView] + :ivar vm_health: The health status for the VM. + :vartype vm_health: ~azure.mgmt.compute.models.VirtualMachineHealthStatus + :ivar boot_diagnostics: Boot Diagnostics is a debugging feature which allows you to view + Console Output and Screenshot to diagnose VM status. You can easily view the output of your + console log. Azure also enables you to see a screenshot of the VM from the hypervisor. + :vartype boot_diagnostics: ~azure.mgmt.compute.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. Minimum api-version: 2020-06-01. + :vartype assigned_host: str + :ivar statuses: The resource status information. + :vartype statuses: list[~azure.mgmt.compute.models.InstanceViewStatus] + :ivar patch_status: [Preview Feature] The status of virtual machine patch operations. + :vartype patch_status: ~azure.mgmt.compute.models.VirtualMachinePatchStatus + :ivar is_vm_in_standby_pool: [Preview Feature] Specifies whether the VM is currently in or out + of the Standby Pool. + :vartype is_vm_in_standby_pool: bool + """ + + platform_update_domain: Optional[int] = rest_field( + name="platformUpdateDomain", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies the update domain of the virtual machine.""" + platform_fault_domain: Optional[int] = rest_field( + name="platformFaultDomain", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies the fault domain of the virtual machine.""" + computer_name: Optional[str] = rest_field( + name="computerName", visibility=["read", "create", "update", "delete", "query"] + ) + """The computer name assigned to the virtual machine.""" + os_name: Optional[str] = rest_field(name="osName", visibility=["read", "create", "update", "delete", "query"]) + """The Operating System running on the virtual machine.""" + os_version: Optional[str] = rest_field(name="osVersion", visibility=["read", "create", "update", "delete", "query"]) + """The version of Operating System running on the virtual machine.""" + hyper_v_generation: Optional[Union[str, "_models.HyperVGenerationType"]] = rest_field( + name="hyperVGeneration", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies the HyperVGeneration Type associated with a resource. Known values are: \"V1\" and + \"V2\".""" + rdp_thumb_print: Optional[str] = rest_field( + name="rdpThumbPrint", visibility=["read", "create", "update", "delete", "query"] + ) + """The Remote desktop certificate thumbprint.""" + vm_agent: Optional["_models.VirtualMachineAgentInstanceView"] = rest_field( + name="vmAgent", visibility=["read", "create", "update", "delete", "query"] + ) + """The VM Agent running on the virtual machine.""" + maintenance_redeploy_status: Optional["_models.MaintenanceRedeployStatus"] = rest_field( + name="maintenanceRedeployStatus", visibility=["read", "create", "update", "delete", "query"] + ) + """The Maintenance Operation status on the virtual machine.""" + disks: Optional[list["_models.DiskInstanceView"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The virtual machine disk information.""" + extensions: Optional[list["_models.VirtualMachineExtensionInstanceView"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The extensions information.""" + vm_health: Optional["_models.VirtualMachineHealthStatus"] = rest_field(name="vmHealth", visibility=["read"]) + """The health status for the VM.""" + boot_diagnostics: Optional["_models.BootDiagnosticsInstanceView"] = rest_field( + name="bootDiagnostics", visibility=["read", "create", "update", "delete", "query"] + ) + """Boot Diagnostics is a debugging feature which allows you to view Console Output and Screenshot + to diagnose VM status. You can easily view the output of your console log. Azure also enables + you to see a screenshot of the VM from the hypervisor.""" + assigned_host: Optional[str] = rest_field(name="assignedHost", visibility=["read"]) + """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. Minimum api-version: 2020-06-01.""" + statuses: Optional[list["_models.InstanceViewStatus"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The resource status information.""" + patch_status: Optional["_models.VirtualMachinePatchStatus"] = rest_field( + name="patchStatus", visibility=["read", "create", "update", "delete", "query"] + ) + """[Preview Feature] The status of virtual machine patch operations.""" + is_vm_in_standby_pool: Optional[bool] = rest_field(name="isVMInStandbyPool", visibility=["read"]) + """[Preview Feature] Specifies whether the VM is currently in or out of the Standby Pool.""" + + @overload + 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, "_models.HyperVGenerationType"]] = None, + rdp_thumb_print: Optional[str] = None, + vm_agent: Optional["_models.VirtualMachineAgentInstanceView"] = None, + maintenance_redeploy_status: Optional["_models.MaintenanceRedeployStatus"] = None, + disks: Optional[list["_models.DiskInstanceView"]] = None, + extensions: Optional[list["_models.VirtualMachineExtensionInstanceView"]] = None, + boot_diagnostics: Optional["_models.BootDiagnosticsInstanceView"] = None, + statuses: Optional[list["_models.InstanceViewStatus"]] = None, + patch_status: Optional["_models.VirtualMachinePatchStatus"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class VirtualMachineIpTag(_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 + """ + + ip_tag_type: Optional[str] = rest_field( + name="ipTagType", visibility=["read", "create", "update", "delete", "query"] + ) + """IP tag type. Example: FirstPartyUsage.""" + tag: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """IP tag associated with the public IP. Example: SQL, Storage etc.""" + + @overload + def __init__( + self, + *, + ip_tag_type: Optional[str] = None, + tag: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class VirtualMachineNetworkInterfaceConfiguration(_Model): # pylint: disable=name-too-long + """Describes a virtual machine network interface configurations. + + :ivar name: The network interface configuration name. Required. + :vartype name: str + :ivar properties: Describes a virtual machine network profile's IP configuration. + :vartype properties: + ~azure.mgmt.compute.models.VirtualMachineNetworkInterfaceConfigurationProperties + :ivar tags: Resource tags applied to the networkInterface address created by this + NetworkInterfaceConfiguration. + :vartype tags: dict[str, str] + """ + + name: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The network interface configuration name. Required.""" + properties: Optional["_models.VirtualMachineNetworkInterfaceConfigurationProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Describes a virtual machine network profile's IP configuration.""" + tags: Optional[dict[str, str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Resource tags applied to the networkInterface address created by this + NetworkInterfaceConfiguration.""" + + @overload + def __init__( + self, + *, + name: str, + properties: Optional["_models.VirtualMachineNetworkInterfaceConfigurationProperties"] = None, + tags: Optional[dict[str, str]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class VirtualMachineNetworkInterfaceConfigurationProperties(_Model): # pylint: disable=name-too-long + """Describes a virtual machine network profile's IP configuration. + + :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. + Known values are: "Delete" and "Detach". + :vartype delete_option: str or ~azure.mgmt.compute.models.DeleteOptions + :ivar enable_accelerated_networking: Specifies whether the network interface is accelerated + networking-enabled. + :vartype enable_accelerated_networking: bool + :ivar disable_tcp_state_tracking: Specifies whether the network interface is disabled for tcp + state tracking. + :vartype disable_tcp_state_tracking: 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.models.SubResource + :ivar dns_settings: The dns settings to be applied on the network interfaces. + :vartype dns_settings: + ~azure.mgmt.compute.models.VirtualMachineNetworkInterfaceDnsSettingsConfiguration + :ivar ip_configurations: Specifies the IP configurations of the network interface. Required. + :vartype ip_configurations: + list[~azure.mgmt.compute.models.VirtualMachineNetworkInterfaceIPConfiguration] + :ivar dscp_configuration: + :vartype dscp_configuration: ~azure.mgmt.compute.models.SubResource + :ivar auxiliary_mode: Specifies whether the Auxiliary mode is enabled for the Network Interface + resource. Known values are: "None", "AcceleratedConnections", and "Floating". + :vartype auxiliary_mode: str or ~azure.mgmt.compute.models.NetworkInterfaceAuxiliaryMode + :ivar auxiliary_sku: Specifies whether the Auxiliary sku is enabled for the Network Interface + resource. Known values are: "None", "A1", "A2", "A4", and "A8". + :vartype auxiliary_sku: str or ~azure.mgmt.compute.models.NetworkInterfaceAuxiliarySku + """ + + primary: Optional[bool] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Specifies the primary network interface in case the virtual machine has more than 1 network + interface.""" + delete_option: Optional[Union[str, "_models.DeleteOptions"]] = rest_field( + name="deleteOption", visibility=["read", "create", "update", "delete", "query"] + ) + """Specify what happens to the network interface when the VM is deleted. Known values are: + \"Delete\" and \"Detach\".""" + enable_accelerated_networking: Optional[bool] = rest_field( + name="enableAcceleratedNetworking", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies whether the network interface is accelerated networking-enabled.""" + disable_tcp_state_tracking: Optional[bool] = rest_field( + name="disableTcpStateTracking", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies whether the network interface is disabled for tcp state tracking.""" + enable_fpga: Optional[bool] = rest_field( + name="enableFpga", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies whether the network interface is FPGA networking-enabled.""" + enable_ip_forwarding: Optional[bool] = rest_field( + name="enableIPForwarding", visibility=["read", "create", "update", "delete", "query"] + ) + """Whether IP forwarding enabled on this NIC.""" + network_security_group: Optional["_models.SubResource"] = rest_field( + name="networkSecurityGroup", visibility=["read", "create", "update", "delete", "query"] + ) + """The network security group.""" + dns_settings: Optional["_models.VirtualMachineNetworkInterfaceDnsSettingsConfiguration"] = rest_field( + name="dnsSettings", visibility=["read", "create", "update", "delete", "query"] + ) + """The dns settings to be applied on the network interfaces.""" + ip_configurations: list["_models.VirtualMachineNetworkInterfaceIPConfiguration"] = rest_field( + name="ipConfigurations", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies the IP configurations of the network interface. Required.""" + dscp_configuration: Optional["_models.SubResource"] = rest_field( + name="dscpConfiguration", visibility=["read", "create", "update", "delete", "query"] + ) + auxiliary_mode: Optional[Union[str, "_models.NetworkInterfaceAuxiliaryMode"]] = rest_field( + name="auxiliaryMode", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies whether the Auxiliary mode is enabled for the Network Interface resource. Known + values are: \"None\", \"AcceleratedConnections\", and \"Floating\".""" + auxiliary_sku: Optional[Union[str, "_models.NetworkInterfaceAuxiliarySku"]] = rest_field( + name="auxiliarySku", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies whether the Auxiliary sku is enabled for the Network Interface resource. Known values + are: \"None\", \"A1\", \"A2\", \"A4\", and \"A8\".""" + + @overload + def __init__( + self, + *, + ip_configurations: list["_models.VirtualMachineNetworkInterfaceIPConfiguration"], + primary: Optional[bool] = None, + delete_option: Optional[Union[str, "_models.DeleteOptions"]] = None, + enable_accelerated_networking: Optional[bool] = None, + disable_tcp_state_tracking: Optional[bool] = None, + enable_fpga: Optional[bool] = None, + enable_ip_forwarding: Optional[bool] = None, + network_security_group: Optional["_models.SubResource"] = None, + dns_settings: Optional["_models.VirtualMachineNetworkInterfaceDnsSettingsConfiguration"] = None, + dscp_configuration: Optional["_models.SubResource"] = None, + auxiliary_mode: Optional[Union[str, "_models.NetworkInterfaceAuxiliaryMode"]] = None, + auxiliary_sku: Optional[Union[str, "_models.NetworkInterfaceAuxiliarySku"]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class VirtualMachineNetworkInterfaceDnsSettingsConfiguration(_Model): # pylint: disable=name-too-long + """Describes a virtual machines network configuration's DNS settings. + + :ivar dns_servers: List of DNS servers IP addresses. + :vartype dns_servers: list[str] + """ + + dns_servers: Optional[list[str]] = rest_field( + name="dnsServers", visibility=["read", "create", "update", "delete", "query"] + ) + """List of DNS servers IP addresses.""" + + @overload + def __init__( + self, + *, + dns_servers: Optional[list[str]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class VirtualMachineNetworkInterfaceIPConfiguration(_Model): # pylint: disable=name-too-long + """Describes a virtual machine network profile's IP configuration. + + :ivar name: The IP configuration name. Required. + :vartype name: str + :ivar properties: Describes a virtual machine network interface IP configuration properties. + :vartype properties: + ~azure.mgmt.compute.models.VirtualMachineNetworkInterfaceIPConfigurationProperties + """ + + name: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The IP configuration name. Required.""" + properties: Optional["_models.VirtualMachineNetworkInterfaceIPConfigurationProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Describes a virtual machine network interface IP configuration properties.""" + + @overload + def __init__( + self, + *, + name: str, + properties: Optional["_models.VirtualMachineNetworkInterfaceIPConfigurationProperties"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class VirtualMachineNetworkInterfaceIPConfigurationProperties(_Model): # pylint: disable=name-too-long + """Describes a virtual machine network interface IP configuration properties. + + :ivar subnet: Specifies the identifier of the subnet. + :vartype subnet: ~azure.mgmt.compute.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.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'. Known values are: "IPv4" and "IPv6". + :vartype private_ip_address_version: str or ~azure.mgmt.compute.models.IPVersions + :ivar application_security_groups: Specifies an array of references to application security + group. + :vartype application_security_groups: list[~azure.mgmt.compute.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.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.models.SubResource] + """ + + subnet: Optional["_models.SubResource"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Specifies the identifier of the subnet.""" + primary: Optional[bool] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Specifies the primary network interface in case the virtual machine has more than 1 network + interface.""" + public_ip_address_configuration: Optional["_models.VirtualMachinePublicIPAddressConfiguration"] = rest_field( + name="publicIPAddressConfiguration", visibility=["read", "create", "update", "delete", "query"] + ) + """The publicIPAddressConfiguration.""" + private_ip_address_version: Optional[Union[str, "_models.IPVersions"]] = rest_field( + name="privateIPAddressVersion", visibility=["read", "create", "update", "delete", "query"] + ) + """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'. Known values are: \"IPv4\" and \"IPv6\".""" + application_security_groups: Optional[list["_models.SubResource"]] = rest_field( + name="applicationSecurityGroups", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies an array of references to application security group.""" + application_gateway_backend_address_pools: Optional[list["_models.SubResource"]] = rest_field( + name="applicationGatewayBackendAddressPools", visibility=["read", "create", "update", "delete", "query"] + ) + """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.""" + load_balancer_backend_address_pools: Optional[list["_models.SubResource"]] = rest_field( + name="loadBalancerBackendAddressPools", visibility=["read", "create", "update", "delete", "query"] + ) + """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].""" + + @overload + def __init__( + self, + *, + subnet: Optional["_models.SubResource"] = None, + primary: Optional[bool] = None, + public_ip_address_configuration: Optional["_models.VirtualMachinePublicIPAddressConfiguration"] = None, + private_ip_address_version: Optional[Union[str, "_models.IPVersions"]] = None, + application_security_groups: Optional[list["_models.SubResource"]] = None, + application_gateway_backend_address_pools: Optional[list["_models.SubResource"]] = None, + load_balancer_backend_address_pools: Optional[list["_models.SubResource"]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class VirtualMachinePatchStatus(_Model): + """The status of virtual machine patch operations. + + :ivar available_patch_summary: The available patch summary of the latest assessment operation + for the virtual machine. + :vartype available_patch_summary: ~azure.mgmt.compute.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.models.LastPatchInstallationSummary + :ivar configuration_statuses: The enablement status of the specified patchMode. + :vartype configuration_statuses: list[~azure.mgmt.compute.models.InstanceViewStatus] + """ + + available_patch_summary: Optional["_models.AvailablePatchSummary"] = rest_field( + name="availablePatchSummary", visibility=["read", "create", "update", "delete", "query"] + ) + """The available patch summary of the latest assessment operation for the virtual machine.""" + last_patch_installation_summary: Optional["_models.LastPatchInstallationSummary"] = rest_field( + name="lastPatchInstallationSummary", visibility=["read", "create", "update", "delete", "query"] + ) + """The installation summary of the latest installation operation for the virtual machine.""" + configuration_statuses: Optional[list["_models.InstanceViewStatus"]] = rest_field( + name="configurationStatuses", visibility=["read"] + ) + """The enablement status of the specified patchMode.""" + + @overload + def __init__( + self, + *, + available_patch_summary: Optional["_models.AvailablePatchSummary"] = None, + last_patch_installation_summary: Optional["_models.LastPatchInstallationSummary"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class VirtualMachineProperties(_Model): + """Describes the properties of a Virtual Machine. + + :ivar hardware_profile: Specifies the hardware settings for the virtual machine. + :vartype hardware_profile: ~azure.mgmt.compute.models.HardwareProfile + :ivar scheduled_events_policy: Specifies Redeploy, Reboot and + ScheduledEventsAdditionalPublishingTargets Scheduled Event related configurations for the + virtual machine. + :vartype scheduled_events_policy: ~azure.mgmt.compute.models.ScheduledEventsPolicy + :ivar storage_profile: Specifies the storage settings for the virtual machine disks. + :vartype storage_profile: ~azure.mgmt.compute.models.StorageProfile + :ivar additional_capabilities: Specifies additional capabilities enabled or disabled on the + virtual machine. + :vartype additional_capabilities: ~azure.mgmt.compute.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.models.OSProfile + :ivar network_profile: Specifies the network interfaces of the virtual machine. + :vartype network_profile: ~azure.mgmt.compute.models.NetworkProfile + :ivar security_profile: Specifies the Security related profile settings for the virtual + machine. + :vartype security_profile: ~azure.mgmt.compute.models.SecurityProfile + :ivar diagnostics_profile: Specifies the boot diagnostic settings state. Minimum api-version: + 2015-06-15. + :vartype diagnostics_profile: ~azure.mgmt.compute.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 + `_. For more + information on Azure planned maintenance, see `Maintenance and updates for Virtual Machines in + Azure `_. 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. This property cannot exist along with a + non-null properties.virtualMachineScaleSet reference. + :vartype availability_set: ~azure.mgmt.compute.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. This property cannot exist along with a non-null + properties.availabilitySet reference. Minimum api‐version: 2019‐03‐01. + :vartype virtual_machine_scale_set: ~azure.mgmt.compute.models.SubResource + :ivar proximity_placement_group: Specifies information about the proximity placement group that + the virtual machine should be assigned to. Minimum api-version: 2018-04-01. + :vartype proximity_placement_group: ~azure.mgmt.compute.models.SubResource + :ivar priority: Specifies the priority for the virtual machine. Minimum api-version: + 2019-03-01. Known values are: "Regular", "Low", and "Spot". + :vartype priority: str or ~azure.mgmt.compute.models.VirtualMachinePriorityTypes + :ivar eviction_policy: Specifies the eviction policy for the Azure Spot virtual machine and + Azure Spot scale set. For Azure Spot virtual machines, both 'Deallocate' and 'Delete' are + supported and the minimum api-version is 2019-03-01. For Azure Spot scale sets, both + 'Deallocate' and 'Delete' are supported and the minimum api-version is 2017-10-30-preview. + Known values are: "Deallocate" and "Delete". + :vartype eviction_policy: str or ~azure.mgmt.compute.models.VirtualMachineEvictionPolicyTypes + :ivar billing_profile: Specifies the billing related details of a Azure Spot virtual machine. + Minimum api-version: 2019-03-01. + :vartype billing_profile: ~azure.mgmt.compute.models.BillingProfile + :ivar host: Specifies information about the dedicated host that the virtual machine resides in. + Minimum api-version: 2018-10-01. + :vartype host: ~azure.mgmt.compute.models.SubResource + :ivar host_group: Specifies information about the dedicated host group that the virtual machine + resides in. **Note:** User cannot specify both host and hostGroup properties. Minimum + api-version: 2020-06-01. + :vartype host_group: ~azure.mgmt.compute.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.models.VirtualMachineInstanceView + :ivar license_type: Specifies that the image or disk that is being used was licensed + on-premises.

Possible values for Windows Server operating system are:

+ Windows_Client

Windows_Server

Possible values for Linux Server operating + system are:

RHEL_BYOS (for RHEL)

SLES_BYOS (for SUSE)

For more + information, see `Azure Hybrid Use Benefit for Windows Server + `_ +

`Azure Hybrid Use Benefit for Linux Server + `_

+ 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). 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. This is + applicable only if the 'virtualMachineScaleSet' property of this Virtual Machine is set. The + Virtual Machine Scale Set that is referenced, must have 'platformFaultDomainCount' greater than + 1. This property cannot be updated once the Virtual Machine is created. Fault domain assignment + can be viewed in the Virtual Machine Instance View. 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.models.ScheduledEventsProfile + :ivar user_data: UserData for the VM, which must be base-64 encoded. Customer should not pass + any secrets in here. 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. Minimum api-version: 2021-04-01. + :vartype capacity_reservation: ~azure.mgmt.compute.models.CapacityReservationProfile + :ivar application_profile: Specifies the gallery applications that should be made available to + the VM/VMSS. + :vartype application_profile: ~azure.mgmt.compute.models.ApplicationProfile + :ivar time_created: Specifies the time at which the Virtual Machine resource was created. + Minimum api-version: 2021-11-01. + :vartype time_created: ~datetime.datetime + """ + + hardware_profile: Optional["_models.HardwareProfile"] = rest_field( + name="hardwareProfile", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies the hardware settings for the virtual machine.""" + scheduled_events_policy: Optional["_models.ScheduledEventsPolicy"] = rest_field( + name="scheduledEventsPolicy", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies Redeploy, Reboot and ScheduledEventsAdditionalPublishingTargets Scheduled Event + related configurations for the virtual machine.""" + storage_profile: Optional["_models.StorageProfile"] = rest_field( + name="storageProfile", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies the storage settings for the virtual machine disks.""" + additional_capabilities: Optional["_models.AdditionalCapabilities"] = rest_field( + name="additionalCapabilities", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies additional capabilities enabled or disabled on the virtual machine.""" + os_profile: Optional["_models.OSProfile"] = rest_field( + name="osProfile", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies the operating system settings used while creating the virtual machine. Some of the + settings cannot be changed once VM is provisioned.""" + network_profile: Optional["_models.NetworkProfile"] = rest_field( + name="networkProfile", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies the network interfaces of the virtual machine.""" + security_profile: Optional["_models.SecurityProfile"] = rest_field( + name="securityProfile", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies the Security related profile settings for the virtual machine.""" + diagnostics_profile: Optional["_models.DiagnosticsProfile"] = rest_field( + name="diagnosticsProfile", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies the boot diagnostic settings state. Minimum api-version: 2015-06-15.""" + availability_set: Optional["_models.SubResource"] = rest_field( + name="availabilitySet", visibility=["read", "create", "update", "delete", "query"] + ) + """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 `_. For + more information on Azure planned maintenance, see `Maintenance and updates for Virtual + Machines in Azure + `_. 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. This property cannot exist along with a + non-null properties.virtualMachineScaleSet reference.""" + virtual_machine_scale_set: Optional["_models.SubResource"] = rest_field( + name="virtualMachineScaleSet", visibility=["read", "create", "update", "delete", "query"] + ) + """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. This + property cannot exist along with a non-null properties.availabilitySet reference. Minimum + api‐version: 2019‐03‐01.""" + proximity_placement_group: Optional["_models.SubResource"] = rest_field( + name="proximityPlacementGroup", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies information about the proximity placement group that the virtual machine should be + assigned to. Minimum api-version: 2018-04-01.""" + priority: Optional[Union[str, "_models.VirtualMachinePriorityTypes"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies the priority for the virtual machine. Minimum api-version: 2019-03-01. Known values + are: \"Regular\", \"Low\", and \"Spot\".""" + eviction_policy: Optional[Union[str, "_models.VirtualMachineEvictionPolicyTypes"]] = rest_field( + name="evictionPolicy", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies the eviction policy for the Azure Spot virtual machine and Azure Spot scale set. For + Azure Spot virtual machines, both 'Deallocate' and 'Delete' are supported and the minimum + api-version is 2019-03-01. For Azure Spot scale sets, both 'Deallocate' and 'Delete' are + supported and the minimum api-version is 2017-10-30-preview. Known values are: \"Deallocate\" + and \"Delete\".""" + billing_profile: Optional["_models.BillingProfile"] = rest_field( + name="billingProfile", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies the billing related details of a Azure Spot virtual machine. Minimum api-version: + 2019-03-01.""" + host: Optional["_models.SubResource"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Specifies information about the dedicated host that the virtual machine resides in. Minimum + api-version: 2018-10-01.""" + host_group: Optional["_models.SubResource"] = rest_field( + name="hostGroup", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies information about the dedicated host group that the virtual machine resides in. + **Note:** User cannot specify both host and hostGroup properties. Minimum api-version: + 2020-06-01.""" + provisioning_state: Optional[str] = rest_field(name="provisioningState", visibility=["read"]) + """The provisioning state, which only appears in the response.""" + instance_view: Optional["_models.VirtualMachineInstanceView"] = rest_field(name="instanceView", visibility=["read"]) + """The virtual machine instance view.""" + license_type: Optional[str] = rest_field( + name="licenseType", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies that the image or disk that is being used was licensed on-premises.

Possible + values for Windows Server operating system are:

Windows_Client

Windows_Server +

Possible values for Linux Server operating system are:

RHEL_BYOS (for RHEL) +

SLES_BYOS (for SUSE)

For more information, see `Azure Hybrid Use Benefit for + Windows Server + `_ +

`Azure Hybrid Use Benefit for Linux Server + `_

+ Minimum api-version: 2015-06-15.""" + vm_id: Optional[str] = rest_field(name="vmId", visibility=["read"]) + """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.""" + extensions_time_budget: Optional[str] = rest_field( + name="extensionsTimeBudget", visibility=["read", "create", "update", "delete", "query"] + ) + """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). Minimum api-version: 2020-06-01.""" + platform_fault_domain: Optional[int] = rest_field( + name="platformFaultDomain", visibility=["read", "create", "update", "delete", "query"] + ) + """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. This is applicable only if the + 'virtualMachineScaleSet' property of this Virtual Machine is set. The Virtual Machine Scale Set + that is referenced, must have 'platformFaultDomainCount' greater than 1. This property cannot + be updated once the Virtual Machine is created. Fault domain assignment can be viewed in the + Virtual Machine Instance View. Minimum api‐version: 2020‐12‐01.""" + scheduled_events_profile: Optional["_models.ScheduledEventsProfile"] = rest_field( + name="scheduledEventsProfile", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies Scheduled Event related configurations.""" + user_data: Optional[str] = rest_field(name="userData", visibility=["read", "create", "update", "delete", "query"]) + """UserData for the VM, which must be base-64 encoded. Customer should not pass any secrets in + here. Minimum api-version: 2021-03-01.""" + capacity_reservation: Optional["_models.CapacityReservationProfile"] = rest_field( + name="capacityReservation", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies information about the capacity reservation that is used to allocate virtual machine. + Minimum api-version: 2021-04-01.""" + application_profile: Optional["_models.ApplicationProfile"] = rest_field( + name="applicationProfile", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies the gallery applications that should be made available to the VM/VMSS.""" + time_created: Optional[datetime.datetime] = rest_field(name="timeCreated", visibility=["read"], format="rfc3339") + """Specifies the time at which the Virtual Machine resource was created. Minimum api-version: + 2021-11-01.""" + + @overload + def __init__( # pylint: disable=too-many-locals + self, + *, + hardware_profile: Optional["_models.HardwareProfile"] = None, + scheduled_events_policy: Optional["_models.ScheduledEventsPolicy"] = None, + storage_profile: Optional["_models.StorageProfile"] = None, + additional_capabilities: Optional["_models.AdditionalCapabilities"] = None, + os_profile: Optional["_models.OSProfile"] = None, + network_profile: Optional["_models.NetworkProfile"] = None, + security_profile: Optional["_models.SecurityProfile"] = None, + diagnostics_profile: Optional["_models.DiagnosticsProfile"] = None, + availability_set: Optional["_models.SubResource"] = None, + virtual_machine_scale_set: Optional["_models.SubResource"] = None, + proximity_placement_group: Optional["_models.SubResource"] = None, + priority: Optional[Union[str, "_models.VirtualMachinePriorityTypes"]] = None, + eviction_policy: Optional[Union[str, "_models.VirtualMachineEvictionPolicyTypes"]] = None, + billing_profile: Optional["_models.BillingProfile"] = None, + host: Optional["_models.SubResource"] = None, + host_group: Optional["_models.SubResource"] = None, + license_type: Optional[str] = None, + extensions_time_budget: Optional[str] = None, + platform_fault_domain: Optional[int] = None, + scheduled_events_profile: Optional["_models.ScheduledEventsProfile"] = None, + user_data: Optional[str] = None, + capacity_reservation: Optional["_models.CapacityReservationProfile"] = None, + application_profile: Optional["_models.ApplicationProfile"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class VirtualMachinePublicIPAddressConfiguration(_Model): # pylint: disable=name-too-long + """Describes a virtual machines IP Configuration's PublicIPAddress configuration. + + :ivar name: The publicIP address configuration name. Required. + :vartype name: str + :ivar properties: Describes a virtual machines IP Configuration's PublicIPAddress + configuration. + :vartype properties: + ~azure.mgmt.compute.models.VirtualMachinePublicIPAddressConfigurationProperties + :ivar sku: Describes the public IP Sku. It can only be set with OrchestrationMode as Flexible. + :vartype sku: ~azure.mgmt.compute.models.PublicIPAddressSku + :ivar tags: Resource tags applied to the publicIP address created by this + PublicIPAddressConfiguration. + :vartype tags: dict[str, str] + """ + + name: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The publicIP address configuration name. Required.""" + properties: Optional["_models.VirtualMachinePublicIPAddressConfigurationProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Describes a virtual machines IP Configuration's PublicIPAddress configuration.""" + sku: Optional["_models.PublicIPAddressSku"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Describes the public IP Sku. It can only be set with OrchestrationMode as Flexible.""" + tags: Optional[dict[str, str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Resource tags applied to the publicIP address created by this PublicIPAddressConfiguration.""" + + @overload + def __init__( + self, + *, + name: str, + properties: Optional["_models.VirtualMachinePublicIPAddressConfigurationProperties"] = None, + sku: Optional["_models.PublicIPAddressSku"] = None, + tags: Optional[dict[str, str]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class VirtualMachinePublicIPAddressConfigurationProperties(_Model): # pylint: disable=name-too-long + """Describes a virtual machines IP Configuration's PublicIPAddress configuration. + + :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. + Known values are: "Delete" and "Detach". + :vartype delete_option: str or ~azure.mgmt.compute.models.DeleteOptions + :ivar dns_settings: The dns settings to be applied on the publicIP addresses . + :vartype dns_settings: + ~azure.mgmt.compute.models.VirtualMachinePublicIPAddressDnsSettingsConfiguration + :ivar ip_tags: The list of IP tags associated with the public IP address. + :vartype ip_tags: list[~azure.mgmt.compute.models.VirtualMachineIpTag] + :ivar public_ip_prefix: The PublicIPPrefix from which to allocate publicIP addresses. + :vartype public_ip_prefix: ~azure.mgmt.compute.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'. Known values are: "IPv4" and "IPv6". + :vartype public_ip_address_version: str or ~azure.mgmt.compute.models.IPVersions + :ivar public_ip_allocation_method: Specify the public IP allocation type. Known values are: + "Dynamic" and "Static". + :vartype public_ip_allocation_method: str or + ~azure.mgmt.compute.models.PublicIPAllocationMethod + """ + + idle_timeout_in_minutes: Optional[int] = rest_field( + name="idleTimeoutInMinutes", visibility=["read", "create", "update", "delete", "query"] + ) + """The idle timeout of the public IP address.""" + delete_option: Optional[Union[str, "_models.DeleteOptions"]] = rest_field( + name="deleteOption", visibility=["read", "create", "update", "delete", "query"] + ) + """Specify what happens to the public IP address when the VM is deleted. Known values are: + \"Delete\" and \"Detach\".""" + dns_settings: Optional["_models.VirtualMachinePublicIPAddressDnsSettingsConfiguration"] = rest_field( + name="dnsSettings", visibility=["read", "create", "update", "delete", "query"] + ) + """The dns settings to be applied on the publicIP addresses .""" + ip_tags: Optional[list["_models.VirtualMachineIpTag"]] = rest_field( + name="ipTags", visibility=["read", "create", "update", "delete", "query"] + ) + """The list of IP tags associated with the public IP address.""" + public_ip_prefix: Optional["_models.SubResource"] = rest_field( + name="publicIPPrefix", visibility=["read", "create", "update", "delete", "query"] + ) + """The PublicIPPrefix from which to allocate publicIP addresses.""" + public_ip_address_version: Optional[Union[str, "_models.IPVersions"]] = rest_field( + name="publicIPAddressVersion", visibility=["read", "create", "update", "delete", "query"] + ) + """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'. Known values are: \"IPv4\" and \"IPv6\".""" + public_ip_allocation_method: Optional[Union[str, "_models.PublicIPAllocationMethod"]] = rest_field( + name="publicIPAllocationMethod", visibility=["read", "create", "update", "delete", "query"] + ) + """Specify the public IP allocation type. Known values are: \"Dynamic\" and \"Static\".""" + + @overload + def __init__( + self, + *, + idle_timeout_in_minutes: Optional[int] = None, + delete_option: Optional[Union[str, "_models.DeleteOptions"]] = None, + dns_settings: Optional["_models.VirtualMachinePublicIPAddressDnsSettingsConfiguration"] = None, + ip_tags: Optional[list["_models.VirtualMachineIpTag"]] = None, + public_ip_prefix: Optional["_models.SubResource"] = None, + public_ip_address_version: Optional[Union[str, "_models.IPVersions"]] = None, + public_ip_allocation_method: Optional[Union[str, "_models.PublicIPAllocationMethod"]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class VirtualMachinePublicIPAddressDnsSettingsConfiguration(_Model): # pylint: disable=name-too-long + """Describes a virtual machines network configuration's DNS settings. + + :ivar domain_name_label: 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. Required. + :vartype domain_name_label: str + :ivar domain_name_label_scope: The Domain name label scope of the PublicIPAddress resources + that will be created. The generated name label is the concatenation of the hashed domain name + label with policy according to the domain name label scope and vm network profile unique ID. + Known values are: "TenantReuse", "SubscriptionReuse", "ResourceGroupReuse", and "NoReuse". + :vartype domain_name_label_scope: str or ~azure.mgmt.compute.models.DomainNameLabelScopeTypes + """ + + domain_name_label: str = rest_field( + name="domainNameLabel", visibility=["read", "create", "update", "delete", "query"] + ) + """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. Required.""" + domain_name_label_scope: Optional[Union[str, "_models.DomainNameLabelScopeTypes"]] = rest_field( + name="domainNameLabelScope", visibility=["read", "create", "update", "delete", "query"] + ) + """The Domain name label scope of the PublicIPAddress resources that will be created. The + generated name label is the concatenation of the hashed domain name label with policy according + to the domain name label scope and vm network profile unique ID. Known values are: + \"TenantReuse\", \"SubscriptionReuse\", \"ResourceGroupReuse\", and \"NoReuse\".""" + + @overload + def __init__( + self, + *, + domain_name_label: str, + domain_name_label_scope: Optional[Union[str, "_models.DomainNameLabelScopeTypes"]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class VirtualMachineReimageParameters(_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 + :ivar exact_version: Specifies in decimal number, the version the OS disk should be reimaged + to. If exact version is not provided, the OS disk is reimaged to the existing version of OS + Disk. + :vartype exact_version: str + :ivar os_profile: Specifies information required for reimaging the non-ephemeral OS disk. + :vartype os_profile: ~azure.mgmt.compute.models.OSProfileProvisioningData + """ + + temp_disk: Optional[bool] = rest_field(name="tempDisk", visibility=["read", "create", "update", "delete", "query"]) + """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.""" + exact_version: Optional[str] = rest_field( + name="exactVersion", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies in decimal number, the version the OS disk should be reimaged to. If exact version is + not provided, the OS disk is reimaged to the existing version of OS Disk.""" + os_profile: Optional["_models.OSProfileProvisioningData"] = rest_field( + name="osProfile", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies information required for reimaging the non-ephemeral OS disk.""" + + @overload + def __init__( + self, + *, + temp_disk: Optional[bool] = None, + exact_version: Optional[str] = None, + os_profile: Optional["_models.OSProfileProvisioningData"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class VirtualMachineRunCommand(TrackedResource): + """Describes a Virtual Machine run command. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.compute.models.SystemData + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar location: The geo-location where the resource lives. Required. + :vartype location: str + :ivar properties: Describes the properties of a Virtual Machine run command. + :vartype properties: ~azure.mgmt.compute.models.VirtualMachineRunCommandProperties + """ + + properties: Optional["_models.VirtualMachineRunCommandProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Describes the properties of a Virtual Machine run command.""" + + @overload + def __init__( + self, + *, + location: str, + tags: Optional[dict[str, str]] = None, + properties: Optional["_models.VirtualMachineRunCommandProperties"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class VirtualMachineRunCommandInstanceView(_Model): + """The instance view of a virtual machine run command. + + :ivar execution_state: Script execution status. Known values are: "Unknown", "Pending", + "Running", "Failed", "Succeeded", "TimedOut", and "Canceled". + :vartype execution_state: str or ~azure.mgmt.compute.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.models.InstanceViewStatus] + """ + + execution_state: Optional[Union[str, "_models.ExecutionState"]] = rest_field( + name="executionState", visibility=["read", "create", "update", "delete", "query"] + ) + """Script execution status. Known values are: \"Unknown\", \"Pending\", \"Running\", \"Failed\", + \"Succeeded\", \"TimedOut\", and \"Canceled\".""" + execution_message: Optional[str] = rest_field( + name="executionMessage", visibility=["read", "create", "update", "delete", "query"] + ) + """Communicate script configuration errors or execution messages.""" + exit_code: Optional[int] = rest_field(name="exitCode", visibility=["read", "create", "update", "delete", "query"]) + """Exit code returned from script execution.""" + output: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Script output stream.""" + error: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Script error stream.""" + start_time: Optional[datetime.datetime] = rest_field( + name="startTime", visibility=["read", "create", "update", "delete", "query"], format="rfc3339" + ) + """Script start time.""" + end_time: Optional[datetime.datetime] = rest_field( + name="endTime", visibility=["read", "create", "update", "delete", "query"], format="rfc3339" + ) + """Script end time.""" + statuses: Optional[list["_models.InstanceViewStatus"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The resource status information.""" + + @overload + def __init__( + self, + *, + execution_state: Optional[Union[str, "_models.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["_models.InstanceViewStatus"]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class VirtualMachineRunCommandProperties(_Model): + """Describes the properties of a Virtual Machine run command. + + :ivar source: The source of the run command script. + :vartype source: ~azure.mgmt.compute.models.VirtualMachineRunCommandScriptSource + :ivar parameters: The parameters used by the script. + :vartype parameters: list[~azure.mgmt.compute.models.RunCommandInputParameter] + :ivar protected_parameters: The parameters used by the script. + :vartype protected_parameters: list[~azure.mgmt.compute.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. Use a SAS URI with read, append, create, write access OR use managed identity to + provide the VM access to the blob. Refer outputBlobManagedIdentity parameter. + :vartype output_blob_uri: str + :ivar error_blob_uri: Specifies the Azure storage blob where script error stream will be + uploaded. Use a SAS URI with read, append, create, write access OR use managed identity to + provide the VM access to the blob. Refer errorBlobManagedIdentity parameter. + :vartype error_blob_uri: str + :ivar output_blob_managed_identity: User-assigned managed identity that has access to + outputBlobUri storage blob. Use an empty object in case of system-assigned identity. Make sure + managed identity has been given access to blob's container with 'Storage Blob Data Contributor' + role assignment. In case of user-assigned identity, make sure you add it under VM's identity. + For more info on managed identity and Run Command, refer `https://aka.ms/ManagedIdentity + `_ and `https://aka.ms/RunCommandManaged + `_. + :vartype output_blob_managed_identity: ~azure.mgmt.compute.models.RunCommandManagedIdentity + :ivar error_blob_managed_identity: User-assigned managed identity that has access to + errorBlobUri storage blob. Use an empty object in case of system-assigned identity. Make sure + managed identity has been given access to blob's container with 'Storage Blob Data Contributor' + role assignment. In case of user-assigned identity, make sure you add it under VM's identity. + For more info on managed identity and Run Command, refer `https://aka.ms/ManagedIdentity + `_ and `https://aka.ms/RunCommandManaged + `_. + :vartype error_blob_managed_identity: ~azure.mgmt.compute.models.RunCommandManagedIdentity + :ivar provisioning_state: The provisioning state, which only appears in the response. If + treatFailureAsDeploymentFailure set to true, any failure in the script will fail the deployment + and ProvisioningState will be marked as Failed. If treatFailureAsDeploymentFailure set to + false, ProvisioningState would only reflect whether the run command was run or not by the + extensions platform, it would not indicate whether script failed in case of script failures. + See instance view of run command in case of script failures to see executionMessage, output, + error: `https://aka.ms/runcommandmanaged#get-execution-status-and-results + `_. + :vartype provisioning_state: str + :ivar instance_view: The virtual machine run command instance view. + :vartype instance_view: ~azure.mgmt.compute.models.VirtualMachineRunCommandInstanceView + :ivar treat_failure_as_deployment_failure: Optional. If set to true, any failure in the script + will fail the deployment and ProvisioningState will be marked as Failed. If set to false, + ProvisioningState would only reflect whether the run command was run or not by the extensions + platform, it would not indicate whether script failed in case of script failures. See instance + view of run command in case of script failures to see executionMessage, output, error: + `https://aka.ms/runcommandmanaged#get-execution-status-and-results + `_. + :vartype treat_failure_as_deployment_failure: bool + """ + + source: Optional["_models.VirtualMachineRunCommandScriptSource"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The source of the run command script.""" + parameters: Optional[list["_models.RunCommandInputParameter"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The parameters used by the script.""" + protected_parameters: Optional[list["_models.RunCommandInputParameter"]] = rest_field( + name="protectedParameters", visibility=["read", "create", "update", "delete", "query"] + ) + """The parameters used by the script.""" + async_execution: Optional[bool] = rest_field( + name="asyncExecution", visibility=["read", "create", "update", "delete", "query"] + ) + """Optional. If set to true, provisioning will complete as soon as the script starts and will not + wait for script to complete.""" + run_as_user: Optional[str] = rest_field( + name="runAsUser", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies the user account on the VM when executing the run command.""" + run_as_password: Optional[str] = rest_field( + name="runAsPassword", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies the user account password on the VM when executing the run command.""" + timeout_in_seconds: Optional[int] = rest_field( + name="timeoutInSeconds", visibility=["read", "create", "update", "delete", "query"] + ) + """The timeout in seconds to execute the run command.""" + output_blob_uri: Optional[str] = rest_field( + name="outputBlobUri", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies the Azure storage blob where script output stream will be uploaded. Use a SAS URI + with read, append, create, write access OR use managed identity to provide the VM access to the + blob. Refer outputBlobManagedIdentity parameter.""" + error_blob_uri: Optional[str] = rest_field( + name="errorBlobUri", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies the Azure storage blob where script error stream will be uploaded. Use a SAS URI with + read, append, create, write access OR use managed identity to provide the VM access to the + blob. Refer errorBlobManagedIdentity parameter.""" + output_blob_managed_identity: Optional["_models.RunCommandManagedIdentity"] = rest_field( + name="outputBlobManagedIdentity", visibility=["read", "create", "update", "delete", "query"] + ) + """User-assigned managed identity that has access to outputBlobUri storage blob. Use an empty + object in case of system-assigned identity. Make sure managed identity has been given access to + blob's container with 'Storage Blob Data Contributor' role assignment. In case of user-assigned + identity, make sure you add it under VM's identity. For more info on managed identity and Run + Command, refer `https://aka.ms/ManagedIdentity `_ and + `https://aka.ms/RunCommandManaged `_.""" + error_blob_managed_identity: Optional["_models.RunCommandManagedIdentity"] = rest_field( + name="errorBlobManagedIdentity", visibility=["read", "create", "update", "delete", "query"] + ) + """User-assigned managed identity that has access to errorBlobUri storage blob. Use an empty + object in case of system-assigned identity. Make sure managed identity has been given access to + blob's container with 'Storage Blob Data Contributor' role assignment. In case of user-assigned + identity, make sure you add it under VM's identity. For more info on managed identity and Run + Command, refer `https://aka.ms/ManagedIdentity `_ and + `https://aka.ms/RunCommandManaged `_.""" + provisioning_state: Optional[str] = rest_field(name="provisioningState", visibility=["read"]) + """The provisioning state, which only appears in the response. If treatFailureAsDeploymentFailure + set to true, any failure in the script will fail the deployment and ProvisioningState will be + marked as Failed. If treatFailureAsDeploymentFailure set to false, ProvisioningState would only + reflect whether the run command was run or not by the extensions platform, it would not + indicate whether script failed in case of script failures. See instance view of run command in + case of script failures to see executionMessage, output, error: + `https://aka.ms/runcommandmanaged#get-execution-status-and-results + `_.""" + instance_view: Optional["_models.VirtualMachineRunCommandInstanceView"] = rest_field( + name="instanceView", visibility=["read"] + ) + """The virtual machine run command instance view.""" + treat_failure_as_deployment_failure: Optional[bool] = rest_field( + name="treatFailureAsDeploymentFailure", visibility=["read", "create", "update", "delete", "query"] + ) + """Optional. If set to true, any failure in the script will fail the deployment and + ProvisioningState will be marked as Failed. If set to false, ProvisioningState would only + reflect whether the run command was run or not by the extensions platform, it would not + indicate whether script failed in case of script failures. See instance view of run command in + case of script failures to see executionMessage, output, error: + `https://aka.ms/runcommandmanaged#get-execution-status-and-results + `_.""" + + @overload + def __init__( + self, + *, + source: Optional["_models.VirtualMachineRunCommandScriptSource"] = None, + parameters: Optional[list["_models.RunCommandInputParameter"]] = None, + protected_parameters: Optional[list["_models.RunCommandInputParameter"]] = None, + async_execution: Optional[bool] = None, + 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, + output_blob_managed_identity: Optional["_models.RunCommandManagedIdentity"] = None, + error_blob_managed_identity: Optional["_models.RunCommandManagedIdentity"] = None, + treat_failure_as_deployment_failure: Optional[bool] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class VirtualMachineRunCommandScriptSource(_Model): + """Describes the script sources for run command. Use only one of these script sources: script, + scriptUri, commandId, galleryScriptReferenceId. + + :ivar script: Specifies the script content to be executed on the VM. + :vartype script: str + :ivar script_uri: Specifies the script download location. It can be either SAS URI of an Azure + storage blob with read access or public URI. + :vartype script_uri: str + :ivar command_id: Specifies a commandId of predefined built-in script. Command IDs available + for Linux are listed at `https://aka.ms/RunCommandManagedLinux#available-commands + `_, Windows at + `https://aka.ms/RunCommandManagedWindows#available-commands + `_. + :vartype command_id: str + :ivar script_uri_managed_identity: User-assigned managed identity that has access to scriptUri + in case of Azure storage blob. Use an empty object in case of system-assigned identity. Make + sure the Azure storage blob exists, and managed identity has been given access to blob's + container with 'Storage Blob Data Reader' role assignment. In case of user-assigned identity, + make sure you add it under VM's identity. For more info on managed identity and Run Command, + refer `https://aka.ms/ManagedIdentity `_ and + `https://aka.ms/RunCommandManaged `_. + :vartype script_uri_managed_identity: ~azure.mgmt.compute.models.RunCommandManagedIdentity + :ivar script_shell: Optional. Specify which shell to use for running the script. These values + must match those expected by the extension. Currently supported only for Windows VMs, script + uses Powershell 7 when specified. Powershell 7 must be already installed on the machine to use + Powershell7 parameter value. Known values are: "Default" and "Powershell7". + :vartype script_shell: str or ~azure.mgmt.compute.models.ScriptShellTypes + :ivar gallery_script_reference_id: The resource ID of a Gallery Script version that needs to be + executed. Example ID looks like + /subscriptions/{subId}/resourceGroups/{rgName}/providers/Microsoft.Compute/galleries/{galleryName}/scripts/{scriptName}/versions/{version}. + :vartype gallery_script_reference_id: str + """ + + script: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Specifies the script content to be executed on the VM.""" + script_uri: Optional[str] = rest_field(name="scriptUri", visibility=["read", "create", "update", "delete", "query"]) + """Specifies the script download location. It can be either SAS URI of an Azure storage blob with + read access or public URI.""" + command_id: Optional[str] = rest_field(name="commandId", visibility=["read", "create", "update", "delete", "query"]) + """Specifies a commandId of predefined built-in script. Command IDs available for Linux are listed + at `https://aka.ms/RunCommandManagedLinux#available-commands + `_, Windows at + `https://aka.ms/RunCommandManagedWindows#available-commands + `_.""" + script_uri_managed_identity: Optional["_models.RunCommandManagedIdentity"] = rest_field( + name="scriptUriManagedIdentity", visibility=["read", "create", "update", "delete", "query"] + ) + """User-assigned managed identity that has access to scriptUri in case of Azure storage blob. Use + an empty object in case of system-assigned identity. Make sure the Azure storage blob exists, + and managed identity has been given access to blob's container with 'Storage Blob Data Reader' + role assignment. In case of user-assigned identity, make sure you add it under VM's identity. + For more info on managed identity and Run Command, refer `https://aka.ms/ManagedIdentity + `_ and `https://aka.ms/RunCommandManaged + `_.""" + script_shell: Optional[Union[str, "_models.ScriptShellTypes"]] = rest_field( + name="scriptShell", visibility=["read", "create", "update", "delete", "query"] + ) + """Optional. Specify which shell to use for running the script. These values must match those + expected by the extension. Currently supported only for Windows VMs, script uses Powershell 7 + when specified. Powershell 7 must be already installed on the machine to use Powershell7 + parameter value. Known values are: \"Default\" and \"Powershell7\".""" + gallery_script_reference_id: Optional[str] = rest_field( + name="galleryScriptReferenceId", visibility=["read", "create", "update", "delete", "query"] + ) + """The resource ID of a Gallery Script version that needs to be executed. Example ID looks like + /subscriptions/{subId}/resourceGroups/{rgName}/providers/Microsoft.Compute/galleries/{galleryName}/scripts/{scriptName}/versions/{version}.""" + + @overload + def __init__( + self, + *, + script: Optional[str] = None, + script_uri: Optional[str] = None, + command_id: Optional[str] = None, + script_uri_managed_identity: Optional["_models.RunCommandManagedIdentity"] = None, + script_shell: Optional[Union[str, "_models.ScriptShellTypes"]] = None, + gallery_script_reference_id: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class VirtualMachineRunCommandUpdate(UpdateResource): + """Describes a Virtual Machine run command. + + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar properties: Describes the properties of a Virtual Machine run command. + :vartype properties: ~azure.mgmt.compute.models.VirtualMachineRunCommandProperties + """ + + properties: Optional["_models.VirtualMachineRunCommandProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Describes the properties of a Virtual Machine run command.""" + + @overload + def __init__( + self, + *, + tags: Optional[dict[str, str]] = None, + properties: Optional["_models.VirtualMachineRunCommandProperties"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class VirtualMachineScaleSet(TrackedResource): + """Describes a Virtual Machine Scale Set. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.compute.models.SystemData + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar location: The geo-location where the resource lives. Required. + :vartype location: str + :ivar sku: The virtual machine scale set sku. + :vartype sku: ~azure.mgmt.compute.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.models.Plan + :ivar properties: Describes the properties of a Virtual Machine Scale Set. + :vartype properties: ~azure.mgmt.compute.models.VirtualMachineScaleSetProperties + :ivar identity: The identity of the virtual machine scale set, if configured. + :vartype identity: ~azure.mgmt.compute.models.VirtualMachineScaleSetIdentity + :ivar zones: The availability zones. + :vartype zones: list[str] + :ivar extended_location: The extended location of the Virtual Machine Scale Set. + :vartype extended_location: ~azure.mgmt.compute.models.ExtendedLocation + :ivar etag: Etag is property returned in Create/Update/Get response of the VMSS, so that + customer can supply it in the header to ensure optimistic updates. + :vartype etag: str + :ivar placement: Placement section specifies the user-defined constraints for virtual machine + scale set hardware placement. This property cannot be changed once VMSS is provisioned. Minimum + api-version: 2025-04-01. + :vartype placement: ~azure.mgmt.compute.models.Placement + """ + + sku: Optional["_models.Sku"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The virtual machine scale set sku.""" + plan: Optional["_models.Plan"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """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**.""" + properties: Optional["_models.VirtualMachineScaleSetProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Describes the properties of a Virtual Machine Scale Set.""" + identity: Optional["_models.VirtualMachineScaleSetIdentity"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The identity of the virtual machine scale set, if configured.""" + zones: Optional[list[str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The availability zones.""" + extended_location: Optional["_models.ExtendedLocation"] = rest_field( + name="extendedLocation", visibility=["read", "create", "update", "delete", "query"] + ) + """The extended location of the Virtual Machine Scale Set.""" + etag: Optional[str] = rest_field(visibility=["read"]) + """Etag is property returned in Create/Update/Get response of the VMSS, so that customer can + supply it in the header to ensure optimistic updates.""" + placement: Optional["_models.Placement"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Placement section specifies the user-defined constraints for virtual machine scale set hardware + placement. This property cannot be changed once VMSS is provisioned. Minimum api-version: + 2025-04-01.""" + + @overload + def __init__( + self, + *, + location: str, + tags: Optional[dict[str, str]] = None, + sku: Optional["_models.Sku"] = None, + plan: Optional["_models.Plan"] = None, + properties: Optional["_models.VirtualMachineScaleSetProperties"] = None, + identity: Optional["_models.VirtualMachineScaleSetIdentity"] = None, + zones: Optional[list[str]] = None, + extended_location: Optional["_models.ExtendedLocation"] = None, + placement: Optional["_models.Placement"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class VirtualMachineScaleSetDataDisk(_Model): + """Describes a virtual machine scale set data disk. + + :ivar name: The disk name. + :vartype name: str + :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. + Required. + :vartype lun: int + :ivar caching: Specifies the caching requirements. Possible values are: **None,** **ReadOnly,** + **ReadWrite.** The default values are: **None for Standard storage. ReadOnly for Premium + storage.**. Known values are: "None", "ReadOnly", and "ReadWrite". + :vartype caching: str or ~azure.mgmt.compute.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: The create option. Required. Known values are: "FromImage", "Empty", + "Attach", "Copy", and "Restore". + :vartype create_option: str or ~azure.mgmt.compute.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. The property diskSizeGB is + the number of bytes x 1024^3 for the disk and the value cannot be larger than 1023. + :vartype disk_size_gb: int + :ivar managed_disk: The managed disk parameters. + :vartype managed_disk: ~azure.mgmt.compute.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: int + :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: int + :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).

+ Possible values:

**Delete** If this value is used, the data disk is deleted when the + VMSS Flex VM is deleted.

**Detach** If this value is used, the data disk is retained + after VMSS Flex VM is deleted.

The default value is set to **Delete**. Known values + are: "Delete" and "Detach". + :vartype delete_option: str or ~azure.mgmt.compute.models.DiskDeleteOptionTypes + """ + + name: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The disk name.""" + lun: int = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """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. Required.""" + caching: Optional[Union[str, "_models.CachingTypes"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies the caching requirements. Possible values are: **None,** **ReadOnly,** **ReadWrite.** + The default values are: **None for Standard storage. ReadOnly for Premium storage.**. Known + values are: \"None\", \"ReadOnly\", and \"ReadWrite\".""" + write_accelerator_enabled: Optional[bool] = rest_field( + name="writeAcceleratorEnabled", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies whether writeAccelerator should be enabled or disabled on the disk.""" + create_option: Union[str, "_models.DiskCreateOptionTypes"] = rest_field( + name="createOption", visibility=["read", "create", "update", "delete", "query"] + ) + """The create option. Required. Known values are: \"FromImage\", \"Empty\", \"Attach\", \"Copy\", + and \"Restore\".""" + disk_size_gb: Optional[int] = rest_field( + name="diskSizeGB", visibility=["read", "create", "update", "delete", "query"] + ) + """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. The property diskSizeGB is the number of bytes + x 1024^3 for the disk and the value cannot be larger than 1023.""" + managed_disk: Optional["_models.VirtualMachineScaleSetManagedDiskParameters"] = rest_field( + name="managedDisk", visibility=["read", "create", "update", "delete", "query"] + ) + """The managed disk parameters.""" + disk_iops_read_write: Optional[int] = rest_field( + name="diskIOPSReadWrite", visibility=["read", "create", "update", "delete", "query"] + ) + """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.""" + disk_m_bps_read_write: Optional[int] = rest_field( + name="diskMBpsReadWrite", visibility=["read", "create", "update", "delete", "query"] + ) + """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.""" + delete_option: Optional[Union[str, "_models.DiskDeleteOptionTypes"]] = rest_field( + name="deleteOption", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies whether data disk should be deleted or detached upon VMSS Flex deletion (This feature + is available for VMSS with Flexible OrchestrationMode only).

Possible values:

+ **Delete** If this value is used, the data disk is deleted when the VMSS Flex VM is + deleted.

**Detach** If this value is used, the data disk is retained after VMSS Flex VM + is deleted.

The default value is set to **Delete**. Known values are: \"Delete\" and + \"Detach\".""" + + @overload + def __init__( + self, + *, + lun: int, + create_option: Union[str, "_models.DiskCreateOptionTypes"], + name: Optional[str] = None, + caching: Optional[Union[str, "_models.CachingTypes"]] = None, + write_accelerator_enabled: Optional[bool] = None, + disk_size_gb: Optional[int] = None, + managed_disk: Optional["_models.VirtualMachineScaleSetManagedDiskParameters"] = None, + disk_iops_read_write: Optional[int] = None, + disk_m_bps_read_write: Optional[int] = None, + delete_option: Optional[Union[str, "_models.DiskDeleteOptionTypes"]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class VirtualMachineScaleSetExtension(SubResourceReadOnly): + """Describes a Virtual Machine Scale Set Extension. + + :ivar id: Resource Id. + :vartype id: str + :ivar properties: Describes the properties of a Virtual Machine Scale Set Extension. + :vartype properties: ~azure.mgmt.compute.models.VirtualMachineScaleSetExtensionProperties + :ivar vm_type: Resource type. + :vartype vm_type: str + :ivar name: Resource name. + :vartype name: str + """ + + properties: Optional["_models.VirtualMachineScaleSetExtensionProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Describes the properties of a Virtual Machine Scale Set Extension.""" + vm_type: Optional[str] = rest_field(name="type", visibility=["read"]) + """Resource type.""" + name: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Resource name.""" + + @overload + def __init__( + self, + *, + properties: Optional["_models.VirtualMachineScaleSetExtensionProperties"] = None, + name: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class VirtualMachineScaleSetExtensionProfile(_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.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). Minimum api-version: 2020-06-01. + :vartype extensions_time_budget: str + """ + + extensions: Optional[list["_models.VirtualMachineScaleSetExtension"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The virtual machine scale set child extension resources.""" + extensions_time_budget: Optional[str] = rest_field( + name="extensionsTimeBudget", visibility=["read", "create", "update", "delete", "query"] + ) + """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). Minimum api-version: 2020-06-01.""" + + @overload + def __init__( + self, + *, + extensions: Optional[list["_models.VirtualMachineScaleSetExtension"]] = None, + extensions_time_budget: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class VirtualMachineScaleSetExtensionProperties(_Model): # pylint: disable=name-too-long + """Describes the properties of a Virtual Machine Scale Set Extension. + + :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: 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 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: ~azure.mgmt.compute.models.KeyVaultSecretReference + """ + + force_update_tag: Optional[str] = rest_field( + name="forceUpdateTag", visibility=["read", "create", "update", "delete", "query"] + ) + """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.""" + publisher: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The name of the extension handler publisher.""" + type: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Specifies the type of the extension; an example is \"CustomScriptExtension\".""" + type_handler_version: Optional[str] = rest_field( + name="typeHandlerVersion", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies the version of the script handler.""" + auto_upgrade_minor_version: Optional[bool] = rest_field( + name="autoUpgradeMinorVersion", visibility=["read", "create", "update", "delete", "query"] + ) + """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.""" + enable_automatic_upgrade: Optional[bool] = rest_field( + name="enableAutomaticUpgrade", visibility=["read", "create", "update", "delete", "query"] + ) + """Indicates whether the extension should be automatically upgraded by the platform if there is a + newer version of the extension available.""" + settings: Optional[Any] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Json formatted public settings for the extension.""" + protected_settings: Optional[Any] = rest_field( + name="protectedSettings", visibility=["read", "create", "update", "delete", "query"] + ) + """The extension can contain either protectedSettings or protectedSettingsFromKeyVault or no + protected settings at all.""" + provisioning_state: Optional[str] = rest_field(name="provisioningState", visibility=["read"]) + """The provisioning state, which only appears in the response.""" + provision_after_extensions: Optional[list[str]] = rest_field( + name="provisionAfterExtensions", visibility=["read", "create", "update", "delete", "query"] + ) + """Collection of extension names after which this extension needs to be provisioned.""" + suppress_failures: Optional[bool] = rest_field( + name="suppressFailures", visibility=["read", "create", "update", "delete", "query"] + ) + """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.""" + protected_settings_from_key_vault: Optional["_models.KeyVaultSecretReference"] = rest_field( + name="protectedSettingsFromKeyVault", visibility=["read", "create", "update", "delete", "query"] + ) + """The extensions protected settings that are passed by reference, and consumed from key vault.""" + + @overload + def __init__( + self, + *, + 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, + provision_after_extensions: Optional[list[str]] = None, + suppress_failures: Optional[bool] = None, + protected_settings_from_key_vault: Optional["_models.KeyVaultSecretReference"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class VirtualMachineScaleSetExtensionUpdate(SubResourceReadOnly): + """Describes a Virtual Machine Scale Set Extension. + + :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 properties: Describes the properties of a Virtual Machine Scale Set Extension. + :vartype properties: ~azure.mgmt.compute.models.VirtualMachineScaleSetExtensionProperties + """ + + name: Optional[str] = rest_field(visibility=["read"]) + """The name of the extension.""" + type: Optional[str] = rest_field(visibility=["read"]) + """Resource type.""" + properties: Optional["_models.VirtualMachineScaleSetExtensionProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Describes the properties of a Virtual Machine Scale Set Extension.""" + + @overload + def __init__( + self, + *, + properties: Optional["_models.VirtualMachineScaleSetExtensionProperties"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class VirtualMachineScaleSetHardwareProfile(_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: 2021-11-01. Please follow the instructions in `VM Customization + `_ for more details. + :vartype vm_size_properties: ~azure.mgmt.compute.models.VMSizeProperties + """ + + vm_size_properties: Optional["_models.VMSizeProperties"] = rest_field( + name="vmSizeProperties", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies the properties for customizing the size of the virtual machine. Minimum api-version: + 2021-11-01. Please follow the instructions in `VM Customization + `_ for more details.""" + + @overload + def __init__( + self, + *, + vm_size_properties: Optional["_models.VMSizeProperties"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class VirtualMachineScaleSetIdentity(_Model): + """Identity for the virtual machine scale set. + + :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. Known values are: "SystemAssigned", "UserAssigned", "SystemAssigned, UserAssigned", and + "None". + :vartype type: str or ~azure.mgmt.compute.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.models.UserAssignedIdentitiesValue] + """ + + principal_id: Optional[str] = rest_field(name="principalId", visibility=["read"]) + """The principal id of virtual machine scale set identity. This property will only be provided for + a system assigned identity.""" + tenant_id: Optional[str] = rest_field(name="tenantId", visibility=["read"]) + """The tenant id associated with the virtual machine scale set. This property will only be + provided for a system assigned identity.""" + type: Optional[Union[str, "_models.ResourceIdentityType"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """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. + Known values are: \"SystemAssigned\", \"UserAssigned\", \"SystemAssigned, UserAssigned\", and + \"None\".""" + user_assigned_identities: Optional[dict[str, "_models.UserAssignedIdentitiesValue"]] = rest_field( + name="userAssignedIdentities", visibility=["read", "create", "update", "delete", "query"] + ) + """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}'.""" + + @overload + def __init__( + self, + *, + type: Optional[Union[str, "_models.ResourceIdentityType"]] = None, + user_assigned_identities: Optional[dict[str, "_models.UserAssignedIdentitiesValue"]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class VirtualMachineScaleSetInstanceView(_Model): + """The instance view of a virtual machine scale set. + + :ivar virtual_machine: The instance view status summary for the virtual machine scale set. + :vartype virtual_machine: + ~azure.mgmt.compute.models.VirtualMachineScaleSetInstanceViewStatusesSummary + :ivar extensions: The extensions information. + :vartype extensions: list[~azure.mgmt.compute.models.VirtualMachineScaleSetVMExtensionsSummary] + :ivar statuses: The resource status information. + :vartype statuses: list[~azure.mgmt.compute.models.InstanceViewStatus] + :ivar orchestration_services: The orchestration services information. + :vartype orchestration_services: list[~azure.mgmt.compute.models.OrchestrationServiceSummary] + """ + + virtual_machine: Optional["_models.VirtualMachineScaleSetInstanceViewStatusesSummary"] = rest_field( + name="virtualMachine", visibility=["read"] + ) + """The instance view status summary for the virtual machine scale set.""" + extensions: Optional[list["_models.VirtualMachineScaleSetVMExtensionsSummary"]] = rest_field(visibility=["read"]) + """The extensions information.""" + statuses: Optional[list["_models.InstanceViewStatus"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The resource status information.""" + orchestration_services: Optional[list["_models.OrchestrationServiceSummary"]] = rest_field( + name="orchestrationServices", visibility=["read"] + ) + """The orchestration services information.""" + + @overload + def __init__( + self, + *, + statuses: Optional[list["_models.InstanceViewStatus"]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class VirtualMachineScaleSetInstanceViewStatusesSummary(_Model): # pylint: disable=name-too-long + """Instance view statuses summary for virtual machines of a virtual machine scale set. + + :ivar statuses_summary: The extensions information. + :vartype statuses_summary: list[~azure.mgmt.compute.models.VirtualMachineStatusCodeCount] + """ + + statuses_summary: Optional[list["_models.VirtualMachineStatusCodeCount"]] = rest_field( + name="statusesSummary", visibility=["read"] + ) + """The extensions information.""" + + +class VirtualMachineScaleSetIPConfiguration(_Model): + """Describes a virtual machine scale set network profile's IP configuration. + + :ivar name: The IP configuration name. Required. + :vartype name: str + :ivar properties: Describes a virtual machine scale set network profile's IP configuration + properties. + :vartype properties: ~azure.mgmt.compute.models.VirtualMachineScaleSetIPConfigurationProperties + """ + + name: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The IP configuration name. Required.""" + properties: Optional["_models.VirtualMachineScaleSetIPConfigurationProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Describes a virtual machine scale set network profile's IP configuration properties.""" + + @overload + def __init__( + self, + *, + name: str, + properties: Optional["_models.VirtualMachineScaleSetIPConfigurationProperties"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class VirtualMachineScaleSetIPConfigurationProperties(_Model): # pylint: disable=name-too-long + """Describes a virtual machine scale set network profile's IP configuration properties. + + :ivar subnet: Specifies the identifier of the subnet. + :vartype subnet: ~azure.mgmt.compute.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.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'. Known values are: "IPv4" and "IPv6". + :vartype private_ip_address_version: str or ~azure.mgmt.compute.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.models.SubResource] + :ivar application_security_groups: Specifies an array of references to application security + group. + :vartype application_security_groups: list[~azure.mgmt.compute.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.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.models.SubResource] + """ + + subnet: Optional["_models.ApiEntityReference"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies the identifier of the subnet.""" + primary: Optional[bool] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Specifies the primary network interface in case the virtual machine has more than 1 network + interface.""" + public_ip_address_configuration: Optional["_models.VirtualMachineScaleSetPublicIPAddressConfiguration"] = ( + rest_field(name="publicIPAddressConfiguration", visibility=["read", "create", "update", "delete", "query"]) + ) + """The publicIPAddressConfiguration.""" + private_ip_address_version: Optional[Union[str, "_models.IPVersion"]] = rest_field( + name="privateIPAddressVersion", visibility=["read", "create", "update", "delete", "query"] + ) + """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'. Known values are: \"IPv4\" and \"IPv6\".""" + application_gateway_backend_address_pools: Optional[list["_models.SubResource"]] = rest_field( + name="applicationGatewayBackendAddressPools", visibility=["read", "create", "update", "delete", "query"] + ) + """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.""" + application_security_groups: Optional[list["_models.SubResource"]] = rest_field( + name="applicationSecurityGroups", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies an array of references to application security group.""" + load_balancer_backend_address_pools: Optional[list["_models.SubResource"]] = rest_field( + name="loadBalancerBackendAddressPools", visibility=["read", "create", "update", "delete", "query"] + ) + """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.""" + load_balancer_inbound_nat_pools: Optional[list["_models.SubResource"]] = rest_field( + name="loadBalancerInboundNatPools", visibility=["read", "create", "update", "delete", "query"] + ) + """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.""" + + @overload + def __init__( + self, + *, + subnet: Optional["_models.ApiEntityReference"] = None, + primary: Optional[bool] = None, + public_ip_address_configuration: Optional["_models.VirtualMachineScaleSetPublicIPAddressConfiguration"] = None, + private_ip_address_version: Optional[Union[str, "_models.IPVersion"]] = None, + application_gateway_backend_address_pools: Optional[list["_models.SubResource"]] = None, + application_security_groups: Optional[list["_models.SubResource"]] = None, + load_balancer_backend_address_pools: Optional[list["_models.SubResource"]] = None, + load_balancer_inbound_nat_pools: Optional[list["_models.SubResource"]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class VirtualMachineScaleSetIpTag(_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 + """ + + ip_tag_type: Optional[str] = rest_field( + name="ipTagType", visibility=["read", "create", "update", "delete", "query"] + ) + """IP tag type. Example: FirstPartyUsage.""" + tag: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """IP tag associated with the public IP. Example: SQL, Storage etc.""" + + @overload + def __init__( + self, + *, + ip_tag_type: Optional[str] = None, + tag: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class VirtualMachineScaleSetManagedDiskParameters(_Model): # pylint: disable=name-too-long + """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. Known values + are: "Standard_LRS", "Premium_LRS", "StandardSSD_LRS", "UltraSSD_LRS", "Premium_ZRS", + "StandardSSD_ZRS", and "PremiumV2_LRS". + :vartype storage_account_type: str or ~azure.mgmt.compute.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.models.DiskEncryptionSetParameters + :ivar security_profile: Specifies the security profile for the managed disk. + :vartype security_profile: ~azure.mgmt.compute.models.VMDiskSecurityProfile + """ + + storage_account_type: Optional[Union[str, "_models.StorageAccountTypes"]] = rest_field( + name="storageAccountType", visibility=["read", "create", "update", "delete", "query"] + ) + """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. Known values are: \"Standard_LRS\", + \"Premium_LRS\", \"StandardSSD_LRS\", \"UltraSSD_LRS\", \"Premium_ZRS\", \"StandardSSD_ZRS\", + and \"PremiumV2_LRS\".""" + disk_encryption_set: Optional["_models.DiskEncryptionSetParameters"] = rest_field( + name="diskEncryptionSet", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies the customer managed disk encryption set resource id for the managed disk.""" + security_profile: Optional["_models.VMDiskSecurityProfile"] = rest_field( + name="securityProfile", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies the security profile for the managed disk.""" + + @overload + def __init__( + self, + *, + storage_account_type: Optional[Union[str, "_models.StorageAccountTypes"]] = None, + disk_encryption_set: Optional["_models.DiskEncryptionSetParameters"] = None, + security_profile: Optional["_models.VMDiskSecurityProfile"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class VirtualMachineScaleSetMigrationInfo(_Model): + """Describes the Availability Set properties related to migration to Flexible Virtual Machine + Scale Set. + + :ivar default_virtual_machine_scale_set_info: Indicates the target Virtual Machine ScaleSet + properties upon triggering a seamless migration without downtime of the VMs via the + ConvertToVirtualMachineScaleSet API. + :vartype default_virtual_machine_scale_set_info: + ~azure.mgmt.compute.models.DefaultVirtualMachineScaleSetInfo + :ivar migrate_to_virtual_machine_scale_set: Specifies the Virtual Machine Scale Set that the + Availability Set is migrated to. + :vartype migrate_to_virtual_machine_scale_set: ~azure.mgmt.compute.models.SubResource + """ + + default_virtual_machine_scale_set_info: Optional["_models.DefaultVirtualMachineScaleSetInfo"] = rest_field( + name="defaultVirtualMachineScaleSetInfo", visibility=["read"] + ) + """Indicates the target Virtual Machine ScaleSet properties upon triggering a seamless migration + without downtime of the VMs via the ConvertToVirtualMachineScaleSet API.""" + migrate_to_virtual_machine_scale_set: Optional["_models.SubResource"] = rest_field( + name="migrateToVirtualMachineScaleSet", visibility=["read"] + ) + """Specifies the Virtual Machine Scale Set that the Availability Set is migrated to.""" + + +class VirtualMachineScaleSetNetworkConfiguration(_Model): # pylint: disable=name-too-long + """Describes a virtual machine scale set network profile's network configurations. + + :ivar name: The network configuration name. Required. + :vartype name: str + :ivar properties: Describes a virtual machine scale set network profile's IP configuration. + :vartype properties: + ~azure.mgmt.compute.models.VirtualMachineScaleSetNetworkConfigurationProperties + :ivar tags: Resource tags applied to the networkInterface address created by this + NetworkInterfaceConfiguration. + :vartype tags: dict[str, str] + """ + + name: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The network configuration name. Required.""" + properties: Optional["_models.VirtualMachineScaleSetNetworkConfigurationProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Describes a virtual machine scale set network profile's IP configuration.""" + tags: Optional[dict[str, str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Resource tags applied to the networkInterface address created by this + NetworkInterfaceConfiguration.""" + + @overload + def __init__( + self, + *, + name: str, + properties: Optional["_models.VirtualMachineScaleSetNetworkConfigurationProperties"] = None, + tags: Optional[dict[str, str]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class VirtualMachineScaleSetNetworkConfigurationDnsSettings(_Model): # pylint: disable=name-too-long + """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] + """ + + dns_servers: Optional[list[str]] = rest_field( + name="dnsServers", visibility=["read", "create", "update", "delete", "query"] + ) + """List of DNS servers IP addresses.""" + + @overload + def __init__( + self, + *, + dns_servers: Optional[list[str]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class VirtualMachineScaleSetNetworkConfigurationProperties(_Model): # pylint: disable=name-too-long + """Describes a virtual machine scale set network profile's IP configuration. + + :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 disable_tcp_state_tracking: Specifies whether the network interface is disabled for tcp + state tracking. + :vartype disable_tcp_state_tracking: 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.models.SubResource + :ivar dns_settings: The dns settings to be applied on the network interfaces. + :vartype dns_settings: + ~azure.mgmt.compute.models.VirtualMachineScaleSetNetworkConfigurationDnsSettings + :ivar ip_configurations: Specifies the IP configurations of the network interface. Required. + :vartype ip_configurations: + list[~azure.mgmt.compute.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. + Known values are: "Delete" and "Detach". + :vartype delete_option: str or ~azure.mgmt.compute.models.DeleteOptions + :ivar auxiliary_mode: Specifies whether the Auxiliary mode is enabled for the Network Interface + resource. Known values are: "None", "AcceleratedConnections", and "Floating". + :vartype auxiliary_mode: str or ~azure.mgmt.compute.models.NetworkInterfaceAuxiliaryMode + :ivar auxiliary_sku: Specifies whether the Auxiliary sku is enabled for the Network Interface + resource. Known values are: "None", "A1", "A2", "A4", and "A8". + :vartype auxiliary_sku: str or ~azure.mgmt.compute.models.NetworkInterfaceAuxiliarySku + """ + + primary: Optional[bool] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Specifies the primary network interface in case the virtual machine has more than 1 network + interface.""" + enable_accelerated_networking: Optional[bool] = rest_field( + name="enableAcceleratedNetworking", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies whether the network interface is accelerated networking-enabled.""" + disable_tcp_state_tracking: Optional[bool] = rest_field( + name="disableTcpStateTracking", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies whether the network interface is disabled for tcp state tracking.""" + enable_fpga: Optional[bool] = rest_field( + name="enableFpga", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies whether the network interface is FPGA networking-enabled.""" + network_security_group: Optional["_models.SubResource"] = rest_field( + name="networkSecurityGroup", visibility=["read", "create", "update", "delete", "query"] + ) + """The network security group.""" + dns_settings: Optional["_models.VirtualMachineScaleSetNetworkConfigurationDnsSettings"] = rest_field( + name="dnsSettings", visibility=["read", "create", "update", "delete", "query"] + ) + """The dns settings to be applied on the network interfaces.""" + ip_configurations: list["_models.VirtualMachineScaleSetIPConfiguration"] = rest_field( + name="ipConfigurations", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies the IP configurations of the network interface. Required.""" + enable_ip_forwarding: Optional[bool] = rest_field( + name="enableIPForwarding", visibility=["read", "create", "update", "delete", "query"] + ) + """Whether IP forwarding enabled on this NIC.""" + delete_option: Optional[Union[str, "_models.DeleteOptions"]] = rest_field( + name="deleteOption", visibility=["read", "create", "update", "delete", "query"] + ) + """Specify what happens to the network interface when the VM is deleted. Known values are: + \"Delete\" and \"Detach\".""" + auxiliary_mode: Optional[Union[str, "_models.NetworkInterfaceAuxiliaryMode"]] = rest_field( + name="auxiliaryMode", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies whether the Auxiliary mode is enabled for the Network Interface resource. Known + values are: \"None\", \"AcceleratedConnections\", and \"Floating\".""" + auxiliary_sku: Optional[Union[str, "_models.NetworkInterfaceAuxiliarySku"]] = rest_field( + name="auxiliarySku", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies whether the Auxiliary sku is enabled for the Network Interface resource. Known values + are: \"None\", \"A1\", \"A2\", \"A4\", and \"A8\".""" + + @overload + def __init__( + self, + *, + ip_configurations: list["_models.VirtualMachineScaleSetIPConfiguration"], + primary: Optional[bool] = None, + enable_accelerated_networking: Optional[bool] = None, + disable_tcp_state_tracking: Optional[bool] = None, + enable_fpga: Optional[bool] = None, + network_security_group: Optional["_models.SubResource"] = None, + dns_settings: Optional["_models.VirtualMachineScaleSetNetworkConfigurationDnsSettings"] = None, + enable_ip_forwarding: Optional[bool] = None, + delete_option: Optional[Union[str, "_models.DeleteOptions"]] = None, + auxiliary_mode: Optional[Union[str, "_models.NetworkInterfaceAuxiliaryMode"]] = None, + auxiliary_sku: Optional[Union[str, "_models.NetworkInterfaceAuxiliarySku"]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class VirtualMachineScaleSetNetworkProfile(_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.models.ApiEntityReference + :ivar network_interface_configurations: The list of network configurations. + :vartype network_interface_configurations: + list[~azure.mgmt.compute.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'. Known values are: "2020-11-01" and "2022-11-01". + :vartype network_api_version: str or ~azure.mgmt.compute.models.NetworkApiVersion + """ + + health_probe: Optional["_models.ApiEntityReference"] = rest_field( + name="healthProbe", visibility=["read", "create", "update", "delete", "query"] + ) + """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}'.""" + network_interface_configurations: Optional[list["_models.VirtualMachineScaleSetNetworkConfiguration"]] = rest_field( + name="networkInterfaceConfigurations", visibility=["read", "create", "update", "delete", "query"] + ) + """The list of network configurations.""" + network_api_version: Optional[Union[str, "_models.NetworkApiVersion"]] = rest_field( + name="networkApiVersion", visibility=["read", "create", "update", "delete", "query"] + ) + """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'. Known values are: \"2020-11-01\" and \"2022-11-01\".""" + + @overload + def __init__( + self, + *, + health_probe: Optional["_models.ApiEntityReference"] = None, + network_interface_configurations: Optional[list["_models.VirtualMachineScaleSetNetworkConfiguration"]] = None, + network_api_version: Optional[Union[str, "_models.NetworkApiVersion"]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class VirtualMachineScaleSetOSDisk(_Model): + """Describes a virtual machine scale set operating system disk. + + :ivar name: The disk name. + :vartype name: str + :ivar caching: Specifies the caching requirements. Possible values are: **None,** **ReadOnly,** + **ReadWrite.** The default values are: **None for Standard storage. ReadOnly for Premium + storage.**. Known values are: "None", "ReadOnly", and "ReadWrite". + :vartype caching: str or ~azure.mgmt.compute.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: Specifies how the virtual machines in the scale set should be created. The + only allowed value is: **FromImage.** 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. Required. Known values are: "FromImage", "Empty", "Attach", "Copy", and + "Restore". + :vartype create_option: str or ~azure.mgmt.compute.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.models.DiffDiskSettings + :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. The property 'diskSizeGB' is + the number of bytes x 1024^3 for the disk and the value cannot be larger than 1023. + :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. Possible values are: **Windows,** + **Linux.**. Known values are: "Windows" and "Linux". + :vartype os_type: str or ~azure.mgmt.compute.models.OperatingSystemTypes + :ivar image: Specifies information about the unmanaged user image to base the scale set on. + :vartype image: ~azure.mgmt.compute.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.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).

+ Possible values:

**Delete** If this value is used, the OS disk is deleted when VMSS + Flex VM is deleted.

**Detach** If this value is used, the OS disk is retained after + VMSS Flex VM is deleted.

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. Known values are: "Delete" and "Detach". + :vartype delete_option: str or ~azure.mgmt.compute.models.DiskDeleteOptionTypes + """ + + name: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The disk name.""" + caching: Optional[Union[str, "_models.CachingTypes"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies the caching requirements. Possible values are: **None,** **ReadOnly,** **ReadWrite.** + The default values are: **None for Standard storage. ReadOnly for Premium storage.**. Known + values are: \"None\", \"ReadOnly\", and \"ReadWrite\".""" + write_accelerator_enabled: Optional[bool] = rest_field( + name="writeAcceleratorEnabled", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies whether writeAccelerator should be enabled or disabled on the disk.""" + create_option: Union[str, "_models.DiskCreateOptionTypes"] = rest_field( + name="createOption", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies how the virtual machines in the scale set should be created. The only allowed value + is: **FromImage.** 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. Required. Known values are: \"FromImage\", \"Empty\", \"Attach\", \"Copy\", and + \"Restore\".""" + diff_disk_settings: Optional["_models.DiffDiskSettings"] = rest_field( + name="diffDiskSettings", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies the ephemeral disk Settings for the operating system disk used by the virtual machine + scale set.""" + disk_size_gb: Optional[int] = rest_field( + name="diskSizeGB", visibility=["read", "create", "update", "delete", "query"] + ) + """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. The property 'diskSizeGB' is the number of + bytes x 1024^3 for the disk and the value cannot be larger than 1023.""" + os_type: Optional[Union[str, "_models.OperatingSystemTypes"]] = rest_field( + name="osType", visibility=["read", "create", "update", "delete", "query"] + ) + """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. Possible values are: **Windows,** **Linux.**. Known + values are: \"Windows\" and \"Linux\".""" + image: Optional["_models.VirtualHardDisk"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Specifies information about the unmanaged user image to base the scale set on.""" + vhd_containers: Optional[list[str]] = rest_field( + name="vhdContainers", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies the container urls that are used to store operating system disks for the scale set.""" + managed_disk: Optional["_models.VirtualMachineScaleSetManagedDiskParameters"] = rest_field( + name="managedDisk", visibility=["read", "create", "update", "delete", "query"] + ) + """The managed disk parameters.""" + delete_option: Optional[Union[str, "_models.DiskDeleteOptionTypes"]] = rest_field( + name="deleteOption", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies whether OS Disk should be deleted or detached upon VMSS Flex deletion (This feature + is available for VMSS with Flexible OrchestrationMode only).

Possible values:

+ **Delete** If this value is used, the OS disk is deleted when VMSS Flex VM is deleted.

+ **Detach** If this value is used, the OS disk is retained after VMSS Flex VM is deleted. +

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. Known values + are: \"Delete\" and \"Detach\".""" + + @overload + def __init__( + self, + *, + create_option: Union[str, "_models.DiskCreateOptionTypes"], + name: Optional[str] = None, + caching: Optional[Union[str, "_models.CachingTypes"]] = None, + write_accelerator_enabled: Optional[bool] = None, + diff_disk_settings: Optional["_models.DiffDiskSettings"] = None, + disk_size_gb: Optional[int] = None, + os_type: Optional[Union[str, "_models.OperatingSystemTypes"]] = None, + image: Optional["_models.VirtualHardDisk"] = None, + vhd_containers: Optional[list[str]] = None, + managed_disk: Optional["_models.VirtualMachineScaleSetManagedDiskParameters"] = None, + delete_option: Optional[Union[str, "_models.DiskDeleteOptionTypes"]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class VirtualMachineScaleSetOSProfile(_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.

**Windows-only + restriction:** Cannot end in "."

**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". +

**Minimum-length (Linux):** 1 character

**Max-length (Linux):** 64 + characters

**Max-length (Windows):** 20 characters. + :vartype admin_username: str + :ivar admin_password: Specifies the password of the administrator account.

+ **Minimum-length (Windows):** 8 characters

**Minimum-length (Linux):** 6 characters +

**Max-length (Windows):** 123 characters

**Max-length (Linux):** 72 + characters

**Complexity requirements:** 3 out of 4 conditions below need to be + fulfilled
Has lower characters
Has upper characters
Has a digit
Has a + special character (Regex match [\\W_])

**Disallowed values:** "abc@123", "P@$$w0rd", + "P@ssw0rd", "P@ssword123", "Pa$$word", "pass@word1", "Password!", "Password1", "Password22", + "iloveyou!"

For resetting the password, see `How to reset the Remote Desktop service + or its login password in a Windows VM + `_

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. 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.models.WindowsConfiguration + :ivar linux_configuration: Specifies the Linux operating system settings on the virtual + machine. For a list of supported Linux distributions, see `Linux on Azure-Endorsed + Distributions `_. + :vartype linux_configuration: ~azure.mgmt.compute.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.models.VaultSecretGroup] + :ivar allow_extension_operations: Specifies whether extension operations should be allowed on + the virtual machine scale set. This may only be set to False when no extensions are present on + the virtual machine scale set. + :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 + """ + + computer_name_prefix: Optional[str] = rest_field( + name="computerNamePrefix", visibility=["read", "create", "update", "delete", "query"] + ) + """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.""" + admin_username: Optional[str] = rest_field( + name="adminUsername", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies the name of the administrator account.

**Windows-only restriction:** Cannot + end in \".\"

**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\".

**Minimum-length (Linux):** 1 character +

**Max-length (Linux):** 64 characters

**Max-length (Windows):** 20 + characters.""" + admin_password: Optional[str] = rest_field( + name="adminPassword", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies the password of the administrator account.

**Minimum-length (Windows):** 8 + characters

**Minimum-length (Linux):** 6 characters

**Max-length (Windows):** + 123 characters

**Max-length (Linux):** 72 characters

**Complexity + requirements:** 3 out of 4 conditions below need to be fulfilled
Has lower characters +
Has upper characters
Has a digit
Has a special character (Regex match [\W_]) +

**Disallowed values:** \"abc@123\", \"P@$$w0rd\", \"P@ssw0rd\", \"P@ssword123\", + \"Pa$$word\", \"pass@word1\", \"Password!\", \"Password1\", \"Password22\", \"iloveyou!\" +

For resetting the password, see `How to reset the Remote Desktop service or its login + password in a Windows VM + `_

For + resetting root password, see `Manage users, SSH, and check or repair disks on Azure Linux VMs + using the VMAccess Extension + `_.""" + custom_data: Optional[str] = rest_field( + name="customData", visibility=["read", "create", "update", "delete", "query"] + ) + """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. For using cloud-init for your VM, see `Using cloud-init to customize a + Linux VM during creation + `_.""" + windows_configuration: Optional["_models.WindowsConfiguration"] = rest_field( + name="windowsConfiguration", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies Windows operating system settings on the virtual machine.""" + linux_configuration: Optional["_models.LinuxConfiguration"] = rest_field( + name="linuxConfiguration", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies the Linux operating system settings on the virtual machine. For a list of supported + Linux distributions, see `Linux on Azure-Endorsed Distributions + `_.""" + secrets: Optional[list["_models.VaultSecretGroup"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """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 + `_.""" + allow_extension_operations: Optional[bool] = rest_field( + name="allowExtensionOperations", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies whether extension operations should be allowed on the virtual machine scale set. This + may only be set to False when no extensions are present on the virtual machine scale set.""" + require_guest_provision_signal: Optional[bool] = rest_field( + name="requireGuestProvisionSignal", visibility=["read", "create", "update", "delete", "query"] + ) + """Optional property which must either be set to True or omitted.""" + + @overload + 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["_models.WindowsConfiguration"] = None, + linux_configuration: Optional["_models.LinuxConfiguration"] = None, + secrets: Optional[list["_models.VaultSecretGroup"]] = None, + allow_extension_operations: Optional[bool] = None, + require_guest_provision_signal: Optional[bool] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class VirtualMachineScaleSetProperties(_Model): + """Describes the properties of a Virtual Machine Scale Set. + + :ivar upgrade_policy: The upgrade policy. + :vartype upgrade_policy: ~azure.mgmt.compute.models.UpgradePolicy + :ivar scheduled_events_policy: The ScheduledEventsPolicy. + :vartype scheduled_events_policy: ~azure.mgmt.compute.models.ScheduledEventsPolicy + :ivar automatic_repairs_policy: Policy for automatic repairs. + :vartype automatic_repairs_policy: ~azure.mgmt.compute.models.AutomaticRepairsPolicy + :ivar virtual_machine_profile: The virtual machine profile. + :vartype virtual_machine_profile: ~azure.mgmt.compute.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. Minimum api-version: 2018-04-01. + :vartype proximity_placement_group: ~azure.mgmt.compute.models.SubResource + :ivar host_group: Specifies information about the dedicated host group that the virtual machine + scale set resides in. Minimum api-version: 2020-06-01. + :vartype host_group: ~azure.mgmt.compute.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.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.models.ScaleInPolicy + :ivar orchestration_mode: Specifies the orchestration mode for the virtual machine scale set. + Known values are: "Uniform" and "Flexible". + :vartype orchestration_mode: str or ~azure.mgmt.compute.models.OrchestrationMode + :ivar spot_restore_policy: Specifies the Spot Restore properties for the virtual machine scale + set. + :vartype spot_restore_policy: ~azure.mgmt.compute.models.SpotRestorePolicy + :ivar priority_mix_policy: Specifies the desired targets for mixing Spot and Regular priority + VMs within the same VMSS Flex instance. + :vartype priority_mix_policy: ~azure.mgmt.compute.models.PriorityMixPolicy + :ivar time_created: Specifies the time at which the Virtual Machine Scale Set resource was + created. Minimum api-version: 2021-11-01. + :vartype time_created: ~datetime.datetime + :ivar constrained_maximum_capacity: Optional property which must either be set to True or + omitted. + :vartype constrained_maximum_capacity: bool + :ivar resiliency_policy: Policy for Resiliency. + :vartype resiliency_policy: ~azure.mgmt.compute.models.ResiliencyPolicy + :ivar zonal_platform_fault_domain_align_mode: Specifies the align mode between Virtual Machine + Scale Set compute and storage Fault Domain count. Known values are: "Aligned" and "Unaligned". + :vartype zonal_platform_fault_domain_align_mode: str or + ~azure.mgmt.compute.models.ZonalPlatformFaultDomainAlignMode + :ivar sku_profile: Specifies the sku profile for the virtual machine scale set. + :vartype sku_profile: ~azure.mgmt.compute.models.SkuProfile + :ivar high_speed_interconnect_placement: Specifies the high speed interconnect placement for + the virtual machine scale set. Known values are: "None" and "Trunk". + :vartype high_speed_interconnect_placement: str or + ~azure.mgmt.compute.models.HighSpeedInterconnectPlacement + """ + + upgrade_policy: Optional["_models.UpgradePolicy"] = rest_field( + name="upgradePolicy", visibility=["read", "create", "update", "delete", "query"] + ) + """The upgrade policy.""" + scheduled_events_policy: Optional["_models.ScheduledEventsPolicy"] = rest_field( + name="scheduledEventsPolicy", visibility=["read", "create", "update", "delete", "query"] + ) + """The ScheduledEventsPolicy.""" + automatic_repairs_policy: Optional["_models.AutomaticRepairsPolicy"] = rest_field( + name="automaticRepairsPolicy", visibility=["read", "create", "update", "delete", "query"] + ) + """Policy for automatic repairs.""" + virtual_machine_profile: Optional["_models.VirtualMachineScaleSetVMProfile"] = rest_field( + name="virtualMachineProfile", visibility=["read", "create", "update", "delete", "query"] + ) + """The virtual machine profile.""" + provisioning_state: Optional[str] = rest_field(name="provisioningState", visibility=["read"]) + """The provisioning state, which only appears in the response.""" + overprovision: Optional[bool] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Specifies whether the Virtual Machine Scale Set should be overprovisioned.""" + do_not_run_extensions_on_overprovisioned_v_ms: Optional[bool] = rest_field( + name="doNotRunExtensionsOnOverprovisionedVMs", visibility=["read", "create", "update", "delete", "query"] + ) + """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.""" + unique_id: Optional[str] = rest_field(name="uniqueId", visibility=["read"]) + """Specifies the ID which uniquely identifies a Virtual Machine Scale Set.""" + single_placement_group: Optional[bool] = rest_field( + name="singlePlacementGroup", visibility=["read", "create", "update", "delete", "query"] + ) + """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.""" + zone_balance: Optional[bool] = rest_field( + name="zoneBalance", visibility=["read", "create", "update", "delete", "query"] + ) + """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.""" + platform_fault_domain_count: Optional[int] = rest_field( + name="platformFaultDomainCount", visibility=["read", "create", "update", "delete", "query"] + ) + """Fault Domain count for each placement group.""" + proximity_placement_group: Optional["_models.SubResource"] = rest_field( + name="proximityPlacementGroup", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies information about the proximity placement group that the virtual machine scale set + should be assigned to. Minimum api-version: 2018-04-01.""" + host_group: Optional["_models.SubResource"] = rest_field( + name="hostGroup", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies information about the dedicated host group that the virtual machine scale set resides + in. Minimum api-version: 2020-06-01.""" + additional_capabilities: Optional["_models.AdditionalCapabilities"] = rest_field( + name="additionalCapabilities", visibility=["read", "create", "update", "delete", "query"] + ) + """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.""" + scale_in_policy: Optional["_models.ScaleInPolicy"] = rest_field( + name="scaleInPolicy", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies the policies applied when scaling in Virtual Machines in the Virtual Machine Scale + Set.""" + orchestration_mode: Optional[Union[str, "_models.OrchestrationMode"]] = rest_field( + name="orchestrationMode", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies the orchestration mode for the virtual machine scale set. Known values are: + \"Uniform\" and \"Flexible\".""" + spot_restore_policy: Optional["_models.SpotRestorePolicy"] = rest_field( + name="spotRestorePolicy", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies the Spot Restore properties for the virtual machine scale set.""" + priority_mix_policy: Optional["_models.PriorityMixPolicy"] = rest_field( + name="priorityMixPolicy", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies the desired targets for mixing Spot and Regular priority VMs within the same VMSS + Flex instance.""" + time_created: Optional[datetime.datetime] = rest_field(name="timeCreated", visibility=["read"], format="rfc3339") + """Specifies the time at which the Virtual Machine Scale Set resource was created. Minimum + api-version: 2021-11-01.""" + constrained_maximum_capacity: Optional[bool] = rest_field( + name="constrainedMaximumCapacity", visibility=["read", "create", "update", "delete", "query"] + ) + """Optional property which must either be set to True or omitted.""" + resiliency_policy: Optional["_models.ResiliencyPolicy"] = rest_field( + name="resiliencyPolicy", visibility=["read", "create", "update", "delete", "query"] + ) + """Policy for Resiliency.""" + zonal_platform_fault_domain_align_mode: Optional[Union[str, "_models.ZonalPlatformFaultDomainAlignMode"]] = ( + rest_field(name="zonalPlatformFaultDomainAlignMode", visibility=["read", "create", "update", "delete", "query"]) + ) + """Specifies the align mode between Virtual Machine Scale Set compute and storage Fault Domain + count. Known values are: \"Aligned\" and \"Unaligned\".""" + sku_profile: Optional["_models.SkuProfile"] = rest_field( + name="skuProfile", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies the sku profile for the virtual machine scale set.""" + high_speed_interconnect_placement: Optional[Union[str, "_models.HighSpeedInterconnectPlacement"]] = rest_field( + name="highSpeedInterconnectPlacement", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies the high speed interconnect placement for the virtual machine scale set. Known values + are: \"None\" and \"Trunk\".""" + + @overload + def __init__( # pylint: disable=too-many-locals + self, + *, + upgrade_policy: Optional["_models.UpgradePolicy"] = None, + scheduled_events_policy: Optional["_models.ScheduledEventsPolicy"] = None, + automatic_repairs_policy: Optional["_models.AutomaticRepairsPolicy"] = None, + virtual_machine_profile: Optional["_models.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["_models.SubResource"] = None, + host_group: Optional["_models.SubResource"] = None, + additional_capabilities: Optional["_models.AdditionalCapabilities"] = None, + scale_in_policy: Optional["_models.ScaleInPolicy"] = None, + orchestration_mode: Optional[Union[str, "_models.OrchestrationMode"]] = None, + spot_restore_policy: Optional["_models.SpotRestorePolicy"] = None, + priority_mix_policy: Optional["_models.PriorityMixPolicy"] = None, + constrained_maximum_capacity: Optional[bool] = None, + resiliency_policy: Optional["_models.ResiliencyPolicy"] = None, + zonal_platform_fault_domain_align_mode: Optional[ + Union[str, "_models.ZonalPlatformFaultDomainAlignMode"] + ] = None, + sku_profile: Optional["_models.SkuProfile"] = None, + high_speed_interconnect_placement: Optional[Union[str, "_models.HighSpeedInterconnectPlacement"]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class VirtualMachineScaleSetPublicIPAddressConfiguration(_Model): # pylint: disable=name-too-long + """Describes a virtual machines scale set IP Configuration's PublicIPAddress configuration. + + :ivar name: The publicIP address configuration name. Required. + :vartype name: str + :ivar properties: Describes a virtual machines scale set IP Configuration's PublicIPAddress + configuration. + :vartype properties: + ~azure.mgmt.compute.models.VirtualMachineScaleSetPublicIPAddressConfigurationProperties + :ivar sku: Describes the public IP Sku. It can only be set with OrchestrationMode as Flexible. + :vartype sku: ~azure.mgmt.compute.models.PublicIPAddressSku + :ivar tags: Resource tags applied to the publicIP address created by this + PublicIPAddressConfiguration. + :vartype tags: dict[str, str] + """ + + name: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The publicIP address configuration name. Required.""" + properties: Optional["_models.VirtualMachineScaleSetPublicIPAddressConfigurationProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Describes a virtual machines scale set IP Configuration's PublicIPAddress configuration.""" + sku: Optional["_models.PublicIPAddressSku"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Describes the public IP Sku. It can only be set with OrchestrationMode as Flexible.""" + tags: Optional[dict[str, str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Resource tags applied to the publicIP address created by this PublicIPAddressConfiguration.""" + + @overload + def __init__( + self, + *, + name: str, + properties: Optional["_models.VirtualMachineScaleSetPublicIPAddressConfigurationProperties"] = None, + sku: Optional["_models.PublicIPAddressSku"] = None, + tags: Optional[dict[str, str]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class VirtualMachineScaleSetPublicIPAddressConfigurationDnsSettings(_Model): # pylint: disable=name-too-long + """Describes a virtual machines scale sets network configuration's DNS settings. + + :ivar domain_name_label: 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. + Required. + :vartype domain_name_label: str + :ivar domain_name_label_scope: The Domain name label scope.The concatenation of the hashed + domain name label that generated according to the policy from domain name label scope and vm + index will be the domain name labels of the PublicIPAddress resources that will be created. + Known values are: "TenantReuse", "SubscriptionReuse", "ResourceGroupReuse", and "NoReuse". + :vartype domain_name_label_scope: str or ~azure.mgmt.compute.models.DomainNameLabelScopeTypes + """ + + domain_name_label: str = rest_field( + name="domainNameLabel", visibility=["read", "create", "update", "delete", "query"] + ) + """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. Required.""" + domain_name_label_scope: Optional[Union[str, "_models.DomainNameLabelScopeTypes"]] = rest_field( + name="domainNameLabelScope", visibility=["read", "create", "update", "delete", "query"] + ) + """The Domain name label scope.The concatenation of the hashed domain name label that generated + according to the policy from domain name label scope and vm index will be the domain name + labels of the PublicIPAddress resources that will be created. Known values are: + \"TenantReuse\", \"SubscriptionReuse\", \"ResourceGroupReuse\", and \"NoReuse\".""" + + @overload + def __init__( + self, + *, + domain_name_label: str, + domain_name_label_scope: Optional[Union[str, "_models.DomainNameLabelScopeTypes"]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class VirtualMachineScaleSetPublicIPAddressConfigurationProperties(_Model): # pylint: disable=name-too-long + """Describes a virtual machines scale set IP Configuration's PublicIPAddress configuration. + + :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.models.VirtualMachineScaleSetPublicIPAddressConfigurationDnsSettings + :ivar ip_tags: The list of IP tags associated with the public IP address. + :vartype ip_tags: list[~azure.mgmt.compute.models.VirtualMachineScaleSetIpTag] + :ivar public_ip_prefix: The PublicIPPrefix from which to allocate publicIP addresses. + :vartype public_ip_prefix: ~azure.mgmt.compute.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'. Known values are: "IPv4" and "IPv6". + :vartype public_ip_address_version: str or ~azure.mgmt.compute.models.IPVersion + :ivar delete_option: Specify what happens to the public IP when the VM is deleted. Known values + are: "Delete" and "Detach". + :vartype delete_option: str or ~azure.mgmt.compute.models.DeleteOptions + """ + + idle_timeout_in_minutes: Optional[int] = rest_field( + name="idleTimeoutInMinutes", visibility=["read", "create", "update", "delete", "query"] + ) + """The idle timeout of the public IP address.""" + dns_settings: Optional["_models.VirtualMachineScaleSetPublicIPAddressConfigurationDnsSettings"] = rest_field( + name="dnsSettings", visibility=["read", "create", "update", "delete", "query"] + ) + """The dns settings to be applied on the publicIP addresses .""" + ip_tags: Optional[list["_models.VirtualMachineScaleSetIpTag"]] = rest_field( + name="ipTags", visibility=["read", "create", "update", "delete", "query"] + ) + """The list of IP tags associated with the public IP address.""" + public_ip_prefix: Optional["_models.SubResource"] = rest_field( + name="publicIPPrefix", visibility=["read", "create", "update", "delete", "query"] + ) + """The PublicIPPrefix from which to allocate publicIP addresses.""" + public_ip_address_version: Optional[Union[str, "_models.IPVersion"]] = rest_field( + name="publicIPAddressVersion", visibility=["read", "create", "update", "delete", "query"] + ) + """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'. Known values are: \"IPv4\" and \"IPv6\".""" + delete_option: Optional[Union[str, "_models.DeleteOptions"]] = rest_field( + name="deleteOption", visibility=["read", "create", "update", "delete", "query"] + ) + """Specify what happens to the public IP when the VM is deleted. Known values are: \"Delete\" and + \"Detach\".""" + + @overload + def __init__( + self, + *, + idle_timeout_in_minutes: Optional[int] = None, + dns_settings: Optional["_models.VirtualMachineScaleSetPublicIPAddressConfigurationDnsSettings"] = None, + ip_tags: Optional[list["_models.VirtualMachineScaleSetIpTag"]] = None, + public_ip_prefix: Optional["_models.SubResource"] = None, + public_ip_address_version: Optional[Union[str, "_models.IPVersion"]] = None, + delete_option: Optional[Union[str, "_models.DeleteOptions"]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class VirtualMachineScaleSetVMReimageParameters(VirtualMachineReimageParameters): # pylint: disable=name-too-long + """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 exact_version: Specifies in decimal number, the version the OS disk should be reimaged + to. If exact version is not provided, the OS disk is reimaged to the existing version of OS + Disk. + :vartype exact_version: str + :ivar os_profile: Specifies information required for reimaging the non-ephemeral OS disk. + :vartype os_profile: ~azure.mgmt.compute.models.OSProfileProvisioningData + :ivar force_update_os_disk_for_ephemeral: Parameter to force update ephemeral OS disk for a + virtual machine scale set VM. + :vartype force_update_os_disk_for_ephemeral: bool + """ + + force_update_os_disk_for_ephemeral: Optional[bool] = rest_field( + name="forceUpdateOSDiskForEphemeral", visibility=["read", "create", "update", "delete", "query"] + ) + """Parameter to force update ephemeral OS disk for a virtual machine scale set VM.""" + + @overload + def __init__( + self, + *, + temp_disk: Optional[bool] = None, + exact_version: Optional[str] = None, + os_profile: Optional["_models.OSProfileProvisioningData"] = None, + force_update_os_disk_for_ephemeral: Optional[bool] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **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 exact_version: Specifies in decimal number, the version the OS disk should be reimaged + to. If exact version is not provided, the OS disk is reimaged to the existing version of OS + Disk. + :vartype exact_version: str + :ivar os_profile: Specifies information required for reimaging the non-ephemeral OS disk. + :vartype os_profile: ~azure.mgmt.compute.models.OSProfileProvisioningData + :ivar force_update_os_disk_for_ephemeral: Parameter to force update ephemeral OS disk for a + virtual machine scale set VM. + :vartype force_update_os_disk_for_ephemeral: 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] + """ + + instance_ids: Optional[list[str]] = rest_field( + name="instanceIds", visibility=["read", "create", "update", "delete", "query"] + ) + """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.""" + + @overload + def __init__( + self, + *, + temp_disk: Optional[bool] = None, + exact_version: Optional[str] = None, + os_profile: Optional["_models.OSProfileProvisioningData"] = None, + force_update_os_disk_for_ephemeral: Optional[bool] = None, + instance_ids: Optional[list[str]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class VirtualMachineScaleSetSku(_Model): + """Describes an available virtual machine scale set sku. + + :ivar resource_type: The type of resource the sku applies to. + :vartype resource_type: str + :ivar sku: The Sku. + :vartype sku: ~azure.mgmt.compute.models.Sku + :ivar capacity: Specifies the number of virtual machines in the scale set. + :vartype capacity: ~azure.mgmt.compute.models.VirtualMachineScaleSetSkuCapacity + """ + + resource_type: Optional[str] = rest_field(name="resourceType", visibility=["read"]) + """The type of resource the sku applies to.""" + sku: Optional["_models.Sku"] = rest_field(visibility=["read"]) + """The Sku.""" + capacity: Optional["_models.VirtualMachineScaleSetSkuCapacity"] = rest_field(visibility=["read"]) + """Specifies the number of virtual machines in the scale set.""" + + +class VirtualMachineScaleSetSkuCapacity(_Model): + """Describes scaling information of a sku. + + :ivar minimum: The minimum capacity. + :vartype minimum: int + :ivar maximum: The maximum capacity that can be set. + :vartype maximum: int + :ivar default_capacity: The default capacity. + :vartype default_capacity: int + :ivar scale_type: The scale type applicable to the sku. Known values are: "Automatic" and + "None". + :vartype scale_type: str or ~azure.mgmt.compute.models.VirtualMachineScaleSetSkuScaleType + """ + + minimum: Optional[int] = rest_field(visibility=["read"]) + """The minimum capacity.""" + maximum: Optional[int] = rest_field(visibility=["read"]) + """The maximum capacity that can be set.""" + default_capacity: Optional[int] = rest_field(name="defaultCapacity", visibility=["read"]) + """The default capacity.""" + scale_type: Optional[Union[str, "_models.VirtualMachineScaleSetSkuScaleType"]] = rest_field( + name="scaleType", visibility=["read"] + ) + """The scale type applicable to the sku. Known values are: \"Automatic\" and \"None\".""" + + +class VirtualMachineScaleSetStorageProfile(_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.models.ImageReference + :ivar os_disk: Specifies information about the operating system disk used by the virtual + machines in the scale set. For more information about disks, see `About disks and VHDs for + Azure virtual machines + `_. + :vartype os_disk: ~azure.mgmt.compute.models.VirtualMachineScaleSetOSDisk + :ivar data_disks: Specifies the parameters that are used to add data disks to the virtual + machines in the scale set. For more information about disks, see `About disks and VHDs for + Azure virtual machines + `_. + :vartype data_disks: list[~azure.mgmt.compute.models.VirtualMachineScaleSetDataDisk] + :ivar disk_controller_type: Specifies the disk controller type configured for the virtual + machines in the scale set. Minimum api-version: 2022-08-01. Known values are: "SCSI" and + "NVMe". + :vartype disk_controller_type: str or ~azure.mgmt.compute.models.DiskControllerTypes + """ + + image_reference: Optional["_models.ImageReference"] = rest_field( + name="imageReference", visibility=["read", "create", "update", "delete", "query"] + ) + """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.""" + os_disk: Optional["_models.VirtualMachineScaleSetOSDisk"] = rest_field( + name="osDisk", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies information about the operating system disk used by the virtual machines in the scale + set. For more information about disks, see `About disks and VHDs for Azure virtual machines + `_.""" + data_disks: Optional[list["_models.VirtualMachineScaleSetDataDisk"]] = rest_field( + name="dataDisks", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies the parameters that are used to add data disks to the virtual machines in the scale + set. For more information about disks, see `About disks and VHDs for Azure virtual machines + `_.""" + disk_controller_type: Optional[Union[str, "_models.DiskControllerTypes"]] = rest_field( + name="diskControllerType", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies the disk controller type configured for the virtual machines in the scale set. + Minimum api-version: 2022-08-01. Known values are: \"SCSI\" and \"NVMe\".""" + + @overload + def __init__( + self, + *, + image_reference: Optional["_models.ImageReference"] = None, + os_disk: Optional["_models.VirtualMachineScaleSetOSDisk"] = None, + data_disks: Optional[list["_models.VirtualMachineScaleSetDataDisk"]] = None, + disk_controller_type: Optional[Union[str, "_models.DiskControllerTypes"]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class VirtualMachineScaleSetUpdate(UpdateResource): + """Describes a Virtual Machine Scale Set. + + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar sku: The virtual machine scale set sku. + :vartype sku: ~azure.mgmt.compute.models.Sku + :ivar plan: The purchase plan when deploying a virtual machine scale set from VM Marketplace + images. + :vartype plan: ~azure.mgmt.compute.models.Plan + :ivar properties: Describes the properties of a Virtual Machine Scale Set. + :vartype properties: ~azure.mgmt.compute.models.VirtualMachineScaleSetUpdateProperties + :ivar identity: The identity of the virtual machine scale set, if configured. + :vartype identity: ~azure.mgmt.compute.models.VirtualMachineScaleSetIdentity + :ivar zones: The virtual machine scale set zones. + :vartype zones: list[str] + """ + + sku: Optional["_models.Sku"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The virtual machine scale set sku.""" + plan: Optional["_models.Plan"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The purchase plan when deploying a virtual machine scale set from VM Marketplace images.""" + properties: Optional["_models.VirtualMachineScaleSetUpdateProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Describes the properties of a Virtual Machine Scale Set.""" + identity: Optional["_models.VirtualMachineScaleSetIdentity"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The identity of the virtual machine scale set, if configured.""" + zones: Optional[list[str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The virtual machine scale set zones.""" + + @overload + def __init__( + self, + *, + tags: Optional[dict[str, str]] = None, + sku: Optional["_models.Sku"] = None, + plan: Optional["_models.Plan"] = None, + properties: Optional["_models.VirtualMachineScaleSetUpdateProperties"] = None, + identity: Optional["_models.VirtualMachineScaleSetIdentity"] = None, + zones: Optional[list[str]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class VirtualMachineScaleSetUpdateIPConfiguration(_Model): # pylint: disable=name-too-long + """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 name: The IP configuration name. + :vartype name: str + :ivar properties: Describes a virtual machine scale set network profile's IP configuration + properties. + :vartype properties: + ~azure.mgmt.compute.models.VirtualMachineScaleSetUpdateIPConfigurationProperties + """ + + name: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The IP configuration name.""" + properties: Optional["_models.VirtualMachineScaleSetUpdateIPConfigurationProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Describes a virtual machine scale set network profile's IP configuration properties.""" + + @overload + def __init__( + self, + *, + name: Optional[str] = None, + properties: Optional["_models.VirtualMachineScaleSetUpdateIPConfigurationProperties"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class VirtualMachineScaleSetUpdateIPConfigurationProperties(_Model): # pylint: disable=name-too-long + """Describes a virtual machine scale set network profile's IP configuration properties. + + :ivar subnet: The subnet. + :vartype subnet: ~azure.mgmt.compute.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.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'. Known values are: "IPv4" and "IPv6". + :vartype private_ip_address_version: str or ~azure.mgmt.compute.models.IPVersion + :ivar application_gateway_backend_address_pools: The application gateway backend address pools. + :vartype application_gateway_backend_address_pools: + list[~azure.mgmt.compute.models.SubResource] + :ivar application_security_groups: Specifies an array of references to application security + group. + :vartype application_security_groups: list[~azure.mgmt.compute.models.SubResource] + :ivar load_balancer_backend_address_pools: The load balancer backend address pools. + :vartype load_balancer_backend_address_pools: list[~azure.mgmt.compute.models.SubResource] + :ivar load_balancer_inbound_nat_pools: The load balancer inbound nat pools. + :vartype load_balancer_inbound_nat_pools: list[~azure.mgmt.compute.models.SubResource] + """ + + subnet: Optional["_models.ApiEntityReference"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The subnet.""" + primary: Optional[bool] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Specifies the primary IP Configuration in case the network interface has more than one IP + Configuration.""" + public_ip_address_configuration: Optional["_models.VirtualMachineScaleSetUpdatePublicIPAddressConfiguration"] = ( + rest_field(name="publicIPAddressConfiguration", visibility=["read", "create", "update", "delete", "query"]) + ) + """The publicIPAddressConfiguration.""" + private_ip_address_version: Optional[Union[str, "_models.IPVersion"]] = rest_field( + name="privateIPAddressVersion", visibility=["read", "create", "update", "delete", "query"] + ) + """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'. Known values are: \"IPv4\" and \"IPv6\".""" + application_gateway_backend_address_pools: Optional[list["_models.SubResource"]] = rest_field( + name="applicationGatewayBackendAddressPools", visibility=["read", "create", "update", "delete", "query"] + ) + """The application gateway backend address pools.""" + application_security_groups: Optional[list["_models.SubResource"]] = rest_field( + name="applicationSecurityGroups", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies an array of references to application security group.""" + load_balancer_backend_address_pools: Optional[list["_models.SubResource"]] = rest_field( + name="loadBalancerBackendAddressPools", visibility=["read", "create", "update", "delete", "query"] + ) + """The load balancer backend address pools.""" + load_balancer_inbound_nat_pools: Optional[list["_models.SubResource"]] = rest_field( + name="loadBalancerInboundNatPools", visibility=["read", "create", "update", "delete", "query"] + ) + """The load balancer inbound nat pools.""" + + @overload + def __init__( + self, + *, + subnet: Optional["_models.ApiEntityReference"] = None, + primary: Optional[bool] = None, + public_ip_address_configuration: Optional[ + "_models.VirtualMachineScaleSetUpdatePublicIPAddressConfiguration" + ] = None, + private_ip_address_version: Optional[Union[str, "_models.IPVersion"]] = None, + application_gateway_backend_address_pools: Optional[list["_models.SubResource"]] = None, + application_security_groups: Optional[list["_models.SubResource"]] = None, + load_balancer_backend_address_pools: Optional[list["_models.SubResource"]] = None, + load_balancer_inbound_nat_pools: Optional[list["_models.SubResource"]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class VirtualMachineScaleSetUpdateNetworkConfiguration(_Model): # pylint: disable=name-too-long + """Describes a virtual machine scale set network profile's network configurations. + + :ivar name: The network configuration name. + :vartype name: str + :ivar properties: Describes a virtual machine scale set updatable network profile's IP + configuration.Use this object for updating network profile's IP Configuration. + :vartype properties: + ~azure.mgmt.compute.models.VirtualMachineScaleSetUpdateNetworkConfigurationProperties + :ivar tags: Resource tags applied to the networkInterface address created by this + NetworkInterfaceConfiguration. + :vartype tags: dict[str, str] + """ + + name: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The network configuration name.""" + properties: Optional["_models.VirtualMachineScaleSetUpdateNetworkConfigurationProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Describes a virtual machine scale set updatable network profile's IP configuration.Use this + object for updating network profile's IP Configuration.""" + tags: Optional[dict[str, str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Resource tags applied to the networkInterface address created by this + NetworkInterfaceConfiguration.""" + + @overload + def __init__( + self, + *, + name: Optional[str] = None, + properties: Optional["_models.VirtualMachineScaleSetUpdateNetworkConfigurationProperties"] = None, + tags: Optional[dict[str, str]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class VirtualMachineScaleSetUpdateNetworkConfigurationProperties(_Model): # pylint: disable=name-too-long + """Describes a virtual machine scale set updatable network profile's IP configuration.Use this + object for updating network profile's IP Configuration. + + :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 disable_tcp_state_tracking: Specifies whether the network interface is disabled for tcp + state tracking. + :vartype disable_tcp_state_tracking: 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.models.SubResource + :ivar dns_settings: The dns settings to be applied on the network interfaces. + :vartype dns_settings: + ~azure.mgmt.compute.models.VirtualMachineScaleSetNetworkConfigurationDnsSettings + :ivar ip_configurations: The virtual machine scale set IP Configuration. + :vartype ip_configurations: + list[~azure.mgmt.compute.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. + Known values are: "Delete" and "Detach". + :vartype delete_option: str or ~azure.mgmt.compute.models.DeleteOptions + :ivar auxiliary_mode: Specifies whether the Auxiliary mode is enabled for the Network Interface + resource. Known values are: "None", "AcceleratedConnections", and "Floating". + :vartype auxiliary_mode: str or ~azure.mgmt.compute.models.NetworkInterfaceAuxiliaryMode + :ivar auxiliary_sku: Specifies whether the Auxiliary sku is enabled for the Network Interface + resource. Known values are: "None", "A1", "A2", "A4", and "A8". + :vartype auxiliary_sku: str or ~azure.mgmt.compute.models.NetworkInterfaceAuxiliarySku + """ + + primary: Optional[bool] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Whether this is a primary NIC on a virtual machine.""" + enable_accelerated_networking: Optional[bool] = rest_field( + name="enableAcceleratedNetworking", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies whether the network interface is accelerated networking-enabled.""" + disable_tcp_state_tracking: Optional[bool] = rest_field( + name="disableTcpStateTracking", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies whether the network interface is disabled for tcp state tracking.""" + enable_fpga: Optional[bool] = rest_field( + name="enableFpga", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies whether the network interface is FPGA networking-enabled.""" + network_security_group: Optional["_models.SubResource"] = rest_field( + name="networkSecurityGroup", visibility=["read", "create", "update", "delete", "query"] + ) + """The network security group.""" + dns_settings: Optional["_models.VirtualMachineScaleSetNetworkConfigurationDnsSettings"] = rest_field( + name="dnsSettings", visibility=["read", "create", "update", "delete", "query"] + ) + """The dns settings to be applied on the network interfaces.""" + ip_configurations: Optional[list["_models.VirtualMachineScaleSetUpdateIPConfiguration"]] = rest_field( + name="ipConfigurations", visibility=["read", "create", "update", "delete", "query"] + ) + """The virtual machine scale set IP Configuration.""" + enable_ip_forwarding: Optional[bool] = rest_field( + name="enableIPForwarding", visibility=["read", "create", "update", "delete", "query"] + ) + """Whether IP forwarding enabled on this NIC.""" + delete_option: Optional[Union[str, "_models.DeleteOptions"]] = rest_field( + name="deleteOption", visibility=["read", "create", "update", "delete", "query"] + ) + """Specify what happens to the network interface when the VM is deleted. Known values are: + \"Delete\" and \"Detach\".""" + auxiliary_mode: Optional[Union[str, "_models.NetworkInterfaceAuxiliaryMode"]] = rest_field( + name="auxiliaryMode", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies whether the Auxiliary mode is enabled for the Network Interface resource. Known + values are: \"None\", \"AcceleratedConnections\", and \"Floating\".""" + auxiliary_sku: Optional[Union[str, "_models.NetworkInterfaceAuxiliarySku"]] = rest_field( + name="auxiliarySku", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies whether the Auxiliary sku is enabled for the Network Interface resource. Known values + are: \"None\", \"A1\", \"A2\", \"A4\", and \"A8\".""" + + @overload + def __init__( + self, + *, + primary: Optional[bool] = None, + enable_accelerated_networking: Optional[bool] = None, + disable_tcp_state_tracking: Optional[bool] = None, + enable_fpga: Optional[bool] = None, + network_security_group: Optional["_models.SubResource"] = None, + dns_settings: Optional["_models.VirtualMachineScaleSetNetworkConfigurationDnsSettings"] = None, + ip_configurations: Optional[list["_models.VirtualMachineScaleSetUpdateIPConfiguration"]] = None, + enable_ip_forwarding: Optional[bool] = None, + delete_option: Optional[Union[str, "_models.DeleteOptions"]] = None, + auxiliary_mode: Optional[Union[str, "_models.NetworkInterfaceAuxiliaryMode"]] = None, + auxiliary_sku: Optional[Union[str, "_models.NetworkInterfaceAuxiliarySku"]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class VirtualMachineScaleSetUpdateNetworkProfile(_Model): # pylint: disable=name-too-long + """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.models.ApiEntityReference + :ivar network_interface_configurations: The list of network configurations. + :vartype network_interface_configurations: + list[~azure.mgmt.compute.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'. Known values are: "2020-11-01" and "2022-11-01". + :vartype network_api_version: str or ~azure.mgmt.compute.models.NetworkApiVersion + """ + + health_probe: Optional["_models.ApiEntityReference"] = rest_field( + name="healthProbe", visibility=["read", "create", "update", "delete", "query"] + ) + """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}'.""" + network_interface_configurations: Optional[list["_models.VirtualMachineScaleSetUpdateNetworkConfiguration"]] = ( + rest_field(name="networkInterfaceConfigurations", visibility=["read", "create", "update", "delete", "query"]) + ) + """The list of network configurations.""" + network_api_version: Optional[Union[str, "_models.NetworkApiVersion"]] = rest_field( + name="networkApiVersion", visibility=["read", "create", "update", "delete", "query"] + ) + """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'. Known values are: \"2020-11-01\" and \"2022-11-01\".""" + + @overload + def __init__( + self, + *, + health_probe: Optional["_models.ApiEntityReference"] = None, + network_interface_configurations: Optional[ + list["_models.VirtualMachineScaleSetUpdateNetworkConfiguration"] + ] = None, + network_api_version: Optional[Union[str, "_models.NetworkApiVersion"]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class VirtualMachineScaleSetUpdateOSDisk(_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. Known values are: "None", "ReadOnly", and "ReadWrite". + :vartype caching: str or ~azure.mgmt.compute.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 scale set. + :vartype diff_disk_settings: ~azure.mgmt.compute.models.DiffDiskSettings + :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.

diskSizeGB is the + number of bytes x 1024^3 for the disk and the value cannot be larger than 1023. + :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.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.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).

+ Possible values:

**Delete** If this value is used, the OS disk is deleted when VMSS + Flex VM is deleted.

**Detach** If this value is used, the OS disk is retained after + VMSS Flex VM is deleted.

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. Known values are: "Delete" and "Detach". + :vartype delete_option: str or ~azure.mgmt.compute.models.DiskDeleteOptionTypes + """ + + caching: Optional[Union[str, "_models.CachingTypes"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The caching type. Known values are: \"None\", \"ReadOnly\", and \"ReadWrite\".""" + write_accelerator_enabled: Optional[bool] = rest_field( + name="writeAcceleratorEnabled", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies whether writeAccelerator should be enabled or disabled on the disk.""" + diff_disk_settings: Optional["_models.DiffDiskSettings"] = rest_field( + name="diffDiskSettings", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies the ephemeral disk Settings for the operating system disk used by the virtual machine + scale set.""" + disk_size_gb: Optional[int] = rest_field( + name="diskSizeGB", visibility=["read", "create", "update", "delete", "query"] + ) + """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.

diskSizeGB is the number of bytes x + 1024^3 for the disk and the value cannot be larger than 1023.""" + image: Optional["_models.VirtualHardDisk"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """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.""" + vhd_containers: Optional[list[str]] = rest_field( + name="vhdContainers", visibility=["read", "create", "update", "delete", "query"] + ) + """The list of virtual hard disk container uris.""" + managed_disk: Optional["_models.VirtualMachineScaleSetManagedDiskParameters"] = rest_field( + name="managedDisk", visibility=["read", "create", "update", "delete", "query"] + ) + """The managed disk parameters.""" + delete_option: Optional[Union[str, "_models.DiskDeleteOptionTypes"]] = rest_field( + name="deleteOption", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies whether OS Disk should be deleted or detached upon VMSS Flex deletion (This feature + is available for VMSS with Flexible OrchestrationMode only).

Possible values:

+ **Delete** If this value is used, the OS disk is deleted when VMSS Flex VM is deleted.

+ **Detach** If this value is used, the OS disk is retained after VMSS Flex VM is deleted. +

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. Known values + are: \"Delete\" and \"Detach\".""" + + @overload + def __init__( + self, + *, + caching: Optional[Union[str, "_models.CachingTypes"]] = None, + write_accelerator_enabled: Optional[bool] = None, + diff_disk_settings: Optional["_models.DiffDiskSettings"] = None, + disk_size_gb: Optional[int] = None, + image: Optional["_models.VirtualHardDisk"] = None, + vhd_containers: Optional[list[str]] = None, + managed_disk: Optional["_models.VirtualMachineScaleSetManagedDiskParameters"] = None, + delete_option: Optional[Union[str, "_models.DiskDeleteOptionTypes"]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class VirtualMachineScaleSetUpdateOSProfile(_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.models.WindowsConfiguration + :ivar linux_configuration: The Linux Configuration of the OS profile. + :vartype linux_configuration: ~azure.mgmt.compute.models.LinuxConfiguration + :ivar secrets: The List of certificates for addition to the VM. + :vartype secrets: list[~azure.mgmt.compute.models.VaultSecretGroup] + """ + + custom_data: Optional[str] = rest_field( + name="customData", visibility=["read", "create", "update", "delete", "query"] + ) + """A base-64 encoded string of custom data.""" + windows_configuration: Optional["_models.WindowsConfiguration"] = rest_field( + name="windowsConfiguration", visibility=["read", "create", "update", "delete", "query"] + ) + """The Windows Configuration of the OS profile.""" + linux_configuration: Optional["_models.LinuxConfiguration"] = rest_field( + name="linuxConfiguration", visibility=["read", "create", "update", "delete", "query"] + ) + """The Linux Configuration of the OS profile.""" + secrets: Optional[list["_models.VaultSecretGroup"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The List of certificates for addition to the VM.""" + + @overload + def __init__( + self, + *, + custom_data: Optional[str] = None, + windows_configuration: Optional["_models.WindowsConfiguration"] = None, + linux_configuration: Optional["_models.LinuxConfiguration"] = None, + secrets: Optional[list["_models.VaultSecretGroup"]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class VirtualMachineScaleSetUpdateProperties(_Model): + """Describes the properties of a Virtual Machine Scale Set. + + :ivar upgrade_policy: The upgrade policy. + :vartype upgrade_policy: ~azure.mgmt.compute.models.UpgradePolicy + :ivar automatic_repairs_policy: Policy for automatic repairs. + :vartype automatic_repairs_policy: ~azure.mgmt.compute.models.AutomaticRepairsPolicy + :ivar virtual_machine_profile: The virtual machine profile. + :vartype virtual_machine_profile: + ~azure.mgmt.compute.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.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.models.ScaleInPolicy + :ivar proximity_placement_group: Specifies information about the proximity placement group that + the virtual machine scale set should be assigned to.

Minimum api-version: 2018-04-01. + :vartype proximity_placement_group: ~azure.mgmt.compute.models.SubResource + :ivar priority_mix_policy: Specifies the desired targets for mixing Spot and Regular priority + VMs within the same VMSS Flex instance. + :vartype priority_mix_policy: ~azure.mgmt.compute.models.PriorityMixPolicy + :ivar spot_restore_policy: Specifies the Spot Restore properties for the virtual machine scale + set. + :vartype spot_restore_policy: ~azure.mgmt.compute.models.SpotRestorePolicy + :ivar resiliency_policy: Policy for Resiliency. + :vartype resiliency_policy: ~azure.mgmt.compute.models.ResiliencyPolicy + :ivar zonal_platform_fault_domain_align_mode: Specifies the align mode between Virtual Machine + Scale Set compute and storage Fault Domain count. Known values are: "Aligned" and "Unaligned". + :vartype zonal_platform_fault_domain_align_mode: str or + ~azure.mgmt.compute.models.ZonalPlatformFaultDomainAlignMode + :ivar sku_profile: Specifies the sku profile for the virtual machine scale set. + :vartype sku_profile: ~azure.mgmt.compute.models.SkuProfile + """ + + upgrade_policy: Optional["_models.UpgradePolicy"] = rest_field( + name="upgradePolicy", visibility=["read", "create", "update", "delete", "query"] + ) + """The upgrade policy.""" + automatic_repairs_policy: Optional["_models.AutomaticRepairsPolicy"] = rest_field( + name="automaticRepairsPolicy", visibility=["read", "create", "update", "delete", "query"] + ) + """Policy for automatic repairs.""" + virtual_machine_profile: Optional["_models.VirtualMachineScaleSetUpdateVMProfile"] = rest_field( + name="virtualMachineProfile", visibility=["read", "create", "update", "delete", "query"] + ) + """The virtual machine profile.""" + overprovision: Optional[bool] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Specifies whether the Virtual Machine Scale Set should be overprovisioned.""" + do_not_run_extensions_on_overprovisioned_v_ms: Optional[bool] = rest_field( + name="doNotRunExtensionsOnOverprovisionedVMs", visibility=["read", "create", "update", "delete", "query"] + ) + """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.""" + single_placement_group: Optional[bool] = rest_field( + name="singlePlacementGroup", visibility=["read", "create", "update", "delete", "query"] + ) + """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.""" + additional_capabilities: Optional["_models.AdditionalCapabilities"] = rest_field( + name="additionalCapabilities", visibility=["read", "create", "update", "delete", "query"] + ) + """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.""" + scale_in_policy: Optional["_models.ScaleInPolicy"] = rest_field( + name="scaleInPolicy", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies the policies applied when scaling in Virtual Machines in the Virtual Machine Scale + Set.""" + proximity_placement_group: Optional["_models.SubResource"] = rest_field( + name="proximityPlacementGroup", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies information about the proximity placement group that the virtual machine scale set + should be assigned to.

Minimum api-version: 2018-04-01.""" + priority_mix_policy: Optional["_models.PriorityMixPolicy"] = rest_field( + name="priorityMixPolicy", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies the desired targets for mixing Spot and Regular priority VMs within the same VMSS + Flex instance.""" + spot_restore_policy: Optional["_models.SpotRestorePolicy"] = rest_field( + name="spotRestorePolicy", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies the Spot Restore properties for the virtual machine scale set.""" + resiliency_policy: Optional["_models.ResiliencyPolicy"] = rest_field( + name="resiliencyPolicy", visibility=["read", "create", "update", "delete", "query"] + ) + """Policy for Resiliency.""" + zonal_platform_fault_domain_align_mode: Optional[Union[str, "_models.ZonalPlatformFaultDomainAlignMode"]] = ( + rest_field(name="zonalPlatformFaultDomainAlignMode", visibility=["read", "create", "update", "delete", "query"]) + ) + """Specifies the align mode between Virtual Machine Scale Set compute and storage Fault Domain + count. Known values are: \"Aligned\" and \"Unaligned\".""" + sku_profile: Optional["_models.SkuProfile"] = rest_field( + name="skuProfile", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies the sku profile for the virtual machine scale set.""" + + @overload + def __init__( + self, + *, + upgrade_policy: Optional["_models.UpgradePolicy"] = None, + automatic_repairs_policy: Optional["_models.AutomaticRepairsPolicy"] = None, + virtual_machine_profile: Optional["_models.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["_models.AdditionalCapabilities"] = None, + scale_in_policy: Optional["_models.ScaleInPolicy"] = None, + proximity_placement_group: Optional["_models.SubResource"] = None, + priority_mix_policy: Optional["_models.PriorityMixPolicy"] = None, + spot_restore_policy: Optional["_models.SpotRestorePolicy"] = None, + resiliency_policy: Optional["_models.ResiliencyPolicy"] = None, + zonal_platform_fault_domain_align_mode: Optional[ + Union[str, "_models.ZonalPlatformFaultDomainAlignMode"] + ] = None, + sku_profile: Optional["_models.SkuProfile"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class VirtualMachineScaleSetUpdatePublicIPAddressConfiguration(_Model): # pylint: disable=name-too-long + """Describes a virtual machines scale set IP Configuration's PublicIPAddress configuration. + + :ivar name: The publicIP address configuration name. + :vartype name: str + :ivar properties: Describes a virtual machines scale set IP Configuration's PublicIPAddress + configuration. + :vartype properties: + ~azure.mgmt.compute.models.VirtualMachineScaleSetUpdatePublicIPAddressConfigurationProperties + :ivar tags: Resource tags applied to the publicIP address created by this + PublicIPAddressConfiguration. + :vartype tags: dict[str, str] + """ + + name: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The publicIP address configuration name.""" + properties: Optional["_models.VirtualMachineScaleSetUpdatePublicIPAddressConfigurationProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Describes a virtual machines scale set IP Configuration's PublicIPAddress configuration.""" + tags: Optional[dict[str, str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Resource tags applied to the publicIP address created by this PublicIPAddressConfiguration.""" + + @overload + def __init__( + self, + *, + name: Optional[str] = None, + properties: Optional["_models.VirtualMachineScaleSetUpdatePublicIPAddressConfigurationProperties"] = None, + tags: Optional[dict[str, str]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class VirtualMachineScaleSetUpdatePublicIPAddressConfigurationProperties(_Model): # pylint: disable=name-too-long + """Describes a virtual machines scale set IP Configuration's PublicIPAddress configuration. + + :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.models.VirtualMachineScaleSetPublicIPAddressConfigurationDnsSettings + :ivar public_ip_prefix: The PublicIPPrefix from which to allocate publicIP addresses. + :vartype public_ip_prefix: ~azure.mgmt.compute.models.SubResource + :ivar delete_option: Specify what happens to the public IP when the VM is deleted. Known values + are: "Delete" and "Detach". + :vartype delete_option: str or ~azure.mgmt.compute.models.DeleteOptions + """ + + idle_timeout_in_minutes: Optional[int] = rest_field( + name="idleTimeoutInMinutes", visibility=["read", "create", "update", "delete", "query"] + ) + """The idle timeout of the public IP address.""" + dns_settings: Optional["_models.VirtualMachineScaleSetPublicIPAddressConfigurationDnsSettings"] = rest_field( + name="dnsSettings", visibility=["read", "create", "update", "delete", "query"] + ) + """The dns settings to be applied on the publicIP addresses .""" + public_ip_prefix: Optional["_models.SubResource"] = rest_field( + name="publicIPPrefix", visibility=["read", "create", "update", "delete", "query"] + ) + """The PublicIPPrefix from which to allocate publicIP addresses.""" + delete_option: Optional[Union[str, "_models.DeleteOptions"]] = rest_field( + name="deleteOption", visibility=["read", "create", "update", "delete", "query"] + ) + """Specify what happens to the public IP when the VM is deleted. Known values are: \"Delete\" and + \"Detach\".""" + + @overload + def __init__( + self, + *, + idle_timeout_in_minutes: Optional[int] = None, + dns_settings: Optional["_models.VirtualMachineScaleSetPublicIPAddressConfigurationDnsSettings"] = None, + public_ip_prefix: Optional["_models.SubResource"] = None, + delete_option: Optional[Union[str, "_models.DeleteOptions"]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class VirtualMachineScaleSetUpdateStorageProfile(_Model): # pylint: disable=name-too-long + """Describes a virtual machine scale set storage profile. + + :ivar image_reference: The image reference. + :vartype image_reference: ~azure.mgmt.compute.models.ImageReference + :ivar os_disk: The OS disk. + :vartype os_disk: ~azure.mgmt.compute.models.VirtualMachineScaleSetUpdateOSDisk + :ivar data_disks: The data disks. + :vartype data_disks: list[~azure.mgmt.compute.models.VirtualMachineScaleSetDataDisk] + :ivar disk_controller_type: Specifies the disk controller type configured for the virtual + machines in the scale set. **Note:** You need to deallocate the virtual machines in the scale + set before updating its disk controller type based on the upgrade mode configured for the scale + set. Minimum api-version: 2022-08-01. Known values are: "SCSI" and "NVMe". + :vartype disk_controller_type: str or ~azure.mgmt.compute.models.DiskControllerTypes + """ + + image_reference: Optional["_models.ImageReference"] = rest_field( + name="imageReference", visibility=["read", "create", "update", "delete", "query"] + ) + """The image reference.""" + os_disk: Optional["_models.VirtualMachineScaleSetUpdateOSDisk"] = rest_field( + name="osDisk", visibility=["read", "create", "update", "delete", "query"] + ) + """The OS disk.""" + data_disks: Optional[list["_models.VirtualMachineScaleSetDataDisk"]] = rest_field( + name="dataDisks", visibility=["read", "create", "update", "delete", "query"] + ) + """The data disks.""" + disk_controller_type: Optional[Union[str, "_models.DiskControllerTypes"]] = rest_field( + name="diskControllerType", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies the disk controller type configured for the virtual machines in the scale set. + **Note:** You need to deallocate the virtual machines in the scale set before updating its disk + controller type based on the upgrade mode configured for the scale set. Minimum api-version: + 2022-08-01. Known values are: \"SCSI\" and \"NVMe\".""" + + @overload + def __init__( + self, + *, + image_reference: Optional["_models.ImageReference"] = None, + os_disk: Optional["_models.VirtualMachineScaleSetUpdateOSDisk"] = None, + data_disks: Optional[list["_models.VirtualMachineScaleSetDataDisk"]] = None, + disk_controller_type: Optional[Union[str, "_models.DiskControllerTypes"]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class VirtualMachineScaleSetUpdateVMProfile(_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.models.VirtualMachineScaleSetUpdateOSProfile + :ivar storage_profile: The virtual machine scale set storage profile. + :vartype storage_profile: ~azure.mgmt.compute.models.VirtualMachineScaleSetUpdateStorageProfile + :ivar network_profile: The virtual machine scale set network profile. + :vartype network_profile: ~azure.mgmt.compute.models.VirtualMachineScaleSetUpdateNetworkProfile + :ivar security_posture_reference: The virtual machine scale set security posture reference. + :vartype security_posture_reference: ~azure.mgmt.compute.models.SecurityPostureReferenceUpdate + :ivar security_profile: The virtual machine scale set Security profile. + :vartype security_profile: ~azure.mgmt.compute.models.SecurityProfile + :ivar diagnostics_profile: The virtual machine scale set diagnostics profile. + :vartype diagnostics_profile: ~azure.mgmt.compute.models.DiagnosticsProfile + :ivar extension_profile: The virtual machine scale set extension profile. + :vartype extension_profile: ~azure.mgmt.compute.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. Minimum + api-version: 2019-03-01. + :vartype billing_profile: ~azure.mgmt.compute.models.BillingProfile + :ivar scheduled_events_profile: Specifies Scheduled Event related configurations. + :vartype scheduled_events_profile: ~azure.mgmt.compute.models.ScheduledEventsProfile + :ivar user_data: UserData for the VM, which must be base-64 encoded. Customer should not pass + any secrets in here.

Minimum api-version: 2021-03-01. + :vartype user_data: str + :ivar hardware_profile: Specifies the hardware profile related details of a scale set. Minimum + api-version: 2021-11-01. + :vartype hardware_profile: ~azure.mgmt.compute.models.VirtualMachineScaleSetHardwareProfile + """ + + os_profile: Optional["_models.VirtualMachineScaleSetUpdateOSProfile"] = rest_field( + name="osProfile", visibility=["read", "create", "update", "delete", "query"] + ) + """The virtual machine scale set OS profile.""" + storage_profile: Optional["_models.VirtualMachineScaleSetUpdateStorageProfile"] = rest_field( + name="storageProfile", visibility=["read", "create", "update", "delete", "query"] + ) + """The virtual machine scale set storage profile.""" + network_profile: Optional["_models.VirtualMachineScaleSetUpdateNetworkProfile"] = rest_field( + name="networkProfile", visibility=["read", "create", "update", "delete", "query"] + ) + """The virtual machine scale set network profile.""" + security_posture_reference: Optional["_models.SecurityPostureReferenceUpdate"] = rest_field( + name="securityPostureReference", visibility=["read", "create", "update", "delete", "query"] + ) + """The virtual machine scale set security posture reference.""" + security_profile: Optional["_models.SecurityProfile"] = rest_field( + name="securityProfile", visibility=["read", "create", "update", "delete", "query"] + ) + """The virtual machine scale set Security profile.""" + diagnostics_profile: Optional["_models.DiagnosticsProfile"] = rest_field( + name="diagnosticsProfile", visibility=["read", "create", "update", "delete", "query"] + ) + """The virtual machine scale set diagnostics profile.""" + extension_profile: Optional["_models.VirtualMachineScaleSetExtensionProfile"] = rest_field( + name="extensionProfile", visibility=["read", "create", "update", "delete", "query"] + ) + """The virtual machine scale set extension profile.""" + license_type: Optional[str] = rest_field( + name="licenseType", visibility=["read", "create", "update", "delete", "query"] + ) + """The license type, which is for bring your own license scenario.""" + billing_profile: Optional["_models.BillingProfile"] = rest_field( + name="billingProfile", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies the billing related details of a Azure Spot VMSS. Minimum api-version: 2019-03-01.""" + scheduled_events_profile: Optional["_models.ScheduledEventsProfile"] = rest_field( + name="scheduledEventsProfile", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies Scheduled Event related configurations.""" + user_data: Optional[str] = rest_field(name="userData", visibility=["read", "create", "update", "delete", "query"]) + """UserData for the VM, which must be base-64 encoded. Customer should not pass any secrets in + here.

Minimum api-version: 2021-03-01.""" + hardware_profile: Optional["_models.VirtualMachineScaleSetHardwareProfile"] = rest_field( + name="hardwareProfile", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies the hardware profile related details of a scale set. Minimum api-version: 2021-11-01.""" + + @overload + def __init__( + self, + *, + os_profile: Optional["_models.VirtualMachineScaleSetUpdateOSProfile"] = None, + storage_profile: Optional["_models.VirtualMachineScaleSetUpdateStorageProfile"] = None, + network_profile: Optional["_models.VirtualMachineScaleSetUpdateNetworkProfile"] = None, + security_posture_reference: Optional["_models.SecurityPostureReferenceUpdate"] = None, + security_profile: Optional["_models.SecurityProfile"] = None, + diagnostics_profile: Optional["_models.DiagnosticsProfile"] = None, + extension_profile: Optional["_models.VirtualMachineScaleSetExtensionProfile"] = None, + license_type: Optional[str] = None, + billing_profile: Optional["_models.BillingProfile"] = None, + scheduled_events_profile: Optional["_models.ScheduledEventsProfile"] = None, + user_data: Optional[str] = None, + hardware_profile: Optional["_models.VirtualMachineScaleSetHardwareProfile"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class VirtualMachineScaleSetVM(TrackedResource): + """Describes a virtual machine scale set virtual machine. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.compute.models.SystemData + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar location: The geo-location where the resource lives. Required. + :vartype location: str + :ivar properties: Describes the properties of a virtual machine scale set virtual machine. + :vartype properties: ~azure.mgmt.compute.models.VirtualMachineScaleSetVMProperties + :ivar instance_id: The virtual machine instance ID. + :vartype instance_id: str + :ivar sku: The virtual machine SKU. + :vartype sku: ~azure.mgmt.compute.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.models.Plan + :ivar resources: The virtual machine child extension resources. + :vartype resources: list[~azure.mgmt.compute.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.models.VirtualMachineIdentity + :ivar etag: Etag is property returned in Update/Get response of the VMSS VM, so that customer + can supply it in the header to ensure optimistic updates. + :vartype etag: str + """ + + properties: Optional["_models.VirtualMachineScaleSetVMProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Describes the properties of a virtual machine scale set virtual machine.""" + instance_id: Optional[str] = rest_field(name="instanceId", visibility=["read"]) + """The virtual machine instance ID.""" + sku: Optional["_models.Sku"] = rest_field(visibility=["read"]) + """The virtual machine SKU.""" + plan: Optional["_models.Plan"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """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**.""" + resources: Optional[list["_models.VirtualMachineExtension"]] = rest_field(visibility=["read"]) + """The virtual machine child extension resources.""" + zones: Optional[list[str]] = rest_field(visibility=["read"]) + """The virtual machine zones.""" + identity: Optional["_models.VirtualMachineIdentity"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The identity of the virtual machine, if configured.""" + etag: Optional[str] = rest_field(visibility=["read"]) + """Etag is property returned in Update/Get response of the VMSS VM, so that customer can supply it + in the header to ensure optimistic updates.""" + + @overload + def __init__( + self, + *, + location: str, + tags: Optional[dict[str, str]] = None, + properties: Optional["_models.VirtualMachineScaleSetVMProperties"] = None, + plan: Optional["_models.Plan"] = None, + identity: Optional["_models.VirtualMachineIdentity"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class VirtualMachineScaleSetVMExtension(SubResourceReadOnly): + """Describes a VMSS VM Extension. + + :ivar id: Resource Id. + :vartype id: str + :ivar properties: Describes the properties of a Virtual Machine Extension. + :vartype properties: ~azure.mgmt.compute.models.VirtualMachineExtensionProperties + :ivar location: The location of the extension. + :vartype location: str + :ivar vm_type: Resource type. + :vartype vm_type: str + :ivar name: Resource name. + :vartype name: str + """ + + properties: Optional["_models.VirtualMachineExtensionProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Describes the properties of a Virtual Machine Extension.""" + location: Optional[str] = rest_field(visibility=["read", "create"]) + """The location of the extension.""" + vm_type: Optional[str] = rest_field(name="type", visibility=["read"]) + """Resource type.""" + name: Optional[str] = rest_field(visibility=["read"]) + """Resource name.""" + + @overload + def __init__( + self, + *, + properties: Optional["_models.VirtualMachineExtensionProperties"] = None, + location: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class VirtualMachineScaleSetVMExtensionsSummary(_Model): # pylint: disable=name-too-long + """Extensions summary for virtual machines of a virtual machine scale set. + + :ivar name: The extension name. + :vartype name: str + :ivar statuses_summary: The extensions information. + :vartype statuses_summary: list[~azure.mgmt.compute.models.VirtualMachineStatusCodeCount] + """ + + name: Optional[str] = rest_field(visibility=["read"]) + """The extension name.""" + statuses_summary: Optional[list["_models.VirtualMachineStatusCodeCount"]] = rest_field( + name="statusesSummary", visibility=["read"] + ) + """The extensions information.""" + + +class VirtualMachineScaleSetVMExtensionUpdate(SubResourceReadOnly): + """Describes a VMSS VM Extension. + + :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 properties: Describes the properties of a Virtual Machine Extension. + :vartype properties: ~azure.mgmt.compute.models.VirtualMachineExtensionUpdateProperties + """ + + name: Optional[str] = rest_field(visibility=["read"]) + """The name of the extension.""" + type: Optional[str] = rest_field(visibility=["read"]) + """Resource type.""" + properties: Optional["_models.VirtualMachineExtensionUpdateProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Describes the properties of a Virtual Machine Extension.""" + + @overload + def __init__( + self, + *, + properties: Optional["_models.VirtualMachineExtensionUpdateProperties"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class VirtualMachineScaleSetVMInstanceIDs(_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] + """ + + instance_ids: Optional[list[str]] = rest_field( + name="instanceIds", visibility=["read", "create", "update", "delete", "query"] + ) + """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.""" + + @overload + def __init__( + self, + *, + instance_ids: Optional[list[str]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class VirtualMachineScaleSetVMInstanceRequiredIDs(_Model): # pylint: disable=name-too-long + """Specifies a list of virtual machine instance IDs from the VM scale set. + + :ivar instance_ids: The virtual machine scale set instance ids. Required. + :vartype instance_ids: list[str] + """ + + instance_ids: list[str] = rest_field(name="instanceIds", visibility=["read", "create", "update", "delete", "query"]) + """The virtual machine scale set instance ids. Required.""" + + @overload + def __init__( + self, + *, + instance_ids: list[str], + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class VirtualMachineScaleSetVMInstanceView(_Model): + """The instance view of a virtual machine scale set VM. + + :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.models.VirtualMachineAgentInstanceView + :ivar maintenance_redeploy_status: The Maintenance Operation status on the virtual machine. + :vartype maintenance_redeploy_status: ~azure.mgmt.compute.models.MaintenanceRedeployStatus + :ivar disks: The disks information. + :vartype disks: list[~azure.mgmt.compute.models.DiskInstanceView] + :ivar extensions: The extensions information. + :vartype extensions: list[~azure.mgmt.compute.models.VirtualMachineExtensionInstanceView] + :ivar vm_health: The health status for the VM. + :vartype vm_health: ~azure.mgmt.compute.models.VirtualMachineHealthStatus + :ivar boot_diagnostics: Boot Diagnostics is a debugging feature which allows you to view + Console Output and Screenshot to diagnose VM status. You can easily view the output of your + console log. Azure also enables you to see a screenshot of the VM from the hypervisor. + :vartype boot_diagnostics: ~azure.mgmt.compute.models.BootDiagnosticsInstanceView + :ivar statuses: The resource status information. + :vartype statuses: list[~azure.mgmt.compute.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. 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 + :ivar computer_name: Specifies the host OS name of the virtual machine.

This name + cannot be updated after the VM is created.

**Max-length (Windows):** 15 characters +

**Max-length (Linux):** 64 characters.

For naming conventions and + restrictions see `Azure infrastructure services implementation guidelines + `_. + :vartype computer_name: str + :ivar os_name: The Operating System running on the hybrid machine. + :vartype os_name: str + :ivar os_version: The version of Operating System running on the hybrid machine. + :vartype os_version: str + :ivar hyper_v_generation: The hypervisor generation of the Virtual Machine [V1, V2]. Known + values are: "V1" and "V2". + :vartype hyper_v_generation: str or ~azure.mgmt.compute.models.HyperVGeneration + """ + + platform_update_domain: Optional[int] = rest_field( + name="platformUpdateDomain", visibility=["read", "create", "update", "delete", "query"] + ) + """The Update Domain count.""" + platform_fault_domain: Optional[int] = rest_field( + name="platformFaultDomain", visibility=["read", "create", "update", "delete", "query"] + ) + """The Fault Domain count.""" + rdp_thumb_print: Optional[str] = rest_field( + name="rdpThumbPrint", visibility=["read", "create", "update", "delete", "query"] + ) + """The Remote desktop certificate thumbprint.""" + vm_agent: Optional["_models.VirtualMachineAgentInstanceView"] = rest_field( + name="vmAgent", visibility=["read", "create", "update", "delete", "query"] + ) + """The VM Agent running on the virtual machine.""" + maintenance_redeploy_status: Optional["_models.MaintenanceRedeployStatus"] = rest_field( + name="maintenanceRedeployStatus", visibility=["read", "create", "update", "delete", "query"] + ) + """The Maintenance Operation status on the virtual machine.""" + disks: Optional[list["_models.DiskInstanceView"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The disks information.""" + extensions: Optional[list["_models.VirtualMachineExtensionInstanceView"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The extensions information.""" + vm_health: Optional["_models.VirtualMachineHealthStatus"] = rest_field(name="vmHealth", visibility=["read"]) + """The health status for the VM.""" + boot_diagnostics: Optional["_models.BootDiagnosticsInstanceView"] = rest_field( + name="bootDiagnostics", visibility=["read", "create", "update", "delete", "query"] + ) + """Boot Diagnostics is a debugging feature which allows you to view Console Output and Screenshot + to diagnose VM status. You can easily view the output of your console log. Azure also enables + you to see a screenshot of the VM from the hypervisor.""" + statuses: Optional[list["_models.InstanceViewStatus"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The resource status information.""" + assigned_host: Optional[str] = rest_field(name="assignedHost", visibility=["read"]) + """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. Minimum api-version: 2020-06-01.""" + placement_group_id: Optional[str] = rest_field( + name="placementGroupId", visibility=["read", "create", "update", "delete", "query"] + ) + """The placement group in which the VM is running. If the VM is deallocated it will not have a + placementGroupId.""" + computer_name: Optional[str] = rest_field( + name="computerName", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies the host OS name of the virtual machine.

This name cannot be updated after + the VM is created.

**Max-length (Windows):** 15 characters

**Max-length + (Linux):** 64 characters.

For naming conventions and restrictions see `Azure + infrastructure services implementation guidelines + `_.""" + os_name: Optional[str] = rest_field(name="osName", visibility=["read", "create", "update", "delete", "query"]) + """The Operating System running on the hybrid machine.""" + os_version: Optional[str] = rest_field(name="osVersion", visibility=["read", "create", "update", "delete", "query"]) + """The version of Operating System running on the hybrid machine.""" + hyper_v_generation: Optional[Union[str, "_models.HyperVGeneration"]] = rest_field( + name="hyperVGeneration", visibility=["read", "create", "update", "delete", "query"] + ) + """The hypervisor generation of the Virtual Machine [V1, V2]. Known values are: \"V1\" and \"V2\".""" + + @overload + def __init__( + self, + *, + platform_update_domain: Optional[int] = None, + platform_fault_domain: Optional[int] = None, + rdp_thumb_print: Optional[str] = None, + vm_agent: Optional["_models.VirtualMachineAgentInstanceView"] = None, + maintenance_redeploy_status: Optional["_models.MaintenanceRedeployStatus"] = None, + disks: Optional[list["_models.DiskInstanceView"]] = None, + extensions: Optional[list["_models.VirtualMachineExtensionInstanceView"]] = None, + boot_diagnostics: Optional["_models.BootDiagnosticsInstanceView"] = None, + statuses: Optional[list["_models.InstanceViewStatus"]] = None, + placement_group_id: Optional[str] = None, + computer_name: Optional[str] = None, + os_name: Optional[str] = None, + os_version: Optional[str] = None, + hyper_v_generation: Optional[Union[str, "_models.HyperVGeneration"]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class VirtualMachineScaleSetVMNetworkProfileConfiguration(_Model): # pylint: disable=name-too-long + """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.models.VirtualMachineScaleSetNetworkConfiguration] + """ + + network_interface_configurations: Optional[list["_models.VirtualMachineScaleSetNetworkConfiguration"]] = rest_field( + name="networkInterfaceConfigurations", visibility=["read", "create", "update", "delete", "query"] + ) + """The list of network configurations.""" + + @overload + def __init__( + self, + *, + network_interface_configurations: Optional[list["_models.VirtualMachineScaleSetNetworkConfiguration"]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class VirtualMachineScaleSetVMProfile(_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.models.VirtualMachineScaleSetOSProfile + :ivar storage_profile: Specifies the storage settings for the virtual machine disks. + :vartype storage_profile: ~azure.mgmt.compute.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.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.models.SecurityProfile + :ivar diagnostics_profile: Specifies the boot diagnostic settings state. Minimum api-version: + 2015-06-15. + :vartype diagnostics_profile: ~azure.mgmt.compute.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.models.VirtualMachineScaleSetExtensionProfile + :ivar license_type: Specifies that the image or disk that is being used was licensed + on-premises.

Possible values for Windows Server operating system are:

+ Windows_Client

Windows_Server

Possible values for Linux Server operating + system are:

RHEL_BYOS (for RHEL)

SLES_BYOS (for SUSE)

For more + information, see `Azure Hybrid Use Benefit for Windows Server + `_ +

`Azure Hybrid Use Benefit for Linux Server + `_

+ Minimum api-version: 2015-06-15. + :vartype license_type: str + :ivar priority: Specifies the priority for the virtual machines in the scale set. Minimum + api-version: 2017-10-30-preview. Known values are: "Regular", "Low", and "Spot". + :vartype priority: str or ~azure.mgmt.compute.models.VirtualMachinePriorityTypes + :ivar eviction_policy: Specifies the eviction policy for the Azure Spot virtual machine and + Azure Spot scale set. For Azure Spot virtual machines, both 'Deallocate' and 'Delete' are + supported and the minimum api-version is 2019-03-01. For Azure Spot scale sets, both + 'Deallocate' and 'Delete' are supported and the minimum api-version is 2017-10-30-preview. + Known values are: "Deallocate" and "Delete". + :vartype eviction_policy: str or ~azure.mgmt.compute.models.VirtualMachineEvictionPolicyTypes + :ivar billing_profile: Specifies the billing related details of a Azure Spot VMSS. Minimum + api-version: 2019-03-01. + :vartype billing_profile: ~azure.mgmt.compute.models.BillingProfile + :ivar scheduled_events_profile: Specifies Scheduled Event related configurations. + :vartype scheduled_events_profile: ~azure.mgmt.compute.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. Minimum api-version: 2021-03-01. + :vartype user_data: str + :ivar capacity_reservation: Specifies the capacity reservation related details of a scale set. + Minimum api-version: 2021-04-01. + :vartype capacity_reservation: ~azure.mgmt.compute.models.CapacityReservationProfile + :ivar application_profile: Specifies the gallery applications that should be made available to + the VM/VMSS. + :vartype application_profile: ~azure.mgmt.compute.models.ApplicationProfile + :ivar hardware_profile: Specifies the hardware profile related details of a scale set. Minimum + api-version: 2021-11-01. + :vartype hardware_profile: ~azure.mgmt.compute.models.VirtualMachineScaleSetHardwareProfile + :ivar service_artifact_reference: Specifies the service artifact reference id used to set same + image version for all virtual machines in the scale set when using 'latest' image version. + Minimum api-version: 2022-11-01. + :vartype service_artifact_reference: ~azure.mgmt.compute.models.ServiceArtifactReference + :ivar security_posture_reference: Specifies the security posture to be used in the scale set. + Minimum api-version: 2023-03-01. + :vartype security_posture_reference: ~azure.mgmt.compute.models.SecurityPostureReference + :ivar time_created: Specifies the time in which this VM profile for the Virtual Machine Scale + Set was created. This value will be added to VMSS Flex VM tags when creating/updating the VMSS + VM Profile. Minimum API version for this property is 2023-09-01. + :vartype time_created: ~datetime.datetime + """ + + os_profile: Optional["_models.VirtualMachineScaleSetOSProfile"] = rest_field( + name="osProfile", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies the operating system settings for the virtual machines in the scale set.""" + storage_profile: Optional["_models.VirtualMachineScaleSetStorageProfile"] = rest_field( + name="storageProfile", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies the storage settings for the virtual machine disks.""" + network_profile: Optional["_models.VirtualMachineScaleSetNetworkProfile"] = rest_field( + name="networkProfile", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies properties of the network interfaces of the virtual machines in the scale set.""" + security_profile: Optional["_models.SecurityProfile"] = rest_field( + name="securityProfile", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies the Security related profile settings for the virtual machines in the scale set.""" + diagnostics_profile: Optional["_models.DiagnosticsProfile"] = rest_field( + name="diagnosticsProfile", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies the boot diagnostic settings state. Minimum api-version: 2015-06-15.""" + extension_profile: Optional["_models.VirtualMachineScaleSetExtensionProfile"] = rest_field( + name="extensionProfile", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies a collection of settings for extensions installed on virtual machines in the scale + set.""" + license_type: Optional[str] = rest_field( + name="licenseType", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies that the image or disk that is being used was licensed on-premises.

Possible + values for Windows Server operating system are:

Windows_Client

Windows_Server +

Possible values for Linux Server operating system are:

RHEL_BYOS (for RHEL) +

SLES_BYOS (for SUSE)

For more information, see `Azure Hybrid Use Benefit for + Windows Server + `_ +

`Azure Hybrid Use Benefit for Linux Server + `_

+ Minimum api-version: 2015-06-15.""" + priority: Optional[Union[str, "_models.VirtualMachinePriorityTypes"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies the priority for the virtual machines in the scale set. Minimum api-version: + 2017-10-30-preview. Known values are: \"Regular\", \"Low\", and \"Spot\".""" + eviction_policy: Optional[Union[str, "_models.VirtualMachineEvictionPolicyTypes"]] = rest_field( + name="evictionPolicy", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies the eviction policy for the Azure Spot virtual machine and Azure Spot scale set. For + Azure Spot virtual machines, both 'Deallocate' and 'Delete' are supported and the minimum + api-version is 2019-03-01. For Azure Spot scale sets, both 'Deallocate' and 'Delete' are + supported and the minimum api-version is 2017-10-30-preview. Known values are: \"Deallocate\" + and \"Delete\".""" + billing_profile: Optional["_models.BillingProfile"] = rest_field( + name="billingProfile", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies the billing related details of a Azure Spot VMSS. Minimum api-version: 2019-03-01.""" + scheduled_events_profile: Optional["_models.ScheduledEventsProfile"] = rest_field( + name="scheduledEventsProfile", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies Scheduled Event related configurations.""" + user_data: Optional[str] = rest_field(name="userData", visibility=["read", "create", "update", "delete", "query"]) + """UserData for the virtual machines in the scale set, which must be base-64 encoded. Customer + should not pass any secrets in here. Minimum api-version: 2021-03-01.""" + capacity_reservation: Optional["_models.CapacityReservationProfile"] = rest_field( + name="capacityReservation", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies the capacity reservation related details of a scale set. Minimum api-version: + 2021-04-01.""" + application_profile: Optional["_models.ApplicationProfile"] = rest_field( + name="applicationProfile", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies the gallery applications that should be made available to the VM/VMSS.""" + hardware_profile: Optional["_models.VirtualMachineScaleSetHardwareProfile"] = rest_field( + name="hardwareProfile", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies the hardware profile related details of a scale set. Minimum api-version: 2021-11-01.""" + service_artifact_reference: Optional["_models.ServiceArtifactReference"] = rest_field( + name="serviceArtifactReference", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies the service artifact reference id used to set same image version for all virtual + machines in the scale set when using 'latest' image version. Minimum api-version: 2022-11-01.""" + security_posture_reference: Optional["_models.SecurityPostureReference"] = rest_field( + name="securityPostureReference", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies the security posture to be used in the scale set. Minimum api-version: 2023-03-01.""" + time_created: Optional[datetime.datetime] = rest_field(name="timeCreated", visibility=["read"], format="rfc3339") + """Specifies the time in which this VM profile for the Virtual Machine Scale Set was created. This + value will be added to VMSS Flex VM tags when creating/updating the VMSS VM Profile. Minimum + API version for this property is 2023-09-01.""" + + @overload + def __init__( + self, + *, + os_profile: Optional["_models.VirtualMachineScaleSetOSProfile"] = None, + storage_profile: Optional["_models.VirtualMachineScaleSetStorageProfile"] = None, + network_profile: Optional["_models.VirtualMachineScaleSetNetworkProfile"] = None, + security_profile: Optional["_models.SecurityProfile"] = None, + diagnostics_profile: Optional["_models.DiagnosticsProfile"] = None, + extension_profile: Optional["_models.VirtualMachineScaleSetExtensionProfile"] = None, + license_type: Optional[str] = None, + priority: Optional[Union[str, "_models.VirtualMachinePriorityTypes"]] = None, + eviction_policy: Optional[Union[str, "_models.VirtualMachineEvictionPolicyTypes"]] = None, + billing_profile: Optional["_models.BillingProfile"] = None, + scheduled_events_profile: Optional["_models.ScheduledEventsProfile"] = None, + user_data: Optional[str] = None, + capacity_reservation: Optional["_models.CapacityReservationProfile"] = None, + application_profile: Optional["_models.ApplicationProfile"] = None, + hardware_profile: Optional["_models.VirtualMachineScaleSetHardwareProfile"] = None, + service_artifact_reference: Optional["_models.ServiceArtifactReference"] = None, + security_posture_reference: Optional["_models.SecurityPostureReference"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class VirtualMachineScaleSetVMProperties(_Model): + """Describes the properties of a virtual machine scale set virtual machine. + + :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.models.VirtualMachineScaleSetVMInstanceView + :ivar hardware_profile: Specifies the hardware settings for the virtual machine. + :vartype hardware_profile: ~azure.mgmt.compute.models.HardwareProfile + :ivar resilient_vm_deletion_status: Specifies the resilient VM deletion status for the virtual + machine. Known values are: "Enabled", "Disabled", "InProgress", and "Failed". + :vartype resilient_vm_deletion_status: str or + ~azure.mgmt.compute.models.ResilientVMDeletionStatus + :ivar storage_profile: Specifies the storage settings for the virtual machine disks. + :vartype storage_profile: ~azure.mgmt.compute.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.models.AdditionalCapabilities + :ivar os_profile: Specifies the operating system settings for the virtual machine. + :vartype os_profile: ~azure.mgmt.compute.models.OSProfile + :ivar security_profile: Specifies the Security related profile settings for the virtual + machine. + :vartype security_profile: ~azure.mgmt.compute.models.SecurityProfile + :ivar network_profile: Specifies the network interfaces of the virtual machine. + :vartype network_profile: ~azure.mgmt.compute.models.NetworkProfile + :ivar network_profile_configuration: Specifies the network profile configuration of the virtual + machine. + :vartype network_profile_configuration: + ~azure.mgmt.compute.models.VirtualMachineScaleSetVMNetworkProfileConfiguration + :ivar diagnostics_profile: Specifies the boot diagnostic settings state. Minimum api-version: + 2015-06-15. + :vartype diagnostics_profile: ~azure.mgmt.compute.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 + `_. For more + information on Azure planned maintenance, see `Maintenance and updates for Virtual Machines in + Azure `_. 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.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.

Possible values for Windows Server operating system are:

+ Windows_Client

Windows_Server

Possible values for Linux Server operating + system are:

RHEL_BYOS (for RHEL)

SLES_BYOS (for SUSE)

For more + information, see `Azure Hybrid Use Benefit for Windows Server + `_ +

`Azure Hybrid Use Benefit for Linux Server + `_

+ 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.models.VirtualMachineScaleSetVMProtectionPolicy + :ivar user_data: UserData for the VM, which must be base-64 encoded. Customer should not pass + any secrets in here. Minimum api-version: 2021-03-01. + :vartype user_data: str + :ivar time_created: Specifies the time at which the Virtual Machine resource was created. + Minimum api-version: 2021-11-01. + :vartype time_created: ~datetime.datetime + """ + + latest_model_applied: Optional[bool] = rest_field(name="latestModelApplied", visibility=["read"]) + """Specifies whether the latest model has been applied to the virtual machine.""" + vm_id: Optional[str] = rest_field(name="vmId", visibility=["read"]) + """Azure VM unique ID.""" + instance_view: Optional["_models.VirtualMachineScaleSetVMInstanceView"] = rest_field( + name="instanceView", visibility=["read"] + ) + """The virtual machine instance view.""" + hardware_profile: Optional["_models.HardwareProfile"] = rest_field( + name="hardwareProfile", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies the hardware settings for the virtual machine.""" + resilient_vm_deletion_status: Optional[Union[str, "_models.ResilientVMDeletionStatus"]] = rest_field( + name="resilientVMDeletionStatus", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies the resilient VM deletion status for the virtual machine. Known values are: + \"Enabled\", \"Disabled\", \"InProgress\", and \"Failed\".""" + storage_profile: Optional["_models.StorageProfile"] = rest_field( + name="storageProfile", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies the storage settings for the virtual machine disks.""" + additional_capabilities: Optional["_models.AdditionalCapabilities"] = rest_field( + name="additionalCapabilities", visibility=["read", "create", "update", "delete", "query"] + ) + """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.""" + os_profile: Optional["_models.OSProfile"] = rest_field( + name="osProfile", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies the operating system settings for the virtual machine.""" + security_profile: Optional["_models.SecurityProfile"] = rest_field( + name="securityProfile", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies the Security related profile settings for the virtual machine.""" + network_profile: Optional["_models.NetworkProfile"] = rest_field( + name="networkProfile", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies the network interfaces of the virtual machine.""" + network_profile_configuration: Optional["_models.VirtualMachineScaleSetVMNetworkProfileConfiguration"] = rest_field( + name="networkProfileConfiguration", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies the network profile configuration of the virtual machine.""" + diagnostics_profile: Optional["_models.DiagnosticsProfile"] = rest_field( + name="diagnosticsProfile", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies the boot diagnostic settings state. Minimum api-version: 2015-06-15.""" + availability_set: Optional["_models.SubResource"] = rest_field( + name="availabilitySet", visibility=["read", "create", "update", "delete", "query"] + ) + """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 `_. For + more information on Azure planned maintenance, see `Maintenance and updates for Virtual + Machines in Azure + `_. Currently, a VM + can only be added to availability set at creation time. An existing VM cannot be added to an + availability set.""" + provisioning_state: Optional[str] = rest_field(name="provisioningState", visibility=["read"]) + """The provisioning state, which only appears in the response.""" + license_type: Optional[str] = rest_field( + name="licenseType", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies that the image or disk that is being used was licensed on-premises.

Possible + values for Windows Server operating system are:

Windows_Client

Windows_Server +

Possible values for Linux Server operating system are:

RHEL_BYOS (for RHEL) +

SLES_BYOS (for SUSE)

For more information, see `Azure Hybrid Use Benefit for + Windows Server + `_ +

`Azure Hybrid Use Benefit for Linux Server + `_

+ Minimum api-version: 2015-06-15.""" + model_definition_applied: Optional[str] = rest_field(name="modelDefinitionApplied", visibility=["read"]) + """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.""" + protection_policy: Optional["_models.VirtualMachineScaleSetVMProtectionPolicy"] = rest_field( + name="protectionPolicy", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies the protection policy of the virtual machine.""" + user_data: Optional[str] = rest_field(name="userData", visibility=["read", "create", "update", "delete", "query"]) + """UserData for the VM, which must be base-64 encoded. Customer should not pass any secrets in + here. Minimum api-version: 2021-03-01.""" + time_created: Optional[datetime.datetime] = rest_field(name="timeCreated", visibility=["read"], format="rfc3339") + """Specifies the time at which the Virtual Machine resource was created. Minimum api-version: + 2021-11-01.""" + + @overload + def __init__( + self, + *, + hardware_profile: Optional["_models.HardwareProfile"] = None, + resilient_vm_deletion_status: Optional[Union[str, "_models.ResilientVMDeletionStatus"]] = None, + storage_profile: Optional["_models.StorageProfile"] = None, + additional_capabilities: Optional["_models.AdditionalCapabilities"] = None, + os_profile: Optional["_models.OSProfile"] = None, + security_profile: Optional["_models.SecurityProfile"] = None, + network_profile: Optional["_models.NetworkProfile"] = None, + network_profile_configuration: Optional["_models.VirtualMachineScaleSetVMNetworkProfileConfiguration"] = None, + diagnostics_profile: Optional["_models.DiagnosticsProfile"] = None, + availability_set: Optional["_models.SubResource"] = None, + license_type: Optional[str] = None, + protection_policy: Optional["_models.VirtualMachineScaleSetVMProtectionPolicy"] = None, + user_data: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class VirtualMachineScaleSetVMProtectionPolicy(_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 + """ + + protect_from_scale_in: Optional[bool] = rest_field( + name="protectFromScaleIn", visibility=["read", "create", "update", "delete", "query"] + ) + """Indicates that the virtual machine scale set VM shouldn't be considered for deletion during a + scale-in operation.""" + protect_from_scale_set_actions: Optional[bool] = rest_field( + name="protectFromScaleSetActions", visibility=["read", "create", "update", "delete", "query"] + ) + """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.""" + + @overload + def __init__( + self, + *, + protect_from_scale_in: Optional[bool] = None, + protect_from_scale_set_actions: Optional[bool] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class VirtualMachineSize(_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 + """ + + name: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The name of the virtual machine size.""" + number_of_cores: Optional[int] = rest_field( + name="numberOfCores", visibility=["read", "create", "update", "delete", "query"] + ) + """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 + `_.""" + os_disk_size_in_mb: Optional[int] = rest_field( + name="osDiskSizeInMB", visibility=["read", "create", "update", "delete", "query"] + ) + """The OS disk size, in MB, allowed by the virtual machine size.""" + resource_disk_size_in_mb: Optional[int] = rest_field( + name="resourceDiskSizeInMB", visibility=["read", "create", "update", "delete", "query"] + ) + """The resource disk size, in MB, allowed by the virtual machine size.""" + memory_in_mb: Optional[int] = rest_field( + name="memoryInMB", visibility=["read", "create", "update", "delete", "query"] + ) + """The amount of memory, in MB, supported by the virtual machine size.""" + max_data_disk_count: Optional[int] = rest_field( + name="maxDataDiskCount", visibility=["read", "create", "update", "delete", "query"] + ) + """The maximum number of data disks that can be attached to the virtual machine size.""" + + @overload + 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, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class VirtualMachineSoftwarePatchProperties(_Model): + """Describes the properties of a Virtual Machine software patch. + + :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. Known values are: + "Unknown", "NeverReboots", "AlwaysRequiresReboot", and "CanRequestReboot". + :vartype reboot_behavior: str or ~azure.mgmt.compute.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. Known values are: + "Unknown" and "Available". + :vartype assessment_state: str or ~azure.mgmt.compute.models.PatchAssessmentState + """ + + patch_id: Optional[str] = rest_field(name="patchId", visibility=["read"]) + """A unique identifier for the patch.""" + name: Optional[str] = rest_field(visibility=["read"]) + """The friendly name of the patch.""" + version: Optional[str] = rest_field(visibility=["read"]) + """The version number of the patch. This property applies only to Linux patches.""" + kb_id: Optional[str] = rest_field(name="kbId", visibility=["read"]) + """The KBID of the patch. Only applies to Windows patches.""" + classifications: Optional[list[str]] = rest_field(visibility=["read"]) + """The classification(s) of the patch as provided by the patch publisher.""" + reboot_behavior: Optional[Union[str, "_models.VMGuestPatchRebootBehavior"]] = rest_field( + name="rebootBehavior", visibility=["read"] + ) + """Describes the reboot requirements of the patch. Known values are: \"Unknown\", + \"NeverReboots\", \"AlwaysRequiresReboot\", and \"CanRequestReboot\".""" + activity_id: Optional[str] = rest_field(name="activityId", visibility=["read"]) + """The activity ID of the operation that produced this result. It is used to correlate across CRP + and extension logs.""" + published_date: Optional[datetime.datetime] = rest_field( + name="publishedDate", visibility=["read"], format="rfc3339" + ) + """The UTC timestamp when the repository published this patch.""" + last_modified_date_time: Optional[datetime.datetime] = rest_field( + name="lastModifiedDateTime", visibility=["read"], format="rfc3339" + ) + """The UTC timestamp of the last update to this patch record.""" + assessment_state: Optional[Union[str, "_models.PatchAssessmentState"]] = rest_field( + name="assessmentState", visibility=["read"] + ) + """Describes the availability of a given patch. Known values are: \"Unknown\" and \"Available\".""" + + +class VirtualMachineStatusCodeCount(_Model): + """The status code and count of the virtual machine scale set instance view status summary. + + :ivar code: The instance view status code. + :vartype code: str + :ivar count: The number of instances having a particular status code. + :vartype count: int + """ + + code: Optional[str] = rest_field(visibility=["read"]) + """The instance view status code.""" + count: Optional[int] = rest_field(visibility=["read"]) + """The number of instances having a particular status code.""" + + +class VirtualMachineUpdate(UpdateResource): + """Describes a Virtual Machine Update. + + :ivar 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.models.Plan + :ivar properties: Describes the properties of a Virtual Machine. + :vartype properties: ~azure.mgmt.compute.models.VirtualMachineProperties + :ivar identity: The identity of the virtual machine, if configured. + :vartype identity: ~azure.mgmt.compute.models.VirtualMachineIdentity + :ivar zones: The virtual machine zones. + :vartype zones: list[str] + """ + + plan: Optional["_models.Plan"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """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**.""" + properties: Optional["_models.VirtualMachineProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Describes the properties of a Virtual Machine.""" + identity: Optional["_models.VirtualMachineIdentity"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The identity of the virtual machine, if configured.""" + zones: Optional[list[str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The virtual machine zones.""" + + @overload + def __init__( + self, + *, + tags: Optional[dict[str, str]] = None, + plan: Optional["_models.Plan"] = None, + properties: Optional["_models.VirtualMachineProperties"] = None, + identity: Optional["_models.VirtualMachineIdentity"] = None, + zones: Optional[list[str]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class VMDiskSecurityProfile(_Model): + """Specifies the security profile settings for the managed disk. **Note:** It can only be set for + Confidential VMs. + + :ivar security_encryption_type: Specifies the EncryptionType of the managed disk. It is set to + DiskWithVMGuestState for encryption of the managed disk along with VMGuestState blob, + VMGuestStateOnly for encryption of just the VMGuestState blob, and NonPersistedTPM for not + persisting firmware state in the VMGuestState blob.. **Note:** It can be set for only + Confidential VMs. Known values are: "VMGuestStateOnly", "DiskWithVMGuestState", and + "NonPersistedTPM". + :vartype security_encryption_type: str or ~azure.mgmt.compute.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.models.DiskEncryptionSetParameters + """ + + security_encryption_type: Optional[Union[str, "_models.SecurityEncryptionTypes"]] = rest_field( + name="securityEncryptionType", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies the EncryptionType of the managed disk. It is set to DiskWithVMGuestState for + encryption of the managed disk along with VMGuestState blob, VMGuestStateOnly for encryption of + just the VMGuestState blob, and NonPersistedTPM for not persisting firmware state in the + VMGuestState blob.. **Note:** It can be set for only Confidential VMs. Known values are: + \"VMGuestStateOnly\", \"DiskWithVMGuestState\", and \"NonPersistedTPM\".""" + disk_encryption_set: Optional["_models.DiskEncryptionSetParameters"] = rest_field( + name="diskEncryptionSet", visibility=["read", "create", "update", "delete", "query"] + ) + """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.""" + + @overload + def __init__( + self, + *, + security_encryption_type: Optional[Union[str, "_models.SecurityEncryptionTypes"]] = None, + disk_encryption_set: Optional["_models.DiskEncryptionSetParameters"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class VMGalleryApplication(_Model): + """Specifies the required information to reference a compute gallery application version. + + :ivar 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: Specifies the GalleryApplicationVersion resource id on the form of + /subscriptions/{SubscriptionId}/resourceGroups/{ResourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{application}/versions/{version}. + Required. + :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 + """ + + tags: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Optional, Specifies a passthrough value for more generic context.""" + order: Optional[int] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Optional, Specifies the order in which the packages have to be installed.""" + package_reference_id: str = rest_field( + name="packageReferenceId", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies the GalleryApplicationVersion resource id on the form of + /subscriptions/{SubscriptionId}/resourceGroups/{ResourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{application}/versions/{version}. + Required.""" + configuration_reference: Optional[str] = rest_field( + name="configurationReference", visibility=["read", "create", "update", "delete", "query"] + ) + """Optional, Specifies the uri to an azure blob that will replace the default configuration for + the package if provided.""" + treat_failure_as_deployment_failure: Optional[bool] = rest_field( + name="treatFailureAsDeploymentFailure", visibility=["read", "create", "update", "delete", "query"] + ) + """Optional, If true, any failure for any operation in the VmApplication will fail the deployment.""" + enable_automatic_upgrade: Optional[bool] = rest_field( + name="enableAutomaticUpgrade", visibility=["read", "create", "update", "delete", "query"] + ) + """If set to true, when a new Gallery Application version is available in PIR/SIG, it will be + automatically updated for the VM/VMSS.""" + + @overload + 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, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class VmImagesInEdgeZoneListResult(_Model): + """The List VmImages in EdgeZone operation response. + + :ivar value: The list of VMImages in EdgeZone. + :vartype value: list[~azure.mgmt.compute.models.VirtualMachineImageResource] + :ivar next_link: The URI to fetch the next page of VMImages in EdgeZone. Call ListNext() with + this URI to fetch the next page of VmImages. + :vartype next_link: str + """ + + value: Optional[list["_models.VirtualMachineImageResource"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The list of VMImages in EdgeZone.""" + next_link: Optional[str] = rest_field(name="nextLink", visibility=["read", "create", "update", "delete", "query"]) + """The URI to fetch the next page of VMImages in EdgeZone. Call ListNext() with this URI to fetch + the next page of VmImages.""" + + @overload + def __init__( + self, + *, + value: Optional[list["_models.VirtualMachineImageResource"]] = None, + next_link: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class VMScaleSetConvertToSinglePlacementGroupInput(_Model): # pylint: disable=name-too-long + """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 + """ + + active_placement_group_id: Optional[str] = rest_field( + name="activePlacementGroupId", visibility=["read", "create", "update", "delete", "query"] + ) + """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.""" + + @overload + def __init__( + self, + *, + active_placement_group_id: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class VMScaleSetScaleOutInput(_Model): + """The input for ScaleOut. + + :ivar capacity: Specifies the number of virtual machines in the scale set. Required. + :vartype capacity: int + :ivar properties: The input properties for ScaleOut. + :vartype properties: ~azure.mgmt.compute.models.VMScaleSetScaleOutInputProperties + """ + + capacity: int = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Specifies the number of virtual machines in the scale set. Required.""" + properties: Optional["_models.VMScaleSetScaleOutInputProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The input properties for ScaleOut.""" + + @overload + def __init__( + self, + *, + capacity: int, + properties: Optional["_models.VMScaleSetScaleOutInputProperties"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class VMScaleSetScaleOutInputProperties(_Model): + """The input properties for ScaleOut. + + :ivar zone: The zone in which the scale out is requested for the virtual machine scale set. + :vartype zone: str + """ + + zone: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The zone in which the scale out is requested for the virtual machine scale set.""" + + @overload + def __init__( + self, + *, + zone: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class VMSizeProperties(_Model): + """Specifies VM Size Property settings on the virtual machine. + + :ivar v_cpus_available: Specifies the number of vCPUs available for the VM. 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. 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 + `_. **Setting this + property to 1 also means that hyper-threading is disabled.**. + :vartype v_cpus_per_core: int + """ + + v_cpus_available: Optional[int] = rest_field( + name="vCPUsAvailable", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies the number of vCPUs available for the VM. 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 + `_.""" + v_cpus_per_core: Optional[int] = rest_field( + name="vCPUsPerCore", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies the vCPU to physical core ratio. 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 + `_. **Setting this + property to 1 also means that hyper-threading is disabled.**.""" + + @overload + def __init__( + self, + *, + v_cpus_available: Optional[int] = None, + v_cpus_per_core: Optional[int] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class WindowsConfiguration(_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. When this property is not specified in the request body, it is set to true by + default. 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. 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". + 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.models.AdditionalUnattendContent] + :ivar patch_settings: [Preview Feature] Specifies settings related to VM Guest Patching on + Windows. + :vartype patch_settings: ~azure.mgmt.compute.models.PatchSettings + :ivar win_rm: Specifies the Windows Remote Management listeners. This enables remote Windows + PowerShell. + :vartype win_rm: ~azure.mgmt.compute.models.WinRMConfiguration + :ivar enable_vm_agent_platform_updates: Indicates whether VMAgent Platform Updates are enabled + for the Windows Virtual Machine. + :vartype enable_vm_agent_platform_updates: bool + """ + + provision_vm_agent: Optional[bool] = rest_field( + name="provisionVMAgent", visibility=["read", "create", "update", "delete", "query"] + ) + """Indicates whether virtual machine agent should be provisioned on the virtual machine. When this + property is not specified in the request body, it is set to true by default. This will ensure + that VM Agent is installed on the VM so that extensions can be added to the VM later.""" + enable_automatic_updates: Optional[bool] = rest_field( + name="enableAutomaticUpdates", visibility=["read", "create", "update", "delete", "query"] + ) + """Indicates whether Automatic Updates is enabled for the Windows virtual machine. Default value + is true. For virtual machine scale sets, this property can be updated and updates will take + effect on OS reprovisioning.""" + time_zone: Optional[str] = rest_field(name="timeZone", visibility=["read", "create", "update", "delete", "query"]) + """Specifies the time zone of the virtual machine. e.g. \"Pacific Standard Time\". Possible values + can be `TimeZoneInfo.Id + `_ value + from time zones returned by `TimeZoneInfo.GetSystemTimeZones + `_.""" + additional_unattend_content: Optional[list["_models.AdditionalUnattendContent"]] = rest_field( + name="additionalUnattendContent", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies additional base-64 encoded XML formatted information that can be included in the + Unattend.xml file, which is used by Windows Setup.""" + patch_settings: Optional["_models.PatchSettings"] = rest_field( + name="patchSettings", visibility=["read", "create", "update", "delete", "query"] + ) + """[Preview Feature] Specifies settings related to VM Guest Patching on Windows.""" + win_rm: Optional["_models.WinRMConfiguration"] = rest_field( + name="winRM", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies the Windows Remote Management listeners. This enables remote Windows PowerShell.""" + enable_vm_agent_platform_updates: Optional[bool] = rest_field( + name="enableVMAgentPlatformUpdates", visibility=["read"] + ) + """Indicates whether VMAgent Platform Updates are enabled for the Windows Virtual Machine.""" + + @overload + 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["_models.AdditionalUnattendContent"]] = None, + patch_settings: Optional["_models.PatchSettings"] = None, + win_rm: Optional["_models.WinRMConfiguration"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class WindowsParameters(_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.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 + :ivar patch_name_masks_to_include: This is used to include patches that match the given patch + name masks. Alphanumeric strings and wildcard expressions consisting of * and ? are only + supported as input values in the list. Null, empty and only whitespaces strings as inputs + values are not supported. + :vartype patch_name_masks_to_include: list[str] + :ivar patch_name_masks_to_exclude: This is used to exclude patches that match the given patch + name masks. Alphanumeric strings and wildcard expressions consisting of * and ? are only + supported as input values in the list. Null, empty and only whitespaces strings as inputs + values are not supported. + :vartype patch_name_masks_to_exclude: list[str] + """ + + classifications_to_include: Optional[list[Union[str, "_models.VMGuestPatchClassificationWindows"]]] = rest_field( + name="classificationsToInclude", visibility=["read", "create", "update", "delete", "query"] + ) + """The update classifications to select when installing patches for Windows.""" + kb_numbers_to_include: Optional[list[str]] = rest_field( + name="kbNumbersToInclude", visibility=["read", "create", "update", "delete", "query"] + ) + """Kbs to include in the patch operation.""" + kb_numbers_to_exclude: Optional[list[str]] = rest_field( + name="kbNumbersToExclude", visibility=["read", "create", "update", "delete", "query"] + ) + """Kbs to exclude in the patch operation.""" + exclude_kbs_requiring_reboot: Optional[bool] = rest_field( + name="excludeKbsRequiringReboot", visibility=["read", "create", "update", "delete", "query"] + ) + """Filters out Kbs that don't have an InstallationRebootBehavior of 'NeverReboots' when this is + set to true.""" + max_patch_publish_date: Optional[datetime.datetime] = rest_field( + name="maxPatchPublishDate", visibility=["read", "create", "update", "delete", "query"], format="rfc3339" + ) + """This is used to install patches that were published on or before this given max published date.""" + patch_name_masks_to_include: Optional[list[str]] = rest_field( + name="patchNameMasksToInclude", visibility=["read", "create", "update", "delete", "query"] + ) + """This is used to include patches that match the given patch name masks. Alphanumeric strings and + wildcard expressions consisting of * and ? are only supported as input values in the list. + Null, empty and only whitespaces strings as inputs values are not supported.""" + patch_name_masks_to_exclude: Optional[list[str]] = rest_field( + name="patchNameMasksToExclude", visibility=["read", "create", "update", "delete", "query"] + ) + """This is used to exclude patches that match the given patch name masks. Alphanumeric strings and + wildcard expressions consisting of * and ? are only supported as input values in the list. + Null, empty and only whitespaces strings as inputs values are not supported.""" + + @overload + def __init__( + self, + *, + classifications_to_include: Optional[list[Union[str, "_models.VMGuestPatchClassificationWindows"]]] = None, + kb_numbers_to_include: Optional[list[str]] = None, + kb_numbers_to_exclude: Optional[list[str]] = None, + exclude_kbs_requiring_reboot: Optional[bool] = None, + max_patch_publish_date: Optional[datetime.datetime] = None, + patch_name_masks_to_include: Optional[list[str]] = None, + patch_name_masks_to_exclude: Optional[list[str]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class WindowsVMGuestPatchAutomaticByPlatformSettings(_Model): # pylint: disable=name-too-long + """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. Known values are: "Unknown", "IfRequired", "Never", and "Always". + :vartype reboot_setting: str or + ~azure.mgmt.compute.models.WindowsVMGuestPatchAutomaticByPlatformRebootSetting + :ivar bypass_platform_safety_checks_on_user_schedule: Enables customer to schedule patching + without accidental upgrades. + :vartype bypass_platform_safety_checks_on_user_schedule: bool + """ + + reboot_setting: Optional[Union[str, "_models.WindowsVMGuestPatchAutomaticByPlatformRebootSetting"]] = rest_field( + name="rebootSetting", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies the reboot setting for all AutomaticByPlatform patch installation operations. Known + values are: \"Unknown\", \"IfRequired\", \"Never\", and \"Always\".""" + bypass_platform_safety_checks_on_user_schedule: Optional[bool] = rest_field( + name="bypassPlatformSafetyChecksOnUserSchedule", visibility=["read", "create", "update", "delete", "query"] + ) + """Enables customer to schedule patching without accidental upgrades.""" + + @overload + def __init__( + self, + *, + reboot_setting: Optional[Union[str, "_models.WindowsVMGuestPatchAutomaticByPlatformRebootSetting"]] = None, + bypass_platform_safety_checks_on_user_schedule: Optional[bool] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class WinRMConfiguration(_Model): + """Describes Windows Remote Management configuration of the VM. + + :ivar listeners: The list of Windows Remote Management listeners. + :vartype listeners: list[~azure.mgmt.compute.models.WinRMListener] + """ + + listeners: Optional[list["_models.WinRMListener"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The list of Windows Remote Management listeners.""" + + @overload + def __init__( + self, + *, + listeners: Optional[list["_models.WinRMListener"]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class WinRMListener(_Model): + """Describes Protocol and thumbprint of Windows Remote Management listener. + + :ivar protocol: Specifies the protocol of WinRM listener. Possible values are: **http,** + **https.**. Known values are: "Http" and "Https". + :vartype protocol: str or ~azure.mgmt.compute.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 the Base64 encoding of the following JSON Object which is encoded in + UTF-8:

{
"data":"",
"dataType":"pfx",
+ "password":""
}
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 + """ + + protocol: Optional[Union[str, "_models.ProtocolTypes"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies the protocol of WinRM listener. Possible values are: **http,** **https.**. Known + values are: \"Http\" and \"Https\".""" + certificate_url: Optional[str] = rest_field( + name="certificateUrl", visibility=["read", "create", "update", "delete", "query"] + ) + """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 the Base64 encoding of the following JSON Object which is encoded in + UTF-8:

{
\"data\":\"\",
+ \"dataType\":\"pfx\",
\"password\":\"\"
}
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 + `_.""" + + @overload + def __init__( + self, + *, + protocol: Optional[Union[str, "_models.ProtocolTypes"]] = None, + certificate_url: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ZoneAllocationPolicy(_Model): + """The configuration parameters for zone allocation of a virtual machine scale set. + + :ivar max_zone_count: The maximum number of availability zones to use if the + ZonePlacementPolicy is 'Auto'. If not specified, all availability zones will be used. + :vartype max_zone_count: int + :ivar max_instance_percent_per_zone_policy: The configuration parameters used to limit the + number of virtual machines per availability zone in the virtual machine scale set. + :vartype max_instance_percent_per_zone_policy: + ~azure.mgmt.compute.models.MaxInstancePercentPerZonePolicy + """ + + max_zone_count: Optional[int] = rest_field( + name="maxZoneCount", visibility=["read", "create", "update", "delete", "query"] + ) + """The maximum number of availability zones to use if the ZonePlacementPolicy is 'Auto'. If not + specified, all availability zones will be used.""" + max_instance_percent_per_zone_policy: Optional["_models.MaxInstancePercentPerZonePolicy"] = rest_field( + name="maxInstancePercentPerZonePolicy", visibility=["read", "create", "update", "delete", "query"] + ) + """The configuration parameters used to limit the number of virtual machines per availability zone + in the virtual machine scale set.""" + + @overload + def __init__( + self, + *, + max_zone_count: Optional[int] = None, + max_instance_percent_per_zone_policy: Optional["_models.MaxInstancePercentPerZonePolicy"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/models/_models_py3.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/models/_models_py3.py deleted file mode 100644 index 26282bc24d4b..000000000000 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/models/_models_py3.py +++ /dev/null @@ -1,28590 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression,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 collections.abc import MutableMapping -import datetime -from typing import Any, Literal, Optional, TYPE_CHECKING, Union - -from .._utils import serialization as _serialization - -if TYPE_CHECKING: - from .. import models as _models -JSON = MutableMapping[str, Any] - - -class AccessControlRules(_serialization.Model): - """This is the Access Control Rules specification for an inVMAccessControlProfile version. - - :ivar privileges: A list of privileges. - :vartype privileges: list[~azure.mgmt.compute.models.AccessControlRulesPrivilege] - :ivar roles: A list of roles. - :vartype roles: list[~azure.mgmt.compute.models.AccessControlRulesRole] - :ivar identities: A list of identities. - :vartype identities: list[~azure.mgmt.compute.models.AccessControlRulesIdentity] - :ivar role_assignments: A list of role assignments. - :vartype role_assignments: list[~azure.mgmt.compute.models.AccessControlRulesRoleAssignment] - """ - - _attribute_map = { - "privileges": {"key": "privileges", "type": "[AccessControlRulesPrivilege]"}, - "roles": {"key": "roles", "type": "[AccessControlRulesRole]"}, - "identities": {"key": "identities", "type": "[AccessControlRulesIdentity]"}, - "role_assignments": {"key": "roleAssignments", "type": "[AccessControlRulesRoleAssignment]"}, - } - - def __init__( - self, - *, - privileges: Optional[list["_models.AccessControlRulesPrivilege"]] = None, - roles: Optional[list["_models.AccessControlRulesRole"]] = None, - identities: Optional[list["_models.AccessControlRulesIdentity"]] = None, - role_assignments: Optional[list["_models.AccessControlRulesRoleAssignment"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword privileges: A list of privileges. - :paramtype privileges: list[~azure.mgmt.compute.models.AccessControlRulesPrivilege] - :keyword roles: A list of roles. - :paramtype roles: list[~azure.mgmt.compute.models.AccessControlRulesRole] - :keyword identities: A list of identities. - :paramtype identities: list[~azure.mgmt.compute.models.AccessControlRulesIdentity] - :keyword role_assignments: A list of role assignments. - :paramtype role_assignments: list[~azure.mgmt.compute.models.AccessControlRulesRoleAssignment] - """ - super().__init__(**kwargs) - self.privileges = privileges - self.roles = roles - self.identities = identities - self.role_assignments = role_assignments - - -class AccessControlRulesIdentity(_serialization.Model): - """The properties of an Access Control Rule Identity. - - All required parameters must be populated in order to send to server. - - :ivar name: The name of the identity. Required. - :vartype name: str - :ivar user_name: The username corresponding to this identity. - :vartype user_name: str - :ivar group_name: The groupName corresponding to this identity. - :vartype group_name: str - :ivar exe_path: The path to the executable. - :vartype exe_path: str - :ivar process_name: The process name of the executable. - :vartype process_name: str - """ - - _validation = { - "name": {"required": True}, - } - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "user_name": {"key": "userName", "type": "str"}, - "group_name": {"key": "groupName", "type": "str"}, - "exe_path": {"key": "exePath", "type": "str"}, - "process_name": {"key": "processName", "type": "str"}, - } - - def __init__( - self, - *, - name: str, - user_name: Optional[str] = None, - group_name: Optional[str] = None, - exe_path: Optional[str] = None, - process_name: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword name: The name of the identity. Required. - :paramtype name: str - :keyword user_name: The username corresponding to this identity. - :paramtype user_name: str - :keyword group_name: The groupName corresponding to this identity. - :paramtype group_name: str - :keyword exe_path: The path to the executable. - :paramtype exe_path: str - :keyword process_name: The process name of the executable. - :paramtype process_name: str - """ - super().__init__(**kwargs) - self.name = name - self.user_name = user_name - self.group_name = group_name - self.exe_path = exe_path - self.process_name = process_name - - -class AccessControlRulesPrivilege(_serialization.Model): - """The properties of an Access Control Rule Privilege. - - All required parameters must be populated in order to send to server. - - :ivar name: The name of the privilege. Required. - :vartype name: str - :ivar path: The HTTP path corresponding to the privilege. Required. - :vartype path: str - :ivar query_parameters: The query parameters to match in the path. - :vartype query_parameters: dict[str, str] - """ - - _validation = { - "name": {"required": True}, - "path": {"required": True}, - } - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "path": {"key": "path", "type": "str"}, - "query_parameters": {"key": "queryParameters", "type": "{str}"}, - } - - def __init__( - self, *, name: str, path: str, query_parameters: Optional[dict[str, str]] = None, **kwargs: Any - ) -> None: - """ - :keyword name: The name of the privilege. Required. - :paramtype name: str - :keyword path: The HTTP path corresponding to the privilege. Required. - :paramtype path: str - :keyword query_parameters: The query parameters to match in the path. - :paramtype query_parameters: dict[str, str] - """ - super().__init__(**kwargs) - self.name = name - self.path = path - self.query_parameters = query_parameters - - -class AccessControlRulesRole(_serialization.Model): - """The properties of an Access Control Rule Role. - - All required parameters must be populated in order to send to server. - - :ivar name: The name of the role. Required. - :vartype name: str - :ivar privileges: A list of privileges needed by this role. Required. - :vartype privileges: list[str] - """ - - _validation = { - "name": {"required": True}, - "privileges": {"required": True}, - } - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "privileges": {"key": "privileges", "type": "[str]"}, - } - - def __init__(self, *, name: str, privileges: list[str], **kwargs: Any) -> None: - """ - :keyword name: The name of the role. Required. - :paramtype name: str - :keyword privileges: A list of privileges needed by this role. Required. - :paramtype privileges: list[str] - """ - super().__init__(**kwargs) - self.name = name - self.privileges = privileges - - -class AccessControlRulesRoleAssignment(_serialization.Model): - """The properties of an Access Control Rule RoleAssignment. - - All required parameters must be populated in order to send to server. - - :ivar role: The name of the role. Required. - :vartype role: str - :ivar identities: A list of identities that can access the privileges defined by the role. - Required. - :vartype identities: list[str] - """ - - _validation = { - "role": {"required": True}, - "identities": {"required": True}, - } - - _attribute_map = { - "role": {"key": "role", "type": "str"}, - "identities": {"key": "identities", "type": "[str]"}, - } - - def __init__(self, *, role: str, identities: list[str], **kwargs: Any) -> None: - """ - :keyword role: The name of the role. Required. - :paramtype role: str - :keyword identities: A list of identities that can access the privileges defined by the role. - Required. - :paramtype identities: list[str] - """ - super().__init__(**kwargs) - self.role = role - self.identities = identities - - -class AccessUri(_serialization.Model): - """A disk access SAS uri. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar access_sas: A SAS uri for accessing a disk. - :vartype access_sas: str - :ivar security_data_access_sas: A SAS uri for accessing a VM guest state. - :vartype security_data_access_sas: str - :ivar security_metadata_access_sas: A SAS uri for accessing a VM metadata. - :vartype security_metadata_access_sas: str - """ - - _validation = { - "access_sas": {"readonly": True}, - "security_data_access_sas": {"readonly": True}, - "security_metadata_access_sas": {"readonly": True}, - } - - _attribute_map = { - "access_sas": {"key": "accessSAS", "type": "str"}, - "security_data_access_sas": {"key": "securityDataAccessSAS", "type": "str"}, - "security_metadata_access_sas": {"key": "securityMetadataAccessSAS", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.access_sas: Optional[str] = None - self.security_data_access_sas: Optional[str] = None - self.security_metadata_access_sas: Optional[str] = None - - -class AdditionalCapabilities(_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: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.ultra_ssd_enabled = ultra_ssd_enabled - self.hibernation_enabled = hibernation_enabled - - -class AdditionalReplicaSet(_serialization.Model): - """Describes the additional replica set information. - - :ivar storage_account_type: Specifies the storage account type to be used to create the direct - drive replicas. Known values are: "Standard_LRS", "Standard_ZRS", "Premium_LRS", and - "PremiumV2_LRS". - :vartype storage_account_type: str or ~azure.mgmt.compute.models.StorageAccountType - :ivar regional_replica_count: The number of direct drive replicas of the Image Version to be - created.This Property is updatable. - :vartype regional_replica_count: int - """ - - _attribute_map = { - "storage_account_type": {"key": "storageAccountType", "type": "str"}, - "regional_replica_count": {"key": "regionalReplicaCount", "type": "int"}, - } - - def __init__( - self, - *, - storage_account_type: Optional[Union[str, "_models.StorageAccountType"]] = None, - regional_replica_count: Optional[int] = None, - **kwargs: Any - ) -> None: - """ - :keyword storage_account_type: Specifies the storage account type to be used to create the - direct drive replicas. Known values are: "Standard_LRS", "Standard_ZRS", "Premium_LRS", and - "PremiumV2_LRS". - :paramtype storage_account_type: str or ~azure.mgmt.compute.models.StorageAccountType - :keyword regional_replica_count: The number of direct drive replicas of the Image Version to be - created.This Property is updatable. - :paramtype regional_replica_count: int - """ - super().__init__(**kwargs) - self.storage_account_type = storage_account_type - self.regional_replica_count = regional_replica_count - - -class AdditionalUnattendContent(_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. Default - value is "OobeSystem". - :vartype pass_name: str - :ivar component_name: The component name. Currently, the only allowable value is - Microsoft-Windows-Shell-Setup. Default value is "Microsoft-Windows-Shell-Setup". - :vartype component_name: str - :ivar setting_name: Specifies the name of the setting to which the content applies. Possible - values are: FirstLogonCommands and AutoLogon. Known values are: "AutoLogon" and - "FirstLogonCommands". - :vartype setting_name: str or ~azure.mgmt.compute.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[Literal["OobeSystem"]] = None, - component_name: Optional[Literal["Microsoft-Windows-Shell-Setup"]] = None, - setting_name: Optional[Union[str, "_models.SettingNames"]] = None, - content: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword pass_name: The pass name. Currently, the only allowable value is OobeSystem. Default - value is "OobeSystem". - :paramtype pass_name: str - :keyword component_name: The component name. Currently, the only allowable value is - Microsoft-Windows-Shell-Setup. Default value is "Microsoft-Windows-Shell-Setup". - :paramtype component_name: str - :keyword setting_name: Specifies the name of the setting to which the content applies. Possible - values are: FirstLogonCommands and AutoLogon. Known values are: "AutoLogon" and - "FirstLogonCommands". - :paramtype setting_name: str or ~azure.mgmt.compute.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().__init__(**kwargs) - self.pass_name = pass_name - self.component_name = component_name - self.setting_name = setting_name - self.content = content - - -class AllInstancesDown(_serialization.Model): - """Specifies if Scheduled Events should be auto-approved when all instances are down. - - :ivar automatically_approve: Specifies if Scheduled Events should be auto-approved when all - instances are down. - its default value is true. - :vartype automatically_approve: bool - """ - - _attribute_map = { - "automatically_approve": {"key": "automaticallyApprove", "type": "bool"}, - } - - def __init__(self, *, automatically_approve: Optional[bool] = None, **kwargs: Any) -> None: - """ - :keyword automatically_approve: Specifies if Scheduled Events should be auto-approved when all - instances are down. - its default value is true. - :paramtype automatically_approve: bool - """ - super().__init__(**kwargs) - self.automatically_approve = automatically_approve - - -class AlternativeOption(_serialization.Model): - """Describes the alternative option specified by the Publisher for this image when this image is - deprecated. - - :ivar type: Describes the type of the alternative option. Known values are: "None", "Offer", - and "Plan". - :vartype type: str or ~azure.mgmt.compute.models.AlternativeType - :ivar value: Indicates the alternative option value specified by the Publisher. This is the - Offer name when the type is Offer or the Plan name when the type is Plan. - :vartype value: str - """ - - _attribute_map = { - "type": {"key": "type", "type": "str"}, - "value": {"key": "value", "type": "str"}, - } - - def __init__( - self, - *, - type: Optional[Union[str, "_models.AlternativeType"]] = None, - value: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword type: Describes the type of the alternative option. Known values are: "None", "Offer", - and "Plan". - :paramtype type: str or ~azure.mgmt.compute.models.AlternativeType - :keyword value: Indicates the alternative option value specified by the Publisher. This is the - Offer name when the type is Offer or the Plan name when the type is Plan. - :paramtype value: str - """ - super().__init__(**kwargs) - self.type = type - self.value = value - - -class ApiEntityReference(_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: Any) -> None: # pylint: disable=redefined-builtin - """ - :keyword id: The ARM resource id in the form of - /subscriptions/{SubscriptionId}/resourceGroups/{ResourceGroupName}/... - :paramtype id: str - """ - super().__init__(**kwargs) - self.id = id - - -class ApiError(_serialization.Model): - """Api error. - - :ivar details: The Api error details. - :vartype details: list[~azure.mgmt.compute.models.ApiErrorBase] - :ivar innererror: The Api inner error. - :vartype innererror: ~azure.mgmt.compute.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["_models.ApiErrorBase"]] = None, - innererror: Optional["_models.InnerError"] = None, - code: Optional[str] = None, - target: Optional[str] = None, - message: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword details: The Api error details. - :paramtype details: list[~azure.mgmt.compute.models.ApiErrorBase] - :keyword innererror: The Api inner error. - :paramtype innererror: ~azure.mgmt.compute.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().__init__(**kwargs) - self.details = details - self.innererror = innererror - self.code = code - self.target = target - self.message = message - - -class ApiErrorBase(_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: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.code = code - self.target = target - self.message = message - - -class ApplicationProfile(_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.models.VMGalleryApplication] - """ - - _attribute_map = { - "gallery_applications": {"key": "galleryApplications", "type": "[VMGalleryApplication]"}, - } - - def __init__( - self, *, gallery_applications: Optional[list["_models.VMGalleryApplication"]] = None, **kwargs: Any - ) -> None: - """ - :keyword gallery_applications: Specifies the gallery applications that should be made available - to the VM/VMSS. - :paramtype gallery_applications: list[~azure.mgmt.compute.models.VMGalleryApplication] - """ - super().__init__(**kwargs) - self.gallery_applications = gallery_applications - - -class AttachDetachDataDisksRequest(_serialization.Model): - """Specifies the input for attaching and detaching a list of managed data disks. - - :ivar data_disks_to_attach: The list of managed data disks to be attached. - :vartype data_disks_to_attach: list[~azure.mgmt.compute.models.DataDisksToAttach] - :ivar data_disks_to_detach: The list of managed data disks to be detached. - :vartype data_disks_to_detach: list[~azure.mgmt.compute.models.DataDisksToDetach] - """ - - _validation = { - "data_disks_to_attach": {"min_items": 1}, - "data_disks_to_detach": {"min_items": 1}, - } - - _attribute_map = { - "data_disks_to_attach": {"key": "dataDisksToAttach", "type": "[DataDisksToAttach]"}, - "data_disks_to_detach": {"key": "dataDisksToDetach", "type": "[DataDisksToDetach]"}, - } - - def __init__( - self, - *, - data_disks_to_attach: Optional[list["_models.DataDisksToAttach"]] = None, - data_disks_to_detach: Optional[list["_models.DataDisksToDetach"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword data_disks_to_attach: The list of managed data disks to be attached. - :paramtype data_disks_to_attach: list[~azure.mgmt.compute.models.DataDisksToAttach] - :keyword data_disks_to_detach: The list of managed data disks to be detached. - :paramtype data_disks_to_detach: list[~azure.mgmt.compute.models.DataDisksToDetach] - """ - super().__init__(**kwargs) - self.data_disks_to_attach = data_disks_to_attach - self.data_disks_to_detach = data_disks_to_detach - - -class AutomaticOSUpgradePolicy(_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. 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 - :ivar os_rolling_upgrade_deferral: Indicates whether Auto OS Upgrade should undergo deferral. - Deferred OS upgrades will send advanced notifications on a per-VM basis that an OS upgrade from - rolling upgrades is incoming, via the IMDS tag 'Platform.PendingOSUpgrade'. The upgrade then - defers until the upgrade is approved via an ApproveRollingUpgrade call. - :vartype os_rolling_upgrade_deferral: 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"}, - "os_rolling_upgrade_deferral": {"key": "osRollingUpgradeDeferral", "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, - os_rolling_upgrade_deferral: Optional[bool] = None, - **kwargs: Any - ) -> None: - """ - :keyword enable_automatic_os_upgrade: Indicates whether OS upgrades should automatically be - applied to scale set instances in a rolling fashion when a newer version of the OS image - becomes available. Default value is false. If this is set to true for Windows based scale sets, - `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 - :keyword os_rolling_upgrade_deferral: Indicates whether Auto OS Upgrade should undergo - deferral. Deferred OS upgrades will send advanced notifications on a per-VM basis that an OS - upgrade from rolling upgrades is incoming, via the IMDS tag 'Platform.PendingOSUpgrade'. The - upgrade then defers until the upgrade is approved via an ApproveRollingUpgrade call. - :paramtype os_rolling_upgrade_deferral: bool - """ - super().__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 - self.os_rolling_upgrade_deferral = os_rolling_upgrade_deferral - - -class AutomaticOSUpgradeProperties(_serialization.Model): - """Describes automatic OS upgrade properties on the image. - - All required parameters must be populated in order to send to server. - - :ivar automatic_os_upgrade_supported: Specifies whether automatic OS upgrade is supported on - the image. Required. - :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: Any) -> None: - """ - :keyword automatic_os_upgrade_supported: Specifies whether automatic OS upgrade is supported on - the image. Required. - :paramtype automatic_os_upgrade_supported: bool - """ - super().__init__(**kwargs) - self.automatic_os_upgrade_supported = automatic_os_upgrade_supported - - -class AutomaticRepairsPolicy(_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. Known values - are: "Replace", "Restart", and "Reimage". - :vartype repair_action: str or ~azure.mgmt.compute.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, "_models.RepairAction"]] = None, - **kwargs: Any - ) -> None: - """ - :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. Known values - are: "Replace", "Restart", and "Reimage". - :paramtype repair_action: str or ~azure.mgmt.compute.models.RepairAction - """ - super().__init__(**kwargs) - self.enabled = enabled - self.grace_period = grace_period - self.repair_action = repair_action - - -class AutomaticZoneRebalancingPolicy(_serialization.Model): - """The configuration parameters used while performing automatic AZ balancing. - - :ivar enabled: Specifies whether Automatic AZ Balancing should be enabled on the virtual - machine scale set. The default value is false. - :vartype enabled: bool - :ivar rebalance_strategy: Type of rebalance strategy that will be used for rebalancing virtual - machines in the scale set across availability zones. Default and only supported value for now - is Recreate. "Recreate" - :vartype rebalance_strategy: str or ~azure.mgmt.compute.models.RebalanceStrategy - :ivar rebalance_behavior: Type of rebalance behavior that will be used for recreating virtual - machines in the scale set across availability zones. Default and only supported value for now - is CreateBeforeDelete. "CreateBeforeDelete" - :vartype rebalance_behavior: str or ~azure.mgmt.compute.models.RebalanceBehavior - """ - - _attribute_map = { - "enabled": {"key": "enabled", "type": "bool"}, - "rebalance_strategy": {"key": "rebalanceStrategy", "type": "str"}, - "rebalance_behavior": {"key": "rebalanceBehavior", "type": "str"}, - } - - def __init__( - self, - *, - enabled: Optional[bool] = None, - rebalance_strategy: Optional[Union[str, "_models.RebalanceStrategy"]] = None, - rebalance_behavior: Optional[Union[str, "_models.RebalanceBehavior"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword enabled: Specifies whether Automatic AZ Balancing should be enabled on the virtual - machine scale set. The default value is false. - :paramtype enabled: bool - :keyword rebalance_strategy: Type of rebalance strategy that will be used for rebalancing - virtual machines in the scale set across availability zones. Default and only supported value - for now is Recreate. "Recreate" - :paramtype rebalance_strategy: str or ~azure.mgmt.compute.models.RebalanceStrategy - :keyword rebalance_behavior: Type of rebalance behavior that will be used for recreating - virtual machines in the scale set across availability zones. Default and only supported value - for now is CreateBeforeDelete. "CreateBeforeDelete" - :paramtype rebalance_behavior: str or ~azure.mgmt.compute.models.RebalanceBehavior - """ - super().__init__(**kwargs) - self.enabled = enabled - self.rebalance_strategy = rebalance_strategy - self.rebalance_behavior = rebalance_behavior - - -class AvailabilityPolicy(_serialization.Model): - """In the case of an availability or connectivity issue with the data disk, specify the behavior - of your VM. - - :ivar action_on_disk_delay: Determines on how to handle disks with slow I/O. Known values are: - "None" and "AutomaticReattach". - :vartype action_on_disk_delay: str or ~azure.mgmt.compute.models.AvailabilityPolicyDiskDelay - """ - - _attribute_map = { - "action_on_disk_delay": {"key": "actionOnDiskDelay", "type": "str"}, - } - - def __init__( - self, *, action_on_disk_delay: Optional[Union[str, "_models.AvailabilityPolicyDiskDelay"]] = None, **kwargs: Any - ) -> None: - """ - :keyword action_on_disk_delay: Determines on how to handle disks with slow I/O. Known values - are: "None" and "AutomaticReattach". - :paramtype action_on_disk_delay: str or ~azure.mgmt.compute.models.AvailabilityPolicyDiskDelay - """ - super().__init__(**kwargs) - self.action_on_disk_delay = action_on_disk_delay - - -class Resource(_serialization.Model): - """Common fields that are returned in the response for all Azure Resource Manager resources. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.compute.models.SystemData - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.id: Optional[str] = None - self.name: Optional[str] = None - self.type: Optional[str] = None - self.system_data: Optional["_models.SystemData"] = None - - -class TrackedResource(Resource): - """The resource model definition for an Azure Resource Manager tracked top level resource which - has 'tags' and a 'location'. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to server. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.compute.models.SystemData - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - :ivar location: The geo-location where the resource lives. Required. - :vartype location: str - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, - "location": {"required": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - "tags": {"key": "tags", "type": "{str}"}, - "location": {"key": "location", "type": "str"}, - } - - def __init__(self, *, location: str, tags: Optional[dict[str, str]] = None, **kwargs: Any) -> None: - """ - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - :keyword location: The geo-location where the resource lives. Required. - :paramtype location: str - """ - super().__init__(**kwargs) - self.tags = tags - self.location = location - - -class AvailabilitySet(TrackedResource): - """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 `_. For - more information on Azure planned maintenance, see `Maintenance and updates for Virtual - Machines in Azure - `_. Currently, a VM - can only be added to an 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 server. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.compute.models.SystemData - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - :ivar location: The geo-location where the resource lives. Required. - :vartype location: 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.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.models.SubResource] - :ivar proximity_placement_group: Specifies information about the proximity placement group that - the availability set should be assigned to. Minimum api-version: 2018-04-01. - :vartype proximity_placement_group: ~azure.mgmt.compute.models.SubResource - :ivar statuses: The resource status information. - :vartype statuses: list[~azure.mgmt.compute.models.InstanceViewStatus] - :ivar scheduled_events_policy: Specifies Redeploy, Reboot and - ScheduledEventsAdditionalPublishingTargets Scheduled Event related configurations for the - availability set. - :vartype scheduled_events_policy: ~azure.mgmt.compute.models.ScheduledEventsPolicy - :ivar virtual_machine_scale_set_migration_info: Describes the migration properties on the - Availability Set. - :vartype virtual_machine_scale_set_migration_info: - ~azure.mgmt.compute.models.VirtualMachineScaleSetMigrationInfo - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, - "location": {"required": True}, - "statuses": {"readonly": True}, - "virtual_machine_scale_set_migration_info": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - "tags": {"key": "tags", "type": "{str}"}, - "location": {"key": "location", "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]"}, - "scheduled_events_policy": {"key": "properties.scheduledEventsPolicy", "type": "ScheduledEventsPolicy"}, - "virtual_machine_scale_set_migration_info": { - "key": "properties.virtualMachineScaleSetMigrationInfo", - "type": "VirtualMachineScaleSetMigrationInfo", - }, - } - - def __init__( - self, - *, - location: str, - tags: Optional[dict[str, str]] = None, - sku: Optional["_models.Sku"] = None, - platform_update_domain_count: Optional[int] = None, - platform_fault_domain_count: Optional[int] = None, - virtual_machines: Optional[list["_models.SubResource"]] = None, - proximity_placement_group: Optional["_models.SubResource"] = None, - scheduled_events_policy: Optional["_models.ScheduledEventsPolicy"] = None, - **kwargs: Any - ) -> None: - """ - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - :keyword location: The geo-location where the resource lives. Required. - :paramtype location: 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.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.models.SubResource] - :keyword proximity_placement_group: Specifies information about the proximity placement group - that the availability set should be assigned to. Minimum api-version: 2018-04-01. - :paramtype proximity_placement_group: ~azure.mgmt.compute.models.SubResource - :keyword scheduled_events_policy: Specifies Redeploy, Reboot and - ScheduledEventsAdditionalPublishingTargets Scheduled Event related configurations for the - availability set. - :paramtype scheduled_events_policy: ~azure.mgmt.compute.models.ScheduledEventsPolicy - """ - super().__init__(tags=tags, location=location, **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: Optional[list["_models.InstanceViewStatus"]] = None - self.scheduled_events_policy = scheduled_events_policy - self.virtual_machine_scale_set_migration_info: Optional["_models.VirtualMachineScaleSetMigrationInfo"] = None - - -class AvailabilitySetListResult(_serialization.Model): - """The List Availability Set operation response. - - All required parameters must be populated in order to send to server. - - :ivar value: The list of availability sets. Required. - :vartype value: list[~azure.mgmt.compute.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["_models.AvailabilitySet"], next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: The list of availability sets. Required. - :paramtype value: list[~azure.mgmt.compute.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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class UpdateResource(_serialization.Model): - """The Update Resource model definition. - - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - """ - - _attribute_map = { - "tags": {"key": "tags", "type": "{str}"}, - } - - def __init__(self, *, tags: Optional[dict[str, str]] = None, **kwargs: Any) -> None: - """ - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - """ - super().__init__(**kwargs) - self.tags = tags - - -class 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: Resource tags. - :vartype tags: dict[str, str] - :ivar sku: Sku of the availability set. - :vartype sku: ~azure.mgmt.compute.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.models.SubResource] - :ivar proximity_placement_group: Specifies information about the proximity placement group that - the availability set should be assigned to. Minimum api-version: 2018-04-01. - :vartype proximity_placement_group: ~azure.mgmt.compute.models.SubResource - :ivar statuses: The resource status information. - :vartype statuses: list[~azure.mgmt.compute.models.InstanceViewStatus] - :ivar scheduled_events_policy: Specifies Redeploy, Reboot and - ScheduledEventsAdditionalPublishingTargets Scheduled Event related configurations for the - availability set. - :vartype scheduled_events_policy: ~azure.mgmt.compute.models.ScheduledEventsPolicy - :ivar virtual_machine_scale_set_migration_info: Describes the migration properties on the - Availability Set. - :vartype virtual_machine_scale_set_migration_info: - ~azure.mgmt.compute.models.VirtualMachineScaleSetMigrationInfo - """ - - _validation = { - "statuses": {"readonly": True}, - "virtual_machine_scale_set_migration_info": {"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]"}, - "scheduled_events_policy": {"key": "properties.scheduledEventsPolicy", "type": "ScheduledEventsPolicy"}, - "virtual_machine_scale_set_migration_info": { - "key": "properties.virtualMachineScaleSetMigrationInfo", - "type": "VirtualMachineScaleSetMigrationInfo", - }, - } - - def __init__( - self, - *, - tags: Optional[dict[str, str]] = None, - sku: Optional["_models.Sku"] = None, - platform_update_domain_count: Optional[int] = None, - platform_fault_domain_count: Optional[int] = None, - virtual_machines: Optional[list["_models.SubResource"]] = None, - proximity_placement_group: Optional["_models.SubResource"] = None, - scheduled_events_policy: Optional["_models.ScheduledEventsPolicy"] = None, - **kwargs: Any - ) -> None: - """ - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - :keyword sku: Sku of the availability set. - :paramtype sku: ~azure.mgmt.compute.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.models.SubResource] - :keyword proximity_placement_group: Specifies information about the proximity placement group - that the availability set should be assigned to. Minimum api-version: 2018-04-01. - :paramtype proximity_placement_group: ~azure.mgmt.compute.models.SubResource - :keyword scheduled_events_policy: Specifies Redeploy, Reboot and - ScheduledEventsAdditionalPublishingTargets Scheduled Event related configurations for the - availability set. - :paramtype scheduled_events_policy: ~azure.mgmt.compute.models.ScheduledEventsPolicy - """ - super().__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: Optional[list["_models.InstanceViewStatus"]] = None - self.scheduled_events_policy = scheduled_events_policy - self.virtual_machine_scale_set_migration_info: Optional["_models.VirtualMachineScaleSetMigrationInfo"] = None - - -class AvailablePatchSummary(_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.". Known values are: "Unknown", "InProgress", "Failed", "Succeeded", - and "CompletedWithWarnings". - :vartype status: str or ~azure.mgmt.compute.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.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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.status: Optional[Union[str, "_models.PatchOperationStatus"]] = None - self.assessment_activity_id: Optional[str] = None - self.reboot_pending: Optional[bool] = None - self.critical_and_security_patch_count: Optional[int] = None - self.other_patch_count: Optional[int] = None - self.start_time: Optional[datetime.datetime] = None - self.last_modified_time: Optional[datetime.datetime] = None - self.error: Optional["_models.ApiError"] = None - - -class BillingProfile(_serialization.Model): - """Specifies the billing related details of a Azure Spot VM or VMSS. 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: Any) -> None: - """ - :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().__init__(**kwargs) - self.max_price = max_price - - -class BootDiagnostics(_serialization.Model): - """Boot Diagnostics is a debugging feature which allows you to view Console Output and Screenshot - to diagnose VM status. You can easily view the output of your console log. 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. 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: Any) -> None: - """ - :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. If storageUri is not specified while enabling boot diagnostics, managed storage - will be used. - :paramtype storage_uri: str - """ - super().__init__(**kwargs) - self.enabled = enabled - self.storage_uri = storage_uri - - -class BootDiagnosticsInstanceView(_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. **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. **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. **Note:** It will be set only - if there are errors encountered in enabling boot diagnostics. - :vartype status: ~azure.mgmt.compute.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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.console_screenshot_blob_uri: Optional[str] = None - self.serial_console_log_blob_uri: Optional[str] = None - self.status: Optional["_models.InstanceViewStatus"] = None - - -class CapacityReservation(TrackedResource): - """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 server. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.compute.models.SystemData - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - :ivar location: The geo-location where the resource lives. Required. - :vartype location: str - :ivar sku: SKU of the resource for which capacity needs be reserved. The SKU name and capacity - is required to be set. For Block capacity reservations, sku.capacity can only accept values 1, - 2, 4, 8, 16, 32, 64. Currently VM Skus with the capability called - 'CapacityReservationSupported' set to true are supported. When 'CapacityReservationSupported' - is true, the SKU capability also specifies the 'SupportedCapacityReservationTypes', which lists - the types of capacity reservations (such as Targeted or Block) that the SKU supports. Refer to - List Microsoft.Compute SKUs in a region - (https://docs.microsoft.com/rest/api/compute/resourceskus/list) for supported values. Required. - :vartype sku: ~azure.mgmt.compute.models.Sku - :ivar zones: The availability zones. - :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 platform_fault_domain_count: Specifies the value of fault domain count that Capacity - Reservation supports for requested VM size. **Note:** The fault domain count specified for a - resource (like virtual machines scale set) must be less than or equal to this value if it - deploys using capacity reservation. Minimum api-version: 2022-08-01. - :vartype platform_fault_domain_count: int - :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.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.models.CapacityReservationInstanceView - :ivar time_created: Specifies the time at which the Capacity Reservation resource was created. - Minimum api-version: 2021-11-01. - :vartype time_created: ~datetime.datetime - :ivar schedule_profile: Defines the schedule for Block-type capacity reservations. Specifies - the schedule during which capacity reservation is active and VM or VMSS resource can be - allocated using reservation. This property is required and only supported when the capacity - reservation group type is 'Block'. The scheduleProfile, start, and end fields are immutable - after creation. Minimum API version: 2025-04-01. Please refer to - https://aka.ms/blockcapacityreservation for more details. - :vartype schedule_profile: ~azure.mgmt.compute.models.ScheduleProfile - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, - "location": {"required": True}, - "sku": {"required": True}, - "reservation_id": {"readonly": True}, - "platform_fault_domain_count": {"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"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - "tags": {"key": "tags", "type": "{str}"}, - "location": {"key": "location", "type": "str"}, - "sku": {"key": "sku", "type": "Sku"}, - "zones": {"key": "zones", "type": "[str]"}, - "reservation_id": {"key": "properties.reservationId", "type": "str"}, - "platform_fault_domain_count": {"key": "properties.platformFaultDomainCount", "type": "int"}, - "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"}, - "schedule_profile": {"key": "properties.scheduleProfile", "type": "ScheduleProfile"}, - } - - def __init__( - self, - *, - location: str, - sku: "_models.Sku", - tags: Optional[dict[str, str]] = None, - zones: Optional[list[str]] = None, - schedule_profile: Optional["_models.ScheduleProfile"] = None, - **kwargs: Any - ) -> None: - """ - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - :keyword location: The geo-location where the resource lives. Required. - :paramtype location: str - :keyword sku: SKU of the resource for which capacity needs be reserved. The SKU name and - capacity is required to be set. For Block capacity reservations, sku.capacity can only accept - values 1, 2, 4, 8, 16, 32, 64. Currently VM Skus with the capability called - 'CapacityReservationSupported' set to true are supported. When 'CapacityReservationSupported' - is true, the SKU capability also specifies the 'SupportedCapacityReservationTypes', which lists - the types of capacity reservations (such as Targeted or Block) that the SKU supports. Refer to - List Microsoft.Compute SKUs in a region - (https://docs.microsoft.com/rest/api/compute/resourceskus/list) for supported values. Required. - :paramtype sku: ~azure.mgmt.compute.models.Sku - :keyword zones: The availability zones. - :paramtype zones: list[str] - :keyword schedule_profile: Defines the schedule for Block-type capacity reservations. Specifies - the schedule during which capacity reservation is active and VM or VMSS resource can be - allocated using reservation. This property is required and only supported when the capacity - reservation group type is 'Block'. The scheduleProfile, start, and end fields are immutable - after creation. Minimum API version: 2025-04-01. Please refer to - https://aka.ms/blockcapacityreservation for more details. - :paramtype schedule_profile: ~azure.mgmt.compute.models.ScheduleProfile - """ - super().__init__(tags=tags, location=location, **kwargs) - self.sku = sku - self.zones = zones - self.reservation_id: Optional[str] = None - self.platform_fault_domain_count: Optional[int] = None - self.virtual_machines_associated: Optional[list["_models.SubResourceReadOnly"]] = None - self.provisioning_time: Optional[datetime.datetime] = None - self.provisioning_state: Optional[str] = None - self.instance_view: Optional["_models.CapacityReservationInstanceView"] = None - self.time_created: Optional[datetime.datetime] = None - self.schedule_profile = schedule_profile - - -class CapacityReservationGroup(TrackedResource): - """Specifies information about the capacity reservation group that the capacity reservations - should be assigned to. 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 server. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.compute.models.SystemData - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - :ivar location: The geo-location where the resource lives. Required. - :vartype location: str - :ivar zones: The availability 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.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.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.models.CapacityReservationGroupInstanceView - :ivar sharing_profile: Specifies the settings to enable sharing across subscriptions for the - capacity reservation group resource. The capacity reservation group resource can generally be - shared across subscriptions belonging to a single Azure AAD tenant or across AAD tenants if - there is a trust relationship established between the tenants. Block capacity reservation does - not support sharing across subscriptions. **Note:** Minimum api-version: 2023-09-01. Please - refer to https://aka.ms/computereservationsharing for more details. - :vartype sharing_profile: ~azure.mgmt.compute.models.ResourceSharingProfile - :ivar reservation_type: Indicates the type of capacity reservation. Allowed values are 'Block' - for block capacity reservations and 'Targeted' for reservations that enable a VM to consume a - specific capacity reservation when a capacity reservation group is provided. The reservation - type is immutable and cannot be changed after it is assigned. Known values are: "Targeted" and - "Block". - :vartype reservation_type: str or ~azure.mgmt.compute.models.ReservationType - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"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"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - "tags": {"key": "tags", "type": "{str}"}, - "location": {"key": "location", "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"}, - "sharing_profile": {"key": "properties.sharingProfile", "type": "ResourceSharingProfile"}, - "reservation_type": {"key": "properties.reservationType", "type": "str"}, - } - - def __init__( - self, - *, - location: str, - tags: Optional[dict[str, str]] = None, - zones: Optional[list[str]] = None, - sharing_profile: Optional["_models.ResourceSharingProfile"] = None, - reservation_type: Optional[Union[str, "_models.ReservationType"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - :keyword location: The geo-location where the resource lives. Required. - :paramtype location: str - :keyword zones: The availability zones. - :paramtype zones: list[str] - :keyword sharing_profile: Specifies the settings to enable sharing across subscriptions for the - capacity reservation group resource. The capacity reservation group resource can generally be - shared across subscriptions belonging to a single Azure AAD tenant or across AAD tenants if - there is a trust relationship established between the tenants. Block capacity reservation does - not support sharing across subscriptions. **Note:** Minimum api-version: 2023-09-01. Please - refer to https://aka.ms/computereservationsharing for more details. - :paramtype sharing_profile: ~azure.mgmt.compute.models.ResourceSharingProfile - :keyword reservation_type: Indicates the type of capacity reservation. Allowed values are - 'Block' for block capacity reservations and 'Targeted' for reservations that enable a VM to - consume a specific capacity reservation when a capacity reservation group is provided. The - reservation type is immutable and cannot be changed after it is assigned. Known values are: - "Targeted" and "Block". - :paramtype reservation_type: str or ~azure.mgmt.compute.models.ReservationType - """ - super().__init__(tags=tags, location=location, **kwargs) - self.zones = zones - self.capacity_reservations: Optional[list["_models.SubResourceReadOnly"]] = None - self.virtual_machines_associated: Optional[list["_models.SubResourceReadOnly"]] = None - self.instance_view: Optional["_models.CapacityReservationGroupInstanceView"] = None - self.sharing_profile = sharing_profile - self.reservation_type = reservation_type - - -class CapacityReservationGroupInstanceView(_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.models.CapacityReservationInstanceViewWithName] - :ivar shared_subscription_ids: List of the subscriptions that the capacity reservation group is - shared with. **Note:** Minimum api-version: 2023-09-01. Please refer to - https://aka.ms/computereservationsharing for more details. - :vartype shared_subscription_ids: list[~azure.mgmt.compute.models.SubResourceReadOnly] - """ - - _validation = { - "capacity_reservations": {"readonly": True}, - "shared_subscription_ids": {"readonly": True}, - } - - _attribute_map = { - "capacity_reservations": {"key": "capacityReservations", "type": "[CapacityReservationInstanceViewWithName]"}, - "shared_subscription_ids": {"key": "sharedSubscriptionIds", "type": "[SubResourceReadOnly]"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.capacity_reservations: Optional[list["_models.CapacityReservationInstanceViewWithName"]] = None - self.shared_subscription_ids: Optional[list["_models.SubResourceReadOnly"]] = None - - -class CapacityReservationGroupListResult(_serialization.Model): - """The List capacity reservation group with resource group response. - - All required parameters must be populated in order to send to server. - - :ivar value: The list of capacity reservation groups. Required. - :vartype value: list[~azure.mgmt.compute.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["_models.CapacityReservationGroup"], next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: The list of capacity reservation groups. Required. - :paramtype value: list[~azure.mgmt.compute.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().__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: 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.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.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.models.CapacityReservationGroupInstanceView - :ivar sharing_profile: Specifies the settings to enable sharing across subscriptions for the - capacity reservation group resource. The capacity reservation group resource can generally be - shared across subscriptions belonging to a single Azure AAD tenant or across AAD tenants if - there is a trust relationship established between the tenants. Block capacity reservation does - not support sharing across subscriptions. **Note:** Minimum api-version: 2023-09-01. Please - refer to https://aka.ms/computereservationsharing for more details. - :vartype sharing_profile: ~azure.mgmt.compute.models.ResourceSharingProfile - :ivar reservation_type: Indicates the type of capacity reservation. Allowed values are 'Block' - for block capacity reservations and 'Targeted' for reservations that enable a VM to consume a - specific capacity reservation when a capacity reservation group is provided. The reservation - type is immutable and cannot be changed after it is assigned. Known values are: "Targeted" and - "Block". - :vartype reservation_type: str or ~azure.mgmt.compute.models.ReservationType - """ - - _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"}, - "sharing_profile": {"key": "properties.sharingProfile", "type": "ResourceSharingProfile"}, - "reservation_type": {"key": "properties.reservationType", "type": "str"}, - } - - def __init__( - self, - *, - tags: Optional[dict[str, str]] = None, - sharing_profile: Optional["_models.ResourceSharingProfile"] = None, - reservation_type: Optional[Union[str, "_models.ReservationType"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - :keyword sharing_profile: Specifies the settings to enable sharing across subscriptions for the - capacity reservation group resource. The capacity reservation group resource can generally be - shared across subscriptions belonging to a single Azure AAD tenant or across AAD tenants if - there is a trust relationship established between the tenants. Block capacity reservation does - not support sharing across subscriptions. **Note:** Minimum api-version: 2023-09-01. Please - refer to https://aka.ms/computereservationsharing for more details. - :paramtype sharing_profile: ~azure.mgmt.compute.models.ResourceSharingProfile - :keyword reservation_type: Indicates the type of capacity reservation. Allowed values are - 'Block' for block capacity reservations and 'Targeted' for reservations that enable a VM to - consume a specific capacity reservation when a capacity reservation group is provided. The - reservation type is immutable and cannot be changed after it is assigned. Known values are: - "Targeted" and "Block". - :paramtype reservation_type: str or ~azure.mgmt.compute.models.ReservationType - """ - super().__init__(tags=tags, **kwargs) - self.capacity_reservations: Optional[list["_models.SubResourceReadOnly"]] = None - self.virtual_machines_associated: Optional[list["_models.SubResourceReadOnly"]] = None - self.instance_view: Optional["_models.CapacityReservationGroupInstanceView"] = None - self.sharing_profile = sharing_profile - self.reservation_type = reservation_type - - -class CapacityReservationInstanceView(_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.models.CapacityReservationUtilization - :ivar statuses: The resource status information. - :vartype statuses: list[~azure.mgmt.compute.models.InstanceViewStatus] - """ - - _attribute_map = { - "utilization_info": {"key": "utilizationInfo", "type": "CapacityReservationUtilization"}, - "statuses": {"key": "statuses", "type": "[InstanceViewStatus]"}, - } - - def __init__( - self, - *, - utilization_info: Optional["_models.CapacityReservationUtilization"] = None, - statuses: Optional[list["_models.InstanceViewStatus"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword utilization_info: Unutilized capacity of the capacity reservation. - :paramtype utilization_info: ~azure.mgmt.compute.models.CapacityReservationUtilization - :keyword statuses: The resource status information. - :paramtype statuses: list[~azure.mgmt.compute.models.InstanceViewStatus] - """ - super().__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.models.CapacityReservationUtilization - :ivar statuses: The resource status information. - :vartype statuses: list[~azure.mgmt.compute.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["_models.CapacityReservationUtilization"] = None, - statuses: Optional[list["_models.InstanceViewStatus"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword utilization_info: Unutilized capacity of the capacity reservation. - :paramtype utilization_info: ~azure.mgmt.compute.models.CapacityReservationUtilization - :keyword statuses: The resource status information. - :paramtype statuses: list[~azure.mgmt.compute.models.InstanceViewStatus] - """ - super().__init__(utilization_info=utilization_info, statuses=statuses, **kwargs) - self.name: Optional[str] = None - - -class CapacityReservationListResult(_serialization.Model): - """The list capacity reservation operation response. - - All required parameters must be populated in order to send to server. - - :ivar value: The list of capacity reservations. Required. - :vartype value: list[~azure.mgmt.compute.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["_models.CapacityReservation"], next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: The list of capacity reservations. Required. - :paramtype value: list[~azure.mgmt.compute.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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class CapacityReservationProfile(_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.models.SubResource - """ - - _attribute_map = { - "capacity_reservation_group": {"key": "capacityReservationGroup", "type": "SubResource"}, - } - - def __init__(self, *, capacity_reservation_group: Optional["_models.SubResource"] = None, **kwargs: Any) -> None: - """ - :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.models.SubResource - """ - super().__init__(**kwargs) - self.capacity_reservation_group = capacity_reservation_group - - -class CapacityReservationUpdate(UpdateResource): - """Specifies information about the capacity reservation. sku.capacity cannot be updated for Block - Capacity Reservation. Tags can be update for all Capacity Reservation Types. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar 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. When 'CapacityReservationSupported' - is true, the SKU capability also specifies the 'SupportedCapacityReservationTypes', which lists - the types of capacity reservations (such as Targeted or Block) that the SKU supports. Refer to - List Microsoft.Compute SKUs in a region - (https://docs.microsoft.com/rest/api/compute/resourceskus/list) for supported values. **Note:** - The SKU name and capacity cannot be updated for Block capacity reservations. - :vartype sku: ~azure.mgmt.compute.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 platform_fault_domain_count: Specifies the value of fault domain count that Capacity - Reservation supports for requested VM size. **Note:** The fault domain count specified for a - resource (like virtual machines scale set) must be less than or equal to this value if it - deploys using capacity reservation. Minimum api-version: 2022-08-01. - :vartype platform_fault_domain_count: int - :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.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.models.CapacityReservationInstanceView - :ivar time_created: Specifies the time at which the Capacity Reservation resource was created. - Minimum api-version: 2021-11-01. - :vartype time_created: ~datetime.datetime - :ivar schedule_profile: Defines the schedule for Block-type capacity reservations. Specifies - the schedule during which capacity reservation is active and VM or VMSS resource can be - allocated using reservation. This property is required and only supported when the capacity - reservation group type is 'Block'. The scheduleProfile, start, and end fields are immutable - after creation. Minimum API version: 2025-04-01. Please refer to - https://aka.ms/blockcapacityreservation for more details. - :vartype schedule_profile: ~azure.mgmt.compute.models.ScheduleProfile - """ - - _validation = { - "reservation_id": {"readonly": True}, - "platform_fault_domain_count": {"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"}, - "platform_fault_domain_count": {"key": "properties.platformFaultDomainCount", "type": "int"}, - "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"}, - "schedule_profile": {"key": "properties.scheduleProfile", "type": "ScheduleProfile"}, - } - - def __init__( - self, - *, - tags: Optional[dict[str, str]] = None, - sku: Optional["_models.Sku"] = None, - schedule_profile: Optional["_models.ScheduleProfile"] = None, - **kwargs: Any - ) -> None: - """ - :keyword 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. When 'CapacityReservationSupported' - is true, the SKU capability also specifies the 'SupportedCapacityReservationTypes', which lists - the types of capacity reservations (such as Targeted or Block) that the SKU supports. Refer to - List Microsoft.Compute SKUs in a region - (https://docs.microsoft.com/rest/api/compute/resourceskus/list) for supported values. **Note:** - The SKU name and capacity cannot be updated for Block capacity reservations. - :paramtype sku: ~azure.mgmt.compute.models.Sku - :keyword schedule_profile: Defines the schedule for Block-type capacity reservations. Specifies - the schedule during which capacity reservation is active and VM or VMSS resource can be - allocated using reservation. This property is required and only supported when the capacity - reservation group type is 'Block'. The scheduleProfile, start, and end fields are immutable - after creation. Minimum API version: 2025-04-01. Please refer to - https://aka.ms/blockcapacityreservation for more details. - :paramtype schedule_profile: ~azure.mgmt.compute.models.ScheduleProfile - """ - super().__init__(tags=tags, **kwargs) - self.sku = sku - self.reservation_id: Optional[str] = None - self.platform_fault_domain_count: Optional[int] = None - self.virtual_machines_associated: Optional[list["_models.SubResourceReadOnly"]] = None - self.provisioning_time: Optional[datetime.datetime] = None - self.provisioning_state: Optional[str] = None - self.instance_view: Optional["_models.CapacityReservationInstanceView"] = None - self.time_created: Optional[datetime.datetime] = None - self.schedule_profile = schedule_profile - - -class CapacityReservationUtilization(_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 current_capacity: The value provides the current capacity of the VM size which was - reserved successfully and for which the customer is getting billed. Minimum api-version: - 2022-08-01. - :vartype current_capacity: int - :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.models.SubResourceReadOnly] - """ - - _validation = { - "current_capacity": {"readonly": True}, - "virtual_machines_allocated": {"readonly": True}, - } - - _attribute_map = { - "current_capacity": {"key": "currentCapacity", "type": "int"}, - "virtual_machines_allocated": {"key": "virtualMachinesAllocated", "type": "[SubResourceReadOnly]"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.current_capacity: Optional[int] = None - self.virtual_machines_allocated: Optional[list["_models.SubResourceReadOnly"]] = None - - -class CloudService(_serialization.Model): - """Describes the cloud service. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to server. - - :ivar id: Resource Id. - :vartype id: str - :ivar name: Resource name. - :vartype name: str - :ivar type: Resource type. - :vartype type: str - :ivar location: Resource location. Required. - :vartype location: str - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - :ivar properties: Cloud service properties. - :vartype properties: ~azure.mgmt.compute.models.CloudServiceProperties - :ivar system_data: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~azure.mgmt.compute.models.SystemData - :ivar zones: List of logical availability zone of the resource. List should contain only 1 zone - where cloud service should be provisioned. This field is optional. - :vartype zones: list[str] - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "location": {"required": True}, - "system_data": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "location": {"key": "location", "type": "str"}, - "tags": {"key": "tags", "type": "{str}"}, - "properties": {"key": "properties", "type": "CloudServiceProperties"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - "zones": {"key": "zones", "type": "[str]"}, - } - - def __init__( - self, - *, - location: str, - tags: Optional[dict[str, str]] = None, - properties: Optional["_models.CloudServiceProperties"] = None, - zones: Optional[list[str]] = None, - **kwargs: Any - ) -> None: - """ - :keyword location: Resource location. Required. - :paramtype location: str - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - :keyword properties: Cloud service properties. - :paramtype properties: ~azure.mgmt.compute.models.CloudServiceProperties - :keyword zones: List of logical availability zone of the resource. List should contain only 1 - zone where cloud service should be provisioned. This field is optional. - :paramtype zones: list[str] - """ - super().__init__(**kwargs) - self.id: Optional[str] = None - self.name: Optional[str] = None - self.type: Optional[str] = None - self.location = location - self.tags = tags - self.properties = properties - self.system_data: Optional["_models.SystemData"] = None - self.zones = zones - - -class CloudServiceExtensionProfile(_serialization.Model): - """Describes a cloud service extension profile. - - :ivar extensions: List of extensions for the cloud service. - :vartype extensions: list[~azure.mgmt.compute.models.Extension] - """ - - _attribute_map = { - "extensions": {"key": "extensions", "type": "[Extension]"}, - } - - def __init__(self, *, extensions: Optional[list["_models.Extension"]] = None, **kwargs: Any) -> None: - """ - :keyword extensions: List of extensions for the cloud service. - :paramtype extensions: list[~azure.mgmt.compute.models.Extension] - """ - super().__init__(**kwargs) - self.extensions = extensions - - -class CloudServiceExtensionProperties(_serialization.Model): - """Extension Properties. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar publisher: The name of the extension handler publisher. - :vartype publisher: str - :ivar type: Specifies the type of the extension. - :vartype type: str - :ivar type_handler_version: Specifies the version of the extension. Specifies the version of - the extension. If this element is not specified or an asterisk (*) is used as the value, the - latest version of the extension is used. If the value is specified with a major version number - and an asterisk as the minor version number (X.), the latest minor version of the specified - major version is selected. If a major version number and a minor version number are specified - (X.Y), the specific extension version is selected. If a version is specified, an auto-upgrade - is performed on the role instance. - :vartype type_handler_version: str - :ivar auto_upgrade_minor_version: Explicitly specify whether platform can automatically upgrade - typeHandlerVersion to higher minor versions when they become available. - :vartype auto_upgrade_minor_version: bool - :ivar settings: Public settings for the extension. For JSON extensions, this is the JSON - settings for the extension. For XML Extension (like RDP), this is the XML setting for the - extension. - :vartype settings: JSON - :ivar protected_settings: Protected settings for the extension which are encrypted before sent - to the role instance. - :vartype protected_settings: JSON - :ivar protected_settings_from_key_vault: Protected settings for the extension, referenced using - KeyVault which are encrypted before sent to the role instance. - :vartype protected_settings_from_key_vault: - ~azure.mgmt.compute.models.CloudServiceVaultAndSecretReference - :ivar force_update_tag: Tag to force apply the provided public and protected settings. - Changing the tag value allows for re-running the extension without changing any of the public - or protected settings. - If forceUpdateTag is not changed, updates to public or protected settings would still be - applied by the handler. - If neither forceUpdateTag nor any of public or protected settings change, extension would flow - to the role instance with the same sequence-number, and - it is up to handler implementation whether to re-run it or not. - :vartype force_update_tag: str - :ivar provisioning_state: The provisioning state, which only appears in the response. - :vartype provisioning_state: str - :ivar roles_applied_to: Optional list of roles to apply this extension. If property is not - specified or '*' is specified, extension is applied to all roles in the cloud service. - :vartype roles_applied_to: list[str] - """ - - _validation = { - "provisioning_state": {"readonly": True}, - } - - _attribute_map = { - "publisher": {"key": "publisher", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "type_handler_version": {"key": "typeHandlerVersion", "type": "str"}, - "auto_upgrade_minor_version": {"key": "autoUpgradeMinorVersion", "type": "bool"}, - "settings": {"key": "settings", "type": "object"}, - "protected_settings": {"key": "protectedSettings", "type": "object"}, - "protected_settings_from_key_vault": { - "key": "protectedSettingsFromKeyVault", - "type": "CloudServiceVaultAndSecretReference", - }, - "force_update_tag": {"key": "forceUpdateTag", "type": "str"}, - "provisioning_state": {"key": "provisioningState", "type": "str"}, - "roles_applied_to": {"key": "rolesAppliedTo", "type": "[str]"}, - } - - def __init__( - self, - *, - publisher: Optional[str] = None, - type: Optional[str] = None, - type_handler_version: Optional[str] = None, - auto_upgrade_minor_version: Optional[bool] = None, - settings: Optional[JSON] = None, - protected_settings: Optional[JSON] = None, - protected_settings_from_key_vault: Optional["_models.CloudServiceVaultAndSecretReference"] = None, - force_update_tag: Optional[str] = None, - roles_applied_to: Optional[list[str]] = None, - **kwargs: Any - ) -> None: - """ - :keyword publisher: The name of the extension handler publisher. - :paramtype publisher: str - :keyword type: Specifies the type of the extension. - :paramtype type: str - :keyword type_handler_version: Specifies the version of the extension. Specifies the version of - the extension. If this element is not specified or an asterisk (*) is used as the value, the - latest version of the extension is used. If the value is specified with a major version number - and an asterisk as the minor version number (X.), the latest minor version of the specified - major version is selected. If a major version number and a minor version number are specified - (X.Y), the specific extension version is selected. If a version is specified, an auto-upgrade - is performed on the role instance. - :paramtype type_handler_version: str - :keyword auto_upgrade_minor_version: Explicitly specify whether platform can automatically - upgrade typeHandlerVersion to higher minor versions when they become available. - :paramtype auto_upgrade_minor_version: bool - :keyword settings: Public settings for the extension. For JSON extensions, this is the JSON - settings for the extension. For XML Extension (like RDP), this is the XML setting for the - extension. - :paramtype settings: JSON - :keyword protected_settings: Protected settings for the extension which are encrypted before - sent to the role instance. - :paramtype protected_settings: JSON - :keyword protected_settings_from_key_vault: Protected settings for the extension, referenced - using KeyVault which are encrypted before sent to the role instance. - :paramtype protected_settings_from_key_vault: - ~azure.mgmt.compute.models.CloudServiceVaultAndSecretReference - :keyword force_update_tag: Tag to force apply the provided public and protected settings. - Changing the tag value allows for re-running the extension without changing any of the public - or protected settings. - If forceUpdateTag is not changed, updates to public or protected settings would still be - applied by the handler. - If neither forceUpdateTag nor any of public or protected settings change, extension would flow - to the role instance with the same sequence-number, and - it is up to handler implementation whether to re-run it or not. - :paramtype force_update_tag: str - :keyword roles_applied_to: Optional list of roles to apply this extension. If property is not - specified or '*' is specified, extension is applied to all roles in the cloud service. - :paramtype roles_applied_to: list[str] - """ - super().__init__(**kwargs) - self.publisher = publisher - self.type = type - self.type_handler_version = type_handler_version - self.auto_upgrade_minor_version = auto_upgrade_minor_version - self.settings = settings - self.protected_settings = protected_settings - self.protected_settings_from_key_vault = protected_settings_from_key_vault - self.force_update_tag = force_update_tag - self.provisioning_state: Optional[str] = None - self.roles_applied_to = roles_applied_to - - -class CloudServiceInstanceView(_serialization.Model): - """InstanceView of CloudService as a whole. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar role_instance: Instance view statuses. - :vartype role_instance: ~azure.mgmt.compute.models.InstanceViewStatusesSummary - :ivar sdk_version: The version of the SDK that was used to generate the package for the cloud - service. - :vartype sdk_version: str - :ivar private_ids: Specifies a list of unique identifiers generated internally for the cloud - service. :code:`
`\\ :code:`
` NOTE: If you are using Azure Diagnostics extension, - this property can be used as 'DeploymentId' for querying details. - :vartype private_ids: list[str] - :ivar statuses: - :vartype statuses: list[~azure.mgmt.compute.models.ResourceInstanceViewStatus] - """ - - _validation = { - "sdk_version": {"readonly": True}, - "private_ids": {"readonly": True}, - "statuses": {"readonly": True}, - } - - _attribute_map = { - "role_instance": {"key": "roleInstance", "type": "InstanceViewStatusesSummary"}, - "sdk_version": {"key": "sdkVersion", "type": "str"}, - "private_ids": {"key": "privateIds", "type": "[str]"}, - "statuses": {"key": "statuses", "type": "[ResourceInstanceViewStatus]"}, - } - - def __init__(self, *, role_instance: Optional["_models.InstanceViewStatusesSummary"] = None, **kwargs: Any) -> None: - """ - :keyword role_instance: Instance view statuses. - :paramtype role_instance: ~azure.mgmt.compute.models.InstanceViewStatusesSummary - """ - super().__init__(**kwargs) - self.role_instance = role_instance - self.sdk_version: Optional[str] = None - self.private_ids: Optional[list[str]] = None - self.statuses: Optional[list["_models.ResourceInstanceViewStatus"]] = None - - -class CloudServiceListResult(_serialization.Model): - """The list operation result. - - All required parameters must be populated in order to send to server. - - :ivar value: The list of resources. Required. - :vartype value: list[~azure.mgmt.compute.models.CloudService] - :ivar next_link: The URI to fetch the next page of resources. Use this to get the next page of - resources. Do this till nextLink is null to fetch all the resources. - :vartype next_link: str - """ - - _validation = { - "value": {"required": True}, - } - - _attribute_map = { - "value": {"key": "value", "type": "[CloudService]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__(self, *, value: list["_models.CloudService"], next_link: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword value: The list of resources. Required. - :paramtype value: list[~azure.mgmt.compute.models.CloudService] - :keyword next_link: The URI to fetch the next page of resources. Use this to get the next page - of resources. Do this till nextLink is null to fetch all the resources. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class CloudServiceNetworkProfile(_serialization.Model): - """Network Profile for the cloud service. - - :ivar load_balancer_configurations: List of Load balancer configurations. Cloud service can - have up to two load balancer configurations, corresponding to a Public Load Balancer and an - Internal Load Balancer. - :vartype load_balancer_configurations: - list[~azure.mgmt.compute.models.LoadBalancerConfiguration] - :ivar slot_type: Slot type for the cloud service. - Possible values are :code:`
`\\ :code:`
`\\ **Production**\\ :code:`
`\\ - :code:`
`\\ **Staging**\\ :code:`
`\\ :code:`
` - If not specified, the default value is Production. Known values are: "Production" and - "Staging". - :vartype slot_type: str or ~azure.mgmt.compute.models.CloudServiceSlotType - :ivar swappable_cloud_service: The id reference of the cloud service containing the target IP - with which the subject cloud service can perform a swap. This property cannot be updated once - it is set. The swappable cloud service referred by this id must be present otherwise an error - will be thrown. - :vartype swappable_cloud_service: ~azure.mgmt.compute.models.SubResource - """ - - _attribute_map = { - "load_balancer_configurations": {"key": "loadBalancerConfigurations", "type": "[LoadBalancerConfiguration]"}, - "slot_type": {"key": "slotType", "type": "str"}, - "swappable_cloud_service": {"key": "swappableCloudService", "type": "SubResource"}, - } - - def __init__( - self, - *, - load_balancer_configurations: Optional[list["_models.LoadBalancerConfiguration"]] = None, - slot_type: Optional[Union[str, "_models.CloudServiceSlotType"]] = None, - swappable_cloud_service: Optional["_models.SubResource"] = None, - **kwargs: Any - ) -> None: - """ - :keyword load_balancer_configurations: List of Load balancer configurations. Cloud service can - have up to two load balancer configurations, corresponding to a Public Load Balancer and an - Internal Load Balancer. - :paramtype load_balancer_configurations: - list[~azure.mgmt.compute.models.LoadBalancerConfiguration] - :keyword slot_type: Slot type for the cloud service. - Possible values are :code:`
`\\ :code:`
`\\ **Production**\\ :code:`
`\\ - :code:`
`\\ **Staging**\\ :code:`
`\\ :code:`
` - If not specified, the default value is Production. Known values are: "Production" and - "Staging". - :paramtype slot_type: str or ~azure.mgmt.compute.models.CloudServiceSlotType - :keyword swappable_cloud_service: The id reference of the cloud service containing the target - IP with which the subject cloud service can perform a swap. This property cannot be updated - once it is set. The swappable cloud service referred by this id must be present otherwise an - error will be thrown. - :paramtype swappable_cloud_service: ~azure.mgmt.compute.models.SubResource - """ - super().__init__(**kwargs) - self.load_balancer_configurations = load_balancer_configurations - self.slot_type = slot_type - self.swappable_cloud_service = swappable_cloud_service - - -class CloudServiceOsProfile(_serialization.Model): - """Describes the OS profile for the cloud service. - - :ivar secrets: Specifies set of certificates that should be installed onto the role instances. - :vartype secrets: list[~azure.mgmt.compute.models.CloudServiceVaultSecretGroup] - """ - - _attribute_map = { - "secrets": {"key": "secrets", "type": "[CloudServiceVaultSecretGroup]"}, - } - - def __init__( - self, *, secrets: Optional[list["_models.CloudServiceVaultSecretGroup"]] = None, **kwargs: Any - ) -> None: - """ - :keyword secrets: Specifies set of certificates that should be installed onto the role - instances. - :paramtype secrets: list[~azure.mgmt.compute.models.CloudServiceVaultSecretGroup] - """ - super().__init__(**kwargs) - self.secrets = secrets - - -class CloudServiceProperties(_serialization.Model): - """Cloud service properties. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar package_url: Specifies a URL that refers to the location of the service package in the - Blob service. The service package URL can be Shared Access Signature (SAS) URI from any storage - account. - This is a write-only property and is not returned in GET calls. - :vartype package_url: str - :ivar configuration: Specifies the XML service configuration (.cscfg) for the cloud service. - :vartype configuration: str - :ivar configuration_url: Specifies a URL that refers to the location of the service - configuration in the Blob service. The service package URL can be Shared Access Signature - (SAS) URI from any storage account. - This is a write-only property and is not returned in GET calls. - :vartype configuration_url: str - :ivar start_cloud_service: (Optional) Indicates whether to start the cloud service immediately - after it is created. The default value is ``true``. - If false, the service model is still deployed, but the code is not run immediately. Instead, - the service is PoweredOff until you call Start, at which time the service will be started. A - deployed service still incurs charges, even if it is poweredoff. - :vartype start_cloud_service: bool - :ivar allow_model_override: (Optional) Indicates whether the role sku properties - (roleProfile.roles.sku) specified in the model/template should override the role instance count - and vm size specified in the .cscfg and .csdef respectively. - The default value is ``false``. - :vartype allow_model_override: bool - :ivar upgrade_mode: Update mode for the cloud service. Role instances are allocated to update - domains when the service is deployed. Updates can be initiated manually in each update domain - or initiated automatically in all update domains. - Possible Values are :code:`
`\\ :code:`
`\\ **Auto**\\ :code:`
`\\ :code:`
`\\ **Manual** :code:`
`\\ :code:`
`\\ **Simultaneous**\\ :code:`
`\\ - :code:`
` - If not specified, the default value is Auto. If set to Manual, PUT UpdateDomain must be called - to apply the update. If set to Auto, the update is automatically applied to each update domain - in sequence. Known values are: "Auto", "Manual", and "Simultaneous". - :vartype upgrade_mode: str or ~azure.mgmt.compute.models.CloudServiceUpgradeMode - :ivar role_profile: Describes the role profile for the cloud service. - :vartype role_profile: ~azure.mgmt.compute.models.CloudServiceRoleProfile - :ivar os_profile: Describes the OS profile for the cloud service. - :vartype os_profile: ~azure.mgmt.compute.models.CloudServiceOsProfile - :ivar network_profile: Network Profile for the cloud service. - :vartype network_profile: ~azure.mgmt.compute.models.CloudServiceNetworkProfile - :ivar extension_profile: Describes a cloud service extension profile. - :vartype extension_profile: ~azure.mgmt.compute.models.CloudServiceExtensionProfile - :ivar provisioning_state: The provisioning state, which only appears in the response. - :vartype provisioning_state: str - :ivar unique_id: The unique identifier for the cloud service. - :vartype unique_id: str - """ - - _validation = { - "provisioning_state": {"readonly": True}, - "unique_id": {"readonly": True}, - } - - _attribute_map = { - "package_url": {"key": "packageUrl", "type": "str"}, - "configuration": {"key": "configuration", "type": "str"}, - "configuration_url": {"key": "configurationUrl", "type": "str"}, - "start_cloud_service": {"key": "startCloudService", "type": "bool"}, - "allow_model_override": {"key": "allowModelOverride", "type": "bool"}, - "upgrade_mode": {"key": "upgradeMode", "type": "str"}, - "role_profile": {"key": "roleProfile", "type": "CloudServiceRoleProfile"}, - "os_profile": {"key": "osProfile", "type": "CloudServiceOsProfile"}, - "network_profile": {"key": "networkProfile", "type": "CloudServiceNetworkProfile"}, - "extension_profile": {"key": "extensionProfile", "type": "CloudServiceExtensionProfile"}, - "provisioning_state": {"key": "provisioningState", "type": "str"}, - "unique_id": {"key": "uniqueId", "type": "str"}, - } - - def __init__( - self, - *, - package_url: Optional[str] = None, - configuration: Optional[str] = None, - configuration_url: Optional[str] = None, - start_cloud_service: Optional[bool] = None, - allow_model_override: Optional[bool] = None, - upgrade_mode: Optional[Union[str, "_models.CloudServiceUpgradeMode"]] = None, - role_profile: Optional["_models.CloudServiceRoleProfile"] = None, - os_profile: Optional["_models.CloudServiceOsProfile"] = None, - network_profile: Optional["_models.CloudServiceNetworkProfile"] = None, - extension_profile: Optional["_models.CloudServiceExtensionProfile"] = None, - **kwargs: Any - ) -> None: - """ - :keyword package_url: Specifies a URL that refers to the location of the service package in the - Blob service. The service package URL can be Shared Access Signature (SAS) URI from any storage - account. - This is a write-only property and is not returned in GET calls. - :paramtype package_url: str - :keyword configuration: Specifies the XML service configuration (.cscfg) for the cloud service. - :paramtype configuration: str - :keyword configuration_url: Specifies a URL that refers to the location of the service - configuration in the Blob service. The service package URL can be Shared Access Signature - (SAS) URI from any storage account. - This is a write-only property and is not returned in GET calls. - :paramtype configuration_url: str - :keyword start_cloud_service: (Optional) Indicates whether to start the cloud service - immediately after it is created. The default value is ``true``. - If false, the service model is still deployed, but the code is not run immediately. Instead, - the service is PoweredOff until you call Start, at which time the service will be started. A - deployed service still incurs charges, even if it is poweredoff. - :paramtype start_cloud_service: bool - :keyword allow_model_override: (Optional) Indicates whether the role sku properties - (roleProfile.roles.sku) specified in the model/template should override the role instance count - and vm size specified in the .cscfg and .csdef respectively. - The default value is ``false``. - :paramtype allow_model_override: bool - :keyword upgrade_mode: Update mode for the cloud service. Role instances are allocated to - update domains when the service is deployed. Updates can be initiated manually in each update - domain or initiated automatically in all update domains. - Possible Values are :code:`
`\\ :code:`
`\\ **Auto**\\ :code:`
`\\ :code:`
`\\ **Manual** :code:`
`\\ :code:`
`\\ **Simultaneous**\\ :code:`
`\\ - :code:`
` - If not specified, the default value is Auto. If set to Manual, PUT UpdateDomain must be called - to apply the update. If set to Auto, the update is automatically applied to each update domain - in sequence. Known values are: "Auto", "Manual", and "Simultaneous". - :paramtype upgrade_mode: str or ~azure.mgmt.compute.models.CloudServiceUpgradeMode - :keyword role_profile: Describes the role profile for the cloud service. - :paramtype role_profile: ~azure.mgmt.compute.models.CloudServiceRoleProfile - :keyword os_profile: Describes the OS profile for the cloud service. - :paramtype os_profile: ~azure.mgmt.compute.models.CloudServiceOsProfile - :keyword network_profile: Network Profile for the cloud service. - :paramtype network_profile: ~azure.mgmt.compute.models.CloudServiceNetworkProfile - :keyword extension_profile: Describes a cloud service extension profile. - :paramtype extension_profile: ~azure.mgmt.compute.models.CloudServiceExtensionProfile - """ - super().__init__(**kwargs) - self.package_url = package_url - self.configuration = configuration - self.configuration_url = configuration_url - self.start_cloud_service = start_cloud_service - self.allow_model_override = allow_model_override - self.upgrade_mode = upgrade_mode - self.role_profile = role_profile - self.os_profile = os_profile - self.network_profile = network_profile - self.extension_profile = extension_profile - self.provisioning_state: Optional[str] = None - self.unique_id: Optional[str] = None - - -class CloudServiceRole(_serialization.Model): - """Describes a role of the cloud service. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Resource id. - :vartype id: str - :ivar name: Resource name. - :vartype name: str - :ivar type: Resource type. - :vartype type: str - :ivar location: Resource location. - :vartype location: str - :ivar sku: Describes the cloud service role sku. - :vartype sku: ~azure.mgmt.compute.models.CloudServiceRoleSku - :ivar properties: The cloud service role properties. - :vartype properties: ~azure.mgmt.compute.models.CloudServiceRoleProperties - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "location": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "location": {"key": "location", "type": "str"}, - "sku": {"key": "sku", "type": "CloudServiceRoleSku"}, - "properties": {"key": "properties", "type": "CloudServiceRoleProperties"}, - } - - def __init__( - self, - *, - sku: Optional["_models.CloudServiceRoleSku"] = None, - properties: Optional["_models.CloudServiceRoleProperties"] = None, - **kwargs: Any - ) -> None: - """ - :keyword sku: Describes the cloud service role sku. - :paramtype sku: ~azure.mgmt.compute.models.CloudServiceRoleSku - :keyword properties: The cloud service role properties. - :paramtype properties: ~azure.mgmt.compute.models.CloudServiceRoleProperties - """ - super().__init__(**kwargs) - self.id: Optional[str] = None - self.name: Optional[str] = None - self.type: Optional[str] = None - self.location: Optional[str] = None - self.sku = sku - self.properties = properties - - -class CloudServiceRoleListResult(_serialization.Model): - """The list operation result. - - All required parameters must be populated in order to send to server. - - :ivar value: The list of resources. Required. - :vartype value: list[~azure.mgmt.compute.models.CloudServiceRole] - :ivar next_link: The URI to fetch the next page of resources. Use this to get the next page of - resources. Do this till nextLink is null to fetch all the resources. - :vartype next_link: str - """ - - _validation = { - "value": {"required": True}, - } - - _attribute_map = { - "value": {"key": "value", "type": "[CloudServiceRole]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, *, value: list["_models.CloudServiceRole"], next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: The list of resources. Required. - :paramtype value: list[~azure.mgmt.compute.models.CloudServiceRole] - :keyword next_link: The URI to fetch the next page of resources. Use this to get the next page - of resources. Do this till nextLink is null to fetch all the resources. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class CloudServiceRoleProfile(_serialization.Model): - """Describes the role profile for the cloud service. - - :ivar roles: List of roles for the cloud service. - :vartype roles: list[~azure.mgmt.compute.models.CloudServiceRoleProfileProperties] - """ - - _attribute_map = { - "roles": {"key": "roles", "type": "[CloudServiceRoleProfileProperties]"}, - } - - def __init__( - self, *, roles: Optional[list["_models.CloudServiceRoleProfileProperties"]] = None, **kwargs: Any - ) -> None: - """ - :keyword roles: List of roles for the cloud service. - :paramtype roles: list[~azure.mgmt.compute.models.CloudServiceRoleProfileProperties] - """ - super().__init__(**kwargs) - self.roles = roles - - -class CloudServiceRoleProfileProperties(_serialization.Model): - """Describes the role properties. - - :ivar name: Resource name. - :vartype name: str - :ivar sku: Describes the cloud service role sku. - :vartype sku: ~azure.mgmt.compute.models.CloudServiceRoleSku - """ - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "sku": {"key": "sku", "type": "CloudServiceRoleSku"}, - } - - def __init__( - self, *, name: Optional[str] = None, sku: Optional["_models.CloudServiceRoleSku"] = None, **kwargs: Any - ) -> None: - """ - :keyword name: Resource name. - :paramtype name: str - :keyword sku: Describes the cloud service role sku. - :paramtype sku: ~azure.mgmt.compute.models.CloudServiceRoleSku - """ - super().__init__(**kwargs) - self.name = name - self.sku = sku - - -class CloudServiceRoleProperties(_serialization.Model): - """The cloud service role properties. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar unique_id: Specifies the ID which uniquely identifies a cloud service role. - :vartype unique_id: str - """ - - _validation = { - "unique_id": {"readonly": True}, - } - - _attribute_map = { - "unique_id": {"key": "uniqueId", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.unique_id: Optional[str] = None - - -class CloudServiceRoleSku(_serialization.Model): - """Describes the cloud service role sku. - - :ivar name: The sku name. NOTE: If the new SKU is not supported on the hardware the cloud - service is currently on, you need to delete and recreate the cloud service or move back to the - old sku. - :vartype name: str - :ivar tier: Specifies the tier of the cloud service. Possible Values are :code:`
`\\ - :code:`
` **Standard** :code:`
`\\ :code:`
` **Basic**. - :vartype tier: str - :ivar capacity: Specifies the number of role instances in the cloud service. - :vartype capacity: int - """ - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "tier": {"key": "tier", "type": "str"}, - "capacity": {"key": "capacity", "type": "int"}, - } - - def __init__( - self, *, name: Optional[str] = None, tier: Optional[str] = None, capacity: Optional[int] = None, **kwargs: Any - ) -> None: - """ - :keyword name: The sku name. NOTE: If the new SKU is not supported on the hardware the cloud - service is currently on, you need to delete and recreate the cloud service or move back to the - old sku. - :paramtype name: str - :keyword tier: Specifies the tier of the cloud service. Possible Values are :code:`
`\\ - :code:`
` **Standard** :code:`
`\\ :code:`
` **Basic**. - :paramtype tier: str - :keyword capacity: Specifies the number of role instances in the cloud service. - :paramtype capacity: int - """ - super().__init__(**kwargs) - self.name = name - self.tier = tier - self.capacity = capacity - - -class CloudServiceUpdate(_serialization.Model): - """CloudServiceUpdate. - - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - """ - - _attribute_map = { - "tags": {"key": "tags", "type": "{str}"}, - } - - def __init__(self, *, tags: Optional[dict[str, str]] = None, **kwargs: Any) -> None: - """ - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - """ - super().__init__(**kwargs) - self.tags = tags - - -class CloudServiceVaultAndSecretReference(_serialization.Model): - """Protected settings for the extension, referenced using KeyVault which are encrypted before sent - to the role instance. - - :ivar source_vault: The ARM Resource ID of the Key Vault. - :vartype source_vault: ~azure.mgmt.compute.models.SubResource - :ivar secret_url: Secret URL which contains the protected settings of the extension. - :vartype secret_url: str - """ - - _attribute_map = { - "source_vault": {"key": "sourceVault", "type": "SubResource"}, - "secret_url": {"key": "secretUrl", "type": "str"}, - } - - def __init__( - self, *, source_vault: Optional["_models.SubResource"] = None, secret_url: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword source_vault: The ARM Resource ID of the Key Vault. - :paramtype source_vault: ~azure.mgmt.compute.models.SubResource - :keyword secret_url: Secret URL which contains the protected settings of the extension. - :paramtype secret_url: str - """ - super().__init__(**kwargs) - self.source_vault = source_vault - self.secret_url = secret_url - - -class CloudServiceVaultCertificate(_serialization.Model): - """Describes a single certificate reference in a Key Vault, and where the certificate should - reside on the role instance. - - :ivar certificate_url: This is the URL of a certificate that has been uploaded to Key Vault as - a secret. - :vartype certificate_url: str - :ivar is_bootstrap_certificate: Flag indicating if the certificate provided is a bootstrap - certificate to be used by the Key Vault Extension to fetch the remaining certificates. - :vartype is_bootstrap_certificate: bool - """ - - _attribute_map = { - "certificate_url": {"key": "certificateUrl", "type": "str"}, - "is_bootstrap_certificate": {"key": "isBootstrapCertificate", "type": "bool"}, - } - - def __init__( - self, *, certificate_url: Optional[str] = None, is_bootstrap_certificate: Optional[bool] = None, **kwargs: Any - ) -> None: - """ - :keyword certificate_url: This is the URL of a certificate that has been uploaded to Key Vault - as a secret. - :paramtype certificate_url: str - :keyword is_bootstrap_certificate: Flag indicating if the certificate provided is a bootstrap - certificate to be used by the Key Vault Extension to fetch the remaining certificates. - :paramtype is_bootstrap_certificate: bool - """ - super().__init__(**kwargs) - self.certificate_url = certificate_url - self.is_bootstrap_certificate = is_bootstrap_certificate - - -class CloudServiceVaultSecretGroup(_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.models.SubResource - :ivar vault_certificates: The list of key vault references in SourceVault which contain - certificates. - :vartype vault_certificates: list[~azure.mgmt.compute.models.CloudServiceVaultCertificate] - """ - - _attribute_map = { - "source_vault": {"key": "sourceVault", "type": "SubResource"}, - "vault_certificates": {"key": "vaultCertificates", "type": "[CloudServiceVaultCertificate]"}, - } - - def __init__( - self, - *, - source_vault: Optional["_models.SubResource"] = None, - vault_certificates: Optional[list["_models.CloudServiceVaultCertificate"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword source_vault: The relative URL of the Key Vault containing all of the certificates in - VaultCertificates. - :paramtype source_vault: ~azure.mgmt.compute.models.SubResource - :keyword vault_certificates: The list of key vault references in SourceVault which contain - certificates. - :paramtype vault_certificates: list[~azure.mgmt.compute.models.CloudServiceVaultCertificate] - """ - super().__init__(**kwargs) - self.source_vault = source_vault - self.vault_certificates = vault_certificates - - -class PirCommunityGalleryResource(_serialization.Model): - """Base information about the community gallery resource in azure compute gallery. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name: Resource name. - :vartype name: str - :ivar location: Resource location. - :vartype location: str - :ivar type: Resource type. - :vartype type: str - :ivar unique_id: The unique id of this community gallery. - :vartype unique_id: str - """ - - _validation = { - "name": {"readonly": True}, - "location": {"readonly": True}, - "type": {"readonly": True}, - } - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "location": {"key": "location", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "unique_id": {"key": "identifier.uniqueId", "type": "str"}, - } - - def __init__(self, *, unique_id: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword unique_id: The unique id of this community gallery. - :paramtype unique_id: str - """ - super().__init__(**kwargs) - self.name: Optional[str] = None - self.location: Optional[str] = None - self.type: Optional[str] = None - self.unique_id = unique_id - - -class CommunityGallery(PirCommunityGalleryResource): - """Specifies information about the Community Gallery that you want to create or update. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name: Resource name. - :vartype name: str - :ivar location: Resource location. - :vartype location: str - :ivar type: Resource type. - :vartype type: str - :ivar unique_id: The unique id of this community gallery. - :vartype unique_id: str - :ivar disclaimer: The disclaimer for a community gallery resource. - :vartype disclaimer: str - :ivar artifact_tags: The artifact tags of a community gallery resource. - :vartype artifact_tags: dict[str, str] - :ivar community_metadata: The metadata of community gallery. - :vartype community_metadata: ~azure.mgmt.compute.models.CommunityGalleryMetadata - """ - - _validation = { - "name": {"readonly": True}, - "location": {"readonly": True}, - "type": {"readonly": True}, - } - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "location": {"key": "location", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "unique_id": {"key": "identifier.uniqueId", "type": "str"}, - "disclaimer": {"key": "properties.disclaimer", "type": "str"}, - "artifact_tags": {"key": "properties.artifactTags", "type": "{str}"}, - "community_metadata": {"key": "properties.communityMetadata", "type": "CommunityGalleryMetadata"}, - } - - def __init__( - self, - *, - unique_id: Optional[str] = None, - disclaimer: Optional[str] = None, - artifact_tags: Optional[dict[str, str]] = None, - community_metadata: Optional["_models.CommunityGalleryMetadata"] = None, - **kwargs: Any - ) -> None: - """ - :keyword unique_id: The unique id of this community gallery. - :paramtype unique_id: str - :keyword disclaimer: The disclaimer for a community gallery resource. - :paramtype disclaimer: str - :keyword artifact_tags: The artifact tags of a community gallery resource. - :paramtype artifact_tags: dict[str, str] - :keyword community_metadata: The metadata of community gallery. - :paramtype community_metadata: ~azure.mgmt.compute.models.CommunityGalleryMetadata - """ - super().__init__(unique_id=unique_id, **kwargs) - self.disclaimer = disclaimer - self.artifact_tags = artifact_tags - self.community_metadata = community_metadata - - -class CommunityGalleryImage(PirCommunityGalleryResource): - """Specifies information about the gallery image definition that you want to create or update. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name: Resource name. - :vartype name: str - :ivar location: Resource location. - :vartype location: str - :ivar type: Resource type. - :vartype type: str - :ivar unique_id: The unique id of this community gallery. - :vartype unique_id: str - :ivar os_type: This property allows you to specify the type of the OS that is included in the - disk when creating a VM from a managed image. Possible values are: **Windows,** **Linux.**. - Known values are: "Windows" and "Linux". - :vartype os_type: str or ~azure.mgmt.compute.models.OperatingSystemTypes - :ivar os_state: This property allows the user to specify whether the virtual machines created - under this image are 'Generalized' or 'Specialized'. Known values are: "Generalized" and - "Specialized". - :vartype os_state: str or ~azure.mgmt.compute.models.OperatingSystemStateTypes - :ivar end_of_life_date: The end of life date of the gallery image definition. This property can - be used for decommissioning purposes. This property is updatable. - :vartype end_of_life_date: ~datetime.datetime - :ivar identifier: This is the community gallery image definition identifier. - :vartype identifier: ~azure.mgmt.compute.models.CommunityGalleryImageIdentifier - :ivar recommended: The properties describe the recommended machine configuration for this Image - Definition. These properties are updatable. - :vartype recommended: ~azure.mgmt.compute.models.RecommendedMachineConfiguration - :ivar disallowed: Describes the disallowed disk types. - :vartype disallowed: ~azure.mgmt.compute.models.Disallowed - :ivar hyper_v_generation: The hypervisor generation of the Virtual Machine. Applicable to OS - disks only. Known values are: "V1" and "V2". - :vartype hyper_v_generation: str or ~azure.mgmt.compute.models.HyperVGeneration - :ivar features: A list of gallery image features. - :vartype features: list[~azure.mgmt.compute.models.GalleryImageFeature] - :ivar purchase_plan: Describes the gallery image definition purchase plan. This is used by - marketplace images. - :vartype purchase_plan: ~azure.mgmt.compute.models.ImagePurchasePlan - :ivar architecture: The architecture of the image. Applicable to OS disks only. Known values - are: "x64" and "Arm64". - :vartype architecture: str or ~azure.mgmt.compute.models.Architecture - :ivar privacy_statement_uri: Privacy statement URI for the current community gallery image. - :vartype privacy_statement_uri: str - :ivar eula: The end-user license agreement for the current community gallery image. - :vartype eula: str - :ivar disclaimer: The disclaimer for a community gallery resource. - :vartype disclaimer: str - :ivar artifact_tags: The artifact tags of a community gallery resource. - :vartype artifact_tags: dict[str, str] - """ - - _validation = { - "name": {"readonly": True}, - "location": {"readonly": True}, - "type": {"readonly": True}, - } - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "location": {"key": "location", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "unique_id": {"key": "identifier.uniqueId", "type": "str"}, - "os_type": {"key": "properties.osType", "type": "str"}, - "os_state": {"key": "properties.osState", "type": "str"}, - "end_of_life_date": {"key": "properties.endOfLifeDate", "type": "iso-8601"}, - "identifier": {"key": "properties.identifier", "type": "CommunityGalleryImageIdentifier"}, - "recommended": {"key": "properties.recommended", "type": "RecommendedMachineConfiguration"}, - "disallowed": {"key": "properties.disallowed", "type": "Disallowed"}, - "hyper_v_generation": {"key": "properties.hyperVGeneration", "type": "str"}, - "features": {"key": "properties.features", "type": "[GalleryImageFeature]"}, - "purchase_plan": {"key": "properties.purchasePlan", "type": "ImagePurchasePlan"}, - "architecture": {"key": "properties.architecture", "type": "str"}, - "privacy_statement_uri": {"key": "properties.privacyStatementUri", "type": "str"}, - "eula": {"key": "properties.eula", "type": "str"}, - "disclaimer": {"key": "properties.disclaimer", "type": "str"}, - "artifact_tags": {"key": "properties.artifactTags", "type": "{str}"}, - } - - def __init__( - self, - *, - unique_id: Optional[str] = None, - os_type: Optional[Union[str, "_models.OperatingSystemTypes"]] = None, - os_state: Optional[Union[str, "_models.OperatingSystemStateTypes"]] = None, - end_of_life_date: Optional[datetime.datetime] = None, - identifier: Optional["_models.CommunityGalleryImageIdentifier"] = None, - recommended: Optional["_models.RecommendedMachineConfiguration"] = None, - disallowed: Optional["_models.Disallowed"] = None, - hyper_v_generation: Optional[Union[str, "_models.HyperVGeneration"]] = None, - features: Optional[list["_models.GalleryImageFeature"]] = None, - purchase_plan: Optional["_models.ImagePurchasePlan"] = None, - architecture: Optional[Union[str, "_models.Architecture"]] = None, - privacy_statement_uri: Optional[str] = None, - eula: Optional[str] = None, - disclaimer: Optional[str] = None, - artifact_tags: Optional[dict[str, str]] = None, - **kwargs: Any - ) -> None: - """ - :keyword unique_id: The unique id of this community gallery. - :paramtype unique_id: str - :keyword os_type: This property allows you to specify the type of the OS that is included in - the disk when creating a VM from a managed image. Possible values are: **Windows,** **Linux.**. - Known values are: "Windows" and "Linux". - :paramtype os_type: str or ~azure.mgmt.compute.models.OperatingSystemTypes - :keyword os_state: This property allows the user to specify whether the virtual machines - created under this image are 'Generalized' or 'Specialized'. Known values are: "Generalized" - and "Specialized". - :paramtype os_state: str or ~azure.mgmt.compute.models.OperatingSystemStateTypes - :keyword end_of_life_date: The end of life date of the gallery image definition. This property - can be used for decommissioning purposes. This property is updatable. - :paramtype end_of_life_date: ~datetime.datetime - :keyword identifier: This is the community gallery image definition identifier. - :paramtype identifier: ~azure.mgmt.compute.models.CommunityGalleryImageIdentifier - :keyword recommended: The properties describe the recommended machine configuration for this - Image Definition. These properties are updatable. - :paramtype recommended: ~azure.mgmt.compute.models.RecommendedMachineConfiguration - :keyword disallowed: Describes the disallowed disk types. - :paramtype disallowed: ~azure.mgmt.compute.models.Disallowed - :keyword hyper_v_generation: The hypervisor generation of the Virtual Machine. Applicable to OS - disks only. Known values are: "V1" and "V2". - :paramtype hyper_v_generation: str or ~azure.mgmt.compute.models.HyperVGeneration - :keyword features: A list of gallery image features. - :paramtype features: list[~azure.mgmt.compute.models.GalleryImageFeature] - :keyword purchase_plan: Describes the gallery image definition purchase plan. This is used by - marketplace images. - :paramtype purchase_plan: ~azure.mgmt.compute.models.ImagePurchasePlan - :keyword architecture: The architecture of the image. Applicable to OS disks only. Known values - are: "x64" and "Arm64". - :paramtype architecture: str or ~azure.mgmt.compute.models.Architecture - :keyword privacy_statement_uri: Privacy statement URI for the current community gallery image. - :paramtype privacy_statement_uri: str - :keyword eula: The end-user license agreement for the current community gallery image. - :paramtype eula: str - :keyword disclaimer: The disclaimer for a community gallery resource. - :paramtype disclaimer: str - :keyword artifact_tags: The artifact tags of a community gallery resource. - :paramtype artifact_tags: dict[str, str] - """ - super().__init__(unique_id=unique_id, **kwargs) - self.os_type = os_type - self.os_state = os_state - self.end_of_life_date = end_of_life_date - self.identifier = identifier - self.recommended = recommended - self.disallowed = disallowed - self.hyper_v_generation = hyper_v_generation - self.features = features - self.purchase_plan = purchase_plan - self.architecture = architecture - self.privacy_statement_uri = privacy_statement_uri - self.eula = eula - self.disclaimer = disclaimer - self.artifact_tags = artifact_tags - - -class CommunityGalleryImageIdentifier(_serialization.Model): - """This is the community gallery image definition identifier. - - :ivar publisher: The name of the gallery image definition publisher. - :vartype publisher: str - :ivar offer: The name of the gallery image definition offer. - :vartype offer: str - :ivar sku: The name of the gallery image definition SKU. - :vartype sku: str - """ - - _attribute_map = { - "publisher": {"key": "publisher", "type": "str"}, - "offer": {"key": "offer", "type": "str"}, - "sku": {"key": "sku", "type": "str"}, - } - - def __init__( - self, *, publisher: Optional[str] = None, offer: Optional[str] = None, sku: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword publisher: The name of the gallery image definition publisher. - :paramtype publisher: str - :keyword offer: The name of the gallery image definition offer. - :paramtype offer: str - :keyword sku: The name of the gallery image definition SKU. - :paramtype sku: str - """ - super().__init__(**kwargs) - self.publisher = publisher - self.offer = offer - self.sku = sku - - -class CommunityGalleryImageList(_serialization.Model): - """The List Community Gallery Images operation response. - - All required parameters must be populated in order to send to server. - - :ivar value: A list of community gallery images. Required. - :vartype value: list[~azure.mgmt.compute.models.CommunityGalleryImage] - :ivar next_link: The link to the next page of items. - :vartype next_link: str - """ - - _validation = { - "value": {"required": True}, - } - - _attribute_map = { - "value": {"key": "value", "type": "[CommunityGalleryImage]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, *, value: list["_models.CommunityGalleryImage"], next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: A list of community gallery images. Required. - :paramtype value: list[~azure.mgmt.compute.models.CommunityGalleryImage] - :keyword next_link: The link to the next page of items. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class CommunityGalleryImageVersion(PirCommunityGalleryResource): - """Specifies information about the gallery image version that you want to create or update. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name: Resource name. - :vartype name: str - :ivar location: Resource location. - :vartype location: str - :ivar type: Resource type. - :vartype type: str - :ivar unique_id: The unique id of this community gallery. - :vartype unique_id: str - :ivar published_date: The published date of the gallery image version Definition. This property - can be used for decommissioning purposes. This property is updatable. - :vartype published_date: ~datetime.datetime - :ivar end_of_life_date: The end of life date of the gallery image version Definition. This - property can be used for decommissioning purposes. This property is updatable. - :vartype end_of_life_date: ~datetime.datetime - :ivar exclude_from_latest: If set to true, Virtual Machines deployed from the latest version of - the Image Definition won't use this Image Version. - :vartype exclude_from_latest: bool - :ivar storage_profile: Describes the storage profile of the image version. - :vartype storage_profile: ~azure.mgmt.compute.models.SharedGalleryImageVersionStorageProfile - :ivar disclaimer: The disclaimer for a community gallery resource. - :vartype disclaimer: str - :ivar artifact_tags: The artifact tags of a community gallery resource. - :vartype artifact_tags: dict[str, str] - """ - - _validation = { - "name": {"readonly": True}, - "location": {"readonly": True}, - "type": {"readonly": True}, - } - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "location": {"key": "location", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "unique_id": {"key": "identifier.uniqueId", "type": "str"}, - "published_date": {"key": "properties.publishedDate", "type": "iso-8601"}, - "end_of_life_date": {"key": "properties.endOfLifeDate", "type": "iso-8601"}, - "exclude_from_latest": {"key": "properties.excludeFromLatest", "type": "bool"}, - "storage_profile": {"key": "properties.storageProfile", "type": "SharedGalleryImageVersionStorageProfile"}, - "disclaimer": {"key": "properties.disclaimer", "type": "str"}, - "artifact_tags": {"key": "properties.artifactTags", "type": "{str}"}, - } - - def __init__( - self, - *, - unique_id: Optional[str] = None, - published_date: Optional[datetime.datetime] = None, - end_of_life_date: Optional[datetime.datetime] = None, - exclude_from_latest: Optional[bool] = None, - storage_profile: Optional["_models.SharedGalleryImageVersionStorageProfile"] = None, - disclaimer: Optional[str] = None, - artifact_tags: Optional[dict[str, str]] = None, - **kwargs: Any - ) -> None: - """ - :keyword unique_id: The unique id of this community gallery. - :paramtype unique_id: str - :keyword published_date: The published date of the gallery image version Definition. This - property can be used for decommissioning purposes. This property is updatable. - :paramtype published_date: ~datetime.datetime - :keyword end_of_life_date: The end of life date of the gallery image version Definition. This - property can be used for decommissioning purposes. This property is updatable. - :paramtype end_of_life_date: ~datetime.datetime - :keyword exclude_from_latest: If set to true, Virtual Machines deployed from the latest version - of the Image Definition won't use this Image Version. - :paramtype exclude_from_latest: bool - :keyword storage_profile: Describes the storage profile of the image version. - :paramtype storage_profile: ~azure.mgmt.compute.models.SharedGalleryImageVersionStorageProfile - :keyword disclaimer: The disclaimer for a community gallery resource. - :paramtype disclaimer: str - :keyword artifact_tags: The artifact tags of a community gallery resource. - :paramtype artifact_tags: dict[str, str] - """ - super().__init__(unique_id=unique_id, **kwargs) - self.published_date = published_date - self.end_of_life_date = end_of_life_date - self.exclude_from_latest = exclude_from_latest - self.storage_profile = storage_profile - self.disclaimer = disclaimer - self.artifact_tags = artifact_tags - - -class CommunityGalleryImageVersionList(_serialization.Model): - """The List Community Gallery Image versions operation response. - - All required parameters must be populated in order to send to server. - - :ivar value: A list of community gallery image versions. Required. - :vartype value: list[~azure.mgmt.compute.models.CommunityGalleryImageVersion] - :ivar next_link: The URI to fetch the next page of community gallery image versions. Call - ListNext() with this to fetch the next page of community gallery image versions. - :vartype next_link: str - """ - - _validation = { - "value": {"required": True}, - } - - _attribute_map = { - "value": {"key": "value", "type": "[CommunityGalleryImageVersion]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, *, value: list["_models.CommunityGalleryImageVersion"], next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: A list of community gallery image versions. Required. - :paramtype value: list[~azure.mgmt.compute.models.CommunityGalleryImageVersion] - :keyword next_link: The URI to fetch the next page of community gallery image versions. Call - ListNext() with this to fetch the next page of community gallery image versions. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class CommunityGalleryInfo(_serialization.Model): - """Information of community gallery if current gallery is shared to community. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar publisher_uri: The link to the publisher website. Visible to all users. - :vartype publisher_uri: str - :ivar publisher_contact: Community gallery publisher support email. The email address of the - publisher. Visible to all users. - :vartype publisher_contact: str - :ivar eula: End-user license agreement for community gallery image. - :vartype eula: str - :ivar public_name_prefix: The prefix of the gallery name that will be displayed publicly. - Visible to all users. - :vartype public_name_prefix: str - :ivar community_gallery_enabled: Contains info about whether community gallery sharing is - enabled. - :vartype community_gallery_enabled: bool - :ivar public_names: Community gallery public name list. - :vartype public_names: list[str] - """ - - _validation = { - "community_gallery_enabled": {"readonly": True}, - "public_names": {"readonly": True}, - } - - _attribute_map = { - "publisher_uri": {"key": "publisherUri", "type": "str"}, - "publisher_contact": {"key": "publisherContact", "type": "str"}, - "eula": {"key": "eula", "type": "str"}, - "public_name_prefix": {"key": "publicNamePrefix", "type": "str"}, - "community_gallery_enabled": {"key": "communityGalleryEnabled", "type": "bool"}, - "public_names": {"key": "publicNames", "type": "[str]"}, - } - - def __init__( - self, - *, - publisher_uri: Optional[str] = None, - publisher_contact: Optional[str] = None, - eula: Optional[str] = None, - public_name_prefix: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword publisher_uri: The link to the publisher website. Visible to all users. - :paramtype publisher_uri: str - :keyword publisher_contact: Community gallery publisher support email. The email address of the - publisher. Visible to all users. - :paramtype publisher_contact: str - :keyword eula: End-user license agreement for community gallery image. - :paramtype eula: str - :keyword public_name_prefix: The prefix of the gallery name that will be displayed publicly. - Visible to all users. - :paramtype public_name_prefix: str - """ - super().__init__(**kwargs) - self.publisher_uri = publisher_uri - self.publisher_contact = publisher_contact - self.eula = eula - self.public_name_prefix = public_name_prefix - self.community_gallery_enabled: Optional[bool] = None - self.public_names: Optional[list[str]] = None - - -class CommunityGalleryMetadata(_serialization.Model): - """The metadata of community gallery. - - All required parameters must be populated in order to send to server. - - :ivar publisher_uri: The publisher URI of this community gallery. - :vartype publisher_uri: str - :ivar publisher_contact: The publisher email id of this community gallery. Required. - :vartype publisher_contact: str - :ivar eula: The end-user license agreement for this community gallery. - :vartype eula: str - :ivar public_names: A list of public names the gallery has. Required. - :vartype public_names: list[str] - :ivar privacy_statement_uri: The link for the privacy statement of this community gallery from - the gallery publisher. - :vartype privacy_statement_uri: str - """ - - _validation = { - "publisher_contact": {"required": True}, - "public_names": {"required": True}, - } - - _attribute_map = { - "publisher_uri": {"key": "publisherUri", "type": "str"}, - "publisher_contact": {"key": "publisherContact", "type": "str"}, - "eula": {"key": "eula", "type": "str"}, - "public_names": {"key": "publicNames", "type": "[str]"}, - "privacy_statement_uri": {"key": "privacyStatementUri", "type": "str"}, - } - - def __init__( - self, - *, - publisher_contact: str, - public_names: list[str], - publisher_uri: Optional[str] = None, - eula: Optional[str] = None, - privacy_statement_uri: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword publisher_uri: The publisher URI of this community gallery. - :paramtype publisher_uri: str - :keyword publisher_contact: The publisher email id of this community gallery. Required. - :paramtype publisher_contact: str - :keyword eula: The end-user license agreement for this community gallery. - :paramtype eula: str - :keyword public_names: A list of public names the gallery has. Required. - :paramtype public_names: list[str] - :keyword privacy_statement_uri: The link for the privacy statement of this community gallery - from the gallery publisher. - :paramtype privacy_statement_uri: str - """ - super().__init__(**kwargs) - self.publisher_uri = publisher_uri - self.publisher_contact = publisher_contact - self.eula = eula - self.public_names = public_names - self.privacy_statement_uri = privacy_statement_uri - - -class ConvertToVirtualMachineScaleSetInput(_serialization.Model): - """Describes the Virtual Machine Scale Set to convert from Availability Set. - - :ivar virtual_machine_scale_set_name: Specifies information about the Virtual Machine Scale Set - that the Availability Set should be converted to. - :vartype virtual_machine_scale_set_name: str - """ - - _attribute_map = { - "virtual_machine_scale_set_name": {"key": "virtualMachineScaleSetName", "type": "str"}, - } - - def __init__(self, *, virtual_machine_scale_set_name: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword virtual_machine_scale_set_name: Specifies information about the Virtual Machine Scale - Set that the Availability Set should be converted to. - :paramtype virtual_machine_scale_set_name: str - """ - super().__init__(**kwargs) - self.virtual_machine_scale_set_name = virtual_machine_scale_set_name - - -class CopyCompletionError(_serialization.Model): - """Indicates the error details if the background copy of a resource created via the CopyStart - operation fails. - - All required parameters must be populated in order to send to server. - - :ivar error_code: Indicates the error code if the background copy of a resource created via the - CopyStart operation fails. Required. "CopySourceNotFound" - :vartype error_code: str or ~azure.mgmt.compute.models.CopyCompletionErrorReason - :ivar error_message: Indicates the error message if the background copy of a resource created - via the CopyStart operation fails. Required. - :vartype error_message: str - """ - - _validation = { - "error_code": {"required": True}, - "error_message": {"required": True}, - } - - _attribute_map = { - "error_code": {"key": "errorCode", "type": "str"}, - "error_message": {"key": "errorMessage", "type": "str"}, - } - - def __init__( - self, *, error_code: Union[str, "_models.CopyCompletionErrorReason"], error_message: str, **kwargs: Any - ) -> None: - """ - :keyword error_code: Indicates the error code if the background copy of a resource created via - the CopyStart operation fails. Required. "CopySourceNotFound" - :paramtype error_code: str or ~azure.mgmt.compute.models.CopyCompletionErrorReason - :keyword error_message: Indicates the error message if the background copy of a resource - created via the CopyStart operation fails. Required. - :paramtype error_message: str - """ - super().__init__(**kwargs) - self.error_code = error_code - self.error_message = error_message - - -class CreationData(_serialization.Model): - """Data used when creating a disk. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to server. - - :ivar create_option: This enumerates the possible sources of a disk's creation. Required. Known - values are: "Empty", "Attach", "FromImage", "Import", "Copy", "Restore", "Upload", "CopyStart", - "ImportSecure", "UploadPreparedSecure", "CopyFromSanSnapshot", and "Import". - :vartype create_option: str or ~azure.mgmt.compute.models.DiskCreateOption - :ivar storage_account_id: Required if createOption is Import. The Azure Resource Manager - identifier of the storage account containing the blob to import as a disk. - :vartype storage_account_id: str - :ivar image_reference: Disk source information for PIR or user images. - :vartype image_reference: ~azure.mgmt.compute.models.ImageDiskReference - :ivar gallery_image_reference: Required if creating from a Gallery Image. The - id/sharedGalleryImageId/communityGalleryImageId of the ImageDiskReference will be the ARM id of - the shared galley image version from which to create a disk. - :vartype gallery_image_reference: ~azure.mgmt.compute.models.ImageDiskReference - :ivar source_uri: If createOption is Import, this is the URI of a blob to be imported into a - managed disk. - :vartype source_uri: str - :ivar source_resource_id: If createOption is Copy, this is the ARM id of the source snapshot or - disk. - :vartype source_resource_id: str - :ivar source_unique_id: If this field is set, this is the unique id identifying the source of - this resource. - :vartype source_unique_id: str - :ivar upload_size_bytes: If createOption is Upload, this is the size of the contents of the - upload including the VHD footer. This value should be between 20972032 (20 MiB + 512 bytes for - the VHD footer) and 35183298347520 bytes (32 TiB + 512 bytes for the VHD footer). - :vartype upload_size_bytes: int - :ivar logical_sector_size: Logical sector size in bytes for Ultra disks. Supported values are - 512 ad 4096. 4096 is the default. - :vartype logical_sector_size: int - :ivar security_data_uri: If createOption is ImportSecure, this is the URI of a blob to be - imported into VM guest state. - :vartype security_data_uri: str - :ivar security_metadata_uri: If createOption is ImportSecure, this is the URI of a blob to be - imported into VM metadata for Confidential VM. - :vartype security_metadata_uri: str - :ivar performance_plus: Set this flag to true to get a boost on the performance target of the - disk deployed, see here on the respective performance target. This flag can only be set on disk - creation time and cannot be disabled after enabled. - :vartype performance_plus: bool - :ivar elastic_san_resource_id: Required if createOption is CopyFromSanSnapshot. This is the ARM - id of the source elastic san volume snapshot. - :vartype elastic_san_resource_id: str - :ivar provisioned_bandwidth_copy_speed: If this field is set on a snapshot and createOption is - CopyStart, the snapshot will be copied at a quicker speed. Known values are: "None" and - "Enhanced". - :vartype provisioned_bandwidth_copy_speed: str or - ~azure.mgmt.compute.models.ProvisionedBandwidthCopyOption - :ivar instant_access_duration_minutes: For snapshots created from Premium SSD v2 or Ultra disk, - this property determines the time in minutes the snapshot is retained for instant access to - enable faster restore. - :vartype instant_access_duration_minutes: int - """ - - _validation = { - "create_option": {"required": True}, - "source_unique_id": {"readonly": True}, - "instant_access_duration_minutes": {"minimum": 1}, - } - - _attribute_map = { - "create_option": {"key": "createOption", "type": "str"}, - "storage_account_id": {"key": "storageAccountId", "type": "str"}, - "image_reference": {"key": "imageReference", "type": "ImageDiskReference"}, - "gallery_image_reference": {"key": "galleryImageReference", "type": "ImageDiskReference"}, - "source_uri": {"key": "sourceUri", "type": "str"}, - "source_resource_id": {"key": "sourceResourceId", "type": "str"}, - "source_unique_id": {"key": "sourceUniqueId", "type": "str"}, - "upload_size_bytes": {"key": "uploadSizeBytes", "type": "int"}, - "logical_sector_size": {"key": "logicalSectorSize", "type": "int"}, - "security_data_uri": {"key": "securityDataUri", "type": "str"}, - "security_metadata_uri": {"key": "securityMetadataUri", "type": "str"}, - "performance_plus": {"key": "performancePlus", "type": "bool"}, - "elastic_san_resource_id": {"key": "elasticSanResourceId", "type": "str"}, - "provisioned_bandwidth_copy_speed": {"key": "provisionedBandwidthCopySpeed", "type": "str"}, - "instant_access_duration_minutes": {"key": "instantAccessDurationMinutes", "type": "int"}, - } - - def __init__( - self, - *, - create_option: Union[str, "_models.DiskCreateOption"], - storage_account_id: Optional[str] = None, - image_reference: Optional["_models.ImageDiskReference"] = None, - gallery_image_reference: Optional["_models.ImageDiskReference"] = None, - source_uri: Optional[str] = None, - source_resource_id: Optional[str] = None, - upload_size_bytes: Optional[int] = None, - logical_sector_size: Optional[int] = None, - security_data_uri: Optional[str] = None, - security_metadata_uri: Optional[str] = None, - performance_plus: Optional[bool] = None, - elastic_san_resource_id: Optional[str] = None, - provisioned_bandwidth_copy_speed: Optional[Union[str, "_models.ProvisionedBandwidthCopyOption"]] = None, - instant_access_duration_minutes: Optional[int] = None, - **kwargs: Any - ) -> None: - """ - :keyword create_option: This enumerates the possible sources of a disk's creation. Required. - Known values are: "Empty", "Attach", "FromImage", "Import", "Copy", "Restore", "Upload", - "CopyStart", "ImportSecure", "UploadPreparedSecure", "CopyFromSanSnapshot", and "Import". - :paramtype create_option: str or ~azure.mgmt.compute.models.DiskCreateOption - :keyword storage_account_id: Required if createOption is Import. The Azure Resource Manager - identifier of the storage account containing the blob to import as a disk. - :paramtype storage_account_id: str - :keyword image_reference: Disk source information for PIR or user images. - :paramtype image_reference: ~azure.mgmt.compute.models.ImageDiskReference - :keyword gallery_image_reference: Required if creating from a Gallery Image. The - id/sharedGalleryImageId/communityGalleryImageId of the ImageDiskReference will be the ARM id of - the shared galley image version from which to create a disk. - :paramtype gallery_image_reference: ~azure.mgmt.compute.models.ImageDiskReference - :keyword source_uri: If createOption is Import, this is the URI of a blob to be imported into a - managed disk. - :paramtype source_uri: str - :keyword source_resource_id: If createOption is Copy, this is the ARM id of the source snapshot - or disk. - :paramtype source_resource_id: str - :keyword upload_size_bytes: If createOption is Upload, this is the size of the contents of the - upload including the VHD footer. This value should be between 20972032 (20 MiB + 512 bytes for - the VHD footer) and 35183298347520 bytes (32 TiB + 512 bytes for the VHD footer). - :paramtype upload_size_bytes: int - :keyword logical_sector_size: Logical sector size in bytes for Ultra disks. Supported values - are 512 ad 4096. 4096 is the default. - :paramtype logical_sector_size: int - :keyword security_data_uri: If createOption is ImportSecure, this is the URI of a blob to be - imported into VM guest state. - :paramtype security_data_uri: str - :keyword security_metadata_uri: If createOption is ImportSecure, this is the URI of a blob to - be imported into VM metadata for Confidential VM. - :paramtype security_metadata_uri: str - :keyword performance_plus: Set this flag to true to get a boost on the performance target of - the disk deployed, see here on the respective performance target. This flag can only be set on - disk creation time and cannot be disabled after enabled. - :paramtype performance_plus: bool - :keyword elastic_san_resource_id: Required if createOption is CopyFromSanSnapshot. This is the - ARM id of the source elastic san volume snapshot. - :paramtype elastic_san_resource_id: str - :keyword provisioned_bandwidth_copy_speed: If this field is set on a snapshot and createOption - is CopyStart, the snapshot will be copied at a quicker speed. Known values are: "None" and - "Enhanced". - :paramtype provisioned_bandwidth_copy_speed: str or - ~azure.mgmt.compute.models.ProvisionedBandwidthCopyOption - :keyword instant_access_duration_minutes: For snapshots created from Premium SSD v2 or Ultra - disk, this property determines the time in minutes the snapshot is retained for instant access - to enable faster restore. - :paramtype instant_access_duration_minutes: int - """ - super().__init__(**kwargs) - self.create_option = create_option - self.storage_account_id = storage_account_id - self.image_reference = image_reference - self.gallery_image_reference = gallery_image_reference - self.source_uri = source_uri - self.source_resource_id = source_resource_id - self.source_unique_id: Optional[str] = None - self.upload_size_bytes = upload_size_bytes - self.logical_sector_size = logical_sector_size - self.security_data_uri = security_data_uri - self.security_metadata_uri = security_metadata_uri - self.performance_plus = performance_plus - self.elastic_san_resource_id = elastic_san_resource_id - self.provisioned_bandwidth_copy_speed = provisioned_bandwidth_copy_speed - self.instant_access_duration_minutes = instant_access_duration_minutes - - -class DataDisk(_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 server. - - :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. - Required. - :vartype lun: int - :ivar name: The disk name. - :vartype name: str - :ivar vhd: The virtual hard disk. - :vartype vhd: ~azure.mgmt.compute.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.models.VirtualHardDisk - :ivar caching: Specifies the caching requirements. Possible values are: **None,** **ReadOnly,** - **ReadWrite.** The defaulting behavior is: **None for Standard storage. ReadOnly for Premium - storage.**. Known values are: "None", "ReadOnly", and "ReadWrite". - :vartype caching: str or ~azure.mgmt.compute.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: Specifies how the virtual machine disk should be created. Possible values - are **Attach:** This value is used when you are using a specialized disk to create the virtual - machine. **FromImage:** This value is used when you are using an image to create the virtual - machine data disk. If you are using a platform image, you should also use the imageReference - element described above. If you are using a marketplace image, you should also use the plan - element previously described. **Empty:** This value is used when creating an empty data disk. - **Copy:** This value is used to create a data disk from a snapshot or another disk. - **Restore:** This value is used to create a data disk from a disk restore point. Required. - Known values are: "FromImage", "Empty", "Attach", "Copy", and "Restore". - :vartype create_option: str or ~azure.mgmt.compute.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. The property 'diskSizeGB' is - the number of bytes x 1024^3 for the disk and the value cannot be larger than 1023. - :vartype disk_size_gb: int - :ivar managed_disk: The managed disk parameters. - :vartype managed_disk: ~azure.mgmt.compute.models.ManagedDiskParameters - :ivar source_resource: The source resource identifier. It can be a snapshot, or disk restore - point from which to create a disk. - :vartype source_resource: ~azure.mgmt.compute.models.ApiEntityReference - :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: int - :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: int - :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.** 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. **This feature is still in preview**. To force-detach a data disk - update toBeDetached to 'true' along with setting detachOption: 'ForceDetach'. "ForceDetach" - :vartype detach_option: str or ~azure.mgmt.compute.models.DiskDetachOptionTypes - :ivar delete_option: Specifies whether data disk should be deleted or detached upon VM - deletion. Possible values are: **Delete.** If this value is used, the data disk is deleted when - VM is deleted. **Detach.** If this value is used, the data disk is retained after VM is - deleted. The default value is set to **Detach**. Known values are: "Delete" and "Detach". - :vartype delete_option: str or ~azure.mgmt.compute.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"}, - "source_resource": {"key": "sourceResource", "type": "ApiEntityReference"}, - "to_be_detached": {"key": "toBeDetached", "type": "bool"}, - "disk_iops_read_write": {"key": "diskIOPSReadWrite", "type": "int"}, - "disk_m_bps_read_write": {"key": "diskMBpsReadWrite", "type": "int"}, - "detach_option": {"key": "detachOption", "type": "str"}, - "delete_option": {"key": "deleteOption", "type": "str"}, - } - - def __init__( - self, - *, - lun: int, - create_option: Union[str, "_models.DiskCreateOptionTypes"], - name: Optional[str] = None, - vhd: Optional["_models.VirtualHardDisk"] = None, - image: Optional["_models.VirtualHardDisk"] = None, - caching: Optional[Union[str, "_models.CachingTypes"]] = None, - write_accelerator_enabled: Optional[bool] = None, - disk_size_gb: Optional[int] = None, - managed_disk: Optional["_models.ManagedDiskParameters"] = None, - source_resource: Optional["_models.ApiEntityReference"] = None, - to_be_detached: Optional[bool] = None, - detach_option: Optional[Union[str, "_models.DiskDetachOptionTypes"]] = None, - delete_option: Optional[Union[str, "_models.DiskDeleteOptionTypes"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword 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. Required. - :paramtype lun: int - :keyword name: The disk name. - :paramtype name: str - :keyword vhd: The virtual hard disk. - :paramtype vhd: ~azure.mgmt.compute.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.models.VirtualHardDisk - :keyword caching: Specifies the caching requirements. Possible values are: **None,** - **ReadOnly,** **ReadWrite.** The defaulting behavior is: **None for Standard storage. ReadOnly - for Premium storage.**. Known values are: "None", "ReadOnly", and "ReadWrite". - :paramtype caching: str or ~azure.mgmt.compute.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: Specifies how the virtual machine disk should be created. Possible - values are **Attach:** This value is used when you are using a specialized disk to create the - virtual machine. **FromImage:** This value is used when you are using an image to create the - virtual machine data disk. If you are using a platform image, you should also use the - imageReference element described above. If you are using a marketplace image, you should also - use the plan element previously described. **Empty:** This value is used when creating an empty - data disk. **Copy:** This value is used to create a data disk from a snapshot or another disk. - **Restore:** This value is used to create a data disk from a disk restore point. Required. - Known values are: "FromImage", "Empty", "Attach", "Copy", and "Restore". - :paramtype create_option: str or ~azure.mgmt.compute.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. The property 'diskSizeGB' - is the number of bytes x 1024^3 for the disk and the value cannot be larger than 1023. - :paramtype disk_size_gb: int - :keyword managed_disk: The managed disk parameters. - :paramtype managed_disk: ~azure.mgmt.compute.models.ManagedDiskParameters - :keyword source_resource: The source resource identifier. It can be a snapshot, or disk restore - point from which to create a disk. - :paramtype source_resource: ~azure.mgmt.compute.models.ApiEntityReference - :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.** 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. **This feature is still in preview**. To force-detach a data disk - update toBeDetached to 'true' along with setting detachOption: 'ForceDetach'. "ForceDetach" - :paramtype detach_option: str or ~azure.mgmt.compute.models.DiskDetachOptionTypes - :keyword delete_option: Specifies whether data disk should be deleted or detached upon VM - deletion. Possible values are: **Delete.** If this value is used, the data disk is deleted when - VM is deleted. **Detach.** If this value is used, the data disk is retained after VM is - deleted. The default value is set to **Detach**. Known values are: "Delete" and "Detach". - :paramtype delete_option: str or ~azure.mgmt.compute.models.DiskDeleteOptionTypes - """ - super().__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.source_resource = source_resource - self.to_be_detached = to_be_detached - self.disk_iops_read_write: Optional[int] = None - self.disk_m_bps_read_write: Optional[int] = None - self.detach_option = detach_option - self.delete_option = delete_option - - -class DataDiskImage(_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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.lun: Optional[int] = None - - -class DiskImageEncryption(_serialization.Model): - """This is the disk image encryption base class. - - :ivar disk_encryption_set_id: A relative URI containing the resource ID of the disk encryption - set. - :vartype disk_encryption_set_id: str - """ - - _attribute_map = { - "disk_encryption_set_id": {"key": "diskEncryptionSetId", "type": "str"}, - } - - def __init__(self, *, disk_encryption_set_id: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword disk_encryption_set_id: A relative URI containing the resource ID of the disk - encryption set. - :paramtype disk_encryption_set_id: str - """ - super().__init__(**kwargs) - self.disk_encryption_set_id = disk_encryption_set_id - - -class DataDiskImageEncryption(DiskImageEncryption): - """Contains encryption settings for a data disk image. - - All required parameters must be populated in order to send to server. - - :ivar disk_encryption_set_id: A relative URI containing the resource ID of the disk encryption - set. - :vartype disk_encryption_set_id: str - :ivar lun: This property specifies the logical unit number of the data disk. This value is used - to identify data disks within the Virtual Machine and therefore must be unique for each data - disk attached to the Virtual Machine. Required. - :vartype lun: int - """ - - _validation = { - "lun": {"required": True}, - } - - _attribute_map = { - "disk_encryption_set_id": {"key": "diskEncryptionSetId", "type": "str"}, - "lun": {"key": "lun", "type": "int"}, - } - - def __init__(self, *, lun: int, disk_encryption_set_id: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword disk_encryption_set_id: A relative URI containing the resource ID of the disk - encryption set. - :paramtype disk_encryption_set_id: str - :keyword lun: This property specifies the logical unit number of the data disk. This value is - used to identify data disks within the Virtual Machine and therefore must be unique for each - data disk attached to the Virtual Machine. Required. - :paramtype lun: int - """ - super().__init__(disk_encryption_set_id=disk_encryption_set_id, **kwargs) - self.lun = lun - - -class DataDisksToAttach(_serialization.Model): - """Describes the data disk to be attached. - - All required parameters must be populated in order to send to server. - - :ivar disk_id: ID of the managed data disk. Required. - :vartype disk_id: str - :ivar lun: 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. If not - specified, lun would be auto assigned. - :vartype lun: int - :ivar caching: Specifies the caching requirements. Possible values are: **None,** **ReadOnly,** - **ReadWrite.** The defaulting behavior is: **None for Standard storage. ReadOnly for Premium - storage.**. Known values are: "None", "ReadOnly", and "ReadWrite". - :vartype caching: str or ~azure.mgmt.compute.models.CachingTypes - :ivar delete_option: Specifies whether data disk should be deleted or detached upon VM - deletion. Possible values are: **Delete.** If this value is used, the data disk is deleted when - VM is deleted. **Detach.** If this value is used, the data disk is retained after VM is - deleted. The default value is set to **Detach**. Known values are: "Delete" and "Detach". - :vartype delete_option: str or ~azure.mgmt.compute.models.DiskDeleteOptionTypes - :ivar disk_encryption_set: Specifies the customer managed disk encryption set resource id for - the managed disk. - :vartype disk_encryption_set: ~azure.mgmt.compute.models.DiskEncryptionSetParameters - :ivar write_accelerator_enabled: Specifies whether writeAccelerator should be enabled or - disabled on the disk. - :vartype write_accelerator_enabled: bool - """ - - _validation = { - "disk_id": {"required": True}, - } - - _attribute_map = { - "disk_id": {"key": "diskId", "type": "str"}, - "lun": {"key": "lun", "type": "int"}, - "caching": {"key": "caching", "type": "str"}, - "delete_option": {"key": "deleteOption", "type": "str"}, - "disk_encryption_set": {"key": "diskEncryptionSet", "type": "DiskEncryptionSetParameters"}, - "write_accelerator_enabled": {"key": "writeAcceleratorEnabled", "type": "bool"}, - } - - def __init__( - self, - *, - disk_id: str, - lun: Optional[int] = None, - caching: Optional[Union[str, "_models.CachingTypes"]] = None, - delete_option: Optional[Union[str, "_models.DiskDeleteOptionTypes"]] = None, - disk_encryption_set: Optional["_models.DiskEncryptionSetParameters"] = None, - write_accelerator_enabled: Optional[bool] = None, - **kwargs: Any - ) -> None: - """ - :keyword disk_id: ID of the managed data disk. Required. - :paramtype disk_id: str - :keyword lun: 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. If not - specified, lun would be auto assigned. - :paramtype lun: int - :keyword caching: Specifies the caching requirements. Possible values are: **None,** - **ReadOnly,** **ReadWrite.** The defaulting behavior is: **None for Standard storage. ReadOnly - for Premium storage.**. Known values are: "None", "ReadOnly", and "ReadWrite". - :paramtype caching: str or ~azure.mgmt.compute.models.CachingTypes - :keyword delete_option: Specifies whether data disk should be deleted or detached upon VM - deletion. Possible values are: **Delete.** If this value is used, the data disk is deleted when - VM is deleted. **Detach.** If this value is used, the data disk is retained after VM is - deleted. The default value is set to **Detach**. Known values are: "Delete" and "Detach". - :paramtype delete_option: str or ~azure.mgmt.compute.models.DiskDeleteOptionTypes - :keyword disk_encryption_set: Specifies the customer managed disk encryption set resource id - for the managed disk. - :paramtype disk_encryption_set: ~azure.mgmt.compute.models.DiskEncryptionSetParameters - :keyword write_accelerator_enabled: Specifies whether writeAccelerator should be enabled or - disabled on the disk. - :paramtype write_accelerator_enabled: bool - """ - super().__init__(**kwargs) - self.disk_id = disk_id - self.lun = lun - self.caching = caching - self.delete_option = delete_option - self.disk_encryption_set = disk_encryption_set - self.write_accelerator_enabled = write_accelerator_enabled - - -class DataDisksToDetach(_serialization.Model): - """Describes the data disk to be detached. - - All required parameters must be populated in order to send to server. - - :ivar disk_id: ID of the managed data disk. Required. - :vartype disk_id: str - :ivar detach_option: Supported options available for Detach of a disk from a VM. Refer to - DetachOption object reference for more details. "ForceDetach" - :vartype detach_option: str or ~azure.mgmt.compute.models.DiskDetachOptionTypes - """ - - _validation = { - "disk_id": {"required": True}, - } - - _attribute_map = { - "disk_id": {"key": "diskId", "type": "str"}, - "detach_option": {"key": "detachOption", "type": "str"}, - } - - def __init__( - self, - *, - disk_id: str, - detach_option: Optional[Union[str, "_models.DiskDetachOptionTypes"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword disk_id: ID of the managed data disk. Required. - :paramtype disk_id: str - :keyword detach_option: Supported options available for Detach of a disk from a VM. Refer to - DetachOption object reference for more details. "ForceDetach" - :paramtype detach_option: str or ~azure.mgmt.compute.models.DiskDetachOptionTypes - """ - super().__init__(**kwargs) - self.disk_id = disk_id - self.detach_option = detach_option - - -class DedicatedHost(TrackedResource): - """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 server. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.compute.models.SystemData - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - :ivar location: The geo-location where the resource lives. Required. - :vartype location: str - :ivar sku: 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. Required. - :vartype sku: ~azure.mgmt.compute.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. 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.models.SubResourceReadOnly] - :ivar license_type: Specifies the software license type that will be applied to the VMs - deployed on the dedicated host. Possible values are: **None,** **Windows_Server_Hybrid,** - **Windows_Server_Perpetual.** The default value is: **None.**. Known values are: "None", - "Windows_Server_Hybrid", and "Windows_Server_Perpetual". - :vartype license_type: str or ~azure.mgmt.compute.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.models.DedicatedHostInstanceView - :ivar time_created: Specifies the time at which the Dedicated Host resource was created. - Minimum api-version: 2021-11-01. - :vartype time_created: ~datetime.datetime - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, - "location": {"required": True}, - "sku": {"required": True}, - "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"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - "tags": {"key": "tags", "type": "{str}"}, - "location": {"key": "location", "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: "_models.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, "_models.DedicatedHostLicenseTypes"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - :keyword location: The geo-location where the resource lives. Required. - :paramtype location: str - :keyword sku: 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. Required. - :paramtype sku: ~azure.mgmt.compute.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. Possible values are: **None,** **Windows_Server_Hybrid,** - **Windows_Server_Perpetual.** The default value is: **None.**. Known values are: "None", - "Windows_Server_Hybrid", and "Windows_Server_Perpetual". - :paramtype license_type: str or ~azure.mgmt.compute.models.DedicatedHostLicenseTypes - """ - super().__init__(tags=tags, location=location, **kwargs) - self.sku = sku - self.platform_fault_domain = platform_fault_domain - self.auto_replace_on_failure = auto_replace_on_failure - self.host_id: Optional[str] = None - self.virtual_machines: Optional[list["_models.SubResourceReadOnly"]] = None - self.license_type = license_type - self.provisioning_time: Optional[datetime.datetime] = None - self.provisioning_state: Optional[str] = None - self.instance_view: Optional["_models.DedicatedHostInstanceView"] = None - self.time_created: Optional[datetime.datetime] = None - - -class DedicatedHostAllocatableVM(_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: Any) -> None: - """ - :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().__init__(**kwargs) - self.vm_size = vm_size - self.count = count - - -class DedicatedHostAvailableCapacity(_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.models.DedicatedHostAllocatableVM] - """ - - _attribute_map = { - "allocatable_v_ms": {"key": "allocatableVMs", "type": "[DedicatedHostAllocatableVM]"}, - } - - def __init__( - self, *, allocatable_v_ms: Optional[list["_models.DedicatedHostAllocatableVM"]] = None, **kwargs: Any - ) -> None: - """ - :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.models.DedicatedHostAllocatableVM] - """ - super().__init__(**kwargs) - self.allocatable_v_ms = allocatable_v_ms - - -class DedicatedHostGroup(TrackedResource): - """Specifies information about the dedicated host group that the dedicated hosts should be - assigned to. 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 server. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.compute.models.SystemData - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - :ivar location: The geo-location where the resource lives. Required. - :vartype location: str - :ivar zones: The availability zones. - :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.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.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. Minimum api-version: 2020-06-01. - :vartype support_automatic_placement: bool - :ivar additional_capabilities: Enables or disables a capability on the dedicated host group. - Minimum api-version: 2022-03-01. - :vartype additional_capabilities: - ~azure.mgmt.compute.models.DedicatedHostGroupPropertiesAdditionalCapabilities - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"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"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - "tags": {"key": "tags", "type": "{str}"}, - "location": {"key": "location", "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["_models.DedicatedHostGroupPropertiesAdditionalCapabilities"] = None, - **kwargs: Any - ) -> None: - """ - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - :keyword location: The geo-location where the resource lives. Required. - :paramtype location: str - :keyword zones: The availability zones. - :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. Minimum api-version: 2020-06-01. - :paramtype support_automatic_placement: bool - :keyword additional_capabilities: Enables or disables a capability on the dedicated host group. - Minimum api-version: 2022-03-01. - :paramtype additional_capabilities: - ~azure.mgmt.compute.models.DedicatedHostGroupPropertiesAdditionalCapabilities - """ - super().__init__(tags=tags, location=location, **kwargs) - self.zones = zones - self.platform_fault_domain_count = platform_fault_domain_count - self.hosts: Optional[list["_models.SubResourceReadOnly"]] = None - self.instance_view: Optional["_models.DedicatedHostGroupInstanceView"] = None - self.support_automatic_placement = support_automatic_placement - self.additional_capabilities = additional_capabilities - - -class DedicatedHostGroupInstanceView(_serialization.Model): - """DedicatedHostGroupInstanceView. - - :ivar hosts: List of instance view of the dedicated hosts under the dedicated host group. - :vartype hosts: list[~azure.mgmt.compute.models.DedicatedHostInstanceViewWithName] - """ - - _attribute_map = { - "hosts": {"key": "hosts", "type": "[DedicatedHostInstanceViewWithName]"}, - } - - def __init__( - self, *, hosts: Optional[list["_models.DedicatedHostInstanceViewWithName"]] = None, **kwargs: Any - ) -> None: - """ - :keyword hosts: List of instance view of the dedicated hosts under the dedicated host group. - :paramtype hosts: list[~azure.mgmt.compute.models.DedicatedHostInstanceViewWithName] - """ - super().__init__(**kwargs) - self.hosts = hosts - - -class DedicatedHostGroupListResult(_serialization.Model): - """The List Dedicated Host Group with resource group response. - - All required parameters must be populated in order to send to server. - - :ivar value: The list of dedicated host groups. Required. - :vartype value: list[~azure.mgmt.compute.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["_models.DedicatedHostGroup"], next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: The list of dedicated host groups. Required. - :paramtype value: list[~azure.mgmt.compute.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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class DedicatedHostGroupPropertiesAdditionalCapabilities(_serialization.Model): # pylint: disable=name-too-long - """Enables or disables a capability on the dedicated host group. 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. **Note:** The ultraSSDEnabled setting can only be enabled for Host Groups - that are created as zonal. 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: Any) -> None: - """ - :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. **Note:** The ultraSSDEnabled setting can only be enabled for Host Groups - that are created as zonal. Minimum api-version: 2022-03-01. - :paramtype ultra_ssd_enabled: bool - """ - super().__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: 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.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.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. Minimum api-version: 2020-06-01. - :vartype support_automatic_placement: bool - :ivar additional_capabilities: Enables or disables a capability on the dedicated host group. - Minimum api-version: 2022-03-01. - :vartype additional_capabilities: - ~azure.mgmt.compute.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["_models.DedicatedHostGroupPropertiesAdditionalCapabilities"] = None, - **kwargs: Any - ) -> None: - """ - :keyword 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. Minimum api-version: 2020-06-01. - :paramtype support_automatic_placement: bool - :keyword additional_capabilities: Enables or disables a capability on the dedicated host group. - Minimum api-version: 2022-03-01. - :paramtype additional_capabilities: - ~azure.mgmt.compute.models.DedicatedHostGroupPropertiesAdditionalCapabilities - """ - super().__init__(tags=tags, **kwargs) - self.zones = zones - self.platform_fault_domain_count = platform_fault_domain_count - self.hosts: Optional[list["_models.SubResourceReadOnly"]] = None - self.instance_view: Optional["_models.DedicatedHostGroupInstanceView"] = None - self.support_automatic_placement = support_automatic_placement - self.additional_capabilities = additional_capabilities - - -class DedicatedHostInstanceView(_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.models.DedicatedHostAvailableCapacity - :ivar statuses: The resource status information. - :vartype statuses: list[~azure.mgmt.compute.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["_models.DedicatedHostAvailableCapacity"] = None, - statuses: Optional[list["_models.InstanceViewStatus"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword available_capacity: Unutilized capacity of the dedicated host. - :paramtype available_capacity: ~azure.mgmt.compute.models.DedicatedHostAvailableCapacity - :keyword statuses: The resource status information. - :paramtype statuses: list[~azure.mgmt.compute.models.InstanceViewStatus] - """ - super().__init__(**kwargs) - self.asset_id: Optional[str] = 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.models.DedicatedHostAvailableCapacity - :ivar statuses: The resource status information. - :vartype statuses: list[~azure.mgmt.compute.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["_models.DedicatedHostAvailableCapacity"] = None, - statuses: Optional[list["_models.InstanceViewStatus"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword available_capacity: Unutilized capacity of the dedicated host. - :paramtype available_capacity: ~azure.mgmt.compute.models.DedicatedHostAvailableCapacity - :keyword statuses: The resource status information. - :paramtype statuses: list[~azure.mgmt.compute.models.InstanceViewStatus] - """ - super().__init__(available_capacity=available_capacity, statuses=statuses, **kwargs) - self.name: Optional[str] = None - - -class DedicatedHostListResult(_serialization.Model): - """The list dedicated host operation response. - - All required parameters must be populated in order to send to server. - - :ivar value: The list of dedicated hosts. Required. - :vartype value: list[~azure.mgmt.compute.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["_models.DedicatedHost"], next_link: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword value: The list of dedicated hosts. Required. - :paramtype value: list[~azure.mgmt.compute.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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class DedicatedHostSizeListResult(_serialization.Model): - """The List Dedicated Host sizes operation response. - - :ivar value: The list of dedicated host sizes. - :vartype value: list[str] - :ivar next_link: The link to the next page of items. - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[str]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__(self, *, value: Optional[list[str]] = None, next_link: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword value: The list of dedicated host sizes. - :paramtype value: list[str] - :keyword next_link: The link to the next page of items. - :paramtype next_link: str - """ - super().__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: Resource tags. - :vartype tags: dict[str, str] - :ivar sku: [List all available dedicated host sizes for resizing] - (https://docs.microsoft.com/rest/api/compute/dedicated-hosts/listavailablesizes). Resizing can - be only used to scale up DedicatedHost. Only name is required to be set. - :vartype sku: ~azure.mgmt.compute.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. 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.models.SubResourceReadOnly] - :ivar license_type: Specifies the software license type that will be applied to the VMs - deployed on the dedicated host. Possible values are: **None,** **Windows_Server_Hybrid,** - **Windows_Server_Perpetual.** The default value is: **None.**. Known values are: "None", - "Windows_Server_Hybrid", and "Windows_Server_Perpetual". - :vartype license_type: str or ~azure.mgmt.compute.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.models.DedicatedHostInstanceView - :ivar time_created: Specifies the time at which the Dedicated Host resource was created. - Minimum api-version: 2021-11-01. - :vartype time_created: ~datetime.datetime - """ - - _validation = { - "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}"}, - "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, - *, - tags: Optional[dict[str, str]] = None, - sku: Optional["_models.Sku"] = None, - platform_fault_domain: Optional[int] = None, - auto_replace_on_failure: Optional[bool] = None, - license_type: Optional[Union[str, "_models.DedicatedHostLicenseTypes"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - :keyword sku: [List all available dedicated host sizes for resizing] - (https://docs.microsoft.com/rest/api/compute/dedicated-hosts/listavailablesizes). Resizing can - be only used to scale up DedicatedHost. Only name is required to be set. - :paramtype sku: ~azure.mgmt.compute.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. Possible values are: **None,** **Windows_Server_Hybrid,** - **Windows_Server_Perpetual.** The default value is: **None.**. Known values are: "None", - "Windows_Server_Hybrid", and "Windows_Server_Perpetual". - :paramtype license_type: str or ~azure.mgmt.compute.models.DedicatedHostLicenseTypes - """ - super().__init__(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: Optional[str] = None - self.virtual_machines: Optional[list["_models.SubResourceReadOnly"]] = None - self.license_type = license_type - self.provisioning_time: Optional[datetime.datetime] = None - self.provisioning_state: Optional[str] = None - self.instance_view: Optional["_models.DedicatedHostInstanceView"] = None - self.time_created: Optional[datetime.datetime] = None - - -class DefaultVirtualMachineScaleSetInfo(_serialization.Model): - """Indicates the target Virtual Machine ScaleSet properties upon triggering a seamless migration - without downtime of the VMs via the ConvertToVirtualMachineScaleSet API. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar constrained_maximum_capacity: Indicates if the the maximum capacity of the default - migrated Virtual Machine Scale Set after its migration will be constrained to a limited number - of VMs. - :vartype constrained_maximum_capacity: bool - :ivar default_virtual_machine_scale_set: The default Virtual Machine ScaleSet Uri that the - Availability Set will be moved to upon triggering a seamless migration via the - ConvertToVirtualMachineScaleSet API. - :vartype default_virtual_machine_scale_set: ~azure.mgmt.compute.models.SubResource - """ - - _validation = { - "constrained_maximum_capacity": {"readonly": True}, - "default_virtual_machine_scale_set": {"readonly": True}, - } - - _attribute_map = { - "constrained_maximum_capacity": {"key": "constrainedMaximumCapacity", "type": "bool"}, - "default_virtual_machine_scale_set": {"key": "defaultVirtualMachineScaleSet", "type": "SubResource"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.constrained_maximum_capacity: Optional[bool] = None - self.default_virtual_machine_scale_set: Optional["_models.SubResource"] = None - - -class DiagnosticsProfile(_serialization.Model): - """Specifies the boot diagnostic settings state. 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. **NOTE**\\ : If storageUri is being - specified then ensure that the storage account is in the same region and subscription as the - VM. You can easily view the output of your console log. Azure also enables you to see a - screenshot of the VM from the hypervisor. - :vartype boot_diagnostics: ~azure.mgmt.compute.models.BootDiagnostics - """ - - _attribute_map = { - "boot_diagnostics": {"key": "bootDiagnostics", "type": "BootDiagnostics"}, - } - - def __init__(self, *, boot_diagnostics: Optional["_models.BootDiagnostics"] = None, **kwargs: Any) -> None: - """ - :keyword boot_diagnostics: Boot Diagnostics is a debugging feature which allows you to view - Console Output and Screenshot to diagnose VM status. **NOTE**\\ : If storageUri is being - specified then ensure that the storage account is in the same region and subscription as the - VM. You can easily view the output of your console log. Azure also enables you to see a - screenshot of the VM from the hypervisor. - :paramtype boot_diagnostics: ~azure.mgmt.compute.models.BootDiagnostics - """ - super().__init__(**kwargs) - self.boot_diagnostics = boot_diagnostics - - -class DiffDiskSettings(_serialization.Model): - """Describes the parameters of ephemeral disk settings that can be specified for operating system - disk. **Note:** The ephemeral disk settings can only be specified for managed disk. - - :ivar option: Specifies the ephemeral disk settings for operating system disk. "Local" - :vartype option: str or ~azure.mgmt.compute.models.DiffDiskOptions - :ivar placement: Specifies the ephemeral disk placement for operating system disk. Possible - values are: **CacheDisk,** **ResourceDisk,** **NvmeDisk.** The defaulting behavior is: - **CacheDisk** if one is configured for the VM size otherwise **ResourceDisk** or **NvmeDisk** - is used. Refer to the 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. Minimum api-version for NvmeDisk: 2024-03-01. Known values are: "CacheDisk", - "ResourceDisk", and "NvmeDisk". - :vartype placement: str or ~azure.mgmt.compute.models.DiffDiskPlacement - """ - - _attribute_map = { - "option": {"key": "option", "type": "str"}, - "placement": {"key": "placement", "type": "str"}, - } - - def __init__( - self, - *, - option: Optional[Union[str, "_models.DiffDiskOptions"]] = None, - placement: Optional[Union[str, "_models.DiffDiskPlacement"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword option: Specifies the ephemeral disk settings for operating system disk. "Local" - :paramtype option: str or ~azure.mgmt.compute.models.DiffDiskOptions - :keyword placement: Specifies the ephemeral disk placement for operating system disk. Possible - values are: **CacheDisk,** **ResourceDisk,** **NvmeDisk.** The defaulting behavior is: - **CacheDisk** if one is configured for the VM size otherwise **ResourceDisk** or **NvmeDisk** - is used. Refer to the 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. Minimum api-version for NvmeDisk: 2024-03-01. Known values are: "CacheDisk", - "ResourceDisk", and "NvmeDisk". - :paramtype placement: str or ~azure.mgmt.compute.models.DiffDiskPlacement - """ - super().__init__(**kwargs) - self.option = option - self.placement = placement - - -class Disallowed(_serialization.Model): - """Describes the disallowed disk types. - - :ivar disk_types: A list of disk types. - :vartype disk_types: list[str] - """ - - _attribute_map = { - "disk_types": {"key": "diskTypes", "type": "[str]"}, - } - - def __init__(self, *, disk_types: Optional[list[str]] = None, **kwargs: Any) -> None: - """ - :keyword disk_types: A list of disk types. - :paramtype disk_types: list[str] - """ - super().__init__(**kwargs) - self.disk_types = disk_types - - -class DisallowedConfiguration(_serialization.Model): - """Specifies the disallowed configuration for a virtual machine image. - - :ivar vm_disk_type: VM disk types which are disallowed. Known values are: "None" and - "Unmanaged". - :vartype vm_disk_type: str or ~azure.mgmt.compute.models.VmDiskTypes - """ - - _attribute_map = { - "vm_disk_type": {"key": "vmDiskType", "type": "str"}, - } - - def __init__(self, *, vm_disk_type: Optional[Union[str, "_models.VmDiskTypes"]] = None, **kwargs: Any) -> None: - """ - :keyword vm_disk_type: VM disk types which are disallowed. Known values are: "None" and - "Unmanaged". - :paramtype vm_disk_type: str or ~azure.mgmt.compute.models.VmDiskTypes - """ - super().__init__(**kwargs) - self.vm_disk_type = vm_disk_type - - -class Disk(TrackedResource): - """Disk resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to server. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.compute.models.SystemData - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - :ivar location: The geo-location where the resource lives. Required. - :vartype location: str - :ivar managed_by: A relative URI containing the ID of the VM that has the disk attached. - :vartype managed_by: str - :ivar managed_by_extended: List of relative URIs containing the IDs of the VMs that have the - disk attached. maxShares should be set to a value greater than one for disks to allow attaching - them to multiple VMs. - :vartype managed_by_extended: list[str] - :ivar sku: The disks sku name. Can be Standard_LRS, Premium_LRS, StandardSSD_LRS, UltraSSD_LRS, - Premium_ZRS, StandardSSD_ZRS, or PremiumV2_LRS. - :vartype sku: ~azure.mgmt.compute.models.DiskSku - :ivar zones: The Logical zone list for Disk. - :vartype zones: list[str] - :ivar extended_location: The extended location where the disk will be created. Extended - location cannot be changed. - :vartype extended_location: ~azure.mgmt.compute.models.ExtendedLocation - :ivar time_created: The time when the disk was created. - :vartype time_created: ~datetime.datetime - :ivar os_type: The Operating System type. Known values are: "Windows" and "Linux". - :vartype os_type: str or ~azure.mgmt.compute.models.OperatingSystemTypes - :ivar hyper_v_generation: The hypervisor generation of the Virtual Machine. Applicable to OS - disks only. Known values are: "V1" and "V2". - :vartype hyper_v_generation: str or ~azure.mgmt.compute.models.HyperVGeneration - :ivar purchase_plan: Purchase plan information for the the image from which the OS disk was - created. E.g. - {name: 2019-Datacenter, publisher: MicrosoftWindowsServer, product: - WindowsServer}. - :vartype purchase_plan: ~azure.mgmt.compute.models.DiskPurchasePlan - :ivar supported_capabilities: List of supported capabilities for the image from which the OS - disk was created. - :vartype supported_capabilities: ~azure.mgmt.compute.models.SupportedCapabilities - :ivar creation_data: Disk source information. CreationData information cannot be changed after - the disk has been created. - :vartype creation_data: ~azure.mgmt.compute.models.CreationData - :ivar disk_size_gb: If creationData.createOption is Empty, this field is mandatory and it - indicates the size of the disk to create. If this field is present for updates or creation with - other options, it indicates a resize. Resizes are only allowed if the disk is not attached to a - running VM, and can only increase the disk's size. - :vartype disk_size_gb: int - :ivar disk_size_bytes: The size of the disk in bytes. This field is read only. - :vartype disk_size_bytes: int - :ivar unique_id: Unique Guid identifying the resource. - :vartype unique_id: str - :ivar encryption_settings_collection: Encryption settings collection used for Azure Disk - Encryption, can contain multiple encryption settings per disk or snapshot. - :vartype encryption_settings_collection: - ~azure.mgmt.compute.models.EncryptionSettingsCollection - :ivar provisioning_state: The disk provisioning state. - :vartype provisioning_state: str - :ivar disk_iops_read_write: The number of IOPS allowed for this disk; only settable for - UltraSSD disks. One operation can transfer between 4k and 256k bytes. - :vartype disk_iops_read_write: int - :ivar disk_m_bps_read_write: The bandwidth allowed for this disk; only settable for UltraSSD - disks. MBps means millions of bytes per second - MB here uses the ISO notation, of powers of - 10. - :vartype disk_m_bps_read_write: int - :ivar disk_iops_read_only: The total number of IOPS that will be allowed across all VMs - mounting the shared disk as ReadOnly. One operation can transfer between 4k and 256k bytes. - :vartype disk_iops_read_only: int - :ivar disk_m_bps_read_only: The total throughput (MBps) that will be allowed across all VMs - mounting the shared disk as ReadOnly. MBps means millions of bytes per second - MB here uses - the ISO notation, of powers of 10. - :vartype disk_m_bps_read_only: int - :ivar disk_state: The state of the disk. Known values are: "Unattached", "Attached", - "Reserved", "Frozen", "ActiveSAS", "ActiveSASFrozen", "ReadyToUpload", and "ActiveUpload". - :vartype disk_state: str or ~azure.mgmt.compute.models.DiskState - :ivar encryption: Encryption property can be used to encrypt data at rest with customer managed - keys or platform managed keys. - :vartype encryption: ~azure.mgmt.compute.models.Encryption - :ivar max_shares: The maximum number of VMs that can attach to the disk at the same time. Value - greater than one indicates a disk that can be mounted on multiple VMs at the same time. - :vartype max_shares: int - :ivar share_info: Details of the list of all VMs that have the disk attached. maxShares should - be set to a value greater than one for disks to allow attaching them to multiple VMs. - :vartype share_info: list[~azure.mgmt.compute.models.ShareInfoElement] - :ivar network_access_policy: Policy for accessing the disk via network. Known values are: - "AllowAll", "AllowPrivate", and "DenyAll". - :vartype network_access_policy: str or ~azure.mgmt.compute.models.NetworkAccessPolicy - :ivar disk_access_id: ARM id of the DiskAccess resource for using private endpoints on disks. - :vartype disk_access_id: str - :ivar bursting_enabled_time: Latest time when bursting was last enabled on a disk. - :vartype bursting_enabled_time: ~datetime.datetime - :ivar tier: Performance tier of the disk (e.g, P4, S10) as described here: - https://azure.microsoft.com/en-us/pricing/details/managed-disks/. Does not apply to Ultra - disks. - :vartype tier: str - :ivar bursting_enabled: Set to true to enable bursting beyond the provisioned performance - target of the disk. Bursting is disabled by default. Does not apply to Ultra disks. - :vartype bursting_enabled: bool - :ivar property_updates_in_progress: Properties of the disk for which update is pending. - :vartype property_updates_in_progress: ~azure.mgmt.compute.models.PropertyUpdatesInProgress - :ivar supports_hibernation: Indicates the OS on a disk supports hibernation. - :vartype supports_hibernation: bool - :ivar security_profile: Contains the security related information for the resource. - :vartype security_profile: ~azure.mgmt.compute.models.DiskSecurityProfile - :ivar completion_percent: Percentage complete for the background copy when a resource is - created via the CopyStart operation. - :vartype completion_percent: float - :ivar public_network_access: Policy for controlling export on the disk. Known values are: - "Enabled" and "Disabled". - :vartype public_network_access: str or ~azure.mgmt.compute.models.PublicNetworkAccess - :ivar data_access_auth_mode: Additional authentication requirements when exporting or uploading - to a disk or snapshot. Known values are: "AzureActiveDirectory" and "None". - :vartype data_access_auth_mode: str or ~azure.mgmt.compute.models.DataAccessAuthMode - :ivar optimized_for_frequent_attach: Setting this property to true improves reliability and - performance of data disks that are frequently (more than 5 times a day) by detached from one - virtual machine and attached to another. This property should not be set for disks that are not - detached and attached frequently as it causes the disks to not align with the fault domain of - the virtual machine. - :vartype optimized_for_frequent_attach: bool - :ivar last_ownership_update_time: The UTC time when the ownership state of the disk was last - changed i.e., the time the disk was last attached or detached from a VM or the time when the VM - to which the disk was attached was deallocated or started. - :vartype last_ownership_update_time: ~datetime.datetime - :ivar availability_policy: Determines how platform treats disk failures. - :vartype availability_policy: ~azure.mgmt.compute.models.AvailabilityPolicy - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, - "location": {"required": True}, - "managed_by": {"readonly": True}, - "managed_by_extended": {"readonly": True}, - "time_created": {"readonly": True}, - "disk_size_bytes": {"readonly": True}, - "unique_id": {"readonly": True}, - "provisioning_state": {"readonly": True}, - "disk_state": {"readonly": True}, - "share_info": {"readonly": True}, - "bursting_enabled_time": {"readonly": True}, - "property_updates_in_progress": {"readonly": True}, - "last_ownership_update_time": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - "tags": {"key": "tags", "type": "{str}"}, - "location": {"key": "location", "type": "str"}, - "managed_by": {"key": "managedBy", "type": "str"}, - "managed_by_extended": {"key": "managedByExtended", "type": "[str]"}, - "sku": {"key": "sku", "type": "DiskSku"}, - "zones": {"key": "zones", "type": "[str]"}, - "extended_location": {"key": "extendedLocation", "type": "ExtendedLocation"}, - "time_created": {"key": "properties.timeCreated", "type": "iso-8601"}, - "os_type": {"key": "properties.osType", "type": "str"}, - "hyper_v_generation": {"key": "properties.hyperVGeneration", "type": "str"}, - "purchase_plan": {"key": "properties.purchasePlan", "type": "DiskPurchasePlan"}, - "supported_capabilities": {"key": "properties.supportedCapabilities", "type": "SupportedCapabilities"}, - "creation_data": {"key": "properties.creationData", "type": "CreationData"}, - "disk_size_gb": {"key": "properties.diskSizeGB", "type": "int"}, - "disk_size_bytes": {"key": "properties.diskSizeBytes", "type": "int"}, - "unique_id": {"key": "properties.uniqueId", "type": "str"}, - "encryption_settings_collection": { - "key": "properties.encryptionSettingsCollection", - "type": "EncryptionSettingsCollection", - }, - "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, - "disk_iops_read_write": {"key": "properties.diskIOPSReadWrite", "type": "int"}, - "disk_m_bps_read_write": {"key": "properties.diskMBpsReadWrite", "type": "int"}, - "disk_iops_read_only": {"key": "properties.diskIOPSReadOnly", "type": "int"}, - "disk_m_bps_read_only": {"key": "properties.diskMBpsReadOnly", "type": "int"}, - "disk_state": {"key": "properties.diskState", "type": "str"}, - "encryption": {"key": "properties.encryption", "type": "Encryption"}, - "max_shares": {"key": "properties.maxShares", "type": "int"}, - "share_info": {"key": "properties.shareInfo", "type": "[ShareInfoElement]"}, - "network_access_policy": {"key": "properties.networkAccessPolicy", "type": "str"}, - "disk_access_id": {"key": "properties.diskAccessId", "type": "str"}, - "bursting_enabled_time": {"key": "properties.burstingEnabledTime", "type": "iso-8601"}, - "tier": {"key": "properties.tier", "type": "str"}, - "bursting_enabled": {"key": "properties.burstingEnabled", "type": "bool"}, - "property_updates_in_progress": { - "key": "properties.propertyUpdatesInProgress", - "type": "PropertyUpdatesInProgress", - }, - "supports_hibernation": {"key": "properties.supportsHibernation", "type": "bool"}, - "security_profile": {"key": "properties.securityProfile", "type": "DiskSecurityProfile"}, - "completion_percent": {"key": "properties.completionPercent", "type": "float"}, - "public_network_access": {"key": "properties.publicNetworkAccess", "type": "str"}, - "data_access_auth_mode": {"key": "properties.dataAccessAuthMode", "type": "str"}, - "optimized_for_frequent_attach": {"key": "properties.optimizedForFrequentAttach", "type": "bool"}, - "last_ownership_update_time": {"key": "properties.LastOwnershipUpdateTime", "type": "iso-8601"}, - "availability_policy": {"key": "properties.availabilityPolicy", "type": "AvailabilityPolicy"}, - } - - def __init__( # pylint: disable=too-many-locals - self, - *, - location: str, - tags: Optional[dict[str, str]] = None, - sku: Optional["_models.DiskSku"] = None, - zones: Optional[list[str]] = None, - extended_location: Optional["_models.ExtendedLocation"] = None, - os_type: Optional[Union[str, "_models.OperatingSystemTypes"]] = None, - hyper_v_generation: Optional[Union[str, "_models.HyperVGeneration"]] = None, - purchase_plan: Optional["_models.DiskPurchasePlan"] = None, - supported_capabilities: Optional["_models.SupportedCapabilities"] = None, - creation_data: Optional["_models.CreationData"] = None, - disk_size_gb: Optional[int] = None, - encryption_settings_collection: Optional["_models.EncryptionSettingsCollection"] = None, - disk_iops_read_write: Optional[int] = None, - disk_m_bps_read_write: Optional[int] = None, - disk_iops_read_only: Optional[int] = None, - disk_m_bps_read_only: Optional[int] = None, - encryption: Optional["_models.Encryption"] = None, - max_shares: Optional[int] = None, - network_access_policy: Optional[Union[str, "_models.NetworkAccessPolicy"]] = None, - disk_access_id: Optional[str] = None, - tier: Optional[str] = None, - bursting_enabled: Optional[bool] = None, - supports_hibernation: Optional[bool] = None, - security_profile: Optional["_models.DiskSecurityProfile"] = None, - completion_percent: Optional[float] = None, - public_network_access: Optional[Union[str, "_models.PublicNetworkAccess"]] = None, - data_access_auth_mode: Optional[Union[str, "_models.DataAccessAuthMode"]] = None, - optimized_for_frequent_attach: Optional[bool] = None, - availability_policy: Optional["_models.AvailabilityPolicy"] = None, - **kwargs: Any - ) -> None: - """ - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - :keyword location: The geo-location where the resource lives. Required. - :paramtype location: str - :keyword sku: The disks sku name. Can be Standard_LRS, Premium_LRS, StandardSSD_LRS, - UltraSSD_LRS, Premium_ZRS, StandardSSD_ZRS, or PremiumV2_LRS. - :paramtype sku: ~azure.mgmt.compute.models.DiskSku - :keyword zones: The Logical zone list for Disk. - :paramtype zones: list[str] - :keyword extended_location: The extended location where the disk will be created. Extended - location cannot be changed. - :paramtype extended_location: ~azure.mgmt.compute.models.ExtendedLocation - :keyword os_type: The Operating System type. Known values are: "Windows" and "Linux". - :paramtype os_type: str or ~azure.mgmt.compute.models.OperatingSystemTypes - :keyword hyper_v_generation: The hypervisor generation of the Virtual Machine. Applicable to OS - disks only. Known values are: "V1" and "V2". - :paramtype hyper_v_generation: str or ~azure.mgmt.compute.models.HyperVGeneration - :keyword purchase_plan: Purchase plan information for the the image from which the OS disk was - created. E.g. - {name: 2019-Datacenter, publisher: MicrosoftWindowsServer, product: - WindowsServer}. - :paramtype purchase_plan: ~azure.mgmt.compute.models.DiskPurchasePlan - :keyword supported_capabilities: List of supported capabilities for the image from which the OS - disk was created. - :paramtype supported_capabilities: ~azure.mgmt.compute.models.SupportedCapabilities - :keyword creation_data: Disk source information. CreationData information cannot be changed - after the disk has been created. - :paramtype creation_data: ~azure.mgmt.compute.models.CreationData - :keyword disk_size_gb: If creationData.createOption is Empty, this field is mandatory and it - indicates the size of the disk to create. If this field is present for updates or creation with - other options, it indicates a resize. Resizes are only allowed if the disk is not attached to a - running VM, and can only increase the disk's size. - :paramtype disk_size_gb: int - :keyword encryption_settings_collection: Encryption settings collection used for Azure Disk - Encryption, can contain multiple encryption settings per disk or snapshot. - :paramtype encryption_settings_collection: - ~azure.mgmt.compute.models.EncryptionSettingsCollection - :keyword disk_iops_read_write: The number of IOPS allowed for this disk; only settable for - UltraSSD disks. One operation can transfer between 4k and 256k bytes. - :paramtype disk_iops_read_write: int - :keyword disk_m_bps_read_write: The bandwidth allowed for this disk; only settable for UltraSSD - disks. MBps means millions of bytes per second - MB here uses the ISO notation, of powers of - 10. - :paramtype disk_m_bps_read_write: int - :keyword disk_iops_read_only: The total number of IOPS that will be allowed across all VMs - mounting the shared disk as ReadOnly. One operation can transfer between 4k and 256k bytes. - :paramtype disk_iops_read_only: int - :keyword disk_m_bps_read_only: The total throughput (MBps) that will be allowed across all VMs - mounting the shared disk as ReadOnly. MBps means millions of bytes per second - MB here uses - the ISO notation, of powers of 10. - :paramtype disk_m_bps_read_only: int - :keyword encryption: Encryption property can be used to encrypt data at rest with customer - managed keys or platform managed keys. - :paramtype encryption: ~azure.mgmt.compute.models.Encryption - :keyword max_shares: The maximum number of VMs that can attach to the disk at the same time. - Value greater than one indicates a disk that can be mounted on multiple VMs at the same time. - :paramtype max_shares: int - :keyword network_access_policy: Policy for accessing the disk via network. Known values are: - "AllowAll", "AllowPrivate", and "DenyAll". - :paramtype network_access_policy: str or ~azure.mgmt.compute.models.NetworkAccessPolicy - :keyword disk_access_id: ARM id of the DiskAccess resource for using private endpoints on - disks. - :paramtype disk_access_id: str - :keyword tier: Performance tier of the disk (e.g, P4, S10) as described here: - https://azure.microsoft.com/en-us/pricing/details/managed-disks/. Does not apply to Ultra - disks. - :paramtype tier: str - :keyword bursting_enabled: Set to true to enable bursting beyond the provisioned performance - target of the disk. Bursting is disabled by default. Does not apply to Ultra disks. - :paramtype bursting_enabled: bool - :keyword supports_hibernation: Indicates the OS on a disk supports hibernation. - :paramtype supports_hibernation: bool - :keyword security_profile: Contains the security related information for the resource. - :paramtype security_profile: ~azure.mgmt.compute.models.DiskSecurityProfile - :keyword completion_percent: Percentage complete for the background copy when a resource is - created via the CopyStart operation. - :paramtype completion_percent: float - :keyword public_network_access: Policy for controlling export on the disk. Known values are: - "Enabled" and "Disabled". - :paramtype public_network_access: str or ~azure.mgmt.compute.models.PublicNetworkAccess - :keyword data_access_auth_mode: Additional authentication requirements when exporting or - uploading to a disk or snapshot. Known values are: "AzureActiveDirectory" and "None". - :paramtype data_access_auth_mode: str or ~azure.mgmt.compute.models.DataAccessAuthMode - :keyword optimized_for_frequent_attach: Setting this property to true improves reliability and - performance of data disks that are frequently (more than 5 times a day) by detached from one - virtual machine and attached to another. This property should not be set for disks that are not - detached and attached frequently as it causes the disks to not align with the fault domain of - the virtual machine. - :paramtype optimized_for_frequent_attach: bool - :keyword availability_policy: Determines how platform treats disk failures. - :paramtype availability_policy: ~azure.mgmt.compute.models.AvailabilityPolicy - """ - super().__init__(tags=tags, location=location, **kwargs) - self.managed_by: Optional[str] = None - self.managed_by_extended: Optional[list[str]] = None - self.sku = sku - self.zones = zones - self.extended_location = extended_location - self.time_created: Optional[datetime.datetime] = None - self.os_type = os_type - self.hyper_v_generation = hyper_v_generation - self.purchase_plan = purchase_plan - self.supported_capabilities = supported_capabilities - self.creation_data = creation_data - self.disk_size_gb = disk_size_gb - self.disk_size_bytes: Optional[int] = None - self.unique_id: Optional[str] = None - self.encryption_settings_collection = encryption_settings_collection - self.provisioning_state: Optional[str] = None - self.disk_iops_read_write = disk_iops_read_write - self.disk_m_bps_read_write = disk_m_bps_read_write - self.disk_iops_read_only = disk_iops_read_only - self.disk_m_bps_read_only = disk_m_bps_read_only - self.disk_state: Optional[Union[str, "_models.DiskState"]] = None - self.encryption = encryption - self.max_shares = max_shares - self.share_info: Optional[list["_models.ShareInfoElement"]] = None - self.network_access_policy = network_access_policy - self.disk_access_id = disk_access_id - self.bursting_enabled_time: Optional[datetime.datetime] = None - self.tier = tier - self.bursting_enabled = bursting_enabled - self.property_updates_in_progress: Optional["_models.PropertyUpdatesInProgress"] = None - self.supports_hibernation = supports_hibernation - self.security_profile = security_profile - self.completion_percent = completion_percent - self.public_network_access = public_network_access - self.data_access_auth_mode = data_access_auth_mode - self.optimized_for_frequent_attach = optimized_for_frequent_attach - self.last_ownership_update_time: Optional[datetime.datetime] = None - self.availability_policy = availability_policy - - -class DiskAccess(TrackedResource): - """disk access resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to server. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.compute.models.SystemData - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - :ivar location: The geo-location where the resource lives. Required. - :vartype location: str - :ivar extended_location: The extended location where the disk access will be created. Extended - location cannot be changed. - :vartype extended_location: ~azure.mgmt.compute.models.ExtendedLocation - :ivar private_endpoint_connections: A readonly collection of private endpoint connections - created on the disk. Currently only one endpoint connection is supported. - :vartype private_endpoint_connections: - list[~azure.mgmt.compute.models.PrivateEndpointConnection] - :ivar provisioning_state: The disk access resource provisioning state. - :vartype provisioning_state: str - :ivar time_created: The time when the disk access was created. - :vartype time_created: ~datetime.datetime - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, - "location": {"required": True}, - "private_endpoint_connections": {"readonly": True}, - "provisioning_state": {"readonly": True}, - "time_created": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - "tags": {"key": "tags", "type": "{str}"}, - "location": {"key": "location", "type": "str"}, - "extended_location": {"key": "extendedLocation", "type": "ExtendedLocation"}, - "private_endpoint_connections": { - "key": "properties.privateEndpointConnections", - "type": "[PrivateEndpointConnection]", - }, - "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, - "time_created": {"key": "properties.timeCreated", "type": "iso-8601"}, - } - - def __init__( - self, - *, - location: str, - tags: Optional[dict[str, str]] = None, - extended_location: Optional["_models.ExtendedLocation"] = None, - **kwargs: Any - ) -> None: - """ - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - :keyword location: The geo-location where the resource lives. Required. - :paramtype location: str - :keyword extended_location: The extended location where the disk access will be created. - Extended location cannot be changed. - :paramtype extended_location: ~azure.mgmt.compute.models.ExtendedLocation - """ - super().__init__(tags=tags, location=location, **kwargs) - self.extended_location = extended_location - self.private_endpoint_connections: Optional[list["_models.PrivateEndpointConnection"]] = None - self.provisioning_state: Optional[str] = None - self.time_created: Optional[datetime.datetime] = None - - -class DiskAccessList(_serialization.Model): - """The List disk access operation response. - - All required parameters must be populated in order to send to server. - - :ivar value: The DiskAccess items on this page. Required. - :vartype value: list[~azure.mgmt.compute.models.DiskAccess] - :ivar next_link: The link to the next page of items. - :vartype next_link: str - """ - - _validation = { - "value": {"required": True}, - } - - _attribute_map = { - "value": {"key": "value", "type": "[DiskAccess]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__(self, *, value: list["_models.DiskAccess"], next_link: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword value: The DiskAccess items on this page. Required. - :paramtype value: list[~azure.mgmt.compute.models.DiskAccess] - :keyword next_link: The link to the next page of items. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class DiskAccessUpdate(_serialization.Model): - """Used for updating a disk access resource. - - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - """ - - _attribute_map = { - "tags": {"key": "tags", "type": "{str}"}, - } - - def __init__(self, *, tags: Optional[dict[str, str]] = None, **kwargs: Any) -> None: - """ - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - """ - super().__init__(**kwargs) - self.tags = tags - - -class DiskEncryptionSet(TrackedResource): - """disk encryption set resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to server. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.compute.models.SystemData - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - :ivar location: The geo-location where the resource lives. Required. - :vartype location: str - :ivar identity: The managed identity for the disk encryption set. It should be given permission - on the key vault before it can be used to encrypt disks. - :vartype identity: ~azure.mgmt.compute.models.EncryptionSetIdentity - :ivar encryption_type: The type of key used to encrypt the data of the disk. Known values are: - "EncryptionAtRestWithCustomerKey", "EncryptionAtRestWithPlatformAndCustomerKeys", and - "ConfidentialVmEncryptedWithCustomerKey". - :vartype encryption_type: str or ~azure.mgmt.compute.models.DiskEncryptionSetType - :ivar active_key: The key vault key which is currently used by this disk encryption set. - :vartype active_key: ~azure.mgmt.compute.models.KeyForDiskEncryptionSet - :ivar previous_keys: A readonly collection of key vault keys previously used by this disk - encryption set while a key rotation is in progress. It will be empty if there is no ongoing key - rotation. - :vartype previous_keys: list[~azure.mgmt.compute.models.KeyForDiskEncryptionSet] - :ivar provisioning_state: The disk encryption set provisioning state. - :vartype provisioning_state: str - :ivar rotation_to_latest_key_version_enabled: Set this flag to true to enable auto-updating of - this disk encryption set to the latest key version. - :vartype rotation_to_latest_key_version_enabled: bool - :ivar last_key_rotation_timestamp: The time when the active key of this disk encryption set was - updated. - :vartype last_key_rotation_timestamp: ~datetime.datetime - :ivar auto_key_rotation_error: The error that was encountered during auto-key rotation. If an - error is present, then auto-key rotation will not be attempted until the error on this disk - encryption set is fixed. - :vartype auto_key_rotation_error: ~azure.mgmt.compute.models.ApiError - :ivar federated_client_id: Multi-tenant application client id to access key vault in a - different tenant. Setting the value to 'None' will clear the property. - :vartype federated_client_id: str - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, - "location": {"required": True}, - "previous_keys": {"readonly": True}, - "provisioning_state": {"readonly": True}, - "last_key_rotation_timestamp": {"readonly": True}, - "auto_key_rotation_error": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - "tags": {"key": "tags", "type": "{str}"}, - "location": {"key": "location", "type": "str"}, - "identity": {"key": "identity", "type": "EncryptionSetIdentity"}, - "encryption_type": {"key": "properties.encryptionType", "type": "str"}, - "active_key": {"key": "properties.activeKey", "type": "KeyForDiskEncryptionSet"}, - "previous_keys": {"key": "properties.previousKeys", "type": "[KeyForDiskEncryptionSet]"}, - "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, - "rotation_to_latest_key_version_enabled": { - "key": "properties.rotationToLatestKeyVersionEnabled", - "type": "bool", - }, - "last_key_rotation_timestamp": {"key": "properties.lastKeyRotationTimestamp", "type": "iso-8601"}, - "auto_key_rotation_error": {"key": "properties.autoKeyRotationError", "type": "ApiError"}, - "federated_client_id": {"key": "properties.federatedClientId", "type": "str"}, - } - - def __init__( - self, - *, - location: str, - tags: Optional[dict[str, str]] = None, - identity: Optional["_models.EncryptionSetIdentity"] = None, - encryption_type: Optional[Union[str, "_models.DiskEncryptionSetType"]] = None, - active_key: Optional["_models.KeyForDiskEncryptionSet"] = None, - rotation_to_latest_key_version_enabled: Optional[bool] = None, - federated_client_id: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - :keyword location: The geo-location where the resource lives. Required. - :paramtype location: str - :keyword identity: The managed identity for the disk encryption set. It should be given - permission on the key vault before it can be used to encrypt disks. - :paramtype identity: ~azure.mgmt.compute.models.EncryptionSetIdentity - :keyword encryption_type: The type of key used to encrypt the data of the disk. Known values - are: "EncryptionAtRestWithCustomerKey", "EncryptionAtRestWithPlatformAndCustomerKeys", and - "ConfidentialVmEncryptedWithCustomerKey". - :paramtype encryption_type: str or ~azure.mgmt.compute.models.DiskEncryptionSetType - :keyword active_key: The key vault key which is currently used by this disk encryption set. - :paramtype active_key: ~azure.mgmt.compute.models.KeyForDiskEncryptionSet - :keyword rotation_to_latest_key_version_enabled: Set this flag to true to enable auto-updating - of this disk encryption set to the latest key version. - :paramtype rotation_to_latest_key_version_enabled: bool - :keyword federated_client_id: Multi-tenant application client id to access key vault in a - different tenant. Setting the value to 'None' will clear the property. - :paramtype federated_client_id: str - """ - super().__init__(tags=tags, location=location, **kwargs) - self.identity = identity - self.encryption_type = encryption_type - self.active_key = active_key - self.previous_keys: Optional[list["_models.KeyForDiskEncryptionSet"]] = None - self.provisioning_state: Optional[str] = None - self.rotation_to_latest_key_version_enabled = rotation_to_latest_key_version_enabled - self.last_key_rotation_timestamp: Optional[datetime.datetime] = None - self.auto_key_rotation_error: Optional["_models.ApiError"] = None - self.federated_client_id = federated_client_id - - -class DiskEncryptionSetList(_serialization.Model): - """The List disk encryption set operation response. - - All required parameters must be populated in order to send to server. - - :ivar value: The DiskEncryptionSet items on this page. Required. - :vartype value: list[~azure.mgmt.compute.models.DiskEncryptionSet] - :ivar next_link: The link to the next page of items. - :vartype next_link: str - """ - - _validation = { - "value": {"required": True}, - } - - _attribute_map = { - "value": {"key": "value", "type": "[DiskEncryptionSet]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, *, value: list["_models.DiskEncryptionSet"], next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: The DiskEncryptionSet items on this page. Required. - :paramtype value: list[~azure.mgmt.compute.models.DiskEncryptionSet] - :keyword next_link: The link to the next page of items. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class SubResource(_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: Any) -> None: # pylint: disable=redefined-builtin - """ - :keyword id: Resource Id. - :paramtype id: str - """ - super().__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. **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 - """ - - -class DiskEncryptionSettings(_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.models.KeyVaultSecretReference - :ivar key_encryption_key: Specifies the location of the key encryption key in Key Vault. - :vartype key_encryption_key: ~azure.mgmt.compute.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["_models.KeyVaultSecretReference"] = None, - key_encryption_key: Optional["_models.KeyVaultKeyReference"] = None, - enabled: Optional[bool] = None, - **kwargs: Any - ) -> None: - """ - :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.models.KeyVaultSecretReference - :keyword key_encryption_key: Specifies the location of the key encryption key in Key Vault. - :paramtype key_encryption_key: ~azure.mgmt.compute.models.KeyVaultKeyReference - :keyword enabled: Specifies whether disk encryption should be enabled on the virtual machine. - :paramtype enabled: bool - """ - super().__init__(**kwargs) - self.disk_encryption_key = disk_encryption_key - self.key_encryption_key = key_encryption_key - self.enabled = enabled - - -class DiskEncryptionSetUpdate(_serialization.Model): - """disk encryption set update resource. - - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - :ivar identity: The managed identity for the disk encryption set. It should be given permission - on the key vault before it can be used to encrypt disks. - :vartype identity: ~azure.mgmt.compute.models.EncryptionSetIdentity - :ivar encryption_type: The type of key used to encrypt the data of the disk. Known values are: - "EncryptionAtRestWithCustomerKey", "EncryptionAtRestWithPlatformAndCustomerKeys", and - "ConfidentialVmEncryptedWithCustomerKey". - :vartype encryption_type: str or ~azure.mgmt.compute.models.DiskEncryptionSetType - :ivar active_key: Key Vault Key Url to be used for server side encryption of Managed Disks and - Snapshots. - :vartype active_key: ~azure.mgmt.compute.models.KeyForDiskEncryptionSet - :ivar rotation_to_latest_key_version_enabled: Set this flag to true to enable auto-updating of - this disk encryption set to the latest key version. - :vartype rotation_to_latest_key_version_enabled: bool - :ivar federated_client_id: Multi-tenant application client id to access key vault in a - different tenant. Setting the value to 'None' will clear the property. - :vartype federated_client_id: str - """ - - _attribute_map = { - "tags": {"key": "tags", "type": "{str}"}, - "identity": {"key": "identity", "type": "EncryptionSetIdentity"}, - "encryption_type": {"key": "properties.encryptionType", "type": "str"}, - "active_key": {"key": "properties.activeKey", "type": "KeyForDiskEncryptionSet"}, - "rotation_to_latest_key_version_enabled": { - "key": "properties.rotationToLatestKeyVersionEnabled", - "type": "bool", - }, - "federated_client_id": {"key": "properties.federatedClientId", "type": "str"}, - } - - def __init__( - self, - *, - tags: Optional[dict[str, str]] = None, - identity: Optional["_models.EncryptionSetIdentity"] = None, - encryption_type: Optional[Union[str, "_models.DiskEncryptionSetType"]] = None, - active_key: Optional["_models.KeyForDiskEncryptionSet"] = None, - rotation_to_latest_key_version_enabled: Optional[bool] = None, - federated_client_id: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - :keyword identity: The managed identity for the disk encryption set. It should be given - permission on the key vault before it can be used to encrypt disks. - :paramtype identity: ~azure.mgmt.compute.models.EncryptionSetIdentity - :keyword encryption_type: The type of key used to encrypt the data of the disk. Known values - are: "EncryptionAtRestWithCustomerKey", "EncryptionAtRestWithPlatformAndCustomerKeys", and - "ConfidentialVmEncryptedWithCustomerKey". - :paramtype encryption_type: str or ~azure.mgmt.compute.models.DiskEncryptionSetType - :keyword active_key: Key Vault Key Url to be used for server side encryption of Managed Disks - and Snapshots. - :paramtype active_key: ~azure.mgmt.compute.models.KeyForDiskEncryptionSet - :keyword rotation_to_latest_key_version_enabled: Set this flag to true to enable auto-updating - of this disk encryption set to the latest key version. - :paramtype rotation_to_latest_key_version_enabled: bool - :keyword federated_client_id: Multi-tenant application client id to access key vault in a - different tenant. Setting the value to 'None' will clear the property. - :paramtype federated_client_id: str - """ - super().__init__(**kwargs) - self.tags = tags - self.identity = identity - self.encryption_type = encryption_type - self.active_key = active_key - self.rotation_to_latest_key_version_enabled = rotation_to_latest_key_version_enabled - self.federated_client_id = federated_client_id - - -class DiskInstanceView(_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.models.DiskEncryptionSettings] - :ivar statuses: The resource status information. - :vartype statuses: list[~azure.mgmt.compute.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["_models.DiskEncryptionSettings"]] = None, - statuses: Optional[list["_models.InstanceViewStatus"]] = None, - **kwargs: Any - ) -> None: - """ - :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.models.DiskEncryptionSettings] - :keyword statuses: The resource status information. - :paramtype statuses: list[~azure.mgmt.compute.models.InstanceViewStatus] - """ - super().__init__(**kwargs) - self.name = name - self.encryption_settings = encryption_settings - self.statuses = statuses - - -class DiskList(_serialization.Model): - """The List Disks operation response. - - All required parameters must be populated in order to send to server. - - :ivar value: The Disk items on this page. Required. - :vartype value: list[~azure.mgmt.compute.models.Disk] - :ivar next_link: The link to the next page of items. - :vartype next_link: str - """ - - _validation = { - "value": {"required": True}, - } - - _attribute_map = { - "value": {"key": "value", "type": "[Disk]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__(self, *, value: list["_models.Disk"], next_link: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword value: The Disk items on this page. Required. - :paramtype value: list[~azure.mgmt.compute.models.Disk] - :keyword next_link: The link to the next page of items. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class DiskPurchasePlan(_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 server. - - :ivar name: The plan ID. Required. - :vartype name: str - :ivar publisher: The publisher ID. Required. - :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. Required. - :vartype product: str - :ivar promotion_code: The Offer Promotion Code. - :vartype promotion_code: str - """ - - _validation = { - "name": {"required": True}, - "publisher": {"required": True}, - "product": {"required": True}, - } - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "publisher": {"key": "publisher", "type": "str"}, - "product": {"key": "product", "type": "str"}, - "promotion_code": {"key": "promotionCode", "type": "str"}, - } - - def __init__( - self, *, name: str, publisher: str, product: str, promotion_code: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword name: The plan ID. Required. - :paramtype name: str - :keyword publisher: The publisher ID. Required. - :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. Required. - :paramtype product: str - :keyword promotion_code: The Offer Promotion Code. - :paramtype promotion_code: str - """ - super().__init__(**kwargs) - self.name = name - self.publisher = publisher - self.product = product - self.promotion_code = promotion_code - - -class ProxyResource(Resource): - """The resource model definition for a Azure Resource Manager proxy resource. It will not have - tags and a location. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.compute.models.SystemData - """ - - -class DiskRestorePoint(ProxyResource): - """Properties of disk restore point. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.compute.models.SystemData - :ivar time_created: The timestamp of restorePoint creation. - :vartype time_created: ~datetime.datetime - :ivar source_resource_id: arm id of source disk or source disk restore point. - :vartype source_resource_id: str - :ivar os_type: The Operating System type. Known values are: "Windows" and "Linux". - :vartype os_type: str or ~azure.mgmt.compute.models.OperatingSystemTypes - :ivar hyper_v_generation: The hypervisor generation of the Virtual Machine. Applicable to OS - disks only. Known values are: "V1" and "V2". - :vartype hyper_v_generation: str or ~azure.mgmt.compute.models.HyperVGeneration - :ivar purchase_plan: Purchase plan information for the the image from which the OS disk was - created. - :vartype purchase_plan: ~azure.mgmt.compute.models.DiskPurchasePlan - :ivar supported_capabilities: List of supported capabilities for the image from which the OS - disk was created. - :vartype supported_capabilities: ~azure.mgmt.compute.models.SupportedCapabilities - :ivar family_id: id of the backing snapshot's MIS family. - :vartype family_id: str - :ivar source_unique_id: unique incarnation id of the source disk. - :vartype source_unique_id: str - :ivar encryption: Encryption property can be used to encrypt data at rest with customer managed - keys or platform managed keys. - :vartype encryption: ~azure.mgmt.compute.models.Encryption - :ivar supports_hibernation: Indicates the OS on a disk supports hibernation. - :vartype supports_hibernation: bool - :ivar network_access_policy: Policy for accessing the disk via network. Known values are: - "AllowAll", "AllowPrivate", and "DenyAll". - :vartype network_access_policy: str or ~azure.mgmt.compute.models.NetworkAccessPolicy - :ivar public_network_access: Policy for controlling export on the disk. Known values are: - "Enabled" and "Disabled". - :vartype public_network_access: str or ~azure.mgmt.compute.models.PublicNetworkAccess - :ivar disk_access_id: ARM id of the DiskAccess resource for using private endpoints on disks. - :vartype disk_access_id: str - :ivar completion_percent: Percentage complete for the background copy of disk restore point - when source resource is from a different region. - :vartype completion_percent: float - :ivar replication_state: Replication state of disk restore point when source resource is from a - different region. - :vartype replication_state: str - :ivar source_resource_location: Location of source disk or source disk restore point when - source resource is from a different region. - :vartype source_resource_location: str - :ivar security_profile: Contains the security related information for the resource. - :vartype security_profile: ~azure.mgmt.compute.models.DiskSecurityProfile - :ivar logical_sector_size: Logical sector size in bytes for disk restore points of UltraSSD_LRS - and PremiumV2_LRS disks. Supported values are 512 and 4096. 4096 is the default. - :vartype logical_sector_size: int - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, - "time_created": {"readonly": True}, - "source_resource_id": {"readonly": True}, - "os_type": {"readonly": True}, - "family_id": {"readonly": True}, - "source_unique_id": {"readonly": True}, - "encryption": {"readonly": True}, - "replication_state": {"readonly": True}, - "source_resource_location": {"readonly": True}, - "logical_sector_size": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - "time_created": {"key": "properties.timeCreated", "type": "iso-8601"}, - "source_resource_id": {"key": "properties.sourceResourceId", "type": "str"}, - "os_type": {"key": "properties.osType", "type": "str"}, - "hyper_v_generation": {"key": "properties.hyperVGeneration", "type": "str"}, - "purchase_plan": {"key": "properties.purchasePlan", "type": "DiskPurchasePlan"}, - "supported_capabilities": {"key": "properties.supportedCapabilities", "type": "SupportedCapabilities"}, - "family_id": {"key": "properties.familyId", "type": "str"}, - "source_unique_id": {"key": "properties.sourceUniqueId", "type": "str"}, - "encryption": {"key": "properties.encryption", "type": "Encryption"}, - "supports_hibernation": {"key": "properties.supportsHibernation", "type": "bool"}, - "network_access_policy": {"key": "properties.networkAccessPolicy", "type": "str"}, - "public_network_access": {"key": "properties.publicNetworkAccess", "type": "str"}, - "disk_access_id": {"key": "properties.diskAccessId", "type": "str"}, - "completion_percent": {"key": "properties.completionPercent", "type": "float"}, - "replication_state": {"key": "properties.replicationState", "type": "str"}, - "source_resource_location": {"key": "properties.sourceResourceLocation", "type": "str"}, - "security_profile": {"key": "properties.securityProfile", "type": "DiskSecurityProfile"}, - "logical_sector_size": {"key": "properties.logicalSectorSize", "type": "int"}, - } - - def __init__( - self, - *, - hyper_v_generation: Optional[Union[str, "_models.HyperVGeneration"]] = None, - purchase_plan: Optional["_models.DiskPurchasePlan"] = None, - supported_capabilities: Optional["_models.SupportedCapabilities"] = None, - supports_hibernation: Optional[bool] = None, - network_access_policy: Optional[Union[str, "_models.NetworkAccessPolicy"]] = None, - public_network_access: Optional[Union[str, "_models.PublicNetworkAccess"]] = None, - disk_access_id: Optional[str] = None, - completion_percent: Optional[float] = None, - security_profile: Optional["_models.DiskSecurityProfile"] = None, - **kwargs: Any - ) -> None: - """ - :keyword hyper_v_generation: The hypervisor generation of the Virtual Machine. Applicable to OS - disks only. Known values are: "V1" and "V2". - :paramtype hyper_v_generation: str or ~azure.mgmt.compute.models.HyperVGeneration - :keyword purchase_plan: Purchase plan information for the the image from which the OS disk was - created. - :paramtype purchase_plan: ~azure.mgmt.compute.models.DiskPurchasePlan - :keyword supported_capabilities: List of supported capabilities for the image from which the OS - disk was created. - :paramtype supported_capabilities: ~azure.mgmt.compute.models.SupportedCapabilities - :keyword supports_hibernation: Indicates the OS on a disk supports hibernation. - :paramtype supports_hibernation: bool - :keyword network_access_policy: Policy for accessing the disk via network. Known values are: - "AllowAll", "AllowPrivate", and "DenyAll". - :paramtype network_access_policy: str or ~azure.mgmt.compute.models.NetworkAccessPolicy - :keyword public_network_access: Policy for controlling export on the disk. Known values are: - "Enabled" and "Disabled". - :paramtype public_network_access: str or ~azure.mgmt.compute.models.PublicNetworkAccess - :keyword disk_access_id: ARM id of the DiskAccess resource for using private endpoints on - disks. - :paramtype disk_access_id: str - :keyword completion_percent: Percentage complete for the background copy of disk restore point - when source resource is from a different region. - :paramtype completion_percent: float - :keyword security_profile: Contains the security related information for the resource. - :paramtype security_profile: ~azure.mgmt.compute.models.DiskSecurityProfile - """ - super().__init__(**kwargs) - self.time_created: Optional[datetime.datetime] = None - self.source_resource_id: Optional[str] = None - self.os_type: Optional[Union[str, "_models.OperatingSystemTypes"]] = None - self.hyper_v_generation = hyper_v_generation - self.purchase_plan = purchase_plan - self.supported_capabilities = supported_capabilities - self.family_id: Optional[str] = None - self.source_unique_id: Optional[str] = None - self.encryption: Optional["_models.Encryption"] = None - self.supports_hibernation = supports_hibernation - self.network_access_policy = network_access_policy - self.public_network_access = public_network_access - self.disk_access_id = disk_access_id - self.completion_percent = completion_percent - self.replication_state: Optional[str] = None - self.source_resource_location: Optional[str] = None - self.security_profile = security_profile - self.logical_sector_size: Optional[int] = None - - -class SubResourceReadOnly(_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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.id: Optional[str] = None - - -class DiskRestorePointAttributes(SubResourceReadOnly): - """Disk 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 encryption: Encryption at rest settings for disk restore point. It is an optional - property that can be specified in the input while creating a restore point. - :vartype encryption: ~azure.mgmt.compute.models.RestorePointEncryption - :ivar source_disk_restore_point: Resource Id of the source disk restore point. - :vartype source_disk_restore_point: ~azure.mgmt.compute.models.ApiEntityReference - """ - - _validation = { - "id": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "encryption": {"key": "encryption", "type": "RestorePointEncryption"}, - "source_disk_restore_point": {"key": "sourceDiskRestorePoint", "type": "ApiEntityReference"}, - } - - def __init__( - self, - *, - encryption: Optional["_models.RestorePointEncryption"] = None, - source_disk_restore_point: Optional["_models.ApiEntityReference"] = None, - **kwargs: Any - ) -> None: - """ - :keyword encryption: Encryption at rest settings for disk restore point. It is an optional - property that can be specified in the input while creating a restore point. - :paramtype encryption: ~azure.mgmt.compute.models.RestorePointEncryption - :keyword source_disk_restore_point: Resource Id of the source disk restore point. - :paramtype source_disk_restore_point: ~azure.mgmt.compute.models.ApiEntityReference - """ - super().__init__(**kwargs) - self.encryption = encryption - self.source_disk_restore_point = source_disk_restore_point - - -class DiskRestorePointInstanceView(_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.models.DiskRestorePointReplicationStatus - """ - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "replication_status": {"key": "replicationStatus", "type": "DiskRestorePointReplicationStatus"}, - } - - def __init__( - self, - *, - id: Optional[str] = None, # pylint: disable=redefined-builtin - replication_status: Optional["_models.DiskRestorePointReplicationStatus"] = None, - **kwargs: Any - ) -> None: - """ - :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.models.DiskRestorePointReplicationStatus - """ - super().__init__(**kwargs) - self.id = id - self.replication_status = replication_status - - -class DiskRestorePointList(_serialization.Model): - """The List Disk Restore Points operation response. - - All required parameters must be populated in order to send to server. - - :ivar value: The DiskRestorePoint items on this page. Required. - :vartype value: list[~azure.mgmt.compute.models.DiskRestorePoint] - :ivar next_link: The link to the next page of items. - :vartype next_link: str - """ - - _validation = { - "value": {"required": True}, - } - - _attribute_map = { - "value": {"key": "value", "type": "[DiskRestorePoint]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, *, value: list["_models.DiskRestorePoint"], next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: The DiskRestorePoint items on this page. Required. - :paramtype value: list[~azure.mgmt.compute.models.DiskRestorePoint] - :keyword next_link: The link to the next page of items. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class DiskRestorePointReplicationStatus(_serialization.Model): - """The instance view of a disk restore point. - - :ivar status: The resource status information. - :vartype status: ~azure.mgmt.compute.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["_models.InstanceViewStatus"] = None, - completion_percent: Optional[int] = None, - **kwargs: Any - ) -> None: - """ - :keyword status: The resource status information. - :paramtype status: ~azure.mgmt.compute.models.InstanceViewStatus - :keyword completion_percent: Replication completion percentage. - :paramtype completion_percent: int - """ - super().__init__(**kwargs) - self.status = status - self.completion_percent = completion_percent - - -class DiskSecurityProfile(_serialization.Model): - """Contains the security related information for the resource. - - :ivar security_type: Specifies the SecurityType of the VM. Applicable for OS disks only. Known - values are: "TrustedLaunch", "ConfidentialVM_VMGuestStateOnlyEncryptedWithPlatformKey", - "ConfidentialVM_DiskEncryptedWithPlatformKey", "ConfidentialVM_DiskEncryptedWithCustomerKey", - and "ConfidentialVM_NonPersistedTPM". - :vartype security_type: str or ~azure.mgmt.compute.models.DiskSecurityTypes - :ivar secure_vm_disk_encryption_set_id: ResourceId of the disk encryption set associated to - Confidential VM supported disk encrypted with customer managed key. - :vartype secure_vm_disk_encryption_set_id: str - """ - - _attribute_map = { - "security_type": {"key": "securityType", "type": "str"}, - "secure_vm_disk_encryption_set_id": {"key": "secureVMDiskEncryptionSetId", "type": "str"}, - } - - def __init__( - self, - *, - security_type: Optional[Union[str, "_models.DiskSecurityTypes"]] = None, - secure_vm_disk_encryption_set_id: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword security_type: Specifies the SecurityType of the VM. Applicable for OS disks only. - Known values are: "TrustedLaunch", "ConfidentialVM_VMGuestStateOnlyEncryptedWithPlatformKey", - "ConfidentialVM_DiskEncryptedWithPlatformKey", "ConfidentialVM_DiskEncryptedWithCustomerKey", - and "ConfidentialVM_NonPersistedTPM". - :paramtype security_type: str or ~azure.mgmt.compute.models.DiskSecurityTypes - :keyword secure_vm_disk_encryption_set_id: ResourceId of the disk encryption set associated to - Confidential VM supported disk encrypted with customer managed key. - :paramtype secure_vm_disk_encryption_set_id: str - """ - super().__init__(**kwargs) - self.security_type = security_type - self.secure_vm_disk_encryption_set_id = secure_vm_disk_encryption_set_id - - -class DiskSku(_serialization.Model): - """The disks sku name. Can be Standard_LRS, Premium_LRS, StandardSSD_LRS, UltraSSD_LRS, - Premium_ZRS, StandardSSD_ZRS, or PremiumV2_LRS. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name: The sku name. Known values are: "Standard_LRS", "Premium_LRS", "StandardSSD_LRS", - "UltraSSD_LRS", "Premium_ZRS", "StandardSSD_ZRS", and "PremiumV2_LRS". - :vartype name: str or ~azure.mgmt.compute.models.DiskStorageAccountTypes - :ivar tier: The sku tier. - :vartype tier: str - """ - - _validation = { - "tier": {"readonly": True}, - } - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "tier": {"key": "tier", "type": "str"}, - } - - def __init__(self, *, name: Optional[Union[str, "_models.DiskStorageAccountTypes"]] = None, **kwargs: Any) -> None: - """ - :keyword name: The sku name. Known values are: "Standard_LRS", "Premium_LRS", - "StandardSSD_LRS", "UltraSSD_LRS", "Premium_ZRS", "StandardSSD_ZRS", and "PremiumV2_LRS". - :paramtype name: str or ~azure.mgmt.compute.models.DiskStorageAccountTypes - """ - super().__init__(**kwargs) - self.name = name - self.tier: Optional[str] = None - - -class DiskUpdate(_serialization.Model): - """Disk update resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - :ivar sku: The disks sku name. Can be Standard_LRS, Premium_LRS, StandardSSD_LRS, UltraSSD_LRS, - Premium_ZRS, StandardSSD_ZRS, or PremiumV2_LRS. - :vartype sku: ~azure.mgmt.compute.models.DiskSku - :ivar os_type: the Operating System type. Known values are: "Windows" and "Linux". - :vartype os_type: str or ~azure.mgmt.compute.models.OperatingSystemTypes - :ivar disk_size_gb: If creationData.createOption is Empty, this field is mandatory and it - indicates the size of the disk to create. If this field is present for updates or creation with - other options, it indicates a resize. Resizes are only allowed if the disk is not attached to a - running VM, and can only increase the disk's size. - :vartype disk_size_gb: int - :ivar encryption_settings_collection: Encryption settings collection used be Azure Disk - Encryption, can contain multiple encryption settings per disk or snapshot. - :vartype encryption_settings_collection: - ~azure.mgmt.compute.models.EncryptionSettingsCollection - :ivar disk_iops_read_write: The number of IOPS allowed for this disk; only settable for - UltraSSD disks. One operation can transfer between 4k and 256k bytes. - :vartype disk_iops_read_write: int - :ivar disk_m_bps_read_write: The bandwidth allowed for this disk; only settable for UltraSSD - disks. MBps means millions of bytes per second - MB here uses the ISO notation, of powers of - 10. - :vartype disk_m_bps_read_write: int - :ivar disk_iops_read_only: The total number of IOPS that will be allowed across all VMs - mounting the shared disk as ReadOnly. One operation can transfer between 4k and 256k bytes. - :vartype disk_iops_read_only: int - :ivar disk_m_bps_read_only: The total throughput (MBps) that will be allowed across all VMs - mounting the shared disk as ReadOnly. MBps means millions of bytes per second - MB here uses - the ISO notation, of powers of 10. - :vartype disk_m_bps_read_only: int - :ivar max_shares: The maximum number of VMs that can attach to the disk at the same time. Value - greater than one indicates a disk that can be mounted on multiple VMs at the same time. - :vartype max_shares: int - :ivar encryption: Encryption property can be used to encrypt data at rest with customer managed - keys or platform managed keys. - :vartype encryption: ~azure.mgmt.compute.models.Encryption - :ivar network_access_policy: Policy for accessing the disk via network. Known values are: - "AllowAll", "AllowPrivate", and "DenyAll". - :vartype network_access_policy: str or ~azure.mgmt.compute.models.NetworkAccessPolicy - :ivar disk_access_id: ARM id of the DiskAccess resource for using private endpoints on disks. - :vartype disk_access_id: str - :ivar tier: Performance tier of the disk (e.g, P4, S10) as described here: - https://azure.microsoft.com/en-us/pricing/details/managed-disks/. Does not apply to Ultra - disks. - :vartype tier: str - :ivar bursting_enabled: Set to true to enable bursting beyond the provisioned performance - target of the disk. Bursting is disabled by default. Does not apply to Ultra disks. - :vartype bursting_enabled: bool - :ivar purchase_plan: Purchase plan information to be added on the OS disk. - :vartype purchase_plan: ~azure.mgmt.compute.models.DiskPurchasePlan - :ivar supported_capabilities: List of supported capabilities to be added on the OS disk. - :vartype supported_capabilities: ~azure.mgmt.compute.models.SupportedCapabilities - :ivar property_updates_in_progress: Properties of the disk for which update is pending. - :vartype property_updates_in_progress: ~azure.mgmt.compute.models.PropertyUpdatesInProgress - :ivar supports_hibernation: Indicates the OS on a disk supports hibernation. - :vartype supports_hibernation: bool - :ivar public_network_access: Policy for controlling export on the disk. Known values are: - "Enabled" and "Disabled". - :vartype public_network_access: str or ~azure.mgmt.compute.models.PublicNetworkAccess - :ivar data_access_auth_mode: Additional authentication requirements when exporting or uploading - to a disk or snapshot. Known values are: "AzureActiveDirectory" and "None". - :vartype data_access_auth_mode: str or ~azure.mgmt.compute.models.DataAccessAuthMode - :ivar optimized_for_frequent_attach: Setting this property to true improves reliability and - performance of data disks that are frequently (more than 5 times a day) by detached from one - virtual machine and attached to another. This property should not be set for disks that are not - detached and attached frequently as it causes the disks to not align with the fault domain of - the virtual machine. - :vartype optimized_for_frequent_attach: bool - :ivar availability_policy: Determines how platform treats disk failures. - :vartype availability_policy: ~azure.mgmt.compute.models.AvailabilityPolicy - """ - - _validation = { - "property_updates_in_progress": {"readonly": True}, - } - - _attribute_map = { - "tags": {"key": "tags", "type": "{str}"}, - "sku": {"key": "sku", "type": "DiskSku"}, - "os_type": {"key": "properties.osType", "type": "str"}, - "disk_size_gb": {"key": "properties.diskSizeGB", "type": "int"}, - "encryption_settings_collection": { - "key": "properties.encryptionSettingsCollection", - "type": "EncryptionSettingsCollection", - }, - "disk_iops_read_write": {"key": "properties.diskIOPSReadWrite", "type": "int"}, - "disk_m_bps_read_write": {"key": "properties.diskMBpsReadWrite", "type": "int"}, - "disk_iops_read_only": {"key": "properties.diskIOPSReadOnly", "type": "int"}, - "disk_m_bps_read_only": {"key": "properties.diskMBpsReadOnly", "type": "int"}, - "max_shares": {"key": "properties.maxShares", "type": "int"}, - "encryption": {"key": "properties.encryption", "type": "Encryption"}, - "network_access_policy": {"key": "properties.networkAccessPolicy", "type": "str"}, - "disk_access_id": {"key": "properties.diskAccessId", "type": "str"}, - "tier": {"key": "properties.tier", "type": "str"}, - "bursting_enabled": {"key": "properties.burstingEnabled", "type": "bool"}, - "purchase_plan": {"key": "properties.purchasePlan", "type": "DiskPurchasePlan"}, - "supported_capabilities": {"key": "properties.supportedCapabilities", "type": "SupportedCapabilities"}, - "property_updates_in_progress": { - "key": "properties.propertyUpdatesInProgress", - "type": "PropertyUpdatesInProgress", - }, - "supports_hibernation": {"key": "properties.supportsHibernation", "type": "bool"}, - "public_network_access": {"key": "properties.publicNetworkAccess", "type": "str"}, - "data_access_auth_mode": {"key": "properties.dataAccessAuthMode", "type": "str"}, - "optimized_for_frequent_attach": {"key": "properties.optimizedForFrequentAttach", "type": "bool"}, - "availability_policy": {"key": "properties.availabilityPolicy", "type": "AvailabilityPolicy"}, - } - - def __init__( - self, - *, - tags: Optional[dict[str, str]] = None, - sku: Optional["_models.DiskSku"] = None, - os_type: Optional[Union[str, "_models.OperatingSystemTypes"]] = None, - disk_size_gb: Optional[int] = None, - encryption_settings_collection: Optional["_models.EncryptionSettingsCollection"] = None, - disk_iops_read_write: Optional[int] = None, - disk_m_bps_read_write: Optional[int] = None, - disk_iops_read_only: Optional[int] = None, - disk_m_bps_read_only: Optional[int] = None, - max_shares: Optional[int] = None, - encryption: Optional["_models.Encryption"] = None, - network_access_policy: Optional[Union[str, "_models.NetworkAccessPolicy"]] = None, - disk_access_id: Optional[str] = None, - tier: Optional[str] = None, - bursting_enabled: Optional[bool] = None, - purchase_plan: Optional["_models.DiskPurchasePlan"] = None, - supported_capabilities: Optional["_models.SupportedCapabilities"] = None, - supports_hibernation: Optional[bool] = None, - public_network_access: Optional[Union[str, "_models.PublicNetworkAccess"]] = None, - data_access_auth_mode: Optional[Union[str, "_models.DataAccessAuthMode"]] = None, - optimized_for_frequent_attach: Optional[bool] = None, - availability_policy: Optional["_models.AvailabilityPolicy"] = None, - **kwargs: Any - ) -> None: - """ - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - :keyword sku: The disks sku name. Can be Standard_LRS, Premium_LRS, StandardSSD_LRS, - UltraSSD_LRS, Premium_ZRS, StandardSSD_ZRS, or PremiumV2_LRS. - :paramtype sku: ~azure.mgmt.compute.models.DiskSku - :keyword os_type: the Operating System type. Known values are: "Windows" and "Linux". - :paramtype os_type: str or ~azure.mgmt.compute.models.OperatingSystemTypes - :keyword disk_size_gb: If creationData.createOption is Empty, this field is mandatory and it - indicates the size of the disk to create. If this field is present for updates or creation with - other options, it indicates a resize. Resizes are only allowed if the disk is not attached to a - running VM, and can only increase the disk's size. - :paramtype disk_size_gb: int - :keyword encryption_settings_collection: Encryption settings collection used be Azure Disk - Encryption, can contain multiple encryption settings per disk or snapshot. - :paramtype encryption_settings_collection: - ~azure.mgmt.compute.models.EncryptionSettingsCollection - :keyword disk_iops_read_write: The number of IOPS allowed for this disk; only settable for - UltraSSD disks. One operation can transfer between 4k and 256k bytes. - :paramtype disk_iops_read_write: int - :keyword disk_m_bps_read_write: The bandwidth allowed for this disk; only settable for UltraSSD - disks. MBps means millions of bytes per second - MB here uses the ISO notation, of powers of - 10. - :paramtype disk_m_bps_read_write: int - :keyword disk_iops_read_only: The total number of IOPS that will be allowed across all VMs - mounting the shared disk as ReadOnly. One operation can transfer between 4k and 256k bytes. - :paramtype disk_iops_read_only: int - :keyword disk_m_bps_read_only: The total throughput (MBps) that will be allowed across all VMs - mounting the shared disk as ReadOnly. MBps means millions of bytes per second - MB here uses - the ISO notation, of powers of 10. - :paramtype disk_m_bps_read_only: int - :keyword max_shares: The maximum number of VMs that can attach to the disk at the same time. - Value greater than one indicates a disk that can be mounted on multiple VMs at the same time. - :paramtype max_shares: int - :keyword encryption: Encryption property can be used to encrypt data at rest with customer - managed keys or platform managed keys. - :paramtype encryption: ~azure.mgmt.compute.models.Encryption - :keyword network_access_policy: Policy for accessing the disk via network. Known values are: - "AllowAll", "AllowPrivate", and "DenyAll". - :paramtype network_access_policy: str or ~azure.mgmt.compute.models.NetworkAccessPolicy - :keyword disk_access_id: ARM id of the DiskAccess resource for using private endpoints on - disks. - :paramtype disk_access_id: str - :keyword tier: Performance tier of the disk (e.g, P4, S10) as described here: - https://azure.microsoft.com/en-us/pricing/details/managed-disks/. Does not apply to Ultra - disks. - :paramtype tier: str - :keyword bursting_enabled: Set to true to enable bursting beyond the provisioned performance - target of the disk. Bursting is disabled by default. Does not apply to Ultra disks. - :paramtype bursting_enabled: bool - :keyword purchase_plan: Purchase plan information to be added on the OS disk. - :paramtype purchase_plan: ~azure.mgmt.compute.models.DiskPurchasePlan - :keyword supported_capabilities: List of supported capabilities to be added on the OS disk. - :paramtype supported_capabilities: ~azure.mgmt.compute.models.SupportedCapabilities - :keyword supports_hibernation: Indicates the OS on a disk supports hibernation. - :paramtype supports_hibernation: bool - :keyword public_network_access: Policy for controlling export on the disk. Known values are: - "Enabled" and "Disabled". - :paramtype public_network_access: str or ~azure.mgmt.compute.models.PublicNetworkAccess - :keyword data_access_auth_mode: Additional authentication requirements when exporting or - uploading to a disk or snapshot. Known values are: "AzureActiveDirectory" and "None". - :paramtype data_access_auth_mode: str or ~azure.mgmt.compute.models.DataAccessAuthMode - :keyword optimized_for_frequent_attach: Setting this property to true improves reliability and - performance of data disks that are frequently (more than 5 times a day) by detached from one - virtual machine and attached to another. This property should not be set for disks that are not - detached and attached frequently as it causes the disks to not align with the fault domain of - the virtual machine. - :paramtype optimized_for_frequent_attach: bool - :keyword availability_policy: Determines how platform treats disk failures. - :paramtype availability_policy: ~azure.mgmt.compute.models.AvailabilityPolicy - """ - super().__init__(**kwargs) - self.tags = tags - self.sku = sku - self.os_type = os_type - self.disk_size_gb = disk_size_gb - self.encryption_settings_collection = encryption_settings_collection - self.disk_iops_read_write = disk_iops_read_write - self.disk_m_bps_read_write = disk_m_bps_read_write - self.disk_iops_read_only = disk_iops_read_only - self.disk_m_bps_read_only = disk_m_bps_read_only - self.max_shares = max_shares - self.encryption = encryption - self.network_access_policy = network_access_policy - self.disk_access_id = disk_access_id - self.tier = tier - self.bursting_enabled = bursting_enabled - self.purchase_plan = purchase_plan - self.supported_capabilities = supported_capabilities - self.property_updates_in_progress: Optional["_models.PropertyUpdatesInProgress"] = None - self.supports_hibernation = supports_hibernation - self.public_network_access = public_network_access - self.data_access_auth_mode = data_access_auth_mode - self.optimized_for_frequent_attach = optimized_for_frequent_attach - self.availability_policy = availability_policy - - -class Encryption(_serialization.Model): - """Encryption at rest settings for disk or snapshot. - - :ivar disk_encryption_set_id: ResourceId of the disk encryption set to use for enabling - encryption at rest. - :vartype disk_encryption_set_id: str - :ivar type: The type of key used to encrypt the data of the disk. Known values are: - "EncryptionAtRestWithPlatformKey", "EncryptionAtRestWithCustomerKey", and - "EncryptionAtRestWithPlatformAndCustomerKeys". - :vartype type: str or ~azure.mgmt.compute.models.EncryptionType - """ - - _attribute_map = { - "disk_encryption_set_id": {"key": "diskEncryptionSetId", "type": "str"}, - "type": {"key": "type", "type": "str"}, - } - - def __init__( - self, - *, - disk_encryption_set_id: Optional[str] = None, - type: Optional[Union[str, "_models.EncryptionType"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword disk_encryption_set_id: ResourceId of the disk encryption set to use for enabling - encryption at rest. - :paramtype disk_encryption_set_id: str - :keyword type: The type of key used to encrypt the data of the disk. Known values are: - "EncryptionAtRestWithPlatformKey", "EncryptionAtRestWithCustomerKey", and - "EncryptionAtRestWithPlatformAndCustomerKeys". - :paramtype type: str or ~azure.mgmt.compute.models.EncryptionType - """ - super().__init__(**kwargs) - self.disk_encryption_set_id = disk_encryption_set_id - self.type = type - - -class EncryptionIdentity(_serialization.Model): - """Specifies the Managed Identity used by ADE to get access token for keyvault operations. - - :ivar user_assigned_identity_resource_id: Specifies ARM Resource ID of one of the user - identities associated with the VM. - :vartype user_assigned_identity_resource_id: str - """ - - _attribute_map = { - "user_assigned_identity_resource_id": {"key": "userAssignedIdentityResourceId", "type": "str"}, - } - - def __init__(self, *, user_assigned_identity_resource_id: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword user_assigned_identity_resource_id: Specifies ARM Resource ID of one of the user - identities associated with the VM. - :paramtype user_assigned_identity_resource_id: str - """ - super().__init__(**kwargs) - self.user_assigned_identity_resource_id = user_assigned_identity_resource_id - - -class EncryptionImages(_serialization.Model): - """Optional. Allows users to provide customer managed keys for encrypting the OS and data disks in - the gallery artifact. - - :ivar os_disk_image: Contains encryption settings for an OS disk image. - :vartype os_disk_image: ~azure.mgmt.compute.models.OSDiskImageEncryption - :ivar data_disk_images: A list of encryption specifications for data disk images. - :vartype data_disk_images: list[~azure.mgmt.compute.models.DataDiskImageEncryption] - """ - - _attribute_map = { - "os_disk_image": {"key": "osDiskImage", "type": "OSDiskImageEncryption"}, - "data_disk_images": {"key": "dataDiskImages", "type": "[DataDiskImageEncryption]"}, - } - - def __init__( - self, - *, - os_disk_image: Optional["_models.OSDiskImageEncryption"] = None, - data_disk_images: Optional[list["_models.DataDiskImageEncryption"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword os_disk_image: Contains encryption settings for an OS disk image. - :paramtype os_disk_image: ~azure.mgmt.compute.models.OSDiskImageEncryption - :keyword data_disk_images: A list of encryption specifications for data disk images. - :paramtype data_disk_images: list[~azure.mgmt.compute.models.DataDiskImageEncryption] - """ - super().__init__(**kwargs) - self.os_disk_image = os_disk_image - self.data_disk_images = data_disk_images - - -class EncryptionSetIdentity(_serialization.Model): - """The managed identity for the disk encryption set. It should be given permission on the key - vault before it can be used to encrypt disks. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar type: The type of Managed Identity used by the DiskEncryptionSet. Only SystemAssigned is - supported for new creations. Disk Encryption Sets can be updated with Identity type None during - migration of subscription to a new Azure Active Directory tenant; it will cause the encrypted - resources to lose access to the keys. Known values are: "SystemAssigned", "UserAssigned", - "SystemAssigned, UserAssigned", and "None". - :vartype type: str or ~azure.mgmt.compute.models.DiskEncryptionSetIdentityType - :ivar principal_id: The object id of the Managed Identity Resource. This will be sent to the RP - from ARM via the x-ms-identity-principal-id header in the PUT request if the resource has a - systemAssigned(implicit) identity. - :vartype principal_id: str - :ivar tenant_id: The tenant id of the Managed Identity Resource. This will be sent to the RP - from ARM via the x-ms-client-tenant-id header in the PUT request if the resource has a - systemAssigned(implicit) identity. - :vartype tenant_id: str - :ivar user_assigned_identities: The list of user identities associated with the disk encryption - 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.models.UserAssignedIdentitiesValue] - """ - - _validation = { - "principal_id": {"readonly": True}, - "tenant_id": {"readonly": True}, - } - - _attribute_map = { - "type": {"key": "type", "type": "str"}, - "principal_id": {"key": "principalId", "type": "str"}, - "tenant_id": {"key": "tenantId", "type": "str"}, - "user_assigned_identities": {"key": "userAssignedIdentities", "type": "{UserAssignedIdentitiesValue}"}, - } - - def __init__( - self, - *, - type: Optional[Union[str, "_models.DiskEncryptionSetIdentityType"]] = None, - user_assigned_identities: Optional[dict[str, "_models.UserAssignedIdentitiesValue"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword type: The type of Managed Identity used by the DiskEncryptionSet. Only SystemAssigned - is supported for new creations. Disk Encryption Sets can be updated with Identity type None - during migration of subscription to a new Azure Active Directory tenant; it will cause the - encrypted resources to lose access to the keys. Known values are: "SystemAssigned", - "UserAssigned", "SystemAssigned, UserAssigned", and "None". - :paramtype type: str or ~azure.mgmt.compute.models.DiskEncryptionSetIdentityType - :keyword user_assigned_identities: The list of user identities associated with the disk - encryption 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.models.UserAssignedIdentitiesValue] - """ - super().__init__(**kwargs) - self.type = type - self.principal_id: Optional[str] = None - self.tenant_id: Optional[str] = None - self.user_assigned_identities = user_assigned_identities - - -class EncryptionSettingsCollection(_serialization.Model): - """Encryption settings for disk or snapshot. - - All required parameters must be populated in order to send to server. - - :ivar enabled: Set this flag to true and provide DiskEncryptionKey and optional - KeyEncryptionKey to enable encryption. Set this flag to false and remove DiskEncryptionKey and - KeyEncryptionKey to disable encryption. If EncryptionSettings is null in the request object, - the existing settings remain unchanged. Required. - :vartype enabled: bool - :ivar encryption_settings: A collection of encryption settings, one for each disk volume. - :vartype encryption_settings: list[~azure.mgmt.compute.models.EncryptionSettingsElement] - :ivar encryption_settings_version: Describes what type of encryption is used for the disks. - Once this field is set, it cannot be overwritten. '1.0' corresponds to Azure Disk Encryption - with AAD app.'1.1' corresponds to Azure Disk Encryption. - :vartype encryption_settings_version: str - """ - - _validation = { - "enabled": {"required": True}, - } - - _attribute_map = { - "enabled": {"key": "enabled", "type": "bool"}, - "encryption_settings": {"key": "encryptionSettings", "type": "[EncryptionSettingsElement]"}, - "encryption_settings_version": {"key": "encryptionSettingsVersion", "type": "str"}, - } - - def __init__( - self, - *, - enabled: bool, - encryption_settings: Optional[list["_models.EncryptionSettingsElement"]] = None, - encryption_settings_version: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword enabled: Set this flag to true and provide DiskEncryptionKey and optional - KeyEncryptionKey to enable encryption. Set this flag to false and remove DiskEncryptionKey and - KeyEncryptionKey to disable encryption. If EncryptionSettings is null in the request object, - the existing settings remain unchanged. Required. - :paramtype enabled: bool - :keyword encryption_settings: A collection of encryption settings, one for each disk volume. - :paramtype encryption_settings: list[~azure.mgmt.compute.models.EncryptionSettingsElement] - :keyword encryption_settings_version: Describes what type of encryption is used for the disks. - Once this field is set, it cannot be overwritten. '1.0' corresponds to Azure Disk Encryption - with AAD app.'1.1' corresponds to Azure Disk Encryption. - :paramtype encryption_settings_version: str - """ - super().__init__(**kwargs) - self.enabled = enabled - self.encryption_settings = encryption_settings - self.encryption_settings_version = encryption_settings_version - - -class EncryptionSettingsElement(_serialization.Model): - """Encryption settings for one disk volume. - - :ivar disk_encryption_key: Key Vault Secret Url and vault id of the disk encryption key. - :vartype disk_encryption_key: ~azure.mgmt.compute.models.KeyVaultAndSecretReference - :ivar key_encryption_key: Key Vault Key Url and vault id of the key encryption key. - KeyEncryptionKey is optional and when provided is used to unwrap the disk encryption key. - :vartype key_encryption_key: ~azure.mgmt.compute.models.KeyVaultAndKeyReference - """ - - _attribute_map = { - "disk_encryption_key": {"key": "diskEncryptionKey", "type": "KeyVaultAndSecretReference"}, - "key_encryption_key": {"key": "keyEncryptionKey", "type": "KeyVaultAndKeyReference"}, - } - - def __init__( - self, - *, - disk_encryption_key: Optional["_models.KeyVaultAndSecretReference"] = None, - key_encryption_key: Optional["_models.KeyVaultAndKeyReference"] = None, - **kwargs: Any - ) -> None: - """ - :keyword disk_encryption_key: Key Vault Secret Url and vault id of the disk encryption key. - :paramtype disk_encryption_key: ~azure.mgmt.compute.models.KeyVaultAndSecretReference - :keyword key_encryption_key: Key Vault Key Url and vault id of the key encryption key. - KeyEncryptionKey is optional and when provided is used to unwrap the disk encryption key. - :paramtype key_encryption_key: ~azure.mgmt.compute.models.KeyVaultAndKeyReference - """ - super().__init__(**kwargs) - self.disk_encryption_key = disk_encryption_key - self.key_encryption_key = key_encryption_key - - -class ErrorAdditionalInfo(_serialization.Model): - """The resource management error additional info. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar type: The additional info type. - :vartype type: str - :ivar info: The additional info. - :vartype info: JSON - """ - - _validation = { - "type": {"readonly": True}, - "info": {"readonly": True}, - } - - _attribute_map = { - "type": {"key": "type", "type": "str"}, - "info": {"key": "info", "type": "object"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.type: Optional[str] = None - self.info: Optional[JSON] = None - - -class ErrorDetail(_serialization.Model): - """The error detail. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar code: The error code. - :vartype code: str - :ivar message: The error message. - :vartype message: str - :ivar target: The error target. - :vartype target: str - :ivar details: The error details. - :vartype details: list[~azure.mgmt.compute.models.ErrorDetail] - :ivar additional_info: The error additional info. - :vartype additional_info: list[~azure.mgmt.compute.models.ErrorAdditionalInfo] - """ - - _validation = { - "code": {"readonly": True}, - "message": {"readonly": True}, - "target": {"readonly": True}, - "details": {"readonly": True}, - "additional_info": {"readonly": True}, - } - - _attribute_map = { - "code": {"key": "code", "type": "str"}, - "message": {"key": "message", "type": "str"}, - "target": {"key": "target", "type": "str"}, - "details": {"key": "details", "type": "[ErrorDetail]"}, - "additional_info": {"key": "additionalInfo", "type": "[ErrorAdditionalInfo]"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.code: Optional[str] = None - self.message: Optional[str] = None - self.target: Optional[str] = None - self.details: Optional[list["_models.ErrorDetail"]] = None - self.additional_info: Optional[list["_models.ErrorAdditionalInfo"]] = None - - -class ErrorResponse(_serialization.Model): - """Common error response for all Azure Resource Manager APIs to return error details for failed - operations. (This also follows the OData error response format.). - - :ivar error: The error object. - :vartype error: ~azure.mgmt.compute.models.ErrorDetail - """ - - _attribute_map = { - "error": {"key": "error", "type": "ErrorDetail"}, - } - - def __init__(self, *, error: Optional["_models.ErrorDetail"] = None, **kwargs: Any) -> None: - """ - :keyword error: The error object. - :paramtype error: ~azure.mgmt.compute.models.ErrorDetail - """ - super().__init__(**kwargs) - self.error = error - - -class EventGridAndResourceGraph(_serialization.Model): - """Specifies eventGridAndResourceGraph related Scheduled Event related configurations. - - :ivar enable: Specifies if event grid and resource graph is enabled for Scheduled event related - configurations. - :vartype enable: bool - :ivar scheduled_events_api_version: Specifies the api-version to determine which Scheduled - Events configuration schema version will be delivered. - :vartype scheduled_events_api_version: str - """ - - _attribute_map = { - "enable": {"key": "enable", "type": "bool"}, - "scheduled_events_api_version": {"key": "scheduledEventsApiVersion", "type": "str"}, - } - - def __init__( - self, *, enable: Optional[bool] = None, scheduled_events_api_version: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword enable: Specifies if event grid and resource graph is enabled for Scheduled event - related configurations. - :paramtype enable: bool - :keyword scheduled_events_api_version: Specifies the api-version to determine which Scheduled - Events configuration schema version will be delivered. - :paramtype scheduled_events_api_version: str - """ - super().__init__(**kwargs) - self.enable = enable - self.scheduled_events_api_version = scheduled_events_api_version - - -class ExecutedValidation(_serialization.Model): - """This is the executed Validation. - - :ivar type: This property specifies the type of image version validation. - :vartype type: str - :ivar status: This property specifies the status of the validationProfile of the image version. - Known values are: "Unknown", "Failed", and "Succeeded". - :vartype status: str or ~azure.mgmt.compute.models.ValidationStatus - :ivar version: This property specifies the valid version of the validation. - :vartype version: str - :ivar execution_time: This property specifies the starting timestamp. - :vartype execution_time: ~datetime.datetime - """ - - _attribute_map = { - "type": {"key": "type", "type": "str"}, - "status": {"key": "status", "type": "str"}, - "version": {"key": "version", "type": "str"}, - "execution_time": {"key": "executionTime", "type": "iso-8601"}, - } - - def __init__( - self, - *, - type: Optional[str] = None, - status: Optional[Union[str, "_models.ValidationStatus"]] = None, - version: Optional[str] = None, - execution_time: Optional[datetime.datetime] = None, - **kwargs: Any - ) -> None: - """ - :keyword type: This property specifies the type of image version validation. - :paramtype type: str - :keyword status: This property specifies the status of the validationProfile of the image - version. Known values are: "Unknown", "Failed", and "Succeeded". - :paramtype status: str or ~azure.mgmt.compute.models.ValidationStatus - :keyword version: This property specifies the valid version of the validation. - :paramtype version: str - :keyword execution_time: This property specifies the starting timestamp. - :paramtype execution_time: ~datetime.datetime - """ - super().__init__(**kwargs) - self.type = type - self.status = status - self.version = version - self.execution_time = execution_time - - -class ExtendedLocation(_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. "EdgeZone" - :vartype type: str or ~azure.mgmt.compute.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, "_models.ExtendedLocationTypes"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword name: The name of the extended location. - :paramtype name: str - :keyword type: The type of the extended location. "EdgeZone" - :paramtype type: str or ~azure.mgmt.compute.models.ExtendedLocationTypes - """ - super().__init__(**kwargs) - self.name = name - self.type = type - - -class Extension(_serialization.Model): - """Describes a cloud service Extension. - - :ivar name: The name of the extension. - :vartype name: str - :ivar properties: Extension Properties. - :vartype properties: ~azure.mgmt.compute.models.CloudServiceExtensionProperties - """ - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "properties": {"key": "properties", "type": "CloudServiceExtensionProperties"}, - } - - def __init__( - self, - *, - name: Optional[str] = None, - properties: Optional["_models.CloudServiceExtensionProperties"] = None, - **kwargs: Any - ) -> None: - """ - :keyword name: The name of the extension. - :paramtype name: str - :keyword properties: Extension Properties. - :paramtype properties: ~azure.mgmt.compute.models.CloudServiceExtensionProperties - """ - super().__init__(**kwargs) - self.name = name - self.properties = properties - - -class Gallery(TrackedResource): - """Specifies information about the Shared Image Gallery that you want to create or update. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to server. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.compute.models.SystemData - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - :ivar location: The geo-location where the resource lives. Required. - :vartype location: str - :ivar identity: The identity of the gallery, if configured. - :vartype identity: ~azure.mgmt.compute.models.GalleryIdentity - :ivar description: The description of this Shared Image Gallery resource. This property is - updatable. - :vartype description: str - :ivar identifier: Describes the gallery unique name. - :vartype identifier: ~azure.mgmt.compute.models.GalleryIdentifier - :ivar provisioning_state: The provisioning state, which only appears in the response. Known - values are: "Creating", "Updating", "Failed", "Succeeded", "Deleting", and "Migrating". - :vartype provisioning_state: str or ~azure.mgmt.compute.models.GalleryProvisioningState - :ivar sharing_profile: Profile for gallery sharing to subscription or tenant. - :vartype sharing_profile: ~azure.mgmt.compute.models.SharingProfile - :ivar soft_delete_policy: Contains information about the soft deletion policy of the gallery. - :vartype soft_delete_policy: ~azure.mgmt.compute.models.SoftDeletePolicy - :ivar sharing_status: Sharing status of current gallery. - :vartype sharing_status: ~azure.mgmt.compute.models.SharingStatus - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, - "location": {"required": True}, - "provisioning_state": {"readonly": True}, - "sharing_status": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - "tags": {"key": "tags", "type": "{str}"}, - "location": {"key": "location", "type": "str"}, - "identity": {"key": "identity", "type": "GalleryIdentity"}, - "description": {"key": "properties.description", "type": "str"}, - "identifier": {"key": "properties.identifier", "type": "GalleryIdentifier"}, - "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, - "sharing_profile": {"key": "properties.sharingProfile", "type": "SharingProfile"}, - "soft_delete_policy": {"key": "properties.softDeletePolicy", "type": "SoftDeletePolicy"}, - "sharing_status": {"key": "properties.sharingStatus", "type": "SharingStatus"}, - } - - def __init__( - self, - *, - location: str, - tags: Optional[dict[str, str]] = None, - identity: Optional["_models.GalleryIdentity"] = None, - description: Optional[str] = None, - identifier: Optional["_models.GalleryIdentifier"] = None, - sharing_profile: Optional["_models.SharingProfile"] = None, - soft_delete_policy: Optional["_models.SoftDeletePolicy"] = None, - **kwargs: Any - ) -> None: - """ - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - :keyword location: The geo-location where the resource lives. Required. - :paramtype location: str - :keyword identity: The identity of the gallery, if configured. - :paramtype identity: ~azure.mgmt.compute.models.GalleryIdentity - :keyword description: The description of this Shared Image Gallery resource. This property is - updatable. - :paramtype description: str - :keyword identifier: Describes the gallery unique name. - :paramtype identifier: ~azure.mgmt.compute.models.GalleryIdentifier - :keyword sharing_profile: Profile for gallery sharing to subscription or tenant. - :paramtype sharing_profile: ~azure.mgmt.compute.models.SharingProfile - :keyword soft_delete_policy: Contains information about the soft deletion policy of the - gallery. - :paramtype soft_delete_policy: ~azure.mgmt.compute.models.SoftDeletePolicy - """ - super().__init__(tags=tags, location=location, **kwargs) - self.identity = identity - self.description = description - self.identifier = identifier - self.provisioning_state: Optional[Union[str, "_models.GalleryProvisioningState"]] = None - self.sharing_profile = sharing_profile - self.soft_delete_policy = soft_delete_policy - self.sharing_status: Optional["_models.SharingStatus"] = None - - -class GalleryApplication(TrackedResource): - """Specifies information about the gallery Application Definition that you want to create or - update. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to server. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.compute.models.SystemData - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - :ivar location: The geo-location where the resource lives. Required. - :vartype location: str - :ivar description: The description of this gallery Application Definition resource. This - property is updatable. - :vartype description: str - :ivar eula: The Eula agreement for the gallery Application Definition. - :vartype eula: str - :ivar privacy_statement_uri: The privacy statement uri. - :vartype privacy_statement_uri: str - :ivar release_note_uri: The release note uri. - :vartype release_note_uri: str - :ivar end_of_life_date: The end of life date of the gallery Application Definition. This - property can be used for decommissioning purposes. This property is updatable. - :vartype end_of_life_date: ~datetime.datetime - :ivar supported_os_type: This property allows you to specify the supported type of the OS that - application is built for. Possible values are: **Windows,** **Linux.**. Known values are: - "Windows" and "Linux". - :vartype supported_os_type: str or ~azure.mgmt.compute.models.OperatingSystemTypes - :ivar custom_actions: A list of custom actions that can be performed with all of the Gallery - Application Versions within this Gallery Application. - :vartype custom_actions: list[~azure.mgmt.compute.models.GalleryApplicationCustomAction] - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, - "location": {"required": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - "tags": {"key": "tags", "type": "{str}"}, - "location": {"key": "location", "type": "str"}, - "description": {"key": "properties.description", "type": "str"}, - "eula": {"key": "properties.eula", "type": "str"}, - "privacy_statement_uri": {"key": "properties.privacyStatementUri", "type": "str"}, - "release_note_uri": {"key": "properties.releaseNoteUri", "type": "str"}, - "end_of_life_date": {"key": "properties.endOfLifeDate", "type": "iso-8601"}, - "supported_os_type": {"key": "properties.supportedOSType", "type": "str"}, - "custom_actions": {"key": "properties.customActions", "type": "[GalleryApplicationCustomAction]"}, - } - - def __init__( - self, - *, - location: str, - tags: Optional[dict[str, str]] = None, - description: Optional[str] = None, - eula: Optional[str] = None, - privacy_statement_uri: Optional[str] = None, - release_note_uri: Optional[str] = None, - end_of_life_date: Optional[datetime.datetime] = None, - supported_os_type: Optional[Union[str, "_models.OperatingSystemTypes"]] = None, - custom_actions: Optional[list["_models.GalleryApplicationCustomAction"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - :keyword location: The geo-location where the resource lives. Required. - :paramtype location: str - :keyword description: The description of this gallery Application Definition resource. This - property is updatable. - :paramtype description: str - :keyword eula: The Eula agreement for the gallery Application Definition. - :paramtype eula: str - :keyword privacy_statement_uri: The privacy statement uri. - :paramtype privacy_statement_uri: str - :keyword release_note_uri: The release note uri. - :paramtype release_note_uri: str - :keyword end_of_life_date: The end of life date of the gallery Application Definition. This - property can be used for decommissioning purposes. This property is updatable. - :paramtype end_of_life_date: ~datetime.datetime - :keyword supported_os_type: This property allows you to specify the supported type of the OS - that application is built for. Possible values are: **Windows,** **Linux.**. Known values are: - "Windows" and "Linux". - :paramtype supported_os_type: str or ~azure.mgmt.compute.models.OperatingSystemTypes - :keyword custom_actions: A list of custom actions that can be performed with all of the Gallery - Application Versions within this Gallery Application. - :paramtype custom_actions: list[~azure.mgmt.compute.models.GalleryApplicationCustomAction] - """ - super().__init__(tags=tags, location=location, **kwargs) - self.description = description - self.eula = eula - self.privacy_statement_uri = privacy_statement_uri - self.release_note_uri = release_note_uri - self.end_of_life_date = end_of_life_date - self.supported_os_type = supported_os_type - self.custom_actions = custom_actions - - -class GalleryApplicationCustomAction(_serialization.Model): - """A custom action that can be performed with a Gallery Application Version. - - All required parameters must be populated in order to send to server. - - :ivar name: The name of the custom action. Must be unique within the Gallery Application - Version. Required. - :vartype name: str - :ivar script: The script to run when executing this custom action. Required. - :vartype script: str - :ivar description: Description to help the users understand what this custom action does. - :vartype description: str - :ivar parameters: The parameters that this custom action uses. - :vartype parameters: list[~azure.mgmt.compute.models.GalleryApplicationCustomActionParameter] - """ - - _validation = { - "name": {"required": True}, - "script": {"required": True}, - } - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "script": {"key": "script", "type": "str"}, - "description": {"key": "description", "type": "str"}, - "parameters": {"key": "parameters", "type": "[GalleryApplicationCustomActionParameter]"}, - } - - def __init__( - self, - *, - name: str, - script: str, - description: Optional[str] = None, - parameters: Optional[list["_models.GalleryApplicationCustomActionParameter"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword name: The name of the custom action. Must be unique within the Gallery Application - Version. Required. - :paramtype name: str - :keyword script: The script to run when executing this custom action. Required. - :paramtype script: str - :keyword description: Description to help the users understand what this custom action does. - :paramtype description: str - :keyword parameters: The parameters that this custom action uses. - :paramtype parameters: list[~azure.mgmt.compute.models.GalleryApplicationCustomActionParameter] - """ - super().__init__(**kwargs) - self.name = name - self.script = script - self.description = description - self.parameters = parameters - - -class GalleryApplicationCustomActionParameter(_serialization.Model): - """The definition of a parameter that can be passed to a custom action of a Gallery Application - Version. - - All required parameters must be populated in order to send to server. - - :ivar name: The name of the custom action. Must be unique within the Gallery Application - Version. Required. - :vartype name: str - :ivar required: Indicates whether this parameter must be passed when running the custom action. - :vartype required: bool - :ivar type: Specifies the type of the custom action parameter. Possible values are: String, - ConfigurationDataBlob or LogOutputBlob. Known values are: "String", "ConfigurationDataBlob", - and "LogOutputBlob". - :vartype type: str or ~azure.mgmt.compute.models.GalleryApplicationCustomActionParameterType - :ivar default_value: The default value of the parameter. Only applies to string types. - :vartype default_value: str - :ivar description: A description to help users understand what this parameter means. - :vartype description: str - """ - - _validation = { - "name": {"required": True}, - } - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "required": {"key": "required", "type": "bool"}, - "type": {"key": "type", "type": "str"}, - "default_value": {"key": "defaultValue", "type": "str"}, - "description": {"key": "description", "type": "str"}, - } - - def __init__( - self, - *, - name: str, - required: Optional[bool] = None, - type: Optional[Union[str, "_models.GalleryApplicationCustomActionParameterType"]] = None, - default_value: Optional[str] = None, - description: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword name: The name of the custom action. Must be unique within the Gallery Application - Version. Required. - :paramtype name: str - :keyword required: Indicates whether this parameter must be passed when running the custom - action. - :paramtype required: bool - :keyword type: Specifies the type of the custom action parameter. Possible values are: String, - ConfigurationDataBlob or LogOutputBlob. Known values are: "String", "ConfigurationDataBlob", - and "LogOutputBlob". - :paramtype type: str or ~azure.mgmt.compute.models.GalleryApplicationCustomActionParameterType - :keyword default_value: The default value of the parameter. Only applies to string types. - :paramtype default_value: str - :keyword description: A description to help users understand what this parameter means. - :paramtype description: str - """ - super().__init__(**kwargs) - self.name = name - self.required = required - self.type = type - self.default_value = default_value - self.description = description - - -class GalleryApplicationList(_serialization.Model): - """The List Gallery Applications operation response. - - All required parameters must be populated in order to send to server. - - :ivar value: The GalleryApplication items on this page. Required. - :vartype value: list[~azure.mgmt.compute.models.GalleryApplication] - :ivar next_link: The link to the next page of items. - :vartype next_link: str - """ - - _validation = { - "value": {"required": True}, - } - - _attribute_map = { - "value": {"key": "value", "type": "[GalleryApplication]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, *, value: list["_models.GalleryApplication"], next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: The GalleryApplication items on this page. Required. - :paramtype value: list[~azure.mgmt.compute.models.GalleryApplication] - :keyword next_link: The link to the next page of items. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class UpdateResourceDefinition(_serialization.Model): - """The Update Resource model definition. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Resource Id. - :vartype id: str - :ivar name: Resource name. - :vartype name: str - :ivar type: Resource type. - :vartype type: str - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "tags": {"key": "tags", "type": "{str}"}, - } - - def __init__(self, *, tags: Optional[dict[str, str]] = None, **kwargs: Any) -> None: - """ - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - """ - super().__init__(**kwargs) - self.id: Optional[str] = None - self.name: Optional[str] = None - self.type: Optional[str] = None - self.tags = tags - - -class GalleryApplicationUpdate(UpdateResourceDefinition): - """Specifies information about the gallery Application Definition that you want to update. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Resource Id. - :vartype id: str - :ivar name: Resource name. - :vartype name: str - :ivar type: Resource type. - :vartype type: str - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - :ivar description: The description of this gallery Application Definition resource. This - property is updatable. - :vartype description: str - :ivar eula: The Eula agreement for the gallery Application Definition. - :vartype eula: str - :ivar privacy_statement_uri: The privacy statement uri. - :vartype privacy_statement_uri: str - :ivar release_note_uri: The release note uri. - :vartype release_note_uri: str - :ivar end_of_life_date: The end of life date of the gallery Application Definition. This - property can be used for decommissioning purposes. This property is updatable. - :vartype end_of_life_date: ~datetime.datetime - :ivar supported_os_type: This property allows you to specify the supported type of the OS that - application is built for. Possible values are: **Windows,** **Linux.**. Known values are: - "Windows" and "Linux". - :vartype supported_os_type: str or ~azure.mgmt.compute.models.OperatingSystemTypes - :ivar custom_actions: A list of custom actions that can be performed with all of the Gallery - Application Versions within this Gallery Application. - :vartype custom_actions: list[~azure.mgmt.compute.models.GalleryApplicationCustomAction] - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "tags": {"key": "tags", "type": "{str}"}, - "description": {"key": "properties.description", "type": "str"}, - "eula": {"key": "properties.eula", "type": "str"}, - "privacy_statement_uri": {"key": "properties.privacyStatementUri", "type": "str"}, - "release_note_uri": {"key": "properties.releaseNoteUri", "type": "str"}, - "end_of_life_date": {"key": "properties.endOfLifeDate", "type": "iso-8601"}, - "supported_os_type": {"key": "properties.supportedOSType", "type": "str"}, - "custom_actions": {"key": "properties.customActions", "type": "[GalleryApplicationCustomAction]"}, - } - - def __init__( - self, - *, - tags: Optional[dict[str, str]] = None, - description: Optional[str] = None, - eula: Optional[str] = None, - privacy_statement_uri: Optional[str] = None, - release_note_uri: Optional[str] = None, - end_of_life_date: Optional[datetime.datetime] = None, - supported_os_type: Optional[Union[str, "_models.OperatingSystemTypes"]] = None, - custom_actions: Optional[list["_models.GalleryApplicationCustomAction"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - :keyword description: The description of this gallery Application Definition resource. This - property is updatable. - :paramtype description: str - :keyword eula: The Eula agreement for the gallery Application Definition. - :paramtype eula: str - :keyword privacy_statement_uri: The privacy statement uri. - :paramtype privacy_statement_uri: str - :keyword release_note_uri: The release note uri. - :paramtype release_note_uri: str - :keyword end_of_life_date: The end of life date of the gallery Application Definition. This - property can be used for decommissioning purposes. This property is updatable. - :paramtype end_of_life_date: ~datetime.datetime - :keyword supported_os_type: This property allows you to specify the supported type of the OS - that application is built for. Possible values are: **Windows,** **Linux.**. Known values are: - "Windows" and "Linux". - :paramtype supported_os_type: str or ~azure.mgmt.compute.models.OperatingSystemTypes - :keyword custom_actions: A list of custom actions that can be performed with all of the Gallery - Application Versions within this Gallery Application. - :paramtype custom_actions: list[~azure.mgmt.compute.models.GalleryApplicationCustomAction] - """ - super().__init__(tags=tags, **kwargs) - self.description = description - self.eula = eula - self.privacy_statement_uri = privacy_statement_uri - self.release_note_uri = release_note_uri - self.end_of_life_date = end_of_life_date - self.supported_os_type = supported_os_type - self.custom_actions = custom_actions - - -class GalleryApplicationVersion(TrackedResource): - """Specifies information about the gallery Application Version that you want to create or update. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to server. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.compute.models.SystemData - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - :ivar location: The geo-location where the resource lives. Required. - :vartype location: str - :ivar publishing_profile: The publishing profile of a gallery image version. - :vartype publishing_profile: - ~azure.mgmt.compute.models.GalleryApplicationVersionPublishingProfile - :ivar safety_profile: The safety profile of the Gallery Application Version. - :vartype safety_profile: ~azure.mgmt.compute.models.GalleryApplicationVersionSafetyProfile - :ivar provisioning_state: The provisioning state, which only appears in the response. Known - values are: "Creating", "Updating", "Failed", "Succeeded", "Deleting", and "Migrating". - :vartype provisioning_state: str or ~azure.mgmt.compute.models.GalleryProvisioningState - :ivar replication_status: This is the replication status of the gallery image version. - :vartype replication_status: ~azure.mgmt.compute.models.ReplicationStatus - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, - "location": {"required": True}, - "provisioning_state": {"readonly": True}, - "replication_status": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - "tags": {"key": "tags", "type": "{str}"}, - "location": {"key": "location", "type": "str"}, - "publishing_profile": { - "key": "properties.publishingProfile", - "type": "GalleryApplicationVersionPublishingProfile", - }, - "safety_profile": {"key": "properties.safetyProfile", "type": "GalleryApplicationVersionSafetyProfile"}, - "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, - "replication_status": {"key": "properties.replicationStatus", "type": "ReplicationStatus"}, - } - - def __init__( - self, - *, - location: str, - tags: Optional[dict[str, str]] = None, - publishing_profile: Optional["_models.GalleryApplicationVersionPublishingProfile"] = None, - safety_profile: Optional["_models.GalleryApplicationVersionSafetyProfile"] = None, - **kwargs: Any - ) -> None: - """ - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - :keyword location: The geo-location where the resource lives. Required. - :paramtype location: str - :keyword publishing_profile: The publishing profile of a gallery image version. - :paramtype publishing_profile: - ~azure.mgmt.compute.models.GalleryApplicationVersionPublishingProfile - :keyword safety_profile: The safety profile of the Gallery Application Version. - :paramtype safety_profile: ~azure.mgmt.compute.models.GalleryApplicationVersionSafetyProfile - """ - super().__init__(tags=tags, location=location, **kwargs) - self.publishing_profile = publishing_profile - self.safety_profile = safety_profile - self.provisioning_state: Optional[Union[str, "_models.GalleryProvisioningState"]] = None - self.replication_status: Optional["_models.ReplicationStatus"] = None - - -class GalleryApplicationVersionList(_serialization.Model): - """The List Gallery Application version operation response. - - All required parameters must be populated in order to send to server. - - :ivar value: A list of gallery Application Versions. Required. - :vartype value: list[~azure.mgmt.compute.models.GalleryApplicationVersion] - :ivar next_link: The uri to fetch the next page of gallery Application Versions. Call - ListNext() with this to fetch the next page of gallery Application Versions. - :vartype next_link: str - """ - - _validation = { - "value": {"required": True}, - } - - _attribute_map = { - "value": {"key": "value", "type": "[GalleryApplicationVersion]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, *, value: list["_models.GalleryApplicationVersion"], next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: A list of gallery Application Versions. Required. - :paramtype value: list[~azure.mgmt.compute.models.GalleryApplicationVersion] - :keyword next_link: The uri to fetch the next page of gallery Application Versions. Call - ListNext() with this to fetch the next page of gallery Application Versions. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class GalleryArtifactPublishingProfileBase(_serialization.Model): - """Describes the basic gallery artifact publishing profile. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar target_regions: The target regions where the Image Version is going to be replicated to. - This property is updatable. - :vartype target_regions: list[~azure.mgmt.compute.models.TargetRegion] - :ivar replica_count: The number of replicas of the Image Version to be created per region. This - property would take effect for a region when regionalReplicaCount is not specified. This - property is updatable. - :vartype replica_count: int - :ivar exclude_from_latest: If set to true, Virtual Machines deployed from the latest version of - the Image Definition won't use this Image Version. - :vartype exclude_from_latest: bool - :ivar published_date: The timestamp for when the gallery image version is published. - :vartype published_date: ~datetime.datetime - :ivar end_of_life_date: The end of life date of the gallery image version. This property can be - used for decommissioning purposes. This property is updatable. - :vartype end_of_life_date: ~datetime.datetime - :ivar storage_account_type: Specifies the storage account type to be used to store the image. - This property is not updatable. Known values are: "Standard_LRS", "Standard_ZRS", - "Premium_LRS", and "PremiumV2_LRS". - :vartype storage_account_type: str or ~azure.mgmt.compute.models.StorageAccountType - :ivar replication_mode: Optional parameter which specifies the mode to be used for replication. - This property is not updatable. Known values are: "Full" and "Shallow". - :vartype replication_mode: str or ~azure.mgmt.compute.models.ReplicationMode - :ivar target_extended_locations: The target extended locations where the Image Version is going - to be replicated to. This property is updatable. - :vartype target_extended_locations: - list[~azure.mgmt.compute.models.GalleryTargetExtendedLocation] - """ - - _validation = { - "published_date": {"readonly": True}, - } - - _attribute_map = { - "target_regions": {"key": "targetRegions", "type": "[TargetRegion]"}, - "replica_count": {"key": "replicaCount", "type": "int"}, - "exclude_from_latest": {"key": "excludeFromLatest", "type": "bool"}, - "published_date": {"key": "publishedDate", "type": "iso-8601"}, - "end_of_life_date": {"key": "endOfLifeDate", "type": "iso-8601"}, - "storage_account_type": {"key": "storageAccountType", "type": "str"}, - "replication_mode": {"key": "replicationMode", "type": "str"}, - "target_extended_locations": {"key": "targetExtendedLocations", "type": "[GalleryTargetExtendedLocation]"}, - } - - def __init__( - self, - *, - target_regions: Optional[list["_models.TargetRegion"]] = None, - replica_count: Optional[int] = None, - exclude_from_latest: Optional[bool] = None, - end_of_life_date: Optional[datetime.datetime] = None, - storage_account_type: Optional[Union[str, "_models.StorageAccountType"]] = None, - replication_mode: Optional[Union[str, "_models.ReplicationMode"]] = None, - target_extended_locations: Optional[list["_models.GalleryTargetExtendedLocation"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword target_regions: The target regions where the Image Version is going to be replicated - to. This property is updatable. - :paramtype target_regions: list[~azure.mgmt.compute.models.TargetRegion] - :keyword replica_count: The number of replicas of the Image Version to be created per region. - This property would take effect for a region when regionalReplicaCount is not specified. This - property is updatable. - :paramtype replica_count: int - :keyword exclude_from_latest: If set to true, Virtual Machines deployed from the latest version - of the Image Definition won't use this Image Version. - :paramtype exclude_from_latest: bool - :keyword end_of_life_date: The end of life date of the gallery image version. This property can - be used for decommissioning purposes. This property is updatable. - :paramtype end_of_life_date: ~datetime.datetime - :keyword storage_account_type: Specifies the storage account type to be used to store the - image. This property is not updatable. Known values are: "Standard_LRS", "Standard_ZRS", - "Premium_LRS", and "PremiumV2_LRS". - :paramtype storage_account_type: str or ~azure.mgmt.compute.models.StorageAccountType - :keyword replication_mode: Optional parameter which specifies the mode to be used for - replication. This property is not updatable. Known values are: "Full" and "Shallow". - :paramtype replication_mode: str or ~azure.mgmt.compute.models.ReplicationMode - :keyword target_extended_locations: The target extended locations where the Image Version is - going to be replicated to. This property is updatable. - :paramtype target_extended_locations: - list[~azure.mgmt.compute.models.GalleryTargetExtendedLocation] - """ - super().__init__(**kwargs) - self.target_regions = target_regions - self.replica_count = replica_count - self.exclude_from_latest = exclude_from_latest - self.published_date: Optional[datetime.datetime] = None - self.end_of_life_date = end_of_life_date - self.storage_account_type = storage_account_type - self.replication_mode = replication_mode - self.target_extended_locations = target_extended_locations - - -class GalleryApplicationVersionPublishingProfile(GalleryArtifactPublishingProfileBase): # pylint: disable=name-too-long - """The publishing profile of a gallery image version. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to server. - - :ivar target_regions: The target regions where the Image Version is going to be replicated to. - This property is updatable. - :vartype target_regions: list[~azure.mgmt.compute.models.TargetRegion] - :ivar replica_count: The number of replicas of the Image Version to be created per region. This - property would take effect for a region when regionalReplicaCount is not specified. This - property is updatable. - :vartype replica_count: int - :ivar exclude_from_latest: If set to true, Virtual Machines deployed from the latest version of - the Image Definition won't use this Image Version. - :vartype exclude_from_latest: bool - :ivar published_date: The timestamp for when the gallery image version is published. - :vartype published_date: ~datetime.datetime - :ivar end_of_life_date: The end of life date of the gallery image version. This property can be - used for decommissioning purposes. This property is updatable. - :vartype end_of_life_date: ~datetime.datetime - :ivar storage_account_type: Specifies the storage account type to be used to store the image. - This property is not updatable. Known values are: "Standard_LRS", "Standard_ZRS", - "Premium_LRS", and "PremiumV2_LRS". - :vartype storage_account_type: str or ~azure.mgmt.compute.models.StorageAccountType - :ivar replication_mode: Optional parameter which specifies the mode to be used for replication. - This property is not updatable. Known values are: "Full" and "Shallow". - :vartype replication_mode: str or ~azure.mgmt.compute.models.ReplicationMode - :ivar target_extended_locations: The target extended locations where the Image Version is going - to be replicated to. This property is updatable. - :vartype target_extended_locations: - list[~azure.mgmt.compute.models.GalleryTargetExtendedLocation] - :ivar source: The source image from which the Image Version is going to be created. Required. - :vartype source: ~azure.mgmt.compute.models.UserArtifactSource - :ivar manage_actions: - :vartype manage_actions: ~azure.mgmt.compute.models.UserArtifactManage - :ivar settings: Additional settings for the VM app that contains the target package and config - file name when it is deployed to target VM or VM scale set. - :vartype settings: ~azure.mgmt.compute.models.UserArtifactSettings - :ivar advanced_settings: Optional. Additional settings to pass to the vm-application-manager - extension. For advanced use only. - :vartype advanced_settings: dict[str, str] - :ivar enable_health_check: Optional. Whether or not this application reports health. - :vartype enable_health_check: bool - :ivar custom_actions: A list of custom actions that can be performed with this Gallery - Application Version. - :vartype custom_actions: list[~azure.mgmt.compute.models.GalleryApplicationCustomAction] - """ - - _validation = { - "published_date": {"readonly": True}, - "source": {"required": True}, - } - - _attribute_map = { - "target_regions": {"key": "targetRegions", "type": "[TargetRegion]"}, - "replica_count": {"key": "replicaCount", "type": "int"}, - "exclude_from_latest": {"key": "excludeFromLatest", "type": "bool"}, - "published_date": {"key": "publishedDate", "type": "iso-8601"}, - "end_of_life_date": {"key": "endOfLifeDate", "type": "iso-8601"}, - "storage_account_type": {"key": "storageAccountType", "type": "str"}, - "replication_mode": {"key": "replicationMode", "type": "str"}, - "target_extended_locations": {"key": "targetExtendedLocations", "type": "[GalleryTargetExtendedLocation]"}, - "source": {"key": "source", "type": "UserArtifactSource"}, - "manage_actions": {"key": "manageActions", "type": "UserArtifactManage"}, - "settings": {"key": "settings", "type": "UserArtifactSettings"}, - "advanced_settings": {"key": "advancedSettings", "type": "{str}"}, - "enable_health_check": {"key": "enableHealthCheck", "type": "bool"}, - "custom_actions": {"key": "customActions", "type": "[GalleryApplicationCustomAction]"}, - } - - def __init__( - self, - *, - source: "_models.UserArtifactSource", - target_regions: Optional[list["_models.TargetRegion"]] = None, - replica_count: Optional[int] = None, - exclude_from_latest: Optional[bool] = None, - end_of_life_date: Optional[datetime.datetime] = None, - storage_account_type: Optional[Union[str, "_models.StorageAccountType"]] = None, - replication_mode: Optional[Union[str, "_models.ReplicationMode"]] = None, - target_extended_locations: Optional[list["_models.GalleryTargetExtendedLocation"]] = None, - manage_actions: Optional["_models.UserArtifactManage"] = None, - settings: Optional["_models.UserArtifactSettings"] = None, - advanced_settings: Optional[dict[str, str]] = None, - enable_health_check: Optional[bool] = None, - custom_actions: Optional[list["_models.GalleryApplicationCustomAction"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword target_regions: The target regions where the Image Version is going to be replicated - to. This property is updatable. - :paramtype target_regions: list[~azure.mgmt.compute.models.TargetRegion] - :keyword replica_count: The number of replicas of the Image Version to be created per region. - This property would take effect for a region when regionalReplicaCount is not specified. This - property is updatable. - :paramtype replica_count: int - :keyword exclude_from_latest: If set to true, Virtual Machines deployed from the latest version - of the Image Definition won't use this Image Version. - :paramtype exclude_from_latest: bool - :keyword end_of_life_date: The end of life date of the gallery image version. This property can - be used for decommissioning purposes. This property is updatable. - :paramtype end_of_life_date: ~datetime.datetime - :keyword storage_account_type: Specifies the storage account type to be used to store the - image. This property is not updatable. Known values are: "Standard_LRS", "Standard_ZRS", - "Premium_LRS", and "PremiumV2_LRS". - :paramtype storage_account_type: str or ~azure.mgmt.compute.models.StorageAccountType - :keyword replication_mode: Optional parameter which specifies the mode to be used for - replication. This property is not updatable. Known values are: "Full" and "Shallow". - :paramtype replication_mode: str or ~azure.mgmt.compute.models.ReplicationMode - :keyword target_extended_locations: The target extended locations where the Image Version is - going to be replicated to. This property is updatable. - :paramtype target_extended_locations: - list[~azure.mgmt.compute.models.GalleryTargetExtendedLocation] - :keyword source: The source image from which the Image Version is going to be created. - Required. - :paramtype source: ~azure.mgmt.compute.models.UserArtifactSource - :keyword manage_actions: - :paramtype manage_actions: ~azure.mgmt.compute.models.UserArtifactManage - :keyword settings: Additional settings for the VM app that contains the target package and - config file name when it is deployed to target VM or VM scale set. - :paramtype settings: ~azure.mgmt.compute.models.UserArtifactSettings - :keyword advanced_settings: Optional. Additional settings to pass to the vm-application-manager - extension. For advanced use only. - :paramtype advanced_settings: dict[str, str] - :keyword enable_health_check: Optional. Whether or not this application reports health. - :paramtype enable_health_check: bool - :keyword custom_actions: A list of custom actions that can be performed with this Gallery - Application Version. - :paramtype custom_actions: list[~azure.mgmt.compute.models.GalleryApplicationCustomAction] - """ - super().__init__( - target_regions=target_regions, - replica_count=replica_count, - exclude_from_latest=exclude_from_latest, - end_of_life_date=end_of_life_date, - storage_account_type=storage_account_type, - replication_mode=replication_mode, - target_extended_locations=target_extended_locations, - **kwargs - ) - self.source = source - self.manage_actions = manage_actions - self.settings = settings - self.advanced_settings = advanced_settings - self.enable_health_check = enable_health_check - self.custom_actions = custom_actions - - -class GalleryArtifactSafetyProfileBase(_serialization.Model): - """This is the safety profile of the Gallery Artifact Version. - - :ivar allow_deletion_of_replicated_locations: Indicates whether or not removing this Gallery - Image Version from replicated regions is allowed. - :vartype allow_deletion_of_replicated_locations: bool - """ - - _attribute_map = { - "allow_deletion_of_replicated_locations": {"key": "allowDeletionOfReplicatedLocations", "type": "bool"}, - } - - def __init__(self, *, allow_deletion_of_replicated_locations: Optional[bool] = None, **kwargs: Any) -> None: - """ - :keyword allow_deletion_of_replicated_locations: Indicates whether or not removing this Gallery - Image Version from replicated regions is allowed. - :paramtype allow_deletion_of_replicated_locations: bool - """ - super().__init__(**kwargs) - self.allow_deletion_of_replicated_locations = allow_deletion_of_replicated_locations - - -class GalleryApplicationVersionSafetyProfile(GalleryArtifactSafetyProfileBase): - """The safety profile of the Gallery Application Version. - - :ivar allow_deletion_of_replicated_locations: Indicates whether or not removing this Gallery - Image Version from replicated regions is allowed. - :vartype allow_deletion_of_replicated_locations: bool - """ - - -class GalleryApplicationVersionUpdate(UpdateResourceDefinition): - """Specifies information about the gallery Application Version that you want to update. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Resource Id. - :vartype id: str - :ivar name: Resource name. - :vartype name: str - :ivar type: Resource type. - :vartype type: str - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - :ivar publishing_profile: The publishing profile of a gallery image version. - :vartype publishing_profile: - ~azure.mgmt.compute.models.GalleryApplicationVersionPublishingProfile - :ivar safety_profile: The safety profile of the Gallery Application Version. - :vartype safety_profile: ~azure.mgmt.compute.models.GalleryApplicationVersionSafetyProfile - :ivar provisioning_state: The provisioning state, which only appears in the response. Known - values are: "Creating", "Updating", "Failed", "Succeeded", "Deleting", and "Migrating". - :vartype provisioning_state: str or ~azure.mgmt.compute.models.GalleryProvisioningState - :ivar replication_status: This is the replication status of the gallery image version. - :vartype replication_status: ~azure.mgmt.compute.models.ReplicationStatus - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "provisioning_state": {"readonly": True}, - "replication_status": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "tags": {"key": "tags", "type": "{str}"}, - "publishing_profile": { - "key": "properties.publishingProfile", - "type": "GalleryApplicationVersionPublishingProfile", - }, - "safety_profile": {"key": "properties.safetyProfile", "type": "GalleryApplicationVersionSafetyProfile"}, - "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, - "replication_status": {"key": "properties.replicationStatus", "type": "ReplicationStatus"}, - } - - def __init__( - self, - *, - tags: Optional[dict[str, str]] = None, - publishing_profile: Optional["_models.GalleryApplicationVersionPublishingProfile"] = None, - safety_profile: Optional["_models.GalleryApplicationVersionSafetyProfile"] = None, - **kwargs: Any - ) -> None: - """ - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - :keyword publishing_profile: The publishing profile of a gallery image version. - :paramtype publishing_profile: - ~azure.mgmt.compute.models.GalleryApplicationVersionPublishingProfile - :keyword safety_profile: The safety profile of the Gallery Application Version. - :paramtype safety_profile: ~azure.mgmt.compute.models.GalleryApplicationVersionSafetyProfile - """ - super().__init__(tags=tags, **kwargs) - self.publishing_profile = publishing_profile - self.safety_profile = safety_profile - self.provisioning_state: Optional[Union[str, "_models.GalleryProvisioningState"]] = None - self.replication_status: Optional["_models.ReplicationStatus"] = None - - -class GalleryArtifactVersionSource(_serialization.Model): - """The gallery artifact version source. - - :ivar id: The id of the gallery artifact version source. - :vartype id: str - """ - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - } - - def __init__(self, *, id: Optional[str] = None, **kwargs: Any) -> None: # pylint: disable=redefined-builtin - """ - :keyword id: The id of the gallery artifact version source. - :paramtype id: str - """ - super().__init__(**kwargs) - self.id = id - - -class GalleryArtifactVersionFullSource(GalleryArtifactVersionSource): - """The source of the gallery artifact version. - - :ivar id: The id of the gallery artifact version source. - :vartype id: str - :ivar community_gallery_image_id: The resource Id of the source Community Gallery Image. Only - required when using Community Gallery Image as a source. - :vartype community_gallery_image_id: str - :ivar virtual_machine_id: The resource Id of the source virtual machine. Only required when - capturing a virtual machine to source this Gallery Image Version. - :vartype virtual_machine_id: str - """ - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "community_gallery_image_id": {"key": "communityGalleryImageId", "type": "str"}, - "virtual_machine_id": {"key": "virtualMachineId", "type": "str"}, - } - - def __init__( - self, - *, - id: Optional[str] = None, # pylint: disable=redefined-builtin - community_gallery_image_id: Optional[str] = None, - virtual_machine_id: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword id: The id of the gallery artifact version source. - :paramtype id: str - :keyword community_gallery_image_id: The resource Id of the source Community Gallery Image. - Only required when using Community Gallery Image as a source. - :paramtype community_gallery_image_id: str - :keyword virtual_machine_id: The resource Id of the source virtual machine. Only required when - capturing a virtual machine to source this Gallery Image Version. - :paramtype virtual_machine_id: str - """ - super().__init__(id=id, **kwargs) - self.community_gallery_image_id = community_gallery_image_id - self.virtual_machine_id = virtual_machine_id - - -class GalleryDiskImage(_serialization.Model): - """This is the disk image base class. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar size_in_gb: This property indicates the size of the VHD to be created. - :vartype size_in_gb: int - :ivar host_caching: The host caching of the disk. Valid values are 'None', 'ReadOnly', and - 'ReadWrite'. Known values are: "None", "ReadOnly", and "ReadWrite". - :vartype host_caching: str or ~azure.mgmt.compute.models.HostCaching - :ivar source: The source for the disk image. - :vartype source: ~azure.mgmt.compute.models.GalleryDiskImageSource - """ - - _validation = { - "size_in_gb": {"readonly": True}, - } - - _attribute_map = { - "size_in_gb": {"key": "sizeInGB", "type": "int"}, - "host_caching": {"key": "hostCaching", "type": "str"}, - "source": {"key": "source", "type": "GalleryDiskImageSource"}, - } - - def __init__( - self, - *, - host_caching: Optional[Union[str, "_models.HostCaching"]] = None, - source: Optional["_models.GalleryDiskImageSource"] = None, - **kwargs: Any - ) -> None: - """ - :keyword host_caching: The host caching of the disk. Valid values are 'None', 'ReadOnly', and - 'ReadWrite'. Known values are: "None", "ReadOnly", and "ReadWrite". - :paramtype host_caching: str or ~azure.mgmt.compute.models.HostCaching - :keyword source: The source for the disk image. - :paramtype source: ~azure.mgmt.compute.models.GalleryDiskImageSource - """ - super().__init__(**kwargs) - self.size_in_gb: Optional[int] = None - self.host_caching = host_caching - self.source = source - - -class GalleryDataDiskImage(GalleryDiskImage): - """This is the data disk image. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to server. - - :ivar size_in_gb: This property indicates the size of the VHD to be created. - :vartype size_in_gb: int - :ivar host_caching: The host caching of the disk. Valid values are 'None', 'ReadOnly', and - 'ReadWrite'. Known values are: "None", "ReadOnly", and "ReadWrite". - :vartype host_caching: str or ~azure.mgmt.compute.models.HostCaching - :ivar source: The source for the disk image. - :vartype source: ~azure.mgmt.compute.models.GalleryDiskImageSource - :ivar lun: This property specifies the logical unit number of the data disk. This value is used - to identify data disks within the Virtual Machine and therefore must be unique for each data - disk attached to the Virtual Machine. Required. - :vartype lun: int - """ - - _validation = { - "size_in_gb": {"readonly": True}, - "lun": {"required": True}, - } - - _attribute_map = { - "size_in_gb": {"key": "sizeInGB", "type": "int"}, - "host_caching": {"key": "hostCaching", "type": "str"}, - "source": {"key": "source", "type": "GalleryDiskImageSource"}, - "lun": {"key": "lun", "type": "int"}, - } - - def __init__( - self, - *, - lun: int, - host_caching: Optional[Union[str, "_models.HostCaching"]] = None, - source: Optional["_models.GalleryDiskImageSource"] = None, - **kwargs: Any - ) -> None: - """ - :keyword host_caching: The host caching of the disk. Valid values are 'None', 'ReadOnly', and - 'ReadWrite'. Known values are: "None", "ReadOnly", and "ReadWrite". - :paramtype host_caching: str or ~azure.mgmt.compute.models.HostCaching - :keyword source: The source for the disk image. - :paramtype source: ~azure.mgmt.compute.models.GalleryDiskImageSource - :keyword lun: This property specifies the logical unit number of the data disk. This value is - used to identify data disks within the Virtual Machine and therefore must be unique for each - data disk attached to the Virtual Machine. Required. - :paramtype lun: int - """ - super().__init__(host_caching=host_caching, source=source, **kwargs) - self.lun = lun - - -class GalleryDiskImageSource(GalleryArtifactVersionSource): - """The source for the disk image. - - :ivar id: The id of the gallery artifact version source. - :vartype id: str - :ivar uri: The uri of the gallery artifact version source. Currently used to specify vhd/blob - source. - :vartype uri: str - :ivar storage_account_id: The Storage Account Id that contains the vhd blob being used as a - source for this artifact version. - :vartype storage_account_id: str - """ - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "uri": {"key": "uri", "type": "str"}, - "storage_account_id": {"key": "storageAccountId", "type": "str"}, - } - - def __init__( - self, - *, - id: Optional[str] = None, # pylint: disable=redefined-builtin - uri: Optional[str] = None, - storage_account_id: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword id: The id of the gallery artifact version source. - :paramtype id: str - :keyword uri: The uri of the gallery artifact version source. Currently used to specify - vhd/blob source. - :paramtype uri: str - :keyword storage_account_id: The Storage Account Id that contains the vhd blob being used as a - source for this artifact version. - :paramtype storage_account_id: str - """ - super().__init__(id=id, **kwargs) - self.uri = uri - self.storage_account_id = storage_account_id - - -class GalleryExtendedLocation(_serialization.Model): - """The name of the extended location. - - :ivar name: - :vartype name: str - :ivar type: It is type of the extended location. Known values are: "EdgeZone" and "Unknown". - :vartype type: str or ~azure.mgmt.compute.models.GalleryExtendedLocationType - """ - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - } - - def __init__( - self, - *, - name: Optional[str] = None, - type: Optional[Union[str, "_models.GalleryExtendedLocationType"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword name: - :paramtype name: str - :keyword type: It is type of the extended location. Known values are: "EdgeZone" and "Unknown". - :paramtype type: str or ~azure.mgmt.compute.models.GalleryExtendedLocationType - """ - super().__init__(**kwargs) - self.name = name - self.type = type - - -class GalleryIdentifier(_serialization.Model): - """Describes the gallery unique name. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar unique_name: The unique name of the Shared Image Gallery. This name is generated - automatically by Azure. - :vartype unique_name: str - """ - - _validation = { - "unique_name": {"readonly": True}, - } - - _attribute_map = { - "unique_name": {"key": "uniqueName", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.unique_name: Optional[str] = None - - -class GalleryIdentity(_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 the gallery identity. This property will only be - provided for a system assigned identity. - :vartype principal_id: str - :ivar tenant_id: The AAD tenant id of the gallery identity. This property will only be provided - for a system assigned identity. - :vartype tenant_id: str - :ivar type: The type of identity used for the gallery. The type 'SystemAssigned, UserAssigned' - includes both an implicitly created identity and a set of user assigned identities. The type - 'None' will remove all identities from the gallery. Known values are: "SystemAssigned", - "UserAssigned", "SystemAssigned, UserAssigned", and "None". - :vartype type: str or ~azure.mgmt.compute.models.ResourceIdentityType - :ivar user_assigned_identities: The list of user identities associated with the gallery. 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.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, "_models.ResourceIdentityType"]] = None, - user_assigned_identities: Optional[dict[str, "_models.UserAssignedIdentitiesValue"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword type: The type of identity used for the gallery. The type 'SystemAssigned, - UserAssigned' includes both an implicitly created identity and a set of user assigned - identities. The type 'None' will remove all identities from the gallery. Known values are: - "SystemAssigned", "UserAssigned", "SystemAssigned, UserAssigned", and "None". - :paramtype type: str or ~azure.mgmt.compute.models.ResourceIdentityType - :keyword user_assigned_identities: The list of user identities associated with the gallery. 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.models.UserAssignedIdentitiesValue] - """ - super().__init__(**kwargs) - self.principal_id: Optional[str] = None - self.tenant_id: Optional[str] = None - self.type = type - self.user_assigned_identities = user_assigned_identities - - -class GalleryImage(TrackedResource): - """Specifies information about the gallery image definition that you want to create or update. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to server. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.compute.models.SystemData - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - :ivar location: The geo-location where the resource lives. Required. - :vartype location: str - :ivar description: The description of this gallery image definition resource. This property is - updatable. - :vartype description: str - :ivar eula: The Eula agreement for the gallery image definition. - :vartype eula: str - :ivar privacy_statement_uri: The privacy statement uri. - :vartype privacy_statement_uri: str - :ivar release_note_uri: The release note uri. - :vartype release_note_uri: str - :ivar os_type: This property allows you to specify the type of the OS that is included in the - disk when creating a VM from a managed image. Possible values are: **Windows,** **Linux.**. - Known values are: "Windows" and "Linux". - :vartype os_type: str or ~azure.mgmt.compute.models.OperatingSystemTypes - :ivar os_state: This property allows the user to specify whether the virtual machines created - under this image are 'Generalized' or 'Specialized'. Known values are: "Generalized" and - "Specialized". - :vartype os_state: str or ~azure.mgmt.compute.models.OperatingSystemStateTypes - :ivar hyper_v_generation: The hypervisor generation of the Virtual Machine. Applicable to OS - disks only. Known values are: "V1" and "V2". - :vartype hyper_v_generation: str or ~azure.mgmt.compute.models.HyperVGeneration - :ivar end_of_life_date: The end of life date of the gallery image definition. This property can - be used for decommissioning purposes. This property is updatable. - :vartype end_of_life_date: ~datetime.datetime - :ivar identifier: This is the gallery image definition identifier. - :vartype identifier: ~azure.mgmt.compute.models.GalleryImageIdentifier - :ivar recommended: The properties describe the recommended machine configuration for this Image - Definition. These properties are updatable. - :vartype recommended: ~azure.mgmt.compute.models.RecommendedMachineConfiguration - :ivar disallowed: Describes the disallowed disk types. - :vartype disallowed: ~azure.mgmt.compute.models.Disallowed - :ivar purchase_plan: Describes the gallery image definition purchase plan. This is used by - marketplace images. - :vartype purchase_plan: ~azure.mgmt.compute.models.ImagePurchasePlan - :ivar provisioning_state: The provisioning state, which only appears in the response. Known - values are: "Creating", "Updating", "Failed", "Succeeded", "Deleting", and "Migrating". - :vartype provisioning_state: str or ~azure.mgmt.compute.models.GalleryProvisioningState - :ivar features: A list of gallery image features. - :vartype features: list[~azure.mgmt.compute.models.GalleryImageFeature] - :ivar architecture: The architecture of the image. Applicable to OS disks only. Known values - are: "x64" and "Arm64". - :vartype architecture: str or ~azure.mgmt.compute.models.Architecture - :ivar allow_update_image: Optional. Must be set to true if the gallery image features are being - updated. - :vartype allow_update_image: bool - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"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"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - "tags": {"key": "tags", "type": "{str}"}, - "location": {"key": "location", "type": "str"}, - "description": {"key": "properties.description", "type": "str"}, - "eula": {"key": "properties.eula", "type": "str"}, - "privacy_statement_uri": {"key": "properties.privacyStatementUri", "type": "str"}, - "release_note_uri": {"key": "properties.releaseNoteUri", "type": "str"}, - "os_type": {"key": "properties.osType", "type": "str"}, - "os_state": {"key": "properties.osState", "type": "str"}, - "hyper_v_generation": {"key": "properties.hyperVGeneration", "type": "str"}, - "end_of_life_date": {"key": "properties.endOfLifeDate", "type": "iso-8601"}, - "identifier": {"key": "properties.identifier", "type": "GalleryImageIdentifier"}, - "recommended": {"key": "properties.recommended", "type": "RecommendedMachineConfiguration"}, - "disallowed": {"key": "properties.disallowed", "type": "Disallowed"}, - "purchase_plan": {"key": "properties.purchasePlan", "type": "ImagePurchasePlan"}, - "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, - "features": {"key": "properties.features", "type": "[GalleryImageFeature]"}, - "architecture": {"key": "properties.architecture", "type": "str"}, - "allow_update_image": {"key": "properties.allowUpdateImage", "type": "bool"}, - } - - def __init__( - self, - *, - location: str, - tags: Optional[dict[str, str]] = None, - description: Optional[str] = None, - eula: Optional[str] = None, - privacy_statement_uri: Optional[str] = None, - release_note_uri: Optional[str] = None, - os_type: Optional[Union[str, "_models.OperatingSystemTypes"]] = None, - os_state: Optional[Union[str, "_models.OperatingSystemStateTypes"]] = None, - hyper_v_generation: Optional[Union[str, "_models.HyperVGeneration"]] = None, - end_of_life_date: Optional[datetime.datetime] = None, - identifier: Optional["_models.GalleryImageIdentifier"] = None, - recommended: Optional["_models.RecommendedMachineConfiguration"] = None, - disallowed: Optional["_models.Disallowed"] = None, - purchase_plan: Optional["_models.ImagePurchasePlan"] = None, - features: Optional[list["_models.GalleryImageFeature"]] = None, - architecture: Optional[Union[str, "_models.Architecture"]] = None, - allow_update_image: Optional[bool] = None, - **kwargs: Any - ) -> None: - """ - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - :keyword location: The geo-location where the resource lives. Required. - :paramtype location: str - :keyword description: The description of this gallery image definition resource. This property - is updatable. - :paramtype description: str - :keyword eula: The Eula agreement for the gallery image definition. - :paramtype eula: str - :keyword privacy_statement_uri: The privacy statement uri. - :paramtype privacy_statement_uri: str - :keyword release_note_uri: The release note uri. - :paramtype release_note_uri: str - :keyword os_type: This property allows you to specify the type of the OS that is included in - the disk when creating a VM from a managed image. Possible values are: **Windows,** **Linux.**. - Known values are: "Windows" and "Linux". - :paramtype os_type: str or ~azure.mgmt.compute.models.OperatingSystemTypes - :keyword os_state: This property allows the user to specify whether the virtual machines - created under this image are 'Generalized' or 'Specialized'. Known values are: "Generalized" - and "Specialized". - :paramtype os_state: str or ~azure.mgmt.compute.models.OperatingSystemStateTypes - :keyword hyper_v_generation: The hypervisor generation of the Virtual Machine. Applicable to OS - disks only. Known values are: "V1" and "V2". - :paramtype hyper_v_generation: str or ~azure.mgmt.compute.models.HyperVGeneration - :keyword end_of_life_date: The end of life date of the gallery image definition. This property - can be used for decommissioning purposes. This property is updatable. - :paramtype end_of_life_date: ~datetime.datetime - :keyword identifier: This is the gallery image definition identifier. - :paramtype identifier: ~azure.mgmt.compute.models.GalleryImageIdentifier - :keyword recommended: The properties describe the recommended machine configuration for this - Image Definition. These properties are updatable. - :paramtype recommended: ~azure.mgmt.compute.models.RecommendedMachineConfiguration - :keyword disallowed: Describes the disallowed disk types. - :paramtype disallowed: ~azure.mgmt.compute.models.Disallowed - :keyword purchase_plan: Describes the gallery image definition purchase plan. This is used by - marketplace images. - :paramtype purchase_plan: ~azure.mgmt.compute.models.ImagePurchasePlan - :keyword features: A list of gallery image features. - :paramtype features: list[~azure.mgmt.compute.models.GalleryImageFeature] - :keyword architecture: The architecture of the image. Applicable to OS disks only. Known values - are: "x64" and "Arm64". - :paramtype architecture: str or ~azure.mgmt.compute.models.Architecture - :keyword allow_update_image: Optional. Must be set to true if the gallery image features are - being updated. - :paramtype allow_update_image: bool - """ - super().__init__(tags=tags, location=location, **kwargs) - self.description = description - self.eula = eula - self.privacy_statement_uri = privacy_statement_uri - self.release_note_uri = release_note_uri - self.os_type = os_type - self.os_state = os_state - self.hyper_v_generation = hyper_v_generation - self.end_of_life_date = end_of_life_date - self.identifier = identifier - self.recommended = recommended - self.disallowed = disallowed - self.purchase_plan = purchase_plan - self.provisioning_state: Optional[Union[str, "_models.GalleryProvisioningState"]] = None - self.features = features - self.architecture = architecture - self.allow_update_image = allow_update_image - - -class GalleryImageFeature(_serialization.Model): - """A feature for gallery image. - - :ivar name: The name of the gallery image feature. - :vartype name: str - :ivar value: The value of the gallery image feature. - :vartype value: str - :ivar starts_at_version: The minimum gallery image version which supports this feature. - :vartype starts_at_version: str - """ - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "value": {"key": "value", "type": "str"}, - "starts_at_version": {"key": "startsAtVersion", "type": "str"}, - } - - def __init__( - self, - *, - name: Optional[str] = None, - value: Optional[str] = None, - starts_at_version: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword name: The name of the gallery image feature. - :paramtype name: str - :keyword value: The value of the gallery image feature. - :paramtype value: str - :keyword starts_at_version: The minimum gallery image version which supports this feature. - :paramtype starts_at_version: str - """ - super().__init__(**kwargs) - self.name = name - self.value = value - self.starts_at_version = starts_at_version - - -class GalleryImageIdentifier(_serialization.Model): - """This is the gallery image definition identifier. - - All required parameters must be populated in order to send to server. - - :ivar publisher: The name of the gallery image definition publisher. Required. - :vartype publisher: str - :ivar offer: The name of the gallery image definition offer. Required. - :vartype offer: str - :ivar sku: The name of the gallery image definition SKU. Required. - :vartype sku: str - """ - - _validation = { - "publisher": {"required": True}, - "offer": {"required": True}, - "sku": {"required": True}, - } - - _attribute_map = { - "publisher": {"key": "publisher", "type": "str"}, - "offer": {"key": "offer", "type": "str"}, - "sku": {"key": "sku", "type": "str"}, - } - - def __init__(self, *, publisher: str, offer: str, sku: str, **kwargs: Any) -> None: - """ - :keyword publisher: The name of the gallery image definition publisher. Required. - :paramtype publisher: str - :keyword offer: The name of the gallery image definition offer. Required. - :paramtype offer: str - :keyword sku: The name of the gallery image definition SKU. Required. - :paramtype sku: str - """ - super().__init__(**kwargs) - self.publisher = publisher - self.offer = offer - self.sku = sku - - -class GalleryImageList(_serialization.Model): - """The List Gallery Images operation response. - - All required parameters must be populated in order to send to server. - - :ivar value: A list of Shared Image Gallery images. Required. - :vartype value: list[~azure.mgmt.compute.models.GalleryImage] - :ivar next_link: The uri to fetch the next page of Image Definitions in the Shared Image - Gallery. Call ListNext() with this to fetch the next page of gallery image definitions. - :vartype next_link: str - """ - - _validation = { - "value": {"required": True}, - } - - _attribute_map = { - "value": {"key": "value", "type": "[GalleryImage]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__(self, *, value: list["_models.GalleryImage"], next_link: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword value: A list of Shared Image Gallery images. Required. - :paramtype value: list[~azure.mgmt.compute.models.GalleryImage] - :keyword next_link: The uri to fetch the next page of Image Definitions in the Shared Image - Gallery. Call ListNext() with this to fetch the next page of gallery image definitions. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class GalleryImageUpdate(UpdateResourceDefinition): - """Specifies information about the gallery image definition that you want to update. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Resource Id. - :vartype id: str - :ivar name: Resource name. - :vartype name: str - :ivar type: Resource type. - :vartype type: str - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - :ivar description: The description of this gallery image definition resource. This property is - updatable. - :vartype description: str - :ivar eula: The Eula agreement for the gallery image definition. - :vartype eula: str - :ivar privacy_statement_uri: The privacy statement uri. - :vartype privacy_statement_uri: str - :ivar release_note_uri: The release note uri. - :vartype release_note_uri: str - :ivar os_type: This property allows you to specify the type of the OS that is included in the - disk when creating a VM from a managed image. Possible values are: **Windows,** **Linux.**. - Known values are: "Windows" and "Linux". - :vartype os_type: str or ~azure.mgmt.compute.models.OperatingSystemTypes - :ivar os_state: This property allows the user to specify whether the virtual machines created - under this image are 'Generalized' or 'Specialized'. Known values are: "Generalized" and - "Specialized". - :vartype os_state: str or ~azure.mgmt.compute.models.OperatingSystemStateTypes - :ivar hyper_v_generation: The hypervisor generation of the Virtual Machine. Applicable to OS - disks only. Known values are: "V1" and "V2". - :vartype hyper_v_generation: str or ~azure.mgmt.compute.models.HyperVGeneration - :ivar end_of_life_date: The end of life date of the gallery image definition. This property can - be used for decommissioning purposes. This property is updatable. - :vartype end_of_life_date: ~datetime.datetime - :ivar identifier: This is the gallery image definition identifier. - :vartype identifier: ~azure.mgmt.compute.models.GalleryImageIdentifier - :ivar recommended: The properties describe the recommended machine configuration for this Image - Definition. These properties are updatable. - :vartype recommended: ~azure.mgmt.compute.models.RecommendedMachineConfiguration - :ivar disallowed: Describes the disallowed disk types. - :vartype disallowed: ~azure.mgmt.compute.models.Disallowed - :ivar purchase_plan: Describes the gallery image definition purchase plan. This is used by - marketplace images. - :vartype purchase_plan: ~azure.mgmt.compute.models.ImagePurchasePlan - :ivar provisioning_state: The provisioning state, which only appears in the response. Known - values are: "Creating", "Updating", "Failed", "Succeeded", "Deleting", and "Migrating". - :vartype provisioning_state: str or ~azure.mgmt.compute.models.GalleryProvisioningState - :ivar features: A list of gallery image features. - :vartype features: list[~azure.mgmt.compute.models.GalleryImageFeature] - :ivar architecture: The architecture of the image. Applicable to OS disks only. Known values - are: "x64" and "Arm64". - :vartype architecture: str or ~azure.mgmt.compute.models.Architecture - :ivar allow_update_image: Optional. Must be set to true if the gallery image features are being - updated. - :vartype allow_update_image: bool - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "provisioning_state": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "tags": {"key": "tags", "type": "{str}"}, - "description": {"key": "properties.description", "type": "str"}, - "eula": {"key": "properties.eula", "type": "str"}, - "privacy_statement_uri": {"key": "properties.privacyStatementUri", "type": "str"}, - "release_note_uri": {"key": "properties.releaseNoteUri", "type": "str"}, - "os_type": {"key": "properties.osType", "type": "str"}, - "os_state": {"key": "properties.osState", "type": "str"}, - "hyper_v_generation": {"key": "properties.hyperVGeneration", "type": "str"}, - "end_of_life_date": {"key": "properties.endOfLifeDate", "type": "iso-8601"}, - "identifier": {"key": "properties.identifier", "type": "GalleryImageIdentifier"}, - "recommended": {"key": "properties.recommended", "type": "RecommendedMachineConfiguration"}, - "disallowed": {"key": "properties.disallowed", "type": "Disallowed"}, - "purchase_plan": {"key": "properties.purchasePlan", "type": "ImagePurchasePlan"}, - "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, - "features": {"key": "properties.features", "type": "[GalleryImageFeature]"}, - "architecture": {"key": "properties.architecture", "type": "str"}, - "allow_update_image": {"key": "properties.allowUpdateImage", "type": "bool"}, - } - - def __init__( - self, - *, - tags: Optional[dict[str, str]] = None, - description: Optional[str] = None, - eula: Optional[str] = None, - privacy_statement_uri: Optional[str] = None, - release_note_uri: Optional[str] = None, - os_type: Optional[Union[str, "_models.OperatingSystemTypes"]] = None, - os_state: Optional[Union[str, "_models.OperatingSystemStateTypes"]] = None, - hyper_v_generation: Optional[Union[str, "_models.HyperVGeneration"]] = None, - end_of_life_date: Optional[datetime.datetime] = None, - identifier: Optional["_models.GalleryImageIdentifier"] = None, - recommended: Optional["_models.RecommendedMachineConfiguration"] = None, - disallowed: Optional["_models.Disallowed"] = None, - purchase_plan: Optional["_models.ImagePurchasePlan"] = None, - features: Optional[list["_models.GalleryImageFeature"]] = None, - architecture: Optional[Union[str, "_models.Architecture"]] = None, - allow_update_image: Optional[bool] = None, - **kwargs: Any - ) -> None: - """ - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - :keyword description: The description of this gallery image definition resource. This property - is updatable. - :paramtype description: str - :keyword eula: The Eula agreement for the gallery image definition. - :paramtype eula: str - :keyword privacy_statement_uri: The privacy statement uri. - :paramtype privacy_statement_uri: str - :keyword release_note_uri: The release note uri. - :paramtype release_note_uri: str - :keyword os_type: This property allows you to specify the type of the OS that is included in - the disk when creating a VM from a managed image. Possible values are: **Windows,** **Linux.**. - Known values are: "Windows" and "Linux". - :paramtype os_type: str or ~azure.mgmt.compute.models.OperatingSystemTypes - :keyword os_state: This property allows the user to specify whether the virtual machines - created under this image are 'Generalized' or 'Specialized'. Known values are: "Generalized" - and "Specialized". - :paramtype os_state: str or ~azure.mgmt.compute.models.OperatingSystemStateTypes - :keyword hyper_v_generation: The hypervisor generation of the Virtual Machine. Applicable to OS - disks only. Known values are: "V1" and "V2". - :paramtype hyper_v_generation: str or ~azure.mgmt.compute.models.HyperVGeneration - :keyword end_of_life_date: The end of life date of the gallery image definition. This property - can be used for decommissioning purposes. This property is updatable. - :paramtype end_of_life_date: ~datetime.datetime - :keyword identifier: This is the gallery image definition identifier. - :paramtype identifier: ~azure.mgmt.compute.models.GalleryImageIdentifier - :keyword recommended: The properties describe the recommended machine configuration for this - Image Definition. These properties are updatable. - :paramtype recommended: ~azure.mgmt.compute.models.RecommendedMachineConfiguration - :keyword disallowed: Describes the disallowed disk types. - :paramtype disallowed: ~azure.mgmt.compute.models.Disallowed - :keyword purchase_plan: Describes the gallery image definition purchase plan. This is used by - marketplace images. - :paramtype purchase_plan: ~azure.mgmt.compute.models.ImagePurchasePlan - :keyword features: A list of gallery image features. - :paramtype features: list[~azure.mgmt.compute.models.GalleryImageFeature] - :keyword architecture: The architecture of the image. Applicable to OS disks only. Known values - are: "x64" and "Arm64". - :paramtype architecture: str or ~azure.mgmt.compute.models.Architecture - :keyword allow_update_image: Optional. Must be set to true if the gallery image features are - being updated. - :paramtype allow_update_image: bool - """ - super().__init__(tags=tags, **kwargs) - self.description = description - self.eula = eula - self.privacy_statement_uri = privacy_statement_uri - self.release_note_uri = release_note_uri - self.os_type = os_type - self.os_state = os_state - self.hyper_v_generation = hyper_v_generation - self.end_of_life_date = end_of_life_date - self.identifier = identifier - self.recommended = recommended - self.disallowed = disallowed - self.purchase_plan = purchase_plan - self.provisioning_state: Optional[Union[str, "_models.GalleryProvisioningState"]] = None - self.features = features - self.architecture = architecture - self.allow_update_image = allow_update_image - - -class GalleryImageVersion(TrackedResource): - """Specifies information about the gallery image version that you want to create or update. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to server. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.compute.models.SystemData - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - :ivar location: The geo-location where the resource lives. Required. - :vartype location: str - :ivar publishing_profile: The publishing profile of a gallery image Version. - :vartype publishing_profile: ~azure.mgmt.compute.models.GalleryImageVersionPublishingProfile - :ivar provisioning_state: The provisioning state, which only appears in the response. Known - values are: "Creating", "Updating", "Failed", "Succeeded", "Deleting", and "Migrating". - :vartype provisioning_state: str or ~azure.mgmt.compute.models.GalleryProvisioningState - :ivar storage_profile: This is the storage profile of a Gallery Image Version. - :vartype storage_profile: ~azure.mgmt.compute.models.GalleryImageVersionStorageProfile - :ivar safety_profile: This is the safety profile of the Gallery Image Version. - :vartype safety_profile: ~azure.mgmt.compute.models.GalleryImageVersionSafetyProfile - :ivar replication_status: This is the replication status of the gallery image version. - :vartype replication_status: ~azure.mgmt.compute.models.ReplicationStatus - :ivar security_profile: The security profile of a gallery image version. - :vartype security_profile: ~azure.mgmt.compute.models.ImageVersionSecurityProfile - :ivar restore: Indicates if this is a soft-delete resource restoration request. - :vartype restore: bool - :ivar validations_profile: This is the validations profile of a Gallery Image Version. - :vartype validations_profile: ~azure.mgmt.compute.models.ValidationsProfile - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, - "location": {"required": True}, - "provisioning_state": {"readonly": True}, - "replication_status": {"readonly": True}, - "validations_profile": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - "tags": {"key": "tags", "type": "{str}"}, - "location": {"key": "location", "type": "str"}, - "publishing_profile": {"key": "properties.publishingProfile", "type": "GalleryImageVersionPublishingProfile"}, - "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, - "storage_profile": {"key": "properties.storageProfile", "type": "GalleryImageVersionStorageProfile"}, - "safety_profile": {"key": "properties.safetyProfile", "type": "GalleryImageVersionSafetyProfile"}, - "replication_status": {"key": "properties.replicationStatus", "type": "ReplicationStatus"}, - "security_profile": {"key": "properties.securityProfile", "type": "ImageVersionSecurityProfile"}, - "restore": {"key": "properties.restore", "type": "bool"}, - "validations_profile": {"key": "properties.validationsProfile", "type": "ValidationsProfile"}, - } - - def __init__( - self, - *, - location: str, - tags: Optional[dict[str, str]] = None, - publishing_profile: Optional["_models.GalleryImageVersionPublishingProfile"] = None, - storage_profile: Optional["_models.GalleryImageVersionStorageProfile"] = None, - safety_profile: Optional["_models.GalleryImageVersionSafetyProfile"] = None, - security_profile: Optional["_models.ImageVersionSecurityProfile"] = None, - restore: Optional[bool] = None, - **kwargs: Any - ) -> None: - """ - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - :keyword location: The geo-location where the resource lives. Required. - :paramtype location: str - :keyword publishing_profile: The publishing profile of a gallery image Version. - :paramtype publishing_profile: ~azure.mgmt.compute.models.GalleryImageVersionPublishingProfile - :keyword storage_profile: This is the storage profile of a Gallery Image Version. - :paramtype storage_profile: ~azure.mgmt.compute.models.GalleryImageVersionStorageProfile - :keyword safety_profile: This is the safety profile of the Gallery Image Version. - :paramtype safety_profile: ~azure.mgmt.compute.models.GalleryImageVersionSafetyProfile - :keyword security_profile: The security profile of a gallery image version. - :paramtype security_profile: ~azure.mgmt.compute.models.ImageVersionSecurityProfile - :keyword restore: Indicates if this is a soft-delete resource restoration request. - :paramtype restore: bool - """ - super().__init__(tags=tags, location=location, **kwargs) - self.publishing_profile = publishing_profile - self.provisioning_state: Optional[Union[str, "_models.GalleryProvisioningState"]] = None - self.storage_profile = storage_profile - self.safety_profile = safety_profile - self.replication_status: Optional["_models.ReplicationStatus"] = None - self.security_profile = security_profile - self.restore = restore - self.validations_profile: Optional["_models.ValidationsProfile"] = None - - -class GalleryImageVersionList(_serialization.Model): - """The List Gallery Image version operation response. - - All required parameters must be populated in order to send to server. - - :ivar value: A list of gallery image versions. Required. - :vartype value: list[~azure.mgmt.compute.models.GalleryImageVersion] - :ivar next_link: The uri to fetch the next page of gallery image versions. Call ListNext() with - this to fetch the next page of gallery image versions. - :vartype next_link: str - """ - - _validation = { - "value": {"required": True}, - } - - _attribute_map = { - "value": {"key": "value", "type": "[GalleryImageVersion]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, *, value: list["_models.GalleryImageVersion"], next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: A list of gallery image versions. Required. - :paramtype value: list[~azure.mgmt.compute.models.GalleryImageVersion] - :keyword next_link: The uri to fetch the next page of gallery image versions. Call ListNext() - with this to fetch the next page of gallery image versions. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class GalleryImageVersionPublishingProfile(GalleryArtifactPublishingProfileBase): - """The publishing profile of a gallery image Version. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar target_regions: The target regions where the Image Version is going to be replicated to. - This property is updatable. - :vartype target_regions: list[~azure.mgmt.compute.models.TargetRegion] - :ivar replica_count: The number of replicas of the Image Version to be created per region. This - property would take effect for a region when regionalReplicaCount is not specified. This - property is updatable. - :vartype replica_count: int - :ivar exclude_from_latest: If set to true, Virtual Machines deployed from the latest version of - the Image Definition won't use this Image Version. - :vartype exclude_from_latest: bool - :ivar published_date: The timestamp for when the gallery image version is published. - :vartype published_date: ~datetime.datetime - :ivar end_of_life_date: The end of life date of the gallery image version. This property can be - used for decommissioning purposes. This property is updatable. - :vartype end_of_life_date: ~datetime.datetime - :ivar storage_account_type: Specifies the storage account type to be used to store the image. - This property is not updatable. Known values are: "Standard_LRS", "Standard_ZRS", - "Premium_LRS", and "PremiumV2_LRS". - :vartype storage_account_type: str or ~azure.mgmt.compute.models.StorageAccountType - :ivar replication_mode: Optional parameter which specifies the mode to be used for replication. - This property is not updatable. Known values are: "Full" and "Shallow". - :vartype replication_mode: str or ~azure.mgmt.compute.models.ReplicationMode - :ivar target_extended_locations: The target extended locations where the Image Version is going - to be replicated to. This property is updatable. - :vartype target_extended_locations: - list[~azure.mgmt.compute.models.GalleryTargetExtendedLocation] - """ - - -class GalleryImageVersionSafetyProfile(GalleryArtifactSafetyProfileBase): - """This is the safety profile of the Gallery Image Version. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar allow_deletion_of_replicated_locations: Indicates whether or not removing this Gallery - Image Version from replicated regions is allowed. - :vartype allow_deletion_of_replicated_locations: bool - :ivar reported_for_policy_violation: Indicates whether this image has been reported as - violating Microsoft's policies. - :vartype reported_for_policy_violation: bool - :ivar policy_violations: A list of Policy Violations that have been reported for this Gallery - Image Version. - :vartype policy_violations: list[~azure.mgmt.compute.models.PolicyViolation] - :ivar block_deletion_before_end_of_life: Indicates whether or not the deletion is blocked for - this Gallery Image Version if its End Of Life has not expired. - :vartype block_deletion_before_end_of_life: bool - """ - - _validation = { - "reported_for_policy_violation": {"readonly": True}, - "policy_violations": {"readonly": True}, - } - - _attribute_map = { - "allow_deletion_of_replicated_locations": {"key": "allowDeletionOfReplicatedLocations", "type": "bool"}, - "reported_for_policy_violation": {"key": "reportedForPolicyViolation", "type": "bool"}, - "policy_violations": {"key": "policyViolations", "type": "[PolicyViolation]"}, - "block_deletion_before_end_of_life": {"key": "blockDeletionBeforeEndOfLife", "type": "bool"}, - } - - def __init__( - self, - *, - allow_deletion_of_replicated_locations: Optional[bool] = None, - block_deletion_before_end_of_life: Optional[bool] = None, - **kwargs: Any - ) -> None: - """ - :keyword allow_deletion_of_replicated_locations: Indicates whether or not removing this Gallery - Image Version from replicated regions is allowed. - :paramtype allow_deletion_of_replicated_locations: bool - :keyword block_deletion_before_end_of_life: Indicates whether or not the deletion is blocked - for this Gallery Image Version if its End Of Life has not expired. - :paramtype block_deletion_before_end_of_life: bool - """ - super().__init__(allow_deletion_of_replicated_locations=allow_deletion_of_replicated_locations, **kwargs) - self.reported_for_policy_violation: Optional[bool] = None - self.policy_violations: Optional[list["_models.PolicyViolation"]] = None - self.block_deletion_before_end_of_life = block_deletion_before_end_of_life - - -class GalleryImageVersionStorageProfile(_serialization.Model): - """This is the storage profile of a Gallery Image Version. - - :ivar source: The source of the gallery artifact version. - :vartype source: ~azure.mgmt.compute.models.GalleryArtifactVersionFullSource - :ivar os_disk_image: This is the OS disk image. - :vartype os_disk_image: ~azure.mgmt.compute.models.GalleryOSDiskImage - :ivar data_disk_images: A list of data disk images. - :vartype data_disk_images: list[~azure.mgmt.compute.models.GalleryDataDiskImage] - """ - - _attribute_map = { - "source": {"key": "source", "type": "GalleryArtifactVersionFullSource"}, - "os_disk_image": {"key": "osDiskImage", "type": "GalleryOSDiskImage"}, - "data_disk_images": {"key": "dataDiskImages", "type": "[GalleryDataDiskImage]"}, - } - - def __init__( - self, - *, - source: Optional["_models.GalleryArtifactVersionFullSource"] = None, - os_disk_image: Optional["_models.GalleryOSDiskImage"] = None, - data_disk_images: Optional[list["_models.GalleryDataDiskImage"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword source: The source of the gallery artifact version. - :paramtype source: ~azure.mgmt.compute.models.GalleryArtifactVersionFullSource - :keyword os_disk_image: This is the OS disk image. - :paramtype os_disk_image: ~azure.mgmt.compute.models.GalleryOSDiskImage - :keyword data_disk_images: A list of data disk images. - :paramtype data_disk_images: list[~azure.mgmt.compute.models.GalleryDataDiskImage] - """ - super().__init__(**kwargs) - self.source = source - self.os_disk_image = os_disk_image - self.data_disk_images = data_disk_images - - -class GalleryImageVersionUefiSettings(_serialization.Model): - """Contains UEFI settings for the image version. - - :ivar signature_template_names: The name of the template(s) that contains default UEFI key - signatures that will be added to the image. - :vartype signature_template_names: list[str or - ~azure.mgmt.compute.models.UefiSignatureTemplateName] - :ivar additional_signatures: Additional UEFI key signatures that will be added to the image in - addition to the signature templates. - :vartype additional_signatures: ~azure.mgmt.compute.models.UefiKeySignatures - """ - - _attribute_map = { - "signature_template_names": {"key": "signatureTemplateNames", "type": "[str]"}, - "additional_signatures": {"key": "additionalSignatures", "type": "UefiKeySignatures"}, - } - - def __init__( - self, - *, - signature_template_names: Optional[list[Union[str, "_models.UefiSignatureTemplateName"]]] = None, - additional_signatures: Optional["_models.UefiKeySignatures"] = None, - **kwargs: Any - ) -> None: - """ - :keyword signature_template_names: The name of the template(s) that contains default UEFI key - signatures that will be added to the image. - :paramtype signature_template_names: list[str or - ~azure.mgmt.compute.models.UefiSignatureTemplateName] - :keyword additional_signatures: Additional UEFI key signatures that will be added to the image - in addition to the signature templates. - :paramtype additional_signatures: ~azure.mgmt.compute.models.UefiKeySignatures - """ - super().__init__(**kwargs) - self.signature_template_names = signature_template_names - self.additional_signatures = additional_signatures - - -class GalleryImageVersionUpdate(UpdateResourceDefinition): - """Specifies information about the gallery image version that you want to update. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Resource Id. - :vartype id: str - :ivar name: Resource name. - :vartype name: str - :ivar type: Resource type. - :vartype type: str - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - :ivar publishing_profile: The publishing profile of a gallery image Version. - :vartype publishing_profile: ~azure.mgmt.compute.models.GalleryImageVersionPublishingProfile - :ivar provisioning_state: The provisioning state, which only appears in the response. Known - values are: "Creating", "Updating", "Failed", "Succeeded", "Deleting", and "Migrating". - :vartype provisioning_state: str or ~azure.mgmt.compute.models.GalleryProvisioningState - :ivar storage_profile: This is the storage profile of a Gallery Image Version. - :vartype storage_profile: ~azure.mgmt.compute.models.GalleryImageVersionStorageProfile - :ivar safety_profile: This is the safety profile of the Gallery Image Version. - :vartype safety_profile: ~azure.mgmt.compute.models.GalleryImageVersionSafetyProfile - :ivar replication_status: This is the replication status of the gallery image version. - :vartype replication_status: ~azure.mgmt.compute.models.ReplicationStatus - :ivar security_profile: The security profile of a gallery image version. - :vartype security_profile: ~azure.mgmt.compute.models.ImageVersionSecurityProfile - :ivar restore: Indicates if this is a soft-delete resource restoration request. - :vartype restore: bool - :ivar validations_profile: This is the validations profile of a Gallery Image Version. - :vartype validations_profile: ~azure.mgmt.compute.models.ValidationsProfile - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "provisioning_state": {"readonly": True}, - "replication_status": {"readonly": True}, - "validations_profile": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "tags": {"key": "tags", "type": "{str}"}, - "publishing_profile": {"key": "properties.publishingProfile", "type": "GalleryImageVersionPublishingProfile"}, - "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, - "storage_profile": {"key": "properties.storageProfile", "type": "GalleryImageVersionStorageProfile"}, - "safety_profile": {"key": "properties.safetyProfile", "type": "GalleryImageVersionSafetyProfile"}, - "replication_status": {"key": "properties.replicationStatus", "type": "ReplicationStatus"}, - "security_profile": {"key": "properties.securityProfile", "type": "ImageVersionSecurityProfile"}, - "restore": {"key": "properties.restore", "type": "bool"}, - "validations_profile": {"key": "properties.validationsProfile", "type": "ValidationsProfile"}, - } - - def __init__( - self, - *, - tags: Optional[dict[str, str]] = None, - publishing_profile: Optional["_models.GalleryImageVersionPublishingProfile"] = None, - storage_profile: Optional["_models.GalleryImageVersionStorageProfile"] = None, - safety_profile: Optional["_models.GalleryImageVersionSafetyProfile"] = None, - security_profile: Optional["_models.ImageVersionSecurityProfile"] = None, - restore: Optional[bool] = None, - **kwargs: Any - ) -> None: - """ - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - :keyword publishing_profile: The publishing profile of a gallery image Version. - :paramtype publishing_profile: ~azure.mgmt.compute.models.GalleryImageVersionPublishingProfile - :keyword storage_profile: This is the storage profile of a Gallery Image Version. - :paramtype storage_profile: ~azure.mgmt.compute.models.GalleryImageVersionStorageProfile - :keyword safety_profile: This is the safety profile of the Gallery Image Version. - :paramtype safety_profile: ~azure.mgmt.compute.models.GalleryImageVersionSafetyProfile - :keyword security_profile: The security profile of a gallery image version. - :paramtype security_profile: ~azure.mgmt.compute.models.ImageVersionSecurityProfile - :keyword restore: Indicates if this is a soft-delete resource restoration request. - :paramtype restore: bool - """ - super().__init__(tags=tags, **kwargs) - self.publishing_profile = publishing_profile - self.provisioning_state: Optional[Union[str, "_models.GalleryProvisioningState"]] = None - self.storage_profile = storage_profile - self.safety_profile = safety_profile - self.replication_status: Optional["_models.ReplicationStatus"] = None - self.security_profile = security_profile - self.restore = restore - self.validations_profile: Optional["_models.ValidationsProfile"] = None - - -class GalleryInVMAccessControlProfile(TrackedResource): - """Specifies information about the gallery inVMAccessControlProfile that you want to create or - update. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to server. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.compute.models.SystemData - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - :ivar location: The geo-location where the resource lives. Required. - :vartype location: str - :ivar properties: Describes the properties of a gallery inVMAccessControlProfile. - :vartype properties: ~azure.mgmt.compute.models.GalleryInVMAccessControlProfileProperties - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, - "location": {"required": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - "tags": {"key": "tags", "type": "{str}"}, - "location": {"key": "location", "type": "str"}, - "properties": {"key": "properties", "type": "GalleryInVMAccessControlProfileProperties"}, - } - - def __init__( - self, - *, - location: str, - tags: Optional[dict[str, str]] = None, - properties: Optional["_models.GalleryInVMAccessControlProfileProperties"] = None, - **kwargs: Any - ) -> None: - """ - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - :keyword location: The geo-location where the resource lives. Required. - :paramtype location: str - :keyword properties: Describes the properties of a gallery inVMAccessControlProfile. - :paramtype properties: ~azure.mgmt.compute.models.GalleryInVMAccessControlProfileProperties - """ - super().__init__(tags=tags, location=location, **kwargs) - self.properties = properties - - -class GalleryInVMAccessControlProfileList(_serialization.Model): - """The List Gallery InVMAccessControlProfiles operation response. - - All required parameters must be populated in order to send to server. - - :ivar value: The GalleryInVMAccessControlProfile items on this page. Required. - :vartype value: list[~azure.mgmt.compute.models.GalleryInVMAccessControlProfile] - :ivar next_link: The link to the next page of items. - :vartype next_link: str - """ - - _validation = { - "value": {"required": True}, - } - - _attribute_map = { - "value": {"key": "value", "type": "[GalleryInVMAccessControlProfile]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, *, value: list["_models.GalleryInVMAccessControlProfile"], next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: The GalleryInVMAccessControlProfile items on this page. Required. - :paramtype value: list[~azure.mgmt.compute.models.GalleryInVMAccessControlProfile] - :keyword next_link: The link to the next page of items. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class GalleryResourceProfilePropertiesBase(_serialization.Model): - """The properties of a gallery ResourceProfile. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar provisioning_state: The provisioning state, which only appears in the response. Known - values are: "Creating", "Updating", "Failed", "Succeeded", "Deleting", and "Migrating". - :vartype provisioning_state: str or ~azure.mgmt.compute.models.GalleryProvisioningState - """ - - _validation = { - "provisioning_state": {"readonly": True}, - } - - _attribute_map = { - "provisioning_state": {"key": "provisioningState", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.provisioning_state: Optional[Union[str, "_models.GalleryProvisioningState"]] = None - - -class GalleryInVMAccessControlProfileProperties(GalleryResourceProfilePropertiesBase): # pylint: disable=name-too-long - """Describes the properties of a gallery inVMAccessControlProfile. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to server. - - :ivar provisioning_state: The provisioning state, which only appears in the response. Known - values are: "Creating", "Updating", "Failed", "Succeeded", "Deleting", and "Migrating". - :vartype provisioning_state: str or ~azure.mgmt.compute.models.GalleryProvisioningState - :ivar description: The description of this gallery inVMAccessControlProfile resources. This - property is updatable. - :vartype description: str - :ivar os_type: This property allows you to specify the OS type of the VMs/VMSS for which this - profile can be used against. Possible values are: 'Windows' or 'Linux'. Required. Known values - are: "Windows" and "Linux". - :vartype os_type: str or ~azure.mgmt.compute.models.OperatingSystemTypes - :ivar applicable_host_endpoint: This property allows you to specify the Endpoint type for which - this profile is defining the access control for. Possible values are: 'WireServer' or 'IMDS'. - Required. Known values are: "WireServer" and "IMDS". - :vartype applicable_host_endpoint: str or ~azure.mgmt.compute.models.EndpointTypes - """ - - _validation = { - "provisioning_state": {"readonly": True}, - "os_type": {"required": True}, - "applicable_host_endpoint": {"required": True}, - } - - _attribute_map = { - "provisioning_state": {"key": "provisioningState", "type": "str"}, - "description": {"key": "description", "type": "str"}, - "os_type": {"key": "osType", "type": "str"}, - "applicable_host_endpoint": {"key": "applicableHostEndpoint", "type": "str"}, - } - - def __init__( - self, - *, - os_type: Union[str, "_models.OperatingSystemTypes"], - applicable_host_endpoint: Union[str, "_models.EndpointTypes"], - description: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword description: The description of this gallery inVMAccessControlProfile resources. This - property is updatable. - :paramtype description: str - :keyword os_type: This property allows you to specify the OS type of the VMs/VMSS for which - this profile can be used against. Possible values are: 'Windows' or 'Linux'. Required. Known - values are: "Windows" and "Linux". - :paramtype os_type: str or ~azure.mgmt.compute.models.OperatingSystemTypes - :keyword applicable_host_endpoint: This property allows you to specify the Endpoint type for - which this profile is defining the access control for. Possible values are: 'WireServer' or - 'IMDS'. Required. Known values are: "WireServer" and "IMDS". - :paramtype applicable_host_endpoint: str or ~azure.mgmt.compute.models.EndpointTypes - """ - super().__init__(**kwargs) - self.description = description - self.os_type = os_type - self.applicable_host_endpoint = applicable_host_endpoint - - -class GalleryInVMAccessControlProfileUpdate(UpdateResourceDefinition): - """Specifies information about the gallery inVMAccessControlProfile that you want to update. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Resource Id. - :vartype id: str - :ivar name: Resource name. - :vartype name: str - :ivar type: Resource type. - :vartype type: str - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - :ivar properties: Describes the properties of a gallery inVMAccessControlProfile. - :vartype properties: ~azure.mgmt.compute.models.GalleryInVMAccessControlProfileProperties - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "tags": {"key": "tags", "type": "{str}"}, - "properties": {"key": "properties", "type": "GalleryInVMAccessControlProfileProperties"}, - } - - def __init__( - self, - *, - tags: Optional[dict[str, str]] = None, - properties: Optional["_models.GalleryInVMAccessControlProfileProperties"] = None, - **kwargs: Any - ) -> None: - """ - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - :keyword properties: Describes the properties of a gallery inVMAccessControlProfile. - :paramtype properties: ~azure.mgmt.compute.models.GalleryInVMAccessControlProfileProperties - """ - super().__init__(tags=tags, **kwargs) - self.properties = properties - - -class GalleryInVMAccessControlProfileVersion(TrackedResource): - """Specifies information about the gallery inVMAccessControlProfile version that you want to - create or update. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to server. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.compute.models.SystemData - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - :ivar location: The geo-location where the resource lives. Required. - :vartype location: str - :ivar target_locations: The target regions where the Resource Profile version is going to be - replicated to. This property is updatable. - :vartype target_locations: list[~azure.mgmt.compute.models.TargetRegion] - :ivar exclude_from_latest: If set to true, Virtual Machines deployed from the latest version of - the Resource Profile won't use this Profile version. - :vartype exclude_from_latest: bool - :ivar published_date: The timestamp for when the Resource Profile Version is published. - :vartype published_date: ~datetime.datetime - :ivar provisioning_state: The provisioning state, which only appears in the response. Known - values are: "Creating", "Updating", "Failed", "Succeeded", "Deleting", and "Migrating". - :vartype provisioning_state: str or ~azure.mgmt.compute.models.GalleryProvisioningState - :ivar replication_status: This is the replication status of the gallery image version. - :vartype replication_status: ~azure.mgmt.compute.models.ReplicationStatus - :ivar mode: This property allows you to specify whether the access control rules are in Audit - mode, in Enforce mode or Disabled. Possible values are: 'Audit', 'Enforce' or 'Disabled'. Known - values are: "Audit", "Enforce", and "Disabled". - :vartype mode: str or ~azure.mgmt.compute.models.AccessControlRulesMode - :ivar default_access: This property allows you to specify if the requests will be allowed to - access the host endpoints. Possible values are: 'Allow', 'Deny'. Known values are: "Allow" and - "Deny". - :vartype default_access: str or ~azure.mgmt.compute.models.EndpointAccess - :ivar rules: This is the Access Control Rules specification for an inVMAccessControlProfile - version. - :vartype rules: ~azure.mgmt.compute.models.AccessControlRules - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, - "location": {"required": True}, - "published_date": {"readonly": True}, - "provisioning_state": {"readonly": True}, - "replication_status": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - "tags": {"key": "tags", "type": "{str}"}, - "location": {"key": "location", "type": "str"}, - "target_locations": {"key": "properties.targetLocations", "type": "[TargetRegion]"}, - "exclude_from_latest": {"key": "properties.excludeFromLatest", "type": "bool"}, - "published_date": {"key": "properties.publishedDate", "type": "iso-8601"}, - "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, - "replication_status": {"key": "properties.replicationStatus", "type": "ReplicationStatus"}, - "mode": {"key": "properties.mode", "type": "str"}, - "default_access": {"key": "properties.defaultAccess", "type": "str"}, - "rules": {"key": "properties.rules", "type": "AccessControlRules"}, - } - - def __init__( - self, - *, - location: str, - tags: Optional[dict[str, str]] = None, - target_locations: Optional[list["_models.TargetRegion"]] = None, - exclude_from_latest: Optional[bool] = None, - mode: Optional[Union[str, "_models.AccessControlRulesMode"]] = None, - default_access: Optional[Union[str, "_models.EndpointAccess"]] = None, - rules: Optional["_models.AccessControlRules"] = None, - **kwargs: Any - ) -> None: - """ - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - :keyword location: The geo-location where the resource lives. Required. - :paramtype location: str - :keyword target_locations: The target regions where the Resource Profile version is going to be - replicated to. This property is updatable. - :paramtype target_locations: list[~azure.mgmt.compute.models.TargetRegion] - :keyword exclude_from_latest: If set to true, Virtual Machines deployed from the latest version - of the Resource Profile won't use this Profile version. - :paramtype exclude_from_latest: bool - :keyword mode: This property allows you to specify whether the access control rules are in - Audit mode, in Enforce mode or Disabled. Possible values are: 'Audit', 'Enforce' or 'Disabled'. - Known values are: "Audit", "Enforce", and "Disabled". - :paramtype mode: str or ~azure.mgmt.compute.models.AccessControlRulesMode - :keyword default_access: This property allows you to specify if the requests will be allowed to - access the host endpoints. Possible values are: 'Allow', 'Deny'. Known values are: "Allow" and - "Deny". - :paramtype default_access: str or ~azure.mgmt.compute.models.EndpointAccess - :keyword rules: This is the Access Control Rules specification for an inVMAccessControlProfile - version. - :paramtype rules: ~azure.mgmt.compute.models.AccessControlRules - """ - super().__init__(tags=tags, location=location, **kwargs) - self.target_locations = target_locations - self.exclude_from_latest = exclude_from_latest - self.published_date: Optional[datetime.datetime] = None - self.provisioning_state: Optional[Union[str, "_models.GalleryProvisioningState"]] = None - self.replication_status: Optional["_models.ReplicationStatus"] = None - self.mode = mode - self.default_access = default_access - self.rules = rules - - -class GalleryInVMAccessControlProfileVersionList(_serialization.Model): # pylint: disable=name-too-long - """The List Gallery InVMAccessControlProfile Versions operation response. - - All required parameters must be populated in order to send to server. - - :ivar value: The GalleryInVMAccessControlProfileVersion items on this page. Required. - :vartype value: list[~azure.mgmt.compute.models.GalleryInVMAccessControlProfileVersion] - :ivar next_link: The link to the next page of items. - :vartype next_link: str - """ - - _validation = { - "value": {"required": True}, - } - - _attribute_map = { - "value": {"key": "value", "type": "[GalleryInVMAccessControlProfileVersion]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, - *, - value: list["_models.GalleryInVMAccessControlProfileVersion"], - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: The GalleryInVMAccessControlProfileVersion items on this page. Required. - :paramtype value: list[~azure.mgmt.compute.models.GalleryInVMAccessControlProfileVersion] - :keyword next_link: The link to the next page of items. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class GalleryResourceProfileVersionPropertiesBase(_serialization.Model): # pylint: disable=name-too-long - """The properties of a gallery ResourceProfile version. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar target_locations: The target regions where the Resource Profile version is going to be - replicated to. This property is updatable. - :vartype target_locations: list[~azure.mgmt.compute.models.TargetRegion] - :ivar exclude_from_latest: If set to true, Virtual Machines deployed from the latest version of - the Resource Profile won't use this Profile version. - :vartype exclude_from_latest: bool - :ivar published_date: The timestamp for when the Resource Profile Version is published. - :vartype published_date: ~datetime.datetime - :ivar provisioning_state: The provisioning state, which only appears in the response. Known - values are: "Creating", "Updating", "Failed", "Succeeded", "Deleting", and "Migrating". - :vartype provisioning_state: str or ~azure.mgmt.compute.models.GalleryProvisioningState - :ivar replication_status: This is the replication status of the gallery image version. - :vartype replication_status: ~azure.mgmt.compute.models.ReplicationStatus - """ - - _validation = { - "published_date": {"readonly": True}, - "provisioning_state": {"readonly": True}, - "replication_status": {"readonly": True}, - } - - _attribute_map = { - "target_locations": {"key": "targetLocations", "type": "[TargetRegion]"}, - "exclude_from_latest": {"key": "excludeFromLatest", "type": "bool"}, - "published_date": {"key": "publishedDate", "type": "iso-8601"}, - "provisioning_state": {"key": "provisioningState", "type": "str"}, - "replication_status": {"key": "replicationStatus", "type": "ReplicationStatus"}, - } - - def __init__( - self, - *, - target_locations: Optional[list["_models.TargetRegion"]] = None, - exclude_from_latest: Optional[bool] = None, - **kwargs: Any - ) -> None: - """ - :keyword target_locations: The target regions where the Resource Profile version is going to be - replicated to. This property is updatable. - :paramtype target_locations: list[~azure.mgmt.compute.models.TargetRegion] - :keyword exclude_from_latest: If set to true, Virtual Machines deployed from the latest version - of the Resource Profile won't use this Profile version. - :paramtype exclude_from_latest: bool - """ - super().__init__(**kwargs) - self.target_locations = target_locations - self.exclude_from_latest = exclude_from_latest - self.published_date: Optional[datetime.datetime] = None - self.provisioning_state: Optional[Union[str, "_models.GalleryProvisioningState"]] = None - self.replication_status: Optional["_models.ReplicationStatus"] = None - - -class GalleryInVMAccessControlProfileVersionProperties( - GalleryResourceProfileVersionPropertiesBase -): # pylint: disable=name-too-long - """Describes the properties of an inVMAccessControlProfile version. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to server. - - :ivar target_locations: The target regions where the Resource Profile version is going to be - replicated to. This property is updatable. - :vartype target_locations: list[~azure.mgmt.compute.models.TargetRegion] - :ivar exclude_from_latest: If set to true, Virtual Machines deployed from the latest version of - the Resource Profile won't use this Profile version. - :vartype exclude_from_latest: bool - :ivar published_date: The timestamp for when the Resource Profile Version is published. - :vartype published_date: ~datetime.datetime - :ivar provisioning_state: The provisioning state, which only appears in the response. Known - values are: "Creating", "Updating", "Failed", "Succeeded", "Deleting", and "Migrating". - :vartype provisioning_state: str or ~azure.mgmt.compute.models.GalleryProvisioningState - :ivar replication_status: This is the replication status of the gallery image version. - :vartype replication_status: ~azure.mgmt.compute.models.ReplicationStatus - :ivar mode: This property allows you to specify whether the access control rules are in Audit - mode, in Enforce mode or Disabled. Possible values are: 'Audit', 'Enforce' or 'Disabled'. - Required. Known values are: "Audit", "Enforce", and "Disabled". - :vartype mode: str or ~azure.mgmt.compute.models.AccessControlRulesMode - :ivar default_access: This property allows you to specify if the requests will be allowed to - access the host endpoints. Possible values are: 'Allow', 'Deny'. Required. Known values are: - "Allow" and "Deny". - :vartype default_access: str or ~azure.mgmt.compute.models.EndpointAccess - :ivar rules: This is the Access Control Rules specification for an inVMAccessControlProfile - version. - :vartype rules: ~azure.mgmt.compute.models.AccessControlRules - """ - - _validation = { - "published_date": {"readonly": True}, - "provisioning_state": {"readonly": True}, - "replication_status": {"readonly": True}, - "mode": {"required": True}, - "default_access": {"required": True}, - } - - _attribute_map = { - "target_locations": {"key": "targetLocations", "type": "[TargetRegion]"}, - "exclude_from_latest": {"key": "excludeFromLatest", "type": "bool"}, - "published_date": {"key": "publishedDate", "type": "iso-8601"}, - "provisioning_state": {"key": "provisioningState", "type": "str"}, - "replication_status": {"key": "replicationStatus", "type": "ReplicationStatus"}, - "mode": {"key": "mode", "type": "str"}, - "default_access": {"key": "defaultAccess", "type": "str"}, - "rules": {"key": "rules", "type": "AccessControlRules"}, - } - - def __init__( - self, - *, - mode: Union[str, "_models.AccessControlRulesMode"], - default_access: Union[str, "_models.EndpointAccess"], - target_locations: Optional[list["_models.TargetRegion"]] = None, - exclude_from_latest: Optional[bool] = None, - rules: Optional["_models.AccessControlRules"] = None, - **kwargs: Any - ) -> None: - """ - :keyword target_locations: The target regions where the Resource Profile version is going to be - replicated to. This property is updatable. - :paramtype target_locations: list[~azure.mgmt.compute.models.TargetRegion] - :keyword exclude_from_latest: If set to true, Virtual Machines deployed from the latest version - of the Resource Profile won't use this Profile version. - :paramtype exclude_from_latest: bool - :keyword mode: This property allows you to specify whether the access control rules are in - Audit mode, in Enforce mode or Disabled. Possible values are: 'Audit', 'Enforce' or 'Disabled'. - Required. Known values are: "Audit", "Enforce", and "Disabled". - :paramtype mode: str or ~azure.mgmt.compute.models.AccessControlRulesMode - :keyword default_access: This property allows you to specify if the requests will be allowed to - access the host endpoints. Possible values are: 'Allow', 'Deny'. Required. Known values are: - "Allow" and "Deny". - :paramtype default_access: str or ~azure.mgmt.compute.models.EndpointAccess - :keyword rules: This is the Access Control Rules specification for an inVMAccessControlProfile - version. - :paramtype rules: ~azure.mgmt.compute.models.AccessControlRules - """ - super().__init__(target_locations=target_locations, exclude_from_latest=exclude_from_latest, **kwargs) - self.mode = mode - self.default_access = default_access - self.rules = rules - - -class GalleryInVMAccessControlProfileVersionUpdate(UpdateResourceDefinition): # pylint: disable=name-too-long - """Specifies information about the gallery inVMAccessControlProfile version that you want to - update. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Resource Id. - :vartype id: str - :ivar name: Resource name. - :vartype name: str - :ivar type: Resource type. - :vartype type: str - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - :ivar target_locations: The target regions where the Resource Profile version is going to be - replicated to. This property is updatable. - :vartype target_locations: list[~azure.mgmt.compute.models.TargetRegion] - :ivar exclude_from_latest: If set to true, Virtual Machines deployed from the latest version of - the Resource Profile won't use this Profile version. - :vartype exclude_from_latest: bool - :ivar published_date: The timestamp for when the Resource Profile Version is published. - :vartype published_date: ~datetime.datetime - :ivar provisioning_state: The provisioning state, which only appears in the response. Known - values are: "Creating", "Updating", "Failed", "Succeeded", "Deleting", and "Migrating". - :vartype provisioning_state: str or ~azure.mgmt.compute.models.GalleryProvisioningState - :ivar replication_status: This is the replication status of the gallery image version. - :vartype replication_status: ~azure.mgmt.compute.models.ReplicationStatus - :ivar mode: This property allows you to specify whether the access control rules are in Audit - mode, in Enforce mode or Disabled. Possible values are: 'Audit', 'Enforce' or 'Disabled'. Known - values are: "Audit", "Enforce", and "Disabled". - :vartype mode: str or ~azure.mgmt.compute.models.AccessControlRulesMode - :ivar default_access: This property allows you to specify if the requests will be allowed to - access the host endpoints. Possible values are: 'Allow', 'Deny'. Known values are: "Allow" and - "Deny". - :vartype default_access: str or ~azure.mgmt.compute.models.EndpointAccess - :ivar rules: This is the Access Control Rules specification for an inVMAccessControlProfile - version. - :vartype rules: ~azure.mgmt.compute.models.AccessControlRules - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "published_date": {"readonly": True}, - "provisioning_state": {"readonly": True}, - "replication_status": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "tags": {"key": "tags", "type": "{str}"}, - "target_locations": {"key": "properties.targetLocations", "type": "[TargetRegion]"}, - "exclude_from_latest": {"key": "properties.excludeFromLatest", "type": "bool"}, - "published_date": {"key": "properties.publishedDate", "type": "iso-8601"}, - "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, - "replication_status": {"key": "properties.replicationStatus", "type": "ReplicationStatus"}, - "mode": {"key": "properties.mode", "type": "str"}, - "default_access": {"key": "properties.defaultAccess", "type": "str"}, - "rules": {"key": "properties.rules", "type": "AccessControlRules"}, - } - - def __init__( - self, - *, - tags: Optional[dict[str, str]] = None, - target_locations: Optional[list["_models.TargetRegion"]] = None, - exclude_from_latest: Optional[bool] = None, - mode: Optional[Union[str, "_models.AccessControlRulesMode"]] = None, - default_access: Optional[Union[str, "_models.EndpointAccess"]] = None, - rules: Optional["_models.AccessControlRules"] = None, - **kwargs: Any - ) -> None: - """ - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - :keyword target_locations: The target regions where the Resource Profile version is going to be - replicated to. This property is updatable. - :paramtype target_locations: list[~azure.mgmt.compute.models.TargetRegion] - :keyword exclude_from_latest: If set to true, Virtual Machines deployed from the latest version - of the Resource Profile won't use this Profile version. - :paramtype exclude_from_latest: bool - :keyword mode: This property allows you to specify whether the access control rules are in - Audit mode, in Enforce mode or Disabled. Possible values are: 'Audit', 'Enforce' or 'Disabled'. - Known values are: "Audit", "Enforce", and "Disabled". - :paramtype mode: str or ~azure.mgmt.compute.models.AccessControlRulesMode - :keyword default_access: This property allows you to specify if the requests will be allowed to - access the host endpoints. Possible values are: 'Allow', 'Deny'. Known values are: "Allow" and - "Deny". - :paramtype default_access: str or ~azure.mgmt.compute.models.EndpointAccess - :keyword rules: This is the Access Control Rules specification for an inVMAccessControlProfile - version. - :paramtype rules: ~azure.mgmt.compute.models.AccessControlRules - """ - super().__init__(tags=tags, **kwargs) - self.target_locations = target_locations - self.exclude_from_latest = exclude_from_latest - self.published_date: Optional[datetime.datetime] = None - self.provisioning_state: Optional[Union[str, "_models.GalleryProvisioningState"]] = None - self.replication_status: Optional["_models.ReplicationStatus"] = None - self.mode = mode - self.default_access = default_access - self.rules = rules - - -class GalleryList(_serialization.Model): - """The List Galleries operation response. - - All required parameters must be populated in order to send to server. - - :ivar value: A list of galleries. Required. - :vartype value: list[~azure.mgmt.compute.models.Gallery] - :ivar next_link: The uri to fetch the next page of galleries. Call ListNext() with this to - fetch the next page of galleries. - :vartype next_link: str - :ivar security_profile: The security profile of a gallery image version. - :vartype security_profile: ~azure.mgmt.compute.models.ImageVersionSecurityProfile - """ - - _validation = { - "value": {"required": True}, - } - - _attribute_map = { - "value": {"key": "value", "type": "[Gallery]"}, - "next_link": {"key": "nextLink", "type": "str"}, - "security_profile": {"key": "securityProfile", "type": "ImageVersionSecurityProfile"}, - } - - def __init__( - self, - *, - value: list["_models.Gallery"], - next_link: Optional[str] = None, - security_profile: Optional["_models.ImageVersionSecurityProfile"] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: A list of galleries. Required. - :paramtype value: list[~azure.mgmt.compute.models.Gallery] - :keyword next_link: The uri to fetch the next page of galleries. Call ListNext() with this to - fetch the next page of galleries. - :paramtype next_link: str - :keyword security_profile: The security profile of a gallery image version. - :paramtype security_profile: ~azure.mgmt.compute.models.ImageVersionSecurityProfile - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - self.security_profile = security_profile - - -class GalleryOSDiskImage(GalleryDiskImage): - """This is the OS disk image. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar size_in_gb: This property indicates the size of the VHD to be created. - :vartype size_in_gb: int - :ivar host_caching: The host caching of the disk. Valid values are 'None', 'ReadOnly', and - 'ReadWrite'. Known values are: "None", "ReadOnly", and "ReadWrite". - :vartype host_caching: str or ~azure.mgmt.compute.models.HostCaching - :ivar source: The source for the disk image. - :vartype source: ~azure.mgmt.compute.models.GalleryDiskImageSource - """ - - -class GallerySoftDeletedResource(TrackedResource): - """The details information of soft-deleted resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to server. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.compute.models.SystemData - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - :ivar location: The geo-location where the resource lives. Required. - :vartype location: str - :ivar resource_arm_id: arm id of the soft-deleted resource. - :vartype resource_arm_id: str - :ivar soft_deleted_artifact_type: artifact type of the soft-deleted resource. "Images" - :vartype soft_deleted_artifact_type: str or ~azure.mgmt.compute.models.SoftDeletedArtifactTypes - :ivar soft_deleted_time: The timestamp for when the resource is soft-deleted. In dateTime - offset format. - :vartype soft_deleted_time: str - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, - "location": {"required": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - "tags": {"key": "tags", "type": "{str}"}, - "location": {"key": "location", "type": "str"}, - "resource_arm_id": {"key": "properties.resourceArmId", "type": "str"}, - "soft_deleted_artifact_type": {"key": "properties.softDeletedArtifactType", "type": "str"}, - "soft_deleted_time": {"key": "properties.softDeletedTime", "type": "str"}, - } - - def __init__( - self, - *, - location: str, - tags: Optional[dict[str, str]] = None, - resource_arm_id: Optional[str] = None, - soft_deleted_artifact_type: Optional[Union[str, "_models.SoftDeletedArtifactTypes"]] = None, - soft_deleted_time: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - :keyword location: The geo-location where the resource lives. Required. - :paramtype location: str - :keyword resource_arm_id: arm id of the soft-deleted resource. - :paramtype resource_arm_id: str - :keyword soft_deleted_artifact_type: artifact type of the soft-deleted resource. "Images" - :paramtype soft_deleted_artifact_type: str or - ~azure.mgmt.compute.models.SoftDeletedArtifactTypes - :keyword soft_deleted_time: The timestamp for when the resource is soft-deleted. In dateTime - offset format. - :paramtype soft_deleted_time: str - """ - super().__init__(tags=tags, location=location, **kwargs) - self.resource_arm_id = resource_arm_id - self.soft_deleted_artifact_type = soft_deleted_artifact_type - self.soft_deleted_time = soft_deleted_time - - -class GallerySoftDeletedResourceList(_serialization.Model): - """The List Soft-deleted Resources operation response. - - All required parameters must be populated in order to send to server. - - :ivar value: The GallerySoftDeletedResource items on this page. Required. - :vartype value: list[~azure.mgmt.compute.models.GallerySoftDeletedResource] - :ivar next_link: The link to the next page of items. - :vartype next_link: str - """ - - _validation = { - "value": {"required": True}, - } - - _attribute_map = { - "value": {"key": "value", "type": "[GallerySoftDeletedResource]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, *, value: list["_models.GallerySoftDeletedResource"], next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: The GallerySoftDeletedResource items on this page. Required. - :paramtype value: list[~azure.mgmt.compute.models.GallerySoftDeletedResource] - :keyword next_link: The link to the next page of items. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class GalleryTargetExtendedLocation(_serialization.Model): - """GalleryTargetExtendedLocation. - - :ivar name: The name of the region. - :vartype name: str - :ivar extended_location: The name of the extended location. - :vartype extended_location: ~azure.mgmt.compute.models.GalleryExtendedLocation - :ivar extended_location_replica_count: The number of replicas of the Image Version to be - created per extended location. This property is updatable. - :vartype extended_location_replica_count: int - :ivar storage_account_type: Specifies the storage account type to be used to store the image. - This property is not updatable. Known values are: "Standard_LRS", "Standard_ZRS", - "StandardSSD_LRS", and "Premium_LRS". - :vartype storage_account_type: str or ~azure.mgmt.compute.models.EdgeZoneStorageAccountType - :ivar encryption: Optional. Allows users to provide customer managed keys for encrypting the OS - and data disks in the gallery artifact. - :vartype encryption: ~azure.mgmt.compute.models.EncryptionImages - """ - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "extended_location": {"key": "extendedLocation", "type": "GalleryExtendedLocation"}, - "extended_location_replica_count": {"key": "extendedLocationReplicaCount", "type": "int"}, - "storage_account_type": {"key": "storageAccountType", "type": "str"}, - "encryption": {"key": "encryption", "type": "EncryptionImages"}, - } - - def __init__( - self, - *, - name: Optional[str] = None, - extended_location: Optional["_models.GalleryExtendedLocation"] = None, - extended_location_replica_count: Optional[int] = None, - storage_account_type: Optional[Union[str, "_models.EdgeZoneStorageAccountType"]] = None, - encryption: Optional["_models.EncryptionImages"] = None, - **kwargs: Any - ) -> None: - """ - :keyword name: The name of the region. - :paramtype name: str - :keyword extended_location: The name of the extended location. - :paramtype extended_location: ~azure.mgmt.compute.models.GalleryExtendedLocation - :keyword extended_location_replica_count: The number of replicas of the Image Version to be - created per extended location. This property is updatable. - :paramtype extended_location_replica_count: int - :keyword storage_account_type: Specifies the storage account type to be used to store the - image. This property is not updatable. Known values are: "Standard_LRS", "Standard_ZRS", - "StandardSSD_LRS", and "Premium_LRS". - :paramtype storage_account_type: str or ~azure.mgmt.compute.models.EdgeZoneStorageAccountType - :keyword encryption: Optional. Allows users to provide customer managed keys for encrypting the - OS and data disks in the gallery artifact. - :paramtype encryption: ~azure.mgmt.compute.models.EncryptionImages - """ - super().__init__(**kwargs) - self.name = name - self.extended_location = extended_location - self.extended_location_replica_count = extended_location_replica_count - self.storage_account_type = storage_account_type - self.encryption = encryption - - -class GalleryUpdate(UpdateResourceDefinition): - """Specifies information about the Shared Image Gallery that you want to update. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Resource Id. - :vartype id: str - :ivar name: Resource name. - :vartype name: str - :ivar type: Resource type. - :vartype type: str - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - :ivar identity: The identity of the gallery, if configured. - :vartype identity: ~azure.mgmt.compute.models.GalleryIdentity - :ivar description: The description of this Shared Image Gallery resource. This property is - updatable. - :vartype description: str - :ivar identifier: Describes the gallery unique name. - :vartype identifier: ~azure.mgmt.compute.models.GalleryIdentifier - :ivar provisioning_state: The provisioning state, which only appears in the response. Known - values are: "Creating", "Updating", "Failed", "Succeeded", "Deleting", and "Migrating". - :vartype provisioning_state: str or ~azure.mgmt.compute.models.GalleryProvisioningState - :ivar sharing_profile: Profile for gallery sharing to subscription or tenant. - :vartype sharing_profile: ~azure.mgmt.compute.models.SharingProfile - :ivar soft_delete_policy: Contains information about the soft deletion policy of the gallery. - :vartype soft_delete_policy: ~azure.mgmt.compute.models.SoftDeletePolicy - :ivar sharing_status: Sharing status of current gallery. - :vartype sharing_status: ~azure.mgmt.compute.models.SharingStatus - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "provisioning_state": {"readonly": True}, - "sharing_status": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "tags": {"key": "tags", "type": "{str}"}, - "identity": {"key": "identity", "type": "GalleryIdentity"}, - "description": {"key": "properties.description", "type": "str"}, - "identifier": {"key": "properties.identifier", "type": "GalleryIdentifier"}, - "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, - "sharing_profile": {"key": "properties.sharingProfile", "type": "SharingProfile"}, - "soft_delete_policy": {"key": "properties.softDeletePolicy", "type": "SoftDeletePolicy"}, - "sharing_status": {"key": "properties.sharingStatus", "type": "SharingStatus"}, - } - - def __init__( - self, - *, - tags: Optional[dict[str, str]] = None, - identity: Optional["_models.GalleryIdentity"] = None, - description: Optional[str] = None, - identifier: Optional["_models.GalleryIdentifier"] = None, - sharing_profile: Optional["_models.SharingProfile"] = None, - soft_delete_policy: Optional["_models.SoftDeletePolicy"] = None, - **kwargs: Any - ) -> None: - """ - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - :keyword identity: The identity of the gallery, if configured. - :paramtype identity: ~azure.mgmt.compute.models.GalleryIdentity - :keyword description: The description of this Shared Image Gallery resource. This property is - updatable. - :paramtype description: str - :keyword identifier: Describes the gallery unique name. - :paramtype identifier: ~azure.mgmt.compute.models.GalleryIdentifier - :keyword sharing_profile: Profile for gallery sharing to subscription or tenant. - :paramtype sharing_profile: ~azure.mgmt.compute.models.SharingProfile - :keyword soft_delete_policy: Contains information about the soft deletion policy of the - gallery. - :paramtype soft_delete_policy: ~azure.mgmt.compute.models.SoftDeletePolicy - """ - super().__init__(tags=tags, **kwargs) - self.identity = identity - self.description = description - self.identifier = identifier - self.provisioning_state: Optional[Union[str, "_models.GalleryProvisioningState"]] = None - self.sharing_profile = sharing_profile - self.soft_delete_policy = soft_delete_policy - self.sharing_status: Optional["_models.SharingStatus"] = None - - -class GrantAccessData(_serialization.Model): - """Data used for requesting a SAS. - - All required parameters must be populated in order to send to server. - - :ivar access: The Access Level, accepted values include None, Read, Write. Required. Known - values are: "None", "Read", and "Write". - :vartype access: str or ~azure.mgmt.compute.models.AccessLevel - :ivar duration_in_seconds: Time duration in seconds until the SAS access expires. Required. - :vartype duration_in_seconds: int - :ivar get_secure_vm_guest_state_sas: Set this flag to true to get additional SAS for VM guest - state. - :vartype get_secure_vm_guest_state_sas: bool - :ivar file_format: Used to specify the file format when making request for SAS on a VHDX file - format snapshot. Known values are: "VHD" and "VHDX". - :vartype file_format: str or ~azure.mgmt.compute.models.FileFormat - """ - - _validation = { - "access": {"required": True}, - "duration_in_seconds": {"required": True}, - } - - _attribute_map = { - "access": {"key": "access", "type": "str"}, - "duration_in_seconds": {"key": "durationInSeconds", "type": "int"}, - "get_secure_vm_guest_state_sas": {"key": "getSecureVMGuestStateSAS", "type": "bool"}, - "file_format": {"key": "fileFormat", "type": "str"}, - } - - def __init__( - self, - *, - access: Union[str, "_models.AccessLevel"], - duration_in_seconds: int, - get_secure_vm_guest_state_sas: Optional[bool] = None, - file_format: Optional[Union[str, "_models.FileFormat"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword access: The Access Level, accepted values include None, Read, Write. Required. Known - values are: "None", "Read", and "Write". - :paramtype access: str or ~azure.mgmt.compute.models.AccessLevel - :keyword duration_in_seconds: Time duration in seconds until the SAS access expires. Required. - :paramtype duration_in_seconds: int - :keyword get_secure_vm_guest_state_sas: Set this flag to true to get additional SAS for VM - guest state. - :paramtype get_secure_vm_guest_state_sas: bool - :keyword file_format: Used to specify the file format when making request for SAS on a VHDX - file format snapshot. Known values are: "VHD" and "VHDX". - :paramtype file_format: str or ~azure.mgmt.compute.models.FileFormat - """ - super().__init__(**kwargs) - self.access = access - self.duration_in_seconds = duration_in_seconds - self.get_secure_vm_guest_state_sas = get_secure_vm_guest_state_sas - self.file_format = file_format - - -class HardwareProfile(_serialization.Model): - """Specifies the hardware settings for the virtual machine. - - :ivar vm_size: Specifies the size of the virtual machine. The enum data type is currently - deprecated and will be removed by December 23rd 2023. The recommended way to get the list of - available sizes is using these APIs: `List all available virtual machine sizes in an - availability set - `_\\ , `List - all available virtual machine sizes in a region - `_\\ , `List all available - virtual machine sizes for resizing - `_. For more - information about virtual machine sizes, see `Sizes for virtual machines - `_. The available VM sizes depend on - region and availability set. Known values are: "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", and - "Standard_NV24". - :vartype vm_size: str or ~azure.mgmt.compute.models.VirtualMachineSizeTypes - :ivar vm_size_properties: Specifies the properties for customizing the size of the virtual - machine. Minimum api-version: 2021-07-01. This feature is still in preview mode and is not - supported for VirtualMachineScaleSet. Please follow the instructions in `VM Customization - `_ for more details. - :vartype vm_size_properties: ~azure.mgmt.compute.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, "_models.VirtualMachineSizeTypes"]] = None, - vm_size_properties: Optional["_models.VMSizeProperties"] = None, - **kwargs: Any - ) -> None: - """ - :keyword vm_size: Specifies the size of the virtual machine. The enum data type is currently - deprecated and will be removed by December 23rd 2023. The recommended way to get the list of - available sizes is using these APIs: `List all available virtual machine sizes in an - availability set - `_\\ , `List - all available virtual machine sizes in a region - `_\\ , `List all available - virtual machine sizes for resizing - `_. For more - information about virtual machine sizes, see `Sizes for virtual machines - `_. The available VM sizes depend on - region and availability set. Known values are: "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", and - "Standard_NV24". - :paramtype vm_size: str or ~azure.mgmt.compute.models.VirtualMachineSizeTypes - :keyword vm_size_properties: Specifies the properties for customizing the size of the virtual - machine. Minimum api-version: 2021-07-01. This feature is still in preview mode and is not - supported for VirtualMachineScaleSet. Please follow the instructions in `VM Customization - `_ for more details. - :paramtype vm_size_properties: ~azure.mgmt.compute.models.VMSizeProperties - """ - super().__init__(**kwargs) - self.vm_size = vm_size - self.vm_size_properties = vm_size_properties - - -class HostEndpointSettings(_serialization.Model): - """Specifies particular host endpoint settings. - - :ivar mode: Specifies the execution mode. In Audit mode, the system acts as if it is enforcing - the access control policy, including emitting access denial entries in the logs but it does not - actually deny any requests to host endpoints. In Enforce mode, the system will enforce the - access control and it is the recommended mode of operation. Known values are: "Audit", - "Enforce", and "Disabled". - :vartype mode: str or ~azure.mgmt.compute.models.Modes - :ivar in_vm_access_control_profile_reference_id: Specifies the InVMAccessControlProfileVersion - resource id in the format of - /subscriptions/{SubscriptionId}/resourceGroups/{ResourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/inVMAccessControlProfiles/{profile}/versions/{version}. - :vartype in_vm_access_control_profile_reference_id: str - """ - - _attribute_map = { - "mode": {"key": "mode", "type": "str"}, - "in_vm_access_control_profile_reference_id": {"key": "inVMAccessControlProfileReferenceId", "type": "str"}, - } - - def __init__( - self, - *, - mode: Optional[Union[str, "_models.Modes"]] = None, - in_vm_access_control_profile_reference_id: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword mode: Specifies the execution mode. In Audit mode, the system acts as if it is - enforcing the access control policy, including emitting access denial entries in the logs but - it does not actually deny any requests to host endpoints. In Enforce mode, the system will - enforce the access control and it is the recommended mode of operation. Known values are: - "Audit", "Enforce", and "Disabled". - :paramtype mode: str or ~azure.mgmt.compute.models.Modes - :keyword in_vm_access_control_profile_reference_id: Specifies the - InVMAccessControlProfileVersion resource id in the format of - /subscriptions/{SubscriptionId}/resourceGroups/{ResourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/inVMAccessControlProfiles/{profile}/versions/{version}. - :paramtype in_vm_access_control_profile_reference_id: str - """ - super().__init__(**kwargs) - self.mode = mode - self.in_vm_access_control_profile_reference_id = in_vm_access_control_profile_reference_id - - -class Image(TrackedResource): - """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 server. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.compute.models.SystemData - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - :ivar location: The geo-location where the resource lives. Required. - :vartype location: str - :ivar extended_location: The extended location of the Image. - :vartype extended_location: ~azure.mgmt.compute.models.ExtendedLocation - :ivar source_virtual_machine: The source virtual machine from which Image is created. - :vartype source_virtual_machine: ~azure.mgmt.compute.models.SubResource - :ivar storage_profile: Specifies the storage settings for the virtual machine disks. - :vartype storage_profile: ~azure.mgmt.compute.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. Known - values are: "V1" and "V2". - :vartype hyper_v_generation: str or ~azure.mgmt.compute.models.HyperVGenerationTypes - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"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"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - "tags": {"key": "tags", "type": "{str}"}, - "location": {"key": "location", "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["_models.ExtendedLocation"] = None, - source_virtual_machine: Optional["_models.SubResource"] = None, - storage_profile: Optional["_models.ImageStorageProfile"] = None, - hyper_v_generation: Optional[Union[str, "_models.HyperVGenerationTypes"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - :keyword location: The geo-location where the resource lives. Required. - :paramtype location: str - :keyword extended_location: The extended location of the Image. - :paramtype extended_location: ~azure.mgmt.compute.models.ExtendedLocation - :keyword source_virtual_machine: The source virtual machine from which Image is created. - :paramtype source_virtual_machine: ~azure.mgmt.compute.models.SubResource - :keyword storage_profile: Specifies the storage settings for the virtual machine disks. - :paramtype storage_profile: ~azure.mgmt.compute.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. Known values are: "V1" and "V2". - :paramtype hyper_v_generation: str or ~azure.mgmt.compute.models.HyperVGenerationTypes - """ - super().__init__(tags=tags, location=location, **kwargs) - self.extended_location = extended_location - self.source_virtual_machine = source_virtual_machine - self.storage_profile = storage_profile - self.provisioning_state: Optional[str] = None - self.hyper_v_generation = hyper_v_generation - - -class ImageDisk(_serialization.Model): - """Describes a image disk. - - :ivar snapshot: The snapshot. - :vartype snapshot: ~azure.mgmt.compute.models.SubResource - :ivar managed_disk: The managedDisk. - :vartype managed_disk: ~azure.mgmt.compute.models.SubResource - :ivar blob_uri: The Virtual Hard Disk. - :vartype blob_uri: str - :ivar caching: Specifies the caching requirements. Possible values are: **None,** **ReadOnly,** - **ReadWrite.** The default values are: **None for Standard storage. ReadOnly for Premium - storage.**. Known values are: "None", "ReadOnly", and "ReadWrite". - :vartype caching: str or ~azure.mgmt.compute.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. 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. Known values - are: "Standard_LRS", "Premium_LRS", "StandardSSD_LRS", "UltraSSD_LRS", "Premium_ZRS", - "StandardSSD_ZRS", and "PremiumV2_LRS". - :vartype storage_account_type: str or ~azure.mgmt.compute.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.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["_models.SubResource"] = None, - managed_disk: Optional["_models.SubResource"] = None, - blob_uri: Optional[str] = None, - caching: Optional[Union[str, "_models.CachingTypes"]] = None, - disk_size_gb: Optional[int] = None, - storage_account_type: Optional[Union[str, "_models.StorageAccountTypes"]] = None, - disk_encryption_set: Optional["_models.DiskEncryptionSetParameters"] = None, - **kwargs: Any - ) -> None: - """ - :keyword snapshot: The snapshot. - :paramtype snapshot: ~azure.mgmt.compute.models.SubResource - :keyword managed_disk: The managedDisk. - :paramtype managed_disk: ~azure.mgmt.compute.models.SubResource - :keyword blob_uri: The Virtual Hard Disk. - :paramtype blob_uri: str - :keyword caching: Specifies the caching requirements. Possible values are: **None,** - **ReadOnly,** **ReadWrite.** The default values are: **None for Standard storage. ReadOnly for - Premium storage.**. Known values are: "None", "ReadOnly", and "ReadWrite". - :paramtype caching: str or ~azure.mgmt.compute.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. 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. Known values - are: "Standard_LRS", "Premium_LRS", "StandardSSD_LRS", "UltraSSD_LRS", "Premium_ZRS", - "StandardSSD_ZRS", and "PremiumV2_LRS". - :paramtype storage_account_type: str or ~azure.mgmt.compute.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.models.DiskEncryptionSetParameters - """ - super().__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 server. - - :ivar snapshot: The snapshot. - :vartype snapshot: ~azure.mgmt.compute.models.SubResource - :ivar managed_disk: The managedDisk. - :vartype managed_disk: ~azure.mgmt.compute.models.SubResource - :ivar blob_uri: The Virtual Hard Disk. - :vartype blob_uri: str - :ivar caching: Specifies the caching requirements. Possible values are: **None,** **ReadOnly,** - **ReadWrite.** The default values are: **None for Standard storage. ReadOnly for Premium - storage.**. Known values are: "None", "ReadOnly", and "ReadWrite". - :vartype caching: str or ~azure.mgmt.compute.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. 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. Known values - are: "Standard_LRS", "Premium_LRS", "StandardSSD_LRS", "UltraSSD_LRS", "Premium_ZRS", - "StandardSSD_ZRS", and "PremiumV2_LRS". - :vartype storage_account_type: str or ~azure.mgmt.compute.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.models.DiskEncryptionSetParameters - :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. - Required. - :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["_models.SubResource"] = None, - managed_disk: Optional["_models.SubResource"] = None, - blob_uri: Optional[str] = None, - caching: Optional[Union[str, "_models.CachingTypes"]] = None, - disk_size_gb: Optional[int] = None, - storage_account_type: Optional[Union[str, "_models.StorageAccountTypes"]] = None, - disk_encryption_set: Optional["_models.DiskEncryptionSetParameters"] = None, - **kwargs: Any - ) -> None: - """ - :keyword snapshot: The snapshot. - :paramtype snapshot: ~azure.mgmt.compute.models.SubResource - :keyword managed_disk: The managedDisk. - :paramtype managed_disk: ~azure.mgmt.compute.models.SubResource - :keyword blob_uri: The Virtual Hard Disk. - :paramtype blob_uri: str - :keyword caching: Specifies the caching requirements. Possible values are: **None,** - **ReadOnly,** **ReadWrite.** The default values are: **None for Standard storage. ReadOnly for - Premium storage.**. Known values are: "None", "ReadOnly", and "ReadWrite". - :paramtype caching: str or ~azure.mgmt.compute.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. 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. Known values - are: "Standard_LRS", "Premium_LRS", "StandardSSD_LRS", "UltraSSD_LRS", "Premium_ZRS", - "StandardSSD_ZRS", and "PremiumV2_LRS". - :paramtype storage_account_type: str or ~azure.mgmt.compute.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.models.DiskEncryptionSetParameters - :keyword 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. Required. - :paramtype lun: int - """ - super().__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 ImageDeprecationStatus(_serialization.Model): - """Describes image deprecation status properties on the image. - - :ivar image_state: Describes the state of the image. Known values are: "Active", - "ScheduledForDeprecation", and "Deprecated". - :vartype image_state: str or ~azure.mgmt.compute.models.ImageState - :ivar scheduled_deprecation_time: The time, in future, at which this image will be marked as - deprecated. This scheduled time is chosen by the Publisher. - :vartype scheduled_deprecation_time: ~datetime.datetime - :ivar alternative_option: Describes the alternative option specified by the Publisher for this - image when this image is deprecated. - :vartype alternative_option: ~azure.mgmt.compute.models.AlternativeOption - """ - - _attribute_map = { - "image_state": {"key": "imageState", "type": "str"}, - "scheduled_deprecation_time": {"key": "scheduledDeprecationTime", "type": "iso-8601"}, - "alternative_option": {"key": "alternativeOption", "type": "AlternativeOption"}, - } - - def __init__( - self, - *, - image_state: Optional[Union[str, "_models.ImageState"]] = None, - scheduled_deprecation_time: Optional[datetime.datetime] = None, - alternative_option: Optional["_models.AlternativeOption"] = None, - **kwargs: Any - ) -> None: - """ - :keyword image_state: Describes the state of the image. Known values are: "Active", - "ScheduledForDeprecation", and "Deprecated". - :paramtype image_state: str or ~azure.mgmt.compute.models.ImageState - :keyword scheduled_deprecation_time: The time, in future, at which this image will be marked as - deprecated. This scheduled time is chosen by the Publisher. - :paramtype scheduled_deprecation_time: ~datetime.datetime - :keyword alternative_option: Describes the alternative option specified by the Publisher for - this image when this image is deprecated. - :paramtype alternative_option: ~azure.mgmt.compute.models.AlternativeOption - """ - super().__init__(**kwargs) - self.image_state = image_state - self.scheduled_deprecation_time = scheduled_deprecation_time - self.alternative_option = alternative_option - - -class ImageDiskReference(_serialization.Model): - """The source image used for creating the disk. - - :ivar id: A relative uri containing either a Platform Image Repository, user image, or Azure - Compute Gallery image reference. - :vartype id: str - :ivar shared_gallery_image_id: A relative uri containing a direct shared Azure Compute Gallery - image reference. - :vartype shared_gallery_image_id: str - :ivar community_gallery_image_id: A relative uri containing a community Azure Compute Gallery - image reference. - :vartype community_gallery_image_id: str - :ivar lun: If the disk is created from an image's data disk, this is an index that indicates - which of the data disks in the image to use. For OS disks, this field is null. - :vartype lun: int - """ - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "shared_gallery_image_id": {"key": "sharedGalleryImageId", "type": "str"}, - "community_gallery_image_id": {"key": "communityGalleryImageId", "type": "str"}, - "lun": {"key": "lun", "type": "int"}, - } - - def __init__( - self, - *, - id: Optional[str] = None, # pylint: disable=redefined-builtin - shared_gallery_image_id: Optional[str] = None, - community_gallery_image_id: Optional[str] = None, - lun: Optional[int] = None, - **kwargs: Any - ) -> None: - """ - :keyword id: A relative uri containing either a Platform Image Repository, user image, or Azure - Compute Gallery image reference. - :paramtype id: str - :keyword shared_gallery_image_id: A relative uri containing a direct shared Azure Compute - Gallery image reference. - :paramtype shared_gallery_image_id: str - :keyword community_gallery_image_id: A relative uri containing a community Azure Compute - Gallery image reference. - :paramtype community_gallery_image_id: str - :keyword lun: If the disk is created from an image's data disk, this is an index that indicates - which of the data disks in the image to use. For OS disks, this field is null. - :paramtype lun: int - """ - super().__init__(**kwargs) - self.id = id - self.shared_gallery_image_id = shared_gallery_image_id - self.community_gallery_image_id = community_gallery_image_id - self.lun = lun - - -class ImageListResult(_serialization.Model): - """The List Image operation response. - - All required parameters must be populated in order to send to server. - - :ivar value: The list of Images. Required. - :vartype value: list[~azure.mgmt.compute.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["_models.Image"], next_link: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword value: The list of Images. Required. - :paramtype value: list[~azure.mgmt.compute.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().__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 server. - - :ivar snapshot: The snapshot. - :vartype snapshot: ~azure.mgmt.compute.models.SubResource - :ivar managed_disk: The managedDisk. - :vartype managed_disk: ~azure.mgmt.compute.models.SubResource - :ivar blob_uri: The Virtual Hard Disk. - :vartype blob_uri: str - :ivar caching: Specifies the caching requirements. Possible values are: **None,** **ReadOnly,** - **ReadWrite.** The default values are: **None for Standard storage. ReadOnly for Premium - storage.**. Known values are: "None", "ReadOnly", and "ReadWrite". - :vartype caching: str or ~azure.mgmt.compute.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. 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. Known values - are: "Standard_LRS", "Premium_LRS", "StandardSSD_LRS", "UltraSSD_LRS", "Premium_ZRS", - "StandardSSD_ZRS", and "PremiumV2_LRS". - :vartype storage_account_type: str or ~azure.mgmt.compute.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.models.DiskEncryptionSetParameters - :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 a custom image. Possible values are: **Windows,** **Linux.**. - Required. Known values are: "Windows" and "Linux". - :vartype os_type: str or ~azure.mgmt.compute.models.OperatingSystemTypes - :ivar os_state: The OS State. For managed images, use Generalized. Required. Known values are: - "Generalized" and "Specialized". - :vartype os_state: str or ~azure.mgmt.compute.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, "_models.OperatingSystemTypes"], - os_state: Union[str, "_models.OperatingSystemStateTypes"], - snapshot: Optional["_models.SubResource"] = None, - managed_disk: Optional["_models.SubResource"] = None, - blob_uri: Optional[str] = None, - caching: Optional[Union[str, "_models.CachingTypes"]] = None, - disk_size_gb: Optional[int] = None, - storage_account_type: Optional[Union[str, "_models.StorageAccountTypes"]] = None, - disk_encryption_set: Optional["_models.DiskEncryptionSetParameters"] = None, - **kwargs: Any - ) -> None: - """ - :keyword snapshot: The snapshot. - :paramtype snapshot: ~azure.mgmt.compute.models.SubResource - :keyword managed_disk: The managedDisk. - :paramtype managed_disk: ~azure.mgmt.compute.models.SubResource - :keyword blob_uri: The Virtual Hard Disk. - :paramtype blob_uri: str - :keyword caching: Specifies the caching requirements. Possible values are: **None,** - **ReadOnly,** **ReadWrite.** The default values are: **None for Standard storage. ReadOnly for - Premium storage.**. Known values are: "None", "ReadOnly", and "ReadWrite". - :paramtype caching: str or ~azure.mgmt.compute.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. 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. Known values - are: "Standard_LRS", "Premium_LRS", "StandardSSD_LRS", "UltraSSD_LRS", "Premium_ZRS", - "StandardSSD_ZRS", and "PremiumV2_LRS". - :paramtype storage_account_type: str or ~azure.mgmt.compute.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.models.DiskEncryptionSetParameters - :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 a custom image. Possible values are: **Windows,** **Linux.**. - Required. Known values are: "Windows" and "Linux". - :paramtype os_type: str or ~azure.mgmt.compute.models.OperatingSystemTypes - :keyword os_state: The OS State. For managed images, use Generalized. Required. Known values - are: "Generalized" and "Specialized". - :paramtype os_state: str or ~azure.mgmt.compute.models.OperatingSystemStateTypes - """ - super().__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 ImagePurchasePlan(_serialization.Model): - """Describes the gallery image definition purchase plan. This is used by marketplace images. - - :ivar name: The plan ID. - :vartype name: str - :ivar publisher: The publisher ID. - :vartype publisher: str - :ivar product: The product ID. - :vartype product: str - """ - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "publisher": {"key": "publisher", "type": "str"}, - "product": {"key": "product", "type": "str"}, - } - - def __init__( - self, - *, - name: Optional[str] = None, - publisher: Optional[str] = None, - product: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword name: The plan ID. - :paramtype name: str - :keyword publisher: The publisher ID. - :paramtype publisher: str - :keyword product: The product ID. - :paramtype product: str - """ - super().__init__(**kwargs) - self.name = name - self.publisher = publisher - self.product = product - - -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, # pylint: disable=redefined-builtin - 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: Any - ) -> None: - """ - :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().__init__(id=id, **kwargs) - self.publisher = publisher - self.offer = offer - self.sku = sku - self.version = version - self.exact_version: Optional[str] = None - self.shared_gallery_image_id = shared_gallery_image_id - self.community_gallery_image_id = community_gallery_image_id - - -class ImageStorageProfile(_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.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.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["_models.ImageOSDisk"] = None, - data_disks: Optional[list["_models.ImageDataDisk"]] = None, - zone_resilient: Optional[bool] = None, - **kwargs: Any - ) -> None: - """ - :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.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.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().__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: 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.models.SubResource - :ivar storage_profile: Specifies the storage settings for the virtual machine disks. - :vartype storage_profile: ~azure.mgmt.compute.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. Known - values are: "V1" and "V2". - :vartype hyper_v_generation: str or ~azure.mgmt.compute.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["_models.SubResource"] = None, - storage_profile: Optional["_models.ImageStorageProfile"] = None, - hyper_v_generation: Optional[Union[str, "_models.HyperVGenerationTypes"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword 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.models.SubResource - :keyword storage_profile: Specifies the storage settings for the virtual machine disks. - :paramtype storage_profile: ~azure.mgmt.compute.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. Known values are: "V1" and "V2". - :paramtype hyper_v_generation: str or ~azure.mgmt.compute.models.HyperVGenerationTypes - """ - super().__init__(tags=tags, **kwargs) - self.source_virtual_machine = source_virtual_machine - self.storage_profile = storage_profile - self.provisioning_state: Optional[str] = None - self.hyper_v_generation = hyper_v_generation - - -class ImageVersionSecurityProfile(_serialization.Model): - """The security profile of a gallery image version. - - :ivar uefi_settings: Contains UEFI settings for the image version. - :vartype uefi_settings: ~azure.mgmt.compute.models.GalleryImageVersionUefiSettings - """ - - _attribute_map = { - "uefi_settings": {"key": "uefiSettings", "type": "GalleryImageVersionUefiSettings"}, - } - - def __init__( - self, *, uefi_settings: Optional["_models.GalleryImageVersionUefiSettings"] = None, **kwargs: Any - ) -> None: - """ - :keyword uefi_settings: Contains UEFI settings for the image version. - :paramtype uefi_settings: ~azure.mgmt.compute.models.GalleryImageVersionUefiSettings - """ - super().__init__(**kwargs) - self.uefi_settings = uefi_settings - - -class InnerError(_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: Any - ) -> None: - """ - :keyword exceptiontype: The exception type. - :paramtype exceptiontype: str - :keyword errordetail: The internal error message or exception dump. - :paramtype errordetail: str - """ - super().__init__(**kwargs) - self.exceptiontype = exceptiontype - self.errordetail = errordetail - - -class InstanceSku(_serialization.Model): - """The role instance SKU. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name: The sku name. - :vartype name: str - :ivar tier: The tier of the cloud service role instance. - :vartype tier: str - """ - - _validation = { - "name": {"readonly": True}, - "tier": {"readonly": True}, - } - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "tier": {"key": "tier", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.name: Optional[str] = None - self.tier: Optional[str] = None - - -class InstanceViewStatus(_serialization.Model): - """Instance view status. - - :ivar code: The status code. - :vartype code: str - :ivar level: The level code. Known values are: "Info", "Warning", and "Error". - :vartype level: str or ~azure.mgmt.compute.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, "_models.StatusLevelTypes"]] = None, - display_status: Optional[str] = None, - message: Optional[str] = None, - time: Optional[datetime.datetime] = None, - **kwargs: Any - ) -> None: - """ - :keyword code: The status code. - :paramtype code: str - :keyword level: The level code. Known values are: "Info", "Warning", and "Error". - :paramtype level: str or ~azure.mgmt.compute.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().__init__(**kwargs) - self.code = code - self.level = level - self.display_status = display_status - self.message = message - self.time = time - - -class InstanceViewStatusesSummary(_serialization.Model): - """Instance view statuses. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar statuses_summary: The summary. - :vartype statuses_summary: list[~azure.mgmt.compute.models.StatusCodeCount] - """ - - _validation = { - "statuses_summary": {"readonly": True}, - } - - _attribute_map = { - "statuses_summary": {"key": "statusesSummary", "type": "[StatusCodeCount]"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.statuses_summary: Optional[list["_models.StatusCodeCount"]] = None - - -class KeyForDiskEncryptionSet(_serialization.Model): - """Key Vault Key Url to be used for server side encryption of Managed Disks and Snapshots. - - All required parameters must be populated in order to send to server. - - :ivar source_vault: Resource id of the KeyVault containing the key or secret. This property is - optional and cannot be used if the KeyVault subscription is not the same as the Disk Encryption - Set subscription. - :vartype source_vault: ~azure.mgmt.compute.models.SourceVault - :ivar key_url: Fully versioned Key Url pointing to a key in KeyVault. Version segment of the - Url is required regardless of rotationToLatestKeyVersionEnabled value. Required. - :vartype key_url: str - """ - - _validation = { - "key_url": {"required": True}, - } - - _attribute_map = { - "source_vault": {"key": "sourceVault", "type": "SourceVault"}, - "key_url": {"key": "keyUrl", "type": "str"}, - } - - def __init__(self, *, key_url: str, source_vault: Optional["_models.SourceVault"] = None, **kwargs: Any) -> None: - """ - :keyword source_vault: Resource id of the KeyVault containing the key or secret. This property - is optional and cannot be used if the KeyVault subscription is not the same as the Disk - Encryption Set subscription. - :paramtype source_vault: ~azure.mgmt.compute.models.SourceVault - :keyword key_url: Fully versioned Key Url pointing to a key in KeyVault. Version segment of the - Url is required regardless of rotationToLatestKeyVersionEnabled value. Required. - :paramtype key_url: str - """ - super().__init__(**kwargs) - self.source_vault = source_vault - self.key_url = key_url - - -class KeyVaultAndKeyReference(_serialization.Model): - """Key Vault Key Url and vault id of KeK, KeK is optional and when provided is used to unwrap the - encryptionKey. - - All required parameters must be populated in order to send to server. - - :ivar source_vault: Resource id of the KeyVault containing the key or secret. Required. - :vartype source_vault: ~azure.mgmt.compute.models.SourceVault - :ivar key_url: Url pointing to a key or secret in KeyVault. Required. - :vartype key_url: str - """ - - _validation = { - "source_vault": {"required": True}, - "key_url": {"required": True}, - } - - _attribute_map = { - "source_vault": {"key": "sourceVault", "type": "SourceVault"}, - "key_url": {"key": "keyUrl", "type": "str"}, - } - - def __init__(self, *, source_vault: "_models.SourceVault", key_url: str, **kwargs: Any) -> None: - """ - :keyword source_vault: Resource id of the KeyVault containing the key or secret. Required. - :paramtype source_vault: ~azure.mgmt.compute.models.SourceVault - :keyword key_url: Url pointing to a key or secret in KeyVault. Required. - :paramtype key_url: str - """ - super().__init__(**kwargs) - self.source_vault = source_vault - self.key_url = key_url - - -class KeyVaultAndSecretReference(_serialization.Model): - """Key Vault Secret Url and vault id of the encryption key. - - All required parameters must be populated in order to send to server. - - :ivar source_vault: Resource id of the KeyVault containing the key or secret. Required. - :vartype source_vault: ~azure.mgmt.compute.models.SourceVault - :ivar secret_url: Url pointing to a key or secret in KeyVault. Required. - :vartype secret_url: str - """ - - _validation = { - "source_vault": {"required": True}, - "secret_url": {"required": True}, - } - - _attribute_map = { - "source_vault": {"key": "sourceVault", "type": "SourceVault"}, - "secret_url": {"key": "secretUrl", "type": "str"}, - } - - def __init__(self, *, source_vault: "_models.SourceVault", secret_url: str, **kwargs: Any) -> None: - """ - :keyword source_vault: Resource id of the KeyVault containing the key or secret. Required. - :paramtype source_vault: ~azure.mgmt.compute.models.SourceVault - :keyword secret_url: Url pointing to a key or secret in KeyVault. Required. - :paramtype secret_url: str - """ - super().__init__(**kwargs) - self.source_vault = source_vault - self.secret_url = secret_url - - -class KeyVaultKeyReference(_serialization.Model): - """Describes a reference to Key Vault Key. - - All required parameters must be populated in order to send to server. - - :ivar key_url: The URL referencing a key encryption key in Key Vault. Required. - :vartype key_url: str - :ivar source_vault: The relative URL of the Key Vault containing the key. Required. - :vartype source_vault: ~azure.mgmt.compute.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: "_models.SubResource", **kwargs: Any) -> None: - """ - :keyword key_url: The URL referencing a key encryption key in Key Vault. Required. - :paramtype key_url: str - :keyword source_vault: The relative URL of the Key Vault containing the key. Required. - :paramtype source_vault: ~azure.mgmt.compute.models.SubResource - """ - super().__init__(**kwargs) - self.key_url = key_url - self.source_vault = source_vault - - -class KeyVaultSecretReference(_serialization.Model): - """Describes a reference to Key Vault Secret. - - All required parameters must be populated in order to send to server. - - :ivar secret_url: The URL referencing a secret in a Key Vault. Required. - :vartype secret_url: str - :ivar source_vault: The relative URL of the Key Vault containing the secret. Required. - :vartype source_vault: ~azure.mgmt.compute.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: "_models.SubResource", **kwargs: Any) -> None: - """ - :keyword secret_url: The URL referencing a secret in a Key Vault. Required. - :paramtype secret_url: str - :keyword source_vault: The relative URL of the Key Vault containing the secret. Required. - :paramtype source_vault: ~azure.mgmt.compute.models.SubResource - """ - super().__init__(**kwargs) - self.secret_url = secret_url - self.source_vault = source_vault - - -class LastPatchInstallationSummary(_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.". Known values are: "Unknown", "InProgress", "Failed", "Succeeded", - and "CompletedWithWarnings". - :vartype status: str or ~azure.mgmt.compute.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.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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.status: Optional[Union[str, "_models.PatchOperationStatus"]] = None - self.installation_activity_id: Optional[str] = None - self.maintenance_window_exceeded: Optional[bool] = None - self.not_selected_patch_count: Optional[int] = None - self.excluded_patch_count: Optional[int] = None - self.pending_patch_count: Optional[int] = None - self.installed_patch_count: Optional[int] = None - self.failed_patch_count: Optional[int] = None - self.start_time: Optional[datetime.datetime] = None - self.last_modified_time: Optional[datetime.datetime] = None - self.error: Optional["_models.ApiError"] = None - - -class LinuxConfiguration(_serialization.Model): - """Specifies the Linux operating system settings on the virtual machine. 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.models.SshConfiguration - :ivar provision_vm_agent: Indicates whether virtual machine agent should be provisioned on the - virtual machine. 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.models.LinuxPatchSettings - :ivar enable_vm_agent_platform_updates: Indicates whether VMAgent Platform Updates is enabled - for the Linux virtual machine. Default value is false. - :vartype enable_vm_agent_platform_updates: bool - """ - - _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"}, - "enable_vm_agent_platform_updates": {"key": "enableVMAgentPlatformUpdates", "type": "bool"}, - } - - def __init__( - self, - *, - disable_password_authentication: Optional[bool] = None, - ssh: Optional["_models.SshConfiguration"] = None, - provision_vm_agent: Optional[bool] = None, - patch_settings: Optional["_models.LinuxPatchSettings"] = None, - enable_vm_agent_platform_updates: Optional[bool] = None, - **kwargs: Any - ) -> None: - """ - :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.models.SshConfiguration - :keyword provision_vm_agent: Indicates whether virtual machine agent should be provisioned on - the virtual machine. 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.models.LinuxPatchSettings - :keyword enable_vm_agent_platform_updates: Indicates whether VMAgent Platform Updates is - enabled for the Linux virtual machine. Default value is false. - :paramtype enable_vm_agent_platform_updates: bool - """ - super().__init__(**kwargs) - self.disable_password_authentication = disable_password_authentication - self.ssh = ssh - self.provision_vm_agent = provision_vm_agent - self.patch_settings = patch_settings - self.enable_vm_agent_platform_updates = enable_vm_agent_platform_updates - - -class LinuxParameters(_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.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, "_models.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: Any - ) -> None: - """ - :keyword classifications_to_include: The update classifications to select when installing - patches for Linux. - :paramtype classifications_to_include: list[str or - ~azure.mgmt.compute.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().__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(_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. Known values are: - "ImageDefault" and "AutomaticByPlatform". - :vartype patch_mode: str or ~azure.mgmt.compute.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. Known values are: "ImageDefault" - and "AutomaticByPlatform". - :vartype assessment_mode: str or ~azure.mgmt.compute.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.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, "_models.LinuxVMGuestPatchMode"]] = None, - assessment_mode: Optional[Union[str, "_models.LinuxPatchAssessmentMode"]] = None, - automatic_by_platform_settings: Optional["_models.LinuxVMGuestPatchAutomaticByPlatformSettings"] = None, - **kwargs: Any - ) -> None: - """ - :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. Known values are: - "ImageDefault" and "AutomaticByPlatform". - :paramtype patch_mode: str or ~azure.mgmt.compute.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. Known values are: "ImageDefault" - and "AutomaticByPlatform". - :paramtype assessment_mode: str or ~azure.mgmt.compute.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.models.LinuxVMGuestPatchAutomaticByPlatformSettings - """ - super().__init__(**kwargs) - self.patch_mode = patch_mode - self.assessment_mode = assessment_mode - self.automatic_by_platform_settings = automatic_by_platform_settings - - -class LinuxVMGuestPatchAutomaticByPlatformSettings(_serialization.Model): # pylint: disable=name-too-long - """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. Known values are: "Unknown", "IfRequired", "Never", and "Always". - :vartype reboot_setting: str or - ~azure.mgmt.compute.models.LinuxVMGuestPatchAutomaticByPlatformRebootSetting - :ivar bypass_platform_safety_checks_on_user_schedule: Enables customer to schedule patching - without accidental upgrades. - :vartype bypass_platform_safety_checks_on_user_schedule: bool - """ - - _attribute_map = { - "reboot_setting": {"key": "rebootSetting", "type": "str"}, - "bypass_platform_safety_checks_on_user_schedule": { - "key": "bypassPlatformSafetyChecksOnUserSchedule", - "type": "bool", - }, - } - - def __init__( - self, - *, - reboot_setting: Optional[Union[str, "_models.LinuxVMGuestPatchAutomaticByPlatformRebootSetting"]] = None, - bypass_platform_safety_checks_on_user_schedule: Optional[bool] = None, - **kwargs: Any - ) -> None: - """ - :keyword reboot_setting: Specifies the reboot setting for all AutomaticByPlatform patch - installation operations. Known values are: "Unknown", "IfRequired", "Never", and "Always". - :paramtype reboot_setting: str or - ~azure.mgmt.compute.models.LinuxVMGuestPatchAutomaticByPlatformRebootSetting - :keyword bypass_platform_safety_checks_on_user_schedule: Enables customer to schedule patching - without accidental upgrades. - :paramtype bypass_platform_safety_checks_on_user_schedule: bool - """ - super().__init__(**kwargs) - self.reboot_setting = reboot_setting - self.bypass_platform_safety_checks_on_user_schedule = bypass_platform_safety_checks_on_user_schedule - - -class ListUsagesResult(_serialization.Model): - """The List Usages operation response. - - All required parameters must be populated in order to send to server. - - :ivar value: The list of compute resource usages. Required. - :vartype value: list[~azure.mgmt.compute.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["_models.Usage"], next_link: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword value: The list of compute resource usages. Required. - :paramtype value: list[~azure.mgmt.compute.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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class LoadBalancerConfiguration(_serialization.Model): - """Describes the load balancer configuration. - - All required parameters must be populated in order to send to server. - - :ivar id: Resource Id. - :vartype id: str - :ivar name: The name of the Load balancer. Required. - :vartype name: str - :ivar properties: Properties of the load balancer configuration. Required. - :vartype properties: ~azure.mgmt.compute.models.LoadBalancerConfigurationProperties - """ - - _validation = { - "name": {"required": True}, - "properties": {"required": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "properties": {"key": "properties", "type": "LoadBalancerConfigurationProperties"}, - } - - def __init__( - self, - *, - name: str, - properties: "_models.LoadBalancerConfigurationProperties", - id: Optional[str] = None, # pylint: disable=redefined-builtin - **kwargs: Any - ) -> None: - """ - :keyword id: Resource Id. - :paramtype id: str - :keyword name: The name of the Load balancer. Required. - :paramtype name: str - :keyword properties: Properties of the load balancer configuration. Required. - :paramtype properties: ~azure.mgmt.compute.models.LoadBalancerConfigurationProperties - """ - super().__init__(**kwargs) - self.id = id - self.name = name - self.properties = properties - - -class LoadBalancerConfigurationProperties(_serialization.Model): - """Describes the properties of the load balancer configuration. - - All required parameters must be populated in order to send to server. - - :ivar frontend_ip_configurations: Specifies the frontend IP to be used for the load balancer. - Only IPv4 frontend IP address is supported. Each load balancer configuration must have exactly - one frontend IP configuration. Required. - :vartype frontend_ip_configurations: - list[~azure.mgmt.compute.models.LoadBalancerFrontendIpConfiguration] - """ - - _validation = { - "frontend_ip_configurations": {"required": True}, - } - - _attribute_map = { - "frontend_ip_configurations": { - "key": "frontendIpConfigurations", - "type": "[LoadBalancerFrontendIpConfiguration]", - }, - } - - def __init__( - self, *, frontend_ip_configurations: list["_models.LoadBalancerFrontendIpConfiguration"], **kwargs: Any - ) -> None: - """ - :keyword frontend_ip_configurations: Specifies the frontend IP to be used for the load - balancer. Only IPv4 frontend IP address is supported. Each load balancer configuration must - have exactly one frontend IP configuration. Required. - :paramtype frontend_ip_configurations: - list[~azure.mgmt.compute.models.LoadBalancerFrontendIpConfiguration] - """ - super().__init__(**kwargs) - self.frontend_ip_configurations = frontend_ip_configurations - - -class LoadBalancerFrontendIpConfiguration(_serialization.Model): - """Specifies the frontend IP to be used for the load balancer. Only IPv4 frontend IP address is - supported. Each load balancer configuration must have exactly one frontend IP configuration. - - All required parameters must be populated in order to send to server. - - :ivar name: The name of the resource that is unique within the set of frontend IP - configurations used by the load balancer. This name can be used to access the resource. - Required. - :vartype name: str - :ivar properties: Properties of load balancer frontend ip configuration. Required. - :vartype properties: ~azure.mgmt.compute.models.LoadBalancerFrontendIpConfigurationProperties - """ - - _validation = { - "name": {"required": True}, - "properties": {"required": True}, - } - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "properties": {"key": "properties", "type": "LoadBalancerFrontendIpConfigurationProperties"}, - } - - def __init__( - self, *, name: str, properties: "_models.LoadBalancerFrontendIpConfigurationProperties", **kwargs: Any - ) -> None: - """ - :keyword name: The name of the resource that is unique within the set of frontend IP - configurations used by the load balancer. This name can be used to access the resource. - Required. - :paramtype name: str - :keyword properties: Properties of load balancer frontend ip configuration. Required. - :paramtype properties: ~azure.mgmt.compute.models.LoadBalancerFrontendIpConfigurationProperties - """ - super().__init__(**kwargs) - self.name = name - self.properties = properties - - -class LoadBalancerFrontendIpConfigurationProperties(_serialization.Model): # pylint: disable=name-too-long - """Describes a cloud service IP Configuration. - - :ivar public_ip_address: The reference to the public ip address resource. - :vartype public_ip_address: ~azure.mgmt.compute.models.SubResource - :ivar subnet: The reference to the virtual network subnet resource. - :vartype subnet: ~azure.mgmt.compute.models.SubResource - :ivar private_ip_address: The virtual network private IP address of the IP configuration. - :vartype private_ip_address: str - """ - - _attribute_map = { - "public_ip_address": {"key": "publicIPAddress", "type": "SubResource"}, - "subnet": {"key": "subnet", "type": "SubResource"}, - "private_ip_address": {"key": "privateIPAddress", "type": "str"}, - } - - def __init__( - self, - *, - public_ip_address: Optional["_models.SubResource"] = None, - subnet: Optional["_models.SubResource"] = None, - private_ip_address: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword public_ip_address: The reference to the public ip address resource. - :paramtype public_ip_address: ~azure.mgmt.compute.models.SubResource - :keyword subnet: The reference to the virtual network subnet resource. - :paramtype subnet: ~azure.mgmt.compute.models.SubResource - :keyword private_ip_address: The virtual network private IP address of the IP configuration. - :paramtype private_ip_address: str - """ - super().__init__(**kwargs) - self.public_ip_address = public_ip_address - self.subnet = subnet - self.private_ip_address = private_ip_address - - -class LogAnalyticsInputBase(_serialization.Model): - """Api input base class for LogAnalytics Api. - - All required parameters must be populated in order to send to server. - - :ivar blob_container_sas_uri: SAS Uri of the logging blob container to which LogAnalytics Api - writes output logs to. Required. - :vartype blob_container_sas_uri: str - :ivar from_time: From time of the query. Required. - :vartype from_time: ~datetime.datetime - :ivar to_time: To time of the query. Required. - :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: Any - ) -> None: - """ - :keyword blob_container_sas_uri: SAS Uri of the logging blob container to which LogAnalytics - Api writes output logs to. Required. - :paramtype blob_container_sas_uri: str - :keyword from_time: From time of the query. Required. - :paramtype from_time: ~datetime.datetime - :keyword to_time: To time of the query. Required. - :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().__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(_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.models.LogAnalyticsOutput - """ - - _validation = { - "properties": {"readonly": True}, - } - - _attribute_map = { - "properties": {"key": "properties", "type": "LogAnalyticsOutput"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.properties: Optional["_models.LogAnalyticsOutput"] = None - - -class LogAnalyticsOutput(_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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.output: Optional[str] = None - - -class MaintenanceRedeployStatus(_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. Known values are: - "None", "RetryLater", "MaintenanceAborted", and "MaintenanceCompleted". - :vartype last_operation_result_code: str or - ~azure.mgmt.compute.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, "_models.MaintenanceOperationResultCodeTypes"]] = None, - last_operation_message: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :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. Known values - are: "None", "RetryLater", "MaintenanceAborted", and "MaintenanceCompleted". - :paramtype last_operation_result_code: str or - ~azure.mgmt.compute.models.MaintenanceOperationResultCodeTypes - :keyword last_operation_message: Message returned for the last Maintenance Operation. - :paramtype last_operation_message: str - """ - super().__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. Known values - are: "Standard_LRS", "Premium_LRS", "StandardSSD_LRS", "UltraSSD_LRS", "Premium_ZRS", - "StandardSSD_ZRS", and "PremiumV2_LRS". - :vartype storage_account_type: str or ~azure.mgmt.compute.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.models.DiskEncryptionSetParameters - :ivar security_profile: Specifies the security profile for the managed disk. - :vartype security_profile: ~azure.mgmt.compute.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, # pylint: disable=redefined-builtin - storage_account_type: Optional[Union[str, "_models.StorageAccountTypes"]] = None, - disk_encryption_set: Optional["_models.DiskEncryptionSetParameters"] = None, - security_profile: Optional["_models.VMDiskSecurityProfile"] = None, - **kwargs: Any - ) -> None: - """ - :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. Known values - are: "Standard_LRS", "Premium_LRS", "StandardSSD_LRS", "UltraSSD_LRS", "Premium_ZRS", - "StandardSSD_ZRS", and "PremiumV2_LRS". - :paramtype storage_account_type: str or ~azure.mgmt.compute.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.models.DiskEncryptionSetParameters - :keyword security_profile: Specifies the security profile for the managed disk. - :paramtype security_profile: ~azure.mgmt.compute.models.VMDiskSecurityProfile - """ - super().__init__(id=id, **kwargs) - self.storage_account_type = storage_account_type - self.disk_encryption_set = disk_encryption_set - self.security_profile = security_profile - - -class MaxInstancePercentPerZonePolicy(_serialization.Model): - """The configuration parameters used to limit the number of virtual machines per availability zone - in the virtual machine scale set. - - :ivar enabled: Specifies whether maxInstancePercentPerZonePolicy should be enabled on the - virtual machine scale set. - :vartype enabled: bool - :ivar value: Limit on the number of instances in each zone as a percentage of the total - capacity of the virtual machine scale set. - :vartype value: int - """ - - _validation = { - "value": {"maximum": 100}, - } - - _attribute_map = { - "enabled": {"key": "enabled", "type": "bool"}, - "value": {"key": "value", "type": "int"}, - } - - def __init__(self, *, enabled: Optional[bool] = None, value: Optional[int] = None, **kwargs: Any) -> None: - """ - :keyword enabled: Specifies whether maxInstancePercentPerZonePolicy should be enabled on the - virtual machine scale set. - :paramtype enabled: bool - :keyword value: Limit on the number of instances in each zone as a percentage of the total - capacity of the virtual machine scale set. - :paramtype value: int - """ - super().__init__(**kwargs) - self.enabled = enabled - self.value = value - - -class MigrateToVirtualMachineScaleSetInput(_serialization.Model): - """Describes the Virtual Machine Scale Set to migrate from Availability Set. - - All required parameters must be populated in order to send to server. - - :ivar virtual_machine_scale_set_flexible: Specifies information about the Virtual Machine Scale - Set that the Availability Set should be migrated to. Minimum api‐version: 2024‐11‐01. Required. - :vartype virtual_machine_scale_set_flexible: ~azure.mgmt.compute.models.SubResource - """ - - _validation = { - "virtual_machine_scale_set_flexible": {"required": True}, - } - - _attribute_map = { - "virtual_machine_scale_set_flexible": {"key": "virtualMachineScaleSetFlexible", "type": "SubResource"}, - } - - def __init__(self, *, virtual_machine_scale_set_flexible: "_models.SubResource", **kwargs: Any) -> None: - """ - :keyword virtual_machine_scale_set_flexible: Specifies information about the Virtual Machine - Scale Set that the Availability Set should be migrated to. Minimum api‐version: 2024‐11‐01. - Required. - :paramtype virtual_machine_scale_set_flexible: ~azure.mgmt.compute.models.SubResource - """ - super().__init__(**kwargs) - self.virtual_machine_scale_set_flexible = virtual_machine_scale_set_flexible - - -class MigrateVMToVirtualMachineScaleSetInput(_serialization.Model): - """The input of virtual machine migration from Availability Set to Flexible Virtual Machine Scale - Set. - - :ivar target_zone: The target zone of VM migration to Flexible Virtual Machine Scale Set. - :vartype target_zone: str - :ivar target_fault_domain: The target compute fault domain of VM migration to Flexible Virtual - Machine Scale Set. - :vartype target_fault_domain: int - :ivar target_vm_size: The target Virtual Machine size of VM migration to Flexible Virtual - Machine Scale Set. - :vartype target_vm_size: str - """ - - _attribute_map = { - "target_zone": {"key": "targetZone", "type": "str"}, - "target_fault_domain": {"key": "targetFaultDomain", "type": "int"}, - "target_vm_size": {"key": "targetVMSize", "type": "str"}, - } - - def __init__( - self, - *, - target_zone: Optional[str] = None, - target_fault_domain: Optional[int] = None, - target_vm_size: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword target_zone: The target zone of VM migration to Flexible Virtual Machine Scale Set. - :paramtype target_zone: str - :keyword target_fault_domain: The target compute fault domain of VM migration to Flexible - Virtual Machine Scale Set. - :paramtype target_fault_domain: int - :keyword target_vm_size: The target Virtual Machine size of VM migration to Flexible Virtual - Machine Scale Set. - :paramtype target_vm_size: str - """ - super().__init__(**kwargs) - self.target_zone = target_zone - self.target_fault_domain = target_fault_domain - self.target_vm_size = target_vm_size - - -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. - Known values are: "Delete" and "Detach". - :vartype delete_option: str or ~azure.mgmt.compute.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, # pylint: disable=redefined-builtin - primary: Optional[bool] = None, - delete_option: Optional[Union[str, "_models.DeleteOptions"]] = None, - **kwargs: Any - ) -> None: - """ - :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. - Known values are: "Delete" and "Detach". - :paramtype delete_option: str or ~azure.mgmt.compute.models.DeleteOptions - """ - super().__init__(id=id, **kwargs) - self.primary = primary - self.delete_option = delete_option - - -class NetworkProfile(_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.models.NetworkInterfaceReference] - :ivar network_api_version: specifies the Microsoft.Network API version used when creating - networking resources in the Network Interface Configurations. Known values are: "2020-11-01" - and "2022-11-01". - :vartype network_api_version: str or ~azure.mgmt.compute.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.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["_models.NetworkInterfaceReference"]] = None, - network_api_version: Optional[Union[str, "_models.NetworkApiVersion"]] = None, - network_interface_configurations: Optional[list["_models.VirtualMachineNetworkInterfaceConfiguration"]] = None, - **kwargs: Any - ) -> None: - """ - :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.models.NetworkInterfaceReference] - :keyword network_api_version: specifies the Microsoft.Network API version used when creating - networking resources in the Network Interface Configurations. Known values are: "2020-11-01" - and "2022-11-01". - :paramtype network_api_version: str or ~azure.mgmt.compute.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.models.VirtualMachineNetworkInterfaceConfiguration] - """ - super().__init__(**kwargs) - self.network_interfaces = network_interfaces - self.network_api_version = network_api_version - self.network_interface_configurations = network_interface_configurations - - -class Operation(_serialization.Model): - """Details of a REST API operation, returned from the Resource Provider Operations API. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name: The name of the operation, as per Resource-Based Access Control (RBAC). Examples: - "Microsoft.Compute/virtualMachines/write", "Microsoft.Compute/virtualMachines/capture/action". - :vartype name: str - :ivar is_data_action: Whether the operation applies to data-plane. This is "true" for - data-plane operations and "false" for ARM/control-plane operations. - :vartype is_data_action: bool - :ivar display: Localized display information for this particular operation. - :vartype display: ~azure.mgmt.compute.models.OperationDisplay - :ivar origin: The intended executor of the operation; as in Resource Based Access Control - (RBAC) and audit logs UX. Default value is "user,system". Known values are: "user", "system", - and "user,system". - :vartype origin: str or ~azure.mgmt.compute.models.Origin - :ivar action_type: Enum. Indicates the action type. "Internal" refers to actions that are for - internal only APIs. "Internal" - :vartype action_type: str or ~azure.mgmt.compute.models.ActionType - """ - - _validation = { - "name": {"readonly": True}, - "is_data_action": {"readonly": True}, - "origin": {"readonly": True}, - "action_type": {"readonly": True}, - } - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "is_data_action": {"key": "isDataAction", "type": "bool"}, - "display": {"key": "display", "type": "OperationDisplay"}, - "origin": {"key": "origin", "type": "str"}, - "action_type": {"key": "actionType", "type": "str"}, - } - - def __init__(self, *, display: Optional["_models.OperationDisplay"] = None, **kwargs: Any) -> None: - """ - :keyword display: Localized display information for this particular operation. - :paramtype display: ~azure.mgmt.compute.models.OperationDisplay - """ - super().__init__(**kwargs) - self.name: Optional[str] = None - self.is_data_action: Optional[bool] = None - self.display = display - self.origin: Optional[Union[str, "_models.Origin"]] = None - self.action_type: Optional[Union[str, "_models.ActionType"]] = None - - -class OperationDisplay(_serialization.Model): - """Localized display information for this particular operation. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar provider: The localized friendly form of the resource provider name, e.g. "Microsoft - Monitoring Insights" or "Microsoft Compute". - :vartype provider: str - :ivar resource: The localized friendly name of the resource type related to this operation. - E.g. "Virtual Machines" or "Job Schedule Collections". - :vartype resource: str - :ivar operation: The concise, localized friendly name for the operation; suitable for - dropdowns. E.g. "Create or Update Virtual Machine", "Restart Virtual Machine". - :vartype operation: str - :ivar description: The short, localized friendly description of the operation; suitable for - tool tips and detailed views. - :vartype description: str - """ - - _validation = { - "provider": {"readonly": True}, - "resource": {"readonly": True}, - "operation": {"readonly": True}, - "description": {"readonly": True}, - } - - _attribute_map = { - "provider": {"key": "provider", "type": "str"}, - "resource": {"key": "resource", "type": "str"}, - "operation": {"key": "operation", "type": "str"}, - "description": {"key": "description", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.provider: Optional[str] = None - self.resource: Optional[str] = None - self.operation: Optional[str] = None - self.description: Optional[str] = None - - -class OperationListResult(_serialization.Model): - """A list of REST API operations supported by an Azure Resource Provider. It contains an URL link - to get the next set of results. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: List of operations supported by the resource provider. - :vartype value: list[~azure.mgmt.compute.models.Operation] - :ivar next_link: URL to get the next set of operation list results (if there are any). - :vartype next_link: str - """ - - _validation = { - "value": {"readonly": True}, - "next_link": {"readonly": True}, - } - - _attribute_map = { - "value": {"key": "value", "type": "[Operation]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.value: Optional[list["_models.Operation"]] = None - self.next_link: Optional[str] = None - - -class OrchestrationServiceStateInput(_serialization.Model): - """The input for OrchestrationServiceState. - - All required parameters must be populated in order to send to server. - - :ivar service_name: The name of the service. Required. Known values are: "AutomaticRepairs" and - "AutomaticZoneRebalancing". - :vartype service_name: str or ~azure.mgmt.compute.models.OrchestrationServiceNames - :ivar action: The action to be performed. Required. Known values are: "Resume" and "Suspend". - :vartype action: str or ~azure.mgmt.compute.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, "_models.OrchestrationServiceNames"], - action: Union[str, "_models.OrchestrationServiceStateAction"], - **kwargs: Any - ) -> None: - """ - :keyword service_name: The name of the service. Required. Known values are: "AutomaticRepairs" - and "AutomaticZoneRebalancing". - :paramtype service_name: str or ~azure.mgmt.compute.models.OrchestrationServiceNames - :keyword action: The action to be performed. Required. Known values are: "Resume" and - "Suspend". - :paramtype action: str or ~azure.mgmt.compute.models.OrchestrationServiceStateAction - """ - super().__init__(**kwargs) - self.service_name = service_name - self.action = action - - -class OrchestrationServiceSummary(_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. Known values are: "AutomaticRepairs" and - "AutomaticZoneRebalancing". - :vartype service_name: str or ~azure.mgmt.compute.models.OrchestrationServiceNames - :ivar service_state: The current state of the service. Known values are: "NotRunning", - "Running", and "Suspended". - :vartype service_state: str or ~azure.mgmt.compute.models.OrchestrationServiceState - :ivar latest_operation_status: The latest operation status of the service. Minimum API version - for this property is 2025-04-01. Known values are: "InProgress" and "Completed". - :vartype latest_operation_status: str or - ~azure.mgmt.compute.models.OrchestrationServiceOperationStatus - :ivar last_status_change_time: The last UTC time when the operation status changed. Minimum API - version for this property is 2025-04-01. - :vartype last_status_change_time: ~datetime.datetime - """ - - _validation = { - "service_name": {"readonly": True}, - "service_state": {"readonly": True}, - "latest_operation_status": {"readonly": True}, - "last_status_change_time": {"readonly": True}, - } - - _attribute_map = { - "service_name": {"key": "serviceName", "type": "str"}, - "service_state": {"key": "serviceState", "type": "str"}, - "latest_operation_status": {"key": "latestOperationStatus", "type": "str"}, - "last_status_change_time": {"key": "lastStatusChangeTime", "type": "iso-8601"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.service_name: Optional[Union[str, "_models.OrchestrationServiceNames"]] = None - self.service_state: Optional[Union[str, "_models.OrchestrationServiceState"]] = None - self.latest_operation_status: Optional[Union[str, "_models.OrchestrationServiceOperationStatus"]] = None - self.last_status_change_time: Optional[datetime.datetime] = None - - -class OSDisk(_serialization.Model): - """Specifies information about the operating system disk used by the virtual machine. 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 server. - - :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. Possible values are: **Windows,** - **Linux.**. Known values are: "Windows" and "Linux". - :vartype os_type: str or ~azure.mgmt.compute.models.OperatingSystemTypes - :ivar encryption_settings: Specifies the encryption settings for the OS Disk. Minimum - api-version: 2015-06-15. - :vartype encryption_settings: ~azure.mgmt.compute.models.DiskEncryptionSettings - :ivar name: The disk name. - :vartype name: str - :ivar vhd: The virtual hard disk. - :vartype vhd: ~azure.mgmt.compute.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.models.VirtualHardDisk - :ivar caching: Specifies the caching requirements. Possible values are: **None,** **ReadOnly,** - **ReadWrite.** The defaulting behavior is: **None for Standard storage. ReadOnly for Premium - storage.**. Known values are: "None", "ReadOnly", and "ReadWrite". - :vartype caching: str or ~azure.mgmt.compute.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.models.DiffDiskSettings - :ivar create_option: Specifies how the virtual machine disk should be created. Possible values - are **Attach:** This value is used when you are using a specialized disk to create the virtual - machine. **FromImage:** This value is used when you are using an image to create the virtual - machine. If you are using a platform image, you should also use the imageReference element - described above. If you are using a marketplace image, you should also use the plan element - previously described. Required. Known values are: "FromImage", "Empty", "Attach", "Copy", and - "Restore". - :vartype create_option: str or ~azure.mgmt.compute.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. The property 'diskSizeGB' is - the number of bytes x 1024^3 for the disk and the value cannot be larger than 1023. - :vartype disk_size_gb: int - :ivar managed_disk: The managed disk parameters. - :vartype managed_disk: ~azure.mgmt.compute.models.ManagedDiskParameters - :ivar delete_option: Specifies whether OS Disk should be deleted or detached upon VM deletion. - Possible values are: **Delete.** If this value is used, the OS disk is deleted when VM is - deleted. **Detach.** If this value is used, the os disk is retained after VM is deleted. The - default value is set to **Detach**. For an ephemeral OS Disk, the default value is set to - **Delete**. The user cannot change the delete option for an ephemeral OS Disk. Known values - are: "Delete" and "Detach". - :vartype delete_option: str or ~azure.mgmt.compute.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, "_models.DiskCreateOptionTypes"], - os_type: Optional[Union[str, "_models.OperatingSystemTypes"]] = None, - encryption_settings: Optional["_models.DiskEncryptionSettings"] = None, - name: Optional[str] = None, - vhd: Optional["_models.VirtualHardDisk"] = None, - image: Optional["_models.VirtualHardDisk"] = None, - caching: Optional[Union[str, "_models.CachingTypes"]] = None, - write_accelerator_enabled: Optional[bool] = None, - diff_disk_settings: Optional["_models.DiffDiskSettings"] = None, - disk_size_gb: Optional[int] = None, - managed_disk: Optional["_models.ManagedDiskParameters"] = None, - delete_option: Optional[Union[str, "_models.DiskDeleteOptionTypes"]] = None, - **kwargs: Any - ) -> None: - """ - :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. Possible values are: - **Windows,** **Linux.**. Known values are: "Windows" and "Linux". - :paramtype os_type: str or ~azure.mgmt.compute.models.OperatingSystemTypes - :keyword encryption_settings: Specifies the encryption settings for the OS Disk. Minimum - api-version: 2015-06-15. - :paramtype encryption_settings: ~azure.mgmt.compute.models.DiskEncryptionSettings - :keyword name: The disk name. - :paramtype name: str - :keyword vhd: The virtual hard disk. - :paramtype vhd: ~azure.mgmt.compute.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.models.VirtualHardDisk - :keyword caching: Specifies the caching requirements. Possible values are: **None,** - **ReadOnly,** **ReadWrite.** The defaulting behavior is: **None for Standard storage. ReadOnly - for Premium storage.**. Known values are: "None", "ReadOnly", and "ReadWrite". - :paramtype caching: str or ~azure.mgmt.compute.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.models.DiffDiskSettings - :keyword create_option: Specifies how the virtual machine disk should be created. Possible - values are **Attach:** This value is used when you are using a specialized disk to create the - virtual machine. **FromImage:** This value is used when you are using an image to create the - virtual machine. If you are using a platform image, you should also use the imageReference - element described above. If you are using a marketplace image, you should also use the plan - element previously described. Required. Known values are: "FromImage", "Empty", "Attach", - "Copy", and "Restore". - :paramtype create_option: str or ~azure.mgmt.compute.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. The property 'diskSizeGB' - is the number of bytes x 1024^3 for the disk and the value cannot be larger than 1023. - :paramtype disk_size_gb: int - :keyword managed_disk: The managed disk parameters. - :paramtype managed_disk: ~azure.mgmt.compute.models.ManagedDiskParameters - :keyword delete_option: Specifies whether OS Disk should be deleted or detached upon VM - deletion. Possible values are: **Delete.** If this value is used, the OS disk is deleted when - VM is deleted. **Detach.** If this value is used, the os disk is retained after VM is deleted. - The default value is set to **Detach**. For an ephemeral OS Disk, the default value is set to - **Delete**. The user cannot change the delete option for an ephemeral OS Disk. Known values - are: "Delete" and "Detach". - :paramtype delete_option: str or ~azure.mgmt.compute.models.DiskDeleteOptionTypes - """ - super().__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(_serialization.Model): - """Contains the os disk image information. - - All required parameters must be populated in order to send to server. - - :ivar operating_system: The operating system of the osDiskImage. Required. Known values are: - "Windows" and "Linux". - :vartype operating_system: str or ~azure.mgmt.compute.models.OperatingSystemTypes - """ - - _validation = { - "operating_system": {"required": True}, - } - - _attribute_map = { - "operating_system": {"key": "operatingSystem", "type": "str"}, - } - - def __init__(self, *, operating_system: Union[str, "_models.OperatingSystemTypes"], **kwargs: Any) -> None: - """ - :keyword operating_system: The operating system of the osDiskImage. Required. Known values are: - "Windows" and "Linux". - :paramtype operating_system: str or ~azure.mgmt.compute.models.OperatingSystemTypes - """ - super().__init__(**kwargs) - self.operating_system = operating_system - - -class OSDiskImageEncryption(DiskImageEncryption): - """Contains encryption settings for an OS disk image. - - :ivar disk_encryption_set_id: A relative URI containing the resource ID of the disk encryption - set. - :vartype disk_encryption_set_id: str - :ivar security_profile: This property specifies the security profile of an OS disk image. - :vartype security_profile: ~azure.mgmt.compute.models.OSDiskImageSecurityProfile - """ - - _attribute_map = { - "disk_encryption_set_id": {"key": "diskEncryptionSetId", "type": "str"}, - "security_profile": {"key": "securityProfile", "type": "OSDiskImageSecurityProfile"}, - } - - def __init__( - self, - *, - disk_encryption_set_id: Optional[str] = None, - security_profile: Optional["_models.OSDiskImageSecurityProfile"] = None, - **kwargs: Any - ) -> None: - """ - :keyword disk_encryption_set_id: A relative URI containing the resource ID of the disk - encryption set. - :paramtype disk_encryption_set_id: str - :keyword security_profile: This property specifies the security profile of an OS disk image. - :paramtype security_profile: ~azure.mgmt.compute.models.OSDiskImageSecurityProfile - """ - super().__init__(disk_encryption_set_id=disk_encryption_set_id, **kwargs) - self.security_profile = security_profile - - -class OSDiskImageSecurityProfile(_serialization.Model): - """Contains security profile for an OS disk image. - - :ivar confidential_vm_encryption_type: confidential VM encryption types. Known values are: - "EncryptedVMGuestStateOnlyWithPmk", "EncryptedWithPmk", "EncryptedWithCmk", and - "NonPersistedTPM". - :vartype confidential_vm_encryption_type: str or - ~azure.mgmt.compute.models.ConfidentialVMEncryptionType - :ivar secure_vm_disk_encryption_set_id: secure VM disk encryption set id. - :vartype secure_vm_disk_encryption_set_id: str - """ - - _attribute_map = { - "confidential_vm_encryption_type": {"key": "confidentialVMEncryptionType", "type": "str"}, - "secure_vm_disk_encryption_set_id": {"key": "secureVMDiskEncryptionSetId", "type": "str"}, - } - - def __init__( - self, - *, - confidential_vm_encryption_type: Optional[Union[str, "_models.ConfidentialVMEncryptionType"]] = None, - secure_vm_disk_encryption_set_id: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword confidential_vm_encryption_type: confidential VM encryption types. Known values are: - "EncryptedVMGuestStateOnlyWithPmk", "EncryptedWithPmk", "EncryptedWithCmk", and - "NonPersistedTPM". - :paramtype confidential_vm_encryption_type: str or - ~azure.mgmt.compute.models.ConfidentialVMEncryptionType - :keyword secure_vm_disk_encryption_set_id: secure VM disk encryption set id. - :paramtype secure_vm_disk_encryption_set_id: str - """ - super().__init__(**kwargs) - self.confidential_vm_encryption_type = confidential_vm_encryption_type - self.secure_vm_disk_encryption_set_id = secure_vm_disk_encryption_set_id - - -class OSFamily(_serialization.Model): - """Describes a cloud service OS family. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Resource Id. - :vartype id: str - :ivar name: Resource name. - :vartype name: str - :ivar type: Resource type. - :vartype type: str - :ivar location: Resource location. - :vartype location: str - :ivar properties: OS family properties. - :vartype properties: ~azure.mgmt.compute.models.OSFamilyProperties - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "location": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "location": {"key": "location", "type": "str"}, - "properties": {"key": "properties", "type": "OSFamilyProperties"}, - } - - def __init__(self, *, properties: Optional["_models.OSFamilyProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: OS family properties. - :paramtype properties: ~azure.mgmt.compute.models.OSFamilyProperties - """ - super().__init__(**kwargs) - self.id: Optional[str] = None - self.name: Optional[str] = None - self.type: Optional[str] = None - self.location: Optional[str] = None - self.properties = properties - - -class OSFamilyListResult(_serialization.Model): - """The list operation result. - - All required parameters must be populated in order to send to server. - - :ivar value: The list of resources. Required. - :vartype value: list[~azure.mgmt.compute.models.OSFamily] - :ivar next_link: The URI to fetch the next page of resources. Use this to get the next page of - resources. Do this till nextLink is null to fetch all the resources. - :vartype next_link: str - """ - - _validation = { - "value": {"required": True}, - } - - _attribute_map = { - "value": {"key": "value", "type": "[OSFamily]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__(self, *, value: list["_models.OSFamily"], next_link: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword value: The list of resources. Required. - :paramtype value: list[~azure.mgmt.compute.models.OSFamily] - :keyword next_link: The URI to fetch the next page of resources. Use this to get the next page - of resources. Do this till nextLink is null to fetch all the resources. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class OSFamilyProperties(_serialization.Model): - """OS family properties. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name: The OS family name. - :vartype name: str - :ivar label: The OS family label. - :vartype label: str - :ivar versions: List of OS versions belonging to this family. - :vartype versions: list[~azure.mgmt.compute.models.OSVersionPropertiesBase] - """ - - _validation = { - "name": {"readonly": True}, - "label": {"readonly": True}, - "versions": {"readonly": True}, - } - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "label": {"key": "label", "type": "str"}, - "versions": {"key": "versions", "type": "[OSVersionPropertiesBase]"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.name: Optional[str] = None - self.label: Optional[str] = None - self.versions: Optional[list["_models.OSVersionPropertiesBase"]] = None - - -class OSImageNotificationProfile(_serialization.Model): - """OSImageNotificationProfile. - - :ivar not_before_timeout: Length of time a Virtual Machine being reimaged or having its OS - upgraded will have to potentially approve the OS Image Scheduled Event before the event is auto - approved (timed out). The configuration is specified in ISO 8601 format, and the value must be - 15 minutes (PT15M). - :vartype not_before_timeout: str - :ivar enable: Specifies whether the OS Image 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: Any - ) -> None: - """ - :keyword not_before_timeout: Length of time a Virtual Machine being reimaged or having its OS - upgraded will have to potentially approve the OS Image Scheduled Event before the event is auto - approved (timed out). The configuration is specified in ISO 8601 format, and the value must be - 15 minutes (PT15M). - :paramtype not_before_timeout: str - :keyword enable: Specifies whether the OS Image Scheduled event is enabled or disabled. - :paramtype enable: bool - """ - super().__init__(**kwargs) - self.not_before_timeout = not_before_timeout - self.enable = enable - - -class OSProfile(_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. This name cannot be - updated after the VM is created. **Max-length (Windows):** 15 characters. **Max-length - (Linux):** 64 characters. 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. **Note: Do not pass any secrets or passwords in - customData property.** This property cannot be updated after the VM is created. The property - 'customData' is passed to the VM to be saved as a file, for more information see `Custom Data - on Azure VMs `_. - 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.models.WindowsConfiguration - :ivar linux_configuration: Specifies the Linux operating system settings on the virtual - machine. For a list of supported Linux distributions, see `Linux on Azure-Endorsed - Distributions `_. - :vartype linux_configuration: ~azure.mgmt.compute.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.models.VaultSecretGroup] - :ivar allow_extension_operations: Specifies whether extension operations should be allowed on - the virtual machine. 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["_models.WindowsConfiguration"] = None, - linux_configuration: Optional["_models.LinuxConfiguration"] = None, - secrets: Optional[list["_models.VaultSecretGroup"]] = None, - allow_extension_operations: Optional[bool] = None, - require_guest_provision_signal: Optional[bool] = None, - **kwargs: Any - ) -> None: - """ - :keyword computer_name: Specifies the host OS name of the virtual machine. This name cannot be - updated after the VM is created. **Max-length (Windows):** 15 characters. **Max-length - (Linux):** 64 characters. 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. **Note: Do not pass any secrets or passwords in - customData property.** This property cannot be updated after the VM is created. The property - 'customData' is passed to the VM to be saved as a file, for more information see `Custom Data - on Azure VMs `_. - 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.models.WindowsConfiguration - :keyword linux_configuration: Specifies the Linux operating system settings on the virtual - machine. For a list of supported Linux distributions, see `Linux on Azure-Endorsed - Distributions `_. - :paramtype linux_configuration: ~azure.mgmt.compute.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.models.VaultSecretGroup] - :keyword allow_extension_operations: Specifies whether extension operations should be allowed - on the virtual machine. 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().__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 OSProfileProvisioningData(_serialization.Model): - """Additional parameters for Reimaging Non-Ephemeral Virtual Machine. - - :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. **Note: Do not pass any secrets or passwords in - customData property.** This property cannot be updated after the VM is created. The property - customData is passed to the VM to be saved as a file, for more information see `Custom Data on - Azure VMs `_. If - using cloud-init for your Linux VM, see `Using cloud-init to customize a Linux VM during - creation `_. - :vartype custom_data: str - """ - - _attribute_map = { - "admin_password": {"key": "adminPassword", "type": "str"}, - "custom_data": {"key": "customData", "type": "str"}, - } - - def __init__( - self, *, admin_password: Optional[str] = None, custom_data: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :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. **Note: Do not pass any secrets or passwords in - customData property.** This property cannot be updated after the VM is created. The property - customData is passed to the VM to be saved as a file, for more information see `Custom Data on - Azure VMs `_. If - using cloud-init for your Linux VM, see `Using cloud-init to customize a Linux VM during - creation `_. - :paramtype custom_data: str - """ - super().__init__(**kwargs) - self.admin_password = admin_password - self.custom_data = custom_data - - -class OSVersion(_serialization.Model): - """Describes a cloud service OS version. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Resource Id. - :vartype id: str - :ivar name: Resource name. - :vartype name: str - :ivar type: Resource type. - :vartype type: str - :ivar location: Resource location. - :vartype location: str - :ivar properties: OS version properties. - :vartype properties: ~azure.mgmt.compute.models.OSVersionProperties - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "location": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "location": {"key": "location", "type": "str"}, - "properties": {"key": "properties", "type": "OSVersionProperties"}, - } - - def __init__(self, *, properties: Optional["_models.OSVersionProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: OS version properties. - :paramtype properties: ~azure.mgmt.compute.models.OSVersionProperties - """ - super().__init__(**kwargs) - self.id: Optional[str] = None - self.name: Optional[str] = None - self.type: Optional[str] = None - self.location: Optional[str] = None - self.properties = properties - - -class OSVersionListResult(_serialization.Model): - """The list operation result. - - All required parameters must be populated in order to send to server. - - :ivar value: The list of resources. Required. - :vartype value: list[~azure.mgmt.compute.models.OSVersion] - :ivar next_link: The URI to fetch the next page of resources. Use this to get the next page of - resources. Do this till nextLink is null to fetch all the resources. - :vartype next_link: str - """ - - _validation = { - "value": {"required": True}, - } - - _attribute_map = { - "value": {"key": "value", "type": "[OSVersion]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__(self, *, value: list["_models.OSVersion"], next_link: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword value: The list of resources. Required. - :paramtype value: list[~azure.mgmt.compute.models.OSVersion] - :keyword next_link: The URI to fetch the next page of resources. Use this to get the next page - of resources. Do this till nextLink is null to fetch all the resources. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class OSVersionProperties(_serialization.Model): - """OS version properties. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar family: The family of this OS version. - :vartype family: str - :ivar family_label: The family label of this OS version. - :vartype family_label: str - :ivar version: The OS version. - :vartype version: str - :ivar label: The OS version label. - :vartype label: str - :ivar is_default: Specifies whether this is the default OS version for its family. - :vartype is_default: bool - :ivar is_active: Specifies whether this OS version is active. - :vartype is_active: bool - """ - - _validation = { - "family": {"readonly": True}, - "family_label": {"readonly": True}, - "version": {"readonly": True}, - "label": {"readonly": True}, - "is_default": {"readonly": True}, - "is_active": {"readonly": True}, - } - - _attribute_map = { - "family": {"key": "family", "type": "str"}, - "family_label": {"key": "familyLabel", "type": "str"}, - "version": {"key": "version", "type": "str"}, - "label": {"key": "label", "type": "str"}, - "is_default": {"key": "isDefault", "type": "bool"}, - "is_active": {"key": "isActive", "type": "bool"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.family: Optional[str] = None - self.family_label: Optional[str] = None - self.version: Optional[str] = None - self.label: Optional[str] = None - self.is_default: Optional[bool] = None - self.is_active: Optional[bool] = None - - -class OSVersionPropertiesBase(_serialization.Model): - """Configuration view of an OS version. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar version: The OS version. - :vartype version: str - :ivar label: The OS version label. - :vartype label: str - :ivar is_default: Specifies whether this is the default OS version for its family. - :vartype is_default: bool - :ivar is_active: Specifies whether this OS version is active. - :vartype is_active: bool - """ - - _validation = { - "version": {"readonly": True}, - "label": {"readonly": True}, - "is_default": {"readonly": True}, - "is_active": {"readonly": True}, - } - - _attribute_map = { - "version": {"key": "version", "type": "str"}, - "label": {"key": "label", "type": "str"}, - "is_default": {"key": "isDefault", "type": "bool"}, - "is_active": {"key": "isActive", "type": "bool"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.version: Optional[str] = None - self.label: Optional[str] = None - self.is_default: Optional[bool] = None - self.is_active: Optional[bool] = None - - -class PatchInstallationDetail(_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. - Known values are: "Unknown", "Installed", "Failed", "Excluded", "NotSelected", and "Pending". - :vartype installation_state: str or ~azure.mgmt.compute.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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.patch_id: Optional[str] = None - self.name: Optional[str] = None - self.version: Optional[str] = None - self.kb_id: Optional[str] = None - self.classifications: Optional[list[str]] = None - self.installation_state: Optional[Union[str, "_models.PatchInstallationState"]] = None - - -class PatchSettings(_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. Known values are: "Manual", "AutomaticByOS", and "AutomaticByPlatform". - :vartype patch_mode: str or ~azure.mgmt.compute.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. Known values are: "ImageDefault" - and "AutomaticByPlatform". - :vartype assessment_mode: str or ~azure.mgmt.compute.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.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, "_models.WindowsVMGuestPatchMode"]] = None, - enable_hotpatching: Optional[bool] = None, - assessment_mode: Optional[Union[str, "_models.WindowsPatchAssessmentMode"]] = None, - automatic_by_platform_settings: Optional["_models.WindowsVMGuestPatchAutomaticByPlatformSettings"] = None, - **kwargs: Any - ) -> None: - """ - :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. Known values are: "Manual", "AutomaticByOS", and "AutomaticByPlatform". - :paramtype patch_mode: str or ~azure.mgmt.compute.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. Known values are: "ImageDefault" - and "AutomaticByPlatform". - :paramtype assessment_mode: str or ~azure.mgmt.compute.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.models.WindowsVMGuestPatchAutomaticByPlatformSettings - """ - super().__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 PirResource(_serialization.Model): - """The Resource model definition. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name: Resource name. - :vartype name: str - :ivar location: Resource location. - :vartype location: str - """ - - _validation = { - "name": {"readonly": True}, - "location": {"readonly": True}, - } - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "location": {"key": "location", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.name: Optional[str] = None - self.location: Optional[str] = None - - -class PirSharedGalleryResource(PirResource): - """Base information about the shared gallery resource in pir. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name: Resource name. - :vartype name: str - :ivar location: Resource location. - :vartype location: str - :ivar unique_id: The unique id of this shared gallery. - :vartype unique_id: str - """ - - _validation = { - "name": {"readonly": True}, - "location": {"readonly": True}, - } - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "location": {"key": "location", "type": "str"}, - "unique_id": {"key": "identifier.uniqueId", "type": "str"}, - } - - def __init__(self, *, unique_id: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword unique_id: The unique id of this shared gallery. - :paramtype unique_id: str - """ - super().__init__(**kwargs) - self.unique_id = unique_id - - -class Placement(_serialization.Model): - """Describes the user-defined constraints for resource hardware placement. - - :ivar zone_placement_policy: Specifies the policy for resource's placement in availability - zone. Possible values are: **Any** (used for Virtual Machines), **Auto** (used for Virtual - Machine Scale Sets) - An availability zone will be automatically picked by system as part of - resource creation. Known values are: "Any" and "Auto". - :vartype zone_placement_policy: str or ~azure.mgmt.compute.models.ZonePlacementPolicyType - :ivar include_zones: This property supplements the 'zonePlacementPolicy' property. If - 'zonePlacementPolicy' is set to 'Any'/'Auto', availability zone selected by the system must be - present in the list of availability zones passed with 'includeZones'. If 'includeZones' is not - provided, all availability zones in region will be considered for selection. - :vartype include_zones: list[str] - :ivar exclude_zones: This property supplements the 'zonePlacementPolicy' property. If - 'zonePlacementPolicy' is set to 'Any'/'Auto', availability zone selected by the system must not - be present in the list of availability zones passed with 'excludeZones'. If 'excludeZones' is - not provided, all availability zones in region will be considered for selection. - :vartype exclude_zones: list[str] - """ - - _attribute_map = { - "zone_placement_policy": {"key": "zonePlacementPolicy", "type": "str"}, - "include_zones": {"key": "includeZones", "type": "[str]"}, - "exclude_zones": {"key": "excludeZones", "type": "[str]"}, - } - - def __init__( - self, - *, - zone_placement_policy: Optional[Union[str, "_models.ZonePlacementPolicyType"]] = None, - include_zones: Optional[list[str]] = None, - exclude_zones: Optional[list[str]] = None, - **kwargs: Any - ) -> None: - """ - :keyword zone_placement_policy: Specifies the policy for resource's placement in availability - zone. Possible values are: **Any** (used for Virtual Machines), **Auto** (used for Virtual - Machine Scale Sets) - An availability zone will be automatically picked by system as part of - resource creation. Known values are: "Any" and "Auto". - :paramtype zone_placement_policy: str or ~azure.mgmt.compute.models.ZonePlacementPolicyType - :keyword include_zones: This property supplements the 'zonePlacementPolicy' property. If - 'zonePlacementPolicy' is set to 'Any'/'Auto', availability zone selected by the system must be - present in the list of availability zones passed with 'includeZones'. If 'includeZones' is not - provided, all availability zones in region will be considered for selection. - :paramtype include_zones: list[str] - :keyword exclude_zones: This property supplements the 'zonePlacementPolicy' property. If - 'zonePlacementPolicy' is set to 'Any'/'Auto', availability zone selected by the system must not - be present in the list of availability zones passed with 'excludeZones'. If 'excludeZones' is - not provided, all availability zones in region will be considered for selection. - :paramtype exclude_zones: list[str] - """ - super().__init__(**kwargs) - self.zone_placement_policy = zone_placement_policy - self.include_zones = include_zones - self.exclude_zones = exclude_zones - - -class Plan(_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: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.name = name - self.publisher = publisher - self.product = product - self.promotion_code = promotion_code - - -class PlatformAttribute(_serialization.Model): - """This is the platform attribute of the image version. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name: This property specifies the name of the platformAttribute. It is read-only. - :vartype name: str - :ivar value: This property specifies the value of the corresponding name property. It is - read-only. - :vartype value: str - """ - - _validation = { - "name": {"readonly": True}, - "value": {"readonly": True}, - } - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "value": {"key": "value", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.name: Optional[str] = None - self.value: Optional[str] = None - - -class PolicyViolation(_serialization.Model): - """A policy violation reported against a gallery artifact. - - :ivar category: Describes the nature of the policy violation. Known values are: "Other", - "ImageFlaggedUnsafe", "CopyrightValidation", and "IpTheft". - :vartype category: str or ~azure.mgmt.compute.models.PolicyViolationCategory - :ivar details: Describes specific details about why this policy violation was reported. - :vartype details: str - """ - - _attribute_map = { - "category": {"key": "category", "type": "str"}, - "details": {"key": "details", "type": "str"}, - } - - def __init__( - self, - *, - category: Optional[Union[str, "_models.PolicyViolationCategory"]] = None, - details: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword category: Describes the nature of the policy violation. Known values are: "Other", - "ImageFlaggedUnsafe", "CopyrightValidation", and "IpTheft". - :paramtype category: str or ~azure.mgmt.compute.models.PolicyViolationCategory - :keyword details: Describes specific details about why this policy violation was reported. - :paramtype details: str - """ - super().__init__(**kwargs) - self.category = category - self.details = details - - -class PriorityMixPolicy(_serialization.Model): - """Specifies the target splits for Spot and Regular priority VMs within a scale set with flexible - orchestration mode. With this property the customer is able to specify the base number of - regular priority VMs created as the VMSS flex instance scales out and the split between Spot - and Regular priority VMs after this base target has been reached. - - :ivar base_regular_priority_count: The base number of regular priority VMs that will be created - in this scale set as it scales out. - :vartype base_regular_priority_count: int - :ivar regular_priority_percentage_above_base: The percentage of VM instances, after the base - regular priority count has been reached, that are expected to use regular priority. - :vartype regular_priority_percentage_above_base: int - """ - - _validation = { - "regular_priority_percentage_above_base": {"maximum": 100}, - } - - _attribute_map = { - "base_regular_priority_count": {"key": "baseRegularPriorityCount", "type": "int"}, - "regular_priority_percentage_above_base": {"key": "regularPriorityPercentageAboveBase", "type": "int"}, - } - - def __init__( - self, - *, - base_regular_priority_count: Optional[int] = None, - regular_priority_percentage_above_base: Optional[int] = None, - **kwargs: Any - ) -> None: - """ - :keyword base_regular_priority_count: The base number of regular priority VMs that will be - created in this scale set as it scales out. - :paramtype base_regular_priority_count: int - :keyword regular_priority_percentage_above_base: The percentage of VM instances, after the base - regular priority count has been reached, that are expected to use regular priority. - :paramtype regular_priority_percentage_above_base: int - """ - super().__init__(**kwargs) - self.base_regular_priority_count = base_regular_priority_count - self.regular_priority_percentage_above_base = regular_priority_percentage_above_base - - -class PrivateEndpoint(_serialization.Model): - """The Private Endpoint resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: The ARM identifier for Private Endpoint. - :vartype id: str - """ - - _validation = { - "id": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.id: Optional[str] = None - - -class PrivateEndpointConnection(ProxyResource): - """The Private Endpoint Connection resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.compute.models.SystemData - :ivar private_endpoint: The resource of private end point. - :vartype private_endpoint: ~azure.mgmt.compute.models.PrivateEndpoint - :ivar private_link_service_connection_state: A collection of information about the state of the - connection between DiskAccess and Virtual Network. - :vartype private_link_service_connection_state: - ~azure.mgmt.compute.models.PrivateLinkServiceConnectionState - :ivar provisioning_state: The provisioning state of the private endpoint connection resource. - Known values are: "Succeeded", "Creating", "Deleting", and "Failed". - :vartype provisioning_state: str or - ~azure.mgmt.compute.models.PrivateEndpointConnectionProvisioningState - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, - "private_endpoint": {"readonly": True}, - "provisioning_state": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - "private_endpoint": {"key": "properties.privateEndpoint", "type": "PrivateEndpoint"}, - "private_link_service_connection_state": { - "key": "properties.privateLinkServiceConnectionState", - "type": "PrivateLinkServiceConnectionState", - }, - "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, - } - - def __init__( - self, - *, - private_link_service_connection_state: Optional["_models.PrivateLinkServiceConnectionState"] = None, - **kwargs: Any - ) -> None: - """ - :keyword private_link_service_connection_state: A collection of information about the state of - the connection between DiskAccess and Virtual Network. - :paramtype private_link_service_connection_state: - ~azure.mgmt.compute.models.PrivateLinkServiceConnectionState - """ - super().__init__(**kwargs) - self.private_endpoint: Optional["_models.PrivateEndpoint"] = None - self.private_link_service_connection_state = private_link_service_connection_state - self.provisioning_state: Optional[Union[str, "_models.PrivateEndpointConnectionProvisioningState"]] = None - - -class PrivateEndpointConnectionListResult(_serialization.Model): - """A list of private link resources. - - All required parameters must be populated in order to send to server. - - :ivar value: The PrivateEndpointConnection items on this page. Required. - :vartype value: list[~azure.mgmt.compute.models.PrivateEndpointConnection] - :ivar next_link: The link to the next page of items. - :vartype next_link: str - """ - - _validation = { - "value": {"required": True}, - } - - _attribute_map = { - "value": {"key": "value", "type": "[PrivateEndpointConnection]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, *, value: list["_models.PrivateEndpointConnection"], next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: The PrivateEndpointConnection items on this page. Required. - :paramtype value: list[~azure.mgmt.compute.models.PrivateEndpointConnection] - :keyword next_link: The link to the next page of items. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class PrivateLinkResource(_serialization.Model): - """A private link resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: private link resource Id. - :vartype id: str - :ivar name: private link resource name. - :vartype name: str - :ivar type: private link resource type. - :vartype type: str - :ivar group_id: The private link resource group id. - :vartype group_id: str - :ivar required_members: The private link resource required member names. - :vartype required_members: list[str] - :ivar required_zone_names: The private link resource DNS zone name. - :vartype required_zone_names: list[str] - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "group_id": {"readonly": True}, - "required_members": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "group_id": {"key": "properties.groupId", "type": "str"}, - "required_members": {"key": "properties.requiredMembers", "type": "[str]"}, - "required_zone_names": {"key": "properties.requiredZoneNames", "type": "[str]"}, - } - - def __init__(self, *, required_zone_names: Optional[list[str]] = None, **kwargs: Any) -> None: - """ - :keyword required_zone_names: The private link resource DNS zone name. - :paramtype required_zone_names: list[str] - """ - super().__init__(**kwargs) - self.id: Optional[str] = None - self.name: Optional[str] = None - self.type: Optional[str] = None - self.group_id: Optional[str] = None - self.required_members: Optional[list[str]] = None - self.required_zone_names = required_zone_names - - -class PrivateLinkResourceListResult(_serialization.Model): - """A list of private link resources. - - :ivar value: Array of private link resources. - :vartype value: list[~azure.mgmt.compute.models.PrivateLinkResource] - """ - - _attribute_map = { - "value": {"key": "value", "type": "[PrivateLinkResource]"}, - } - - def __init__(self, *, value: Optional[list["_models.PrivateLinkResource"]] = None, **kwargs: Any) -> None: - """ - :keyword value: Array of private link resources. - :paramtype value: list[~azure.mgmt.compute.models.PrivateLinkResource] - """ - super().__init__(**kwargs) - self.value = value - - -class PrivateLinkServiceConnectionState(_serialization.Model): - """A collection of information about the state of the connection between service consumer and - provider. - - :ivar status: Indicates whether the connection has been Approved/Rejected/Removed by the owner - of the service. Known values are: "Pending", "Approved", and "Rejected". - :vartype status: str or ~azure.mgmt.compute.models.PrivateEndpointServiceConnectionStatus - :ivar description: The reason for approval/rejection of the connection. - :vartype description: str - :ivar actions_required: A message indicating if changes on the service provider require any - updates on the consumer. - :vartype actions_required: str - """ - - _attribute_map = { - "status": {"key": "status", "type": "str"}, - "description": {"key": "description", "type": "str"}, - "actions_required": {"key": "actionsRequired", "type": "str"}, - } - - def __init__( - self, - *, - status: Optional[Union[str, "_models.PrivateEndpointServiceConnectionStatus"]] = None, - description: Optional[str] = None, - actions_required: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword status: Indicates whether the connection has been Approved/Rejected/Removed by the - owner of the service. Known values are: "Pending", "Approved", and "Rejected". - :paramtype status: str or ~azure.mgmt.compute.models.PrivateEndpointServiceConnectionStatus - :keyword description: The reason for approval/rejection of the connection. - :paramtype description: str - :keyword actions_required: A message indicating if changes on the service provider require any - updates on the consumer. - :paramtype actions_required: str - """ - super().__init__(**kwargs) - self.status = status - self.description = description - self.actions_required = actions_required - - -class PropertyUpdatesInProgress(_serialization.Model): - """Properties of the disk for which update is pending. - - :ivar target_tier: The target performance tier of the disk if a tier change operation is in - progress. - :vartype target_tier: str - """ - - _attribute_map = { - "target_tier": {"key": "targetTier", "type": "str"}, - } - - def __init__(self, *, target_tier: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword target_tier: The target performance tier of the disk if a tier change operation is in - progress. - :paramtype target_tier: str - """ - super().__init__(**kwargs) - self.target_tier = target_tier - - -class ProximityPlacementGroup(TrackedResource): - """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 server. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.compute.models.SystemData - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - :ivar location: The geo-location where the resource lives. Required. - :vartype location: str - :ivar zones: The availability zones. - :vartype zones: list[str] - :ivar proximity_placement_group_type: Specifies the type of the proximity placement group. - Possible values are: **Standard** : Co-locate resources within an Azure region or Availability - Zone. **Ultra** : For future use. Known values are: "Standard" and "Ultra". - :vartype proximity_placement_group_type: str or - ~azure.mgmt.compute.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.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.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.models.SubResourceWithColocationStatus] - :ivar colocation_status: Describes colocation status of the Proximity Placement Group. - :vartype colocation_status: ~azure.mgmt.compute.models.InstanceViewStatus - :ivar intent: Specifies the user intent of the proximity placement group. - :vartype intent: ~azure.mgmt.compute.models.ProximityPlacementGroupPropertiesIntent - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"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"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - "tags": {"key": "tags", "type": "{str}"}, - "location": {"key": "location", "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, "_models.ProximityPlacementGroupType"]] = None, - colocation_status: Optional["_models.InstanceViewStatus"] = None, - intent: Optional["_models.ProximityPlacementGroupPropertiesIntent"] = None, - **kwargs: Any - ) -> None: - """ - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - :keyword location: The geo-location where the resource lives. Required. - :paramtype location: str - :keyword zones: The availability zones. - :paramtype zones: list[str] - :keyword proximity_placement_group_type: Specifies the type of the proximity placement group. - Possible values are: **Standard** : Co-locate resources within an Azure region or Availability - Zone. **Ultra** : For future use. Known values are: "Standard" and "Ultra". - :paramtype proximity_placement_group_type: str or - ~azure.mgmt.compute.models.ProximityPlacementGroupType - :keyword colocation_status: Describes colocation status of the Proximity Placement Group. - :paramtype colocation_status: ~azure.mgmt.compute.models.InstanceViewStatus - :keyword intent: Specifies the user intent of the proximity placement group. - :paramtype intent: ~azure.mgmt.compute.models.ProximityPlacementGroupPropertiesIntent - """ - super().__init__(tags=tags, location=location, **kwargs) - self.zones = zones - self.proximity_placement_group_type = proximity_placement_group_type - self.virtual_machines: Optional[list["_models.SubResourceWithColocationStatus"]] = None - self.virtual_machine_scale_sets: Optional[list["_models.SubResourceWithColocationStatus"]] = None - self.availability_sets: Optional[list["_models.SubResourceWithColocationStatus"]] = None - self.colocation_status = colocation_status - self.intent = intent - - -class ProximityPlacementGroupListResult(_serialization.Model): - """The List Proximity Placement Group operation response. - - All required parameters must be populated in order to send to server. - - :ivar value: The list of proximity placement groups. Required. - :vartype value: list[~azure.mgmt.compute.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["_models.ProximityPlacementGroup"], next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: The list of proximity placement groups. Required. - :paramtype value: list[~azure.mgmt.compute.models.ProximityPlacementGroup] - :keyword next_link: The URI to fetch the next page of proximity placement groups. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class ProximityPlacementGroupPropertiesIntent(_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: Any) -> None: - """ - :keyword vm_sizes: Specifies possible sizes of virtual machines that can be created in the - proximity placement group. - :paramtype vm_sizes: list[str] - """ - super().__init__(**kwargs) - self.vm_sizes = vm_sizes - - -class ProximityPlacementGroupUpdate(UpdateResource): - """Specifies information about the proximity placement group. - - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - """ - - -class ProxyAgentSettings(_serialization.Model): - """Specifies ProxyAgent settings for the virtual machine or virtual machine scale set. Minimum - api-version: 2023-09-01. - - :ivar enabled: Specifies whether ProxyAgent feature should be enabled on the virtual machine or - virtual machine scale set. - :vartype enabled: bool - :ivar mode: Specifies the mode that ProxyAgent will execute on. Warning: this property has been - deprecated, please specify 'mode' under particular hostendpoint setting. Known values are: - "Audit" and "Enforce". - :vartype mode: str or ~azure.mgmt.compute.models.Mode - :ivar key_incarnation_id: Increase the value of this property allows users to reset the key - used for securing communication channel between guest and host. - :vartype key_incarnation_id: int - :ivar wire_server: Specifies the Wire Server endpoint settings while creating the virtual - machine or virtual machine scale set. Minimum api-version: 2024-03-01. - :vartype wire_server: ~azure.mgmt.compute.models.HostEndpointSettings - :ivar imds: Specifies the IMDS endpoint settings while creating the virtual machine or virtual - machine scale set. Minimum api-version: 2024-03-01. - :vartype imds: ~azure.mgmt.compute.models.HostEndpointSettings - :ivar add_proxy_agent_extension: Specify whether to implicitly install the ProxyAgent - Extension. This option is currently applicable only for Linux Os. - :vartype add_proxy_agent_extension: bool - """ - - _attribute_map = { - "enabled": {"key": "enabled", "type": "bool"}, - "mode": {"key": "mode", "type": "str"}, - "key_incarnation_id": {"key": "keyIncarnationId", "type": "int"}, - "wire_server": {"key": "wireServer", "type": "HostEndpointSettings"}, - "imds": {"key": "imds", "type": "HostEndpointSettings"}, - "add_proxy_agent_extension": {"key": "addProxyAgentExtension", "type": "bool"}, - } - - def __init__( - self, - *, - enabled: Optional[bool] = None, - mode: Optional[Union[str, "_models.Mode"]] = None, - key_incarnation_id: Optional[int] = None, - wire_server: Optional["_models.HostEndpointSettings"] = None, - imds: Optional["_models.HostEndpointSettings"] = None, - add_proxy_agent_extension: Optional[bool] = None, - **kwargs: Any - ) -> None: - """ - :keyword enabled: Specifies whether ProxyAgent feature should be enabled on the virtual machine - or virtual machine scale set. - :paramtype enabled: bool - :keyword mode: Specifies the mode that ProxyAgent will execute on. Warning: this property has - been deprecated, please specify 'mode' under particular hostendpoint setting. Known values are: - "Audit" and "Enforce". - :paramtype mode: str or ~azure.mgmt.compute.models.Mode - :keyword key_incarnation_id: Increase the value of this property allows users to reset the key - used for securing communication channel between guest and host. - :paramtype key_incarnation_id: int - :keyword wire_server: Specifies the Wire Server endpoint settings while creating the virtual - machine or virtual machine scale set. Minimum api-version: 2024-03-01. - :paramtype wire_server: ~azure.mgmt.compute.models.HostEndpointSettings - :keyword imds: Specifies the IMDS endpoint settings while creating the virtual machine or - virtual machine scale set. Minimum api-version: 2024-03-01. - :paramtype imds: ~azure.mgmt.compute.models.HostEndpointSettings - :keyword add_proxy_agent_extension: Specify whether to implicitly install the ProxyAgent - Extension. This option is currently applicable only for Linux Os. - :paramtype add_proxy_agent_extension: bool - """ - super().__init__(**kwargs) - self.enabled = enabled - self.mode = mode - self.key_incarnation_id = key_incarnation_id - self.wire_server = wire_server - self.imds = imds - self.add_proxy_agent_extension = add_proxy_agent_extension - - -class PublicIPAddressSku(_serialization.Model): - """Describes the public IP Sku. It can only be set with OrchestrationMode as Flexible. - - :ivar name: Specify public IP sku name. Known values are: "Basic" and "Standard". - :vartype name: str or ~azure.mgmt.compute.models.PublicIPAddressSkuName - :ivar tier: Specify public IP sku tier. Known values are: "Regional", "Global", and "Global". - :vartype tier: str or ~azure.mgmt.compute.models.PublicIPAddressSkuTier - """ - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "tier": {"key": "tier", "type": "str"}, - } - - def __init__( - self, - *, - name: Optional[Union[str, "_models.PublicIPAddressSkuName"]] = None, - tier: Optional[Union[str, "_models.PublicIPAddressSkuTier"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword name: Specify public IP sku name. Known values are: "Basic" and "Standard". - :paramtype name: str or ~azure.mgmt.compute.models.PublicIPAddressSkuName - :keyword tier: Specify public IP sku tier. Known values are: "Regional", "Global", and - "Global". - :paramtype tier: str or ~azure.mgmt.compute.models.PublicIPAddressSkuTier - """ - super().__init__(**kwargs) - self.name = name - self.tier = tier - - -class PurchasePlan(_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 server. - - :ivar publisher: The publisher ID. Required. - :vartype publisher: str - :ivar name: The plan ID. Required. - :vartype name: str - :ivar product: Specifies the product of the image from the marketplace. This is the same value - as Offer under the imageReference element. Required. - :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: Any) -> None: - """ - :keyword publisher: The publisher ID. Required. - :paramtype publisher: str - :keyword name: The plan ID. Required. - :paramtype name: str - :keyword product: Specifies the product of the image from the marketplace. This is the same - value as Offer under the imageReference element. Required. - :paramtype product: str - """ - super().__init__(**kwargs) - self.publisher = publisher - self.name = name - self.product = product - - -class RecommendedMachineConfiguration(_serialization.Model): - """The properties describe the recommended machine configuration for this Image Definition. These - properties are updatable. - - :ivar v_cp_us: Describes the resource range. - :vartype v_cp_us: ~azure.mgmt.compute.models.ResourceRange - :ivar memory: Describes the resource range. - :vartype memory: ~azure.mgmt.compute.models.ResourceRange - """ - - _attribute_map = { - "v_cp_us": {"key": "vCPUs", "type": "ResourceRange"}, - "memory": {"key": "memory", "type": "ResourceRange"}, - } - - def __init__( - self, - *, - v_cp_us: Optional["_models.ResourceRange"] = None, - memory: Optional["_models.ResourceRange"] = None, - **kwargs: Any - ) -> None: - """ - :keyword v_cp_us: Describes the resource range. - :paramtype v_cp_us: ~azure.mgmt.compute.models.ResourceRange - :keyword memory: Describes the resource range. - :paramtype memory: ~azure.mgmt.compute.models.ResourceRange - """ - super().__init__(**kwargs) - self.v_cp_us = v_cp_us - self.memory = memory - - -class RecoveryWalkResponse(_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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.walk_performed: Optional[bool] = None - self.next_platform_update_domain: Optional[int] = None - - -class RegionalReplicationStatus(_serialization.Model): - """This is the regional replication status. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar region: The region to which the gallery image version is being replicated to. - :vartype region: str - :ivar state: This is the regional replication state. Known values are: "Unknown", - "Replicating", "Completed", and "Failed". - :vartype state: str or ~azure.mgmt.compute.models.ReplicationState - :ivar details: The details of the replication status. - :vartype details: str - :ivar progress: It indicates progress of the replication job. - :vartype progress: int - """ - - _validation = { - "region": {"readonly": True}, - "state": {"readonly": True}, - "details": {"readonly": True}, - "progress": {"readonly": True}, - } - - _attribute_map = { - "region": {"key": "region", "type": "str"}, - "state": {"key": "state", "type": "str"}, - "details": {"key": "details", "type": "str"}, - "progress": {"key": "progress", "type": "int"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.region: Optional[str] = None - self.state: Optional[Union[str, "_models.ReplicationState"]] = None - self.details: Optional[str] = None - self.progress: Optional[int] = None - - -class RegionalSharingStatus(_serialization.Model): - """Gallery regional sharing status. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar region: Region name. - :vartype region: str - :ivar state: Gallery sharing state in current region. Known values are: "Succeeded", - "InProgress", "Failed", and "Unknown". - :vartype state: str or ~azure.mgmt.compute.models.SharingState - :ivar details: Details of gallery regional sharing failure. - :vartype details: str - """ - - _validation = { - "state": {"readonly": True}, - } - - _attribute_map = { - "region": {"key": "region", "type": "str"}, - "state": {"key": "state", "type": "str"}, - "details": {"key": "details", "type": "str"}, - } - - def __init__(self, *, region: Optional[str] = None, details: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword region: Region name. - :paramtype region: str - :keyword details: Details of gallery regional sharing failure. - :paramtype details: str - """ - super().__init__(**kwargs) - self.region = region - self.state: Optional[Union[str, "_models.SharingState"]] = None - self.details = details - - -class ReplicationStatus(_serialization.Model): - """This is the replication status of the gallery image version. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar aggregated_state: This is the aggregated replication status based on all the regional - replication status flags. Known values are: "Unknown", "InProgress", "Completed", and "Failed". - :vartype aggregated_state: str or ~azure.mgmt.compute.models.AggregatedReplicationState - :ivar summary: This is a summary of replication status for each region. - :vartype summary: list[~azure.mgmt.compute.models.RegionalReplicationStatus] - """ - - _validation = { - "aggregated_state": {"readonly": True}, - "summary": {"readonly": True}, - } - - _attribute_map = { - "aggregated_state": {"key": "aggregatedState", "type": "str"}, - "summary": {"key": "summary", "type": "[RegionalReplicationStatus]"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.aggregated_state: Optional[Union[str, "_models.AggregatedReplicationState"]] = None - self.summary: Optional[list["_models.RegionalReplicationStatus"]] = None - - -class RequestRateByIntervalInput(LogAnalyticsInputBase): - """Api request input for LogAnalytics getRequestRateByInterval Api. - - All required parameters must be populated in order to send to server. - - :ivar blob_container_sas_uri: SAS Uri of the logging blob container to which LogAnalytics Api - writes output logs to. Required. - :vartype blob_container_sas_uri: str - :ivar from_time: From time of the query. Required. - :vartype from_time: ~datetime.datetime - :ivar to_time: To time of the query. Required. - :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: Interval value in minutes used to create LogAnalytics call rate logs. - Required. Known values are: "ThreeMins", "FiveMins", "ThirtyMins", and "SixtyMins". - :vartype interval_length: str or ~azure.mgmt.compute.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, "_models.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: Any - ) -> None: - """ - :keyword blob_container_sas_uri: SAS Uri of the logging blob container to which LogAnalytics - Api writes output logs to. Required. - :paramtype blob_container_sas_uri: str - :keyword from_time: From time of the query. Required. - :paramtype from_time: ~datetime.datetime - :keyword to_time: To time of the query. Required. - :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: Interval value in minutes used to create LogAnalytics call rate logs. - Required. Known values are: "ThreeMins", "FiveMins", "ThirtyMins", and "SixtyMins". - :paramtype interval_length: str or ~azure.mgmt.compute.models.IntervalInMins - """ - super().__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 ResiliencyPolicy(_serialization.Model): - """Describes an resiliency policy - AutomaticZoneRebalancingPolicy, ResilientVMCreationPolicy - and/or ResilientVMDeletionPolicy. - - :ivar resilient_vm_creation_policy: The configuration parameters used while performing - resilient VM creation. - :vartype resilient_vm_creation_policy: ~azure.mgmt.compute.models.ResilientVMCreationPolicy - :ivar resilient_vm_deletion_policy: The configuration parameters used while performing - resilient VM deletion. - :vartype resilient_vm_deletion_policy: ~azure.mgmt.compute.models.ResilientVMDeletionPolicy - :ivar automatic_zone_rebalancing_policy: The configuration parameters used while performing - automatic AZ balancing. - :vartype automatic_zone_rebalancing_policy: - ~azure.mgmt.compute.models.AutomaticZoneRebalancingPolicy - :ivar zone_allocation_policy: The configuration parameters used while performing zone - allocation. - :vartype zone_allocation_policy: ~azure.mgmt.compute.models.ZoneAllocationPolicy - """ - - _attribute_map = { - "resilient_vm_creation_policy": {"key": "resilientVMCreationPolicy", "type": "ResilientVMCreationPolicy"}, - "resilient_vm_deletion_policy": {"key": "resilientVMDeletionPolicy", "type": "ResilientVMDeletionPolicy"}, - "automatic_zone_rebalancing_policy": { - "key": "automaticZoneRebalancingPolicy", - "type": "AutomaticZoneRebalancingPolicy", - }, - "zone_allocation_policy": {"key": "zoneAllocationPolicy", "type": "ZoneAllocationPolicy"}, - } - - def __init__( - self, - *, - resilient_vm_creation_policy: Optional["_models.ResilientVMCreationPolicy"] = None, - resilient_vm_deletion_policy: Optional["_models.ResilientVMDeletionPolicy"] = None, - automatic_zone_rebalancing_policy: Optional["_models.AutomaticZoneRebalancingPolicy"] = None, - zone_allocation_policy: Optional["_models.ZoneAllocationPolicy"] = None, - **kwargs: Any - ) -> None: - """ - :keyword resilient_vm_creation_policy: The configuration parameters used while performing - resilient VM creation. - :paramtype resilient_vm_creation_policy: ~azure.mgmt.compute.models.ResilientVMCreationPolicy - :keyword resilient_vm_deletion_policy: The configuration parameters used while performing - resilient VM deletion. - :paramtype resilient_vm_deletion_policy: ~azure.mgmt.compute.models.ResilientVMDeletionPolicy - :keyword automatic_zone_rebalancing_policy: The configuration parameters used while performing - automatic AZ balancing. - :paramtype automatic_zone_rebalancing_policy: - ~azure.mgmt.compute.models.AutomaticZoneRebalancingPolicy - :keyword zone_allocation_policy: The configuration parameters used while performing zone - allocation. - :paramtype zone_allocation_policy: ~azure.mgmt.compute.models.ZoneAllocationPolicy - """ - super().__init__(**kwargs) - self.resilient_vm_creation_policy = resilient_vm_creation_policy - self.resilient_vm_deletion_policy = resilient_vm_deletion_policy - self.automatic_zone_rebalancing_policy = automatic_zone_rebalancing_policy - self.zone_allocation_policy = zone_allocation_policy - - -class ResilientVMCreationPolicy(_serialization.Model): - """The configuration parameters used while performing resilient VM creation. - - :ivar enabled: Specifies whether resilient VM creation should be enabled on the virtual machine - scale set. The default value is false. - :vartype enabled: bool - """ - - _attribute_map = { - "enabled": {"key": "enabled", "type": "bool"}, - } - - def __init__(self, *, enabled: Optional[bool] = None, **kwargs: Any) -> None: - """ - :keyword enabled: Specifies whether resilient VM creation should be enabled on the virtual - machine scale set. The default value is false. - :paramtype enabled: bool - """ - super().__init__(**kwargs) - self.enabled = enabled - - -class ResilientVMDeletionPolicy(_serialization.Model): - """The configuration parameters used while performing resilient VM deletion. - - :ivar enabled: Specifies whether resilient VM deletion should be enabled on the virtual machine - scale set. The default value is false. - :vartype enabled: bool - """ - - _attribute_map = { - "enabled": {"key": "enabled", "type": "bool"}, - } - - def __init__(self, *, enabled: Optional[bool] = None, **kwargs: Any) -> None: - """ - :keyword enabled: Specifies whether resilient VM deletion should be enabled on the virtual - machine scale set. The default value is false. - :paramtype enabled: bool - """ - super().__init__(**kwargs) - self.enabled = enabled - - -class ResourceInstanceViewStatus(_serialization.Model): - """Instance view status. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar code: The status code. - :vartype code: str - :ivar display_status: The short localizable label for the status. - :vartype display_status: str - :ivar message: The detailed status message, including for alerts and error messages. - :vartype message: str - :ivar time: The time of the status. - :vartype time: ~datetime.datetime - :ivar level: The level code. Known values are: "Info", "Warning", and "Error". - :vartype level: str or ~azure.mgmt.compute.models.StatusLevelTypes - """ - - _validation = { - "code": {"readonly": True}, - "display_status": {"readonly": True}, - "message": {"readonly": True}, - "time": {"readonly": True}, - } - - _attribute_map = { - "code": {"key": "code", "type": "str"}, - "display_status": {"key": "displayStatus", "type": "str"}, - "message": {"key": "message", "type": "str"}, - "time": {"key": "time", "type": "iso-8601"}, - "level": {"key": "level", "type": "str"}, - } - - def __init__(self, *, level: Optional[Union[str, "_models.StatusLevelTypes"]] = None, **kwargs: Any) -> None: - """ - :keyword level: The level code. Known values are: "Info", "Warning", and "Error". - :paramtype level: str or ~azure.mgmt.compute.models.StatusLevelTypes - """ - super().__init__(**kwargs) - self.code: Optional[str] = None - self.display_status: Optional[str] = None - self.message: Optional[str] = None - self.time: Optional[datetime.datetime] = None - self.level = level - - -class ResourceRange(_serialization.Model): - """Describes the resource range. - - :ivar min: The minimum number of the resource. - :vartype min: int - :ivar max: The maximum number of the resource. - :vartype max: int - """ - - _attribute_map = { - "min": {"key": "min", "type": "int"}, - "max": {"key": "max", "type": "int"}, - } - - def __init__( - self, - *, - min: Optional[int] = None, # pylint: disable=redefined-builtin - max: Optional[int] = None, # pylint: disable=redefined-builtin - **kwargs: Any - ) -> None: - """ - :keyword min: The minimum number of the resource. - :paramtype min: int - :keyword max: The maximum number of the resource. - :paramtype max: int - """ - super().__init__(**kwargs) - self.min = min - self.max = max - - -class ResourceSharingProfile(_serialization.Model): - """ResourceSharingProfile. - - :ivar subscription_ids: Specifies an array of subscription resource IDs that capacity - reservation group is shared with. Block Capacity Reservations does not support sharing across - subscriptions. **Note:** Minimum api-version: 2023-09-01. Please refer to - https://aka.ms/computereservationsharing for more details. - :vartype subscription_ids: list[~azure.mgmt.compute.models.SubResource] - """ - - _attribute_map = { - "subscription_ids": {"key": "subscriptionIds", "type": "[SubResource]"}, - } - - def __init__(self, *, subscription_ids: Optional[list["_models.SubResource"]] = None, **kwargs: Any) -> None: - """ - :keyword subscription_ids: Specifies an array of subscription resource IDs that capacity - reservation group is shared with. Block Capacity Reservations does not support sharing across - subscriptions. **Note:** Minimum api-version: 2023-09-01. Please refer to - https://aka.ms/computereservationsharing for more details. - :paramtype subscription_ids: list[~azure.mgmt.compute.models.SubResource] - """ - super().__init__(**kwargs) - self.subscription_ids = subscription_ids - - -class ResourceSku(_serialization.Model): - """Describes an available Compute SKU. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar resource_type: The type of resource the SKU applies to. - :vartype resource_type: str - :ivar name: The name of SKU. - :vartype name: str - :ivar tier: Specifies the tier of virtual machines in a scale set.\\ :code:`
`\\ - :code:`
` Possible Values:\\ :code:`
`\\ :code:`
` **Standard**\\ :code:`
`\\ :code:`
` **Basic**. - :vartype tier: str - :ivar size: The Size of the SKU. - :vartype size: str - :ivar family: The Family of this particular SKU. - :vartype family: str - :ivar kind: The Kind of resources that are supported in this SKU. - :vartype kind: str - :ivar capacity: Specifies the number of virtual machines in the scale set. - :vartype capacity: ~azure.mgmt.compute.models.ResourceSkuCapacity - :ivar locations: The set of locations that the SKU is available. - :vartype locations: list[str] - :ivar location_info: A list of locations and availability zones in those locations where the - SKU is available. - :vartype location_info: list[~azure.mgmt.compute.models.ResourceSkuLocationInfo] - :ivar api_versions: The api versions that support this SKU. - :vartype api_versions: list[str] - :ivar costs: Metadata for retrieving price info. - :vartype costs: list[~azure.mgmt.compute.models.ResourceSkuCosts] - :ivar capabilities: A name value pair to describe the capability. - :vartype capabilities: list[~azure.mgmt.compute.models.ResourceSkuCapabilities] - :ivar restrictions: The restrictions because of which SKU cannot be used. This is empty if - there are no restrictions. - :vartype restrictions: list[~azure.mgmt.compute.models.ResourceSkuRestrictions] - """ - - _validation = { - "resource_type": {"readonly": True}, - "name": {"readonly": True}, - "tier": {"readonly": True}, - "size": {"readonly": True}, - "family": {"readonly": True}, - "kind": {"readonly": True}, - "capacity": {"readonly": True}, - "locations": {"readonly": True}, - "location_info": {"readonly": True}, - "api_versions": {"readonly": True}, - "costs": {"readonly": True}, - "capabilities": {"readonly": True}, - "restrictions": {"readonly": True}, - } - - _attribute_map = { - "resource_type": {"key": "resourceType", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "tier": {"key": "tier", "type": "str"}, - "size": {"key": "size", "type": "str"}, - "family": {"key": "family", "type": "str"}, - "kind": {"key": "kind", "type": "str"}, - "capacity": {"key": "capacity", "type": "ResourceSkuCapacity"}, - "locations": {"key": "locations", "type": "[str]"}, - "location_info": {"key": "locationInfo", "type": "[ResourceSkuLocationInfo]"}, - "api_versions": {"key": "apiVersions", "type": "[str]"}, - "costs": {"key": "costs", "type": "[ResourceSkuCosts]"}, - "capabilities": {"key": "capabilities", "type": "[ResourceSkuCapabilities]"}, - "restrictions": {"key": "restrictions", "type": "[ResourceSkuRestrictions]"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.resource_type: Optional[str] = None - self.name: Optional[str] = None - self.tier: Optional[str] = None - self.size: Optional[str] = None - self.family: Optional[str] = None - self.kind: Optional[str] = None - self.capacity: Optional["_models.ResourceSkuCapacity"] = None - self.locations: Optional[list[str]] = None - self.location_info: Optional[list["_models.ResourceSkuLocationInfo"]] = None - self.api_versions: Optional[list[str]] = None - self.costs: Optional[list["_models.ResourceSkuCosts"]] = None - self.capabilities: Optional[list["_models.ResourceSkuCapabilities"]] = None - self.restrictions: Optional[list["_models.ResourceSkuRestrictions"]] = None - - -class ResourceSkuCapabilities(_serialization.Model): - """Describes The SKU capabilities object. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name: An invariant to describe the feature. - :vartype name: str - :ivar value: An invariant if the feature is measured by quantity. - :vartype value: str - """ - - _validation = { - "name": {"readonly": True}, - "value": {"readonly": True}, - } - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "value": {"key": "value", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.name: Optional[str] = None - self.value: Optional[str] = None - - -class ResourceSkuCapacity(_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: int - :ivar maximum: The maximum capacity that can be set. - :vartype maximum: int - :ivar default: The default capacity. - :vartype default: int - :ivar scale_type: The scale type applicable to the sku. Known values are: "Automatic", - "Manual", and "None". - :vartype scale_type: str or ~azure.mgmt.compute.models.ResourceSkuCapacityScaleType - """ - - _validation = { - "minimum": {"readonly": True}, - "maximum": {"readonly": True}, - "default": {"readonly": True}, - "scale_type": {"readonly": True}, - } - - _attribute_map = { - "minimum": {"key": "minimum", "type": "int"}, - "maximum": {"key": "maximum", "type": "int"}, - "default": {"key": "default", "type": "int"}, - "scale_type": {"key": "scaleType", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.minimum: Optional[int] = None - self.maximum: Optional[int] = None - self.default: Optional[int] = None - self.scale_type: Optional[Union[str, "_models.ResourceSkuCapacityScaleType"]] = None - - -class ResourceSkuCosts(_serialization.Model): - """Describes metadata for retrieving price info. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar meter_id: Used for querying price from commerce. - :vartype meter_id: str - :ivar quantity: The multiplier is needed to extend the base metered cost. - :vartype quantity: int - :ivar extended_unit: An invariant to show the extended unit. - :vartype extended_unit: str - """ - - _validation = { - "meter_id": {"readonly": True}, - "quantity": {"readonly": True}, - "extended_unit": {"readonly": True}, - } - - _attribute_map = { - "meter_id": {"key": "meterID", "type": "str"}, - "quantity": {"key": "quantity", "type": "int"}, - "extended_unit": {"key": "extendedUnit", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.meter_id: Optional[str] = None - self.quantity: Optional[int] = None - self.extended_unit: Optional[str] = None - - -class ResourceSkuLocationInfo(_serialization.Model): - """Describes an available Compute SKU Location Information. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar location: Location of the SKU. - :vartype location: str - :ivar zones: List of availability zones where the SKU is supported. - :vartype zones: list[str] - :ivar zone_details: Details of capabilities available to a SKU in specific zones. - :vartype zone_details: list[~azure.mgmt.compute.models.ResourceSkuZoneDetails] - :ivar extended_locations: The names of extended locations. - :vartype extended_locations: list[str] - :ivar type: The type of the extended location. "EdgeZone" - :vartype type: str or ~azure.mgmt.compute.models.ExtendedLocationType - """ - - _validation = { - "location": {"readonly": True}, - "zones": {"readonly": True}, - "zone_details": {"readonly": True}, - "extended_locations": {"readonly": True}, - "type": {"readonly": True}, - } - - _attribute_map = { - "location": {"key": "location", "type": "str"}, - "zones": {"key": "zones", "type": "[str]"}, - "zone_details": {"key": "zoneDetails", "type": "[ResourceSkuZoneDetails]"}, - "extended_locations": {"key": "extendedLocations", "type": "[str]"}, - "type": {"key": "type", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.location: Optional[str] = None - self.zones: Optional[list[str]] = None - self.zone_details: Optional[list["_models.ResourceSkuZoneDetails"]] = None - self.extended_locations: Optional[list[str]] = None - self.type: Optional[Union[str, "_models.ExtendedLocationType"]] = None - - -class ResourceSkuRestrictionInfo(_serialization.Model): - """Describes an available Compute SKU Restriction Information. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar locations: Locations where the SKU is restricted. - :vartype locations: list[str] - :ivar zones: List of availability zones where the SKU is restricted. - :vartype zones: list[str] - """ - - _validation = { - "locations": {"readonly": True}, - "zones": {"readonly": True}, - } - - _attribute_map = { - "locations": {"key": "locations", "type": "[str]"}, - "zones": {"key": "zones", "type": "[str]"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.locations: Optional[list[str]] = None - self.zones: Optional[list[str]] = None - - -class ResourceSkuRestrictions(_serialization.Model): - """Describes scaling information of a SKU. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar type: The type of restrictions. Known values are: "Location" and "Zone". - :vartype type: str or ~azure.mgmt.compute.models.ResourceSkuRestrictionsType - :ivar values: The value of restrictions. If the restriction type is set to location. This would - be different locations where the SKU is restricted. - :vartype values: list[str] - :ivar restriction_info: The information about the restriction where the SKU cannot be used. - :vartype restriction_info: ~azure.mgmt.compute.models.ResourceSkuRestrictionInfo - :ivar reason_code: The reason for restriction. Known values are: "QuotaId" and - "NotAvailableForSubscription". - :vartype reason_code: str or ~azure.mgmt.compute.models.ResourceSkuRestrictionsReasonCode - """ - - _validation = { - "type": {"readonly": True}, - "values": {"readonly": True}, - "restriction_info": {"readonly": True}, - "reason_code": {"readonly": True}, - } - - _attribute_map = { - "type": {"key": "type", "type": "str"}, - "values": {"key": "values", "type": "[str]"}, - "restriction_info": {"key": "restrictionInfo", "type": "ResourceSkuRestrictionInfo"}, - "reason_code": {"key": "reasonCode", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.type: Optional[Union[str, "_models.ResourceSkuRestrictionsType"]] = None - self.values: Optional[list[str]] = None - self.restriction_info: Optional["_models.ResourceSkuRestrictionInfo"] = None - self.reason_code: Optional[Union[str, "_models.ResourceSkuRestrictionsReasonCode"]] = None - - -class ResourceSkusResult(_serialization.Model): - """The List Resource Skus operation response. - - All required parameters must be populated in order to send to server. - - :ivar value: The ResourceSku items on this page. Required. - :vartype value: list[~azure.mgmt.compute.models.ResourceSku] - :ivar next_link: The link to the next page of items. - :vartype next_link: str - """ - - _validation = { - "value": {"required": True}, - } - - _attribute_map = { - "value": {"key": "value", "type": "[ResourceSku]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__(self, *, value: list["_models.ResourceSku"], next_link: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword value: The ResourceSku items on this page. Required. - :paramtype value: list[~azure.mgmt.compute.models.ResourceSku] - :keyword next_link: The link to the next page of items. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class ResourceSkuZoneDetails(_serialization.Model): - """Describes The zonal capabilities of a SKU. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name: The set of zones that the SKU is available in with the specified capabilities. - :vartype name: list[str] - :ivar capabilities: A list of capabilities that are available for the SKU in the specified list - of zones. - :vartype capabilities: list[~azure.mgmt.compute.models.ResourceSkuCapabilities] - """ - - _validation = { - "name": {"readonly": True}, - "capabilities": {"readonly": True}, - } - - _attribute_map = { - "name": {"key": "name", "type": "[str]"}, - "capabilities": {"key": "capabilities", "type": "[ResourceSkuCapabilities]"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.name: Optional[list[str]] = None - self.capabilities: Optional[list["_models.ResourceSkuCapabilities"]] = None - - -class ResourceUriList(_serialization.Model): - """The List resources which are encrypted with the disk encryption set. - - All required parameters must be populated in order to send to server. - - :ivar value: A list of IDs or Owner IDs of resources which are encrypted with the disk - encryption set. Required. - :vartype value: list[str] - :ivar next_link: The uri to fetch the next page of encrypted resources. Call ListNext() with - this to fetch the next page of encrypted resources. - :vartype next_link: str - """ - - _validation = { - "value": {"required": True}, - } - - _attribute_map = { - "value": {"key": "value", "type": "[str]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__(self, *, value: list[str], next_link: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword value: A list of IDs or Owner IDs of resources which are encrypted with the disk - encryption set. Required. - :paramtype value: list[str] - :keyword next_link: The uri to fetch the next page of encrypted resources. Call ListNext() with - this to fetch the next page of encrypted resources. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class ResourceWithOptionalLocation(_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: 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: Any) -> None: - """ - :keyword location: Resource location. - :paramtype location: str - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - """ - super().__init__(**kwargs) - self.location = location - self.id: Optional[str] = None - self.name: Optional[str] = None - self.type: Optional[str] = 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: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.compute.models.SystemData - :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.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.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. Known values are: - "CrashConsistent", "FileSystemConsistent", and "ApplicationConsistent". - :vartype consistency_mode: str or ~azure.mgmt.compute.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.models.ApiEntityReference - :ivar instance_view: The restore point instance view. - :vartype instance_view: ~azure.mgmt.compute.models.RestorePointInstanceView - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"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"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - "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["_models.ApiEntityReference"]] = None, - source_metadata: Optional["_models.RestorePointSourceMetadata"] = None, - consistency_mode: Optional[Union[str, "_models.ConsistencyModeTypes"]] = None, - time_created: Optional[datetime.datetime] = None, - source_restore_point: Optional["_models.ApiEntityReference"] = None, - **kwargs: Any - ) -> None: - """ - :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.models.ApiEntityReference] - :keyword source_metadata: Gets the details of the VM captured at the time of the restore point - creation. - :paramtype source_metadata: ~azure.mgmt.compute.models.RestorePointSourceMetadata - :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. Known values are: - "CrashConsistent", "FileSystemConsistent", and "ApplicationConsistent". - :paramtype consistency_mode: str or ~azure.mgmt.compute.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.models.ApiEntityReference - """ - super().__init__(**kwargs) - self.exclude_disks = exclude_disks - self.source_metadata = source_metadata - self.provisioning_state: Optional[str] = None - self.consistency_mode = consistency_mode - self.time_created = time_created - self.source_restore_point = source_restore_point - self.instance_view: Optional["_models.RestorePointInstanceView"] = None - - -class RestorePointCollection(TrackedResource): - """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 server. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.compute.models.SystemData - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - :ivar location: The geo-location where the resource lives. Required. - :vartype location: str - :ivar source: The properties of the source resource that this restore point collection is - created from. - :vartype source: ~azure.mgmt.compute.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.models.RestorePoint] - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"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"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - "tags": {"key": "tags", "type": "{str}"}, - "location": {"key": "location", "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["_models.RestorePointCollectionSourceProperties"] = None, - **kwargs: Any - ) -> None: - """ - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - :keyword location: The geo-location where the resource lives. Required. - :paramtype location: str - :keyword source: The properties of the source resource that this restore point collection is - created from. - :paramtype source: ~azure.mgmt.compute.models.RestorePointCollectionSourceProperties - """ - super().__init__(tags=tags, location=location, **kwargs) - self.source = source - self.provisioning_state: Optional[str] = None - self.restore_point_collection_id: Optional[str] = None - self.restore_points: Optional[list["_models.RestorePoint"]] = None - - -class RestorePointCollectionListResult(_serialization.Model): - """The List restore point collection operation response. - - All required parameters must be populated in order to send to server. - - :ivar value: Gets the list of restore point collections. Required. - :vartype value: list[~azure.mgmt.compute.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 - """ - - _validation = { - "value": {"required": True}, - } - - _attribute_map = { - "value": {"key": "value", "type": "[RestorePointCollection]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, *, value: list["_models.RestorePointCollection"], next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: Gets the list of restore point collections. Required. - :paramtype value: list[~azure.mgmt.compute.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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class RestorePointCollectionSourceProperties(_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: Any) -> None: # pylint: disable=redefined-builtin - """ - :keyword id: Resource Id of the source resource used to create this restore point collection. - :paramtype id: str - """ - super().__init__(**kwargs) - self.location: Optional[str] = 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: 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.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.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["_models.RestorePointCollectionSourceProperties"] = None, - **kwargs: Any - ) -> None: - """ - :keyword 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.models.RestorePointCollectionSourceProperties - """ - super().__init__(tags=tags, **kwargs) - self.source = source - self.provisioning_state: Optional[str] = None - self.restore_point_collection_id: Optional[str] = None - self.restore_points: Optional[list["_models.RestorePoint"]] = None - - -class RestorePointEncryption(_serialization.Model): - """Encryption at rest settings for disk restore point. It is an optional property that can be - specified in the input while creating a restore point. - - :ivar disk_encryption_set: Describes the parameter of customer managed disk encryption set - resource id that can be specified for disk. **Note:** The disk encryption set resource id can - only be specified for managed disk. Please refer https://aka.ms/mdssewithcmkoverview for more - details. - :vartype disk_encryption_set: ~azure.mgmt.compute.models.DiskEncryptionSetParameters - :ivar type: The type of key used to encrypt the data of the disk restore point. Known values - are: "EncryptionAtRestWithPlatformKey", "EncryptionAtRestWithCustomerKey", and - "EncryptionAtRestWithPlatformAndCustomerKeys". - :vartype type: str or ~azure.mgmt.compute.models.RestorePointEncryptionType - """ - - _attribute_map = { - "disk_encryption_set": {"key": "diskEncryptionSet", "type": "DiskEncryptionSetParameters"}, - "type": {"key": "type", "type": "str"}, - } - - def __init__( - self, - *, - disk_encryption_set: Optional["_models.DiskEncryptionSetParameters"] = None, - type: Optional[Union[str, "_models.RestorePointEncryptionType"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword disk_encryption_set: Describes the parameter of customer managed disk encryption set - resource id that can be specified for disk. **Note:** The disk encryption set resource id can - only be specified for managed disk. Please refer https://aka.ms/mdssewithcmkoverview for more - details. - :paramtype disk_encryption_set: ~azure.mgmt.compute.models.DiskEncryptionSetParameters - :keyword type: The type of key used to encrypt the data of the disk restore point. Known values - are: "EncryptionAtRestWithPlatformKey", "EncryptionAtRestWithCustomerKey", and - "EncryptionAtRestWithPlatformAndCustomerKeys". - :paramtype type: str or ~azure.mgmt.compute.models.RestorePointEncryptionType - """ - super().__init__(**kwargs) - self.disk_encryption_set = disk_encryption_set - self.type = type - - -class RestorePointInstanceView(_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.models.DiskRestorePointInstanceView] - :ivar statuses: The resource status information. - :vartype statuses: list[~azure.mgmt.compute.models.InstanceViewStatus] - """ - - _attribute_map = { - "disk_restore_points": {"key": "diskRestorePoints", "type": "[DiskRestorePointInstanceView]"}, - "statuses": {"key": "statuses", "type": "[InstanceViewStatus]"}, - } - - def __init__( - self, - *, - disk_restore_points: Optional[list["_models.DiskRestorePointInstanceView"]] = None, - statuses: Optional[list["_models.InstanceViewStatus"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword disk_restore_points: The disk restore points information. - :paramtype disk_restore_points: list[~azure.mgmt.compute.models.DiskRestorePointInstanceView] - :keyword statuses: The resource status information. - :paramtype statuses: list[~azure.mgmt.compute.models.InstanceViewStatus] - """ - super().__init__(**kwargs) - self.disk_restore_points = disk_restore_points - self.statuses = statuses - - -class RestorePointSourceMetadata(_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. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar hardware_profile: Gets the hardware profile. - :vartype hardware_profile: ~azure.mgmt.compute.models.HardwareProfile - :ivar storage_profile: Gets the storage profile. - :vartype storage_profile: ~azure.mgmt.compute.models.RestorePointSourceVMStorageProfile - :ivar os_profile: Gets the OS profile. - :vartype os_profile: ~azure.mgmt.compute.models.OSProfile - :ivar diagnostics_profile: Gets the diagnostics profile. - :vartype diagnostics_profile: ~azure.mgmt.compute.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.models.SecurityProfile - :ivar location: Location of the VM from which the restore point was created. - :vartype location: str - :ivar user_data: UserData associated with the source VM for which restore point is captured, - which is a base-64 encoded value. - :vartype user_data: str - :ivar hyper_v_generation: HyperVGeneration of the source VM for which restore point is - captured. Known values are: "V1" and "V2". - :vartype hyper_v_generation: str or ~azure.mgmt.compute.models.HyperVGenerationTypes - """ - - _validation = { - "hardware_profile": {"readonly": True}, - "os_profile": {"readonly": True}, - "diagnostics_profile": {"readonly": True}, - "license_type": {"readonly": True}, - "vm_id": {"readonly": True}, - "security_profile": {"readonly": True}, - "location": {"readonly": True}, - "user_data": {"readonly": True}, - "hyper_v_generation": {"readonly": True}, - } - - _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"}, - "user_data": {"key": "userData", "type": "str"}, - "hyper_v_generation": {"key": "hyperVGeneration", "type": "str"}, - } - - def __init__( - self, *, storage_profile: Optional["_models.RestorePointSourceVMStorageProfile"] = None, **kwargs: Any - ) -> None: - """ - :keyword storage_profile: Gets the storage profile. - :paramtype storage_profile: ~azure.mgmt.compute.models.RestorePointSourceVMStorageProfile - """ - super().__init__(**kwargs) - self.hardware_profile: Optional["_models.HardwareProfile"] = None - self.storage_profile = storage_profile - self.os_profile: Optional["_models.OSProfile"] = None - self.diagnostics_profile: Optional["_models.DiagnosticsProfile"] = None - self.license_type: Optional[str] = None - self.vm_id: Optional[str] = None - self.security_profile: Optional["_models.SecurityProfile"] = None - self.location: Optional[str] = None - self.user_data: Optional[str] = None - self.hyper_v_generation: Optional[Union[str, "_models.HyperVGenerationTypes"]] = None - - -class RestorePointSourceVMDataDisk(_serialization.Model): - """Describes a data disk. - - Variables are only populated by the server, and will be ignored when sending a request. - - :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. Known values are: "None", "ReadOnly", and "ReadWrite". - :vartype caching: str or ~azure.mgmt.compute.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: Contains the managed disk details. - :vartype managed_disk: ~azure.mgmt.compute.models.ManagedDiskParameters - :ivar disk_restore_point: Contains Disk Restore Point properties. - :vartype disk_restore_point: ~azure.mgmt.compute.models.DiskRestorePointAttributes - :ivar write_accelerator_enabled: Shows true if the disk is write-accelerator enabled. - :vartype write_accelerator_enabled: bool - """ - - _validation = { - "lun": {"readonly": True}, - "name": {"readonly": True}, - "caching": {"readonly": True}, - "disk_size_gb": {"readonly": True}, - "write_accelerator_enabled": {"readonly": True}, - } - - _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": "DiskRestorePointAttributes"}, - "write_accelerator_enabled": {"key": "writeAcceleratorEnabled", "type": "bool"}, - } - - def __init__( - self, - *, - managed_disk: Optional["_models.ManagedDiskParameters"] = None, - disk_restore_point: Optional["_models.DiskRestorePointAttributes"] = None, - **kwargs: Any - ) -> None: - """ - :keyword managed_disk: Contains the managed disk details. - :paramtype managed_disk: ~azure.mgmt.compute.models.ManagedDiskParameters - :keyword disk_restore_point: Contains Disk Restore Point properties. - :paramtype disk_restore_point: ~azure.mgmt.compute.models.DiskRestorePointAttributes - """ - super().__init__(**kwargs) - self.lun: Optional[int] = None - self.name: Optional[str] = None - self.caching: Optional[Union[str, "_models.CachingTypes"]] = None - self.disk_size_gb: Optional[int] = None - self.managed_disk = managed_disk - self.disk_restore_point = disk_restore_point - self.write_accelerator_enabled: Optional[bool] = None - - -class RestorePointSourceVMOSDisk(_serialization.Model): - """Describes an Operating System disk. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar os_type: Gets the Operating System type. Known values are: "Windows" and "Linux". - :vartype os_type: str or ~azure.mgmt.compute.models.OperatingSystemType - :ivar encryption_settings: Gets the disk encryption settings. - :vartype encryption_settings: ~azure.mgmt.compute.models.DiskEncryptionSettings - :ivar name: Gets the disk name. - :vartype name: str - :ivar caching: Gets the caching type. Known values are: "None", "ReadOnly", and "ReadWrite". - :vartype caching: str or ~azure.mgmt.compute.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.models.ManagedDiskParameters - :ivar disk_restore_point: Contains Disk Restore Point properties. - :vartype disk_restore_point: ~azure.mgmt.compute.models.DiskRestorePointAttributes - :ivar write_accelerator_enabled: Shows true if the disk is write-accelerator enabled. - :vartype write_accelerator_enabled: bool - """ - - _validation = { - "os_type": {"readonly": True}, - "encryption_settings": {"readonly": True}, - "name": {"readonly": True}, - "caching": {"readonly": True}, - "disk_size_gb": {"readonly": True}, - "write_accelerator_enabled": {"readonly": True}, - } - - _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": "DiskRestorePointAttributes"}, - "write_accelerator_enabled": {"key": "writeAcceleratorEnabled", "type": "bool"}, - } - - def __init__( - self, - *, - managed_disk: Optional["_models.ManagedDiskParameters"] = None, - disk_restore_point: Optional["_models.DiskRestorePointAttributes"] = None, - **kwargs: Any - ) -> None: - """ - :keyword managed_disk: Gets the managed disk details. - :paramtype managed_disk: ~azure.mgmt.compute.models.ManagedDiskParameters - :keyword disk_restore_point: Contains Disk Restore Point properties. - :paramtype disk_restore_point: ~azure.mgmt.compute.models.DiskRestorePointAttributes - """ - super().__init__(**kwargs) - self.os_type: Optional[Union[str, "_models.OperatingSystemType"]] = None - self.encryption_settings: Optional["_models.DiskEncryptionSettings"] = None - self.name: Optional[str] = None - self.caching: Optional[Union[str, "_models.CachingTypes"]] = None - self.disk_size_gb: Optional[int] = None - self.managed_disk = managed_disk - self.disk_restore_point = disk_restore_point - self.write_accelerator_enabled: Optional[bool] = None - - -class RestorePointSourceVMStorageProfile(_serialization.Model): - """Describes the storage profile. - - Variables are only populated by the server, and will be ignored when sending a request. - - :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.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.models.RestorePointSourceVMDataDisk] - :ivar disk_controller_type: Gets the disk controller type of the VM captured at the time of the - restore point creation. Known values are: "SCSI" and "NVMe". - :vartype disk_controller_type: str or ~azure.mgmt.compute.models.DiskControllerTypes - """ - - _validation = { - "disk_controller_type": {"readonly": True}, - } - - _attribute_map = { - "os_disk": {"key": "osDisk", "type": "RestorePointSourceVMOSDisk"}, - "data_disks": {"key": "dataDisks", "type": "[RestorePointSourceVMDataDisk]"}, - "disk_controller_type": {"key": "diskControllerType", "type": "str"}, - } - - def __init__( - self, - *, - os_disk: Optional["_models.RestorePointSourceVMOSDisk"] = None, - data_disks: Optional[list["_models.RestorePointSourceVMDataDisk"]] = None, - **kwargs: Any - ) -> None: - """ - :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.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.models.RestorePointSourceVMDataDisk] - """ - super().__init__(**kwargs) - self.os_disk = os_disk - self.data_disks = data_disks - self.disk_controller_type: Optional[Union[str, "_models.DiskControllerTypes"]] = None - - -class RetrieveBootDiagnosticsDataResult(_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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.console_screenshot_blob_uri: Optional[str] = None - self.serial_console_log_blob_uri: Optional[str] = None - - -class RoleInstance(_serialization.Model): - """Describes the cloud service role instance. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Resource Id. - :vartype id: str - :ivar name: Resource Name. - :vartype name: str - :ivar type: Resource Type. - :vartype type: str - :ivar location: Resource Location. - :vartype location: str - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - :ivar sku: The role instance SKU. - :vartype sku: ~azure.mgmt.compute.models.InstanceSku - :ivar properties: Role instance properties. - :vartype properties: ~azure.mgmt.compute.models.RoleInstanceProperties - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "location": {"readonly": True}, - "tags": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "location": {"key": "location", "type": "str"}, - "tags": {"key": "tags", "type": "{str}"}, - "sku": {"key": "sku", "type": "InstanceSku"}, - "properties": {"key": "properties", "type": "RoleInstanceProperties"}, - } - - def __init__( - self, - *, - sku: Optional["_models.InstanceSku"] = None, - properties: Optional["_models.RoleInstanceProperties"] = None, - **kwargs: Any - ) -> None: - """ - :keyword sku: The role instance SKU. - :paramtype sku: ~azure.mgmt.compute.models.InstanceSku - :keyword properties: Role instance properties. - :paramtype properties: ~azure.mgmt.compute.models.RoleInstanceProperties - """ - super().__init__(**kwargs) - self.id: Optional[str] = None - self.name: Optional[str] = None - self.type: Optional[str] = None - self.location: Optional[str] = None - self.tags: Optional[dict[str, str]] = None - self.sku = sku - self.properties = properties - - -class RoleInstanceListResult(_serialization.Model): - """The list operation result. - - All required parameters must be populated in order to send to server. - - :ivar value: The list of resources. Required. - :vartype value: list[~azure.mgmt.compute.models.RoleInstance] - :ivar next_link: The URI to fetch the next page of resources. Use this to get the next page of - resources. Do this till nextLink is null to fetch all the resources. - :vartype next_link: str - """ - - _validation = { - "value": {"required": True}, - } - - _attribute_map = { - "value": {"key": "value", "type": "[RoleInstance]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__(self, *, value: list["_models.RoleInstance"], next_link: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword value: The list of resources. Required. - :paramtype value: list[~azure.mgmt.compute.models.RoleInstance] - :keyword next_link: The URI to fetch the next page of resources. Use this to get the next page - of resources. Do this till nextLink is null to fetch all the resources. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class RoleInstanceNetworkProfile(_serialization.Model): - """Describes the network profile for the role instance. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar network_interfaces: Specifies the list of resource Ids for the network interfaces - associated with the role instance. - :vartype network_interfaces: list[~azure.mgmt.compute.models.SubResource] - """ - - _validation = { - "network_interfaces": {"readonly": True}, - } - - _attribute_map = { - "network_interfaces": {"key": "networkInterfaces", "type": "[SubResource]"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.network_interfaces: Optional[list["_models.SubResource"]] = None - - -class RoleInstanceProperties(_serialization.Model): - """Role instance properties. - - :ivar network_profile: Describes the network profile for the role instance. - :vartype network_profile: ~azure.mgmt.compute.models.RoleInstanceNetworkProfile - :ivar instance_view: The instance view of the role instance. - :vartype instance_view: ~azure.mgmt.compute.models.RoleInstanceView - """ - - _attribute_map = { - "network_profile": {"key": "networkProfile", "type": "RoleInstanceNetworkProfile"}, - "instance_view": {"key": "instanceView", "type": "RoleInstanceView"}, - } - - def __init__( - self, - *, - network_profile: Optional["_models.RoleInstanceNetworkProfile"] = None, - instance_view: Optional["_models.RoleInstanceView"] = None, - **kwargs: Any - ) -> None: - """ - :keyword network_profile: Describes the network profile for the role instance. - :paramtype network_profile: ~azure.mgmt.compute.models.RoleInstanceNetworkProfile - :keyword instance_view: The instance view of the role instance. - :paramtype instance_view: ~azure.mgmt.compute.models.RoleInstanceView - """ - super().__init__(**kwargs) - self.network_profile = network_profile - self.instance_view = instance_view - - -class RoleInstances(_serialization.Model): - """Specifies a list of role instances from the cloud service. - - All required parameters must be populated in order to send to server. - - :ivar role_instances: List of cloud service role instance names. Value of '*' will signify all - role instances of the cloud service. Required. - :vartype role_instances: list[str] - """ - - _validation = { - "role_instances": {"required": True}, - } - - _attribute_map = { - "role_instances": {"key": "roleInstances", "type": "[str]"}, - } - - def __init__(self, *, role_instances: list[str], **kwargs: Any) -> None: - """ - :keyword role_instances: List of cloud service role instance names. Value of '*' will signify - all role instances of the cloud service. Required. - :paramtype role_instances: list[str] - """ - super().__init__(**kwargs) - self.role_instances = role_instances - - -class RoleInstanceView(_serialization.Model): - """The instance view of the role instance. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar platform_update_domain: The Update Domain. - :vartype platform_update_domain: int - :ivar platform_fault_domain: The Fault Domain. - :vartype platform_fault_domain: int - :ivar private_id: Specifies a unique identifier generated internally for the cloud service - associated with this role instance. :code:`
`\\ :code:`
` NOTE: If you are using - Azure Diagnostics extension, this property can be used as 'DeploymentId' for querying details. - :vartype private_id: str - :ivar statuses: - :vartype statuses: list[~azure.mgmt.compute.models.ResourceInstanceViewStatus] - """ - - _validation = { - "platform_update_domain": {"readonly": True}, - "platform_fault_domain": {"readonly": True}, - "private_id": {"readonly": True}, - "statuses": {"readonly": True}, - } - - _attribute_map = { - "platform_update_domain": {"key": "platformUpdateDomain", "type": "int"}, - "platform_fault_domain": {"key": "platformFaultDomain", "type": "int"}, - "private_id": {"key": "privateId", "type": "str"}, - "statuses": {"key": "statuses", "type": "[ResourceInstanceViewStatus]"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.platform_update_domain: Optional[int] = None - self.platform_fault_domain: Optional[int] = None - self.private_id: Optional[str] = None - self.statuses: Optional[list["_models.ResourceInstanceViewStatus"]] = None - - -class RollbackStatusInfo(_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.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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.successfully_rolledback_instance_count: Optional[int] = None - self.failed_rolledback_instance_count: Optional[int] = None - self.rollback_error: Optional["_models.ApiError"] = None - - -class RollingUpgradePolicy(_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 - :ivar rollback_failed_instances_on_policy_breach: Rollback failed instances to previous model - if the Rolling Upgrade policy is violated. - :vartype rollback_failed_instances_on_policy_breach: bool - :ivar max_surge: Create new virtual machines to upgrade the scale set, rather than updating the - existing virtual machines. Existing virtual machines will be deleted once the new virtual - machines are created for each batch. - :vartype max_surge: 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}, - } - - _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"}, - "rollback_failed_instances_on_policy_breach": {"key": "rollbackFailedInstancesOnPolicyBreach", "type": "bool"}, - "max_surge": {"key": "maxSurge", "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, - rollback_failed_instances_on_policy_breach: Optional[bool] = None, - max_surge: Optional[bool] = None, - **kwargs: Any - ) -> None: - """ - :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 - :keyword rollback_failed_instances_on_policy_breach: Rollback failed instances to previous - model if the Rolling Upgrade policy is violated. - :paramtype rollback_failed_instances_on_policy_breach: bool - :keyword max_surge: Create new virtual machines to upgrade the scale set, rather than updating - the existing virtual machines. Existing virtual machines will be deleted once the new virtual - machines are created for each batch. - :paramtype max_surge: bool - """ - super().__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 - self.rollback_failed_instances_on_policy_breach = rollback_failed_instances_on_policy_breach - self.max_surge = max_surge - - -class RollingUpgradeProgressInfo(_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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.successful_instance_count: Optional[int] = None - self.failed_instance_count: Optional[int] = None - self.in_progress_instance_count: Optional[int] = None - self.pending_instance_count: Optional[int] = None - - -class RollingUpgradeRunningStatus(_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. Known values are: - "RollingForward", "Cancelled", "Completed", and "Faulted". - :vartype code: str or ~azure.mgmt.compute.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. Known values are: "Start" - and "Cancel". - :vartype last_action: str or ~azure.mgmt.compute.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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.code: Optional[Union[str, "_models.RollingUpgradeStatusCode"]] = None - self.start_time: Optional[datetime.datetime] = None - self.last_action: Optional[Union[str, "_models.RollingUpgradeActionType"]] = None - self.last_action_time: Optional[datetime.datetime] = None - - -class RollingUpgradeStatusInfo(TrackedResource): - """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 server. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.compute.models.SystemData - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - :ivar location: The geo-location where the resource lives. Required. - :vartype location: str - :ivar policy: The rolling upgrade policies applied for this upgrade. - :vartype policy: ~azure.mgmt.compute.models.RollingUpgradePolicy - :ivar running_status: Information about the current running state of the overall upgrade. - :vartype running_status: ~azure.mgmt.compute.models.RollingUpgradeRunningStatus - :ivar progress: Information about the number of virtual machine instances in each upgrade - state. - :vartype progress: ~azure.mgmt.compute.models.RollingUpgradeProgressInfo - :ivar error: Error details for this upgrade, if there are any. - :vartype error: ~azure.mgmt.compute.models.ApiError - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"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"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - "tags": {"key": "tags", "type": "{str}"}, - "location": {"key": "location", "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: Any) -> None: - """ - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - :keyword location: The geo-location where the resource lives. Required. - :paramtype location: str - """ - super().__init__(tags=tags, location=location, **kwargs) - self.policy: Optional["_models.RollingUpgradePolicy"] = None - self.running_status: Optional["_models.RollingUpgradeRunningStatus"] = None - self.progress: Optional["_models.RollingUpgradeProgressInfo"] = None - self.error: Optional["_models.ApiError"] = None - - -class RunCommandDocumentBase(_serialization.Model): - """Describes the properties of a Run Command metadata. - - All required parameters must be populated in order to send to server. - - :ivar schema: The VM run command schema. Required. - :vartype schema: str - :ivar id: The VM run command id. Required. - :vartype id: str - :ivar os_type: The Operating System type. Required. Known values are: "Windows" and "Linux". - :vartype os_type: str or ~azure.mgmt.compute.models.OperatingSystemTypes - :ivar label: The VM run command label. Required. - :vartype label: str - :ivar description: The VM run command description. Required. - :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, # pylint: disable=redefined-builtin - os_type: Union[str, "_models.OperatingSystemTypes"], - label: str, - description: str, - **kwargs: Any - ) -> None: - """ - :keyword schema: The VM run command schema. Required. - :paramtype schema: str - :keyword id: The VM run command id. Required. - :paramtype id: str - :keyword os_type: The Operating System type. Required. Known values are: "Windows" and "Linux". - :paramtype os_type: str or ~azure.mgmt.compute.models.OperatingSystemTypes - :keyword label: The VM run command label. Required. - :paramtype label: str - :keyword description: The VM run command description. Required. - :paramtype description: str - """ - super().__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 server. - - :ivar schema: The VM run command schema. Required. - :vartype schema: str - :ivar id: The VM run command id. Required. - :vartype id: str - :ivar os_type: The Operating System type. Required. Known values are: "Windows" and "Linux". - :vartype os_type: str or ~azure.mgmt.compute.models.OperatingSystemTypes - :ivar label: The VM run command label. Required. - :vartype label: str - :ivar description: The VM run command description. Required. - :vartype description: str - :ivar script: The script to be executed. Required. - :vartype script: list[str] - :ivar parameters: The parameters used by the script. - :vartype parameters: list[~azure.mgmt.compute.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, # pylint: disable=redefined-builtin - os_type: Union[str, "_models.OperatingSystemTypes"], - label: str, - description: str, - script: list[str], - parameters: Optional[list["_models.RunCommandParameterDefinition"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword schema: The VM run command schema. Required. - :paramtype schema: str - :keyword id: The VM run command id. Required. - :paramtype id: str - :keyword os_type: The Operating System type. Required. Known values are: "Windows" and "Linux". - :paramtype os_type: str or ~azure.mgmt.compute.models.OperatingSystemTypes - :keyword label: The VM run command label. Required. - :paramtype label: str - :keyword description: The VM run command description. Required. - :paramtype description: str - :keyword script: The script to be executed. Required. - :paramtype script: list[str] - :keyword parameters: The parameters used by the script. - :paramtype parameters: list[~azure.mgmt.compute.models.RunCommandParameterDefinition] - """ - super().__init__(schema=schema, id=id, os_type=os_type, label=label, description=description, **kwargs) - self.script = script - self.parameters = parameters - - -class RunCommandInput(_serialization.Model): - """Capture Virtual Machine parameters. - - All required parameters must be populated in order to send to server. - - :ivar command_id: Specifies a commandId of predefined built-in script. Command IDs available - for Linux are listed at https://aka.ms/RunCommandManagedLinux#available-commands, Windows at - https://aka.ms/RunCommandManagedWindows#available-commands. Required. - :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.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["_models.RunCommandInputParameter"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword command_id: Specifies a commandId of predefined built-in script. Command IDs available - for Linux are listed at https://aka.ms/RunCommandManagedLinux#available-commands, Windows at - https://aka.ms/RunCommandManagedWindows#available-commands. Required. - :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.models.RunCommandInputParameter] - """ - super().__init__(**kwargs) - self.command_id = command_id - self.script = script - self.parameters = parameters - - -class RunCommandInputParameter(_serialization.Model): - """Describes the properties of a run command parameter. - - All required parameters must be populated in order to send to server. - - :ivar name: The run command parameter name. Required. - :vartype name: str - :ivar value: The run command parameter value. Required. - :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: Any) -> None: - """ - :keyword name: The run command parameter name. Required. - :paramtype name: str - :keyword value: The run command parameter value. Required. - :paramtype value: str - """ - super().__init__(**kwargs) - self.name = name - self.value = value - - -class RunCommandListResult(_serialization.Model): - """The List Virtual Machine operation response. - - All required parameters must be populated in order to send to server. - - :ivar value: The list of virtual machine run commands. Required. - :vartype value: list[~azure.mgmt.compute.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["_models.RunCommandDocumentBase"], next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: The list of virtual machine run commands. Required. - :paramtype value: list[~azure.mgmt.compute.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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class RunCommandManagedIdentity(_serialization.Model): - """Contains clientId or objectId (use only one, not both) of a user-assigned managed identity that - has access to storage blob used in Run Command. Use an empty RunCommandManagedIdentity object - in case of system-assigned identity. Make sure the Azure storage blob exists in case of - scriptUri, and managed identity has been given access to blob's container with 'Storage Blob - Data Reader' role assignment with scriptUri blob and 'Storage Blob Data Contributor' for Append - blobs(outputBlobUri, errorBlobUri). In case of user assigned identity, make sure you add it - under VM's identity. For more info on managed identity and Run Command, refer - https://aka.ms/ManagedIdentity and https://aka.ms/RunCommandManaged. - - :ivar client_id: Client Id (GUID value) of the user-assigned managed identity. ObjectId should - not be used if this is provided. - :vartype client_id: str - :ivar object_id: Object Id (GUID value) of the user-assigned managed identity. ClientId should - not be used if this is provided. - :vartype object_id: str - """ - - _attribute_map = { - "client_id": {"key": "clientId", "type": "str"}, - "object_id": {"key": "objectId", "type": "str"}, - } - - def __init__(self, *, client_id: Optional[str] = None, object_id: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword client_id: Client Id (GUID value) of the user-assigned managed identity. ObjectId - should not be used if this is provided. - :paramtype client_id: str - :keyword object_id: Object Id (GUID value) of the user-assigned managed identity. ClientId - should not be used if this is provided. - :paramtype object_id: str - """ - super().__init__(**kwargs) - self.client_id = client_id - self.object_id = object_id - - -class RunCommandParameterDefinition(_serialization.Model): - """Describes the properties of a run command parameter. - - All required parameters must be populated in order to send to server. - - :ivar name: The run command parameter name. Required. - :vartype name: str - :ivar type: The run command parameter type. Required. - :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] = None, - **kwargs: Any - ) -> None: - """ - :keyword name: The run command parameter name. Required. - :paramtype name: str - :keyword type: The run command parameter type. Required. - :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().__init__(**kwargs) - self.name = name - self.type = type - self.default_value = default_value - self.required = required - - -class RunCommandResult(_serialization.Model): - """RunCommandResult. - - :ivar value: Run command operation response. - :vartype value: list[~azure.mgmt.compute.models.InstanceViewStatus] - """ - - _attribute_map = { - "value": {"key": "value", "type": "[InstanceViewStatus]"}, - } - - def __init__(self, *, value: Optional[list["_models.InstanceViewStatus"]] = None, **kwargs: Any) -> None: - """ - :keyword value: Run command operation response. - :paramtype value: list[~azure.mgmt.compute.models.InstanceViewStatus] - """ - super().__init__(**kwargs) - self.value = value - - -class ScaleInPolicy(_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.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 - :ivar prioritize_unhealthy_v_ms: This property allows you to prioritize the deletion of - unhealthy and inactive VMs when a virtual machine scale set is being scaled-in.(Feature in - Preview). - :vartype prioritize_unhealthy_v_ms: bool - """ - - _attribute_map = { - "rules": {"key": "rules", "type": "[str]"}, - "force_deletion": {"key": "forceDeletion", "type": "bool"}, - "prioritize_unhealthy_v_ms": {"key": "prioritizeUnhealthyVMs", "type": "bool"}, - } - - def __init__( - self, - *, - rules: Optional[list[Union[str, "_models.VirtualMachineScaleSetScaleInRules"]]] = None, - force_deletion: Optional[bool] = None, - prioritize_unhealthy_v_ms: Optional[bool] = None, - **kwargs: Any - ) -> None: - """ - :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.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 - :keyword prioritize_unhealthy_v_ms: This property allows you to prioritize the deletion of - unhealthy and inactive VMs when a virtual machine scale set is being scaled-in.(Feature in - Preview). - :paramtype prioritize_unhealthy_v_ms: bool - """ - super().__init__(**kwargs) - self.rules = rules - self.force_deletion = force_deletion - self.prioritize_unhealthy_v_ms = prioritize_unhealthy_v_ms - - -class ScheduledEventsAdditionalPublishingTargets(_serialization.Model): # pylint: disable=name-too-long - """ScheduledEventsAdditionalPublishingTargets. - - :ivar event_grid_and_resource_graph: The configuration parameters used while creating - eventGridAndResourceGraph Scheduled Event setting. - :vartype event_grid_and_resource_graph: ~azure.mgmt.compute.models.EventGridAndResourceGraph - """ - - _attribute_map = { - "event_grid_and_resource_graph": {"key": "eventGridAndResourceGraph", "type": "EventGridAndResourceGraph"}, - } - - def __init__( - self, *, event_grid_and_resource_graph: Optional["_models.EventGridAndResourceGraph"] = None, **kwargs: Any - ) -> None: - """ - :keyword event_grid_and_resource_graph: The configuration parameters used while creating - eventGridAndResourceGraph Scheduled Event setting. - :paramtype event_grid_and_resource_graph: ~azure.mgmt.compute.models.EventGridAndResourceGraph - """ - super().__init__(**kwargs) - self.event_grid_and_resource_graph = event_grid_and_resource_graph - - -class ScheduledEventsPolicy(_serialization.Model): - """Specifies Redeploy, Reboot and ScheduledEventsAdditionalPublishingTargets Scheduled Event - related configurations. - - :ivar user_initiated_redeploy: The configuration parameters used while creating - userInitiatedRedeploy scheduled event setting creation. - :vartype user_initiated_redeploy: ~azure.mgmt.compute.models.UserInitiatedRedeploy - :ivar user_initiated_reboot: The configuration parameters used while creating - userInitiatedReboot scheduled event setting creation. - :vartype user_initiated_reboot: ~azure.mgmt.compute.models.UserInitiatedReboot - :ivar scheduled_events_additional_publishing_targets: The configuration parameters used while - publishing scheduledEventsAdditionalPublishingTargets. - :vartype scheduled_events_additional_publishing_targets: - ~azure.mgmt.compute.models.ScheduledEventsAdditionalPublishingTargets - :ivar all_instances_down: The configuration parameters used while creating AllInstancesDown - scheduled event setting creation. - :vartype all_instances_down: ~azure.mgmt.compute.models.AllInstancesDown - """ - - _attribute_map = { - "user_initiated_redeploy": {"key": "userInitiatedRedeploy", "type": "UserInitiatedRedeploy"}, - "user_initiated_reboot": {"key": "userInitiatedReboot", "type": "UserInitiatedReboot"}, - "scheduled_events_additional_publishing_targets": { - "key": "scheduledEventsAdditionalPublishingTargets", - "type": "ScheduledEventsAdditionalPublishingTargets", - }, - "all_instances_down": {"key": "allInstancesDown", "type": "AllInstancesDown"}, - } - - def __init__( - self, - *, - user_initiated_redeploy: Optional["_models.UserInitiatedRedeploy"] = None, - user_initiated_reboot: Optional["_models.UserInitiatedReboot"] = None, - scheduled_events_additional_publishing_targets: Optional[ - "_models.ScheduledEventsAdditionalPublishingTargets" - ] = None, - all_instances_down: Optional["_models.AllInstancesDown"] = None, - **kwargs: Any - ) -> None: - """ - :keyword user_initiated_redeploy: The configuration parameters used while creating - userInitiatedRedeploy scheduled event setting creation. - :paramtype user_initiated_redeploy: ~azure.mgmt.compute.models.UserInitiatedRedeploy - :keyword user_initiated_reboot: The configuration parameters used while creating - userInitiatedReboot scheduled event setting creation. - :paramtype user_initiated_reboot: ~azure.mgmt.compute.models.UserInitiatedReboot - :keyword scheduled_events_additional_publishing_targets: The configuration parameters used - while publishing scheduledEventsAdditionalPublishingTargets. - :paramtype scheduled_events_additional_publishing_targets: - ~azure.mgmt.compute.models.ScheduledEventsAdditionalPublishingTargets - :keyword all_instances_down: The configuration parameters used while creating AllInstancesDown - scheduled event setting creation. - :paramtype all_instances_down: ~azure.mgmt.compute.models.AllInstancesDown - """ - super().__init__(**kwargs) - self.user_initiated_redeploy = user_initiated_redeploy - self.user_initiated_reboot = user_initiated_reboot - self.scheduled_events_additional_publishing_targets = scheduled_events_additional_publishing_targets - self.all_instances_down = all_instances_down - - -class ScheduledEventsProfile(_serialization.Model): - """ScheduledEventsProfile. - - :ivar terminate_notification_profile: Specifies Terminate Scheduled Event related - configurations. - :vartype terminate_notification_profile: - ~azure.mgmt.compute.models.TerminateNotificationProfile - :ivar os_image_notification_profile: Specifies OS Image Scheduled Event related configurations. - :vartype os_image_notification_profile: ~azure.mgmt.compute.models.OSImageNotificationProfile - """ - - _attribute_map = { - "terminate_notification_profile": { - "key": "terminateNotificationProfile", - "type": "TerminateNotificationProfile", - }, - "os_image_notification_profile": {"key": "osImageNotificationProfile", "type": "OSImageNotificationProfile"}, - } - - def __init__( - self, - *, - terminate_notification_profile: Optional["_models.TerminateNotificationProfile"] = None, - os_image_notification_profile: Optional["_models.OSImageNotificationProfile"] = None, - **kwargs: Any - ) -> None: - """ - :keyword terminate_notification_profile: Specifies Terminate Scheduled Event related - configurations. - :paramtype terminate_notification_profile: - ~azure.mgmt.compute.models.TerminateNotificationProfile - :keyword os_image_notification_profile: Specifies OS Image Scheduled Event related - configurations. - :paramtype os_image_notification_profile: ~azure.mgmt.compute.models.OSImageNotificationProfile - """ - super().__init__(**kwargs) - self.terminate_notification_profile = terminate_notification_profile - self.os_image_notification_profile = os_image_notification_profile - - -class ScheduleProfile(_serialization.Model): - """Defines the schedule for Block-type capacity reservations. Specifies the schedule during which - capacity reservation is active and VM or VMSS resource can be allocated using reservation. This - property is required and only supported when the capacity reservation group type is 'Block'. - The scheduleProfile, start, and end fields are immutable after creation. Minimum API version: - 2025-04-01. Please refer to https://aka.ms/blockcapacityreservation for more details. - - :ivar start: The required start date for block capacity reservations. Must be today or within - 56 days in the future. For same-day scheduling, requests must be submitted before 11:30 AM UTC. - Example: 2025-06-27. - :vartype start: str - :ivar end: The required end date for block capacity reservations. Must be after the start date, - with a duration of either 1–14 whole days or 3–26 whole weeks. Example: 2025-06-28. - :vartype end: str - """ - - _attribute_map = { - "start": {"key": "start", "type": "str"}, - "end": {"key": "end", "type": "str"}, - } - - def __init__(self, *, start: Optional[str] = None, end: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword start: The required start date for block capacity reservations. Must be today or - within 56 days in the future. For same-day scheduling, requests must be submitted before 11:30 - AM UTC. Example: 2025-06-27. - :paramtype start: str - :keyword end: The required end date for block capacity reservations. Must be after the start - date, with a duration of either 1–14 whole days or 3–26 whole weeks. Example: 2025-06-28. - :paramtype end: str - """ - super().__init__(**kwargs) - self.start = start - self.end = end - - -class SecurityPostureReference(_serialization.Model): - """Specifies the security posture to be used in the scale set. Minimum api-version: 2023-03-01. - - All required parameters must be populated in order to send to server. - - :ivar id: The security posture reference id in the form of - /CommunityGalleries/{communityGalleryName}/securityPostures/{securityPostureName}/versions/{major.minor.patch}|latest. - Required. - :vartype id: str - :ivar exclude_extensions: The list of virtual machine extension names to exclude when applying - the security posture. - :vartype exclude_extensions: list[str] - :ivar is_overridable: Whether the security posture can be overridden by the user. - :vartype is_overridable: bool - """ - - _validation = { - "id": {"required": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "exclude_extensions": {"key": "excludeExtensions", "type": "[str]"}, - "is_overridable": {"key": "isOverridable", "type": "bool"}, - } - - def __init__( - self, - *, - id: str, # pylint: disable=redefined-builtin - exclude_extensions: Optional[list[str]] = None, - is_overridable: Optional[bool] = None, - **kwargs: Any - ) -> None: - """ - :keyword id: The security posture reference id in the form of - /CommunityGalleries/{communityGalleryName}/securityPostures/{securityPostureName}/versions/{major.minor.patch}|latest. - Required. - :paramtype id: str - :keyword exclude_extensions: The list of virtual machine extension names to exclude when - applying the security posture. - :paramtype exclude_extensions: list[str] - :keyword is_overridable: Whether the security posture can be overridden by the user. - :paramtype is_overridable: bool - """ - super().__init__(**kwargs) - self.id = id - self.exclude_extensions = exclude_extensions - self.is_overridable = is_overridable - - -class SecurityPostureReferenceUpdate(_serialization.Model): - """Specifies the security posture to be used in the scale set. Minimum api-version: 2023-03-01. - - :ivar id: The security posture reference id in the form of - /CommunityGalleries/{communityGalleryName}/securityPostures/{securityPostureName}/versions/{major.minor.patch}|latest. - :vartype id: str - :ivar exclude_extensions: The list of virtual machine extension names to exclude when applying - the security posture. - :vartype exclude_extensions: list[str] - :ivar is_overridable: Whether the security posture can be overridden by the user. - :vartype is_overridable: bool - """ - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "exclude_extensions": {"key": "excludeExtensions", "type": "[str]"}, - "is_overridable": {"key": "isOverridable", "type": "bool"}, - } - - def __init__( - self, - *, - id: Optional[str] = None, # pylint: disable=redefined-builtin - exclude_extensions: Optional[list[str]] = None, - is_overridable: Optional[bool] = None, - **kwargs: Any - ) -> None: - """ - :keyword id: The security posture reference id in the form of - /CommunityGalleries/{communityGalleryName}/securityPostures/{securityPostureName}/versions/{major.minor.patch}|latest. - :paramtype id: str - :keyword exclude_extensions: The list of virtual machine extension names to exclude when - applying the security posture. - :paramtype exclude_extensions: list[str] - :keyword is_overridable: Whether the security posture can be overridden by the user. - :paramtype is_overridable: bool - """ - super().__init__(**kwargs) - self.id = id - self.exclude_extensions = exclude_extensions - self.is_overridable = is_overridable - - -class SecurityProfile(_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. Minimum api-version: 2020-12-01. - :vartype uefi_settings: ~azure.mgmt.compute.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. The default behavior - is: 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. The default behavior is: UefiSettings will not be - enabled unless this property is set. Known values are: "TrustedLaunch" and "ConfidentialVM". - :vartype security_type: str or ~azure.mgmt.compute.models.SecurityTypes - :ivar encryption_identity: Specifies the Managed Identity used by ADE to get access token for - keyvault operations. - :vartype encryption_identity: ~azure.mgmt.compute.models.EncryptionIdentity - :ivar proxy_agent_settings: Specifies ProxyAgent settings while creating the virtual machine. - Minimum api-version: 2023-09-01. - :vartype proxy_agent_settings: ~azure.mgmt.compute.models.ProxyAgentSettings - """ - - _attribute_map = { - "uefi_settings": {"key": "uefiSettings", "type": "UefiSettings"}, - "encryption_at_host": {"key": "encryptionAtHost", "type": "bool"}, - "security_type": {"key": "securityType", "type": "str"}, - "encryption_identity": {"key": "encryptionIdentity", "type": "EncryptionIdentity"}, - "proxy_agent_settings": {"key": "proxyAgentSettings", "type": "ProxyAgentSettings"}, - } - - def __init__( - self, - *, - uefi_settings: Optional["_models.UefiSettings"] = None, - encryption_at_host: Optional[bool] = None, - security_type: Optional[Union[str, "_models.SecurityTypes"]] = None, - encryption_identity: Optional["_models.EncryptionIdentity"] = None, - proxy_agent_settings: Optional["_models.ProxyAgentSettings"] = None, - **kwargs: Any - ) -> None: - """ - :keyword uefi_settings: Specifies the security settings like secure boot and vTPM used while - creating the virtual machine. Minimum api-version: 2020-12-01. - :paramtype uefi_settings: ~azure.mgmt.compute.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. The - default behavior is: 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. The default behavior is: UefiSettings will not be - enabled unless this property is set. Known values are: "TrustedLaunch" and "ConfidentialVM". - :paramtype security_type: str or ~azure.mgmt.compute.models.SecurityTypes - :keyword encryption_identity: Specifies the Managed Identity used by ADE to get access token - for keyvault operations. - :paramtype encryption_identity: ~azure.mgmt.compute.models.EncryptionIdentity - :keyword proxy_agent_settings: Specifies ProxyAgent settings while creating the virtual - machine. Minimum api-version: 2023-09-01. - :paramtype proxy_agent_settings: ~azure.mgmt.compute.models.ProxyAgentSettings - """ - super().__init__(**kwargs) - self.uefi_settings = uefi_settings - self.encryption_at_host = encryption_at_host - self.security_type = security_type - self.encryption_identity = encryption_identity - self.proxy_agent_settings = proxy_agent_settings - - -class ServiceArtifactReference(_serialization.Model): - """Specifies the service artifact reference id used to set same image version for all virtual - machines in the scale set when using 'latest' image version. Minimum api-version: 2022-11-01. - - :ivar id: The service artifact reference id in the form of - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/galleries/{galleryName}/serviceArtifacts/{serviceArtifactName}/vmArtifactsProfiles/{vmArtifactsProfilesName}. - :vartype id: str - """ - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - } - - def __init__(self, *, id: Optional[str] = None, **kwargs: Any) -> None: # pylint: disable=redefined-builtin - """ - :keyword id: The service artifact reference id in the form of - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/galleries/{galleryName}/serviceArtifacts/{serviceArtifactName}/vmArtifactsProfiles/{vmArtifactsProfilesName}. - :paramtype id: str - """ - super().__init__(**kwargs) - self.id = id - - -class SharedGallery(PirSharedGalleryResource): - """Specifies information about the Shared Gallery that you want to create or update. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name: Resource name. - :vartype name: str - :ivar location: Resource location. - :vartype location: str - :ivar unique_id: The unique id of this shared gallery. - :vartype unique_id: str - :ivar artifact_tags: The artifact tags of a shared gallery resource. - :vartype artifact_tags: dict[str, str] - """ - - _validation = { - "name": {"readonly": True}, - "location": {"readonly": True}, - "artifact_tags": {"readonly": True}, - } - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "location": {"key": "location", "type": "str"}, - "unique_id": {"key": "identifier.uniqueId", "type": "str"}, - "artifact_tags": {"key": "properties.artifactTags", "type": "{str}"}, - } - - def __init__(self, *, unique_id: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword unique_id: The unique id of this shared gallery. - :paramtype unique_id: str - """ - super().__init__(unique_id=unique_id, **kwargs) - self.artifact_tags: Optional[dict[str, str]] = None - - -class SharedGalleryDiskImage(_serialization.Model): - """This is the disk image base class. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar disk_size_gb: This property indicates the size of the VHD to be created. - :vartype disk_size_gb: int - :ivar host_caching: The host caching of the disk. Valid values are 'None', 'ReadOnly', and - 'ReadWrite'. Known values are: "None", "ReadOnly", and "ReadWrite". - :vartype host_caching: str or ~azure.mgmt.compute.models.SharedGalleryHostCaching - """ - - _validation = { - "disk_size_gb": {"readonly": True}, - } - - _attribute_map = { - "disk_size_gb": {"key": "diskSizeGB", "type": "int"}, - "host_caching": {"key": "hostCaching", "type": "str"}, - } - - def __init__( - self, *, host_caching: Optional[Union[str, "_models.SharedGalleryHostCaching"]] = None, **kwargs: Any - ) -> None: - """ - :keyword host_caching: The host caching of the disk. Valid values are 'None', 'ReadOnly', and - 'ReadWrite'. Known values are: "None", "ReadOnly", and "ReadWrite". - :paramtype host_caching: str or ~azure.mgmt.compute.models.SharedGalleryHostCaching - """ - super().__init__(**kwargs) - self.disk_size_gb: Optional[int] = None - self.host_caching = host_caching - - -class SharedGalleryDataDiskImage(SharedGalleryDiskImage): - """This is the data disk image. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to server. - - :ivar disk_size_gb: This property indicates the size of the VHD to be created. - :vartype disk_size_gb: int - :ivar host_caching: The host caching of the disk. Valid values are 'None', 'ReadOnly', and - 'ReadWrite'. Known values are: "None", "ReadOnly", and "ReadWrite". - :vartype host_caching: str or ~azure.mgmt.compute.models.SharedGalleryHostCaching - :ivar lun: This property specifies the logical unit number of the data disk. This value is used - to identify data disks within the Virtual Machine and therefore must be unique for each data - disk attached to the Virtual Machine. Required. - :vartype lun: int - """ - - _validation = { - "disk_size_gb": {"readonly": True}, - "lun": {"required": True}, - } - - _attribute_map = { - "disk_size_gb": {"key": "diskSizeGB", "type": "int"}, - "host_caching": {"key": "hostCaching", "type": "str"}, - "lun": {"key": "lun", "type": "int"}, - } - - def __init__( - self, *, lun: int, host_caching: Optional[Union[str, "_models.SharedGalleryHostCaching"]] = None, **kwargs: Any - ) -> None: - """ - :keyword host_caching: The host caching of the disk. Valid values are 'None', 'ReadOnly', and - 'ReadWrite'. Known values are: "None", "ReadOnly", and "ReadWrite". - :paramtype host_caching: str or ~azure.mgmt.compute.models.SharedGalleryHostCaching - :keyword lun: This property specifies the logical unit number of the data disk. This value is - used to identify data disks within the Virtual Machine and therefore must be unique for each - data disk attached to the Virtual Machine. Required. - :paramtype lun: int - """ - super().__init__(host_caching=host_caching, **kwargs) - self.lun = lun - - -class SharedGalleryImage(PirSharedGalleryResource): - """Specifies information about the gallery image definition that you want to create or update. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name: Resource name. - :vartype name: str - :ivar location: Resource location. - :vartype location: str - :ivar unique_id: The unique id of this shared gallery. - :vartype unique_id: str - :ivar os_type: This property allows you to specify the type of the OS that is included in the - disk when creating a VM from a managed image. Possible values are: **Windows,** **Linux.**. - Known values are: "Windows" and "Linux". - :vartype os_type: str or ~azure.mgmt.compute.models.OperatingSystemTypes - :ivar os_state: This property allows the user to specify whether the virtual machines created - under this image are 'Generalized' or 'Specialized'. Known values are: "Generalized" and - "Specialized". - :vartype os_state: str or ~azure.mgmt.compute.models.OperatingSystemStateTypes - :ivar end_of_life_date: The end of life date of the gallery image definition. This property can - be used for decommissioning purposes. This property is updatable. - :vartype end_of_life_date: ~datetime.datetime - :ivar identifier: This is the gallery image definition identifier. - :vartype identifier: ~azure.mgmt.compute.models.GalleryImageIdentifier - :ivar recommended: The properties describe the recommended machine configuration for this Image - Definition. These properties are updatable. - :vartype recommended: ~azure.mgmt.compute.models.RecommendedMachineConfiguration - :ivar disallowed: Describes the disallowed disk types. - :vartype disallowed: ~azure.mgmt.compute.models.Disallowed - :ivar hyper_v_generation: The hypervisor generation of the Virtual Machine. Applicable to OS - disks only. Known values are: "V1" and "V2". - :vartype hyper_v_generation: str or ~azure.mgmt.compute.models.HyperVGeneration - :ivar features: A list of gallery image features. - :vartype features: list[~azure.mgmt.compute.models.GalleryImageFeature] - :ivar purchase_plan: Describes the gallery image definition purchase plan. This is used by - marketplace images. - :vartype purchase_plan: ~azure.mgmt.compute.models.ImagePurchasePlan - :ivar architecture: The architecture of the image. Applicable to OS disks only. Known values - are: "x64" and "Arm64". - :vartype architecture: str or ~azure.mgmt.compute.models.Architecture - :ivar privacy_statement_uri: Privacy statement uri for the current community gallery image. - :vartype privacy_statement_uri: str - :ivar eula: End-user license agreement for the current community gallery image. - :vartype eula: str - :ivar artifact_tags: The artifact tags of a shared gallery resource. - :vartype artifact_tags: dict[str, str] - """ - - _validation = { - "name": {"readonly": True}, - "location": {"readonly": True}, - } - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "location": {"key": "location", "type": "str"}, - "unique_id": {"key": "identifier.uniqueId", "type": "str"}, - "os_type": {"key": "properties.osType", "type": "str"}, - "os_state": {"key": "properties.osState", "type": "str"}, - "end_of_life_date": {"key": "properties.endOfLifeDate", "type": "iso-8601"}, - "identifier": {"key": "properties.identifier", "type": "GalleryImageIdentifier"}, - "recommended": {"key": "properties.recommended", "type": "RecommendedMachineConfiguration"}, - "disallowed": {"key": "properties.disallowed", "type": "Disallowed"}, - "hyper_v_generation": {"key": "properties.hyperVGeneration", "type": "str"}, - "features": {"key": "properties.features", "type": "[GalleryImageFeature]"}, - "purchase_plan": {"key": "properties.purchasePlan", "type": "ImagePurchasePlan"}, - "architecture": {"key": "properties.architecture", "type": "str"}, - "privacy_statement_uri": {"key": "properties.privacyStatementUri", "type": "str"}, - "eula": {"key": "properties.eula", "type": "str"}, - "artifact_tags": {"key": "properties.artifactTags", "type": "{str}"}, - } - - def __init__( - self, - *, - unique_id: Optional[str] = None, - os_type: Optional[Union[str, "_models.OperatingSystemTypes"]] = None, - os_state: Optional[Union[str, "_models.OperatingSystemStateTypes"]] = None, - end_of_life_date: Optional[datetime.datetime] = None, - identifier: Optional["_models.GalleryImageIdentifier"] = None, - recommended: Optional["_models.RecommendedMachineConfiguration"] = None, - disallowed: Optional["_models.Disallowed"] = None, - hyper_v_generation: Optional[Union[str, "_models.HyperVGeneration"]] = None, - features: Optional[list["_models.GalleryImageFeature"]] = None, - purchase_plan: Optional["_models.ImagePurchasePlan"] = None, - architecture: Optional[Union[str, "_models.Architecture"]] = None, - privacy_statement_uri: Optional[str] = None, - eula: Optional[str] = None, - artifact_tags: Optional[dict[str, str]] = None, - **kwargs: Any - ) -> None: - """ - :keyword unique_id: The unique id of this shared gallery. - :paramtype unique_id: str - :keyword os_type: This property allows you to specify the type of the OS that is included in - the disk when creating a VM from a managed image. Possible values are: **Windows,** **Linux.**. - Known values are: "Windows" and "Linux". - :paramtype os_type: str or ~azure.mgmt.compute.models.OperatingSystemTypes - :keyword os_state: This property allows the user to specify whether the virtual machines - created under this image are 'Generalized' or 'Specialized'. Known values are: "Generalized" - and "Specialized". - :paramtype os_state: str or ~azure.mgmt.compute.models.OperatingSystemStateTypes - :keyword end_of_life_date: The end of life date of the gallery image definition. This property - can be used for decommissioning purposes. This property is updatable. - :paramtype end_of_life_date: ~datetime.datetime - :keyword identifier: This is the gallery image definition identifier. - :paramtype identifier: ~azure.mgmt.compute.models.GalleryImageIdentifier - :keyword recommended: The properties describe the recommended machine configuration for this - Image Definition. These properties are updatable. - :paramtype recommended: ~azure.mgmt.compute.models.RecommendedMachineConfiguration - :keyword disallowed: Describes the disallowed disk types. - :paramtype disallowed: ~azure.mgmt.compute.models.Disallowed - :keyword hyper_v_generation: The hypervisor generation of the Virtual Machine. Applicable to OS - disks only. Known values are: "V1" and "V2". - :paramtype hyper_v_generation: str or ~azure.mgmt.compute.models.HyperVGeneration - :keyword features: A list of gallery image features. - :paramtype features: list[~azure.mgmt.compute.models.GalleryImageFeature] - :keyword purchase_plan: Describes the gallery image definition purchase plan. This is used by - marketplace images. - :paramtype purchase_plan: ~azure.mgmt.compute.models.ImagePurchasePlan - :keyword architecture: The architecture of the image. Applicable to OS disks only. Known values - are: "x64" and "Arm64". - :paramtype architecture: str or ~azure.mgmt.compute.models.Architecture - :keyword privacy_statement_uri: Privacy statement uri for the current community gallery image. - :paramtype privacy_statement_uri: str - :keyword eula: End-user license agreement for the current community gallery image. - :paramtype eula: str - :keyword artifact_tags: The artifact tags of a shared gallery resource. - :paramtype artifact_tags: dict[str, str] - """ - super().__init__(unique_id=unique_id, **kwargs) - self.os_type = os_type - self.os_state = os_state - self.end_of_life_date = end_of_life_date - self.identifier = identifier - self.recommended = recommended - self.disallowed = disallowed - self.hyper_v_generation = hyper_v_generation - self.features = features - self.purchase_plan = purchase_plan - self.architecture = architecture - self.privacy_statement_uri = privacy_statement_uri - self.eula = eula - self.artifact_tags = artifact_tags - - -class SharedGalleryImageList(_serialization.Model): - """The List Shared Gallery Images operation response. - - All required parameters must be populated in order to send to server. - - :ivar value: A list of shared gallery images. Required. - :vartype value: list[~azure.mgmt.compute.models.SharedGalleryImage] - :ivar next_link: The uri to fetch the next page of shared gallery images. Call ListNext() with - this to fetch the next page of shared gallery images. - :vartype next_link: str - """ - - _validation = { - "value": {"required": True}, - } - - _attribute_map = { - "value": {"key": "value", "type": "[SharedGalleryImage]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, *, value: list["_models.SharedGalleryImage"], next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: A list of shared gallery images. Required. - :paramtype value: list[~azure.mgmt.compute.models.SharedGalleryImage] - :keyword next_link: The uri to fetch the next page of shared gallery images. Call ListNext() - with this to fetch the next page of shared gallery images. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class SharedGalleryImageVersion(PirSharedGalleryResource): - """Specifies information about the gallery image version that you want to create or update. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name: Resource name. - :vartype name: str - :ivar location: Resource location. - :vartype location: str - :ivar unique_id: The unique id of this shared gallery. - :vartype unique_id: str - :ivar published_date: The published date of the gallery image version Definition. This property - can be used for decommissioning purposes. This property is updatable. - :vartype published_date: ~datetime.datetime - :ivar end_of_life_date: The end of life date of the gallery image version Definition. This - property can be used for decommissioning purposes. This property is updatable. - :vartype end_of_life_date: ~datetime.datetime - :ivar exclude_from_latest: If set to true, Virtual Machines deployed from the latest version of - the Image Definition won't use this Image Version. - :vartype exclude_from_latest: bool - :ivar storage_profile: Describes the storage profile of the image version. - :vartype storage_profile: ~azure.mgmt.compute.models.SharedGalleryImageVersionStorageProfile - :ivar artifact_tags: The artifact tags of a shared gallery resource. - :vartype artifact_tags: dict[str, str] - """ - - _validation = { - "name": {"readonly": True}, - "location": {"readonly": True}, - } - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "location": {"key": "location", "type": "str"}, - "unique_id": {"key": "identifier.uniqueId", "type": "str"}, - "published_date": {"key": "properties.publishedDate", "type": "iso-8601"}, - "end_of_life_date": {"key": "properties.endOfLifeDate", "type": "iso-8601"}, - "exclude_from_latest": {"key": "properties.excludeFromLatest", "type": "bool"}, - "storage_profile": {"key": "properties.storageProfile", "type": "SharedGalleryImageVersionStorageProfile"}, - "artifact_tags": {"key": "properties.artifactTags", "type": "{str}"}, - } - - def __init__( - self, - *, - unique_id: Optional[str] = None, - published_date: Optional[datetime.datetime] = None, - end_of_life_date: Optional[datetime.datetime] = None, - exclude_from_latest: Optional[bool] = None, - storage_profile: Optional["_models.SharedGalleryImageVersionStorageProfile"] = None, - artifact_tags: Optional[dict[str, str]] = None, - **kwargs: Any - ) -> None: - """ - :keyword unique_id: The unique id of this shared gallery. - :paramtype unique_id: str - :keyword published_date: The published date of the gallery image version Definition. This - property can be used for decommissioning purposes. This property is updatable. - :paramtype published_date: ~datetime.datetime - :keyword end_of_life_date: The end of life date of the gallery image version Definition. This - property can be used for decommissioning purposes. This property is updatable. - :paramtype end_of_life_date: ~datetime.datetime - :keyword exclude_from_latest: If set to true, Virtual Machines deployed from the latest version - of the Image Definition won't use this Image Version. - :paramtype exclude_from_latest: bool - :keyword storage_profile: Describes the storage profile of the image version. - :paramtype storage_profile: ~azure.mgmt.compute.models.SharedGalleryImageVersionStorageProfile - :keyword artifact_tags: The artifact tags of a shared gallery resource. - :paramtype artifact_tags: dict[str, str] - """ - super().__init__(unique_id=unique_id, **kwargs) - self.published_date = published_date - self.end_of_life_date = end_of_life_date - self.exclude_from_latest = exclude_from_latest - self.storage_profile = storage_profile - self.artifact_tags = artifact_tags - - -class SharedGalleryImageVersionList(_serialization.Model): - """The List Shared Gallery Image versions operation response. - - All required parameters must be populated in order to send to server. - - :ivar value: The SharedGalleryImageVersion items on this page. Required. - :vartype value: list[~azure.mgmt.compute.models.SharedGalleryImageVersion] - :ivar next_link: The link to the next page of items. - :vartype next_link: str - """ - - _validation = { - "value": {"required": True}, - } - - _attribute_map = { - "value": {"key": "value", "type": "[SharedGalleryImageVersion]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, *, value: list["_models.SharedGalleryImageVersion"], next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: The SharedGalleryImageVersion items on this page. Required. - :paramtype value: list[~azure.mgmt.compute.models.SharedGalleryImageVersion] - :keyword next_link: The link to the next page of items. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class SharedGalleryImageVersionStorageProfile(_serialization.Model): - """This is the storage profile of a Gallery Image Version. - - :ivar os_disk_image: This is the OS disk image. - :vartype os_disk_image: ~azure.mgmt.compute.models.SharedGalleryOSDiskImage - :ivar data_disk_images: A list of data disk images. - :vartype data_disk_images: list[~azure.mgmt.compute.models.SharedGalleryDataDiskImage] - """ - - _attribute_map = { - "os_disk_image": {"key": "osDiskImage", "type": "SharedGalleryOSDiskImage"}, - "data_disk_images": {"key": "dataDiskImages", "type": "[SharedGalleryDataDiskImage]"}, - } - - def __init__( - self, - *, - os_disk_image: Optional["_models.SharedGalleryOSDiskImage"] = None, - data_disk_images: Optional[list["_models.SharedGalleryDataDiskImage"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword os_disk_image: This is the OS disk image. - :paramtype os_disk_image: ~azure.mgmt.compute.models.SharedGalleryOSDiskImage - :keyword data_disk_images: A list of data disk images. - :paramtype data_disk_images: list[~azure.mgmt.compute.models.SharedGalleryDataDiskImage] - """ - super().__init__(**kwargs) - self.os_disk_image = os_disk_image - self.data_disk_images = data_disk_images - - -class SharedGalleryList(_serialization.Model): - """The List Shared Galleries operation response. - - All required parameters must be populated in order to send to server. - - :ivar value: A list of shared galleries. Required. - :vartype value: list[~azure.mgmt.compute.models.SharedGallery] - :ivar next_link: The uri to fetch the next page of shared galleries. Call ListNext() with this - to fetch the next page of shared galleries. - :vartype next_link: str - """ - - _validation = { - "value": {"required": True}, - } - - _attribute_map = { - "value": {"key": "value", "type": "[SharedGallery]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__(self, *, value: list["_models.SharedGallery"], next_link: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword value: A list of shared galleries. Required. - :paramtype value: list[~azure.mgmt.compute.models.SharedGallery] - :keyword next_link: The uri to fetch the next page of shared galleries. Call ListNext() with - this to fetch the next page of shared galleries. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class SharedGalleryOSDiskImage(SharedGalleryDiskImage): - """This is the OS disk image. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar disk_size_gb: This property indicates the size of the VHD to be created. - :vartype disk_size_gb: int - :ivar host_caching: The host caching of the disk. Valid values are 'None', 'ReadOnly', and - 'ReadWrite'. Known values are: "None", "ReadOnly", and "ReadWrite". - :vartype host_caching: str or ~azure.mgmt.compute.models.SharedGalleryHostCaching - """ - - -class ShareInfoElement(_serialization.Model): - """ShareInfoElement. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar vm_uri: A relative URI containing the ID of the VM that has the disk attached. - :vartype vm_uri: str - """ - - _validation = { - "vm_uri": {"readonly": True}, - } - - _attribute_map = { - "vm_uri": {"key": "vmUri", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.vm_uri: Optional[str] = None - - -class SharingProfile(_serialization.Model): - """Profile for gallery sharing to subscription or tenant. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar permissions: This property allows you to specify the permission of sharing gallery. - Possible values are: **Private,** **Groups,** **Community.**. Known values are: "Private", - "Groups", and "Community". - :vartype permissions: str or ~azure.mgmt.compute.models.GallerySharingPermissionTypes - :ivar groups: A list of sharing profile groups. - :vartype groups: list[~azure.mgmt.compute.models.SharingProfileGroup] - :ivar community_gallery_info: Information of community gallery if current gallery is shared to - community. - :vartype community_gallery_info: ~azure.mgmt.compute.models.CommunityGalleryInfo - """ - - _validation = { - "groups": {"readonly": True}, - } - - _attribute_map = { - "permissions": {"key": "permissions", "type": "str"}, - "groups": {"key": "groups", "type": "[SharingProfileGroup]"}, - "community_gallery_info": {"key": "communityGalleryInfo", "type": "CommunityGalleryInfo"}, - } - - def __init__( - self, - *, - permissions: Optional[Union[str, "_models.GallerySharingPermissionTypes"]] = None, - community_gallery_info: Optional["_models.CommunityGalleryInfo"] = None, - **kwargs: Any - ) -> None: - """ - :keyword permissions: This property allows you to specify the permission of sharing gallery. - Possible values are: **Private,** **Groups,** **Community.**. Known values are: "Private", - "Groups", and "Community". - :paramtype permissions: str or ~azure.mgmt.compute.models.GallerySharingPermissionTypes - :keyword community_gallery_info: Information of community gallery if current gallery is shared - to community. - :paramtype community_gallery_info: ~azure.mgmt.compute.models.CommunityGalleryInfo - """ - super().__init__(**kwargs) - self.permissions = permissions - self.groups: Optional[list["_models.SharingProfileGroup"]] = None - self.community_gallery_info = community_gallery_info - - -class SharingProfileGroup(_serialization.Model): - """Group of the gallery sharing profile. - - :ivar type: This property allows you to specify the type of sharing group. Possible values are: - **Subscriptions,** **AADTenants.**. Known values are: "Subscriptions" and "AADTenants". - :vartype type: str or ~azure.mgmt.compute.models.SharingProfileGroupTypes - :ivar ids: A list of subscription/tenant ids the gallery is aimed to be shared to. - :vartype ids: list[str] - """ - - _attribute_map = { - "type": {"key": "type", "type": "str"}, - "ids": {"key": "ids", "type": "[str]"}, - } - - def __init__( - self, - *, - type: Optional[Union[str, "_models.SharingProfileGroupTypes"]] = None, - ids: Optional[list[str]] = None, - **kwargs: Any - ) -> None: - """ - :keyword type: This property allows you to specify the type of sharing group. Possible values - are: **Subscriptions,** **AADTenants.**. Known values are: "Subscriptions" and "AADTenants". - :paramtype type: str or ~azure.mgmt.compute.models.SharingProfileGroupTypes - :keyword ids: A list of subscription/tenant ids the gallery is aimed to be shared to. - :paramtype ids: list[str] - """ - super().__init__(**kwargs) - self.type = type - self.ids = ids - - -class SharingStatus(_serialization.Model): - """Sharing status of current gallery. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar aggregated_state: Aggregated sharing state of current gallery. Known values are: - "Succeeded", "InProgress", "Failed", and "Unknown". - :vartype aggregated_state: str or ~azure.mgmt.compute.models.SharingState - :ivar summary: Summary of all regional sharing status. - :vartype summary: list[~azure.mgmt.compute.models.RegionalSharingStatus] - """ - - _validation = { - "aggregated_state": {"readonly": True}, - } - - _attribute_map = { - "aggregated_state": {"key": "aggregatedState", "type": "str"}, - "summary": {"key": "summary", "type": "[RegionalSharingStatus]"}, - } - - def __init__(self, *, summary: Optional[list["_models.RegionalSharingStatus"]] = None, **kwargs: Any) -> None: - """ - :keyword summary: Summary of all regional sharing status. - :paramtype summary: list[~azure.mgmt.compute.models.RegionalSharingStatus] - """ - super().__init__(**kwargs) - self.aggregated_state: Optional[Union[str, "_models.SharingState"]] = None - self.summary = summary - - -class SharingUpdate(_serialization.Model): - """Specifies information about the gallery sharing profile update. - - All required parameters must be populated in order to send to server. - - :ivar operation_type: This property allows you to specify the operation type of gallery sharing - update. Possible values are: **Add,** **Remove,** **Reset.**. Required. Known values are: - "Add", "Remove", "Reset", and "EnableCommunity". - :vartype operation_type: str or ~azure.mgmt.compute.models.SharingUpdateOperationTypes - :ivar groups: A list of sharing profile groups. - :vartype groups: list[~azure.mgmt.compute.models.SharingProfileGroup] - """ - - _validation = { - "operation_type": {"required": True}, - } - - _attribute_map = { - "operation_type": {"key": "operationType", "type": "str"}, - "groups": {"key": "groups", "type": "[SharingProfileGroup]"}, - } - - def __init__( - self, - *, - operation_type: Union[str, "_models.SharingUpdateOperationTypes"], - groups: Optional[list["_models.SharingProfileGroup"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword operation_type: This property allows you to specify the operation type of gallery - sharing update. Possible values are: **Add,** **Remove,** **Reset.**. Required. Known values - are: "Add", "Remove", "Reset", and "EnableCommunity". - :paramtype operation_type: str or ~azure.mgmt.compute.models.SharingUpdateOperationTypes - :keyword groups: A list of sharing profile groups. - :paramtype groups: list[~azure.mgmt.compute.models.SharingProfileGroup] - """ - super().__init__(**kwargs) - self.operation_type = operation_type - self.groups = groups - - -class Sku(_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: int - """ - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "tier": {"key": "tier", "type": "str"}, - "capacity": {"key": "capacity", "type": "int"}, - } - - def __init__( - self, *, name: Optional[str] = None, tier: Optional[str] = None, capacity: Optional[int] = None, **kwargs: Any - ) -> None: - """ - :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: int - """ - super().__init__(**kwargs) - self.name = name - self.tier = tier - self.capacity = capacity - - -class SkuProfile(_serialization.Model): - """Specifies the sku profile for the virtual machine scale set. With this property the customer is - able to specify a list of VM sizes and an allocation strategy. - - :ivar vm_sizes: Specifies the VM sizes for the virtual machine scale set. - :vartype vm_sizes: list[~azure.mgmt.compute.models.SkuProfileVMSize] - :ivar allocation_strategy: Specifies the allocation strategy for the virtual machine scale set - based on which the VMs will be allocated. Known values are: "LowestPrice", "CapacityOptimized", - and "Prioritized". - :vartype allocation_strategy: str or ~azure.mgmt.compute.models.AllocationStrategy - """ - - _attribute_map = { - "vm_sizes": {"key": "vmSizes", "type": "[SkuProfileVMSize]"}, - "allocation_strategy": {"key": "allocationStrategy", "type": "str"}, - } - - def __init__( - self, - *, - vm_sizes: Optional[list["_models.SkuProfileVMSize"]] = None, - allocation_strategy: Optional[Union[str, "_models.AllocationStrategy"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword vm_sizes: Specifies the VM sizes for the virtual machine scale set. - :paramtype vm_sizes: list[~azure.mgmt.compute.models.SkuProfileVMSize] - :keyword allocation_strategy: Specifies the allocation strategy for the virtual machine scale - set based on which the VMs will be allocated. Known values are: "LowestPrice", - "CapacityOptimized", and "Prioritized". - :paramtype allocation_strategy: str or ~azure.mgmt.compute.models.AllocationStrategy - """ - super().__init__(**kwargs) - self.vm_sizes = vm_sizes - self.allocation_strategy = allocation_strategy - - -class SkuProfileVMSize(_serialization.Model): - """Specifies the VM Size. - - :ivar name: Specifies the name of the VM Size. - :vartype name: str - :ivar rank: Specifies the rank (a.k.a priority) associated with the VM Size. - :vartype rank: int - """ - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "rank": {"key": "rank", "type": "int"}, - } - - def __init__(self, *, name: Optional[str] = None, rank: Optional[int] = None, **kwargs: Any) -> None: - """ - :keyword name: Specifies the name of the VM Size. - :paramtype name: str - :keyword rank: Specifies the rank (a.k.a priority) associated with the VM Size. - :paramtype rank: int - """ - super().__init__(**kwargs) - self.name = name - self.rank = rank - - -class Snapshot(TrackedResource): - """Snapshot resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to server. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.compute.models.SystemData - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - :ivar location: The geo-location where the resource lives. Required. - :vartype location: str - :ivar managed_by: Unused. Always Null. - :vartype managed_by: str - :ivar sku: The snapshots sku name. Can be Standard_LRS, Premium_LRS, or Standard_ZRS. This is - an optional parameter for incremental snapshot and the default behavior is the SKU will be set - to the same sku as the previous snapshot. - :vartype sku: ~azure.mgmt.compute.models.SnapshotSku - :ivar extended_location: The extended location where the snapshot will be created. Extended - location cannot be changed. - :vartype extended_location: ~azure.mgmt.compute.models.ExtendedLocation - :ivar time_created: The time when the snapshot was created. - :vartype time_created: ~datetime.datetime - :ivar os_type: The Operating System type. Known values are: "Windows" and "Linux". - :vartype os_type: str or ~azure.mgmt.compute.models.OperatingSystemTypes - :ivar hyper_v_generation: The hypervisor generation of the Virtual Machine. Applicable to OS - disks only. Known values are: "V1" and "V2". - :vartype hyper_v_generation: str or ~azure.mgmt.compute.models.HyperVGeneration - :ivar purchase_plan: Purchase plan information for the image from which the source disk for the - snapshot was originally created. - :vartype purchase_plan: ~azure.mgmt.compute.models.DiskPurchasePlan - :ivar supported_capabilities: List of supported capabilities for the image from which the - source disk from the snapshot was originally created. - :vartype supported_capabilities: ~azure.mgmt.compute.models.SupportedCapabilities - :ivar creation_data: Disk source information. CreationData information cannot be changed after - the disk has been created. - :vartype creation_data: ~azure.mgmt.compute.models.CreationData - :ivar disk_size_gb: If creationData.createOption is Empty, this field is mandatory and it - indicates the size of the disk to create. If this field is present for updates or creation with - other options, it indicates a resize. Resizes are only allowed if the disk is not attached to a - running VM, and can only increase the disk's size. - :vartype disk_size_gb: int - :ivar disk_size_bytes: The size of the disk in bytes. This field is read only. - :vartype disk_size_bytes: int - :ivar disk_state: The state of the snapshot. Known values are: "Unattached", "Attached", - "Reserved", "Frozen", "ActiveSAS", "ActiveSASFrozen", "ReadyToUpload", and "ActiveUpload". - :vartype disk_state: str or ~azure.mgmt.compute.models.DiskState - :ivar unique_id: Unique Guid identifying the resource. - :vartype unique_id: str - :ivar encryption_settings_collection: Encryption settings collection used be Azure Disk - Encryption, can contain multiple encryption settings per disk or snapshot. - :vartype encryption_settings_collection: - ~azure.mgmt.compute.models.EncryptionSettingsCollection - :ivar provisioning_state: The disk provisioning state. - :vartype provisioning_state: str - :ivar incremental: Whether a snapshot is incremental. Incremental snapshots on the same disk - occupy less space than full snapshots and can be diffed. - :vartype incremental: bool - :ivar incremental_snapshot_family_id: Incremental snapshots for a disk share an incremental - snapshot family id. The Get Page Range Diff API can only be called on incremental snapshots - with the same family id. - :vartype incremental_snapshot_family_id: str - :ivar encryption: Encryption property can be used to encrypt data at rest with customer managed - keys or platform managed keys. - :vartype encryption: ~azure.mgmt.compute.models.Encryption - :ivar network_access_policy: Policy for accessing the disk via network. Known values are: - "AllowAll", "AllowPrivate", and "DenyAll". - :vartype network_access_policy: str or ~azure.mgmt.compute.models.NetworkAccessPolicy - :ivar disk_access_id: ARM id of the DiskAccess resource for using private endpoints on disks. - :vartype disk_access_id: str - :ivar security_profile: Contains the security related information for the resource. - :vartype security_profile: ~azure.mgmt.compute.models.DiskSecurityProfile - :ivar supports_hibernation: Indicates the OS on a snapshot supports hibernation. - :vartype supports_hibernation: bool - :ivar public_network_access: Policy for controlling export on the disk. Known values are: - "Enabled" and "Disabled". - :vartype public_network_access: str or ~azure.mgmt.compute.models.PublicNetworkAccess - :ivar completion_percent: Percentage complete for the background copy when a resource is - created via the CopyStart operation. - :vartype completion_percent: float - :ivar copy_completion_error: Indicates the error details if the background copy of a resource - created via the CopyStart operation fails. - :vartype copy_completion_error: ~azure.mgmt.compute.models.CopyCompletionError - :ivar data_access_auth_mode: Additional authentication requirements when exporting or uploading - to a disk or snapshot. Known values are: "AzureActiveDirectory" and "None". - :vartype data_access_auth_mode: str or ~azure.mgmt.compute.models.DataAccessAuthMode - :ivar snapshot_access_state: The state of snapshot which determines the access availability of - the snapshot. Known values are: "Unknown", "Pending", "Available", "InstantAccess", and - "AvailableWithInstantAccess". - :vartype snapshot_access_state: str or ~azure.mgmt.compute.models.SnapshotAccessState - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, - "location": {"required": True}, - "managed_by": {"readonly": True}, - "time_created": {"readonly": True}, - "disk_size_bytes": {"readonly": True}, - "disk_state": {"readonly": True}, - "unique_id": {"readonly": True}, - "provisioning_state": {"readonly": True}, - "incremental_snapshot_family_id": {"readonly": True}, - "snapshot_access_state": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - "tags": {"key": "tags", "type": "{str}"}, - "location": {"key": "location", "type": "str"}, - "managed_by": {"key": "managedBy", "type": "str"}, - "sku": {"key": "sku", "type": "SnapshotSku"}, - "extended_location": {"key": "extendedLocation", "type": "ExtendedLocation"}, - "time_created": {"key": "properties.timeCreated", "type": "iso-8601"}, - "os_type": {"key": "properties.osType", "type": "str"}, - "hyper_v_generation": {"key": "properties.hyperVGeneration", "type": "str"}, - "purchase_plan": {"key": "properties.purchasePlan", "type": "DiskPurchasePlan"}, - "supported_capabilities": {"key": "properties.supportedCapabilities", "type": "SupportedCapabilities"}, - "creation_data": {"key": "properties.creationData", "type": "CreationData"}, - "disk_size_gb": {"key": "properties.diskSizeGB", "type": "int"}, - "disk_size_bytes": {"key": "properties.diskSizeBytes", "type": "int"}, - "disk_state": {"key": "properties.diskState", "type": "str"}, - "unique_id": {"key": "properties.uniqueId", "type": "str"}, - "encryption_settings_collection": { - "key": "properties.encryptionSettingsCollection", - "type": "EncryptionSettingsCollection", - }, - "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, - "incremental": {"key": "properties.incremental", "type": "bool"}, - "incremental_snapshot_family_id": {"key": "properties.incrementalSnapshotFamilyId", "type": "str"}, - "encryption": {"key": "properties.encryption", "type": "Encryption"}, - "network_access_policy": {"key": "properties.networkAccessPolicy", "type": "str"}, - "disk_access_id": {"key": "properties.diskAccessId", "type": "str"}, - "security_profile": {"key": "properties.securityProfile", "type": "DiskSecurityProfile"}, - "supports_hibernation": {"key": "properties.supportsHibernation", "type": "bool"}, - "public_network_access": {"key": "properties.publicNetworkAccess", "type": "str"}, - "completion_percent": {"key": "properties.completionPercent", "type": "float"}, - "copy_completion_error": {"key": "properties.copyCompletionError", "type": "CopyCompletionError"}, - "data_access_auth_mode": {"key": "properties.dataAccessAuthMode", "type": "str"}, - "snapshot_access_state": {"key": "properties.snapshotAccessState", "type": "str"}, - } - - def __init__( # pylint: disable=too-many-locals - self, - *, - location: str, - tags: Optional[dict[str, str]] = None, - sku: Optional["_models.SnapshotSku"] = None, - extended_location: Optional["_models.ExtendedLocation"] = None, - os_type: Optional[Union[str, "_models.OperatingSystemTypes"]] = None, - hyper_v_generation: Optional[Union[str, "_models.HyperVGeneration"]] = None, - purchase_plan: Optional["_models.DiskPurchasePlan"] = None, - supported_capabilities: Optional["_models.SupportedCapabilities"] = None, - creation_data: Optional["_models.CreationData"] = None, - disk_size_gb: Optional[int] = None, - encryption_settings_collection: Optional["_models.EncryptionSettingsCollection"] = None, - incremental: Optional[bool] = None, - encryption: Optional["_models.Encryption"] = None, - network_access_policy: Optional[Union[str, "_models.NetworkAccessPolicy"]] = None, - disk_access_id: Optional[str] = None, - security_profile: Optional["_models.DiskSecurityProfile"] = None, - supports_hibernation: Optional[bool] = None, - public_network_access: Optional[Union[str, "_models.PublicNetworkAccess"]] = None, - completion_percent: Optional[float] = None, - copy_completion_error: Optional["_models.CopyCompletionError"] = None, - data_access_auth_mode: Optional[Union[str, "_models.DataAccessAuthMode"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - :keyword location: The geo-location where the resource lives. Required. - :paramtype location: str - :keyword sku: The snapshots sku name. Can be Standard_LRS, Premium_LRS, or Standard_ZRS. This - is an optional parameter for incremental snapshot and the default behavior is the SKU will be - set to the same sku as the previous snapshot. - :paramtype sku: ~azure.mgmt.compute.models.SnapshotSku - :keyword extended_location: The extended location where the snapshot will be created. Extended - location cannot be changed. - :paramtype extended_location: ~azure.mgmt.compute.models.ExtendedLocation - :keyword os_type: The Operating System type. Known values are: "Windows" and "Linux". - :paramtype os_type: str or ~azure.mgmt.compute.models.OperatingSystemTypes - :keyword hyper_v_generation: The hypervisor generation of the Virtual Machine. Applicable to OS - disks only. Known values are: "V1" and "V2". - :paramtype hyper_v_generation: str or ~azure.mgmt.compute.models.HyperVGeneration - :keyword purchase_plan: Purchase plan information for the image from which the source disk for - the snapshot was originally created. - :paramtype purchase_plan: ~azure.mgmt.compute.models.DiskPurchasePlan - :keyword supported_capabilities: List of supported capabilities for the image from which the - source disk from the snapshot was originally created. - :paramtype supported_capabilities: ~azure.mgmt.compute.models.SupportedCapabilities - :keyword creation_data: Disk source information. CreationData information cannot be changed - after the disk has been created. - :paramtype creation_data: ~azure.mgmt.compute.models.CreationData - :keyword disk_size_gb: If creationData.createOption is Empty, this field is mandatory and it - indicates the size of the disk to create. If this field is present for updates or creation with - other options, it indicates a resize. Resizes are only allowed if the disk is not attached to a - running VM, and can only increase the disk's size. - :paramtype disk_size_gb: int - :keyword encryption_settings_collection: Encryption settings collection used be Azure Disk - Encryption, can contain multiple encryption settings per disk or snapshot. - :paramtype encryption_settings_collection: - ~azure.mgmt.compute.models.EncryptionSettingsCollection - :keyword incremental: Whether a snapshot is incremental. Incremental snapshots on the same disk - occupy less space than full snapshots and can be diffed. - :paramtype incremental: bool - :keyword encryption: Encryption property can be used to encrypt data at rest with customer - managed keys or platform managed keys. - :paramtype encryption: ~azure.mgmt.compute.models.Encryption - :keyword network_access_policy: Policy for accessing the disk via network. Known values are: - "AllowAll", "AllowPrivate", and "DenyAll". - :paramtype network_access_policy: str or ~azure.mgmt.compute.models.NetworkAccessPolicy - :keyword disk_access_id: ARM id of the DiskAccess resource for using private endpoints on - disks. - :paramtype disk_access_id: str - :keyword security_profile: Contains the security related information for the resource. - :paramtype security_profile: ~azure.mgmt.compute.models.DiskSecurityProfile - :keyword supports_hibernation: Indicates the OS on a snapshot supports hibernation. - :paramtype supports_hibernation: bool - :keyword public_network_access: Policy for controlling export on the disk. Known values are: - "Enabled" and "Disabled". - :paramtype public_network_access: str or ~azure.mgmt.compute.models.PublicNetworkAccess - :keyword completion_percent: Percentage complete for the background copy when a resource is - created via the CopyStart operation. - :paramtype completion_percent: float - :keyword copy_completion_error: Indicates the error details if the background copy of a - resource created via the CopyStart operation fails. - :paramtype copy_completion_error: ~azure.mgmt.compute.models.CopyCompletionError - :keyword data_access_auth_mode: Additional authentication requirements when exporting or - uploading to a disk or snapshot. Known values are: "AzureActiveDirectory" and "None". - :paramtype data_access_auth_mode: str or ~azure.mgmt.compute.models.DataAccessAuthMode - """ - super().__init__(tags=tags, location=location, **kwargs) - self.managed_by: Optional[str] = None - self.sku = sku - self.extended_location = extended_location - self.time_created: Optional[datetime.datetime] = None - self.os_type = os_type - self.hyper_v_generation = hyper_v_generation - self.purchase_plan = purchase_plan - self.supported_capabilities = supported_capabilities - self.creation_data = creation_data - self.disk_size_gb = disk_size_gb - self.disk_size_bytes: Optional[int] = None - self.disk_state: Optional[Union[str, "_models.DiskState"]] = None - self.unique_id: Optional[str] = None - self.encryption_settings_collection = encryption_settings_collection - self.provisioning_state: Optional[str] = None - self.incremental = incremental - self.incremental_snapshot_family_id: Optional[str] = None - self.encryption = encryption - self.network_access_policy = network_access_policy - self.disk_access_id = disk_access_id - self.security_profile = security_profile - self.supports_hibernation = supports_hibernation - self.public_network_access = public_network_access - self.completion_percent = completion_percent - self.copy_completion_error = copy_completion_error - self.data_access_auth_mode = data_access_auth_mode - self.snapshot_access_state: Optional[Union[str, "_models.SnapshotAccessState"]] = None - - -class SnapshotList(_serialization.Model): - """The List Snapshots operation response. - - All required parameters must be populated in order to send to server. - - :ivar value: A list of snapshots. Required. - :vartype value: list[~azure.mgmt.compute.models.Snapshot] - :ivar next_link: The link to the next page of items. - :vartype next_link: str - """ - - _validation = { - "value": {"required": True}, - } - - _attribute_map = { - "value": {"key": "value", "type": "[Snapshot]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__(self, *, value: list["_models.Snapshot"], next_link: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword value: A list of snapshots. Required. - :paramtype value: list[~azure.mgmt.compute.models.Snapshot] - :keyword next_link: The link to the next page of items. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class SnapshotSku(_serialization.Model): - """The snapshots sku name. Can be Standard_LRS, Premium_LRS, or Standard_ZRS. This is an optional - parameter for incremental snapshot and the default behavior is the SKU will be set to the same - sku as the previous snapshot. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name: The sku name. Known values are: "Standard_LRS", "Premium_LRS", and "Standard_ZRS". - :vartype name: str or ~azure.mgmt.compute.models.SnapshotStorageAccountTypes - :ivar tier: The sku tier. - :vartype tier: str - """ - - _validation = { - "tier": {"readonly": True}, - } - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "tier": {"key": "tier", "type": "str"}, - } - - def __init__( - self, *, name: Optional[Union[str, "_models.SnapshotStorageAccountTypes"]] = None, **kwargs: Any - ) -> None: - """ - :keyword name: The sku name. Known values are: "Standard_LRS", "Premium_LRS", and - "Standard_ZRS". - :paramtype name: str or ~azure.mgmt.compute.models.SnapshotStorageAccountTypes - """ - super().__init__(**kwargs) - self.name = name - self.tier: Optional[str] = None - - -class SnapshotUpdate(_serialization.Model): - """Snapshot update resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - :ivar sku: The snapshots sku name. Can be Standard_LRS, Premium_LRS, or Standard_ZRS. This is - an optional parameter for incremental snapshot and the default behavior is the SKU will be set - to the same sku as the previous snapshot. - :vartype sku: ~azure.mgmt.compute.models.SnapshotSku - :ivar os_type: the Operating System type. Known values are: "Windows" and "Linux". - :vartype os_type: str or ~azure.mgmt.compute.models.OperatingSystemTypes - :ivar disk_size_gb: If creationData.createOption is Empty, this field is mandatory and it - indicates the size of the disk to create. If this field is present for updates or creation with - other options, it indicates a resize. Resizes are only allowed if the disk is not attached to a - running VM, and can only increase the disk's size. - :vartype disk_size_gb: int - :ivar encryption_settings_collection: Encryption settings collection used be Azure Disk - Encryption, can contain multiple encryption settings per disk or snapshot. - :vartype encryption_settings_collection: - ~azure.mgmt.compute.models.EncryptionSettingsCollection - :ivar encryption: Encryption property can be used to encrypt data at rest with customer managed - keys or platform managed keys. - :vartype encryption: ~azure.mgmt.compute.models.Encryption - :ivar network_access_policy: Policy for accessing the disk via network. Known values are: - "AllowAll", "AllowPrivate", and "DenyAll". - :vartype network_access_policy: str or ~azure.mgmt.compute.models.NetworkAccessPolicy - :ivar disk_access_id: ARM id of the DiskAccess resource for using private endpoints on disks. - :vartype disk_access_id: str - :ivar supports_hibernation: Indicates the OS on a snapshot supports hibernation. - :vartype supports_hibernation: bool - :ivar public_network_access: Policy for controlling export on the disk. Known values are: - "Enabled" and "Disabled". - :vartype public_network_access: str or ~azure.mgmt.compute.models.PublicNetworkAccess - :ivar data_access_auth_mode: Additional authentication requirements when exporting or uploading - to a disk or snapshot. Known values are: "AzureActiveDirectory" and "None". - :vartype data_access_auth_mode: str or ~azure.mgmt.compute.models.DataAccessAuthMode - :ivar supported_capabilities: List of supported capabilities for the image from which the OS - disk was created. - :vartype supported_capabilities: ~azure.mgmt.compute.models.SupportedCapabilities - :ivar snapshot_access_state: The state of snapshot which determines the access availability of - the snapshot. Known values are: "Unknown", "Pending", "Available", "InstantAccess", and - "AvailableWithInstantAccess". - :vartype snapshot_access_state: str or ~azure.mgmt.compute.models.SnapshotAccessState - """ - - _validation = { - "snapshot_access_state": {"readonly": True}, - } - - _attribute_map = { - "tags": {"key": "tags", "type": "{str}"}, - "sku": {"key": "sku", "type": "SnapshotSku"}, - "os_type": {"key": "properties.osType", "type": "str"}, - "disk_size_gb": {"key": "properties.diskSizeGB", "type": "int"}, - "encryption_settings_collection": { - "key": "properties.encryptionSettingsCollection", - "type": "EncryptionSettingsCollection", - }, - "encryption": {"key": "properties.encryption", "type": "Encryption"}, - "network_access_policy": {"key": "properties.networkAccessPolicy", "type": "str"}, - "disk_access_id": {"key": "properties.diskAccessId", "type": "str"}, - "supports_hibernation": {"key": "properties.supportsHibernation", "type": "bool"}, - "public_network_access": {"key": "properties.publicNetworkAccess", "type": "str"}, - "data_access_auth_mode": {"key": "properties.dataAccessAuthMode", "type": "str"}, - "supported_capabilities": {"key": "properties.supportedCapabilities", "type": "SupportedCapabilities"}, - "snapshot_access_state": {"key": "properties.snapshotAccessState", "type": "str"}, - } - - def __init__( - self, - *, - tags: Optional[dict[str, str]] = None, - sku: Optional["_models.SnapshotSku"] = None, - os_type: Optional[Union[str, "_models.OperatingSystemTypes"]] = None, - disk_size_gb: Optional[int] = None, - encryption_settings_collection: Optional["_models.EncryptionSettingsCollection"] = None, - encryption: Optional["_models.Encryption"] = None, - network_access_policy: Optional[Union[str, "_models.NetworkAccessPolicy"]] = None, - disk_access_id: Optional[str] = None, - supports_hibernation: Optional[bool] = None, - public_network_access: Optional[Union[str, "_models.PublicNetworkAccess"]] = None, - data_access_auth_mode: Optional[Union[str, "_models.DataAccessAuthMode"]] = None, - supported_capabilities: Optional["_models.SupportedCapabilities"] = None, - **kwargs: Any - ) -> None: - """ - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - :keyword sku: The snapshots sku name. Can be Standard_LRS, Premium_LRS, or Standard_ZRS. This - is an optional parameter for incremental snapshot and the default behavior is the SKU will be - set to the same sku as the previous snapshot. - :paramtype sku: ~azure.mgmt.compute.models.SnapshotSku - :keyword os_type: the Operating System type. Known values are: "Windows" and "Linux". - :paramtype os_type: str or ~azure.mgmt.compute.models.OperatingSystemTypes - :keyword disk_size_gb: If creationData.createOption is Empty, this field is mandatory and it - indicates the size of the disk to create. If this field is present for updates or creation with - other options, it indicates a resize. Resizes are only allowed if the disk is not attached to a - running VM, and can only increase the disk's size. - :paramtype disk_size_gb: int - :keyword encryption_settings_collection: Encryption settings collection used be Azure Disk - Encryption, can contain multiple encryption settings per disk or snapshot. - :paramtype encryption_settings_collection: - ~azure.mgmt.compute.models.EncryptionSettingsCollection - :keyword encryption: Encryption property can be used to encrypt data at rest with customer - managed keys or platform managed keys. - :paramtype encryption: ~azure.mgmt.compute.models.Encryption - :keyword network_access_policy: Policy for accessing the disk via network. Known values are: - "AllowAll", "AllowPrivate", and "DenyAll". - :paramtype network_access_policy: str or ~azure.mgmt.compute.models.NetworkAccessPolicy - :keyword disk_access_id: ARM id of the DiskAccess resource for using private endpoints on - disks. - :paramtype disk_access_id: str - :keyword supports_hibernation: Indicates the OS on a snapshot supports hibernation. - :paramtype supports_hibernation: bool - :keyword public_network_access: Policy for controlling export on the disk. Known values are: - "Enabled" and "Disabled". - :paramtype public_network_access: str or ~azure.mgmt.compute.models.PublicNetworkAccess - :keyword data_access_auth_mode: Additional authentication requirements when exporting or - uploading to a disk or snapshot. Known values are: "AzureActiveDirectory" and "None". - :paramtype data_access_auth_mode: str or ~azure.mgmt.compute.models.DataAccessAuthMode - :keyword supported_capabilities: List of supported capabilities for the image from which the OS - disk was created. - :paramtype supported_capabilities: ~azure.mgmt.compute.models.SupportedCapabilities - """ - super().__init__(**kwargs) - self.tags = tags - self.sku = sku - self.os_type = os_type - self.disk_size_gb = disk_size_gb - self.encryption_settings_collection = encryption_settings_collection - self.encryption = encryption - self.network_access_policy = network_access_policy - self.disk_access_id = disk_access_id - self.supports_hibernation = supports_hibernation - self.public_network_access = public_network_access - self.data_access_auth_mode = data_access_auth_mode - self.supported_capabilities = supported_capabilities - self.snapshot_access_state: Optional[Union[str, "_models.SnapshotAccessState"]] = None - - -class SoftDeletePolicy(_serialization.Model): - """Contains information about the soft deletion policy of the gallery. - - :ivar is_soft_delete_enabled: Enables soft-deletion for resources in this gallery, allowing - them to be recovered within retention time. - :vartype is_soft_delete_enabled: bool - """ - - _attribute_map = { - "is_soft_delete_enabled": {"key": "isSoftDeleteEnabled", "type": "bool"}, - } - - def __init__(self, *, is_soft_delete_enabled: Optional[bool] = None, **kwargs: Any) -> None: - """ - :keyword is_soft_delete_enabled: Enables soft-deletion for resources in this gallery, allowing - them to be recovered within retention time. - :paramtype is_soft_delete_enabled: bool - """ - super().__init__(**kwargs) - self.is_soft_delete_enabled = is_soft_delete_enabled - - -class SourceVault(_serialization.Model): - """The vault id is an Azure Resource Manager Resource id in the form - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}. - - :ivar id: Resource Id. - :vartype id: str - """ - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - } - - def __init__(self, *, id: Optional[str] = None, **kwargs: Any) -> None: # pylint: disable=redefined-builtin - """ - :keyword id: Resource Id. - :paramtype id: str - """ - super().__init__(**kwargs) - self.id = id - - -class SpotRestorePolicy(_serialization.Model): - """Specifies the Spot-Try-Restore properties for the virtual machine scale set. 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: Any) -> None: - """ - :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().__init__(**kwargs) - self.enabled = enabled - self.restore_timeout = restore_timeout - - -class SshConfiguration(_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.models.SshPublicKey] - """ - - _attribute_map = { - "public_keys": {"key": "publicKeys", "type": "[SshPublicKey]"}, - } - - def __init__(self, *, public_keys: Optional[list["_models.SshPublicKey"]] = None, **kwargs: Any) -> None: - """ - :keyword public_keys: The list of SSH public keys used to authenticate with linux based VMs. - :paramtype public_keys: list[~azure.mgmt.compute.models.SshPublicKey] - """ - super().__init__(**kwargs) - self.public_keys = public_keys - - -class SshGenerateKeyPairInputParameters(_serialization.Model): - """Parameters for GenerateSshKeyPair. - - :ivar encryption_type: The encryption type of the SSH keys to be generated. See - SshEncryptionTypes for possible set of values. If not provided, will default to RSA. Known - values are: "RSA" and "Ed25519". - :vartype encryption_type: str or ~azure.mgmt.compute.models.SshEncryptionTypes - """ - - _attribute_map = { - "encryption_type": {"key": "encryptionType", "type": "str"}, - } - - def __init__( - self, *, encryption_type: Optional[Union[str, "_models.SshEncryptionTypes"]] = None, **kwargs: Any - ) -> None: - """ - :keyword encryption_type: The encryption type of the SSH keys to be generated. See - SshEncryptionTypes for possible set of values. If not provided, will default to RSA. Known - values are: "RSA" and "Ed25519". - :paramtype encryption_type: str or ~azure.mgmt.compute.models.SshEncryptionTypes - """ - super().__init__(**kwargs) - self.encryption_type = encryption_type - - -class SshPublicKey(_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. 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: Any) -> None: - """ - :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. 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().__init__(**kwargs) - self.path = path - self.key_data = key_data - - -class SshPublicKeyGenerateKeyPairResult(_serialization.Model): - """Response from generation of an SSH key pair. - - All required parameters must be populated in order to send to server. - - :ivar private_key: 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. Required. - :vartype private_key: str - :ivar public_key: Public key portion of the key pair used to authenticate to a virtual machine - through ssh. The public key is in ssh-rsa format. Required. - :vartype public_key: str - :ivar id: The ARM resource id in the form of - /subscriptions/{SubscriptionId}/resourceGroups/{ResourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{SshPublicKeyName}. - Required. - :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: Any # pylint: disable=redefined-builtin - ) -> None: - """ - :keyword private_key: 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. Required. - :paramtype private_key: str - :keyword public_key: Public key portion of the key pair used to authenticate to a virtual - machine through ssh. The public key is in ssh-rsa format. Required. - :paramtype public_key: str - :keyword id: The ARM resource id in the form of - /subscriptions/{SubscriptionId}/resourceGroups/{ResourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{SshPublicKeyName}. - Required. - :paramtype id: str - """ - super().__init__(**kwargs) - self.private_key = private_key - self.public_key = public_key - self.id = id - - -class SshPublicKeyResource(TrackedResource): - """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 server. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.compute.models.SystemData - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - :ivar location: The geo-location where the resource lives. Required. - :vartype location: 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}, - "system_data": {"readonly": True}, - "location": {"required": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - "tags": {"key": "tags", "type": "{str}"}, - "location": {"key": "location", "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: Any - ) -> None: - """ - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - :keyword location: The geo-location where the resource lives. Required. - :paramtype location: 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().__init__(tags=tags, location=location, **kwargs) - self.public_key = public_key - - -class SshPublicKeysGroupListResult(_serialization.Model): - """The list SSH public keys operation response. - - All required parameters must be populated in order to send to server. - - :ivar value: The list of SSH public keys. Required. - :vartype value: list[~azure.mgmt.compute.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["_models.SshPublicKeyResource"], next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: The list of SSH public keys. Required. - :paramtype value: list[~azure.mgmt.compute.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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class SshPublicKeyUpdateResource(UpdateResource): - """Specifies information about the SSH public key. - - :ivar 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: Any - ) -> None: - """ - :keyword 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().__init__(tags=tags, **kwargs) - self.public_key = public_key - - -class StatusCodeCount(_serialization.Model): - """The status code and count of the cloud service instance view statuses. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar code: The instance view status code. - :vartype code: str - :ivar count: Number of instances having this status code. - :vartype count: int - """ - - _validation = { - "code": {"readonly": True}, - "count": {"readonly": True}, - } - - _attribute_map = { - "code": {"key": "code", "type": "str"}, - "count": {"key": "count", "type": "int"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.code: Optional[str] = None - self.count: Optional[int] = None - - -class StorageProfile(_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.models.ImageReference - :ivar os_disk: Specifies information about the operating system disk used by the virtual - machine. For more information about disks, see `About disks and VHDs for Azure virtual machines - `_. - :vartype os_disk: ~azure.mgmt.compute.models.OSDisk - :ivar data_disks: Specifies the parameters that are used to add a data disk to a virtual - machine. For more information about disks, see `About disks and VHDs for Azure virtual machines - `_. - :vartype data_disks: list[~azure.mgmt.compute.models.DataDisk] - :ivar disk_controller_type: Specifies the disk controller type configured for the VM. **Note:** - This property will be set to the default disk controller type if not specified provided virtual - machine is being created with 'hyperVGeneration' set to V2 based on the capabilities of the - operating system disk and VM size from the the specified minimum api version. You need to - deallocate the VM before updating its disk controller type unless you are updating the VM size - in the VM configuration which implicitly deallocates and reallocates the VM. Minimum - api-version: 2022-08-01. Known values are: "SCSI" and "NVMe". - :vartype disk_controller_type: str or ~azure.mgmt.compute.models.DiskControllerTypes - :ivar align_regional_disks_to_vm_zone: Specifies whether the regional disks should be - aligned/moved to the VM zone. This is applicable only for VMs with placement property set. - Please note that this change is irreversible. Minimum api-version: 2024-11-01. - :vartype align_regional_disks_to_vm_zone: bool - """ - - _attribute_map = { - "image_reference": {"key": "imageReference", "type": "ImageReference"}, - "os_disk": {"key": "osDisk", "type": "OSDisk"}, - "data_disks": {"key": "dataDisks", "type": "[DataDisk]"}, - "disk_controller_type": {"key": "diskControllerType", "type": "str"}, - "align_regional_disks_to_vm_zone": {"key": "alignRegionalDisksToVMZone", "type": "bool"}, - } - - def __init__( - self, - *, - image_reference: Optional["_models.ImageReference"] = None, - os_disk: Optional["_models.OSDisk"] = None, - data_disks: Optional[list["_models.DataDisk"]] = None, - disk_controller_type: Optional[Union[str, "_models.DiskControllerTypes"]] = None, - align_regional_disks_to_vm_zone: Optional[bool] = None, - **kwargs: Any - ) -> None: - """ - :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.models.ImageReference - :keyword os_disk: Specifies information about the operating system disk used by the virtual - machine. For more information about disks, see `About disks and VHDs for Azure virtual machines - `_. - :paramtype os_disk: ~azure.mgmt.compute.models.OSDisk - :keyword data_disks: Specifies the parameters that are used to add a data disk to a virtual - machine. For more information about disks, see `About disks and VHDs for Azure virtual machines - `_. - :paramtype data_disks: list[~azure.mgmt.compute.models.DataDisk] - :keyword disk_controller_type: Specifies the disk controller type configured for the VM. - **Note:** This property will be set to the default disk controller type if not specified - provided virtual machine is being created with 'hyperVGeneration' set to V2 based on the - capabilities of the operating system disk and VM size from the the specified minimum api - version. You need to deallocate the VM before updating its disk controller type unless you are - updating the VM size in the VM configuration which implicitly deallocates and reallocates the - VM. Minimum api-version: 2022-08-01. Known values are: "SCSI" and "NVMe". - :paramtype disk_controller_type: str or ~azure.mgmt.compute.models.DiskControllerTypes - :keyword align_regional_disks_to_vm_zone: Specifies whether the regional disks should be - aligned/moved to the VM zone. This is applicable only for VMs with placement property set. - Please note that this change is irreversible. Minimum api-version: 2024-11-01. - :paramtype align_regional_disks_to_vm_zone: bool - """ - super().__init__(**kwargs) - self.image_reference = image_reference - self.os_disk = os_disk - self.data_disks = data_disks - self.disk_controller_type = disk_controller_type - self.align_regional_disks_to_vm_zone = align_regional_disks_to_vm_zone - - -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.models.InstanceViewStatus - """ - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "colocation_status": {"key": "colocationStatus", "type": "InstanceViewStatus"}, - } - - def __init__( - self, - *, - id: Optional[str] = None, # pylint: disable=redefined-builtin - colocation_status: Optional["_models.InstanceViewStatus"] = None, - **kwargs: Any - ) -> None: - """ - :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.models.InstanceViewStatus - """ - super().__init__(id=id, **kwargs) - self.colocation_status = colocation_status - - -class SupportedCapabilities(_serialization.Model): - """List of supported capabilities persisted on the disk resource for VM use. - - :ivar disk_controller_types: The disk controllers that an OS disk supports. If set it can be - SCSI or SCSI, NVME or NVME, SCSI. - :vartype disk_controller_types: str - :ivar accelerated_network: True if the image from which the OS disk is created supports - accelerated networking. - :vartype accelerated_network: bool - :ivar architecture: CPU architecture supported by an OS disk. Known values are: "x64" and - "Arm64". - :vartype architecture: str or ~azure.mgmt.compute.models.Architecture - :ivar supported_security_option: Refers to the security capability of the disk supported to - create a Trusted launch or Confidential VM. Known values are: "TrustedLaunchSupported" and - "TrustedLaunchAndConfidentialVMSupported". - :vartype supported_security_option: str or ~azure.mgmt.compute.models.SupportedSecurityOption - """ - - _attribute_map = { - "disk_controller_types": {"key": "diskControllerTypes", "type": "str"}, - "accelerated_network": {"key": "acceleratedNetwork", "type": "bool"}, - "architecture": {"key": "architecture", "type": "str"}, - "supported_security_option": {"key": "supportedSecurityOption", "type": "str"}, - } - - def __init__( - self, - *, - disk_controller_types: Optional[str] = None, - accelerated_network: Optional[bool] = None, - architecture: Optional[Union[str, "_models.Architecture"]] = None, - supported_security_option: Optional[Union[str, "_models.SupportedSecurityOption"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword disk_controller_types: The disk controllers that an OS disk supports. If set it can be - SCSI or SCSI, NVME or NVME, SCSI. - :paramtype disk_controller_types: str - :keyword accelerated_network: True if the image from which the OS disk is created supports - accelerated networking. - :paramtype accelerated_network: bool - :keyword architecture: CPU architecture supported by an OS disk. Known values are: "x64" and - "Arm64". - :paramtype architecture: str or ~azure.mgmt.compute.models.Architecture - :keyword supported_security_option: Refers to the security capability of the disk supported to - create a Trusted launch or Confidential VM. Known values are: "TrustedLaunchSupported" and - "TrustedLaunchAndConfidentialVMSupported". - :paramtype supported_security_option: str or ~azure.mgmt.compute.models.SupportedSecurityOption - """ - super().__init__(**kwargs) - self.disk_controller_types = disk_controller_types - self.accelerated_network = accelerated_network - self.architecture = architecture - self.supported_security_option = supported_security_option - - -class SystemData(_serialization.Model): - """Metadata pertaining to creation and last modification of the resource. - - :ivar created_by: The identity that created the resource. - :vartype created_by: str - :ivar created_by_type: The type of identity that created the resource. Known values are: - "User", "Application", "ManagedIdentity", and "Key". - :vartype created_by_type: str or ~azure.mgmt.compute.models.CreatedByType - :ivar created_at: The timestamp of resource creation (UTC). - :vartype created_at: ~datetime.datetime - :ivar last_modified_by: The identity that last modified the resource. - :vartype last_modified_by: str - :ivar last_modified_by_type: The type of identity that last modified the resource. Known values - are: "User", "Application", "ManagedIdentity", and "Key". - :vartype last_modified_by_type: str or ~azure.mgmt.compute.models.CreatedByType - :ivar last_modified_at: The timestamp of resource last modification (UTC). - :vartype last_modified_at: ~datetime.datetime - """ - - _attribute_map = { - "created_by": {"key": "createdBy", "type": "str"}, - "created_by_type": {"key": "createdByType", "type": "str"}, - "created_at": {"key": "createdAt", "type": "iso-8601"}, - "last_modified_by": {"key": "lastModifiedBy", "type": "str"}, - "last_modified_by_type": {"key": "lastModifiedByType", "type": "str"}, - "last_modified_at": {"key": "lastModifiedAt", "type": "iso-8601"}, - } - - def __init__( - self, - *, - created_by: Optional[str] = None, - created_by_type: Optional[Union[str, "_models.CreatedByType"]] = None, - created_at: Optional[datetime.datetime] = None, - last_modified_by: Optional[str] = None, - last_modified_by_type: Optional[Union[str, "_models.CreatedByType"]] = None, - last_modified_at: Optional[datetime.datetime] = None, - **kwargs: Any - ) -> None: - """ - :keyword created_by: The identity that created the resource. - :paramtype created_by: str - :keyword created_by_type: The type of identity that created the resource. Known values are: - "User", "Application", "ManagedIdentity", and "Key". - :paramtype created_by_type: str or ~azure.mgmt.compute.models.CreatedByType - :keyword created_at: The timestamp of resource creation (UTC). - :paramtype created_at: ~datetime.datetime - :keyword last_modified_by: The identity that last modified the resource. - :paramtype last_modified_by: str - :keyword last_modified_by_type: The type of identity that last modified the resource. Known - values are: "User", "Application", "ManagedIdentity", and "Key". - :paramtype last_modified_by_type: str or ~azure.mgmt.compute.models.CreatedByType - :keyword last_modified_at: The timestamp of resource last modification (UTC). - :paramtype last_modified_at: ~datetime.datetime - """ - super().__init__(**kwargs) - self.created_by = created_by - self.created_by_type = created_by_type - self.created_at = created_at - self.last_modified_by = last_modified_by - self.last_modified_by_type = last_modified_by_type - self.last_modified_at = last_modified_at - - -class TargetRegion(_serialization.Model): - """Describes the target region information. - - All required parameters must be populated in order to send to server. - - :ivar name: The name of the region. Required. - :vartype name: str - :ivar regional_replica_count: The number of replicas of the Image Version to be created per - region. This property is updatable. - :vartype regional_replica_count: int - :ivar storage_account_type: Specifies the storage account type to be used to store the image. - This property is not updatable. Known values are: "Standard_LRS", "Standard_ZRS", - "Premium_LRS", and "PremiumV2_LRS". - :vartype storage_account_type: str or ~azure.mgmt.compute.models.StorageAccountType - :ivar encryption: Optional. Allows users to provide customer managed keys for encrypting the OS - and data disks in the gallery artifact. - :vartype encryption: ~azure.mgmt.compute.models.EncryptionImages - :ivar exclude_from_latest: Contains the flag setting to hide an image when users specify - version='latest'. - :vartype exclude_from_latest: bool - :ivar additional_replica_sets: List of storage sku with replica count to create direct drive - replicas. - :vartype additional_replica_sets: list[~azure.mgmt.compute.models.AdditionalReplicaSet] - """ - - _validation = { - "name": {"required": True}, - } - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "regional_replica_count": {"key": "regionalReplicaCount", "type": "int"}, - "storage_account_type": {"key": "storageAccountType", "type": "str"}, - "encryption": {"key": "encryption", "type": "EncryptionImages"}, - "exclude_from_latest": {"key": "excludeFromLatest", "type": "bool"}, - "additional_replica_sets": {"key": "additionalReplicaSets", "type": "[AdditionalReplicaSet]"}, - } - - def __init__( - self, - *, - name: str, - regional_replica_count: Optional[int] = None, - storage_account_type: Optional[Union[str, "_models.StorageAccountType"]] = None, - encryption: Optional["_models.EncryptionImages"] = None, - exclude_from_latest: Optional[bool] = None, - additional_replica_sets: Optional[list["_models.AdditionalReplicaSet"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword name: The name of the region. Required. - :paramtype name: str - :keyword regional_replica_count: The number of replicas of the Image Version to be created per - region. This property is updatable. - :paramtype regional_replica_count: int - :keyword storage_account_type: Specifies the storage account type to be used to store the - image. This property is not updatable. Known values are: "Standard_LRS", "Standard_ZRS", - "Premium_LRS", and "PremiumV2_LRS". - :paramtype storage_account_type: str or ~azure.mgmt.compute.models.StorageAccountType - :keyword encryption: Optional. Allows users to provide customer managed keys for encrypting the - OS and data disks in the gallery artifact. - :paramtype encryption: ~azure.mgmt.compute.models.EncryptionImages - :keyword exclude_from_latest: Contains the flag setting to hide an image when users specify - version='latest'. - :paramtype exclude_from_latest: bool - :keyword additional_replica_sets: List of storage sku with replica count to create direct drive - replicas. - :paramtype additional_replica_sets: list[~azure.mgmt.compute.models.AdditionalReplicaSet] - """ - super().__init__(**kwargs) - self.name = name - self.regional_replica_count = regional_replica_count - self.storage_account_type = storage_account_type - self.encryption = encryption - self.exclude_from_latest = exclude_from_latest - self.additional_replica_sets = additional_replica_sets - - -class TerminateNotificationProfile(_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: Any - ) -> None: - """ - :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().__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 server. - - :ivar blob_container_sas_uri: SAS Uri of the logging blob container to which LogAnalytics Api - writes output logs to. Required. - :vartype blob_container_sas_uri: str - :ivar from_time: From time of the query. Required. - :vartype from_time: ~datetime.datetime - :ivar to_time: To time of the query. Required. - :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 - """ - - -class UefiKey(_serialization.Model): - """A UEFI key signature. - - :ivar type: The type of key signature. Known values are: "sha256" and "x509". - :vartype type: str or ~azure.mgmt.compute.models.UefiKeyType - :ivar value: The value of the key signature. - :vartype value: list[str] - """ - - _attribute_map = { - "type": {"key": "type", "type": "str"}, - "value": {"key": "value", "type": "[str]"}, - } - - def __init__( - self, - *, - type: Optional[Union[str, "_models.UefiKeyType"]] = None, - value: Optional[list[str]] = None, - **kwargs: Any - ) -> None: - """ - :keyword type: The type of key signature. Known values are: "sha256" and "x509". - :paramtype type: str or ~azure.mgmt.compute.models.UefiKeyType - :keyword value: The value of the key signature. - :paramtype value: list[str] - """ - super().__init__(**kwargs) - self.type = type - self.value = value - - -class UefiKeySignatures(_serialization.Model): - """Additional UEFI key signatures that will be added to the image in addition to the signature - templates. - - :ivar pk: The Platform Key of this image version. - :vartype pk: ~azure.mgmt.compute.models.UefiKey - :ivar kek: The Key Encryption Keys of this image version. - :vartype kek: list[~azure.mgmt.compute.models.UefiKey] - :ivar db: The database of UEFI keys for this image version. - :vartype db: list[~azure.mgmt.compute.models.UefiKey] - :ivar dbx: The database of revoked UEFI keys for this image version. - :vartype dbx: list[~azure.mgmt.compute.models.UefiKey] - """ - - _attribute_map = { - "pk": {"key": "pk", "type": "UefiKey"}, - "kek": {"key": "kek", "type": "[UefiKey]"}, - "db": {"key": "db", "type": "[UefiKey]"}, - "dbx": {"key": "dbx", "type": "[UefiKey]"}, - } - - def __init__( - self, - *, - pk: Optional["_models.UefiKey"] = None, - kek: Optional[list["_models.UefiKey"]] = None, - db: Optional[list["_models.UefiKey"]] = None, - dbx: Optional[list["_models.UefiKey"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword pk: The Platform Key of this image version. - :paramtype pk: ~azure.mgmt.compute.models.UefiKey - :keyword kek: The Key Encryption Keys of this image version. - :paramtype kek: list[~azure.mgmt.compute.models.UefiKey] - :keyword db: The database of UEFI keys for this image version. - :paramtype db: list[~azure.mgmt.compute.models.UefiKey] - :keyword dbx: The database of revoked UEFI keys for this image version. - :paramtype dbx: list[~azure.mgmt.compute.models.UefiKey] - """ - super().__init__(**kwargs) - self.pk = pk - self.kek = kek - self.db = db - self.dbx = dbx - - -class UefiSettings(_serialization.Model): - """Specifies the security settings like secure boot and vTPM used while creating the virtual - machine. Minimum api-version: 2020-12-01. - - :ivar secure_boot_enabled: Specifies whether secure boot should be enabled on the virtual - machine. 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. 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: Any - ) -> None: - """ - :keyword secure_boot_enabled: Specifies whether secure boot should be enabled on the virtual - machine. 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. - Minimum api-version: 2020-12-01. - :paramtype v_tpm_enabled: bool - """ - super().__init__(**kwargs) - self.secure_boot_enabled = secure_boot_enabled - self.v_tpm_enabled = v_tpm_enabled - - -class UpdateDomain(_serialization.Model): - """Defines an update domain for the cloud service. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Resource Id. - :vartype id: str - :ivar name: Resource Name. - :vartype name: str - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.id: Optional[str] = None - self.name: Optional[str] = None - - -class UpdateDomainListResult(_serialization.Model): - """The list operation result. - - All required parameters must be populated in order to send to server. - - :ivar value: The list of resources. Required. - :vartype value: list[~azure.mgmt.compute.models.UpdateDomain] - :ivar next_link: The URI to fetch the next page of resources. Use this to get the next page of - resources. Do this till nextLink is null to fetch all the resources. - :vartype next_link: str - """ - - _validation = { - "value": {"required": True}, - } - - _attribute_map = { - "value": {"key": "value", "type": "[UpdateDomain]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__(self, *, value: list["_models.UpdateDomain"], next_link: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword value: The list of resources. Required. - :paramtype value: list[~azure.mgmt.compute.models.UpdateDomain] - :keyword next_link: The URI to fetch the next page of resources. Use this to get the next page - of resources. Do this till nextLink is null to fetch all the resources. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class UpgradeOperationHistoricalStatusInfo(_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.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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.properties: Optional["_models.UpgradeOperationHistoricalStatusInfoProperties"] = None - self.type: Optional[str] = None - self.location: Optional[str] = None - - -class UpgradeOperationHistoricalStatusInfoProperties(_serialization.Model): # pylint: disable=name-too-long - """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.models.UpgradeOperationHistoryStatus - :ivar progress: Counts of the VMs in each state. - :vartype progress: ~azure.mgmt.compute.models.RollingUpgradeProgressInfo - :ivar error: Error Details for this upgrade if there are any. - :vartype error: ~azure.mgmt.compute.models.ApiError - :ivar started_by: Invoker of the Upgrade Operation. Known values are: "Unknown", "User", and - "Platform". - :vartype started_by: str or ~azure.mgmt.compute.models.UpgradeOperationInvoker - :ivar target_image_reference: Image Reference details. - :vartype target_image_reference: ~azure.mgmt.compute.models.ImageReference - :ivar rollback_info: Information about OS rollback if performed. - :vartype rollback_info: ~azure.mgmt.compute.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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.running_status: Optional["_models.UpgradeOperationHistoryStatus"] = None - self.progress: Optional["_models.RollingUpgradeProgressInfo"] = None - self.error: Optional["_models.ApiError"] = None - self.started_by: Optional[Union[str, "_models.UpgradeOperationInvoker"]] = None - self.target_image_reference: Optional["_models.ImageReference"] = None - self.rollback_info: Optional["_models.RollbackStatusInfo"] = None - - -class UpgradeOperationHistoryStatus(_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. Known values are: - "RollingForward", "Cancelled", "Completed", and "Faulted". - :vartype code: str or ~azure.mgmt.compute.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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.code: Optional[Union[str, "_models.UpgradeState"]] = None - self.start_time: Optional[datetime.datetime] = None - self.end_time: Optional[datetime.datetime] = None - - -class UpgradePolicy(_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. Known values are: - "Automatic", "Manual", and "Rolling". - :vartype mode: str or ~azure.mgmt.compute.models.UpgradeMode - :ivar rolling_upgrade_policy: The configuration parameters used while performing a rolling - upgrade. - :vartype rolling_upgrade_policy: ~azure.mgmt.compute.models.RollingUpgradePolicy - :ivar automatic_os_upgrade_policy: Configuration parameters used for performing automatic OS - Upgrade. - :vartype automatic_os_upgrade_policy: ~azure.mgmt.compute.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, "_models.UpgradeMode"]] = None, - rolling_upgrade_policy: Optional["_models.RollingUpgradePolicy"] = None, - automatic_os_upgrade_policy: Optional["_models.AutomaticOSUpgradePolicy"] = None, - **kwargs: Any - ) -> None: - """ - :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. Known values - are: "Automatic", "Manual", and "Rolling". - :paramtype mode: str or ~azure.mgmt.compute.models.UpgradeMode - :keyword rolling_upgrade_policy: The configuration parameters used while performing a rolling - upgrade. - :paramtype rolling_upgrade_policy: ~azure.mgmt.compute.models.RollingUpgradePolicy - :keyword automatic_os_upgrade_policy: Configuration parameters used for performing automatic OS - Upgrade. - :paramtype automatic_os_upgrade_policy: ~azure.mgmt.compute.models.AutomaticOSUpgradePolicy - """ - super().__init__(**kwargs) - self.mode = mode - self.rolling_upgrade_policy = rolling_upgrade_policy - self.automatic_os_upgrade_policy = automatic_os_upgrade_policy - - -class Usage(_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 server. - - :ivar unit: An enum describing the unit of usage measurement. Required. Default value is - "Count". - :vartype unit: str - :ivar current_value: The current usage of the resource. Required. - :vartype current_value: int - :ivar limit: The maximum permitted usage of the resource. Required. - :vartype limit: int - :ivar name: The name of the type of usage. Required. - :vartype name: ~azure.mgmt.compute.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": "int"}, - "name": {"key": "name", "type": "UsageName"}, - } - - unit = "Count" - - def __init__(self, *, current_value: int, limit: int, name: "_models.UsageName", **kwargs: Any) -> None: - """ - :keyword current_value: The current usage of the resource. Required. - :paramtype current_value: int - :keyword limit: The maximum permitted usage of the resource. Required. - :paramtype limit: int - :keyword name: The name of the type of usage. Required. - :paramtype name: ~azure.mgmt.compute.models.UsageName - """ - super().__init__(**kwargs) - self.current_value = current_value - self.limit = limit - self.name = name - - -class UsageName(_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: Any) -> None: - """ - :keyword value: The name of the resource. - :paramtype value: str - :keyword localized_value: The localized name of the resource. - :paramtype localized_value: str - """ - super().__init__(**kwargs) - self.value = value - self.localized_value = localized_value - - -class UserArtifactManage(_serialization.Model): - """UserArtifactManage. - - All required parameters must be populated in order to send to server. - - :ivar install: Required. The path and arguments to install the gallery application. This is - limited to 4096 characters. Required. - :vartype install: str - :ivar remove: Required. The path and arguments to remove the gallery application. This is - limited to 4096 characters. Required. - :vartype remove: str - :ivar update: Optional. The path and arguments to update the gallery application. If not - present, then update operation will invoke remove command on the previous version and install - command on the current version of the gallery application. This is limited to 4096 characters. - :vartype update: str - """ - - _validation = { - "install": {"required": True}, - "remove": {"required": True}, - } - - _attribute_map = { - "install": {"key": "install", "type": "str"}, - "remove": {"key": "remove", "type": "str"}, - "update": {"key": "update", "type": "str"}, - } - - def __init__(self, *, install: str, remove: str, update: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword install: Required. The path and arguments to install the gallery application. This is - limited to 4096 characters. Required. - :paramtype install: str - :keyword remove: Required. The path and arguments to remove the gallery application. This is - limited to 4096 characters. Required. - :paramtype remove: str - :keyword update: Optional. The path and arguments to update the gallery application. If not - present, then update operation will invoke remove command on the previous version and install - command on the current version of the gallery application. This is limited to 4096 characters. - :paramtype update: str - """ - super().__init__(**kwargs) - self.install = install - self.remove = remove - self.update = update - - -class UserArtifactSettings(_serialization.Model): - """Additional settings for the VM app that contains the target package and config file name when - it is deployed to target VM or VM scale set. - - :ivar package_file_name: Optional. The name to assign the downloaded package file on the VM. - This is limited to 4096 characters. If not specified, the package file will be named the same - as the Gallery Application name. - :vartype package_file_name: str - :ivar config_file_name: Optional. The name to assign the downloaded config file on the VM. This - is limited to 4096 characters. If not specified, the config file will be named the Gallery - Application name appended with "_config". - :vartype config_file_name: str - :ivar script_behavior_after_reboot: Optional. The action to be taken with regards to - install/update/remove of the gallery application in the event of a reboot. Known values are: - "None" and "Rerun". - :vartype script_behavior_after_reboot: str or - ~azure.mgmt.compute.models.GalleryApplicationScriptRebootBehavior - """ - - _attribute_map = { - "package_file_name": {"key": "packageFileName", "type": "str"}, - "config_file_name": {"key": "configFileName", "type": "str"}, - "script_behavior_after_reboot": {"key": "scriptBehaviorAfterReboot", "type": "str"}, - } - - def __init__( - self, - *, - package_file_name: Optional[str] = None, - config_file_name: Optional[str] = None, - script_behavior_after_reboot: Optional[Union[str, "_models.GalleryApplicationScriptRebootBehavior"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword package_file_name: Optional. The name to assign the downloaded package file on the VM. - This is limited to 4096 characters. If not specified, the package file will be named the same - as the Gallery Application name. - :paramtype package_file_name: str - :keyword config_file_name: Optional. The name to assign the downloaded config file on the VM. - This is limited to 4096 characters. If not specified, the config file will be named the Gallery - Application name appended with "_config". - :paramtype config_file_name: str - :keyword script_behavior_after_reboot: Optional. The action to be taken with regards to - install/update/remove of the gallery application in the event of a reboot. Known values are: - "None" and "Rerun". - :paramtype script_behavior_after_reboot: str or - ~azure.mgmt.compute.models.GalleryApplicationScriptRebootBehavior - """ - super().__init__(**kwargs) - self.package_file_name = package_file_name - self.config_file_name = config_file_name - self.script_behavior_after_reboot = script_behavior_after_reboot - - -class UserArtifactSource(_serialization.Model): - """The source image from which the Image Version is going to be created. - - All required parameters must be populated in order to send to server. - - :ivar media_link: Required. The mediaLink of the artifact, must be a readable storage page - blob. Required. - :vartype media_link: str - :ivar default_configuration_link: Optional. The defaultConfigurationLink of the artifact, must - be a readable storage page blob. - :vartype default_configuration_link: str - """ - - _validation = { - "media_link": {"required": True}, - } - - _attribute_map = { - "media_link": {"key": "mediaLink", "type": "str"}, - "default_configuration_link": {"key": "defaultConfigurationLink", "type": "str"}, - } - - def __init__(self, *, media_link: str, default_configuration_link: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword media_link: Required. The mediaLink of the artifact, must be a readable storage page - blob. Required. - :paramtype media_link: str - :keyword default_configuration_link: Optional. The defaultConfigurationLink of the artifact, - must be a readable storage page blob. - :paramtype default_configuration_link: str - """ - super().__init__(**kwargs) - self.media_link = media_link - self.default_configuration_link = default_configuration_link - - -class UserAssignedIdentitiesValue(_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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.principal_id: Optional[str] = None - self.client_id: Optional[str] = None - - -class UserInitiatedReboot(_serialization.Model): - """Specifies Reboot related Scheduled Event related configurations. - - :ivar automatically_approve: Specifies Reboot Scheduled Event related configurations. - :vartype automatically_approve: bool - """ - - _attribute_map = { - "automatically_approve": {"key": "automaticallyApprove", "type": "bool"}, - } - - def __init__(self, *, automatically_approve: Optional[bool] = None, **kwargs: Any) -> None: - """ - :keyword automatically_approve: Specifies Reboot Scheduled Event related configurations. - :paramtype automatically_approve: bool - """ - super().__init__(**kwargs) - self.automatically_approve = automatically_approve - - -class UserInitiatedRedeploy(_serialization.Model): - """Specifies Redeploy related Scheduled Event related configurations. - - :ivar automatically_approve: Specifies Redeploy Scheduled Event related configurations. - :vartype automatically_approve: bool - """ - - _attribute_map = { - "automatically_approve": {"key": "automaticallyApprove", "type": "bool"}, - } - - def __init__(self, *, automatically_approve: Optional[bool] = None, **kwargs: Any) -> None: - """ - :keyword automatically_approve: Specifies Redeploy Scheduled Event related configurations. - :paramtype automatically_approve: bool - """ - super().__init__(**kwargs) - self.automatically_approve = automatically_approve - - -class ValidationsProfile(_serialization.Model): - """This is the validations profile of a Gallery Image Version. - - :ivar validation_etag: The published time of the image version. - :vartype validation_etag: str - :ivar executed_validations: - :vartype executed_validations: list[~azure.mgmt.compute.models.ExecutedValidation] - :ivar platform_attributes: This specifies the pub, offer, sku and version of the image version - metadata. - :vartype platform_attributes: list[~azure.mgmt.compute.models.PlatformAttribute] - """ - - _attribute_map = { - "validation_etag": {"key": "validationEtag", "type": "str"}, - "executed_validations": {"key": "executedValidations", "type": "[ExecutedValidation]"}, - "platform_attributes": {"key": "platformAttributes", "type": "[PlatformAttribute]"}, - } - - def __init__( - self, - *, - validation_etag: Optional[str] = None, - executed_validations: Optional[list["_models.ExecutedValidation"]] = None, - platform_attributes: Optional[list["_models.PlatformAttribute"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword validation_etag: The published time of the image version. - :paramtype validation_etag: str - :keyword executed_validations: - :paramtype executed_validations: list[~azure.mgmt.compute.models.ExecutedValidation] - :keyword platform_attributes: This specifies the pub, offer, sku and version of the image - version metadata. - :paramtype platform_attributes: list[~azure.mgmt.compute.models.PlatformAttribute] - """ - super().__init__(**kwargs) - self.validation_etag = validation_etag - self.executed_validations = executed_validations - self.platform_attributes = platform_attributes - - -class VaultCertificate(_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. 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: Any - ) -> None: - """ - :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. 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().__init__(**kwargs) - self.certificate_url = certificate_url - self.certificate_store = certificate_store - - -class VaultSecretGroup(_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.models.SubResource - :ivar vault_certificates: The list of key vault references in SourceVault which contain - certificates. - :vartype vault_certificates: list[~azure.mgmt.compute.models.VaultCertificate] - """ - - _attribute_map = { - "source_vault": {"key": "sourceVault", "type": "SubResource"}, - "vault_certificates": {"key": "vaultCertificates", "type": "[VaultCertificate]"}, - } - - def __init__( - self, - *, - source_vault: Optional["_models.SubResource"] = None, - vault_certificates: Optional[list["_models.VaultCertificate"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword source_vault: The relative URL of the Key Vault containing all of the certificates in - VaultCertificates. - :paramtype source_vault: ~azure.mgmt.compute.models.SubResource - :keyword vault_certificates: The list of key vault references in SourceVault which contain - certificates. - :paramtype vault_certificates: list[~azure.mgmt.compute.models.VaultCertificate] - """ - super().__init__(**kwargs) - self.source_vault = source_vault - self.vault_certificates = vault_certificates - - -class VirtualHardDisk(_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: Any) -> None: - """ - :keyword uri: Specifies the virtual hard disk's uri. - :paramtype uri: str - """ - super().__init__(**kwargs) - self.uri = uri - - -class VirtualMachine(TrackedResource): - """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 server. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.compute.models.SystemData - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - :ivar location: The geo-location where the resource lives. Required. - :vartype location: 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.models.Plan - :ivar resources: The virtual machine child extension resources. - :vartype resources: list[~azure.mgmt.compute.models.VirtualMachineExtension] - :ivar identity: The identity of the virtual machine, if configured. - :vartype identity: ~azure.mgmt.compute.models.VirtualMachineIdentity - :ivar zones: The availability zones. - :vartype zones: list[str] - :ivar extended_location: The extended location of the Virtual Machine. - :vartype extended_location: ~azure.mgmt.compute.models.ExtendedLocation - :ivar managed_by: ManagedBy is set to Virtual Machine Scale Set(VMSS) flex ARM resourceID, if - the VM is part of the VMSS. This property is used by platform for internal resource group - delete optimization. - :vartype managed_by: str - :ivar etag: Etag is property returned in Create/Update/Get response of the VM, so that customer - can supply it in the header to ensure optimistic updates. - :vartype etag: str - :ivar placement: Placement section specifies the user-defined constraints for virtual machine - hardware placement. This property cannot be changed once VM is provisioned. Minimum - api-version: 2024-11-01. - :vartype placement: ~azure.mgmt.compute.models.Placement - :ivar hardware_profile: Specifies the hardware settings for the virtual machine. - :vartype hardware_profile: ~azure.mgmt.compute.models.HardwareProfile - :ivar scheduled_events_policy: Specifies Redeploy, Reboot and - ScheduledEventsAdditionalPublishingTargets Scheduled Event related configurations for the - virtual machine. - :vartype scheduled_events_policy: ~azure.mgmt.compute.models.ScheduledEventsPolicy - :ivar storage_profile: Specifies the storage settings for the virtual machine disks. - :vartype storage_profile: ~azure.mgmt.compute.models.StorageProfile - :ivar additional_capabilities: Specifies additional capabilities enabled or disabled on the - virtual machine. - :vartype additional_capabilities: ~azure.mgmt.compute.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.models.OSProfile - :ivar network_profile: Specifies the network interfaces of the virtual machine. - :vartype network_profile: ~azure.mgmt.compute.models.NetworkProfile - :ivar security_profile: Specifies the Security related profile settings for the virtual - machine. - :vartype security_profile: ~azure.mgmt.compute.models.SecurityProfile - :ivar diagnostics_profile: Specifies the boot diagnostic settings state. Minimum api-version: - 2015-06-15. - :vartype diagnostics_profile: ~azure.mgmt.compute.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 - `_. For more - information on Azure planned maintenance, see `Maintenance and updates for Virtual Machines in - Azure `_. 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. This property cannot exist along with a - non-null properties.virtualMachineScaleSet reference. - :vartype availability_set: ~azure.mgmt.compute.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. This property cannot exist along with a non-null - properties.availabilitySet reference. Minimum api‐version: 2019‐03‐01. - :vartype virtual_machine_scale_set: ~azure.mgmt.compute.models.SubResource - :ivar proximity_placement_group: Specifies information about the proximity placement group that - the virtual machine should be assigned to. Minimum api-version: 2018-04-01. - :vartype proximity_placement_group: ~azure.mgmt.compute.models.SubResource - :ivar priority: Specifies the priority for the virtual machine. Minimum api-version: - 2019-03-01. Known values are: "Regular", "Low", and "Spot". - :vartype priority: str or ~azure.mgmt.compute.models.VirtualMachinePriorityTypes - :ivar eviction_policy: Specifies the eviction policy for the Azure Spot virtual machine and - Azure Spot scale set. For Azure Spot virtual machines, both 'Deallocate' and 'Delete' are - supported and the minimum api-version is 2019-03-01. For Azure Spot scale sets, both - 'Deallocate' and 'Delete' are supported and the minimum api-version is 2017-10-30-preview. - Known values are: "Deallocate" and "Delete". - :vartype eviction_policy: str or ~azure.mgmt.compute.models.VirtualMachineEvictionPolicyTypes - :ivar billing_profile: Specifies the billing related details of a Azure Spot virtual machine. - Minimum api-version: 2019-03-01. - :vartype billing_profile: ~azure.mgmt.compute.models.BillingProfile - :ivar host: Specifies information about the dedicated host that the virtual machine resides in. - Minimum api-version: 2018-10-01. - :vartype host: ~azure.mgmt.compute.models.SubResource - :ivar host_group: Specifies information about the dedicated host group that the virtual machine - resides in. **Note:** User cannot specify both host and hostGroup properties. Minimum - api-version: 2020-06-01. - :vartype host_group: ~azure.mgmt.compute.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.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). 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. This is - applicable only if the 'virtualMachineScaleSet' property of this Virtual Machine is set. The - Virtual Machine Scale Set that is referenced, must have 'platformFaultDomainCount' greater than - 1. This property cannot be updated once the Virtual Machine is created. Fault domain assignment - can be viewed in the Virtual Machine Instance View. 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.models.ScheduledEventsProfile - :ivar user_data: UserData for the VM, which must be base-64 encoded. Customer should not pass - any secrets in here. 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. Minimum api-version: 2021-04-01. - :vartype capacity_reservation: ~azure.mgmt.compute.models.CapacityReservationProfile - :ivar application_profile: Specifies the gallery applications that should be made available to - the VM/VMSS. - :vartype application_profile: ~azure.mgmt.compute.models.ApplicationProfile - :ivar time_created: Specifies the time at which the Virtual Machine resource was created. - Minimum api-version: 2021-11-01. - :vartype time_created: ~datetime.datetime - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, - "location": {"required": True}, - "resources": {"readonly": True}, - "managed_by": {"readonly": True}, - "etag": {"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"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - "tags": {"key": "tags", "type": "{str}"}, - "location": {"key": "location", "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"}, - "managed_by": {"key": "managedBy", "type": "str"}, - "etag": {"key": "etag", "type": "str"}, - "placement": {"key": "placement", "type": "Placement"}, - "hardware_profile": {"key": "properties.hardwareProfile", "type": "HardwareProfile"}, - "scheduled_events_policy": {"key": "properties.scheduledEventsPolicy", "type": "ScheduledEventsPolicy"}, - "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__( # pylint: disable=too-many-locals - self, - *, - location: str, - tags: Optional[dict[str, str]] = None, - plan: Optional["_models.Plan"] = None, - identity: Optional["_models.VirtualMachineIdentity"] = None, - zones: Optional[list[str]] = None, - extended_location: Optional["_models.ExtendedLocation"] = None, - placement: Optional["_models.Placement"] = None, - hardware_profile: Optional["_models.HardwareProfile"] = None, - scheduled_events_policy: Optional["_models.ScheduledEventsPolicy"] = None, - storage_profile: Optional["_models.StorageProfile"] = None, - additional_capabilities: Optional["_models.AdditionalCapabilities"] = None, - os_profile: Optional["_models.OSProfile"] = None, - network_profile: Optional["_models.NetworkProfile"] = None, - security_profile: Optional["_models.SecurityProfile"] = None, - diagnostics_profile: Optional["_models.DiagnosticsProfile"] = None, - availability_set: Optional["_models.SubResource"] = None, - virtual_machine_scale_set: Optional["_models.SubResource"] = None, - proximity_placement_group: Optional["_models.SubResource"] = None, - priority: Optional[Union[str, "_models.VirtualMachinePriorityTypes"]] = None, - eviction_policy: Optional[Union[str, "_models.VirtualMachineEvictionPolicyTypes"]] = None, - billing_profile: Optional["_models.BillingProfile"] = None, - host: Optional["_models.SubResource"] = None, - host_group: Optional["_models.SubResource"] = None, - license_type: Optional[str] = None, - extensions_time_budget: Optional[str] = None, - platform_fault_domain: Optional[int] = None, - scheduled_events_profile: Optional["_models.ScheduledEventsProfile"] = None, - user_data: Optional[str] = None, - capacity_reservation: Optional["_models.CapacityReservationProfile"] = None, - application_profile: Optional["_models.ApplicationProfile"] = None, - **kwargs: Any - ) -> None: - """ - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - :keyword location: The geo-location where the resource lives. Required. - :paramtype location: 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.models.Plan - :keyword identity: The identity of the virtual machine, if configured. - :paramtype identity: ~azure.mgmt.compute.models.VirtualMachineIdentity - :keyword zones: The availability zones. - :paramtype zones: list[str] - :keyword extended_location: The extended location of the Virtual Machine. - :paramtype extended_location: ~azure.mgmt.compute.models.ExtendedLocation - :keyword placement: Placement section specifies the user-defined constraints for virtual - machine hardware placement. This property cannot be changed once VM is provisioned. Minimum - api-version: 2024-11-01. - :paramtype placement: ~azure.mgmt.compute.models.Placement - :keyword hardware_profile: Specifies the hardware settings for the virtual machine. - :paramtype hardware_profile: ~azure.mgmt.compute.models.HardwareProfile - :keyword scheduled_events_policy: Specifies Redeploy, Reboot and - ScheduledEventsAdditionalPublishingTargets Scheduled Event related configurations for the - virtual machine. - :paramtype scheduled_events_policy: ~azure.mgmt.compute.models.ScheduledEventsPolicy - :keyword storage_profile: Specifies the storage settings for the virtual machine disks. - :paramtype storage_profile: ~azure.mgmt.compute.models.StorageProfile - :keyword additional_capabilities: Specifies additional capabilities enabled or disabled on the - virtual machine. - :paramtype additional_capabilities: ~azure.mgmt.compute.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.models.OSProfile - :keyword network_profile: Specifies the network interfaces of the virtual machine. - :paramtype network_profile: ~azure.mgmt.compute.models.NetworkProfile - :keyword security_profile: Specifies the Security related profile settings for the virtual - machine. - :paramtype security_profile: ~azure.mgmt.compute.models.SecurityProfile - :keyword diagnostics_profile: Specifies the boot diagnostic settings state. Minimum - api-version: 2015-06-15. - :paramtype diagnostics_profile: ~azure.mgmt.compute.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 - `_. For more - information on Azure planned maintenance, see `Maintenance and updates for Virtual Machines in - Azure `_. 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. This property cannot exist along with a - non-null properties.virtualMachineScaleSet reference. - :paramtype availability_set: ~azure.mgmt.compute.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. This property cannot exist along with a non-null - properties.availabilitySet reference. Minimum api‐version: 2019‐03‐01. - :paramtype virtual_machine_scale_set: ~azure.mgmt.compute.models.SubResource - :keyword proximity_placement_group: Specifies information about the proximity placement group - that the virtual machine should be assigned to. Minimum api-version: 2018-04-01. - :paramtype proximity_placement_group: ~azure.mgmt.compute.models.SubResource - :keyword priority: Specifies the priority for the virtual machine. Minimum api-version: - 2019-03-01. Known values are: "Regular", "Low", and "Spot". - :paramtype priority: str or ~azure.mgmt.compute.models.VirtualMachinePriorityTypes - :keyword eviction_policy: Specifies the eviction policy for the Azure Spot virtual machine and - Azure Spot scale set. For Azure Spot virtual machines, both 'Deallocate' and 'Delete' are - supported and the minimum api-version is 2019-03-01. For Azure Spot scale sets, both - 'Deallocate' and 'Delete' are supported and the minimum api-version is 2017-10-30-preview. - Known values are: "Deallocate" and "Delete". - :paramtype eviction_policy: str or ~azure.mgmt.compute.models.VirtualMachineEvictionPolicyTypes - :keyword billing_profile: Specifies the billing related details of a Azure Spot virtual - machine. Minimum api-version: 2019-03-01. - :paramtype billing_profile: ~azure.mgmt.compute.models.BillingProfile - :keyword host: Specifies information about the dedicated host that the virtual machine resides - in. Minimum api-version: 2018-10-01. - :paramtype host: ~azure.mgmt.compute.models.SubResource - :keyword host_group: Specifies information about the dedicated host group that the virtual - machine resides in. **Note:** User cannot specify both host and hostGroup properties. Minimum - api-version: 2020-06-01. - :paramtype host_group: ~azure.mgmt.compute.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). 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. This is - applicable only if the 'virtualMachineScaleSet' property of this Virtual Machine is set. The - Virtual Machine Scale Set that is referenced, must have 'platformFaultDomainCount' greater than - 1. This property cannot be updated once the Virtual Machine is created. Fault domain assignment - can be viewed in the Virtual Machine Instance View. 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.models.ScheduledEventsProfile - :keyword user_data: UserData for the VM, which must be base-64 encoded. Customer should not - pass any secrets in here. 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. Minimum api-version: 2021-04-01. - :paramtype capacity_reservation: ~azure.mgmt.compute.models.CapacityReservationProfile - :keyword application_profile: Specifies the gallery applications that should be made available - to the VM/VMSS. - :paramtype application_profile: ~azure.mgmt.compute.models.ApplicationProfile - """ - super().__init__(tags=tags, location=location, **kwargs) - self.plan = plan - self.resources: Optional[list["_models.VirtualMachineExtension"]] = None - self.identity = identity - self.zones = zones - self.extended_location = extended_location - self.managed_by: Optional[str] = None - self.etag: Optional[str] = None - self.placement = placement - self.hardware_profile = hardware_profile - self.scheduled_events_policy = scheduled_events_policy - 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: Optional[str] = None - self.instance_view: Optional["_models.VirtualMachineInstanceView"] = None - self.license_type = license_type - self.vm_id: Optional[str] = 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: Optional[datetime.datetime] = None - - -class VirtualMachineAgentInstanceView(_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.models.VirtualMachineExtensionHandlerInstanceView] - :ivar statuses: The resource status information. - :vartype statuses: list[~azure.mgmt.compute.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["_models.VirtualMachineExtensionHandlerInstanceView"]] = None, - statuses: Optional[list["_models.InstanceViewStatus"]] = None, - **kwargs: Any - ) -> None: - """ - :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.models.VirtualMachineExtensionHandlerInstanceView] - :keyword statuses: The resource status information. - :paramtype statuses: list[~azure.mgmt.compute.models.InstanceViewStatus] - """ - super().__init__(**kwargs) - self.vm_agent_version = vm_agent_version - self.extension_handlers = extension_handlers - self.statuses = statuses - - -class VirtualMachineAssessPatchesResult(_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.". Known values are: "Unknown", "InProgress", "Failed", "Succeeded", - and "CompletedWithWarnings". - :vartype status: str or ~azure.mgmt.compute.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.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.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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.status: Optional[Union[str, "_models.PatchOperationStatus"]] = None - self.assessment_activity_id: Optional[str] = None - self.reboot_pending: Optional[bool] = None - self.critical_and_security_patch_count: Optional[int] = None - self.other_patch_count: Optional[int] = None - self.start_date_time: Optional[datetime.datetime] = None - self.available_patches: Optional[list["_models.VirtualMachineSoftwarePatchProperties"]] = None - self.error: Optional["_models.ApiError"] = None - - -class VirtualMachineCaptureParameters(_serialization.Model): - """Capture Virtual Machine parameters. - - All required parameters must be populated in order to send to server. - - :ivar vhd_prefix: The captured virtual hard disk's name prefix. Required. - :vartype vhd_prefix: str - :ivar destination_container_name: The destination container name. Required. - :vartype destination_container_name: str - :ivar overwrite_vhds: Specifies whether to overwrite the destination virtual hard disk, in case - of conflict. Required. - :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: Any - ) -> None: - """ - :keyword vhd_prefix: The captured virtual hard disk's name prefix. Required. - :paramtype vhd_prefix: str - :keyword destination_container_name: The destination container name. Required. - :paramtype destination_container_name: str - :keyword overwrite_vhds: Specifies whether to overwrite the destination virtual hard disk, in - case of conflict. Required. - :paramtype overwrite_vhds: bool - """ - super().__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: Any) -> None: # pylint: disable=redefined-builtin - """ - :keyword id: Resource Id. - :paramtype id: str - """ - super().__init__(id=id, **kwargs) - self.schema: Optional[str] = None - self.content_version: Optional[str] = None - self.parameters: Optional[Any] = None - self.resources: Optional[list[Any]] = None - - -class VirtualMachineExtension(TrackedResource): - """Describes a Virtual Machine Extension. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to server. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.compute.models.SystemData - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - :ivar location: The geo-location where the resource lives. Required. - :vartype location: 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.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: ~azure.mgmt.compute.models.KeyVaultSecretReference - :ivar provision_after_extensions: Collection of extension names after which this extension - needs to be provisioned. - :vartype provision_after_extensions: list[str] - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"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"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - "tags": {"key": "tags", "type": "{str}"}, - "location": {"key": "location", "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": "KeyVaultSecretReference", - }, - "provision_after_extensions": {"key": "properties.provisionAfterExtensions", "type": "[str]"}, - } - - def __init__( - self, - *, - location: str, - tags: Optional[dict[str, str]] = None, - force_update_tag: Optional[str] = None, - publisher: Optional[str] = None, - type_properties_type: Optional[str] = None, - type_handler_version: Optional[str] = None, - auto_upgrade_minor_version: Optional[bool] = None, - enable_automatic_upgrade: Optional[bool] = None, - settings: Optional[Any] = None, - protected_settings: Optional[Any] = None, - instance_view: Optional["_models.VirtualMachineExtensionInstanceView"] = None, - suppress_failures: Optional[bool] = None, - protected_settings_from_key_vault: Optional["_models.KeyVaultSecretReference"] = None, - provision_after_extensions: Optional[list[str]] = None, - **kwargs: Any - ) -> None: - """ - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - :keyword location: The geo-location where the resource lives. Required. - :paramtype location: 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.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: - ~azure.mgmt.compute.models.KeyVaultSecretReference - :keyword provision_after_extensions: Collection of extension names after which this extension - needs to be provisioned. - :paramtype provision_after_extensions: list[str] - """ - super().__init__(tags=tags, location=location, **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: Optional[str] = None - self.instance_view = instance_view - self.suppress_failures = suppress_failures - self.protected_settings_from_key_vault = protected_settings_from_key_vault - self.provision_after_extensions = provision_after_extensions - - -class VirtualMachineExtensionHandlerInstanceView(_serialization.Model): # pylint: disable=name-too-long - """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.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["_models.InstanceViewStatus"] = None, - **kwargs: Any - ) -> None: - """ - :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.models.InstanceViewStatus - """ - super().__init__(**kwargs) - self.type = type - self.type_handler_version = type_handler_version - self.status = status - - -class VirtualMachineExtensionImage(TrackedResource): - """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 server. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.compute.models.SystemData - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - :ivar location: The geo-location where the resource lives. Required. - :vartype location: 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}, - "system_data": {"readonly": True}, - "location": {"required": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - "tags": {"key": "tags", "type": "{str}"}, - "location": {"key": "location", "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: Any - ) -> None: - """ - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - :keyword location: The geo-location where the resource lives. Required. - :paramtype location: 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().__init__(tags=tags, location=location, **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(_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.models.InstanceViewStatus] - :ivar statuses: The resource status information. - :vartype statuses: list[~azure.mgmt.compute.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["_models.InstanceViewStatus"]] = None, - statuses: Optional[list["_models.InstanceViewStatus"]] = None, - **kwargs: Any - ) -> None: - """ - :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.models.InstanceViewStatus] - :keyword statuses: The resource status information. - :paramtype statuses: list[~azure.mgmt.compute.models.InstanceViewStatus] - """ - super().__init__(**kwargs) - self.name = name - self.type = type - self.type_handler_version = type_handler_version - self.substatuses = substatuses - self.statuses = statuses - - -class VirtualMachineExtensionsListResult(_serialization.Model): - """The List Extension operation response. - - :ivar value: The list of extensions. - :vartype value: list[~azure.mgmt.compute.models.VirtualMachineExtension] - """ - - _attribute_map = { - "value": {"key": "value", "type": "[VirtualMachineExtension]"}, - } - - def __init__(self, *, value: Optional[list["_models.VirtualMachineExtension"]] = None, **kwargs: Any) -> None: - """ - :keyword value: The list of extensions. - :paramtype value: list[~azure.mgmt.compute.models.VirtualMachineExtension] - """ - super().__init__(**kwargs) - self.value = value - - -class VirtualMachineExtensionUpdate(UpdateResource): - """Describes a Virtual Machine Extension. - - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - :ivar force_update_tag: How the extension handler should be forced to update even if the - extension configuration has not changed. - :vartype force_update_tag: str - :ivar publisher: The name of the extension handler publisher. - :vartype publisher: str - :ivar type: Specifies the type of the extension; an example is "CustomScriptExtension". - :vartype type: str - :ivar type_handler_version: Specifies the version of the script handler. - :vartype type_handler_version: str - :ivar 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: ~azure.mgmt.compute.models.KeyVaultSecretReference - """ - - _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": "KeyVaultSecretReference", - }, - } - - 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["_models.KeyVaultSecretReference"] = None, - **kwargs: Any - ) -> None: - """ - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - :keyword force_update_tag: How the extension handler should be forced to update even if the - extension configuration has not changed. - :paramtype force_update_tag: str - :keyword publisher: The name of the extension handler publisher. - :paramtype publisher: str - :keyword type: Specifies the type of the extension; an example is "CustomScriptExtension". - :paramtype type: str - :keyword type_handler_version: Specifies the version of the script handler. - :paramtype type_handler_version: str - :keyword 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: - ~azure.mgmt.compute.models.KeyVaultSecretReference - """ - super().__init__(tags=tags, **kwargs) - self.force_update_tag = force_update_tag - self.publisher = publisher - self.type = type - self.type_handler_version = type_handler_version - self.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(_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.models.InstanceViewStatus - """ - - _validation = { - "status": {"readonly": True}, - } - - _attribute_map = { - "status": {"key": "status", "type": "InstanceViewStatus"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.status: Optional["_models.InstanceViewStatus"] = None - - -class VirtualMachineIdentity(_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. Known values - are: "SystemAssigned", "UserAssigned", "SystemAssigned, UserAssigned", and "None". - :vartype type: str or ~azure.mgmt.compute.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.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, "_models.ResourceIdentityType"]] = None, - user_assigned_identities: Optional[dict[str, "_models.UserAssignedIdentitiesValue"]] = None, - **kwargs: Any - ) -> None: - """ - :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. Known values - are: "SystemAssigned", "UserAssigned", "SystemAssigned, UserAssigned", and "None". - :paramtype type: str or ~azure.mgmt.compute.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.models.UserAssignedIdentitiesValue] - """ - super().__init__(**kwargs) - self.principal_id: Optional[str] = None - self.tenant_id: Optional[str] = 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 server. - - :ivar id: Resource Id. - :vartype id: str - :ivar name: The name of the resource. Required. - :vartype name: str - :ivar location: The supported Azure location of the resource. Required. - :vartype location: str - :ivar 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.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, # pylint: disable=redefined-builtin - tags: Optional[dict[str, str]] = None, - extended_location: Optional["_models.ExtendedLocation"] = None, - **kwargs: Any - ) -> None: - """ - :keyword id: Resource Id. - :paramtype id: str - :keyword name: The name of the resource. Required. - :paramtype name: str - :keyword location: The supported Azure location of the resource. Required. - :paramtype location: str - :keyword 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.models.ExtendedLocation - """ - super().__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 server. - - :ivar id: Resource Id. - :vartype id: str - :ivar name: The name of the resource. Required. - :vartype name: str - :ivar location: The supported Azure location of the resource. Required. - :vartype location: str - :ivar 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.models.ExtendedLocation - :ivar plan: Used for establishing the purchase context of any 3rd Party artifact through - MarketPlace. - :vartype plan: ~azure.mgmt.compute.models.PurchasePlan - :ivar os_disk_image: Contains the os disk image information. - :vartype os_disk_image: ~azure.mgmt.compute.models.OSDiskImage - :ivar data_disk_images: The list of data disk images information. - :vartype data_disk_images: list[~azure.mgmt.compute.models.DataDiskImage] - :ivar automatic_os_upgrade_properties: Describes automatic OS upgrade properties on the image. - :vartype automatic_os_upgrade_properties: - ~azure.mgmt.compute.models.AutomaticOSUpgradeProperties - :ivar hyper_v_generation: Specifies the HyperVGeneration Type. Known values are: "V1" and "V2". - :vartype hyper_v_generation: str or ~azure.mgmt.compute.models.HyperVGenerationTypes - :ivar disallowed: Specifies disallowed configuration for the VirtualMachine created from the - image. - :vartype disallowed: ~azure.mgmt.compute.models.DisallowedConfiguration - :ivar features: - :vartype features: list[~azure.mgmt.compute.models.VirtualMachineImageFeature] - :ivar architecture: Specifies the Architecture Type. Known values are: "x64" and "Arm64". - :vartype architecture: str or ~azure.mgmt.compute.models.ArchitectureTypes - :ivar image_deprecation_status: Describes image deprecation status properties on the image. - :vartype image_deprecation_status: ~azure.mgmt.compute.models.ImageDeprecationStatus - """ - - _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"}, - "image_deprecation_status": {"key": "properties.imageDeprecationStatus", "type": "ImageDeprecationStatus"}, - } - - def __init__( - self, - *, - name: str, - location: str, - id: Optional[str] = None, # pylint: disable=redefined-builtin - tags: Optional[dict[str, str]] = None, - extended_location: Optional["_models.ExtendedLocation"] = None, - plan: Optional["_models.PurchasePlan"] = None, - os_disk_image: Optional["_models.OSDiskImage"] = None, - data_disk_images: Optional[list["_models.DataDiskImage"]] = None, - automatic_os_upgrade_properties: Optional["_models.AutomaticOSUpgradeProperties"] = None, - hyper_v_generation: Optional[Union[str, "_models.HyperVGenerationTypes"]] = None, - disallowed: Optional["_models.DisallowedConfiguration"] = None, - features: Optional[list["_models.VirtualMachineImageFeature"]] = None, - architecture: Optional[Union[str, "_models.ArchitectureTypes"]] = None, - image_deprecation_status: Optional["_models.ImageDeprecationStatus"] = None, - **kwargs: Any - ) -> None: - """ - :keyword id: Resource Id. - :paramtype id: str - :keyword name: The name of the resource. Required. - :paramtype name: str - :keyword location: The supported Azure location of the resource. Required. - :paramtype location: str - :keyword 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.models.ExtendedLocation - :keyword plan: Used for establishing the purchase context of any 3rd Party artifact through - MarketPlace. - :paramtype plan: ~azure.mgmt.compute.models.PurchasePlan - :keyword os_disk_image: Contains the os disk image information. - :paramtype os_disk_image: ~azure.mgmt.compute.models.OSDiskImage - :keyword data_disk_images: The list of data disk images information. - :paramtype data_disk_images: list[~azure.mgmt.compute.models.DataDiskImage] - :keyword automatic_os_upgrade_properties: Describes automatic OS upgrade properties on the - image. - :paramtype automatic_os_upgrade_properties: - ~azure.mgmt.compute.models.AutomaticOSUpgradeProperties - :keyword hyper_v_generation: Specifies the HyperVGeneration Type. Known values are: "V1" and - "V2". - :paramtype hyper_v_generation: str or ~azure.mgmt.compute.models.HyperVGenerationTypes - :keyword disallowed: Specifies disallowed configuration for the VirtualMachine created from the - image. - :paramtype disallowed: ~azure.mgmt.compute.models.DisallowedConfiguration - :keyword features: - :paramtype features: list[~azure.mgmt.compute.models.VirtualMachineImageFeature] - :keyword architecture: Specifies the Architecture Type. Known values are: "x64" and "Arm64". - :paramtype architecture: str or ~azure.mgmt.compute.models.ArchitectureTypes - :keyword image_deprecation_status: Describes image deprecation status properties on the image. - :paramtype image_deprecation_status: ~azure.mgmt.compute.models.ImageDeprecationStatus - """ - super().__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 - self.image_deprecation_status = image_deprecation_status - - -class VirtualMachineImageFeature(_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: Any) -> None: - """ - :keyword name: The name of the feature. - :paramtype name: str - :keyword value: The corresponding value for the feature. - :paramtype value: str - """ - super().__init__(**kwargs) - self.name = name - self.value = value - - -class VirtualMachineInstallPatchesParameters(_serialization.Model): - """Input for InstallPatches as directly received by the API. - - All required parameters must be populated in order to send to server. - - :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: ~datetime.timedelta - :ivar reboot_setting: Defines when it is acceptable to reboot a VM during a software update - operation. Required. Known values are: "IfRequired", "Never", and "Always". - :vartype reboot_setting: str or ~azure.mgmt.compute.models.VMGuestPatchRebootSetting - :ivar windows_parameters: Input for InstallPatches on a Windows VM, as directly received by the - API. - :vartype windows_parameters: ~azure.mgmt.compute.models.WindowsParameters - :ivar linux_parameters: Input for InstallPatches on a Linux VM, as directly received by the - API. - :vartype linux_parameters: ~azure.mgmt.compute.models.LinuxParameters - """ - - _validation = { - "reboot_setting": {"required": True}, - } - - _attribute_map = { - "maximum_duration": {"key": "maximumDuration", "type": "duration"}, - "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, "_models.VMGuestPatchRebootSetting"], - maximum_duration: Optional[datetime.timedelta] = None, - windows_parameters: Optional["_models.WindowsParameters"] = None, - linux_parameters: Optional["_models.LinuxParameters"] = None, - **kwargs: Any - ) -> None: - """ - :keyword maximum_duration: Specifies the maximum amount of time that the operation will run. It - must be an ISO 8601-compliant duration string such as PT4H (4 hours). - :paramtype maximum_duration: ~datetime.timedelta - :keyword reboot_setting: Defines when it is acceptable to reboot a VM during a software update - operation. Required. Known values are: "IfRequired", "Never", and "Always". - :paramtype reboot_setting: str or ~azure.mgmt.compute.models.VMGuestPatchRebootSetting - :keyword windows_parameters: Input for InstallPatches on a Windows VM, as directly received by - the API. - :paramtype windows_parameters: ~azure.mgmt.compute.models.WindowsParameters - :keyword linux_parameters: Input for InstallPatches on a Linux VM, as directly received by the - API. - :paramtype linux_parameters: ~azure.mgmt.compute.models.LinuxParameters - """ - super().__init__(**kwargs) - self.maximum_duration = maximum_duration - self.reboot_setting = reboot_setting - self.windows_parameters = windows_parameters - self.linux_parameters = linux_parameters - - -class VirtualMachineInstallPatchesResult(_serialization.Model): - """The result summary of an installation operation. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar status: The overall success or failure status of the operation. It remains "InProgress" - until the operation completes. At that point it will become "Failed", "Succeeded", "Unknown" or - "CompletedWithWarnings.". Known values are: "Unknown", "InProgress", "Failed", "Succeeded", and - "CompletedWithWarnings". - :vartype status: str or ~azure.mgmt.compute.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. Known - values are: "Unknown", "NotNeeded", "Required", "Started", "Failed", and "Completed". - :vartype reboot_status: str or ~azure.mgmt.compute.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.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.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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.status: Optional[Union[str, "_models.PatchOperationStatus"]] = None - self.installation_activity_id: Optional[str] = None - self.reboot_status: Optional[Union[str, "_models.VMGuestPatchRebootStatus"]] = None - self.maintenance_window_exceeded: Optional[bool] = None - self.excluded_patch_count: Optional[int] = None - self.not_selected_patch_count: Optional[int] = None - self.pending_patch_count: Optional[int] = None - self.installed_patch_count: Optional[int] = None - self.failed_patch_count: Optional[int] = None - self.patches: Optional[list["_models.PatchInstallationDetail"]] = None - self.start_date_time: Optional[datetime.datetime] = None - self.error: Optional["_models.ApiError"] = None - - -class VirtualMachineInstanceView(_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. Known - values are: "V1" and "V2". - :vartype hyper_v_generation: str or ~azure.mgmt.compute.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.models.VirtualMachineAgentInstanceView - :ivar maintenance_redeploy_status: The Maintenance Operation status on the virtual machine. - :vartype maintenance_redeploy_status: ~azure.mgmt.compute.models.MaintenanceRedeployStatus - :ivar disks: The virtual machine disk information. - :vartype disks: list[~azure.mgmt.compute.models.DiskInstanceView] - :ivar extensions: The extensions information. - :vartype extensions: list[~azure.mgmt.compute.models.VirtualMachineExtensionInstanceView] - :ivar vm_health: The health status for the VM. - :vartype vm_health: ~azure.mgmt.compute.models.VirtualMachineHealthStatus - :ivar boot_diagnostics: Boot Diagnostics is a debugging feature which allows you to view - Console Output and Screenshot to diagnose VM status. You can easily view the output of your - console log. Azure also enables you to see a screenshot of the VM from the hypervisor. - :vartype boot_diagnostics: ~azure.mgmt.compute.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. Minimum api-version: 2020-06-01. - :vartype assigned_host: str - :ivar statuses: The resource status information. - :vartype statuses: list[~azure.mgmt.compute.models.InstanceViewStatus] - :ivar patch_status: [Preview Feature] The status of virtual machine patch operations. - :vartype patch_status: ~azure.mgmt.compute.models.VirtualMachinePatchStatus - :ivar is_vm_in_standby_pool: [Preview Feature] Specifies whether the VM is currently in or out - of the Standby Pool. - :vartype is_vm_in_standby_pool: bool - """ - - _validation = { - "vm_health": {"readonly": True}, - "assigned_host": {"readonly": True}, - "is_vm_in_standby_pool": {"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"}, - "is_vm_in_standby_pool": {"key": "isVMInStandbyPool", "type": "bool"}, - } - - 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, "_models.HyperVGenerationType"]] = None, - rdp_thumb_print: Optional[str] = None, - vm_agent: Optional["_models.VirtualMachineAgentInstanceView"] = None, - maintenance_redeploy_status: Optional["_models.MaintenanceRedeployStatus"] = None, - disks: Optional[list["_models.DiskInstanceView"]] = None, - extensions: Optional[list["_models.VirtualMachineExtensionInstanceView"]] = None, - boot_diagnostics: Optional["_models.BootDiagnosticsInstanceView"] = None, - statuses: Optional[list["_models.InstanceViewStatus"]] = None, - patch_status: Optional["_models.VirtualMachinePatchStatus"] = None, - **kwargs: Any - ) -> None: - """ - :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. - Known values are: "V1" and "V2". - :paramtype hyper_v_generation: str or ~azure.mgmt.compute.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.models.VirtualMachineAgentInstanceView - :keyword maintenance_redeploy_status: The Maintenance Operation status on the virtual machine. - :paramtype maintenance_redeploy_status: ~azure.mgmt.compute.models.MaintenanceRedeployStatus - :keyword disks: The virtual machine disk information. - :paramtype disks: list[~azure.mgmt.compute.models.DiskInstanceView] - :keyword extensions: The extensions information. - :paramtype extensions: list[~azure.mgmt.compute.models.VirtualMachineExtensionInstanceView] - :keyword boot_diagnostics: Boot Diagnostics is a debugging feature which allows you to view - Console Output and Screenshot to diagnose VM status. You can easily view the output of your - console log. Azure also enables you to see a screenshot of the VM from the hypervisor. - :paramtype boot_diagnostics: ~azure.mgmt.compute.models.BootDiagnosticsInstanceView - :keyword statuses: The resource status information. - :paramtype statuses: list[~azure.mgmt.compute.models.InstanceViewStatus] - :keyword patch_status: [Preview Feature] The status of virtual machine patch operations. - :paramtype patch_status: ~azure.mgmt.compute.models.VirtualMachinePatchStatus - """ - super().__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: Optional["_models.VirtualMachineHealthStatus"] = None - self.boot_diagnostics = boot_diagnostics - self.assigned_host: Optional[str] = None - self.statuses = statuses - self.patch_status = patch_status - self.is_vm_in_standby_pool: Optional[bool] = None - - -class VirtualMachineIpTag(_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: Any) -> None: - """ - :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().__init__(**kwargs) - self.ip_tag_type = ip_tag_type - self.tag = tag - - -class VirtualMachineListResult(_serialization.Model): - """The List Virtual Machine operation response. - - All required parameters must be populated in order to send to server. - - :ivar value: The list of virtual machines. Required. - :vartype value: list[~azure.mgmt.compute.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["_models.VirtualMachine"], next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: The list of virtual machines. Required. - :paramtype value: list[~azure.mgmt.compute.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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class VirtualMachineNetworkInterfaceConfiguration(_serialization.Model): # pylint: disable=name-too-long - """Describes a virtual machine network interface configurations. - - All required parameters must be populated in order to send to server. - - :ivar name: The network interface configuration name. Required. - :vartype name: str - :ivar tags: Resource tags applied to the networkInterface address created by this - NetworkInterfaceConfiguration. - :vartype tags: dict[str, 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. - Known values are: "Delete" and "Detach". - :vartype delete_option: str or ~azure.mgmt.compute.models.DeleteOptions - :ivar enable_accelerated_networking: Specifies whether the network interface is accelerated - networking-enabled. - :vartype enable_accelerated_networking: bool - :ivar disable_tcp_state_tracking: Specifies whether the network interface is disabled for tcp - state tracking. - :vartype disable_tcp_state_tracking: 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.models.SubResource - :ivar dns_settings: The dns settings to be applied on the network interfaces. - :vartype dns_settings: - ~azure.mgmt.compute.models.VirtualMachineNetworkInterfaceDnsSettingsConfiguration - :ivar ip_configurations: Specifies the IP configurations of the network interface. - :vartype ip_configurations: - list[~azure.mgmt.compute.models.VirtualMachineNetworkInterfaceIPConfiguration] - :ivar dscp_configuration: - :vartype dscp_configuration: ~azure.mgmt.compute.models.SubResource - :ivar auxiliary_mode: Specifies whether the Auxiliary mode is enabled for the Network Interface - resource. Known values are: "None", "AcceleratedConnections", and "Floating". - :vartype auxiliary_mode: str or ~azure.mgmt.compute.models.NetworkInterfaceAuxiliaryMode - :ivar auxiliary_sku: Specifies whether the Auxiliary sku is enabled for the Network Interface - resource. Known values are: "None", "A1", "A2", "A4", and "A8". - :vartype auxiliary_sku: str or ~azure.mgmt.compute.models.NetworkInterfaceAuxiliarySku - """ - - _validation = { - "name": {"required": True}, - } - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "tags": {"key": "tags", "type": "{str}"}, - "primary": {"key": "properties.primary", "type": "bool"}, - "delete_option": {"key": "properties.deleteOption", "type": "str"}, - "enable_accelerated_networking": {"key": "properties.enableAcceleratedNetworking", "type": "bool"}, - "disable_tcp_state_tracking": {"key": "properties.disableTcpStateTracking", "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"}, - "auxiliary_mode": {"key": "properties.auxiliaryMode", "type": "str"}, - "auxiliary_sku": {"key": "properties.auxiliarySku", "type": "str"}, - } - - def __init__( - self, - *, - name: str, - tags: Optional[dict[str, str]] = None, - primary: Optional[bool] = None, - delete_option: Optional[Union[str, "_models.DeleteOptions"]] = None, - enable_accelerated_networking: Optional[bool] = None, - disable_tcp_state_tracking: Optional[bool] = None, - enable_fpga: Optional[bool] = None, - enable_ip_forwarding: Optional[bool] = None, - network_security_group: Optional["_models.SubResource"] = None, - dns_settings: Optional["_models.VirtualMachineNetworkInterfaceDnsSettingsConfiguration"] = None, - ip_configurations: Optional[list["_models.VirtualMachineNetworkInterfaceIPConfiguration"]] = None, - dscp_configuration: Optional["_models.SubResource"] = None, - auxiliary_mode: Optional[Union[str, "_models.NetworkInterfaceAuxiliaryMode"]] = None, - auxiliary_sku: Optional[Union[str, "_models.NetworkInterfaceAuxiliarySku"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword name: The network interface configuration name. Required. - :paramtype name: str - :keyword tags: Resource tags applied to the networkInterface address created by this - NetworkInterfaceConfiguration. - :paramtype tags: dict[str, 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. - Known values are: "Delete" and "Detach". - :paramtype delete_option: str or ~azure.mgmt.compute.models.DeleteOptions - :keyword enable_accelerated_networking: Specifies whether the network interface is accelerated - networking-enabled. - :paramtype enable_accelerated_networking: bool - :keyword disable_tcp_state_tracking: Specifies whether the network interface is disabled for - tcp state tracking. - :paramtype disable_tcp_state_tracking: 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.models.SubResource - :keyword dns_settings: The dns settings to be applied on the network interfaces. - :paramtype dns_settings: - ~azure.mgmt.compute.models.VirtualMachineNetworkInterfaceDnsSettingsConfiguration - :keyword ip_configurations: Specifies the IP configurations of the network interface. - :paramtype ip_configurations: - list[~azure.mgmt.compute.models.VirtualMachineNetworkInterfaceIPConfiguration] - :keyword dscp_configuration: - :paramtype dscp_configuration: ~azure.mgmt.compute.models.SubResource - :keyword auxiliary_mode: Specifies whether the Auxiliary mode is enabled for the Network - Interface resource. Known values are: "None", "AcceleratedConnections", and "Floating". - :paramtype auxiliary_mode: str or ~azure.mgmt.compute.models.NetworkInterfaceAuxiliaryMode - :keyword auxiliary_sku: Specifies whether the Auxiliary sku is enabled for the Network - Interface resource. Known values are: "None", "A1", "A2", "A4", and "A8". - :paramtype auxiliary_sku: str or ~azure.mgmt.compute.models.NetworkInterfaceAuxiliarySku - """ - super().__init__(**kwargs) - self.name = name - self.tags = tags - self.primary = primary - self.delete_option = delete_option - self.enable_accelerated_networking = enable_accelerated_networking - self.disable_tcp_state_tracking = disable_tcp_state_tracking - 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 - self.auxiliary_mode = auxiliary_mode - self.auxiliary_sku = auxiliary_sku - - -class VirtualMachineNetworkInterfaceDnsSettingsConfiguration(_serialization.Model): # pylint: disable=name-too-long - """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: Any) -> None: - """ - :keyword dns_servers: List of DNS servers IP addresses. - :paramtype dns_servers: list[str] - """ - super().__init__(**kwargs) - self.dns_servers = dns_servers - - -class VirtualMachineNetworkInterfaceIPConfiguration(_serialization.Model): # pylint: disable=name-too-long - """Describes a virtual machine network profile's IP configuration. - - All required parameters must be populated in order to send to server. - - :ivar name: The IP configuration name. Required. - :vartype name: str - :ivar subnet: Specifies the identifier of the subnet. - :vartype subnet: ~azure.mgmt.compute.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.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'. Known values are: "IPv4" and "IPv6". - :vartype private_ip_address_version: str or ~azure.mgmt.compute.models.IPVersions - :ivar application_security_groups: Specifies an array of references to application security - group. - :vartype application_security_groups: list[~azure.mgmt.compute.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.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.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["_models.SubResource"] = None, - primary: Optional[bool] = None, - public_ip_address_configuration: Optional["_models.VirtualMachinePublicIPAddressConfiguration"] = None, - private_ip_address_version: Optional[Union[str, "_models.IPVersions"]] = None, - application_security_groups: Optional[list["_models.SubResource"]] = None, - application_gateway_backend_address_pools: Optional[list["_models.SubResource"]] = None, - load_balancer_backend_address_pools: Optional[list["_models.SubResource"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword name: The IP configuration name. Required. - :paramtype name: str - :keyword subnet: Specifies the identifier of the subnet. - :paramtype subnet: ~azure.mgmt.compute.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.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'. Known values are: "IPv4" and "IPv6". - :paramtype private_ip_address_version: str or ~azure.mgmt.compute.models.IPVersions - :keyword application_security_groups: Specifies an array of references to application security - group. - :paramtype application_security_groups: list[~azure.mgmt.compute.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.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.models.SubResource] - """ - super().__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(_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.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.models.LastPatchInstallationSummary - :ivar configuration_statuses: The enablement status of the specified patchMode. - :vartype configuration_statuses: list[~azure.mgmt.compute.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["_models.AvailablePatchSummary"] = None, - last_patch_installation_summary: Optional["_models.LastPatchInstallationSummary"] = None, - **kwargs: Any - ) -> None: - """ - :keyword available_patch_summary: The available patch summary of the latest assessment - operation for the virtual machine. - :paramtype available_patch_summary: ~azure.mgmt.compute.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.models.LastPatchInstallationSummary - """ - super().__init__(**kwargs) - self.available_patch_summary = available_patch_summary - self.last_patch_installation_summary = last_patch_installation_summary - self.configuration_statuses: Optional[list["_models.InstanceViewStatus"]] = None - - -class VirtualMachinePublicIPAddressConfiguration(_serialization.Model): # pylint: disable=name-too-long - """Describes a virtual machines IP Configuration's PublicIPAddress configuration. - - All required parameters must be populated in order to send to server. - - :ivar name: The publicIP address configuration name. Required. - :vartype name: str - :ivar sku: Describes the public IP Sku. It can only be set with OrchestrationMode as Flexible. - :vartype sku: ~azure.mgmt.compute.models.PublicIPAddressSku - :ivar tags: Resource tags applied to the publicIP address created by this - PublicIPAddressConfiguration. - :vartype tags: dict[str, str] - :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. - Known values are: "Delete" and "Detach". - :vartype delete_option: str or ~azure.mgmt.compute.models.DeleteOptions - :ivar dns_settings: The dns settings to be applied on the publicIP addresses . - :vartype dns_settings: - ~azure.mgmt.compute.models.VirtualMachinePublicIPAddressDnsSettingsConfiguration - :ivar ip_tags: The list of IP tags associated with the public IP address. - :vartype ip_tags: list[~azure.mgmt.compute.models.VirtualMachineIpTag] - :ivar public_ip_prefix: The PublicIPPrefix from which to allocate publicIP addresses. - :vartype public_ip_prefix: ~azure.mgmt.compute.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'. Known values are: "IPv4" and "IPv6". - :vartype public_ip_address_version: str or ~azure.mgmt.compute.models.IPVersions - :ivar public_ip_allocation_method: Specify the public IP allocation type. Known values are: - "Dynamic" and "Static". - :vartype public_ip_allocation_method: str or - ~azure.mgmt.compute.models.PublicIPAllocationMethod - """ - - _validation = { - "name": {"required": True}, - } - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "sku": {"key": "sku", "type": "PublicIPAddressSku"}, - "tags": {"key": "tags", "type": "{str}"}, - "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["_models.PublicIPAddressSku"] = None, - tags: Optional[dict[str, str]] = None, - idle_timeout_in_minutes: Optional[int] = None, - delete_option: Optional[Union[str, "_models.DeleteOptions"]] = None, - dns_settings: Optional["_models.VirtualMachinePublicIPAddressDnsSettingsConfiguration"] = None, - ip_tags: Optional[list["_models.VirtualMachineIpTag"]] = None, - public_ip_prefix: Optional["_models.SubResource"] = None, - public_ip_address_version: Optional[Union[str, "_models.IPVersions"]] = None, - public_ip_allocation_method: Optional[Union[str, "_models.PublicIPAllocationMethod"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword name: The publicIP address configuration name. Required. - :paramtype name: str - :keyword sku: Describes the public IP Sku. It can only be set with OrchestrationMode as - Flexible. - :paramtype sku: ~azure.mgmt.compute.models.PublicIPAddressSku - :keyword tags: Resource tags applied to the publicIP address created by this - PublicIPAddressConfiguration. - :paramtype tags: dict[str, str] - :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. - Known values are: "Delete" and "Detach". - :paramtype delete_option: str or ~azure.mgmt.compute.models.DeleteOptions - :keyword dns_settings: The dns settings to be applied on the publicIP addresses . - :paramtype dns_settings: - ~azure.mgmt.compute.models.VirtualMachinePublicIPAddressDnsSettingsConfiguration - :keyword ip_tags: The list of IP tags associated with the public IP address. - :paramtype ip_tags: list[~azure.mgmt.compute.models.VirtualMachineIpTag] - :keyword public_ip_prefix: The PublicIPPrefix from which to allocate publicIP addresses. - :paramtype public_ip_prefix: ~azure.mgmt.compute.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'. Known values are: "IPv4" and "IPv6". - :paramtype public_ip_address_version: str or ~azure.mgmt.compute.models.IPVersions - :keyword public_ip_allocation_method: Specify the public IP allocation type. Known values are: - "Dynamic" and "Static". - :paramtype public_ip_allocation_method: str or - ~azure.mgmt.compute.models.PublicIPAllocationMethod - """ - super().__init__(**kwargs) - self.name = name - self.sku = sku - self.tags = tags - 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(_serialization.Model): # pylint: disable=name-too-long - """Describes a virtual machines network configuration's DNS settings. - - All required parameters must be populated in order to send to server. - - :ivar domain_name_label: 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. Required. - :vartype domain_name_label: str - :ivar domain_name_label_scope: The Domain name label scope of the PublicIPAddress resources - that will be created. The generated name label is the concatenation of the hashed domain name - label with policy according to the domain name label scope and vm network profile unique ID. - Known values are: "TenantReuse", "SubscriptionReuse", "ResourceGroupReuse", and "NoReuse". - :vartype domain_name_label_scope: str or ~azure.mgmt.compute.models.DomainNameLabelScopeTypes - """ - - _validation = { - "domain_name_label": {"required": True}, - } - - _attribute_map = { - "domain_name_label": {"key": "domainNameLabel", "type": "str"}, - "domain_name_label_scope": {"key": "domainNameLabelScope", "type": "str"}, - } - - def __init__( - self, - *, - domain_name_label: str, - domain_name_label_scope: Optional[Union[str, "_models.DomainNameLabelScopeTypes"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword domain_name_label: 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. Required. - :paramtype domain_name_label: str - :keyword domain_name_label_scope: The Domain name label scope of the PublicIPAddress resources - that will be created. The generated name label is the concatenation of the hashed domain name - label with policy according to the domain name label scope and vm network profile unique ID. - Known values are: "TenantReuse", "SubscriptionReuse", "ResourceGroupReuse", and "NoReuse". - :paramtype domain_name_label_scope: str or ~azure.mgmt.compute.models.DomainNameLabelScopeTypes - """ - super().__init__(**kwargs) - self.domain_name_label = domain_name_label - self.domain_name_label_scope = domain_name_label_scope - - -class VirtualMachineReimageParameters(_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 - :ivar exact_version: Specifies in decimal number, the version the OS disk should be reimaged - to. If exact version is not provided, the OS disk is reimaged to the existing version of OS - Disk. - :vartype exact_version: str - :ivar os_profile: Specifies information required for reimaging the non-ephemeral OS disk. - :vartype os_profile: ~azure.mgmt.compute.models.OSProfileProvisioningData - """ - - _attribute_map = { - "temp_disk": {"key": "tempDisk", "type": "bool"}, - "exact_version": {"key": "exactVersion", "type": "str"}, - "os_profile": {"key": "osProfile", "type": "OSProfileProvisioningData"}, - } - - def __init__( - self, - *, - temp_disk: Optional[bool] = None, - exact_version: Optional[str] = None, - os_profile: Optional["_models.OSProfileProvisioningData"] = None, - **kwargs: Any - ) -> None: - """ - :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 exact_version: Specifies in decimal number, the version the OS disk should be reimaged - to. If exact version is not provided, the OS disk is reimaged to the existing version of OS - Disk. - :paramtype exact_version: str - :keyword os_profile: Specifies information required for reimaging the non-ephemeral OS disk. - :paramtype os_profile: ~azure.mgmt.compute.models.OSProfileProvisioningData - """ - super().__init__(**kwargs) - self.temp_disk = temp_disk - self.exact_version = exact_version - self.os_profile = os_profile - - -class VirtualMachineRunCommand(TrackedResource): - """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 server. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.compute.models.SystemData - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - :ivar location: The geo-location where the resource lives. Required. - :vartype location: str - :ivar source: The source of the run command script. - :vartype source: ~azure.mgmt.compute.models.VirtualMachineRunCommandScriptSource - :ivar parameters: The parameters used by the script. - :vartype parameters: list[~azure.mgmt.compute.models.RunCommandInputParameter] - :ivar protected_parameters: The parameters used by the script. - :vartype protected_parameters: list[~azure.mgmt.compute.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. Use a SAS URI with read, append, create, write access OR use managed identity to - provide the VM access to the blob. Refer outputBlobManagedIdentity parameter. - :vartype output_blob_uri: str - :ivar error_blob_uri: Specifies the Azure storage blob where script error stream will be - uploaded. Use a SAS URI with read, append, create, write access OR use managed identity to - provide the VM access to the blob. Refer errorBlobManagedIdentity parameter. - :vartype error_blob_uri: str - :ivar output_blob_managed_identity: User-assigned managed identity that has access to - outputBlobUri storage blob. Use an empty object in case of system-assigned identity. Make sure - managed identity has been given access to blob's container with 'Storage Blob Data Contributor' - role assignment. In case of user-assigned identity, make sure you add it under VM's identity. - For more info on managed identity and Run Command, refer https://aka.ms/ManagedIdentity and - https://aka.ms/RunCommandManaged. - :vartype output_blob_managed_identity: ~azure.mgmt.compute.models.RunCommandManagedIdentity - :ivar error_blob_managed_identity: User-assigned managed identity that has access to - errorBlobUri storage blob. Use an empty object in case of system-assigned identity. Make sure - managed identity has been given access to blob's container with 'Storage Blob Data Contributor' - role assignment. In case of user-assigned identity, make sure you add it under VM's identity. - For more info on managed identity and Run Command, refer https://aka.ms/ManagedIdentity and - https://aka.ms/RunCommandManaged. - :vartype error_blob_managed_identity: ~azure.mgmt.compute.models.RunCommandManagedIdentity - :ivar provisioning_state: The provisioning state, which only appears in the response. If - treatFailureAsDeploymentFailure set to true, any failure in the script will fail the deployment - and ProvisioningState will be marked as Failed. If treatFailureAsDeploymentFailure set to - false, ProvisioningState would only reflect whether the run command was run or not by the - extensions platform, it would not indicate whether script failed in case of script failures. - See instance view of run command in case of script failures to see executionMessage, output, - error: https://aka.ms/runcommandmanaged#get-execution-status-and-results. - :vartype provisioning_state: str - :ivar instance_view: The virtual machine run command instance view. - :vartype instance_view: ~azure.mgmt.compute.models.VirtualMachineRunCommandInstanceView - :ivar treat_failure_as_deployment_failure: Optional. If set to true, any failure in the script - will fail the deployment and ProvisioningState will be marked as Failed. If set to false, - ProvisioningState would only reflect whether the run command was run or not by the extensions - platform, it would not indicate whether script failed in case of script failures. See instance - view of run command in case of script failures to see executionMessage, output, error: - https://aka.ms/runcommandmanaged#get-execution-status-and-results. - :vartype treat_failure_as_deployment_failure: bool - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"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"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - "tags": {"key": "tags", "type": "{str}"}, - "location": {"key": "location", "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"}, - "output_blob_managed_identity": { - "key": "properties.outputBlobManagedIdentity", - "type": "RunCommandManagedIdentity", - }, - "error_blob_managed_identity": { - "key": "properties.errorBlobManagedIdentity", - "type": "RunCommandManagedIdentity", - }, - "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, - "instance_view": {"key": "properties.instanceView", "type": "VirtualMachineRunCommandInstanceView"}, - "treat_failure_as_deployment_failure": {"key": "properties.treatFailureAsDeploymentFailure", "type": "bool"}, - } - - def __init__( - self, - *, - location: str, - tags: Optional[dict[str, str]] = None, - source: Optional["_models.VirtualMachineRunCommandScriptSource"] = None, - parameters: Optional[list["_models.RunCommandInputParameter"]] = None, - protected_parameters: Optional[list["_models.RunCommandInputParameter"]] = None, - async_execution: Optional[bool] = None, - 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, - output_blob_managed_identity: Optional["_models.RunCommandManagedIdentity"] = None, - error_blob_managed_identity: Optional["_models.RunCommandManagedIdentity"] = None, - treat_failure_as_deployment_failure: Optional[bool] = None, - **kwargs: Any - ) -> None: - """ - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - :keyword location: The geo-location where the resource lives. Required. - :paramtype location: str - :keyword source: The source of the run command script. - :paramtype source: ~azure.mgmt.compute.models.VirtualMachineRunCommandScriptSource - :keyword parameters: The parameters used by the script. - :paramtype parameters: list[~azure.mgmt.compute.models.RunCommandInputParameter] - :keyword protected_parameters: The parameters used by the script. - :paramtype protected_parameters: list[~azure.mgmt.compute.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. Use a SAS URI with read, append, create, write access OR use managed identity to - provide the VM access to the blob. Refer outputBlobManagedIdentity parameter. - :paramtype output_blob_uri: str - :keyword error_blob_uri: Specifies the Azure storage blob where script error stream will be - uploaded. Use a SAS URI with read, append, create, write access OR use managed identity to - provide the VM access to the blob. Refer errorBlobManagedIdentity parameter. - :paramtype error_blob_uri: str - :keyword output_blob_managed_identity: User-assigned managed identity that has access to - outputBlobUri storage blob. Use an empty object in case of system-assigned identity. Make sure - managed identity has been given access to blob's container with 'Storage Blob Data Contributor' - role assignment. In case of user-assigned identity, make sure you add it under VM's identity. - For more info on managed identity and Run Command, refer https://aka.ms/ManagedIdentity and - https://aka.ms/RunCommandManaged. - :paramtype output_blob_managed_identity: ~azure.mgmt.compute.models.RunCommandManagedIdentity - :keyword error_blob_managed_identity: User-assigned managed identity that has access to - errorBlobUri storage blob. Use an empty object in case of system-assigned identity. Make sure - managed identity has been given access to blob's container with 'Storage Blob Data Contributor' - role assignment. In case of user-assigned identity, make sure you add it under VM's identity. - For more info on managed identity and Run Command, refer https://aka.ms/ManagedIdentity and - https://aka.ms/RunCommandManaged. - :paramtype error_blob_managed_identity: ~azure.mgmt.compute.models.RunCommandManagedIdentity - :keyword treat_failure_as_deployment_failure: Optional. If set to true, any failure in the - script will fail the deployment and ProvisioningState will be marked as Failed. If set to - false, ProvisioningState would only reflect whether the run command was run or not by the - extensions platform, it would not indicate whether script failed in case of script failures. - See instance view of run command in case of script failures to see executionMessage, output, - error: https://aka.ms/runcommandmanaged#get-execution-status-and-results. - :paramtype treat_failure_as_deployment_failure: bool - """ - super().__init__(tags=tags, location=location, **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.output_blob_managed_identity = output_blob_managed_identity - self.error_blob_managed_identity = error_blob_managed_identity - self.provisioning_state: Optional[str] = None - self.instance_view: Optional["_models.VirtualMachineRunCommandInstanceView"] = None - self.treat_failure_as_deployment_failure = treat_failure_as_deployment_failure - - -class VirtualMachineRunCommandInstanceView(_serialization.Model): - """The instance view of a virtual machine run command. - - :ivar execution_state: Script execution status. Known values are: "Unknown", "Pending", - "Running", "Failed", "Succeeded", "TimedOut", and "Canceled". - :vartype execution_state: str or ~azure.mgmt.compute.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.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, "_models.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["_models.InstanceViewStatus"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword execution_state: Script execution status. Known values are: "Unknown", "Pending", - "Running", "Failed", "Succeeded", "TimedOut", and "Canceled". - :paramtype execution_state: str or ~azure.mgmt.compute.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.models.InstanceViewStatus] - """ - super().__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(_serialization.Model): - """Describes the script sources for run command. Use only one of these script sources: script, - scriptUri, commandId, galleryScriptReferenceId. - - :ivar script: Specifies the script content to be executed on the VM. - :vartype script: str - :ivar script_uri: Specifies the script download location. It can be either SAS URI of an Azure - storage blob with read access or public URI. - :vartype script_uri: str - :ivar command_id: Specifies a commandId of predefined built-in script. Command IDs available - for Linux are listed at https://aka.ms/RunCommandManagedLinux#available-commands, Windows at - https://aka.ms/RunCommandManagedWindows#available-commands. - :vartype command_id: str - :ivar script_uri_managed_identity: User-assigned managed identity that has access to scriptUri - in case of Azure storage blob. Use an empty object in case of system-assigned identity. Make - sure the Azure storage blob exists, and managed identity has been given access to blob's - container with 'Storage Blob Data Reader' role assignment. In case of user-assigned identity, - make sure you add it under VM's identity. For more info on managed identity and Run Command, - refer https://aka.ms/ManagedIdentity and https://aka.ms/RunCommandManaged. - :vartype script_uri_managed_identity: ~azure.mgmt.compute.models.RunCommandManagedIdentity - :ivar script_shell: Optional. Specify which shell to use for running the script. These values - must match those expected by the extension. Currently supported only for Windows VMs, script - uses Powershell 7 when specified. Powershell 7 must be already installed on the machine to use - Powershell7 parameter value. Known values are: "Default" and "Powershell7". - :vartype script_shell: str or ~azure.mgmt.compute.models.ScriptShellTypes - :ivar gallery_script_reference_id: The resource ID of a Gallery Script version that needs to be - executed. Example ID looks like - /subscriptions/{subId}/resourceGroups/{rgName}/providers/Microsoft.Compute/galleries/{galleryName}/scripts/{scriptName}/versions/{version}. - :vartype gallery_script_reference_id: str - """ - - _attribute_map = { - "script": {"key": "script", "type": "str"}, - "script_uri": {"key": "scriptUri", "type": "str"}, - "command_id": {"key": "commandId", "type": "str"}, - "script_uri_managed_identity": {"key": "scriptUriManagedIdentity", "type": "RunCommandManagedIdentity"}, - "script_shell": {"key": "scriptShell", "type": "str"}, - "gallery_script_reference_id": {"key": "galleryScriptReferenceId", "type": "str"}, - } - - def __init__( - self, - *, - script: Optional[str] = None, - script_uri: Optional[str] = None, - command_id: Optional[str] = None, - script_uri_managed_identity: Optional["_models.RunCommandManagedIdentity"] = None, - script_shell: Optional[Union[str, "_models.ScriptShellTypes"]] = None, - gallery_script_reference_id: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword script: Specifies the script content to be executed on the VM. - :paramtype script: str - :keyword script_uri: Specifies the script download location. It can be either SAS URI of an - Azure storage blob with read access or public URI. - :paramtype script_uri: str - :keyword command_id: Specifies a commandId of predefined built-in script. Command IDs available - for Linux are listed at https://aka.ms/RunCommandManagedLinux#available-commands, Windows at - https://aka.ms/RunCommandManagedWindows#available-commands. - :paramtype command_id: str - :keyword script_uri_managed_identity: User-assigned managed identity that has access to - scriptUri in case of Azure storage blob. Use an empty object in case of system-assigned - identity. Make sure the Azure storage blob exists, and managed identity has been given access - to blob's container with 'Storage Blob Data Reader' role assignment. In case of user-assigned - identity, make sure you add it under VM's identity. For more info on managed identity and Run - Command, refer https://aka.ms/ManagedIdentity and https://aka.ms/RunCommandManaged. - :paramtype script_uri_managed_identity: ~azure.mgmt.compute.models.RunCommandManagedIdentity - :keyword script_shell: Optional. Specify which shell to use for running the script. These - values must match those expected by the extension. Currently supported only for Windows VMs, - script uses Powershell 7 when specified. Powershell 7 must be already installed on the machine - to use Powershell7 parameter value. Known values are: "Default" and "Powershell7". - :paramtype script_shell: str or ~azure.mgmt.compute.models.ScriptShellTypes - :keyword gallery_script_reference_id: The resource ID of a Gallery Script version that needs to - be executed. Example ID looks like - /subscriptions/{subId}/resourceGroups/{rgName}/providers/Microsoft.Compute/galleries/{galleryName}/scripts/{scriptName}/versions/{version}. - :paramtype gallery_script_reference_id: str - """ - super().__init__(**kwargs) - self.script = script - self.script_uri = script_uri - self.command_id = command_id - self.script_uri_managed_identity = script_uri_managed_identity - self.script_shell = script_shell - self.gallery_script_reference_id = gallery_script_reference_id - - -class VirtualMachineRunCommandsListResult(_serialization.Model): - """The List run command operation response. - - All required parameters must be populated in order to send to server. - - :ivar value: The list of run commands. Required. - :vartype value: list[~azure.mgmt.compute.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["_models.VirtualMachineRunCommand"], next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: The list of run commands. Required. - :paramtype value: list[~azure.mgmt.compute.models.VirtualMachineRunCommand] - :keyword next_link: The uri to fetch the next page of run commands. - :paramtype next_link: str - """ - super().__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: Resource tags. - :vartype tags: dict[str, str] - :ivar source: The source of the run command script. - :vartype source: ~azure.mgmt.compute.models.VirtualMachineRunCommandScriptSource - :ivar parameters: The parameters used by the script. - :vartype parameters: list[~azure.mgmt.compute.models.RunCommandInputParameter] - :ivar protected_parameters: The parameters used by the script. - :vartype protected_parameters: list[~azure.mgmt.compute.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. Use a SAS URI with read, append, create, write access OR use managed identity to - provide the VM access to the blob. Refer outputBlobManagedIdentity parameter. - :vartype output_blob_uri: str - :ivar error_blob_uri: Specifies the Azure storage blob where script error stream will be - uploaded. Use a SAS URI with read, append, create, write access OR use managed identity to - provide the VM access to the blob. Refer errorBlobManagedIdentity parameter. - :vartype error_blob_uri: str - :ivar output_blob_managed_identity: User-assigned managed identity that has access to - outputBlobUri storage blob. Use an empty object in case of system-assigned identity. Make sure - managed identity has been given access to blob's container with 'Storage Blob Data Contributor' - role assignment. In case of user-assigned identity, make sure you add it under VM's identity. - For more info on managed identity and Run Command, refer https://aka.ms/ManagedIdentity and - https://aka.ms/RunCommandManaged. - :vartype output_blob_managed_identity: ~azure.mgmt.compute.models.RunCommandManagedIdentity - :ivar error_blob_managed_identity: User-assigned managed identity that has access to - errorBlobUri storage blob. Use an empty object in case of system-assigned identity. Make sure - managed identity has been given access to blob's container with 'Storage Blob Data Contributor' - role assignment. In case of user-assigned identity, make sure you add it under VM's identity. - For more info on managed identity and Run Command, refer https://aka.ms/ManagedIdentity and - https://aka.ms/RunCommandManaged. - :vartype error_blob_managed_identity: ~azure.mgmt.compute.models.RunCommandManagedIdentity - :ivar provisioning_state: The provisioning state, which only appears in the response. If - treatFailureAsDeploymentFailure set to true, any failure in the script will fail the deployment - and ProvisioningState will be marked as Failed. If treatFailureAsDeploymentFailure set to - false, ProvisioningState would only reflect whether the run command was run or not by the - extensions platform, it would not indicate whether script failed in case of script failures. - See instance view of run command in case of script failures to see executionMessage, output, - error: https://aka.ms/runcommandmanaged#get-execution-status-and-results. - :vartype provisioning_state: str - :ivar instance_view: The virtual machine run command instance view. - :vartype instance_view: ~azure.mgmt.compute.models.VirtualMachineRunCommandInstanceView - :ivar treat_failure_as_deployment_failure: Optional. If set to true, any failure in the script - will fail the deployment and ProvisioningState will be marked as Failed. If set to false, - ProvisioningState would only reflect whether the run command was run or not by the extensions - platform, it would not indicate whether script failed in case of script failures. See instance - view of run command in case of script failures to see executionMessage, output, error: - https://aka.ms/runcommandmanaged#get-execution-status-and-results. - :vartype treat_failure_as_deployment_failure: bool - """ - - _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"}, - "output_blob_managed_identity": { - "key": "properties.outputBlobManagedIdentity", - "type": "RunCommandManagedIdentity", - }, - "error_blob_managed_identity": { - "key": "properties.errorBlobManagedIdentity", - "type": "RunCommandManagedIdentity", - }, - "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, - "instance_view": {"key": "properties.instanceView", "type": "VirtualMachineRunCommandInstanceView"}, - "treat_failure_as_deployment_failure": {"key": "properties.treatFailureAsDeploymentFailure", "type": "bool"}, - } - - def __init__( - self, - *, - tags: Optional[dict[str, str]] = None, - source: Optional["_models.VirtualMachineRunCommandScriptSource"] = None, - parameters: Optional[list["_models.RunCommandInputParameter"]] = None, - protected_parameters: Optional[list["_models.RunCommandInputParameter"]] = None, - async_execution: Optional[bool] = None, - 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, - output_blob_managed_identity: Optional["_models.RunCommandManagedIdentity"] = None, - error_blob_managed_identity: Optional["_models.RunCommandManagedIdentity"] = None, - treat_failure_as_deployment_failure: Optional[bool] = None, - **kwargs: Any - ) -> None: - """ - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - :keyword source: The source of the run command script. - :paramtype source: ~azure.mgmt.compute.models.VirtualMachineRunCommandScriptSource - :keyword parameters: The parameters used by the script. - :paramtype parameters: list[~azure.mgmt.compute.models.RunCommandInputParameter] - :keyword protected_parameters: The parameters used by the script. - :paramtype protected_parameters: list[~azure.mgmt.compute.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. Use a SAS URI with read, append, create, write access OR use managed identity to - provide the VM access to the blob. Refer outputBlobManagedIdentity parameter. - :paramtype output_blob_uri: str - :keyword error_blob_uri: Specifies the Azure storage blob where script error stream will be - uploaded. Use a SAS URI with read, append, create, write access OR use managed identity to - provide the VM access to the blob. Refer errorBlobManagedIdentity parameter. - :paramtype error_blob_uri: str - :keyword output_blob_managed_identity: User-assigned managed identity that has access to - outputBlobUri storage blob. Use an empty object in case of system-assigned identity. Make sure - managed identity has been given access to blob's container with 'Storage Blob Data Contributor' - role assignment. In case of user-assigned identity, make sure you add it under VM's identity. - For more info on managed identity and Run Command, refer https://aka.ms/ManagedIdentity and - https://aka.ms/RunCommandManaged. - :paramtype output_blob_managed_identity: ~azure.mgmt.compute.models.RunCommandManagedIdentity - :keyword error_blob_managed_identity: User-assigned managed identity that has access to - errorBlobUri storage blob. Use an empty object in case of system-assigned identity. Make sure - managed identity has been given access to blob's container with 'Storage Blob Data Contributor' - role assignment. In case of user-assigned identity, make sure you add it under VM's identity. - For more info on managed identity and Run Command, refer https://aka.ms/ManagedIdentity and - https://aka.ms/RunCommandManaged. - :paramtype error_blob_managed_identity: ~azure.mgmt.compute.models.RunCommandManagedIdentity - :keyword treat_failure_as_deployment_failure: Optional. If set to true, any failure in the - script will fail the deployment and ProvisioningState will be marked as Failed. If set to - false, ProvisioningState would only reflect whether the run command was run or not by the - extensions platform, it would not indicate whether script failed in case of script failures. - See instance view of run command in case of script failures to see executionMessage, output, - error: https://aka.ms/runcommandmanaged#get-execution-status-and-results. - :paramtype treat_failure_as_deployment_failure: bool - """ - super().__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.output_blob_managed_identity = output_blob_managed_identity - self.error_blob_managed_identity = error_blob_managed_identity - self.provisioning_state: Optional[str] = None - self.instance_view: Optional["_models.VirtualMachineRunCommandInstanceView"] = None - self.treat_failure_as_deployment_failure = treat_failure_as_deployment_failure - - -class VirtualMachineScaleSet(TrackedResource): - """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 server. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.compute.models.SystemData - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - :ivar location: The geo-location where the resource lives. Required. - :vartype location: str - :ivar sku: The virtual machine scale set sku. - :vartype sku: ~azure.mgmt.compute.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.models.Plan - :ivar identity: The identity of the virtual machine scale set, if configured. - :vartype identity: ~azure.mgmt.compute.models.VirtualMachineScaleSetIdentity - :ivar zones: The availability zones. - :vartype zones: list[str] - :ivar extended_location: The extended location of the Virtual Machine Scale Set. - :vartype extended_location: ~azure.mgmt.compute.models.ExtendedLocation - :ivar etag: Etag is property returned in Create/Update/Get response of the VMSS, so that - customer can supply it in the header to ensure optimistic updates. - :vartype etag: str - :ivar placement: Placement section specifies the user-defined constraints for virtual machine - scale set hardware placement. This property cannot be changed once VMSS is provisioned. Minimum - api-version: 2025-04-01. - :vartype placement: ~azure.mgmt.compute.models.Placement - :ivar upgrade_policy: The upgrade policy. - :vartype upgrade_policy: ~azure.mgmt.compute.models.UpgradePolicy - :ivar scheduled_events_policy: The ScheduledEventsPolicy. - :vartype scheduled_events_policy: ~azure.mgmt.compute.models.ScheduledEventsPolicy - :ivar automatic_repairs_policy: Policy for automatic repairs. - :vartype automatic_repairs_policy: ~azure.mgmt.compute.models.AutomaticRepairsPolicy - :ivar virtual_machine_profile: The virtual machine profile. - :vartype virtual_machine_profile: ~azure.mgmt.compute.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. Minimum api-version: 2018-04-01. - :vartype proximity_placement_group: ~azure.mgmt.compute.models.SubResource - :ivar host_group: Specifies information about the dedicated host group that the virtual machine - scale set resides in. Minimum api-version: 2020-06-01. - :vartype host_group: ~azure.mgmt.compute.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.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.models.ScaleInPolicy - :ivar orchestration_mode: Specifies the orchestration mode for the virtual machine scale set. - Known values are: "Uniform" and "Flexible". - :vartype orchestration_mode: str or ~azure.mgmt.compute.models.OrchestrationMode - :ivar spot_restore_policy: Specifies the Spot Restore properties for the virtual machine scale - set. - :vartype spot_restore_policy: ~azure.mgmt.compute.models.SpotRestorePolicy - :ivar priority_mix_policy: Specifies the desired targets for mixing Spot and Regular priority - VMs within the same VMSS Flex instance. - :vartype priority_mix_policy: ~azure.mgmt.compute.models.PriorityMixPolicy - :ivar time_created: Specifies the time at which the Virtual Machine Scale Set resource was - created. Minimum api-version: 2021-11-01. - :vartype time_created: ~datetime.datetime - :ivar constrained_maximum_capacity: Optional property which must either be set to True or - omitted. - :vartype constrained_maximum_capacity: bool - :ivar resiliency_policy: Policy for Resiliency. - :vartype resiliency_policy: ~azure.mgmt.compute.models.ResiliencyPolicy - :ivar zonal_platform_fault_domain_align_mode: Specifies the align mode between Virtual Machine - Scale Set compute and storage Fault Domain count. Known values are: "Aligned" and "Unaligned". - :vartype zonal_platform_fault_domain_align_mode: str or - ~azure.mgmt.compute.models.ZonalPlatformFaultDomainAlignMode - :ivar sku_profile: Specifies the sku profile for the virtual machine scale set. - :vartype sku_profile: ~azure.mgmt.compute.models.SkuProfile - :ivar high_speed_interconnect_placement: Specifies the high speed interconnect placement for - the virtual machine scale set. Known values are: "None" and "Trunk". - :vartype high_speed_interconnect_placement: str or - ~azure.mgmt.compute.models.HighSpeedInterconnectPlacement - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, - "location": {"required": True}, - "etag": {"readonly": 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"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - "tags": {"key": "tags", "type": "{str}"}, - "location": {"key": "location", "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"}, - "etag": {"key": "etag", "type": "str"}, - "placement": {"key": "placement", "type": "Placement"}, - "upgrade_policy": {"key": "properties.upgradePolicy", "type": "UpgradePolicy"}, - "scheduled_events_policy": {"key": "properties.scheduledEventsPolicy", "type": "ScheduledEventsPolicy"}, - "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"}, - "priority_mix_policy": {"key": "properties.priorityMixPolicy", "type": "PriorityMixPolicy"}, - "time_created": {"key": "properties.timeCreated", "type": "iso-8601"}, - "constrained_maximum_capacity": {"key": "properties.constrainedMaximumCapacity", "type": "bool"}, - "resiliency_policy": {"key": "properties.resiliencyPolicy", "type": "ResiliencyPolicy"}, - "zonal_platform_fault_domain_align_mode": { - "key": "properties.zonalPlatformFaultDomainAlignMode", - "type": "str", - }, - "sku_profile": {"key": "properties.skuProfile", "type": "SkuProfile"}, - "high_speed_interconnect_placement": {"key": "properties.highSpeedInterconnectPlacement", "type": "str"}, - } - - def __init__( # pylint: disable=too-many-locals - self, - *, - location: str, - tags: Optional[dict[str, str]] = None, - sku: Optional["_models.Sku"] = None, - plan: Optional["_models.Plan"] = None, - identity: Optional["_models.VirtualMachineScaleSetIdentity"] = None, - zones: Optional[list[str]] = None, - extended_location: Optional["_models.ExtendedLocation"] = None, - placement: Optional["_models.Placement"] = None, - upgrade_policy: Optional["_models.UpgradePolicy"] = None, - scheduled_events_policy: Optional["_models.ScheduledEventsPolicy"] = None, - automatic_repairs_policy: Optional["_models.AutomaticRepairsPolicy"] = None, - virtual_machine_profile: Optional["_models.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["_models.SubResource"] = None, - host_group: Optional["_models.SubResource"] = None, - additional_capabilities: Optional["_models.AdditionalCapabilities"] = None, - scale_in_policy: Optional["_models.ScaleInPolicy"] = None, - orchestration_mode: Optional[Union[str, "_models.OrchestrationMode"]] = None, - spot_restore_policy: Optional["_models.SpotRestorePolicy"] = None, - priority_mix_policy: Optional["_models.PriorityMixPolicy"] = None, - constrained_maximum_capacity: Optional[bool] = None, - resiliency_policy: Optional["_models.ResiliencyPolicy"] = None, - zonal_platform_fault_domain_align_mode: Optional[ - Union[str, "_models.ZonalPlatformFaultDomainAlignMode"] - ] = None, - sku_profile: Optional["_models.SkuProfile"] = None, - high_speed_interconnect_placement: Optional[Union[str, "_models.HighSpeedInterconnectPlacement"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - :keyword location: The geo-location where the resource lives. Required. - :paramtype location: str - :keyword sku: The virtual machine scale set sku. - :paramtype sku: ~azure.mgmt.compute.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.models.Plan - :keyword identity: The identity of the virtual machine scale set, if configured. - :paramtype identity: ~azure.mgmt.compute.models.VirtualMachineScaleSetIdentity - :keyword zones: The availability zones. - :paramtype zones: list[str] - :keyword extended_location: The extended location of the Virtual Machine Scale Set. - :paramtype extended_location: ~azure.mgmt.compute.models.ExtendedLocation - :keyword placement: Placement section specifies the user-defined constraints for virtual - machine scale set hardware placement. This property cannot be changed once VMSS is provisioned. - Minimum api-version: 2025-04-01. - :paramtype placement: ~azure.mgmt.compute.models.Placement - :keyword upgrade_policy: The upgrade policy. - :paramtype upgrade_policy: ~azure.mgmt.compute.models.UpgradePolicy - :keyword scheduled_events_policy: The ScheduledEventsPolicy. - :paramtype scheduled_events_policy: ~azure.mgmt.compute.models.ScheduledEventsPolicy - :keyword automatic_repairs_policy: Policy for automatic repairs. - :paramtype automatic_repairs_policy: ~azure.mgmt.compute.models.AutomaticRepairsPolicy - :keyword virtual_machine_profile: The virtual machine profile. - :paramtype virtual_machine_profile: ~azure.mgmt.compute.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. Minimum api-version: 2018-04-01. - :paramtype proximity_placement_group: ~azure.mgmt.compute.models.SubResource - :keyword host_group: Specifies information about the dedicated host group that the virtual - machine scale set resides in. Minimum api-version: 2020-06-01. - :paramtype host_group: ~azure.mgmt.compute.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.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.models.ScaleInPolicy - :keyword orchestration_mode: Specifies the orchestration mode for the virtual machine scale - set. Known values are: "Uniform" and "Flexible". - :paramtype orchestration_mode: str or ~azure.mgmt.compute.models.OrchestrationMode - :keyword spot_restore_policy: Specifies the Spot Restore properties for the virtual machine - scale set. - :paramtype spot_restore_policy: ~azure.mgmt.compute.models.SpotRestorePolicy - :keyword priority_mix_policy: Specifies the desired targets for mixing Spot and Regular - priority VMs within the same VMSS Flex instance. - :paramtype priority_mix_policy: ~azure.mgmt.compute.models.PriorityMixPolicy - :keyword constrained_maximum_capacity: Optional property which must either be set to True or - omitted. - :paramtype constrained_maximum_capacity: bool - :keyword resiliency_policy: Policy for Resiliency. - :paramtype resiliency_policy: ~azure.mgmt.compute.models.ResiliencyPolicy - :keyword zonal_platform_fault_domain_align_mode: Specifies the align mode between Virtual - Machine Scale Set compute and storage Fault Domain count. Known values are: "Aligned" and - "Unaligned". - :paramtype zonal_platform_fault_domain_align_mode: str or - ~azure.mgmt.compute.models.ZonalPlatformFaultDomainAlignMode - :keyword sku_profile: Specifies the sku profile for the virtual machine scale set. - :paramtype sku_profile: ~azure.mgmt.compute.models.SkuProfile - :keyword high_speed_interconnect_placement: Specifies the high speed interconnect placement for - the virtual machine scale set. Known values are: "None" and "Trunk". - :paramtype high_speed_interconnect_placement: str or - ~azure.mgmt.compute.models.HighSpeedInterconnectPlacement - """ - super().__init__(tags=tags, location=location, **kwargs) - self.sku = sku - self.plan = plan - self.identity = identity - self.zones = zones - self.extended_location = extended_location - self.etag: Optional[str] = None - self.placement = placement - self.upgrade_policy = upgrade_policy - self.scheduled_events_policy = scheduled_events_policy - self.automatic_repairs_policy = automatic_repairs_policy - self.virtual_machine_profile = virtual_machine_profile - self.provisioning_state: Optional[str] = None - self.overprovision = overprovision - self.do_not_run_extensions_on_overprovisioned_v_ms = do_not_run_extensions_on_overprovisioned_v_ms - self.unique_id: Optional[str] = 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.priority_mix_policy = priority_mix_policy - self.time_created: Optional[datetime.datetime] = None - self.constrained_maximum_capacity = constrained_maximum_capacity - self.resiliency_policy = resiliency_policy - self.zonal_platform_fault_domain_align_mode = zonal_platform_fault_domain_align_mode - self.sku_profile = sku_profile - self.high_speed_interconnect_placement = high_speed_interconnect_placement - - -class VirtualMachineScaleSetDataDisk(_serialization.Model): - """Describes a virtual machine scale set data disk. - - All required parameters must be populated in order to send to server. - - :ivar name: The disk name. - :vartype name: str - :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. - Required. - :vartype lun: int - :ivar caching: Specifies the caching requirements. Possible values are: **None,** **ReadOnly,** - **ReadWrite.** The default values are: **None for Standard storage. ReadOnly for Premium - storage.**. Known values are: "None", "ReadOnly", and "ReadWrite". - :vartype caching: str or ~azure.mgmt.compute.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: The create option. Required. Known values are: "FromImage", "Empty", - "Attach", "Copy", and "Restore". - :vartype create_option: str or ~azure.mgmt.compute.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. The property diskSizeGB is - the number of bytes x 1024^3 for the disk and the value cannot be larger than 1023. - :vartype disk_size_gb: int - :ivar managed_disk: The managed disk parameters. - :vartype managed_disk: ~azure.mgmt.compute.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: int - :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: int - :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**. Known values - are: "Delete" and "Detach". - :vartype delete_option: str or ~azure.mgmt.compute.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": "int"}, - "disk_m_bps_read_write": {"key": "diskMBpsReadWrite", "type": "int"}, - "delete_option": {"key": "deleteOption", "type": "str"}, - } - - def __init__( - self, - *, - lun: int, - create_option: Union[str, "_models.DiskCreateOptionTypes"], - name: Optional[str] = None, - caching: Optional[Union[str, "_models.CachingTypes"]] = None, - write_accelerator_enabled: Optional[bool] = None, - disk_size_gb: Optional[int] = None, - managed_disk: Optional["_models.VirtualMachineScaleSetManagedDiskParameters"] = None, - disk_iops_read_write: Optional[int] = None, - disk_m_bps_read_write: Optional[int] = None, - delete_option: Optional[Union[str, "_models.DiskDeleteOptionTypes"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword name: The disk name. - :paramtype name: str - :keyword 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. Required. - :paramtype lun: int - :keyword caching: Specifies the caching requirements. Possible values are: **None,** - **ReadOnly,** **ReadWrite.** The default values are: **None for Standard storage. ReadOnly for - Premium storage.**. Known values are: "None", "ReadOnly", and "ReadWrite". - :paramtype caching: str or ~azure.mgmt.compute.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: The create option. Required. Known values are: "FromImage", "Empty", - "Attach", "Copy", and "Restore". - :paramtype create_option: str or ~azure.mgmt.compute.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. The property diskSizeGB - is the number of bytes x 1024^3 for the disk and the value cannot be larger than 1023. - :paramtype disk_size_gb: int - :keyword managed_disk: The managed disk parameters. - :paramtype managed_disk: ~azure.mgmt.compute.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: int - :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: int - :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**. Known values - are: "Delete" and "Detach". - :paramtype delete_option: str or ~azure.mgmt.compute.models.DiskDeleteOptionTypes - """ - super().__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 type: Resource type. - :vartype type: str - :ivar name: Resource name. - :vartype name: str - :ivar force_update_tag: If a value is provided and is different from the previous value, the - extension handler will be forced to update even if the extension configuration has not changed. - :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: ~azure.mgmt.compute.models.KeyVaultSecretReference - """ - - _validation = { - "id": {"readonly": True}, - "type": {"readonly": True}, - "provisioning_state": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "name": {"key": "name", "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": "KeyVaultSecretReference", - }, - } - - 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["_models.KeyVaultSecretReference"] = None, - **kwargs: Any - ) -> None: - """ - :keyword name: Resource name. - :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: - ~azure.mgmt.compute.models.KeyVaultSecretReference - """ - super().__init__(**kwargs) - self.type: Optional[str] = None - self.name = name - 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: Optional[str] = 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(_serialization.Model): # pylint: disable=name-too-long - """The List VM scale set extension operation response. - - All required parameters must be populated in order to send to server. - - :ivar value: The list of VM scale set extensions. Required. - :vartype value: list[~azure.mgmt.compute.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["_models.VirtualMachineScaleSetExtension"], next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: The list of VM scale set extensions. Required. - :paramtype value: list[~azure.mgmt.compute.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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class VirtualMachineScaleSetExtensionProfile(_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.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). 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["_models.VirtualMachineScaleSetExtension"]] = None, - extensions_time_budget: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword extensions: The virtual machine scale set child extension resources. - :paramtype extensions: list[~azure.mgmt.compute.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). Minimum api-version: 2020-06-01. - :paramtype extensions_time_budget: str - """ - super().__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: ~azure.mgmt.compute.models.KeyVaultSecretReference - """ - - _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": "KeyVaultSecretReference", - }, - } - - 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["_models.KeyVaultSecretReference"] = None, - **kwargs: Any - ) -> None: - """ - :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: - ~azure.mgmt.compute.models.KeyVaultSecretReference - """ - super().__init__(**kwargs) - self.name: Optional[str] = None - self.type: Optional[str] = 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: Optional[str] = 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(_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: 2021-11-01. Please follow the instructions in `VM Customization - `_ for more details. - :vartype vm_size_properties: ~azure.mgmt.compute.models.VMSizeProperties - """ - - _attribute_map = { - "vm_size_properties": {"key": "vmSizeProperties", "type": "VMSizeProperties"}, - } - - def __init__(self, *, vm_size_properties: Optional["_models.VMSizeProperties"] = None, **kwargs: Any) -> None: - """ - :keyword vm_size_properties: Specifies the properties for customizing the size of the virtual - machine. Minimum api-version: 2021-11-01. Please follow the instructions in `VM Customization - `_ for more details. - :paramtype vm_size_properties: ~azure.mgmt.compute.models.VMSizeProperties - """ - super().__init__(**kwargs) - self.vm_size_properties = vm_size_properties - - -class VirtualMachineScaleSetIdentity(_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. Known values are: "SystemAssigned", "UserAssigned", "SystemAssigned, UserAssigned", and - "None". - :vartype type: str or ~azure.mgmt.compute.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.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, "_models.ResourceIdentityType"]] = None, - user_assigned_identities: Optional[dict[str, "_models.UserAssignedIdentitiesValue"]] = None, - **kwargs: Any - ) -> None: - """ - :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. Known values are: "SystemAssigned", "UserAssigned", "SystemAssigned, UserAssigned", and - "None". - :paramtype type: str or ~azure.mgmt.compute.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.models.UserAssignedIdentitiesValue] - """ - super().__init__(**kwargs) - self.principal_id: Optional[str] = None - self.tenant_id: Optional[str] = None - self.type = type - self.user_assigned_identities = user_assigned_identities - - -class VirtualMachineScaleSetInstanceView(_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.models.VirtualMachineScaleSetInstanceViewStatusesSummary - :ivar extensions: The extensions information. - :vartype extensions: list[~azure.mgmt.compute.models.VirtualMachineScaleSetVMExtensionsSummary] - :ivar statuses: The resource status information. - :vartype statuses: list[~azure.mgmt.compute.models.InstanceViewStatus] - :ivar orchestration_services: The orchestration services information. - :vartype orchestration_services: list[~azure.mgmt.compute.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["_models.InstanceViewStatus"]] = None, **kwargs: Any) -> None: - """ - :keyword statuses: The resource status information. - :paramtype statuses: list[~azure.mgmt.compute.models.InstanceViewStatus] - """ - super().__init__(**kwargs) - self.virtual_machine: Optional["_models.VirtualMachineScaleSetInstanceViewStatusesSummary"] = None - self.extensions: Optional[list["_models.VirtualMachineScaleSetVMExtensionsSummary"]] = None - self.statuses = statuses - self.orchestration_services: Optional[list["_models.OrchestrationServiceSummary"]] = None - - -class VirtualMachineScaleSetInstanceViewStatusesSummary(_serialization.Model): # pylint: disable=name-too-long - """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.models.VirtualMachineStatusCodeCount] - """ - - _validation = { - "statuses_summary": {"readonly": True}, - } - - _attribute_map = { - "statuses_summary": {"key": "statusesSummary", "type": "[VirtualMachineStatusCodeCount]"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.statuses_summary: Optional[list["_models.VirtualMachineStatusCodeCount"]] = None - - -class VirtualMachineScaleSetIPConfiguration(_serialization.Model): - """Describes a virtual machine scale set network profile's IP configuration. - - All required parameters must be populated in order to send to server. - - :ivar name: The IP configuration name. Required. - :vartype name: str - :ivar subnet: Specifies the identifier of the subnet. - :vartype subnet: ~azure.mgmt.compute.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.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'. Known values are: "IPv4" and "IPv6". - :vartype private_ip_address_version: str or ~azure.mgmt.compute.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.models.SubResource] - :ivar application_security_groups: Specifies an array of references to application security - group. - :vartype application_security_groups: list[~azure.mgmt.compute.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.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.models.SubResource] - """ - - _validation = { - "name": {"required": True}, - } - - _attribute_map = { - "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, - subnet: Optional["_models.ApiEntityReference"] = None, - primary: Optional[bool] = None, - public_ip_address_configuration: Optional["_models.VirtualMachineScaleSetPublicIPAddressConfiguration"] = None, - private_ip_address_version: Optional[Union[str, "_models.IPVersion"]] = None, - application_gateway_backend_address_pools: Optional[list["_models.SubResource"]] = None, - application_security_groups: Optional[list["_models.SubResource"]] = None, - load_balancer_backend_address_pools: Optional[list["_models.SubResource"]] = None, - load_balancer_inbound_nat_pools: Optional[list["_models.SubResource"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword name: The IP configuration name. Required. - :paramtype name: str - :keyword subnet: Specifies the identifier of the subnet. - :paramtype subnet: ~azure.mgmt.compute.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.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'. Known values are: "IPv4" and "IPv6". - :paramtype private_ip_address_version: str or ~azure.mgmt.compute.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.models.SubResource] - :keyword application_security_groups: Specifies an array of references to application security - group. - :paramtype application_security_groups: list[~azure.mgmt.compute.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.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.models.SubResource] - """ - super().__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_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(_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: Any) -> None: - """ - :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().__init__(**kwargs) - self.ip_tag_type = ip_tag_type - self.tag = tag - - -class VirtualMachineScaleSetListOSUpgradeHistory(_serialization.Model): # pylint: disable=name-too-long - """List of Virtual Machine Scale Set OS Upgrade History operation response. - - All required parameters must be populated in order to send to server. - - :ivar value: The list of OS upgrades performed on the virtual machine scale set. Required. - :vartype value: list[~azure.mgmt.compute.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["_models.UpgradeOperationHistoricalStatusInfo"], - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: The list of OS upgrades performed on the virtual machine scale set. Required. - :paramtype value: list[~azure.mgmt.compute.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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class VirtualMachineScaleSetListResult(_serialization.Model): - """The List Virtual Machine operation response. - - All required parameters must be populated in order to send to server. - - :ivar value: The list of virtual machine scale sets. Required. - :vartype value: list[~azure.mgmt.compute.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["_models.VirtualMachineScaleSet"], next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: The list of virtual machine scale sets. Required. - :paramtype value: list[~azure.mgmt.compute.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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class VirtualMachineScaleSetListSkusResult(_serialization.Model): - """The Virtual Machine Scale Set List Skus operation response. - - All required parameters must be populated in order to send to server. - - :ivar value: The list of skus available for the virtual machine scale set. Required. - :vartype value: list[~azure.mgmt.compute.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["_models.VirtualMachineScaleSetSku"], next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: The list of skus available for the virtual machine scale set. Required. - :paramtype value: list[~azure.mgmt.compute.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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class VirtualMachineScaleSetListWithLinkResult(_serialization.Model): - """The List Virtual Machine operation response. - - All required parameters must be populated in order to send to server. - - :ivar value: The list of virtual machine scale sets. Required. - :vartype value: list[~azure.mgmt.compute.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["_models.VirtualMachineScaleSet"], next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: The list of virtual machine scale sets. Required. - :paramtype value: list[~azure.mgmt.compute.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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class VirtualMachineScaleSetManagedDiskParameters(_serialization.Model): # pylint: disable=name-too-long - """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. Known values - are: "Standard_LRS", "Premium_LRS", "StandardSSD_LRS", "UltraSSD_LRS", "Premium_ZRS", - "StandardSSD_ZRS", and "PremiumV2_LRS". - :vartype storage_account_type: str or ~azure.mgmt.compute.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.models.DiskEncryptionSetParameters - :ivar security_profile: Specifies the security profile for the managed disk. - :vartype security_profile: ~azure.mgmt.compute.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, "_models.StorageAccountTypes"]] = None, - disk_encryption_set: Optional["_models.DiskEncryptionSetParameters"] = None, - security_profile: Optional["_models.VMDiskSecurityProfile"] = None, - **kwargs: Any - ) -> None: - """ - :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. Known values - are: "Standard_LRS", "Premium_LRS", "StandardSSD_LRS", "UltraSSD_LRS", "Premium_ZRS", - "StandardSSD_ZRS", and "PremiumV2_LRS". - :paramtype storage_account_type: str or ~azure.mgmt.compute.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.models.DiskEncryptionSetParameters - :keyword security_profile: Specifies the security profile for the managed disk. - :paramtype security_profile: ~azure.mgmt.compute.models.VMDiskSecurityProfile - """ - super().__init__(**kwargs) - self.storage_account_type = storage_account_type - self.disk_encryption_set = disk_encryption_set - self.security_profile = security_profile - - -class VirtualMachineScaleSetMigrationInfo(_serialization.Model): - """Describes the Availability Set properties related to migration to Flexible Virtual Machine - Scale Set. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar default_virtual_machine_scale_set_info: Indicates the target Virtual Machine ScaleSet - properties upon triggering a seamless migration without downtime of the VMs via the - ConvertToVirtualMachineScaleSet API. - :vartype default_virtual_machine_scale_set_info: - ~azure.mgmt.compute.models.DefaultVirtualMachineScaleSetInfo - :ivar migrate_to_virtual_machine_scale_set: Specifies the Virtual Machine Scale Set that the - Availability Set is migrated to. - :vartype migrate_to_virtual_machine_scale_set: ~azure.mgmt.compute.models.SubResource - """ - - _validation = { - "default_virtual_machine_scale_set_info": {"readonly": True}, - "migrate_to_virtual_machine_scale_set": {"readonly": True}, - } - - _attribute_map = { - "default_virtual_machine_scale_set_info": { - "key": "defaultVirtualMachineScaleSetInfo", - "type": "DefaultVirtualMachineScaleSetInfo", - }, - "migrate_to_virtual_machine_scale_set": {"key": "migrateToVirtualMachineScaleSet", "type": "SubResource"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.default_virtual_machine_scale_set_info: Optional["_models.DefaultVirtualMachineScaleSetInfo"] = None - self.migrate_to_virtual_machine_scale_set: Optional["_models.SubResource"] = None - - -class VirtualMachineScaleSetNetworkConfiguration(_serialization.Model): # pylint: disable=name-too-long - """Describes a virtual machine scale set network profile's network configurations. - - All required parameters must be populated in order to send to server. - - :ivar name: The network configuration name. Required. - :vartype name: str - :ivar tags: Resource tags applied to the networkInterface address created by this - NetworkInterfaceConfiguration. - :vartype tags: dict[str, 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 disable_tcp_state_tracking: Specifies whether the network interface is disabled for tcp - state tracking. - :vartype disable_tcp_state_tracking: 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.models.SubResource - :ivar dns_settings: The dns settings to be applied on the network interfaces. - :vartype dns_settings: - ~azure.mgmt.compute.models.VirtualMachineScaleSetNetworkConfigurationDnsSettings - :ivar ip_configurations: Specifies the IP configurations of the network interface. - :vartype ip_configurations: - list[~azure.mgmt.compute.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. - Known values are: "Delete" and "Detach". - :vartype delete_option: str or ~azure.mgmt.compute.models.DeleteOptions - :ivar auxiliary_mode: Specifies whether the Auxiliary mode is enabled for the Network Interface - resource. Known values are: "None", "AcceleratedConnections", and "Floating". - :vartype auxiliary_mode: str or ~azure.mgmt.compute.models.NetworkInterfaceAuxiliaryMode - :ivar auxiliary_sku: Specifies whether the Auxiliary sku is enabled for the Network Interface - resource. Known values are: "None", "A1", "A2", "A4", and "A8". - :vartype auxiliary_sku: str or ~azure.mgmt.compute.models.NetworkInterfaceAuxiliarySku - """ - - _validation = { - "name": {"required": True}, - } - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "tags": {"key": "tags", "type": "{str}"}, - "primary": {"key": "properties.primary", "type": "bool"}, - "enable_accelerated_networking": {"key": "properties.enableAcceleratedNetworking", "type": "bool"}, - "disable_tcp_state_tracking": {"key": "properties.disableTcpStateTracking", "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"}, - "auxiliary_mode": {"key": "properties.auxiliaryMode", "type": "str"}, - "auxiliary_sku": {"key": "properties.auxiliarySku", "type": "str"}, - } - - def __init__( - self, - *, - name: str, - tags: Optional[dict[str, str]] = None, - primary: Optional[bool] = None, - enable_accelerated_networking: Optional[bool] = None, - disable_tcp_state_tracking: Optional[bool] = None, - enable_fpga: Optional[bool] = None, - network_security_group: Optional["_models.SubResource"] = None, - dns_settings: Optional["_models.VirtualMachineScaleSetNetworkConfigurationDnsSettings"] = None, - ip_configurations: Optional[list["_models.VirtualMachineScaleSetIPConfiguration"]] = None, - enable_ip_forwarding: Optional[bool] = None, - delete_option: Optional[Union[str, "_models.DeleteOptions"]] = None, - auxiliary_mode: Optional[Union[str, "_models.NetworkInterfaceAuxiliaryMode"]] = None, - auxiliary_sku: Optional[Union[str, "_models.NetworkInterfaceAuxiliarySku"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword name: The network configuration name. Required. - :paramtype name: str - :keyword tags: Resource tags applied to the networkInterface address created by this - NetworkInterfaceConfiguration. - :paramtype tags: dict[str, 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 disable_tcp_state_tracking: Specifies whether the network interface is disabled for - tcp state tracking. - :paramtype disable_tcp_state_tracking: 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.models.SubResource - :keyword dns_settings: The dns settings to be applied on the network interfaces. - :paramtype dns_settings: - ~azure.mgmt.compute.models.VirtualMachineScaleSetNetworkConfigurationDnsSettings - :keyword ip_configurations: Specifies the IP configurations of the network interface. - :paramtype ip_configurations: - list[~azure.mgmt.compute.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. - Known values are: "Delete" and "Detach". - :paramtype delete_option: str or ~azure.mgmt.compute.models.DeleteOptions - :keyword auxiliary_mode: Specifies whether the Auxiliary mode is enabled for the Network - Interface resource. Known values are: "None", "AcceleratedConnections", and "Floating". - :paramtype auxiliary_mode: str or ~azure.mgmt.compute.models.NetworkInterfaceAuxiliaryMode - :keyword auxiliary_sku: Specifies whether the Auxiliary sku is enabled for the Network - Interface resource. Known values are: "None", "A1", "A2", "A4", and "A8". - :paramtype auxiliary_sku: str or ~azure.mgmt.compute.models.NetworkInterfaceAuxiliarySku - """ - super().__init__(**kwargs) - self.name = name - self.tags = tags - self.primary = primary - self.enable_accelerated_networking = enable_accelerated_networking - self.disable_tcp_state_tracking = disable_tcp_state_tracking - 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 - self.auxiliary_mode = auxiliary_mode - self.auxiliary_sku = auxiliary_sku - - -class VirtualMachineScaleSetNetworkConfigurationDnsSettings(_serialization.Model): # pylint: disable=name-too-long - """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: Any) -> None: - """ - :keyword dns_servers: List of DNS servers IP addresses. - :paramtype dns_servers: list[str] - """ - super().__init__(**kwargs) - self.dns_servers = dns_servers - - -class VirtualMachineScaleSetNetworkProfile(_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.models.ApiEntityReference - :ivar network_interface_configurations: The list of network configurations. - :vartype network_interface_configurations: - list[~azure.mgmt.compute.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'. Known values are: "2020-11-01" and "2022-11-01". - :vartype network_api_version: str or ~azure.mgmt.compute.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["_models.ApiEntityReference"] = None, - network_interface_configurations: Optional[list["_models.VirtualMachineScaleSetNetworkConfiguration"]] = None, - network_api_version: Optional[Union[str, "_models.NetworkApiVersion"]] = None, - **kwargs: Any - ) -> None: - """ - :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.models.ApiEntityReference - :keyword network_interface_configurations: The list of network configurations. - :paramtype network_interface_configurations: - list[~azure.mgmt.compute.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'. Known values are: "2020-11-01" and "2022-11-01". - :paramtype network_api_version: str or ~azure.mgmt.compute.models.NetworkApiVersion - """ - super().__init__(**kwargs) - self.health_probe = health_probe - self.network_interface_configurations = network_interface_configurations - self.network_api_version = network_api_version - - -class VirtualMachineScaleSetOSDisk(_serialization.Model): - """Describes a virtual machine scale set operating system disk. - - All required parameters must be populated in order to send to server. - - :ivar name: The disk name. - :vartype name: str - :ivar caching: Specifies the caching requirements. Possible values are: **None,** **ReadOnly,** - **ReadWrite.** The default values are: **None for Standard storage. ReadOnly for Premium - storage.**. Known values are: "None", "ReadOnly", and "ReadWrite". - :vartype caching: str or ~azure.mgmt.compute.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: Specifies how the virtual machines in the scale set should be created. The - only allowed value is: **FromImage.** 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. Required. Known values are: "FromImage", "Empty", "Attach", "Copy", and - "Restore". - :vartype create_option: str or ~azure.mgmt.compute.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.models.DiffDiskSettings - :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. The property 'diskSizeGB' is - the number of bytes x 1024^3 for the disk and the value cannot be larger than 1023. - :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. Possible values are: **Windows,** - **Linux.**. Known values are: "Windows" and "Linux". - :vartype os_type: str or ~azure.mgmt.compute.models.OperatingSystemTypes - :ivar image: Specifies information about the unmanaged user image to base the scale set on. - :vartype image: ~azure.mgmt.compute.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.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. Known values are: "Delete" and "Detach". - :vartype delete_option: str or ~azure.mgmt.compute.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, "_models.DiskCreateOptionTypes"], - name: Optional[str] = None, - caching: Optional[Union[str, "_models.CachingTypes"]] = None, - write_accelerator_enabled: Optional[bool] = None, - diff_disk_settings: Optional["_models.DiffDiskSettings"] = None, - disk_size_gb: Optional[int] = None, - os_type: Optional[Union[str, "_models.OperatingSystemTypes"]] = None, - image: Optional["_models.VirtualHardDisk"] = None, - vhd_containers: Optional[list[str]] = None, - managed_disk: Optional["_models.VirtualMachineScaleSetManagedDiskParameters"] = None, - delete_option: Optional[Union[str, "_models.DiskDeleteOptionTypes"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword name: The disk name. - :paramtype name: str - :keyword caching: Specifies the caching requirements. Possible values are: **None,** - **ReadOnly,** **ReadWrite.** The default values are: **None for Standard storage. ReadOnly for - Premium storage.**. Known values are: "None", "ReadOnly", and "ReadWrite". - :paramtype caching: str or ~azure.mgmt.compute.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: Specifies how the virtual machines in the scale set should be created. - The only allowed value is: **FromImage.** 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. Required. Known values are: "FromImage", "Empty", "Attach", "Copy", and - "Restore". - :paramtype create_option: str or ~azure.mgmt.compute.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.models.DiffDiskSettings - :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. The property 'diskSizeGB' - is the number of bytes x 1024^3 for the disk and the value cannot be larger than 1023. - :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. Possible values are: - **Windows,** **Linux.**. Known values are: "Windows" and "Linux". - :paramtype os_type: str or ~azure.mgmt.compute.models.OperatingSystemTypes - :keyword image: Specifies information about the unmanaged user image to base the scale set on. - :paramtype image: ~azure.mgmt.compute.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.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. Known values are: "Delete" and "Detach". - :paramtype delete_option: str or ~azure.mgmt.compute.models.DiskDeleteOptionTypes - """ - super().__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(_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. 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.models.WindowsConfiguration - :ivar linux_configuration: Specifies the Linux operating system settings on the virtual - machine. For a list of supported Linux distributions, see `Linux on Azure-Endorsed - Distributions `_. - :vartype linux_configuration: ~azure.mgmt.compute.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.models.VaultSecretGroup] - :ivar allow_extension_operations: Specifies whether extension operations should be allowed on - the virtual machine scale set. This may only be set to False when no extensions are present on - the virtual machine scale set. - :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_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"}, - "require_guest_provision_signal": {"key": "requireGuestProvisionSignal", "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["_models.WindowsConfiguration"] = None, - linux_configuration: Optional["_models.LinuxConfiguration"] = None, - secrets: Optional[list["_models.VaultSecretGroup"]] = None, - allow_extension_operations: Optional[bool] = None, - require_guest_provision_signal: Optional[bool] = None, - **kwargs: Any - ) -> None: - """ - :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. 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.models.WindowsConfiguration - :keyword linux_configuration: Specifies the Linux operating system settings on the virtual - machine. For a list of supported Linux distributions, see `Linux on Azure-Endorsed - Distributions `_. - :paramtype linux_configuration: ~azure.mgmt.compute.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.models.VaultSecretGroup] - :keyword allow_extension_operations: Specifies whether extension operations should be allowed - on the virtual machine scale set. This may only be set to False when no extensions are present - on the virtual machine scale set. - :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().__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 - self.require_guest_provision_signal = require_guest_provision_signal - - -class VirtualMachineScaleSetPublicIPAddressConfiguration(_serialization.Model): # pylint: disable=name-too-long - """Describes a virtual machines scale set IP Configuration's PublicIPAddress configuration. - - All required parameters must be populated in order to send to server. - - :ivar name: The publicIP address configuration name. Required. - :vartype name: str - :ivar sku: Describes the public IP Sku. It can only be set with OrchestrationMode as Flexible. - :vartype sku: ~azure.mgmt.compute.models.PublicIPAddressSku - :ivar tags: Resource tags applied to the publicIP address created by this - PublicIPAddressConfiguration. - :vartype tags: dict[str, 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.models.VirtualMachineScaleSetPublicIPAddressConfigurationDnsSettings - :ivar ip_tags: The list of IP tags associated with the public IP address. - :vartype ip_tags: list[~azure.mgmt.compute.models.VirtualMachineScaleSetIpTag] - :ivar public_ip_prefix: The PublicIPPrefix from which to allocate publicIP addresses. - :vartype public_ip_prefix: ~azure.mgmt.compute.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'. Known values are: "IPv4" and "IPv6". - :vartype public_ip_address_version: str or ~azure.mgmt.compute.models.IPVersion - :ivar delete_option: Specify what happens to the public IP when the VM is deleted. Known values - are: "Delete" and "Detach". - :vartype delete_option: str or ~azure.mgmt.compute.models.DeleteOptions - """ - - _validation = { - "name": {"required": True}, - } - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "sku": {"key": "sku", "type": "PublicIPAddressSku"}, - "tags": {"key": "tags", "type": "{str}"}, - "idle_timeout_in_minutes": {"key": "properties.idleTimeoutInMinutes", "type": "int"}, - "dns_settings": { - "key": "properties.dnsSettings", - "type": "VirtualMachineScaleSetPublicIPAddressConfigurationDnsSettings", - }, - "ip_tags": {"key": "properties.ipTags", "type": "[VirtualMachineScaleSetIpTag]"}, - "public_ip_prefix": {"key": "properties.publicIPPrefix", "type": "SubResource"}, - "public_ip_address_version": {"key": "properties.publicIPAddressVersion", "type": "str"}, - "delete_option": {"key": "properties.deleteOption", "type": "str"}, - } - - def __init__( - self, - *, - name: str, - sku: Optional["_models.PublicIPAddressSku"] = None, - tags: Optional[dict[str, str]] = None, - idle_timeout_in_minutes: Optional[int] = None, - dns_settings: Optional["_models.VirtualMachineScaleSetPublicIPAddressConfigurationDnsSettings"] = None, - ip_tags: Optional[list["_models.VirtualMachineScaleSetIpTag"]] = None, - public_ip_prefix: Optional["_models.SubResource"] = None, - public_ip_address_version: Optional[Union[str, "_models.IPVersion"]] = None, - delete_option: Optional[Union[str, "_models.DeleteOptions"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword name: The publicIP address configuration name. Required. - :paramtype name: str - :keyword sku: Describes the public IP Sku. It can only be set with OrchestrationMode as - Flexible. - :paramtype sku: ~azure.mgmt.compute.models.PublicIPAddressSku - :keyword tags: Resource tags applied to the publicIP address created by this - PublicIPAddressConfiguration. - :paramtype tags: dict[str, 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.models.VirtualMachineScaleSetPublicIPAddressConfigurationDnsSettings - :keyword ip_tags: The list of IP tags associated with the public IP address. - :paramtype ip_tags: list[~azure.mgmt.compute.models.VirtualMachineScaleSetIpTag] - :keyword public_ip_prefix: The PublicIPPrefix from which to allocate publicIP addresses. - :paramtype public_ip_prefix: ~azure.mgmt.compute.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'. Known values are: "IPv4" and "IPv6". - :paramtype public_ip_address_version: str or ~azure.mgmt.compute.models.IPVersion - :keyword delete_option: Specify what happens to the public IP when the VM is deleted. Known - values are: "Delete" and "Detach". - :paramtype delete_option: str or ~azure.mgmt.compute.models.DeleteOptions - """ - super().__init__(**kwargs) - self.name = name - self.sku = sku - self.tags = tags - 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( - _serialization.Model -): # pylint: disable=name-too-long - """Describes a virtual machines scale sets network configuration's DNS settings. - - All required parameters must be populated in order to send to server. - - :ivar domain_name_label: 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. - Required. - :vartype domain_name_label: str - :ivar domain_name_label_scope: The Domain name label scope.The concatenation of the hashed - domain name label that generated according to the policy from domain name label scope and vm - index will be the domain name labels of the PublicIPAddress resources that will be created. - Known values are: "TenantReuse", "SubscriptionReuse", "ResourceGroupReuse", and "NoReuse". - :vartype domain_name_label_scope: str or ~azure.mgmt.compute.models.DomainNameLabelScopeTypes - """ - - _validation = { - "domain_name_label": {"required": True}, - } - - _attribute_map = { - "domain_name_label": {"key": "domainNameLabel", "type": "str"}, - "domain_name_label_scope": {"key": "domainNameLabelScope", "type": "str"}, - } - - def __init__( - self, - *, - domain_name_label: str, - domain_name_label_scope: Optional[Union[str, "_models.DomainNameLabelScopeTypes"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword domain_name_label: 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. Required. - :paramtype domain_name_label: str - :keyword domain_name_label_scope: The Domain name label scope.The concatenation of the hashed - domain name label that generated according to the policy from domain name label scope and vm - index will be the domain name labels of the PublicIPAddress resources that will be created. - Known values are: "TenantReuse", "SubscriptionReuse", "ResourceGroupReuse", and "NoReuse". - :paramtype domain_name_label_scope: str or ~azure.mgmt.compute.models.DomainNameLabelScopeTypes - """ - super().__init__(**kwargs) - self.domain_name_label = domain_name_label - self.domain_name_label_scope = domain_name_label_scope - - -class VirtualMachineScaleSetVMReimageParameters(VirtualMachineReimageParameters): # pylint: disable=name-too-long - """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 exact_version: Specifies in decimal number, the version the OS disk should be reimaged - to. If exact version is not provided, the OS disk is reimaged to the existing version of OS - Disk. - :vartype exact_version: str - :ivar os_profile: Specifies information required for reimaging the non-ephemeral OS disk. - :vartype os_profile: ~azure.mgmt.compute.models.OSProfileProvisioningData - :ivar force_update_os_disk_for_ephemeral: Parameter to force update ephemeral OS disk for a - virtual machine scale set VM. - :vartype force_update_os_disk_for_ephemeral: bool - """ - - _attribute_map = { - "temp_disk": {"key": "tempDisk", "type": "bool"}, - "exact_version": {"key": "exactVersion", "type": "str"}, - "os_profile": {"key": "osProfile", "type": "OSProfileProvisioningData"}, - "force_update_os_disk_for_ephemeral": {"key": "forceUpdateOSDiskForEphemeral", "type": "bool"}, - } - - def __init__( - self, - *, - temp_disk: Optional[bool] = None, - exact_version: Optional[str] = None, - os_profile: Optional["_models.OSProfileProvisioningData"] = None, - force_update_os_disk_for_ephemeral: Optional[bool] = None, - **kwargs: Any - ) -> None: - """ - :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 exact_version: Specifies in decimal number, the version the OS disk should be reimaged - to. If exact version is not provided, the OS disk is reimaged to the existing version of OS - Disk. - :paramtype exact_version: str - :keyword os_profile: Specifies information required for reimaging the non-ephemeral OS disk. - :paramtype os_profile: ~azure.mgmt.compute.models.OSProfileProvisioningData - :keyword force_update_os_disk_for_ephemeral: Parameter to force update ephemeral OS disk for a - virtual machine scale set VM. - :paramtype force_update_os_disk_for_ephemeral: bool - """ - super().__init__(temp_disk=temp_disk, exact_version=exact_version, os_profile=os_profile, **kwargs) - self.force_update_os_disk_for_ephemeral = force_update_os_disk_for_ephemeral - - -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 exact_version: Specifies in decimal number, the version the OS disk should be reimaged - to. If exact version is not provided, the OS disk is reimaged to the existing version of OS - Disk. - :vartype exact_version: str - :ivar os_profile: Specifies information required for reimaging the non-ephemeral OS disk. - :vartype os_profile: ~azure.mgmt.compute.models.OSProfileProvisioningData - :ivar force_update_os_disk_for_ephemeral: Parameter to force update ephemeral OS disk for a - virtual machine scale set VM. - :vartype force_update_os_disk_for_ephemeral: 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"}, - "exact_version": {"key": "exactVersion", "type": "str"}, - "os_profile": {"key": "osProfile", "type": "OSProfileProvisioningData"}, - "force_update_os_disk_for_ephemeral": {"key": "forceUpdateOSDiskForEphemeral", "type": "bool"}, - "instance_ids": {"key": "instanceIds", "type": "[str]"}, - } - - def __init__( - self, - *, - temp_disk: Optional[bool] = None, - exact_version: Optional[str] = None, - os_profile: Optional["_models.OSProfileProvisioningData"] = None, - force_update_os_disk_for_ephemeral: Optional[bool] = None, - instance_ids: Optional[list[str]] = None, - **kwargs: Any - ) -> None: - """ - :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 exact_version: Specifies in decimal number, the version the OS disk should be reimaged - to. If exact version is not provided, the OS disk is reimaged to the existing version of OS - Disk. - :paramtype exact_version: str - :keyword os_profile: Specifies information required for reimaging the non-ephemeral OS disk. - :paramtype os_profile: ~azure.mgmt.compute.models.OSProfileProvisioningData - :keyword force_update_os_disk_for_ephemeral: Parameter to force update ephemeral OS disk for a - virtual machine scale set VM. - :paramtype force_update_os_disk_for_ephemeral: 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().__init__( - temp_disk=temp_disk, - exact_version=exact_version, - os_profile=os_profile, - force_update_os_disk_for_ephemeral=force_update_os_disk_for_ephemeral, - **kwargs - ) - self.instance_ids = instance_ids - - -class VirtualMachineScaleSetSku(_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.models.Sku - :ivar capacity: Specifies the number of virtual machines in the scale set. - :vartype capacity: ~azure.mgmt.compute.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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.resource_type: Optional[str] = None - self.sku: Optional["_models.Sku"] = None - self.capacity: Optional["_models.VirtualMachineScaleSetSkuCapacity"] = None - - -class VirtualMachineScaleSetSkuCapacity(_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: int - :ivar maximum: The maximum capacity that can be set. - :vartype maximum: int - :ivar default_capacity: The default capacity. - :vartype default_capacity: int - :ivar scale_type: The scale type applicable to the sku. Known values are: "Automatic" and - "None". - :vartype scale_type: str or ~azure.mgmt.compute.models.VirtualMachineScaleSetSkuScaleType - """ - - _validation = { - "minimum": {"readonly": True}, - "maximum": {"readonly": True}, - "default_capacity": {"readonly": True}, - "scale_type": {"readonly": True}, - } - - _attribute_map = { - "minimum": {"key": "minimum", "type": "int"}, - "maximum": {"key": "maximum", "type": "int"}, - "default_capacity": {"key": "defaultCapacity", "type": "int"}, - "scale_type": {"key": "scaleType", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.minimum: Optional[int] = None - self.maximum: Optional[int] = None - self.default_capacity: Optional[int] = None - self.scale_type: Optional[Union[str, "_models.VirtualMachineScaleSetSkuScaleType"]] = None - - -class VirtualMachineScaleSetStorageProfile(_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.models.ImageReference - :ivar os_disk: Specifies information about the operating system disk used by the virtual - machines in the scale set. For more information about disks, see `About disks and VHDs for - Azure virtual machines - `_. - :vartype os_disk: ~azure.mgmt.compute.models.VirtualMachineScaleSetOSDisk - :ivar data_disks: Specifies the parameters that are used to add data disks to the virtual - machines in the scale set. For more information about disks, see `About disks and VHDs for - Azure virtual machines - `_. - :vartype data_disks: list[~azure.mgmt.compute.models.VirtualMachineScaleSetDataDisk] - :ivar disk_controller_type: Specifies the disk controller type configured for the virtual - machines in the scale set. Minimum api-version: 2022-08-01. Known values are: "SCSI" and - "NVMe". - :vartype disk_controller_type: str or ~azure.mgmt.compute.models.DiskControllerTypes - """ - - _attribute_map = { - "image_reference": {"key": "imageReference", "type": "ImageReference"}, - "os_disk": {"key": "osDisk", "type": "VirtualMachineScaleSetOSDisk"}, - "data_disks": {"key": "dataDisks", "type": "[VirtualMachineScaleSetDataDisk]"}, - "disk_controller_type": {"key": "diskControllerType", "type": "str"}, - } - - def __init__( - self, - *, - image_reference: Optional["_models.ImageReference"] = None, - os_disk: Optional["_models.VirtualMachineScaleSetOSDisk"] = None, - data_disks: Optional[list["_models.VirtualMachineScaleSetDataDisk"]] = None, - disk_controller_type: Optional[Union[str, "_models.DiskControllerTypes"]] = None, - **kwargs: Any - ) -> None: - """ - :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.models.ImageReference - :keyword os_disk: Specifies information about the operating system disk used by the virtual - machines in the scale set. For more information about disks, see `About disks and VHDs for - Azure virtual machines - `_. - :paramtype os_disk: ~azure.mgmt.compute.models.VirtualMachineScaleSetOSDisk - :keyword data_disks: Specifies the parameters that are used to add data disks to the virtual - machines in the scale set. For more information about disks, see `About disks and VHDs for - Azure virtual machines - `_. - :paramtype data_disks: list[~azure.mgmt.compute.models.VirtualMachineScaleSetDataDisk] - :keyword disk_controller_type: Specifies the disk controller type configured for the virtual - machines in the scale set. Minimum api-version: 2022-08-01. Known values are: "SCSI" and - "NVMe". - :paramtype disk_controller_type: str or ~azure.mgmt.compute.models.DiskControllerTypes - """ - super().__init__(**kwargs) - self.image_reference = image_reference - self.os_disk = os_disk - self.data_disks = data_disks - self.disk_controller_type = disk_controller_type - - -class VirtualMachineScaleSetUpdate(UpdateResource): - """Describes a Virtual Machine Scale Set. - - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - :ivar sku: The virtual machine scale set sku. - :vartype sku: ~azure.mgmt.compute.models.Sku - :ivar plan: The purchase plan when deploying a virtual machine scale set from VM Marketplace - images. - :vartype plan: ~azure.mgmt.compute.models.Plan - :ivar identity: The identity of the virtual machine scale set, if configured. - :vartype identity: ~azure.mgmt.compute.models.VirtualMachineScaleSetIdentity - :ivar zones: The virtual machine scale set zones. - :vartype zones: list[str] - :ivar upgrade_policy: The upgrade policy. - :vartype upgrade_policy: ~azure.mgmt.compute.models.UpgradePolicy - :ivar automatic_repairs_policy: Policy for automatic repairs. - :vartype automatic_repairs_policy: ~azure.mgmt.compute.models.AutomaticRepairsPolicy - :ivar virtual_machine_profile: The virtual machine profile. - :vartype virtual_machine_profile: - ~azure.mgmt.compute.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.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.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.models.SubResource - :ivar priority_mix_policy: Specifies the desired targets for mixing Spot and Regular priority - VMs within the same VMSS Flex instance. - :vartype priority_mix_policy: ~azure.mgmt.compute.models.PriorityMixPolicy - :ivar spot_restore_policy: Specifies the Spot Restore properties for the virtual machine scale - set. - :vartype spot_restore_policy: ~azure.mgmt.compute.models.SpotRestorePolicy - :ivar resiliency_policy: Policy for Resiliency. - :vartype resiliency_policy: ~azure.mgmt.compute.models.ResiliencyPolicy - :ivar zonal_platform_fault_domain_align_mode: Specifies the align mode between Virtual Machine - Scale Set compute and storage Fault Domain count. Known values are: "Aligned" and "Unaligned". - :vartype zonal_platform_fault_domain_align_mode: str or - ~azure.mgmt.compute.models.ZonalPlatformFaultDomainAlignMode - :ivar sku_profile: Specifies the sku profile for the virtual machine scale set. - :vartype sku_profile: ~azure.mgmt.compute.models.SkuProfile - """ - - _attribute_map = { - "tags": {"key": "tags", "type": "{str}"}, - "sku": {"key": "sku", "type": "Sku"}, - "plan": {"key": "plan", "type": "Plan"}, - "identity": {"key": "identity", "type": "VirtualMachineScaleSetIdentity"}, - "zones": {"key": "zones", "type": "[str]"}, - "upgrade_policy": {"key": "properties.upgradePolicy", "type": "UpgradePolicy"}, - "automatic_repairs_policy": {"key": "properties.automaticRepairsPolicy", "type": "AutomaticRepairsPolicy"}, - "virtual_machine_profile": { - "key": "properties.virtualMachineProfile", - "type": "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"}, - "priority_mix_policy": {"key": "properties.priorityMixPolicy", "type": "PriorityMixPolicy"}, - "spot_restore_policy": {"key": "properties.spotRestorePolicy", "type": "SpotRestorePolicy"}, - "resiliency_policy": {"key": "properties.resiliencyPolicy", "type": "ResiliencyPolicy"}, - "zonal_platform_fault_domain_align_mode": { - "key": "properties.zonalPlatformFaultDomainAlignMode", - "type": "str", - }, - "sku_profile": {"key": "properties.skuProfile", "type": "SkuProfile"}, - } - - def __init__( - self, - *, - tags: Optional[dict[str, str]] = None, - sku: Optional["_models.Sku"] = None, - plan: Optional["_models.Plan"] = None, - identity: Optional["_models.VirtualMachineScaleSetIdentity"] = None, - zones: Optional[list[str]] = None, - upgrade_policy: Optional["_models.UpgradePolicy"] = None, - automatic_repairs_policy: Optional["_models.AutomaticRepairsPolicy"] = None, - virtual_machine_profile: Optional["_models.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["_models.AdditionalCapabilities"] = None, - scale_in_policy: Optional["_models.ScaleInPolicy"] = None, - proximity_placement_group: Optional["_models.SubResource"] = None, - priority_mix_policy: Optional["_models.PriorityMixPolicy"] = None, - spot_restore_policy: Optional["_models.SpotRestorePolicy"] = None, - resiliency_policy: Optional["_models.ResiliencyPolicy"] = None, - zonal_platform_fault_domain_align_mode: Optional[ - Union[str, "_models.ZonalPlatformFaultDomainAlignMode"] - ] = None, - sku_profile: Optional["_models.SkuProfile"] = None, - **kwargs: Any - ) -> None: - """ - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - :keyword sku: The virtual machine scale set sku. - :paramtype sku: ~azure.mgmt.compute.models.Sku - :keyword plan: The purchase plan when deploying a virtual machine scale set from VM Marketplace - images. - :paramtype plan: ~azure.mgmt.compute.models.Plan - :keyword identity: The identity of the virtual machine scale set, if configured. - :paramtype identity: ~azure.mgmt.compute.models.VirtualMachineScaleSetIdentity - :keyword zones: The virtual machine scale set zones. - :paramtype zones: list[str] - :keyword upgrade_policy: The upgrade policy. - :paramtype upgrade_policy: ~azure.mgmt.compute.models.UpgradePolicy - :keyword automatic_repairs_policy: Policy for automatic repairs. - :paramtype automatic_repairs_policy: ~azure.mgmt.compute.models.AutomaticRepairsPolicy - :keyword virtual_machine_profile: The virtual machine profile. - :paramtype virtual_machine_profile: - ~azure.mgmt.compute.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.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.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.models.SubResource - :keyword priority_mix_policy: Specifies the desired targets for mixing Spot and Regular - priority VMs within the same VMSS Flex instance. - :paramtype priority_mix_policy: ~azure.mgmt.compute.models.PriorityMixPolicy - :keyword spot_restore_policy: Specifies the Spot Restore properties for the virtual machine - scale set. - :paramtype spot_restore_policy: ~azure.mgmt.compute.models.SpotRestorePolicy - :keyword resiliency_policy: Policy for Resiliency. - :paramtype resiliency_policy: ~azure.mgmt.compute.models.ResiliencyPolicy - :keyword zonal_platform_fault_domain_align_mode: Specifies the align mode between Virtual - Machine Scale Set compute and storage Fault Domain count. Known values are: "Aligned" and - "Unaligned". - :paramtype zonal_platform_fault_domain_align_mode: str or - ~azure.mgmt.compute.models.ZonalPlatformFaultDomainAlignMode - :keyword sku_profile: Specifies the sku profile for the virtual machine scale set. - :paramtype sku_profile: ~azure.mgmt.compute.models.SkuProfile - """ - super().__init__(tags=tags, **kwargs) - self.sku = sku - self.plan = plan - self.identity = identity - self.zones = zones - 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 - self.priority_mix_policy = priority_mix_policy - self.spot_restore_policy = spot_restore_policy - self.resiliency_policy = resiliency_policy - self.zonal_platform_fault_domain_align_mode = zonal_platform_fault_domain_align_mode - self.sku_profile = sku_profile - - -class VirtualMachineScaleSetUpdateIPConfiguration(_serialization.Model): # pylint: disable=name-too-long - """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 name: The IP configuration name. - :vartype name: str - :ivar subnet: The subnet. - :vartype subnet: ~azure.mgmt.compute.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.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'. Known values are: "IPv4" and "IPv6". - :vartype private_ip_address_version: str or ~azure.mgmt.compute.models.IPVersion - :ivar application_gateway_backend_address_pools: The application gateway backend address pools. - :vartype application_gateway_backend_address_pools: - list[~azure.mgmt.compute.models.SubResource] - :ivar application_security_groups: Specifies an array of references to application security - group. - :vartype application_security_groups: list[~azure.mgmt.compute.models.SubResource] - :ivar load_balancer_backend_address_pools: The load balancer backend address pools. - :vartype load_balancer_backend_address_pools: list[~azure.mgmt.compute.models.SubResource] - :ivar load_balancer_inbound_nat_pools: The load balancer inbound nat pools. - :vartype load_balancer_inbound_nat_pools: list[~azure.mgmt.compute.models.SubResource] - """ - - _attribute_map = { - "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, - *, - name: Optional[str] = None, - subnet: Optional["_models.ApiEntityReference"] = None, - primary: Optional[bool] = None, - public_ip_address_configuration: Optional[ - "_models.VirtualMachineScaleSetUpdatePublicIPAddressConfiguration" - ] = None, - private_ip_address_version: Optional[Union[str, "_models.IPVersion"]] = None, - application_gateway_backend_address_pools: Optional[list["_models.SubResource"]] = None, - application_security_groups: Optional[list["_models.SubResource"]] = None, - load_balancer_backend_address_pools: Optional[list["_models.SubResource"]] = None, - load_balancer_inbound_nat_pools: Optional[list["_models.SubResource"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword name: The IP configuration name. - :paramtype name: str - :keyword subnet: The subnet. - :paramtype subnet: ~azure.mgmt.compute.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.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'. Known values are: "IPv4" and "IPv6". - :paramtype private_ip_address_version: str or ~azure.mgmt.compute.models.IPVersion - :keyword application_gateway_backend_address_pools: The application gateway backend address - pools. - :paramtype application_gateway_backend_address_pools: - list[~azure.mgmt.compute.models.SubResource] - :keyword application_security_groups: Specifies an array of references to application security - group. - :paramtype application_security_groups: list[~azure.mgmt.compute.models.SubResource] - :keyword load_balancer_backend_address_pools: The load balancer backend address pools. - :paramtype load_balancer_backend_address_pools: list[~azure.mgmt.compute.models.SubResource] - :keyword load_balancer_inbound_nat_pools: The load balancer inbound nat pools. - :paramtype load_balancer_inbound_nat_pools: list[~azure.mgmt.compute.models.SubResource] - """ - super().__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_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(_serialization.Model): # pylint: disable=name-too-long - """Describes a virtual machine scale set network profile's network configurations. - - :ivar name: The network configuration name. - :vartype name: str - :ivar tags: Resource tags applied to the networkInterface address created by this - NetworkInterfaceConfiguration. - :vartype tags: dict[str, 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 disable_tcp_state_tracking: Specifies whether the network interface is disabled for tcp - state tracking. - :vartype disable_tcp_state_tracking: 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.models.SubResource - :ivar dns_settings: The dns settings to be applied on the network interfaces. - :vartype dns_settings: - ~azure.mgmt.compute.models.VirtualMachineScaleSetNetworkConfigurationDnsSettings - :ivar ip_configurations: The virtual machine scale set IP Configuration. - :vartype ip_configurations: - list[~azure.mgmt.compute.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. - Known values are: "Delete" and "Detach". - :vartype delete_option: str or ~azure.mgmt.compute.models.DeleteOptions - :ivar auxiliary_mode: Specifies whether the Auxiliary mode is enabled for the Network Interface - resource. Known values are: "None", "AcceleratedConnections", and "Floating". - :vartype auxiliary_mode: str or ~azure.mgmt.compute.models.NetworkInterfaceAuxiliaryMode - :ivar auxiliary_sku: Specifies whether the Auxiliary sku is enabled for the Network Interface - resource. Known values are: "None", "A1", "A2", "A4", and "A8". - :vartype auxiliary_sku: str or ~azure.mgmt.compute.models.NetworkInterfaceAuxiliarySku - """ - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "tags": {"key": "tags", "type": "{str}"}, - "primary": {"key": "properties.primary", "type": "bool"}, - "enable_accelerated_networking": {"key": "properties.enableAcceleratedNetworking", "type": "bool"}, - "disable_tcp_state_tracking": {"key": "properties.disableTcpStateTracking", "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"}, - "auxiliary_mode": {"key": "properties.auxiliaryMode", "type": "str"}, - "auxiliary_sku": {"key": "properties.auxiliarySku", "type": "str"}, - } - - def __init__( - self, - *, - name: Optional[str] = None, - tags: Optional[dict[str, str]] = None, - primary: Optional[bool] = None, - enable_accelerated_networking: Optional[bool] = None, - disable_tcp_state_tracking: Optional[bool] = None, - enable_fpga: Optional[bool] = None, - network_security_group: Optional["_models.SubResource"] = None, - dns_settings: Optional["_models.VirtualMachineScaleSetNetworkConfigurationDnsSettings"] = None, - ip_configurations: Optional[list["_models.VirtualMachineScaleSetUpdateIPConfiguration"]] = None, - enable_ip_forwarding: Optional[bool] = None, - delete_option: Optional[Union[str, "_models.DeleteOptions"]] = None, - auxiliary_mode: Optional[Union[str, "_models.NetworkInterfaceAuxiliaryMode"]] = None, - auxiliary_sku: Optional[Union[str, "_models.NetworkInterfaceAuxiliarySku"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword name: The network configuration name. - :paramtype name: str - :keyword tags: Resource tags applied to the networkInterface address created by this - NetworkInterfaceConfiguration. - :paramtype tags: dict[str, 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 disable_tcp_state_tracking: Specifies whether the network interface is disabled for - tcp state tracking. - :paramtype disable_tcp_state_tracking: 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.models.SubResource - :keyword dns_settings: The dns settings to be applied on the network interfaces. - :paramtype dns_settings: - ~azure.mgmt.compute.models.VirtualMachineScaleSetNetworkConfigurationDnsSettings - :keyword ip_configurations: The virtual machine scale set IP Configuration. - :paramtype ip_configurations: - list[~azure.mgmt.compute.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. - Known values are: "Delete" and "Detach". - :paramtype delete_option: str or ~azure.mgmt.compute.models.DeleteOptions - :keyword auxiliary_mode: Specifies whether the Auxiliary mode is enabled for the Network - Interface resource. Known values are: "None", "AcceleratedConnections", and "Floating". - :paramtype auxiliary_mode: str or ~azure.mgmt.compute.models.NetworkInterfaceAuxiliaryMode - :keyword auxiliary_sku: Specifies whether the Auxiliary sku is enabled for the Network - Interface resource. Known values are: "None", "A1", "A2", "A4", and "A8". - :paramtype auxiliary_sku: str or ~azure.mgmt.compute.models.NetworkInterfaceAuxiliarySku - """ - super().__init__(**kwargs) - self.name = name - self.tags = tags - self.primary = primary - self.enable_accelerated_networking = enable_accelerated_networking - self.disable_tcp_state_tracking = disable_tcp_state_tracking - 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 - self.auxiliary_mode = auxiliary_mode - self.auxiliary_sku = auxiliary_sku - - -class VirtualMachineScaleSetUpdateNetworkProfile(_serialization.Model): # pylint: disable=name-too-long - """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.models.ApiEntityReference - :ivar network_interface_configurations: The list of network configurations. - :vartype network_interface_configurations: - list[~azure.mgmt.compute.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'. Known values are: "2020-11-01" and "2022-11-01". - :vartype network_api_version: str or ~azure.mgmt.compute.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["_models.ApiEntityReference"] = None, - network_interface_configurations: Optional[ - list["_models.VirtualMachineScaleSetUpdateNetworkConfiguration"] - ] = None, - network_api_version: Optional[Union[str, "_models.NetworkApiVersion"]] = None, - **kwargs: Any - ) -> None: - """ - :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.models.ApiEntityReference - :keyword network_interface_configurations: The list of network configurations. - :paramtype network_interface_configurations: - list[~azure.mgmt.compute.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'. Known values are: "2020-11-01" and "2022-11-01". - :paramtype network_api_version: str or ~azure.mgmt.compute.models.NetworkApiVersion - """ - super().__init__(**kwargs) - self.health_probe = health_probe - self.network_interface_configurations = network_interface_configurations - self.network_api_version = network_api_version - - -class VirtualMachineScaleSetUpdateOSDisk(_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. Known values are: "None", "ReadOnly", and "ReadWrite". - :vartype caching: str or ~azure.mgmt.compute.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 scale set. - :vartype diff_disk_settings: ~azure.mgmt.compute.models.DiffDiskSettings - :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:`
` - diskSizeGB is the number of bytes x 1024^3 for the disk and the value cannot be larger than - 1023. - :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.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.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. Known values are: "Delete" and "Detach". - :vartype delete_option: str or ~azure.mgmt.compute.models.DiskDeleteOptionTypes - """ - - _attribute_map = { - "caching": {"key": "caching", "type": "str"}, - "write_accelerator_enabled": {"key": "writeAcceleratorEnabled", "type": "bool"}, - "diff_disk_settings": {"key": "diffDiskSettings", "type": "DiffDiskSettings"}, - "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, "_models.CachingTypes"]] = None, - write_accelerator_enabled: Optional[bool] = None, - diff_disk_settings: Optional["_models.DiffDiskSettings"] = None, - disk_size_gb: Optional[int] = None, - image: Optional["_models.VirtualHardDisk"] = None, - vhd_containers: Optional[list[str]] = None, - managed_disk: Optional["_models.VirtualMachineScaleSetManagedDiskParameters"] = None, - delete_option: Optional[Union[str, "_models.DiskDeleteOptionTypes"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword caching: The caching type. Known values are: "None", "ReadOnly", and "ReadWrite". - :paramtype caching: str or ~azure.mgmt.compute.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 scale set. - :paramtype diff_disk_settings: ~azure.mgmt.compute.models.DiffDiskSettings - :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:`
` diskSizeGB is the number of bytes x 1024^3 for the disk and the value cannot be - larger than 1023. - :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.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.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. Known values are: "Delete" and "Detach". - :paramtype delete_option: str or ~azure.mgmt.compute.models.DiskDeleteOptionTypes - """ - super().__init__(**kwargs) - self.caching = caching - self.write_accelerator_enabled = write_accelerator_enabled - self.diff_disk_settings = diff_disk_settings - 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(_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.models.WindowsConfiguration - :ivar linux_configuration: The Linux Configuration of the OS profile. - :vartype linux_configuration: ~azure.mgmt.compute.models.LinuxConfiguration - :ivar secrets: The List of certificates for addition to the VM. - :vartype secrets: list[~azure.mgmt.compute.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["_models.WindowsConfiguration"] = None, - linux_configuration: Optional["_models.LinuxConfiguration"] = None, - secrets: Optional[list["_models.VaultSecretGroup"]] = None, - **kwargs: Any - ) -> None: - """ - :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.models.WindowsConfiguration - :keyword linux_configuration: The Linux Configuration of the OS profile. - :paramtype linux_configuration: ~azure.mgmt.compute.models.LinuxConfiguration - :keyword secrets: The List of certificates for addition to the VM. - :paramtype secrets: list[~azure.mgmt.compute.models.VaultSecretGroup] - """ - super().__init__(**kwargs) - self.custom_data = custom_data - self.windows_configuration = windows_configuration - self.linux_configuration = linux_configuration - self.secrets = secrets - - -class VirtualMachineScaleSetUpdatePublicIPAddressConfiguration(_serialization.Model): # pylint: disable=name-too-long - """Describes a virtual machines scale set IP Configuration's PublicIPAddress configuration. - - :ivar name: The publicIP address configuration name. - :vartype name: str - :ivar tags: Resource tags applied to the publicIP address created by this - PublicIPAddressConfiguration. - :vartype tags: dict[str, 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.models.VirtualMachineScaleSetPublicIPAddressConfigurationDnsSettings - :ivar public_ip_prefix: The PublicIPPrefix from which to allocate publicIP addresses. - :vartype public_ip_prefix: ~azure.mgmt.compute.models.SubResource - :ivar delete_option: Specify what happens to the public IP when the VM is deleted. Known values - are: "Delete" and "Detach". - :vartype delete_option: str or ~azure.mgmt.compute.models.DeleteOptions - """ - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "tags": {"key": "tags", "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, - tags: Optional[dict[str, str]] = None, - idle_timeout_in_minutes: Optional[int] = None, - dns_settings: Optional["_models.VirtualMachineScaleSetPublicIPAddressConfigurationDnsSettings"] = None, - public_ip_prefix: Optional["_models.SubResource"] = None, - delete_option: Optional[Union[str, "_models.DeleteOptions"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword name: The publicIP address configuration name. - :paramtype name: str - :keyword tags: Resource tags applied to the publicIP address created by this - PublicIPAddressConfiguration. - :paramtype tags: dict[str, 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.models.VirtualMachineScaleSetPublicIPAddressConfigurationDnsSettings - :keyword public_ip_prefix: The PublicIPPrefix from which to allocate publicIP addresses. - :paramtype public_ip_prefix: ~azure.mgmt.compute.models.SubResource - :keyword delete_option: Specify what happens to the public IP when the VM is deleted. Known - values are: "Delete" and "Detach". - :paramtype delete_option: str or ~azure.mgmt.compute.models.DeleteOptions - """ - super().__init__(**kwargs) - self.name = name - self.tags = tags - 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(_serialization.Model): # pylint: disable=name-too-long - """Describes a virtual machine scale set storage profile. - - :ivar image_reference: The image reference. - :vartype image_reference: ~azure.mgmt.compute.models.ImageReference - :ivar os_disk: The OS disk. - :vartype os_disk: ~azure.mgmt.compute.models.VirtualMachineScaleSetUpdateOSDisk - :ivar data_disks: The data disks. - :vartype data_disks: list[~azure.mgmt.compute.models.VirtualMachineScaleSetDataDisk] - :ivar disk_controller_type: Specifies the disk controller type configured for the virtual - machines in the scale set. **Note:** You need to deallocate the virtual machines in the scale - set before updating its disk controller type based on the upgrade mode configured for the scale - set. Minimum api-version: 2022-08-01. Known values are: "SCSI" and "NVMe". - :vartype disk_controller_type: str or ~azure.mgmt.compute.models.DiskControllerTypes - """ - - _attribute_map = { - "image_reference": {"key": "imageReference", "type": "ImageReference"}, - "os_disk": {"key": "osDisk", "type": "VirtualMachineScaleSetUpdateOSDisk"}, - "data_disks": {"key": "dataDisks", "type": "[VirtualMachineScaleSetDataDisk]"}, - "disk_controller_type": {"key": "diskControllerType", "type": "str"}, - } - - def __init__( - self, - *, - image_reference: Optional["_models.ImageReference"] = None, - os_disk: Optional["_models.VirtualMachineScaleSetUpdateOSDisk"] = None, - data_disks: Optional[list["_models.VirtualMachineScaleSetDataDisk"]] = None, - disk_controller_type: Optional[Union[str, "_models.DiskControllerTypes"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword image_reference: The image reference. - :paramtype image_reference: ~azure.mgmt.compute.models.ImageReference - :keyword os_disk: The OS disk. - :paramtype os_disk: ~azure.mgmt.compute.models.VirtualMachineScaleSetUpdateOSDisk - :keyword data_disks: The data disks. - :paramtype data_disks: list[~azure.mgmt.compute.models.VirtualMachineScaleSetDataDisk] - :keyword disk_controller_type: Specifies the disk controller type configured for the virtual - machines in the scale set. **Note:** You need to deallocate the virtual machines in the scale - set before updating its disk controller type based on the upgrade mode configured for the scale - set. Minimum api-version: 2022-08-01. Known values are: "SCSI" and "NVMe". - :paramtype disk_controller_type: str or ~azure.mgmt.compute.models.DiskControllerTypes - """ - super().__init__(**kwargs) - self.image_reference = image_reference - self.os_disk = os_disk - self.data_disks = data_disks - self.disk_controller_type = disk_controller_type - - -class VirtualMachineScaleSetUpdateVMProfile(_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.models.VirtualMachineScaleSetUpdateOSProfile - :ivar storage_profile: The virtual machine scale set storage profile. - :vartype storage_profile: ~azure.mgmt.compute.models.VirtualMachineScaleSetUpdateStorageProfile - :ivar network_profile: The virtual machine scale set network profile. - :vartype network_profile: ~azure.mgmt.compute.models.VirtualMachineScaleSetUpdateNetworkProfile - :ivar security_posture_reference: The virtual machine scale set security posture reference. - :vartype security_posture_reference: ~azure.mgmt.compute.models.SecurityPostureReferenceUpdate - :ivar security_profile: The virtual machine scale set Security profile. - :vartype security_profile: ~azure.mgmt.compute.models.SecurityProfile - :ivar diagnostics_profile: The virtual machine scale set diagnostics profile. - :vartype diagnostics_profile: ~azure.mgmt.compute.models.DiagnosticsProfile - :ivar extension_profile: The virtual machine scale set extension profile. - :vartype extension_profile: ~azure.mgmt.compute.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. Minimum - api-version: 2019-03-01. - :vartype billing_profile: ~azure.mgmt.compute.models.BillingProfile - :ivar scheduled_events_profile: Specifies Scheduled Event related configurations. - :vartype scheduled_events_profile: ~azure.mgmt.compute.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 hardware_profile: Specifies the hardware profile related details of a scale set. Minimum - api-version: 2021-11-01. - :vartype hardware_profile: ~azure.mgmt.compute.models.VirtualMachineScaleSetHardwareProfile - """ - - _attribute_map = { - "os_profile": {"key": "osProfile", "type": "VirtualMachineScaleSetUpdateOSProfile"}, - "storage_profile": {"key": "storageProfile", "type": "VirtualMachineScaleSetUpdateStorageProfile"}, - "network_profile": {"key": "networkProfile", "type": "VirtualMachineScaleSetUpdateNetworkProfile"}, - "security_posture_reference": {"key": "securityPostureReference", "type": "SecurityPostureReferenceUpdate"}, - "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"}, - "hardware_profile": {"key": "hardwareProfile", "type": "VirtualMachineScaleSetHardwareProfile"}, - } - - def __init__( - self, - *, - os_profile: Optional["_models.VirtualMachineScaleSetUpdateOSProfile"] = None, - storage_profile: Optional["_models.VirtualMachineScaleSetUpdateStorageProfile"] = None, - network_profile: Optional["_models.VirtualMachineScaleSetUpdateNetworkProfile"] = None, - security_posture_reference: Optional["_models.SecurityPostureReferenceUpdate"] = None, - security_profile: Optional["_models.SecurityProfile"] = None, - diagnostics_profile: Optional["_models.DiagnosticsProfile"] = None, - extension_profile: Optional["_models.VirtualMachineScaleSetExtensionProfile"] = None, - license_type: Optional[str] = None, - billing_profile: Optional["_models.BillingProfile"] = None, - scheduled_events_profile: Optional["_models.ScheduledEventsProfile"] = None, - user_data: Optional[str] = None, - hardware_profile: Optional["_models.VirtualMachineScaleSetHardwareProfile"] = None, - **kwargs: Any - ) -> None: - """ - :keyword os_profile: The virtual machine scale set OS profile. - :paramtype os_profile: ~azure.mgmt.compute.models.VirtualMachineScaleSetUpdateOSProfile - :keyword storage_profile: The virtual machine scale set storage profile. - :paramtype storage_profile: - ~azure.mgmt.compute.models.VirtualMachineScaleSetUpdateStorageProfile - :keyword network_profile: The virtual machine scale set network profile. - :paramtype network_profile: - ~azure.mgmt.compute.models.VirtualMachineScaleSetUpdateNetworkProfile - :keyword security_posture_reference: The virtual machine scale set security posture reference. - :paramtype security_posture_reference: - ~azure.mgmt.compute.models.SecurityPostureReferenceUpdate - :keyword security_profile: The virtual machine scale set Security profile. - :paramtype security_profile: ~azure.mgmt.compute.models.SecurityProfile - :keyword diagnostics_profile: The virtual machine scale set diagnostics profile. - :paramtype diagnostics_profile: ~azure.mgmt.compute.models.DiagnosticsProfile - :keyword extension_profile: The virtual machine scale set extension profile. - :paramtype extension_profile: ~azure.mgmt.compute.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. Minimum - api-version: 2019-03-01. - :paramtype billing_profile: ~azure.mgmt.compute.models.BillingProfile - :keyword scheduled_events_profile: Specifies Scheduled Event related configurations. - :paramtype scheduled_events_profile: ~azure.mgmt.compute.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 hardware_profile: Specifies the hardware profile related details of a scale set. - Minimum api-version: 2021-11-01. - :paramtype hardware_profile: ~azure.mgmt.compute.models.VirtualMachineScaleSetHardwareProfile - """ - super().__init__(**kwargs) - self.os_profile = os_profile - self.storage_profile = storage_profile - self.network_profile = network_profile - self.security_posture_reference = security_posture_reference - 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 - self.hardware_profile = hardware_profile - - -class VirtualMachineScaleSetVM(TrackedResource): - """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 server. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.compute.models.SystemData - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - :ivar location: The geo-location where the resource lives. Required. - :vartype location: str - :ivar instance_id: The virtual machine instance ID. - :vartype instance_id: str - :ivar sku: The virtual machine SKU. - :vartype sku: ~azure.mgmt.compute.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.models.Plan - :ivar resources: The virtual machine child extension resources. - :vartype resources: list[~azure.mgmt.compute.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.models.VirtualMachineIdentity - :ivar etag: Etag is property returned in Update/Get response of the VMSS VM, so that customer - can supply it in the header to ensure optimistic updates. - :vartype etag: str - :ivar latest_model_applied: Specifies whether the latest model has been applied to the virtual - machine. - :vartype latest_model_applied: bool - :ivar vm_id: Azure VM unique ID. - :vartype vm_id: str - :ivar instance_view: The virtual machine instance view. - :vartype instance_view: ~azure.mgmt.compute.models.VirtualMachineScaleSetVMInstanceView - :ivar hardware_profile: Specifies the hardware settings for the virtual machine. - :vartype hardware_profile: ~azure.mgmt.compute.models.HardwareProfile - :ivar resilient_vm_deletion_status: Specifies the resilient VM deletion status for the virtual - machine. Known values are: "Enabled", "Disabled", "InProgress", and "Failed". - :vartype resilient_vm_deletion_status: str or - ~azure.mgmt.compute.models.ResilientVMDeletionStatus - :ivar storage_profile: Specifies the storage settings for the virtual machine disks. - :vartype storage_profile: ~azure.mgmt.compute.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.models.AdditionalCapabilities - :ivar os_profile: Specifies the operating system settings for the virtual machine. - :vartype os_profile: ~azure.mgmt.compute.models.OSProfile - :ivar security_profile: Specifies the Security related profile settings for the virtual - machine. - :vartype security_profile: ~azure.mgmt.compute.models.SecurityProfile - :ivar network_profile: Specifies the network interfaces of the virtual machine. - :vartype network_profile: ~azure.mgmt.compute.models.NetworkProfile - :ivar network_profile_configuration: Specifies the network profile configuration of the virtual - machine. - :vartype network_profile_configuration: - ~azure.mgmt.compute.models.VirtualMachineScaleSetVMNetworkProfileConfiguration - :ivar diagnostics_profile: Specifies the boot diagnostic settings state. Minimum api-version: - 2015-06-15. - :vartype diagnostics_profile: ~azure.mgmt.compute.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 - `_. For more - information on Azure planned maintenance, see `Maintenance and updates for Virtual Machines in - Azure `_. 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.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.models.VirtualMachineScaleSetVMProtectionPolicy - :ivar user_data: UserData for the VM, which must be base-64 encoded. Customer should not pass - any secrets in here. Minimum api-version: 2021-03-01. - :vartype user_data: str - :ivar time_created: Specifies the time at which the Virtual Machine resource was created. - Minimum api-version: 2021-11-01. - :vartype time_created: ~datetime.datetime - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, - "location": {"required": True}, - "instance_id": {"readonly": True}, - "sku": {"readonly": True}, - "resources": {"readonly": True}, - "zones": {"readonly": True}, - "etag": {"readonly": True}, - "latest_model_applied": {"readonly": True}, - "vm_id": {"readonly": True}, - "instance_view": {"readonly": True}, - "provisioning_state": {"readonly": True}, - "model_definition_applied": {"readonly": True}, - "time_created": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - "tags": {"key": "tags", "type": "{str}"}, - "location": {"key": "location", "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"}, - "etag": {"key": "etag", "type": "str"}, - "latest_model_applied": {"key": "properties.latestModelApplied", "type": "bool"}, - "vm_id": {"key": "properties.vmId", "type": "str"}, - "instance_view": {"key": "properties.instanceView", "type": "VirtualMachineScaleSetVMInstanceView"}, - "hardware_profile": {"key": "properties.hardwareProfile", "type": "HardwareProfile"}, - "resilient_vm_deletion_status": {"key": "properties.resilientVMDeletionStatus", "type": "str"}, - "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"}, - "time_created": {"key": "properties.timeCreated", "type": "iso-8601"}, - } - - def __init__( # pylint: disable=too-many-locals - self, - *, - location: str, - tags: Optional[dict[str, str]] = None, - plan: Optional["_models.Plan"] = None, - identity: Optional["_models.VirtualMachineIdentity"] = None, - hardware_profile: Optional["_models.HardwareProfile"] = None, - resilient_vm_deletion_status: Optional[Union[str, "_models.ResilientVMDeletionStatus"]] = None, - storage_profile: Optional["_models.StorageProfile"] = None, - additional_capabilities: Optional["_models.AdditionalCapabilities"] = None, - os_profile: Optional["_models.OSProfile"] = None, - security_profile: Optional["_models.SecurityProfile"] = None, - network_profile: Optional["_models.NetworkProfile"] = None, - network_profile_configuration: Optional["_models.VirtualMachineScaleSetVMNetworkProfileConfiguration"] = None, - diagnostics_profile: Optional["_models.DiagnosticsProfile"] = None, - availability_set: Optional["_models.SubResource"] = None, - license_type: Optional[str] = None, - protection_policy: Optional["_models.VirtualMachineScaleSetVMProtectionPolicy"] = None, - user_data: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - :keyword location: The geo-location where the resource lives. Required. - :paramtype location: 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.models.Plan - :keyword identity: The identity of the virtual machine, if configured. - :paramtype identity: ~azure.mgmt.compute.models.VirtualMachineIdentity - :keyword hardware_profile: Specifies the hardware settings for the virtual machine. - :paramtype hardware_profile: ~azure.mgmt.compute.models.HardwareProfile - :keyword resilient_vm_deletion_status: Specifies the resilient VM deletion status for the - virtual machine. Known values are: "Enabled", "Disabled", "InProgress", and "Failed". - :paramtype resilient_vm_deletion_status: str or - ~azure.mgmt.compute.models.ResilientVMDeletionStatus - :keyword storage_profile: Specifies the storage settings for the virtual machine disks. - :paramtype storage_profile: ~azure.mgmt.compute.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.models.AdditionalCapabilities - :keyword os_profile: Specifies the operating system settings for the virtual machine. - :paramtype os_profile: ~azure.mgmt.compute.models.OSProfile - :keyword security_profile: Specifies the Security related profile settings for the virtual - machine. - :paramtype security_profile: ~azure.mgmt.compute.models.SecurityProfile - :keyword network_profile: Specifies the network interfaces of the virtual machine. - :paramtype network_profile: ~azure.mgmt.compute.models.NetworkProfile - :keyword network_profile_configuration: Specifies the network profile configuration of the - virtual machine. - :paramtype network_profile_configuration: - ~azure.mgmt.compute.models.VirtualMachineScaleSetVMNetworkProfileConfiguration - :keyword diagnostics_profile: Specifies the boot diagnostic settings state. Minimum - api-version: 2015-06-15. - :paramtype diagnostics_profile: ~azure.mgmt.compute.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 - `_. For more - information on Azure planned maintenance, see `Maintenance and updates for Virtual Machines in - Azure `_. 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.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.models.VirtualMachineScaleSetVMProtectionPolicy - :keyword user_data: UserData for the VM, which must be base-64 encoded. Customer should not - pass any secrets in here. Minimum api-version: 2021-03-01. - :paramtype user_data: str - """ - super().__init__(tags=tags, location=location, **kwargs) - self.instance_id: Optional[str] = None - self.sku: Optional["_models.Sku"] = None - self.plan = plan - self.resources: Optional[list["_models.VirtualMachineExtension"]] = None - self.zones: Optional[list[str]] = None - self.identity = identity - self.etag: Optional[str] = None - self.latest_model_applied: Optional[bool] = None - self.vm_id: Optional[str] = None - self.instance_view: Optional["_models.VirtualMachineScaleSetVMInstanceView"] = None - self.hardware_profile = hardware_profile - self.resilient_vm_deletion_status = resilient_vm_deletion_status - 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: Optional[str] = None - self.license_type = license_type - self.model_definition_applied: Optional[str] = None - self.protection_policy = protection_policy - self.user_data = user_data - self.time_created: Optional[datetime.datetime] = None - - -class VirtualMachineScaleSetVMExtension(SubResourceReadOnly): - """Describes a VMSS VM Extension. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Resource Id. - :vartype id: str - :ivar location: The location of the extension. - :vartype location: str - :ivar type: Resource type. - :vartype type: str - :ivar name: Resource name. - :vartype name: 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.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: ~azure.mgmt.compute.models.KeyVaultSecretReference - :ivar provision_after_extensions: Collection of extension names after which this extension - needs to be provisioned. - :vartype provision_after_extensions: list[str] - """ - - _validation = { - "id": {"readonly": True}, - "type": {"readonly": True}, - "name": {"readonly": True}, - "provisioning_state": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "location": {"key": "location", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "name": {"key": "name", "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": "KeyVaultSecretReference", - }, - "provision_after_extensions": {"key": "properties.provisionAfterExtensions", "type": "[str]"}, - } - - def __init__( - self, - *, - location: 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, - instance_view: Optional["_models.VirtualMachineExtensionInstanceView"] = None, - suppress_failures: Optional[bool] = None, - protected_settings_from_key_vault: Optional["_models.KeyVaultSecretReference"] = None, - provision_after_extensions: Optional[list[str]] = None, - **kwargs: Any - ) -> None: - """ - :keyword location: The location of the extension. - :paramtype location: 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.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: - ~azure.mgmt.compute.models.KeyVaultSecretReference - :keyword provision_after_extensions: Collection of extension names after which this extension - needs to be provisioned. - :paramtype provision_after_extensions: list[str] - """ - super().__init__(**kwargs) - self.location = location - self.type: Optional[str] = None - self.name: Optional[str] = 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: Optional[str] = None - self.instance_view = instance_view - self.suppress_failures = suppress_failures - self.protected_settings_from_key_vault = protected_settings_from_key_vault - self.provision_after_extensions = provision_after_extensions - - -class VirtualMachineScaleSetVMExtensionsListResult(_serialization.Model): # pylint: disable=name-too-long - """The List VMSS VM Extension operation response. - - :ivar value: The list of VMSS VM extensions. - :vartype value: list[~azure.mgmt.compute.models.VirtualMachineScaleSetVMExtension] - """ - - _attribute_map = { - "value": {"key": "value", "type": "[VirtualMachineScaleSetVMExtension]"}, - } - - def __init__( - self, *, value: Optional[list["_models.VirtualMachineScaleSetVMExtension"]] = None, **kwargs: Any - ) -> None: - """ - :keyword value: The list of VMSS VM extensions. - :paramtype value: list[~azure.mgmt.compute.models.VirtualMachineScaleSetVMExtension] - """ - super().__init__(**kwargs) - self.value = value - - -class VirtualMachineScaleSetVMExtensionsSummary(_serialization.Model): # pylint: disable=name-too-long - """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.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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.name: Optional[str] = None - self.statuses_summary: Optional[list["_models.VirtualMachineStatusCodeCount"]] = 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: ~azure.mgmt.compute.models.KeyVaultSecretReference - """ - - _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": "KeyVaultSecretReference", - }, - } - - 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["_models.KeyVaultSecretReference"] = None, - **kwargs: Any - ) -> None: - """ - :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: - ~azure.mgmt.compute.models.KeyVaultSecretReference - """ - super().__init__(**kwargs) - self.name: Optional[str] = None - self.type: Optional[str] = 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(_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: Any) -> None: - """ - :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().__init__(**kwargs) - self.instance_ids = instance_ids - - -class VirtualMachineScaleSetVMInstanceRequiredIDs(_serialization.Model): # pylint: disable=name-too-long - """Specifies a list of virtual machine instance IDs from the VM scale set. - - All required parameters must be populated in order to send to server. - - :ivar instance_ids: The virtual machine scale set instance ids. Required. - :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: Any) -> None: - """ - :keyword instance_ids: The virtual machine scale set instance ids. Required. - :paramtype instance_ids: list[str] - """ - super().__init__(**kwargs) - self.instance_ids = instance_ids - - -class VirtualMachineScaleSetVMInstanceView(_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.models.VirtualMachineAgentInstanceView - :ivar maintenance_redeploy_status: The Maintenance Operation status on the virtual machine. - :vartype maintenance_redeploy_status: ~azure.mgmt.compute.models.MaintenanceRedeployStatus - :ivar disks: The disks information. - :vartype disks: list[~azure.mgmt.compute.models.DiskInstanceView] - :ivar extensions: The extensions information. - :vartype extensions: list[~azure.mgmt.compute.models.VirtualMachineExtensionInstanceView] - :ivar vm_health: The health status for the VM. - :vartype vm_health: ~azure.mgmt.compute.models.VirtualMachineHealthStatus - :ivar boot_diagnostics: Boot Diagnostics is a debugging feature which allows you to view - Console Output and Screenshot to diagnose VM status. You can easily view the output of your - console log. Azure also enables you to see a screenshot of the VM from the hypervisor. - :vartype boot_diagnostics: ~azure.mgmt.compute.models.BootDiagnosticsInstanceView - :ivar statuses: The resource status information. - :vartype statuses: list[~azure.mgmt.compute.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. 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 - :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 os_name: The Operating System running on the hybrid machine. - :vartype os_name: str - :ivar os_version: The version of Operating System running on the hybrid machine. - :vartype os_version: str - :ivar hyper_v_generation: The hypervisor generation of the Virtual Machine [V1, V2]. Known - values are: "V1" and "V2". - :vartype hyper_v_generation: str or ~azure.mgmt.compute.models.HyperVGeneration - """ - - _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"}, - "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"}, - } - - def __init__( - self, - *, - platform_update_domain: Optional[int] = None, - platform_fault_domain: Optional[int] = None, - rdp_thumb_print: Optional[str] = None, - vm_agent: Optional["_models.VirtualMachineAgentInstanceView"] = None, - maintenance_redeploy_status: Optional["_models.MaintenanceRedeployStatus"] = None, - disks: Optional[list["_models.DiskInstanceView"]] = None, - extensions: Optional[list["_models.VirtualMachineExtensionInstanceView"]] = None, - boot_diagnostics: Optional["_models.BootDiagnosticsInstanceView"] = None, - statuses: Optional[list["_models.InstanceViewStatus"]] = None, - placement_group_id: Optional[str] = None, - computer_name: Optional[str] = None, - os_name: Optional[str] = None, - os_version: Optional[str] = None, - hyper_v_generation: Optional[Union[str, "_models.HyperVGeneration"]] = None, - **kwargs: Any - ) -> None: - """ - :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.models.VirtualMachineAgentInstanceView - :keyword maintenance_redeploy_status: The Maintenance Operation status on the virtual machine. - :paramtype maintenance_redeploy_status: ~azure.mgmt.compute.models.MaintenanceRedeployStatus - :keyword disks: The disks information. - :paramtype disks: list[~azure.mgmt.compute.models.DiskInstanceView] - :keyword extensions: The extensions information. - :paramtype extensions: list[~azure.mgmt.compute.models.VirtualMachineExtensionInstanceView] - :keyword boot_diagnostics: Boot Diagnostics is a debugging feature which allows you to view - Console Output and Screenshot to diagnose VM status. You can easily view the output of your - console log. Azure also enables you to see a screenshot of the VM from the hypervisor. - :paramtype boot_diagnostics: ~azure.mgmt.compute.models.BootDiagnosticsInstanceView - :keyword statuses: The resource status information. - :paramtype statuses: list[~azure.mgmt.compute.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 - :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 os_name: The Operating System running on the hybrid machine. - :paramtype os_name: str - :keyword os_version: The version of Operating System running on the hybrid machine. - :paramtype os_version: str - :keyword hyper_v_generation: The hypervisor generation of the Virtual Machine [V1, V2]. Known - values are: "V1" and "V2". - :paramtype hyper_v_generation: str or ~azure.mgmt.compute.models.HyperVGeneration - """ - super().__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: Optional["_models.VirtualMachineHealthStatus"] = None - self.boot_diagnostics = boot_diagnostics - self.statuses = statuses - self.assigned_host: Optional[str] = None - self.placement_group_id = placement_group_id - self.computer_name = computer_name - self.os_name = os_name - self.os_version = os_version - self.hyper_v_generation = hyper_v_generation - - -class VirtualMachineScaleSetVMListResult(_serialization.Model): - """The List Virtual Machine Scale Set VMs operation response. - - All required parameters must be populated in order to send to server. - - :ivar value: The list of virtual machine scale sets VMs. Required. - :vartype value: list[~azure.mgmt.compute.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["_models.VirtualMachineScaleSetVM"], next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: The list of virtual machine scale sets VMs. Required. - :paramtype value: list[~azure.mgmt.compute.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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class VirtualMachineScaleSetVMNetworkProfileConfiguration(_serialization.Model): # pylint: disable=name-too-long - """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.models.VirtualMachineScaleSetNetworkConfiguration] - """ - - _attribute_map = { - "network_interface_configurations": { - "key": "networkInterfaceConfigurations", - "type": "[VirtualMachineScaleSetNetworkConfiguration]", - }, - } - - def __init__( - self, - *, - network_interface_configurations: Optional[list["_models.VirtualMachineScaleSetNetworkConfiguration"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword network_interface_configurations: The list of network configurations. - :paramtype network_interface_configurations: - list[~azure.mgmt.compute.models.VirtualMachineScaleSetNetworkConfiguration] - """ - super().__init__(**kwargs) - self.network_interface_configurations = network_interface_configurations - - -class VirtualMachineScaleSetVMProfile(_serialization.Model): - """Describes a virtual machine scale set virtual machine profile. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar os_profile: Specifies the operating system settings for the virtual machines in the scale - set. - :vartype os_profile: ~azure.mgmt.compute.models.VirtualMachineScaleSetOSProfile - :ivar storage_profile: Specifies the storage settings for the virtual machine disks. - :vartype storage_profile: ~azure.mgmt.compute.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.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.models.SecurityProfile - :ivar diagnostics_profile: Specifies the boot diagnostic settings state. Minimum api-version: - 2015-06-15. - :vartype diagnostics_profile: ~azure.mgmt.compute.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.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. Minimum - api-version: 2017-10-30-preview. Known values are: "Regular", "Low", and "Spot". - :vartype priority: str or ~azure.mgmt.compute.models.VirtualMachinePriorityTypes - :ivar eviction_policy: Specifies the eviction policy for the Azure Spot virtual machine and - Azure Spot scale set. For Azure Spot virtual machines, both 'Deallocate' and 'Delete' are - supported and the minimum api-version is 2019-03-01. For Azure Spot scale sets, both - 'Deallocate' and 'Delete' are supported and the minimum api-version is 2017-10-30-preview. - Known values are: "Deallocate" and "Delete". - :vartype eviction_policy: str or ~azure.mgmt.compute.models.VirtualMachineEvictionPolicyTypes - :ivar billing_profile: Specifies the billing related details of a Azure Spot VMSS. Minimum - api-version: 2019-03-01. - :vartype billing_profile: ~azure.mgmt.compute.models.BillingProfile - :ivar scheduled_events_profile: Specifies Scheduled Event related configurations. - :vartype scheduled_events_profile: ~azure.mgmt.compute.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. Minimum api-version: 2021-03-01. - :vartype user_data: str - :ivar capacity_reservation: Specifies the capacity reservation related details of a scale set. - Minimum api-version: 2021-04-01. - :vartype capacity_reservation: ~azure.mgmt.compute.models.CapacityReservationProfile - :ivar application_profile: Specifies the gallery applications that should be made available to - the VM/VMSS. - :vartype application_profile: ~azure.mgmt.compute.models.ApplicationProfile - :ivar hardware_profile: Specifies the hardware profile related details of a scale set. Minimum - api-version: 2021-11-01. - :vartype hardware_profile: ~azure.mgmt.compute.models.VirtualMachineScaleSetHardwareProfile - :ivar service_artifact_reference: Specifies the service artifact reference id used to set same - image version for all virtual machines in the scale set when using 'latest' image version. - Minimum api-version: 2022-11-01. - :vartype service_artifact_reference: ~azure.mgmt.compute.models.ServiceArtifactReference - :ivar security_posture_reference: Specifies the security posture to be used in the scale set. - Minimum api-version: 2023-03-01. - :vartype security_posture_reference: ~azure.mgmt.compute.models.SecurityPostureReference - :ivar time_created: Specifies the time in which this VM profile for the Virtual Machine Scale - Set was created. This value will be added to VMSS Flex VM tags when creating/updating the VMSS - VM Profile. Minimum API version for this property is 2023-09-01. - :vartype time_created: ~datetime.datetime - """ - - _validation = { - "time_created": {"readonly": True}, - } - - _attribute_map = { - "os_profile": {"key": "osProfile", "type": "VirtualMachineScaleSetOSProfile"}, - "storage_profile": {"key": "storageProfile", "type": "VirtualMachineScaleSetStorageProfile"}, - "network_profile": {"key": "networkProfile", "type": "VirtualMachineScaleSetNetworkProfile"}, - "security_profile": {"key": "securityProfile", "type": "SecurityProfile"}, - "diagnostics_profile": {"key": "diagnosticsProfile", "type": "DiagnosticsProfile"}, - "extension_profile": {"key": "extensionProfile", "type": "VirtualMachineScaleSetExtensionProfile"}, - "license_type": {"key": "licenseType", "type": "str"}, - "priority": {"key": "priority", "type": "str"}, - "eviction_policy": {"key": "evictionPolicy", "type": "str"}, - "billing_profile": {"key": "billingProfile", "type": "BillingProfile"}, - "scheduled_events_profile": {"key": "scheduledEventsProfile", "type": "ScheduledEventsProfile"}, - "user_data": {"key": "userData", "type": "str"}, - "capacity_reservation": {"key": "capacityReservation", "type": "CapacityReservationProfile"}, - "application_profile": {"key": "applicationProfile", "type": "ApplicationProfile"}, - "hardware_profile": {"key": "hardwareProfile", "type": "VirtualMachineScaleSetHardwareProfile"}, - "service_artifact_reference": {"key": "serviceArtifactReference", "type": "ServiceArtifactReference"}, - "security_posture_reference": {"key": "securityPostureReference", "type": "SecurityPostureReference"}, - "time_created": {"key": "timeCreated", "type": "iso-8601"}, - } - - def __init__( - self, - *, - os_profile: Optional["_models.VirtualMachineScaleSetOSProfile"] = None, - storage_profile: Optional["_models.VirtualMachineScaleSetStorageProfile"] = None, - network_profile: Optional["_models.VirtualMachineScaleSetNetworkProfile"] = None, - security_profile: Optional["_models.SecurityProfile"] = None, - diagnostics_profile: Optional["_models.DiagnosticsProfile"] = None, - extension_profile: Optional["_models.VirtualMachineScaleSetExtensionProfile"] = None, - license_type: Optional[str] = None, - priority: Optional[Union[str, "_models.VirtualMachinePriorityTypes"]] = None, - eviction_policy: Optional[Union[str, "_models.VirtualMachineEvictionPolicyTypes"]] = None, - billing_profile: Optional["_models.BillingProfile"] = None, - scheduled_events_profile: Optional["_models.ScheduledEventsProfile"] = None, - user_data: Optional[str] = None, - capacity_reservation: Optional["_models.CapacityReservationProfile"] = None, - application_profile: Optional["_models.ApplicationProfile"] = None, - hardware_profile: Optional["_models.VirtualMachineScaleSetHardwareProfile"] = None, - service_artifact_reference: Optional["_models.ServiceArtifactReference"] = None, - security_posture_reference: Optional["_models.SecurityPostureReference"] = None, - **kwargs: Any - ) -> None: - """ - :keyword os_profile: Specifies the operating system settings for the virtual machines in the - scale set. - :paramtype os_profile: ~azure.mgmt.compute.models.VirtualMachineScaleSetOSProfile - :keyword storage_profile: Specifies the storage settings for the virtual machine disks. - :paramtype storage_profile: ~azure.mgmt.compute.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.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.models.SecurityProfile - :keyword diagnostics_profile: Specifies the boot diagnostic settings state. Minimum - api-version: 2015-06-15. - :paramtype diagnostics_profile: ~azure.mgmt.compute.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.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. Minimum - api-version: 2017-10-30-preview. Known values are: "Regular", "Low", and "Spot". - :paramtype priority: str or ~azure.mgmt.compute.models.VirtualMachinePriorityTypes - :keyword eviction_policy: Specifies the eviction policy for the Azure Spot virtual machine and - Azure Spot scale set. For Azure Spot virtual machines, both 'Deallocate' and 'Delete' are - supported and the minimum api-version is 2019-03-01. For Azure Spot scale sets, both - 'Deallocate' and 'Delete' are supported and the minimum api-version is 2017-10-30-preview. - Known values are: "Deallocate" and "Delete". - :paramtype eviction_policy: str or ~azure.mgmt.compute.models.VirtualMachineEvictionPolicyTypes - :keyword billing_profile: Specifies the billing related details of a Azure Spot VMSS. Minimum - api-version: 2019-03-01. - :paramtype billing_profile: ~azure.mgmt.compute.models.BillingProfile - :keyword scheduled_events_profile: Specifies Scheduled Event related configurations. - :paramtype scheduled_events_profile: ~azure.mgmt.compute.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. Minimum api-version: 2021-03-01. - :paramtype user_data: str - :keyword capacity_reservation: Specifies the capacity reservation related details of a scale - set. Minimum api-version: 2021-04-01. - :paramtype capacity_reservation: ~azure.mgmt.compute.models.CapacityReservationProfile - :keyword application_profile: Specifies the gallery applications that should be made available - to the VM/VMSS. - :paramtype application_profile: ~azure.mgmt.compute.models.ApplicationProfile - :keyword hardware_profile: Specifies the hardware profile related details of a scale set. - Minimum api-version: 2021-11-01. - :paramtype hardware_profile: ~azure.mgmt.compute.models.VirtualMachineScaleSetHardwareProfile - :keyword service_artifact_reference: Specifies the service artifact reference id used to set - same image version for all virtual machines in the scale set when using 'latest' image version. - Minimum api-version: 2022-11-01. - :paramtype service_artifact_reference: ~azure.mgmt.compute.models.ServiceArtifactReference - :keyword security_posture_reference: Specifies the security posture to be used in the scale - set. Minimum api-version: 2023-03-01. - :paramtype security_posture_reference: ~azure.mgmt.compute.models.SecurityPostureReference - """ - super().__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 - self.service_artifact_reference = service_artifact_reference - self.security_posture_reference = security_posture_reference - self.time_created: Optional[datetime.datetime] = None - - -class VirtualMachineScaleSetVMProtectionPolicy(_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: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.protect_from_scale_in = protect_from_scale_in - self.protect_from_scale_set_actions = protect_from_scale_set_actions - - -class VirtualMachineSize(_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: Any - ) -> None: - """ - :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().__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(_serialization.Model): - """The List Virtual Machine operation response. - - :ivar value: The list of virtual machine sizes. - :vartype value: list[~azure.mgmt.compute.models.VirtualMachineSize] - :ivar next_link: The link to the next page of items. - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[VirtualMachineSize]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, - *, - value: Optional[list["_models.VirtualMachineSize"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: The list of virtual machine sizes. - :paramtype value: list[~azure.mgmt.compute.models.VirtualMachineSize] - :keyword next_link: The link to the next page of items. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class VirtualMachineSoftwarePatchProperties(_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. Known values are: - "Unknown", "NeverReboots", "AlwaysRequiresReboot", and "CanRequestReboot". - :vartype reboot_behavior: str or ~azure.mgmt.compute.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. Known values are: - "Unknown" and "Available". - :vartype assessment_state: str or ~azure.mgmt.compute.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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.patch_id: Optional[str] = None - self.name: Optional[str] = None - self.version: Optional[str] = None - self.kb_id: Optional[str] = None - self.classifications: Optional[list[str]] = None - self.reboot_behavior: Optional[Union[str, "_models.VMGuestPatchRebootBehavior"]] = None - self.activity_id: Optional[str] = None - self.published_date: Optional[datetime.datetime] = None - self.last_modified_date_time: Optional[datetime.datetime] = None - self.assessment_state: Optional[Union[str, "_models.PatchAssessmentState"]] = None - - -class VirtualMachineStatusCodeCount(_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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.code: Optional[str] = None - self.count: Optional[int] = 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: 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.models.Plan - :ivar identity: The identity of the virtual machine, if configured. - :vartype identity: ~azure.mgmt.compute.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.models.HardwareProfile - :ivar scheduled_events_policy: Specifies Redeploy, Reboot and - ScheduledEventsAdditionalPublishingTargets Scheduled Event related configurations for the - virtual machine. - :vartype scheduled_events_policy: ~azure.mgmt.compute.models.ScheduledEventsPolicy - :ivar storage_profile: Specifies the storage settings for the virtual machine disks. - :vartype storage_profile: ~azure.mgmt.compute.models.StorageProfile - :ivar additional_capabilities: Specifies additional capabilities enabled or disabled on the - virtual machine. - :vartype additional_capabilities: ~azure.mgmt.compute.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.models.OSProfile - :ivar network_profile: Specifies the network interfaces of the virtual machine. - :vartype network_profile: ~azure.mgmt.compute.models.NetworkProfile - :ivar security_profile: Specifies the Security related profile settings for the virtual - machine. - :vartype security_profile: ~azure.mgmt.compute.models.SecurityProfile - :ivar diagnostics_profile: Specifies the boot diagnostic settings state. Minimum api-version: - 2015-06-15. - :vartype diagnostics_profile: ~azure.mgmt.compute.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 - `_. For more - information on Azure planned maintenance, see `Maintenance and updates for Virtual Machines in - Azure `_. 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. This property cannot exist along with a - non-null properties.virtualMachineScaleSet reference. - :vartype availability_set: ~azure.mgmt.compute.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. This property cannot exist along with a non-null - properties.availabilitySet reference. Minimum api‐version: 2019‐03‐01. - :vartype virtual_machine_scale_set: ~azure.mgmt.compute.models.SubResource - :ivar proximity_placement_group: Specifies information about the proximity placement group that - the virtual machine should be assigned to. Minimum api-version: 2018-04-01. - :vartype proximity_placement_group: ~azure.mgmt.compute.models.SubResource - :ivar priority: Specifies the priority for the virtual machine. Minimum api-version: - 2019-03-01. Known values are: "Regular", "Low", and "Spot". - :vartype priority: str or ~azure.mgmt.compute.models.VirtualMachinePriorityTypes - :ivar eviction_policy: Specifies the eviction policy for the Azure Spot virtual machine and - Azure Spot scale set. For Azure Spot virtual machines, both 'Deallocate' and 'Delete' are - supported and the minimum api-version is 2019-03-01. For Azure Spot scale sets, both - 'Deallocate' and 'Delete' are supported and the minimum api-version is 2017-10-30-preview. - Known values are: "Deallocate" and "Delete". - :vartype eviction_policy: str or ~azure.mgmt.compute.models.VirtualMachineEvictionPolicyTypes - :ivar billing_profile: Specifies the billing related details of a Azure Spot virtual machine. - Minimum api-version: 2019-03-01. - :vartype billing_profile: ~azure.mgmt.compute.models.BillingProfile - :ivar host: Specifies information about the dedicated host that the virtual machine resides in. - Minimum api-version: 2018-10-01. - :vartype host: ~azure.mgmt.compute.models.SubResource - :ivar host_group: Specifies information about the dedicated host group that the virtual machine - resides in. **Note:** User cannot specify both host and hostGroup properties. Minimum - api-version: 2020-06-01. - :vartype host_group: ~azure.mgmt.compute.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.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). 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. This is - applicable only if the 'virtualMachineScaleSet' property of this Virtual Machine is set. The - Virtual Machine Scale Set that is referenced, must have 'platformFaultDomainCount' greater than - 1. This property cannot be updated once the Virtual Machine is created. Fault domain assignment - can be viewed in the Virtual Machine Instance View. 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.models.ScheduledEventsProfile - :ivar user_data: UserData for the VM, which must be base-64 encoded. Customer should not pass - any secrets in here. 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. Minimum api-version: 2021-04-01. - :vartype capacity_reservation: ~azure.mgmt.compute.models.CapacityReservationProfile - :ivar application_profile: Specifies the gallery applications that should be made available to - the VM/VMSS. - :vartype application_profile: ~azure.mgmt.compute.models.ApplicationProfile - :ivar time_created: Specifies the time at which the Virtual Machine resource was created. - Minimum api-version: 2021-11-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"}, - "scheduled_events_policy": {"key": "properties.scheduledEventsPolicy", "type": "ScheduledEventsPolicy"}, - "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__( # pylint: disable=too-many-locals - self, - *, - tags: Optional[dict[str, str]] = None, - plan: Optional["_models.Plan"] = None, - identity: Optional["_models.VirtualMachineIdentity"] = None, - zones: Optional[list[str]] = None, - hardware_profile: Optional["_models.HardwareProfile"] = None, - scheduled_events_policy: Optional["_models.ScheduledEventsPolicy"] = None, - storage_profile: Optional["_models.StorageProfile"] = None, - additional_capabilities: Optional["_models.AdditionalCapabilities"] = None, - os_profile: Optional["_models.OSProfile"] = None, - network_profile: Optional["_models.NetworkProfile"] = None, - security_profile: Optional["_models.SecurityProfile"] = None, - diagnostics_profile: Optional["_models.DiagnosticsProfile"] = None, - availability_set: Optional["_models.SubResource"] = None, - virtual_machine_scale_set: Optional["_models.SubResource"] = None, - proximity_placement_group: Optional["_models.SubResource"] = None, - priority: Optional[Union[str, "_models.VirtualMachinePriorityTypes"]] = None, - eviction_policy: Optional[Union[str, "_models.VirtualMachineEvictionPolicyTypes"]] = None, - billing_profile: Optional["_models.BillingProfile"] = None, - host: Optional["_models.SubResource"] = None, - host_group: Optional["_models.SubResource"] = None, - license_type: Optional[str] = None, - extensions_time_budget: Optional[str] = None, - platform_fault_domain: Optional[int] = None, - scheduled_events_profile: Optional["_models.ScheduledEventsProfile"] = None, - user_data: Optional[str] = None, - capacity_reservation: Optional["_models.CapacityReservationProfile"] = None, - application_profile: Optional["_models.ApplicationProfile"] = None, - **kwargs: Any - ) -> None: - """ - :keyword 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.models.Plan - :keyword identity: The identity of the virtual machine, if configured. - :paramtype identity: ~azure.mgmt.compute.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.models.HardwareProfile - :keyword scheduled_events_policy: Specifies Redeploy, Reboot and - ScheduledEventsAdditionalPublishingTargets Scheduled Event related configurations for the - virtual machine. - :paramtype scheduled_events_policy: ~azure.mgmt.compute.models.ScheduledEventsPolicy - :keyword storage_profile: Specifies the storage settings for the virtual machine disks. - :paramtype storage_profile: ~azure.mgmt.compute.models.StorageProfile - :keyword additional_capabilities: Specifies additional capabilities enabled or disabled on the - virtual machine. - :paramtype additional_capabilities: ~azure.mgmt.compute.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.models.OSProfile - :keyword network_profile: Specifies the network interfaces of the virtual machine. - :paramtype network_profile: ~azure.mgmt.compute.models.NetworkProfile - :keyword security_profile: Specifies the Security related profile settings for the virtual - machine. - :paramtype security_profile: ~azure.mgmt.compute.models.SecurityProfile - :keyword diagnostics_profile: Specifies the boot diagnostic settings state. Minimum - api-version: 2015-06-15. - :paramtype diagnostics_profile: ~azure.mgmt.compute.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 - `_. For more - information on Azure planned maintenance, see `Maintenance and updates for Virtual Machines in - Azure `_. 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. This property cannot exist along with a - non-null properties.virtualMachineScaleSet reference. - :paramtype availability_set: ~azure.mgmt.compute.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. This property cannot exist along with a non-null - properties.availabilitySet reference. Minimum api‐version: 2019‐03‐01. - :paramtype virtual_machine_scale_set: ~azure.mgmt.compute.models.SubResource - :keyword proximity_placement_group: Specifies information about the proximity placement group - that the virtual machine should be assigned to. Minimum api-version: 2018-04-01. - :paramtype proximity_placement_group: ~azure.mgmt.compute.models.SubResource - :keyword priority: Specifies the priority for the virtual machine. Minimum api-version: - 2019-03-01. Known values are: "Regular", "Low", and "Spot". - :paramtype priority: str or ~azure.mgmt.compute.models.VirtualMachinePriorityTypes - :keyword eviction_policy: Specifies the eviction policy for the Azure Spot virtual machine and - Azure Spot scale set. For Azure Spot virtual machines, both 'Deallocate' and 'Delete' are - supported and the minimum api-version is 2019-03-01. For Azure Spot scale sets, both - 'Deallocate' and 'Delete' are supported and the minimum api-version is 2017-10-30-preview. - Known values are: "Deallocate" and "Delete". - :paramtype eviction_policy: str or ~azure.mgmt.compute.models.VirtualMachineEvictionPolicyTypes - :keyword billing_profile: Specifies the billing related details of a Azure Spot virtual - machine. Minimum api-version: 2019-03-01. - :paramtype billing_profile: ~azure.mgmt.compute.models.BillingProfile - :keyword host: Specifies information about the dedicated host that the virtual machine resides - in. Minimum api-version: 2018-10-01. - :paramtype host: ~azure.mgmt.compute.models.SubResource - :keyword host_group: Specifies information about the dedicated host group that the virtual - machine resides in. **Note:** User cannot specify both host and hostGroup properties. Minimum - api-version: 2020-06-01. - :paramtype host_group: ~azure.mgmt.compute.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). 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. This is - applicable only if the 'virtualMachineScaleSet' property of this Virtual Machine is set. The - Virtual Machine Scale Set that is referenced, must have 'platformFaultDomainCount' greater than - 1. This property cannot be updated once the Virtual Machine is created. Fault domain assignment - can be viewed in the Virtual Machine Instance View. 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.models.ScheduledEventsProfile - :keyword user_data: UserData for the VM, which must be base-64 encoded. Customer should not - pass any secrets in here. 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. Minimum api-version: 2021-04-01. - :paramtype capacity_reservation: ~azure.mgmt.compute.models.CapacityReservationProfile - :keyword application_profile: Specifies the gallery applications that should be made available - to the VM/VMSS. - :paramtype application_profile: ~azure.mgmt.compute.models.ApplicationProfile - """ - super().__init__(tags=tags, **kwargs) - self.plan = plan - self.identity = identity - self.zones = zones - self.hardware_profile = hardware_profile - self.scheduled_events_policy = scheduled_events_policy - 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: Optional[str] = None - self.instance_view: Optional["_models.VirtualMachineInstanceView"] = None - self.license_type = license_type - self.vm_id: Optional[str] = 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: Optional[datetime.datetime] = None - - -class VMDiskSecurityProfile(_serialization.Model): - """Specifies the security profile settings for the managed disk. **Note:** It can only be set for - Confidential VMs. - - :ivar security_encryption_type: Specifies the EncryptionType of the managed disk. It is set to - DiskWithVMGuestState for encryption of the managed disk along with VMGuestState blob, - VMGuestStateOnly for encryption of just the VMGuestState blob, and NonPersistedTPM for not - persisting firmware state in the VMGuestState blob.. **Note:** It can be set for only - Confidential VMs. Known values are: "VMGuestStateOnly", "DiskWithVMGuestState", and - "NonPersistedTPM". - :vartype security_encryption_type: str or ~azure.mgmt.compute.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.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, "_models.SecurityEncryptionTypes"]] = None, - disk_encryption_set: Optional["_models.DiskEncryptionSetParameters"] = None, - **kwargs: Any - ) -> None: - """ - :keyword security_encryption_type: Specifies the EncryptionType of the managed disk. It is set - to DiskWithVMGuestState for encryption of the managed disk along with VMGuestState blob, - VMGuestStateOnly for encryption of just the VMGuestState blob, and NonPersistedTPM for not - persisting firmware state in the VMGuestState blob.. **Note:** It can be set for only - Confidential VMs. Known values are: "VMGuestStateOnly", "DiskWithVMGuestState", and - "NonPersistedTPM". - :paramtype security_encryption_type: str or ~azure.mgmt.compute.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.models.DiskEncryptionSetParameters - """ - super().__init__(**kwargs) - self.security_encryption_type = security_encryption_type - self.disk_encryption_set = disk_encryption_set - - -class VMGalleryApplication(_serialization.Model): - """Specifies the required information to reference a compute gallery application version. - - All required parameters must be populated in order to send to server. - - :ivar 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: Specifies the GalleryApplicationVersion resource id on the form of - /subscriptions/{SubscriptionId}/resourceGroups/{ResourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{application}/versions/{version}. - Required. - :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: Any - ) -> None: - """ - :keyword 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: Specifies the GalleryApplicationVersion resource id on the form - of - /subscriptions/{SubscriptionId}/resourceGroups/{ResourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{application}/versions/{version}. - Required. - :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().__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 VmImagesInEdgeZoneListResult(_serialization.Model): - """The List VmImages in EdgeZone operation response. - - :ivar value: The list of VMImages in EdgeZone. - :vartype value: list[~azure.mgmt.compute.models.VirtualMachineImageResource] - :ivar next_link: The URI to fetch the next page of VMImages in EdgeZone. Call ListNext() with - this URI to fetch the next page of VmImages. - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[VirtualMachineImageResource]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, - *, - value: Optional[list["_models.VirtualMachineImageResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: The list of VMImages in EdgeZone. - :paramtype value: list[~azure.mgmt.compute.models.VirtualMachineImageResource] - :keyword next_link: The URI to fetch the next page of VMImages in EdgeZone. Call ListNext() - with this URI to fetch the next page of VmImages. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class VMScaleSetConvertToSinglePlacementGroupInput(_serialization.Model): # pylint: disable=name-too-long - """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: Any) -> None: - """ - :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().__init__(**kwargs) - self.active_placement_group_id = active_placement_group_id - - -class VMScaleSetScaleOutInput(_serialization.Model): - """The input for ScaleOut. - - All required parameters must be populated in order to send to server. - - :ivar capacity: Specifies the number of virtual machines in the scale set. Required. - :vartype capacity: int - :ivar properties: The input properties for ScaleOut. - :vartype properties: ~azure.mgmt.compute.models.VMScaleSetScaleOutInputProperties - """ - - _validation = { - "capacity": {"required": True}, - } - - _attribute_map = { - "capacity": {"key": "capacity", "type": "int"}, - "properties": {"key": "properties", "type": "VMScaleSetScaleOutInputProperties"}, - } - - def __init__( - self, *, capacity: int, properties: Optional["_models.VMScaleSetScaleOutInputProperties"] = None, **kwargs: Any - ) -> None: - """ - :keyword capacity: Specifies the number of virtual machines in the scale set. Required. - :paramtype capacity: int - :keyword properties: The input properties for ScaleOut. - :paramtype properties: ~azure.mgmt.compute.models.VMScaleSetScaleOutInputProperties - """ - super().__init__(**kwargs) - self.capacity = capacity - self.properties = properties - - -class VMScaleSetScaleOutInputProperties(_serialization.Model): - """The input properties for ScaleOut. - - :ivar zone: The zone in which the scale out is requested for the virtual machine scale set. - :vartype zone: str - """ - - _attribute_map = { - "zone": {"key": "zone", "type": "str"}, - } - - def __init__(self, *, zone: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword zone: The zone in which the scale out is requested for the virtual machine scale set. - :paramtype zone: str - """ - super().__init__(**kwargs) - self.zone = zone - - -class VMSizeProperties(_serialization.Model): - """Specifies VM Size Property settings on the virtual machine. - - :ivar v_cpus_available: Specifies the number of vCPUs available for the VM. 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. 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 - `_. **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: Any - ) -> None: - """ - :keyword v_cpus_available: Specifies the number of vCPUs available for the VM. 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. 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 - `_. **Setting this - property to 1 also means that hyper-threading is disabled.**. - :paramtype v_cpus_per_core: int - """ - super().__init__(**kwargs) - self.v_cpus_available = v_cpus_available - self.v_cpus_per_core = v_cpus_per_core - - -class WindowsConfiguration(_serialization.Model): - """Specifies Windows operating system settings on the virtual machine. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar provision_vm_agent: Indicates whether virtual machine agent should be provisioned on the - virtual machine. When this property is not specified in the request body, it is set to true by - default. 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. 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". - 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.models.AdditionalUnattendContent] - :ivar patch_settings: [Preview Feature] Specifies settings related to VM Guest Patching on - Windows. - :vartype patch_settings: ~azure.mgmt.compute.models.PatchSettings - :ivar win_rm: Specifies the Windows Remote Management listeners. This enables remote Windows - PowerShell. - :vartype win_rm: ~azure.mgmt.compute.models.WinRMConfiguration - :ivar enable_vm_agent_platform_updates: Indicates whether VMAgent Platform Updates are enabled - for the Windows Virtual Machine. - :vartype enable_vm_agent_platform_updates: bool - """ - - _validation = { - "enable_vm_agent_platform_updates": {"readonly": True}, - } - - _attribute_map = { - "provision_vm_agent": {"key": "provisionVMAgent", "type": "bool"}, - "enable_automatic_updates": {"key": "enableAutomaticUpdates", "type": "bool"}, - "time_zone": {"key": "timeZone", "type": "str"}, - "additional_unattend_content": {"key": "additionalUnattendContent", "type": "[AdditionalUnattendContent]"}, - "patch_settings": {"key": "patchSettings", "type": "PatchSettings"}, - "win_rm": {"key": "winRM", "type": "WinRMConfiguration"}, - "enable_vm_agent_platform_updates": {"key": "enableVMAgentPlatformUpdates", "type": "bool"}, - } - - 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["_models.AdditionalUnattendContent"]] = None, - patch_settings: Optional["_models.PatchSettings"] = None, - win_rm: Optional["_models.WinRMConfiguration"] = None, - **kwargs: Any - ) -> None: - """ - :keyword provision_vm_agent: Indicates whether virtual machine agent should be provisioned on - the virtual machine. When this property is not specified in the request body, it is set to true - by default. 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. 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". 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.models.AdditionalUnattendContent] - :keyword patch_settings: [Preview Feature] Specifies settings related to VM Guest Patching on - Windows. - :paramtype patch_settings: ~azure.mgmt.compute.models.PatchSettings - :keyword win_rm: Specifies the Windows Remote Management listeners. This enables remote Windows - PowerShell. - :paramtype win_rm: ~azure.mgmt.compute.models.WinRMConfiguration - """ - super().__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 - self.enable_vm_agent_platform_updates: Optional[bool] = None - - -class WindowsParameters(_serialization.Model): - """Input for InstallPatches on a Windows VM, as directly received by the API. - - :ivar classifications_to_include: The update classifications to select when installing patches - for Windows. - :vartype classifications_to_include: list[str or - ~azure.mgmt.compute.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 - :ivar patch_name_masks_to_include: This is used to include patches that match the given patch - name masks. Alphanumeric strings and wildcard expressions consisting of * and ? are only - supported as input values in the list. Null, empty and only whitespaces strings as inputs - values are not supported. - :vartype patch_name_masks_to_include: list[str] - :ivar patch_name_masks_to_exclude: This is used to exclude patches that match the given patch - name masks. Alphanumeric strings and wildcard expressions consisting of * and ? are only - supported as input values in the list. Null, empty and only whitespaces strings as inputs - values are not supported. - :vartype patch_name_masks_to_exclude: list[str] - """ - - _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"}, - "patch_name_masks_to_include": {"key": "patchNameMasksToInclude", "type": "[str]"}, - "patch_name_masks_to_exclude": {"key": "patchNameMasksToExclude", "type": "[str]"}, - } - - def __init__( - self, - *, - classifications_to_include: Optional[list[Union[str, "_models.VMGuestPatchClassificationWindows"]]] = None, - kb_numbers_to_include: Optional[list[str]] = None, - kb_numbers_to_exclude: Optional[list[str]] = None, - exclude_kbs_requiring_reboot: Optional[bool] = None, - max_patch_publish_date: Optional[datetime.datetime] = None, - patch_name_masks_to_include: Optional[list[str]] = None, - patch_name_masks_to_exclude: Optional[list[str]] = None, - **kwargs: Any - ) -> None: - """ - :keyword classifications_to_include: The update classifications to select when installing - patches for Windows. - :paramtype classifications_to_include: list[str or - ~azure.mgmt.compute.models.VMGuestPatchClassificationWindows] - :keyword kb_numbers_to_include: Kbs to include in the patch operation. - :paramtype kb_numbers_to_include: list[str] - :keyword kb_numbers_to_exclude: Kbs to exclude in the patch operation. - :paramtype kb_numbers_to_exclude: list[str] - :keyword exclude_kbs_requiring_reboot: Filters out Kbs that don't have an - InstallationRebootBehavior of 'NeverReboots' when this is set to true. - :paramtype exclude_kbs_requiring_reboot: bool - :keyword max_patch_publish_date: This is used to install patches that were published on or - before this given max published date. - :paramtype max_patch_publish_date: ~datetime.datetime - :keyword patch_name_masks_to_include: This is used to include patches that match the given - patch name masks. Alphanumeric strings and wildcard expressions consisting of * and ? are only - supported as input values in the list. Null, empty and only whitespaces strings as inputs - values are not supported. - :paramtype patch_name_masks_to_include: list[str] - :keyword patch_name_masks_to_exclude: This is used to exclude patches that match the given - patch name masks. Alphanumeric strings and wildcard expressions consisting of * and ? are only - supported as input values in the list. Null, empty and only whitespaces strings as inputs - values are not supported. - :paramtype patch_name_masks_to_exclude: list[str] - """ - super().__init__(**kwargs) - self.classifications_to_include = classifications_to_include - self.kb_numbers_to_include = kb_numbers_to_include - self.kb_numbers_to_exclude = kb_numbers_to_exclude - self.exclude_kbs_requiring_reboot = exclude_kbs_requiring_reboot - self.max_patch_publish_date = max_patch_publish_date - self.patch_name_masks_to_include = patch_name_masks_to_include - self.patch_name_masks_to_exclude = patch_name_masks_to_exclude - - -class WindowsVMGuestPatchAutomaticByPlatformSettings(_serialization.Model): # pylint: disable=name-too-long - """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. Known values are: "Unknown", "IfRequired", "Never", and "Always". - :vartype reboot_setting: str or - ~azure.mgmt.compute.models.WindowsVMGuestPatchAutomaticByPlatformRebootSetting - :ivar bypass_platform_safety_checks_on_user_schedule: Enables customer to schedule patching - without accidental upgrades. - :vartype bypass_platform_safety_checks_on_user_schedule: bool - """ - - _attribute_map = { - "reboot_setting": {"key": "rebootSetting", "type": "str"}, - "bypass_platform_safety_checks_on_user_schedule": { - "key": "bypassPlatformSafetyChecksOnUserSchedule", - "type": "bool", - }, - } - - def __init__( - self, - *, - reboot_setting: Optional[Union[str, "_models.WindowsVMGuestPatchAutomaticByPlatformRebootSetting"]] = None, - bypass_platform_safety_checks_on_user_schedule: Optional[bool] = None, - **kwargs: Any - ) -> None: - """ - :keyword reboot_setting: Specifies the reboot setting for all AutomaticByPlatform patch - installation operations. Known values are: "Unknown", "IfRequired", "Never", and "Always". - :paramtype reboot_setting: str or - ~azure.mgmt.compute.models.WindowsVMGuestPatchAutomaticByPlatformRebootSetting - :keyword bypass_platform_safety_checks_on_user_schedule: Enables customer to schedule patching - without accidental upgrades. - :paramtype bypass_platform_safety_checks_on_user_schedule: bool - """ - super().__init__(**kwargs) - self.reboot_setting = reboot_setting - self.bypass_platform_safety_checks_on_user_schedule = bypass_platform_safety_checks_on_user_schedule - - -class WinRMConfiguration(_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.models.WinRMListener] - """ - - _attribute_map = { - "listeners": {"key": "listeners", "type": "[WinRMListener]"}, - } - - def __init__(self, *, listeners: Optional[list["_models.WinRMListener"]] = None, **kwargs: Any) -> None: - """ - :keyword listeners: The list of Windows Remote Management listeners. - :paramtype listeners: list[~azure.mgmt.compute.models.WinRMListener] - """ - super().__init__(**kwargs) - self.listeners = listeners - - -class WinRMListener(_serialization.Model): - """Describes Protocol and thumbprint of Windows Remote Management listener. - - :ivar protocol: Specifies the protocol of WinRM listener. Possible values are: **http,** - **https.**. Known values are: "Http" and "Https". - :vartype protocol: str or ~azure.mgmt.compute.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 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, "_models.ProtocolTypes"]] = None, - certificate_url: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword protocol: Specifies the protocol of WinRM listener. Possible values are: **http,** - **https.**. Known values are: "Http" and "Https". - :paramtype protocol: str or ~azure.mgmt.compute.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 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().__init__(**kwargs) - self.protocol = protocol - self.certificate_url = certificate_url - - -class ZoneAllocationPolicy(_serialization.Model): - """The configuration parameters for zone allocation of a virtual machine scale set. - - :ivar max_zone_count: The maximum number of availability zones to use if the - ZonePlacementPolicy is 'Auto'. If not specified, all availability zones will be used. - :vartype max_zone_count: int - :ivar max_instance_percent_per_zone_policy: The configuration parameters used to limit the - number of virtual machines per availability zone in the virtual machine scale set. - :vartype max_instance_percent_per_zone_policy: - ~azure.mgmt.compute.models.MaxInstancePercentPerZonePolicy - """ - - _attribute_map = { - "max_zone_count": {"key": "maxZoneCount", "type": "int"}, - "max_instance_percent_per_zone_policy": { - "key": "maxInstancePercentPerZonePolicy", - "type": "MaxInstancePercentPerZonePolicy", - }, - } - - def __init__( - self, - *, - max_zone_count: Optional[int] = None, - max_instance_percent_per_zone_policy: Optional["_models.MaxInstancePercentPerZonePolicy"] = None, - **kwargs: Any - ) -> None: - """ - :keyword max_zone_count: The maximum number of availability zones to use if the - ZonePlacementPolicy is 'Auto'. If not specified, all availability zones will be used. - :paramtype max_zone_count: int - :keyword max_instance_percent_per_zone_policy: The configuration parameters used to limit the - number of virtual machines per availability zone in the virtual machine scale set. - :paramtype max_instance_percent_per_zone_policy: - ~azure.mgmt.compute.models.MaxInstancePercentPerZonePolicy - """ - super().__init__(**kwargs) - self.max_zone_count = max_zone_count - self.max_instance_percent_per_zone_policy = max_instance_percent_per_zone_policy diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/models/_patch.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/models/_patch.py index 8bcb627aa475..87676c65a8f0 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/models/_patch.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/models/_patch.py @@ -7,9 +7,9 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/operations/__init__.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/operations/__init__.py index 1526f7d90f57..e7c7e55a0228 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/operations/__init__.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/operations/__init__.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- # pylint: disable=wrong-import-position @@ -14,57 +13,54 @@ from ._patch import * # pylint: disable=unused-wildcard-import from ._operations import Operations # type: ignore -from ._availability_sets_operations import AvailabilitySetsOperations # type: ignore -from ._capacity_reservation_groups_operations import CapacityReservationGroupsOperations # type: ignore -from ._dedicated_host_groups_operations import DedicatedHostGroupsOperations # type: ignore -from ._images_operations import ImagesOperations # type: ignore -from ._virtual_machine_images_edge_zone_operations import VirtualMachineImagesEdgeZoneOperations # type: ignore -from ._virtual_machine_images_operations import VirtualMachineImagesOperations # type: ignore -from ._log_analytics_operations import LogAnalyticsOperations # type: ignore -from ._virtual_machine_extension_images_operations import VirtualMachineExtensionImagesOperations # type: ignore -from ._virtual_machine_run_commands_operations import VirtualMachineRunCommandsOperations # type: ignore -from ._usage_operations import UsageOperations # type: ignore -from ._virtual_machine_scale_sets_operations import VirtualMachineScaleSetsOperations # type: ignore -from ._virtual_machines_operations import VirtualMachinesOperations # type: ignore -from ._virtual_machine_sizes_operations import VirtualMachineSizesOperations # type: ignore -from ._proximity_placement_groups_operations import ProximityPlacementGroupsOperations # type: ignore -from ._restore_point_collections_operations import RestorePointCollectionsOperations # type: ignore -from ._ssh_public_keys_operations import SshPublicKeysOperations # type: ignore -from ._capacity_reservations_operations import CapacityReservationsOperations # type: ignore -from ._dedicated_hosts_operations import DedicatedHostsOperations # type: ignore -from ._restore_points_operations import RestorePointsOperations # type: ignore -from ._virtual_machine_scale_set_rolling_upgrades_operations import VirtualMachineScaleSetRollingUpgradesOperations # type: ignore -from ._virtual_machine_scale_set_extensions_operations import VirtualMachineScaleSetExtensionsOperations # type: ignore -from ._virtual_machine_scale_set_vms_operations import VirtualMachineScaleSetVMsOperations # type: ignore -from ._virtual_machine_scale_set_vm_extensions_operations import VirtualMachineScaleSetVMExtensionsOperations # type: ignore -from ._virtual_machine_scale_set_vm_run_commands_operations import VirtualMachineScaleSetVMRunCommandsOperations # type: ignore -from ._virtual_machine_extensions_operations import VirtualMachineExtensionsOperations # type: ignore -from ._disk_accesses_operations import DiskAccessesOperations # type: ignore -from ._disk_encryption_sets_operations import DiskEncryptionSetsOperations # type: ignore -from ._disks_operations import DisksOperations # type: ignore -from ._snapshots_operations import SnapshotsOperations # type: ignore -from ._disk_restore_point_operations import DiskRestorePointOperations # type: ignore -from ._resource_skus_operations import ResourceSkusOperations # type: ignore -from ._galleries_operations import GalleriesOperations # type: ignore -from ._community_galleries_operations import CommunityGalleriesOperations # type: ignore -from ._community_gallery_images_operations import CommunityGalleryImagesOperations # type: ignore -from ._community_gallery_image_versions_operations import CommunityGalleryImageVersionsOperations # type: ignore -from ._shared_galleries_operations import SharedGalleriesOperations # type: ignore -from ._shared_gallery_images_operations import SharedGalleryImagesOperations # type: ignore -from ._shared_gallery_image_versions_operations import SharedGalleryImageVersionsOperations # type: ignore -from ._gallery_applications_operations import GalleryApplicationsOperations # type: ignore -from ._gallery_application_versions_operations import GalleryApplicationVersionsOperations # type: ignore -from ._gallery_images_operations import GalleryImagesOperations # type: ignore -from ._gallery_image_versions_operations import GalleryImageVersionsOperations # type: ignore -from ._gallery_in_vm_access_control_profiles_operations import GalleryInVMAccessControlProfilesOperations # type: ignore -from ._gallery_in_vm_access_control_profile_versions_operations import GalleryInVMAccessControlProfileVersionsOperations # type: ignore -from ._gallery_sharing_profile_operations import GallerySharingProfileOperations # type: ignore -from ._soft_deleted_resource_operations import SoftDeletedResourceOperations # type: ignore -from ._cloud_service_role_instances_operations import CloudServiceRoleInstancesOperations # type: ignore -from ._cloud_service_roles_operations import CloudServiceRolesOperations # type: ignore -from ._cloud_services_operations import CloudServicesOperations # type: ignore -from ._cloud_services_update_domain_operations import CloudServicesUpdateDomainOperations # type: ignore -from ._cloud_service_operating_systems_operations import CloudServiceOperatingSystemsOperations # type: ignore +from ._operations import VirtualMachineScaleSetsOperations # type: ignore +from ._operations import RollingUpgradeStatusInfosOperations # type: ignore +from ._operations import VirtualMachineScaleSetExtensionsOperations # type: ignore +from ._operations import VirtualMachineScaleSetVMSOperations # type: ignore +from ._operations import VirtualMachineScaleSetVMExtensionsOperations # type: ignore +from ._operations import VirtualMachinesOperations # type: ignore +from ._operations import VirtualMachineExtensionsOperations # type: ignore +from ._operations import VirtualMachineExtensionImagesOperations # type: ignore +from ._operations import AvailabilitySetsOperations # type: ignore +from ._operations import ProximityPlacementGroupsOperations # type: ignore +from ._operations import DedicatedHostGroupsOperations # type: ignore +from ._operations import DedicatedHostsOperations # type: ignore +from ._operations import SshPublicKeyResourcesOperations # type: ignore +from ._operations import ImagesOperations # type: ignore +from ._operations import RestorePointCollectionsOperations # type: ignore +from ._operations import RestorePointsOperations # type: ignore +from ._operations import CapacityReservationGroupsOperations # type: ignore +from ._operations import CapacityReservationsOperations # type: ignore +from ._operations import VirtualMachineRunCommandsOperations # type: ignore +from ._operations import VirtualMachineScaleSetVMRunCommandsOperations # type: ignore +from ._operations import UsageOperationGroupOperations # type: ignore +from ._operations import VirtualMachineSizesOperationGroupOperations # type: ignore +from ._operations import VirtualMachineScaleSetsOperationGroupOperations # type: ignore +from ._operations import VirtualMachinesOperationGroupOperations # type: ignore +from ._operations import VirtualMachineImagesEdgeZoneOperationGroupOperations # type: ignore +from ._operations import VirtualMachineImagesOperationGroupOperations # type: ignore +from ._operations import LogAnalyticsOperationGroupOperations # type: ignore +from ._operations import VirtualMachineRunCommandsOperationGroupOperations # type: ignore +from ._operations import DisksOperations # type: ignore +from ._operations import DiskAccessesOperations # type: ignore +from ._operations import PrivateEndpointConnectionsOperations # type: ignore +from ._operations import DiskEncryptionSetsOperations # type: ignore +from ._operations import DiskRestorePointsOperations # type: ignore +from ._operations import SnapshotsOperations # type: ignore +from ._operations import GalleriesOperations # type: ignore +from ._operations import GalleryImagesOperations # type: ignore +from ._operations import GalleryImageVersionsOperations # type: ignore +from ._operations import GalleryApplicationsOperations # type: ignore +from ._operations import GalleryApplicationVersionsOperations # type: ignore +from ._operations import GalleryInVMAccessControlProfilesOperations # type: ignore +from ._operations import GalleryInVMAccessControlProfileVersionsOperations # type: ignore +from ._operations import SharedGalleriesOperations # type: ignore +from ._operations import SharedGalleryImagesOperations # type: ignore +from ._operations import SharedGalleryImageVersionsOperations # type: ignore +from ._operations import CommunityGalleriesOperations # type: ignore +from ._operations import CommunityGalleryImagesOperations # type: ignore +from ._operations import CommunityGalleryImageVersionsOperations # type: ignore +from ._operations import ResourceSkusOperations # type: ignore from ._patch import __all__ as _patch_all from ._patch import * @@ -72,57 +68,54 @@ __all__ = [ "Operations", - "AvailabilitySetsOperations", - "CapacityReservationGroupsOperations", - "DedicatedHostGroupsOperations", - "ImagesOperations", - "VirtualMachineImagesEdgeZoneOperations", - "VirtualMachineImagesOperations", - "LogAnalyticsOperations", - "VirtualMachineExtensionImagesOperations", - "VirtualMachineRunCommandsOperations", - "UsageOperations", "VirtualMachineScaleSetsOperations", + "RollingUpgradeStatusInfosOperations", + "VirtualMachineScaleSetExtensionsOperations", + "VirtualMachineScaleSetVMSOperations", + "VirtualMachineScaleSetVMExtensionsOperations", "VirtualMachinesOperations", - "VirtualMachineSizesOperations", + "VirtualMachineExtensionsOperations", + "VirtualMachineExtensionImagesOperations", + "AvailabilitySetsOperations", "ProximityPlacementGroupsOperations", - "RestorePointCollectionsOperations", - "SshPublicKeysOperations", - "CapacityReservationsOperations", + "DedicatedHostGroupsOperations", "DedicatedHostsOperations", + "SshPublicKeyResourcesOperations", + "ImagesOperations", + "RestorePointCollectionsOperations", "RestorePointsOperations", - "VirtualMachineScaleSetRollingUpgradesOperations", - "VirtualMachineScaleSetExtensionsOperations", - "VirtualMachineScaleSetVMsOperations", - "VirtualMachineScaleSetVMExtensionsOperations", + "CapacityReservationGroupsOperations", + "CapacityReservationsOperations", + "VirtualMachineRunCommandsOperations", "VirtualMachineScaleSetVMRunCommandsOperations", - "VirtualMachineExtensionsOperations", + "UsageOperationGroupOperations", + "VirtualMachineSizesOperationGroupOperations", + "VirtualMachineScaleSetsOperationGroupOperations", + "VirtualMachinesOperationGroupOperations", + "VirtualMachineImagesEdgeZoneOperationGroupOperations", + "VirtualMachineImagesOperationGroupOperations", + "LogAnalyticsOperationGroupOperations", + "VirtualMachineRunCommandsOperationGroupOperations", + "DisksOperations", "DiskAccessesOperations", + "PrivateEndpointConnectionsOperations", "DiskEncryptionSetsOperations", - "DisksOperations", + "DiskRestorePointsOperations", "SnapshotsOperations", - "DiskRestorePointOperations", - "ResourceSkusOperations", "GalleriesOperations", - "CommunityGalleriesOperations", - "CommunityGalleryImagesOperations", - "CommunityGalleryImageVersionsOperations", - "SharedGalleriesOperations", - "SharedGalleryImagesOperations", - "SharedGalleryImageVersionsOperations", - "GalleryApplicationsOperations", - "GalleryApplicationVersionsOperations", "GalleryImagesOperations", "GalleryImageVersionsOperations", + "GalleryApplicationsOperations", + "GalleryApplicationVersionsOperations", "GalleryInVMAccessControlProfilesOperations", "GalleryInVMAccessControlProfileVersionsOperations", - "GallerySharingProfileOperations", - "SoftDeletedResourceOperations", - "CloudServiceRoleInstancesOperations", - "CloudServiceRolesOperations", - "CloudServicesOperations", - "CloudServicesUpdateDomainOperations", - "CloudServiceOperatingSystemsOperations", + "SharedGalleriesOperations", + "SharedGalleryImagesOperations", + "SharedGalleryImageVersionsOperations", + "CommunityGalleriesOperations", + "CommunityGalleryImagesOperations", + "CommunityGalleryImageVersionsOperations", + "ResourceSkusOperations", ] __all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/operations/_availability_sets_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/operations/_availability_sets_operations.py deleted file mode 100644 index 351cebb3dc99..000000000000 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/operations/_availability_sets_operations.py +++ /dev/null @@ -1,1526 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression,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 collections.abc import MutableMapping -from io import IOBase -from typing import Any, Callable, IO, Iterator, Optional, TypeVar, Union, cast, overload - -from azure.core import PipelineClient -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - StreamClosedError, - StreamConsumedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from .._configuration import ComputeManagementClientConfiguration -from .._utils.serialization import Deserializer, Serializer - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] -List = list - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_by_subscription_request( - subscription_id: str, *, expand: Optional[str] = None, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - accept = _headers.pop("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", min_length=1), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if expand is not None: - _params["$expand"] = _SERIALIZER.query("expand", expand, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request(resource_group_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_request( - resource_group_name: str, availability_set_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "availabilitySetName": _SERIALIZER.url("availability_set_name", availability_set_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, availability_set_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "availabilitySetName": _SERIALIZER.url("availability_set_name", availability_set_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_request( - resource_group_name: str, availability_set_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "availabilitySetName": _SERIALIZER.url("availability_set_name", availability_set_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, availability_set_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "availabilitySetName": _SERIALIZER.url("availability_set_name", availability_set_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_cancel_migration_to_virtual_machine_scale_set_request( # pylint: disable=name-too-long - resource_group_name: str, availability_set_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}/cancelMigrationToVirtualMachineScaleSet", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "availabilitySetName": _SERIALIZER.url("availability_set_name", availability_set_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_convert_to_virtual_machine_scale_set_request( # pylint: disable=name-too-long - resource_group_name: str, availability_set_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}/convertToVirtualMachineScaleSet", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "availabilitySetName": _SERIALIZER.url("availability_set_name", availability_set_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_start_migration_to_virtual_machine_scale_set_request( # pylint: disable=name-too-long - resource_group_name: str, availability_set_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}/startMigrationToVirtualMachineScaleSet", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "availabilitySetName": _SERIALIZER.url("availability_set_name", availability_set_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_validate_migration_to_virtual_machine_scale_set_request( # pylint: disable=name-too-long - resource_group_name: str, availability_set_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}/validateMigrationToVirtualMachineScaleSet", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "availabilitySetName": _SERIALIZER.url("availability_set_name", availability_set_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_available_sizes_request( - resource_group_name: str, availability_set_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}/vmSizes", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "availabilitySetName": _SERIALIZER.url("availability_set_name", availability_set_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class AvailabilitySetsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.compute.ComputeManagementClient`'s - :attr:`availability_sets` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list_by_subscription(self, expand: Optional[str] = None, **kwargs: Any) -> ItemPaged["_models.AvailabilitySet"]: - """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 - :return: An iterator like instance of either AvailabilitySet or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.models.AvailabilitySet] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[_models.AvailabilitySetListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_by_subscription_request( - subscription_id=self._config.subscription_id, - expand=expand, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - _request = HttpRequest("GET", next_link) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @distributed_trace - def list(self, resource_group_name: str, **kwargs: Any) -> ItemPaged["_models.AvailabilitySet"]: - """Lists all availability sets in a resource group. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :return: An iterator like instance of either AvailabilitySet or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.models.AvailabilitySet] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[_models.AvailabilitySetListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - _request = HttpRequest("GET", next_link) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @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. The name is case insensitive. - Required. - :type resource_group_name: str - :param availability_set_name: The name of the availability set. Required. - :type availability_set_name: str - :return: AvailabilitySet or the result of cls(response) - :rtype: ~azure.mgmt.compute.models.AvailabilitySet - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[_models.AvailabilitySet] = kwargs.pop("cls", None) - - _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, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("AvailabilitySet", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def create_or_update( - self, - resource_group_name: str, - availability_set_name: str, - parameters: _models.AvailabilitySet, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.AvailabilitySet: - """Create or update an availability set. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param availability_set_name: The name of the availability set. Required. - :type availability_set_name: str - :param parameters: Parameters supplied to the Create Availability Set operation. Required. - :type parameters: ~azure.mgmt.compute.models.AvailabilitySet - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: AvailabilitySet or the result of cls(response) - :rtype: ~azure.mgmt.compute.models.AvailabilitySet - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def create_or_update( - self, - resource_group_name: str, - availability_set_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.AvailabilitySet: - """Create or update an availability set. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param availability_set_name: The name of the availability set. Required. - :type availability_set_name: str - :param parameters: Parameters supplied to the Create Availability Set operation. Required. - :type parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: AvailabilitySet or the result of cls(response) - :rtype: ~azure.mgmt.compute.models.AvailabilitySet - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def create_or_update( - self, - resource_group_name: str, - availability_set_name: str, - parameters: Union[_models.AvailabilitySet, IO[bytes]], - **kwargs: Any - ) -> _models.AvailabilitySet: - """Create or update an availability set. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param availability_set_name: The name of the availability set. Required. - :type availability_set_name: str - :param parameters: Parameters supplied to the Create Availability Set operation. Is either a - AvailabilitySet type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.compute.models.AvailabilitySet or IO[bytes] - :return: AvailabilitySet or the result of cls(response) - :rtype: ~azure.mgmt.compute.models.AvailabilitySet - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AvailabilitySet] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _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, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("AvailabilitySet", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def update( - self, - resource_group_name: str, - availability_set_name: str, - parameters: _models.AvailabilitySetUpdate, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.AvailabilitySet: - """Update an availability set. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param availability_set_name: The name of the availability set. Required. - :type availability_set_name: str - :param parameters: Parameters supplied to the Update Availability Set operation. Required. - :type parameters: ~azure.mgmt.compute.models.AvailabilitySetUpdate - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: AvailabilitySet or the result of cls(response) - :rtype: ~azure.mgmt.compute.models.AvailabilitySet - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def update( - self, - resource_group_name: str, - availability_set_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.AvailabilitySet: - """Update an availability set. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param availability_set_name: The name of the availability set. Required. - :type availability_set_name: str - :param parameters: Parameters supplied to the Update Availability Set operation. Required. - :type parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: AvailabilitySet or the result of cls(response) - :rtype: ~azure.mgmt.compute.models.AvailabilitySet - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def update( - self, - resource_group_name: str, - availability_set_name: str, - parameters: Union[_models.AvailabilitySetUpdate, IO[bytes]], - **kwargs: Any - ) -> _models.AvailabilitySet: - """Update an availability set. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param availability_set_name: The name of the availability set. Required. - :type availability_set_name: str - :param parameters: Parameters supplied to the Update Availability Set operation. Is either a - AvailabilitySetUpdate type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.compute.models.AvailabilitySetUpdate or IO[bytes] - :return: AvailabilitySet or the result of cls(response) - :rtype: ~azure.mgmt.compute.models.AvailabilitySet - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AvailabilitySet] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _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, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("AvailabilitySet", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. The name is case insensitive. - Required. - :type resource_group_name: str - :param availability_set_name: The name of the availability set. Required. - :type availability_set_name: str - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - - _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, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 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, {}) # type: ignore - - @distributed_trace - def cancel_migration_to_virtual_machine_scale_set( # pylint: disable=inconsistent-return-statements,name-too-long - self, resource_group_name: str, availability_set_name: str, **kwargs: Any - ) -> None: - """Cancel the migration operation on an Availability Set. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param availability_set_name: The name of the availability set. Required. - :type availability_set_name: str - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_cancel_migration_to_virtual_machine_scale_set_request( - resource_group_name=resource_group_name, - availability_set_name=availability_set_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [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, {}) # type: ignore - - def _convert_to_virtual_machine_scale_set_initial( # pylint: disable=name-too-long - self, - resource_group_name: str, - availability_set_name: str, - parameters: Optional[Union[_models.ConvertToVirtualMachineScaleSetInput, IO[bytes]]] = None, - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - content_type = content_type if parameters else None - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" if parameters else None - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - if parameters is not None: - _json = self._serialize.body(parameters, "ConvertToVirtualMachineScaleSetInput") - else: - _json = None - - _request = build_convert_to_virtual_machine_scale_set_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, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [202]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_convert_to_virtual_machine_scale_set( # pylint: disable=name-too-long - self, - resource_group_name: str, - availability_set_name: str, - parameters: Optional[_models.ConvertToVirtualMachineScaleSetInput] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[None]: - """Create a new Flexible Virtual Machine Scale Set and migrate all the Virtual Machines in the - Availability Set. This does not trigger a downtime on the Virtual Machines. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param availability_set_name: The name of the availability set. Required. - :type availability_set_name: str - :param parameters: Parameters supplied to the migrate operation on the availability set. - Default value is None. - :type parameters: ~azure.mgmt.compute.models.ConvertToVirtualMachineScaleSetInput - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_convert_to_virtual_machine_scale_set( # pylint: disable=name-too-long - self, - resource_group_name: str, - availability_set_name: str, - parameters: Optional[IO[bytes]] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[None]: - """Create a new Flexible Virtual Machine Scale Set and migrate all the Virtual Machines in the - Availability Set. This does not trigger a downtime on the Virtual Machines. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param availability_set_name: The name of the availability set. Required. - :type availability_set_name: str - :param parameters: Parameters supplied to the migrate operation on the availability set. - Default value is None. - :type parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_convert_to_virtual_machine_scale_set( # pylint: disable=name-too-long - self, - resource_group_name: str, - availability_set_name: str, - parameters: Optional[Union[_models.ConvertToVirtualMachineScaleSetInput, IO[bytes]]] = None, - **kwargs: Any - ) -> LROPoller[None]: - """Create a new Flexible Virtual Machine Scale Set and migrate all the Virtual Machines in the - Availability Set. This does not trigger a downtime on the Virtual Machines. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param availability_set_name: The name of the availability set. Required. - :type availability_set_name: str - :param parameters: Parameters supplied to the migrate operation on the availability set. Is - either a ConvertToVirtualMachineScaleSetInput type or a IO[bytes] type. Default value is None. - :type parameters: ~azure.mgmt.compute.models.ConvertToVirtualMachineScaleSetInput or IO[bytes] - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - content_type = content_type if parameters else None - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._convert_to_virtual_machine_scale_set_initial( - resource_group_name=resource_group_name, - availability_set_name=availability_set_name, - parameters=parameters, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @overload - def start_migration_to_virtual_machine_scale_set( # pylint: disable=name-too-long - self, - resource_group_name: str, - availability_set_name: str, - parameters: _models.MigrateToVirtualMachineScaleSetInput, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> None: - """Start migration operation on an Availability Set to move its Virtual Machines to a Virtual - Machine Scale Set. This should be followed by a migrate operation on each Virtual Machine that - triggers a downtime on the Virtual Machine. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param availability_set_name: The name of the availability set. Required. - :type availability_set_name: str - :param parameters: Parameters supplied to the migrate operation on the availability set. - Required. - :type parameters: ~azure.mgmt.compute.models.MigrateToVirtualMachineScaleSetInput - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def start_migration_to_virtual_machine_scale_set( # pylint: disable=name-too-long - self, - resource_group_name: str, - availability_set_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> None: - """Start migration operation on an Availability Set to move its Virtual Machines to a Virtual - Machine Scale Set. This should be followed by a migrate operation on each Virtual Machine that - triggers a downtime on the Virtual Machine. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param availability_set_name: The name of the availability set. Required. - :type availability_set_name: str - :param parameters: Parameters supplied to the migrate operation on the availability set. - Required. - :type parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def start_migration_to_virtual_machine_scale_set( # pylint: disable=inconsistent-return-statements,name-too-long - self, - resource_group_name: str, - availability_set_name: str, - parameters: Union[_models.MigrateToVirtualMachineScaleSetInput, IO[bytes]], - **kwargs: Any - ) -> None: - """Start migration operation on an Availability Set to move its Virtual Machines to a Virtual - Machine Scale Set. This should be followed by a migrate operation on each Virtual Machine that - triggers a downtime on the Virtual Machine. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param availability_set_name: The name of the availability set. Required. - :type availability_set_name: str - :param parameters: Parameters supplied to the migrate operation on the availability set. Is - either a MigrateToVirtualMachineScaleSetInput type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.compute.models.MigrateToVirtualMachineScaleSetInput or IO[bytes] - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "MigrateToVirtualMachineScaleSetInput") - - _request = build_start_migration_to_virtual_machine_scale_set_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, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [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, {}) # type: ignore - - @overload - def validate_migration_to_virtual_machine_scale_set( # pylint: disable=name-too-long - self, - resource_group_name: str, - availability_set_name: str, - parameters: _models.MigrateToVirtualMachineScaleSetInput, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> None: - """Validates that the Virtual Machines in the Availability Set can be migrated to the provided - Virtual Machine Scale Set. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param availability_set_name: The name of the availability set. Required. - :type availability_set_name: str - :param parameters: Parameters supplied to the migrate operation on the availability set. - Required. - :type parameters: ~azure.mgmt.compute.models.MigrateToVirtualMachineScaleSetInput - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def validate_migration_to_virtual_machine_scale_set( # pylint: disable=name-too-long - self, - resource_group_name: str, - availability_set_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> None: - """Validates that the Virtual Machines in the Availability Set can be migrated to the provided - Virtual Machine Scale Set. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param availability_set_name: The name of the availability set. Required. - :type availability_set_name: str - :param parameters: Parameters supplied to the migrate operation on the availability set. - Required. - :type parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def validate_migration_to_virtual_machine_scale_set( # pylint: disable=inconsistent-return-statements,name-too-long - self, - resource_group_name: str, - availability_set_name: str, - parameters: Union[_models.MigrateToVirtualMachineScaleSetInput, IO[bytes]], - **kwargs: Any - ) -> None: - """Validates that the Virtual Machines in the Availability Set can be migrated to the provided - Virtual Machine Scale Set. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param availability_set_name: The name of the availability set. Required. - :type availability_set_name: str - :param parameters: Parameters supplied to the migrate operation on the availability set. Is - either a MigrateToVirtualMachineScaleSetInput type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.compute.models.MigrateToVirtualMachineScaleSetInput or IO[bytes] - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "MigrateToVirtualMachineScaleSetInput") - - _request = build_validate_migration_to_virtual_machine_scale_set_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, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [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, {}) # type: ignore - - @distributed_trace - def list_available_sizes( - self, resource_group_name: str, availability_set_name: str, **kwargs: Any - ) -> ItemPaged["_models.VirtualMachineSize"]: - """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. The name is case insensitive. - Required. - :type resource_group_name: str - :param availability_set_name: The name of the availability set. Required. - :type availability_set_name: str - :return: An iterator like instance of either VirtualMachineSize or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.models.VirtualMachineSize] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[_models.VirtualMachineSizeListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_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, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - _request = HttpRequest("GET", next_link) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/operations/_capacity_reservation_groups_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/operations/_capacity_reservation_groups_operations.py deleted file mode 100644 index 5c7bd968a7af..000000000000 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/operations/_capacity_reservation_groups_operations.py +++ /dev/null @@ -1,846 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# 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 collections.abc import MutableMapping -from io import IOBase -from typing import Any, Callable, IO, Optional, TypeVar, Union, overload - -from azure.core import PipelineClient -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models -from .._configuration import ComputeManagementClientConfiguration -from .._utils.serialization import Deserializer, Serializer - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] -List = list - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_by_subscription_request( - subscription_id: str, - *, - expand: Optional[Union[str, _models.ExpandTypesForGetCapacityReservationGroups]] = None, - resource_ids_only: Optional[Union[str, _models.ResourceIdOptionsForGetCapacityReservationGroups]] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/capacityReservationGroups" - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if expand is not None: - _params["$expand"] = _SERIALIZER.query("expand", expand, "str") - if resource_ids_only is not None: - _params["resourceIdsOnly"] = _SERIALIZER.query("resource_ids_only", resource_ids_only, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **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: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if expand is not None: - _params["$expand"] = _SERIALIZER.query("expand", expand, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -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: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "capacityReservationGroupName": _SERIALIZER.url( - "capacity_reservation_group_name", capacity_reservation_group_name, "str" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if expand is not None: - _params["$expand"] = _SERIALIZER.query("expand", expand, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, capacity_reservation_group_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "capacityReservationGroupName": _SERIALIZER.url( - "capacity_reservation_group_name", capacity_reservation_group_name, "str" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_request( - resource_group_name: str, capacity_reservation_group_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "capacityReservationGroupName": _SERIALIZER.url( - "capacity_reservation_group_name", capacity_reservation_group_name, "str" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, capacity_reservation_group_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "capacityReservationGroupName": _SERIALIZER.url( - "capacity_reservation_group_name", capacity_reservation_group_name, "str" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -class CapacityReservationGroupsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.compute.ComputeManagementClient`'s - :attr:`capacity_reservation_groups` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list_by_subscription( - self, - expand: Optional[Union[str, _models.ExpandTypesForGetCapacityReservationGroups]] = None, - resource_ids_only: Optional[Union[str, _models.ResourceIdOptionsForGetCapacityReservationGroups]] = None, - **kwargs: Any - ) -> ItemPaged["_models.CapacityReservationGroup"]: - """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. Known values are: - "virtualMachineScaleSetVMs/$ref" and "virtualMachines/$ref". Default value is None. - :type expand: str or ~azure.mgmt.compute.models.ExpandTypesForGetCapacityReservationGroups - :param resource_ids_only: The query option to fetch Capacity Reservation Group Resource Ids. - :code:`
` 'CreatedInSubscription' enables fetching Resource Ids for all capacity reservation - group resources created in the subscription. :code:`
` 'SharedWithSubscription' enables - fetching Resource Ids for all capacity reservation group resources shared with the - subscription. :code:`
` 'All' enables fetching Resource Ids for all capacity reservation - group resources shared with the subscription and created in the subscription. Known values are: - "CreatedInSubscription", "SharedWithSubscription", and "All". Default value is None. - :type resource_ids_only: str or - ~azure.mgmt.compute.models.ResourceIdOptionsForGetCapacityReservationGroups - :return: An iterator like instance of either CapacityReservationGroup or the result of - cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.models.CapacityReservationGroup] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[_models.CapacityReservationGroupListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_by_subscription_request( - subscription_id=self._config.subscription_id, - expand=expand, - resource_ids_only=resource_ids_only, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - _request = HttpRequest("GET", next_link) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @distributed_trace - def list_by_resource_group( - self, - resource_group_name: str, - expand: Optional[Union[str, _models.ExpandTypesForGetCapacityReservationGroups]] = None, - **kwargs: Any - ) -> ItemPaged["_models.CapacityReservationGroup"]: - """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. The name is case insensitive. - Required. - :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. Known values are: - "virtualMachineScaleSetVMs/$ref" and "virtualMachines/$ref". Default value is None. - :type expand: str or ~azure.mgmt.compute.models.ExpandTypesForGetCapacityReservationGroups - :return: An iterator like instance of either CapacityReservationGroup or the result of - cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.models.CapacityReservationGroup] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[_models.CapacityReservationGroupListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_by_resource_group_request( - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - expand=expand, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - _request = HttpRequest("GET", next_link) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @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. The name is case insensitive. - Required. - :type resource_group_name: str - :param capacity_reservation_group_name: The name of the capacity reservation group. Required. - :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. "instanceView" Default value is - None. - :type expand: str or ~azure.mgmt.compute.models.CapacityReservationGroupInstanceViewTypes - :return: CapacityReservationGroup or the result of cls(response) - :rtype: ~azure.mgmt.compute.models.CapacityReservationGroup - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[_models.CapacityReservationGroup] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - capacity_reservation_group_name=capacity_reservation_group_name, - subscription_id=self._config.subscription_id, - expand=expand, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("CapacityReservationGroup", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def create_or_update( - self, - resource_group_name: str, - capacity_reservation_group_name: str, - parameters: _models.CapacityReservationGroup, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.CapacityReservationGroup: - """The operation to create or update a capacity reservation group. When updating a capacity - reservation group, only tags and sharing profile may be modified. Please refer to - https://aka.ms/CapacityReservation for more details. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param capacity_reservation_group_name: The name of the capacity reservation group. Required. - :type capacity_reservation_group_name: str - :param parameters: Parameters supplied to the Create capacity reservation Group. Required. - :type parameters: ~azure.mgmt.compute.models.CapacityReservationGroup - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: CapacityReservationGroup or the result of cls(response) - :rtype: ~azure.mgmt.compute.models.CapacityReservationGroup - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def create_or_update( - self, - resource_group_name: str, - capacity_reservation_group_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.CapacityReservationGroup: - """The operation to create or update a capacity reservation group. When updating a capacity - reservation group, only tags and sharing profile may be modified. Please refer to - https://aka.ms/CapacityReservation for more details. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param capacity_reservation_group_name: The name of the capacity reservation group. Required. - :type capacity_reservation_group_name: str - :param parameters: Parameters supplied to the Create capacity reservation Group. Required. - :type parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: CapacityReservationGroup or the result of cls(response) - :rtype: ~azure.mgmt.compute.models.CapacityReservationGroup - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def create_or_update( - self, - resource_group_name: str, - capacity_reservation_group_name: str, - parameters: Union[_models.CapacityReservationGroup, IO[bytes]], - **kwargs: Any - ) -> _models.CapacityReservationGroup: - """The operation to create or update a capacity reservation group. When updating a capacity - reservation group, only tags and sharing profile may be modified. Please refer to - https://aka.ms/CapacityReservation for more details. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param capacity_reservation_group_name: The name of the capacity reservation group. Required. - :type capacity_reservation_group_name: str - :param parameters: Parameters supplied to the Create capacity reservation Group. Is either a - CapacityReservationGroup type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.compute.models.CapacityReservationGroup or IO[bytes] - :return: CapacityReservationGroup or the result of cls(response) - :rtype: ~azure.mgmt.compute.models.CapacityReservationGroup - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CapacityReservationGroup] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _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, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("CapacityReservationGroup", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def update( - self, - resource_group_name: str, - capacity_reservation_group_name: str, - parameters: _models.CapacityReservationGroupUpdate, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.CapacityReservationGroup: - """The operation to update a capacity reservation group. When updating a capacity reservation - group, only tags and sharing profile may be modified. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param capacity_reservation_group_name: The name of the capacity reservation group. Required. - :type capacity_reservation_group_name: str - :param parameters: Parameters supplied to the Update capacity reservation Group operation. - Required. - :type parameters: ~azure.mgmt.compute.models.CapacityReservationGroupUpdate - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: CapacityReservationGroup or the result of cls(response) - :rtype: ~azure.mgmt.compute.models.CapacityReservationGroup - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def update( - self, - resource_group_name: str, - capacity_reservation_group_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.CapacityReservationGroup: - """The operation to update a capacity reservation group. When updating a capacity reservation - group, only tags and sharing profile may be modified. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param capacity_reservation_group_name: The name of the capacity reservation group. Required. - :type capacity_reservation_group_name: str - :param parameters: Parameters supplied to the Update capacity reservation Group operation. - Required. - :type parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: CapacityReservationGroup or the result of cls(response) - :rtype: ~azure.mgmt.compute.models.CapacityReservationGroup - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def update( - self, - resource_group_name: str, - capacity_reservation_group_name: str, - parameters: Union[_models.CapacityReservationGroupUpdate, IO[bytes]], - **kwargs: Any - ) -> _models.CapacityReservationGroup: - """The operation to update a capacity reservation group. When updating a capacity reservation - group, only tags and sharing profile may be modified. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param capacity_reservation_group_name: The name of the capacity reservation group. Required. - :type capacity_reservation_group_name: str - :param parameters: Parameters supplied to the Update capacity reservation Group operation. Is - either a CapacityReservationGroupUpdate type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.compute.models.CapacityReservationGroupUpdate or IO[bytes] - :return: CapacityReservationGroup or the result of cls(response) - :rtype: ~azure.mgmt.compute.models.CapacityReservationGroup - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CapacityReservationGroup] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _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, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("CapacityReservationGroup", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. The name is case insensitive. - Required. - :type resource_group_name: str - :param capacity_reservation_group_name: The name of the capacity reservation group. Required. - :type capacity_reservation_group_name: str - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - - _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, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 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, {}) # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/operations/_capacity_reservations_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/operations/_capacity_reservations_operations.py deleted file mode 100644 index 6fb46647f82d..000000000000 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/operations/_capacity_reservations_operations.py +++ /dev/null @@ -1,965 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# 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 collections.abc import MutableMapping -from io import IOBase -from typing import Any, Callable, IO, Iterator, Optional, TypeVar, Union, cast, overload - -from azure.core import PipelineClient -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - StreamClosedError, - StreamConsumedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from .._configuration import ComputeManagementClientConfiguration -from .._utils.serialization import Deserializer, Serializer - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] -List = list - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_by_capacity_reservation_group_request( # pylint: disable=name-too-long - resource_group_name: str, capacity_reservation_group_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}/capacityReservations", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "capacityReservationGroupName": _SERIALIZER.url( - "capacity_reservation_group_name", capacity_reservation_group_name, "str" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_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: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}/capacityReservations/{capacityReservationName}", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "capacityReservationGroupName": _SERIALIZER.url( - "capacity_reservation_group_name", capacity_reservation_group_name, "str" - ), - "capacityReservationName": _SERIALIZER.url("capacity_reservation_name", capacity_reservation_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if expand is not None: - _params["$expand"] = _SERIALIZER.query("expand", expand, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, - capacity_reservation_group_name: str, - capacity_reservation_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}/capacityReservations/{capacityReservationName}", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "capacityReservationGroupName": _SERIALIZER.url( - "capacity_reservation_group_name", capacity_reservation_group_name, "str" - ), - "capacityReservationName": _SERIALIZER.url("capacity_reservation_name", capacity_reservation_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_request( - resource_group_name: str, - capacity_reservation_group_name: str, - capacity_reservation_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}/capacityReservations/{capacityReservationName}", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "capacityReservationGroupName": _SERIALIZER.url( - "capacity_reservation_group_name", capacity_reservation_group_name, "str" - ), - "capacityReservationName": _SERIALIZER.url("capacity_reservation_name", capacity_reservation_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, - capacity_reservation_group_name: str, - capacity_reservation_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}/capacityReservations/{capacityReservationName}", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "capacityReservationGroupName": _SERIALIZER.url( - "capacity_reservation_group_name", capacity_reservation_group_name, "str" - ), - "capacityReservationName": _SERIALIZER.url("capacity_reservation_name", capacity_reservation_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -class CapacityReservationsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.compute.ComputeManagementClient`'s - :attr:`capacity_reservations` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list_by_capacity_reservation_group( - self, resource_group_name: str, capacity_reservation_group_name: str, **kwargs: Any - ) -> ItemPaged["_models.CapacityReservation"]: - """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. The name is case insensitive. - Required. - :type resource_group_name: str - :param capacity_reservation_group_name: The name of the capacity reservation group. Required. - :type capacity_reservation_group_name: str - :return: An iterator like instance of either CapacityReservation or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.models.CapacityReservation] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[_models.CapacityReservationListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_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, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - _request = HttpRequest("GET", next_link) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @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. The name is case insensitive. - Required. - :type resource_group_name: str - :param capacity_reservation_group_name: The name of the capacity reservation group. Required. - :type capacity_reservation_group_name: str - :param capacity_reservation_name: The name of the capacity reservation. Required. - :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. "instanceView" Default value is None. - :type expand: str or ~azure.mgmt.compute.models.CapacityReservationInstanceViewTypes - :return: CapacityReservation or the result of cls(response) - :rtype: ~azure.mgmt.compute.models.CapacityReservation - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[_models.CapacityReservation] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - capacity_reservation_group_name=capacity_reservation_group_name, - capacity_reservation_name=capacity_reservation_name, - subscription_id=self._config.subscription_id, - expand=expand, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("CapacityReservation", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - capacity_reservation_group_name: str, - capacity_reservation_name: str, - parameters: Union[_models.CapacityReservation, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "CapacityReservation") - - _request = build_create_or_update_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, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 201: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - capacity_reservation_group_name: str, - capacity_reservation_name: str, - parameters: _models.CapacityReservation, - *, - content_type: str = "application/json", - **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. The name is case insensitive. - Required. - :type resource_group_name: str - :param capacity_reservation_group_name: The name of the capacity reservation group. Required. - :type capacity_reservation_group_name: str - :param capacity_reservation_name: The name of the capacity reservation. Required. - :type capacity_reservation_name: str - :param parameters: Parameters supplied to the Create capacity reservation. Required. - :type parameters: ~azure.mgmt.compute.models.CapacityReservation - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either CapacityReservation or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.CapacityReservation] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - capacity_reservation_group_name: str, - capacity_reservation_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **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. The name is case insensitive. - Required. - :type resource_group_name: str - :param capacity_reservation_group_name: The name of the capacity reservation group. Required. - :type capacity_reservation_group_name: str - :param capacity_reservation_name: The name of the capacity reservation. Required. - :type capacity_reservation_name: str - :param parameters: Parameters supplied to the Create capacity reservation. Required. - :type parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either CapacityReservation or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.CapacityReservation] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - capacity_reservation_group_name: str, - capacity_reservation_name: str, - parameters: Union[_models.CapacityReservation, IO[bytes]], - **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. The name is case insensitive. - Required. - :type resource_group_name: str - :param capacity_reservation_group_name: The name of the capacity reservation group. Required. - :type capacity_reservation_group_name: str - :param capacity_reservation_name: The name of the capacity reservation. Required. - :type capacity_reservation_name: str - :param parameters: Parameters supplied to the Create capacity reservation. Is either a - CapacityReservation type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.compute.models.CapacityReservation or IO[bytes] - :return: An instance of LROPoller that returns either CapacityReservation or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.CapacityReservation] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CapacityReservation] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._create_or_update_initial( - resource_group_name=resource_group_name, - 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, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("CapacityReservation", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.CapacityReservation].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.CapacityReservation]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _update_initial( - self, - resource_group_name: str, - capacity_reservation_group_name: str, - capacity_reservation_name: str, - parameters: Union[_models.CapacityReservationUpdate, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "CapacityReservationUpdate") - - _request = build_update_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, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update( - self, - resource_group_name: str, - capacity_reservation_group_name: str, - capacity_reservation_name: str, - parameters: _models.CapacityReservationUpdate, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.CapacityReservation]: - """The operation to update a capacity reservation. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param capacity_reservation_group_name: The name of the capacity reservation group. Required. - :type capacity_reservation_group_name: str - :param capacity_reservation_name: The name of the capacity reservation. Required. - :type capacity_reservation_name: str - :param parameters: Parameters supplied to the Update capacity reservation operation. Required. - :type parameters: ~azure.mgmt.compute.models.CapacityReservationUpdate - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either CapacityReservation or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.CapacityReservation] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update( - self, - resource_group_name: str, - capacity_reservation_group_name: str, - capacity_reservation_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.CapacityReservation]: - """The operation to update a capacity reservation. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param capacity_reservation_group_name: The name of the capacity reservation group. Required. - :type capacity_reservation_group_name: str - :param capacity_reservation_name: The name of the capacity reservation. Required. - :type capacity_reservation_name: str - :param parameters: Parameters supplied to the Update capacity reservation operation. Required. - :type parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either CapacityReservation or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.CapacityReservation] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_update( - self, - resource_group_name: str, - capacity_reservation_group_name: str, - capacity_reservation_name: str, - parameters: Union[_models.CapacityReservationUpdate, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.CapacityReservation]: - """The operation to update a capacity reservation. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param capacity_reservation_group_name: The name of the capacity reservation group. Required. - :type capacity_reservation_group_name: str - :param capacity_reservation_name: The name of the capacity reservation. Required. - :type capacity_reservation_name: str - :param parameters: Parameters supplied to the Update capacity reservation operation. Is either - a CapacityReservationUpdate type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.compute.models.CapacityReservationUpdate or IO[bytes] - :return: An instance of LROPoller that returns either CapacityReservation or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.CapacityReservation] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CapacityReservation] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._update_initial( - resource_group_name=resource_group_name, - 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, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("CapacityReservation", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.CapacityReservation].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.CapacityReservation]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, - resource_group_name: str, - capacity_reservation_group_name: str, - capacity_reservation_name: str, - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_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, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_delete( - 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. Note: Block capacity reservations cannot - be deleted after it has been successfully allocated until the schedule end time. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param capacity_reservation_group_name: The name of the capacity reservation group. Required. - :type capacity_reservation_group_name: str - :param capacity_reservation_name: The name of the capacity reservation. Required. - :type capacity_reservation_name: str - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( - 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, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/operations/_cloud_service_operating_systems_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/operations/_cloud_service_operating_systems_operations.py deleted file mode 100644 index d2b1aba2d047..000000000000 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/operations/_cloud_service_operating_systems_operations.py +++ /dev/null @@ -1,419 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# 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 collections.abc import MutableMapping -from typing import Any, Callable, Optional, TypeVar - -from azure.core import PipelineClient -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models -from .._configuration import ComputeManagementClientConfiguration -from .._utils.serialization import Deserializer, Serializer - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] -List = list - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_get_os_version_request( - location: str, os_version_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-04")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/cloudServiceOsVersions/{osVersionName}", - ) - path_format_arguments = { - "location": _SERIALIZER.url("location", location, "str"), - "osVersionName": _SERIALIZER.url("os_version_name", os_version_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_os_versions_request(location: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-04")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/cloudServiceOsVersions", - ) - path_format_arguments = { - "location": _SERIALIZER.url("location", location, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_os_family_request(location: str, os_family_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-04")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/cloudServiceOsFamilies/{osFamilyName}", - ) - path_format_arguments = { - "location": _SERIALIZER.url("location", location, "str"), - "osFamilyName": _SERIALIZER.url("os_family_name", os_family_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_os_families_request(location: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-04")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/cloudServiceOsFamilies", - ) - path_format_arguments = { - "location": _SERIALIZER.url("location", location, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class CloudServiceOperatingSystemsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.compute.ComputeManagementClient`'s - :attr:`cloud_service_operating_systems` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def get_os_version(self, location: str, os_version_name: str, **kwargs: Any) -> _models.OSVersion: - """Gets properties of a guest operating system version that can be specified in the XML service - configuration (.cscfg) for a cloud service. - - :param location: Name of the location that the OS version pertains to. Required. - :type location: str - :param os_version_name: Name of the OS version. Required. - :type os_version_name: str - :return: OSVersion or the result of cls(response) - :rtype: ~azure.mgmt.compute.models.OSVersion - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-04")) - cls: ClsType[_models.OSVersion] = kwargs.pop("cls", None) - - _request = build_get_os_version_request( - location=location, - os_version_name=os_version_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("OSVersion", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def list_os_versions(self, location: str, **kwargs: Any) -> ItemPaged["_models.OSVersion"]: - """Gets a list of all guest operating system versions available to be specified in the XML service - configuration (.cscfg) for a cloud service. Use nextLink property in the response to get the - next page of OS versions. Do this till nextLink is null to fetch all the OS versions. - - :param location: Name of the location that the OS versions pertain to. Required. - :type location: str - :return: An iterator like instance of either OSVersion or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.models.OSVersion] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-04")) - cls: ClsType[_models.OSVersionListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_os_versions_request( - location=location, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - _request = HttpRequest("GET", next_link) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("OSVersionListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @distributed_trace - def get_os_family(self, location: str, os_family_name: str, **kwargs: Any) -> _models.OSFamily: - """Gets properties of a guest operating system family that can be specified in the XML service - configuration (.cscfg) for a cloud service. - - :param location: Name of the location that the OS family pertains to. Required. - :type location: str - :param os_family_name: Name of the OS family. Required. - :type os_family_name: str - :return: OSFamily or the result of cls(response) - :rtype: ~azure.mgmt.compute.models.OSFamily - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-04")) - cls: ClsType[_models.OSFamily] = kwargs.pop("cls", None) - - _request = build_get_os_family_request( - location=location, - os_family_name=os_family_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("OSFamily", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def list_os_families(self, location: str, **kwargs: Any) -> ItemPaged["_models.OSFamily"]: - """Gets a list of all guest operating system families available to be specified in the XML service - configuration (.cscfg) for a cloud service. Use nextLink property in the response to get the - next page of OS Families. Do this till nextLink is null to fetch all the OS Families. - - :param location: Name of the location that the OS families pertain to. Required. - :type location: str - :return: An iterator like instance of either OSFamily or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.models.OSFamily] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-04")) - cls: ClsType[_models.OSFamilyListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_os_families_request( - location=location, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - _request = HttpRequest("GET", next_link) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("OSFamilyListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/operations/_cloud_service_role_instances_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/operations/_cloud_service_role_instances_operations.py deleted file mode 100644 index eb1f7c67c43a..000000000000 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/operations/_cloud_service_role_instances_operations.py +++ /dev/null @@ -1,1041 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression,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 collections.abc import MutableMapping -from typing import Any, Callable, Iterator, Optional, TypeVar, Union, cast - -from azure.core import PipelineClient -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - StreamClosedError, - StreamConsumedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from .._configuration import ComputeManagementClientConfiguration -from .._utils.serialization import Deserializer, Serializer - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] -List = list - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_delete_request( - role_instance_name: str, resource_group_name: str, cloud_service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-04")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}", - ) - path_format_arguments = { - "roleInstanceName": _SERIALIZER.url("role_instance_name", role_instance_name, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "cloudServiceName": _SERIALIZER.url("cloud_service_name", cloud_service_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_request( - role_instance_name: str, - resource_group_name: str, - cloud_service_name: str, - subscription_id: str, - *, - expand: Optional[Union[str, _models.InstanceViewTypes]] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-04")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}", - ) - path_format_arguments = { - "roleInstanceName": _SERIALIZER.url("role_instance_name", role_instance_name, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "cloudServiceName": _SERIALIZER.url("cloud_service_name", cloud_service_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if expand is not None: - _params["$expand"] = _SERIALIZER.query("expand", expand, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_instance_view_request( - role_instance_name: str, resource_group_name: str, cloud_service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-04")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}/instanceView", - ) - path_format_arguments = { - "roleInstanceName": _SERIALIZER.url("role_instance_name", role_instance_name, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "cloudServiceName": _SERIALIZER.url("cloud_service_name", cloud_service_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request( - resource_group_name: str, - cloud_service_name: str, - subscription_id: str, - *, - expand: Optional[Union[str, _models.InstanceViewTypes]] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-04")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "cloudServiceName": _SERIALIZER.url("cloud_service_name", cloud_service_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if expand is not None: - _params["$expand"] = _SERIALIZER.query("expand", expand, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_restart_request( - role_instance_name: str, resource_group_name: str, cloud_service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-04")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}/restart", - ) - path_format_arguments = { - "roleInstanceName": _SERIALIZER.url("role_instance_name", role_instance_name, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "cloudServiceName": _SERIALIZER.url("cloud_service_name", cloud_service_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_reimage_request( - role_instance_name: str, resource_group_name: str, cloud_service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-04")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}/reimage", - ) - path_format_arguments = { - "roleInstanceName": _SERIALIZER.url("role_instance_name", role_instance_name, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "cloudServiceName": _SERIALIZER.url("cloud_service_name", cloud_service_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_rebuild_request( - role_instance_name: str, resource_group_name: str, cloud_service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-04")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}/rebuild", - ) - path_format_arguments = { - "roleInstanceName": _SERIALIZER.url("role_instance_name", role_instance_name, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "cloudServiceName": _SERIALIZER.url("cloud_service_name", cloud_service_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_remote_desktop_file_request( - role_instance_name: str, resource_group_name: str, cloud_service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-04")) - accept = _headers.pop("Accept", "application/x-rdp") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}/remoteDesktopFile", - ) - path_format_arguments = { - "roleInstanceName": _SERIALIZER.url("role_instance_name", role_instance_name, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "cloudServiceName": _SERIALIZER.url("cloud_service_name", cloud_service_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class CloudServiceRoleInstancesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.compute.ComputeManagementClient`'s - :attr:`cloud_service_role_instances` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - def _delete_initial( - self, role_instance_name: str, resource_group_name: str, cloud_service_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-04")) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_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, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_delete( - self, role_instance_name: str, resource_group_name: str, cloud_service_name: str, **kwargs: Any - ) -> LROPoller[None]: - """Deletes a role instance from a cloud service. - - :param role_instance_name: Name of the role instance. Required. - :type role_instance_name: str - :param resource_group_name: Name of the resource group. Required. - :type resource_group_name: str - :param cloud_service_name: Name of the cloud service. Required. - :type cloud_service_name: str - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-04")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( - 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, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def get( - self, - role_instance_name: str, - resource_group_name: str, - cloud_service_name: str, - expand: Optional[Union[str, _models.InstanceViewTypes]] = None, - **kwargs: Any - ) -> _models.RoleInstance: - """Gets a role instance from a cloud service. - - :param role_instance_name: Name of the role instance. Required. - :type role_instance_name: str - :param resource_group_name: Name of the resource group. Required. - :type resource_group_name: str - :param cloud_service_name: Name of the cloud service. Required. - :type cloud_service_name: str - :param expand: The expand expression to apply to the operation. 'UserData' is not supported for - cloud services. Known values are: "instanceView", "userData", and "resiliencyView". Default - value is None. - :type expand: str or ~azure.mgmt.compute.models.InstanceViewTypes - :return: RoleInstance or the result of cls(response) - :rtype: ~azure.mgmt.compute.models.RoleInstance - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-04")) - cls: ClsType[_models.RoleInstance] = kwargs.pop("cls", None) - - _request = build_get_request( - role_instance_name=role_instance_name, - resource_group_name=resource_group_name, - cloud_service_name=cloud_service_name, - subscription_id=self._config.subscription_id, - expand=expand, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("RoleInstance", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def get_instance_view( - self, role_instance_name: str, resource_group_name: str, cloud_service_name: str, **kwargs: Any - ) -> _models.RoleInstanceView: - """Retrieves information about the run-time state of a role instance in a cloud service. - - :param role_instance_name: Name of the role instance. Required. - :type role_instance_name: str - :param resource_group_name: Name of the resource group. Required. - :type resource_group_name: str - :param cloud_service_name: Name of the cloud service. Required. - :type cloud_service_name: str - :return: RoleInstanceView or the result of cls(response) - :rtype: ~azure.mgmt.compute.models.RoleInstanceView - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-04")) - cls: ClsType[_models.RoleInstanceView] = kwargs.pop("cls", None) - - _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, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("RoleInstanceView", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def list( - self, - resource_group_name: str, - cloud_service_name: str, - expand: Optional[Union[str, _models.InstanceViewTypes]] = None, - **kwargs: Any - ) -> ItemPaged["_models.RoleInstance"]: - """Gets the list of all role instances in a cloud service. Use nextLink property in the response - to get the next page of role instances. Do this till nextLink is null to fetch all the role - instances. - - :param resource_group_name: Name of the resource group. Required. - :type resource_group_name: str - :param cloud_service_name: Name of the cloud service. Required. - :type cloud_service_name: str - :param expand: The expand expression to apply to the operation. 'UserData' is not supported for - cloud services. Known values are: "instanceView", "userData", and "resiliencyView". Default - value is None. - :type expand: str or ~azure.mgmt.compute.models.InstanceViewTypes - :return: An iterator like instance of either RoleInstance or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.models.RoleInstance] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-04")) - cls: ClsType[_models.RoleInstanceListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - cloud_service_name=cloud_service_name, - subscription_id=self._config.subscription_id, - expand=expand, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - _request = HttpRequest("GET", next_link) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("RoleInstanceListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - def _restart_initial( - self, role_instance_name: str, resource_group_name: str, cloud_service_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-04")) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_restart_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, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_restart( - self, role_instance_name: str, resource_group_name: str, cloud_service_name: str, **kwargs: Any - ) -> LROPoller[None]: - """The Reboot Role Instance asynchronous operation requests a reboot of a role instance in the - cloud service. - - :param role_instance_name: Name of the role instance. Required. - :type role_instance_name: str - :param resource_group_name: Name of the resource group. Required. - :type resource_group_name: str - :param cloud_service_name: Name of the cloud service. Required. - :type cloud_service_name: str - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-04")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._restart_initial( - 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, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _reimage_initial( - self, role_instance_name: str, resource_group_name: str, cloud_service_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-04")) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_reimage_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, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_reimage( - self, role_instance_name: str, resource_group_name: str, cloud_service_name: str, **kwargs: Any - ) -> LROPoller[None]: - """The Reimage Role Instance asynchronous operation reinstalls the operating system on instances - of web roles or worker roles. - - :param role_instance_name: Name of the role instance. Required. - :type role_instance_name: str - :param resource_group_name: Name of the resource group. Required. - :type resource_group_name: str - :param cloud_service_name: Name of the cloud service. Required. - :type cloud_service_name: str - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-04")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._reimage_initial( - 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, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _rebuild_initial( - self, role_instance_name: str, resource_group_name: str, cloud_service_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-04")) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_rebuild_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, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_rebuild( - self, role_instance_name: str, resource_group_name: str, cloud_service_name: str, **kwargs: Any - ) -> LROPoller[None]: - """The Rebuild Role Instance asynchronous operation reinstalls the operating system on instances - of web roles or worker roles and initializes the storage resources that are used by them. If - you do not want to initialize storage resources, you can use Reimage Role Instance. - - :param role_instance_name: Name of the role instance. Required. - :type role_instance_name: str - :param resource_group_name: Name of the resource group. Required. - :type resource_group_name: str - :param cloud_service_name: Name of the cloud service. Required. - :type cloud_service_name: str - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-04")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._rebuild_initial( - 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, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def get_remote_desktop_file( - self, role_instance_name: str, resource_group_name: str, cloud_service_name: str, **kwargs: Any - ) -> Iterator[bytes]: - """Gets a remote desktop file for a role instance in a cloud service. - - :param role_instance_name: Name of the role instance. Required. - :type role_instance_name: str - :param resource_group_name: Name of the resource group. Required. - :type resource_group_name: str - :param cloud_service_name: Name of the cloud service. Required. - :type cloud_service_name: str - :return: Iterator[bytes] or the result of cls(response) - :rtype: Iterator[bytes] - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-04")) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _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, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/operations/_cloud_service_roles_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/operations/_cloud_service_roles_operations.py deleted file mode 100644 index 0ea127486dca..000000000000 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/operations/_cloud_service_roles_operations.py +++ /dev/null @@ -1,251 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# 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 collections.abc import MutableMapping -from typing import Any, Callable, Optional, TypeVar - -from azure.core import PipelineClient -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models -from .._configuration import ComputeManagementClientConfiguration -from .._utils.serialization import Deserializer, Serializer - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] -List = list - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_get_request( - role_name: str, resource_group_name: str, cloud_service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-04")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roles/{roleName}", - ) - path_format_arguments = { - "roleName": _SERIALIZER.url("role_name", role_name, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "cloudServiceName": _SERIALIZER.url("cloud_service_name", cloud_service_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request( - resource_group_name: str, cloud_service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-04")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roles", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "cloudServiceName": _SERIALIZER.url("cloud_service_name", cloud_service_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class CloudServiceRolesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.compute.ComputeManagementClient`'s - :attr:`cloud_service_roles` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def get( - self, role_name: str, resource_group_name: str, cloud_service_name: str, **kwargs: Any - ) -> _models.CloudServiceRole: - """Gets a role from a cloud service. - - :param role_name: Name of the role. Required. - :type role_name: str - :param resource_group_name: Name of the resource group. Required. - :type resource_group_name: str - :param cloud_service_name: Name of the cloud service. Required. - :type cloud_service_name: str - :return: CloudServiceRole or the result of cls(response) - :rtype: ~azure.mgmt.compute.models.CloudServiceRole - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-04")) - cls: ClsType[_models.CloudServiceRole] = kwargs.pop("cls", None) - - _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, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("CloudServiceRole", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, cloud_service_name: str, **kwargs: Any - ) -> ItemPaged["_models.CloudServiceRole"]: - """Gets a list of all roles in a cloud service. Use nextLink property in the response to get the - next page of roles. Do this till nextLink is null to fetch all the roles. - - :param resource_group_name: Name of the resource group. Required. - :type resource_group_name: str - :param cloud_service_name: Name of the cloud service. Required. - :type cloud_service_name: str - :return: An iterator like instance of either CloudServiceRole or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.models.CloudServiceRole] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-04")) - cls: ClsType[_models.CloudServiceRoleListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - cloud_service_name=cloud_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - _request = HttpRequest("GET", next_link) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("CloudServiceRoleListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/operations/_cloud_services_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/operations/_cloud_services_operations.py deleted file mode 100644 index 8fb653b359b7..000000000000 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/operations/_cloud_services_operations.py +++ /dev/null @@ -1,2165 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression,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 collections.abc import MutableMapping -from io import IOBase -from typing import Any, Callable, IO, Iterator, Optional, TypeVar, Union, cast, overload - -from azure.core import PipelineClient -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - StreamClosedError, - StreamConsumedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from .._configuration import ComputeManagementClientConfiguration -from .._utils.serialization import Deserializer, Serializer - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] -List = list - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_create_or_update_request( - resource_group_name: str, cloud_service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-04")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "cloudServiceName": _SERIALIZER.url("cloud_service_name", cloud_service_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_request( - resource_group_name: str, cloud_service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-04")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "cloudServiceName": _SERIALIZER.url("cloud_service_name", cloud_service_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, cloud_service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-04")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "cloudServiceName": _SERIALIZER.url("cloud_service_name", cloud_service_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_request( - resource_group_name: str, cloud_service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-04")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "cloudServiceName": _SERIALIZER.url("cloud_service_name", cloud_service_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_instance_view_request( - resource_group_name: str, cloud_service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-04")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/instanceView", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "cloudServiceName": _SERIALIZER.url("cloud_service_name", cloud_service_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_all_request(subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-04")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/cloudServices") - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request(resource_group_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-04")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_start_request( - resource_group_name: str, cloud_service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-04")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/start", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "cloudServiceName": _SERIALIZER.url("cloud_service_name", cloud_service_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_power_off_request( - resource_group_name: str, cloud_service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-04")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/poweroff", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "cloudServiceName": _SERIALIZER.url("cloud_service_name", cloud_service_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_restart_request( - resource_group_name: str, cloud_service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-04")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/restart", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "cloudServiceName": _SERIALIZER.url("cloud_service_name", cloud_service_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_reimage_request( - resource_group_name: str, cloud_service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-04")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/reimage", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "cloudServiceName": _SERIALIZER.url("cloud_service_name", cloud_service_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_rebuild_request( - resource_group_name: str, cloud_service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-04")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/rebuild", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "cloudServiceName": _SERIALIZER.url("cloud_service_name", cloud_service_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_instances_request( - resource_group_name: str, cloud_service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-04")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/delete", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "cloudServiceName": _SERIALIZER.url("cloud_service_name", cloud_service_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class CloudServicesOperations: # pylint: disable=too-many-public-methods - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.compute.ComputeManagementClient`'s - :attr:`cloud_services` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - def _create_or_update_initial( - self, - resource_group_name: str, - cloud_service_name: str, - parameters: Optional[Union[_models.CloudService, IO[bytes]]] = None, - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-04")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - content_type = content_type if parameters else None - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" if parameters else None - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - if parameters is not None: - _json = self._serialize.body(parameters, "CloudService") - else: - _json = None - - _request = build_create_or_update_request( - 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, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - cloud_service_name: str, - parameters: Optional[_models.CloudService] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.CloudService]: - """Create or update a cloud service. Please note some properties can be set only during cloud - service creation. - - :param resource_group_name: Name of the resource group. Required. - :type resource_group_name: str - :param cloud_service_name: Name of the cloud service. Required. - :type cloud_service_name: str - :param parameters: The cloud service object. Default value is None. - :type parameters: ~azure.mgmt.compute.models.CloudService - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either CloudService or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.CloudService] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - cloud_service_name: str, - parameters: Optional[IO[bytes]] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.CloudService]: - """Create or update a cloud service. Please note some properties can be set only during cloud - service creation. - - :param resource_group_name: Name of the resource group. Required. - :type resource_group_name: str - :param cloud_service_name: Name of the cloud service. Required. - :type cloud_service_name: str - :param parameters: The cloud service object. Default value is None. - :type parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either CloudService or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.CloudService] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - cloud_service_name: str, - parameters: Optional[Union[_models.CloudService, IO[bytes]]] = None, - **kwargs: Any - ) -> LROPoller[_models.CloudService]: - """Create or update a cloud service. Please note some properties can be set only during cloud - service creation. - - :param resource_group_name: Name of the resource group. Required. - :type resource_group_name: str - :param cloud_service_name: Name of the cloud service. Required. - :type cloud_service_name: str - :param parameters: The cloud service object. Is either a CloudService type or a IO[bytes] type. - Default value is None. - :type parameters: ~azure.mgmt.compute.models.CloudService or IO[bytes] - :return: An instance of LROPoller that returns either CloudService or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.CloudService] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-04")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - content_type = content_type if parameters else None - cls: ClsType[_models.CloudService] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._create_or_update_initial( - resource_group_name=resource_group_name, - cloud_service_name=cloud_service_name, - parameters=parameters, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("CloudService", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.CloudService].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.CloudService]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _update_initial( - self, - resource_group_name: str, - cloud_service_name: str, - parameters: Optional[Union[_models.CloudServiceUpdate, IO[bytes]]] = None, - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-04")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - content_type = content_type if parameters else None - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" if parameters else None - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - if parameters is not None: - _json = self._serialize.body(parameters, "CloudServiceUpdate") - else: - _json = None - - _request = build_update_request( - 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, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update( - self, - resource_group_name: str, - cloud_service_name: str, - parameters: Optional[_models.CloudServiceUpdate] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.CloudService]: - """Update a cloud service. - - :param resource_group_name: Name of the resource group. Required. - :type resource_group_name: str - :param cloud_service_name: Name of the cloud service. Required. - :type cloud_service_name: str - :param parameters: The cloud service object. Default value is None. - :type parameters: ~azure.mgmt.compute.models.CloudServiceUpdate - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either CloudService or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.CloudService] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update( - self, - resource_group_name: str, - cloud_service_name: str, - parameters: Optional[IO[bytes]] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.CloudService]: - """Update a cloud service. - - :param resource_group_name: Name of the resource group. Required. - :type resource_group_name: str - :param cloud_service_name: Name of the cloud service. Required. - :type cloud_service_name: str - :param parameters: The cloud service object. Default value is None. - :type parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either CloudService or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.CloudService] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_update( - self, - resource_group_name: str, - cloud_service_name: str, - parameters: Optional[Union[_models.CloudServiceUpdate, IO[bytes]]] = None, - **kwargs: Any - ) -> LROPoller[_models.CloudService]: - """Update a cloud service. - - :param resource_group_name: Name of the resource group. Required. - :type resource_group_name: str - :param cloud_service_name: Name of the cloud service. Required. - :type cloud_service_name: str - :param parameters: The cloud service object. Is either a CloudServiceUpdate type or a IO[bytes] - type. Default value is None. - :type parameters: ~azure.mgmt.compute.models.CloudServiceUpdate or IO[bytes] - :return: An instance of LROPoller that returns either CloudService or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.CloudService] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-04")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - content_type = content_type if parameters else None - cls: ClsType[_models.CloudService] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._update_initial( - resource_group_name=resource_group_name, - cloud_service_name=cloud_service_name, - parameters=parameters, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("CloudService", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.CloudService].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.CloudService]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial(self, resource_group_name: str, cloud_service_name: str, **kwargs: Any) -> Iterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-04")) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - cloud_service_name=cloud_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_delete(self, resource_group_name: str, cloud_service_name: str, **kwargs: Any) -> LROPoller[None]: - """Deletes a cloud service. - - :param resource_group_name: Name of the resource group. Required. - :type resource_group_name: str - :param cloud_service_name: Name of the cloud service. Required. - :type cloud_service_name: str - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-04")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - cloud_service_name=cloud_service_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def get(self, resource_group_name: str, cloud_service_name: str, **kwargs: Any) -> _models.CloudService: - """Display information about a cloud service. - - :param resource_group_name: Name of the resource group. Required. - :type resource_group_name: str - :param cloud_service_name: Name of the cloud service. Required. - :type cloud_service_name: str - :return: CloudService or the result of cls(response) - :rtype: ~azure.mgmt.compute.models.CloudService - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-04")) - cls: ClsType[_models.CloudService] = kwargs.pop("cls", None) - - _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, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("CloudService", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def get_instance_view( - self, resource_group_name: str, cloud_service_name: str, **kwargs: Any - ) -> _models.CloudServiceInstanceView: - """Gets the status of a cloud service. - - :param resource_group_name: Name of the resource group. Required. - :type resource_group_name: str - :param cloud_service_name: Name of the cloud service. Required. - :type cloud_service_name: str - :return: CloudServiceInstanceView or the result of cls(response) - :rtype: ~azure.mgmt.compute.models.CloudServiceInstanceView - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-04")) - cls: ClsType[_models.CloudServiceInstanceView] = kwargs.pop("cls", None) - - _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, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("CloudServiceInstanceView", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def list_all(self, **kwargs: Any) -> ItemPaged["_models.CloudService"]: - """Gets a list of all cloud services in the subscription, regardless of the associated resource - group. Use nextLink property in the response to get the next page of Cloud Services. Do this - till nextLink is null to fetch all the Cloud Services. - - :return: An iterator like instance of either CloudService or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.models.CloudService] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-04")) - cls: ClsType[_models.CloudServiceListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_all_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - _request = HttpRequest("GET", next_link) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("CloudServiceListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @distributed_trace - def list(self, resource_group_name: str, **kwargs: Any) -> ItemPaged["_models.CloudService"]: - """Gets a list of all cloud services under a resource group. Use nextLink property in the response - to get the next page of Cloud Services. Do this till nextLink is null to fetch all the Cloud - Services. - - :param resource_group_name: Name of the resource group. Required. - :type resource_group_name: str - :return: An iterator like instance of either CloudService or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.models.CloudService] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-04")) - cls: ClsType[_models.CloudServiceListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - _request = HttpRequest("GET", next_link) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("CloudServiceListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - def _start_initial(self, resource_group_name: str, cloud_service_name: str, **kwargs: Any) -> Iterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-04")) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_start_request( - resource_group_name=resource_group_name, - cloud_service_name=cloud_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_start(self, resource_group_name: str, cloud_service_name: str, **kwargs: Any) -> LROPoller[None]: - """Starts the cloud service. - - :param resource_group_name: Name of the resource group. Required. - :type resource_group_name: str - :param cloud_service_name: Name of the cloud service. Required. - :type cloud_service_name: str - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-04")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._start_initial( - resource_group_name=resource_group_name, - cloud_service_name=cloud_service_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _power_off_initial(self, resource_group_name: str, cloud_service_name: str, **kwargs: Any) -> Iterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-04")) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_power_off_request( - resource_group_name=resource_group_name, - cloud_service_name=cloud_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_power_off(self, resource_group_name: str, cloud_service_name: str, **kwargs: Any) -> LROPoller[None]: - """Power off the cloud service. Note that resources are still attached and you are getting charged - for the resources. - - :param resource_group_name: Name of the resource group. Required. - :type resource_group_name: str - :param cloud_service_name: Name of the cloud service. Required. - :type cloud_service_name: str - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-04")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._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, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _restart_initial( - self, - resource_group_name: str, - cloud_service_name: str, - parameters: Optional[Union[_models.RoleInstances, IO[bytes]]] = None, - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-04")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - content_type = content_type if parameters else None - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" if parameters else None - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - if parameters is not None: - _json = self._serialize.body(parameters, "RoleInstances") - else: - _json = None - - _request = build_restart_request( - 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, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_restart( - self, - resource_group_name: str, - cloud_service_name: str, - parameters: Optional[_models.RoleInstances] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[None]: - """Restarts one or more role instances in a cloud service. - - :param resource_group_name: Name of the resource group. Required. - :type resource_group_name: str - :param cloud_service_name: Name of the cloud service. Required. - :type cloud_service_name: str - :param parameters: List of cloud service role instance names. Default value is None. - :type parameters: ~azure.mgmt.compute.models.RoleInstances - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_restart( - self, - resource_group_name: str, - cloud_service_name: str, - parameters: Optional[IO[bytes]] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[None]: - """Restarts one or more role instances in a cloud service. - - :param resource_group_name: Name of the resource group. Required. - :type resource_group_name: str - :param cloud_service_name: Name of the cloud service. Required. - :type cloud_service_name: str - :param parameters: List of cloud service role instance names. Default value is None. - :type parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_restart( - self, - resource_group_name: str, - cloud_service_name: str, - parameters: Optional[Union[_models.RoleInstances, IO[bytes]]] = None, - **kwargs: Any - ) -> LROPoller[None]: - """Restarts one or more role instances in a cloud service. - - :param resource_group_name: Name of the resource group. Required. - :type resource_group_name: str - :param cloud_service_name: Name of the cloud service. Required. - :type cloud_service_name: str - :param parameters: List of cloud service role instance names. Is either a RoleInstances type or - a IO[bytes] type. Default value is None. - :type parameters: ~azure.mgmt.compute.models.RoleInstances or IO[bytes] - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-04")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - content_type = content_type if parameters else None - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._restart_initial( - 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, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _reimage_initial( - self, - resource_group_name: str, - cloud_service_name: str, - parameters: Optional[Union[_models.RoleInstances, IO[bytes]]] = None, - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-04")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - content_type = content_type if parameters else None - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" if parameters else None - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - if parameters is not None: - _json = self._serialize.body(parameters, "RoleInstances") - else: - _json = None - - _request = build_reimage_request( - 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, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_reimage( - self, - resource_group_name: str, - cloud_service_name: str, - parameters: Optional[_models.RoleInstances] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[None]: - """Reimage asynchronous operation reinstalls the operating system on instances of web roles or - worker roles. - - :param resource_group_name: Name of the resource group. Required. - :type resource_group_name: str - :param cloud_service_name: Name of the cloud service. Required. - :type cloud_service_name: str - :param parameters: List of cloud service role instance names. Default value is None. - :type parameters: ~azure.mgmt.compute.models.RoleInstances - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_reimage( - self, - resource_group_name: str, - cloud_service_name: str, - parameters: Optional[IO[bytes]] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[None]: - """Reimage asynchronous operation reinstalls the operating system on instances of web roles or - worker roles. - - :param resource_group_name: Name of the resource group. Required. - :type resource_group_name: str - :param cloud_service_name: Name of the cloud service. Required. - :type cloud_service_name: str - :param parameters: List of cloud service role instance names. Default value is None. - :type parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_reimage( - self, - resource_group_name: str, - cloud_service_name: str, - parameters: Optional[Union[_models.RoleInstances, IO[bytes]]] = None, - **kwargs: Any - ) -> LROPoller[None]: - """Reimage asynchronous operation reinstalls the operating system on instances of web roles or - worker roles. - - :param resource_group_name: Name of the resource group. Required. - :type resource_group_name: str - :param cloud_service_name: Name of the cloud service. Required. - :type cloud_service_name: str - :param parameters: List of cloud service role instance names. Is either a RoleInstances type or - a IO[bytes] type. Default value is None. - :type parameters: ~azure.mgmt.compute.models.RoleInstances or IO[bytes] - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-04")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - content_type = content_type if parameters else None - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._reimage_initial( - 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, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _rebuild_initial( - self, - resource_group_name: str, - cloud_service_name: str, - parameters: Optional[Union[_models.RoleInstances, IO[bytes]]] = None, - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-04")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - content_type = content_type if parameters else None - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" if parameters else None - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - if parameters is not None: - _json = self._serialize.body(parameters, "RoleInstances") - else: - _json = None - - _request = build_rebuild_request( - 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, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_rebuild( - self, - resource_group_name: str, - cloud_service_name: str, - parameters: Optional[_models.RoleInstances] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[None]: - """Rebuild Role Instances reinstalls the operating system on instances of web roles or worker - roles and initializes the storage resources that are used by them. If you do not want to - initialize storage resources, you can use Reimage Role Instances. - - :param resource_group_name: Name of the resource group. Required. - :type resource_group_name: str - :param cloud_service_name: Name of the cloud service. Required. - :type cloud_service_name: str - :param parameters: List of cloud service role instance names. Default value is None. - :type parameters: ~azure.mgmt.compute.models.RoleInstances - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_rebuild( - self, - resource_group_name: str, - cloud_service_name: str, - parameters: Optional[IO[bytes]] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[None]: - """Rebuild Role Instances reinstalls the operating system on instances of web roles or worker - roles and initializes the storage resources that are used by them. If you do not want to - initialize storage resources, you can use Reimage Role Instances. - - :param resource_group_name: Name of the resource group. Required. - :type resource_group_name: str - :param cloud_service_name: Name of the cloud service. Required. - :type cloud_service_name: str - :param parameters: List of cloud service role instance names. Default value is None. - :type parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_rebuild( - self, - resource_group_name: str, - cloud_service_name: str, - parameters: Optional[Union[_models.RoleInstances, IO[bytes]]] = None, - **kwargs: Any - ) -> LROPoller[None]: - """Rebuild Role Instances reinstalls the operating system on instances of web roles or worker - roles and initializes the storage resources that are used by them. If you do not want to - initialize storage resources, you can use Reimage Role Instances. - - :param resource_group_name: Name of the resource group. Required. - :type resource_group_name: str - :param cloud_service_name: Name of the cloud service. Required. - :type cloud_service_name: str - :param parameters: List of cloud service role instance names. Is either a RoleInstances type or - a IO[bytes] type. Default value is None. - :type parameters: ~azure.mgmt.compute.models.RoleInstances or IO[bytes] - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-04")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - content_type = content_type if parameters else None - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._rebuild_initial( - 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, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _delete_instances_initial( - self, - resource_group_name: str, - cloud_service_name: str, - parameters: Optional[Union[_models.RoleInstances, IO[bytes]]] = None, - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-04")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - content_type = content_type if parameters else None - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" if parameters else None - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - if parameters is not None: - _json = self._serialize.body(parameters, "RoleInstances") - else: - _json = None - - _request = build_delete_instances_request( - 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, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_delete_instances( - self, - resource_group_name: str, - cloud_service_name: str, - parameters: Optional[_models.RoleInstances] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[None]: - """Deletes role instances in a cloud service. - - :param resource_group_name: Name of the resource group. Required. - :type resource_group_name: str - :param cloud_service_name: Name of the cloud service. Required. - :type cloud_service_name: str - :param parameters: List of cloud service role instance names. Default value is None. - :type parameters: ~azure.mgmt.compute.models.RoleInstances - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_delete_instances( - self, - resource_group_name: str, - cloud_service_name: str, - parameters: Optional[IO[bytes]] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[None]: - """Deletes role instances in a cloud service. - - :param resource_group_name: Name of the resource group. Required. - :type resource_group_name: str - :param cloud_service_name: Name of the cloud service. Required. - :type cloud_service_name: str - :param parameters: List of cloud service role instance names. Default value is None. - :type parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_delete_instances( - self, - resource_group_name: str, - cloud_service_name: str, - parameters: Optional[Union[_models.RoleInstances, IO[bytes]]] = None, - **kwargs: Any - ) -> LROPoller[None]: - """Deletes role instances in a cloud service. - - :param resource_group_name: Name of the resource group. Required. - :type resource_group_name: str - :param cloud_service_name: Name of the cloud service. Required. - :type cloud_service_name: str - :param parameters: List of cloud service role instance names. Is either a RoleInstances type or - a IO[bytes] type. Default value is None. - :type parameters: ~azure.mgmt.compute.models.RoleInstances or IO[bytes] - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-04")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - content_type = content_type if parameters else None - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_instances_initial( - 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, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/operations/_cloud_services_update_domain_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/operations/_cloud_services_update_domain_operations.py deleted file mode 100644 index 4a19924c2f71..000000000000 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/operations/_cloud_services_update_domain_operations.py +++ /dev/null @@ -1,499 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# 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 collections.abc import MutableMapping -from io import IOBase -from typing import Any, Callable, IO, Iterator, Optional, TypeVar, Union, cast, overload - -from azure.core import PipelineClient -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - StreamClosedError, - StreamConsumedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from .._configuration import ComputeManagementClientConfiguration -from .._utils.serialization import Deserializer, Serializer - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] -List = list - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_walk_update_domain_request( - resource_group_name: str, cloud_service_name: str, update_domain: int, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-04")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/updateDomains/{updateDomain}", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "cloudServiceName": _SERIALIZER.url("cloud_service_name", cloud_service_name, "str"), - "updateDomain": _SERIALIZER.url("update_domain", update_domain, "int"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_update_domain_request( - resource_group_name: str, cloud_service_name: str, update_domain: int, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-04")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/updateDomains/{updateDomain}", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "cloudServiceName": _SERIALIZER.url("cloud_service_name", cloud_service_name, "str"), - "updateDomain": _SERIALIZER.url("update_domain", update_domain, "int"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_update_domains_request( - resource_group_name: str, cloud_service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-04")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/updateDomains", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "cloudServiceName": _SERIALIZER.url("cloud_service_name", cloud_service_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class CloudServicesUpdateDomainOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.compute.ComputeManagementClient`'s - :attr:`cloud_services_update_domain` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - def _walk_update_domain_initial( - self, - resource_group_name: str, - cloud_service_name: str, - update_domain: int, - parameters: Optional[Union[_models.UpdateDomain, IO[bytes]]] = None, - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-04")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - content_type = content_type if parameters else None - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" if parameters else None - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - if parameters is not None: - _json = self._serialize.body(parameters, "UpdateDomain") - else: - _json = None - - _request = build_walk_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, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_walk_update_domain( - self, - resource_group_name: str, - cloud_service_name: str, - update_domain: int, - parameters: Optional[_models.UpdateDomain] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[None]: - """Updates the role instances in the specified update domain. - - :param resource_group_name: Name of the resource group. Required. - :type resource_group_name: str - :param cloud_service_name: Name of the cloud service. Required. - :type cloud_service_name: str - :param update_domain: Specifies an integer value that identifies the update domain. Update - 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. Required. - :type update_domain: int - :param parameters: The update domain object. Default value is None. - :type parameters: ~azure.mgmt.compute.models.UpdateDomain - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_walk_update_domain( - self, - resource_group_name: str, - cloud_service_name: str, - update_domain: int, - parameters: Optional[IO[bytes]] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[None]: - """Updates the role instances in the specified update domain. - - :param resource_group_name: Name of the resource group. Required. - :type resource_group_name: str - :param cloud_service_name: Name of the cloud service. Required. - :type cloud_service_name: str - :param update_domain: Specifies an integer value that identifies the update domain. Update - 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. Required. - :type update_domain: int - :param parameters: The update domain object. Default value is None. - :type parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_walk_update_domain( - self, - resource_group_name: str, - cloud_service_name: str, - update_domain: int, - parameters: Optional[Union[_models.UpdateDomain, IO[bytes]]] = None, - **kwargs: Any - ) -> LROPoller[None]: - """Updates the role instances in the specified update domain. - - :param resource_group_name: Name of the resource group. Required. - :type resource_group_name: str - :param cloud_service_name: Name of the cloud service. Required. - :type cloud_service_name: str - :param update_domain: Specifies an integer value that identifies the update domain. Update - 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. Required. - :type update_domain: int - :param parameters: The update domain object. Is either a UpdateDomain type or a IO[bytes] type. - Default value is None. - :type parameters: ~azure.mgmt.compute.models.UpdateDomain or IO[bytes] - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-04")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - content_type = content_type if parameters else None - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._walk_update_domain_initial( - resource_group_name=resource_group_name, - 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, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def get_update_domain( - self, resource_group_name: str, cloud_service_name: str, update_domain: int, **kwargs: Any - ) -> _models.UpdateDomain: - """Gets the specified update domain of a cloud service. Use nextLink property in the response to - get the next page of update domains. Do this till nextLink is null to fetch all the update - domains. - - :param resource_group_name: Name of the resource group. Required. - :type resource_group_name: str - :param cloud_service_name: Name of the cloud service. Required. - :type cloud_service_name: str - :param update_domain: Specifies an integer value that identifies the update domain. Update - 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. Required. - :type update_domain: int - :return: UpdateDomain or the result of cls(response) - :rtype: ~azure.mgmt.compute.models.UpdateDomain - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-04")) - cls: ClsType[_models.UpdateDomain] = kwargs.pop("cls", None) - - _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, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("UpdateDomain", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def list_update_domains( - self, resource_group_name: str, cloud_service_name: str, **kwargs: Any - ) -> ItemPaged["_models.UpdateDomain"]: - """Gets a list of all update domains in a cloud service. - - :param resource_group_name: Name of the resource group. Required. - :type resource_group_name: str - :param cloud_service_name: Name of the cloud service. Required. - :type cloud_service_name: str - :return: An iterator like instance of either UpdateDomain or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.models.UpdateDomain] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-04")) - cls: ClsType[_models.UpdateDomainListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_update_domains_request( - resource_group_name=resource_group_name, - cloud_service_name=cloud_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - _request = HttpRequest("GET", next_link) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("UpdateDomainListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/operations/_community_galleries_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/operations/_community_galleries_operations.py deleted file mode 100644 index 706424c5af45..000000000000 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/operations/_community_galleries_operations.py +++ /dev/null @@ -1,139 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# 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 collections.abc import MutableMapping -from typing import Any, Callable, Optional, TypeVar - -from azure.core import PipelineClient -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models -from .._configuration import ComputeManagementClientConfiguration -from .._utils.serialization import Deserializer, Serializer - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] -List = list - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_get_request(location: str, public_gallery_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-03")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/communityGalleries/{publicGalleryName}", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "location": _SERIALIZER.url("location", location, "str", min_length=1), - "publicGalleryName": _SERIALIZER.url("public_gallery_name", public_gallery_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class CommunityGalleriesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.compute.ComputeManagementClient`'s - :attr:`community_galleries` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def get(self, location: str, public_gallery_name: str, **kwargs: Any) -> _models.CommunityGallery: - """Get a community gallery by gallery public name. - - :param location: The name of Azure region. Required. - :type location: str - :param public_gallery_name: The public name of the community gallery. Required. - :type public_gallery_name: str - :return: CommunityGallery or the result of cls(response) - :rtype: ~azure.mgmt.compute.models.CommunityGallery - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-03")) - cls: ClsType[_models.CommunityGallery] = kwargs.pop("cls", None) - - _request = build_get_request( - location=location, - public_gallery_name=public_gallery_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("CommunityGallery", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/operations/_community_gallery_image_versions_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/operations/_community_gallery_image_versions_operations.py deleted file mode 100644 index a26bb34b19ff..000000000000 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/operations/_community_gallery_image_versions_operations.py +++ /dev/null @@ -1,272 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# 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 collections.abc import MutableMapping -from typing import Any, Callable, Optional, TypeVar - -from azure.core import PipelineClient -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models -from .._configuration import ComputeManagementClientConfiguration -from .._utils.serialization import Deserializer, Serializer - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] -List = list - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_request( - location: str, public_gallery_name: str, gallery_image_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-03")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/communityGalleries/{publicGalleryName}/images/{galleryImageName}/versions", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "location": _SERIALIZER.url("location", location, "str", min_length=1), - "publicGalleryName": _SERIALIZER.url("public_gallery_name", public_gallery_name, "str"), - "galleryImageName": _SERIALIZER.url("gallery_image_name", gallery_image_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_request( - location: str, - public_gallery_name: str, - gallery_image_name: str, - gallery_image_version_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-03")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/communityGalleries/{publicGalleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "location": _SERIALIZER.url("location", location, "str", min_length=1), - "publicGalleryName": _SERIALIZER.url("public_gallery_name", public_gallery_name, "str"), - "galleryImageName": _SERIALIZER.url("gallery_image_name", gallery_image_name, "str"), - "galleryImageVersionName": _SERIALIZER.url("gallery_image_version_name", gallery_image_version_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class CommunityGalleryImageVersionsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.compute.ComputeManagementClient`'s - :attr:`community_gallery_image_versions` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list( - self, location: str, public_gallery_name: str, gallery_image_name: str, **kwargs: Any - ) -> ItemPaged["_models.CommunityGalleryImageVersion"]: - """List community gallery image versions inside an image. - - :param location: The name of Azure region. Required. - :type location: str - :param public_gallery_name: The public name of the community gallery. Required. - :type public_gallery_name: str - :param gallery_image_name: The name of the community gallery image definition. Required. - :type gallery_image_name: str - :return: An iterator like instance of either CommunityGalleryImageVersion or the result of - cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.models.CommunityGalleryImageVersion] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-03")) - cls: ClsType[_models.CommunityGalleryImageVersionList] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - location=location, - public_gallery_name=public_gallery_name, - gallery_image_name=gallery_image_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - _request = HttpRequest("GET", next_link) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("CommunityGalleryImageVersionList", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @distributed_trace - def get( - self, - location: str, - public_gallery_name: str, - gallery_image_name: str, - gallery_image_version_name: str, - **kwargs: Any - ) -> _models.CommunityGalleryImageVersion: - """Get a community gallery image version. - - :param location: The name of Azure region. Required. - :type location: str - :param public_gallery_name: The public name of the community gallery. Required. - :type public_gallery_name: str - :param gallery_image_name: The name of the community gallery image definition. Required. - :type gallery_image_name: str - :param gallery_image_version_name: The name of the community gallery image version. Needs to - follow semantic version name pattern: The allowed characters are digit and period. Digits must - be within the range of a 32-bit integer. Format: :code:``.\\ - :code:``.\\ :code:``. Required. - :type gallery_image_version_name: str - :return: CommunityGalleryImageVersion or the result of cls(response) - :rtype: ~azure.mgmt.compute.models.CommunityGalleryImageVersion - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-03")) - cls: ClsType[_models.CommunityGalleryImageVersion] = kwargs.pop("cls", None) - - _request = build_get_request( - location=location, - public_gallery_name=public_gallery_name, - gallery_image_name=gallery_image_name, - gallery_image_version_name=gallery_image_version_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("CommunityGalleryImageVersion", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/operations/_community_gallery_images_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/operations/_community_gallery_images_operations.py deleted file mode 100644 index 922a82e4f19b..000000000000 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/operations/_community_gallery_images_operations.py +++ /dev/null @@ -1,249 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# 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 collections.abc import MutableMapping -from typing import Any, Callable, Optional, TypeVar - -from azure.core import PipelineClient -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models -from .._configuration import ComputeManagementClientConfiguration -from .._utils.serialization import Deserializer, Serializer - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] -List = list - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_request(location: str, public_gallery_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-03")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/communityGalleries/{publicGalleryName}/images", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "location": _SERIALIZER.url("location", location, "str", min_length=1), - "publicGalleryName": _SERIALIZER.url("public_gallery_name", public_gallery_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_request( - location: str, public_gallery_name: str, gallery_image_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-03")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/communityGalleries/{publicGalleryName}/images/{galleryImageName}", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "location": _SERIALIZER.url("location", location, "str", min_length=1), - "publicGalleryName": _SERIALIZER.url("public_gallery_name", public_gallery_name, "str"), - "galleryImageName": _SERIALIZER.url("gallery_image_name", gallery_image_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class CommunityGalleryImagesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.compute.ComputeManagementClient`'s - :attr:`community_gallery_images` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list( - self, location: str, public_gallery_name: str, **kwargs: Any - ) -> ItemPaged["_models.CommunityGalleryImage"]: - """List community gallery images inside a gallery. - - :param location: The name of Azure region. Required. - :type location: str - :param public_gallery_name: The public name of the community gallery. Required. - :type public_gallery_name: str - :return: An iterator like instance of either CommunityGalleryImage or the result of - cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.models.CommunityGalleryImage] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-03")) - cls: ClsType[_models.CommunityGalleryImageList] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - location=location, - public_gallery_name=public_gallery_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - _request = HttpRequest("GET", next_link) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("CommunityGalleryImageList", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @distributed_trace - def get( - self, location: str, public_gallery_name: str, gallery_image_name: str, **kwargs: Any - ) -> _models.CommunityGalleryImage: - """Get a community gallery image. - - :param location: The name of Azure region. Required. - :type location: str - :param public_gallery_name: The public name of the community gallery. Required. - :type public_gallery_name: str - :param gallery_image_name: The name of the community gallery image definition. Required. - :type gallery_image_name: str - :return: CommunityGalleryImage or the result of cls(response) - :rtype: ~azure.mgmt.compute.models.CommunityGalleryImage - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-03")) - cls: ClsType[_models.CommunityGalleryImage] = kwargs.pop("cls", None) - - _request = build_get_request( - location=location, - public_gallery_name=public_gallery_name, - gallery_image_name=gallery_image_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("CommunityGalleryImage", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/operations/_dedicated_host_groups_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/operations/_dedicated_host_groups_operations.py deleted file mode 100644 index c743fe43f236..000000000000 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/operations/_dedicated_host_groups_operations.py +++ /dev/null @@ -1,777 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# 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 collections.abc import MutableMapping -from io import IOBase -from typing import Any, Callable, IO, Optional, TypeVar, Union, overload - -from azure.core import PipelineClient -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models -from .._configuration import ComputeManagementClientConfiguration -from .._utils.serialization import Deserializer, Serializer - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] -List = list - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_by_subscription_request(subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - accept = _headers.pop("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", min_length=1), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_by_resource_group_request(resource_group_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_request( - resource_group_name: str, - host_group_name: str, - subscription_id: str, - *, - expand: Optional[Union[str, _models.InstanceViewTypes]] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "hostGroupName": _SERIALIZER.url("host_group_name", host_group_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if expand is not None: - _params["$expand"] = _SERIALIZER.query("expand", expand, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, host_group_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "hostGroupName": _SERIALIZER.url("host_group_name", host_group_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_request( - resource_group_name: str, host_group_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "hostGroupName": _SERIALIZER.url("host_group_name", host_group_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, host_group_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "hostGroupName": _SERIALIZER.url("host_group_name", host_group_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -class DedicatedHostGroupsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.compute.ComputeManagementClient`'s - :attr:`dedicated_host_groups` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list_by_subscription(self, **kwargs: Any) -> ItemPaged["_models.DedicatedHostGroup"]: - """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. - - :return: An iterator like instance of either DedicatedHostGroup or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.models.DedicatedHostGroup] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[_models.DedicatedHostGroupListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_by_subscription_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - _request = HttpRequest("GET", next_link) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @distributed_trace - def list_by_resource_group( - self, resource_group_name: str, **kwargs: Any - ) -> ItemPaged["_models.DedicatedHostGroup"]: - """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. The name is case insensitive. - Required. - :type resource_group_name: str - :return: An iterator like instance of either DedicatedHostGroup or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.models.DedicatedHostGroup] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[_models.DedicatedHostGroupListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_by_resource_group_request( - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - _request = HttpRequest("GET", next_link) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @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. The name is case insensitive. - Required. - :type resource_group_name: str - :param host_group_name: The name of the dedicated host group. Required. - :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. Known values are: "instanceView", "userData", and - "resiliencyView". Default value is None. - :type expand: str or ~azure.mgmt.compute.models.InstanceViewTypes - :return: DedicatedHostGroup or the result of cls(response) - :rtype: ~azure.mgmt.compute.models.DedicatedHostGroup - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[_models.DedicatedHostGroup] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - host_group_name=host_group_name, - subscription_id=self._config.subscription_id, - expand=expand, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("DedicatedHostGroup", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def create_or_update( - self, - resource_group_name: str, - host_group_name: str, - parameters: _models.DedicatedHostGroup, - *, - content_type: str = "application/json", - **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. The name is case insensitive. - Required. - :type resource_group_name: str - :param host_group_name: The name of the dedicated host group. Required. - :type host_group_name: str - :param parameters: Parameters supplied to the Create Dedicated Host Group. Required. - :type parameters: ~azure.mgmt.compute.models.DedicatedHostGroup - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: DedicatedHostGroup or the result of cls(response) - :rtype: ~azure.mgmt.compute.models.DedicatedHostGroup - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def create_or_update( - self, - resource_group_name: str, - host_group_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **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. The name is case insensitive. - Required. - :type resource_group_name: str - :param host_group_name: The name of the dedicated host group. Required. - :type host_group_name: str - :param parameters: Parameters supplied to the Create Dedicated Host Group. Required. - :type parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: DedicatedHostGroup or the result of cls(response) - :rtype: ~azure.mgmt.compute.models.DedicatedHostGroup - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def create_or_update( - self, - resource_group_name: str, - host_group_name: str, - parameters: Union[_models.DedicatedHostGroup, IO[bytes]], - **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. The name is case insensitive. - Required. - :type resource_group_name: str - :param host_group_name: The name of the dedicated host group. Required. - :type host_group_name: str - :param parameters: Parameters supplied to the Create Dedicated Host Group. Is either a - DedicatedHostGroup type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.compute.models.DedicatedHostGroup or IO[bytes] - :return: DedicatedHostGroup or the result of cls(response) - :rtype: ~azure.mgmt.compute.models.DedicatedHostGroup - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.DedicatedHostGroup] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _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, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("DedicatedHostGroup", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def update( - self, - resource_group_name: str, - host_group_name: str, - parameters: _models.DedicatedHostGroupUpdate, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.DedicatedHostGroup: - """Update an dedicated host group. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param host_group_name: The name of the dedicated host group. Required. - :type host_group_name: str - :param parameters: Parameters supplied to the Update Dedicated Host Group operation. Required. - :type parameters: ~azure.mgmt.compute.models.DedicatedHostGroupUpdate - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: DedicatedHostGroup or the result of cls(response) - :rtype: ~azure.mgmt.compute.models.DedicatedHostGroup - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def update( - self, - resource_group_name: str, - host_group_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.DedicatedHostGroup: - """Update an dedicated host group. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param host_group_name: The name of the dedicated host group. Required. - :type host_group_name: str - :param parameters: Parameters supplied to the Update Dedicated Host Group operation. Required. - :type parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: DedicatedHostGroup or the result of cls(response) - :rtype: ~azure.mgmt.compute.models.DedicatedHostGroup - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def update( - self, - resource_group_name: str, - host_group_name: str, - parameters: Union[_models.DedicatedHostGroupUpdate, IO[bytes]], - **kwargs: Any - ) -> _models.DedicatedHostGroup: - """Update an dedicated host group. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param host_group_name: The name of the dedicated host group. Required. - :type host_group_name: str - :param parameters: Parameters supplied to the Update Dedicated Host Group operation. Is either - a DedicatedHostGroupUpdate type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.compute.models.DedicatedHostGroupUpdate or IO[bytes] - :return: DedicatedHostGroup or the result of cls(response) - :rtype: ~azure.mgmt.compute.models.DedicatedHostGroup - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.DedicatedHostGroup] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _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, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("DedicatedHostGroup", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. The name is case insensitive. - Required. - :type resource_group_name: str - :param host_group_name: The name of the dedicated host group. Required. - :type host_group_name: str - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - - _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, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 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, {}) # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/operations/_dedicated_hosts_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/operations/_dedicated_hosts_operations.py deleted file mode 100644 index ddeb37d67b63..000000000000 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/operations/_dedicated_hosts_operations.py +++ /dev/null @@ -1,1347 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression,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 collections.abc import MutableMapping -from io import IOBase -from typing import Any, Callable, IO, Iterator, Optional, TypeVar, Union, cast, overload - -from azure.core import PipelineClient -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - StreamClosedError, - StreamConsumedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from .._configuration import ComputeManagementClientConfiguration -from .._utils.serialization import Deserializer, Serializer - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] -List = list - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_by_host_group_request( - resource_group_name: str, host_group_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "hostGroupName": _SERIALIZER.url("host_group_name", host_group_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_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: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "hostGroupName": _SERIALIZER.url("host_group_name", host_group_name, "str"), - "hostName": _SERIALIZER.url("host_name", host_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if expand is not None: - _params["$expand"] = _SERIALIZER.query("expand", expand, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, host_group_name: str, host_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "hostGroupName": _SERIALIZER.url("host_group_name", host_group_name, "str"), - "hostName": _SERIALIZER.url("host_name", host_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_request( - resource_group_name: str, host_group_name: str, host_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "hostGroupName": _SERIALIZER.url("host_group_name", host_group_name, "str"), - "hostName": _SERIALIZER.url("host_name", host_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, host_group_name: str, host_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "hostGroupName": _SERIALIZER.url("host_group_name", host_group_name, "str"), - "hostName": _SERIALIZER.url("host_name", host_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_available_sizes_request( - resource_group_name: str, host_group_name: str, host_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}/hostSizes", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "hostGroupName": _SERIALIZER.url("host_group_name", host_group_name, "str"), - "hostName": _SERIALIZER.url("host_name", host_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_redeploy_request( - resource_group_name: str, host_group_name: str, host_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}/redeploy", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "hostGroupName": _SERIALIZER.url("host_group_name", host_group_name, "str"), - "hostName": _SERIALIZER.url("host_name", host_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_restart_request( - resource_group_name: str, host_group_name: str, host_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}/restart", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "hostGroupName": _SERIALIZER.url("host_group_name", host_group_name, "str"), - "hostName": _SERIALIZER.url("host_name", host_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class DedicatedHostsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.compute.ComputeManagementClient`'s - :attr:`dedicated_hosts` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list_by_host_group( - self, resource_group_name: str, host_group_name: str, **kwargs: Any - ) -> ItemPaged["_models.DedicatedHost"]: - """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. The name is case insensitive. - Required. - :type resource_group_name: str - :param host_group_name: The name of the dedicated host group. Required. - :type host_group_name: str - :return: An iterator like instance of either DedicatedHost or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.models.DedicatedHost] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[_models.DedicatedHostListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_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, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - _request = HttpRequest("GET", next_link) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @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. The name is case insensitive. - Required. - :type resource_group_name: str - :param host_group_name: The name of the dedicated host group. Required. - :type host_group_name: str - :param host_name: The name of the dedicated host. Required. - :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. Known values are: "instanceView", "userData", and "resiliencyView". Default value is - None. - :type expand: str or ~azure.mgmt.compute.models.InstanceViewTypes - :return: DedicatedHost or the result of cls(response) - :rtype: ~azure.mgmt.compute.models.DedicatedHost - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[_models.DedicatedHost] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - host_group_name=host_group_name, - host_name=host_name, - subscription_id=self._config.subscription_id, - expand=expand, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("DedicatedHost", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - host_group_name: str, - host_name: str, - parameters: Union[_models.DedicatedHost, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "DedicatedHost") - - _request = build_create_or_update_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, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 201: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - host_group_name: str, - host_name: str, - parameters: _models.DedicatedHost, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.DedicatedHost]: - """Create or update a dedicated host . - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param host_group_name: The name of the dedicated host group. Required. - :type host_group_name: str - :param host_name: The name of the dedicated host. Required. - :type host_name: str - :param parameters: Parameters supplied to the Create Dedicated Host. Required. - :type parameters: ~azure.mgmt.compute.models.DedicatedHost - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either DedicatedHost or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.DedicatedHost] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - host_group_name: str, - host_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.DedicatedHost]: - """Create or update a dedicated host . - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param host_group_name: The name of the dedicated host group. Required. - :type host_group_name: str - :param host_name: The name of the dedicated host. Required. - :type host_name: str - :param parameters: Parameters supplied to the Create Dedicated Host. Required. - :type parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either DedicatedHost or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.DedicatedHost] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - host_group_name: str, - host_name: str, - parameters: Union[_models.DedicatedHost, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.DedicatedHost]: - """Create or update a dedicated host . - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param host_group_name: The name of the dedicated host group. Required. - :type host_group_name: str - :param host_name: The name of the dedicated host. Required. - :type host_name: str - :param parameters: Parameters supplied to the Create Dedicated Host. Is either a DedicatedHost - type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.compute.models.DedicatedHost or IO[bytes] - :return: An instance of LROPoller that returns either DedicatedHost or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.DedicatedHost] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.DedicatedHost] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._create_or_update_initial( - resource_group_name=resource_group_name, - 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, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("DedicatedHost", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.DedicatedHost].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.DedicatedHost]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _update_initial( - self, - resource_group_name: str, - host_group_name: str, - host_name: str, - parameters: Union[_models.DedicatedHostUpdate, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "DedicatedHostUpdate") - - _request = build_update_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, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update( - self, - resource_group_name: str, - host_group_name: str, - host_name: str, - parameters: _models.DedicatedHostUpdate, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.DedicatedHost]: - """Update a dedicated host . - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param host_group_name: The name of the dedicated host group. Required. - :type host_group_name: str - :param host_name: The name of the dedicated host. Required. - :type host_name: str - :param parameters: Parameters supplied to the Update Dedicated Host operation. Required. - :type parameters: ~azure.mgmt.compute.models.DedicatedHostUpdate - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either DedicatedHost or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.DedicatedHost] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update( - self, - resource_group_name: str, - host_group_name: str, - host_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.DedicatedHost]: - """Update a dedicated host . - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param host_group_name: The name of the dedicated host group. Required. - :type host_group_name: str - :param host_name: The name of the dedicated host. Required. - :type host_name: str - :param parameters: Parameters supplied to the Update Dedicated Host operation. Required. - :type parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either DedicatedHost or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.DedicatedHost] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_update( - self, - resource_group_name: str, - host_group_name: str, - host_name: str, - parameters: Union[_models.DedicatedHostUpdate, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.DedicatedHost]: - """Update a dedicated host . - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param host_group_name: The name of the dedicated host group. Required. - :type host_group_name: str - :param host_name: The name of the dedicated host. Required. - :type host_name: str - :param parameters: Parameters supplied to the Update Dedicated Host operation. Is either a - DedicatedHostUpdate type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.compute.models.DedicatedHostUpdate or IO[bytes] - :return: An instance of LROPoller that returns either DedicatedHost or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.DedicatedHost] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.DedicatedHost] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._update_initial( - resource_group_name=resource_group_name, - 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, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - response_headers = {} - response = pipeline_response.http_response - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = self._deserialize("DedicatedHost", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.DedicatedHost].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.DedicatedHost]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, host_group_name: str, host_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_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, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_delete( - 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. The name is case insensitive. - Required. - :type resource_group_name: str - :param host_group_name: The name of the dedicated host group. Required. - :type host_group_name: str - :param host_name: The name of the dedicated host. Required. - :type host_name: str - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( - 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, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list_available_sizes( - self, resource_group_name: str, host_group_name: str, host_name: str, **kwargs: Any - ) -> ItemPaged[str]: - """Lists all available dedicated host sizes to which the specified dedicated host can be resized. - NOTE: The dedicated host sizes provided can be used to only scale up the existing dedicated - host. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param host_group_name: The name of the dedicated host group. Required. - :type host_group_name: str - :param host_name: The name of the dedicated host. Required. - :type host_name: str - :return: An iterator like instance of either str or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[str] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[_models.DedicatedHostSizeListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_available_sizes_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, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - _request = HttpRequest("GET", next_link) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("DedicatedHostSizeListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - def _redeploy_initial( - self, resource_group_name: str, host_group_name: str, host_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_redeploy_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, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [202]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_redeploy( - self, resource_group_name: str, host_group_name: str, host_name: str, **kwargs: Any - ) -> LROPoller[None]: - """Redeploy the dedicated host. The operation will complete successfully once the dedicated host - has migrated to a new node and is running. To determine the health of VMs deployed on the - dedicated host after the redeploy check the Resource Health Center in the Azure Portal. Please - refer to https://docs.microsoft.com/azure/service-health/resource-health-overview for more - details. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param host_group_name: The name of the dedicated host group. Required. - :type host_group_name: str - :param host_name: The name of the dedicated host. Required. - :type host_name: str - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._redeploy_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, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _restart_initial( - self, resource_group_name: str, host_group_name: str, host_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_restart_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, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_restart( - 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/azure/service-health/resource-health-overview for more details. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param host_group_name: The name of the dedicated host group. Required. - :type host_group_name: str - :param host_name: The name of the dedicated host. Required. - :type host_name: str - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._restart_initial( - 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, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/operations/_disk_accesses_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/operations/_disk_accesses_operations.py deleted file mode 100644 index 281bf0cf2b08..000000000000 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/operations/_disk_accesses_operations.py +++ /dev/null @@ -1,1686 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression,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 collections.abc import MutableMapping -from io import IOBase -from typing import Any, Callable, IO, Iterator, Optional, TypeVar, Union, cast, overload - -from azure.core import PipelineClient -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - StreamClosedError, - StreamConsumedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from .._configuration import ComputeManagementClientConfiguration -from .._utils.serialization import Deserializer, Serializer - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] -List = list - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-01-02")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/diskAccesses") - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_by_resource_group_request(resource_group_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-01-02")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_request( - resource_group_name: str, disk_access_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-01-02")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "diskAccessName": _SERIALIZER.url("disk_access_name", disk_access_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, disk_access_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-01-02")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "diskAccessName": _SERIALIZER.url("disk_access_name", disk_access_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_request( - resource_group_name: str, disk_access_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-01-02")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "diskAccessName": _SERIALIZER.url("disk_access_name", disk_access_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, disk_access_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-01-02")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "diskAccessName": _SERIALIZER.url("disk_access_name", disk_access_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_private_endpoint_connections_request( # pylint: disable=name-too-long - resource_group_name: str, disk_access_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-01-02")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateEndpointConnections", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "diskAccessName": _SERIALIZER.url("disk_access_name", disk_access_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_a_private_endpoint_connection_request( # pylint: disable=name-too-long - resource_group_name: str, - disk_access_name: str, - private_endpoint_connection_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-01-02")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateEndpointConnections/{privateEndpointConnectionName}", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "diskAccessName": _SERIALIZER.url("disk_access_name", disk_access_name, "str"), - "privateEndpointConnectionName": _SERIALIZER.url( - "private_endpoint_connection_name", private_endpoint_connection_name, "str" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_a_private_endpoint_connection_request( # pylint: disable=name-too-long - resource_group_name: str, - disk_access_name: str, - private_endpoint_connection_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-01-02")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateEndpointConnections/{privateEndpointConnectionName}", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "diskAccessName": _SERIALIZER.url("disk_access_name", disk_access_name, "str"), - "privateEndpointConnectionName": _SERIALIZER.url( - "private_endpoint_connection_name", private_endpoint_connection_name, "str" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_a_private_endpoint_connection_request( # pylint: disable=name-too-long - resource_group_name: str, - disk_access_name: str, - private_endpoint_connection_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-01-02")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateEndpointConnections/{privateEndpointConnectionName}", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "diskAccessName": _SERIALIZER.url("disk_access_name", disk_access_name, "str"), - "privateEndpointConnectionName": _SERIALIZER.url( - "private_endpoint_connection_name", private_endpoint_connection_name, "str" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_private_link_resources_request( - resource_group_name: str, disk_access_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-01-02")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privatelinkresources", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "diskAccessName": _SERIALIZER.url("disk_access_name", disk_access_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class DiskAccessesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.compute.ComputeManagementClient`'s - :attr:`disk_accesses` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list(self, **kwargs: Any) -> ItemPaged["_models.DiskAccess"]: - """Lists all the disk access resources under a subscription. - - :return: An iterator like instance of either DiskAccess or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.models.DiskAccess] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-01-02")) - cls: ClsType[_models.DiskAccessList] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - _request = HttpRequest("GET", next_link) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("DiskAccessList", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @distributed_trace - def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> ItemPaged["_models.DiskAccess"]: - """Lists all the disk access resources under a resource group. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :return: An iterator like instance of either DiskAccess or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.models.DiskAccess] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-01-02")) - cls: ClsType[_models.DiskAccessList] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_by_resource_group_request( - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - _request = HttpRequest("GET", next_link) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("DiskAccessList", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @distributed_trace - def get(self, resource_group_name: str, disk_access_name: str, **kwargs: Any) -> _models.DiskAccess: - """Gets information about a disk access resource. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param disk_access_name: The name of the disk access resource that is being created. The name - can't be changed after the disk encryption set is created. Supported characters for the name - are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. - :type disk_access_name: str - :return: DiskAccess or the result of cls(response) - :rtype: ~azure.mgmt.compute.models.DiskAccess - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-01-02")) - cls: ClsType[_models.DiskAccess] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - disk_access_name=disk_access_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("DiskAccess", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - disk_access_name: str, - disk_access: Union[_models.DiskAccess, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-01-02")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(disk_access, (IOBase, bytes)): - _content = disk_access - else: - _json = self._serialize.body(disk_access, "DiskAccess") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - disk_access_name=disk_access_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - disk_access_name: str, - disk_access: _models.DiskAccess, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.DiskAccess]: - """Creates or updates a disk access resource. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param disk_access_name: The name of the disk access resource that is being created. The name - can't be changed after the disk encryption set is created. Supported characters for the name - are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. - :type disk_access_name: str - :param disk_access: disk access object supplied in the body of the Put disk access operation. - Required. - :type disk_access: ~azure.mgmt.compute.models.DiskAccess - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either DiskAccess or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.DiskAccess] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - disk_access_name: str, - disk_access: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.DiskAccess]: - """Creates or updates a disk access resource. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param disk_access_name: The name of the disk access resource that is being created. The name - can't be changed after the disk encryption set is created. Supported characters for the name - are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. - :type disk_access_name: str - :param disk_access: disk access object supplied in the body of the Put disk access operation. - Required. - :type disk_access: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either DiskAccess or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.DiskAccess] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - disk_access_name: str, - disk_access: Union[_models.DiskAccess, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.DiskAccess]: - """Creates or updates a disk access resource. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param disk_access_name: The name of the disk access resource that is being created. The name - can't be changed after the disk encryption set is created. Supported characters for the name - are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. - :type disk_access_name: str - :param disk_access: disk access object supplied in the body of the Put disk access operation. - Is either a DiskAccess type or a IO[bytes] type. Required. - :type disk_access: ~azure.mgmt.compute.models.DiskAccess or IO[bytes] - :return: An instance of LROPoller that returns either DiskAccess or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.DiskAccess] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-01-02")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.DiskAccess] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._create_or_update_initial( - resource_group_name=resource_group_name, - disk_access_name=disk_access_name, - disk_access=disk_access, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("DiskAccess", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.DiskAccess].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.DiskAccess]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _update_initial( - self, - resource_group_name: str, - disk_access_name: str, - disk_access: Union[_models.DiskAccessUpdate, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-01-02")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(disk_access, (IOBase, bytes)): - _content = disk_access - else: - _json = self._serialize.body(disk_access, "DiskAccessUpdate") - - _request = build_update_request( - resource_group_name=resource_group_name, - disk_access_name=disk_access_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update( - self, - resource_group_name: str, - disk_access_name: str, - disk_access: _models.DiskAccessUpdate, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.DiskAccess]: - """Updates (patches) a disk access resource. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param disk_access_name: The name of the disk access resource that is being created. The name - can't be changed after the disk encryption set is created. Supported characters for the name - are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. - :type disk_access_name: str - :param disk_access: disk access object supplied in the body of the Patch disk access operation. - Required. - :type disk_access: ~azure.mgmt.compute.models.DiskAccessUpdate - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either DiskAccess or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.DiskAccess] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update( - self, - resource_group_name: str, - disk_access_name: str, - disk_access: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.DiskAccess]: - """Updates (patches) a disk access resource. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param disk_access_name: The name of the disk access resource that is being created. The name - can't be changed after the disk encryption set is created. Supported characters for the name - are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. - :type disk_access_name: str - :param disk_access: disk access object supplied in the body of the Patch disk access operation. - Required. - :type disk_access: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either DiskAccess or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.DiskAccess] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_update( - self, - resource_group_name: str, - disk_access_name: str, - disk_access: Union[_models.DiskAccessUpdate, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.DiskAccess]: - """Updates (patches) a disk access resource. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param disk_access_name: The name of the disk access resource that is being created. The name - can't be changed after the disk encryption set is created. Supported characters for the name - are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. - :type disk_access_name: str - :param disk_access: disk access object supplied in the body of the Patch disk access operation. - Is either a DiskAccessUpdate type or a IO[bytes] type. Required. - :type disk_access: ~azure.mgmt.compute.models.DiskAccessUpdate or IO[bytes] - :return: An instance of LROPoller that returns either DiskAccess or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.DiskAccess] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-01-02")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.DiskAccess] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._update_initial( - resource_group_name=resource_group_name, - disk_access_name=disk_access_name, - disk_access=disk_access, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("DiskAccess", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.DiskAccess].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.DiskAccess]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial(self, resource_group_name: str, disk_access_name: str, **kwargs: Any) -> Iterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-01-02")) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - disk_access_name=disk_access_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_delete(self, resource_group_name: str, disk_access_name: str, **kwargs: Any) -> LROPoller[None]: - """Deletes a disk access resource. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param disk_access_name: The name of the disk access resource that is being created. The name - can't be changed after the disk encryption set is created. Supported characters for the name - are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. - :type disk_access_name: str - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-01-02")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - disk_access_name=disk_access_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list_private_endpoint_connections( - self, resource_group_name: str, disk_access_name: str, **kwargs: Any - ) -> ItemPaged["_models.PrivateEndpointConnection"]: - """List information about private endpoint connections under a disk access resource. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param disk_access_name: The name of the disk access resource that is being created. The name - can't be changed after the disk encryption set is created. Supported characters for the name - are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. - :type disk_access_name: str - :return: An iterator like instance of either PrivateEndpointConnection or the result of - cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.models.PrivateEndpointConnection] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-01-02")) - cls: ClsType[_models.PrivateEndpointConnectionListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_private_endpoint_connections_request( - resource_group_name=resource_group_name, - disk_access_name=disk_access_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - _request = HttpRequest("GET", next_link) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("PrivateEndpointConnectionListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @distributed_trace - def get_a_private_endpoint_connection( - self, resource_group_name: str, disk_access_name: str, private_endpoint_connection_name: str, **kwargs: Any - ) -> _models.PrivateEndpointConnection: - """Gets information about a private endpoint connection under a disk access resource. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param disk_access_name: The name of the disk access resource that is being created. The name - can't be changed after the disk encryption set is created. Supported characters for the name - are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. - :type disk_access_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection. Required. - :type private_endpoint_connection_name: str - :return: PrivateEndpointConnection or the result of cls(response) - :rtype: ~azure.mgmt.compute.models.PrivateEndpointConnection - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-01-02")) - cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) - - _request = build_get_a_private_endpoint_connection_request( - resource_group_name=resource_group_name, - disk_access_name=disk_access_name, - private_endpoint_connection_name=private_endpoint_connection_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _update_a_private_endpoint_connection_initial( # pylint: disable=name-too-long - self, - resource_group_name: str, - disk_access_name: str, - private_endpoint_connection_name: str, - private_endpoint_connection: Union[_models.PrivateEndpointConnection, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-01-02")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(private_endpoint_connection, (IOBase, bytes)): - _content = private_endpoint_connection - else: - _json = self._serialize.body(private_endpoint_connection, "PrivateEndpointConnection") - - _request = build_update_a_private_endpoint_connection_request( - resource_group_name=resource_group_name, - disk_access_name=disk_access_name, - private_endpoint_connection_name=private_endpoint_connection_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update_a_private_endpoint_connection( # pylint: disable=name-too-long - self, - resource_group_name: str, - disk_access_name: str, - private_endpoint_connection_name: str, - private_endpoint_connection: _models.PrivateEndpointConnection, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.PrivateEndpointConnection]: - """Approve or reject a private endpoint connection under disk access resource, this can't be used - to create a new private endpoint connection. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param disk_access_name: The name of the disk access resource that is being created. The name - can't be changed after the disk encryption set is created. Supported characters for the name - are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. - :type disk_access_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection. Required. - :type private_endpoint_connection_name: str - :param private_endpoint_connection: private endpoint connection object supplied in the body of - the Put private endpoint connection operation. Required. - :type private_endpoint_connection: ~azure.mgmt.compute.models.PrivateEndpointConnection - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either PrivateEndpointConnection or the result - of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.PrivateEndpointConnection] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update_a_private_endpoint_connection( # pylint: disable=name-too-long - self, - resource_group_name: str, - disk_access_name: str, - private_endpoint_connection_name: str, - private_endpoint_connection: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.PrivateEndpointConnection]: - """Approve or reject a private endpoint connection under disk access resource, this can't be used - to create a new private endpoint connection. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param disk_access_name: The name of the disk access resource that is being created. The name - can't be changed after the disk encryption set is created. Supported characters for the name - are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. - :type disk_access_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection. Required. - :type private_endpoint_connection_name: str - :param private_endpoint_connection: private endpoint connection object supplied in the body of - the Put private endpoint connection operation. Required. - :type private_endpoint_connection: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either PrivateEndpointConnection or the result - of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.PrivateEndpointConnection] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_update_a_private_endpoint_connection( # pylint: disable=name-too-long - self, - resource_group_name: str, - disk_access_name: str, - private_endpoint_connection_name: str, - private_endpoint_connection: Union[_models.PrivateEndpointConnection, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.PrivateEndpointConnection]: - """Approve or reject a private endpoint connection under disk access resource, this can't be used - to create a new private endpoint connection. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param disk_access_name: The name of the disk access resource that is being created. The name - can't be changed after the disk encryption set is created. Supported characters for the name - are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. - :type disk_access_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection. Required. - :type private_endpoint_connection_name: str - :param private_endpoint_connection: private endpoint connection object supplied in the body of - the Put private endpoint connection operation. Is either a PrivateEndpointConnection type or a - IO[bytes] type. Required. - :type private_endpoint_connection: ~azure.mgmt.compute.models.PrivateEndpointConnection or - IO[bytes] - :return: An instance of LROPoller that returns either PrivateEndpointConnection or the result - of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.PrivateEndpointConnection] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-01-02")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._update_a_private_endpoint_connection_initial( - resource_group_name=resource_group_name, - disk_access_name=disk_access_name, - private_endpoint_connection_name=private_endpoint_connection_name, - private_endpoint_connection=private_endpoint_connection, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.PrivateEndpointConnection].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.PrivateEndpointConnection]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_a_private_endpoint_connection_initial( # pylint: disable=name-too-long - self, resource_group_name: str, disk_access_name: str, private_endpoint_connection_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-01-02")) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_a_private_endpoint_connection_request( - resource_group_name=resource_group_name, - disk_access_name=disk_access_name, - private_endpoint_connection_name=private_endpoint_connection_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_delete_a_private_endpoint_connection( # pylint: disable=name-too-long - self, resource_group_name: str, disk_access_name: str, private_endpoint_connection_name: str, **kwargs: Any - ) -> LROPoller[None]: - """Deletes a private endpoint connection under a disk access resource. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param disk_access_name: The name of the disk access resource that is being created. The name - can't be changed after the disk encryption set is created. Supported characters for the name - are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. - :type disk_access_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection. Required. - :type private_endpoint_connection_name: str - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-01-02")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_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, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def get_private_link_resources( - self, resource_group_name: str, disk_access_name: str, **kwargs: Any - ) -> _models.PrivateLinkResourceListResult: - """Gets the private link resources possible under disk access resource. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param disk_access_name: The name of the disk access resource that is being created. The name - can't be changed after the disk encryption set is created. Supported characters for the name - are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. - :type disk_access_name: str - :return: PrivateLinkResourceListResult or the result of cls(response) - :rtype: ~azure.mgmt.compute.models.PrivateLinkResourceListResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-01-02")) - cls: ClsType[_models.PrivateLinkResourceListResult] = kwargs.pop("cls", None) - - _request = build_get_private_link_resources_request( - resource_group_name=resource_group_name, - disk_access_name=disk_access_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("PrivateLinkResourceListResult", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/operations/_disk_encryption_sets_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/operations/_disk_encryption_sets_operations.py deleted file mode 100644 index 9e19ec5f096a..000000000000 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/operations/_disk_encryption_sets_operations.py +++ /dev/null @@ -1,1075 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression,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 collections.abc import MutableMapping -from io import IOBase -from typing import Any, Callable, IO, Iterator, Optional, TypeVar, Union, cast, overload - -from azure.core import PipelineClient -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - StreamClosedError, - StreamConsumedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from .._configuration import ComputeManagementClientConfiguration -from .._utils.serialization import Deserializer, Serializer - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] -List = list - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-01-02")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/diskEncryptionSets") - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_by_resource_group_request(resource_group_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-01-02")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_request( - resource_group_name: str, disk_encryption_set_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-01-02")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "diskEncryptionSetName": _SERIALIZER.url("disk_encryption_set_name", disk_encryption_set_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, disk_encryption_set_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-01-02")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "diskEncryptionSetName": _SERIALIZER.url("disk_encryption_set_name", disk_encryption_set_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_request( - resource_group_name: str, disk_encryption_set_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-01-02")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "diskEncryptionSetName": _SERIALIZER.url("disk_encryption_set_name", disk_encryption_set_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, disk_encryption_set_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-01-02")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "diskEncryptionSetName": _SERIALIZER.url("disk_encryption_set_name", disk_encryption_set_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_associated_resources_request( - resource_group_name: str, disk_encryption_set_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-01-02")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}/associatedResources", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "diskEncryptionSetName": _SERIALIZER.url("disk_encryption_set_name", disk_encryption_set_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class DiskEncryptionSetsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.compute.ComputeManagementClient`'s - :attr:`disk_encryption_sets` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list(self, **kwargs: Any) -> ItemPaged["_models.DiskEncryptionSet"]: - """Lists all the disk encryption sets under a subscription. - - :return: An iterator like instance of either DiskEncryptionSet or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.models.DiskEncryptionSet] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-01-02")) - cls: ClsType[_models.DiskEncryptionSetList] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - _request = HttpRequest("GET", next_link) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("DiskEncryptionSetList", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @distributed_trace - def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> ItemPaged["_models.DiskEncryptionSet"]: - """Lists all the disk encryption sets under a resource group. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :return: An iterator like instance of either DiskEncryptionSet or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.models.DiskEncryptionSet] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-01-02")) - cls: ClsType[_models.DiskEncryptionSetList] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_by_resource_group_request( - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - _request = HttpRequest("GET", next_link) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("DiskEncryptionSetList", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @distributed_trace - def get(self, resource_group_name: str, disk_encryption_set_name: str, **kwargs: Any) -> _models.DiskEncryptionSet: - """Gets information about a disk encryption set. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param disk_encryption_set_name: The name of the disk encryption set that is being created. The - name can't be changed after the disk encryption set is created. Supported characters for the - name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. - :type disk_encryption_set_name: str - :return: DiskEncryptionSet or the result of cls(response) - :rtype: ~azure.mgmt.compute.models.DiskEncryptionSet - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-01-02")) - cls: ClsType[_models.DiskEncryptionSet] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - disk_encryption_set_name=disk_encryption_set_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("DiskEncryptionSet", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - disk_encryption_set_name: str, - disk_encryption_set: Union[_models.DiskEncryptionSet, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-01-02")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(disk_encryption_set, (IOBase, bytes)): - _content = disk_encryption_set - else: - _json = self._serialize.body(disk_encryption_set, "DiskEncryptionSet") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - disk_encryption_set_name=disk_encryption_set_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - disk_encryption_set_name: str, - disk_encryption_set: _models.DiskEncryptionSet, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.DiskEncryptionSet]: - """Creates or updates a disk encryption set. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param disk_encryption_set_name: The name of the disk encryption set that is being created. The - name can't be changed after the disk encryption set is created. Supported characters for the - name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. - :type disk_encryption_set_name: str - :param disk_encryption_set: disk encryption set object supplied in the body of the Put disk - encryption set operation. Required. - :type disk_encryption_set: ~azure.mgmt.compute.models.DiskEncryptionSet - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either DiskEncryptionSet or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.DiskEncryptionSet] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - disk_encryption_set_name: str, - disk_encryption_set: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.DiskEncryptionSet]: - """Creates or updates a disk encryption set. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param disk_encryption_set_name: The name of the disk encryption set that is being created. The - name can't be changed after the disk encryption set is created. Supported characters for the - name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. - :type disk_encryption_set_name: str - :param disk_encryption_set: disk encryption set object supplied in the body of the Put disk - encryption set operation. Required. - :type disk_encryption_set: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either DiskEncryptionSet or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.DiskEncryptionSet] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - disk_encryption_set_name: str, - disk_encryption_set: Union[_models.DiskEncryptionSet, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.DiskEncryptionSet]: - """Creates or updates a disk encryption set. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param disk_encryption_set_name: The name of the disk encryption set that is being created. The - name can't be changed after the disk encryption set is created. Supported characters for the - name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. - :type disk_encryption_set_name: str - :param disk_encryption_set: disk encryption set object supplied in the body of the Put disk - encryption set operation. Is either a DiskEncryptionSet type or a IO[bytes] type. Required. - :type disk_encryption_set: ~azure.mgmt.compute.models.DiskEncryptionSet or IO[bytes] - :return: An instance of LROPoller that returns either DiskEncryptionSet or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.DiskEncryptionSet] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-01-02")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.DiskEncryptionSet] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._create_or_update_initial( - resource_group_name=resource_group_name, - 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, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("DiskEncryptionSet", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.DiskEncryptionSet].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.DiskEncryptionSet]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _update_initial( - self, - resource_group_name: str, - disk_encryption_set_name: str, - disk_encryption_set: Union[_models.DiskEncryptionSetUpdate, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-01-02")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(disk_encryption_set, (IOBase, bytes)): - _content = disk_encryption_set - else: - _json = self._serialize.body(disk_encryption_set, "DiskEncryptionSetUpdate") - - _request = build_update_request( - resource_group_name=resource_group_name, - disk_encryption_set_name=disk_encryption_set_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update( - self, - resource_group_name: str, - disk_encryption_set_name: str, - disk_encryption_set: _models.DiskEncryptionSetUpdate, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.DiskEncryptionSet]: - """Updates (patches) a disk encryption set. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param disk_encryption_set_name: The name of the disk encryption set that is being created. The - name can't be changed after the disk encryption set is created. Supported characters for the - name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. - :type disk_encryption_set_name: str - :param disk_encryption_set: disk encryption set object supplied in the body of the Patch disk - encryption set operation. Required. - :type disk_encryption_set: ~azure.mgmt.compute.models.DiskEncryptionSetUpdate - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either DiskEncryptionSet or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.DiskEncryptionSet] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update( - self, - resource_group_name: str, - disk_encryption_set_name: str, - disk_encryption_set: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.DiskEncryptionSet]: - """Updates (patches) a disk encryption set. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param disk_encryption_set_name: The name of the disk encryption set that is being created. The - name can't be changed after the disk encryption set is created. Supported characters for the - name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. - :type disk_encryption_set_name: str - :param disk_encryption_set: disk encryption set object supplied in the body of the Patch disk - encryption set operation. Required. - :type disk_encryption_set: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either DiskEncryptionSet or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.DiskEncryptionSet] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_update( - self, - resource_group_name: str, - disk_encryption_set_name: str, - disk_encryption_set: Union[_models.DiskEncryptionSetUpdate, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.DiskEncryptionSet]: - """Updates (patches) a disk encryption set. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param disk_encryption_set_name: The name of the disk encryption set that is being created. The - name can't be changed after the disk encryption set is created. Supported characters for the - name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. - :type disk_encryption_set_name: str - :param disk_encryption_set: disk encryption set object supplied in the body of the Patch disk - encryption set operation. Is either a DiskEncryptionSetUpdate type or a IO[bytes] type. - Required. - :type disk_encryption_set: ~azure.mgmt.compute.models.DiskEncryptionSetUpdate or IO[bytes] - :return: An instance of LROPoller that returns either DiskEncryptionSet or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.DiskEncryptionSet] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-01-02")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.DiskEncryptionSet] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._update_initial( - resource_group_name=resource_group_name, - 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, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("DiskEncryptionSet", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.DiskEncryptionSet].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.DiskEncryptionSet]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, disk_encryption_set_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-01-02")) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - disk_encryption_set_name=disk_encryption_set_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_delete(self, resource_group_name: str, disk_encryption_set_name: str, **kwargs: Any) -> LROPoller[None]: - """Deletes a disk encryption set. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param disk_encryption_set_name: The name of the disk encryption set that is being created. The - name can't be changed after the disk encryption set is created. Supported characters for the - name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. - :type disk_encryption_set_name: str - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-01-02")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - disk_encryption_set_name=disk_encryption_set_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list_associated_resources( - self, resource_group_name: str, disk_encryption_set_name: str, **kwargs: Any - ) -> ItemPaged[str]: - """Lists all resources that are encrypted with this disk encryption set. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param disk_encryption_set_name: The name of the disk encryption set that is being created. The - name can't be changed after the disk encryption set is created. Supported characters for the - name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. - :type disk_encryption_set_name: str - :return: An iterator like instance of either str or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[str] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-01-02")) - cls: ClsType[_models.ResourceUriList] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_associated_resources_request( - resource_group_name=resource_group_name, - disk_encryption_set_name=disk_encryption_set_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - _request = HttpRequest("GET", next_link) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("ResourceUriList", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/operations/_disk_restore_point_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/operations/_disk_restore_point_operations.py deleted file mode 100644 index 6aead15e7370..000000000000 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/operations/_disk_restore_point_operations.py +++ /dev/null @@ -1,738 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# 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 collections.abc import MutableMapping -from io import IOBase -from typing import Any, Callable, IO, Iterator, Optional, TypeVar, Union, cast, overload - -from azure.core import PipelineClient -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - StreamClosedError, - StreamConsumedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from .._configuration import ComputeManagementClientConfiguration -from .._utils.serialization import Deserializer, Serializer - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] -List = list - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_by_restore_point_request( - resource_group_name: str, - restore_point_collection_name: str, - vm_restore_point_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-01-02")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{vmRestorePointName}/diskRestorePoints", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "restorePointCollectionName": _SERIALIZER.url( - "restore_point_collection_name", restore_point_collection_name, "str" - ), - "vmRestorePointName": _SERIALIZER.url("vm_restore_point_name", vm_restore_point_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_request( - resource_group_name: str, - restore_point_collection_name: str, - vm_restore_point_name: str, - disk_restore_point_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-01-02")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{vmRestorePointName}/diskRestorePoints/{diskRestorePointName}", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "restorePointCollectionName": _SERIALIZER.url( - "restore_point_collection_name", restore_point_collection_name, "str" - ), - "vmRestorePointName": _SERIALIZER.url("vm_restore_point_name", vm_restore_point_name, "str"), - "diskRestorePointName": _SERIALIZER.url("disk_restore_point_name", disk_restore_point_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_grant_access_request( - resource_group_name: str, - restore_point_collection_name: str, - vm_restore_point_name: str, - disk_restore_point_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-01-02")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{vmRestorePointName}/diskRestorePoints/{diskRestorePointName}/beginGetAccess", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "restorePointCollectionName": _SERIALIZER.url( - "restore_point_collection_name", restore_point_collection_name, "str" - ), - "vmRestorePointName": _SERIALIZER.url("vm_restore_point_name", vm_restore_point_name, "str"), - "diskRestorePointName": _SERIALIZER.url("disk_restore_point_name", disk_restore_point_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_revoke_access_request( - resource_group_name: str, - restore_point_collection_name: str, - vm_restore_point_name: str, - disk_restore_point_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-01-02")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{vmRestorePointName}/diskRestorePoints/{diskRestorePointName}/endGetAccess", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "restorePointCollectionName": _SERIALIZER.url( - "restore_point_collection_name", restore_point_collection_name, "str" - ), - "vmRestorePointName": _SERIALIZER.url("vm_restore_point_name", vm_restore_point_name, "str"), - "diskRestorePointName": _SERIALIZER.url("disk_restore_point_name", disk_restore_point_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class DiskRestorePointOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.compute.ComputeManagementClient`'s - :attr:`disk_restore_point` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list_by_restore_point( - self, resource_group_name: str, restore_point_collection_name: str, vm_restore_point_name: str, **kwargs: Any - ) -> ItemPaged["_models.DiskRestorePoint"]: - """Lists diskRestorePoints under a vmRestorePoint. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param restore_point_collection_name: The name of the restore point collection that the disk - restore point belongs. Required. - :type restore_point_collection_name: str - :param vm_restore_point_name: The name of the vm restore point that the disk disk restore point - belongs. Required. - :type vm_restore_point_name: str - :return: An iterator like instance of either DiskRestorePoint or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.models.DiskRestorePoint] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-01-02")) - cls: ClsType[_models.DiskRestorePointList] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_by_restore_point_request( - resource_group_name=resource_group_name, - restore_point_collection_name=restore_point_collection_name, - vm_restore_point_name=vm_restore_point_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - _request = HttpRequest("GET", next_link) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("DiskRestorePointList", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @distributed_trace - def get( - self, - resource_group_name: str, - restore_point_collection_name: str, - vm_restore_point_name: str, - disk_restore_point_name: str, - **kwargs: Any - ) -> _models.DiskRestorePoint: - """Get disk restorePoint resource. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param restore_point_collection_name: The name of the restore point collection that the disk - restore point belongs. Required. - :type restore_point_collection_name: str - :param vm_restore_point_name: The name of the vm restore point that the disk disk restore point - belongs. Required. - :type vm_restore_point_name: str - :param disk_restore_point_name: The name of the DiskRestorePoint. Required. - :type disk_restore_point_name: str - :return: DiskRestorePoint or the result of cls(response) - :rtype: ~azure.mgmt.compute.models.DiskRestorePoint - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-01-02")) - cls: ClsType[_models.DiskRestorePoint] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - restore_point_collection_name=restore_point_collection_name, - vm_restore_point_name=vm_restore_point_name, - disk_restore_point_name=disk_restore_point_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("DiskRestorePoint", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _grant_access_initial( - self, - resource_group_name: str, - restore_point_collection_name: str, - vm_restore_point_name: str, - disk_restore_point_name: str, - grant_access_data: Union[_models.GrantAccessData, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-01-02")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(grant_access_data, (IOBase, bytes)): - _content = grant_access_data - else: - _json = self._serialize.body(grant_access_data, "GrantAccessData") - - _request = build_grant_access_request( - resource_group_name=resource_group_name, - restore_point_collection_name=restore_point_collection_name, - vm_restore_point_name=vm_restore_point_name, - disk_restore_point_name=disk_restore_point_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_grant_access( - self, - resource_group_name: str, - restore_point_collection_name: str, - vm_restore_point_name: str, - disk_restore_point_name: str, - grant_access_data: _models.GrantAccessData, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.AccessUri]: - """Grants access to a diskRestorePoint. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param restore_point_collection_name: The name of the restore point collection that the disk - restore point belongs. Required. - :type restore_point_collection_name: str - :param vm_restore_point_name: The name of the vm restore point that the disk disk restore point - belongs. Required. - :type vm_restore_point_name: str - :param disk_restore_point_name: The name of the DiskRestorePoint. Required. - :type disk_restore_point_name: str - :param grant_access_data: Access data object supplied in the body of the get disk access - operation. Required. - :type grant_access_data: ~azure.mgmt.compute.models.GrantAccessData - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either AccessUri or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.AccessUri] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_grant_access( - self, - resource_group_name: str, - restore_point_collection_name: str, - vm_restore_point_name: str, - disk_restore_point_name: str, - grant_access_data: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.AccessUri]: - """Grants access to a diskRestorePoint. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param restore_point_collection_name: The name of the restore point collection that the disk - restore point belongs. Required. - :type restore_point_collection_name: str - :param vm_restore_point_name: The name of the vm restore point that the disk disk restore point - belongs. Required. - :type vm_restore_point_name: str - :param disk_restore_point_name: The name of the DiskRestorePoint. Required. - :type disk_restore_point_name: str - :param grant_access_data: Access data object supplied in the body of the get disk access - operation. Required. - :type grant_access_data: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either AccessUri or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.AccessUri] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_grant_access( - self, - resource_group_name: str, - restore_point_collection_name: str, - vm_restore_point_name: str, - disk_restore_point_name: str, - grant_access_data: Union[_models.GrantAccessData, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.AccessUri]: - """Grants access to a diskRestorePoint. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param restore_point_collection_name: The name of the restore point collection that the disk - restore point belongs. Required. - :type restore_point_collection_name: str - :param vm_restore_point_name: The name of the vm restore point that the disk disk restore point - belongs. Required. - :type vm_restore_point_name: str - :param disk_restore_point_name: The name of the DiskRestorePoint. Required. - :type disk_restore_point_name: str - :param grant_access_data: Access data object supplied in the body of the get disk access - operation. Is either a GrantAccessData type or a IO[bytes] type. Required. - :type grant_access_data: ~azure.mgmt.compute.models.GrantAccessData or IO[bytes] - :return: An instance of LROPoller that returns either AccessUri or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.AccessUri] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-01-02")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AccessUri] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._grant_access_initial( - resource_group_name=resource_group_name, - restore_point_collection_name=restore_point_collection_name, - vm_restore_point_name=vm_restore_point_name, - disk_restore_point_name=disk_restore_point_name, - grant_access_data=grant_access_data, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("AccessUri", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.AccessUri].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.AccessUri]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _revoke_access_initial( - self, - resource_group_name: str, - restore_point_collection_name: str, - vm_restore_point_name: str, - disk_restore_point_name: str, - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-01-02")) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_revoke_access_request( - resource_group_name=resource_group_name, - restore_point_collection_name=restore_point_collection_name, - vm_restore_point_name=vm_restore_point_name, - disk_restore_point_name=disk_restore_point_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_revoke_access( - self, - resource_group_name: str, - restore_point_collection_name: str, - vm_restore_point_name: str, - disk_restore_point_name: str, - **kwargs: Any - ) -> LROPoller[None]: - """Revokes access to a diskRestorePoint. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param restore_point_collection_name: The name of the restore point collection that the disk - restore point belongs. Required. - :type restore_point_collection_name: str - :param vm_restore_point_name: The name of the vm restore point that the disk disk restore point - belongs. Required. - :type vm_restore_point_name: str - :param disk_restore_point_name: The name of the DiskRestorePoint. Required. - :type disk_restore_point_name: str - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-01-02")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._revoke_access_initial( - resource_group_name=resource_group_name, - restore_point_collection_name=restore_point_collection_name, - vm_restore_point_name=vm_restore_point_name, - disk_restore_point_name=disk_restore_point_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/operations/_disks_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/operations/_disks_operations.py deleted file mode 100644 index 3e8b1b36ff32..000000000000 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/operations/_disks_operations.py +++ /dev/null @@ -1,1316 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression,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 collections.abc import MutableMapping -from io import IOBase -from typing import Any, Callable, IO, Iterator, Optional, TypeVar, Union, cast, overload - -from azure.core import PipelineClient -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - StreamClosedError, - StreamConsumedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from .._configuration import ComputeManagementClientConfiguration -from .._utils.serialization import Deserializer, Serializer - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] -List = list - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-01-02")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/disks") - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_by_resource_group_request(resource_group_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-01-02")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_request(resource_group_name: str, disk_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-01-02")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "diskName": _SERIALIZER.url("disk_name", disk_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, disk_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-01-02")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "diskName": _SERIALIZER.url("disk_name", disk_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_request(resource_group_name: str, disk_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-01-02")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "diskName": _SERIALIZER.url("disk_name", disk_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request(resource_group_name: str, disk_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-01-02")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "diskName": _SERIALIZER.url("disk_name", disk_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_grant_access_request( - resource_group_name: str, disk_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-01-02")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/beginGetAccess", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "diskName": _SERIALIZER.url("disk_name", disk_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_revoke_access_request( - resource_group_name: str, disk_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-01-02")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/endGetAccess", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "diskName": _SERIALIZER.url("disk_name", disk_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class DisksOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.compute.ComputeManagementClient`'s - :attr:`disks` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list(self, **kwargs: Any) -> ItemPaged["_models.Disk"]: - """Lists all the disks under a subscription. - - :return: An iterator like instance of either Disk or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.models.Disk] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-01-02")) - cls: ClsType[_models.DiskList] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - _request = HttpRequest("GET", next_link) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("DiskList", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @distributed_trace - def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> ItemPaged["_models.Disk"]: - """Lists all the disks under a resource group. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :return: An iterator like instance of either Disk or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.models.Disk] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-01-02")) - cls: ClsType[_models.DiskList] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_by_resource_group_request( - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - _request = HttpRequest("GET", next_link) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("DiskList", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @distributed_trace - def get(self, resource_group_name: str, disk_name: str, **kwargs: Any) -> _models.Disk: - """Gets information about a disk. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param disk_name: The name of the managed disk that is being created. The name can't be changed - after the disk is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The - maximum name length is 80 characters. Required. - :type disk_name: str - :return: Disk or the result of cls(response) - :rtype: ~azure.mgmt.compute.models.Disk - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-01-02")) - cls: ClsType[_models.Disk] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - disk_name=disk_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("Disk", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, resource_group_name: str, disk_name: str, disk: Union[_models.Disk, IO[bytes]], **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-01-02")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(disk, (IOBase, bytes)): - _content = disk - else: - _json = self._serialize.body(disk, "Disk") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - disk_name=disk_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - disk_name: str, - disk: _models.Disk, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.Disk]: - """Creates or updates a disk. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param disk_name: The name of the managed disk that is being created. The name can't be changed - after the disk is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The - maximum name length is 80 characters. Required. - :type disk_name: str - :param disk: Disk object supplied in the body of the Put disk operation. Required. - :type disk: ~azure.mgmt.compute.models.Disk - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either Disk or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.Disk] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - disk_name: str, - disk: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.Disk]: - """Creates or updates a disk. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param disk_name: The name of the managed disk that is being created. The name can't be changed - after the disk is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The - maximum name length is 80 characters. Required. - :type disk_name: str - :param disk: Disk object supplied in the body of the Put disk operation. Required. - :type disk: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either Disk or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.Disk] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, resource_group_name: str, disk_name: str, disk: Union[_models.Disk, IO[bytes]], **kwargs: Any - ) -> LROPoller[_models.Disk]: - """Creates or updates a disk. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param disk_name: The name of the managed disk that is being created. The name can't be changed - after the disk is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The - maximum name length is 80 characters. Required. - :type disk_name: str - :param disk: Disk object supplied in the body of the Put disk operation. Is either a Disk type - or a IO[bytes] type. Required. - :type disk: ~azure.mgmt.compute.models.Disk or IO[bytes] - :return: An instance of LROPoller that returns either Disk or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.Disk] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-01-02")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Disk] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._create_or_update_initial( - resource_group_name=resource_group_name, - disk_name=disk_name, - disk=disk, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Disk", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.Disk].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.Disk]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _update_initial( - self, resource_group_name: str, disk_name: str, disk: Union[_models.DiskUpdate, IO[bytes]], **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-01-02")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(disk, (IOBase, bytes)): - _content = disk - else: - _json = self._serialize.body(disk, "DiskUpdate") - - _request = build_update_request( - resource_group_name=resource_group_name, - disk_name=disk_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update( - self, - resource_group_name: str, - disk_name: str, - disk: _models.DiskUpdate, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.Disk]: - """Updates (patches) a disk. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param disk_name: The name of the managed disk that is being created. The name can't be changed - after the disk is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The - maximum name length is 80 characters. Required. - :type disk_name: str - :param disk: Disk object supplied in the body of the Patch disk operation. Required. - :type disk: ~azure.mgmt.compute.models.DiskUpdate - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either Disk or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.Disk] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update( - self, - resource_group_name: str, - disk_name: str, - disk: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.Disk]: - """Updates (patches) a disk. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param disk_name: The name of the managed disk that is being created. The name can't be changed - after the disk is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The - maximum name length is 80 characters. Required. - :type disk_name: str - :param disk: Disk object supplied in the body of the Patch disk operation. Required. - :type disk: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either Disk or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.Disk] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_update( - self, resource_group_name: str, disk_name: str, disk: Union[_models.DiskUpdate, IO[bytes]], **kwargs: Any - ) -> LROPoller[_models.Disk]: - """Updates (patches) a disk. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param disk_name: The name of the managed disk that is being created. The name can't be changed - after the disk is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The - maximum name length is 80 characters. Required. - :type disk_name: str - :param disk: Disk object supplied in the body of the Patch disk operation. Is either a - DiskUpdate type or a IO[bytes] type. Required. - :type disk: ~azure.mgmt.compute.models.DiskUpdate or IO[bytes] - :return: An instance of LROPoller that returns either Disk or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.Disk] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-01-02")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Disk] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._update_initial( - resource_group_name=resource_group_name, - disk_name=disk_name, - disk=disk, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Disk", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.Disk].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.Disk]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial(self, resource_group_name: str, disk_name: str, **kwargs: Any) -> Iterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-01-02")) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - disk_name=disk_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_delete(self, resource_group_name: str, disk_name: str, **kwargs: Any) -> LROPoller[None]: - """Deletes a disk. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param disk_name: The name of the managed disk that is being created. The name can't be changed - after the disk is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The - maximum name length is 80 characters. Required. - :type disk_name: str - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-01-02")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - disk_name=disk_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _grant_access_initial( - self, - resource_group_name: str, - disk_name: str, - grant_access_data: Union[_models.GrantAccessData, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-01-02")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(grant_access_data, (IOBase, bytes)): - _content = grant_access_data - else: - _json = self._serialize.body(grant_access_data, "GrantAccessData") - - _request = build_grant_access_request( - resource_group_name=resource_group_name, - disk_name=disk_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_grant_access( - self, - resource_group_name: str, - disk_name: str, - grant_access_data: _models.GrantAccessData, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.AccessUri]: - """Grants access to a disk. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param disk_name: The name of the managed disk that is being created. The name can't be changed - after the disk is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The - maximum name length is 80 characters. Required. - :type disk_name: str - :param grant_access_data: Access data object supplied in the body of the get disk access - operation. Required. - :type grant_access_data: ~azure.mgmt.compute.models.GrantAccessData - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either AccessUri or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.AccessUri] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_grant_access( - self, - resource_group_name: str, - disk_name: str, - grant_access_data: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.AccessUri]: - """Grants access to a disk. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param disk_name: The name of the managed disk that is being created. The name can't be changed - after the disk is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The - maximum name length is 80 characters. Required. - :type disk_name: str - :param grant_access_data: Access data object supplied in the body of the get disk access - operation. Required. - :type grant_access_data: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either AccessUri or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.AccessUri] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_grant_access( - self, - resource_group_name: str, - disk_name: str, - grant_access_data: Union[_models.GrantAccessData, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.AccessUri]: - """Grants access to a disk. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param disk_name: The name of the managed disk that is being created. The name can't be changed - after the disk is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The - maximum name length is 80 characters. Required. - :type disk_name: str - :param grant_access_data: Access data object supplied in the body of the get disk access - operation. Is either a GrantAccessData type or a IO[bytes] type. Required. - :type grant_access_data: ~azure.mgmt.compute.models.GrantAccessData or IO[bytes] - :return: An instance of LROPoller that returns either AccessUri or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.AccessUri] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-01-02")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AccessUri] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._grant_access_initial( - 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, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("AccessUri", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.AccessUri].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.AccessUri]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _revoke_access_initial(self, resource_group_name: str, disk_name: str, **kwargs: Any) -> Iterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-01-02")) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_revoke_access_request( - resource_group_name=resource_group_name, - disk_name=disk_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_revoke_access(self, resource_group_name: str, disk_name: str, **kwargs: Any) -> LROPoller[None]: - """Revokes access to a disk. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param disk_name: The name of the managed disk that is being created. The name can't be changed - after the disk is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The - maximum name length is 80 characters. Required. - :type disk_name: str - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-01-02")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._revoke_access_initial( - resource_group_name=resource_group_name, - disk_name=disk_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/operations/_galleries_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/operations/_galleries_operations.py deleted file mode 100644 index 7670e16be883..000000000000 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/operations/_galleries_operations.py +++ /dev/null @@ -1,966 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# 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 collections.abc import MutableMapping -from io import IOBase -from typing import Any, Callable, IO, Iterator, Optional, TypeVar, Union, cast, overload - -from azure.core import PipelineClient -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - StreamClosedError, - StreamConsumedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from .._configuration import ComputeManagementClientConfiguration -from .._utils.serialization import Deserializer, Serializer - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] -List = list - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-03")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/galleries") - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_by_resource_group_request(resource_group_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-03")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_request( - resource_group_name: str, - gallery_name: str, - subscription_id: str, - *, - select: Optional[Union[str, _models.SelectPermissions]] = None, - expand: Optional[Union[str, _models.GalleryExpandParams]] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-03")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "galleryName": _SERIALIZER.url("gallery_name", gallery_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if select is not None: - _params["$select"] = _SERIALIZER.query("select", select, "str") - if expand is not None: - _params["$expand"] = _SERIALIZER.query("expand", expand, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, gallery_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-03")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "galleryName": _SERIALIZER.url("gallery_name", gallery_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_request( - resource_group_name: str, gallery_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-03")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "galleryName": _SERIALIZER.url("gallery_name", gallery_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, gallery_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-03")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "galleryName": _SERIALIZER.url("gallery_name", gallery_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -class GalleriesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.compute.ComputeManagementClient`'s - :attr:`galleries` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list(self, **kwargs: Any) -> ItemPaged["_models.Gallery"]: - """List galleries under a subscription. - - :return: An iterator like instance of either Gallery or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.models.Gallery] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-03")) - cls: ClsType[_models.GalleryList] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - _request = HttpRequest("GET", next_link) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("GalleryList", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @distributed_trace - def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> ItemPaged["_models.Gallery"]: - """List galleries under a resource group. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :return: An iterator like instance of either Gallery or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.models.Gallery] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-03")) - cls: ClsType[_models.GalleryList] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_by_resource_group_request( - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - _request = HttpRequest("GET", next_link) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("GalleryList", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @distributed_trace - def get( - self, - resource_group_name: str, - gallery_name: str, - select: Optional[Union[str, _models.SelectPermissions]] = None, - expand: Optional[Union[str, _models.GalleryExpandParams]] = None, - **kwargs: Any - ) -> _models.Gallery: - """Retrieves information about a Shared Image Gallery. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :param select: The select expression to apply on the operation. "Permissions" Default value is - None. - :type select: str or ~azure.mgmt.compute.models.SelectPermissions - :param expand: The expand query option to apply on the operation. "SharingProfile/Groups" - Default value is None. - :type expand: str or ~azure.mgmt.compute.models.GalleryExpandParams - :return: Gallery or the result of cls(response) - :rtype: ~azure.mgmt.compute.models.Gallery - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-03")) - cls: ClsType[_models.Gallery] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - gallery_name=gallery_name, - subscription_id=self._config.subscription_id, - select=select, - expand=expand, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("Gallery", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, resource_group_name: str, gallery_name: str, gallery: Union[_models.Gallery, IO[bytes]], **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-03")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(gallery, (IOBase, bytes)): - _content = gallery - else: - _json = self._serialize.body(gallery, "Gallery") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - gallery_name=gallery_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 201: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - gallery_name: str, - gallery: _models.Gallery, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.Gallery]: - """Create or update a Shared Image Gallery. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :param gallery: Parameters supplied to the create or update Shared Image Gallery operation. - Required. - :type gallery: ~azure.mgmt.compute.models.Gallery - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either Gallery or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.Gallery] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - gallery_name: str, - gallery: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.Gallery]: - """Create or update a Shared Image Gallery. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :param gallery: Parameters supplied to the create or update Shared Image Gallery operation. - Required. - :type gallery: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either Gallery or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.Gallery] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, resource_group_name: str, gallery_name: str, gallery: Union[_models.Gallery, IO[bytes]], **kwargs: Any - ) -> LROPoller[_models.Gallery]: - """Create or update a Shared Image Gallery. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :param gallery: Parameters supplied to the create or update Shared Image Gallery operation. Is - either a Gallery type or a IO[bytes] type. Required. - :type gallery: ~azure.mgmt.compute.models.Gallery or IO[bytes] - :return: An instance of LROPoller that returns either Gallery or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.Gallery] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-03")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Gallery] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._create_or_update_initial( - resource_group_name=resource_group_name, - gallery_name=gallery_name, - gallery=gallery, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Gallery", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.Gallery].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.Gallery]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _update_initial( - self, - resource_group_name: str, - gallery_name: str, - gallery: Union[_models.GalleryUpdate, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-03")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(gallery, (IOBase, bytes)): - _content = gallery - else: - _json = self._serialize.body(gallery, "GalleryUpdate") - - _request = build_update_request( - resource_group_name=resource_group_name, - gallery_name=gallery_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update( - self, - resource_group_name: str, - gallery_name: str, - gallery: _models.GalleryUpdate, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.Gallery]: - """Update a Shared Image Gallery. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :param gallery: Parameters supplied to the update Shared Image Gallery operation. Required. - :type gallery: ~azure.mgmt.compute.models.GalleryUpdate - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either Gallery or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.Gallery] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update( - self, - resource_group_name: str, - gallery_name: str, - gallery: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.Gallery]: - """Update a Shared Image Gallery. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :param gallery: Parameters supplied to the update Shared Image Gallery operation. Required. - :type gallery: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either Gallery or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.Gallery] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_update( - self, - resource_group_name: str, - gallery_name: str, - gallery: Union[_models.GalleryUpdate, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.Gallery]: - """Update a Shared Image Gallery. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :param gallery: Parameters supplied to the update Shared Image Gallery operation. Is either a - GalleryUpdate type or a IO[bytes] type. Required. - :type gallery: ~azure.mgmt.compute.models.GalleryUpdate or IO[bytes] - :return: An instance of LROPoller that returns either Gallery or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.Gallery] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-03")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Gallery] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._update_initial( - resource_group_name=resource_group_name, - gallery_name=gallery_name, - gallery=gallery, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - response_headers = {} - response = pipeline_response.http_response - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = self._deserialize("Gallery", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.Gallery].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.Gallery]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial(self, resource_group_name: str, gallery_name: str, **kwargs: Any) -> Iterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-03")) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - gallery_name=gallery_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_delete(self, resource_group_name: str, gallery_name: str, **kwargs: Any) -> LROPoller[None]: - """Delete a Shared Image Gallery. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-03")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - gallery_name=gallery_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/operations/_gallery_application_versions_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/operations/_gallery_application_versions_operations.py deleted file mode 100644 index 67154128e1ad..000000000000 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/operations/_gallery_application_versions_operations.py +++ /dev/null @@ -1,1032 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression,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 collections.abc import MutableMapping -from io import IOBase -from typing import Any, Callable, IO, Iterator, Optional, TypeVar, Union, cast, overload - -from azure.core import PipelineClient -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - StreamClosedError, - StreamConsumedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from .._configuration import ComputeManagementClientConfiguration -from .._utils.serialization import Deserializer, Serializer - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] -List = list - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_by_gallery_application_request( # pylint: disable=name-too-long - resource_group_name: str, gallery_name: str, gallery_application_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-03")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}/versions", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "galleryName": _SERIALIZER.url("gallery_name", gallery_name, "str"), - "galleryApplicationName": _SERIALIZER.url("gallery_application_name", gallery_application_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_request( - resource_group_name: str, - gallery_name: str, - gallery_application_name: str, - gallery_application_version_name: str, - subscription_id: str, - *, - expand: Optional[Union[str, _models.ReplicationStatusTypes]] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-03")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}/versions/{galleryApplicationVersionName}", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "galleryName": _SERIALIZER.url("gallery_name", gallery_name, "str"), - "galleryApplicationName": _SERIALIZER.url("gallery_application_name", gallery_application_name, "str"), - "galleryApplicationVersionName": _SERIALIZER.url( - "gallery_application_version_name", gallery_application_version_name, "str" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if expand is not None: - _params["$expand"] = _SERIALIZER.query("expand", expand, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, - gallery_name: str, - gallery_application_name: str, - gallery_application_version_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-03")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}/versions/{galleryApplicationVersionName}", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "galleryName": _SERIALIZER.url("gallery_name", gallery_name, "str"), - "galleryApplicationName": _SERIALIZER.url("gallery_application_name", gallery_application_name, "str"), - "galleryApplicationVersionName": _SERIALIZER.url( - "gallery_application_version_name", gallery_application_version_name, "str" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_request( - resource_group_name: str, - gallery_name: str, - gallery_application_name: str, - gallery_application_version_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-03")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}/versions/{galleryApplicationVersionName}", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "galleryName": _SERIALIZER.url("gallery_name", gallery_name, "str"), - "galleryApplicationName": _SERIALIZER.url("gallery_application_name", gallery_application_name, "str"), - "galleryApplicationVersionName": _SERIALIZER.url( - "gallery_application_version_name", gallery_application_version_name, "str" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, - gallery_name: str, - gallery_application_name: str, - gallery_application_version_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-03")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}/versions/{galleryApplicationVersionName}", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "galleryName": _SERIALIZER.url("gallery_name", gallery_name, "str"), - "galleryApplicationName": _SERIALIZER.url("gallery_application_name", gallery_application_name, "str"), - "galleryApplicationVersionName": _SERIALIZER.url( - "gallery_application_version_name", gallery_application_version_name, "str" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -class GalleryApplicationVersionsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.compute.ComputeManagementClient`'s - :attr:`gallery_application_versions` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list_by_gallery_application( - self, resource_group_name: str, gallery_name: str, gallery_application_name: str, **kwargs: Any - ) -> ItemPaged["_models.GalleryApplicationVersion"]: - """List gallery Application Versions in a gallery Application Definition. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :param gallery_application_name: The name of the gallery Application Definition to be - retrieved. Required. - :type gallery_application_name: str - :return: An iterator like instance of either GalleryApplicationVersion or the result of - cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.models.GalleryApplicationVersion] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-03")) - cls: ClsType[_models.GalleryApplicationVersionList] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_by_gallery_application_request( - resource_group_name=resource_group_name, - gallery_name=gallery_name, - gallery_application_name=gallery_application_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - _request = HttpRequest("GET", next_link) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("GalleryApplicationVersionList", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @distributed_trace - def get( - self, - resource_group_name: str, - gallery_name: str, - gallery_application_name: str, - gallery_application_version_name: str, - expand: Optional[Union[str, _models.ReplicationStatusTypes]] = None, - **kwargs: Any - ) -> _models.GalleryApplicationVersion: - """Retrieves information about a gallery Application Version. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :param gallery_application_name: The name of the gallery Application Definition to be - retrieved. Required. - :type gallery_application_name: str - :param gallery_application_version_name: The name of the gallery Application Version to be - retrieved. Required. - :type gallery_application_version_name: str - :param expand: The expand expression to apply on the operation. Known values are: - "ReplicationStatus" and "UefiSettings". Default value is None. - :type expand: str or ~azure.mgmt.compute.models.ReplicationStatusTypes - :return: GalleryApplicationVersion or the result of cls(response) - :rtype: ~azure.mgmt.compute.models.GalleryApplicationVersion - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-03")) - cls: ClsType[_models.GalleryApplicationVersion] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - gallery_name=gallery_name, - gallery_application_name=gallery_application_name, - gallery_application_version_name=gallery_application_version_name, - subscription_id=self._config.subscription_id, - expand=expand, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("GalleryApplicationVersion", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - gallery_name: str, - gallery_application_name: str, - gallery_application_version_name: str, - gallery_application_version: Union[_models.GalleryApplicationVersion, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-03")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(gallery_application_version, (IOBase, bytes)): - _content = gallery_application_version - else: - _json = self._serialize.body(gallery_application_version, "GalleryApplicationVersion") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - gallery_name=gallery_name, - gallery_application_name=gallery_application_name, - gallery_application_version_name=gallery_application_version_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 201: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - gallery_name: str, - gallery_application_name: str, - gallery_application_version_name: str, - gallery_application_version: _models.GalleryApplicationVersion, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.GalleryApplicationVersion]: - """Create or update a gallery Application Version. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :param gallery_application_name: The name of the gallery Application Definition to be - retrieved. Required. - :type gallery_application_name: str - :param gallery_application_version_name: The name of the gallery Application Version to be - retrieved. Required. - :type gallery_application_version_name: str - :param gallery_application_version: Parameters supplied to the create or update gallery - Application Version operation. Required. - :type gallery_application_version: ~azure.mgmt.compute.models.GalleryApplicationVersion - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either GalleryApplicationVersion or the result - of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.GalleryApplicationVersion] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - gallery_name: str, - gallery_application_name: str, - gallery_application_version_name: str, - gallery_application_version: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.GalleryApplicationVersion]: - """Create or update a gallery Application Version. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :param gallery_application_name: The name of the gallery Application Definition to be - retrieved. Required. - :type gallery_application_name: str - :param gallery_application_version_name: The name of the gallery Application Version to be - retrieved. Required. - :type gallery_application_version_name: str - :param gallery_application_version: Parameters supplied to the create or update gallery - Application Version operation. Required. - :type gallery_application_version: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either GalleryApplicationVersion or the result - of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.GalleryApplicationVersion] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - gallery_name: str, - gallery_application_name: str, - gallery_application_version_name: str, - gallery_application_version: Union[_models.GalleryApplicationVersion, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.GalleryApplicationVersion]: - """Create or update a gallery Application Version. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :param gallery_application_name: The name of the gallery Application Definition to be - retrieved. Required. - :type gallery_application_name: str - :param gallery_application_version_name: The name of the gallery Application Version to be - retrieved. Required. - :type gallery_application_version_name: str - :param gallery_application_version: Parameters supplied to the create or update gallery - Application Version operation. Is either a GalleryApplicationVersion type or a IO[bytes] type. - Required. - :type gallery_application_version: ~azure.mgmt.compute.models.GalleryApplicationVersion or - IO[bytes] - :return: An instance of LROPoller that returns either GalleryApplicationVersion or the result - of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.GalleryApplicationVersion] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-03")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.GalleryApplicationVersion] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._create_or_update_initial( - resource_group_name=resource_group_name, - gallery_name=gallery_name, - 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, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("GalleryApplicationVersion", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.GalleryApplicationVersion].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.GalleryApplicationVersion]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _update_initial( - self, - resource_group_name: str, - gallery_name: str, - gallery_application_name: str, - gallery_application_version_name: str, - gallery_application_version: Union[_models.GalleryApplicationVersionUpdate, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-03")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(gallery_application_version, (IOBase, bytes)): - _content = gallery_application_version - else: - _json = self._serialize.body(gallery_application_version, "GalleryApplicationVersionUpdate") - - _request = build_update_request( - resource_group_name=resource_group_name, - gallery_name=gallery_name, - gallery_application_name=gallery_application_name, - gallery_application_version_name=gallery_application_version_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update( - self, - resource_group_name: str, - gallery_name: str, - gallery_application_name: str, - gallery_application_version_name: str, - gallery_application_version: _models.GalleryApplicationVersionUpdate, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.GalleryApplicationVersion]: - """Update a gallery Application Version. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :param gallery_application_name: The name of the gallery Application Definition to be - retrieved. Required. - :type gallery_application_name: str - :param gallery_application_version_name: The name of the gallery Application Version to be - retrieved. Required. - :type gallery_application_version_name: str - :param gallery_application_version: Parameters supplied to the update gallery Application - Version operation. Required. - :type gallery_application_version: ~azure.mgmt.compute.models.GalleryApplicationVersionUpdate - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either GalleryApplicationVersion or the result - of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.GalleryApplicationVersion] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update( - self, - resource_group_name: str, - gallery_name: str, - gallery_application_name: str, - gallery_application_version_name: str, - gallery_application_version: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.GalleryApplicationVersion]: - """Update a gallery Application Version. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :param gallery_application_name: The name of the gallery Application Definition to be - retrieved. Required. - :type gallery_application_name: str - :param gallery_application_version_name: The name of the gallery Application Version to be - retrieved. Required. - :type gallery_application_version_name: str - :param gallery_application_version: Parameters supplied to the update gallery Application - Version operation. Required. - :type gallery_application_version: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either GalleryApplicationVersion or the result - of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.GalleryApplicationVersion] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_update( - self, - resource_group_name: str, - gallery_name: str, - gallery_application_name: str, - gallery_application_version_name: str, - gallery_application_version: Union[_models.GalleryApplicationVersionUpdate, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.GalleryApplicationVersion]: - """Update a gallery Application Version. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :param gallery_application_name: The name of the gallery Application Definition to be - retrieved. Required. - :type gallery_application_name: str - :param gallery_application_version_name: The name of the gallery Application Version to be - retrieved. Required. - :type gallery_application_version_name: str - :param gallery_application_version: Parameters supplied to the update gallery Application - Version operation. Is either a GalleryApplicationVersionUpdate type or a IO[bytes] type. - Required. - :type gallery_application_version: ~azure.mgmt.compute.models.GalleryApplicationVersionUpdate - or IO[bytes] - :return: An instance of LROPoller that returns either GalleryApplicationVersion or the result - of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.GalleryApplicationVersion] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-03")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.GalleryApplicationVersion] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._update_initial( - resource_group_name=resource_group_name, - gallery_name=gallery_name, - 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, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - response_headers = {} - response = pipeline_response.http_response - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = self._deserialize("GalleryApplicationVersion", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.GalleryApplicationVersion].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.GalleryApplicationVersion]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, - resource_group_name: str, - gallery_name: str, - gallery_application_name: str, - gallery_application_version_name: str, - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-03")) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - gallery_name=gallery_name, - gallery_application_name=gallery_application_name, - gallery_application_version_name=gallery_application_version_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_delete( - self, - resource_group_name: str, - gallery_name: str, - gallery_application_name: str, - gallery_application_version_name: str, - **kwargs: Any - ) -> LROPoller[None]: - """Delete a gallery Application Version. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :param gallery_application_name: The name of the gallery Application Definition to be - retrieved. Required. - :type gallery_application_name: str - :param gallery_application_version_name: The name of the gallery Application Version to be - retrieved. Required. - :type gallery_application_version_name: str - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-03")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - gallery_name=gallery_name, - gallery_application_name=gallery_application_name, - gallery_application_version_name=gallery_application_version_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/operations/_gallery_applications_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/operations/_gallery_applications_operations.py deleted file mode 100644 index 3236db888e21..000000000000 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/operations/_gallery_applications_operations.py +++ /dev/null @@ -1,927 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# 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 collections.abc import MutableMapping -from io import IOBase -from typing import Any, Callable, IO, Iterator, Optional, TypeVar, Union, cast, overload - -from azure.core import PipelineClient -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - StreamClosedError, - StreamConsumedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from .._configuration import ComputeManagementClientConfiguration -from .._utils.serialization import Deserializer, Serializer - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] -List = list - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_by_gallery_request( - resource_group_name: str, gallery_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-03")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "galleryName": _SERIALIZER.url("gallery_name", gallery_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_request( - resource_group_name: str, gallery_name: str, gallery_application_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-03")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "galleryName": _SERIALIZER.url("gallery_name", gallery_name, "str"), - "galleryApplicationName": _SERIALIZER.url("gallery_application_name", gallery_application_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, gallery_name: str, gallery_application_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-03")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "galleryName": _SERIALIZER.url("gallery_name", gallery_name, "str"), - "galleryApplicationName": _SERIALIZER.url("gallery_application_name", gallery_application_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_request( - resource_group_name: str, gallery_name: str, gallery_application_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-03")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "galleryName": _SERIALIZER.url("gallery_name", gallery_name, "str"), - "galleryApplicationName": _SERIALIZER.url("gallery_application_name", gallery_application_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, gallery_name: str, gallery_application_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-03")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "galleryName": _SERIALIZER.url("gallery_name", gallery_name, "str"), - "galleryApplicationName": _SERIALIZER.url("gallery_application_name", gallery_application_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -class GalleryApplicationsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.compute.ComputeManagementClient`'s - :attr:`gallery_applications` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list_by_gallery( - self, resource_group_name: str, gallery_name: str, **kwargs: Any - ) -> ItemPaged["_models.GalleryApplication"]: - """List gallery Application Definitions in a gallery. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :return: An iterator like instance of either GalleryApplication or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.models.GalleryApplication] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-03")) - cls: ClsType[_models.GalleryApplicationList] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_by_gallery_request( - resource_group_name=resource_group_name, - gallery_name=gallery_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - _request = HttpRequest("GET", next_link) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("GalleryApplicationList", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @distributed_trace - def get( - self, resource_group_name: str, gallery_name: str, gallery_application_name: str, **kwargs: Any - ) -> _models.GalleryApplication: - """Retrieves information about a gallery Application Definition. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :param gallery_application_name: The name of the gallery Application Definition to be - retrieved. Required. - :type gallery_application_name: str - :return: GalleryApplication or the result of cls(response) - :rtype: ~azure.mgmt.compute.models.GalleryApplication - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-03")) - cls: ClsType[_models.GalleryApplication] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - gallery_name=gallery_name, - gallery_application_name=gallery_application_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("GalleryApplication", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - gallery_name: str, - gallery_application_name: str, - gallery_application: Union[_models.GalleryApplication, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-03")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(gallery_application, (IOBase, bytes)): - _content = gallery_application - else: - _json = self._serialize.body(gallery_application, "GalleryApplication") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - gallery_name=gallery_name, - gallery_application_name=gallery_application_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 201: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - gallery_name: str, - gallery_application_name: str, - gallery_application: _models.GalleryApplication, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.GalleryApplication]: - """Create or update a gallery Application Definition. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :param gallery_application_name: The name of the gallery Application Definition to be - retrieved. Required. - :type gallery_application_name: str - :param gallery_application: Parameters supplied to the create or update gallery Application - operation. Required. - :type gallery_application: ~azure.mgmt.compute.models.GalleryApplication - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either GalleryApplication or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.GalleryApplication] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - gallery_name: str, - gallery_application_name: str, - gallery_application: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.GalleryApplication]: - """Create or update a gallery Application Definition. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :param gallery_application_name: The name of the gallery Application Definition to be - retrieved. Required. - :type gallery_application_name: str - :param gallery_application: Parameters supplied to the create or update gallery Application - operation. Required. - :type gallery_application: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either GalleryApplication or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.GalleryApplication] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - gallery_name: str, - gallery_application_name: str, - gallery_application: Union[_models.GalleryApplication, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.GalleryApplication]: - """Create or update a gallery Application Definition. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :param gallery_application_name: The name of the gallery Application Definition to be - retrieved. Required. - :type gallery_application_name: str - :param gallery_application: Parameters supplied to the create or update gallery Application - operation. Is either a GalleryApplication type or a IO[bytes] type. Required. - :type gallery_application: ~azure.mgmt.compute.models.GalleryApplication or IO[bytes] - :return: An instance of LROPoller that returns either GalleryApplication or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.GalleryApplication] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-03")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.GalleryApplication] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._create_or_update_initial( - resource_group_name=resource_group_name, - 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, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("GalleryApplication", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.GalleryApplication].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.GalleryApplication]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _update_initial( - self, - resource_group_name: str, - gallery_name: str, - gallery_application_name: str, - gallery_application: Union[_models.GalleryApplicationUpdate, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-03")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(gallery_application, (IOBase, bytes)): - _content = gallery_application - else: - _json = self._serialize.body(gallery_application, "GalleryApplicationUpdate") - - _request = build_update_request( - resource_group_name=resource_group_name, - gallery_name=gallery_name, - gallery_application_name=gallery_application_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update( - self, - resource_group_name: str, - gallery_name: str, - gallery_application_name: str, - gallery_application: _models.GalleryApplicationUpdate, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.GalleryApplication]: - """Update a gallery Application Definition. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :param gallery_application_name: The name of the gallery Application Definition to be - retrieved. Required. - :type gallery_application_name: str - :param gallery_application: Parameters supplied to the update gallery Application operation. - Required. - :type gallery_application: ~azure.mgmt.compute.models.GalleryApplicationUpdate - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either GalleryApplication or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.GalleryApplication] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update( - self, - resource_group_name: str, - gallery_name: str, - gallery_application_name: str, - gallery_application: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.GalleryApplication]: - """Update a gallery Application Definition. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :param gallery_application_name: The name of the gallery Application Definition to be - retrieved. Required. - :type gallery_application_name: str - :param gallery_application: Parameters supplied to the update gallery Application operation. - Required. - :type gallery_application: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either GalleryApplication or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.GalleryApplication] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_update( - self, - resource_group_name: str, - gallery_name: str, - gallery_application_name: str, - gallery_application: Union[_models.GalleryApplicationUpdate, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.GalleryApplication]: - """Update a gallery Application Definition. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :param gallery_application_name: The name of the gallery Application Definition to be - retrieved. Required. - :type gallery_application_name: str - :param gallery_application: Parameters supplied to the update gallery Application operation. Is - either a GalleryApplicationUpdate type or a IO[bytes] type. Required. - :type gallery_application: ~azure.mgmt.compute.models.GalleryApplicationUpdate or IO[bytes] - :return: An instance of LROPoller that returns either GalleryApplication or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.GalleryApplication] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-03")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.GalleryApplication] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._update_initial( - resource_group_name=resource_group_name, - 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, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - response_headers = {} - response = pipeline_response.http_response - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = self._deserialize("GalleryApplication", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.GalleryApplication].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.GalleryApplication]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, gallery_name: str, gallery_application_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-03")) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - gallery_name=gallery_name, - gallery_application_name=gallery_application_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_delete( - self, resource_group_name: str, gallery_name: str, gallery_application_name: str, **kwargs: Any - ) -> LROPoller[None]: - """Delete a gallery Application. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :param gallery_application_name: The name of the gallery Application Definition to be - retrieved. Required. - :type gallery_application_name: str - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-03")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( - 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, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/operations/_gallery_image_versions_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/operations/_gallery_image_versions_operations.py deleted file mode 100644 index b9164dd78539..000000000000 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/operations/_gallery_image_versions_operations.py +++ /dev/null @@ -1,1010 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression,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 collections.abc import MutableMapping -from io import IOBase -from typing import Any, Callable, IO, Iterator, Optional, TypeVar, Union, cast, overload - -from azure.core import PipelineClient -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - StreamClosedError, - StreamConsumedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from .._configuration import ComputeManagementClientConfiguration -from .._utils.serialization import Deserializer, Serializer - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] -List = list - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_by_gallery_image_request( - resource_group_name: str, gallery_name: str, gallery_image_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-03")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}/versions", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "galleryName": _SERIALIZER.url("gallery_name", gallery_name, "str"), - "galleryImageName": _SERIALIZER.url("gallery_image_name", gallery_image_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_request( - resource_group_name: str, - gallery_name: str, - gallery_image_name: str, - gallery_image_version_name: str, - subscription_id: str, - *, - expand: Optional[Union[str, _models.ReplicationStatusTypes]] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-03")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "galleryName": _SERIALIZER.url("gallery_name", gallery_name, "str"), - "galleryImageName": _SERIALIZER.url("gallery_image_name", gallery_image_name, "str"), - "galleryImageVersionName": _SERIALIZER.url("gallery_image_version_name", gallery_image_version_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if expand is not None: - _params["$expand"] = _SERIALIZER.query("expand", expand, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, - gallery_name: str, - gallery_image_name: str, - gallery_image_version_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-03")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "galleryName": _SERIALIZER.url("gallery_name", gallery_name, "str"), - "galleryImageName": _SERIALIZER.url("gallery_image_name", gallery_image_name, "str"), - "galleryImageVersionName": _SERIALIZER.url("gallery_image_version_name", gallery_image_version_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_request( - resource_group_name: str, - gallery_name: str, - gallery_image_name: str, - gallery_image_version_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-03")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "galleryName": _SERIALIZER.url("gallery_name", gallery_name, "str"), - "galleryImageName": _SERIALIZER.url("gallery_image_name", gallery_image_name, "str"), - "galleryImageVersionName": _SERIALIZER.url("gallery_image_version_name", gallery_image_version_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, - gallery_name: str, - gallery_image_name: str, - gallery_image_version_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-03")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "galleryName": _SERIALIZER.url("gallery_name", gallery_name, "str"), - "galleryImageName": _SERIALIZER.url("gallery_image_name", gallery_image_name, "str"), - "galleryImageVersionName": _SERIALIZER.url("gallery_image_version_name", gallery_image_version_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -class GalleryImageVersionsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.compute.ComputeManagementClient`'s - :attr:`gallery_image_versions` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list_by_gallery_image( - self, resource_group_name: str, gallery_name: str, gallery_image_name: str, **kwargs: Any - ) -> ItemPaged["_models.GalleryImageVersion"]: - """List gallery image versions in a gallery image definition. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :param gallery_image_name: The name of the gallery image definition to be retrieved. Required. - :type gallery_image_name: str - :return: An iterator like instance of either GalleryImageVersion or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.models.GalleryImageVersion] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-03")) - cls: ClsType[_models.GalleryImageVersionList] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_by_gallery_image_request( - resource_group_name=resource_group_name, - gallery_name=gallery_name, - gallery_image_name=gallery_image_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - _request = HttpRequest("GET", next_link) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("GalleryImageVersionList", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @distributed_trace - def get( - self, - resource_group_name: str, - gallery_name: str, - gallery_image_name: str, - gallery_image_version_name: str, - expand: Optional[Union[str, _models.ReplicationStatusTypes]] = None, - **kwargs: Any - ) -> _models.GalleryImageVersion: - """Retrieves information about a gallery image version. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :param gallery_image_name: The name of the gallery image definition to be retrieved. Required. - :type gallery_image_name: str - :param gallery_image_version_name: The name of the gallery image version to be retrieved. - Required. - :type gallery_image_version_name: str - :param expand: The expand expression to apply on the operation. Known values are: - "ReplicationStatus" and "UefiSettings". Default value is None. - :type expand: str or ~azure.mgmt.compute.models.ReplicationStatusTypes - :return: GalleryImageVersion or the result of cls(response) - :rtype: ~azure.mgmt.compute.models.GalleryImageVersion - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-03")) - cls: ClsType[_models.GalleryImageVersion] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - gallery_name=gallery_name, - gallery_image_name=gallery_image_name, - gallery_image_version_name=gallery_image_version_name, - subscription_id=self._config.subscription_id, - expand=expand, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("GalleryImageVersion", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - gallery_name: str, - gallery_image_name: str, - gallery_image_version_name: str, - gallery_image_version: Union[_models.GalleryImageVersion, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-03")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(gallery_image_version, (IOBase, bytes)): - _content = gallery_image_version - else: - _json = self._serialize.body(gallery_image_version, "GalleryImageVersion") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - gallery_name=gallery_name, - gallery_image_name=gallery_image_name, - gallery_image_version_name=gallery_image_version_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 201: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - gallery_name: str, - gallery_image_name: str, - gallery_image_version_name: str, - gallery_image_version: _models.GalleryImageVersion, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.GalleryImageVersion]: - """Create or update a gallery image version. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :param gallery_image_name: The name of the gallery image definition to be retrieved. Required. - :type gallery_image_name: str - :param gallery_image_version_name: The name of the gallery image version to be retrieved. - Required. - :type gallery_image_version_name: str - :param gallery_image_version: Parameters supplied to the create or update gallery image version - operation. Required. - :type gallery_image_version: ~azure.mgmt.compute.models.GalleryImageVersion - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either GalleryImageVersion or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.GalleryImageVersion] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - gallery_name: str, - gallery_image_name: str, - gallery_image_version_name: str, - gallery_image_version: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.GalleryImageVersion]: - """Create or update a gallery image version. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :param gallery_image_name: The name of the gallery image definition to be retrieved. Required. - :type gallery_image_name: str - :param gallery_image_version_name: The name of the gallery image version to be retrieved. - Required. - :type gallery_image_version_name: str - :param gallery_image_version: Parameters supplied to the create or update gallery image version - operation. Required. - :type gallery_image_version: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either GalleryImageVersion or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.GalleryImageVersion] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - gallery_name: str, - gallery_image_name: str, - gallery_image_version_name: str, - gallery_image_version: Union[_models.GalleryImageVersion, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.GalleryImageVersion]: - """Create or update a gallery image version. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :param gallery_image_name: The name of the gallery image definition to be retrieved. Required. - :type gallery_image_name: str - :param gallery_image_version_name: The name of the gallery image version to be retrieved. - Required. - :type gallery_image_version_name: str - :param gallery_image_version: Parameters supplied to the create or update gallery image version - operation. Is either a GalleryImageVersion type or a IO[bytes] type. Required. - :type gallery_image_version: ~azure.mgmt.compute.models.GalleryImageVersion or IO[bytes] - :return: An instance of LROPoller that returns either GalleryImageVersion or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.GalleryImageVersion] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-03")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.GalleryImageVersion] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._create_or_update_initial( - resource_group_name=resource_group_name, - gallery_name=gallery_name, - 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, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("GalleryImageVersion", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.GalleryImageVersion].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.GalleryImageVersion]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _update_initial( - self, - resource_group_name: str, - gallery_name: str, - gallery_image_name: str, - gallery_image_version_name: str, - gallery_image_version: Union[_models.GalleryImageVersionUpdate, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-03")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(gallery_image_version, (IOBase, bytes)): - _content = gallery_image_version - else: - _json = self._serialize.body(gallery_image_version, "GalleryImageVersionUpdate") - - _request = build_update_request( - resource_group_name=resource_group_name, - gallery_name=gallery_name, - gallery_image_name=gallery_image_name, - gallery_image_version_name=gallery_image_version_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update( - self, - resource_group_name: str, - gallery_name: str, - gallery_image_name: str, - gallery_image_version_name: str, - gallery_image_version: _models.GalleryImageVersionUpdate, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.GalleryImageVersion]: - """Update a gallery image version. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :param gallery_image_name: The name of the gallery image definition to be retrieved. Required. - :type gallery_image_name: str - :param gallery_image_version_name: The name of the gallery image version to be retrieved. - Required. - :type gallery_image_version_name: str - :param gallery_image_version: Parameters supplied to the update gallery image version - operation. Required. - :type gallery_image_version: ~azure.mgmt.compute.models.GalleryImageVersionUpdate - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either GalleryImageVersion or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.GalleryImageVersion] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update( - self, - resource_group_name: str, - gallery_name: str, - gallery_image_name: str, - gallery_image_version_name: str, - gallery_image_version: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.GalleryImageVersion]: - """Update a gallery image version. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :param gallery_image_name: The name of the gallery image definition to be retrieved. Required. - :type gallery_image_name: str - :param gallery_image_version_name: The name of the gallery image version to be retrieved. - Required. - :type gallery_image_version_name: str - :param gallery_image_version: Parameters supplied to the update gallery image version - operation. Required. - :type gallery_image_version: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either GalleryImageVersion or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.GalleryImageVersion] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_update( - self, - resource_group_name: str, - gallery_name: str, - gallery_image_name: str, - gallery_image_version_name: str, - gallery_image_version: Union[_models.GalleryImageVersionUpdate, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.GalleryImageVersion]: - """Update a gallery image version. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :param gallery_image_name: The name of the gallery image definition to be retrieved. Required. - :type gallery_image_name: str - :param gallery_image_version_name: The name of the gallery image version to be retrieved. - Required. - :type gallery_image_version_name: str - :param gallery_image_version: Parameters supplied to the update gallery image version - operation. Is either a GalleryImageVersionUpdate type or a IO[bytes] type. Required. - :type gallery_image_version: ~azure.mgmt.compute.models.GalleryImageVersionUpdate or IO[bytes] - :return: An instance of LROPoller that returns either GalleryImageVersion or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.GalleryImageVersion] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-03")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.GalleryImageVersion] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._update_initial( - resource_group_name=resource_group_name, - gallery_name=gallery_name, - 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, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - response_headers = {} - response = pipeline_response.http_response - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = self._deserialize("GalleryImageVersion", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.GalleryImageVersion].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.GalleryImageVersion]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, - resource_group_name: str, - gallery_name: str, - gallery_image_name: str, - gallery_image_version_name: str, - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-03")) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - gallery_name=gallery_name, - gallery_image_name=gallery_image_name, - gallery_image_version_name=gallery_image_version_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_delete( - self, - resource_group_name: str, - gallery_name: str, - gallery_image_name: str, - gallery_image_version_name: str, - **kwargs: Any - ) -> LROPoller[None]: - """Delete a gallery image version. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :param gallery_image_name: The name of the gallery image definition to be retrieved. Required. - :type gallery_image_name: str - :param gallery_image_version_name: The name of the gallery image version to be retrieved. - Required. - :type gallery_image_version_name: str - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-03")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - gallery_name=gallery_name, - gallery_image_name=gallery_image_name, - gallery_image_version_name=gallery_image_version_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/operations/_gallery_images_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/operations/_gallery_images_operations.py deleted file mode 100644 index d24838a1bd03..000000000000 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/operations/_gallery_images_operations.py +++ /dev/null @@ -1,917 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# 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 collections.abc import MutableMapping -from io import IOBase -from typing import Any, Callable, IO, Iterator, Optional, TypeVar, Union, cast, overload - -from azure.core import PipelineClient -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - StreamClosedError, - StreamConsumedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from .._configuration import ComputeManagementClientConfiguration -from .._utils.serialization import Deserializer, Serializer - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] -List = list - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_by_gallery_request( - resource_group_name: str, gallery_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-03")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "galleryName": _SERIALIZER.url("gallery_name", gallery_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_request( - resource_group_name: str, gallery_name: str, gallery_image_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-03")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "galleryName": _SERIALIZER.url("gallery_name", gallery_name, "str"), - "galleryImageName": _SERIALIZER.url("gallery_image_name", gallery_image_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, gallery_name: str, gallery_image_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-03")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "galleryName": _SERIALIZER.url("gallery_name", gallery_name, "str"), - "galleryImageName": _SERIALIZER.url("gallery_image_name", gallery_image_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_request( - resource_group_name: str, gallery_name: str, gallery_image_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-03")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "galleryName": _SERIALIZER.url("gallery_name", gallery_name, "str"), - "galleryImageName": _SERIALIZER.url("gallery_image_name", gallery_image_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, gallery_name: str, gallery_image_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-03")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "galleryName": _SERIALIZER.url("gallery_name", gallery_name, "str"), - "galleryImageName": _SERIALIZER.url("gallery_image_name", gallery_image_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -class GalleryImagesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.compute.ComputeManagementClient`'s - :attr:`gallery_images` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list_by_gallery( - self, resource_group_name: str, gallery_name: str, **kwargs: Any - ) -> ItemPaged["_models.GalleryImage"]: - """List gallery image definitions in a gallery. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :return: An iterator like instance of either GalleryImage or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.models.GalleryImage] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-03")) - cls: ClsType[_models.GalleryImageList] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_by_gallery_request( - resource_group_name=resource_group_name, - gallery_name=gallery_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - _request = HttpRequest("GET", next_link) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("GalleryImageList", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @distributed_trace - def get( - self, resource_group_name: str, gallery_name: str, gallery_image_name: str, **kwargs: Any - ) -> _models.GalleryImage: - """Retrieves information about a gallery image definition. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :param gallery_image_name: The name of the gallery image definition to be retrieved. Required. - :type gallery_image_name: str - :return: GalleryImage or the result of cls(response) - :rtype: ~azure.mgmt.compute.models.GalleryImage - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-03")) - cls: ClsType[_models.GalleryImage] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - gallery_name=gallery_name, - gallery_image_name=gallery_image_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("GalleryImage", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - gallery_name: str, - gallery_image_name: str, - gallery_image: Union[_models.GalleryImage, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-03")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(gallery_image, (IOBase, bytes)): - _content = gallery_image - else: - _json = self._serialize.body(gallery_image, "GalleryImage") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - gallery_name=gallery_name, - gallery_image_name=gallery_image_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 201: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - gallery_name: str, - gallery_image_name: str, - gallery_image: _models.GalleryImage, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.GalleryImage]: - """Create or update a gallery image definition. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :param gallery_image_name: The name of the gallery image definition to be retrieved. Required. - :type gallery_image_name: str - :param gallery_image: Parameters supplied to the create or update gallery image operation. - Required. - :type gallery_image: ~azure.mgmt.compute.models.GalleryImage - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either GalleryImage or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.GalleryImage] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - gallery_name: str, - gallery_image_name: str, - gallery_image: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.GalleryImage]: - """Create or update a gallery image definition. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :param gallery_image_name: The name of the gallery image definition to be retrieved. Required. - :type gallery_image_name: str - :param gallery_image: Parameters supplied to the create or update gallery image operation. - Required. - :type gallery_image: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either GalleryImage or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.GalleryImage] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - gallery_name: str, - gallery_image_name: str, - gallery_image: Union[_models.GalleryImage, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.GalleryImage]: - """Create or update a gallery image definition. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :param gallery_image_name: The name of the gallery image definition to be retrieved. Required. - :type gallery_image_name: str - :param gallery_image: Parameters supplied to the create or update gallery image operation. Is - either a GalleryImage type or a IO[bytes] type. Required. - :type gallery_image: ~azure.mgmt.compute.models.GalleryImage or IO[bytes] - :return: An instance of LROPoller that returns either GalleryImage or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.GalleryImage] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-03")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.GalleryImage] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._create_or_update_initial( - resource_group_name=resource_group_name, - 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, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("GalleryImage", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.GalleryImage].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.GalleryImage]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _update_initial( - self, - resource_group_name: str, - gallery_name: str, - gallery_image_name: str, - gallery_image: Union[_models.GalleryImageUpdate, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-03")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(gallery_image, (IOBase, bytes)): - _content = gallery_image - else: - _json = self._serialize.body(gallery_image, "GalleryImageUpdate") - - _request = build_update_request( - resource_group_name=resource_group_name, - gallery_name=gallery_name, - gallery_image_name=gallery_image_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update( - self, - resource_group_name: str, - gallery_name: str, - gallery_image_name: str, - gallery_image: _models.GalleryImageUpdate, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.GalleryImage]: - """Update a gallery image definition. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :param gallery_image_name: The name of the gallery image definition to be retrieved. Required. - :type gallery_image_name: str - :param gallery_image: Parameters supplied to the update gallery image operation. Required. - :type gallery_image: ~azure.mgmt.compute.models.GalleryImageUpdate - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either GalleryImage or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.GalleryImage] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update( - self, - resource_group_name: str, - gallery_name: str, - gallery_image_name: str, - gallery_image: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.GalleryImage]: - """Update a gallery image definition. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :param gallery_image_name: The name of the gallery image definition to be retrieved. Required. - :type gallery_image_name: str - :param gallery_image: Parameters supplied to the update gallery image operation. Required. - :type gallery_image: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either GalleryImage or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.GalleryImage] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_update( - self, - resource_group_name: str, - gallery_name: str, - gallery_image_name: str, - gallery_image: Union[_models.GalleryImageUpdate, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.GalleryImage]: - """Update a gallery image definition. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :param gallery_image_name: The name of the gallery image definition to be retrieved. Required. - :type gallery_image_name: str - :param gallery_image: Parameters supplied to the update gallery image operation. Is either a - GalleryImageUpdate type or a IO[bytes] type. Required. - :type gallery_image: ~azure.mgmt.compute.models.GalleryImageUpdate or IO[bytes] - :return: An instance of LROPoller that returns either GalleryImage or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.GalleryImage] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-03")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.GalleryImage] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._update_initial( - resource_group_name=resource_group_name, - 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, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - response_headers = {} - response = pipeline_response.http_response - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = self._deserialize("GalleryImage", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.GalleryImage].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.GalleryImage]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, gallery_name: str, gallery_image_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-03")) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - gallery_name=gallery_name, - gallery_image_name=gallery_image_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_delete( - self, resource_group_name: str, gallery_name: str, gallery_image_name: str, **kwargs: Any - ) -> LROPoller[None]: - """Delete a gallery image. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :param gallery_image_name: The name of the gallery image definition to be retrieved. Required. - :type gallery_image_name: str - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-03")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( - 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, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/operations/_gallery_in_vm_access_control_profile_versions_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/operations/_gallery_in_vm_access_control_profile_versions_operations.py deleted file mode 100644 index 115de5c9aeae..000000000000 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/operations/_gallery_in_vm_access_control_profile_versions_operations.py +++ /dev/null @@ -1,1052 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression,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 collections.abc import MutableMapping -from io import IOBase -from typing import Any, Callable, IO, Iterator, Optional, TypeVar, Union, cast, overload - -from azure.core import PipelineClient -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - StreamClosedError, - StreamConsumedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from .._configuration import ComputeManagementClientConfiguration -from .._utils.serialization import Deserializer, Serializer - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] -List = list - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_by_gallery_in_vm_access_control_profile_request( # pylint: disable=name-too-long - resource_group_name: str, - gallery_name: str, - in_vm_access_control_profile_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-03")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/inVMAccessControlProfiles/{inVMAccessControlProfileName}/versions", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "galleryName": _SERIALIZER.url("gallery_name", gallery_name, "str"), - "inVMAccessControlProfileName": _SERIALIZER.url( - "in_vm_access_control_profile_name", in_vm_access_control_profile_name, "str" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_request( - resource_group_name: str, - gallery_name: str, - in_vm_access_control_profile_name: str, - in_vm_access_control_profile_version_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-03")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/inVMAccessControlProfiles/{inVMAccessControlProfileName}/versions/{inVMAccessControlProfileVersionName}", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "galleryName": _SERIALIZER.url("gallery_name", gallery_name, "str"), - "inVMAccessControlProfileName": _SERIALIZER.url( - "in_vm_access_control_profile_name", in_vm_access_control_profile_name, "str" - ), - "inVMAccessControlProfileVersionName": _SERIALIZER.url( - "in_vm_access_control_profile_version_name", in_vm_access_control_profile_version_name, "str" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, - gallery_name: str, - in_vm_access_control_profile_name: str, - in_vm_access_control_profile_version_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-03")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/inVMAccessControlProfiles/{inVMAccessControlProfileName}/versions/{inVMAccessControlProfileVersionName}", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "galleryName": _SERIALIZER.url("gallery_name", gallery_name, "str"), - "inVMAccessControlProfileName": _SERIALIZER.url( - "in_vm_access_control_profile_name", in_vm_access_control_profile_name, "str" - ), - "inVMAccessControlProfileVersionName": _SERIALIZER.url( - "in_vm_access_control_profile_version_name", in_vm_access_control_profile_version_name, "str" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_request( - resource_group_name: str, - gallery_name: str, - in_vm_access_control_profile_name: str, - in_vm_access_control_profile_version_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-03")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/inVMAccessControlProfiles/{inVMAccessControlProfileName}/versions/{inVMAccessControlProfileVersionName}", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "galleryName": _SERIALIZER.url("gallery_name", gallery_name, "str"), - "inVMAccessControlProfileName": _SERIALIZER.url( - "in_vm_access_control_profile_name", in_vm_access_control_profile_name, "str" - ), - "inVMAccessControlProfileVersionName": _SERIALIZER.url( - "in_vm_access_control_profile_version_name", in_vm_access_control_profile_version_name, "str" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, - gallery_name: str, - in_vm_access_control_profile_name: str, - in_vm_access_control_profile_version_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-03")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/inVMAccessControlProfiles/{inVMAccessControlProfileName}/versions/{inVMAccessControlProfileVersionName}", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "galleryName": _SERIALIZER.url("gallery_name", gallery_name, "str"), - "inVMAccessControlProfileName": _SERIALIZER.url( - "in_vm_access_control_profile_name", in_vm_access_control_profile_name, "str" - ), - "inVMAccessControlProfileVersionName": _SERIALIZER.url( - "in_vm_access_control_profile_version_name", in_vm_access_control_profile_version_name, "str" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -class GalleryInVMAccessControlProfileVersionsOperations: # pylint: disable=name-too-long - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.compute.ComputeManagementClient`'s - :attr:`gallery_in_vm_access_control_profile_versions` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list_by_gallery_in_vm_access_control_profile( # pylint: disable=name-too-long - self, resource_group_name: str, gallery_name: str, in_vm_access_control_profile_name: str, **kwargs: Any - ) -> ItemPaged["_models.GalleryInVMAccessControlProfileVersion"]: - """List gallery inVMAccessControlProfile versions in a gallery inVMAccessControlProfile. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :param in_vm_access_control_profile_name: The name of the gallery inVMAccessControlProfile to - be retrieved. Required. - :type in_vm_access_control_profile_name: str - :return: An iterator like instance of either GalleryInVMAccessControlProfileVersion or the - result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.compute.models.GalleryInVMAccessControlProfileVersion] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-03")) - cls: ClsType[_models.GalleryInVMAccessControlProfileVersionList] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_by_gallery_in_vm_access_control_profile_request( - resource_group_name=resource_group_name, - gallery_name=gallery_name, - in_vm_access_control_profile_name=in_vm_access_control_profile_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - _request = HttpRequest("GET", next_link) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("GalleryInVMAccessControlProfileVersionList", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @distributed_trace - def get( - self, - resource_group_name: str, - gallery_name: str, - in_vm_access_control_profile_name: str, - in_vm_access_control_profile_version_name: str, - **kwargs: Any - ) -> _models.GalleryInVMAccessControlProfileVersion: - """Retrieves information about a gallery inVMAccessControlProfile version. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :param in_vm_access_control_profile_name: The name of the gallery inVMAccessControlProfile to - be retrieved. Required. - :type in_vm_access_control_profile_name: str - :param in_vm_access_control_profile_version_name: The name of the gallery - inVMAccessControlProfile version to be retrieved. Required. - :type in_vm_access_control_profile_version_name: str - :return: GalleryInVMAccessControlProfileVersion or the result of cls(response) - :rtype: ~azure.mgmt.compute.models.GalleryInVMAccessControlProfileVersion - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-03")) - cls: ClsType[_models.GalleryInVMAccessControlProfileVersion] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - gallery_name=gallery_name, - in_vm_access_control_profile_name=in_vm_access_control_profile_name, - in_vm_access_control_profile_version_name=in_vm_access_control_profile_version_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("GalleryInVMAccessControlProfileVersion", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - gallery_name: str, - in_vm_access_control_profile_name: str, - in_vm_access_control_profile_version_name: str, - gallery_in_vm_access_control_profile_version: Union[_models.GalleryInVMAccessControlProfileVersion, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-03")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(gallery_in_vm_access_control_profile_version, (IOBase, bytes)): - _content = gallery_in_vm_access_control_profile_version - else: - _json = self._serialize.body( - gallery_in_vm_access_control_profile_version, "GalleryInVMAccessControlProfileVersion" - ) - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - gallery_name=gallery_name, - in_vm_access_control_profile_name=in_vm_access_control_profile_name, - in_vm_access_control_profile_version_name=in_vm_access_control_profile_version_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 201: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - gallery_name: str, - in_vm_access_control_profile_name: str, - in_vm_access_control_profile_version_name: str, - gallery_in_vm_access_control_profile_version: _models.GalleryInVMAccessControlProfileVersion, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.GalleryInVMAccessControlProfileVersion]: - """Create or update a gallery inVMAccessControlProfile version. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :param in_vm_access_control_profile_name: The name of the gallery inVMAccessControlProfile to - be retrieved. Required. - :type in_vm_access_control_profile_name: str - :param in_vm_access_control_profile_version_name: The name of the gallery - inVMAccessControlProfile version to be retrieved. Required. - :type in_vm_access_control_profile_version_name: str - :param gallery_in_vm_access_control_profile_version: Parameters supplied to the create or - update gallery inVMAccessControlProfile version operation. Required. - :type gallery_in_vm_access_control_profile_version: - ~azure.mgmt.compute.models.GalleryInVMAccessControlProfileVersion - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either GalleryInVMAccessControlProfileVersion or - the result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.GalleryInVMAccessControlProfileVersion] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - gallery_name: str, - in_vm_access_control_profile_name: str, - in_vm_access_control_profile_version_name: str, - gallery_in_vm_access_control_profile_version: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.GalleryInVMAccessControlProfileVersion]: - """Create or update a gallery inVMAccessControlProfile version. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :param in_vm_access_control_profile_name: The name of the gallery inVMAccessControlProfile to - be retrieved. Required. - :type in_vm_access_control_profile_name: str - :param in_vm_access_control_profile_version_name: The name of the gallery - inVMAccessControlProfile version to be retrieved. Required. - :type in_vm_access_control_profile_version_name: str - :param gallery_in_vm_access_control_profile_version: Parameters supplied to the create or - update gallery inVMAccessControlProfile version operation. Required. - :type gallery_in_vm_access_control_profile_version: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either GalleryInVMAccessControlProfileVersion or - the result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.GalleryInVMAccessControlProfileVersion] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - gallery_name: str, - in_vm_access_control_profile_name: str, - in_vm_access_control_profile_version_name: str, - gallery_in_vm_access_control_profile_version: Union[_models.GalleryInVMAccessControlProfileVersion, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.GalleryInVMAccessControlProfileVersion]: - """Create or update a gallery inVMAccessControlProfile version. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :param in_vm_access_control_profile_name: The name of the gallery inVMAccessControlProfile to - be retrieved. Required. - :type in_vm_access_control_profile_name: str - :param in_vm_access_control_profile_version_name: The name of the gallery - inVMAccessControlProfile version to be retrieved. Required. - :type in_vm_access_control_profile_version_name: str - :param gallery_in_vm_access_control_profile_version: Parameters supplied to the create or - update gallery inVMAccessControlProfile version operation. Is either a - GalleryInVMAccessControlProfileVersion type or a IO[bytes] type. Required. - :type gallery_in_vm_access_control_profile_version: - ~azure.mgmt.compute.models.GalleryInVMAccessControlProfileVersion or IO[bytes] - :return: An instance of LROPoller that returns either GalleryInVMAccessControlProfileVersion or - the result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.GalleryInVMAccessControlProfileVersion] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-03")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.GalleryInVMAccessControlProfileVersion] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._create_or_update_initial( - resource_group_name=resource_group_name, - gallery_name=gallery_name, - in_vm_access_control_profile_name=in_vm_access_control_profile_name, - in_vm_access_control_profile_version_name=in_vm_access_control_profile_version_name, - gallery_in_vm_access_control_profile_version=gallery_in_vm_access_control_profile_version, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("GalleryInVMAccessControlProfileVersion", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.GalleryInVMAccessControlProfileVersion].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.GalleryInVMAccessControlProfileVersion]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _update_initial( - self, - resource_group_name: str, - gallery_name: str, - in_vm_access_control_profile_name: str, - in_vm_access_control_profile_version_name: str, - gallery_in_vm_access_control_profile_version: Union[ - _models.GalleryInVMAccessControlProfileVersionUpdate, IO[bytes] - ], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-03")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(gallery_in_vm_access_control_profile_version, (IOBase, bytes)): - _content = gallery_in_vm_access_control_profile_version - else: - _json = self._serialize.body( - gallery_in_vm_access_control_profile_version, "GalleryInVMAccessControlProfileVersionUpdate" - ) - - _request = build_update_request( - resource_group_name=resource_group_name, - gallery_name=gallery_name, - in_vm_access_control_profile_name=in_vm_access_control_profile_name, - in_vm_access_control_profile_version_name=in_vm_access_control_profile_version_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update( - self, - resource_group_name: str, - gallery_name: str, - in_vm_access_control_profile_name: str, - in_vm_access_control_profile_version_name: str, - gallery_in_vm_access_control_profile_version: _models.GalleryInVMAccessControlProfileVersionUpdate, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.GalleryInVMAccessControlProfileVersion]: - """Update a gallery inVMAccessControlProfile version. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :param in_vm_access_control_profile_name: The name of the gallery inVMAccessControlProfile to - be retrieved. Required. - :type in_vm_access_control_profile_name: str - :param in_vm_access_control_profile_version_name: The name of the gallery - inVMAccessControlProfile version to be retrieved. Required. - :type in_vm_access_control_profile_version_name: str - :param gallery_in_vm_access_control_profile_version: Parameters supplied to the update gallery - inVMAccessControlProfile version operation. Required. - :type gallery_in_vm_access_control_profile_version: - ~azure.mgmt.compute.models.GalleryInVMAccessControlProfileVersionUpdate - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either GalleryInVMAccessControlProfileVersion or - the result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.GalleryInVMAccessControlProfileVersion] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update( - self, - resource_group_name: str, - gallery_name: str, - in_vm_access_control_profile_name: str, - in_vm_access_control_profile_version_name: str, - gallery_in_vm_access_control_profile_version: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.GalleryInVMAccessControlProfileVersion]: - """Update a gallery inVMAccessControlProfile version. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :param in_vm_access_control_profile_name: The name of the gallery inVMAccessControlProfile to - be retrieved. Required. - :type in_vm_access_control_profile_name: str - :param in_vm_access_control_profile_version_name: The name of the gallery - inVMAccessControlProfile version to be retrieved. Required. - :type in_vm_access_control_profile_version_name: str - :param gallery_in_vm_access_control_profile_version: Parameters supplied to the update gallery - inVMAccessControlProfile version operation. Required. - :type gallery_in_vm_access_control_profile_version: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either GalleryInVMAccessControlProfileVersion or - the result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.GalleryInVMAccessControlProfileVersion] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_update( - self, - resource_group_name: str, - gallery_name: str, - in_vm_access_control_profile_name: str, - in_vm_access_control_profile_version_name: str, - gallery_in_vm_access_control_profile_version: Union[ - _models.GalleryInVMAccessControlProfileVersionUpdate, IO[bytes] - ], - **kwargs: Any - ) -> LROPoller[_models.GalleryInVMAccessControlProfileVersion]: - """Update a gallery inVMAccessControlProfile version. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :param in_vm_access_control_profile_name: The name of the gallery inVMAccessControlProfile to - be retrieved. Required. - :type in_vm_access_control_profile_name: str - :param in_vm_access_control_profile_version_name: The name of the gallery - inVMAccessControlProfile version to be retrieved. Required. - :type in_vm_access_control_profile_version_name: str - :param gallery_in_vm_access_control_profile_version: Parameters supplied to the update gallery - inVMAccessControlProfile version operation. Is either a - GalleryInVMAccessControlProfileVersionUpdate type or a IO[bytes] type. Required. - :type gallery_in_vm_access_control_profile_version: - ~azure.mgmt.compute.models.GalleryInVMAccessControlProfileVersionUpdate or IO[bytes] - :return: An instance of LROPoller that returns either GalleryInVMAccessControlProfileVersion or - the result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.GalleryInVMAccessControlProfileVersion] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-03")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.GalleryInVMAccessControlProfileVersion] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._update_initial( - resource_group_name=resource_group_name, - gallery_name=gallery_name, - in_vm_access_control_profile_name=in_vm_access_control_profile_name, - in_vm_access_control_profile_version_name=in_vm_access_control_profile_version_name, - gallery_in_vm_access_control_profile_version=gallery_in_vm_access_control_profile_version, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - response_headers = {} - response = pipeline_response.http_response - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = self._deserialize("GalleryInVMAccessControlProfileVersion", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.GalleryInVMAccessControlProfileVersion].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.GalleryInVMAccessControlProfileVersion]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, - resource_group_name: str, - gallery_name: str, - in_vm_access_control_profile_name: str, - in_vm_access_control_profile_version_name: str, - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-03")) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - gallery_name=gallery_name, - in_vm_access_control_profile_name=in_vm_access_control_profile_name, - in_vm_access_control_profile_version_name=in_vm_access_control_profile_version_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [202, 204]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_delete( - self, - resource_group_name: str, - gallery_name: str, - in_vm_access_control_profile_name: str, - in_vm_access_control_profile_version_name: str, - **kwargs: Any - ) -> LROPoller[None]: - """Delete a gallery inVMAccessControlProfile version. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :param in_vm_access_control_profile_name: The name of the gallery inVMAccessControlProfile to - be retrieved. Required. - :type in_vm_access_control_profile_name: str - :param in_vm_access_control_profile_version_name: The name of the gallery - inVMAccessControlProfile version to be retrieved. Required. - :type in_vm_access_control_profile_version_name: str - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-03")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - gallery_name=gallery_name, - in_vm_access_control_profile_name=in_vm_access_control_profile_name, - in_vm_access_control_profile_version_name=in_vm_access_control_profile_version_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/operations/_gallery_in_vm_access_control_profiles_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/operations/_gallery_in_vm_access_control_profiles_operations.py deleted file mode 100644 index 1cb16ed08483..000000000000 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/operations/_gallery_in_vm_access_control_profiles_operations.py +++ /dev/null @@ -1,963 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# 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 collections.abc import MutableMapping -from io import IOBase -from typing import Any, Callable, IO, Iterator, Optional, TypeVar, Union, cast, overload - -from azure.core import PipelineClient -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - StreamClosedError, - StreamConsumedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from .._configuration import ComputeManagementClientConfiguration -from .._utils.serialization import Deserializer, Serializer - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] -List = list - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_by_gallery_request( - resource_group_name: str, gallery_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-03")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/inVMAccessControlProfiles", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "galleryName": _SERIALIZER.url("gallery_name", gallery_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_request( - resource_group_name: str, - gallery_name: str, - in_vm_access_control_profile_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-03")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/inVMAccessControlProfiles/{inVMAccessControlProfileName}", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "galleryName": _SERIALIZER.url("gallery_name", gallery_name, "str"), - "inVMAccessControlProfileName": _SERIALIZER.url( - "in_vm_access_control_profile_name", in_vm_access_control_profile_name, "str" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, - gallery_name: str, - in_vm_access_control_profile_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-03")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/inVMAccessControlProfiles/{inVMAccessControlProfileName}", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "galleryName": _SERIALIZER.url("gallery_name", gallery_name, "str"), - "inVMAccessControlProfileName": _SERIALIZER.url( - "in_vm_access_control_profile_name", in_vm_access_control_profile_name, "str" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_request( - resource_group_name: str, - gallery_name: str, - in_vm_access_control_profile_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-03")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/inVMAccessControlProfiles/{inVMAccessControlProfileName}", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "galleryName": _SERIALIZER.url("gallery_name", gallery_name, "str"), - "inVMAccessControlProfileName": _SERIALIZER.url( - "in_vm_access_control_profile_name", in_vm_access_control_profile_name, "str" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, - gallery_name: str, - in_vm_access_control_profile_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-03")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/inVMAccessControlProfiles/{inVMAccessControlProfileName}", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "galleryName": _SERIALIZER.url("gallery_name", gallery_name, "str"), - "inVMAccessControlProfileName": _SERIALIZER.url( - "in_vm_access_control_profile_name", in_vm_access_control_profile_name, "str" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -class GalleryInVMAccessControlProfilesOperations: # pylint: disable=name-too-long - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.compute.ComputeManagementClient`'s - :attr:`gallery_in_vm_access_control_profiles` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list_by_gallery( - self, resource_group_name: str, gallery_name: str, **kwargs: Any - ) -> ItemPaged["_models.GalleryInVMAccessControlProfile"]: - """List gallery inVMAccessControlProfiles in a gallery. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :return: An iterator like instance of either GalleryInVMAccessControlProfile or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.compute.models.GalleryInVMAccessControlProfile] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-03")) - cls: ClsType[_models.GalleryInVMAccessControlProfileList] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_by_gallery_request( - resource_group_name=resource_group_name, - gallery_name=gallery_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - _request = HttpRequest("GET", next_link) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("GalleryInVMAccessControlProfileList", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @distributed_trace - def get( - self, resource_group_name: str, gallery_name: str, in_vm_access_control_profile_name: str, **kwargs: Any - ) -> _models.GalleryInVMAccessControlProfile: - """Retrieves information about a gallery inVMAccessControlProfile. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :param in_vm_access_control_profile_name: The name of the gallery inVMAccessControlProfile to - be retrieved. Required. - :type in_vm_access_control_profile_name: str - :return: GalleryInVMAccessControlProfile or the result of cls(response) - :rtype: ~azure.mgmt.compute.models.GalleryInVMAccessControlProfile - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-03")) - cls: ClsType[_models.GalleryInVMAccessControlProfile] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - gallery_name=gallery_name, - in_vm_access_control_profile_name=in_vm_access_control_profile_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("GalleryInVMAccessControlProfile", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - gallery_name: str, - in_vm_access_control_profile_name: str, - gallery_in_vm_access_control_profile: Union[_models.GalleryInVMAccessControlProfile, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-03")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(gallery_in_vm_access_control_profile, (IOBase, bytes)): - _content = gallery_in_vm_access_control_profile - else: - _json = self._serialize.body(gallery_in_vm_access_control_profile, "GalleryInVMAccessControlProfile") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - gallery_name=gallery_name, - in_vm_access_control_profile_name=in_vm_access_control_profile_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 201: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - gallery_name: str, - in_vm_access_control_profile_name: str, - gallery_in_vm_access_control_profile: _models.GalleryInVMAccessControlProfile, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.GalleryInVMAccessControlProfile]: - """Create or update a gallery inVMAccessControlProfile. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :param in_vm_access_control_profile_name: The name of the gallery inVMAccessControlProfile to - be retrieved. Required. - :type in_vm_access_control_profile_name: str - :param gallery_in_vm_access_control_profile: Parameters supplied to the create or update - gallery inVMAccessControlProfile operation. Required. - :type gallery_in_vm_access_control_profile: - ~azure.mgmt.compute.models.GalleryInVMAccessControlProfile - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either GalleryInVMAccessControlProfile or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.GalleryInVMAccessControlProfile] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - gallery_name: str, - in_vm_access_control_profile_name: str, - gallery_in_vm_access_control_profile: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.GalleryInVMAccessControlProfile]: - """Create or update a gallery inVMAccessControlProfile. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :param in_vm_access_control_profile_name: The name of the gallery inVMAccessControlProfile to - be retrieved. Required. - :type in_vm_access_control_profile_name: str - :param gallery_in_vm_access_control_profile: Parameters supplied to the create or update - gallery inVMAccessControlProfile operation. Required. - :type gallery_in_vm_access_control_profile: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either GalleryInVMAccessControlProfile or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.GalleryInVMAccessControlProfile] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - gallery_name: str, - in_vm_access_control_profile_name: str, - gallery_in_vm_access_control_profile: Union[_models.GalleryInVMAccessControlProfile, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.GalleryInVMAccessControlProfile]: - """Create or update a gallery inVMAccessControlProfile. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :param in_vm_access_control_profile_name: The name of the gallery inVMAccessControlProfile to - be retrieved. Required. - :type in_vm_access_control_profile_name: str - :param gallery_in_vm_access_control_profile: Parameters supplied to the create or update - gallery inVMAccessControlProfile operation. Is either a GalleryInVMAccessControlProfile type or - a IO[bytes] type. Required. - :type gallery_in_vm_access_control_profile: - ~azure.mgmt.compute.models.GalleryInVMAccessControlProfile or IO[bytes] - :return: An instance of LROPoller that returns either GalleryInVMAccessControlProfile or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.GalleryInVMAccessControlProfile] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-03")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.GalleryInVMAccessControlProfile] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._create_or_update_initial( - resource_group_name=resource_group_name, - gallery_name=gallery_name, - in_vm_access_control_profile_name=in_vm_access_control_profile_name, - gallery_in_vm_access_control_profile=gallery_in_vm_access_control_profile, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("GalleryInVMAccessControlProfile", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.GalleryInVMAccessControlProfile].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.GalleryInVMAccessControlProfile]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _update_initial( - self, - resource_group_name: str, - gallery_name: str, - in_vm_access_control_profile_name: str, - gallery_in_vm_access_control_profile: Union[_models.GalleryInVMAccessControlProfileUpdate, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-03")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(gallery_in_vm_access_control_profile, (IOBase, bytes)): - _content = gallery_in_vm_access_control_profile - else: - _json = self._serialize.body(gallery_in_vm_access_control_profile, "GalleryInVMAccessControlProfileUpdate") - - _request = build_update_request( - resource_group_name=resource_group_name, - gallery_name=gallery_name, - in_vm_access_control_profile_name=in_vm_access_control_profile_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update( - self, - resource_group_name: str, - gallery_name: str, - in_vm_access_control_profile_name: str, - gallery_in_vm_access_control_profile: _models.GalleryInVMAccessControlProfileUpdate, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.GalleryInVMAccessControlProfile]: - """Update a gallery inVMAccessControlProfile. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :param in_vm_access_control_profile_name: The name of the gallery inVMAccessControlProfile to - be retrieved. Required. - :type in_vm_access_control_profile_name: str - :param gallery_in_vm_access_control_profile: Parameters supplied to the update gallery - inVMAccessControlProfile operation. Required. - :type gallery_in_vm_access_control_profile: - ~azure.mgmt.compute.models.GalleryInVMAccessControlProfileUpdate - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either GalleryInVMAccessControlProfile or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.GalleryInVMAccessControlProfile] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update( - self, - resource_group_name: str, - gallery_name: str, - in_vm_access_control_profile_name: str, - gallery_in_vm_access_control_profile: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.GalleryInVMAccessControlProfile]: - """Update a gallery inVMAccessControlProfile. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :param in_vm_access_control_profile_name: The name of the gallery inVMAccessControlProfile to - be retrieved. Required. - :type in_vm_access_control_profile_name: str - :param gallery_in_vm_access_control_profile: Parameters supplied to the update gallery - inVMAccessControlProfile operation. Required. - :type gallery_in_vm_access_control_profile: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either GalleryInVMAccessControlProfile or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.GalleryInVMAccessControlProfile] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_update( - self, - resource_group_name: str, - gallery_name: str, - in_vm_access_control_profile_name: str, - gallery_in_vm_access_control_profile: Union[_models.GalleryInVMAccessControlProfileUpdate, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.GalleryInVMAccessControlProfile]: - """Update a gallery inVMAccessControlProfile. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :param in_vm_access_control_profile_name: The name of the gallery inVMAccessControlProfile to - be retrieved. Required. - :type in_vm_access_control_profile_name: str - :param gallery_in_vm_access_control_profile: Parameters supplied to the update gallery - inVMAccessControlProfile operation. Is either a GalleryInVMAccessControlProfileUpdate type or a - IO[bytes] type. Required. - :type gallery_in_vm_access_control_profile: - ~azure.mgmt.compute.models.GalleryInVMAccessControlProfileUpdate or IO[bytes] - :return: An instance of LROPoller that returns either GalleryInVMAccessControlProfile or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.GalleryInVMAccessControlProfile] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-03")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.GalleryInVMAccessControlProfile] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._update_initial( - resource_group_name=resource_group_name, - gallery_name=gallery_name, - in_vm_access_control_profile_name=in_vm_access_control_profile_name, - gallery_in_vm_access_control_profile=gallery_in_vm_access_control_profile, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - response_headers = {} - response = pipeline_response.http_response - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = self._deserialize("GalleryInVMAccessControlProfile", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.GalleryInVMAccessControlProfile].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.GalleryInVMAccessControlProfile]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, gallery_name: str, in_vm_access_control_profile_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-03")) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - gallery_name=gallery_name, - in_vm_access_control_profile_name=in_vm_access_control_profile_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [202, 204]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_delete( - self, resource_group_name: str, gallery_name: str, in_vm_access_control_profile_name: str, **kwargs: Any - ) -> LROPoller[None]: - """Delete a gallery inVMAccessControlProfile. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :param in_vm_access_control_profile_name: The name of the gallery inVMAccessControlProfile to - be retrieved. Required. - :type in_vm_access_control_profile_name: str - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-03")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - gallery_name=gallery_name, - in_vm_access_control_profile_name=in_vm_access_control_profile_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/operations/_gallery_sharing_profile_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/operations/_gallery_sharing_profile_operations.py deleted file mode 100644 index 1cdfa240f40a..000000000000 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/operations/_gallery_sharing_profile_operations.py +++ /dev/null @@ -1,296 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# 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 collections.abc import MutableMapping -from io import IOBase -from typing import Any, Callable, IO, Iterator, Optional, TypeVar, Union, cast, overload - -from azure.core import PipelineClient -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - StreamClosedError, - StreamConsumedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from .._configuration import ComputeManagementClientConfiguration -from .._utils.serialization import Deserializer, Serializer - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] -List = list - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_update_request( - resource_group_name: str, gallery_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-03")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/share", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "galleryName": _SERIALIZER.url("gallery_name", gallery_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class GallerySharingProfileOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.compute.ComputeManagementClient`'s - :attr:`gallery_sharing_profile` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - def _update_initial( - self, - resource_group_name: str, - gallery_name: str, - sharing_update: Union[_models.SharingUpdate, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-03")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(sharing_update, (IOBase, bytes)): - _content = sharing_update - else: - _json = self._serialize.body(sharing_update, "SharingUpdate") - - _request = build_update_request( - resource_group_name=resource_group_name, - gallery_name=gallery_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update( - self, - resource_group_name: str, - gallery_name: str, - sharing_update: _models.SharingUpdate, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.SharingUpdate]: - """Update sharing profile of a gallery. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :param sharing_update: Parameters supplied to the update gallery sharing profile. Required. - :type sharing_update: ~azure.mgmt.compute.models.SharingUpdate - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either SharingUpdate or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.SharingUpdate] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update( - self, - resource_group_name: str, - gallery_name: str, - sharing_update: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.SharingUpdate]: - """Update sharing profile of a gallery. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :param sharing_update: Parameters supplied to the update gallery sharing profile. Required. - :type sharing_update: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either SharingUpdate or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.SharingUpdate] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_update( - self, - resource_group_name: str, - gallery_name: str, - sharing_update: Union[_models.SharingUpdate, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.SharingUpdate]: - """Update sharing profile of a gallery. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :param sharing_update: Parameters supplied to the update gallery sharing profile. Is either a - SharingUpdate type or a IO[bytes] type. Required. - :type sharing_update: ~azure.mgmt.compute.models.SharingUpdate or IO[bytes] - :return: An instance of LROPoller that returns either SharingUpdate or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.SharingUpdate] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-03")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.SharingUpdate] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._update_initial( - resource_group_name=resource_group_name, - gallery_name=gallery_name, - sharing_update=sharing_update, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("SharingUpdate", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.SharingUpdate].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.SharingUpdate]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/operations/_images_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/operations/_images_operations.py deleted file mode 100644 index f717f077e5ca..000000000000 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/operations/_images_operations.py +++ /dev/null @@ -1,936 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# 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 collections.abc import MutableMapping -from io import IOBase -from typing import Any, Callable, IO, Iterator, Optional, TypeVar, Union, cast, overload - -from azure.core import PipelineClient -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - StreamClosedError, - StreamConsumedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from .._configuration import ComputeManagementClientConfiguration -from .._utils.serialization import Deserializer, Serializer - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] -List = list - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - accept = _headers.pop("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", min_length=1), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_by_resource_group_request(resource_group_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_request( - resource_group_name: str, image_name: str, subscription_id: str, *, expand: Optional[str] = None, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "imageName": _SERIALIZER.url("image_name", image_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if expand is not None: - _params["$expand"] = _SERIALIZER.query("expand", expand, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, image_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "imageName": _SERIALIZER.url("image_name", image_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_request(resource_group_name: str, image_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "imageName": _SERIALIZER.url("image_name", image_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request(resource_group_name: str, image_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "imageName": _SERIALIZER.url("image_name", image_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -class ImagesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.compute.ComputeManagementClient`'s - :attr:`images` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list(self, **kwargs: Any) -> ItemPaged["_models.Image"]: - """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. - - :return: An iterator like instance of either Image or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.models.Image] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[_models.ImageListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - _request = HttpRequest("GET", next_link) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @distributed_trace - def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> ItemPaged["_models.Image"]: - """Gets the list of images under a resource group. Use nextLink property in the response to get - the next page of Images. Do this till nextLink is null to fetch all the Images. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :return: An iterator like instance of either Image or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.models.Image] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[_models.ImageListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_by_resource_group_request( - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - _request = HttpRequest("GET", next_link) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @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. The name is case insensitive. - Required. - :type resource_group_name: str - :param image_name: The name of the image. Required. - :type image_name: str - :param expand: The expand expression to apply on the operation. Default value is None. - :type expand: str - :return: Image or the result of cls(response) - :rtype: ~azure.mgmt.compute.models.Image - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[_models.Image] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - image_name=image_name, - subscription_id=self._config.subscription_id, - expand=expand, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("Image", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, resource_group_name: str, image_name: str, parameters: Union[_models.Image, IO[bytes]], **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "Image") - - _request = build_create_or_update_request( - 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, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 201: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - image_name: str, - parameters: _models.Image, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.Image]: - """Create or update an image. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param image_name: The name of the image. Required. - :type image_name: str - :param parameters: Parameters supplied to the Create Image operation. Required. - :type parameters: ~azure.mgmt.compute.models.Image - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either Image or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.Image] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - image_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.Image]: - """Create or update an image. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param image_name: The name of the image. Required. - :type image_name: str - :param parameters: Parameters supplied to the Create Image operation. Required. - :type parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either Image or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.Image] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, resource_group_name: str, image_name: str, parameters: Union[_models.Image, IO[bytes]], **kwargs: Any - ) -> LROPoller[_models.Image]: - """Create or update an image. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param image_name: The name of the image. Required. - :type image_name: str - :param parameters: Parameters supplied to the Create Image operation. Is either a Image type or - a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.compute.models.Image or IO[bytes] - :return: An instance of LROPoller that returns either Image or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.Image] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Image] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._create_or_update_initial( - resource_group_name=resource_group_name, - image_name=image_name, - parameters=parameters, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Image", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.Image].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.Image]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _update_initial( - self, - resource_group_name: str, - image_name: str, - parameters: Union[_models.ImageUpdate, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "ImageUpdate") - - _request = build_update_request( - 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, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 201: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update( - self, - resource_group_name: str, - image_name: str, - parameters: _models.ImageUpdate, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.Image]: - """Update an image. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param image_name: The name of the image. Required. - :type image_name: str - :param parameters: Parameters supplied to the Update Image operation. Required. - :type parameters: ~azure.mgmt.compute.models.ImageUpdate - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either Image or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.Image] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update( - self, - resource_group_name: str, - image_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.Image]: - """Update an image. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param image_name: The name of the image. Required. - :type image_name: str - :param parameters: Parameters supplied to the Update Image operation. Required. - :type parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either Image or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.Image] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_update( - self, - resource_group_name: str, - image_name: str, - parameters: Union[_models.ImageUpdate, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.Image]: - """Update an image. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param image_name: The name of the image. Required. - :type image_name: str - :param parameters: Parameters supplied to the Update Image operation. Is either a ImageUpdate - type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.compute.models.ImageUpdate or IO[bytes] - :return: An instance of LROPoller that returns either Image or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.Image] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Image] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._update_initial( - resource_group_name=resource_group_name, - image_name=image_name, - parameters=parameters, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Image", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.Image].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.Image]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial(self, resource_group_name: str, image_name: str, **kwargs: Any) -> Iterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - image_name=image_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_delete(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. The name is case insensitive. - Required. - :type resource_group_name: str - :param image_name: The name of the image. Required. - :type image_name: str - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - image_name=image_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/operations/_log_analytics_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/operations/_log_analytics_operations.py deleted file mode 100644 index 41ced928791a..000000000000 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/operations/_log_analytics_operations.py +++ /dev/null @@ -1,483 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# 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 collections.abc import MutableMapping -from io import IOBase -from typing import Any, Callable, IO, Iterator, Optional, TypeVar, Union, cast, overload - -from azure.core import PipelineClient -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - StreamClosedError, - StreamConsumedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from .._configuration import ComputeManagementClientConfiguration -from .._utils.serialization import Deserializer, Serializer - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] -List = list - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_export_request_rate_by_interval_request( # pylint: disable=name-too-long - location: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/logAnalytics/apiAccess/getRequestRateByInterval", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "location": _SERIALIZER.url("location", location, "str", min_length=1), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_export_throttled_requests_request(location: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/logAnalytics/apiAccess/getThrottledRequests", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "location": _SERIALIZER.url("location", location, "str", min_length=1), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class LogAnalyticsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.compute.ComputeManagementClient`'s - :attr:`log_analytics` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - def _export_request_rate_by_interval_initial( - self, location: str, parameters: Union[_models.RequestRateByIntervalInput, IO[bytes]], **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "RequestRateByIntervalInput") - - _request = build_export_request_rate_by_interval_request( - location=location, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_export_request_rate_by_interval( - self, - location: str, - parameters: _models.RequestRateByIntervalInput, - *, - content_type: str = "application/json", - **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 name of Azure region. Required. - :type location: str - :param parameters: Parameters supplied to the LogAnalytics getRequestRateByInterval Api. - Required. - :type parameters: ~azure.mgmt.compute.models.RequestRateByIntervalInput - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either LogAnalyticsOperationResult or the result - of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.LogAnalyticsOperationResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_export_request_rate_by_interval( - self, location: str, parameters: IO[bytes], *, content_type: str = "application/json", **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 name of Azure region. Required. - :type location: str - :param parameters: Parameters supplied to the LogAnalytics getRequestRateByInterval Api. - Required. - :type parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either LogAnalyticsOperationResult or the result - of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.LogAnalyticsOperationResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_export_request_rate_by_interval( - self, location: str, parameters: Union[_models.RequestRateByIntervalInput, IO[bytes]], **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 name of Azure region. Required. - :type location: str - :param parameters: Parameters supplied to the LogAnalytics getRequestRateByInterval Api. Is - either a RequestRateByIntervalInput type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.compute.models.RequestRateByIntervalInput or IO[bytes] - :return: An instance of LROPoller that returns either LogAnalyticsOperationResult or the result - of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.LogAnalyticsOperationResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.LogAnalyticsOperationResult] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._export_request_rate_by_interval_initial( - location=location, - parameters=parameters, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("LogAnalyticsOperationResult", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.LogAnalyticsOperationResult].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.LogAnalyticsOperationResult]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _export_throttled_requests_initial( - self, location: str, parameters: Union[_models.ThrottledRequestsInput, IO[bytes]], **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "ThrottledRequestsInput") - - _request = build_export_throttled_requests_request( - location=location, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_export_throttled_requests( - self, - location: str, - parameters: _models.ThrottledRequestsInput, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.LogAnalyticsOperationResult]: - """Export logs that show total throttled Api requests for this subscription in the given time - window. - - :param location: The name of Azure region. Required. - :type location: str - :param parameters: The request body. Required. - :type parameters: ~azure.mgmt.compute.models.ThrottledRequestsInput - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either LogAnalyticsOperationResult or the result - of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.LogAnalyticsOperationResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_export_throttled_requests( - self, location: str, parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.LogAnalyticsOperationResult]: - """Export logs that show total throttled Api requests for this subscription in the given time - window. - - :param location: The name of Azure region. Required. - :type location: str - :param parameters: The request body. Required. - :type parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either LogAnalyticsOperationResult or the result - of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.LogAnalyticsOperationResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_export_throttled_requests( - self, location: str, parameters: Union[_models.ThrottledRequestsInput, IO[bytes]], **kwargs: Any - ) -> LROPoller[_models.LogAnalyticsOperationResult]: - """Export logs that show total throttled Api requests for this subscription in the given time - window. - - :param location: The name of Azure region. Required. - :type location: str - :param parameters: The request body. Is either a ThrottledRequestsInput type or a IO[bytes] - type. Required. - :type parameters: ~azure.mgmt.compute.models.ThrottledRequestsInput or IO[bytes] - :return: An instance of LROPoller that returns either LogAnalyticsOperationResult or the result - of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.LogAnalyticsOperationResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.LogAnalyticsOperationResult] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._export_throttled_requests_initial( - location=location, - parameters=parameters, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("LogAnalyticsOperationResult", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.LogAnalyticsOperationResult].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.LogAnalyticsOperationResult]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/operations/_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/operations/_operations.py index 84468c6bad8b..90e75b211298 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/operations/_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/operations/_operations.py @@ -1,42 +1,55 @@ +# pylint: disable=line-too-long,useless-suppression,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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from collections.abc import MutableMapping -from typing import Any, Callable, Optional, TypeVar +from io import IOBase +import json +from typing import Any, Callable, IO, Iterator, Optional, TypeVar, Union, cast, overload +import urllib.parse -from azure.core import PipelineClient +from azure.core import MatchConditions, PipelineClient from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, ResourceExistsError, + ResourceModifiedError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models -from .._configuration import ComputeManagementClientConfiguration +from .._configuration import ComputeClientConfiguration +from .._utils.model_base import SdkJSONEncoder, _deserialize, _failsafe_deserialize from .._utils.serialization import Deserializer, Serializer +from .._utils.utils import prep_if_match, prep_if_none_match +from .._validation import api_version_validation T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] +JSON = MutableMapping[str, Any] List = list _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -def build_list_request(**kwargs: Any) -> HttpRequest: +def build_operations_list_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -44,7 +57,7 @@ def build_list_request(**kwargs: Any) -> HttpRequest: accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/providers/Microsoft.Compute/operations") + _url = "/providers/Microsoft.Compute/operations" # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -55,38 +68,47242 @@ def build_list_request(**kwargs: Any) -> HttpRequest: return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) +def build_virtual_machine_scale_sets_get_request( # pylint: disable=name-too-long + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + *, + expand: Optional[Union[str, _models.ExpandTypesForGetVMScaleSets]] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if expand is not None: + _params["$expand"] = _SERIALIZER.query("expand", expand, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_virtual_machine_scale_sets_create_or_update_request( # pylint: disable=name-too-long + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + if_match = prep_if_match(etag, match_condition) + if if_match is not None: + _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") + if_none_match = prep_if_none_match(etag, match_condition) + if if_none_match is not None: + _headers["If-None-Match"] = _SERIALIZER.header("if_none_match", if_none_match, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_virtual_machine_scale_sets_update_request( # pylint: disable=name-too-long + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + if_match = prep_if_match(etag, match_condition) + if if_match is not None: + _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") + if_none_match = prep_if_none_match(etag, match_condition) + if if_none_match is not None: + _headers["If-None-Match"] = _SERIALIZER.header("if_none_match", if_none_match, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_virtual_machine_scale_sets_delete_request( # pylint: disable=name-too-long + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + *, + force_deletion: Optional[bool] = None, + **kwargs: Any +) -> HttpRequest: + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if force_deletion is not None: + _params["forceDeletion"] = _SERIALIZER.query("force_deletion", force_deletion, "bool") + + return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) + + +def build_virtual_machine_scale_sets_list_request( # pylint: disable=name-too-long + resource_group_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_virtual_machine_scale_sets_list_all_request( # pylint: disable=name-too-long + subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/virtualMachineScaleSets" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_virtual_machine_scale_sets_approve_rolling_upgrade_request( # pylint: disable=name-too-long + resource_group_name: str, vm_scale_set_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/approveRollingUpgrade" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_virtual_machine_scale_sets_convert_to_single_placement_group_request( # pylint: disable=name-too-long + resource_group_name: str, vm_scale_set_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/convertToSinglePlacementGroup" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_virtual_machine_scale_sets_deallocate_request( # pylint: disable=name-too-long + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + *, + hibernate: Optional[bool] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/deallocate" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if hibernate is not None: + _params["hibernate"] = _SERIALIZER.query("hibernate", hibernate, "bool") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_virtual_machine_scale_sets_delete_instances_request( # pylint: disable=name-too-long + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + *, + force_deletion: Optional[bool] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/delete" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if force_deletion is not None: + _params["forceDeletion"] = _SERIALIZER.query("force_deletion", force_deletion, "bool") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_virtual_machine_scale_sets_force_recovery_service_fabric_platform_update_domain_walk_request( # pylint: disable=name-too-long + 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: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/forceRecoveryServiceFabricPlatformUpdateDomainWalk" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + _params["platformUpdateDomain"] = _SERIALIZER.query("platform_update_domain", platform_update_domain, "int") + if zone is not None: + _params["zone"] = _SERIALIZER.query("zone", zone, "str") + if placement_group_id is not None: + _params["placementGroupId"] = _SERIALIZER.query("placement_group_id", placement_group_id, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_virtual_machine_scale_sets_get_instance_view_request( # pylint: disable=name-too-long + resource_group_name: str, vm_scale_set_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/instanceView" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_virtual_machine_scale_sets_update_instances_request( # pylint: disable=name-too-long + resource_group_name: str, vm_scale_set_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/manualupgrade" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_virtual_machine_scale_sets_get_os_upgrade_history_request( # pylint: disable=name-too-long + resource_group_name: str, vm_scale_set_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/osUpgradeHistory" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_virtual_machine_scale_sets_perform_maintenance_request( # pylint: disable=name-too-long + resource_group_name: str, vm_scale_set_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/performMaintenance" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_virtual_machine_scale_sets_power_off_request( # pylint: disable=name-too-long + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + *, + skip_shutdown: Optional[bool] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/poweroff" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if skip_shutdown is not None: + _params["skipShutdown"] = _SERIALIZER.query("skip_shutdown", skip_shutdown, "bool") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_virtual_machine_scale_sets_reapply_request( # pylint: disable=name-too-long + resource_group_name: str, vm_scale_set_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/reapply" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + return HttpRequest(method="POST", url=_url, params=_params, **kwargs) + + +def build_virtual_machine_scale_sets_redeploy_request( # pylint: disable=name-too-long + resource_group_name: str, vm_scale_set_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/redeploy" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_virtual_machine_scale_sets_reimage_request( # pylint: disable=name-too-long + resource_group_name: str, vm_scale_set_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/reimage" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_virtual_machine_scale_sets_reimage_all_request( # pylint: disable=name-too-long + resource_group_name: str, vm_scale_set_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/reimageall" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_virtual_machine_scale_sets_restart_request( # pylint: disable=name-too-long + resource_group_name: str, vm_scale_set_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/restart" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_virtual_machine_scale_sets_set_orchestration_service_state_request( # pylint: disable=name-too-long + resource_group_name: str, vm_scale_set_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/setOrchestrationServiceState" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_virtual_machine_scale_sets_list_skus_request( # pylint: disable=name-too-long + resource_group_name: str, vm_scale_set_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/skus" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_virtual_machine_scale_sets_start_request( # pylint: disable=name-too-long + resource_group_name: str, vm_scale_set_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/start" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_virtual_machine_scale_sets_start_extension_upgrade_request( # pylint: disable=name-too-long + resource_group_name: str, vm_scale_set_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensionRollingUpgrade" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + return HttpRequest(method="POST", url=_url, params=_params, **kwargs) + + +def build_virtual_machine_scale_sets_start_os_upgrade_request( # pylint: disable=name-too-long + resource_group_name: str, vm_scale_set_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/osRollingUpgrade" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + return HttpRequest(method="POST", url=_url, params=_params, **kwargs) + + +def build_virtual_machine_scale_sets_cancel_request( # pylint: disable=name-too-long + resource_group_name: str, vm_scale_set_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/rollingUpgrades/cancel" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + return HttpRequest(method="POST", url=_url, params=_params, **kwargs) + + +def build_virtual_machine_scale_sets_scale_out_request( # pylint: disable=name-too-long + resource_group_name: str, vm_scale_set_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/scaleOut" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_rolling_upgrade_status_infos_get_latest_request( # pylint: disable=name-too-long + resource_group_name: str, vm_scale_set_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/rollingUpgrades/latest" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_virtual_machine_scale_set_extensions_get_request( # pylint: disable=name-too-long + resource_group_name: str, + vm_scale_set_name: str, + vmss_extension_name: str, + subscription_id: str, + *, + expand: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "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"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if expand is not None: + _params["$expand"] = _SERIALIZER.query("expand", expand, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_virtual_machine_scale_set_extensions_create_or_update_request( # pylint: disable=name-too-long + resource_group_name: str, vm_scale_set_name: str, vmss_extension_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "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"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_virtual_machine_scale_set_extensions_update_request( # pylint: disable=name-too-long + resource_group_name: str, vm_scale_set_name: str, vmss_extension_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "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"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_virtual_machine_scale_set_extensions_delete_request( # pylint: disable=name-too-long + resource_group_name: str, vm_scale_set_name: str, vmss_extension_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "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"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) + + +def build_virtual_machine_scale_set_extensions_list_request( # pylint: disable=name-too-long + resource_group_name: str, vm_scale_set_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_virtual_machine_scale_set_vms_get_request( # pylint: disable=name-too-long + 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: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), + "instanceId": _SERIALIZER.url("instance_id", instance_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if expand is not None: + _params["$expand"] = _SERIALIZER.query("expand", expand, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_virtual_machine_scale_set_vms_update_request( # pylint: disable=name-too-long + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + subscription_id: str, + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), + "instanceId": _SERIALIZER.url("instance_id", instance_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + if_match = prep_if_match(etag, match_condition) + if if_match is not None: + _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") + if_none_match = prep_if_none_match(etag, match_condition) + if if_none_match is not None: + _headers["If-None-Match"] = _SERIALIZER.header("if_none_match", if_none_match, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_virtual_machine_scale_set_vms_delete_request( # pylint: disable=name-too-long + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + subscription_id: str, + *, + force_deletion: Optional[bool] = None, + **kwargs: Any +) -> HttpRequest: + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), + "instanceId": _SERIALIZER.url("instance_id", instance_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if force_deletion is not None: + _params["forceDeletion"] = _SERIALIZER.query("force_deletion", force_deletion, "bool") + + return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) + + +def build_virtual_machine_scale_set_vms_list_request( # pylint: disable=name-too-long + 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: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{virtualMachineScaleSetName}/virtualMachines" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "virtualMachineScaleSetName": _SERIALIZER.url( + "virtual_machine_scale_set_name", virtual_machine_scale_set_name, "str" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if filter is not None: + _params["$filter"] = _SERIALIZER.query("filter", filter, "str") + if select is not None: + _params["$select"] = _SERIALIZER.query("select", select, "str") + if expand is not None: + _params["$expand"] = _SERIALIZER.query("expand", expand, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_virtual_machine_scale_set_vms_approve_rolling_upgrade_request( # pylint: disable=name-too-long + resource_group_name: str, vm_scale_set_name: str, instance_id: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/approveRollingUpgrade" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), + "instanceId": _SERIALIZER.url("instance_id", instance_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + return HttpRequest(method="POST", url=_url, params=_params, **kwargs) + + +def build_virtual_machine_scale_set_vms_deallocate_request( # pylint: disable=name-too-long + resource_group_name: str, vm_scale_set_name: str, instance_id: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/deallocate" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), + "instanceId": _SERIALIZER.url("instance_id", instance_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + return HttpRequest(method="POST", url=_url, params=_params, **kwargs) + + +def build_virtual_machine_scale_set_vms_get_instance_view_request( # pylint: disable=name-too-long + resource_group_name: str, vm_scale_set_name: str, instance_id: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/instanceView" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), + "instanceId": _SERIALIZER.url("instance_id", instance_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_virtual_machine_scale_set_vms_reimage_request( # pylint: disable=name-too-long + resource_group_name: str, vm_scale_set_name: str, instance_id: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/reimage" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), + "instanceId": _SERIALIZER.url("instance_id", instance_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_virtual_machine_scale_set_vms_reimage_all_request( # pylint: disable=name-too-long + resource_group_name: str, vm_scale_set_name: str, instance_id: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/reimageall" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), + "instanceId": _SERIALIZER.url("instance_id", instance_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + return HttpRequest(method="POST", url=_url, params=_params, **kwargs) + + +def build_virtual_machine_scale_set_vms_simulate_eviction_request( # pylint: disable=name-too-long + resource_group_name: str, vm_scale_set_name: str, instance_id: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/simulateEviction" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), + "instanceId": _SERIALIZER.url("instance_id", instance_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + return HttpRequest(method="POST", url=_url, params=_params, **kwargs) + + +def build_virtual_machine_scale_set_vms_attach_detach_data_disks_request( # pylint: disable=name-too-long + resource_group_name: str, vm_scale_set_name: str, instance_id: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/attachDetachDataDisks" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), + "instanceId": _SERIALIZER.url("instance_id", instance_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_virtual_machine_scale_set_vms_perform_maintenance_request( # pylint: disable=name-too-long + resource_group_name: str, vm_scale_set_name: str, instance_id: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/performMaintenance" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), + "instanceId": _SERIALIZER.url("instance_id", instance_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + return HttpRequest(method="POST", url=_url, params=_params, **kwargs) + + +def build_virtual_machine_scale_set_vms_power_off_request( # pylint: disable=name-too-long + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + subscription_id: str, + *, + skip_shutdown: Optional[bool] = None, + **kwargs: Any +) -> HttpRequest: + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/powerOff" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), + "instanceId": _SERIALIZER.url("instance_id", instance_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if skip_shutdown is not None: + _params["skipShutdown"] = _SERIALIZER.query("skip_shutdown", skip_shutdown, "bool") + + return HttpRequest(method="POST", url=_url, params=_params, **kwargs) + + +def build_virtual_machine_scale_set_vms_redeploy_request( # pylint: disable=name-too-long + resource_group_name: str, vm_scale_set_name: str, instance_id: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/redeploy" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), + "instanceId": _SERIALIZER.url("instance_id", instance_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + return HttpRequest(method="POST", url=_url, params=_params, **kwargs) + + +def build_virtual_machine_scale_set_vms_restart_request( # pylint: disable=name-too-long + resource_group_name: str, vm_scale_set_name: str, instance_id: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/restart" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), + "instanceId": _SERIALIZER.url("instance_id", instance_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + return HttpRequest(method="POST", url=_url, params=_params, **kwargs) + + +def build_virtual_machine_scale_set_vms_retrieve_boot_diagnostics_data_request( # pylint: disable=name-too-long + 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: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/retrieveBootDiagnosticsData" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), + "instanceId": _SERIALIZER.url("instance_id", instance_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if sas_uri_expiration_time_in_minutes is not None: + _params["sasUriExpirationTimeInMinutes"] = _SERIALIZER.query( + "sas_uri_expiration_time_in_minutes", sas_uri_expiration_time_in_minutes, "int" + ) + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_virtual_machine_scale_set_vms_start_request( # pylint: disable=name-too-long + resource_group_name: str, vm_scale_set_name: str, instance_id: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/start" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), + "instanceId": _SERIALIZER.url("instance_id", instance_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + return HttpRequest(method="POST", url=_url, params=_params, **kwargs) + + +def build_virtual_machine_scale_set_vms_run_command_request( # pylint: disable=name-too-long + resource_group_name: str, vm_scale_set_name: str, instance_id: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/runCommand" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), + "instanceId": _SERIALIZER.url("instance_id", instance_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_virtual_machine_scale_set_vm_extensions_get_request( # pylint: disable=name-too-long + 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: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/extensions/{vmExtensionName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", 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"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if expand is not None: + _params["$expand"] = _SERIALIZER.query("expand", expand, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_virtual_machine_scale_set_vm_extensions_create_or_update_request( # pylint: disable=name-too-long + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + vm_extension_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/extensions/{vmExtensionName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", 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"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_virtual_machine_scale_set_vm_extensions_update_request( # pylint: disable=name-too-long + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + vm_extension_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/extensions/{vmExtensionName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", 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"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_virtual_machine_scale_set_vm_extensions_delete_request( # pylint: disable=name-too-long + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + vm_extension_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/extensions/{vmExtensionName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", 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"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) + + +def build_virtual_machine_scale_set_vm_extensions_list_request( # pylint: disable=name-too-long + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + subscription_id: str, + *, + expand: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/extensions" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), + "instanceId": _SERIALIZER.url("instance_id", instance_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if expand is not None: + _params["$expand"] = _SERIALIZER.query("expand", expand, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_virtual_machines_get_request( + resource_group_name: str, + vm_name: str, + subscription_id: str, + *, + expand: Optional[Union[str, _models.InstanceViewTypes]] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if expand is not None: + _params["$expand"] = _SERIALIZER.query("expand", expand, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_virtual_machines_create_or_update_request( # pylint: disable=name-too-long + resource_group_name: str, + vm_name: str, + subscription_id: str, + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + if_match = prep_if_match(etag, match_condition) + if if_match is not None: + _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") + if_none_match = prep_if_none_match(etag, match_condition) + if if_none_match is not None: + _headers["If-None-Match"] = _SERIALIZER.header("if_none_match", if_none_match, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_virtual_machines_update_request( + resource_group_name: str, + vm_name: str, + subscription_id: str, + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + if_match = prep_if_match(etag, match_condition) + if if_match is not None: + _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") + if_none_match = prep_if_none_match(etag, match_condition) + if if_none_match is not None: + _headers["If-None-Match"] = _SERIALIZER.header("if_none_match", if_none_match, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_virtual_machines_delete_request( + resource_group_name: str, + vm_name: str, + subscription_id: str, + *, + force_deletion: Optional[bool] = None, + **kwargs: Any +) -> HttpRequest: + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if force_deletion is not None: + _params["forceDeletion"] = _SERIALIZER.query("force_deletion", force_deletion, "bool") + + return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) + + +def build_virtual_machines_list_request( + resource_group_name: str, + subscription_id: str, + *, + filter: Optional[str] = None, + expand: Optional[Union[str, _models.ExpandTypeForListVMs]] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = ( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines" + ) + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if filter is not None: + _params["$filter"] = _SERIALIZER.query("filter", filter, "str") + if expand is not None: + _params["$expand"] = _SERIALIZER.query("expand", expand, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_virtual_machines_list_all_request( + subscription_id: str, + *, + status_only: Optional[str] = None, + filter: Optional[str] = None, + expand: Optional[Union[str, _models.ExpandTypesForListVMs]] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/virtualMachines" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if status_only is not None: + _params["statusOnly"] = _SERIALIZER.query("status_only", status_only, "str") + if filter is not None: + _params["$filter"] = _SERIALIZER.query("filter", filter, "str") + if expand is not None: + _params["$expand"] = _SERIALIZER.query("expand", expand, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_virtual_machines_assess_patches_request( # pylint: disable=name-too-long + resource_group_name: str, vm_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/assessPatches" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_virtual_machines_attach_detach_data_disks_request( # pylint: disable=name-too-long + resource_group_name: str, vm_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/attachDetachDataDisks" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_virtual_machines_capture_request( + resource_group_name: str, vm_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/capture" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_virtual_machines_convert_to_managed_disks_request( # pylint: disable=name-too-long + resource_group_name: str, vm_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/convertToManagedDisks" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + return HttpRequest(method="POST", url=_url, params=_params, **kwargs) + + +def build_virtual_machines_deallocate_request( # pylint: disable=name-too-long + resource_group_name: str, vm_name: str, subscription_id: str, *, hibernate: Optional[bool] = None, **kwargs: Any +) -> HttpRequest: + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/deallocate" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if hibernate is not None: + _params["hibernate"] = _SERIALIZER.query("hibernate", hibernate, "bool") + + return HttpRequest(method="POST", url=_url, params=_params, **kwargs) + + +def build_virtual_machines_generalize_request( # pylint: disable=name-too-long + resource_group_name: str, vm_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/generalize" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + return HttpRequest(method="POST", url=_url, params=_params, **kwargs) + + +def build_virtual_machines_install_patches_request( # pylint: disable=name-too-long + resource_group_name: str, vm_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/installPatches" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_virtual_machines_instance_view_request( # pylint: disable=name-too-long + resource_group_name: str, vm_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/instanceView" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_virtual_machines_perform_maintenance_request( # pylint: disable=name-too-long + resource_group_name: str, vm_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/performMaintenance" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + return HttpRequest(method="POST", url=_url, params=_params, **kwargs) + + +def build_virtual_machines_power_off_request( + resource_group_name: str, vm_name: str, subscription_id: str, *, skip_shutdown: Optional[bool] = None, **kwargs: Any +) -> HttpRequest: + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/powerOff" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if skip_shutdown is not None: + _params["skipShutdown"] = _SERIALIZER.query("skip_shutdown", skip_shutdown, "bool") + + return HttpRequest(method="POST", url=_url, params=_params, **kwargs) + + +def build_virtual_machines_reapply_request( + resource_group_name: str, vm_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/reapply" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + return HttpRequest(method="POST", url=_url, params=_params, **kwargs) + + +def build_virtual_machines_redeploy_request( + resource_group_name: str, vm_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/redeploy" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + return HttpRequest(method="POST", url=_url, params=_params, **kwargs) + + +def build_virtual_machines_reimage_request( + resource_group_name: str, vm_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/reimage" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_virtual_machines_restart_request( + resource_group_name: str, vm_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/restart" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + return HttpRequest(method="POST", url=_url, params=_params, **kwargs) + + +def build_virtual_machines_retrieve_boot_diagnostics_data_request( # pylint: disable=name-too-long + resource_group_name: str, + vm_name: str, + subscription_id: str, + *, + sas_uri_expiration_time_in_minutes: Optional[int] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/retrieveBootDiagnosticsData" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if sas_uri_expiration_time_in_minutes is not None: + _params["sasUriExpirationTimeInMinutes"] = _SERIALIZER.query( + "sas_uri_expiration_time_in_minutes", sas_uri_expiration_time_in_minutes, "int" + ) + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_virtual_machines_simulate_eviction_request( # pylint: disable=name-too-long + resource_group_name: str, vm_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/simulateEviction" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + return HttpRequest(method="POST", url=_url, params=_params, **kwargs) + + +def build_virtual_machines_start_request( + resource_group_name: str, vm_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/start" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + return HttpRequest(method="POST", url=_url, params=_params, **kwargs) + + +def build_virtual_machines_list_available_sizes_request( # pylint: disable=name-too-long + resource_group_name: str, vm_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/vmSizes" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_virtual_machines_run_command_request( # pylint: disable=name-too-long + resource_group_name: str, vm_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommand" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_virtual_machines_migrate_to_vm_scale_set_request( # pylint: disable=name-too-long + resource_group_name: str, vm_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/migrateToVirtualMachineScaleSet" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_virtual_machine_extensions_get_request( # pylint: disable=name-too-long + resource_group_name: str, + vm_name: str, + vm_extension_name: str, + subscription_id: str, + *, + expand: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "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"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if expand is not None: + _params["$expand"] = _SERIALIZER.query("expand", expand, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_virtual_machine_extensions_create_or_update_request( # pylint: disable=name-too-long + resource_group_name: str, vm_name: str, vm_extension_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "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"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_virtual_machine_extensions_update_request( # pylint: disable=name-too-long + resource_group_name: str, vm_name: str, vm_extension_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "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"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_virtual_machine_extensions_delete_request( # pylint: disable=name-too-long + resource_group_name: str, vm_name: str, vm_extension_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "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"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) + + +def build_virtual_machine_extensions_list_request( # pylint: disable=name-too-long + resource_group_name: str, vm_name: str, subscription_id: str, *, expand: Optional[str] = None, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if expand is not None: + _params["$expand"] = _SERIALIZER.query("expand", expand, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_virtual_machine_extension_images_get_request( # pylint: disable=name-too-long + location: str, publisher_name: str, type: str, version: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmextension/types/{type}/versions/{version}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "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"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_virtual_machine_extension_images_list_types_request( # pylint: disable=name-too-long + location: str, publisher_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmextension/types" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "location": _SERIALIZER.url("location", location, "str"), + "publisherName": _SERIALIZER.url("publisher_name", publisher_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_virtual_machine_extension_images_list_versions_request( # pylint: disable=name-too-long + 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: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmextension/types/{type}/versions" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "location": _SERIALIZER.url("location", location, "str"), + "publisherName": _SERIALIZER.url("publisher_name", publisher_name, "str"), + "type": _SERIALIZER.url("type", type, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if filter is not None: + _params["$filter"] = _SERIALIZER.query("filter", filter, "str") + if top is not None: + _params["$top"] = _SERIALIZER.query("top", top, "int") + if orderby is not None: + _params["$orderby"] = _SERIALIZER.query("orderby", orderby, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_availability_sets_get_request( + resource_group_name: str, availability_set_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "availabilitySetName": _SERIALIZER.url("availability_set_name", availability_set_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_availability_sets_create_or_update_request( # pylint: disable=name-too-long + resource_group_name: str, availability_set_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "availabilitySetName": _SERIALIZER.url("availability_set_name", availability_set_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_availability_sets_update_request( + resource_group_name: str, availability_set_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "availabilitySetName": _SERIALIZER.url("availability_set_name", availability_set_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_availability_sets_delete_request( + resource_group_name: str, availability_set_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "availabilitySetName": _SERIALIZER.url("availability_set_name", availability_set_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) + + +def build_availability_sets_list_request(resource_group_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_availability_sets_list_by_subscription_request( # pylint: disable=name-too-long + subscription_id: str, *, expand: Optional[str] = None, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/availabilitySets" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if expand is not None: + _params["$expand"] = _SERIALIZER.query("expand", expand, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_availability_sets_list_available_sizes_request( # pylint: disable=name-too-long + resource_group_name: str, availability_set_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}/vmSizes" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "availabilitySetName": _SERIALIZER.url("availability_set_name", availability_set_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_availability_sets_start_migration_to_virtual_machine_scale_set_request( # pylint: disable=name-too-long + resource_group_name: str, availability_set_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}/startMigrationToVirtualMachineScaleSet" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "availabilitySetName": _SERIALIZER.url("availability_set_name", availability_set_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_availability_sets_cancel_migration_to_virtual_machine_scale_set_request( # pylint: disable=name-too-long + resource_group_name: str, availability_set_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}/cancelMigrationToVirtualMachineScaleSet" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "availabilitySetName": _SERIALIZER.url("availability_set_name", availability_set_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + return HttpRequest(method="POST", url=_url, params=_params, **kwargs) + + +def build_availability_sets_validate_migration_to_virtual_machine_scale_set_request( # pylint: disable=name-too-long + resource_group_name: str, availability_set_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}/validateMigrationToVirtualMachineScaleSet" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "availabilitySetName": _SERIALIZER.url("availability_set_name", availability_set_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_availability_sets_convert_to_virtual_machine_scale_set_request( # pylint: disable=name-too-long + resource_group_name: str, availability_set_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}/convertToVirtualMachineScaleSet" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "availabilitySetName": _SERIALIZER.url("availability_set_name", availability_set_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_proximity_placement_groups_get_request( # pylint: disable=name-too-long + resource_group_name: str, + proximity_placement_group_name: str, + subscription_id: str, + *, + include_colocation_status: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "proximityPlacementGroupName": _SERIALIZER.url( + "proximity_placement_group_name", proximity_placement_group_name, "str" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if include_colocation_status is not None: + _params["includeColocationStatus"] = _SERIALIZER.query( + "include_colocation_status", include_colocation_status, "str" + ) + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_proximity_placement_groups_create_or_update_request( # pylint: disable=name-too-long + resource_group_name: str, proximity_placement_group_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "proximityPlacementGroupName": _SERIALIZER.url( + "proximity_placement_group_name", proximity_placement_group_name, "str" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_proximity_placement_groups_update_request( # pylint: disable=name-too-long + resource_group_name: str, proximity_placement_group_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "proximityPlacementGroupName": _SERIALIZER.url( + "proximity_placement_group_name", proximity_placement_group_name, "str" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_proximity_placement_groups_delete_request( # pylint: disable=name-too-long + resource_group_name: str, proximity_placement_group_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "proximityPlacementGroupName": _SERIALIZER.url( + "proximity_placement_group_name", proximity_placement_group_name, "str" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) + + +def build_proximity_placement_groups_list_by_resource_group_request( # pylint: disable=name-too-long + resource_group_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_proximity_placement_groups_list_by_subscription_request( # pylint: disable=name-too-long + subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/proximityPlacementGroups" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_dedicated_host_groups_get_request( + resource_group_name: str, + host_group_name: str, + subscription_id: str, + *, + expand: Optional[Union[str, _models.InstanceViewTypes]] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "hostGroupName": _SERIALIZER.url("host_group_name", host_group_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if expand is not None: + _params["$expand"] = _SERIALIZER.query("expand", expand, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_dedicated_host_groups_create_or_update_request( # pylint: disable=name-too-long + resource_group_name: str, host_group_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "hostGroupName": _SERIALIZER.url("host_group_name", host_group_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_dedicated_host_groups_update_request( # pylint: disable=name-too-long + resource_group_name: str, host_group_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "hostGroupName": _SERIALIZER.url("host_group_name", host_group_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_dedicated_host_groups_delete_request( # pylint: disable=name-too-long + resource_group_name: str, host_group_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "hostGroupName": _SERIALIZER.url("host_group_name", host_group_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) + + +def build_dedicated_host_groups_list_by_resource_group_request( # pylint: disable=name-too-long + resource_group_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_dedicated_host_groups_list_by_subscription_request( # pylint: disable=name-too-long + subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/hostGroups" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_dedicated_hosts_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: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "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"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if expand is not None: + _params["$expand"] = _SERIALIZER.query("expand", expand, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_dedicated_hosts_create_or_update_request( # pylint: disable=name-too-long + resource_group_name: str, host_group_name: str, host_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "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"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_dedicated_hosts_update_request( + resource_group_name: str, host_group_name: str, host_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "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"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_dedicated_hosts_delete_request( + resource_group_name: str, host_group_name: str, host_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "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"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) + + +def build_dedicated_hosts_list_by_host_group_request( # pylint: disable=name-too-long + resource_group_name: str, host_group_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "hostGroupName": _SERIALIZER.url("host_group_name", host_group_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_dedicated_hosts_list_available_sizes_request( # pylint: disable=name-too-long + resource_group_name: str, host_group_name: str, host_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}/hostSizes" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "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"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_dedicated_hosts_redeploy_request( + resource_group_name: str, host_group_name: str, host_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}/redeploy" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "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"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + return HttpRequest(method="POST", url=_url, params=_params, **kwargs) + + +def build_dedicated_hosts_restart_request( + resource_group_name: str, host_group_name: str, host_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}/restart" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "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"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + return HttpRequest(method="POST", url=_url, params=_params, **kwargs) + + +def build_ssh_public_key_resources_get_request( # pylint: disable=name-too-long + resource_group_name: str, ssh_public_key_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{sshPublicKeyName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "sshPublicKeyName": _SERIALIZER.url("ssh_public_key_name", ssh_public_key_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_ssh_public_key_resources_create_request( # pylint: disable=name-too-long + resource_group_name: str, ssh_public_key_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{sshPublicKeyName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "sshPublicKeyName": _SERIALIZER.url("ssh_public_key_name", ssh_public_key_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_ssh_public_key_resources_update_request( # pylint: disable=name-too-long + resource_group_name: str, ssh_public_key_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{sshPublicKeyName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "sshPublicKeyName": _SERIALIZER.url("ssh_public_key_name", ssh_public_key_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_ssh_public_key_resources_delete_request( # pylint: disable=name-too-long + resource_group_name: str, ssh_public_key_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{sshPublicKeyName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "sshPublicKeyName": _SERIALIZER.url("ssh_public_key_name", ssh_public_key_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) + + +def build_ssh_public_key_resources_list_by_resource_group_request( # pylint: disable=name-too-long + resource_group_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = ( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/sshPublicKeys" + ) + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_ssh_public_key_resources_list_by_subscription_request( # pylint: disable=name-too-long + subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/sshPublicKeys" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_ssh_public_key_resources_generate_key_pair_request( # pylint: disable=name-too-long + resource_group_name: str, ssh_public_key_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{sshPublicKeyName}/generateKeyPair" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "sshPublicKeyName": _SERIALIZER.url("ssh_public_key_name", ssh_public_key_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_images_get_request( + resource_group_name: str, image_name: str, subscription_id: str, *, expand: Optional[str] = None, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "imageName": _SERIALIZER.url("image_name", image_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if expand is not None: + _params["$expand"] = _SERIALIZER.query("expand", expand, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_images_create_or_update_request( + resource_group_name: str, image_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "imageName": _SERIALIZER.url("image_name", image_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_images_update_request( + resource_group_name: str, image_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "imageName": _SERIALIZER.url("image_name", image_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_images_delete_request( + resource_group_name: str, image_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "imageName": _SERIALIZER.url("image_name", image_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) + + +def build_images_list_by_resource_group_request( # pylint: disable=name-too-long + resource_group_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_images_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/images" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_restore_point_collections_get_request( # pylint: disable=name-too-long + resource_group_name: str, + restore_point_collection_name: str, + subscription_id: str, + *, + expand: Optional[Union[str, _models.RestorePointCollectionExpandOptions]] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "restorePointCollectionName": _SERIALIZER.url( + "restore_point_collection_name", restore_point_collection_name, "str" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if expand is not None: + _params["$expand"] = _SERIALIZER.query("expand", expand, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_restore_point_collections_create_or_update_request( # pylint: disable=name-too-long + resource_group_name: str, restore_point_collection_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "restorePointCollectionName": _SERIALIZER.url( + "restore_point_collection_name", restore_point_collection_name, "str" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_restore_point_collections_update_request( # pylint: disable=name-too-long + resource_group_name: str, restore_point_collection_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "restorePointCollectionName": _SERIALIZER.url( + "restore_point_collection_name", restore_point_collection_name, "str" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_restore_point_collections_delete_request( # pylint: disable=name-too-long + resource_group_name: str, restore_point_collection_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "restorePointCollectionName": _SERIALIZER.url( + "restore_point_collection_name", restore_point_collection_name, "str" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) + + +def build_restore_point_collections_list_request( # pylint: disable=name-too-long + resource_group_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_restore_point_collections_list_all_request( # pylint: disable=name-too-long + subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/restorePointCollections" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_restore_points_get_request( + resource_group_name: str, + restore_point_collection_name: str, + restore_point_name: str, + subscription_id: str, + *, + expand: Optional[Union[str, _models.RestorePointExpandOptions]] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{restorePointName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "restorePointCollectionName": _SERIALIZER.url( + "restore_point_collection_name", restore_point_collection_name, "str" + ), + "restorePointName": _SERIALIZER.url("restore_point_name", restore_point_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if expand is not None: + _params["$expand"] = _SERIALIZER.query("expand", expand, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_restore_points_create_request( + resource_group_name: str, + restore_point_collection_name: str, + restore_point_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{restorePointName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "restorePointCollectionName": _SERIALIZER.url( + "restore_point_collection_name", restore_point_collection_name, "str" + ), + "restorePointName": _SERIALIZER.url("restore_point_name", restore_point_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_restore_points_delete_request( + resource_group_name: str, + restore_point_collection_name: str, + restore_point_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{restorePointName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "restorePointCollectionName": _SERIALIZER.url( + "restore_point_collection_name", restore_point_collection_name, "str" + ), + "restorePointName": _SERIALIZER.url("restore_point_name", restore_point_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) + + +def build_capacity_reservation_groups_get_request( # pylint: disable=name-too-long + resource_group_name: str, + capacity_reservation_group_name: str, + subscription_id: str, + *, + expand: Optional[Union[str, _models.CapacityReservationGroupInstanceViewTypes]] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "capacityReservationGroupName": _SERIALIZER.url( + "capacity_reservation_group_name", capacity_reservation_group_name, "str" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if expand is not None: + _params["$expand"] = _SERIALIZER.query("expand", expand, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_capacity_reservation_groups_create_or_update_request( # pylint: disable=name-too-long + resource_group_name: str, capacity_reservation_group_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "capacityReservationGroupName": _SERIALIZER.url( + "capacity_reservation_group_name", capacity_reservation_group_name, "str" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_capacity_reservation_groups_update_request( # pylint: disable=name-too-long + resource_group_name: str, capacity_reservation_group_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "capacityReservationGroupName": _SERIALIZER.url( + "capacity_reservation_group_name", capacity_reservation_group_name, "str" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_capacity_reservation_groups_delete_request( # pylint: disable=name-too-long + resource_group_name: str, capacity_reservation_group_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "capacityReservationGroupName": _SERIALIZER.url( + "capacity_reservation_group_name", capacity_reservation_group_name, "str" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) + + +def build_capacity_reservation_groups_list_by_resource_group_request( # pylint: disable=name-too-long + resource_group_name: str, + subscription_id: str, + *, + expand: Optional[Union[str, _models.ExpandTypesForGetCapacityReservationGroups]] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if expand is not None: + _params["$expand"] = _SERIALIZER.query("expand", expand, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_capacity_reservation_groups_list_by_subscription_request( # pylint: disable=name-too-long + subscription_id: str, + *, + expand: Optional[Union[str, _models.ExpandTypesForGetCapacityReservationGroups]] = None, + resource_ids_only: Optional[Union[str, _models.ResourceIdOptionsForGetCapacityReservationGroups]] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/capacityReservationGroups" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if expand is not None: + _params["$expand"] = _SERIALIZER.query("expand", expand, "str") + if resource_ids_only is not None: + _params["resourceIdsOnly"] = _SERIALIZER.query("resource_ids_only", resource_ids_only, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_capacity_reservations_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: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}/capacityReservations/{capacityReservationName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "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"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if expand is not None: + _params["$expand"] = _SERIALIZER.query("expand", expand, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_capacity_reservations_create_or_update_request( # pylint: disable=name-too-long + resource_group_name: str, + capacity_reservation_group_name: str, + capacity_reservation_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}/capacityReservations/{capacityReservationName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "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"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_capacity_reservations_update_request( # pylint: disable=name-too-long + resource_group_name: str, + capacity_reservation_group_name: str, + capacity_reservation_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}/capacityReservations/{capacityReservationName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "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"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_capacity_reservations_delete_request( # pylint: disable=name-too-long + resource_group_name: str, + capacity_reservation_group_name: str, + capacity_reservation_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}/capacityReservations/{capacityReservationName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "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"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) + + +def build_capacity_reservations_list_by_capacity_reservation_group_request( # pylint: disable=name-too-long + resource_group_name: str, capacity_reservation_group_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}/capacityReservations" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "capacityReservationGroupName": _SERIALIZER.url( + "capacity_reservation_group_name", capacity_reservation_group_name, "str" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_virtual_machine_run_commands_get_by_virtual_machine_request( # pylint: disable=name-too-long + resource_group_name: str, + vm_name: str, + run_command_name: str, + subscription_id: str, + *, + expand: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommands/{runCommandName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "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"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if expand is not None: + _params["$expand"] = _SERIALIZER.query("expand", expand, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_virtual_machine_run_commands_create_or_update_request( # pylint: disable=name-too-long + resource_group_name: str, vm_name: str, run_command_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommands/{runCommandName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "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"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_virtual_machine_run_commands_update_request( # pylint: disable=name-too-long + resource_group_name: str, vm_name: str, run_command_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommands/{runCommandName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "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"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_virtual_machine_run_commands_delete_request( # pylint: disable=name-too-long + resource_group_name: str, vm_name: str, run_command_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommands/{runCommandName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "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"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) + + +def build_virtual_machine_run_commands_list_by_virtual_machine_request( # pylint: disable=name-too-long + resource_group_name: str, vm_name: str, subscription_id: str, *, expand: Optional[str] = None, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommands" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if expand is not None: + _params["$expand"] = _SERIALIZER.query("expand", expand, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_virtual_machine_scale_set_vm_run_commands_get_request( # pylint: disable=name-too-long + 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: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/runCommands/{runCommandName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", 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"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if expand is not None: + _params["$expand"] = _SERIALIZER.query("expand", expand, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_virtual_machine_scale_set_vm_run_commands_create_or_update_request( # pylint: disable=name-too-long + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + run_command_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/runCommands/{runCommandName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", 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"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_virtual_machine_scale_set_vm_run_commands_update_request( # pylint: disable=name-too-long + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + run_command_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/runCommands/{runCommandName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", 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"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_virtual_machine_scale_set_vm_run_commands_delete_request( # pylint: disable=name-too-long + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + run_command_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/runCommands/{runCommandName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", 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"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) + + +def build_virtual_machine_scale_set_vm_run_commands_list_request( # pylint: disable=name-too-long + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + subscription_id: str, + *, + expand: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/runCommands" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), + "instanceId": _SERIALIZER.url("instance_id", instance_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if expand is not None: + _params["$expand"] = _SERIALIZER.query("expand", expand, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_usage_operation_group_list_request(location: str, subscription_id: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/usages" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "location": _SERIALIZER.url("location", location, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_virtual_machine_sizes_operation_group_list_request( # pylint: disable=name-too-long + location: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/vmSizes" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "location": _SERIALIZER.url("location", location, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_virtual_machine_scale_sets_operation_group_list_by_location_request( # pylint: disable=name-too-long + location: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/virtualMachineScaleSets" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "location": _SERIALIZER.url("location", location, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_virtual_machines_operation_group_list_by_location_request( # pylint: disable=name-too-long + location: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/virtualMachines" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "location": _SERIALIZER.url("location", location, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_virtual_machine_images_edge_zone_operation_group_list_publishers_request( # pylint: disable=name-too-long + location: str, edge_zone: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/edgeZones/{edgeZone}/publishers" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "location": _SERIALIZER.url("location", location, "str"), + "edgeZone": _SERIALIZER.url("edge_zone", edge_zone, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_virtual_machine_images_edge_zone_operation_group_list_offers_request( # pylint: disable=name-too-long + location: str, edge_zone: str, publisher_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/edgeZones/{edgeZone}/publishers/{publisherName}/artifacttypes/vmimage/offers" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "location": _SERIALIZER.url("location", location, "str"), + "edgeZone": _SERIALIZER.url("edge_zone", edge_zone, "str"), + "publisherName": _SERIALIZER.url("publisher_name", publisher_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_virtual_machine_images_edge_zone_operation_group_list_skus_request( # pylint: disable=name-too-long + location: str, edge_zone: str, publisher_name: str, offer: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/edgeZones/{edgeZone}/publishers/{publisherName}/artifacttypes/vmimage/offers/{offer}/skus" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "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"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_virtual_machine_images_edge_zone_operation_group_list_request( # pylint: disable=name-too-long + 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: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/edgeZones/{edgeZone}/publishers/{publisherName}/artifacttypes/vmimage/offers/{offer}/skus/{skus}/versions" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "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"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if expand is not None: + _params["$expand"] = _SERIALIZER.query("expand", expand, "str") + if top is not None: + _params["$top"] = _SERIALIZER.query("top", top, "int") + if orderby is not None: + _params["$orderby"] = _SERIALIZER.query("orderby", orderby, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_virtual_machine_images_edge_zone_operation_group_get_request( # pylint: disable=name-too-long + location: str, + edge_zone: str, + publisher_name: str, + offer: str, + skus: str, + version: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/edgeZones/{edgeZone}/publishers/{publisherName}/artifacttypes/vmimage/offers/{offer}/skus/{skus}/versions/{version}" + path_format_arguments = { + "location": _SERIALIZER.url("location", location, "str"), + "edgeZone": _SERIALIZER.url("edge_zone", edge_zone, "str"), + "publisherName": _SERIALIZER.url("publisher_name", publisher_name, "str"), + "offer": _SERIALIZER.url("offer", offer, "str"), + "skus": _SERIALIZER.url("skus", skus, "str"), + "version": _SERIALIZER.url("version", version, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_virtual_machine_images_operation_group_list_by_edge_zone_request( # pylint: disable=name-too-long + location: str, edge_zone: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = ( + "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/edgeZones/{edgeZone}/vmimages" + ) + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "location": _SERIALIZER.url("location", location, "str"), + "edgeZone": _SERIALIZER.url("edge_zone", edge_zone, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_virtual_machine_images_operation_group_list_publishers_request( # pylint: disable=name-too-long + location: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "location": _SERIALIZER.url("location", location, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_virtual_machine_images_operation_group_list_offers_request( # pylint: disable=name-too-long + location: str, publisher_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmimage/offers" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "location": _SERIALIZER.url("location", location, "str"), + "publisherName": _SERIALIZER.url("publisher_name", publisher_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_virtual_machine_images_operation_group_list_skus_request( # pylint: disable=name-too-long + location: str, publisher_name: str, offer: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmimage/offers/{offer}/skus" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "location": _SERIALIZER.url("location", location, "str"), + "publisherName": _SERIALIZER.url("publisher_name", publisher_name, "str"), + "offer": _SERIALIZER.url("offer", offer, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_virtual_machine_images_operation_group_list_request( # pylint: disable=name-too-long + 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: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmimage/offers/{offer}/skus/{skus}/versions" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "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"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if expand is not None: + _params["$expand"] = _SERIALIZER.query("expand", expand, "str") + if top is not None: + _params["$top"] = _SERIALIZER.query("top", top, "int") + if orderby is not None: + _params["$orderby"] = _SERIALIZER.query("orderby", orderby, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_virtual_machine_images_operation_group_list_with_properties_request( # pylint: disable=name-too-long + location: str, + publisher_name: str, + offer: str, + skus: str, + subscription_id: str, + *, + expand: str, + top: Optional[int] = None, + orderby: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmimage/offers/{offer}/skus/{skus}/versions?$expand=Properties" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "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"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + _params["$expand"] = _SERIALIZER.query("expand", expand, "str") + if top is not None: + _params["$top"] = _SERIALIZER.query("top", top, "int") + if orderby is not None: + _params["$orderby"] = _SERIALIZER.query("orderby", orderby, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_virtual_machine_images_operation_group_get_request( # pylint: disable=name-too-long + location: str, publisher_name: str, offer: str, skus: str, version: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmimage/offers/{offer}/skus/{skus}/versions/{version}" + path_format_arguments = { + "location": _SERIALIZER.url("location", location, "str"), + "publisherName": _SERIALIZER.url("publisher_name", publisher_name, "str"), + "offer": _SERIALIZER.url("offer", offer, "str"), + "skus": _SERIALIZER.url("skus", skus, "str"), + "version": _SERIALIZER.url("version", version, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_log_analytics_operation_group_export_request_rate_by_interval_request( # pylint: disable=name-too-long + location: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/logAnalytics/apiAccess/getRequestRateByInterval" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "location": _SERIALIZER.url("location", location, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_log_analytics_operation_group_export_throttled_requests_request( # pylint: disable=name-too-long + location: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/logAnalytics/apiAccess/getThrottledRequests" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "location": _SERIALIZER.url("location", location, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_virtual_machine_run_commands_operation_group_list_request( # pylint: disable=name-too-long + location: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + accept = _headers.pop("Accept", None) + + # Construct URL + _url = "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/runCommands" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "location": _SERIALIZER.url("location", location, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if accept is not None: + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_virtual_machine_run_commands_operation_group_get_request( # pylint: disable=name-too-long + location: str, command_id: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + accept = _headers.pop("Accept", None) + + # Construct URL + _url = "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/runCommands/{commandId}" + path_format_arguments = { + "location": _SERIALIZER.url("location", location, "str"), + "commandId": _SERIALIZER.url("command_id", command_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if accept is not None: + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_disks_get_request( + resource_group_name: str, disk_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "diskName": _SERIALIZER.url("disk_name", disk_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_disks_create_or_update_request( + resource_group_name: str, disk_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "diskName": _SERIALIZER.url("disk_name", disk_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_disks_update_request( + resource_group_name: str, disk_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "diskName": _SERIALIZER.url("disk_name", disk_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_disks_delete_request( + resource_group_name: str, disk_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "diskName": _SERIALIZER.url("disk_name", disk_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) + + +def build_disks_list_by_resource_group_request( # pylint: disable=name-too-long + resource_group_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_disks_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/disks" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_disks_grant_access_request( + resource_group_name: str, disk_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/beginGetAccess" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "diskName": _SERIALIZER.url("disk_name", disk_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_disks_revoke_access_request( + resource_group_name: str, disk_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/endGetAccess" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "diskName": _SERIALIZER.url("disk_name", disk_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + return HttpRequest(method="POST", url=_url, params=_params, **kwargs) + + +def build_disk_accesses_get_request( + resource_group_name: str, disk_access_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "diskAccessName": _SERIALIZER.url("disk_access_name", disk_access_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_disk_accesses_create_or_update_request( # pylint: disable=name-too-long + resource_group_name: str, disk_access_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "diskAccessName": _SERIALIZER.url("disk_access_name", disk_access_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_disk_accesses_update_request( + resource_group_name: str, disk_access_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "diskAccessName": _SERIALIZER.url("disk_access_name", disk_access_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_disk_accesses_delete_request( + resource_group_name: str, disk_access_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "diskAccessName": _SERIALIZER.url("disk_access_name", disk_access_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) + + +def build_disk_accesses_list_by_resource_group_request( # pylint: disable=name-too-long + resource_group_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_disk_accesses_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/diskAccesses" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_disk_accesses_get_private_link_resources_request( # pylint: disable=name-too-long + resource_group_name: str, disk_access_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privatelinkresources" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "diskAccessName": _SERIALIZER.url("disk_access_name", disk_access_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_private_endpoint_connections_get_a_private_endpoint_connection_request( # pylint: disable=name-too-long + resource_group_name: str, + disk_access_name: str, + private_endpoint_connection_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateEndpointConnections/{privateEndpointConnectionName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "diskAccessName": _SERIALIZER.url("disk_access_name", disk_access_name, "str"), + "privateEndpointConnectionName": _SERIALIZER.url( + "private_endpoint_connection_name", private_endpoint_connection_name, "str" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_private_endpoint_connections_update_a_private_endpoint_connection_request( # pylint: disable=name-too-long + resource_group_name: str, + disk_access_name: str, + private_endpoint_connection_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateEndpointConnections/{privateEndpointConnectionName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "diskAccessName": _SERIALIZER.url("disk_access_name", disk_access_name, "str"), + "privateEndpointConnectionName": _SERIALIZER.url( + "private_endpoint_connection_name", private_endpoint_connection_name, "str" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_private_endpoint_connections_delete_a_private_endpoint_connection_request( # pylint: disable=name-too-long + resource_group_name: str, + disk_access_name: str, + private_endpoint_connection_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateEndpointConnections/{privateEndpointConnectionName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "diskAccessName": _SERIALIZER.url("disk_access_name", disk_access_name, "str"), + "privateEndpointConnectionName": _SERIALIZER.url( + "private_endpoint_connection_name", private_endpoint_connection_name, "str" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) + + +def build_private_endpoint_connections_list_private_endpoint_connections_request( # pylint: disable=name-too-long + resource_group_name: str, disk_access_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateEndpointConnections" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "diskAccessName": _SERIALIZER.url("disk_access_name", disk_access_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_disk_encryption_sets_get_request( + resource_group_name: str, disk_encryption_set_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "diskEncryptionSetName": _SERIALIZER.url("disk_encryption_set_name", disk_encryption_set_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_disk_encryption_sets_create_or_update_request( # pylint: disable=name-too-long + resource_group_name: str, disk_encryption_set_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "diskEncryptionSetName": _SERIALIZER.url("disk_encryption_set_name", disk_encryption_set_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_disk_encryption_sets_update_request( # pylint: disable=name-too-long + resource_group_name: str, disk_encryption_set_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "diskEncryptionSetName": _SERIALIZER.url("disk_encryption_set_name", disk_encryption_set_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_disk_encryption_sets_delete_request( # pylint: disable=name-too-long + resource_group_name: str, disk_encryption_set_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "diskEncryptionSetName": _SERIALIZER.url("disk_encryption_set_name", disk_encryption_set_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) + + +def build_disk_encryption_sets_list_by_resource_group_request( # pylint: disable=name-too-long + resource_group_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_disk_encryption_sets_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/diskEncryptionSets" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_disk_encryption_sets_list_associated_resources_request( # pylint: disable=name-too-long + resource_group_name: str, disk_encryption_set_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}/associatedResources" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "diskEncryptionSetName": _SERIALIZER.url("disk_encryption_set_name", disk_encryption_set_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_disk_restore_points_get_request( + resource_group_name: str, + restore_point_collection_name: str, + vm_restore_point_name: str, + disk_restore_point_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{vmRestorePointName}/diskRestorePoints/{diskRestorePointName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "restorePointCollectionName": _SERIALIZER.url( + "restore_point_collection_name", restore_point_collection_name, "str" + ), + "vmRestorePointName": _SERIALIZER.url("vm_restore_point_name", vm_restore_point_name, "str"), + "diskRestorePointName": _SERIALIZER.url("disk_restore_point_name", disk_restore_point_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_disk_restore_points_list_by_restore_point_request( # pylint: disable=name-too-long + resource_group_name: str, + restore_point_collection_name: str, + vm_restore_point_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{vmRestorePointName}/diskRestorePoints" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "restorePointCollectionName": _SERIALIZER.url( + "restore_point_collection_name", restore_point_collection_name, "str" + ), + "vmRestorePointName": _SERIALIZER.url("vm_restore_point_name", vm_restore_point_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_disk_restore_points_grant_access_request( # pylint: disable=name-too-long + resource_group_name: str, + restore_point_collection_name: str, + vm_restore_point_name: str, + disk_restore_point_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{vmRestorePointName}/diskRestorePoints/{diskRestorePointName}/beginGetAccess" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "restorePointCollectionName": _SERIALIZER.url( + "restore_point_collection_name", restore_point_collection_name, "str" + ), + "vmRestorePointName": _SERIALIZER.url("vm_restore_point_name", vm_restore_point_name, "str"), + "diskRestorePointName": _SERIALIZER.url("disk_restore_point_name", disk_restore_point_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_disk_restore_points_revoke_access_request( # pylint: disable=name-too-long + resource_group_name: str, + restore_point_collection_name: str, + vm_restore_point_name: str, + disk_restore_point_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{vmRestorePointName}/diskRestorePoints/{diskRestorePointName}/endGetAccess" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "restorePointCollectionName": _SERIALIZER.url( + "restore_point_collection_name", restore_point_collection_name, "str" + ), + "vmRestorePointName": _SERIALIZER.url("vm_restore_point_name", vm_restore_point_name, "str"), + "diskRestorePointName": _SERIALIZER.url("disk_restore_point_name", disk_restore_point_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + return HttpRequest(method="POST", url=_url, params=_params, **kwargs) + + +def build_snapshots_get_request( + resource_group_name: str, snapshot_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "snapshotName": _SERIALIZER.url("snapshot_name", snapshot_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_snapshots_create_or_update_request( + resource_group_name: str, snapshot_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "snapshotName": _SERIALIZER.url("snapshot_name", snapshot_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_snapshots_update_request( + resource_group_name: str, snapshot_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "snapshotName": _SERIALIZER.url("snapshot_name", snapshot_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_snapshots_delete_request( + resource_group_name: str, snapshot_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "snapshotName": _SERIALIZER.url("snapshot_name", snapshot_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) + + +def build_snapshots_list_by_resource_group_request( # pylint: disable=name-too-long + resource_group_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_snapshots_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/snapshots" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_snapshots_grant_access_request( + resource_group_name: str, snapshot_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/beginGetAccess" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "snapshotName": _SERIALIZER.url("snapshot_name", snapshot_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_snapshots_revoke_access_request( + resource_group_name: str, snapshot_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/endGetAccess" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "snapshotName": _SERIALIZER.url("snapshot_name", snapshot_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + return HttpRequest(method="POST", url=_url, params=_params, **kwargs) + + +def build_galleries_get_request( + resource_group_name: str, + gallery_name: str, + subscription_id: str, + *, + select: Optional[Union[str, _models.SelectPermissions]] = None, + expand: Optional[Union[str, _models.GalleryExpandParams]] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "galleryName": _SERIALIZER.url("gallery_name", gallery_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if select is not None: + _params["$select"] = _SERIALIZER.query("select", select, "str") + if expand is not None: + _params["$expand"] = _SERIALIZER.query("expand", expand, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_galleries_create_or_update_request( + resource_group_name: str, gallery_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "galleryName": _SERIALIZER.url("gallery_name", gallery_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_galleries_update_request( + resource_group_name: str, gallery_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "galleryName": _SERIALIZER.url("gallery_name", gallery_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_galleries_delete_request( + resource_group_name: str, gallery_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "galleryName": _SERIALIZER.url("gallery_name", gallery_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) + + +def build_galleries_list_by_resource_group_request( # pylint: disable=name-too-long + resource_group_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_galleries_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/galleries" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_galleries_list_by_artifact_name_request( # pylint: disable=name-too-long + resource_group_name: str, + gallery_name: str, + artifact_type: str, + artifact_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/softdeletedartifacttypes/{artifactType}/artifacts/{artifactName}/versions" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "galleryName": _SERIALIZER.url("gallery_name", gallery_name, "str"), + "artifactType": _SERIALIZER.url("artifact_type", artifact_type, "str"), + "artifactName": _SERIALIZER.url("artifact_name", artifact_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_galleries_gallery_sharing_profile_update_request( # pylint: disable=name-too-long + resource_group_name: str, gallery_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/share" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "galleryName": _SERIALIZER.url("gallery_name", gallery_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_gallery_images_get_request( + resource_group_name: str, gallery_name: str, gallery_image_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "galleryName": _SERIALIZER.url("gallery_name", gallery_name, "str"), + "galleryImageName": _SERIALIZER.url("gallery_image_name", gallery_image_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_gallery_images_create_or_update_request( # pylint: disable=name-too-long + resource_group_name: str, gallery_name: str, gallery_image_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "galleryName": _SERIALIZER.url("gallery_name", gallery_name, "str"), + "galleryImageName": _SERIALIZER.url("gallery_image_name", gallery_image_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_gallery_images_update_request( + resource_group_name: str, gallery_name: str, gallery_image_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "galleryName": _SERIALIZER.url("gallery_name", gallery_name, "str"), + "galleryImageName": _SERIALIZER.url("gallery_image_name", gallery_image_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_gallery_images_delete_request( + resource_group_name: str, gallery_name: str, gallery_image_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "galleryName": _SERIALIZER.url("gallery_name", gallery_name, "str"), + "galleryImageName": _SERIALIZER.url("gallery_image_name", gallery_image_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) + + +def build_gallery_images_list_by_gallery_request( # pylint: disable=name-too-long + resource_group_name: str, gallery_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "galleryName": _SERIALIZER.url("gallery_name", gallery_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_gallery_image_versions_get_request( + resource_group_name: str, + gallery_name: str, + gallery_image_name: str, + gallery_image_version_name: str, + subscription_id: str, + *, + expand: Optional[Union[str, _models.ReplicationStatusTypes]] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "galleryName": _SERIALIZER.url("gallery_name", gallery_name, "str"), + "galleryImageName": _SERIALIZER.url("gallery_image_name", gallery_image_name, "str"), + "galleryImageVersionName": _SERIALIZER.url("gallery_image_version_name", gallery_image_version_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if expand is not None: + _params["$expand"] = _SERIALIZER.query("expand", expand, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_gallery_image_versions_create_or_update_request( # pylint: disable=name-too-long + resource_group_name: str, + gallery_name: str, + gallery_image_name: str, + gallery_image_version_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "galleryName": _SERIALIZER.url("gallery_name", gallery_name, "str"), + "galleryImageName": _SERIALIZER.url("gallery_image_name", gallery_image_name, "str"), + "galleryImageVersionName": _SERIALIZER.url("gallery_image_version_name", gallery_image_version_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_gallery_image_versions_update_request( # pylint: disable=name-too-long + resource_group_name: str, + gallery_name: str, + gallery_image_name: str, + gallery_image_version_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "galleryName": _SERIALIZER.url("gallery_name", gallery_name, "str"), + "galleryImageName": _SERIALIZER.url("gallery_image_name", gallery_image_name, "str"), + "galleryImageVersionName": _SERIALIZER.url("gallery_image_version_name", gallery_image_version_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_gallery_image_versions_delete_request( # pylint: disable=name-too-long + resource_group_name: str, + gallery_name: str, + gallery_image_name: str, + gallery_image_version_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "galleryName": _SERIALIZER.url("gallery_name", gallery_name, "str"), + "galleryImageName": _SERIALIZER.url("gallery_image_name", gallery_image_name, "str"), + "galleryImageVersionName": _SERIALIZER.url("gallery_image_version_name", gallery_image_version_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) + + +def build_gallery_image_versions_list_by_gallery_image_request( # pylint: disable=name-too-long + resource_group_name: str, gallery_name: str, gallery_image_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}/versions" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "galleryName": _SERIALIZER.url("gallery_name", gallery_name, "str"), + "galleryImageName": _SERIALIZER.url("gallery_image_name", gallery_image_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_gallery_applications_get_request( + resource_group_name: str, gallery_name: str, gallery_application_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "galleryName": _SERIALIZER.url("gallery_name", gallery_name, "str"), + "galleryApplicationName": _SERIALIZER.url("gallery_application_name", gallery_application_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_gallery_applications_create_or_update_request( # pylint: disable=name-too-long + resource_group_name: str, gallery_name: str, gallery_application_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "galleryName": _SERIALIZER.url("gallery_name", gallery_name, "str"), + "galleryApplicationName": _SERIALIZER.url("gallery_application_name", gallery_application_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_gallery_applications_update_request( # pylint: disable=name-too-long + resource_group_name: str, gallery_name: str, gallery_application_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "galleryName": _SERIALIZER.url("gallery_name", gallery_name, "str"), + "galleryApplicationName": _SERIALIZER.url("gallery_application_name", gallery_application_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_gallery_applications_delete_request( # pylint: disable=name-too-long + resource_group_name: str, gallery_name: str, gallery_application_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "galleryName": _SERIALIZER.url("gallery_name", gallery_name, "str"), + "galleryApplicationName": _SERIALIZER.url("gallery_application_name", gallery_application_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) + + +def build_gallery_applications_list_by_gallery_request( # pylint: disable=name-too-long + resource_group_name: str, gallery_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "galleryName": _SERIALIZER.url("gallery_name", gallery_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_gallery_application_versions_get_request( # pylint: disable=name-too-long + resource_group_name: str, + gallery_name: str, + gallery_application_name: str, + gallery_application_version_name: str, + subscription_id: str, + *, + expand: Optional[Union[str, _models.ReplicationStatusTypes]] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}/versions/{galleryApplicationVersionName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "galleryName": _SERIALIZER.url("gallery_name", gallery_name, "str"), + "galleryApplicationName": _SERIALIZER.url("gallery_application_name", gallery_application_name, "str"), + "galleryApplicationVersionName": _SERIALIZER.url( + "gallery_application_version_name", gallery_application_version_name, "str" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if expand is not None: + _params["$expand"] = _SERIALIZER.query("expand", expand, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_gallery_application_versions_create_or_update_request( # pylint: disable=name-too-long + resource_group_name: str, + gallery_name: str, + gallery_application_name: str, + gallery_application_version_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}/versions/{galleryApplicationVersionName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "galleryName": _SERIALIZER.url("gallery_name", gallery_name, "str"), + "galleryApplicationName": _SERIALIZER.url("gallery_application_name", gallery_application_name, "str"), + "galleryApplicationVersionName": _SERIALIZER.url( + "gallery_application_version_name", gallery_application_version_name, "str" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_gallery_application_versions_update_request( # pylint: disable=name-too-long + resource_group_name: str, + gallery_name: str, + gallery_application_name: str, + gallery_application_version_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}/versions/{galleryApplicationVersionName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "galleryName": _SERIALIZER.url("gallery_name", gallery_name, "str"), + "galleryApplicationName": _SERIALIZER.url("gallery_application_name", gallery_application_name, "str"), + "galleryApplicationVersionName": _SERIALIZER.url( + "gallery_application_version_name", gallery_application_version_name, "str" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_gallery_application_versions_delete_request( # pylint: disable=name-too-long + resource_group_name: str, + gallery_name: str, + gallery_application_name: str, + gallery_application_version_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}/versions/{galleryApplicationVersionName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "galleryName": _SERIALIZER.url("gallery_name", gallery_name, "str"), + "galleryApplicationName": _SERIALIZER.url("gallery_application_name", gallery_application_name, "str"), + "galleryApplicationVersionName": _SERIALIZER.url( + "gallery_application_version_name", gallery_application_version_name, "str" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) + + +def build_gallery_application_versions_list_by_gallery_application_request( # pylint: disable=name-too-long + resource_group_name: str, gallery_name: str, gallery_application_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}/versions" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "galleryName": _SERIALIZER.url("gallery_name", gallery_name, "str"), + "galleryApplicationName": _SERIALIZER.url("gallery_application_name", gallery_application_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_gallery_in_vm_access_control_profiles_get_request( # pylint: disable=name-too-long + resource_group_name: str, + gallery_name: str, + in_vm_access_control_profile_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/inVMAccessControlProfiles/{inVMAccessControlProfileName}" + 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"), + "inVMAccessControlProfileName": _SERIALIZER.url( + "in_vm_access_control_profile_name", in_vm_access_control_profile_name, "str" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_gallery_in_vm_access_control_profiles_create_or_update_request( # pylint: disable=name-too-long + resource_group_name: str, + gallery_name: str, + in_vm_access_control_profile_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/inVMAccessControlProfiles/{inVMAccessControlProfileName}" + 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"), + "inVMAccessControlProfileName": _SERIALIZER.url( + "in_vm_access_control_profile_name", in_vm_access_control_profile_name, "str" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_gallery_in_vm_access_control_profiles_update_request( # pylint: disable=name-too-long + resource_group_name: str, + gallery_name: str, + in_vm_access_control_profile_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/inVMAccessControlProfiles/{inVMAccessControlProfileName}" + 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"), + "inVMAccessControlProfileName": _SERIALIZER.url( + "in_vm_access_control_profile_name", in_vm_access_control_profile_name, "str" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_gallery_in_vm_access_control_profiles_delete_request( # pylint: disable=name-too-long + resource_group_name: str, + gallery_name: str, + in_vm_access_control_profile_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/inVMAccessControlProfiles/{inVMAccessControlProfileName}" + 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"), + "inVMAccessControlProfileName": _SERIALIZER.url( + "in_vm_access_control_profile_name", in_vm_access_control_profile_name, "str" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) + + +def build_gallery_in_vm_access_control_profiles_list_by_gallery_request( # pylint: disable=name-too-long + resource_group_name: str, gallery_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/inVMAccessControlProfiles" + 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: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_gallery_in_vm_access_control_profile_versions_get_request( # pylint: disable=name-too-long + resource_group_name: str, + gallery_name: str, + in_vm_access_control_profile_name: str, + in_vm_access_control_profile_version_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/inVMAccessControlProfiles/{inVMAccessControlProfileName}/versions/{inVMAccessControlProfileVersionName}" + 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"), + "inVMAccessControlProfileName": _SERIALIZER.url( + "in_vm_access_control_profile_name", in_vm_access_control_profile_name, "str" + ), + "inVMAccessControlProfileVersionName": _SERIALIZER.url( + "in_vm_access_control_profile_version_name", in_vm_access_control_profile_version_name, "str" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_gallery_in_vm_access_control_profile_versions_create_or_update_request( # pylint: disable=name-too-long + resource_group_name: str, + gallery_name: str, + in_vm_access_control_profile_name: str, + in_vm_access_control_profile_version_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/inVMAccessControlProfiles/{inVMAccessControlProfileName}/versions/{inVMAccessControlProfileVersionName}" + 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"), + "inVMAccessControlProfileName": _SERIALIZER.url( + "in_vm_access_control_profile_name", in_vm_access_control_profile_name, "str" + ), + "inVMAccessControlProfileVersionName": _SERIALIZER.url( + "in_vm_access_control_profile_version_name", in_vm_access_control_profile_version_name, "str" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_gallery_in_vm_access_control_profile_versions_update_request( # pylint: disable=name-too-long + resource_group_name: str, + gallery_name: str, + in_vm_access_control_profile_name: str, + in_vm_access_control_profile_version_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/inVMAccessControlProfiles/{inVMAccessControlProfileName}/versions/{inVMAccessControlProfileVersionName}" + 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"), + "inVMAccessControlProfileName": _SERIALIZER.url( + "in_vm_access_control_profile_name", in_vm_access_control_profile_name, "str" + ), + "inVMAccessControlProfileVersionName": _SERIALIZER.url( + "in_vm_access_control_profile_version_name", in_vm_access_control_profile_version_name, "str" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_gallery_in_vm_access_control_profile_versions_delete_request( # pylint: disable=name-too-long + resource_group_name: str, + gallery_name: str, + in_vm_access_control_profile_name: str, + in_vm_access_control_profile_version_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/inVMAccessControlProfiles/{inVMAccessControlProfileName}/versions/{inVMAccessControlProfileVersionName}" + 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"), + "inVMAccessControlProfileName": _SERIALIZER.url( + "in_vm_access_control_profile_name", in_vm_access_control_profile_name, "str" + ), + "inVMAccessControlProfileVersionName": _SERIALIZER.url( + "in_vm_access_control_profile_version_name", in_vm_access_control_profile_version_name, "str" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) + + +def build_gallery_in_vm_access_control_profile_versions_list_by_gallery_in_vm_access_control_profile_request( # pylint: disable=name-too-long + resource_group_name: str, + gallery_name: str, + in_vm_access_control_profile_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/inVMAccessControlProfiles/{inVMAccessControlProfileName}/versions" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "galleryName": _SERIALIZER.url("gallery_name", gallery_name, "str"), + "inVMAccessControlProfileName": _SERIALIZER.url( + "in_vm_access_control_profile_name", in_vm_access_control_profile_name, "str" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_shared_galleries_get_request( + location: str, gallery_unique_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/sharedGalleries/{galleryUniqueName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "location": _SERIALIZER.url("location", location, "str"), + "galleryUniqueName": _SERIALIZER.url("gallery_unique_name", gallery_unique_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_shared_galleries_list_request( + location: str, + subscription_id: str, + *, + shared_to: Optional[Union[str, _models.SharedToValues]] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/sharedGalleries" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "location": _SERIALIZER.url("location", location, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if shared_to is not None: + _params["sharedTo"] = _SERIALIZER.query("shared_to", shared_to, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_shared_gallery_images_get_request( + location: str, gallery_unique_name: str, gallery_image_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/sharedGalleries/{galleryUniqueName}/images/{galleryImageName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "location": _SERIALIZER.url("location", location, "str"), + "galleryUniqueName": _SERIALIZER.url("gallery_unique_name", gallery_unique_name, "str"), + "galleryImageName": _SERIALIZER.url("gallery_image_name", gallery_image_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_shared_gallery_images_list_request( + location: str, + gallery_unique_name: str, + subscription_id: str, + *, + shared_to: Optional[Union[str, _models.SharedToValues]] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/sharedGalleries/{galleryUniqueName}/images" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "location": _SERIALIZER.url("location", location, "str"), + "galleryUniqueName": _SERIALIZER.url("gallery_unique_name", gallery_unique_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if shared_to is not None: + _params["sharedTo"] = _SERIALIZER.query("shared_to", shared_to, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_shared_gallery_image_versions_get_request( # pylint: disable=name-too-long + location: str, + gallery_unique_name: str, + gallery_image_name: str, + gallery_image_version_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/sharedGalleries/{galleryUniqueName}/images/{galleryImageName}/versions/{galleryImageVersionName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "location": _SERIALIZER.url("location", location, "str"), + "galleryUniqueName": _SERIALIZER.url("gallery_unique_name", gallery_unique_name, "str"), + "galleryImageName": _SERIALIZER.url("gallery_image_name", gallery_image_name, "str"), + "galleryImageVersionName": _SERIALIZER.url("gallery_image_version_name", gallery_image_version_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_shared_gallery_image_versions_list_request( # pylint: disable=name-too-long + location: str, + gallery_unique_name: str, + gallery_image_name: str, + subscription_id: str, + *, + shared_to: Optional[Union[str, _models.SharedToValues]] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/sharedGalleries/{galleryUniqueName}/images/{galleryImageName}/versions" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "location": _SERIALIZER.url("location", location, "str"), + "galleryUniqueName": _SERIALIZER.url("gallery_unique_name", gallery_unique_name, "str"), + "galleryImageName": _SERIALIZER.url("gallery_image_name", gallery_image_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if shared_to is not None: + _params["sharedTo"] = _SERIALIZER.query("shared_to", shared_to, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_community_galleries_get_request( + location: str, public_gallery_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/communityGalleries/{publicGalleryName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "location": _SERIALIZER.url("location", location, "str"), + "publicGalleryName": _SERIALIZER.url("public_gallery_name", public_gallery_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_community_gallery_images_get_request( # pylint: disable=name-too-long + location: str, public_gallery_name: str, gallery_image_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/communityGalleries/{publicGalleryName}/images/{galleryImageName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "location": _SERIALIZER.url("location", location, "str"), + "publicGalleryName": _SERIALIZER.url("public_gallery_name", public_gallery_name, "str"), + "galleryImageName": _SERIALIZER.url("gallery_image_name", gallery_image_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_community_gallery_images_list_request( # pylint: disable=name-too-long + location: str, public_gallery_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/communityGalleries/{publicGalleryName}/images" + 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: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_community_gallery_image_versions_get_request( # pylint: disable=name-too-long + location: str, + public_gallery_name: str, + gallery_image_name: str, + gallery_image_version_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/communityGalleries/{publicGalleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "location": _SERIALIZER.url("location", location, "str"), + "publicGalleryName": _SERIALIZER.url("public_gallery_name", public_gallery_name, "str"), + "galleryImageName": _SERIALIZER.url("gallery_image_name", gallery_image_name, "str"), + "galleryImageVersionName": _SERIALIZER.url("gallery_image_version_name", gallery_image_version_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_community_gallery_image_versions_list_request( # pylint: disable=name-too-long + location: str, public_gallery_name: str, gallery_image_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/communityGalleries/{publicGalleryName}/images/{galleryImageName}/versions" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "location": _SERIALIZER.url("location", location, "str"), + "publicGalleryName": _SERIALIZER.url("public_gallery_name", public_gallery_name, "str"), + "galleryImageName": _SERIALIZER.url("gallery_image_name", gallery_image_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_resource_skus_list_request( + subscription_id: str, + *, + filter: Optional[str] = None, + include_extended_locations: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/skus" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if filter is not None: + _params["$filter"] = _SERIALIZER.query("filter", filter, "str") + if include_extended_locations is not None: + _params["includeExtendedLocations"] = _SERIALIZER.query( + "include_extended_locations", include_extended_locations, "str" + ) + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + class Operations: """ .. warning:: **DO NOT** instantiate this class directly. Instead, you should access the following operations through - :class:`~azure.mgmt.compute.ComputeManagementClient`'s - :attr:`operations` attribute. + :class:`~azure.mgmt.compute.ComputeClient`'s + :attr:`operations` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list(self, **kwargs: Any) -> ItemPaged["_models.Operation"]: + """List the operations for the provider. + + :return: An iterator like instance of Operation + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.models.Operation] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.Operation]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_operations_list_request( + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.Operation], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + +class VirtualMachineScaleSetsOperations: # pylint: disable=too-many-public-methods + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.compute.ComputeClient`'s + :attr:`virtual_machine_scale_sets` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @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. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :keyword 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. "userData" Default value is None. + :paramtype expand: str or ~azure.mgmt.compute.models.ExpandTypesForGetVMScaleSets + :return: VirtualMachineScaleSet. The VirtualMachineScaleSet is compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.VirtualMachineScaleSet + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.VirtualMachineScaleSet] = kwargs.pop("cls", None) + + _request = build_virtual_machine_scale_sets_get_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + expand=expand, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.VirtualMachineScaleSet, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _create_or_update_initial( + self, + resource_group_name: str, + vm_scale_set_name: str, + resource: Union[_models.VirtualMachineScaleSet, JSON, IO[bytes]], + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + if match_condition == MatchConditions.IfNotModified: + error_map[412] = ResourceModifiedError + elif match_condition == MatchConditions.IfPresent: + error_map[412] = ResourceNotFoundError + elif match_condition == MatchConditions.IfMissing: + error_map[412] = ResourceExistsError + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(resource, (IOBase, bytes)): + _content = resource + else: + _content = json.dumps(resource, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_virtual_machine_scale_sets_create_or_update_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + etag=etag, + match_condition=match_condition, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 201: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + vm_scale_set_name: str, + resource: _models.VirtualMachineScaleSet, + *, + content_type: str = "application/json", + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> LROPoller[None]: + """Create or update a VM scale set. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param resource: The scale set object. Required. + :type resource: ~azure.mgmt.compute.models.VirtualMachineScaleSet + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + vm_scale_set_name: str, + resource: JSON, + *, + content_type: str = "application/json", + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> LROPoller[None]: + """Create or update a VM scale set. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param resource: The scale set object. Required. + :type resource: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + vm_scale_set_name: str, + resource: IO[bytes], + *, + content_type: str = "application/json", + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> LROPoller[None]: + """Create or update a VM scale set. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param resource: The scale set object. Required. + :type resource: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + vm_scale_set_name: str, + resource: Union[_models.VirtualMachineScaleSet, JSON, IO[bytes]], + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> LROPoller[None]: + """Create or update a VM scale set. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param resource: The scale set object. Is one of the following types: VirtualMachineScaleSet, + JSON, IO[bytes] Required. + :type resource: ~azure.mgmt.compute.models.VirtualMachineScaleSet or JSON or IO[bytes] + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + resource=resource, + etag=etag, + match_condition=match_condition, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + def _update_initial( + self, + resource_group_name: str, + vm_scale_set_name: str, + properties: Union[_models.VirtualMachineScaleSetUpdate, JSON, IO[bytes]], + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + if match_condition == MatchConditions.IfNotModified: + error_map[412] = ResourceModifiedError + elif match_condition == MatchConditions.IfPresent: + error_map[412] = ResourceNotFoundError + elif match_condition == MatchConditions.IfMissing: + error_map[412] = ResourceExistsError + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(properties, (IOBase, bytes)): + _content = properties + else: + _content = json.dumps(properties, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_virtual_machine_scale_sets_update_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + etag=etag, + match_condition=match_condition, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_update( + self, + resource_group_name: str, + vm_scale_set_name: str, + properties: _models.VirtualMachineScaleSetUpdate, + *, + content_type: str = "application/json", + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> LROPoller[None]: + """Update a VM scale set. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param properties: The scale set object. Required. + :type properties: ~azure.mgmt.compute.models.VirtualMachineScaleSetUpdate + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update( + self, + resource_group_name: str, + vm_scale_set_name: str, + properties: JSON, + *, + content_type: str = "application/json", + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> LROPoller[None]: + """Update a VM scale set. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param properties: The scale set object. Required. + :type properties: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update( + self, + resource_group_name: str, + vm_scale_set_name: str, + properties: IO[bytes], + *, + content_type: str = "application/json", + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> LROPoller[None]: + """Update a VM scale set. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param properties: The scale set object. Required. + :type properties: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update( + self, + resource_group_name: str, + vm_scale_set_name: str, + properties: Union[_models.VirtualMachineScaleSetUpdate, JSON, IO[bytes]], + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> LROPoller[None]: + """Update a VM scale set. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param properties: The scale set object. Is one of the following types: + VirtualMachineScaleSetUpdate, JSON, IO[bytes] Required. + :type properties: ~azure.mgmt.compute.models.VirtualMachineScaleSetUpdate or JSON or IO[bytes] + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._update_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + properties=properties, + etag=etag, + match_condition=match_condition, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + def _delete_initial( + self, resource_group_name: str, vm_scale_set_name: str, *, force_deletion: Optional[bool] = None, **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_virtual_machine_scale_sets_delete_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + force_deletion=force_deletion, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_delete( + 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. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :keyword force_deletion: Optional parameter to force delete a VM scale set. (Feature in + Preview). Default value is None. + :paramtype force_deletion: bool + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + force_deletion=force_deletion, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace + def list(self, resource_group_name: str, **kwargs: Any) -> ItemPaged["_models.VirtualMachineScaleSet"]: + """Gets a list of all VM scale sets under a resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :return: An iterator like instance of VirtualMachineScaleSet + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.models.VirtualMachineScaleSet] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.VirtualMachineScaleSet]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_virtual_machine_scale_sets_list_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.VirtualMachineScaleSet], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + @distributed_trace + def list_all(self, **kwargs: Any) -> ItemPaged["_models.VirtualMachineScaleSet"]: + """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. + + :return: An iterator like instance of VirtualMachineScaleSet + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.models.VirtualMachineScaleSet] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.VirtualMachineScaleSet]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_virtual_machine_scale_sets_list_all_request( + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.VirtualMachineScaleSet], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + def _approve_rolling_upgrade_initial( + self, + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional[Union[_models.VirtualMachineScaleSetVMInstanceIDs, JSON, IO[bytes]]] = None, + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + content_type = content_type if vm_instance_i_ds else None + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" if vm_instance_i_ds else None + _content = None + if isinstance(vm_instance_i_ds, (IOBase, bytes)): + _content = vm_instance_i_ds + else: + if vm_instance_i_ds is not None: + _content = json.dumps(vm_instance_i_ds, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + else: + _content = None + + _request = build_virtual_machine_scale_sets_approve_rolling_upgrade_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_approve_rolling_upgrade( + self, + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional[_models.VirtualMachineScaleSetVMInstanceIDs] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Approve upgrade on deferred rolling upgrades for OS disks in the virtual machines in a VM scale + set. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :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.models.VirtualMachineScaleSetVMInstanceIDs + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_approve_rolling_upgrade( + self, + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional[JSON] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Approve upgrade on deferred rolling upgrades for OS disks in the virtual machines in a VM scale + set. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :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: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_approve_rolling_upgrade( + self, + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Approve upgrade on deferred rolling upgrades for OS disks in the virtual machines in a VM scale + set. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :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: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_approve_rolling_upgrade( + self, + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional[Union[_models.VirtualMachineScaleSetVMInstanceIDs, JSON, IO[bytes]]] = None, + **kwargs: Any + ) -> LROPoller[None]: + """Approve upgrade on deferred rolling upgrades for OS disks in the virtual machines in a VM scale + set. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param vm_instance_i_ds: A list of virtual machine instance IDs from the VM scale set. Is one + of the following types: VirtualMachineScaleSetVMInstanceIDs, JSON, IO[bytes] Default value is + None. + :type vm_instance_i_ds: ~azure.mgmt.compute.models.VirtualMachineScaleSetVMInstanceIDs or JSON + or IO[bytes] + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + content_type = content_type if vm_instance_i_ds else None + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._approve_rolling_upgrade_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + vm_instance_i_ds=vm_instance_i_ds, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @overload + def convert_to_single_placement_group( + self, + resource_group_name: str, + vm_scale_set_name: str, + body: _models.VMScaleSetConvertToSinglePlacementGroupInput, + *, + content_type: str = "application/json", + **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. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param body: The input object for ConvertToSinglePlacementGroup API. Required. + :type body: ~azure.mgmt.compute.models.VMScaleSetConvertToSinglePlacementGroupInput + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def convert_to_single_placement_group( + self, + resource_group_name: str, + vm_scale_set_name: str, + body: JSON, + *, + content_type: str = "application/json", + **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. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param body: The input object for ConvertToSinglePlacementGroup API. Required. + :type body: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def convert_to_single_placement_group( + self, + resource_group_name: str, + vm_scale_set_name: str, + body: IO[bytes], + *, + content_type: str = "application/json", + **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. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param body: The input object for ConvertToSinglePlacementGroup API. Required. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def convert_to_single_placement_group( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + vm_scale_set_name: str, + body: Union[_models.VMScaleSetConvertToSinglePlacementGroupInput, JSON, IO[bytes]], + **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. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param body: The input object for ConvertToSinglePlacementGroup API. Is one of the following + types: VMScaleSetConvertToSinglePlacementGroupInput, JSON, IO[bytes] Required. + :type body: ~azure.mgmt.compute.models.VMScaleSetConvertToSinglePlacementGroupInput or JSON or + IO[bytes] + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_virtual_machine_scale_sets_convert_to_single_placement_group_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + def _deallocate_initial( + self, + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional[Union[_models.VirtualMachineScaleSetVMInstanceIDs, JSON, IO[bytes]]] = None, + *, + hibernate: Optional[bool] = None, + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + content_type = content_type if vm_instance_i_ds else None + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" if vm_instance_i_ds else None + _content = None + if isinstance(vm_instance_i_ds, (IOBase, bytes)): + _content = vm_instance_i_ds + else: + if vm_instance_i_ds is not None: + _content = json.dumps(vm_instance_i_ds, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + else: + _content = None + + _request = build_virtual_machine_scale_sets_deallocate_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + hibernate=hibernate, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_deallocate( + self, + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional[_models.VirtualMachineScaleSetVMInstanceIDs] = None, + *, + hibernate: Optional[bool] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.OkResponse]: + """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. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :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.models.VirtualMachineScaleSetVMInstanceIDs + :keyword hibernate: Optional parameter to hibernate a virtual machine from the VM scale set. + (This feature is available for VMSS with Flexible OrchestrationMode only). Default value is + None. + :paramtype hibernate: bool + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns OkResponse. The OkResponse is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.OkResponse] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_deallocate( + self, + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional[JSON] = None, + *, + hibernate: Optional[bool] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.OkResponse]: + """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. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :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: JSON + :keyword hibernate: Optional parameter to hibernate a virtual machine from the VM scale set. + (This feature is available for VMSS with Flexible OrchestrationMode only). Default value is + None. + :paramtype hibernate: bool + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns OkResponse. The OkResponse is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.OkResponse] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_deallocate( + self, + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional[IO[bytes]] = None, + *, + hibernate: Optional[bool] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.OkResponse]: + """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. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :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: IO[bytes] + :keyword hibernate: Optional parameter to hibernate a virtual machine from the VM scale set. + (This feature is available for VMSS with Flexible OrchestrationMode only). Default value is + None. + :paramtype hibernate: bool + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns OkResponse. The OkResponse is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.OkResponse] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_deallocate( + self, + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional[Union[_models.VirtualMachineScaleSetVMInstanceIDs, JSON, IO[bytes]]] = None, + *, + hibernate: Optional[bool] = None, + **kwargs: Any + ) -> LROPoller[_models.OkResponse]: + """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. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param vm_instance_i_ds: A list of virtual machine instance IDs from the VM scale set. Is one + of the following types: VirtualMachineScaleSetVMInstanceIDs, JSON, IO[bytes] Default value is + None. + :type vm_instance_i_ds: ~azure.mgmt.compute.models.VirtualMachineScaleSetVMInstanceIDs or JSON + or IO[bytes] + :keyword hibernate: Optional parameter to hibernate a virtual machine from the VM scale set. + (This feature is available for VMSS with Flexible OrchestrationMode only). Default value is + None. + :paramtype hibernate: bool + :return: An instance of LROPoller that returns OkResponse. The OkResponse is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.OkResponse] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + content_type = content_type if vm_instance_i_ds else None + cls: ClsType[_models.OkResponse] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._deallocate_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + vm_instance_i_ds=vm_instance_i_ds, + hibernate=hibernate, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = _deserialize(_models.OkResponse, response.json()) + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.OkResponse].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.OkResponse]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _delete_instances_initial( + self, + resource_group_name: str, + vm_scale_set_name: str, + body: Union[_models.VirtualMachineScaleSetVMInstanceRequiredIDs, JSON, IO[bytes]], + *, + force_deletion: Optional[bool] = None, + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_virtual_machine_scale_sets_delete_instances_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + force_deletion=force_deletion, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_delete_instances( + self, + resource_group_name: str, + vm_scale_set_name: str, + body: _models.VirtualMachineScaleSetVMInstanceRequiredIDs, + *, + force_deletion: Optional[bool] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.OkResponse]: + """Deletes virtual machines in a VM scale set. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param body: A list of virtual machine instance IDs from the VM scale set. Required. + :type body: ~azure.mgmt.compute.models.VirtualMachineScaleSetVMInstanceRequiredIDs + :keyword force_deletion: Optional parameter to force delete virtual machines from the VM scale + set. (Feature in Preview). Default value is None. + :paramtype force_deletion: bool + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns OkResponse. The OkResponse is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.OkResponse] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_delete_instances( + self, + resource_group_name: str, + vm_scale_set_name: str, + body: JSON, + *, + force_deletion: Optional[bool] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.OkResponse]: + """Deletes virtual machines in a VM scale set. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param body: A list of virtual machine instance IDs from the VM scale set. Required. + :type body: JSON + :keyword force_deletion: Optional parameter to force delete virtual machines from the VM scale + set. (Feature in Preview). Default value is None. + :paramtype force_deletion: bool + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns OkResponse. The OkResponse is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.OkResponse] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_delete_instances( + self, + resource_group_name: str, + vm_scale_set_name: str, + body: IO[bytes], + *, + force_deletion: Optional[bool] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.OkResponse]: + """Deletes virtual machines in a VM scale set. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param body: A list of virtual machine instance IDs from the VM scale set. Required. + :type body: IO[bytes] + :keyword force_deletion: Optional parameter to force delete virtual machines from the VM scale + set. (Feature in Preview). Default value is None. + :paramtype force_deletion: bool + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns OkResponse. The OkResponse is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.OkResponse] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_delete_instances( + self, + resource_group_name: str, + vm_scale_set_name: str, + body: Union[_models.VirtualMachineScaleSetVMInstanceRequiredIDs, JSON, IO[bytes]], + *, + force_deletion: Optional[bool] = None, + **kwargs: Any + ) -> LROPoller[_models.OkResponse]: + """Deletes virtual machines in a VM scale set. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param body: A list of virtual machine instance IDs from the VM scale set. Is one of the + following types: VirtualMachineScaleSetVMInstanceRequiredIDs, JSON, IO[bytes] Required. + :type body: ~azure.mgmt.compute.models.VirtualMachineScaleSetVMInstanceRequiredIDs or JSON or + IO[bytes] + :keyword force_deletion: Optional parameter to force delete virtual machines from the VM scale + set. (Feature in Preview). Default value is None. + :paramtype force_deletion: bool + :return: An instance of LROPoller that returns OkResponse. The OkResponse is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.OkResponse] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.OkResponse] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_instances_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + body=body, + force_deletion=force_deletion, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = _deserialize(_models.OkResponse, response.json()) + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.OkResponse].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.OkResponse]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + @distributed_trace + def force_recovery_service_fabric_platform_update_domain_walk( # pylint: disable=name-too-long + 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. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :keyword platform_update_domain: The platform update domain for which a manual recovery walk is + requested. Required. + :paramtype platform_update_domain: int + :keyword zone: The zone in which the manual recovery walk is requested for cross zone virtual + machine scale set. Default value is None. + :paramtype zone: str + :keyword placement_group_id: The placement group id for which the manual recovery walk is + requested. Default value is None. + :paramtype placement_group_id: str + :return: RecoveryWalkResponse. The RecoveryWalkResponse is compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.RecoveryWalkResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.RecoveryWalkResponse] = kwargs.pop("cls", None) + + _request = build_virtual_machine_scale_sets_force_recovery_service_fabric_platform_update_domain_walk_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + platform_update_domain=platform_update_domain, + zone=zone, + placement_group_id=placement_group_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.RecoveryWalkResponse, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # 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. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :return: VirtualMachineScaleSetInstanceView. The VirtualMachineScaleSetInstanceView is + compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.VirtualMachineScaleSetInstanceView + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.VirtualMachineScaleSetInstanceView] = kwargs.pop("cls", None) + + _request = build_virtual_machine_scale_sets_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=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.VirtualMachineScaleSetInstanceView, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _update_instances_initial( + self, + resource_group_name: str, + vm_scale_set_name: str, + body: Union[_models.VirtualMachineScaleSetVMInstanceRequiredIDs, JSON, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_virtual_machine_scale_sets_update_instances_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_update_instances( + self, + resource_group_name: str, + vm_scale_set_name: str, + body: _models.VirtualMachineScaleSetVMInstanceRequiredIDs, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.OkResponse]: + """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. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param body: A list of virtual machine instance IDs from the VM scale set. Required. + :type body: ~azure.mgmt.compute.models.VirtualMachineScaleSetVMInstanceRequiredIDs + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns OkResponse. The OkResponse is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.OkResponse] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update_instances( + self, + resource_group_name: str, + vm_scale_set_name: str, + body: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.OkResponse]: + """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. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param body: A list of virtual machine instance IDs from the VM scale set. Required. + :type body: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns OkResponse. The OkResponse is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.OkResponse] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update_instances( + self, + resource_group_name: str, + vm_scale_set_name: str, + body: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.OkResponse]: + """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. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param body: A list of virtual machine instance IDs from the VM scale set. Required. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns OkResponse. The OkResponse is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.OkResponse] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update_instances( + self, + resource_group_name: str, + vm_scale_set_name: str, + body: Union[_models.VirtualMachineScaleSetVMInstanceRequiredIDs, JSON, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.OkResponse]: + """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. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param body: A list of virtual machine instance IDs from the VM scale set. Is one of the + following types: VirtualMachineScaleSetVMInstanceRequiredIDs, JSON, IO[bytes] Required. + :type body: ~azure.mgmt.compute.models.VirtualMachineScaleSetVMInstanceRequiredIDs or JSON or + IO[bytes] + :return: An instance of LROPoller that returns OkResponse. The OkResponse is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.OkResponse] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.OkResponse] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._update_instances_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + body=body, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = _deserialize(_models.OkResponse, response.json()) + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.OkResponse].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.OkResponse]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + @distributed_trace + def get_os_upgrade_history( + self, resource_group_name: str, vm_scale_set_name: str, **kwargs: Any + ) -> ItemPaged["_models.UpgradeOperationHistoricalStatusInfo"]: + """Gets list of OS upgrades on a VM scale set instance. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :return: An iterator like instance of UpgradeOperationHistoricalStatusInfo + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.models.UpgradeOperationHistoricalStatusInfo] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.UpgradeOperationHistoricalStatusInfo]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_virtual_machine_scale_sets_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=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.UpgradeOperationHistoricalStatusInfo], deserialized.get("value", []) + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + def _perform_maintenance_initial( + self, + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional[Union[_models.VirtualMachineScaleSetVMInstanceIDs, JSON, IO[bytes]]] = None, + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + content_type = content_type if vm_instance_i_ds else None + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" if vm_instance_i_ds else None + _content = None + if isinstance(vm_instance_i_ds, (IOBase, bytes)): + _content = vm_instance_i_ds + else: + if vm_instance_i_ds is not None: + _content = json.dumps(vm_instance_i_ds, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + else: + _content = None + + _request = build_virtual_machine_scale_sets_perform_maintenance_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_perform_maintenance( + self, + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional[_models.VirtualMachineScaleSetVMInstanceIDs] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.OkResponse]: + """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. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :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.models.VirtualMachineScaleSetVMInstanceIDs + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns OkResponse. The OkResponse is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.OkResponse] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_perform_maintenance( + self, + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional[JSON] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.OkResponse]: + """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. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :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: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns OkResponse. The OkResponse is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.OkResponse] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_perform_maintenance( + self, + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.OkResponse]: + """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. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :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: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns OkResponse. The OkResponse is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.OkResponse] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_perform_maintenance( + self, + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional[Union[_models.VirtualMachineScaleSetVMInstanceIDs, JSON, IO[bytes]]] = None, + **kwargs: Any + ) -> LROPoller[_models.OkResponse]: + """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. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param vm_instance_i_ds: A list of virtual machine instance IDs from the VM scale set. Is one + of the following types: VirtualMachineScaleSetVMInstanceIDs, JSON, IO[bytes] Default value is + None. + :type vm_instance_i_ds: ~azure.mgmt.compute.models.VirtualMachineScaleSetVMInstanceIDs or JSON + or IO[bytes] + :return: An instance of LROPoller that returns OkResponse. The OkResponse is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.OkResponse] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + content_type = content_type if vm_instance_i_ds else None + cls: ClsType[_models.OkResponse] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._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, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = _deserialize(_models.OkResponse, response.json()) + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.OkResponse].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.OkResponse]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _power_off_initial( + self, + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional[Union[_models.VirtualMachineScaleSetVMInstanceIDs, JSON, IO[bytes]]] = None, + *, + skip_shutdown: Optional[bool] = None, + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + content_type = content_type if vm_instance_i_ds else None + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" if vm_instance_i_ds else None + _content = None + if isinstance(vm_instance_i_ds, (IOBase, bytes)): + _content = vm_instance_i_ds + else: + if vm_instance_i_ds is not None: + _content = json.dumps(vm_instance_i_ds, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + else: + _content = None + + _request = build_virtual_machine_scale_sets_power_off_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + skip_shutdown=skip_shutdown, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_power_off( + self, + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional[_models.VirtualMachineScaleSetVMInstanceIDs] = None, + *, + skip_shutdown: Optional[bool] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.OkResponse]: + """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. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :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.models.VirtualMachineScaleSetVMInstanceIDs + :keyword 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 None. + :paramtype skip_shutdown: bool + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns OkResponse. The OkResponse is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.OkResponse] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_power_off( + self, + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional[JSON] = None, + *, + skip_shutdown: Optional[bool] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.OkResponse]: + """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. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :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: JSON + :keyword 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 None. + :paramtype skip_shutdown: bool + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns OkResponse. The OkResponse is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.OkResponse] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_power_off( + self, + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional[IO[bytes]] = None, + *, + skip_shutdown: Optional[bool] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.OkResponse]: + """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. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :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: IO[bytes] + :keyword 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 None. + :paramtype skip_shutdown: bool + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns OkResponse. The OkResponse is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.OkResponse] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_power_off( + self, + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional[Union[_models.VirtualMachineScaleSetVMInstanceIDs, JSON, IO[bytes]]] = None, + *, + skip_shutdown: Optional[bool] = None, + **kwargs: Any + ) -> LROPoller[_models.OkResponse]: + """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. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param vm_instance_i_ds: A list of virtual machine instance IDs from the VM scale set. Is one + of the following types: VirtualMachineScaleSetVMInstanceIDs, JSON, IO[bytes] Default value is + None. + :type vm_instance_i_ds: ~azure.mgmt.compute.models.VirtualMachineScaleSetVMInstanceIDs or JSON + or IO[bytes] + :keyword 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 None. + :paramtype skip_shutdown: bool + :return: An instance of LROPoller that returns OkResponse. The OkResponse is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.OkResponse] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + content_type = content_type if vm_instance_i_ds else None + cls: ClsType[_models.OkResponse] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._power_off_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + vm_instance_i_ds=vm_instance_i_ds, + skip_shutdown=skip_shutdown, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = _deserialize(_models.OkResponse, response.json()) + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.OkResponse].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.OkResponse]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _reapply_initial(self, resource_group_name: str, vm_scale_set_name: str, **kwargs: Any) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_virtual_machine_scale_sets_reapply_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_reapply( + self, resource_group_name: str, vm_scale_set_name: str, **kwargs: Any + ) -> LROPoller[_models.OkResponse]: + """Reapplies the Virtual Machine Scale Set Virtual Machine Profile to the Virtual Machine + Instances. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :return: An instance of LROPoller that returns OkResponse. The OkResponse is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.OkResponse] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.OkResponse] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._reapply_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = _deserialize(_models.OkResponse, response.json()) + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.OkResponse].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.OkResponse]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _redeploy_initial( + self, + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional[Union[_models.VirtualMachineScaleSetVMInstanceIDs, JSON, IO[bytes]]] = None, + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + content_type = content_type if vm_instance_i_ds else None + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" if vm_instance_i_ds else None + _content = None + if isinstance(vm_instance_i_ds, (IOBase, bytes)): + _content = vm_instance_i_ds + else: + if vm_instance_i_ds is not None: + _content = json.dumps(vm_instance_i_ds, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + else: + _content = None + + _request = build_virtual_machine_scale_sets_redeploy_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_redeploy( + self, + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional[_models.VirtualMachineScaleSetVMInstanceIDs] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.OkResponse]: + """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. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :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.models.VirtualMachineScaleSetVMInstanceIDs + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns OkResponse. The OkResponse is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.OkResponse] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_redeploy( + self, + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional[JSON] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.OkResponse]: + """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. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :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: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns OkResponse. The OkResponse is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.OkResponse] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_redeploy( + self, + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.OkResponse]: + """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. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :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: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns OkResponse. The OkResponse is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.OkResponse] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_redeploy( + self, + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional[Union[_models.VirtualMachineScaleSetVMInstanceIDs, JSON, IO[bytes]]] = None, + **kwargs: Any + ) -> LROPoller[_models.OkResponse]: + """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. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param vm_instance_i_ds: A list of virtual machine instance IDs from the VM scale set. Is one + of the following types: VirtualMachineScaleSetVMInstanceIDs, JSON, IO[bytes] Default value is + None. + :type vm_instance_i_ds: ~azure.mgmt.compute.models.VirtualMachineScaleSetVMInstanceIDs or JSON + or IO[bytes] + :return: An instance of LROPoller that returns OkResponse. The OkResponse is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.OkResponse] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + content_type = content_type if vm_instance_i_ds else None + cls: ClsType[_models.OkResponse] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._redeploy_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + vm_instance_i_ds=vm_instance_i_ds, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = _deserialize(_models.OkResponse, response.json()) + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.OkResponse].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.OkResponse]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _reimage_initial( + self, + resource_group_name: str, + vm_scale_set_name: str, + vm_scale_set_reimage_input: Optional[ + Union[_models.VirtualMachineScaleSetReimageParameters, JSON, IO[bytes]] + ] = None, + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + content_type = content_type if vm_scale_set_reimage_input else None + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" if vm_scale_set_reimage_input else None + _content = None + if isinstance(vm_scale_set_reimage_input, (IOBase, bytes)): + _content = vm_scale_set_reimage_input + else: + if vm_scale_set_reimage_input is not None: + _content = json.dumps(vm_scale_set_reimage_input, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + else: + _content = None + + _request = build_virtual_machine_scale_sets_reimage_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_reimage( + self, + resource_group_name: str, + vm_scale_set_name: str, + vm_scale_set_reimage_input: Optional[_models.VirtualMachineScaleSetReimageParameters] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.OkResponse]: + """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. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :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.models.VirtualMachineScaleSetReimageParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns OkResponse. The OkResponse is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.OkResponse] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_reimage( + self, + resource_group_name: str, + vm_scale_set_name: str, + vm_scale_set_reimage_input: Optional[JSON] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.OkResponse]: + """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. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :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: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns OkResponse. The OkResponse is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.OkResponse] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_reimage( + self, + resource_group_name: str, + vm_scale_set_name: str, + vm_scale_set_reimage_input: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.OkResponse]: + """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. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :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: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns OkResponse. The OkResponse is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.OkResponse] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_reimage( + self, + resource_group_name: str, + vm_scale_set_name: str, + vm_scale_set_reimage_input: Optional[ + Union[_models.VirtualMachineScaleSetReimageParameters, JSON, IO[bytes]] + ] = None, + **kwargs: Any + ) -> LROPoller[_models.OkResponse]: + """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. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param vm_scale_set_reimage_input: Parameters for Reimaging VM ScaleSet. Is one of the + following types: VirtualMachineScaleSetReimageParameters, JSON, IO[bytes] Default value is + None. + :type vm_scale_set_reimage_input: + ~azure.mgmt.compute.models.VirtualMachineScaleSetReimageParameters or JSON or IO[bytes] + :return: An instance of LROPoller that returns OkResponse. The OkResponse is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.OkResponse] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + content_type = content_type if vm_scale_set_reimage_input else None + cls: ClsType[_models.OkResponse] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._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, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = _deserialize(_models.OkResponse, response.json()) + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.OkResponse].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.OkResponse]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _reimage_all_initial( + self, + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional[Union[_models.VirtualMachineScaleSetVMInstanceIDs, JSON, IO[bytes]]] = None, + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + content_type = content_type if vm_instance_i_ds else None + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" if vm_instance_i_ds else None + _content = None + if isinstance(vm_instance_i_ds, (IOBase, bytes)): + _content = vm_instance_i_ds + else: + if vm_instance_i_ds is not None: + _content = json.dumps(vm_instance_i_ds, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + else: + _content = None + + _request = build_virtual_machine_scale_sets_reimage_all_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_reimage_all( + self, + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional[_models.VirtualMachineScaleSetVMInstanceIDs] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.OkResponse]: + """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. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :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.models.VirtualMachineScaleSetVMInstanceIDs + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns OkResponse. The OkResponse is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.OkResponse] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_reimage_all( + self, + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional[JSON] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.OkResponse]: + """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. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :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: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns OkResponse. The OkResponse is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.OkResponse] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_reimage_all( + self, + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.OkResponse]: + """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. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :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: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns OkResponse. The OkResponse is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.OkResponse] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_reimage_all( + self, + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional[Union[_models.VirtualMachineScaleSetVMInstanceIDs, JSON, IO[bytes]]] = None, + **kwargs: Any + ) -> LROPoller[_models.OkResponse]: + """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. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param vm_instance_i_ds: A list of virtual machine instance IDs from the VM scale set. Is one + of the following types: VirtualMachineScaleSetVMInstanceIDs, JSON, IO[bytes] Default value is + None. + :type vm_instance_i_ds: ~azure.mgmt.compute.models.VirtualMachineScaleSetVMInstanceIDs or JSON + or IO[bytes] + :return: An instance of LROPoller that returns OkResponse. The OkResponse is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.OkResponse] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + content_type = content_type if vm_instance_i_ds else None + cls: ClsType[_models.OkResponse] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._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, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = _deserialize(_models.OkResponse, response.json()) + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.OkResponse].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.OkResponse]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _restart_initial( + self, + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional[Union[_models.VirtualMachineScaleSetVMInstanceIDs, JSON, IO[bytes]]] = None, + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + content_type = content_type if vm_instance_i_ds else None + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" if vm_instance_i_ds else None + _content = None + if isinstance(vm_instance_i_ds, (IOBase, bytes)): + _content = vm_instance_i_ds + else: + if vm_instance_i_ds is not None: + _content = json.dumps(vm_instance_i_ds, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + else: + _content = None + + _request = build_virtual_machine_scale_sets_restart_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_restart( + self, + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional[_models.VirtualMachineScaleSetVMInstanceIDs] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.OkResponse]: + """Restarts one or more virtual machines in a VM scale set. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :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.models.VirtualMachineScaleSetVMInstanceIDs + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns OkResponse. The OkResponse is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.OkResponse] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_restart( + self, + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional[JSON] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.OkResponse]: + """Restarts one or more virtual machines in a VM scale set. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :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: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns OkResponse. The OkResponse is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.OkResponse] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_restart( + self, + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.OkResponse]: + """Restarts one or more virtual machines in a VM scale set. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :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: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns OkResponse. The OkResponse is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.OkResponse] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_restart( + self, + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional[Union[_models.VirtualMachineScaleSetVMInstanceIDs, JSON, IO[bytes]]] = None, + **kwargs: Any + ) -> LROPoller[_models.OkResponse]: + """Restarts one or more virtual machines in a VM scale set. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param vm_instance_i_ds: A list of virtual machine instance IDs from the VM scale set. Is one + of the following types: VirtualMachineScaleSetVMInstanceIDs, JSON, IO[bytes] Default value is + None. + :type vm_instance_i_ds: ~azure.mgmt.compute.models.VirtualMachineScaleSetVMInstanceIDs or JSON + or IO[bytes] + :return: An instance of LROPoller that returns OkResponse. The OkResponse is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.OkResponse] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + content_type = content_type if vm_instance_i_ds else None + cls: ClsType[_models.OkResponse] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._restart_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + vm_instance_i_ds=vm_instance_i_ds, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = _deserialize(_models.OkResponse, response.json()) + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.OkResponse].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.OkResponse]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _set_orchestration_service_state_initial( + self, + resource_group_name: str, + vm_scale_set_name: str, + body: Union[_models.OrchestrationServiceStateInput, JSON, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_virtual_machine_scale_sets_set_orchestration_service_state_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_set_orchestration_service_state( + self, + resource_group_name: str, + vm_scale_set_name: str, + body: _models.OrchestrationServiceStateInput, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.OkResponse]: + """Changes ServiceState property for a given service. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param body: The input object for SetOrchestrationServiceState API. Required. + :type body: ~azure.mgmt.compute.models.OrchestrationServiceStateInput + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns OkResponse. The OkResponse is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.OkResponse] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_set_orchestration_service_state( + self, + resource_group_name: str, + vm_scale_set_name: str, + body: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.OkResponse]: + """Changes ServiceState property for a given service. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param body: The input object for SetOrchestrationServiceState API. Required. + :type body: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns OkResponse. The OkResponse is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.OkResponse] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_set_orchestration_service_state( + self, + resource_group_name: str, + vm_scale_set_name: str, + body: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.OkResponse]: + """Changes ServiceState property for a given service. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param body: The input object for SetOrchestrationServiceState API. Required. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns OkResponse. The OkResponse is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.OkResponse] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_set_orchestration_service_state( + self, + resource_group_name: str, + vm_scale_set_name: str, + body: Union[_models.OrchestrationServiceStateInput, JSON, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.OkResponse]: + """Changes ServiceState property for a given service. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param body: The input object for SetOrchestrationServiceState API. Is one of the following + types: OrchestrationServiceStateInput, JSON, IO[bytes] Required. + :type body: ~azure.mgmt.compute.models.OrchestrationServiceStateInput or JSON or IO[bytes] + :return: An instance of LROPoller that returns OkResponse. The OkResponse is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.OkResponse] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.OkResponse] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._set_orchestration_service_state_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + body=body, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = _deserialize(_models.OkResponse, response.json()) + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.OkResponse].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.OkResponse]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + @distributed_trace + def list_skus( + self, resource_group_name: str, vm_scale_set_name: str, **kwargs: Any + ) -> ItemPaged["_models.VirtualMachineScaleSetSku"]: + """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. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :return: An iterator like instance of VirtualMachineScaleSetSku + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.models.VirtualMachineScaleSetSku] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.VirtualMachineScaleSetSku]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_virtual_machine_scale_sets_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=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.VirtualMachineScaleSetSku], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + def _start_initial( + self, + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional[Union[_models.VirtualMachineScaleSetVMInstanceIDs, JSON, IO[bytes]]] = None, + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + content_type = content_type if vm_instance_i_ds else None + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" if vm_instance_i_ds else None + _content = None + if isinstance(vm_instance_i_ds, (IOBase, bytes)): + _content = vm_instance_i_ds + else: + if vm_instance_i_ds is not None: + _content = json.dumps(vm_instance_i_ds, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + else: + _content = None + + _request = build_virtual_machine_scale_sets_start_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_start( + self, + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional[_models.VirtualMachineScaleSetVMInstanceIDs] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.OkResponse]: + """Starts one or more virtual machines in a VM scale set. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :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.models.VirtualMachineScaleSetVMInstanceIDs + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns OkResponse. The OkResponse is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.OkResponse] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_start( + self, + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional[JSON] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.OkResponse]: + """Starts one or more virtual machines in a VM scale set. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :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: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns OkResponse. The OkResponse is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.OkResponse] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_start( + self, + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.OkResponse]: + """Starts one or more virtual machines in a VM scale set. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :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: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns OkResponse. The OkResponse is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.OkResponse] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_start( + self, + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional[Union[_models.VirtualMachineScaleSetVMInstanceIDs, JSON, IO[bytes]]] = None, + **kwargs: Any + ) -> LROPoller[_models.OkResponse]: + """Starts one or more virtual machines in a VM scale set. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param vm_instance_i_ds: A list of virtual machine instance IDs from the VM scale set. Is one + of the following types: VirtualMachineScaleSetVMInstanceIDs, JSON, IO[bytes] Default value is + None. + :type vm_instance_i_ds: ~azure.mgmt.compute.models.VirtualMachineScaleSetVMInstanceIDs or JSON + or IO[bytes] + :return: An instance of LROPoller that returns OkResponse. The OkResponse is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.OkResponse] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + content_type = content_type if vm_instance_i_ds else None + cls: ClsType[_models.OkResponse] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._start_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + vm_instance_i_ds=vm_instance_i_ds, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = _deserialize(_models.OkResponse, response.json()) + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.OkResponse].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.OkResponse]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _start_extension_upgrade_initial( + self, resource_group_name: str, vm_scale_set_name: str, **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_virtual_machine_scale_sets_start_extension_upgrade_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_start_extension_upgrade( + self, resource_group_name: str, vm_scale_set_name: str, **kwargs: Any + ) -> LROPoller[_models.OkResponse]: + """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. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :return: An instance of LROPoller that returns OkResponse. The OkResponse is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.OkResponse] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.OkResponse] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._start_extension_upgrade_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = _deserialize(_models.OkResponse, response.json()) + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.OkResponse].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.OkResponse]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _start_os_upgrade_initial( + self, resource_group_name: str, vm_scale_set_name: str, **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_virtual_machine_scale_sets_start_os_upgrade_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_start_os_upgrade( + self, resource_group_name: str, vm_scale_set_name: str, **kwargs: Any + ) -> LROPoller[_models.OkResponse]: + """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. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :return: An instance of LROPoller that returns OkResponse. The OkResponse is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.OkResponse] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.OkResponse] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._start_os_upgrade_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = _deserialize(_models.OkResponse, response.json()) + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.OkResponse].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.OkResponse]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _cancel_initial(self, resource_group_name: str, vm_scale_set_name: str, **kwargs: Any) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_virtual_machine_scale_sets_cancel_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_cancel( + self, resource_group_name: str, vm_scale_set_name: str, **kwargs: Any + ) -> LROPoller[_models.OkResponse]: + """Cancels the current virtual machine scale set rolling upgrade. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :return: An instance of LROPoller that returns OkResponse. The OkResponse is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.OkResponse] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.OkResponse] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._cancel_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = _deserialize(_models.OkResponse, response.json()) + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.OkResponse].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.OkResponse]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + @api_version_validation( + method_added_on="2025-04-01", + params_added_on={ + "2025-04-01": ["api_version", "subscription_id", "resource_group_name", "vm_scale_set_name", "content_type"] + }, + api_versions_list=["2025-04-01"], + ) + def _scale_out_initial( + self, + resource_group_name: str, + vm_scale_set_name: str, + body: Union[_models.VMScaleSetScaleOutInput, JSON, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_virtual_machine_scale_sets_scale_out_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_scale_out( + self, + resource_group_name: str, + vm_scale_set_name: str, + body: _models.VMScaleSetScaleOutInput, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.OkResponse]: + """Scales out one or more virtual machines in a VM scale set. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param body: The input object for ScaleOut API. Required. + :type body: ~azure.mgmt.compute.models.VMScaleSetScaleOutInput + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns OkResponse. The OkResponse is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.OkResponse] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_scale_out( + self, + resource_group_name: str, + vm_scale_set_name: str, + body: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.OkResponse]: + """Scales out one or more virtual machines in a VM scale set. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param body: The input object for ScaleOut API. Required. + :type body: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns OkResponse. The OkResponse is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.OkResponse] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_scale_out( + self, + resource_group_name: str, + vm_scale_set_name: str, + body: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.OkResponse]: + """Scales out one or more virtual machines in a VM scale set. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param body: The input object for ScaleOut API. Required. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns OkResponse. The OkResponse is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.OkResponse] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + @api_version_validation( + method_added_on="2025-04-01", + params_added_on={ + "2025-04-01": ["api_version", "subscription_id", "resource_group_name", "vm_scale_set_name", "content_type"] + }, + api_versions_list=["2025-04-01"], + ) + def begin_scale_out( + self, + resource_group_name: str, + vm_scale_set_name: str, + body: Union[_models.VMScaleSetScaleOutInput, JSON, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.OkResponse]: + """Scales out one or more virtual machines in a VM scale set. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param body: The input object for ScaleOut API. Is one of the following types: + VMScaleSetScaleOutInput, JSON, IO[bytes] Required. + :type body: ~azure.mgmt.compute.models.VMScaleSetScaleOutInput or JSON or IO[bytes] + :return: An instance of LROPoller that returns OkResponse. The OkResponse is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.OkResponse] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.OkResponse] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._scale_out_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + body=body, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = _deserialize(_models.OkResponse, response.json()) + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.OkResponse].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.OkResponse]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + +class RollingUpgradeStatusInfosOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.compute.ComputeClient`'s + :attr:`rolling_upgrade_status_infos` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @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. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :return: RollingUpgradeStatusInfo. The RollingUpgradeStatusInfo is compatible with + MutableMapping + :rtype: ~azure.mgmt.compute.models.RollingUpgradeStatusInfo + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.RollingUpgradeStatusInfo] = kwargs.pop("cls", None) + + _request = build_rolling_upgrade_status_infos_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=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.RollingUpgradeStatusInfo, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + +class VirtualMachineScaleSetExtensionsOperations: # pylint: disable=name-too-long + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.compute.ComputeClient`'s + :attr:`virtual_machine_scale_set_extensions` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @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. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param vmss_extension_name: The name of the VM scale set extension. Required. + :type vmss_extension_name: str + :keyword expand: The expand expression to apply on the operation. Default value is None. + :paramtype expand: str + :return: VirtualMachineScaleSetExtension. The VirtualMachineScaleSetExtension is compatible + with MutableMapping + :rtype: ~azure.mgmt.compute.models.VirtualMachineScaleSetExtension + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.VirtualMachineScaleSetExtension] = kwargs.pop("cls", None) + + _request = build_virtual_machine_scale_set_extensions_get_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + vmss_extension_name=vmss_extension_name, + subscription_id=self._config.subscription_id, + expand=expand, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.VirtualMachineScaleSetExtension, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _create_or_update_initial( + self, + resource_group_name: str, + vm_scale_set_name: str, + vmss_extension_name: str, + resource: Union[_models.VirtualMachineScaleSetExtension, JSON, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(resource, (IOBase, bytes)): + _content = resource + else: + _content = json.dumps(resource, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_virtual_machine_scale_set_extensions_create_or_update_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, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 201: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + vm_scale_set_name: str, + vmss_extension_name: str, + resource: _models.VirtualMachineScaleSetExtension, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """The operation to create or update an extension. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param vmss_extension_name: The name of the VM scale set extension. Required. + :type vmss_extension_name: str + :param resource: Parameters supplied to the Create VM scale set Extension operation. Required. + :type resource: ~azure.mgmt.compute.models.VirtualMachineScaleSetExtension + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + vm_scale_set_name: str, + vmss_extension_name: str, + resource: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """The operation to create or update an extension. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param vmss_extension_name: The name of the VM scale set extension. Required. + :type vmss_extension_name: str + :param resource: Parameters supplied to the Create VM scale set Extension operation. Required. + :type resource: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + vm_scale_set_name: str, + vmss_extension_name: str, + resource: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """The operation to create or update an extension. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param vmss_extension_name: The name of the VM scale set extension. Required. + :type vmss_extension_name: str + :param resource: Parameters supplied to the Create VM scale set Extension operation. Required. + :type resource: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + vm_scale_set_name: str, + vmss_extension_name: str, + resource: Union[_models.VirtualMachineScaleSetExtension, JSON, IO[bytes]], + **kwargs: Any + ) -> LROPoller[None]: + """The operation to create or update an extension. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param vmss_extension_name: The name of the VM scale set extension. Required. + :type vmss_extension_name: str + :param resource: Parameters supplied to the Create VM scale set Extension operation. Is one of + the following types: VirtualMachineScaleSetExtension, JSON, IO[bytes] Required. + :type resource: ~azure.mgmt.compute.models.VirtualMachineScaleSetExtension or JSON or IO[bytes] + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + vmss_extension_name=vmss_extension_name, + resource=resource, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + def _update_initial( + self, + resource_group_name: str, + vm_scale_set_name: str, + vmss_extension_name: str, + properties: Union[_models.VirtualMachineScaleSetExtensionUpdate, JSON, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(properties, (IOBase, bytes)): + _content = properties + else: + _content = json.dumps(properties, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_virtual_machine_scale_set_extensions_update_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, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 201: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_update( + self, + resource_group_name: str, + vm_scale_set_name: str, + vmss_extension_name: str, + properties: _models.VirtualMachineScaleSetExtensionUpdate, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """The operation to update an extension. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param vmss_extension_name: The name of the VM scale set extension. Required. + :type vmss_extension_name: str + :param properties: Parameters supplied to the Update VM scale set Extension operation. + Required. + :type properties: ~azure.mgmt.compute.models.VirtualMachineScaleSetExtensionUpdate + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update( + self, + resource_group_name: str, + vm_scale_set_name: str, + vmss_extension_name: str, + properties: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """The operation to update an extension. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param vmss_extension_name: The name of the VM scale set extension. Required. + :type vmss_extension_name: str + :param properties: Parameters supplied to the Update VM scale set Extension operation. + Required. + :type properties: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update( + self, + resource_group_name: str, + vm_scale_set_name: str, + vmss_extension_name: str, + properties: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """The operation to update an extension. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param vmss_extension_name: The name of the VM scale set extension. Required. + :type vmss_extension_name: str + :param properties: Parameters supplied to the Update VM scale set Extension operation. + Required. + :type properties: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update( + self, + resource_group_name: str, + vm_scale_set_name: str, + vmss_extension_name: str, + properties: Union[_models.VirtualMachineScaleSetExtensionUpdate, JSON, IO[bytes]], + **kwargs: Any + ) -> LROPoller[None]: + """The operation to update an extension. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param vmss_extension_name: The name of the VM scale set extension. Required. + :type vmss_extension_name: str + :param properties: Parameters supplied to the Update VM scale set Extension operation. Is one + of the following types: VirtualMachineScaleSetExtensionUpdate, JSON, IO[bytes] Required. + :type properties: ~azure.mgmt.compute.models.VirtualMachineScaleSetExtensionUpdate or JSON or + IO[bytes] + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._update_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + vmss_extension_name=vmss_extension_name, + properties=properties, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + def _delete_initial( + self, resource_group_name: str, vm_scale_set_name: str, vmss_extension_name: str, **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_virtual_machine_scale_set_extensions_delete_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=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_delete( + 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. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param vmss_extension_name: The name of the VM scale set extension. Required. + :type vmss_extension_name: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + vmss_extension_name=vmss_extension_name, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace + def list( + self, resource_group_name: str, vm_scale_set_name: str, **kwargs: Any + ) -> ItemPaged["_models.VirtualMachineScaleSetExtension"]: + """Gets a list of all extensions in a VM scale set. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :return: An iterator like instance of VirtualMachineScaleSetExtension + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.models.VirtualMachineScaleSetExtension] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.VirtualMachineScaleSetExtension]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_virtual_machine_scale_set_extensions_list_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.VirtualMachineScaleSetExtension], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + +class VirtualMachineScaleSetVMSOperations: # pylint: disable=too-many-public-methods + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.compute.ComputeClient`'s + :attr:`virtual_machine_scale_set_vms` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @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. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. Required. + :type instance_id: str + :keyword 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. Known values are: "instanceView", "userData", and "resiliencyView". Default value is + None. + :paramtype expand: str or ~azure.mgmt.compute.models.InstanceViewTypes + :return: VirtualMachineScaleSetVM. The VirtualMachineScaleSetVM is compatible with + MutableMapping + :rtype: ~azure.mgmt.compute.models.VirtualMachineScaleSetVM + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.VirtualMachineScaleSetVM] = kwargs.pop("cls", None) + + _request = build_virtual_machine_scale_set_vms_get_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + expand=expand, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.VirtualMachineScaleSetVM, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _update_initial( + self, + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + resource: Union[_models.VirtualMachineScaleSetVM, JSON, IO[bytes]], + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + if match_condition == MatchConditions.IfNotModified: + error_map[412] = ResourceModifiedError + elif match_condition == MatchConditions.IfPresent: + error_map[412] = ResourceNotFoundError + elif match_condition == MatchConditions.IfMissing: + error_map[412] = ResourceExistsError + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(resource, (IOBase, bytes)): + _content = resource + else: + _content = json.dumps(resource, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_virtual_machine_scale_set_vms_update_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + etag=etag, + match_condition=match_condition, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_update( + self, + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + resource: _models.VirtualMachineScaleSetVM, + *, + content_type: str = "application/json", + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> LROPoller[None]: + """Updates a virtual machine of a VM scale set. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. Required. + :type instance_id: str + :param resource: Parameters supplied to the Update Virtual Machine Scale Sets VM operation. + Required. + :type resource: ~azure.mgmt.compute.models.VirtualMachineScaleSetVM + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update( + self, + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + resource: JSON, + *, + content_type: str = "application/json", + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> LROPoller[None]: + """Updates a virtual machine of a VM scale set. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. Required. + :type instance_id: str + :param resource: Parameters supplied to the Update Virtual Machine Scale Sets VM operation. + Required. + :type resource: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update( + self, + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + resource: IO[bytes], + *, + content_type: str = "application/json", + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> LROPoller[None]: + """Updates a virtual machine of a VM scale set. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. Required. + :type instance_id: str + :param resource: Parameters supplied to the Update Virtual Machine Scale Sets VM operation. + Required. + :type resource: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update( + self, + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + resource: Union[_models.VirtualMachineScaleSetVM, JSON, IO[bytes]], + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> LROPoller[None]: + """Updates a virtual machine of a VM scale set. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. Required. + :type instance_id: str + :param resource: Parameters supplied to the Update Virtual Machine Scale Sets VM operation. Is + one of the following types: VirtualMachineScaleSetVM, JSON, IO[bytes] Required. + :type resource: ~azure.mgmt.compute.models.VirtualMachineScaleSetVM or JSON or IO[bytes] + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._update_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + resource=resource, + etag=etag, + match_condition=match_condition, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + def _delete_initial( + self, + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + *, + force_deletion: Optional[bool] = None, + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_virtual_machine_scale_set_vms_delete_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + force_deletion=force_deletion, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_delete( + 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. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. Required. + :type instance_id: str + :keyword force_deletion: Optional parameter to force delete a virtual machine from a VM scale + set. (Feature in Preview). Default value is None. + :paramtype force_deletion: bool + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + force_deletion=force_deletion, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # 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 + ) -> ItemPaged["_models.VirtualMachineScaleSetVM"]: + """Gets a list of all virtual machines in a VM scale sets. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param virtual_machine_scale_set_name: The name of the VirtualMachineScaleSet. Required. + :type virtual_machine_scale_set_name: str + :keyword 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. + :paramtype filter: str + :keyword select: The list parameters. Allowed values are 'instanceView', + 'instanceView/statuses'. Default value is None. + :paramtype select: str + :keyword expand: The expand expression to apply to the operation. Allowed values are + 'instanceView'. Default value is None. + :paramtype expand: str + :return: An iterator like instance of VirtualMachineScaleSetVM + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.models.VirtualMachineScaleSetVM] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.VirtualMachineScaleSetVM]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_virtual_machine_scale_set_vms_list_request( + resource_group_name=resource_group_name, + virtual_machine_scale_set_name=virtual_machine_scale_set_name, + subscription_id=self._config.subscription_id, + filter=filter, + select=select, + expand=expand, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.VirtualMachineScaleSetVM], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + def _approve_rolling_upgrade_initial( + self, resource_group_name: str, vm_scale_set_name: str, instance_id: str, **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_virtual_machine_scale_set_vms_approve_rolling_upgrade_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_approve_rolling_upgrade( + self, resource_group_name: str, vm_scale_set_name: str, instance_id: str, **kwargs: Any + ) -> LROPoller[None]: + """Approve upgrade on deferred rolling upgrade for OS disk on a VM scale set instance. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. Required. + :type instance_id: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._approve_rolling_upgrade_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + def _deallocate_initial( + self, resource_group_name: str, vm_scale_set_name: str, instance_id: str, **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_virtual_machine_scale_set_vms_deallocate_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_deallocate( + self, resource_group_name: str, vm_scale_set_name: str, instance_id: str, **kwargs: Any + ) -> LROPoller[_models.OkResponse]: + """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. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. Required. + :type instance_id: str + :return: An instance of LROPoller that returns OkResponse. The OkResponse is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.OkResponse] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.OkResponse] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._deallocate_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = _deserialize(_models.OkResponse, response.json()) + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.OkResponse].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.OkResponse]( + self._client, raw_result, get_long_running_output, polling_method # 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. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. Required. + :type instance_id: str + :return: VirtualMachineScaleSetVMInstanceView. The VirtualMachineScaleSetVMInstanceView is + compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.VirtualMachineScaleSetVMInstanceView + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.VirtualMachineScaleSetVMInstanceView] = kwargs.pop("cls", None) + + _request = build_virtual_machine_scale_set_vms_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=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.VirtualMachineScaleSetVMInstanceView, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _reimage_initial( + self, + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + vm_scale_set_vm_reimage_input: Optional[ + Union[_models.VirtualMachineScaleSetVMReimageParameters, JSON, IO[bytes]] + ] = None, + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + content_type = content_type if vm_scale_set_vm_reimage_input else None + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" if vm_scale_set_vm_reimage_input else None + _content = None + if isinstance(vm_scale_set_vm_reimage_input, (IOBase, bytes)): + _content = vm_scale_set_vm_reimage_input + else: + if vm_scale_set_vm_reimage_input is not None: + _content = json.dumps(vm_scale_set_vm_reimage_input, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + else: + _content = None + + _request = build_virtual_machine_scale_set_vms_reimage_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_reimage( + self, + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + vm_scale_set_vm_reimage_input: Optional[_models.VirtualMachineScaleSetVMReimageParameters] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.OkResponse]: + """Reimages (upgrade the operating system) a specific virtual machine in a VM scale set. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. Required. + :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.models.VirtualMachineScaleSetVMReimageParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns OkResponse. The OkResponse is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.OkResponse] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_reimage( + self, + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + vm_scale_set_vm_reimage_input: Optional[JSON] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.OkResponse]: + """Reimages (upgrade the operating system) a specific virtual machine in a VM scale set. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. Required. + :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: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns OkResponse. The OkResponse is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.OkResponse] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_reimage( + self, + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + vm_scale_set_vm_reimage_input: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.OkResponse]: + """Reimages (upgrade the operating system) a specific virtual machine in a VM scale set. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. Required. + :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: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns OkResponse. The OkResponse is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.OkResponse] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_reimage( + self, + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + vm_scale_set_vm_reimage_input: Optional[ + Union[_models.VirtualMachineScaleSetVMReimageParameters, JSON, IO[bytes]] + ] = None, + **kwargs: Any + ) -> LROPoller[_models.OkResponse]: + """Reimages (upgrade the operating system) a specific virtual machine in a VM scale set. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. Required. + :type instance_id: str + :param vm_scale_set_vm_reimage_input: Parameters for the Reimaging Virtual machine in ScaleSet. + Is one of the following types: VirtualMachineScaleSetVMReimageParameters, JSON, IO[bytes] + Default value is None. + :type vm_scale_set_vm_reimage_input: + ~azure.mgmt.compute.models.VirtualMachineScaleSetVMReimageParameters or JSON or IO[bytes] + :return: An instance of LROPoller that returns OkResponse. The OkResponse is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.OkResponse] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + content_type = content_type if vm_scale_set_vm_reimage_input else None + cls: ClsType[_models.OkResponse] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._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, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = _deserialize(_models.OkResponse, response.json()) + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.OkResponse].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.OkResponse]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _reimage_all_initial( + self, resource_group_name: str, vm_scale_set_name: str, instance_id: str, **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_virtual_machine_scale_set_vms_reimage_all_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_reimage_all( + self, resource_group_name: str, vm_scale_set_name: str, instance_id: str, **kwargs: Any + ) -> LROPoller[_models.OkResponse]: + """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. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. Required. + :type instance_id: str + :return: An instance of LROPoller that returns OkResponse. The OkResponse is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.OkResponse] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.OkResponse] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._reimage_all_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = _deserialize(_models.OkResponse, response.json()) + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.OkResponse].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.OkResponse]( + self._client, raw_result, get_long_running_output, polling_method # 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. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. Required. + :type instance_id: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_virtual_machine_scale_set_vms_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=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + def _attach_detach_data_disks_initial( + self, + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + body: Union[_models.AttachDetachDataDisksRequest, JSON, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_virtual_machine_scale_set_vms_attach_detach_data_disks_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_attach_detach_data_disks( + self, + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + body: _models.AttachDetachDataDisksRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.StorageProfile]: + """Attach and detach data disks to/from a virtual machine in a VM scale set. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. Required. + :type instance_id: str + :param body: Parameters supplied to the attach and detach data disks operation on a Virtual + Machine Scale Sets VM. Required. + :type body: ~azure.mgmt.compute.models.AttachDetachDataDisksRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns StorageProfile. The StorageProfile is compatible + with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.StorageProfile] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_attach_detach_data_disks( + self, + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + body: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.StorageProfile]: + """Attach and detach data disks to/from a virtual machine in a VM scale set. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. Required. + :type instance_id: str + :param body: Parameters supplied to the attach and detach data disks operation on a Virtual + Machine Scale Sets VM. Required. + :type body: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns StorageProfile. The StorageProfile is compatible + with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.StorageProfile] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_attach_detach_data_disks( + self, + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + body: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.StorageProfile]: + """Attach and detach data disks to/from a virtual machine in a VM scale set. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. Required. + :type instance_id: str + :param body: Parameters supplied to the attach and detach data disks operation on a Virtual + Machine Scale Sets VM. Required. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns StorageProfile. The StorageProfile is compatible + with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.StorageProfile] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_attach_detach_data_disks( + self, + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + body: Union[_models.AttachDetachDataDisksRequest, JSON, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.StorageProfile]: + """Attach and detach data disks to/from a virtual machine in a VM scale set. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. Required. + :type instance_id: str + :param body: Parameters supplied to the attach and detach data disks operation on a Virtual + Machine Scale Sets VM. Is one of the following types: AttachDetachDataDisksRequest, JSON, + IO[bytes] Required. + :type body: ~azure.mgmt.compute.models.AttachDetachDataDisksRequest or JSON or IO[bytes] + :return: An instance of LROPoller that returns StorageProfile. The StorageProfile is compatible + with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.StorageProfile] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.StorageProfile] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._attach_detach_data_disks_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + body=body, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = _deserialize(_models.StorageProfile, response.json()) + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.StorageProfile].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.StorageProfile]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _perform_maintenance_initial( + self, resource_group_name: str, vm_scale_set_name: str, instance_id: str, **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_virtual_machine_scale_set_vms_perform_maintenance_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_perform_maintenance( + self, resource_group_name: str, vm_scale_set_name: str, instance_id: str, **kwargs: Any + ) -> LROPoller[_models.OkResponse]: + """Performs maintenance on a virtual machine in a VM scale set. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. Required. + :type instance_id: str + :return: An instance of LROPoller that returns OkResponse. The OkResponse is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.OkResponse] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.OkResponse] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._perform_maintenance_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = _deserialize(_models.OkResponse, response.json()) + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.OkResponse].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.OkResponse]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _power_off_initial( + self, + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + *, + skip_shutdown: Optional[bool] = None, + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_virtual_machine_scale_set_vms_power_off_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + skip_shutdown=skip_shutdown, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_power_off( + self, + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + *, + skip_shutdown: Optional[bool] = None, + **kwargs: Any + ) -> LROPoller[_models.OkResponse]: + """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. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. Required. + :type instance_id: str + :keyword 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 None. + :paramtype skip_shutdown: bool + :return: An instance of LROPoller that returns OkResponse. The OkResponse is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.OkResponse] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.OkResponse] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._power_off_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + skip_shutdown=skip_shutdown, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = _deserialize(_models.OkResponse, response.json()) + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.OkResponse].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.OkResponse]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _redeploy_initial( + self, resource_group_name: str, vm_scale_set_name: str, instance_id: str, **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_virtual_machine_scale_set_vms_redeploy_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_redeploy( + self, resource_group_name: str, vm_scale_set_name: str, instance_id: str, **kwargs: Any + ) -> LROPoller[_models.OkResponse]: + """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. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. Required. + :type instance_id: str + :return: An instance of LROPoller that returns OkResponse. The OkResponse is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.OkResponse] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.OkResponse] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._redeploy_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = _deserialize(_models.OkResponse, response.json()) + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.OkResponse].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.OkResponse]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _restart_initial( + self, resource_group_name: str, vm_scale_set_name: str, instance_id: str, **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_virtual_machine_scale_set_vms_restart_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_restart( + self, resource_group_name: str, vm_scale_set_name: str, instance_id: str, **kwargs: Any + ) -> LROPoller[_models.OkResponse]: + """Restarts a virtual machine in a VM scale set. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. Required. + :type instance_id: str + :return: An instance of LROPoller that returns OkResponse. The OkResponse is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.OkResponse] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.OkResponse] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._restart_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = _deserialize(_models.OkResponse, response.json()) + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.OkResponse].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.OkResponse]( + self._client, raw_result, get_long_running_output, polling_method # 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. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. Required. + :type instance_id: str + :keyword sas_uri_expiration_time_in_minutes: Expiration duration in minutes for the SAS URIs + with a value between 1 to 1440 minutes. **Note:** If not specified, SAS URIs will be generated + with a default expiration duration of 120 minutes. Default value is None. + :paramtype sas_uri_expiration_time_in_minutes: int + :return: RetrieveBootDiagnosticsDataResult. The RetrieveBootDiagnosticsDataResult is compatible + with MutableMapping + :rtype: ~azure.mgmt.compute.models.RetrieveBootDiagnosticsDataResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.RetrieveBootDiagnosticsDataResult] = kwargs.pop("cls", None) + + _request = build_virtual_machine_scale_set_vms_retrieve_boot_diagnostics_data_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + sas_uri_expiration_time_in_minutes=sas_uri_expiration_time_in_minutes, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.RetrieveBootDiagnosticsDataResult, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _start_initial( + self, resource_group_name: str, vm_scale_set_name: str, instance_id: str, **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_virtual_machine_scale_set_vms_start_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_start( + self, resource_group_name: str, vm_scale_set_name: str, instance_id: str, **kwargs: Any + ) -> LROPoller[_models.OkResponse]: + """Starts a virtual machine in a VM scale set. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. Required. + :type instance_id: str + :return: An instance of LROPoller that returns OkResponse. The OkResponse is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.OkResponse] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.OkResponse] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._start_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = _deserialize(_models.OkResponse, response.json()) + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.OkResponse].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.OkResponse]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _run_command_initial( + self, + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + body: Union[_models.RunCommandInput, JSON, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_virtual_machine_scale_set_vms_run_command_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_run_command( + self, + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + body: _models.RunCommandInput, + *, + content_type: 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. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. Required. + :type instance_id: str + :param body: Parameters supplied to the Run command operation. Required. + :type body: ~azure.mgmt.compute.models.RunCommandInput + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns RunCommandResult. The RunCommandResult is + compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.RunCommandResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_run_command( + self, + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + body: JSON, + *, + content_type: 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. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. Required. + :type instance_id: str + :param body: Parameters supplied to the Run command operation. Required. + :type body: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns RunCommandResult. The RunCommandResult is + compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.RunCommandResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_run_command( + self, + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + body: IO[bytes], + *, + content_type: 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. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. Required. + :type instance_id: str + :param body: Parameters supplied to the Run command operation. Required. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns RunCommandResult. The RunCommandResult is + compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.RunCommandResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_run_command( + self, + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + body: Union[_models.RunCommandInput, JSON, IO[bytes]], + **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. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. Required. + :type instance_id: str + :param body: Parameters supplied to the Run command operation. Is one of the following types: + RunCommandInput, JSON, IO[bytes] Required. + :type body: ~azure.mgmt.compute.models.RunCommandInput or JSON or IO[bytes] + :return: An instance of LROPoller that returns RunCommandResult. The RunCommandResult is + compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.RunCommandResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.RunCommandResult] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._run_command_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + body=body, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = _deserialize(_models.RunCommandResult, response.json()) + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.RunCommandResult].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.RunCommandResult]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + +class VirtualMachineScaleSetVMExtensionsOperations: # pylint: disable=name-too-long + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.compute.ComputeClient`'s + :attr:`virtual_machine_scale_set_vm_extensions` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @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. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. Required. + :type instance_id: str + :param vm_extension_name: The name of the virtual machine extension. Required. + :type vm_extension_name: str + :keyword expand: The expand expression to apply on the operation. Default value is None. + :paramtype expand: str + :return: VirtualMachineScaleSetVMExtension. The VirtualMachineScaleSetVMExtension is compatible + with MutableMapping + :rtype: ~azure.mgmt.compute.models.VirtualMachineScaleSetVMExtension + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.VirtualMachineScaleSetVMExtension] = kwargs.pop("cls", None) + + _request = build_virtual_machine_scale_set_vm_extensions_get_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + vm_extension_name=vm_extension_name, + subscription_id=self._config.subscription_id, + expand=expand, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.VirtualMachineScaleSetVMExtension, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _create_or_update_initial( + self, + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + vm_extension_name: str, + resource: Union[_models.VirtualMachineScaleSetVMExtension, JSON, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(resource, (IOBase, bytes)): + _content = resource + else: + _content = json.dumps(resource, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_virtual_machine_scale_set_vm_extensions_create_or_update_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, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 201: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + vm_extension_name: str, + resource: _models.VirtualMachineScaleSetVMExtension, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """The operation to create or update the VMSS VM extension. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. Required. + :type instance_id: str + :param vm_extension_name: The name of the virtual machine extension. Required. + :type vm_extension_name: str + :param resource: Parameters supplied to the Create Virtual Machine Extension operation. + Required. + :type resource: ~azure.mgmt.compute.models.VirtualMachineScaleSetVMExtension + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + vm_extension_name: str, + resource: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """The operation to create or update the VMSS VM extension. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. Required. + :type instance_id: str + :param vm_extension_name: The name of the virtual machine extension. Required. + :type vm_extension_name: str + :param resource: Parameters supplied to the Create Virtual Machine Extension operation. + Required. + :type resource: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + vm_extension_name: str, + resource: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """The operation to create or update the VMSS VM extension. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. Required. + :type instance_id: str + :param vm_extension_name: The name of the virtual machine extension. Required. + :type vm_extension_name: str + :param resource: Parameters supplied to the Create Virtual Machine Extension operation. + Required. + :type resource: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + vm_extension_name: str, + resource: Union[_models.VirtualMachineScaleSetVMExtension, JSON, IO[bytes]], + **kwargs: Any + ) -> LROPoller[None]: + """The operation to create or update the VMSS VM extension. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. Required. + :type instance_id: str + :param vm_extension_name: The name of the virtual machine extension. Required. + :type vm_extension_name: str + :param resource: Parameters supplied to the Create Virtual Machine Extension operation. Is one + of the following types: VirtualMachineScaleSetVMExtension, JSON, IO[bytes] Required. + :type resource: ~azure.mgmt.compute.models.VirtualMachineScaleSetVMExtension or JSON or + IO[bytes] + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._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, + resource=resource, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + def _update_initial( + self, + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + vm_extension_name: str, + properties: Union[_models.VirtualMachineScaleSetVMExtensionUpdate, JSON, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(properties, (IOBase, bytes)): + _content = properties + else: + _content = json.dumps(properties, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_virtual_machine_scale_set_vm_extensions_update_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, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_update( + self, + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + vm_extension_name: str, + properties: _models.VirtualMachineScaleSetVMExtensionUpdate, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """The operation to update the VMSS VM extension. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. Required. + :type instance_id: str + :param vm_extension_name: The name of the virtual machine extension. Required. + :type vm_extension_name: str + :param properties: Parameters supplied to the Update Virtual Machine Extension operation. + Required. + :type properties: ~azure.mgmt.compute.models.VirtualMachineScaleSetVMExtensionUpdate + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update( + self, + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + vm_extension_name: str, + properties: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """The operation to update the VMSS VM extension. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. Required. + :type instance_id: str + :param vm_extension_name: The name of the virtual machine extension. Required. + :type vm_extension_name: str + :param properties: Parameters supplied to the Update Virtual Machine Extension operation. + Required. + :type properties: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update( + self, + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + vm_extension_name: str, + properties: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """The operation to update the VMSS VM extension. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. Required. + :type instance_id: str + :param vm_extension_name: The name of the virtual machine extension. Required. + :type vm_extension_name: str + :param properties: Parameters supplied to the Update Virtual Machine Extension operation. + Required. + :type properties: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update( + self, + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + vm_extension_name: str, + properties: Union[_models.VirtualMachineScaleSetVMExtensionUpdate, JSON, IO[bytes]], + **kwargs: Any + ) -> LROPoller[None]: + """The operation to update the VMSS VM extension. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. Required. + :type instance_id: str + :param vm_extension_name: The name of the virtual machine extension. Required. + :type vm_extension_name: str + :param properties: Parameters supplied to the Update Virtual Machine Extension operation. Is + one of the following types: VirtualMachineScaleSetVMExtensionUpdate, JSON, IO[bytes] Required. + :type properties: ~azure.mgmt.compute.models.VirtualMachineScaleSetVMExtensionUpdate or JSON or + IO[bytes] + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._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, + properties=properties, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + def _delete_initial( + self, resource_group_name: str, vm_scale_set_name: str, instance_id: str, vm_extension_name: str, **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_virtual_machine_scale_set_vm_extensions_delete_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=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_delete( + 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. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. Required. + :type instance_id: str + :param vm_extension_name: The name of the virtual machine extension. Required. + :type vm_extension_name: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + vm_extension_name=vm_extension_name, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # 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 + ) -> ItemPaged["_models.VirtualMachineScaleSetVMExtension"]: + """The operation to get all extensions of an instance in Virtual Machine Scaleset. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. Required. + :type instance_id: str + :keyword expand: The expand expression to apply on the operation. Default value is None. + :paramtype expand: str + :return: An iterator like instance of VirtualMachineScaleSetVMExtension + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.models.VirtualMachineScaleSetVMExtension] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.VirtualMachineScaleSetVMExtension]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_virtual_machine_scale_set_vm_extensions_list_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + expand=expand, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.VirtualMachineScaleSetVMExtension], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + +class VirtualMachinesOperations: # pylint: disable=too-many-public-methods + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.compute.ComputeClient`'s + :attr:`virtual_machines` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @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. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_name: The name of the virtual machine. Required. + :type vm_name: str + :keyword 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. + Known values are: "instanceView", "userData", and "resiliencyView". Default value is None. + :paramtype expand: str or ~azure.mgmt.compute.models.InstanceViewTypes + :return: VirtualMachine. The VirtualMachine is compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.VirtualMachine + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.VirtualMachine] = kwargs.pop("cls", None) + + _request = build_virtual_machines_get_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + expand=expand, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.VirtualMachine, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _create_or_update_initial( + self, + resource_group_name: str, + vm_name: str, + resource: Union[_models.VirtualMachine, JSON, IO[bytes]], + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + if match_condition == MatchConditions.IfNotModified: + error_map[412] = ResourceModifiedError + elif match_condition == MatchConditions.IfPresent: + error_map[412] = ResourceNotFoundError + elif match_condition == MatchConditions.IfMissing: + error_map[412] = ResourceExistsError + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(resource, (IOBase, bytes)): + _content = resource + else: + _content = json.dumps(resource, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_virtual_machines_create_or_update_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + etag=etag, + match_condition=match_condition, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 201: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + vm_name: str, + resource: _models.VirtualMachine, + *, + content_type: str = "application/json", + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> LROPoller[None]: + """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. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_name: The name of the virtual machine. Required. + :type vm_name: str + :param resource: Parameters supplied to the Create Virtual Machine operation. Required. + :type resource: ~azure.mgmt.compute.models.VirtualMachine + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + vm_name: str, + resource: JSON, + *, + content_type: str = "application/json", + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> LROPoller[None]: + """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. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_name: The name of the virtual machine. Required. + :type vm_name: str + :param resource: Parameters supplied to the Create Virtual Machine operation. Required. + :type resource: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + vm_name: str, + resource: IO[bytes], + *, + content_type: str = "application/json", + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> LROPoller[None]: + """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. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_name: The name of the virtual machine. Required. + :type vm_name: str + :param resource: Parameters supplied to the Create Virtual Machine operation. Required. + :type resource: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + vm_name: str, + resource: Union[_models.VirtualMachine, JSON, IO[bytes]], + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> LROPoller[None]: + """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. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_name: The name of the virtual machine. Required. + :type vm_name: str + :param resource: Parameters supplied to the Create Virtual Machine operation. Is one of the + following types: VirtualMachine, JSON, IO[bytes] Required. + :type resource: ~azure.mgmt.compute.models.VirtualMachine or JSON or IO[bytes] + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + resource=resource, + etag=etag, + match_condition=match_condition, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + def _update_initial( + self, + resource_group_name: str, + vm_name: str, + properties: Union[_models.VirtualMachineUpdate, JSON, IO[bytes]], + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + if match_condition == MatchConditions.IfNotModified: + error_map[412] = ResourceModifiedError + elif match_condition == MatchConditions.IfPresent: + error_map[412] = ResourceNotFoundError + elif match_condition == MatchConditions.IfMissing: + error_map[412] = ResourceExistsError + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(properties, (IOBase, bytes)): + _content = properties + else: + _content = json.dumps(properties, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_virtual_machines_update_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + etag=etag, + match_condition=match_condition, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_update( + self, + resource_group_name: str, + vm_name: str, + properties: _models.VirtualMachineUpdate, + *, + content_type: str = "application/json", + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> LROPoller[None]: + """The operation to update a virtual machine. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_name: The name of the virtual machine. Required. + :type vm_name: str + :param properties: Parameters supplied to the Update Virtual Machine operation. Required. + :type properties: ~azure.mgmt.compute.models.VirtualMachineUpdate + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update( + self, + resource_group_name: str, + vm_name: str, + properties: JSON, + *, + content_type: str = "application/json", + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> LROPoller[None]: + """The operation to update a virtual machine. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_name: The name of the virtual machine. Required. + :type vm_name: str + :param properties: Parameters supplied to the Update Virtual Machine operation. Required. + :type properties: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update( + self, + resource_group_name: str, + vm_name: str, + properties: IO[bytes], + *, + content_type: str = "application/json", + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> LROPoller[None]: + """The operation to update a virtual machine. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_name: The name of the virtual machine. Required. + :type vm_name: str + :param properties: Parameters supplied to the Update Virtual Machine operation. Required. + :type properties: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update( + self, + resource_group_name: str, + vm_name: str, + properties: Union[_models.VirtualMachineUpdate, JSON, IO[bytes]], + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> LROPoller[None]: + """The operation to update a virtual machine. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_name: The name of the virtual machine. Required. + :type vm_name: str + :param properties: Parameters supplied to the Update Virtual Machine operation. Is one of the + following types: VirtualMachineUpdate, JSON, IO[bytes] Required. + :type properties: ~azure.mgmt.compute.models.VirtualMachineUpdate or JSON or IO[bytes] + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._update_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + properties=properties, + etag=etag, + match_condition=match_condition, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + def _delete_initial( + self, resource_group_name: str, vm_name: str, *, force_deletion: Optional[bool] = None, **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_virtual_machines_delete_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + force_deletion=force_deletion, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_delete( + 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. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_name: The name of the virtual machine. Required. + :type vm_name: str + :keyword force_deletion: Optional parameter to force delete virtual machines. Default value is + None. + :paramtype force_deletion: bool + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + force_deletion=force_deletion, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace + def list( + self, + resource_group_name: str, + *, + filter: Optional[str] = None, + expand: Optional[Union[str, _models.ExpandTypeForListVMs]] = None, + **kwargs: Any + ) -> ItemPaged["_models.VirtualMachine"]: + """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. The name is case insensitive. + Required. + :type resource_group_name: str + :keyword 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. + :paramtype filter: str + :keyword expand: The expand expression to apply on operation. 'instanceView' enables fetching + run time status of all Virtual Machines, this can only be specified if a valid $filter option + is specified. "instanceView" Default value is None. + :paramtype expand: str or ~azure.mgmt.compute.models.ExpandTypeForListVMs + :return: An iterator like instance of VirtualMachine + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.models.VirtualMachine] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.VirtualMachine]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_virtual_machines_list_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + filter=filter, + expand=expand, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.VirtualMachine], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + @distributed_trace + def list_all( + self, + *, + status_only: Optional[str] = None, + filter: Optional[str] = None, + expand: Optional[Union[str, _models.ExpandTypesForListVMs]] = None, + **kwargs: Any + ) -> ItemPaged["_models.VirtualMachine"]: + """Lists all of the virtual machines in the specified subscription. Use the nextLink property in + the response to get the next page of virtual machines. + + :keyword status_only: statusOnly=true enables fetching run time status of all Virtual Machines + in the subscription. Default value is None. + :paramtype status_only: str + :keyword 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. + :paramtype filter: str + :keyword expand: The expand expression to apply on operation. 'instanceView' enables fetching + run time status of all Virtual Machines, this can only be specified if a valid $filter option + is specified. "instanceView" Default value is None. + :paramtype expand: str or ~azure.mgmt.compute.models.ExpandTypesForListVMs + :return: An iterator like instance of VirtualMachine + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.models.VirtualMachine] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.VirtualMachine]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_virtual_machines_list_all_request( + subscription_id=self._config.subscription_id, + status_only=status_only, + filter=filter, + expand=expand, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.VirtualMachine], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + def _assess_patches_initial(self, resource_group_name: str, vm_name: str, **kwargs: Any) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_virtual_machines_assess_patches_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # 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. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_name: The name of the virtual machine. Required. + :type vm_name: str + :return: An instance of LROPoller that returns VirtualMachineAssessPatchesResult. The + VirtualMachineAssessPatchesResult is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.VirtualMachineAssessPatchesResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.VirtualMachineAssessPatchesResult] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._assess_patches_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = _deserialize(_models.VirtualMachineAssessPatchesResult, response.json()) + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.VirtualMachineAssessPatchesResult].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.VirtualMachineAssessPatchesResult]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _attach_detach_data_disks_initial( + self, + resource_group_name: str, + vm_name: str, + body: Union[_models.AttachDetachDataDisksRequest, JSON, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_virtual_machines_attach_detach_data_disks_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_attach_detach_data_disks( + self, + resource_group_name: str, + vm_name: str, + body: _models.AttachDetachDataDisksRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.StorageProfile]: + """Attach and detach data disks to/from the virtual machine. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_name: The name of the virtual machine. Required. + :type vm_name: str + :param body: Parameters supplied to the attach and detach data disks operation on the virtual + machine. Required. + :type body: ~azure.mgmt.compute.models.AttachDetachDataDisksRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns StorageProfile. The StorageProfile is compatible + with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.StorageProfile] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_attach_detach_data_disks( + self, + resource_group_name: str, + vm_name: str, + body: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.StorageProfile]: + """Attach and detach data disks to/from the virtual machine. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_name: The name of the virtual machine. Required. + :type vm_name: str + :param body: Parameters supplied to the attach and detach data disks operation on the virtual + machine. Required. + :type body: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns StorageProfile. The StorageProfile is compatible + with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.StorageProfile] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_attach_detach_data_disks( + self, + resource_group_name: str, + vm_name: str, + body: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.StorageProfile]: + """Attach and detach data disks to/from the virtual machine. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_name: The name of the virtual machine. Required. + :type vm_name: str + :param body: Parameters supplied to the attach and detach data disks operation on the virtual + machine. Required. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns StorageProfile. The StorageProfile is compatible + with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.StorageProfile] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_attach_detach_data_disks( + self, + resource_group_name: str, + vm_name: str, + body: Union[_models.AttachDetachDataDisksRequest, JSON, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.StorageProfile]: + """Attach and detach data disks to/from the virtual machine. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_name: The name of the virtual machine. Required. + :type vm_name: str + :param body: Parameters supplied to the attach and detach data disks operation on the virtual + machine. Is one of the following types: AttachDetachDataDisksRequest, JSON, IO[bytes] Required. + :type body: ~azure.mgmt.compute.models.AttachDetachDataDisksRequest or JSON or IO[bytes] + :return: An instance of LROPoller that returns StorageProfile. The StorageProfile is compatible + with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.StorageProfile] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.StorageProfile] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._attach_detach_data_disks_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + body=body, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = _deserialize(_models.StorageProfile, response.json()) + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.StorageProfile].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.StorageProfile]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _capture_initial( + self, + resource_group_name: str, + vm_name: str, + body: Union[_models.VirtualMachineCaptureParameters, JSON, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_virtual_machines_capture_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_capture( + self, + resource_group_name: str, + vm_name: str, + body: _models.VirtualMachineCaptureParameters, + *, + content_type: str = "application/json", + **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. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_name: The name of the virtual machine. Required. + :type vm_name: str + :param body: Parameters supplied to the Capture Virtual Machine operation. Required. + :type body: ~azure.mgmt.compute.models.VirtualMachineCaptureParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns VirtualMachineCaptureResult. The + VirtualMachineCaptureResult is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.VirtualMachineCaptureResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_capture( + self, + resource_group_name: str, + vm_name: str, + body: JSON, + *, + content_type: str = "application/json", + **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. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_name: The name of the virtual machine. Required. + :type vm_name: str + :param body: Parameters supplied to the Capture Virtual Machine operation. Required. + :type body: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns VirtualMachineCaptureResult. The + VirtualMachineCaptureResult is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.VirtualMachineCaptureResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_capture( + self, + resource_group_name: str, + vm_name: str, + body: IO[bytes], + *, + content_type: str = "application/json", + **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. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_name: The name of the virtual machine. Required. + :type vm_name: str + :param body: Parameters supplied to the Capture Virtual Machine operation. Required. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns VirtualMachineCaptureResult. The + VirtualMachineCaptureResult is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.VirtualMachineCaptureResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_capture( + self, + resource_group_name: str, + vm_name: str, + body: Union[_models.VirtualMachineCaptureParameters, JSON, IO[bytes]], + **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. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_name: The name of the virtual machine. Required. + :type vm_name: str + :param body: Parameters supplied to the Capture Virtual Machine operation. Is one of the + following types: VirtualMachineCaptureParameters, JSON, IO[bytes] Required. + :type body: ~azure.mgmt.compute.models.VirtualMachineCaptureParameters or JSON or IO[bytes] + :return: An instance of LROPoller that returns VirtualMachineCaptureResult. The + VirtualMachineCaptureResult is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.VirtualMachineCaptureResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.VirtualMachineCaptureResult] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._capture_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + body=body, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = _deserialize(_models.VirtualMachineCaptureResult, response.json()) + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.VirtualMachineCaptureResult].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.VirtualMachineCaptureResult]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _convert_to_managed_disks_initial( + self, resource_group_name: str, vm_name: str, **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_virtual_machines_convert_to_managed_disks_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_convert_to_managed_disks( + self, resource_group_name: str, vm_name: str, **kwargs: Any + ) -> LROPoller[_models.OkResponse]: + """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. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_name: The name of the virtual machine. Required. + :type vm_name: str + :return: An instance of LROPoller that returns OkResponse. The OkResponse is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.OkResponse] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.OkResponse] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._convert_to_managed_disks_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = _deserialize(_models.OkResponse, response.json()) + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.OkResponse].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.OkResponse]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _deallocate_initial( + self, resource_group_name: str, vm_name: str, *, hibernate: Optional[bool] = None, **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_virtual_machines_deallocate_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + hibernate=hibernate, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_deallocate( + self, resource_group_name: str, vm_name: str, *, hibernate: Optional[bool] = None, **kwargs: Any + ) -> LROPoller[_models.OkResponse]: + """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. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_name: The name of the virtual machine. Required. + :type vm_name: str + :keyword hibernate: Optional parameter to hibernate a virtual machine. Default value is None. + :paramtype hibernate: bool + :return: An instance of LROPoller that returns OkResponse. The OkResponse is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.OkResponse] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.OkResponse] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._deallocate_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + hibernate=hibernate, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = _deserialize(_models.OkResponse, response.json()) + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.OkResponse].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.OkResponse]( + self._client, raw_result, get_long_running_output, polling_method # 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. For Windows, please refer to `Create a + managed image of a generalized VM in Azure + `_. 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. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_name: The name of the virtual machine. Required. + :type vm_name: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_virtual_machines_generalize_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + def _install_patches_initial( + self, + resource_group_name: str, + vm_name: str, + body: Union[_models.VirtualMachineInstallPatchesParameters, JSON, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_virtual_machines_install_patches_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_install_patches( + self, + resource_group_name: str, + vm_name: str, + body: _models.VirtualMachineInstallPatchesParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.VirtualMachineInstallPatchesResult]: + """Installs patches on the VM. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_name: The name of the virtual machine. Required. + :type vm_name: str + :param body: Input for InstallPatches as directly received by the API. Required. + :type body: ~azure.mgmt.compute.models.VirtualMachineInstallPatchesParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns VirtualMachineInstallPatchesResult. The + VirtualMachineInstallPatchesResult is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.VirtualMachineInstallPatchesResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_install_patches( + self, + resource_group_name: str, + vm_name: str, + body: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.VirtualMachineInstallPatchesResult]: + """Installs patches on the VM. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_name: The name of the virtual machine. Required. + :type vm_name: str + :param body: Input for InstallPatches as directly received by the API. Required. + :type body: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns VirtualMachineInstallPatchesResult. The + VirtualMachineInstallPatchesResult is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.VirtualMachineInstallPatchesResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_install_patches( + self, + resource_group_name: str, + vm_name: str, + body: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.VirtualMachineInstallPatchesResult]: + """Installs patches on the VM. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_name: The name of the virtual machine. Required. + :type vm_name: str + :param body: Input for InstallPatches as directly received by the API. Required. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns VirtualMachineInstallPatchesResult. The + VirtualMachineInstallPatchesResult is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.VirtualMachineInstallPatchesResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_install_patches( + self, + resource_group_name: str, + vm_name: str, + body: Union[_models.VirtualMachineInstallPatchesParameters, JSON, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.VirtualMachineInstallPatchesResult]: + """Installs patches on the VM. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_name: The name of the virtual machine. Required. + :type vm_name: str + :param body: Input for InstallPatches as directly received by the API. Is one of the following + types: VirtualMachineInstallPatchesParameters, JSON, IO[bytes] Required. + :type body: ~azure.mgmt.compute.models.VirtualMachineInstallPatchesParameters or JSON or + IO[bytes] + :return: An instance of LROPoller that returns VirtualMachineInstallPatchesResult. The + VirtualMachineInstallPatchesResult is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.VirtualMachineInstallPatchesResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.VirtualMachineInstallPatchesResult] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._install_patches_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + body=body, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = _deserialize(_models.VirtualMachineInstallPatchesResult, response.json()) + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.VirtualMachineInstallPatchesResult].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.VirtualMachineInstallPatchesResult]( + self._client, raw_result, get_long_running_output, polling_method # 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. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_name: The name of the virtual machine. Required. + :type vm_name: str + :return: VirtualMachineInstanceView. The VirtualMachineInstanceView is compatible with + MutableMapping + :rtype: ~azure.mgmt.compute.models.VirtualMachineInstanceView + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.VirtualMachineInstanceView] = kwargs.pop("cls", None) + + _request = build_virtual_machines_instance_view_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.VirtualMachineInstanceView, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _perform_maintenance_initial(self, resource_group_name: str, vm_name: str, **kwargs: Any) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_virtual_machines_perform_maintenance_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_perform_maintenance( + self, resource_group_name: str, vm_name: str, **kwargs: Any + ) -> LROPoller[_models.OkResponse]: + """The operation to perform maintenance on a virtual machine. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_name: The name of the virtual machine. Required. + :type vm_name: str + :return: An instance of LROPoller that returns OkResponse. The OkResponse is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.OkResponse] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.OkResponse] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._perform_maintenance_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = _deserialize(_models.OkResponse, response.json()) + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.OkResponse].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.OkResponse]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _power_off_initial( + self, resource_group_name: str, vm_name: str, *, skip_shutdown: Optional[bool] = None, **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_virtual_machines_power_off_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + skip_shutdown=skip_shutdown, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_power_off( + self, resource_group_name: str, vm_name: str, *, skip_shutdown: Optional[bool] = None, **kwargs: Any + ) -> LROPoller[_models.OkResponse]: + """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. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_name: The name of the virtual machine. Required. + :type vm_name: str + :keyword 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 None. + :paramtype skip_shutdown: bool + :return: An instance of LROPoller that returns OkResponse. The OkResponse is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.OkResponse] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.OkResponse] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._power_off_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + skip_shutdown=skip_shutdown, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = _deserialize(_models.OkResponse, response.json()) + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.OkResponse].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.OkResponse]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _reapply_initial(self, resource_group_name: str, vm_name: str, **kwargs: Any) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_virtual_machines_reapply_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_reapply(self, resource_group_name: str, vm_name: str, **kwargs: Any) -> LROPoller[_models.OkResponse]: + """The operation to reapply a virtual machine's state. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_name: The name of the virtual machine. Required. + :type vm_name: str + :return: An instance of LROPoller that returns OkResponse. The OkResponse is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.OkResponse] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.OkResponse] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._reapply_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = _deserialize(_models.OkResponse, response.json()) + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.OkResponse].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.OkResponse]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _redeploy_initial(self, resource_group_name: str, vm_name: str, **kwargs: Any) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_virtual_machines_redeploy_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_redeploy(self, resource_group_name: str, vm_name: str, **kwargs: Any) -> LROPoller[_models.OkResponse]: + """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. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_name: The name of the virtual machine. Required. + :type vm_name: str + :return: An instance of LROPoller that returns OkResponse. The OkResponse is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.OkResponse] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.OkResponse] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._redeploy_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = _deserialize(_models.OkResponse, response.json()) + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.OkResponse].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.OkResponse]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _reimage_initial( + self, + resource_group_name: str, + vm_name: str, + parameters: Optional[Union[_models.VirtualMachineReimageParameters, JSON, IO[bytes]]] = None, + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + content_type = content_type if parameters else None + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" if parameters else None + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + if parameters is not None: + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + else: + _content = None + + _request = build_virtual_machines_reimage_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_reimage( + self, + resource_group_name: str, + vm_name: str, + parameters: Optional[_models.VirtualMachineReimageParameters] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.OkResponse]: + """Reimages (upgrade the operating system) a virtual machine 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. NOTE: The retaining of old OS disk depends on the value of deleteOption of OS disk. If + deleteOption is detach, the old OS disk will be preserved after reimage. If deleteOption is + delete, the old OS disk will be deleted after reimage. The deleteOption of the OS disk should + be updated accordingly before performing the reimage. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_name: The name of the virtual machine. Required. + :type vm_name: str + :param parameters: Parameters supplied to the Reimage Virtual Machine operation. Default value + is None. + :type parameters: ~azure.mgmt.compute.models.VirtualMachineReimageParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns OkResponse. The OkResponse is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.OkResponse] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_reimage( + self, + resource_group_name: str, + vm_name: str, + parameters: Optional[JSON] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.OkResponse]: + """Reimages (upgrade the operating system) a virtual machine 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. NOTE: The retaining of old OS disk depends on the value of deleteOption of OS disk. If + deleteOption is detach, the old OS disk will be preserved after reimage. If deleteOption is + delete, the old OS disk will be deleted after reimage. The deleteOption of the OS disk should + be updated accordingly before performing the reimage. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_name: The name of the virtual machine. Required. + :type vm_name: str + :param parameters: Parameters supplied to the Reimage Virtual Machine operation. Default value + is None. + :type parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns OkResponse. The OkResponse is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.OkResponse] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_reimage( + self, + resource_group_name: str, + vm_name: str, + parameters: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.OkResponse]: + """Reimages (upgrade the operating system) a virtual machine 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. NOTE: The retaining of old OS disk depends on the value of deleteOption of OS disk. If + deleteOption is detach, the old OS disk will be preserved after reimage. If deleteOption is + delete, the old OS disk will be deleted after reimage. The deleteOption of the OS disk should + be updated accordingly before performing the reimage. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_name: The name of the virtual machine. Required. + :type vm_name: str + :param parameters: Parameters supplied to the Reimage Virtual Machine operation. Default value + is None. + :type parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns OkResponse. The OkResponse is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.OkResponse] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_reimage( + self, + resource_group_name: str, + vm_name: str, + parameters: Optional[Union[_models.VirtualMachineReimageParameters, JSON, IO[bytes]]] = None, + **kwargs: Any + ) -> LROPoller[_models.OkResponse]: + """Reimages (upgrade the operating system) a virtual machine 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. NOTE: The retaining of old OS disk depends on the value of deleteOption of OS disk. If + deleteOption is detach, the old OS disk will be preserved after reimage. If deleteOption is + delete, the old OS disk will be deleted after reimage. The deleteOption of the OS disk should + be updated accordingly before performing the reimage. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_name: The name of the virtual machine. Required. + :type vm_name: str + :param parameters: Parameters supplied to the Reimage Virtual Machine operation. Is one of the + following types: VirtualMachineReimageParameters, JSON, IO[bytes] Default value is None. + :type parameters: ~azure.mgmt.compute.models.VirtualMachineReimageParameters or JSON or + IO[bytes] + :return: An instance of LROPoller that returns OkResponse. The OkResponse is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.OkResponse] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + content_type = content_type if parameters else None + cls: ClsType[_models.OkResponse] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._reimage_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + parameters=parameters, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = _deserialize(_models.OkResponse, response.json()) + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.OkResponse].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.OkResponse]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _restart_initial(self, resource_group_name: str, vm_name: str, **kwargs: Any) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_virtual_machines_restart_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_restart(self, resource_group_name: str, vm_name: str, **kwargs: Any) -> LROPoller[_models.OkResponse]: + """The operation to restart a virtual machine. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_name: The name of the virtual machine. Required. + :type vm_name: str + :return: An instance of LROPoller that returns OkResponse. The OkResponse is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.OkResponse] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.OkResponse] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._restart_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = _deserialize(_models.OkResponse, response.json()) + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.OkResponse].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.OkResponse]( + self._client, raw_result, get_long_running_output, polling_method # 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. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_name: The name of the virtual machine. Required. + :type vm_name: str + :keyword sas_uri_expiration_time_in_minutes: Expiration duration in minutes for the SAS URIs + with a value between 1 to 1440 minutes. **Note:** If not specified, SAS URIs will be generated + with a default expiration duration of 120 minutes. Default value is None. + :paramtype sas_uri_expiration_time_in_minutes: int + :return: RetrieveBootDiagnosticsDataResult. The RetrieveBootDiagnosticsDataResult is compatible + with MutableMapping + :rtype: ~azure.mgmt.compute.models.RetrieveBootDiagnosticsDataResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.RetrieveBootDiagnosticsDataResult] = kwargs.pop("cls", None) + + _request = build_virtual_machines_retrieve_boot_diagnostics_data_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + sas_uri_expiration_time_in_minutes=sas_uri_expiration_time_in_minutes, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.RetrieveBootDiagnosticsDataResult, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # 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. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_name: The name of the virtual machine. Required. + :type vm_name: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_virtual_machines_simulate_eviction_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + def _start_initial(self, resource_group_name: str, vm_name: str, **kwargs: Any) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_virtual_machines_start_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_start(self, resource_group_name: str, vm_name: str, **kwargs: Any) -> LROPoller[_models.OkResponse]: + """The operation to start a virtual machine. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_name: The name of the virtual machine. Required. + :type vm_name: str + :return: An instance of LROPoller that returns OkResponse. The OkResponse is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.OkResponse] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.OkResponse] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._start_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = _deserialize(_models.OkResponse, response.json()) + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.OkResponse].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.OkResponse]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + @distributed_trace + def list_available_sizes( + self, resource_group_name: str, vm_name: str, **kwargs: Any + ) -> ItemPaged["_models.VirtualMachineSize"]: + """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. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_name: The name of the virtual machine. Required. + :type vm_name: str + :return: An iterator like instance of VirtualMachineSize + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.models.VirtualMachineSize] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.VirtualMachineSize]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_virtual_machines_list_available_sizes_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.VirtualMachineSize], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + def _run_command_initial( + self, + resource_group_name: str, + vm_name: str, + body: Union[_models.RunCommandInput, JSON, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_virtual_machines_run_command_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_run_command( + self, + resource_group_name: str, + vm_name: str, + body: _models.RunCommandInput, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.RunCommandResult]: + """Run command on the VM. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_name: The name of the virtual machine. Required. + :type vm_name: str + :param body: Parameters supplied to the Run command operation. Required. + :type body: ~azure.mgmt.compute.models.RunCommandInput + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns RunCommandResult. The RunCommandResult is + compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.RunCommandResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_run_command( + self, + resource_group_name: str, + vm_name: str, + body: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.RunCommandResult]: + """Run command on the VM. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_name: The name of the virtual machine. Required. + :type vm_name: str + :param body: Parameters supplied to the Run command operation. Required. + :type body: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns RunCommandResult. The RunCommandResult is + compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.RunCommandResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_run_command( + self, + resource_group_name: str, + vm_name: str, + body: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.RunCommandResult]: + """Run command on the VM. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_name: The name of the virtual machine. Required. + :type vm_name: str + :param body: Parameters supplied to the Run command operation. Required. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns RunCommandResult. The RunCommandResult is + compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.RunCommandResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_run_command( + self, + resource_group_name: str, + vm_name: str, + body: Union[_models.RunCommandInput, JSON, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.RunCommandResult]: + """Run command on the VM. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_name: The name of the virtual machine. Required. + :type vm_name: str + :param body: Parameters supplied to the Run command operation. Is one of the following types: + RunCommandInput, JSON, IO[bytes] Required. + :type body: ~azure.mgmt.compute.models.RunCommandInput or JSON or IO[bytes] + :return: An instance of LROPoller that returns RunCommandResult. The RunCommandResult is + compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.RunCommandResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.RunCommandResult] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._run_command_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + body=body, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = _deserialize(_models.RunCommandResult, response.json()) + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.RunCommandResult].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.RunCommandResult]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _migrate_to_vm_scale_set_initial( + self, + resource_group_name: str, + vm_name: str, + parameters: Optional[Union[_models.MigrateVMToVirtualMachineScaleSetInput, JSON, IO[bytes]]] = None, + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + content_type = content_type if parameters else None + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" if parameters else None + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + if parameters is not None: + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + else: + _content = None + + _request = build_virtual_machines_migrate_to_vm_scale_set_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_migrate_to_vm_scale_set( + self, + resource_group_name: str, + vm_name: str, + parameters: Optional[_models.MigrateVMToVirtualMachineScaleSetInput] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Migrate a virtual machine from availability set to Flexible Virtual Machine Scale Set. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_name: The name of the virtual machine. Required. + :type vm_name: str + :param parameters: Parameters supplied to the Migrate Virtual Machine operation. Default value + is None. + :type parameters: ~azure.mgmt.compute.models.MigrateVMToVirtualMachineScaleSetInput + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_migrate_to_vm_scale_set( + self, + resource_group_name: str, + vm_name: str, + parameters: Optional[JSON] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Migrate a virtual machine from availability set to Flexible Virtual Machine Scale Set. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_name: The name of the virtual machine. Required. + :type vm_name: str + :param parameters: Parameters supplied to the Migrate Virtual Machine operation. Default value + is None. + :type parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_migrate_to_vm_scale_set( + self, + resource_group_name: str, + vm_name: str, + parameters: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Migrate a virtual machine from availability set to Flexible Virtual Machine Scale Set. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_name: The name of the virtual machine. Required. + :type vm_name: str + :param parameters: Parameters supplied to the Migrate Virtual Machine operation. Default value + is None. + :type parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_migrate_to_vm_scale_set( + self, + resource_group_name: str, + vm_name: str, + parameters: Optional[Union[_models.MigrateVMToVirtualMachineScaleSetInput, JSON, IO[bytes]]] = None, + **kwargs: Any + ) -> LROPoller[None]: + """Migrate a virtual machine from availability set to Flexible Virtual Machine Scale Set. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_name: The name of the virtual machine. Required. + :type vm_name: str + :param parameters: Parameters supplied to the Migrate Virtual Machine operation. Is one of the + following types: MigrateVMToVirtualMachineScaleSetInput, JSON, IO[bytes] Default value is None. + :type parameters: ~azure.mgmt.compute.models.MigrateVMToVirtualMachineScaleSetInput or JSON or + IO[bytes] + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + content_type = content_type if parameters else None + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._migrate_to_vm_scale_set_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + parameters=parameters, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + +class VirtualMachineExtensionsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.compute.ComputeClient`'s + :attr:`virtual_machine_extensions` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @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. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_name: The name of the virtual machine. Required. + :type vm_name: str + :param vm_extension_name: The name of the virtual machine extension. Required. + :type vm_extension_name: str + :keyword expand: The expand expression to apply on the operation. Default value is None. + :paramtype expand: str + :return: VirtualMachineExtension. The VirtualMachineExtension is compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.VirtualMachineExtension + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.VirtualMachineExtension] = kwargs.pop("cls", None) + + _request = build_virtual_machine_extensions_get_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + vm_extension_name=vm_extension_name, + subscription_id=self._config.subscription_id, + expand=expand, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.VirtualMachineExtension, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _create_or_update_initial( + self, + resource_group_name: str, + vm_name: str, + vm_extension_name: str, + resource: Union[_models.VirtualMachineExtension, JSON, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(resource, (IOBase, bytes)): + _content = resource + else: + _content = json.dumps(resource, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_virtual_machine_extensions_create_or_update_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + vm_extension_name=vm_extension_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 201: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + vm_name: str, + vm_extension_name: str, + resource: _models.VirtualMachineExtension, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """The operation to create or update the extension. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_name: The name of the virtual machine. Required. + :type vm_name: str + :param vm_extension_name: The name of the virtual machine extension. Required. + :type vm_extension_name: str + :param resource: Parameters supplied to the Create Virtual Machine Extension operation. + Required. + :type resource: ~azure.mgmt.compute.models.VirtualMachineExtension + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + vm_name: str, + vm_extension_name: str, + resource: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """The operation to create or update the extension. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_name: The name of the virtual machine. Required. + :type vm_name: str + :param vm_extension_name: The name of the virtual machine extension. Required. + :type vm_extension_name: str + :param resource: Parameters supplied to the Create Virtual Machine Extension operation. + Required. + :type resource: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + vm_name: str, + vm_extension_name: str, + resource: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """The operation to create or update the extension. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_name: The name of the virtual machine. Required. + :type vm_name: str + :param vm_extension_name: The name of the virtual machine extension. Required. + :type vm_extension_name: str + :param resource: Parameters supplied to the Create Virtual Machine Extension operation. + Required. + :type resource: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + vm_name: str, + vm_extension_name: str, + resource: Union[_models.VirtualMachineExtension, JSON, IO[bytes]], + **kwargs: Any + ) -> LROPoller[None]: + """The operation to create or update the extension. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_name: The name of the virtual machine. Required. + :type vm_name: str + :param vm_extension_name: The name of the virtual machine extension. Required. + :type vm_extension_name: str + :param resource: Parameters supplied to the Create Virtual Machine Extension operation. Is one + of the following types: VirtualMachineExtension, JSON, IO[bytes] Required. + :type resource: ~azure.mgmt.compute.models.VirtualMachineExtension or JSON or IO[bytes] + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + vm_extension_name=vm_extension_name, + resource=resource, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + def _update_initial( + self, + resource_group_name: str, + vm_name: str, + vm_extension_name: str, + properties: Union[_models.VirtualMachineExtensionUpdate, JSON, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(properties, (IOBase, bytes)): + _content = properties + else: + _content = json.dumps(properties, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_virtual_machine_extensions_update_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + vm_extension_name=vm_extension_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_update( + self, + resource_group_name: str, + vm_name: str, + vm_extension_name: str, + properties: _models.VirtualMachineExtensionUpdate, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """The operation to update the extension. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_name: The name of the virtual machine. Required. + :type vm_name: str + :param vm_extension_name: The name of the virtual machine extension. Required. + :type vm_extension_name: str + :param properties: Parameters supplied to the Update Virtual Machine Extension operation. + Required. + :type properties: ~azure.mgmt.compute.models.VirtualMachineExtensionUpdate + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update( + self, + resource_group_name: str, + vm_name: str, + vm_extension_name: str, + properties: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """The operation to update the extension. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_name: The name of the virtual machine. Required. + :type vm_name: str + :param vm_extension_name: The name of the virtual machine extension. Required. + :type vm_extension_name: str + :param properties: Parameters supplied to the Update Virtual Machine Extension operation. + Required. + :type properties: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update( + self, + resource_group_name: str, + vm_name: str, + vm_extension_name: str, + properties: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """The operation to update the extension. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_name: The name of the virtual machine. Required. + :type vm_name: str + :param vm_extension_name: The name of the virtual machine extension. Required. + :type vm_extension_name: str + :param properties: Parameters supplied to the Update Virtual Machine Extension operation. + Required. + :type properties: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update( + self, + resource_group_name: str, + vm_name: str, + vm_extension_name: str, + properties: Union[_models.VirtualMachineExtensionUpdate, JSON, IO[bytes]], + **kwargs: Any + ) -> LROPoller[None]: + """The operation to update the extension. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_name: The name of the virtual machine. Required. + :type vm_name: str + :param vm_extension_name: The name of the virtual machine extension. Required. + :type vm_extension_name: str + :param properties: Parameters supplied to the Update Virtual Machine Extension operation. Is + one of the following types: VirtualMachineExtensionUpdate, JSON, IO[bytes] Required. + :type properties: ~azure.mgmt.compute.models.VirtualMachineExtensionUpdate or JSON or IO[bytes] + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._update_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + vm_extension_name=vm_extension_name, + properties=properties, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + def _delete_initial( + self, resource_group_name: str, vm_name: str, vm_extension_name: str, **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_virtual_machine_extensions_delete_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=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_delete( + 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. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_name: The name of the virtual machine. Required. + :type vm_name: str + :param vm_extension_name: The name of the virtual machine extension. Required. + :type vm_extension_name: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + vm_extension_name=vm_extension_name, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace + def list( + self, resource_group_name: str, vm_name: str, *, expand: Optional[str] = None, **kwargs: Any + ) -> ItemPaged["_models.VirtualMachineExtension"]: + """The operation to get all extensions of a Virtual Machine. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_name: The name of the virtual machine. Required. + :type vm_name: str + :keyword expand: The expand expression to apply on the operation. Default value is None. + :paramtype expand: str + :return: An iterator like instance of VirtualMachineExtension + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.models.VirtualMachineExtension] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.VirtualMachineExtension]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_virtual_machine_extensions_list_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + expand=expand, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.VirtualMachineExtension], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + +class VirtualMachineExtensionImagesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.compute.ComputeClient`'s + :attr:`virtual_machine_extension_images` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @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 location name. Required. + :type location: str + :param publisher_name: Required. + :type publisher_name: str + :param type: Required. + :type type: str + :param version: Required. + :type version: str + :return: VirtualMachineExtensionImage. The VirtualMachineExtensionImage is compatible with + MutableMapping + :rtype: ~azure.mgmt.compute.models.VirtualMachineExtensionImage + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.VirtualMachineExtensionImage] = kwargs.pop("cls", None) + + _request = build_virtual_machine_extension_images_get_request( + location=location, + publisher_name=publisher_name, + type=type, + version=version, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.VirtualMachineExtensionImage, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # 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 location name. Required. + :type location: str + :param publisher_name: Required. + :type publisher_name: str + :return: list of VirtualMachineExtensionImage + :rtype: list[~azure.mgmt.compute.models.VirtualMachineExtensionImage] + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.VirtualMachineExtensionImage]] = kwargs.pop("cls", None) + + _request = build_virtual_machine_extension_images_list_types_request( + location=location, + publisher_name=publisher_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(List[_models.VirtualMachineExtensionImage], response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # 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 location name. Required. + :type location: str + :param publisher_name: Required. + :type publisher_name: str + :param type: Required. + :type type: str + :keyword filter: The filter to apply on the operation. Default value is None. + :paramtype filter: str + :keyword top: Default value is None. + :paramtype top: int + :keyword orderby: Default value is None. + :paramtype orderby: str + :return: list of VirtualMachineExtensionImage + :rtype: list[~azure.mgmt.compute.models.VirtualMachineExtensionImage] + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.VirtualMachineExtensionImage]] = kwargs.pop("cls", None) + + _request = build_virtual_machine_extension_images_list_versions_request( + location=location, + publisher_name=publisher_name, + type=type, + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + orderby=orderby, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(List[_models.VirtualMachineExtensionImage], response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + +class AvailabilitySetsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.compute.ComputeClient`'s + :attr:`availability_sets` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @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. The name is case insensitive. + Required. + :type resource_group_name: str + :param availability_set_name: The name of the availability set. Required. + :type availability_set_name: str + :return: AvailabilitySet. The AvailabilitySet is compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.AvailabilitySet + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.AvailabilitySet] = kwargs.pop("cls", None) + + _request = build_availability_sets_get_request( + resource_group_name=resource_group_name, + availability_set_name=availability_set_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.AvailabilitySet, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def create_or_update( + self, + resource_group_name: str, + availability_set_name: str, + resource: _models.AvailabilitySet, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.AvailabilitySet: + """Create or update an availability set. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param availability_set_name: The name of the availability set. Required. + :type availability_set_name: str + :param resource: Parameters supplied to the Create Availability Set operation. Required. + :type resource: ~azure.mgmt.compute.models.AvailabilitySet + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: AvailabilitySet. The AvailabilitySet is compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.AvailabilitySet + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update( + self, + resource_group_name: str, + availability_set_name: str, + resource: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.AvailabilitySet: + """Create or update an availability set. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param availability_set_name: The name of the availability set. Required. + :type availability_set_name: str + :param resource: Parameters supplied to the Create Availability Set operation. Required. + :type resource: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: AvailabilitySet. The AvailabilitySet is compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.AvailabilitySet + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update( + self, + resource_group_name: str, + availability_set_name: str, + resource: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.AvailabilitySet: + """Create or update an availability set. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param availability_set_name: The name of the availability set. Required. + :type availability_set_name: str + :param resource: Parameters supplied to the Create Availability Set operation. Required. + :type resource: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: AvailabilitySet. The AvailabilitySet is compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.AvailabilitySet + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create_or_update( + self, + resource_group_name: str, + availability_set_name: str, + resource: Union[_models.AvailabilitySet, JSON, IO[bytes]], + **kwargs: Any + ) -> _models.AvailabilitySet: + """Create or update an availability set. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param availability_set_name: The name of the availability set. Required. + :type availability_set_name: str + :param resource: Parameters supplied to the Create Availability Set operation. Is one of the + following types: AvailabilitySet, JSON, IO[bytes] Required. + :type resource: ~azure.mgmt.compute.models.AvailabilitySet or JSON or IO[bytes] + :return: AvailabilitySet. The AvailabilitySet is compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.AvailabilitySet + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AvailabilitySet] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(resource, (IOBase, bytes)): + _content = resource + else: + _content = json.dumps(resource, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_availability_sets_create_or_update_request( + resource_group_name=resource_group_name, + availability_set_name=availability_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.AvailabilitySet, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def update( + self, + resource_group_name: str, + availability_set_name: str, + properties: _models.AvailabilitySetUpdate, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.AvailabilitySet: + """Update an availability set. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param availability_set_name: The name of the availability set. Required. + :type availability_set_name: str + :param properties: Parameters supplied to the Update Availability Set operation. Required. + :type properties: ~azure.mgmt.compute.models.AvailabilitySetUpdate + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: AvailabilitySet. The AvailabilitySet is compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.AvailabilitySet + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update( + self, + resource_group_name: str, + availability_set_name: str, + properties: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.AvailabilitySet: + """Update an availability set. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param availability_set_name: The name of the availability set. Required. + :type availability_set_name: str + :param properties: Parameters supplied to the Update Availability Set operation. Required. + :type properties: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: AvailabilitySet. The AvailabilitySet is compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.AvailabilitySet + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update( + self, + resource_group_name: str, + availability_set_name: str, + properties: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.AvailabilitySet: + """Update an availability set. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param availability_set_name: The name of the availability set. Required. + :type availability_set_name: str + :param properties: Parameters supplied to the Update Availability Set operation. Required. + :type properties: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: AvailabilitySet. The AvailabilitySet is compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.AvailabilitySet + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def update( + self, + resource_group_name: str, + availability_set_name: str, + properties: Union[_models.AvailabilitySetUpdate, JSON, IO[bytes]], + **kwargs: Any + ) -> _models.AvailabilitySet: + """Update an availability set. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param availability_set_name: The name of the availability set. Required. + :type availability_set_name: str + :param properties: Parameters supplied to the Update Availability Set operation. Is one of the + following types: AvailabilitySetUpdate, JSON, IO[bytes] Required. + :type properties: ~azure.mgmt.compute.models.AvailabilitySetUpdate or JSON or IO[bytes] + :return: AvailabilitySet. The AvailabilitySet is compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.AvailabilitySet + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AvailabilitySet] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(properties, (IOBase, bytes)): + _content = properties + else: + _content = json.dumps(properties, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_availability_sets_update_request( + resource_group_name=resource_group_name, + availability_set_name=availability_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.AvailabilitySet, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # 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. The name is case insensitive. + Required. + :type resource_group_name: str + :param availability_set_name: The name of the availability set. Required. + :type availability_set_name: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_availability_sets_delete_request( + resource_group_name=resource_group_name, + availability_set_name=availability_set_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace + def list(self, resource_group_name: str, **kwargs: Any) -> ItemPaged["_models.AvailabilitySet"]: + """Lists all availability sets in a resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :return: An iterator like instance of AvailabilitySet + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.models.AvailabilitySet] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.AvailabilitySet]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_availability_sets_list_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.AvailabilitySet], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + @distributed_trace + def list_by_subscription( + self, *, expand: Optional[str] = None, **kwargs: Any + ) -> ItemPaged["_models.AvailabilitySet"]: + """Lists all availability sets in a subscription. + + :keyword expand: The expand expression to apply to the operation. Allowed values are + 'instanceView'. Default value is None. + :paramtype expand: str + :return: An iterator like instance of AvailabilitySet + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.models.AvailabilitySet] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.AvailabilitySet]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_availability_sets_list_by_subscription_request( + subscription_id=self._config.subscription_id, + expand=expand, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.AvailabilitySet], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + @distributed_trace + def list_available_sizes( + self, resource_group_name: str, availability_set_name: str, **kwargs: Any + ) -> ItemPaged["_models.VirtualMachineSize"]: + """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. The name is case insensitive. + Required. + :type resource_group_name: str + :param availability_set_name: The name of the availability set. Required. + :type availability_set_name: str + :return: An iterator like instance of VirtualMachineSize + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.models.VirtualMachineSize] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.VirtualMachineSize]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_availability_sets_list_available_sizes_request( + resource_group_name=resource_group_name, + availability_set_name=availability_set_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.VirtualMachineSize], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + @overload + def start_migration_to_virtual_machine_scale_set( # pylint: disable=name-too-long + self, + resource_group_name: str, + availability_set_name: str, + body: _models.MigrateToVirtualMachineScaleSetInput, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> None: + """Start migration operation on an Availability Set to move its Virtual Machines to a Virtual + Machine Scale Set. This should be followed by a migrate operation on each Virtual Machine that + triggers a downtime on the Virtual Machine. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param availability_set_name: The name of the availability set. Required. + :type availability_set_name: str + :param body: Parameters supplied to the migrate operation on the availability set. Required. + :type body: ~azure.mgmt.compute.models.MigrateToVirtualMachineScaleSetInput + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def start_migration_to_virtual_machine_scale_set( # pylint: disable=name-too-long + self, + resource_group_name: str, + availability_set_name: str, + body: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> None: + """Start migration operation on an Availability Set to move its Virtual Machines to a Virtual + Machine Scale Set. This should be followed by a migrate operation on each Virtual Machine that + triggers a downtime on the Virtual Machine. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param availability_set_name: The name of the availability set. Required. + :type availability_set_name: str + :param body: Parameters supplied to the migrate operation on the availability set. Required. + :type body: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def start_migration_to_virtual_machine_scale_set( # pylint: disable=name-too-long + self, + resource_group_name: str, + availability_set_name: str, + body: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> None: + """Start migration operation on an Availability Set to move its Virtual Machines to a Virtual + Machine Scale Set. This should be followed by a migrate operation on each Virtual Machine that + triggers a downtime on the Virtual Machine. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param availability_set_name: The name of the availability set. Required. + :type availability_set_name: str + :param body: Parameters supplied to the migrate operation on the availability set. Required. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def start_migration_to_virtual_machine_scale_set( # pylint: disable=inconsistent-return-statements,name-too-long + self, + resource_group_name: str, + availability_set_name: str, + body: Union[_models.MigrateToVirtualMachineScaleSetInput, JSON, IO[bytes]], + **kwargs: Any + ) -> None: + """Start migration operation on an Availability Set to move its Virtual Machines to a Virtual + Machine Scale Set. This should be followed by a migrate operation on each Virtual Machine that + triggers a downtime on the Virtual Machine. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param availability_set_name: The name of the availability set. Required. + :type availability_set_name: str + :param body: Parameters supplied to the migrate operation on the availability set. Is one of + the following types: MigrateToVirtualMachineScaleSetInput, JSON, IO[bytes] Required. + :type body: ~azure.mgmt.compute.models.MigrateToVirtualMachineScaleSetInput or JSON or + IO[bytes] + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_availability_sets_start_migration_to_virtual_machine_scale_set_request( + resource_group_name=resource_group_name, + availability_set_name=availability_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace + def cancel_migration_to_virtual_machine_scale_set( # pylint: disable=inconsistent-return-statements,name-too-long + self, resource_group_name: str, availability_set_name: str, **kwargs: Any + ) -> None: + """Cancel the migration operation on an Availability Set. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param availability_set_name: The name of the availability set. Required. + :type availability_set_name: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_availability_sets_cancel_migration_to_virtual_machine_scale_set_request( + resource_group_name=resource_group_name, + availability_set_name=availability_set_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @overload + def validate_migration_to_virtual_machine_scale_set( # pylint: disable=name-too-long + self, + resource_group_name: str, + availability_set_name: str, + body: _models.MigrateToVirtualMachineScaleSetInput, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> None: + """Validates that the Virtual Machines in the Availability Set can be migrated to the provided + Virtual Machine Scale Set. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param availability_set_name: The name of the availability set. Required. + :type availability_set_name: str + :param body: Parameters supplied to the migrate operation on the availability set. Required. + :type body: ~azure.mgmt.compute.models.MigrateToVirtualMachineScaleSetInput + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def validate_migration_to_virtual_machine_scale_set( # pylint: disable=name-too-long + self, + resource_group_name: str, + availability_set_name: str, + body: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> None: + """Validates that the Virtual Machines in the Availability Set can be migrated to the provided + Virtual Machine Scale Set. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param availability_set_name: The name of the availability set. Required. + :type availability_set_name: str + :param body: Parameters supplied to the migrate operation on the availability set. Required. + :type body: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def validate_migration_to_virtual_machine_scale_set( # pylint: disable=name-too-long + self, + resource_group_name: str, + availability_set_name: str, + body: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> None: + """Validates that the Virtual Machines in the Availability Set can be migrated to the provided + Virtual Machine Scale Set. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param availability_set_name: The name of the availability set. Required. + :type availability_set_name: str + :param body: Parameters supplied to the migrate operation on the availability set. Required. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def validate_migration_to_virtual_machine_scale_set( # pylint: disable=inconsistent-return-statements,name-too-long + self, + resource_group_name: str, + availability_set_name: str, + body: Union[_models.MigrateToVirtualMachineScaleSetInput, JSON, IO[bytes]], + **kwargs: Any + ) -> None: + """Validates that the Virtual Machines in the Availability Set can be migrated to the provided + Virtual Machine Scale Set. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param availability_set_name: The name of the availability set. Required. + :type availability_set_name: str + :param body: Parameters supplied to the migrate operation on the availability set. Is one of + the following types: MigrateToVirtualMachineScaleSetInput, JSON, IO[bytes] Required. + :type body: ~azure.mgmt.compute.models.MigrateToVirtualMachineScaleSetInput or JSON or + IO[bytes] + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_availability_sets_validate_migration_to_virtual_machine_scale_set_request( + resource_group_name=resource_group_name, + availability_set_name=availability_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + def _convert_to_virtual_machine_scale_set_initial( # pylint: disable=name-too-long + self, + resource_group_name: str, + availability_set_name: str, + parameters: Optional[Union[_models.ConvertToVirtualMachineScaleSetInput, JSON, IO[bytes]]] = None, + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + content_type = content_type if parameters else None + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" if parameters else None + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + if parameters is not None: + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + else: + _content = None + + _request = build_availability_sets_convert_to_virtual_machine_scale_set_request( + resource_group_name=resource_group_name, + availability_set_name=availability_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_convert_to_virtual_machine_scale_set( # pylint: disable=name-too-long + self, + resource_group_name: str, + availability_set_name: str, + parameters: Optional[_models.ConvertToVirtualMachineScaleSetInput] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Create a new Flexible Virtual Machine Scale Set and migrate all the Virtual Machines in the + Availability Set. This does not trigger a downtime on the Virtual Machines. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param availability_set_name: The name of the availability set. Required. + :type availability_set_name: str + :param parameters: Parameters supplied to the migrate operation on the availability set. + Default value is None. + :type parameters: ~azure.mgmt.compute.models.ConvertToVirtualMachineScaleSetInput + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_convert_to_virtual_machine_scale_set( # pylint: disable=name-too-long + self, + resource_group_name: str, + availability_set_name: str, + parameters: Optional[JSON] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Create a new Flexible Virtual Machine Scale Set and migrate all the Virtual Machines in the + Availability Set. This does not trigger a downtime on the Virtual Machines. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param availability_set_name: The name of the availability set. Required. + :type availability_set_name: str + :param parameters: Parameters supplied to the migrate operation on the availability set. + Default value is None. + :type parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_convert_to_virtual_machine_scale_set( # pylint: disable=name-too-long + self, + resource_group_name: str, + availability_set_name: str, + parameters: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Create a new Flexible Virtual Machine Scale Set and migrate all the Virtual Machines in the + Availability Set. This does not trigger a downtime on the Virtual Machines. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param availability_set_name: The name of the availability set. Required. + :type availability_set_name: str + :param parameters: Parameters supplied to the migrate operation on the availability set. + Default value is None. + :type parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_convert_to_virtual_machine_scale_set( # pylint: disable=name-too-long + self, + resource_group_name: str, + availability_set_name: str, + parameters: Optional[Union[_models.ConvertToVirtualMachineScaleSetInput, JSON, IO[bytes]]] = None, + **kwargs: Any + ) -> LROPoller[None]: + """Create a new Flexible Virtual Machine Scale Set and migrate all the Virtual Machines in the + Availability Set. This does not trigger a downtime on the Virtual Machines. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param availability_set_name: The name of the availability set. Required. + :type availability_set_name: str + :param parameters: Parameters supplied to the migrate operation on the availability set. Is one + of the following types: ConvertToVirtualMachineScaleSetInput, JSON, IO[bytes] Default value is + None. + :type parameters: ~azure.mgmt.compute.models.ConvertToVirtualMachineScaleSetInput or JSON or + IO[bytes] + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + content_type = content_type if parameters else None + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._convert_to_virtual_machine_scale_set_initial( + resource_group_name=resource_group_name, + availability_set_name=availability_set_name, + parameters=parameters, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + +class ProximityPlacementGroupsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.compute.ComputeClient`'s + :attr:`proximity_placement_groups` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @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. The name is case insensitive. + Required. + :type resource_group_name: str + :param proximity_placement_group_name: The name of the proximity placement group. Required. + :type proximity_placement_group_name: str + :keyword include_colocation_status: includeColocationStatus=true enables fetching the + colocation status of all the resources in the proximity placement group. Default value is None. + :paramtype include_colocation_status: str + :return: ProximityPlacementGroup. The ProximityPlacementGroup is compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.ProximityPlacementGroup + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.ProximityPlacementGroup] = kwargs.pop("cls", None) + + _request = build_proximity_placement_groups_get_request( + resource_group_name=resource_group_name, + proximity_placement_group_name=proximity_placement_group_name, + subscription_id=self._config.subscription_id, + include_colocation_status=include_colocation_status, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.ProximityPlacementGroup, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def create_or_update( + self, + resource_group_name: str, + proximity_placement_group_name: str, + resource: _models.ProximityPlacementGroup, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ProximityPlacementGroup: + """Create or update a proximity placement group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param proximity_placement_group_name: The name of the proximity placement group. Required. + :type proximity_placement_group_name: str + :param resource: Parameters supplied to the Create Proximity Placement Group operation. + Required. + :type resource: ~azure.mgmt.compute.models.ProximityPlacementGroup + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: ProximityPlacementGroup. The ProximityPlacementGroup is compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.ProximityPlacementGroup + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update( + self, + resource_group_name: str, + proximity_placement_group_name: str, + resource: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ProximityPlacementGroup: + """Create or update a proximity placement group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param proximity_placement_group_name: The name of the proximity placement group. Required. + :type proximity_placement_group_name: str + :param resource: Parameters supplied to the Create Proximity Placement Group operation. + Required. + :type resource: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: ProximityPlacementGroup. The ProximityPlacementGroup is compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.ProximityPlacementGroup + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update( + self, + resource_group_name: str, + proximity_placement_group_name: str, + resource: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ProximityPlacementGroup: + """Create or update a proximity placement group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param proximity_placement_group_name: The name of the proximity placement group. Required. + :type proximity_placement_group_name: str + :param resource: Parameters supplied to the Create Proximity Placement Group operation. + Required. + :type resource: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: ProximityPlacementGroup. The ProximityPlacementGroup is compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.ProximityPlacementGroup + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create_or_update( + self, + resource_group_name: str, + proximity_placement_group_name: str, + resource: Union[_models.ProximityPlacementGroup, JSON, IO[bytes]], + **kwargs: Any + ) -> _models.ProximityPlacementGroup: + """Create or update a proximity placement group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param proximity_placement_group_name: The name of the proximity placement group. Required. + :type proximity_placement_group_name: str + :param resource: Parameters supplied to the Create Proximity Placement Group operation. Is one + of the following types: ProximityPlacementGroup, JSON, IO[bytes] Required. + :type resource: ~azure.mgmt.compute.models.ProximityPlacementGroup or JSON or IO[bytes] + :return: ProximityPlacementGroup. The ProximityPlacementGroup is compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.ProximityPlacementGroup + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ProximityPlacementGroup] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(resource, (IOBase, bytes)): + _content = resource + else: + _content = json.dumps(resource, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_proximity_placement_groups_create_or_update_request( + resource_group_name=resource_group_name, + proximity_placement_group_name=proximity_placement_group_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.ProximityPlacementGroup, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def update( + self, + resource_group_name: str, + proximity_placement_group_name: str, + properties: _models.ProximityPlacementGroupUpdate, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ProximityPlacementGroup: + """Update a proximity placement group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param proximity_placement_group_name: The name of the proximity placement group. Required. + :type proximity_placement_group_name: str + :param properties: Parameters supplied to the Update Proximity Placement Group operation. + Required. + :type properties: ~azure.mgmt.compute.models.ProximityPlacementGroupUpdate + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: ProximityPlacementGroup. The ProximityPlacementGroup is compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.ProximityPlacementGroup + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update( + self, + resource_group_name: str, + proximity_placement_group_name: str, + properties: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ProximityPlacementGroup: + """Update a proximity placement group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param proximity_placement_group_name: The name of the proximity placement group. Required. + :type proximity_placement_group_name: str + :param properties: Parameters supplied to the Update Proximity Placement Group operation. + Required. + :type properties: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: ProximityPlacementGroup. The ProximityPlacementGroup is compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.ProximityPlacementGroup + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update( + self, + resource_group_name: str, + proximity_placement_group_name: str, + properties: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ProximityPlacementGroup: + """Update a proximity placement group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param proximity_placement_group_name: The name of the proximity placement group. Required. + :type proximity_placement_group_name: str + :param properties: Parameters supplied to the Update Proximity Placement Group operation. + Required. + :type properties: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: ProximityPlacementGroup. The ProximityPlacementGroup is compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.ProximityPlacementGroup + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def update( + self, + resource_group_name: str, + proximity_placement_group_name: str, + properties: Union[_models.ProximityPlacementGroupUpdate, JSON, IO[bytes]], + **kwargs: Any + ) -> _models.ProximityPlacementGroup: + """Update a proximity placement group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param proximity_placement_group_name: The name of the proximity placement group. Required. + :type proximity_placement_group_name: str + :param properties: Parameters supplied to the Update Proximity Placement Group operation. Is + one of the following types: ProximityPlacementGroupUpdate, JSON, IO[bytes] Required. + :type properties: ~azure.mgmt.compute.models.ProximityPlacementGroupUpdate or JSON or IO[bytes] + :return: ProximityPlacementGroup. The ProximityPlacementGroup is compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.ProximityPlacementGroup + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ProximityPlacementGroup] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(properties, (IOBase, bytes)): + _content = properties + else: + _content = json.dumps(properties, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_proximity_placement_groups_update_request( + resource_group_name=resource_group_name, + proximity_placement_group_name=proximity_placement_group_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.ProximityPlacementGroup, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # 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. The name is case insensitive. + Required. + :type resource_group_name: str + :param proximity_placement_group_name: The name of the proximity placement group. Required. + :type proximity_placement_group_name: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_proximity_placement_groups_delete_request( + resource_group_name=resource_group_name, + proximity_placement_group_name=proximity_placement_group_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace + def list_by_resource_group( + self, resource_group_name: str, **kwargs: Any + ) -> ItemPaged["_models.ProximityPlacementGroup"]: + """Lists all proximity placement groups in a resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :return: An iterator like instance of ProximityPlacementGroup + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.models.ProximityPlacementGroup] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.ProximityPlacementGroup]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_proximity_placement_groups_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.ProximityPlacementGroup], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + @distributed_trace + def list_by_subscription(self, **kwargs: Any) -> ItemPaged["_models.ProximityPlacementGroup"]: + """Lists all proximity placement groups in a subscription. + + :return: An iterator like instance of ProximityPlacementGroup + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.models.ProximityPlacementGroup] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.ProximityPlacementGroup]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_proximity_placement_groups_list_by_subscription_request( + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.ProximityPlacementGroup], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + +class DedicatedHostGroupsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.compute.ComputeClient`'s + :attr:`dedicated_host_groups` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @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. The name is case insensitive. + Required. + :type resource_group_name: str + :param host_group_name: The name of the dedicated host group. Required. + :type host_group_name: str + :keyword 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. Known values are: "instanceView", "userData", and + "resiliencyView". Default value is None. + :paramtype expand: str or ~azure.mgmt.compute.models.InstanceViewTypes + :return: DedicatedHostGroup. The DedicatedHostGroup is compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.DedicatedHostGroup + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.DedicatedHostGroup] = kwargs.pop("cls", None) + + _request = build_dedicated_host_groups_get_request( + resource_group_name=resource_group_name, + host_group_name=host_group_name, + subscription_id=self._config.subscription_id, + expand=expand, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.DedicatedHostGroup, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def create_or_update( + self, + resource_group_name: str, + host_group_name: str, + resource: _models.DedicatedHostGroup, + *, + content_type: str = "application/json", + **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. The name is case insensitive. + Required. + :type resource_group_name: str + :param host_group_name: The name of the dedicated host group. Required. + :type host_group_name: str + :param resource: Parameters supplied to the Create Dedicated Host Group. Required. + :type resource: ~azure.mgmt.compute.models.DedicatedHostGroup + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: DedicatedHostGroup. The DedicatedHostGroup is compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.DedicatedHostGroup + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update( + self, + resource_group_name: str, + host_group_name: str, + resource: JSON, + *, + content_type: str = "application/json", + **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. The name is case insensitive. + Required. + :type resource_group_name: str + :param host_group_name: The name of the dedicated host group. Required. + :type host_group_name: str + :param resource: Parameters supplied to the Create Dedicated Host Group. Required. + :type resource: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: DedicatedHostGroup. The DedicatedHostGroup is compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.DedicatedHostGroup + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update( + self, + resource_group_name: str, + host_group_name: str, + resource: IO[bytes], + *, + content_type: str = "application/json", + **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. The name is case insensitive. + Required. + :type resource_group_name: str + :param host_group_name: The name of the dedicated host group. Required. + :type host_group_name: str + :param resource: Parameters supplied to the Create Dedicated Host Group. Required. + :type resource: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: DedicatedHostGroup. The DedicatedHostGroup is compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.DedicatedHostGroup + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create_or_update( + self, + resource_group_name: str, + host_group_name: str, + resource: Union[_models.DedicatedHostGroup, JSON, IO[bytes]], + **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. The name is case insensitive. + Required. + :type resource_group_name: str + :param host_group_name: The name of the dedicated host group. Required. + :type host_group_name: str + :param resource: Parameters supplied to the Create Dedicated Host Group. Is one of the + following types: DedicatedHostGroup, JSON, IO[bytes] Required. + :type resource: ~azure.mgmt.compute.models.DedicatedHostGroup or JSON or IO[bytes] + :return: DedicatedHostGroup. The DedicatedHostGroup is compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.DedicatedHostGroup + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.DedicatedHostGroup] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(resource, (IOBase, bytes)): + _content = resource + else: + _content = json.dumps(resource, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_dedicated_host_groups_create_or_update_request( + resource_group_name=resource_group_name, + host_group_name=host_group_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.DedicatedHostGroup, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def update( + self, + resource_group_name: str, + host_group_name: str, + properties: _models.DedicatedHostGroupUpdate, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.DedicatedHostGroup: + """Update an dedicated host group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param host_group_name: The name of the dedicated host group. Required. + :type host_group_name: str + :param properties: Parameters supplied to the Update Dedicated Host Group operation. Required. + :type properties: ~azure.mgmt.compute.models.DedicatedHostGroupUpdate + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: DedicatedHostGroup. The DedicatedHostGroup is compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.DedicatedHostGroup + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update( + self, + resource_group_name: str, + host_group_name: str, + properties: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.DedicatedHostGroup: + """Update an dedicated host group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param host_group_name: The name of the dedicated host group. Required. + :type host_group_name: str + :param properties: Parameters supplied to the Update Dedicated Host Group operation. Required. + :type properties: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: DedicatedHostGroup. The DedicatedHostGroup is compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.DedicatedHostGroup + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update( + self, + resource_group_name: str, + host_group_name: str, + properties: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.DedicatedHostGroup: + """Update an dedicated host group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param host_group_name: The name of the dedicated host group. Required. + :type host_group_name: str + :param properties: Parameters supplied to the Update Dedicated Host Group operation. Required. + :type properties: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: DedicatedHostGroup. The DedicatedHostGroup is compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.DedicatedHostGroup + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def update( + self, + resource_group_name: str, + host_group_name: str, + properties: Union[_models.DedicatedHostGroupUpdate, JSON, IO[bytes]], + **kwargs: Any + ) -> _models.DedicatedHostGroup: + """Update an dedicated host group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param host_group_name: The name of the dedicated host group. Required. + :type host_group_name: str + :param properties: Parameters supplied to the Update Dedicated Host Group operation. Is one of + the following types: DedicatedHostGroupUpdate, JSON, IO[bytes] Required. + :type properties: ~azure.mgmt.compute.models.DedicatedHostGroupUpdate or JSON or IO[bytes] + :return: DedicatedHostGroup. The DedicatedHostGroup is compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.DedicatedHostGroup + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.DedicatedHostGroup] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(properties, (IOBase, bytes)): + _content = properties + else: + _content = json.dumps(properties, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_dedicated_host_groups_update_request( + resource_group_name=resource_group_name, + host_group_name=host_group_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.DedicatedHostGroup, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # 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. The name is case insensitive. + Required. + :type resource_group_name: str + :param host_group_name: The name of the dedicated host group. Required. + :type host_group_name: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_dedicated_host_groups_delete_request( + resource_group_name=resource_group_name, + host_group_name=host_group_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace + def list_by_resource_group( + self, resource_group_name: str, **kwargs: Any + ) -> ItemPaged["_models.DedicatedHostGroup"]: + """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. The name is case insensitive. + Required. + :type resource_group_name: str + :return: An iterator like instance of DedicatedHostGroup + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.models.DedicatedHostGroup] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.DedicatedHostGroup]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_dedicated_host_groups_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.DedicatedHostGroup], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + @distributed_trace + def list_by_subscription(self, **kwargs: Any) -> ItemPaged["_models.DedicatedHostGroup"]: + """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. + + :return: An iterator like instance of DedicatedHostGroup + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.models.DedicatedHostGroup] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.DedicatedHostGroup]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_dedicated_host_groups_list_by_subscription_request( + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.DedicatedHostGroup], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + +class DedicatedHostsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.compute.ComputeClient`'s + :attr:`dedicated_hosts` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @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. The name is case insensitive. + Required. + :type resource_group_name: str + :param host_group_name: The name of the dedicated host group. Required. + :type host_group_name: str + :param host_name: The name of the dedicated host. Required. + :type host_name: str + :keyword 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. Known values are: "instanceView", "userData", and "resiliencyView". Default value is + None. + :paramtype expand: str or ~azure.mgmt.compute.models.InstanceViewTypes + :return: DedicatedHost. The DedicatedHost is compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.DedicatedHost + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.DedicatedHost] = kwargs.pop("cls", None) + + _request = build_dedicated_hosts_get_request( + resource_group_name=resource_group_name, + host_group_name=host_group_name, + host_name=host_name, + subscription_id=self._config.subscription_id, + expand=expand, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.DedicatedHost, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _create_or_update_initial( + self, + resource_group_name: str, + host_group_name: str, + host_name: str, + resource: Union[_models.DedicatedHost, JSON, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(resource, (IOBase, bytes)): + _content = resource + else: + _content = json.dumps(resource, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_dedicated_hosts_create_or_update_request( + resource_group_name=resource_group_name, + host_group_name=host_group_name, + host_name=host_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 201: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + host_group_name: str, + host_name: str, + resource: _models.DedicatedHost, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Create or update a dedicated host . + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param host_group_name: The name of the dedicated host group. Required. + :type host_group_name: str + :param host_name: The name of the dedicated host. Required. + :type host_name: str + :param resource: Parameters supplied to the Create Dedicated Host. Required. + :type resource: ~azure.mgmt.compute.models.DedicatedHost + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + host_group_name: str, + host_name: str, + resource: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Create or update a dedicated host . + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param host_group_name: The name of the dedicated host group. Required. + :type host_group_name: str + :param host_name: The name of the dedicated host. Required. + :type host_name: str + :param resource: Parameters supplied to the Create Dedicated Host. Required. + :type resource: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + host_group_name: str, + host_name: str, + resource: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Create or update a dedicated host . + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param host_group_name: The name of the dedicated host group. Required. + :type host_group_name: str + :param host_name: The name of the dedicated host. Required. + :type host_name: str + :param resource: Parameters supplied to the Create Dedicated Host. Required. + :type resource: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + host_group_name: str, + host_name: str, + resource: Union[_models.DedicatedHost, JSON, IO[bytes]], + **kwargs: Any + ) -> LROPoller[None]: + """Create or update a dedicated host . + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param host_group_name: The name of the dedicated host group. Required. + :type host_group_name: str + :param host_name: The name of the dedicated host. Required. + :type host_name: str + :param resource: Parameters supplied to the Create Dedicated Host. Is one of the following + types: DedicatedHost, JSON, IO[bytes] Required. + :type resource: ~azure.mgmt.compute.models.DedicatedHost or JSON or IO[bytes] + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + host_group_name=host_group_name, + host_name=host_name, + resource=resource, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + def _update_initial( + self, + resource_group_name: str, + host_group_name: str, + host_name: str, + properties: Union[_models.DedicatedHostUpdate, JSON, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(properties, (IOBase, bytes)): + _content = properties + else: + _content = json.dumps(properties, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_dedicated_hosts_update_request( + resource_group_name=resource_group_name, + host_group_name=host_group_name, + host_name=host_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_update( + self, + resource_group_name: str, + host_group_name: str, + host_name: str, + properties: _models.DedicatedHostUpdate, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Update a dedicated host . + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param host_group_name: The name of the dedicated host group. Required. + :type host_group_name: str + :param host_name: The name of the dedicated host. Required. + :type host_name: str + :param properties: Parameters supplied to the Update Dedicated Host operation. Required. + :type properties: ~azure.mgmt.compute.models.DedicatedHostUpdate + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update( + self, + resource_group_name: str, + host_group_name: str, + host_name: str, + properties: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Update a dedicated host . + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param host_group_name: The name of the dedicated host group. Required. + :type host_group_name: str + :param host_name: The name of the dedicated host. Required. + :type host_name: str + :param properties: Parameters supplied to the Update Dedicated Host operation. Required. + :type properties: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update( + self, + resource_group_name: str, + host_group_name: str, + host_name: str, + properties: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Update a dedicated host . + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param host_group_name: The name of the dedicated host group. Required. + :type host_group_name: str + :param host_name: The name of the dedicated host. Required. + :type host_name: str + :param properties: Parameters supplied to the Update Dedicated Host operation. Required. + :type properties: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update( + self, + resource_group_name: str, + host_group_name: str, + host_name: str, + properties: Union[_models.DedicatedHostUpdate, JSON, IO[bytes]], + **kwargs: Any + ) -> LROPoller[None]: + """Update a dedicated host . + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param host_group_name: The name of the dedicated host group. Required. + :type host_group_name: str + :param host_name: The name of the dedicated host. Required. + :type host_name: str + :param properties: Parameters supplied to the Update Dedicated Host operation. Is one of the + following types: DedicatedHostUpdate, JSON, IO[bytes] Required. + :type properties: ~azure.mgmt.compute.models.DedicatedHostUpdate or JSON or IO[bytes] + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._update_initial( + resource_group_name=resource_group_name, + host_group_name=host_group_name, + host_name=host_name, + properties=properties, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + def _delete_initial( + self, resource_group_name: str, host_group_name: str, host_name: str, **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_dedicated_hosts_delete_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=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_delete( + 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. The name is case insensitive. + Required. + :type resource_group_name: str + :param host_group_name: The name of the dedicated host group. Required. + :type host_group_name: str + :param host_name: The name of the dedicated host. Required. + :type host_name: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + host_group_name=host_group_name, + host_name=host_name, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace + def list_by_host_group( + self, resource_group_name: str, host_group_name: str, **kwargs: Any + ) -> ItemPaged["_models.DedicatedHost"]: + """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. The name is case insensitive. + Required. + :type resource_group_name: str + :param host_group_name: The name of the dedicated host group. Required. + :type host_group_name: str + :return: An iterator like instance of DedicatedHost + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.models.DedicatedHost] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.DedicatedHost]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_dedicated_hosts_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=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.DedicatedHost], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + @distributed_trace + def list_available_sizes( + self, resource_group_name: str, host_group_name: str, host_name: str, **kwargs: Any + ) -> ItemPaged[str]: + """Lists all available dedicated host sizes to which the specified dedicated host can be resized. + NOTE: The dedicated host sizes provided can be used to only scale up the existing dedicated + host. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param host_group_name: The name of the dedicated host group. Required. + :type host_group_name: str + :param host_name: The name of the dedicated host. Required. + :type host_name: str + :return: An iterator like instance of str + :rtype: ~azure.core.paging.ItemPaged[str] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[str]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_dedicated_hosts_list_available_sizes_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=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[str], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + def _redeploy_initial( + self, resource_group_name: str, host_group_name: str, host_name: str, **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_dedicated_hosts_redeploy_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=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_redeploy( + self, resource_group_name: str, host_group_name: str, host_name: str, **kwargs: Any + ) -> LROPoller[None]: + """Redeploy the dedicated host. The operation will complete successfully once the dedicated host + has migrated to a new node and is running. To determine the health of VMs deployed on the + dedicated host after the redeploy check the Resource Health Center in the Azure Portal. Please + refer to `https://docs.microsoft.com/azure/service-health/resource-health-overview + `_ for more details. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param host_group_name: The name of the dedicated host group. Required. + :type host_group_name: str + :param host_name: The name of the dedicated host. Required. + :type host_name: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._redeploy_initial( + resource_group_name=resource_group_name, + host_group_name=host_group_name, + host_name=host_name, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + def _restart_initial( + self, resource_group_name: str, host_group_name: str, host_name: str, **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_dedicated_hosts_restart_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=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_restart( + 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/azure/service-health/resource-health-overview + `_ for more details. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param host_group_name: The name of the dedicated host group. Required. + :type host_group_name: str + :param host_name: The name of the dedicated host. Required. + :type host_name: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._restart_initial( + resource_group_name=resource_group_name, + host_group_name=host_group_name, + host_name=host_name, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + +class SshPublicKeyResourcesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.compute.ComputeClient`'s + :attr:`ssh_public_key_resources` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @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. The name is case insensitive. + Required. + :type resource_group_name: str + :param ssh_public_key_name: The name of the SSH public key. Required. + :type ssh_public_key_name: str + :return: SshPublicKeyResource. The SshPublicKeyResource is compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.SshPublicKeyResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.SshPublicKeyResource] = kwargs.pop("cls", None) + + _request = build_ssh_public_key_resources_get_request( + resource_group_name=resource_group_name, + ssh_public_key_name=ssh_public_key_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.SshPublicKeyResource, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def create( + self, + resource_group_name: str, + ssh_public_key_name: str, + resource: _models.SshPublicKeyResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SshPublicKeyResource: + """Creates a new SSH public key resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param ssh_public_key_name: The name of the SSH public key. Required. + :type ssh_public_key_name: str + :param resource: Parameters supplied to create the SSH public key. Required. + :type resource: ~azure.mgmt.compute.models.SshPublicKeyResource + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: SshPublicKeyResource. The SshPublicKeyResource is compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.SshPublicKeyResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create( + self, + resource_group_name: str, + ssh_public_key_name: str, + resource: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SshPublicKeyResource: + """Creates a new SSH public key resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param ssh_public_key_name: The name of the SSH public key. Required. + :type ssh_public_key_name: str + :param resource: Parameters supplied to create the SSH public key. Required. + :type resource: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: SshPublicKeyResource. The SshPublicKeyResource is compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.SshPublicKeyResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create( + self, + resource_group_name: str, + ssh_public_key_name: str, + resource: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SshPublicKeyResource: + """Creates a new SSH public key resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param ssh_public_key_name: The name of the SSH public key. Required. + :type ssh_public_key_name: str + :param resource: Parameters supplied to create the SSH public key. Required. + :type resource: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: SshPublicKeyResource. The SshPublicKeyResource is compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.SshPublicKeyResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create( + self, + resource_group_name: str, + ssh_public_key_name: str, + resource: Union[_models.SshPublicKeyResource, JSON, IO[bytes]], + **kwargs: Any + ) -> _models.SshPublicKeyResource: + """Creates a new SSH public key resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param ssh_public_key_name: The name of the SSH public key. Required. + :type ssh_public_key_name: str + :param resource: Parameters supplied to create the SSH public key. Is one of the following + types: SshPublicKeyResource, JSON, IO[bytes] Required. + :type resource: ~azure.mgmt.compute.models.SshPublicKeyResource or JSON or IO[bytes] + :return: SshPublicKeyResource. The SshPublicKeyResource is compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.SshPublicKeyResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SshPublicKeyResource] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(resource, (IOBase, bytes)): + _content = resource + else: + _content = json.dumps(resource, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_ssh_public_key_resources_create_request( + resource_group_name=resource_group_name, + ssh_public_key_name=ssh_public_key_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.SshPublicKeyResource, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def update( + self, + resource_group_name: str, + ssh_public_key_name: str, + properties: _models.SshPublicKeyUpdateResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SshPublicKeyResource: + """Updates a new SSH public key resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param ssh_public_key_name: The name of the SSH public key. Required. + :type ssh_public_key_name: str + :param properties: Parameters supplied to update the SSH public key. Required. + :type properties: ~azure.mgmt.compute.models.SshPublicKeyUpdateResource + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: SshPublicKeyResource. The SshPublicKeyResource is compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.SshPublicKeyResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update( + self, + resource_group_name: str, + ssh_public_key_name: str, + properties: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SshPublicKeyResource: + """Updates a new SSH public key resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param ssh_public_key_name: The name of the SSH public key. Required. + :type ssh_public_key_name: str + :param properties: Parameters supplied to update the SSH public key. Required. + :type properties: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: SshPublicKeyResource. The SshPublicKeyResource is compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.SshPublicKeyResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update( + self, + resource_group_name: str, + ssh_public_key_name: str, + properties: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SshPublicKeyResource: + """Updates a new SSH public key resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param ssh_public_key_name: The name of the SSH public key. Required. + :type ssh_public_key_name: str + :param properties: Parameters supplied to update the SSH public key. Required. + :type properties: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: SshPublicKeyResource. The SshPublicKeyResource is compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.SshPublicKeyResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def update( + self, + resource_group_name: str, + ssh_public_key_name: str, + properties: Union[_models.SshPublicKeyUpdateResource, JSON, IO[bytes]], + **kwargs: Any + ) -> _models.SshPublicKeyResource: + """Updates a new SSH public key resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param ssh_public_key_name: The name of the SSH public key. Required. + :type ssh_public_key_name: str + :param properties: Parameters supplied to update the SSH public key. Is one of the following + types: SshPublicKeyUpdateResource, JSON, IO[bytes] Required. + :type properties: ~azure.mgmt.compute.models.SshPublicKeyUpdateResource or JSON or IO[bytes] + :return: SshPublicKeyResource. The SshPublicKeyResource is compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.SshPublicKeyResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SshPublicKeyResource] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(properties, (IOBase, bytes)): + _content = properties + else: + _content = json.dumps(properties, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_ssh_public_key_resources_update_request( + resource_group_name=resource_group_name, + ssh_public_key_name=ssh_public_key_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.SshPublicKeyResource, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # 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. The name is case insensitive. + Required. + :type resource_group_name: str + :param ssh_public_key_name: The name of the SSH public key. Required. + :type ssh_public_key_name: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_ssh_public_key_resources_delete_request( + resource_group_name=resource_group_name, + ssh_public_key_name=ssh_public_key_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace + def list_by_resource_group( + self, resource_group_name: str, **kwargs: Any + ) -> ItemPaged["_models.SshPublicKeyResource"]: + """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. The name is case insensitive. + Required. + :type resource_group_name: str + :return: An iterator like instance of SshPublicKeyResource + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.models.SshPublicKeyResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.SshPublicKeyResource]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_ssh_public_key_resources_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.SshPublicKeyResource], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + @distributed_trace + def list_by_subscription(self, **kwargs: Any) -> ItemPaged["_models.SshPublicKeyResource"]: + """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. + + :return: An iterator like instance of SshPublicKeyResource + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.models.SshPublicKeyResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.SshPublicKeyResource]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_ssh_public_key_resources_list_by_subscription_request( + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.SshPublicKeyResource], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + @overload + def generate_key_pair( + self, + resource_group_name: str, + ssh_public_key_name: str, + parameters: Optional[_models.SshGenerateKeyPairInputParameters] = None, + *, + content_type: str = "application/json", + **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. The name is case insensitive. + Required. + :type resource_group_name: str + :param ssh_public_key_name: The name of the SSH public key. Required. + :type ssh_public_key_name: str + :param parameters: Parameters supplied to generate the SSH public key. Default value is None. + :type parameters: ~azure.mgmt.compute.models.SshGenerateKeyPairInputParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: SshPublicKeyGenerateKeyPairResult. The SshPublicKeyGenerateKeyPairResult is compatible + with MutableMapping + :rtype: ~azure.mgmt.compute.models.SshPublicKeyGenerateKeyPairResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def generate_key_pair( + self, + resource_group_name: str, + ssh_public_key_name: str, + parameters: Optional[JSON] = None, + *, + content_type: str = "application/json", + **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. The name is case insensitive. + Required. + :type resource_group_name: str + :param ssh_public_key_name: The name of the SSH public key. Required. + :type ssh_public_key_name: str + :param parameters: Parameters supplied to generate the SSH public key. Default value is None. + :type parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: SshPublicKeyGenerateKeyPairResult. The SshPublicKeyGenerateKeyPairResult is compatible + with MutableMapping + :rtype: ~azure.mgmt.compute.models.SshPublicKeyGenerateKeyPairResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def generate_key_pair( + self, + resource_group_name: str, + ssh_public_key_name: str, + parameters: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + **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. The name is case insensitive. + Required. + :type resource_group_name: str + :param ssh_public_key_name: The name of the SSH public key. Required. + :type ssh_public_key_name: str + :param parameters: Parameters supplied to generate the SSH public key. Default value is None. + :type parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: SshPublicKeyGenerateKeyPairResult. The SshPublicKeyGenerateKeyPairResult is compatible + with MutableMapping + :rtype: ~azure.mgmt.compute.models.SshPublicKeyGenerateKeyPairResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def generate_key_pair( + self, + resource_group_name: str, + ssh_public_key_name: str, + parameters: Optional[Union[_models.SshGenerateKeyPairInputParameters, JSON, IO[bytes]]] = None, + **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. The name is case insensitive. + Required. + :type resource_group_name: str + :param ssh_public_key_name: The name of the SSH public key. Required. + :type ssh_public_key_name: str + :param parameters: Parameters supplied to generate the SSH public key. Is one of the following + types: SshGenerateKeyPairInputParameters, JSON, IO[bytes] Default value is None. + :type parameters: ~azure.mgmt.compute.models.SshGenerateKeyPairInputParameters or JSON or + IO[bytes] + :return: SshPublicKeyGenerateKeyPairResult. The SshPublicKeyGenerateKeyPairResult is compatible + with MutableMapping + :rtype: ~azure.mgmt.compute.models.SshPublicKeyGenerateKeyPairResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + content_type = content_type if parameters else None + cls: ClsType[_models.SshPublicKeyGenerateKeyPairResult] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" if parameters else None + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + if parameters is not None: + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + else: + _content = None + + _request = build_ssh_public_key_resources_generate_key_pair_request( + resource_group_name=resource_group_name, + ssh_public_key_name=ssh_public_key_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.SshPublicKeyGenerateKeyPairResult, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + +class ImagesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.compute.ComputeClient`'s + :attr:`images` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @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. The name is case insensitive. + Required. + :type resource_group_name: str + :param image_name: The name of the image. Required. + :type image_name: str + :keyword expand: The expand expression to apply on the operation. Default value is None. + :paramtype expand: str + :return: Image. The Image is compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.Image + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.Image] = kwargs.pop("cls", None) + + _request = build_images_get_request( + resource_group_name=resource_group_name, + image_name=image_name, + subscription_id=self._config.subscription_id, + expand=expand, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.Image, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _create_or_update_initial( + self, resource_group_name: str, image_name: str, resource: Union[_models.Image, JSON, IO[bytes]], **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(resource, (IOBase, bytes)): + _content = resource + else: + _content = json.dumps(resource, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_images_create_or_update_request( + resource_group_name=resource_group_name, + image_name=image_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 201: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + image_name: str, + resource: _models.Image, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Create or update an image. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param image_name: The name of the image. Required. + :type image_name: str + :param resource: Parameters supplied to the Create Image operation. Required. + :type resource: ~azure.mgmt.compute.models.Image + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + image_name: str, + resource: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Create or update an image. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param image_name: The name of the image. Required. + :type image_name: str + :param resource: Parameters supplied to the Create Image operation. Required. + :type resource: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + image_name: str, + resource: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Create or update an image. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param image_name: The name of the image. Required. + :type image_name: str + :param resource: Parameters supplied to the Create Image operation. Required. + :type resource: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, resource_group_name: str, image_name: str, resource: Union[_models.Image, JSON, IO[bytes]], **kwargs: Any + ) -> LROPoller[None]: + """Create or update an image. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param image_name: The name of the image. Required. + :type image_name: str + :param resource: Parameters supplied to the Create Image operation. Is one of the following + types: Image, JSON, IO[bytes] Required. + :type resource: ~azure.mgmt.compute.models.Image or JSON or IO[bytes] + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + image_name=image_name, + resource=resource, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + def _update_initial( + self, + resource_group_name: str, + image_name: str, + properties: Union[_models.ImageUpdate, JSON, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(properties, (IOBase, bytes)): + _content = properties + else: + _content = json.dumps(properties, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_images_update_request( + resource_group_name=resource_group_name, + image_name=image_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 201: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_update( + self, + resource_group_name: str, + image_name: str, + properties: _models.ImageUpdate, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Update an image. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param image_name: The name of the image. Required. + :type image_name: str + :param properties: Parameters supplied to the Update Image operation. Required. + :type properties: ~azure.mgmt.compute.models.ImageUpdate + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update( + self, + resource_group_name: str, + image_name: str, + properties: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Update an image. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param image_name: The name of the image. Required. + :type image_name: str + :param properties: Parameters supplied to the Update Image operation. Required. + :type properties: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update( + self, + resource_group_name: str, + image_name: str, + properties: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Update an image. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param image_name: The name of the image. Required. + :type image_name: str + :param properties: Parameters supplied to the Update Image operation. Required. + :type properties: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update( + self, + resource_group_name: str, + image_name: str, + properties: Union[_models.ImageUpdate, JSON, IO[bytes]], + **kwargs: Any + ) -> LROPoller[None]: + """Update an image. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param image_name: The name of the image. Required. + :type image_name: str + :param properties: Parameters supplied to the Update Image operation. Is one of the following + types: ImageUpdate, JSON, IO[bytes] Required. + :type properties: ~azure.mgmt.compute.models.ImageUpdate or JSON or IO[bytes] + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._update_initial( + resource_group_name=resource_group_name, + image_name=image_name, + properties=properties, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + def _delete_initial(self, resource_group_name: str, image_name: str, **kwargs: Any) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_images_delete_request( + resource_group_name=resource_group_name, + image_name=image_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_delete(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. The name is case insensitive. + Required. + :type resource_group_name: str + :param image_name: The name of the image. Required. + :type image_name: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + image_name=image_name, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace + def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> ItemPaged["_models.Image"]: + """Gets the list of images under a resource group. Use nextLink property in the response to get + the next page of Images. Do this till nextLink is null to fetch all the Images. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :return: An iterator like instance of Image + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.models.Image] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.Image]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_images_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.Image], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + @distributed_trace + def list(self, **kwargs: Any) -> ItemPaged["_models.Image"]: + """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. + + :return: An iterator like instance of Image + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.models.Image] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.Image]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_images_list_request( + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.Image], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + +class RestorePointCollectionsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.compute.ComputeClient`'s + :attr:`restore_point_collections` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @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. The name is case insensitive. + Required. + :type resource_group_name: str + :param restore_point_collection_name: The name of the restore point collection. Required. + :type restore_point_collection_name: str + :keyword expand: The expand expression to apply on the operation. If expand=restorePoints, + server will return all contained restore points in the restorePointCollection. "restorePoints" + Default value is None. + :paramtype expand: str or ~azure.mgmt.compute.models.RestorePointCollectionExpandOptions + :return: RestorePointCollection. The RestorePointCollection is compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.RestorePointCollection + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.RestorePointCollection] = kwargs.pop("cls", None) + + _request = build_restore_point_collections_get_request( + resource_group_name=resource_group_name, + restore_point_collection_name=restore_point_collection_name, + subscription_id=self._config.subscription_id, + expand=expand, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.RestorePointCollection, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def create_or_update( + self, + resource_group_name: str, + restore_point_collection_name: str, + resource: _models.RestorePointCollection, + *, + content_type: str = "application/json", + **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. The name is case insensitive. + Required. + :type resource_group_name: str + :param restore_point_collection_name: The name of the restore point collection. Required. + :type restore_point_collection_name: str + :param resource: Parameters supplied to the Create or Update restore point collection + operation. Required. + :type resource: ~azure.mgmt.compute.models.RestorePointCollection + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: RestorePointCollection. The RestorePointCollection is compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.RestorePointCollection + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update( + self, + resource_group_name: str, + restore_point_collection_name: str, + resource: JSON, + *, + content_type: str = "application/json", + **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. The name is case insensitive. + Required. + :type resource_group_name: str + :param restore_point_collection_name: The name of the restore point collection. Required. + :type restore_point_collection_name: str + :param resource: Parameters supplied to the Create or Update restore point collection + operation. Required. + :type resource: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: RestorePointCollection. The RestorePointCollection is compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.RestorePointCollection + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update( + self, + resource_group_name: str, + restore_point_collection_name: str, + resource: IO[bytes], + *, + content_type: str = "application/json", + **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. The name is case insensitive. + Required. + :type resource_group_name: str + :param restore_point_collection_name: The name of the restore point collection. Required. + :type restore_point_collection_name: str + :param resource: Parameters supplied to the Create or Update restore point collection + operation. Required. + :type resource: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: RestorePointCollection. The RestorePointCollection is compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.RestorePointCollection + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create_or_update( + self, + resource_group_name: str, + restore_point_collection_name: str, + resource: Union[_models.RestorePointCollection, JSON, IO[bytes]], + **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. The name is case insensitive. + Required. + :type resource_group_name: str + :param restore_point_collection_name: The name of the restore point collection. Required. + :type restore_point_collection_name: str + :param resource: Parameters supplied to the Create or Update restore point collection + operation. Is one of the following types: RestorePointCollection, JSON, IO[bytes] Required. + :type resource: ~azure.mgmt.compute.models.RestorePointCollection or JSON or IO[bytes] + :return: RestorePointCollection. The RestorePointCollection is compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.RestorePointCollection + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.RestorePointCollection] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(resource, (IOBase, bytes)): + _content = resource + else: + _content = json.dumps(resource, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_restore_point_collections_create_or_update_request( + resource_group_name=resource_group_name, + restore_point_collection_name=restore_point_collection_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.RestorePointCollection, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def update( + self, + resource_group_name: str, + restore_point_collection_name: str, + properties: _models.RestorePointCollectionUpdate, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.RestorePointCollection: + """The operation to update the restore point collection. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param restore_point_collection_name: The name of the restore point collection. Required. + :type restore_point_collection_name: str + :param properties: Parameters supplied to the Update restore point collection operation. + Required. + :type properties: ~azure.mgmt.compute.models.RestorePointCollectionUpdate + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: RestorePointCollection. The RestorePointCollection is compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.RestorePointCollection + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update( + self, + resource_group_name: str, + restore_point_collection_name: str, + properties: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.RestorePointCollection: + """The operation to update the restore point collection. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param restore_point_collection_name: The name of the restore point collection. Required. + :type restore_point_collection_name: str + :param properties: Parameters supplied to the Update restore point collection operation. + Required. + :type properties: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: RestorePointCollection. The RestorePointCollection is compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.RestorePointCollection + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update( + self, + resource_group_name: str, + restore_point_collection_name: str, + properties: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.RestorePointCollection: + """The operation to update the restore point collection. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param restore_point_collection_name: The name of the restore point collection. Required. + :type restore_point_collection_name: str + :param properties: Parameters supplied to the Update restore point collection operation. + Required. + :type properties: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: RestorePointCollection. The RestorePointCollection is compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.RestorePointCollection + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def update( + self, + resource_group_name: str, + restore_point_collection_name: str, + properties: Union[_models.RestorePointCollectionUpdate, JSON, IO[bytes]], + **kwargs: Any + ) -> _models.RestorePointCollection: + """The operation to update the restore point collection. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param restore_point_collection_name: The name of the restore point collection. Required. + :type restore_point_collection_name: str + :param properties: Parameters supplied to the Update restore point collection operation. Is one + of the following types: RestorePointCollectionUpdate, JSON, IO[bytes] Required. + :type properties: ~azure.mgmt.compute.models.RestorePointCollectionUpdate or JSON or IO[bytes] + :return: RestorePointCollection. The RestorePointCollection is compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.RestorePointCollection + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.RestorePointCollection] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(properties, (IOBase, bytes)): + _content = properties + else: + _content = json.dumps(properties, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_restore_point_collections_update_request( + resource_group_name=resource_group_name, + restore_point_collection_name=restore_point_collection_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.RestorePointCollection, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _delete_initial( + self, resource_group_name: str, restore_point_collection_name: str, **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_restore_point_collections_delete_request( + resource_group_name=resource_group_name, + restore_point_collection_name=restore_point_collection_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_delete( + 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. The name is case insensitive. + Required. + :type resource_group_name: str + :param restore_point_collection_name: The name of the restore point collection. Required. + :type restore_point_collection_name: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + restore_point_collection_name=restore_point_collection_name, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace + def list(self, resource_group_name: str, **kwargs: Any) -> ItemPaged["_models.RestorePointCollection"]: + """Gets the list of restore point collections in a resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :return: An iterator like instance of RestorePointCollection + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.models.RestorePointCollection] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.RestorePointCollection]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_restore_point_collections_list_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.RestorePointCollection], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + @distributed_trace + def list_all(self, **kwargs: Any) -> ItemPaged["_models.RestorePointCollection"]: + """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. + + :return: An iterator like instance of RestorePointCollection + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.models.RestorePointCollection] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.RestorePointCollection]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_restore_point_collections_list_all_request( + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.RestorePointCollection], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + +class RestorePointsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.compute.ComputeClient`'s + :attr:`restore_points` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @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. The name is case insensitive. + Required. + :type resource_group_name: str + :param restore_point_collection_name: The name of the restore point collection. Required. + :type restore_point_collection_name: str + :param restore_point_name: The name of the restore point. Required. + :type restore_point_name: str + :keyword expand: The expand expression to apply on the operation. 'InstanceView' retrieves + information about the run-time state of a restore point. "instanceView" Default value is None. + :paramtype expand: str or ~azure.mgmt.compute.models.RestorePointExpandOptions + :return: RestorePoint. The RestorePoint is compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.RestorePoint + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.RestorePoint] = kwargs.pop("cls", None) + + _request = build_restore_points_get_request( + resource_group_name=resource_group_name, + restore_point_collection_name=restore_point_collection_name, + restore_point_name=restore_point_name, + subscription_id=self._config.subscription_id, + expand=expand, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.RestorePoint, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _create_initial( + self, + resource_group_name: str, + restore_point_collection_name: str, + restore_point_name: str, + resource: Union[_models.RestorePoint, JSON, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(resource, (IOBase, bytes)): + _content = resource + else: + _content = json.dumps(resource, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_restore_points_create_request( + resource_group_name=resource_group_name, + restore_point_collection_name=restore_point_collection_name, + restore_point_name=restore_point_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_create( + self, + resource_group_name: str, + restore_point_collection_name: str, + restore_point_name: str, + resource: _models.RestorePoint, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """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. The name is case insensitive. + Required. + :type resource_group_name: str + :param restore_point_collection_name: The name of the restore point collection. Required. + :type restore_point_collection_name: str + :param restore_point_name: The name of the restore point. Required. + :type restore_point_name: str + :param resource: Parameters supplied to the Create restore point operation. Required. + :type resource: ~azure.mgmt.compute.models.RestorePoint + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create( + self, + resource_group_name: str, + restore_point_collection_name: str, + restore_point_name: str, + resource: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """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. The name is case insensitive. + Required. + :type resource_group_name: str + :param restore_point_collection_name: The name of the restore point collection. Required. + :type restore_point_collection_name: str + :param restore_point_name: The name of the restore point. Required. + :type restore_point_name: str + :param resource: Parameters supplied to the Create restore point operation. Required. + :type resource: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create( + self, + resource_group_name: str, + restore_point_collection_name: str, + restore_point_name: str, + resource: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """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. The name is case insensitive. + Required. + :type resource_group_name: str + :param restore_point_collection_name: The name of the restore point collection. Required. + :type restore_point_collection_name: str + :param restore_point_name: The name of the restore point. Required. + :type restore_point_name: str + :param resource: Parameters supplied to the Create restore point operation. Required. + :type resource: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create( + self, + resource_group_name: str, + restore_point_collection_name: str, + restore_point_name: str, + resource: Union[_models.RestorePoint, JSON, IO[bytes]], + **kwargs: Any + ) -> LROPoller[None]: + """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. The name is case insensitive. + Required. + :type resource_group_name: str + :param restore_point_collection_name: The name of the restore point collection. Required. + :type restore_point_collection_name: str + :param restore_point_name: The name of the restore point. Required. + :type restore_point_name: str + :param resource: Parameters supplied to the Create restore point operation. Is one of the + following types: RestorePoint, JSON, IO[bytes] Required. + :type resource: ~azure.mgmt.compute.models.RestorePoint or JSON or IO[bytes] + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._create_initial( + resource_group_name=resource_group_name, + restore_point_collection_name=restore_point_collection_name, + restore_point_name=restore_point_name, + resource=resource, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + def _delete_initial( + self, resource_group_name: str, restore_point_collection_name: str, restore_point_name: str, **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_restore_points_delete_request( + resource_group_name=resource_group_name, + restore_point_collection_name=restore_point_collection_name, + restore_point_name=restore_point_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_delete( + 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. The name is case insensitive. + Required. + :type resource_group_name: str + :param restore_point_collection_name: The name of the restore point collection. Required. + :type restore_point_collection_name: str + :param restore_point_name: The name of the restore point. Required. + :type restore_point_name: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + restore_point_collection_name=restore_point_collection_name, + restore_point_name=restore_point_name, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + +class CapacityReservationGroupsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.compute.ComputeClient`'s + :attr:`capacity_reservation_groups` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @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. The name is case insensitive. + Required. + :type resource_group_name: str + :param capacity_reservation_group_name: The name of the capacity reservation group. Required. + :type capacity_reservation_group_name: str + :keyword 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. "instanceView" Default value is + None. + :paramtype expand: str or ~azure.mgmt.compute.models.CapacityReservationGroupInstanceViewTypes + :return: CapacityReservationGroup. The CapacityReservationGroup is compatible with + MutableMapping + :rtype: ~azure.mgmt.compute.models.CapacityReservationGroup + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.CapacityReservationGroup] = kwargs.pop("cls", None) + + _request = build_capacity_reservation_groups_get_request( + resource_group_name=resource_group_name, + capacity_reservation_group_name=capacity_reservation_group_name, + subscription_id=self._config.subscription_id, + expand=expand, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.CapacityReservationGroup, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def create_or_update( + self, + resource_group_name: str, + capacity_reservation_group_name: str, + resource: _models.CapacityReservationGroup, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.CapacityReservationGroup: + """The operation to create or update a capacity reservation group. When updating a capacity + reservation group, only tags and sharing profile may be modified. Please refer to + `https://aka.ms/CapacityReservation `_ for more details. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param capacity_reservation_group_name: The name of the capacity reservation group. Required. + :type capacity_reservation_group_name: str + :param resource: Parameters supplied to the Create capacity reservation Group. Required. + :type resource: ~azure.mgmt.compute.models.CapacityReservationGroup + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: CapacityReservationGroup. The CapacityReservationGroup is compatible with + MutableMapping + :rtype: ~azure.mgmt.compute.models.CapacityReservationGroup + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update( + self, + resource_group_name: str, + capacity_reservation_group_name: str, + resource: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.CapacityReservationGroup: + """The operation to create or update a capacity reservation group. When updating a capacity + reservation group, only tags and sharing profile may be modified. Please refer to + `https://aka.ms/CapacityReservation `_ for more details. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param capacity_reservation_group_name: The name of the capacity reservation group. Required. + :type capacity_reservation_group_name: str + :param resource: Parameters supplied to the Create capacity reservation Group. Required. + :type resource: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: CapacityReservationGroup. The CapacityReservationGroup is compatible with + MutableMapping + :rtype: ~azure.mgmt.compute.models.CapacityReservationGroup + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update( + self, + resource_group_name: str, + capacity_reservation_group_name: str, + resource: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.CapacityReservationGroup: + """The operation to create or update a capacity reservation group. When updating a capacity + reservation group, only tags and sharing profile may be modified. Please refer to + `https://aka.ms/CapacityReservation `_ for more details. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param capacity_reservation_group_name: The name of the capacity reservation group. Required. + :type capacity_reservation_group_name: str + :param resource: Parameters supplied to the Create capacity reservation Group. Required. + :type resource: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: CapacityReservationGroup. The CapacityReservationGroup is compatible with + MutableMapping + :rtype: ~azure.mgmt.compute.models.CapacityReservationGroup + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create_or_update( + self, + resource_group_name: str, + capacity_reservation_group_name: str, + resource: Union[_models.CapacityReservationGroup, JSON, IO[bytes]], + **kwargs: Any + ) -> _models.CapacityReservationGroup: + """The operation to create or update a capacity reservation group. When updating a capacity + reservation group, only tags and sharing profile may be modified. Please refer to + `https://aka.ms/CapacityReservation `_ for more details. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param capacity_reservation_group_name: The name of the capacity reservation group. Required. + :type capacity_reservation_group_name: str + :param resource: Parameters supplied to the Create capacity reservation Group. Is one of the + following types: CapacityReservationGroup, JSON, IO[bytes] Required. + :type resource: ~azure.mgmt.compute.models.CapacityReservationGroup or JSON or IO[bytes] + :return: CapacityReservationGroup. The CapacityReservationGroup is compatible with + MutableMapping + :rtype: ~azure.mgmt.compute.models.CapacityReservationGroup + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CapacityReservationGroup] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(resource, (IOBase, bytes)): + _content = resource + else: + _content = json.dumps(resource, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_capacity_reservation_groups_create_or_update_request( + resource_group_name=resource_group_name, + capacity_reservation_group_name=capacity_reservation_group_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.CapacityReservationGroup, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def update( + self, + resource_group_name: str, + capacity_reservation_group_name: str, + properties: _models.CapacityReservationGroupUpdate, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.CapacityReservationGroup: + """The operation to update a capacity reservation group. When updating a capacity reservation + group, only tags and sharing profile may be modified. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param capacity_reservation_group_name: The name of the capacity reservation group. Required. + :type capacity_reservation_group_name: str + :param properties: Parameters supplied to the Update capacity reservation Group operation. + Required. + :type properties: ~azure.mgmt.compute.models.CapacityReservationGroupUpdate + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: CapacityReservationGroup. The CapacityReservationGroup is compatible with + MutableMapping + :rtype: ~azure.mgmt.compute.models.CapacityReservationGroup + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update( + self, + resource_group_name: str, + capacity_reservation_group_name: str, + properties: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.CapacityReservationGroup: + """The operation to update a capacity reservation group. When updating a capacity reservation + group, only tags and sharing profile may be modified. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param capacity_reservation_group_name: The name of the capacity reservation group. Required. + :type capacity_reservation_group_name: str + :param properties: Parameters supplied to the Update capacity reservation Group operation. + Required. + :type properties: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: CapacityReservationGroup. The CapacityReservationGroup is compatible with + MutableMapping + :rtype: ~azure.mgmt.compute.models.CapacityReservationGroup + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update( + self, + resource_group_name: str, + capacity_reservation_group_name: str, + properties: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.CapacityReservationGroup: + """The operation to update a capacity reservation group. When updating a capacity reservation + group, only tags and sharing profile may be modified. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param capacity_reservation_group_name: The name of the capacity reservation group. Required. + :type capacity_reservation_group_name: str + :param properties: Parameters supplied to the Update capacity reservation Group operation. + Required. + :type properties: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: CapacityReservationGroup. The CapacityReservationGroup is compatible with + MutableMapping + :rtype: ~azure.mgmt.compute.models.CapacityReservationGroup + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def update( + self, + resource_group_name: str, + capacity_reservation_group_name: str, + properties: Union[_models.CapacityReservationGroupUpdate, JSON, IO[bytes]], + **kwargs: Any + ) -> _models.CapacityReservationGroup: + """The operation to update a capacity reservation group. When updating a capacity reservation + group, only tags and sharing profile may be modified. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param capacity_reservation_group_name: The name of the capacity reservation group. Required. + :type capacity_reservation_group_name: str + :param properties: Parameters supplied to the Update capacity reservation Group operation. Is + one of the following types: CapacityReservationGroupUpdate, JSON, IO[bytes] Required. + :type properties: ~azure.mgmt.compute.models.CapacityReservationGroupUpdate or JSON or + IO[bytes] + :return: CapacityReservationGroup. The CapacityReservationGroup is compatible with + MutableMapping + :rtype: ~azure.mgmt.compute.models.CapacityReservationGroup + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CapacityReservationGroup] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(properties, (IOBase, bytes)): + _content = properties + else: + _content = json.dumps(properties, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_capacity_reservation_groups_update_request( + resource_group_name=resource_group_name, + capacity_reservation_group_name=capacity_reservation_group_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.CapacityReservationGroup, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # 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. The name is case insensitive. + Required. + :type resource_group_name: str + :param capacity_reservation_group_name: The name of the capacity reservation group. Required. + :type capacity_reservation_group_name: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_capacity_reservation_groups_delete_request( + resource_group_name=resource_group_name, + capacity_reservation_group_name=capacity_reservation_group_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace + def list_by_resource_group( + self, + resource_group_name: str, + *, + expand: Optional[Union[str, _models.ExpandTypesForGetCapacityReservationGroups]] = None, + **kwargs: Any + ) -> ItemPaged["_models.CapacityReservationGroup"]: + """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. The name is case insensitive. + Required. + :type resource_group_name: str + :keyword 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. Known values are: + "virtualMachineScaleSetVMs/$ref" and "virtualMachines/$ref". Default value is None. + :paramtype expand: str or ~azure.mgmt.compute.models.ExpandTypesForGetCapacityReservationGroups + :return: An iterator like instance of CapacityReservationGroup + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.models.CapacityReservationGroup] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.CapacityReservationGroup]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_capacity_reservation_groups_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + expand=expand, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.CapacityReservationGroup], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + @distributed_trace + def list_by_subscription( + self, + *, + expand: Optional[Union[str, _models.ExpandTypesForGetCapacityReservationGroups]] = None, + resource_ids_only: Optional[Union[str, _models.ResourceIdOptionsForGetCapacityReservationGroups]] = None, + **kwargs: Any + ) -> ItemPaged["_models.CapacityReservationGroup"]: + """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. + + :keyword 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. Known values are: + "virtualMachineScaleSetVMs/$ref" and "virtualMachines/$ref". Default value is None. + :paramtype expand: str or ~azure.mgmt.compute.models.ExpandTypesForGetCapacityReservationGroups + :keyword resource_ids_only: The query option to fetch Capacity Reservation Group Resource Ids. +
'CreatedInSubscription' enables fetching Resource Ids for all capacity reservation group + resources created in the subscription.
'SharedWithSubscription' enables fetching Resource + Ids for all capacity reservation group resources shared with the subscription.
'All' + enables fetching Resource Ids for all capacity reservation group resources shared with the + subscription and created in the subscription. Known values are: "CreatedInSubscription", + "SharedWithSubscription", and "All". Default value is None. + :paramtype resource_ids_only: str or + ~azure.mgmt.compute.models.ResourceIdOptionsForGetCapacityReservationGroups + :return: An iterator like instance of CapacityReservationGroup + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.models.CapacityReservationGroup] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.CapacityReservationGroup]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_capacity_reservation_groups_list_by_subscription_request( + subscription_id=self._config.subscription_id, + expand=expand, + resource_ids_only=resource_ids_only, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.CapacityReservationGroup], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + +class CapacityReservationsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.compute.ComputeClient`'s + :attr:`capacity_reservations` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @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. The name is case insensitive. + Required. + :type resource_group_name: str + :param capacity_reservation_group_name: The name of the capacity reservation group. Required. + :type capacity_reservation_group_name: str + :param capacity_reservation_name: The name of the capacity reservation. Required. + :type capacity_reservation_name: str + :keyword 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. "instanceView" Default value is None. + :paramtype expand: str or ~azure.mgmt.compute.models.CapacityReservationInstanceViewTypes + :return: CapacityReservation. The CapacityReservation is compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.CapacityReservation + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.CapacityReservation] = kwargs.pop("cls", None) + + _request = build_capacity_reservations_get_request( + resource_group_name=resource_group_name, + capacity_reservation_group_name=capacity_reservation_group_name, + capacity_reservation_name=capacity_reservation_name, + subscription_id=self._config.subscription_id, + expand=expand, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.CapacityReservation, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _create_or_update_initial( + self, + resource_group_name: str, + capacity_reservation_group_name: str, + capacity_reservation_name: str, + resource: Union[_models.CapacityReservation, JSON, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(resource, (IOBase, bytes)): + _content = resource + else: + _content = json.dumps(resource, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_capacity_reservations_create_or_update_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, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 201: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + capacity_reservation_group_name: str, + capacity_reservation_name: str, + resource: _models.CapacityReservation, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """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. The name is case insensitive. + Required. + :type resource_group_name: str + :param capacity_reservation_group_name: The name of the capacity reservation group. Required. + :type capacity_reservation_group_name: str + :param capacity_reservation_name: The name of the capacity reservation. Required. + :type capacity_reservation_name: str + :param resource: Parameters supplied to the Create capacity reservation. Required. + :type resource: ~azure.mgmt.compute.models.CapacityReservation + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + capacity_reservation_group_name: str, + capacity_reservation_name: str, + resource: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """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. The name is case insensitive. + Required. + :type resource_group_name: str + :param capacity_reservation_group_name: The name of the capacity reservation group. Required. + :type capacity_reservation_group_name: str + :param capacity_reservation_name: The name of the capacity reservation. Required. + :type capacity_reservation_name: str + :param resource: Parameters supplied to the Create capacity reservation. Required. + :type resource: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + capacity_reservation_group_name: str, + capacity_reservation_name: str, + resource: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """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. The name is case insensitive. + Required. + :type resource_group_name: str + :param capacity_reservation_group_name: The name of the capacity reservation group. Required. + :type capacity_reservation_group_name: str + :param capacity_reservation_name: The name of the capacity reservation. Required. + :type capacity_reservation_name: str + :param resource: Parameters supplied to the Create capacity reservation. Required. + :type resource: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + capacity_reservation_group_name: str, + capacity_reservation_name: str, + resource: Union[_models.CapacityReservation, JSON, IO[bytes]], + **kwargs: Any + ) -> LROPoller[None]: + """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. The name is case insensitive. + Required. + :type resource_group_name: str + :param capacity_reservation_group_name: The name of the capacity reservation group. Required. + :type capacity_reservation_group_name: str + :param capacity_reservation_name: The name of the capacity reservation. Required. + :type capacity_reservation_name: str + :param resource: Parameters supplied to the Create capacity reservation. Is one of the + following types: CapacityReservation, JSON, IO[bytes] Required. + :type resource: ~azure.mgmt.compute.models.CapacityReservation or JSON or IO[bytes] + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + capacity_reservation_group_name=capacity_reservation_group_name, + capacity_reservation_name=capacity_reservation_name, + resource=resource, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + def _update_initial( + self, + resource_group_name: str, + capacity_reservation_group_name: str, + capacity_reservation_name: str, + properties: Union[_models.CapacityReservationUpdate, JSON, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(properties, (IOBase, bytes)): + _content = properties + else: + _content = json.dumps(properties, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_capacity_reservations_update_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, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_update( + self, + resource_group_name: str, + capacity_reservation_group_name: str, + capacity_reservation_name: str, + properties: _models.CapacityReservationUpdate, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """The operation to update a capacity reservation. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param capacity_reservation_group_name: The name of the capacity reservation group. Required. + :type capacity_reservation_group_name: str + :param capacity_reservation_name: The name of the capacity reservation. Required. + :type capacity_reservation_name: str + :param properties: Parameters supplied to the Update capacity reservation operation. Required. + :type properties: ~azure.mgmt.compute.models.CapacityReservationUpdate + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update( + self, + resource_group_name: str, + capacity_reservation_group_name: str, + capacity_reservation_name: str, + properties: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """The operation to update a capacity reservation. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param capacity_reservation_group_name: The name of the capacity reservation group. Required. + :type capacity_reservation_group_name: str + :param capacity_reservation_name: The name of the capacity reservation. Required. + :type capacity_reservation_name: str + :param properties: Parameters supplied to the Update capacity reservation operation. Required. + :type properties: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update( + self, + resource_group_name: str, + capacity_reservation_group_name: str, + capacity_reservation_name: str, + properties: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """The operation to update a capacity reservation. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param capacity_reservation_group_name: The name of the capacity reservation group. Required. + :type capacity_reservation_group_name: str + :param capacity_reservation_name: The name of the capacity reservation. Required. + :type capacity_reservation_name: str + :param properties: Parameters supplied to the Update capacity reservation operation. Required. + :type properties: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update( + self, + resource_group_name: str, + capacity_reservation_group_name: str, + capacity_reservation_name: str, + properties: Union[_models.CapacityReservationUpdate, JSON, IO[bytes]], + **kwargs: Any + ) -> LROPoller[None]: + """The operation to update a capacity reservation. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param capacity_reservation_group_name: The name of the capacity reservation group. Required. + :type capacity_reservation_group_name: str + :param capacity_reservation_name: The name of the capacity reservation. Required. + :type capacity_reservation_name: str + :param properties: Parameters supplied to the Update capacity reservation operation. Is one of + the following types: CapacityReservationUpdate, JSON, IO[bytes] Required. + :type properties: ~azure.mgmt.compute.models.CapacityReservationUpdate or JSON or IO[bytes] + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._update_initial( + resource_group_name=resource_group_name, + capacity_reservation_group_name=capacity_reservation_group_name, + capacity_reservation_name=capacity_reservation_name, + properties=properties, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + def _delete_initial( + self, + resource_group_name: str, + capacity_reservation_group_name: str, + capacity_reservation_name: str, + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_capacity_reservations_delete_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=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_delete( + 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. + Note: Block capacity reservations cannot be deleted after it has been successfully allocated + until the schedule end time. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param capacity_reservation_group_name: The name of the capacity reservation group. Required. + :type capacity_reservation_group_name: str + :param capacity_reservation_name: The name of the capacity reservation. Required. + :type capacity_reservation_name: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + capacity_reservation_group_name=capacity_reservation_group_name, + capacity_reservation_name=capacity_reservation_name, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace + def list_by_capacity_reservation_group( + self, resource_group_name: str, capacity_reservation_group_name: str, **kwargs: Any + ) -> ItemPaged["_models.CapacityReservation"]: + """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. The name is case insensitive. + Required. + :type resource_group_name: str + :param capacity_reservation_group_name: The name of the capacity reservation group. Required. + :type capacity_reservation_group_name: str + :return: An iterator like instance of CapacityReservation + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.models.CapacityReservation] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.CapacityReservation]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_capacity_reservations_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=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.CapacityReservation], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + +class VirtualMachineRunCommandsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.compute.ComputeClient`'s + :attr:`virtual_machine_run_commands` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @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. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_name: The name of the VirtualMachine. Required. + :type vm_name: str + :param run_command_name: The name of the VirtualMachineRunCommand. Required. + :type run_command_name: str + :keyword expand: The expand expression to apply on the operation. Default value is None. + :paramtype expand: str + :return: VirtualMachineRunCommand. The VirtualMachineRunCommand is compatible with + MutableMapping + :rtype: ~azure.mgmt.compute.models.VirtualMachineRunCommand + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.VirtualMachineRunCommand] = kwargs.pop("cls", None) + + _request = build_virtual_machine_run_commands_get_by_virtual_machine_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + run_command_name=run_command_name, + subscription_id=self._config.subscription_id, + expand=expand, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.VirtualMachineRunCommand, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _create_or_update_initial( + self, + resource_group_name: str, + vm_name: str, + run_command_name: str, + body: Union[_models.VirtualMachineRunCommand, JSON, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_virtual_machine_run_commands_create_or_update_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + run_command_name=run_command_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 201: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + vm_name: str, + run_command_name: str, + body: _models.VirtualMachineRunCommand, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """The operation to create or update the run command. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_name: The name of the VirtualMachine. Required. + :type vm_name: str + :param run_command_name: The name of the VirtualMachineRunCommand. Required. + :type run_command_name: str + :param body: Parameters supplied to the Create Virtual Machine RunCommand operation. Required. + :type body: ~azure.mgmt.compute.models.VirtualMachineRunCommand + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + vm_name: str, + run_command_name: str, + body: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """The operation to create or update the run command. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_name: The name of the VirtualMachine. Required. + :type vm_name: str + :param run_command_name: The name of the VirtualMachineRunCommand. Required. + :type run_command_name: str + :param body: Parameters supplied to the Create Virtual Machine RunCommand operation. Required. + :type body: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + vm_name: str, + run_command_name: str, + body: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """The operation to create or update the run command. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_name: The name of the VirtualMachine. Required. + :type vm_name: str + :param run_command_name: The name of the VirtualMachineRunCommand. Required. + :type run_command_name: str + :param body: Parameters supplied to the Create Virtual Machine RunCommand operation. Required. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + vm_name: str, + run_command_name: str, + body: Union[_models.VirtualMachineRunCommand, JSON, IO[bytes]], + **kwargs: Any + ) -> LROPoller[None]: + """The operation to create or update the run command. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_name: The name of the VirtualMachine. Required. + :type vm_name: str + :param run_command_name: The name of the VirtualMachineRunCommand. Required. + :type run_command_name: str + :param body: Parameters supplied to the Create Virtual Machine RunCommand operation. Is one of + the following types: VirtualMachineRunCommand, JSON, IO[bytes] Required. + :type body: ~azure.mgmt.compute.models.VirtualMachineRunCommand or JSON or IO[bytes] + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + run_command_name=run_command_name, + body=body, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + def _update_initial( + self, + resource_group_name: str, + vm_name: str, + run_command_name: str, + body: Union[_models.VirtualMachineRunCommandUpdate, JSON, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_virtual_machine_run_commands_update_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + run_command_name=run_command_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_update( + self, + resource_group_name: str, + vm_name: str, + run_command_name: str, + body: _models.VirtualMachineRunCommandUpdate, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """The operation to update the run command. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_name: The name of the VirtualMachine. Required. + :type vm_name: str + :param run_command_name: The name of the VirtualMachineRunCommand. Required. + :type run_command_name: str + :param body: Parameters supplied to the Update Virtual Machine RunCommand operation. Required. + :type body: ~azure.mgmt.compute.models.VirtualMachineRunCommandUpdate + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update( + self, + resource_group_name: str, + vm_name: str, + run_command_name: str, + body: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """The operation to update the run command. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_name: The name of the VirtualMachine. Required. + :type vm_name: str + :param run_command_name: The name of the VirtualMachineRunCommand. Required. + :type run_command_name: str + :param body: Parameters supplied to the Update Virtual Machine RunCommand operation. Required. + :type body: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update( + self, + resource_group_name: str, + vm_name: str, + run_command_name: str, + body: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """The operation to update the run command. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_name: The name of the VirtualMachine. Required. + :type vm_name: str + :param run_command_name: The name of the VirtualMachineRunCommand. Required. + :type run_command_name: str + :param body: Parameters supplied to the Update Virtual Machine RunCommand operation. Required. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update( + self, + resource_group_name: str, + vm_name: str, + run_command_name: str, + body: Union[_models.VirtualMachineRunCommandUpdate, JSON, IO[bytes]], + **kwargs: Any + ) -> LROPoller[None]: + """The operation to update the run command. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_name: The name of the VirtualMachine. Required. + :type vm_name: str + :param run_command_name: The name of the VirtualMachineRunCommand. Required. + :type run_command_name: str + :param body: Parameters supplied to the Update Virtual Machine RunCommand operation. Is one of + the following types: VirtualMachineRunCommandUpdate, JSON, IO[bytes] Required. + :type body: ~azure.mgmt.compute.models.VirtualMachineRunCommandUpdate or JSON or IO[bytes] + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._update_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + run_command_name=run_command_name, + body=body, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + def _delete_initial( + self, resource_group_name: str, vm_name: str, run_command_name: str, **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_virtual_machine_run_commands_delete_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=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_delete( + 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. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_name: The name of the VirtualMachine. Required. + :type vm_name: str + :param run_command_name: The name of the VirtualMachineRunCommand. Required. + :type run_command_name: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + run_command_name=run_command_name, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace + def list_by_virtual_machine( + self, resource_group_name: str, vm_name: str, *, expand: Optional[str] = None, **kwargs: Any + ) -> ItemPaged["_models.VirtualMachineRunCommand"]: + """The operation to get all run commands of a Virtual Machine. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_name: The name of the VirtualMachine. Required. + :type vm_name: str + :keyword expand: The expand expression to apply on the operation. Default value is None. + :paramtype expand: str + :return: An iterator like instance of VirtualMachineRunCommand + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.models.VirtualMachineRunCommand] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.VirtualMachineRunCommand]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_virtual_machine_run_commands_list_by_virtual_machine_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + expand=expand, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.VirtualMachineRunCommand], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + +class VirtualMachineScaleSetVMRunCommandsOperations: # pylint: disable=name-too-long + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.compute.ComputeClient`'s + :attr:`virtual_machine_scale_set_vm_run_commands` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @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. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VirtualMachineScaleSet. Required. + :type vm_scale_set_name: str + :param instance_id: The name of the VirtualMachineScaleSetVM. Required. + :type instance_id: str + :param run_command_name: The name of the VirtualMachineRunCommand. Required. + :type run_command_name: str + :keyword expand: The expand expression to apply on the operation. Default value is None. + :paramtype expand: str + :return: VirtualMachineRunCommand. The VirtualMachineRunCommand is compatible with + MutableMapping + :rtype: ~azure.mgmt.compute.models.VirtualMachineRunCommand + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.VirtualMachineRunCommand] = kwargs.pop("cls", None) + + _request = build_virtual_machine_scale_set_vm_run_commands_get_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + run_command_name=run_command_name, + subscription_id=self._config.subscription_id, + expand=expand, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.VirtualMachineRunCommand, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _create_or_update_initial( + self, + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + run_command_name: str, + body: Union[_models.VirtualMachineRunCommand, JSON, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_virtual_machine_scale_set_vm_run_commands_create_or_update_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, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 201: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + run_command_name: str, + body: _models.VirtualMachineRunCommand, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """The operation to create or update the VMSS VM run command. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VirtualMachineScaleSet. Required. + :type vm_scale_set_name: str + :param instance_id: The name of the VirtualMachineScaleSetVM. Required. + :type instance_id: str + :param run_command_name: The name of the VirtualMachineRunCommand. Required. + :type run_command_name: str + :param body: Parameters supplied to the Create Virtual Machine RunCommand operation. Required. + :type body: ~azure.mgmt.compute.models.VirtualMachineRunCommand + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + run_command_name: str, + body: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """The operation to create or update the VMSS VM run command. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VirtualMachineScaleSet. Required. + :type vm_scale_set_name: str + :param instance_id: The name of the VirtualMachineScaleSetVM. Required. + :type instance_id: str + :param run_command_name: The name of the VirtualMachineRunCommand. Required. + :type run_command_name: str + :param body: Parameters supplied to the Create Virtual Machine RunCommand operation. Required. + :type body: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + run_command_name: str, + body: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """The operation to create or update the VMSS VM run command. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VirtualMachineScaleSet. Required. + :type vm_scale_set_name: str + :param instance_id: The name of the VirtualMachineScaleSetVM. Required. + :type instance_id: str + :param run_command_name: The name of the VirtualMachineRunCommand. Required. + :type run_command_name: str + :param body: Parameters supplied to the Create Virtual Machine RunCommand operation. Required. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + run_command_name: str, + body: Union[_models.VirtualMachineRunCommand, JSON, IO[bytes]], + **kwargs: Any + ) -> LROPoller[None]: + """The operation to create or update the VMSS VM run command. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VirtualMachineScaleSet. Required. + :type vm_scale_set_name: str + :param instance_id: The name of the VirtualMachineScaleSetVM. Required. + :type instance_id: str + :param run_command_name: The name of the VirtualMachineRunCommand. Required. + :type run_command_name: str + :param body: Parameters supplied to the Create Virtual Machine RunCommand operation. Is one of + the following types: VirtualMachineRunCommand, JSON, IO[bytes] Required. + :type body: ~azure.mgmt.compute.models.VirtualMachineRunCommand or JSON or IO[bytes] + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._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, + body=body, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + def _update_initial( + self, + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + run_command_name: str, + body: Union[_models.VirtualMachineRunCommandUpdate, JSON, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_virtual_machine_scale_set_vm_run_commands_update_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, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_update( + self, + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + run_command_name: str, + body: _models.VirtualMachineRunCommandUpdate, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """The operation to update the VMSS VM run command. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VirtualMachineScaleSet. Required. + :type vm_scale_set_name: str + :param instance_id: The name of the VirtualMachineScaleSetVM. Required. + :type instance_id: str + :param run_command_name: The name of the VirtualMachineRunCommand. Required. + :type run_command_name: str + :param body: Resource create parameters. Required. + :type body: ~azure.mgmt.compute.models.VirtualMachineRunCommandUpdate + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update( + self, + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + run_command_name: str, + body: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """The operation to update the VMSS VM run command. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VirtualMachineScaleSet. Required. + :type vm_scale_set_name: str + :param instance_id: The name of the VirtualMachineScaleSetVM. Required. + :type instance_id: str + :param run_command_name: The name of the VirtualMachineRunCommand. Required. + :type run_command_name: str + :param body: Resource create parameters. Required. + :type body: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update( + self, + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + run_command_name: str, + body: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """The operation to update the VMSS VM run command. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VirtualMachineScaleSet. Required. + :type vm_scale_set_name: str + :param instance_id: The name of the VirtualMachineScaleSetVM. Required. + :type instance_id: str + :param run_command_name: The name of the VirtualMachineRunCommand. Required. + :type run_command_name: str + :param body: Resource create parameters. Required. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update( + self, + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + run_command_name: str, + body: Union[_models.VirtualMachineRunCommandUpdate, JSON, IO[bytes]], + **kwargs: Any + ) -> LROPoller[None]: + """The operation to update the VMSS VM run command. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VirtualMachineScaleSet. Required. + :type vm_scale_set_name: str + :param instance_id: The name of the VirtualMachineScaleSetVM. Required. + :type instance_id: str + :param run_command_name: The name of the VirtualMachineRunCommand. Required. + :type run_command_name: str + :param body: Resource create parameters. Is one of the following types: + VirtualMachineRunCommandUpdate, JSON, IO[bytes] Required. + :type body: ~azure.mgmt.compute.models.VirtualMachineRunCommandUpdate or JSON or IO[bytes] + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._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, + body=body, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + def _delete_initial( + self, resource_group_name: str, vm_scale_set_name: str, instance_id: str, run_command_name: str, **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_virtual_machine_scale_set_vm_run_commands_delete_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=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_delete( + 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. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VirtualMachineScaleSet. Required. + :type vm_scale_set_name: str + :param instance_id: The name of the VirtualMachineScaleSetVM. Required. + :type instance_id: str + :param run_command_name: The name of the VirtualMachineRunCommand. Required. + :type run_command_name: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + run_command_name=run_command_name, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # 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 + ) -> ItemPaged["_models.VirtualMachineRunCommand"]: + """The operation to get all run commands of an instance in Virtual Machine Scaleset. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VirtualMachineScaleSet. Required. + :type vm_scale_set_name: str + :param instance_id: The name of the VirtualMachineScaleSetVM. Required. + :type instance_id: str + :keyword expand: The expand expression to apply on the operation. Default value is None. + :paramtype expand: str + :return: An iterator like instance of VirtualMachineRunCommand + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.models.VirtualMachineRunCommand] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.VirtualMachineRunCommand]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_virtual_machine_scale_set_vm_run_commands_list_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + expand=expand, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.VirtualMachineRunCommand], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + +class UsageOperationGroupOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.compute.ComputeClient`'s + :attr:`usage_operation_group` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list(self, location: str, **kwargs: Any) -> ItemPaged["_models.Usage"]: + """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 name. Required. + :type location: str + :return: An iterator like instance of Usage + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.models.Usage] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.Usage]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_usage_operation_group_list_request( + location=location, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.Usage], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + +class VirtualMachineSizesOperationGroupOperations: # pylint: disable=name-too-long + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.compute.ComputeClient`'s + :attr:`virtual_machine_sizes_operation_group` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list(self, location: str, **kwargs: Any) -> ItemPaged["_models.VirtualMachineSize"]: + """This API is deprecated. Use `Resources Skus + `_. + + :param location: The location name. Required. + :type location: str + :return: An iterator like instance of VirtualMachineSize + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.models.VirtualMachineSize] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.VirtualMachineSize]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_virtual_machine_sizes_operation_group_list_request( + location=location, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.VirtualMachineSize], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + +class VirtualMachineScaleSetsOperationGroupOperations: # pylint: disable=name-too-long + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.compute.ComputeClient`'s + :attr:`virtual_machine_scale_sets_operation_group` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list_by_location(self, location: str, **kwargs: Any) -> ItemPaged["_models.VirtualMachineScaleSet"]: + """Gets all the VM scale sets under the specified subscription for the specified location. + + :param location: The location name. Required. + :type location: str + :return: An iterator like instance of VirtualMachineScaleSet + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.models.VirtualMachineScaleSet] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.VirtualMachineScaleSet]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_virtual_machine_scale_sets_operation_group_list_by_location_request( + location=location, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.VirtualMachineScaleSet], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + +class VirtualMachinesOperationGroupOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.compute.ComputeClient`'s + :attr:`virtual_machines_operation_group` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list_by_location(self, location: str, **kwargs: Any) -> ItemPaged["_models.VirtualMachine"]: + """Gets all the virtual machines under the specified subscription for the specified location. + + :param location: The location name. Required. + :type location: str + :return: An iterator like instance of VirtualMachine + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.models.VirtualMachine] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.VirtualMachine]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_virtual_machines_operation_group_list_by_location_request( + location=location, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.VirtualMachine], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + +class VirtualMachineImagesEdgeZoneOperationGroupOperations: # pylint: disable=name-too-long + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.compute.ComputeClient`'s + :attr:`virtual_machine_images_edge_zone_operation_group` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @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 location name. Required. + :type location: str + :param edge_zone: The name of the edge zone. Required. + :type edge_zone: str + :return: list of VirtualMachineImageResource + :rtype: list[~azure.mgmt.compute.models.VirtualMachineImageResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.VirtualMachineImageResource]] = kwargs.pop("cls", None) + + _request = build_virtual_machine_images_edge_zone_operation_group_list_publishers_request( + location=location, + edge_zone=edge_zone, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(List[_models.VirtualMachineImageResource], response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # 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 location name. Required. + :type location: str + :param edge_zone: The name of the edge zone. Required. + :type edge_zone: str + :param publisher_name: A valid image publisher. Required. + :type publisher_name: str + :return: list of VirtualMachineImageResource + :rtype: list[~azure.mgmt.compute.models.VirtualMachineImageResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.VirtualMachineImageResource]] = kwargs.pop("cls", None) + + _request = build_virtual_machine_images_edge_zone_operation_group_list_offers_request( + location=location, + edge_zone=edge_zone, + publisher_name=publisher_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(List[_models.VirtualMachineImageResource], response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # 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 location name. Required. + :type location: str + :param edge_zone: The name of the edge zone. Required. + :type edge_zone: str + :param publisher_name: A valid image publisher. Required. + :type publisher_name: str + :param offer: A valid image publisher offer. Required. + :type offer: str + :return: list of VirtualMachineImageResource + :rtype: list[~azure.mgmt.compute.models.VirtualMachineImageResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.VirtualMachineImageResource]] = kwargs.pop("cls", None) + + _request = build_virtual_machine_images_edge_zone_operation_group_list_skus_request( + location=location, + edge_zone=edge_zone, + publisher_name=publisher_name, + offer=offer, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(List[_models.VirtualMachineImageResource], response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # 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 location name. Required. + :type location: str + :param edge_zone: The name of the edge zone. Required. + :type edge_zone: str + :param publisher_name: A valid image publisher. Required. + :type publisher_name: str + :param offer: A valid image publisher offer. Required. + :type offer: str + :param skus: A valid image SKU. Required. + :type skus: str + :keyword expand: The expand expression to apply on the operation. Default value is None. + :paramtype expand: str + :keyword top: An integer value specifying the number of images to return that matches supplied + values. Default value is None. + :paramtype top: int + :keyword orderby: Specifies the order of the results returned. Formatted as an OData query. + Default value is None. + :paramtype orderby: str + :return: list of VirtualMachineImageResource + :rtype: list[~azure.mgmt.compute.models.VirtualMachineImageResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.VirtualMachineImageResource]] = kwargs.pop("cls", None) + + _request = build_virtual_machine_images_edge_zone_operation_group_list_request( + location=location, + edge_zone=edge_zone, + publisher_name=publisher_name, + offer=offer, + skus=skus, + subscription_id=self._config.subscription_id, + expand=expand, + top=top, + orderby=orderby, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(List[_models.VirtualMachineImageResource], response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @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 the Azure region. Required. + :type location: str + :param edge_zone: The name of the edge zone. Required. + :type edge_zone: str + :param publisher_name: A valid image publisher. Required. + :type publisher_name: str + :param offer: A valid image publisher offer. Required. + :type offer: str + :param skus: A valid image SKU. Required. + :type skus: str + :param version: A valid image SKU version. Required. + :type version: str + :return: VirtualMachineImage. The VirtualMachineImage is compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.VirtualMachineImage + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.VirtualMachineImage] = kwargs.pop("cls", None) + + _request = build_virtual_machine_images_edge_zone_operation_group_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=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.VirtualMachineImage, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + +class VirtualMachineImagesOperationGroupOperations: # pylint: disable=name-too-long + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.compute.ComputeClient`'s + :attr:`virtual_machine_images_operation_group` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list_by_edge_zone(self, location: str, edge_zone: str, **kwargs: Any) -> _models.VmImagesInEdgeZoneListResult: + """Gets a list of all virtual machine image versions for the specified edge zone. + + :param location: The location name. Required. + :type location: str + :param edge_zone: The name of the edge zone. Required. + :type edge_zone: str + :return: VmImagesInEdgeZoneListResult. The VmImagesInEdgeZoneListResult is compatible with + MutableMapping + :rtype: ~azure.mgmt.compute.models.VmImagesInEdgeZoneListResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.VmImagesInEdgeZoneListResult] = kwargs.pop("cls", None) + + _request = build_virtual_machine_images_operation_group_list_by_edge_zone_request( + location=location, + edge_zone=edge_zone, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.VmImagesInEdgeZoneListResult, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # 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 location name. Required. + :type location: str + :return: list of VirtualMachineImageResource + :rtype: list[~azure.mgmt.compute.models.VirtualMachineImageResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.VirtualMachineImageResource]] = kwargs.pop("cls", None) + + _request = build_virtual_machine_images_operation_group_list_publishers_request( + location=location, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(List[_models.VirtualMachineImageResource], response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # 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 location name. Required. + :type location: str + :param publisher_name: A valid image publisher. Required. + :type publisher_name: str + :return: list of VirtualMachineImageResource + :rtype: list[~azure.mgmt.compute.models.VirtualMachineImageResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.VirtualMachineImageResource]] = kwargs.pop("cls", None) + + _request = build_virtual_machine_images_operation_group_list_offers_request( + location=location, + publisher_name=publisher_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(List[_models.VirtualMachineImageResource], response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # 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 location name. Required. + :type location: str + :param publisher_name: A valid image publisher. Required. + :type publisher_name: str + :param offer: A valid image publisher offer. Required. + :type offer: str + :return: list of VirtualMachineImageResource + :rtype: list[~azure.mgmt.compute.models.VirtualMachineImageResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.VirtualMachineImageResource]] = kwargs.pop("cls", None) + + _request = build_virtual_machine_images_operation_group_list_skus_request( + location=location, + publisher_name=publisher_name, + offer=offer, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(List[_models.VirtualMachineImageResource], response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # 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 location name. Required. + :type location: str + :param publisher_name: A valid image publisher. Required. + :type publisher_name: str + :param offer: A valid image publisher offer. Required. + :type offer: str + :param skus: A valid image SKU. Required. + :type skus: str + :keyword expand: The expand expression to apply on the operation. Default value is None. + :paramtype expand: str + :keyword top: Default value is None. + :paramtype top: int + :keyword orderby: Default value is None. + :paramtype orderby: str + :return: list of VirtualMachineImageResource + :rtype: list[~azure.mgmt.compute.models.VirtualMachineImageResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.VirtualMachineImageResource]] = kwargs.pop("cls", None) + + _request = build_virtual_machine_images_operation_group_list_request( + location=location, + publisher_name=publisher_name, + offer=offer, + skus=skus, + subscription_id=self._config.subscription_id, + expand=expand, + top=top, + orderby=orderby, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(List[_models.VirtualMachineImageResource], response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list_with_properties( + self, + location: str, + publisher_name: str, + offer: str, + skus: str, + *, + expand: str, + top: Optional[int] = None, + orderby: Optional[str] = None, + **kwargs: Any + ) -> List[_models.VirtualMachineImage]: + """list_with_properties. + + :param location: The location name. Required. + :type location: str + :param publisher_name: A valid image publisher. Required. + :type publisher_name: str + :param offer: A valid image publisher offer. Required. + :type offer: str + :param skus: A valid image SKU. Required. + :type skus: str + :keyword expand: The expand expression to apply on the operation. Required. + :paramtype expand: str + :keyword top: Default value is None. + :paramtype top: int + :keyword orderby: Default value is None. + :paramtype orderby: str + :return: list of VirtualMachineImage + :rtype: list[~azure.mgmt.compute.models.VirtualMachineImage] + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.VirtualMachineImage]] = kwargs.pop("cls", None) + + _request = build_virtual_machine_images_operation_group_list_with_properties_request( + location=location, + publisher_name=publisher_name, + offer=offer, + skus=skus, + subscription_id=self._config.subscription_id, + expand=expand, + top=top, + orderby=orderby, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(List[_models.VirtualMachineImage], response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @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 the Azure region. Required. + :type location: str + :param publisher_name: A valid image publisher. Required. + :type publisher_name: str + :param offer: A valid image publisher offer. Required. + :type offer: str + :param skus: A valid image SKU. Required. + :type skus: str + :param version: A valid image SKU version. Required. + :type version: str + :return: VirtualMachineImage. The VirtualMachineImage is compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.VirtualMachineImage + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.VirtualMachineImage] = kwargs.pop("cls", None) + + _request = build_virtual_machine_images_operation_group_get_request( + location=location, + publisher_name=publisher_name, + offer=offer, + skus=skus, + version=version, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.VirtualMachineImage, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + +class LogAnalyticsOperationGroupOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.compute.ComputeClient`'s + :attr:`log_analytics_operation_group` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + def _export_request_rate_by_interval_initial( + self, location: str, body: Union[_models.RequestRateByIntervalInput, JSON, IO[bytes]], **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_log_analytics_operation_group_export_request_rate_by_interval_request( + location=location, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_export_request_rate_by_interval( + self, + location: str, + body: _models.RequestRateByIntervalInput, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Export logs that show Api requests made by this subscription in the given time window to show + throttling activities. + + :param location: The location name. Required. + :type location: str + :param body: Parameters supplied to the LogAnalytics getRequestRateByInterval Api. Required. + :type body: ~azure.mgmt.compute.models.RequestRateByIntervalInput + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_export_request_rate_by_interval( + self, location: str, body: JSON, *, content_type: str = "application/json", **kwargs: Any + ) -> LROPoller[None]: + """Export logs that show Api requests made by this subscription in the given time window to show + throttling activities. + + :param location: The location name. Required. + :type location: str + :param body: Parameters supplied to the LogAnalytics getRequestRateByInterval Api. Required. + :type body: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_export_request_rate_by_interval( + self, location: str, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any + ) -> LROPoller[None]: + """Export logs that show Api requests made by this subscription in the given time window to show + throttling activities. + + :param location: The location name. Required. + :type location: str + :param body: Parameters supplied to the LogAnalytics getRequestRateByInterval Api. Required. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_export_request_rate_by_interval( + self, location: str, body: Union[_models.RequestRateByIntervalInput, JSON, IO[bytes]], **kwargs: Any + ) -> LROPoller[None]: + """Export logs that show Api requests made by this subscription in the given time window to show + throttling activities. + + :param location: The location name. Required. + :type location: str + :param body: Parameters supplied to the LogAnalytics getRequestRateByInterval Api. Is one of + the following types: RequestRateByIntervalInput, JSON, IO[bytes] Required. + :type body: ~azure.mgmt.compute.models.RequestRateByIntervalInput or JSON or IO[bytes] + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._export_request_rate_by_interval_initial( + location=location, + body=body, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + def _export_throttled_requests_initial( + self, location: str, body: Union[_models.ThrottledRequestsInput, JSON, IO[bytes]], **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_log_analytics_operation_group_export_throttled_requests_request( + location=location, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_export_throttled_requests( + self, + location: str, + body: _models.ThrottledRequestsInput, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Export logs that show total throttled Api requests for this subscription in the given time + window. + + :param location: The location name. Required. + :type location: str + :param body: The request body. Required. + :type body: ~azure.mgmt.compute.models.ThrottledRequestsInput + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_export_throttled_requests( + self, location: str, body: JSON, *, content_type: str = "application/json", **kwargs: Any + ) -> LROPoller[None]: + """Export logs that show total throttled Api requests for this subscription in the given time + window. + + :param location: The location name. Required. + :type location: str + :param body: The request body. Required. + :type body: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_export_throttled_requests( + self, location: str, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any + ) -> LROPoller[None]: + """Export logs that show total throttled Api requests for this subscription in the given time + window. + + :param location: The location name. Required. + :type location: str + :param body: The request body. Required. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_export_throttled_requests( + self, location: str, body: Union[_models.ThrottledRequestsInput, JSON, IO[bytes]], **kwargs: Any + ) -> LROPoller[None]: + """Export logs that show total throttled Api requests for this subscription in the given time + window. + + :param location: The location name. Required. + :type location: str + :param body: The request body. Is one of the following types: ThrottledRequestsInput, JSON, + IO[bytes] Required. + :type body: ~azure.mgmt.compute.models.ThrottledRequestsInput or JSON or IO[bytes] + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._export_throttled_requests_initial( + location=location, + body=body, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + +class VirtualMachineRunCommandsOperationGroupOperations: # pylint: disable=name-too-long + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.compute.ComputeClient`'s + :attr:`virtual_machine_run_commands_operation_group` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list(self, location: str, **kwargs: Any) -> ItemPaged["_models.RunCommandDocumentBase"]: + """Lists all available run commands for a subscription in a location. + + :param location: The location name. Required. + :type location: str + :return: An iterator like instance of RunCommandDocumentBase + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.models.RunCommandDocumentBase] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.RunCommandDocumentBase]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_virtual_machine_run_commands_operation_group_list_request( + location=location, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.RunCommandDocumentBase], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + @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 name of the Azure region. Required. + :type location: str + :param command_id: Specifies a commandId of predefined built-in script. Command IDs available + for Linux are listed at `https://aka.ms/RunCommandManagedLinux#available-commands + `_, Windows at + `https://aka.ms/RunCommandManagedWindows#available-commands + `_. Required. + :type command_id: str + :return: RunCommandDocument. The RunCommandDocument is compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.RunCommandDocument + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.RunCommandDocument] = kwargs.pop("cls", None) + + _request = build_virtual_machine_run_commands_operation_group_get_request( + location=location, + command_id=command_id, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.RunCommandDocument, response.json()) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + +class DisksOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.compute.ComputeClient`'s + :attr:`disks` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def get(self, resource_group_name: str, disk_name: str, **kwargs: Any) -> _models.Disk: + """Gets information about a disk. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param disk_name: The name of the managed disk that is being created. The name can't be changed + after the disk is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The + maximum name length is 80 characters. Required. + :type disk_name: str + :return: Disk. The Disk is compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.Disk + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.Disk] = kwargs.pop("cls", None) + + _request = build_disks_get_request( + resource_group_name=resource_group_name, + disk_name=disk_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.Disk, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _create_or_update_initial( + self, resource_group_name: str, disk_name: str, resource: Union[_models.Disk, JSON, IO[bytes]], **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(resource, (IOBase, bytes)): + _content = resource + else: + _content = json.dumps(resource, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_disks_create_or_update_request( + resource_group_name=resource_group_name, + disk_name=disk_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + disk_name: str, + resource: _models.Disk, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Creates or updates a disk. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param disk_name: The name of the managed disk that is being created. The name can't be changed + after the disk is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The + maximum name length is 80 characters. Required. + :type disk_name: str + :param resource: Disk object supplied in the body of the Put disk operation. Required. + :type resource: ~azure.mgmt.compute.models.Disk + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + disk_name: str, + resource: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Creates or updates a disk. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param disk_name: The name of the managed disk that is being created. The name can't be changed + after the disk is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The + maximum name length is 80 characters. Required. + :type disk_name: str + :param resource: Disk object supplied in the body of the Put disk operation. Required. + :type resource: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + disk_name: str, + resource: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Creates or updates a disk. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param disk_name: The name of the managed disk that is being created. The name can't be changed + after the disk is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The + maximum name length is 80 characters. Required. + :type disk_name: str + :param resource: Disk object supplied in the body of the Put disk operation. Required. + :type resource: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, resource_group_name: str, disk_name: str, resource: Union[_models.Disk, JSON, IO[bytes]], **kwargs: Any + ) -> LROPoller[None]: + """Creates or updates a disk. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param disk_name: The name of the managed disk that is being created. The name can't be changed + after the disk is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The + maximum name length is 80 characters. Required. + :type disk_name: str + :param resource: Disk object supplied in the body of the Put disk operation. Is one of the + following types: Disk, JSON, IO[bytes] Required. + :type resource: ~azure.mgmt.compute.models.Disk or JSON or IO[bytes] + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + disk_name=disk_name, + resource=resource, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + def _update_initial( + self, + resource_group_name: str, + disk_name: str, + properties: Union[_models.DiskUpdate, JSON, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(properties, (IOBase, bytes)): + _content = properties + else: + _content = json.dumps(properties, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_disks_update_request( + resource_group_name=resource_group_name, + disk_name=disk_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_update( + self, + resource_group_name: str, + disk_name: str, + properties: _models.DiskUpdate, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Updates (patches) a disk. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param disk_name: The name of the managed disk that is being created. The name can't be changed + after the disk is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The + maximum name length is 80 characters. Required. + :type disk_name: str + :param properties: Disk object supplied in the body of the Patch disk operation. Required. + :type properties: ~azure.mgmt.compute.models.DiskUpdate + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update( + self, + resource_group_name: str, + disk_name: str, + properties: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Updates (patches) a disk. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param disk_name: The name of the managed disk that is being created. The name can't be changed + after the disk is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The + maximum name length is 80 characters. Required. + :type disk_name: str + :param properties: Disk object supplied in the body of the Patch disk operation. Required. + :type properties: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update( + self, + resource_group_name: str, + disk_name: str, + properties: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Updates (patches) a disk. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param disk_name: The name of the managed disk that is being created. The name can't be changed + after the disk is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The + maximum name length is 80 characters. Required. + :type disk_name: str + :param properties: Disk object supplied in the body of the Patch disk operation. Required. + :type properties: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update( + self, + resource_group_name: str, + disk_name: str, + properties: Union[_models.DiskUpdate, JSON, IO[bytes]], + **kwargs: Any + ) -> LROPoller[None]: + """Updates (patches) a disk. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param disk_name: The name of the managed disk that is being created. The name can't be changed + after the disk is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The + maximum name length is 80 characters. Required. + :type disk_name: str + :param properties: Disk object supplied in the body of the Patch disk operation. Is one of the + following types: DiskUpdate, JSON, IO[bytes] Required. + :type properties: ~azure.mgmt.compute.models.DiskUpdate or JSON or IO[bytes] + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._update_initial( + resource_group_name=resource_group_name, + disk_name=disk_name, + properties=properties, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + def _delete_initial(self, resource_group_name: str, disk_name: str, **kwargs: Any) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_disks_delete_request( + resource_group_name=resource_group_name, + disk_name=disk_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_delete(self, resource_group_name: str, disk_name: str, **kwargs: Any) -> LROPoller[None]: + """Deletes a disk. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param disk_name: The name of the managed disk that is being created. The name can't be changed + after the disk is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The + maximum name length is 80 characters. Required. + :type disk_name: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + disk_name=disk_name, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace + def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> ItemPaged["_models.Disk"]: + """Lists all the disks under a resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :return: An iterator like instance of Disk + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.models.Disk] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.Disk]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_disks_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.Disk], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + @distributed_trace + def list(self, **kwargs: Any) -> ItemPaged["_models.Disk"]: + """Lists all the disks under a subscription. + + :return: An iterator like instance of Disk + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.models.Disk] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.Disk]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_disks_list_request( + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.Disk], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + def _grant_access_initial( + self, + resource_group_name: str, + disk_name: str, + body: Union[_models.GrantAccessData, JSON, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_disks_grant_access_request( + resource_group_name=resource_group_name, + disk_name=disk_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_grant_access( + self, + resource_group_name: str, + disk_name: str, + body: _models.GrantAccessData, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.AccessUri]: + """Grants access to a disk. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param disk_name: The name of the managed disk that is being created. The name can't be changed + after the disk is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The + maximum name length is 80 characters. Required. + :type disk_name: str + :param body: Access data object supplied in the body of the get disk access operation. + Required. + :type body: ~azure.mgmt.compute.models.GrantAccessData + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns AccessUri. The AccessUri is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.AccessUri] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_grant_access( + self, + resource_group_name: str, + disk_name: str, + body: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.AccessUri]: + """Grants access to a disk. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param disk_name: The name of the managed disk that is being created. The name can't be changed + after the disk is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The + maximum name length is 80 characters. Required. + :type disk_name: str + :param body: Access data object supplied in the body of the get disk access operation. + Required. + :type body: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns AccessUri. The AccessUri is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.AccessUri] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_grant_access( + self, + resource_group_name: str, + disk_name: str, + body: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.AccessUri]: + """Grants access to a disk. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param disk_name: The name of the managed disk that is being created. The name can't be changed + after the disk is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The + maximum name length is 80 characters. Required. + :type disk_name: str + :param body: Access data object supplied in the body of the get disk access operation. + Required. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns AccessUri. The AccessUri is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.AccessUri] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_grant_access( + self, + resource_group_name: str, + disk_name: str, + body: Union[_models.GrantAccessData, JSON, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.AccessUri]: + """Grants access to a disk. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param disk_name: The name of the managed disk that is being created. The name can't be changed + after the disk is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The + maximum name length is 80 characters. Required. + :type disk_name: str + :param body: Access data object supplied in the body of the get disk access operation. Is one + of the following types: GrantAccessData, JSON, IO[bytes] Required. + :type body: ~azure.mgmt.compute.models.GrantAccessData or JSON or IO[bytes] + :return: An instance of LROPoller that returns AccessUri. The AccessUri is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.AccessUri] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AccessUri] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._grant_access_initial( + resource_group_name=resource_group_name, + disk_name=disk_name, + body=body, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = _deserialize(_models.AccessUri, response.json()) + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.AccessUri].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.AccessUri]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _revoke_access_initial(self, resource_group_name: str, disk_name: str, **kwargs: Any) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_disks_revoke_access_request( + resource_group_name=resource_group_name, + disk_name=disk_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_revoke_access( + self, resource_group_name: str, disk_name: str, **kwargs: Any + ) -> LROPoller[_models.OkResponse]: + """Revokes access to a disk. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param disk_name: The name of the managed disk that is being created. The name can't be changed + after the disk is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The + maximum name length is 80 characters. Required. + :type disk_name: str + :return: An instance of LROPoller that returns OkResponse. The OkResponse is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.OkResponse] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.OkResponse] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._revoke_access_initial( + resource_group_name=resource_group_name, + disk_name=disk_name, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = _deserialize(_models.OkResponse, response.json()) + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.OkResponse].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.OkResponse]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + +class DiskAccessesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.compute.ComputeClient`'s + :attr:`disk_accesses` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def get(self, resource_group_name: str, disk_access_name: str, **kwargs: Any) -> _models.DiskAccess: + """Gets information about a disk access resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param disk_access_name: The name of the disk access resource that is being created. The name + can't be changed after the disk encryption set is created. Supported characters for the name + are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. + :type disk_access_name: str + :return: DiskAccess. The DiskAccess is compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.DiskAccess + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.DiskAccess] = kwargs.pop("cls", None) + + _request = build_disk_accesses_get_request( + resource_group_name=resource_group_name, + disk_access_name=disk_access_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.DiskAccess, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _create_or_update_initial( + self, + resource_group_name: str, + disk_access_name: str, + resource: Union[_models.DiskAccess, JSON, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(resource, (IOBase, bytes)): + _content = resource + else: + _content = json.dumps(resource, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_disk_accesses_create_or_update_request( + resource_group_name=resource_group_name, + disk_access_name=disk_access_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + disk_access_name: str, + resource: _models.DiskAccess, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Creates or updates a disk access resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param disk_access_name: The name of the disk access resource that is being created. The name + can't be changed after the disk encryption set is created. Supported characters for the name + are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. + :type disk_access_name: str + :param resource: disk access object supplied in the body of the Put disk access operation. + Required. + :type resource: ~azure.mgmt.compute.models.DiskAccess + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + disk_access_name: str, + resource: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Creates or updates a disk access resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param disk_access_name: The name of the disk access resource that is being created. The name + can't be changed after the disk encryption set is created. Supported characters for the name + are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. + :type disk_access_name: str + :param resource: disk access object supplied in the body of the Put disk access operation. + Required. + :type resource: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + disk_access_name: str, + resource: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Creates or updates a disk access resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param disk_access_name: The name of the disk access resource that is being created. The name + can't be changed after the disk encryption set is created. Supported characters for the name + are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. + :type disk_access_name: str + :param resource: disk access object supplied in the body of the Put disk access operation. + Required. + :type resource: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + disk_access_name: str, + resource: Union[_models.DiskAccess, JSON, IO[bytes]], + **kwargs: Any + ) -> LROPoller[None]: + """Creates or updates a disk access resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param disk_access_name: The name of the disk access resource that is being created. The name + can't be changed after the disk encryption set is created. Supported characters for the name + are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. + :type disk_access_name: str + :param resource: disk access object supplied in the body of the Put disk access operation. Is + one of the following types: DiskAccess, JSON, IO[bytes] Required. + :type resource: ~azure.mgmt.compute.models.DiskAccess or JSON or IO[bytes] + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + disk_access_name=disk_access_name, + resource=resource, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + def _update_initial( + self, + resource_group_name: str, + disk_access_name: str, + properties: Union[_models.DiskAccessUpdate, JSON, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(properties, (IOBase, bytes)): + _content = properties + else: + _content = json.dumps(properties, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_disk_accesses_update_request( + resource_group_name=resource_group_name, + disk_access_name=disk_access_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_update( + self, + resource_group_name: str, + disk_access_name: str, + properties: _models.DiskAccessUpdate, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Updates (patches) a disk access resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param disk_access_name: The name of the disk access resource that is being created. The name + can't be changed after the disk encryption set is created. Supported characters for the name + are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. + :type disk_access_name: str + :param properties: disk access object supplied in the body of the Patch disk access operation. + Required. + :type properties: ~azure.mgmt.compute.models.DiskAccessUpdate + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update( + self, + resource_group_name: str, + disk_access_name: str, + properties: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Updates (patches) a disk access resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param disk_access_name: The name of the disk access resource that is being created. The name + can't be changed after the disk encryption set is created. Supported characters for the name + are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. + :type disk_access_name: str + :param properties: disk access object supplied in the body of the Patch disk access operation. + Required. + :type properties: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update( + self, + resource_group_name: str, + disk_access_name: str, + properties: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Updates (patches) a disk access resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param disk_access_name: The name of the disk access resource that is being created. The name + can't be changed after the disk encryption set is created. Supported characters for the name + are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. + :type disk_access_name: str + :param properties: disk access object supplied in the body of the Patch disk access operation. + Required. + :type properties: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update( + self, + resource_group_name: str, + disk_access_name: str, + properties: Union[_models.DiskAccessUpdate, JSON, IO[bytes]], + **kwargs: Any + ) -> LROPoller[None]: + """Updates (patches) a disk access resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param disk_access_name: The name of the disk access resource that is being created. The name + can't be changed after the disk encryption set is created. Supported characters for the name + are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. + :type disk_access_name: str + :param properties: disk access object supplied in the body of the Patch disk access operation. + Is one of the following types: DiskAccessUpdate, JSON, IO[bytes] Required. + :type properties: ~azure.mgmt.compute.models.DiskAccessUpdate or JSON or IO[bytes] + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._update_initial( + resource_group_name=resource_group_name, + disk_access_name=disk_access_name, + properties=properties, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + def _delete_initial(self, resource_group_name: str, disk_access_name: str, **kwargs: Any) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_disk_accesses_delete_request( + resource_group_name=resource_group_name, + disk_access_name=disk_access_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_delete(self, resource_group_name: str, disk_access_name: str, **kwargs: Any) -> LROPoller[None]: + """Deletes a disk access resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param disk_access_name: The name of the disk access resource that is being created. The name + can't be changed after the disk encryption set is created. Supported characters for the name + are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. + :type disk_access_name: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + disk_access_name=disk_access_name, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace + def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> ItemPaged["_models.DiskAccess"]: + """Lists all the disk access resources under a resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :return: An iterator like instance of DiskAccess + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.models.DiskAccess] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.DiskAccess]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_disk_accesses_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.DiskAccess], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + @distributed_trace + def list(self, **kwargs: Any) -> ItemPaged["_models.DiskAccess"]: + """Lists all the disk access resources under a subscription. + + :return: An iterator like instance of DiskAccess + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.models.DiskAccess] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.DiskAccess]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_disk_accesses_list_request( + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.DiskAccess], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + @distributed_trace + def get_private_link_resources( + self, resource_group_name: str, disk_access_name: str, **kwargs: Any + ) -> _models.PrivateLinkResourceListResult: + """Gets the private link resources possible under disk access resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param disk_access_name: The name of the disk access resource that is being created. The name + can't be changed after the disk encryption set is created. Supported characters for the name + are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. + :type disk_access_name: str + :return: PrivateLinkResourceListResult. The PrivateLinkResourceListResult is compatible with + MutableMapping + :rtype: ~azure.mgmt.compute.models.PrivateLinkResourceListResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.PrivateLinkResourceListResult] = kwargs.pop("cls", None) + + _request = build_disk_accesses_get_private_link_resources_request( + resource_group_name=resource_group_name, + disk_access_name=disk_access_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.PrivateLinkResourceListResult, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + +class PrivateEndpointConnectionsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.compute.ComputeClient`'s + :attr:`private_endpoint_connections` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def get_a_private_endpoint_connection( + self, resource_group_name: str, disk_access_name: str, private_endpoint_connection_name: str, **kwargs: Any + ) -> _models.PrivateEndpointConnection: + """Gets information about a private endpoint connection under a disk access resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param disk_access_name: The name of the disk access resource that is being created. The name + can't be changed after the disk encryption set is created. Supported characters for the name + are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. + :type disk_access_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. + :type private_endpoint_connection_name: str + :return: PrivateEndpointConnection. The PrivateEndpointConnection is compatible with + MutableMapping + :rtype: ~azure.mgmt.compute.models.PrivateEndpointConnection + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) + + _request = build_private_endpoint_connections_get_a_private_endpoint_connection_request( + resource_group_name=resource_group_name, + disk_access_name=disk_access_name, + private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.PrivateEndpointConnection, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _update_a_private_endpoint_connection_initial( # pylint: disable=name-too-long + self, + resource_group_name: str, + disk_access_name: str, + private_endpoint_connection_name: str, + resource: Union[_models.PrivateEndpointConnection, JSON, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(resource, (IOBase, bytes)): + _content = resource + else: + _content = json.dumps(resource, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_private_endpoint_connections_update_a_private_endpoint_connection_request( + resource_group_name=resource_group_name, + disk_access_name=disk_access_name, + private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_update_a_private_endpoint_connection( # pylint: disable=name-too-long + self, + resource_group_name: str, + disk_access_name: str, + private_endpoint_connection_name: str, + resource: _models.PrivateEndpointConnection, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Approve or reject a private endpoint connection under disk access resource, this can't be used + to create a new private endpoint connection. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param disk_access_name: The name of the disk access resource that is being created. The name + can't be changed after the disk encryption set is created. Supported characters for the name + are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. + :type disk_access_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. + :type private_endpoint_connection_name: str + :param resource: private endpoint connection object supplied in the body of the Put private + endpoint connection operation. Required. + :type resource: ~azure.mgmt.compute.models.PrivateEndpointConnection + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update_a_private_endpoint_connection( # pylint: disable=name-too-long + self, + resource_group_name: str, + disk_access_name: str, + private_endpoint_connection_name: str, + resource: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Approve or reject a private endpoint connection under disk access resource, this can't be used + to create a new private endpoint connection. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param disk_access_name: The name of the disk access resource that is being created. The name + can't be changed after the disk encryption set is created. Supported characters for the name + are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. + :type disk_access_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. + :type private_endpoint_connection_name: str + :param resource: private endpoint connection object supplied in the body of the Put private + endpoint connection operation. Required. + :type resource: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update_a_private_endpoint_connection( # pylint: disable=name-too-long + self, + resource_group_name: str, + disk_access_name: str, + private_endpoint_connection_name: str, + resource: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Approve or reject a private endpoint connection under disk access resource, this can't be used + to create a new private endpoint connection. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param disk_access_name: The name of the disk access resource that is being created. The name + can't be changed after the disk encryption set is created. Supported characters for the name + are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. + :type disk_access_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. + :type private_endpoint_connection_name: str + :param resource: private endpoint connection object supplied in the body of the Put private + endpoint connection operation. Required. + :type resource: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update_a_private_endpoint_connection( # pylint: disable=name-too-long + self, + resource_group_name: str, + disk_access_name: str, + private_endpoint_connection_name: str, + resource: Union[_models.PrivateEndpointConnection, JSON, IO[bytes]], + **kwargs: Any + ) -> LROPoller[None]: + """Approve or reject a private endpoint connection under disk access resource, this can't be used + to create a new private endpoint connection. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param disk_access_name: The name of the disk access resource that is being created. The name + can't be changed after the disk encryption set is created. Supported characters for the name + are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. + :type disk_access_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. + :type private_endpoint_connection_name: str + :param resource: private endpoint connection object supplied in the body of the Put private + endpoint connection operation. Is one of the following types: PrivateEndpointConnection, JSON, + IO[bytes] Required. + :type resource: ~azure.mgmt.compute.models.PrivateEndpointConnection or JSON or IO[bytes] + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._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, + resource=resource, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + def _delete_a_private_endpoint_connection_initial( # pylint: disable=name-too-long + self, resource_group_name: str, disk_access_name: str, private_endpoint_connection_name: str, **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_private_endpoint_connections_delete_a_private_endpoint_connection_request( + resource_group_name=resource_group_name, + disk_access_name=disk_access_name, + private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_delete_a_private_endpoint_connection( # pylint: disable=name-too-long + self, resource_group_name: str, disk_access_name: str, private_endpoint_connection_name: str, **kwargs: Any + ) -> LROPoller[None]: + """Deletes a private endpoint connection under a disk access resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param disk_access_name: The name of the disk access resource that is being created. The name + can't be changed after the disk encryption set is created. Supported characters for the name + are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. + :type disk_access_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. + :type private_endpoint_connection_name: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_a_private_endpoint_connection_initial( + resource_group_name=resource_group_name, + disk_access_name=disk_access_name, + private_endpoint_connection_name=private_endpoint_connection_name, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace + def list_private_endpoint_connections( + self, resource_group_name: str, disk_access_name: str, **kwargs: Any + ) -> ItemPaged["_models.PrivateEndpointConnection"]: + """List information about private endpoint connections under a disk access resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param disk_access_name: The name of the disk access resource that is being created. The name + can't be changed after the disk encryption set is created. Supported characters for the name + are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. + :type disk_access_name: str + :return: An iterator like instance of PrivateEndpointConnection + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.models.PrivateEndpointConnection] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.PrivateEndpointConnection]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_private_endpoint_connections_list_private_endpoint_connections_request( + resource_group_name=resource_group_name, + disk_access_name=disk_access_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.PrivateEndpointConnection], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + +class DiskEncryptionSetsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.compute.ComputeClient`'s + :attr:`disk_encryption_sets` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def get(self, resource_group_name: str, disk_encryption_set_name: str, **kwargs: Any) -> _models.DiskEncryptionSet: + """Gets information about a disk encryption set. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param disk_encryption_set_name: The name of the disk encryption set that is being created. The + name can't be changed after the disk encryption set is created. Supported characters for the + name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. + :type disk_encryption_set_name: str + :return: DiskEncryptionSet. The DiskEncryptionSet is compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.DiskEncryptionSet + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.DiskEncryptionSet] = kwargs.pop("cls", None) + + _request = build_disk_encryption_sets_get_request( + resource_group_name=resource_group_name, + disk_encryption_set_name=disk_encryption_set_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.DiskEncryptionSet, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _create_or_update_initial( + self, + resource_group_name: str, + disk_encryption_set_name: str, + resource: Union[_models.DiskEncryptionSet, JSON, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(resource, (IOBase, bytes)): + _content = resource + else: + _content = json.dumps(resource, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_disk_encryption_sets_create_or_update_request( + resource_group_name=resource_group_name, + disk_encryption_set_name=disk_encryption_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + disk_encryption_set_name: str, + resource: _models.DiskEncryptionSet, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Creates or updates a disk encryption set. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param disk_encryption_set_name: The name of the disk encryption set that is being created. The + name can't be changed after the disk encryption set is created. Supported characters for the + name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. + :type disk_encryption_set_name: str + :param resource: disk encryption set object supplied in the body of the Put disk encryption set + operation. Required. + :type resource: ~azure.mgmt.compute.models.DiskEncryptionSet + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + disk_encryption_set_name: str, + resource: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Creates or updates a disk encryption set. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param disk_encryption_set_name: The name of the disk encryption set that is being created. The + name can't be changed after the disk encryption set is created. Supported characters for the + name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. + :type disk_encryption_set_name: str + :param resource: disk encryption set object supplied in the body of the Put disk encryption set + operation. Required. + :type resource: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + disk_encryption_set_name: str, + resource: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Creates or updates a disk encryption set. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param disk_encryption_set_name: The name of the disk encryption set that is being created. The + name can't be changed after the disk encryption set is created. Supported characters for the + name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. + :type disk_encryption_set_name: str + :param resource: disk encryption set object supplied in the body of the Put disk encryption set + operation. Required. + :type resource: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + disk_encryption_set_name: str, + resource: Union[_models.DiskEncryptionSet, JSON, IO[bytes]], + **kwargs: Any + ) -> LROPoller[None]: + """Creates or updates a disk encryption set. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param disk_encryption_set_name: The name of the disk encryption set that is being created. The + name can't be changed after the disk encryption set is created. Supported characters for the + name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. + :type disk_encryption_set_name: str + :param resource: disk encryption set object supplied in the body of the Put disk encryption set + operation. Is one of the following types: DiskEncryptionSet, JSON, IO[bytes] Required. + :type resource: ~azure.mgmt.compute.models.DiskEncryptionSet or JSON or IO[bytes] + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + disk_encryption_set_name=disk_encryption_set_name, + resource=resource, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + def _update_initial( + self, + resource_group_name: str, + disk_encryption_set_name: str, + properties: Union[_models.DiskEncryptionSetUpdate, JSON, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(properties, (IOBase, bytes)): + _content = properties + else: + _content = json.dumps(properties, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_disk_encryption_sets_update_request( + resource_group_name=resource_group_name, + disk_encryption_set_name=disk_encryption_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_update( + self, + resource_group_name: str, + disk_encryption_set_name: str, + properties: _models.DiskEncryptionSetUpdate, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Updates (patches) a disk encryption set. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param disk_encryption_set_name: The name of the disk encryption set that is being created. The + name can't be changed after the disk encryption set is created. Supported characters for the + name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. + :type disk_encryption_set_name: str + :param properties: disk encryption set object supplied in the body of the Patch disk encryption + set operation. Required. + :type properties: ~azure.mgmt.compute.models.DiskEncryptionSetUpdate + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update( + self, + resource_group_name: str, + disk_encryption_set_name: str, + properties: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Updates (patches) a disk encryption set. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param disk_encryption_set_name: The name of the disk encryption set that is being created. The + name can't be changed after the disk encryption set is created. Supported characters for the + name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. + :type disk_encryption_set_name: str + :param properties: disk encryption set object supplied in the body of the Patch disk encryption + set operation. Required. + :type properties: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update( + self, + resource_group_name: str, + disk_encryption_set_name: str, + properties: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Updates (patches) a disk encryption set. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param disk_encryption_set_name: The name of the disk encryption set that is being created. The + name can't be changed after the disk encryption set is created. Supported characters for the + name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. + :type disk_encryption_set_name: str + :param properties: disk encryption set object supplied in the body of the Patch disk encryption + set operation. Required. + :type properties: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update( + self, + resource_group_name: str, + disk_encryption_set_name: str, + properties: Union[_models.DiskEncryptionSetUpdate, JSON, IO[bytes]], + **kwargs: Any + ) -> LROPoller[None]: + """Updates (patches) a disk encryption set. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param disk_encryption_set_name: The name of the disk encryption set that is being created. The + name can't be changed after the disk encryption set is created. Supported characters for the + name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. + :type disk_encryption_set_name: str + :param properties: disk encryption set object supplied in the body of the Patch disk encryption + set operation. Is one of the following types: DiskEncryptionSetUpdate, JSON, IO[bytes] + Required. + :type properties: ~azure.mgmt.compute.models.DiskEncryptionSetUpdate or JSON or IO[bytes] + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._update_initial( + resource_group_name=resource_group_name, + disk_encryption_set_name=disk_encryption_set_name, + properties=properties, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + def _delete_initial( + self, resource_group_name: str, disk_encryption_set_name: str, **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_disk_encryption_sets_delete_request( + resource_group_name=resource_group_name, + disk_encryption_set_name=disk_encryption_set_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_delete(self, resource_group_name: str, disk_encryption_set_name: str, **kwargs: Any) -> LROPoller[None]: + """Deletes a disk encryption set. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param disk_encryption_set_name: The name of the disk encryption set that is being created. The + name can't be changed after the disk encryption set is created. Supported characters for the + name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. + :type disk_encryption_set_name: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + disk_encryption_set_name=disk_encryption_set_name, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace + def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> ItemPaged["_models.DiskEncryptionSet"]: + """Lists all the disk encryption sets under a resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :return: An iterator like instance of DiskEncryptionSet + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.models.DiskEncryptionSet] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.DiskEncryptionSet]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_disk_encryption_sets_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.DiskEncryptionSet], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + @distributed_trace + def list(self, **kwargs: Any) -> ItemPaged["_models.DiskEncryptionSet"]: + """Lists all the disk encryption sets under a subscription. + + :return: An iterator like instance of DiskEncryptionSet + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.models.DiskEncryptionSet] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.DiskEncryptionSet]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_disk_encryption_sets_list_request( + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.DiskEncryptionSet], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + @distributed_trace + def list_associated_resources( + self, resource_group_name: str, disk_encryption_set_name: str, **kwargs: Any + ) -> ItemPaged[str]: + """Lists all resources that are encrypted with this disk encryption set. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param disk_encryption_set_name: The name of the disk encryption set that is being created. The + name can't be changed after the disk encryption set is created. Supported characters for the + name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. + :type disk_encryption_set_name: str + :return: An iterator like instance of str + :rtype: ~azure.core.paging.ItemPaged[str] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[str]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_disk_encryption_sets_list_associated_resources_request( + resource_group_name=resource_group_name, + disk_encryption_set_name=disk_encryption_set_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[str], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + +class DiskRestorePointsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.compute.ComputeClient`'s + :attr:`disk_restore_points` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def get( + self, + resource_group_name: str, + restore_point_collection_name: str, + vm_restore_point_name: str, + disk_restore_point_name: str, + **kwargs: Any + ) -> _models.DiskRestorePoint: + """Get disk restorePoint resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param restore_point_collection_name: The name of the restore point collection that the disk + restore point belongs. Required. + :type restore_point_collection_name: str + :param vm_restore_point_name: The name of the vm restore point that the disk disk restore point + belongs. Required. + :type vm_restore_point_name: str + :param disk_restore_point_name: The name of the DiskRestorePoint. Required. + :type disk_restore_point_name: str + :return: DiskRestorePoint. The DiskRestorePoint is compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.DiskRestorePoint + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.DiskRestorePoint] = kwargs.pop("cls", None) + + _request = build_disk_restore_points_get_request( + resource_group_name=resource_group_name, + restore_point_collection_name=restore_point_collection_name, + vm_restore_point_name=vm_restore_point_name, + disk_restore_point_name=disk_restore_point_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.DiskRestorePoint, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list_by_restore_point( + self, resource_group_name: str, restore_point_collection_name: str, vm_restore_point_name: str, **kwargs: Any + ) -> ItemPaged["_models.DiskRestorePoint"]: + """Lists diskRestorePoints under a vmRestorePoint. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param restore_point_collection_name: The name of the restore point collection that the disk + restore point belongs. Required. + :type restore_point_collection_name: str + :param vm_restore_point_name: The name of the vm restore point that the disk disk restore point + belongs. Required. + :type vm_restore_point_name: str + :return: An iterator like instance of DiskRestorePoint + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.models.DiskRestorePoint] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.DiskRestorePoint]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_disk_restore_points_list_by_restore_point_request( + resource_group_name=resource_group_name, + restore_point_collection_name=restore_point_collection_name, + vm_restore_point_name=vm_restore_point_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.DiskRestorePoint], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + def _grant_access_initial( + self, + resource_group_name: str, + restore_point_collection_name: str, + vm_restore_point_name: str, + disk_restore_point_name: str, + body: Union[_models.GrantAccessData, JSON, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_disk_restore_points_grant_access_request( + resource_group_name=resource_group_name, + restore_point_collection_name=restore_point_collection_name, + vm_restore_point_name=vm_restore_point_name, + disk_restore_point_name=disk_restore_point_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_grant_access( + self, + resource_group_name: str, + restore_point_collection_name: str, + vm_restore_point_name: str, + disk_restore_point_name: str, + body: _models.GrantAccessData, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.AccessUri]: + """Grants access to a diskRestorePoint. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param restore_point_collection_name: The name of the restore point collection that the disk + restore point belongs. Required. + :type restore_point_collection_name: str + :param vm_restore_point_name: The name of the vm restore point that the disk disk restore point + belongs. Required. + :type vm_restore_point_name: str + :param disk_restore_point_name: The name of the DiskRestorePoint. Required. + :type disk_restore_point_name: str + :param body: Access data object supplied in the body of the get disk access operation. + Required. + :type body: ~azure.mgmt.compute.models.GrantAccessData + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns AccessUri. The AccessUri is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.AccessUri] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_grant_access( + self, + resource_group_name: str, + restore_point_collection_name: str, + vm_restore_point_name: str, + disk_restore_point_name: str, + body: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.AccessUri]: + """Grants access to a diskRestorePoint. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param restore_point_collection_name: The name of the restore point collection that the disk + restore point belongs. Required. + :type restore_point_collection_name: str + :param vm_restore_point_name: The name of the vm restore point that the disk disk restore point + belongs. Required. + :type vm_restore_point_name: str + :param disk_restore_point_name: The name of the DiskRestorePoint. Required. + :type disk_restore_point_name: str + :param body: Access data object supplied in the body of the get disk access operation. + Required. + :type body: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns AccessUri. The AccessUri is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.AccessUri] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_grant_access( + self, + resource_group_name: str, + restore_point_collection_name: str, + vm_restore_point_name: str, + disk_restore_point_name: str, + body: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.AccessUri]: + """Grants access to a diskRestorePoint. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param restore_point_collection_name: The name of the restore point collection that the disk + restore point belongs. Required. + :type restore_point_collection_name: str + :param vm_restore_point_name: The name of the vm restore point that the disk disk restore point + belongs. Required. + :type vm_restore_point_name: str + :param disk_restore_point_name: The name of the DiskRestorePoint. Required. + :type disk_restore_point_name: str + :param body: Access data object supplied in the body of the get disk access operation. + Required. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns AccessUri. The AccessUri is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.AccessUri] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_grant_access( + self, + resource_group_name: str, + restore_point_collection_name: str, + vm_restore_point_name: str, + disk_restore_point_name: str, + body: Union[_models.GrantAccessData, JSON, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.AccessUri]: + """Grants access to a diskRestorePoint. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param restore_point_collection_name: The name of the restore point collection that the disk + restore point belongs. Required. + :type restore_point_collection_name: str + :param vm_restore_point_name: The name of the vm restore point that the disk disk restore point + belongs. Required. + :type vm_restore_point_name: str + :param disk_restore_point_name: The name of the DiskRestorePoint. Required. + :type disk_restore_point_name: str + :param body: Access data object supplied in the body of the get disk access operation. Is one + of the following types: GrantAccessData, JSON, IO[bytes] Required. + :type body: ~azure.mgmt.compute.models.GrantAccessData or JSON or IO[bytes] + :return: An instance of LROPoller that returns AccessUri. The AccessUri is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.AccessUri] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AccessUri] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._grant_access_initial( + resource_group_name=resource_group_name, + restore_point_collection_name=restore_point_collection_name, + vm_restore_point_name=vm_restore_point_name, + disk_restore_point_name=disk_restore_point_name, + body=body, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = _deserialize(_models.AccessUri, response.json()) + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.AccessUri].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.AccessUri]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _revoke_access_initial( + self, + resource_group_name: str, + restore_point_collection_name: str, + vm_restore_point_name: str, + disk_restore_point_name: str, + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_disk_restore_points_revoke_access_request( + resource_group_name=resource_group_name, + restore_point_collection_name=restore_point_collection_name, + vm_restore_point_name=vm_restore_point_name, + disk_restore_point_name=disk_restore_point_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_revoke_access( + self, + resource_group_name: str, + restore_point_collection_name: str, + vm_restore_point_name: str, + disk_restore_point_name: str, + **kwargs: Any + ) -> LROPoller[_models.OkResponse]: + """Revokes access to a diskRestorePoint. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param restore_point_collection_name: The name of the restore point collection that the disk + restore point belongs. Required. + :type restore_point_collection_name: str + :param vm_restore_point_name: The name of the vm restore point that the disk disk restore point + belongs. Required. + :type vm_restore_point_name: str + :param disk_restore_point_name: The name of the DiskRestorePoint. Required. + :type disk_restore_point_name: str + :return: An instance of LROPoller that returns OkResponse. The OkResponse is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.OkResponse] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.OkResponse] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._revoke_access_initial( + resource_group_name=resource_group_name, + restore_point_collection_name=restore_point_collection_name, + vm_restore_point_name=vm_restore_point_name, + disk_restore_point_name=disk_restore_point_name, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = _deserialize(_models.OkResponse, response.json()) + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.OkResponse].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.OkResponse]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + +class SnapshotsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.compute.ComputeClient`'s + :attr:`snapshots` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def get(self, resource_group_name: str, snapshot_name: str, **kwargs: Any) -> _models.Snapshot: + """Gets information about a snapshot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param snapshot_name: The name of the snapshot that is being created. The name can't be changed + after the snapshot is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. + The max name length is 80 characters. Required. + :type snapshot_name: str + :return: Snapshot. The Snapshot is compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.Snapshot + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.Snapshot] = kwargs.pop("cls", None) + + _request = build_snapshots_get_request( + resource_group_name=resource_group_name, + snapshot_name=snapshot_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.Snapshot, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _create_or_update_initial( + self, + resource_group_name: str, + snapshot_name: str, + resource: Union[_models.Snapshot, JSON, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(resource, (IOBase, bytes)): + _content = resource + else: + _content = json.dumps(resource, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_snapshots_create_or_update_request( + resource_group_name=resource_group_name, + snapshot_name=snapshot_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + snapshot_name: str, + resource: _models.Snapshot, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Creates or updates a snapshot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param snapshot_name: The name of the snapshot that is being created. The name can't be changed + after the snapshot is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. + The max name length is 80 characters. Required. + :type snapshot_name: str + :param resource: Snapshot object supplied in the body of the Put disk operation. Required. + :type resource: ~azure.mgmt.compute.models.Snapshot + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + snapshot_name: str, + resource: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Creates or updates a snapshot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param snapshot_name: The name of the snapshot that is being created. The name can't be changed + after the snapshot is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. + The max name length is 80 characters. Required. + :type snapshot_name: str + :param resource: Snapshot object supplied in the body of the Put disk operation. Required. + :type resource: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + snapshot_name: str, + resource: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Creates or updates a snapshot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param snapshot_name: The name of the snapshot that is being created. The name can't be changed + after the snapshot is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. + The max name length is 80 characters. Required. + :type snapshot_name: str + :param resource: Snapshot object supplied in the body of the Put disk operation. Required. + :type resource: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + snapshot_name: str, + resource: Union[_models.Snapshot, JSON, IO[bytes]], + **kwargs: Any + ) -> LROPoller[None]: + """Creates or updates a snapshot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param snapshot_name: The name of the snapshot that is being created. The name can't be changed + after the snapshot is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. + The max name length is 80 characters. Required. + :type snapshot_name: str + :param resource: Snapshot object supplied in the body of the Put disk operation. Is one of the + following types: Snapshot, JSON, IO[bytes] Required. + :type resource: ~azure.mgmt.compute.models.Snapshot or JSON or IO[bytes] + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + snapshot_name=snapshot_name, + resource=resource, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + def _update_initial( + self, + resource_group_name: str, + snapshot_name: str, + properties: Union[_models.SnapshotUpdate, JSON, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(properties, (IOBase, bytes)): + _content = properties + else: + _content = json.dumps(properties, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_snapshots_update_request( + resource_group_name=resource_group_name, + snapshot_name=snapshot_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_update( + self, + resource_group_name: str, + snapshot_name: str, + properties: _models.SnapshotUpdate, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Updates (patches) a snapshot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param snapshot_name: The name of the snapshot that is being created. The name can't be changed + after the snapshot is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. + The max name length is 80 characters. Required. + :type snapshot_name: str + :param properties: Snapshot object supplied in the body of the Patch snapshot operation. + Required. + :type properties: ~azure.mgmt.compute.models.SnapshotUpdate + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update( + self, + resource_group_name: str, + snapshot_name: str, + properties: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Updates (patches) a snapshot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param snapshot_name: The name of the snapshot that is being created. The name can't be changed + after the snapshot is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. + The max name length is 80 characters. Required. + :type snapshot_name: str + :param properties: Snapshot object supplied in the body of the Patch snapshot operation. + Required. + :type properties: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update( + self, + resource_group_name: str, + snapshot_name: str, + properties: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Updates (patches) a snapshot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param snapshot_name: The name of the snapshot that is being created. The name can't be changed + after the snapshot is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. + The max name length is 80 characters. Required. + :type snapshot_name: str + :param properties: Snapshot object supplied in the body of the Patch snapshot operation. + Required. + :type properties: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update( + self, + resource_group_name: str, + snapshot_name: str, + properties: Union[_models.SnapshotUpdate, JSON, IO[bytes]], + **kwargs: Any + ) -> LROPoller[None]: + """Updates (patches) a snapshot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param snapshot_name: The name of the snapshot that is being created. The name can't be changed + after the snapshot is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. + The max name length is 80 characters. Required. + :type snapshot_name: str + :param properties: Snapshot object supplied in the body of the Patch snapshot operation. Is one + of the following types: SnapshotUpdate, JSON, IO[bytes] Required. + :type properties: ~azure.mgmt.compute.models.SnapshotUpdate or JSON or IO[bytes] + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._update_initial( + resource_group_name=resource_group_name, + snapshot_name=snapshot_name, + properties=properties, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + def _delete_initial(self, resource_group_name: str, snapshot_name: str, **kwargs: Any) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_snapshots_delete_request( + resource_group_name=resource_group_name, + snapshot_name=snapshot_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_delete(self, resource_group_name: str, snapshot_name: str, **kwargs: Any) -> LROPoller[None]: + """Deletes a snapshot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param snapshot_name: The name of the snapshot that is being created. The name can't be changed + after the snapshot is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. + The max name length is 80 characters. Required. + :type snapshot_name: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + snapshot_name=snapshot_name, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace + def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> ItemPaged["_models.Snapshot"]: + """Lists snapshots under a resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :return: An iterator like instance of Snapshot + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.models.Snapshot] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.Snapshot]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_snapshots_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.Snapshot], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + @distributed_trace + def list(self, **kwargs: Any) -> ItemPaged["_models.Snapshot"]: + """Lists snapshots under a subscription. + + :return: An iterator like instance of Snapshot + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.models.Snapshot] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.Snapshot]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_snapshots_list_request( + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.Snapshot], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + def _grant_access_initial( + self, + resource_group_name: str, + snapshot_name: str, + body: Union[_models.GrantAccessData, JSON, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_snapshots_grant_access_request( + resource_group_name=resource_group_name, + snapshot_name=snapshot_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_grant_access( + self, + resource_group_name: str, + snapshot_name: str, + body: _models.GrantAccessData, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.AccessUri]: + """Grants access to a snapshot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param snapshot_name: The name of the snapshot that is being created. The name can't be changed + after the snapshot is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. + The max name length is 80 characters. Required. + :type snapshot_name: str + :param body: Access data object supplied in the body of the get snapshot access operation. + Required. + :type body: ~azure.mgmt.compute.models.GrantAccessData + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns AccessUri. The AccessUri is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.AccessUri] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_grant_access( + self, + resource_group_name: str, + snapshot_name: str, + body: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.AccessUri]: + """Grants access to a snapshot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param snapshot_name: The name of the snapshot that is being created. The name can't be changed + after the snapshot is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. + The max name length is 80 characters. Required. + :type snapshot_name: str + :param body: Access data object supplied in the body of the get snapshot access operation. + Required. + :type body: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns AccessUri. The AccessUri is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.AccessUri] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_grant_access( + self, + resource_group_name: str, + snapshot_name: str, + body: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.AccessUri]: + """Grants access to a snapshot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param snapshot_name: The name of the snapshot that is being created. The name can't be changed + after the snapshot is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. + The max name length is 80 characters. Required. + :type snapshot_name: str + :param body: Access data object supplied in the body of the get snapshot access operation. + Required. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns AccessUri. The AccessUri is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.AccessUri] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_grant_access( + self, + resource_group_name: str, + snapshot_name: str, + body: Union[_models.GrantAccessData, JSON, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.AccessUri]: + """Grants access to a snapshot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param snapshot_name: The name of the snapshot that is being created. The name can't be changed + after the snapshot is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. + The max name length is 80 characters. Required. + :type snapshot_name: str + :param body: Access data object supplied in the body of the get snapshot access operation. Is + one of the following types: GrantAccessData, JSON, IO[bytes] Required. + :type body: ~azure.mgmt.compute.models.GrantAccessData or JSON or IO[bytes] + :return: An instance of LROPoller that returns AccessUri. The AccessUri is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.AccessUri] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AccessUri] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._grant_access_initial( + resource_group_name=resource_group_name, + snapshot_name=snapshot_name, + body=body, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = _deserialize(_models.AccessUri, response.json()) + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.AccessUri].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.AccessUri]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _revoke_access_initial(self, resource_group_name: str, snapshot_name: str, **kwargs: Any) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_snapshots_revoke_access_request( + resource_group_name=resource_group_name, + snapshot_name=snapshot_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_revoke_access( + self, resource_group_name: str, snapshot_name: str, **kwargs: Any + ) -> LROPoller[_models.OkResponse]: + """Revokes access to a snapshot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param snapshot_name: The name of the snapshot that is being created. The name can't be changed + after the snapshot is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. + The max name length is 80 characters. Required. + :type snapshot_name: str + :return: An instance of LROPoller that returns OkResponse. The OkResponse is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.OkResponse] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.OkResponse] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._revoke_access_initial( + resource_group_name=resource_group_name, + snapshot_name=snapshot_name, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = _deserialize(_models.OkResponse, response.json()) + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.OkResponse].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.OkResponse]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + +class GalleriesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.compute.ComputeClient`'s + :attr:`galleries` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def get( + self, + resource_group_name: str, + gallery_name: str, + *, + select: Optional[Union[str, _models.SelectPermissions]] = None, + expand: Optional[Union[str, _models.GalleryExpandParams]] = None, + **kwargs: Any + ) -> _models.Gallery: + """Retrieves information about a Shared Image Gallery. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :keyword select: The select expression to apply on the operation. "Permissions" Default value + is None. + :paramtype select: str or ~azure.mgmt.compute.models.SelectPermissions + :keyword expand: The expand query option to apply on the operation. "SharingProfile/Groups" + Default value is None. + :paramtype expand: str or ~azure.mgmt.compute.models.GalleryExpandParams + :return: Gallery. The Gallery is compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.Gallery + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.Gallery] = kwargs.pop("cls", None) + + _request = build_galleries_get_request( + resource_group_name=resource_group_name, + gallery_name=gallery_name, + subscription_id=self._config.subscription_id, + select=select, + expand=expand, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.Gallery, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _create_or_update_initial( + self, + resource_group_name: str, + gallery_name: str, + resource: Union[_models.Gallery, JSON, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(resource, (IOBase, bytes)): + _content = resource + else: + _content = json.dumps(resource, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_galleries_create_or_update_request( + resource_group_name=resource_group_name, + gallery_name=gallery_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 201: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + gallery_name: str, + resource: _models.Gallery, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Create or update a Shared Image Gallery. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param resource: Parameters supplied to the create or update Shared Image Gallery operation. + Required. + :type resource: ~azure.mgmt.compute.models.Gallery + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + gallery_name: str, + resource: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Create or update a Shared Image Gallery. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param resource: Parameters supplied to the create or update Shared Image Gallery operation. + Required. + :type resource: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + gallery_name: str, + resource: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Create or update a Shared Image Gallery. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param resource: Parameters supplied to the create or update Shared Image Gallery operation. + Required. + :type resource: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + gallery_name: str, + resource: Union[_models.Gallery, JSON, IO[bytes]], + **kwargs: Any + ) -> LROPoller[None]: + """Create or update a Shared Image Gallery. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param resource: Parameters supplied to the create or update Shared Image Gallery operation. Is + one of the following types: Gallery, JSON, IO[bytes] Required. + :type resource: ~azure.mgmt.compute.models.Gallery or JSON or IO[bytes] + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + gallery_name=gallery_name, + resource=resource, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + def _update_initial( + self, + resource_group_name: str, + gallery_name: str, + properties: Union[_models.GalleryUpdate, JSON, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(properties, (IOBase, bytes)): + _content = properties + else: + _content = json.dumps(properties, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_galleries_update_request( + resource_group_name=resource_group_name, + gallery_name=gallery_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_update( + self, + resource_group_name: str, + gallery_name: str, + properties: _models.GalleryUpdate, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Update a Shared Image Gallery. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param properties: Parameters supplied to the update Shared Image Gallery operation. Required. + :type properties: ~azure.mgmt.compute.models.GalleryUpdate + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update( + self, + resource_group_name: str, + gallery_name: str, + properties: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Update a Shared Image Gallery. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param properties: Parameters supplied to the update Shared Image Gallery operation. Required. + :type properties: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update( + self, + resource_group_name: str, + gallery_name: str, + properties: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Update a Shared Image Gallery. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param properties: Parameters supplied to the update Shared Image Gallery operation. Required. + :type properties: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update( + self, + resource_group_name: str, + gallery_name: str, + properties: Union[_models.GalleryUpdate, JSON, IO[bytes]], + **kwargs: Any + ) -> LROPoller[None]: + """Update a Shared Image Gallery. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param properties: Parameters supplied to the update Shared Image Gallery operation. Is one of + the following types: GalleryUpdate, JSON, IO[bytes] Required. + :type properties: ~azure.mgmt.compute.models.GalleryUpdate or JSON or IO[bytes] + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._update_initial( + resource_group_name=resource_group_name, + gallery_name=gallery_name, + properties=properties, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + def _delete_initial(self, resource_group_name: str, gallery_name: str, **kwargs: Any) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_galleries_delete_request( + resource_group_name=resource_group_name, + gallery_name=gallery_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_delete(self, resource_group_name: str, gallery_name: str, **kwargs: Any) -> LROPoller[None]: + """Delete a Shared Image Gallery. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + gallery_name=gallery_name, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace + def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> ItemPaged["_models.Gallery"]: + """List galleries under a resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :return: An iterator like instance of Gallery + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.models.Gallery] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.Gallery]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_galleries_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.Gallery], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + @distributed_trace + def list(self, **kwargs: Any) -> ItemPaged["_models.Gallery"]: + """List galleries under a subscription. + + :return: An iterator like instance of Gallery + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.models.Gallery] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.Gallery]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_galleries_list_request( + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.Gallery], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + @distributed_trace + def list_by_artifact_name( + self, resource_group_name: str, gallery_name: str, artifact_type: str, artifact_name: str, **kwargs: Any + ) -> ItemPaged["_models.GallerySoftDeletedResource"]: + """List soft-deleted resources of an artifact in the gallery, such as soft-deleted gallery image + version of an image. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param artifact_type: The type of the artifact to be listed, such as gallery image version. + Required. + :type artifact_type: str + :param artifact_name: The artifact name to be listed. If artifact type is Images, then the + artifact name should be the gallery image name. Required. + :type artifact_name: str + :return: An iterator like instance of GallerySoftDeletedResource + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.models.GallerySoftDeletedResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.GallerySoftDeletedResource]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_galleries_list_by_artifact_name_request( + resource_group_name=resource_group_name, + gallery_name=gallery_name, + artifact_type=artifact_type, + artifact_name=artifact_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.GallerySoftDeletedResource], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + def _gallery_sharing_profile_update_initial( + self, + resource_group_name: str, + gallery_name: str, + body: Union[_models.SharingUpdate, JSON, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_galleries_gallery_sharing_profile_update_request( + resource_group_name=resource_group_name, + gallery_name=gallery_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_gallery_sharing_profile_update( + self, + resource_group_name: str, + gallery_name: str, + body: _models.SharingUpdate, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Update sharing profile of a gallery. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param body: Parameters supplied to the update gallery sharing profile. Required. + :type body: ~azure.mgmt.compute.models.SharingUpdate + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_gallery_sharing_profile_update( + self, + resource_group_name: str, + gallery_name: str, + body: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Update sharing profile of a gallery. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param body: Parameters supplied to the update gallery sharing profile. Required. + :type body: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_gallery_sharing_profile_update( + self, + resource_group_name: str, + gallery_name: str, + body: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Update sharing profile of a gallery. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param body: Parameters supplied to the update gallery sharing profile. Required. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_gallery_sharing_profile_update( + self, + resource_group_name: str, + gallery_name: str, + body: Union[_models.SharingUpdate, JSON, IO[bytes]], + **kwargs: Any + ) -> LROPoller[None]: + """Update sharing profile of a gallery. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param body: Parameters supplied to the update gallery sharing profile. Is one of the following + types: SharingUpdate, JSON, IO[bytes] Required. + :type body: ~azure.mgmt.compute.models.SharingUpdate or JSON or IO[bytes] + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._gallery_sharing_profile_update_initial( + resource_group_name=resource_group_name, + gallery_name=gallery_name, + body=body, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + +class GalleryImagesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.compute.ComputeClient`'s + :attr:`gallery_images` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def get( + self, resource_group_name: str, gallery_name: str, gallery_image_name: str, **kwargs: Any + ) -> _models.GalleryImage: + """Retrieves information about a gallery image definition. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param gallery_image_name: The name of the gallery image definition to be retrieved. Required. + :type gallery_image_name: str + :return: GalleryImage. The GalleryImage is compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.GalleryImage + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.GalleryImage] = kwargs.pop("cls", None) + + _request = build_gallery_images_get_request( + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_image_name=gallery_image_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.GalleryImage, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _create_or_update_initial( + self, + resource_group_name: str, + gallery_name: str, + gallery_image_name: str, + resource: Union[_models.GalleryImage, JSON, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(resource, (IOBase, bytes)): + _content = resource + else: + _content = json.dumps(resource, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_gallery_images_create_or_update_request( + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_image_name=gallery_image_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 201: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + gallery_name: str, + gallery_image_name: str, + resource: _models.GalleryImage, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Create or update a gallery image definition. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param gallery_image_name: The name of the gallery image definition to be retrieved. Required. + :type gallery_image_name: str + :param resource: Parameters supplied to the create or update gallery image operation. Required. + :type resource: ~azure.mgmt.compute.models.GalleryImage + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + gallery_name: str, + gallery_image_name: str, + resource: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Create or update a gallery image definition. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param gallery_image_name: The name of the gallery image definition to be retrieved. Required. + :type gallery_image_name: str + :param resource: Parameters supplied to the create or update gallery image operation. Required. + :type resource: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + gallery_name: str, + gallery_image_name: str, + resource: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Create or update a gallery image definition. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param gallery_image_name: The name of the gallery image definition to be retrieved. Required. + :type gallery_image_name: str + :param resource: Parameters supplied to the create or update gallery image operation. Required. + :type resource: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + gallery_name: str, + gallery_image_name: str, + resource: Union[_models.GalleryImage, JSON, IO[bytes]], + **kwargs: Any + ) -> LROPoller[None]: + """Create or update a gallery image definition. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param gallery_image_name: The name of the gallery image definition to be retrieved. Required. + :type gallery_image_name: str + :param resource: Parameters supplied to the create or update gallery image operation. Is one of + the following types: GalleryImage, JSON, IO[bytes] Required. + :type resource: ~azure.mgmt.compute.models.GalleryImage or JSON or IO[bytes] + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_image_name=gallery_image_name, + resource=resource, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + def _update_initial( + self, + resource_group_name: str, + gallery_name: str, + gallery_image_name: str, + properties: Union[_models.GalleryImageUpdate, JSON, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(properties, (IOBase, bytes)): + _content = properties + else: + _content = json.dumps(properties, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_gallery_images_update_request( + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_image_name=gallery_image_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_update( + self, + resource_group_name: str, + gallery_name: str, + gallery_image_name: str, + properties: _models.GalleryImageUpdate, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Update a gallery image definition. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param gallery_image_name: The name of the gallery image definition to be retrieved. Required. + :type gallery_image_name: str + :param properties: Parameters supplied to the update gallery image operation. Required. + :type properties: ~azure.mgmt.compute.models.GalleryImageUpdate + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update( + self, + resource_group_name: str, + gallery_name: str, + gallery_image_name: str, + properties: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Update a gallery image definition. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param gallery_image_name: The name of the gallery image definition to be retrieved. Required. + :type gallery_image_name: str + :param properties: Parameters supplied to the update gallery image operation. Required. + :type properties: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update( + self, + resource_group_name: str, + gallery_name: str, + gallery_image_name: str, + properties: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Update a gallery image definition. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param gallery_image_name: The name of the gallery image definition to be retrieved. Required. + :type gallery_image_name: str + :param properties: Parameters supplied to the update gallery image operation. Required. + :type properties: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update( + self, + resource_group_name: str, + gallery_name: str, + gallery_image_name: str, + properties: Union[_models.GalleryImageUpdate, JSON, IO[bytes]], + **kwargs: Any + ) -> LROPoller[None]: + """Update a gallery image definition. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param gallery_image_name: The name of the gallery image definition to be retrieved. Required. + :type gallery_image_name: str + :param properties: Parameters supplied to the update gallery image operation. Is one of the + following types: GalleryImageUpdate, JSON, IO[bytes] Required. + :type properties: ~azure.mgmt.compute.models.GalleryImageUpdate or JSON or IO[bytes] + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._update_initial( + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_image_name=gallery_image_name, + properties=properties, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + def _delete_initial( + self, resource_group_name: str, gallery_name: str, gallery_image_name: str, **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_gallery_images_delete_request( + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_image_name=gallery_image_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_delete( + self, resource_group_name: str, gallery_name: str, gallery_image_name: str, **kwargs: Any + ) -> LROPoller[None]: + """Delete a gallery image. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param gallery_image_name: The name of the gallery image definition to be retrieved. Required. + :type gallery_image_name: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_image_name=gallery_image_name, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace + def list_by_gallery( + self, resource_group_name: str, gallery_name: str, **kwargs: Any + ) -> ItemPaged["_models.GalleryImage"]: + """List gallery image definitions in a gallery. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :return: An iterator like instance of GalleryImage + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.models.GalleryImage] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.GalleryImage]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_gallery_images_list_by_gallery_request( + resource_group_name=resource_group_name, + gallery_name=gallery_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.GalleryImage], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + +class GalleryImageVersionsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.compute.ComputeClient`'s + :attr:`gallery_image_versions` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def get( + self, + resource_group_name: str, + gallery_name: str, + gallery_image_name: str, + gallery_image_version_name: str, + *, + expand: Optional[Union[str, _models.ReplicationStatusTypes]] = None, + **kwargs: Any + ) -> _models.GalleryImageVersion: + """Retrieves information about a gallery image version. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param gallery_image_name: The name of the gallery image definition to be retrieved. Required. + :type gallery_image_name: str + :param gallery_image_version_name: The name of the gallery image version to be retrieved. + Required. + :type gallery_image_version_name: str + :keyword expand: The expand expression to apply on the operation. Known values are: + "ReplicationStatus" and "UefiSettings". Default value is None. + :paramtype expand: str or ~azure.mgmt.compute.models.ReplicationStatusTypes + :return: GalleryImageVersion. The GalleryImageVersion is compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.GalleryImageVersion + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.GalleryImageVersion] = kwargs.pop("cls", None) + + _request = build_gallery_image_versions_get_request( + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_image_name=gallery_image_name, + gallery_image_version_name=gallery_image_version_name, + subscription_id=self._config.subscription_id, + expand=expand, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.GalleryImageVersion, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _create_or_update_initial( + self, + resource_group_name: str, + gallery_name: str, + gallery_image_name: str, + gallery_image_version_name: str, + resource: Union[_models.GalleryImageVersion, JSON, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(resource, (IOBase, bytes)): + _content = resource + else: + _content = json.dumps(resource, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_gallery_image_versions_create_or_update_request( + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_image_name=gallery_image_name, + gallery_image_version_name=gallery_image_version_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 201: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + gallery_name: str, + gallery_image_name: str, + gallery_image_version_name: str, + resource: _models.GalleryImageVersion, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Create or update a gallery image version. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param gallery_image_name: The name of the gallery image definition to be retrieved. Required. + :type gallery_image_name: str + :param gallery_image_version_name: The name of the gallery image version to be retrieved. + Required. + :type gallery_image_version_name: str + :param resource: Parameters supplied to the create or update gallery image version operation. + Required. + :type resource: ~azure.mgmt.compute.models.GalleryImageVersion + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + gallery_name: str, + gallery_image_name: str, + gallery_image_version_name: str, + resource: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Create or update a gallery image version. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param gallery_image_name: The name of the gallery image definition to be retrieved. Required. + :type gallery_image_name: str + :param gallery_image_version_name: The name of the gallery image version to be retrieved. + Required. + :type gallery_image_version_name: str + :param resource: Parameters supplied to the create or update gallery image version operation. + Required. + :type resource: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + gallery_name: str, + gallery_image_name: str, + gallery_image_version_name: str, + resource: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Create or update a gallery image version. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param gallery_image_name: The name of the gallery image definition to be retrieved. Required. + :type gallery_image_name: str + :param gallery_image_version_name: The name of the gallery image version to be retrieved. + Required. + :type gallery_image_version_name: str + :param resource: Parameters supplied to the create or update gallery image version operation. + Required. + :type resource: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + gallery_name: str, + gallery_image_name: str, + gallery_image_version_name: str, + resource: Union[_models.GalleryImageVersion, JSON, IO[bytes]], + **kwargs: Any + ) -> LROPoller[None]: + """Create or update a gallery image version. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param gallery_image_name: The name of the gallery image definition to be retrieved. Required. + :type gallery_image_name: str + :param gallery_image_version_name: The name of the gallery image version to be retrieved. + Required. + :type gallery_image_version_name: str + :param resource: Parameters supplied to the create or update gallery image version operation. + Is one of the following types: GalleryImageVersion, JSON, IO[bytes] Required. + :type resource: ~azure.mgmt.compute.models.GalleryImageVersion or JSON or IO[bytes] + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_image_name=gallery_image_name, + gallery_image_version_name=gallery_image_version_name, + resource=resource, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + def _update_initial( + self, + resource_group_name: str, + gallery_name: str, + gallery_image_name: str, + gallery_image_version_name: str, + properties: Union[_models.GalleryImageVersionUpdate, JSON, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(properties, (IOBase, bytes)): + _content = properties + else: + _content = json.dumps(properties, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_gallery_image_versions_update_request( + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_image_name=gallery_image_name, + gallery_image_version_name=gallery_image_version_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_update( + self, + resource_group_name: str, + gallery_name: str, + gallery_image_name: str, + gallery_image_version_name: str, + properties: _models.GalleryImageVersionUpdate, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Update a gallery image version. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param gallery_image_name: The name of the gallery image definition to be retrieved. Required. + :type gallery_image_name: str + :param gallery_image_version_name: The name of the gallery image version to be retrieved. + Required. + :type gallery_image_version_name: str + :param properties: Parameters supplied to the update gallery image version operation. Required. + :type properties: ~azure.mgmt.compute.models.GalleryImageVersionUpdate + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update( + self, + resource_group_name: str, + gallery_name: str, + gallery_image_name: str, + gallery_image_version_name: str, + properties: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Update a gallery image version. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param gallery_image_name: The name of the gallery image definition to be retrieved. Required. + :type gallery_image_name: str + :param gallery_image_version_name: The name of the gallery image version to be retrieved. + Required. + :type gallery_image_version_name: str + :param properties: Parameters supplied to the update gallery image version operation. Required. + :type properties: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update( + self, + resource_group_name: str, + gallery_name: str, + gallery_image_name: str, + gallery_image_version_name: str, + properties: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Update a gallery image version. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param gallery_image_name: The name of the gallery image definition to be retrieved. Required. + :type gallery_image_name: str + :param gallery_image_version_name: The name of the gallery image version to be retrieved. + Required. + :type gallery_image_version_name: str + :param properties: Parameters supplied to the update gallery image version operation. Required. + :type properties: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update( + self, + resource_group_name: str, + gallery_name: str, + gallery_image_name: str, + gallery_image_version_name: str, + properties: Union[_models.GalleryImageVersionUpdate, JSON, IO[bytes]], + **kwargs: Any + ) -> LROPoller[None]: + """Update a gallery image version. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param gallery_image_name: The name of the gallery image definition to be retrieved. Required. + :type gallery_image_name: str + :param gallery_image_version_name: The name of the gallery image version to be retrieved. + Required. + :type gallery_image_version_name: str + :param properties: Parameters supplied to the update gallery image version operation. Is one of + the following types: GalleryImageVersionUpdate, JSON, IO[bytes] Required. + :type properties: ~azure.mgmt.compute.models.GalleryImageVersionUpdate or JSON or IO[bytes] + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._update_initial( + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_image_name=gallery_image_name, + gallery_image_version_name=gallery_image_version_name, + properties=properties, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + def _delete_initial( + self, + resource_group_name: str, + gallery_name: str, + gallery_image_name: str, + gallery_image_version_name: str, + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_gallery_image_versions_delete_request( + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_image_name=gallery_image_name, + gallery_image_version_name=gallery_image_version_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_delete( + self, + resource_group_name: str, + gallery_name: str, + gallery_image_name: str, + gallery_image_version_name: str, + **kwargs: Any + ) -> LROPoller[None]: + """Delete a gallery image version. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param gallery_image_name: The name of the gallery image definition to be retrieved. Required. + :type gallery_image_name: str + :param gallery_image_version_name: The name of the gallery image version to be retrieved. + Required. + :type gallery_image_version_name: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_image_name=gallery_image_name, + gallery_image_version_name=gallery_image_version_name, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace + def list_by_gallery_image( + self, resource_group_name: str, gallery_name: str, gallery_image_name: str, **kwargs: Any + ) -> ItemPaged["_models.GalleryImageVersion"]: + """List gallery image versions in a gallery image definition. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param gallery_image_name: The name of the gallery image definition to be retrieved. Required. + :type gallery_image_name: str + :return: An iterator like instance of GalleryImageVersion + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.models.GalleryImageVersion] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.GalleryImageVersion]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_gallery_image_versions_list_by_gallery_image_request( + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_image_name=gallery_image_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.GalleryImageVersion], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + +class GalleryApplicationsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.compute.ComputeClient`'s + :attr:`gallery_applications` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def get( + self, resource_group_name: str, gallery_name: str, gallery_application_name: str, **kwargs: Any + ) -> _models.GalleryApplication: + """Retrieves information about a gallery Application Definition. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param gallery_application_name: The name of the gallery Application Definition to be + retrieved. Required. + :type gallery_application_name: str + :return: GalleryApplication. The GalleryApplication is compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.GalleryApplication + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.GalleryApplication] = kwargs.pop("cls", None) + + _request = build_gallery_applications_get_request( + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_application_name=gallery_application_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.GalleryApplication, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _create_or_update_initial( + self, + resource_group_name: str, + gallery_name: str, + gallery_application_name: str, + resource: Union[_models.GalleryApplication, JSON, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(resource, (IOBase, bytes)): + _content = resource + else: + _content = json.dumps(resource, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_gallery_applications_create_or_update_request( + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_application_name=gallery_application_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 201: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + gallery_name: str, + gallery_application_name: str, + resource: _models.GalleryApplication, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Create or update a gallery Application Definition. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param gallery_application_name: The name of the gallery Application Definition to be + retrieved. Required. + :type gallery_application_name: str + :param resource: Parameters supplied to the create or update gallery Application operation. + Required. + :type resource: ~azure.mgmt.compute.models.GalleryApplication + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + gallery_name: str, + gallery_application_name: str, + resource: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Create or update a gallery Application Definition. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param gallery_application_name: The name of the gallery Application Definition to be + retrieved. Required. + :type gallery_application_name: str + :param resource: Parameters supplied to the create or update gallery Application operation. + Required. + :type resource: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + gallery_name: str, + gallery_application_name: str, + resource: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Create or update a gallery Application Definition. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param gallery_application_name: The name of the gallery Application Definition to be + retrieved. Required. + :type gallery_application_name: str + :param resource: Parameters supplied to the create or update gallery Application operation. + Required. + :type resource: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + gallery_name: str, + gallery_application_name: str, + resource: Union[_models.GalleryApplication, JSON, IO[bytes]], + **kwargs: Any + ) -> LROPoller[None]: + """Create or update a gallery Application Definition. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param gallery_application_name: The name of the gallery Application Definition to be + retrieved. Required. + :type gallery_application_name: str + :param resource: Parameters supplied to the create or update gallery Application operation. Is + one of the following types: GalleryApplication, JSON, IO[bytes] Required. + :type resource: ~azure.mgmt.compute.models.GalleryApplication or JSON or IO[bytes] + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_application_name=gallery_application_name, + resource=resource, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + def _update_initial( + self, + resource_group_name: str, + gallery_name: str, + gallery_application_name: str, + properties: Union[_models.GalleryApplicationUpdate, JSON, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(properties, (IOBase, bytes)): + _content = properties + else: + _content = json.dumps(properties, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_gallery_applications_update_request( + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_application_name=gallery_application_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_update( + self, + resource_group_name: str, + gallery_name: str, + gallery_application_name: str, + properties: _models.GalleryApplicationUpdate, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Update a gallery Application Definition. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param gallery_application_name: The name of the gallery Application Definition to be + retrieved. Required. + :type gallery_application_name: str + :param properties: Parameters supplied to the update gallery Application operation. Required. + :type properties: ~azure.mgmt.compute.models.GalleryApplicationUpdate + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update( + self, + resource_group_name: str, + gallery_name: str, + gallery_application_name: str, + properties: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Update a gallery Application Definition. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param gallery_application_name: The name of the gallery Application Definition to be + retrieved. Required. + :type gallery_application_name: str + :param properties: Parameters supplied to the update gallery Application operation. Required. + :type properties: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update( + self, + resource_group_name: str, + gallery_name: str, + gallery_application_name: str, + properties: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Update a gallery Application Definition. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param gallery_application_name: The name of the gallery Application Definition to be + retrieved. Required. + :type gallery_application_name: str + :param properties: Parameters supplied to the update gallery Application operation. Required. + :type properties: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update( + self, + resource_group_name: str, + gallery_name: str, + gallery_application_name: str, + properties: Union[_models.GalleryApplicationUpdate, JSON, IO[bytes]], + **kwargs: Any + ) -> LROPoller[None]: + """Update a gallery Application Definition. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param gallery_application_name: The name of the gallery Application Definition to be + retrieved. Required. + :type gallery_application_name: str + :param properties: Parameters supplied to the update gallery Application operation. Is one of + the following types: GalleryApplicationUpdate, JSON, IO[bytes] Required. + :type properties: ~azure.mgmt.compute.models.GalleryApplicationUpdate or JSON or IO[bytes] + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._update_initial( + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_application_name=gallery_application_name, + properties=properties, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + def _delete_initial( + self, resource_group_name: str, gallery_name: str, gallery_application_name: str, **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_gallery_applications_delete_request( + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_application_name=gallery_application_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_delete( + self, resource_group_name: str, gallery_name: str, gallery_application_name: str, **kwargs: Any + ) -> LROPoller[None]: + """Delete a gallery Application. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param gallery_application_name: The name of the gallery Application Definition to be + retrieved. Required. + :type gallery_application_name: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_application_name=gallery_application_name, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace + def list_by_gallery( + self, resource_group_name: str, gallery_name: str, **kwargs: Any + ) -> ItemPaged["_models.GalleryApplication"]: + """List gallery Application Definitions in a gallery. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :return: An iterator like instance of GalleryApplication + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.models.GalleryApplication] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.GalleryApplication]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_gallery_applications_list_by_gallery_request( + resource_group_name=resource_group_name, + gallery_name=gallery_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.GalleryApplication], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + +class GalleryApplicationVersionsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.compute.ComputeClient`'s + :attr:`gallery_application_versions` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def get( + self, + resource_group_name: str, + gallery_name: str, + gallery_application_name: str, + gallery_application_version_name: str, + *, + expand: Optional[Union[str, _models.ReplicationStatusTypes]] = None, + **kwargs: Any + ) -> _models.GalleryApplicationVersion: + """Retrieves information about a gallery Application Version. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param gallery_application_name: The name of the gallery Application Definition to be + retrieved. Required. + :type gallery_application_name: str + :param gallery_application_version_name: The name of the gallery Application Version to be + retrieved. Required. + :type gallery_application_version_name: str + :keyword expand: The expand expression to apply on the operation. Known values are: + "ReplicationStatus" and "UefiSettings". Default value is None. + :paramtype expand: str or ~azure.mgmt.compute.models.ReplicationStatusTypes + :return: GalleryApplicationVersion. The GalleryApplicationVersion is compatible with + MutableMapping + :rtype: ~azure.mgmt.compute.models.GalleryApplicationVersion + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.GalleryApplicationVersion] = kwargs.pop("cls", None) + + _request = build_gallery_application_versions_get_request( + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_application_name=gallery_application_name, + gallery_application_version_name=gallery_application_version_name, + subscription_id=self._config.subscription_id, + expand=expand, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.GalleryApplicationVersion, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _create_or_update_initial( + self, + resource_group_name: str, + gallery_name: str, + gallery_application_name: str, + gallery_application_version_name: str, + resource: Union[_models.GalleryApplicationVersion, JSON, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(resource, (IOBase, bytes)): + _content = resource + else: + _content = json.dumps(resource, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_gallery_application_versions_create_or_update_request( + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_application_name=gallery_application_name, + gallery_application_version_name=gallery_application_version_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 201: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + gallery_name: str, + gallery_application_name: str, + gallery_application_version_name: str, + resource: _models.GalleryApplicationVersion, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.GalleryApplicationVersion]: + """Create or update a gallery Application Version. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param gallery_application_name: The name of the gallery Application Definition to be + retrieved. Required. + :type gallery_application_name: str + :param gallery_application_version_name: The name of the gallery Application Version to be + retrieved. Required. + :type gallery_application_version_name: str + :param resource: Parameters supplied to the create or update gallery Application Version + operation. Required. + :type resource: ~azure.mgmt.compute.models.GalleryApplicationVersion + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns GalleryApplicationVersion. The + GalleryApplicationVersion is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.GalleryApplicationVersion] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + gallery_name: str, + gallery_application_name: str, + gallery_application_version_name: str, + resource: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.GalleryApplicationVersion]: + """Create or update a gallery Application Version. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param gallery_application_name: The name of the gallery Application Definition to be + retrieved. Required. + :type gallery_application_name: str + :param gallery_application_version_name: The name of the gallery Application Version to be + retrieved. Required. + :type gallery_application_version_name: str + :param resource: Parameters supplied to the create or update gallery Application Version + operation. Required. + :type resource: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns GalleryApplicationVersion. The + GalleryApplicationVersion is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.GalleryApplicationVersion] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + gallery_name: str, + gallery_application_name: str, + gallery_application_version_name: str, + resource: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.GalleryApplicationVersion]: + """Create or update a gallery Application Version. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param gallery_application_name: The name of the gallery Application Definition to be + retrieved. Required. + :type gallery_application_name: str + :param gallery_application_version_name: The name of the gallery Application Version to be + retrieved. Required. + :type gallery_application_version_name: str + :param resource: Parameters supplied to the create or update gallery Application Version + operation. Required. + :type resource: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns GalleryApplicationVersion. The + GalleryApplicationVersion is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.GalleryApplicationVersion] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + gallery_name: str, + gallery_application_name: str, + gallery_application_version_name: str, + resource: Union[_models.GalleryApplicationVersion, JSON, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.GalleryApplicationVersion]: + """Create or update a gallery Application Version. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param gallery_application_name: The name of the gallery Application Definition to be + retrieved. Required. + :type gallery_application_name: str + :param gallery_application_version_name: The name of the gallery Application Version to be + retrieved. Required. + :type gallery_application_version_name: str + :param resource: Parameters supplied to the create or update gallery Application Version + operation. Is one of the following types: GalleryApplicationVersion, JSON, IO[bytes] Required. + :type resource: ~azure.mgmt.compute.models.GalleryApplicationVersion or JSON or IO[bytes] + :return: An instance of LROPoller that returns GalleryApplicationVersion. The + GalleryApplicationVersion is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.GalleryApplicationVersion] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.GalleryApplicationVersion] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_application_name=gallery_application_name, + gallery_application_version_name=gallery_application_version_name, + resource=resource, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.GalleryApplicationVersion, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.GalleryApplicationVersion].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.GalleryApplicationVersion]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _update_initial( + self, + resource_group_name: str, + gallery_name: str, + gallery_application_name: str, + gallery_application_version_name: str, + properties: Union[_models.GalleryApplicationVersionUpdate, JSON, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(properties, (IOBase, bytes)): + _content = properties + else: + _content = json.dumps(properties, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_gallery_application_versions_update_request( + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_application_name=gallery_application_name, + gallery_application_version_name=gallery_application_version_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_update( + self, + resource_group_name: str, + gallery_name: str, + gallery_application_name: str, + gallery_application_version_name: str, + properties: _models.GalleryApplicationVersionUpdate, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Update a gallery Application Version. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param gallery_application_name: The name of the gallery Application Definition to be + retrieved. Required. + :type gallery_application_name: str + :param gallery_application_version_name: The name of the gallery Application Version to be + retrieved. Required. + :type gallery_application_version_name: str + :param properties: Parameters supplied to the update gallery Application Version operation. + Required. + :type properties: ~azure.mgmt.compute.models.GalleryApplicationVersionUpdate + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update( + self, + resource_group_name: str, + gallery_name: str, + gallery_application_name: str, + gallery_application_version_name: str, + properties: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Update a gallery Application Version. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param gallery_application_name: The name of the gallery Application Definition to be + retrieved. Required. + :type gallery_application_name: str + :param gallery_application_version_name: The name of the gallery Application Version to be + retrieved. Required. + :type gallery_application_version_name: str + :param properties: Parameters supplied to the update gallery Application Version operation. + Required. + :type properties: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update( + self, + resource_group_name: str, + gallery_name: str, + gallery_application_name: str, + gallery_application_version_name: str, + properties: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Update a gallery Application Version. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param gallery_application_name: The name of the gallery Application Definition to be + retrieved. Required. + :type gallery_application_name: str + :param gallery_application_version_name: The name of the gallery Application Version to be + retrieved. Required. + :type gallery_application_version_name: str + :param properties: Parameters supplied to the update gallery Application Version operation. + Required. + :type properties: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update( + self, + resource_group_name: str, + gallery_name: str, + gallery_application_name: str, + gallery_application_version_name: str, + properties: Union[_models.GalleryApplicationVersionUpdate, JSON, IO[bytes]], + **kwargs: Any + ) -> LROPoller[None]: + """Update a gallery Application Version. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param gallery_application_name: The name of the gallery Application Definition to be + retrieved. Required. + :type gallery_application_name: str + :param gallery_application_version_name: The name of the gallery Application Version to be + retrieved. Required. + :type gallery_application_version_name: str + :param properties: Parameters supplied to the update gallery Application Version operation. Is + one of the following types: GalleryApplicationVersionUpdate, JSON, IO[bytes] Required. + :type properties: ~azure.mgmt.compute.models.GalleryApplicationVersionUpdate or JSON or + IO[bytes] + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._update_initial( + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_application_name=gallery_application_name, + gallery_application_version_name=gallery_application_version_name, + properties=properties, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + def _delete_initial( + self, + resource_group_name: str, + gallery_name: str, + gallery_application_name: str, + gallery_application_version_name: str, + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_gallery_application_versions_delete_request( + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_application_name=gallery_application_name, + gallery_application_version_name=gallery_application_version_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_delete( + self, + resource_group_name: str, + gallery_name: str, + gallery_application_name: str, + gallery_application_version_name: str, + **kwargs: Any + ) -> LROPoller[None]: + """Delete a gallery Application Version. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param gallery_application_name: The name of the gallery Application Definition to be + retrieved. Required. + :type gallery_application_name: str + :param gallery_application_version_name: The name of the gallery Application Version to be + retrieved. Required. + :type gallery_application_version_name: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_application_name=gallery_application_name, + gallery_application_version_name=gallery_application_version_name, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace + def list_by_gallery_application( + self, resource_group_name: str, gallery_name: str, gallery_application_name: str, **kwargs: Any + ) -> ItemPaged["_models.GalleryApplicationVersion"]: + """List gallery Application Versions in a gallery Application Definition. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param gallery_application_name: The name of the gallery Application Definition to be + retrieved. Required. + :type gallery_application_name: str + :return: An iterator like instance of GalleryApplicationVersion + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.models.GalleryApplicationVersion] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.GalleryApplicationVersion]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_gallery_application_versions_list_by_gallery_application_request( + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_application_name=gallery_application_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.GalleryApplicationVersion], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + +class GalleryInVMAccessControlProfilesOperations: # pylint: disable=name-too-long + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.compute.ComputeClient`'s + :attr:`gallery_in_vm_access_control_profiles` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def get( + self, resource_group_name: str, gallery_name: str, in_vm_access_control_profile_name: str, **kwargs: Any + ) -> _models.GalleryInVMAccessControlProfile: + """Retrieves information about a gallery inVMAccessControlProfile. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param in_vm_access_control_profile_name: The name of the gallery inVMAccessControlProfile to + be retrieved. Required. + :type in_vm_access_control_profile_name: str + :return: GalleryInVMAccessControlProfile. The GalleryInVMAccessControlProfile is compatible + with MutableMapping + :rtype: ~azure.mgmt.compute.models.GalleryInVMAccessControlProfile + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.GalleryInVMAccessControlProfile] = kwargs.pop("cls", None) + + _request = build_gallery_in_vm_access_control_profiles_get_request( + resource_group_name=resource_group_name, + gallery_name=gallery_name, + in_vm_access_control_profile_name=in_vm_access_control_profile_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.GalleryInVMAccessControlProfile, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _create_or_update_initial( + self, + resource_group_name: str, + gallery_name: str, + in_vm_access_control_profile_name: str, + resource: Union[_models.GalleryInVMAccessControlProfile, JSON, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(resource, (IOBase, bytes)): + _content = resource + else: + _content = json.dumps(resource, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_gallery_in_vm_access_control_profiles_create_or_update_request( + resource_group_name=resource_group_name, + gallery_name=gallery_name, + in_vm_access_control_profile_name=in_vm_access_control_profile_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 201: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + gallery_name: str, + in_vm_access_control_profile_name: str, + resource: _models.GalleryInVMAccessControlProfile, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Create or update a gallery inVMAccessControlProfile. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param in_vm_access_control_profile_name: The name of the gallery inVMAccessControlProfile to + be retrieved. Required. + :type in_vm_access_control_profile_name: str + :param resource: Parameters supplied to the create or update gallery inVMAccessControlProfile + operation. Required. + :type resource: ~azure.mgmt.compute.models.GalleryInVMAccessControlProfile + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + gallery_name: str, + in_vm_access_control_profile_name: str, + resource: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Create or update a gallery inVMAccessControlProfile. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param in_vm_access_control_profile_name: The name of the gallery inVMAccessControlProfile to + be retrieved. Required. + :type in_vm_access_control_profile_name: str + :param resource: Parameters supplied to the create or update gallery inVMAccessControlProfile + operation. Required. + :type resource: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + gallery_name: str, + in_vm_access_control_profile_name: str, + resource: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Create or update a gallery inVMAccessControlProfile. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param in_vm_access_control_profile_name: The name of the gallery inVMAccessControlProfile to + be retrieved. Required. + :type in_vm_access_control_profile_name: str + :param resource: Parameters supplied to the create or update gallery inVMAccessControlProfile + operation. Required. + :type resource: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + gallery_name: str, + in_vm_access_control_profile_name: str, + resource: Union[_models.GalleryInVMAccessControlProfile, JSON, IO[bytes]], + **kwargs: Any + ) -> LROPoller[None]: + """Create or update a gallery inVMAccessControlProfile. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param in_vm_access_control_profile_name: The name of the gallery inVMAccessControlProfile to + be retrieved. Required. + :type in_vm_access_control_profile_name: str + :param resource: Parameters supplied to the create or update gallery inVMAccessControlProfile + operation. Is one of the following types: GalleryInVMAccessControlProfile, JSON, IO[bytes] + Required. + :type resource: ~azure.mgmt.compute.models.GalleryInVMAccessControlProfile or JSON or IO[bytes] + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + gallery_name=gallery_name, + in_vm_access_control_profile_name=in_vm_access_control_profile_name, + resource=resource, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + def _update_initial( + self, + resource_group_name: str, + gallery_name: str, + in_vm_access_control_profile_name: str, + properties: Union[_models.GalleryInVMAccessControlProfileUpdate, JSON, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(properties, (IOBase, bytes)): + _content = properties + else: + _content = json.dumps(properties, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_gallery_in_vm_access_control_profiles_update_request( + resource_group_name=resource_group_name, + gallery_name=gallery_name, + in_vm_access_control_profile_name=in_vm_access_control_profile_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_update( + self, + resource_group_name: str, + gallery_name: str, + in_vm_access_control_profile_name: str, + properties: _models.GalleryInVMAccessControlProfileUpdate, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Update a gallery inVMAccessControlProfile. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param in_vm_access_control_profile_name: The name of the gallery inVMAccessControlProfile to + be retrieved. Required. + :type in_vm_access_control_profile_name: str + :param properties: Parameters supplied to the update gallery inVMAccessControlProfile + operation. Required. + :type properties: ~azure.mgmt.compute.models.GalleryInVMAccessControlProfileUpdate + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update( + self, + resource_group_name: str, + gallery_name: str, + in_vm_access_control_profile_name: str, + properties: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Update a gallery inVMAccessControlProfile. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param in_vm_access_control_profile_name: The name of the gallery inVMAccessControlProfile to + be retrieved. Required. + :type in_vm_access_control_profile_name: str + :param properties: Parameters supplied to the update gallery inVMAccessControlProfile + operation. Required. + :type properties: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update( + self, + resource_group_name: str, + gallery_name: str, + in_vm_access_control_profile_name: str, + properties: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Update a gallery inVMAccessControlProfile. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param in_vm_access_control_profile_name: The name of the gallery inVMAccessControlProfile to + be retrieved. Required. + :type in_vm_access_control_profile_name: str + :param properties: Parameters supplied to the update gallery inVMAccessControlProfile + operation. Required. + :type properties: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update( + self, + resource_group_name: str, + gallery_name: str, + in_vm_access_control_profile_name: str, + properties: Union[_models.GalleryInVMAccessControlProfileUpdate, JSON, IO[bytes]], + **kwargs: Any + ) -> LROPoller[None]: + """Update a gallery inVMAccessControlProfile. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param in_vm_access_control_profile_name: The name of the gallery inVMAccessControlProfile to + be retrieved. Required. + :type in_vm_access_control_profile_name: str + :param properties: Parameters supplied to the update gallery inVMAccessControlProfile + operation. Is one of the following types: GalleryInVMAccessControlProfileUpdate, JSON, + IO[bytes] Required. + :type properties: ~azure.mgmt.compute.models.GalleryInVMAccessControlProfileUpdate or JSON or + IO[bytes] + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._update_initial( + resource_group_name=resource_group_name, + gallery_name=gallery_name, + in_vm_access_control_profile_name=in_vm_access_control_profile_name, + properties=properties, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + def _delete_initial( + self, resource_group_name: str, gallery_name: str, in_vm_access_control_profile_name: str, **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_gallery_in_vm_access_control_profiles_delete_request( + resource_group_name=resource_group_name, + gallery_name=gallery_name, + in_vm_access_control_profile_name=in_vm_access_control_profile_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_delete( + self, resource_group_name: str, gallery_name: str, in_vm_access_control_profile_name: str, **kwargs: Any + ) -> LROPoller[None]: + """Delete a gallery inVMAccessControlProfile. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param in_vm_access_control_profile_name: The name of the gallery inVMAccessControlProfile to + be retrieved. Required. + :type in_vm_access_control_profile_name: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + gallery_name=gallery_name, + in_vm_access_control_profile_name=in_vm_access_control_profile_name, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace + def list_by_gallery( + self, resource_group_name: str, gallery_name: str, **kwargs: Any + ) -> ItemPaged["_models.GalleryInVMAccessControlProfile"]: + """List gallery inVMAccessControlProfiles in a gallery. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :return: An iterator like instance of GalleryInVMAccessControlProfile + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.models.GalleryInVMAccessControlProfile] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.GalleryInVMAccessControlProfile]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_gallery_in_vm_access_control_profiles_list_by_gallery_request( + resource_group_name=resource_group_name, + gallery_name=gallery_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.GalleryInVMAccessControlProfile], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + +class GalleryInVMAccessControlProfileVersionsOperations: # pylint: disable=name-too-long + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.compute.ComputeClient`'s + :attr:`gallery_in_vm_access_control_profile_versions` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def get( + self, + resource_group_name: str, + gallery_name: str, + in_vm_access_control_profile_name: str, + in_vm_access_control_profile_version_name: str, + **kwargs: Any + ) -> _models.GalleryInVMAccessControlProfileVersion: + """Retrieves information about a gallery inVMAccessControlProfile version. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param in_vm_access_control_profile_name: The name of the gallery inVMAccessControlProfile to + be retrieved. Required. + :type in_vm_access_control_profile_name: str + :param in_vm_access_control_profile_version_name: The name of the gallery + inVMAccessControlProfile version to be retrieved. Required. + :type in_vm_access_control_profile_version_name: str + :return: GalleryInVMAccessControlProfileVersion. The GalleryInVMAccessControlProfileVersion is + compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.GalleryInVMAccessControlProfileVersion + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.GalleryInVMAccessControlProfileVersion] = kwargs.pop("cls", None) + + _request = build_gallery_in_vm_access_control_profile_versions_get_request( + resource_group_name=resource_group_name, + gallery_name=gallery_name, + in_vm_access_control_profile_name=in_vm_access_control_profile_name, + in_vm_access_control_profile_version_name=in_vm_access_control_profile_version_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.GalleryInVMAccessControlProfileVersion, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _create_or_update_initial( + self, + resource_group_name: str, + gallery_name: str, + in_vm_access_control_profile_name: str, + in_vm_access_control_profile_version_name: str, + resource: Union[_models.GalleryInVMAccessControlProfileVersion, JSON, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(resource, (IOBase, bytes)): + _content = resource + else: + _content = json.dumps(resource, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_gallery_in_vm_access_control_profile_versions_create_or_update_request( + resource_group_name=resource_group_name, + gallery_name=gallery_name, + in_vm_access_control_profile_name=in_vm_access_control_profile_name, + in_vm_access_control_profile_version_name=in_vm_access_control_profile_version_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 201: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + gallery_name: str, + in_vm_access_control_profile_name: str, + in_vm_access_control_profile_version_name: str, + resource: _models.GalleryInVMAccessControlProfileVersion, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Create or update a gallery inVMAccessControlProfile version. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param in_vm_access_control_profile_name: The name of the gallery inVMAccessControlProfile to + be retrieved. Required. + :type in_vm_access_control_profile_name: str + :param in_vm_access_control_profile_version_name: The name of the gallery + inVMAccessControlProfile version to be retrieved. Required. + :type in_vm_access_control_profile_version_name: str + :param resource: Parameters supplied to the create or update gallery inVMAccessControlProfile + version operation. Required. + :type resource: ~azure.mgmt.compute.models.GalleryInVMAccessControlProfileVersion + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + gallery_name: str, + in_vm_access_control_profile_name: str, + in_vm_access_control_profile_version_name: str, + resource: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Create or update a gallery inVMAccessControlProfile version. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param in_vm_access_control_profile_name: The name of the gallery inVMAccessControlProfile to + be retrieved. Required. + :type in_vm_access_control_profile_name: str + :param in_vm_access_control_profile_version_name: The name of the gallery + inVMAccessControlProfile version to be retrieved. Required. + :type in_vm_access_control_profile_version_name: str + :param resource: Parameters supplied to the create or update gallery inVMAccessControlProfile + version operation. Required. + :type resource: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + gallery_name: str, + in_vm_access_control_profile_name: str, + in_vm_access_control_profile_version_name: str, + resource: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Create or update a gallery inVMAccessControlProfile version. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param in_vm_access_control_profile_name: The name of the gallery inVMAccessControlProfile to + be retrieved. Required. + :type in_vm_access_control_profile_name: str + :param in_vm_access_control_profile_version_name: The name of the gallery + inVMAccessControlProfile version to be retrieved. Required. + :type in_vm_access_control_profile_version_name: str + :param resource: Parameters supplied to the create or update gallery inVMAccessControlProfile + version operation. Required. + :type resource: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + gallery_name: str, + in_vm_access_control_profile_name: str, + in_vm_access_control_profile_version_name: str, + resource: Union[_models.GalleryInVMAccessControlProfileVersion, JSON, IO[bytes]], + **kwargs: Any + ) -> LROPoller[None]: + """Create or update a gallery inVMAccessControlProfile version. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param in_vm_access_control_profile_name: The name of the gallery inVMAccessControlProfile to + be retrieved. Required. + :type in_vm_access_control_profile_name: str + :param in_vm_access_control_profile_version_name: The name of the gallery + inVMAccessControlProfile version to be retrieved. Required. + :type in_vm_access_control_profile_version_name: str + :param resource: Parameters supplied to the create or update gallery inVMAccessControlProfile + version operation. Is one of the following types: GalleryInVMAccessControlProfileVersion, JSON, + IO[bytes] Required. + :type resource: ~azure.mgmt.compute.models.GalleryInVMAccessControlProfileVersion or JSON or + IO[bytes] + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + gallery_name=gallery_name, + in_vm_access_control_profile_name=in_vm_access_control_profile_name, + in_vm_access_control_profile_version_name=in_vm_access_control_profile_version_name, + resource=resource, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + def _update_initial( + self, + resource_group_name: str, + gallery_name: str, + in_vm_access_control_profile_name: str, + in_vm_access_control_profile_version_name: str, + properties: Union[_models.GalleryInVMAccessControlProfileVersionUpdate, JSON, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(properties, (IOBase, bytes)): + _content = properties + else: + _content = json.dumps(properties, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_gallery_in_vm_access_control_profile_versions_update_request( + resource_group_name=resource_group_name, + gallery_name=gallery_name, + in_vm_access_control_profile_name=in_vm_access_control_profile_name, + in_vm_access_control_profile_version_name=in_vm_access_control_profile_version_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_update( + self, + resource_group_name: str, + gallery_name: str, + in_vm_access_control_profile_name: str, + in_vm_access_control_profile_version_name: str, + properties: _models.GalleryInVMAccessControlProfileVersionUpdate, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Update a gallery inVMAccessControlProfile version. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param in_vm_access_control_profile_name: The name of the gallery inVMAccessControlProfile to + be retrieved. Required. + :type in_vm_access_control_profile_name: str + :param in_vm_access_control_profile_version_name: The name of the gallery + inVMAccessControlProfile version to be retrieved. Required. + :type in_vm_access_control_profile_version_name: str + :param properties: Parameters supplied to the update gallery inVMAccessControlProfile version + operation. Required. + :type properties: ~azure.mgmt.compute.models.GalleryInVMAccessControlProfileVersionUpdate + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update( + self, + resource_group_name: str, + gallery_name: str, + in_vm_access_control_profile_name: str, + in_vm_access_control_profile_version_name: str, + properties: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Update a gallery inVMAccessControlProfile version. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param in_vm_access_control_profile_name: The name of the gallery inVMAccessControlProfile to + be retrieved. Required. + :type in_vm_access_control_profile_name: str + :param in_vm_access_control_profile_version_name: The name of the gallery + inVMAccessControlProfile version to be retrieved. Required. + :type in_vm_access_control_profile_version_name: str + :param properties: Parameters supplied to the update gallery inVMAccessControlProfile version + operation. Required. + :type properties: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update( + self, + resource_group_name: str, + gallery_name: str, + in_vm_access_control_profile_name: str, + in_vm_access_control_profile_version_name: str, + properties: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Update a gallery inVMAccessControlProfile version. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param in_vm_access_control_profile_name: The name of the gallery inVMAccessControlProfile to + be retrieved. Required. + :type in_vm_access_control_profile_name: str + :param in_vm_access_control_profile_version_name: The name of the gallery + inVMAccessControlProfile version to be retrieved. Required. + :type in_vm_access_control_profile_version_name: str + :param properties: Parameters supplied to the update gallery inVMAccessControlProfile version + operation. Required. + :type properties: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update( + self, + resource_group_name: str, + gallery_name: str, + in_vm_access_control_profile_name: str, + in_vm_access_control_profile_version_name: str, + properties: Union[_models.GalleryInVMAccessControlProfileVersionUpdate, JSON, IO[bytes]], + **kwargs: Any + ) -> LROPoller[None]: + """Update a gallery inVMAccessControlProfile version. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param in_vm_access_control_profile_name: The name of the gallery inVMAccessControlProfile to + be retrieved. Required. + :type in_vm_access_control_profile_name: str + :param in_vm_access_control_profile_version_name: The name of the gallery + inVMAccessControlProfile version to be retrieved. Required. + :type in_vm_access_control_profile_version_name: str + :param properties: Parameters supplied to the update gallery inVMAccessControlProfile version + operation. Is one of the following types: GalleryInVMAccessControlProfileVersionUpdate, JSON, + IO[bytes] Required. + :type properties: ~azure.mgmt.compute.models.GalleryInVMAccessControlProfileVersionUpdate or + JSON or IO[bytes] + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._update_initial( + resource_group_name=resource_group_name, + gallery_name=gallery_name, + in_vm_access_control_profile_name=in_vm_access_control_profile_name, + in_vm_access_control_profile_version_name=in_vm_access_control_profile_version_name, + properties=properties, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + def _delete_initial( + self, + resource_group_name: str, + gallery_name: str, + in_vm_access_control_profile_name: str, + in_vm_access_control_profile_version_name: str, + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_gallery_in_vm_access_control_profile_versions_delete_request( + resource_group_name=resource_group_name, + gallery_name=gallery_name, + in_vm_access_control_profile_name=in_vm_access_control_profile_name, + in_vm_access_control_profile_version_name=in_vm_access_control_profile_version_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_delete( + self, + resource_group_name: str, + gallery_name: str, + in_vm_access_control_profile_name: str, + in_vm_access_control_profile_version_name: str, + **kwargs: Any + ) -> LROPoller[None]: + """Delete a gallery inVMAccessControlProfile version. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param in_vm_access_control_profile_name: The name of the gallery inVMAccessControlProfile to + be retrieved. Required. + :type in_vm_access_control_profile_name: str + :param in_vm_access_control_profile_version_name: The name of the gallery + inVMAccessControlProfile version to be retrieved. Required. + :type in_vm_access_control_profile_version_name: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + gallery_name=gallery_name, + in_vm_access_control_profile_name=in_vm_access_control_profile_name, + in_vm_access_control_profile_version_name=in_vm_access_control_profile_version_name, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace + def list_by_gallery_in_vm_access_control_profile( # pylint: disable=name-too-long + self, resource_group_name: str, gallery_name: str, in_vm_access_control_profile_name: str, **kwargs: Any + ) -> ItemPaged["_models.GalleryInVMAccessControlProfileVersion"]: + """List gallery inVMAccessControlProfile versions in a gallery inVMAccessControlProfile. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param in_vm_access_control_profile_name: The name of the gallery inVMAccessControlProfile to + be retrieved. Required. + :type in_vm_access_control_profile_name: str + :return: An iterator like instance of GalleryInVMAccessControlProfileVersion + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.models.GalleryInVMAccessControlProfileVersion] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.GalleryInVMAccessControlProfileVersion]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_gallery_in_vm_access_control_profile_versions_list_by_gallery_in_vm_access_control_profile_request( + resource_group_name=resource_group_name, + gallery_name=gallery_name, + in_vm_access_control_profile_name=in_vm_access_control_profile_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.GalleryInVMAccessControlProfileVersion], deserialized.get("value", []) + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + +class SharedGalleriesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.compute.ComputeClient`'s + :attr:`shared_galleries` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def get(self, location: str, gallery_unique_name: str, **kwargs: Any) -> _models.SharedGallery: + """Get a shared gallery by subscription id or tenant id. + + :param location: The name of the Azure region. Required. + :type location: str + :param gallery_unique_name: The unique name of the Shared Gallery. Required. + :type gallery_unique_name: str + :return: SharedGallery. The SharedGallery is compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.SharedGallery + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.SharedGallery] = kwargs.pop("cls", None) + + _request = build_shared_galleries_get_request( + location=location, + gallery_unique_name=gallery_unique_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.SharedGallery, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list( + self, location: str, *, shared_to: Optional[Union[str, _models.SharedToValues]] = None, **kwargs: Any + ) -> ItemPaged["_models.SharedGallery"]: + """List shared galleries by subscription id or tenant id. + + :param location: The name of the Azure region. Required. + :type location: str + :keyword shared_to: The query parameter to decide what shared galleries to fetch when doing + listing operations. "tenant" Default value is None. + :paramtype shared_to: str or ~azure.mgmt.compute.models.SharedToValues + :return: An iterator like instance of SharedGallery + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.models.SharedGallery] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.SharedGallery]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_shared_galleries_list_request( + location=location, + subscription_id=self._config.subscription_id, + shared_to=shared_to, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.SharedGallery], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + +class SharedGalleryImagesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.compute.ComputeClient`'s + :attr:`shared_gallery_images` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def get( + self, location: str, gallery_unique_name: str, gallery_image_name: str, **kwargs: Any + ) -> _models.SharedGalleryImage: + """Get a shared gallery image by subscription id or tenant id. + + :param location: The name of the Azure region. Required. + :type location: str + :param gallery_unique_name: The unique name of the Shared Gallery. Required. + :type gallery_unique_name: str + :param gallery_image_name: The name of the Shared Gallery Image Definition from which the Image + Versions are to be listed. Required. + :type gallery_image_name: str + :return: SharedGalleryImage. The SharedGalleryImage is compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.SharedGalleryImage + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.SharedGalleryImage] = kwargs.pop("cls", None) + + _request = build_shared_gallery_images_get_request( + location=location, + gallery_unique_name=gallery_unique_name, + gallery_image_name=gallery_image_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.SharedGalleryImage, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list( + self, + location: str, + gallery_unique_name: str, + *, + shared_to: Optional[Union[str, _models.SharedToValues]] = None, + **kwargs: Any + ) -> ItemPaged["_models.SharedGalleryImage"]: + """List shared gallery images by subscription id or tenant id. + + :param location: The name of the Azure region. Required. + :type location: str + :param gallery_unique_name: The unique name of the Shared Gallery. Required. + :type gallery_unique_name: str + :keyword shared_to: The query parameter to decide what shared galleries to fetch when doing + listing operations. "tenant" Default value is None. + :paramtype shared_to: str or ~azure.mgmt.compute.models.SharedToValues + :return: An iterator like instance of SharedGalleryImage + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.models.SharedGalleryImage] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.SharedGalleryImage]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_shared_gallery_images_list_request( + location=location, + gallery_unique_name=gallery_unique_name, + subscription_id=self._config.subscription_id, + shared_to=shared_to, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.SharedGalleryImage], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + +class SharedGalleryImageVersionsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.compute.ComputeClient`'s + :attr:`shared_gallery_image_versions` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def get( + self, + location: str, + gallery_unique_name: str, + gallery_image_name: str, + gallery_image_version_name: str, + **kwargs: Any + ) -> _models.SharedGalleryImageVersion: + """Get a shared gallery image version by subscription id or tenant id. + + :param location: The name of the Azure region. Required. + :type location: str + :param gallery_unique_name: The unique name of the Shared Gallery. Required. + :type gallery_unique_name: str + :param gallery_image_name: The name of the Shared Gallery Image Definition from which the Image + Versions are to be listed. Required. + :type gallery_image_name: str + :param gallery_image_version_name: The name of the gallery image version to be created. Needs + to follow semantic version name pattern: The allowed characters are digit and period. Digits + must be within the range of a 32-bit integer. Format: ... + Required. + :type gallery_image_version_name: str + :return: SharedGalleryImageVersion. The SharedGalleryImageVersion is compatible with + MutableMapping + :rtype: ~azure.mgmt.compute.models.SharedGalleryImageVersion + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.SharedGalleryImageVersion] = kwargs.pop("cls", None) + + _request = build_shared_gallery_image_versions_get_request( + location=location, + gallery_unique_name=gallery_unique_name, + gallery_image_name=gallery_image_name, + gallery_image_version_name=gallery_image_version_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.SharedGalleryImageVersion, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list( + self, + location: str, + gallery_unique_name: str, + gallery_image_name: str, + *, + shared_to: Optional[Union[str, _models.SharedToValues]] = None, + **kwargs: Any + ) -> ItemPaged["_models.SharedGalleryImageVersion"]: + """List shared gallery image versions by subscription id or tenant id. + + :param location: The name of the Azure region. Required. + :type location: str + :param gallery_unique_name: The unique name of the Shared Gallery. Required. + :type gallery_unique_name: str + :param gallery_image_name: The name of the Shared Gallery Image Definition from which the Image + Versions are to be listed. Required. + :type gallery_image_name: str + :keyword shared_to: The query parameter to decide what shared galleries to fetch when doing + listing operations. "tenant" Default value is None. + :paramtype shared_to: str or ~azure.mgmt.compute.models.SharedToValues + :return: An iterator like instance of SharedGalleryImageVersion + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.models.SharedGalleryImageVersion] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.SharedGalleryImageVersion]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_shared_gallery_image_versions_list_request( + location=location, + gallery_unique_name=gallery_unique_name, + gallery_image_name=gallery_image_name, + subscription_id=self._config.subscription_id, + shared_to=shared_to, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.SharedGalleryImageVersion], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + +class CommunityGalleriesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.compute.ComputeClient`'s + :attr:`community_galleries` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def get(self, location: str, public_gallery_name: str, **kwargs: Any) -> _models.CommunityGallery: + """Get a community gallery by gallery public name. + + :param location: The name of the Azure region. Required. + :type location: str + :param public_gallery_name: The public name of the community gallery. Required. + :type public_gallery_name: str + :return: CommunityGallery. The CommunityGallery is compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.CommunityGallery + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.CommunityGallery] = kwargs.pop("cls", None) + + _request = build_community_galleries_get_request( + location=location, + public_gallery_name=public_gallery_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.CommunityGallery, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + +class CommunityGalleryImagesOperations: """ + .. warning:: + **DO NOT** instantiate this class directly. - models = _models + Instead, you should access the following operations through + :class:`~azure.mgmt.compute.ComputeClient`'s + :attr:`community_gallery_images` attribute. + """ def __init__(self, *args, **kwargs) -> None: input_args = list(args) self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._config: ComputeClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace - def list(self, **kwargs: Any) -> ItemPaged["_models.Operation"]: - """List the operations for the provider. + def get( + self, location: str, public_gallery_name: str, gallery_image_name: str, **kwargs: Any + ) -> _models.CommunityGalleryImage: + """Get a community gallery image. - :return: An iterator like instance of either Operation or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.models.Operation] + :param location: The name of the Azure region. Required. + :type location: str + :param public_gallery_name: The public name of the community gallery. Required. + :type public_gallery_name: str + :param gallery_image_name: The name of the community gallery image definition. Required. + :type gallery_image_name: str + :return: CommunityGalleryImage. The CommunityGalleryImage is compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.CommunityGalleryImage + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.CommunityGalleryImage] = kwargs.pop("cls", None) + + _request = build_community_gallery_images_get_request( + location=location, + public_gallery_name=public_gallery_name, + gallery_image_name=gallery_image_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.CommunityGalleryImage, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list( + self, location: str, public_gallery_name: str, **kwargs: Any + ) -> ItemPaged["_models.CommunityGalleryImage"]: + """List community gallery images inside a gallery. + + :param location: The name of the Azure region. Required. + :type location: str + :param public_gallery_name: The public name of the community gallery. Required. + :type public_gallery_name: str + :return: An iterator like instance of CommunityGalleryImage + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.models.CommunityGalleryImage] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.CommunityGalleryImage]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_community_gallery_images_list_request( + location=location, + public_gallery_name=public_gallery_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.CommunityGalleryImage], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + +class CommunityGalleryImageVersionsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.compute.ComputeClient`'s + :attr:`community_gallery_image_versions` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def get( + self, + location: str, + public_gallery_name: str, + gallery_image_name: str, + gallery_image_version_name: str, + **kwargs: Any + ) -> _models.CommunityGalleryImageVersion: + """Get a community gallery image version. + + :param location: The name of the Azure region. Required. + :type location: str + :param public_gallery_name: The public name of the community gallery. Required. + :type public_gallery_name: str + :param gallery_image_name: The name of the community gallery image definition. Required. + :type gallery_image_name: str + :param gallery_image_version_name: The name of the community gallery image version. Needs to + follow semantic version name pattern: The allowed characters are digit and period. Digits must + be within the range of a 32-bit integer. Format: ... + Required. + :type gallery_image_version_name: str + :return: CommunityGalleryImageVersion. The CommunityGalleryImageVersion is compatible with + MutableMapping + :rtype: ~azure.mgmt.compute.models.CommunityGalleryImageVersion + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.CommunityGalleryImageVersion] = kwargs.pop("cls", None) + + _request = build_community_gallery_image_versions_get_request( + location=location, + public_gallery_name=public_gallery_name, + gallery_image_name=gallery_image_name, + gallery_image_version_name=gallery_image_version_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.CommunityGalleryImageVersion, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list( + self, location: str, public_gallery_name: str, gallery_image_name: str, **kwargs: Any + ) -> ItemPaged["_models.CommunityGalleryImageVersion"]: + """List community gallery image versions inside an image. + + :param location: The name of the Azure region. Required. + :type location: str + :param public_gallery_name: The public name of the community gallery. Required. + :type public_gallery_name: str + :param gallery_image_name: The name of the community gallery image definition. Required. + :type gallery_image_name: str + :return: An iterator like instance of CommunityGalleryImageVersion + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.models.CommunityGalleryImageVersion] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.CommunityGalleryImageVersion]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_community_gallery_image_versions_list_request( + location=location, + public_gallery_name=public_gallery_name, + gallery_image_name=gallery_image_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.CommunityGalleryImageVersion], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + +class ResourceSkusOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.compute.ComputeClient`'s + :attr:`resource_skus` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list( + self, *, filter: Optional[str] = None, include_extended_locations: Optional[str] = None, **kwargs: Any + ) -> ItemPaged["_models.ResourceSku"]: + """Gets the list of Microsoft.Compute SKUs available for your Subscription. + + :keyword filter: The filter to apply on the operation. Only **location** filter is supported + currently. Default value is None. + :paramtype filter: str + :keyword include_extended_locations: To Include Extended Locations information or not in the + response. Default value is None. + :paramtype include_extended_locations: str + :return: An iterator like instance of ResourceSku + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.models.ResourceSku] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + _params = kwargs.pop("params", {}) or {} - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) + cls: ClsType[List[_models.ResourceSku]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -99,25 +47316,49 @@ def list(self, **kwargs: Any) -> ItemPaged["_models.Operation"]: def prepare_request(next_link=None): if not next_link: - _request = build_list_request( - api_version=api_version, + _request = build_resource_skus_list_request( + subscription_id=self._config.subscription_id, + filter=filter, + include_extended_locations=include_extended_locations, + api_version=self._config.api_version, headers=_headers, params=_params, ) - _request.url = self._client.format_url(_request.url) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) else: - _request = HttpRequest("GET", next_link) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + return _request def extract_data(pipeline_response): - deserialized = self._deserialize("OperationListResult", pipeline_response) - list_of_elem = deserialized.value + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.ResourceSku], deserialized.get("value", [])) if cls: list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) + return deserialized.get("nextLink") or None, iter(list_of_elem) def get_next(next_link=None): _request = prepare_request(next_link) @@ -130,7 +47371,8 @@ def get_next(next_link=None): if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + error = _failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/operations/_patch.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/operations/_patch.py index 8bcb627aa475..87676c65a8f0 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/operations/_patch.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/operations/_patch.py @@ -7,9 +7,9 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/operations/_proximity_placement_groups_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/operations/_proximity_placement_groups_operations.py deleted file mode 100644 index 1f5332fdc1ff..000000000000 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/operations/_proximity_placement_groups_operations.py +++ /dev/null @@ -1,785 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# 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 collections.abc import MutableMapping -from io import IOBase -from typing import Any, Callable, IO, Optional, TypeVar, Union, overload - -from azure.core import PipelineClient -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models -from .._configuration import ComputeManagementClientConfiguration -from .._utils.serialization import Deserializer, Serializer - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] -List = list - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_by_subscription_request(subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - accept = _headers.pop("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", min_length=1), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_by_resource_group_request(resource_group_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_request( - resource_group_name: str, - proximity_placement_group_name: str, - subscription_id: str, - *, - include_colocation_status: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "proximityPlacementGroupName": _SERIALIZER.url( - "proximity_placement_group_name", proximity_placement_group_name, "str" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if include_colocation_status is not None: - _params["includeColocationStatus"] = _SERIALIZER.query( - "include_colocation_status", include_colocation_status, "str" - ) - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, proximity_placement_group_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "proximityPlacementGroupName": _SERIALIZER.url( - "proximity_placement_group_name", proximity_placement_group_name, "str" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_request( - resource_group_name: str, proximity_placement_group_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "proximityPlacementGroupName": _SERIALIZER.url( - "proximity_placement_group_name", proximity_placement_group_name, "str" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, proximity_placement_group_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "proximityPlacementGroupName": _SERIALIZER.url( - "proximity_placement_group_name", proximity_placement_group_name, "str" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -class ProximityPlacementGroupsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.compute.ComputeManagementClient`'s - :attr:`proximity_placement_groups` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list_by_subscription(self, **kwargs: Any) -> ItemPaged["_models.ProximityPlacementGroup"]: - """Lists all proximity placement groups in a subscription. - - :return: An iterator like instance of either ProximityPlacementGroup or the result of - cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.models.ProximityPlacementGroup] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[_models.ProximityPlacementGroupListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_by_subscription_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - _request = HttpRequest("GET", next_link) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @distributed_trace - def list_by_resource_group( - self, resource_group_name: str, **kwargs: Any - ) -> ItemPaged["_models.ProximityPlacementGroup"]: - """Lists all proximity placement groups in a resource group. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :return: An iterator like instance of either ProximityPlacementGroup or the result of - cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.models.ProximityPlacementGroup] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[_models.ProximityPlacementGroupListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_by_resource_group_request( - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - _request = HttpRequest("GET", next_link) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @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. The name is case insensitive. - Required. - :type resource_group_name: str - :param proximity_placement_group_name: The name of the proximity placement group. Required. - :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 - :return: ProximityPlacementGroup or the result of cls(response) - :rtype: ~azure.mgmt.compute.models.ProximityPlacementGroup - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[_models.ProximityPlacementGroup] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - proximity_placement_group_name=proximity_placement_group_name, - subscription_id=self._config.subscription_id, - include_colocation_status=include_colocation_status, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("ProximityPlacementGroup", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def create_or_update( - self, - resource_group_name: str, - proximity_placement_group_name: str, - parameters: _models.ProximityPlacementGroup, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.ProximityPlacementGroup: - """Create or update a proximity placement group. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param proximity_placement_group_name: The name of the proximity placement group. Required. - :type proximity_placement_group_name: str - :param parameters: Parameters supplied to the Create Proximity Placement Group operation. - Required. - :type parameters: ~azure.mgmt.compute.models.ProximityPlacementGroup - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: ProximityPlacementGroup or the result of cls(response) - :rtype: ~azure.mgmt.compute.models.ProximityPlacementGroup - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def create_or_update( - self, - resource_group_name: str, - proximity_placement_group_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.ProximityPlacementGroup: - """Create or update a proximity placement group. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param proximity_placement_group_name: The name of the proximity placement group. Required. - :type proximity_placement_group_name: str - :param parameters: Parameters supplied to the Create Proximity Placement Group operation. - Required. - :type parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: ProximityPlacementGroup or the result of cls(response) - :rtype: ~azure.mgmt.compute.models.ProximityPlacementGroup - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def create_or_update( - self, - resource_group_name: str, - proximity_placement_group_name: str, - parameters: Union[_models.ProximityPlacementGroup, IO[bytes]], - **kwargs: Any - ) -> _models.ProximityPlacementGroup: - """Create or update a proximity placement group. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param proximity_placement_group_name: The name of the proximity placement group. Required. - :type proximity_placement_group_name: str - :param parameters: Parameters supplied to the Create Proximity Placement Group operation. Is - either a ProximityPlacementGroup type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.compute.models.ProximityPlacementGroup or IO[bytes] - :return: ProximityPlacementGroup or the result of cls(response) - :rtype: ~azure.mgmt.compute.models.ProximityPlacementGroup - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ProximityPlacementGroup] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _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, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("ProximityPlacementGroup", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def update( - self, - resource_group_name: str, - proximity_placement_group_name: str, - parameters: _models.ProximityPlacementGroupUpdate, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.ProximityPlacementGroup: - """Update a proximity placement group. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param proximity_placement_group_name: The name of the proximity placement group. Required. - :type proximity_placement_group_name: str - :param parameters: Parameters supplied to the Update Proximity Placement Group operation. - Required. - :type parameters: ~azure.mgmt.compute.models.ProximityPlacementGroupUpdate - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: ProximityPlacementGroup or the result of cls(response) - :rtype: ~azure.mgmt.compute.models.ProximityPlacementGroup - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def update( - self, - resource_group_name: str, - proximity_placement_group_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.ProximityPlacementGroup: - """Update a proximity placement group. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param proximity_placement_group_name: The name of the proximity placement group. Required. - :type proximity_placement_group_name: str - :param parameters: Parameters supplied to the Update Proximity Placement Group operation. - Required. - :type parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: ProximityPlacementGroup or the result of cls(response) - :rtype: ~azure.mgmt.compute.models.ProximityPlacementGroup - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def update( - self, - resource_group_name: str, - proximity_placement_group_name: str, - parameters: Union[_models.ProximityPlacementGroupUpdate, IO[bytes]], - **kwargs: Any - ) -> _models.ProximityPlacementGroup: - """Update a proximity placement group. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param proximity_placement_group_name: The name of the proximity placement group. Required. - :type proximity_placement_group_name: str - :param parameters: Parameters supplied to the Update Proximity Placement Group operation. Is - either a ProximityPlacementGroupUpdate type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.compute.models.ProximityPlacementGroupUpdate or IO[bytes] - :return: ProximityPlacementGroup or the result of cls(response) - :rtype: ~azure.mgmt.compute.models.ProximityPlacementGroup - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ProximityPlacementGroup] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _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, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("ProximityPlacementGroup", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. The name is case insensitive. - Required. - :type resource_group_name: str - :param proximity_placement_group_name: The name of the proximity placement group. Required. - :type proximity_placement_group_name: str - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - - _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, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/operations/_resource_skus_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/operations/_resource_skus_operations.py deleted file mode 100644 index 3e09e6f31b6b..000000000000 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/operations/_resource_skus_operations.py +++ /dev/null @@ -1,166 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from collections.abc import MutableMapping -from typing import Any, Callable, Optional, TypeVar - -from azure.core import PipelineClient -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models -from .._configuration import ComputeManagementClientConfiguration -from .._utils.serialization import Deserializer, Serializer - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] -List = list - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_request( - subscription_id: str, - *, - filter: Optional[str] = None, - include_extended_locations: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/skus") - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if filter is not None: - _params["$filter"] = _SERIALIZER.query("filter", filter, "str") - if include_extended_locations is not None: - _params["includeExtendedLocations"] = _SERIALIZER.query( - "include_extended_locations", include_extended_locations, "str" - ) - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class ResourceSkusOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.compute.ComputeManagementClient`'s - :attr:`resource_skus` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list( - self, filter: Optional[str] = None, include_extended_locations: Optional[str] = None, **kwargs: Any - ) -> ItemPaged["_models.ResourceSku"]: - """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. Default value is None. - :type filter: str - :param include_extended_locations: To Include Extended Locations information or not in the - response. Default value is None. - :type include_extended_locations: str - :return: An iterator like instance of either ResourceSku or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.models.ResourceSku] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) - cls: ClsType[_models.ResourceSkusResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - subscription_id=self._config.subscription_id, - filter=filter, - include_extended_locations=include_extended_locations, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - _request = HttpRequest("GET", next_link) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("ResourceSkusResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/operations/_restore_point_collections_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/operations/_restore_point_collections_operations.py deleted file mode 100644 index c9719e875fa9..000000000000 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/operations/_restore_point_collections_operations.py +++ /dev/null @@ -1,854 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# 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 collections.abc import MutableMapping -from io import IOBase -from typing import Any, Callable, IO, Iterator, Optional, TypeVar, Union, cast, overload - -from azure.core import PipelineClient -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - StreamClosedError, - StreamConsumedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from .._configuration import ComputeManagementClientConfiguration -from .._utils.serialization import Deserializer, Serializer - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] -List = list - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_all_request(subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - accept = _headers.pop("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", min_length=1), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request(resource_group_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_request( - resource_group_name: str, - restore_point_collection_name: str, - subscription_id: str, - *, - expand: Optional[Union[str, _models.RestorePointCollectionExpandOptions]] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "restorePointCollectionName": _SERIALIZER.url( - "restore_point_collection_name", restore_point_collection_name, "str" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if expand is not None: - _params["$expand"] = _SERIALIZER.query("expand", expand, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, restore_point_collection_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "restorePointCollectionName": _SERIALIZER.url( - "restore_point_collection_name", restore_point_collection_name, "str" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_request( - resource_group_name: str, restore_point_collection_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "restorePointCollectionName": _SERIALIZER.url( - "restore_point_collection_name", restore_point_collection_name, "str" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, restore_point_collection_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "restorePointCollectionName": _SERIALIZER.url( - "restore_point_collection_name", restore_point_collection_name, "str" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -class RestorePointCollectionsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.compute.ComputeManagementClient`'s - :attr:`restore_point_collections` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list_all(self, **kwargs: Any) -> ItemPaged["_models.RestorePointCollection"]: - """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. - - :return: An iterator like instance of either RestorePointCollection or the result of - cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.models.RestorePointCollection] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[_models.RestorePointCollectionListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_all_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - _request = HttpRequest("GET", next_link) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @distributed_trace - def list(self, resource_group_name: str, **kwargs: Any) -> ItemPaged["_models.RestorePointCollection"]: - """Gets the list of restore point collections in a resource group. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :return: An iterator like instance of either RestorePointCollection or the result of - cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.models.RestorePointCollection] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[_models.RestorePointCollectionListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - _request = HttpRequest("GET", next_link) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @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. The name is case insensitive. - Required. - :type resource_group_name: str - :param restore_point_collection_name: The name of the restore point collection. Required. - :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. "restorePoints" Default - value is None. - :type expand: str or ~azure.mgmt.compute.models.RestorePointCollectionExpandOptions - :return: RestorePointCollection or the result of cls(response) - :rtype: ~azure.mgmt.compute.models.RestorePointCollection - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[_models.RestorePointCollection] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - restore_point_collection_name=restore_point_collection_name, - subscription_id=self._config.subscription_id, - expand=expand, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("RestorePointCollection", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def create_or_update( - self, - resource_group_name: str, - restore_point_collection_name: str, - parameters: _models.RestorePointCollection, - *, - content_type: str = "application/json", - **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. The name is case insensitive. - Required. - :type resource_group_name: str - :param restore_point_collection_name: The name of the restore point collection. Required. - :type restore_point_collection_name: str - :param parameters: Parameters supplied to the Create or Update restore point collection - operation. Required. - :type parameters: ~azure.mgmt.compute.models.RestorePointCollection - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: RestorePointCollection or the result of cls(response) - :rtype: ~azure.mgmt.compute.models.RestorePointCollection - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def create_or_update( - self, - resource_group_name: str, - restore_point_collection_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **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. The name is case insensitive. - Required. - :type resource_group_name: str - :param restore_point_collection_name: The name of the restore point collection. Required. - :type restore_point_collection_name: str - :param parameters: Parameters supplied to the Create or Update restore point collection - operation. Required. - :type parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: RestorePointCollection or the result of cls(response) - :rtype: ~azure.mgmt.compute.models.RestorePointCollection - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def create_or_update( - self, - resource_group_name: str, - restore_point_collection_name: str, - parameters: Union[_models.RestorePointCollection, IO[bytes]], - **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. The name is case insensitive. - Required. - :type resource_group_name: str - :param restore_point_collection_name: The name of the restore point collection. Required. - :type restore_point_collection_name: str - :param parameters: Parameters supplied to the Create or Update restore point collection - operation. Is either a RestorePointCollection type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.compute.models.RestorePointCollection or IO[bytes] - :return: RestorePointCollection or the result of cls(response) - :rtype: ~azure.mgmt.compute.models.RestorePointCollection - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.RestorePointCollection] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "RestorePointCollection") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - restore_point_collection_name=restore_point_collection_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("RestorePointCollection", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def update( - self, - resource_group_name: str, - restore_point_collection_name: str, - parameters: _models.RestorePointCollectionUpdate, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.RestorePointCollection: - """The operation to update the restore point collection. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param restore_point_collection_name: The name of the restore point collection. Required. - :type restore_point_collection_name: str - :param parameters: Parameters supplied to the Update restore point collection operation. - Required. - :type parameters: ~azure.mgmt.compute.models.RestorePointCollectionUpdate - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: RestorePointCollection or the result of cls(response) - :rtype: ~azure.mgmt.compute.models.RestorePointCollection - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def update( - self, - resource_group_name: str, - restore_point_collection_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.RestorePointCollection: - """The operation to update the restore point collection. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param restore_point_collection_name: The name of the restore point collection. Required. - :type restore_point_collection_name: str - :param parameters: Parameters supplied to the Update restore point collection operation. - Required. - :type parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: RestorePointCollection or the result of cls(response) - :rtype: ~azure.mgmt.compute.models.RestorePointCollection - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def update( - self, - resource_group_name: str, - restore_point_collection_name: str, - parameters: Union[_models.RestorePointCollectionUpdate, IO[bytes]], - **kwargs: Any - ) -> _models.RestorePointCollection: - """The operation to update the restore point collection. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param restore_point_collection_name: The name of the restore point collection. Required. - :type restore_point_collection_name: str - :param parameters: Parameters supplied to the Update restore point collection operation. Is - either a RestorePointCollectionUpdate type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.compute.models.RestorePointCollectionUpdate or IO[bytes] - :return: RestorePointCollection or the result of cls(response) - :rtype: ~azure.mgmt.compute.models.RestorePointCollection - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.RestorePointCollection] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "RestorePointCollectionUpdate") - - _request = build_update_request( - resource_group_name=resource_group_name, - restore_point_collection_name=restore_point_collection_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("RestorePointCollection", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _delete_initial( - self, resource_group_name: str, restore_point_collection_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - restore_point_collection_name=restore_point_collection_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_delete( - 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. The name is case insensitive. - Required. - :type resource_group_name: str - :param restore_point_collection_name: The name of the restore point collection. Required. - :type restore_point_collection_name: str - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - restore_point_collection_name=restore_point_collection_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/operations/_restore_points_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/operations/_restore_points_operations.py deleted file mode 100644 index 34521c70cb22..000000000000 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/operations/_restore_points_operations.py +++ /dev/null @@ -1,591 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# 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 collections.abc import MutableMapping -from io import IOBase -from typing import Any, Callable, IO, Iterator, Optional, TypeVar, Union, cast, overload - -from azure.core import PipelineClient -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - StreamClosedError, - StreamConsumedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from .._configuration import ComputeManagementClientConfiguration -from .._utils.serialization import Deserializer, Serializer - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] -List = list - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_get_request( - resource_group_name: str, - restore_point_collection_name: str, - restore_point_name: str, - subscription_id: str, - *, - expand: Optional[Union[str, _models.RestorePointExpandOptions]] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{restorePointName}", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "restorePointCollectionName": _SERIALIZER.url( - "restore_point_collection_name", restore_point_collection_name, "str" - ), - "restorePointName": _SERIALIZER.url("restore_point_name", restore_point_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if expand is not None: - _params["$expand"] = _SERIALIZER.query("expand", expand, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_request( - resource_group_name: str, - restore_point_collection_name: str, - restore_point_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{restorePointName}", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "restorePointCollectionName": _SERIALIZER.url( - "restore_point_collection_name", restore_point_collection_name, "str" - ), - "restorePointName": _SERIALIZER.url("restore_point_name", restore_point_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, - restore_point_collection_name: str, - restore_point_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{restorePointName}", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "restorePointCollectionName": _SERIALIZER.url( - "restore_point_collection_name", restore_point_collection_name, "str" - ), - "restorePointName": _SERIALIZER.url("restore_point_name", restore_point_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -class RestorePointsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.compute.ComputeManagementClient`'s - :attr:`restore_points` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @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. The name is case insensitive. - Required. - :type resource_group_name: str - :param restore_point_collection_name: The name of the restore point collection. Required. - :type restore_point_collection_name: str - :param restore_point_name: The name of the restore point. Required. - :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. "instanceView" Default value is None. - :type expand: str or ~azure.mgmt.compute.models.RestorePointExpandOptions - :return: RestorePoint or the result of cls(response) - :rtype: ~azure.mgmt.compute.models.RestorePoint - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[_models.RestorePoint] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - restore_point_collection_name=restore_point_collection_name, - restore_point_name=restore_point_name, - subscription_id=self._config.subscription_id, - expand=expand, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("RestorePoint", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_initial( - self, - resource_group_name: str, - restore_point_collection_name: str, - restore_point_name: str, - parameters: Union[_models.RestorePoint, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "RestorePoint") - - _request = build_create_request( - resource_group_name=resource_group_name, - restore_point_collection_name=restore_point_collection_name, - restore_point_name=restore_point_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [201]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create( - self, - resource_group_name: str, - restore_point_collection_name: str, - restore_point_name: str, - parameters: _models.RestorePoint, - *, - content_type: str = "application/json", - **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. The name is case insensitive. - Required. - :type resource_group_name: str - :param restore_point_collection_name: The name of the restore point collection. Required. - :type restore_point_collection_name: str - :param restore_point_name: The name of the restore point. Required. - :type restore_point_name: str - :param parameters: Parameters supplied to the Create restore point operation. Required. - :type parameters: ~azure.mgmt.compute.models.RestorePoint - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either RestorePoint or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.RestorePoint] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create( - self, - resource_group_name: str, - restore_point_collection_name: str, - restore_point_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **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. The name is case insensitive. - Required. - :type resource_group_name: str - :param restore_point_collection_name: The name of the restore point collection. Required. - :type restore_point_collection_name: str - :param restore_point_name: The name of the restore point. Required. - :type restore_point_name: str - :param parameters: Parameters supplied to the Create restore point operation. Required. - :type parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either RestorePoint or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.RestorePoint] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create( - self, - resource_group_name: str, - restore_point_collection_name: str, - restore_point_name: str, - parameters: Union[_models.RestorePoint, IO[bytes]], - **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. The name is case insensitive. - Required. - :type resource_group_name: str - :param restore_point_collection_name: The name of the restore point collection. Required. - :type restore_point_collection_name: str - :param restore_point_name: The name of the restore point. Required. - :type restore_point_name: str - :param parameters: Parameters supplied to the Create restore point operation. Is either a - RestorePoint type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.compute.models.RestorePoint or IO[bytes] - :return: An instance of LROPoller that returns either RestorePoint or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.RestorePoint] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.RestorePoint] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._create_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, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - response_headers = {} - response = pipeline_response.http_response - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = self._deserialize("RestorePoint", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.RestorePoint].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.RestorePoint]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, restore_point_collection_name: str, restore_point_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - restore_point_collection_name=restore_point_collection_name, - restore_point_name=restore_point_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_delete( - 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. The name is case insensitive. - Required. - :type resource_group_name: str - :param restore_point_collection_name: The name of the restore point collection. Required. - :type restore_point_collection_name: str - :param restore_point_name: The name of the restore point. Required. - :type restore_point_name: str - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( - 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, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/operations/_shared_galleries_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/operations/_shared_galleries_operations.py deleted file mode 100644 index 91e63a533ac2..000000000000 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/operations/_shared_galleries_operations.py +++ /dev/null @@ -1,248 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# 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 collections.abc import MutableMapping -from typing import Any, Callable, Optional, TypeVar, Union - -from azure.core import PipelineClient -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models -from .._configuration import ComputeManagementClientConfiguration -from .._utils.serialization import Deserializer, Serializer - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] -List = list - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_request( - location: str, - subscription_id: str, - *, - shared_to: Optional[Union[str, _models.SharedToValues]] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-03")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/sharedGalleries", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "location": _SERIALIZER.url("location", location, "str", min_length=1), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if shared_to is not None: - _params["sharedTo"] = _SERIALIZER.query("shared_to", shared_to, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_request(location: str, gallery_unique_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-03")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/sharedGalleries/{galleryUniqueName}", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "location": _SERIALIZER.url("location", location, "str", min_length=1), - "galleryUniqueName": _SERIALIZER.url("gallery_unique_name", gallery_unique_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class SharedGalleriesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.compute.ComputeManagementClient`'s - :attr:`shared_galleries` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list( - self, location: str, shared_to: Optional[Union[str, _models.SharedToValues]] = None, **kwargs: Any - ) -> ItemPaged["_models.SharedGallery"]: - """List shared galleries by subscription id or tenant id. - - :param location: The name of Azure region. Required. - :type location: str - :param shared_to: The query parameter to decide what shared galleries to fetch when doing - listing operations. "tenant" Default value is None. - :type shared_to: str or ~azure.mgmt.compute.models.SharedToValues - :return: An iterator like instance of either SharedGallery or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.models.SharedGallery] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-03")) - cls: ClsType[_models.SharedGalleryList] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - location=location, - subscription_id=self._config.subscription_id, - shared_to=shared_to, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - _request = HttpRequest("GET", next_link) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("SharedGalleryList", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @distributed_trace - def get(self, location: str, gallery_unique_name: str, **kwargs: Any) -> _models.SharedGallery: - """Get a shared gallery by subscription id or tenant id. - - :param location: The name of Azure region. Required. - :type location: str - :param gallery_unique_name: The unique name of the Shared Gallery. Required. - :type gallery_unique_name: str - :return: SharedGallery or the result of cls(response) - :rtype: ~azure.mgmt.compute.models.SharedGallery - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-03")) - cls: ClsType[_models.SharedGallery] = kwargs.pop("cls", None) - - _request = build_get_request( - location=location, - gallery_unique_name=gallery_unique_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("SharedGallery", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/operations/_shared_gallery_image_versions_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/operations/_shared_gallery_image_versions_operations.py deleted file mode 100644 index 10baecfa4081..000000000000 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/operations/_shared_gallery_image_versions_operations.py +++ /dev/null @@ -1,291 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# 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 collections.abc import MutableMapping -from typing import Any, Callable, Optional, TypeVar, Union - -from azure.core import PipelineClient -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models -from .._configuration import ComputeManagementClientConfiguration -from .._utils.serialization import Deserializer, Serializer - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] -List = list - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_request( - location: str, - gallery_unique_name: str, - gallery_image_name: str, - subscription_id: str, - *, - shared_to: Optional[Union[str, _models.SharedToValues]] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-03")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/sharedGalleries/{galleryUniqueName}/images/{galleryImageName}/versions", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "location": _SERIALIZER.url("location", location, "str", min_length=1), - "galleryUniqueName": _SERIALIZER.url("gallery_unique_name", gallery_unique_name, "str"), - "galleryImageName": _SERIALIZER.url("gallery_image_name", gallery_image_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if shared_to is not None: - _params["sharedTo"] = _SERIALIZER.query("shared_to", shared_to, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_request( - location: str, - gallery_unique_name: str, - gallery_image_name: str, - gallery_image_version_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-03")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/sharedGalleries/{galleryUniqueName}/images/{galleryImageName}/versions/{galleryImageVersionName}", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "location": _SERIALIZER.url("location", location, "str", min_length=1), - "galleryUniqueName": _SERIALIZER.url("gallery_unique_name", gallery_unique_name, "str"), - "galleryImageName": _SERIALIZER.url("gallery_image_name", gallery_image_name, "str"), - "galleryImageVersionName": _SERIALIZER.url("gallery_image_version_name", gallery_image_version_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class SharedGalleryImageVersionsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.compute.ComputeManagementClient`'s - :attr:`shared_gallery_image_versions` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list( - self, - location: str, - gallery_unique_name: str, - gallery_image_name: str, - shared_to: Optional[Union[str, _models.SharedToValues]] = None, - **kwargs: Any - ) -> ItemPaged["_models.SharedGalleryImageVersion"]: - """List shared gallery image versions by subscription id or tenant id. - - :param location: The name of Azure region. Required. - :type location: str - :param gallery_unique_name: The unique name of the Shared Gallery. Required. - :type gallery_unique_name: str - :param gallery_image_name: The name of the Shared Gallery Image Definition from which the Image - Versions are to be listed. Required. - :type gallery_image_name: str - :param shared_to: The query parameter to decide what shared galleries to fetch when doing - listing operations. "tenant" Default value is None. - :type shared_to: str or ~azure.mgmt.compute.models.SharedToValues - :return: An iterator like instance of either SharedGalleryImageVersion or the result of - cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.models.SharedGalleryImageVersion] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-03")) - cls: ClsType[_models.SharedGalleryImageVersionList] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - location=location, - gallery_unique_name=gallery_unique_name, - gallery_image_name=gallery_image_name, - subscription_id=self._config.subscription_id, - shared_to=shared_to, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - _request = HttpRequest("GET", next_link) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("SharedGalleryImageVersionList", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @distributed_trace - def get( - self, - location: str, - gallery_unique_name: str, - gallery_image_name: str, - gallery_image_version_name: str, - **kwargs: Any - ) -> _models.SharedGalleryImageVersion: - """Get a shared gallery image version by subscription id or tenant id. - - :param location: The name of Azure region. Required. - :type location: str - :param gallery_unique_name: The unique name of the Shared Gallery. Required. - :type gallery_unique_name: str - :param gallery_image_name: The name of the Shared Gallery Image Definition from which the Image - Versions are to be listed. Required. - :type gallery_image_name: str - :param gallery_image_version_name: The name of the gallery image version to be created. Needs - to follow semantic version name pattern: The allowed characters are digit and period. Digits - must be within the range of a 32-bit integer. Format: :code:``.\\ - :code:``.\\ :code:``. Required. - :type gallery_image_version_name: str - :return: SharedGalleryImageVersion or the result of cls(response) - :rtype: ~azure.mgmt.compute.models.SharedGalleryImageVersion - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-03")) - cls: ClsType[_models.SharedGalleryImageVersion] = kwargs.pop("cls", None) - - _request = build_get_request( - location=location, - gallery_unique_name=gallery_unique_name, - gallery_image_name=gallery_image_name, - gallery_image_version_name=gallery_image_version_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("SharedGalleryImageVersion", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/operations/_shared_gallery_images_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/operations/_shared_gallery_images_operations.py deleted file mode 100644 index 3585d4830301..000000000000 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/operations/_shared_gallery_images_operations.py +++ /dev/null @@ -1,266 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# 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 collections.abc import MutableMapping -from typing import Any, Callable, Optional, TypeVar, Union - -from azure.core import PipelineClient -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models -from .._configuration import ComputeManagementClientConfiguration -from .._utils.serialization import Deserializer, Serializer - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] -List = list - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_request( - location: str, - gallery_unique_name: str, - subscription_id: str, - *, - shared_to: Optional[Union[str, _models.SharedToValues]] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-03")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/sharedGalleries/{galleryUniqueName}/images", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "location": _SERIALIZER.url("location", location, "str", min_length=1), - "galleryUniqueName": _SERIALIZER.url("gallery_unique_name", gallery_unique_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if shared_to is not None: - _params["sharedTo"] = _SERIALIZER.query("shared_to", shared_to, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_request( - location: str, gallery_unique_name: str, gallery_image_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-03")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/sharedGalleries/{galleryUniqueName}/images/{galleryImageName}", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "location": _SERIALIZER.url("location", location, "str", min_length=1), - "galleryUniqueName": _SERIALIZER.url("gallery_unique_name", gallery_unique_name, "str"), - "galleryImageName": _SERIALIZER.url("gallery_image_name", gallery_image_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class SharedGalleryImagesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.compute.ComputeManagementClient`'s - :attr:`shared_gallery_images` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list( - self, - location: str, - gallery_unique_name: str, - shared_to: Optional[Union[str, _models.SharedToValues]] = None, - **kwargs: Any - ) -> ItemPaged["_models.SharedGalleryImage"]: - """List shared gallery images by subscription id or tenant id. - - :param location: The name of Azure region. Required. - :type location: str - :param gallery_unique_name: The unique name of the Shared Gallery. Required. - :type gallery_unique_name: str - :param shared_to: The query parameter to decide what shared galleries to fetch when doing - listing operations. "tenant" Default value is None. - :type shared_to: str or ~azure.mgmt.compute.models.SharedToValues - :return: An iterator like instance of either SharedGalleryImage or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.models.SharedGalleryImage] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-03")) - cls: ClsType[_models.SharedGalleryImageList] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - location=location, - gallery_unique_name=gallery_unique_name, - subscription_id=self._config.subscription_id, - shared_to=shared_to, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - _request = HttpRequest("GET", next_link) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("SharedGalleryImageList", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @distributed_trace - def get( - self, location: str, gallery_unique_name: str, gallery_image_name: str, **kwargs: Any - ) -> _models.SharedGalleryImage: - """Get a shared gallery image by subscription id or tenant id. - - :param location: The name of Azure region. Required. - :type location: str - :param gallery_unique_name: The unique name of the Shared Gallery. Required. - :type gallery_unique_name: str - :param gallery_image_name: The name of the Shared Gallery Image Definition from which the Image - Versions are to be listed. Required. - :type gallery_image_name: str - :return: SharedGalleryImage or the result of cls(response) - :rtype: ~azure.mgmt.compute.models.SharedGalleryImage - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-03")) - cls: ClsType[_models.SharedGalleryImage] = kwargs.pop("cls", None) - - _request = build_get_request( - location=location, - gallery_unique_name=gallery_unique_name, - gallery_image_name=gallery_image_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("SharedGalleryImage", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/operations/_snapshots_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/operations/_snapshots_operations.py deleted file mode 100644 index 62d80b6db608..000000000000 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/operations/_snapshots_operations.py +++ /dev/null @@ -1,1330 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression,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 collections.abc import MutableMapping -from io import IOBase -from typing import Any, Callable, IO, Iterator, Optional, TypeVar, Union, cast, overload - -from azure.core import PipelineClient -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - StreamClosedError, - StreamConsumedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from .._configuration import ComputeManagementClientConfiguration -from .._utils.serialization import Deserializer, Serializer - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] -List = list - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-01-02")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/snapshots") - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_by_resource_group_request(resource_group_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-01-02")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_request(resource_group_name: str, snapshot_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-01-02")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "snapshotName": _SERIALIZER.url("snapshot_name", snapshot_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, snapshot_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-01-02")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "snapshotName": _SERIALIZER.url("snapshot_name", snapshot_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_request( - resource_group_name: str, snapshot_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-01-02")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "snapshotName": _SERIALIZER.url("snapshot_name", snapshot_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, snapshot_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-01-02")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "snapshotName": _SERIALIZER.url("snapshot_name", snapshot_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_grant_access_request( - resource_group_name: str, snapshot_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-01-02")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/beginGetAccess", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "snapshotName": _SERIALIZER.url("snapshot_name", snapshot_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_revoke_access_request( - resource_group_name: str, snapshot_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-01-02")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/endGetAccess", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "snapshotName": _SERIALIZER.url("snapshot_name", snapshot_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class SnapshotsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.compute.ComputeManagementClient`'s - :attr:`snapshots` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list(self, **kwargs: Any) -> ItemPaged["_models.Snapshot"]: - """Lists snapshots under a subscription. - - :return: An iterator like instance of either Snapshot or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.models.Snapshot] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-01-02")) - cls: ClsType[_models.SnapshotList] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - _request = HttpRequest("GET", next_link) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("SnapshotList", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @distributed_trace - def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> ItemPaged["_models.Snapshot"]: - """Lists snapshots under a resource group. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :return: An iterator like instance of either Snapshot or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.models.Snapshot] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-01-02")) - cls: ClsType[_models.SnapshotList] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_by_resource_group_request( - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - _request = HttpRequest("GET", next_link) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("SnapshotList", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @distributed_trace - def get(self, resource_group_name: str, snapshot_name: str, **kwargs: Any) -> _models.Snapshot: - """Gets information about a snapshot. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param snapshot_name: The name of the snapshot that is being created. The name can't be changed - after the snapshot is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. - The max name length is 80 characters. Required. - :type snapshot_name: str - :return: Snapshot or the result of cls(response) - :rtype: ~azure.mgmt.compute.models.Snapshot - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-01-02")) - cls: ClsType[_models.Snapshot] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - snapshot_name=snapshot_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("Snapshot", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, resource_group_name: str, snapshot_name: str, snapshot: Union[_models.Snapshot, IO[bytes]], **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-01-02")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(snapshot, (IOBase, bytes)): - _content = snapshot - else: - _json = self._serialize.body(snapshot, "Snapshot") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - snapshot_name=snapshot_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - snapshot_name: str, - snapshot: _models.Snapshot, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.Snapshot]: - """Creates or updates a snapshot. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param snapshot_name: The name of the snapshot that is being created. The name can't be changed - after the snapshot is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. - The max name length is 80 characters. Required. - :type snapshot_name: str - :param snapshot: Snapshot object supplied in the body of the Put disk operation. Required. - :type snapshot: ~azure.mgmt.compute.models.Snapshot - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either Snapshot or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.Snapshot] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - snapshot_name: str, - snapshot: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.Snapshot]: - """Creates or updates a snapshot. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param snapshot_name: The name of the snapshot that is being created. The name can't be changed - after the snapshot is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. - The max name length is 80 characters. Required. - :type snapshot_name: str - :param snapshot: Snapshot object supplied in the body of the Put disk operation. Required. - :type snapshot: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either Snapshot or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.Snapshot] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, resource_group_name: str, snapshot_name: str, snapshot: Union[_models.Snapshot, IO[bytes]], **kwargs: Any - ) -> LROPoller[_models.Snapshot]: - """Creates or updates a snapshot. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param snapshot_name: The name of the snapshot that is being created. The name can't be changed - after the snapshot is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. - The max name length is 80 characters. Required. - :type snapshot_name: str - :param snapshot: Snapshot object supplied in the body of the Put disk operation. Is either a - Snapshot type or a IO[bytes] type. Required. - :type snapshot: ~azure.mgmt.compute.models.Snapshot or IO[bytes] - :return: An instance of LROPoller that returns either Snapshot or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.Snapshot] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-01-02")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Snapshot] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._create_or_update_initial( - resource_group_name=resource_group_name, - snapshot_name=snapshot_name, - snapshot=snapshot, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Snapshot", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.Snapshot].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.Snapshot]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _update_initial( - self, - resource_group_name: str, - snapshot_name: str, - snapshot: Union[_models.SnapshotUpdate, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-01-02")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(snapshot, (IOBase, bytes)): - _content = snapshot - else: - _json = self._serialize.body(snapshot, "SnapshotUpdate") - - _request = build_update_request( - resource_group_name=resource_group_name, - snapshot_name=snapshot_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update( - self, - resource_group_name: str, - snapshot_name: str, - snapshot: _models.SnapshotUpdate, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.Snapshot]: - """Updates (patches) a snapshot. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param snapshot_name: The name of the snapshot that is being created. The name can't be changed - after the snapshot is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. - The max name length is 80 characters. Required. - :type snapshot_name: str - :param snapshot: Snapshot object supplied in the body of the Patch snapshot operation. - Required. - :type snapshot: ~azure.mgmt.compute.models.SnapshotUpdate - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either Snapshot or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.Snapshot] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update( - self, - resource_group_name: str, - snapshot_name: str, - snapshot: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.Snapshot]: - """Updates (patches) a snapshot. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param snapshot_name: The name of the snapshot that is being created. The name can't be changed - after the snapshot is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. - The max name length is 80 characters. Required. - :type snapshot_name: str - :param snapshot: Snapshot object supplied in the body of the Patch snapshot operation. - Required. - :type snapshot: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either Snapshot or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.Snapshot] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_update( - self, - resource_group_name: str, - snapshot_name: str, - snapshot: Union[_models.SnapshotUpdate, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.Snapshot]: - """Updates (patches) a snapshot. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param snapshot_name: The name of the snapshot that is being created. The name can't be changed - after the snapshot is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. - The max name length is 80 characters. Required. - :type snapshot_name: str - :param snapshot: Snapshot object supplied in the body of the Patch snapshot operation. Is - either a SnapshotUpdate type or a IO[bytes] type. Required. - :type snapshot: ~azure.mgmt.compute.models.SnapshotUpdate or IO[bytes] - :return: An instance of LROPoller that returns either Snapshot or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.Snapshot] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-01-02")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Snapshot] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._update_initial( - resource_group_name=resource_group_name, - snapshot_name=snapshot_name, - snapshot=snapshot, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Snapshot", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.Snapshot].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.Snapshot]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial(self, resource_group_name: str, snapshot_name: str, **kwargs: Any) -> Iterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-01-02")) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - snapshot_name=snapshot_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_delete(self, resource_group_name: str, snapshot_name: str, **kwargs: Any) -> LROPoller[None]: - """Deletes a snapshot. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param snapshot_name: The name of the snapshot that is being created. The name can't be changed - after the snapshot is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. - The max name length is 80 characters. Required. - :type snapshot_name: str - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-01-02")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - snapshot_name=snapshot_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _grant_access_initial( - self, - resource_group_name: str, - snapshot_name: str, - grant_access_data: Union[_models.GrantAccessData, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-01-02")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(grant_access_data, (IOBase, bytes)): - _content = grant_access_data - else: - _json = self._serialize.body(grant_access_data, "GrantAccessData") - - _request = build_grant_access_request( - resource_group_name=resource_group_name, - snapshot_name=snapshot_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_grant_access( - self, - resource_group_name: str, - snapshot_name: str, - grant_access_data: _models.GrantAccessData, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.AccessUri]: - """Grants access to a snapshot. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param snapshot_name: The name of the snapshot that is being created. The name can't be changed - after the snapshot is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. - The max name length is 80 characters. Required. - :type snapshot_name: str - :param grant_access_data: Access data object supplied in the body of the get snapshot access - operation. Required. - :type grant_access_data: ~azure.mgmt.compute.models.GrantAccessData - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either AccessUri or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.AccessUri] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_grant_access( - self, - resource_group_name: str, - snapshot_name: str, - grant_access_data: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.AccessUri]: - """Grants access to a snapshot. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param snapshot_name: The name of the snapshot that is being created. The name can't be changed - after the snapshot is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. - The max name length is 80 characters. Required. - :type snapshot_name: str - :param grant_access_data: Access data object supplied in the body of the get snapshot access - operation. Required. - :type grant_access_data: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either AccessUri or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.AccessUri] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_grant_access( - self, - resource_group_name: str, - snapshot_name: str, - grant_access_data: Union[_models.GrantAccessData, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.AccessUri]: - """Grants access to a snapshot. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param snapshot_name: The name of the snapshot that is being created. The name can't be changed - after the snapshot is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. - The max name length is 80 characters. Required. - :type snapshot_name: str - :param grant_access_data: Access data object supplied in the body of the get snapshot access - operation. Is either a GrantAccessData type or a IO[bytes] type. Required. - :type grant_access_data: ~azure.mgmt.compute.models.GrantAccessData or IO[bytes] - :return: An instance of LROPoller that returns either AccessUri or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.AccessUri] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-01-02")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AccessUri] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._grant_access_initial( - 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, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("AccessUri", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.AccessUri].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.AccessUri]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _revoke_access_initial(self, resource_group_name: str, snapshot_name: str, **kwargs: Any) -> Iterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-01-02")) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_revoke_access_request( - resource_group_name=resource_group_name, - snapshot_name=snapshot_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_revoke_access(self, resource_group_name: str, snapshot_name: str, **kwargs: Any) -> LROPoller[None]: - """Revokes access to a snapshot. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param snapshot_name: The name of the snapshot that is being created. The name can't be changed - after the snapshot is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. - The max name length is 80 characters. Required. - :type snapshot_name: str - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-01-02")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._revoke_access_initial( - resource_group_name=resource_group_name, - snapshot_name=snapshot_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/operations/_soft_deleted_resource_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/operations/_soft_deleted_resource_operations.py deleted file mode 100644 index 3579297b3a54..000000000000 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/operations/_soft_deleted_resource_operations.py +++ /dev/null @@ -1,183 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# 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 collections.abc import MutableMapping -from typing import Any, Callable, Optional, TypeVar - -from azure.core import PipelineClient -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models -from .._configuration import ComputeManagementClientConfiguration -from .._utils.serialization import Deserializer, Serializer - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] -List = list - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_by_artifact_name_request( - resource_group_name: str, - gallery_name: str, - artifact_type: str, - artifact_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-03")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/softdeletedartifacttypes/{artifactType}/artifacts/{artifactName}/versions", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "galleryName": _SERIALIZER.url("gallery_name", gallery_name, "str"), - "artifactType": _SERIALIZER.url( - "artifact_type", artifact_type, "str", pattern=r"^[a-zA-Z0-9]+([_]?[a-zA-Z0-9]+)*$" - ), - "artifactName": _SERIALIZER.url( - "artifact_name", artifact_name, "str", pattern=r"^[a-zA-Z0-9]+([_]?[a-zA-Z0-9]+)*$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class SoftDeletedResourceOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.compute.ComputeManagementClient`'s - :attr:`soft_deleted_resource` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list_by_artifact_name( - self, resource_group_name: str, gallery_name: str, artifact_type: str, artifact_name: str, **kwargs: Any - ) -> ItemPaged["_models.GallerySoftDeletedResource"]: - """List soft-deleted resources of an artifact in the gallery, such as soft-deleted gallery image - version of an image. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :param artifact_type: The type of the artifact to be listed, such as gallery image version. - Required. - :type artifact_type: str - :param artifact_name: The artifact name to be listed. If artifact type is Images, then the - artifact name should be the gallery image name. Required. - :type artifact_name: str - :return: An iterator like instance of either GallerySoftDeletedResource or the result of - cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.models.GallerySoftDeletedResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-03")) - cls: ClsType[_models.GallerySoftDeletedResourceList] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_by_artifact_name_request( - resource_group_name=resource_group_name, - gallery_name=gallery_name, - artifact_type=artifact_type, - artifact_name=artifact_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - _request = HttpRequest("GET", next_link) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("GallerySoftDeletedResourceList", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/operations/_ssh_public_keys_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/operations/_ssh_public_keys_operations.py deleted file mode 100644 index 7b151bd4a88b..000000000000 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/operations/_ssh_public_keys_operations.py +++ /dev/null @@ -1,930 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# 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 collections.abc import MutableMapping -from io import IOBase -from typing import Any, Callable, IO, Optional, TypeVar, Union, overload - -from azure.core import PipelineClient -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models -from .._configuration import ComputeManagementClientConfiguration -from .._utils.serialization import Deserializer, Serializer - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] -List = list - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_by_subscription_request(subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - accept = _headers.pop("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", min_length=1), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_by_resource_group_request(resource_group_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/sshPublicKeys", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_request( - resource_group_name: str, ssh_public_key_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{sshPublicKeyName}", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "sshPublicKeyName": _SERIALIZER.url("ssh_public_key_name", ssh_public_key_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_request( - resource_group_name: str, ssh_public_key_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{sshPublicKeyName}", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "sshPublicKeyName": _SERIALIZER.url("ssh_public_key_name", ssh_public_key_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_request( - resource_group_name: str, ssh_public_key_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{sshPublicKeyName}", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "sshPublicKeyName": _SERIALIZER.url("ssh_public_key_name", ssh_public_key_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, ssh_public_key_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{sshPublicKeyName}", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "sshPublicKeyName": _SERIALIZER.url("ssh_public_key_name", ssh_public_key_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_generate_key_pair_request( - resource_group_name: str, ssh_public_key_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{sshPublicKeyName}/generateKeyPair", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "sshPublicKeyName": _SERIALIZER.url("ssh_public_key_name", ssh_public_key_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class SshPublicKeysOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.compute.ComputeManagementClient`'s - :attr:`ssh_public_keys` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list_by_subscription(self, **kwargs: Any) -> ItemPaged["_models.SshPublicKeyResource"]: - """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. - - :return: An iterator like instance of either SshPublicKeyResource or the result of - cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.models.SshPublicKeyResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[_models.SshPublicKeysGroupListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_by_subscription_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - _request = HttpRequest("GET", next_link) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @distributed_trace - def list_by_resource_group( - self, resource_group_name: str, **kwargs: Any - ) -> ItemPaged["_models.SshPublicKeyResource"]: - """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. The name is case insensitive. - Required. - :type resource_group_name: str - :return: An iterator like instance of either SshPublicKeyResource or the result of - cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.models.SshPublicKeyResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[_models.SshPublicKeysGroupListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_by_resource_group_request( - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - _request = HttpRequest("GET", next_link) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @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. The name is case insensitive. - Required. - :type resource_group_name: str - :param ssh_public_key_name: The name of the SSH public key. Required. - :type ssh_public_key_name: str - :return: SshPublicKeyResource or the result of cls(response) - :rtype: ~azure.mgmt.compute.models.SshPublicKeyResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[_models.SshPublicKeyResource] = kwargs.pop("cls", None) - - _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, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("SshPublicKeyResource", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def create( - self, - resource_group_name: str, - ssh_public_key_name: str, - parameters: _models.SshPublicKeyResource, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.SshPublicKeyResource: - """Creates a new SSH public key resource. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param ssh_public_key_name: The name of the SSH public key. Required. - :type ssh_public_key_name: str - :param parameters: Parameters supplied to create the SSH public key. Required. - :type parameters: ~azure.mgmt.compute.models.SshPublicKeyResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: SshPublicKeyResource or the result of cls(response) - :rtype: ~azure.mgmt.compute.models.SshPublicKeyResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def create( - self, - resource_group_name: str, - ssh_public_key_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.SshPublicKeyResource: - """Creates a new SSH public key resource. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param ssh_public_key_name: The name of the SSH public key. Required. - :type ssh_public_key_name: str - :param parameters: Parameters supplied to create the SSH public key. Required. - :type parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: SshPublicKeyResource or the result of cls(response) - :rtype: ~azure.mgmt.compute.models.SshPublicKeyResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def create( - self, - resource_group_name: str, - ssh_public_key_name: str, - parameters: Union[_models.SshPublicKeyResource, IO[bytes]], - **kwargs: Any - ) -> _models.SshPublicKeyResource: - """Creates a new SSH public key resource. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param ssh_public_key_name: The name of the SSH public key. Required. - :type ssh_public_key_name: str - :param parameters: Parameters supplied to create the SSH public key. Is either a - SshPublicKeyResource type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.compute.models.SshPublicKeyResource or IO[bytes] - :return: SshPublicKeyResource or the result of cls(response) - :rtype: ~azure.mgmt.compute.models.SshPublicKeyResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.SshPublicKeyResource] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _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, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("SshPublicKeyResource", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def update( - self, - resource_group_name: str, - ssh_public_key_name: str, - parameters: _models.SshPublicKeyUpdateResource, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.SshPublicKeyResource: - """Updates a new SSH public key resource. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param ssh_public_key_name: The name of the SSH public key. Required. - :type ssh_public_key_name: str - :param parameters: Parameters supplied to update the SSH public key. Required. - :type parameters: ~azure.mgmt.compute.models.SshPublicKeyUpdateResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: SshPublicKeyResource or the result of cls(response) - :rtype: ~azure.mgmt.compute.models.SshPublicKeyResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def update( - self, - resource_group_name: str, - ssh_public_key_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.SshPublicKeyResource: - """Updates a new SSH public key resource. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param ssh_public_key_name: The name of the SSH public key. Required. - :type ssh_public_key_name: str - :param parameters: Parameters supplied to update the SSH public key. Required. - :type parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: SshPublicKeyResource or the result of cls(response) - :rtype: ~azure.mgmt.compute.models.SshPublicKeyResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def update( - self, - resource_group_name: str, - ssh_public_key_name: str, - parameters: Union[_models.SshPublicKeyUpdateResource, IO[bytes]], - **kwargs: Any - ) -> _models.SshPublicKeyResource: - """Updates a new SSH public key resource. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param ssh_public_key_name: The name of the SSH public key. Required. - :type ssh_public_key_name: str - :param parameters: Parameters supplied to update the SSH public key. Is either a - SshPublicKeyUpdateResource type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.compute.models.SshPublicKeyUpdateResource or IO[bytes] - :return: SshPublicKeyResource or the result of cls(response) - :rtype: ~azure.mgmt.compute.models.SshPublicKeyResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.SshPublicKeyResource] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _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, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("SshPublicKeyResource", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. The name is case insensitive. - Required. - :type resource_group_name: str - :param ssh_public_key_name: The name of the SSH public key. Required. - :type ssh_public_key_name: str - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - - _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, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 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, {}) # type: ignore - - @overload - def generate_key_pair( - self, - resource_group_name: str, - ssh_public_key_name: str, - parameters: Optional[_models.SshGenerateKeyPairInputParameters] = None, - *, - content_type: str = "application/json", - **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. The name is case insensitive. - Required. - :type resource_group_name: str - :param ssh_public_key_name: The name of the SSH public key. Required. - :type ssh_public_key_name: str - :param parameters: Parameters supplied to generate the SSH public key. Default value is None. - :type parameters: ~azure.mgmt.compute.models.SshGenerateKeyPairInputParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: SshPublicKeyGenerateKeyPairResult or the result of cls(response) - :rtype: ~azure.mgmt.compute.models.SshPublicKeyGenerateKeyPairResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def generate_key_pair( - self, - resource_group_name: str, - ssh_public_key_name: str, - parameters: Optional[IO[bytes]] = None, - *, - content_type: str = "application/json", - **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. The name is case insensitive. - Required. - :type resource_group_name: str - :param ssh_public_key_name: The name of the SSH public key. Required. - :type ssh_public_key_name: str - :param parameters: Parameters supplied to generate the SSH public key. Default value is None. - :type parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: SshPublicKeyGenerateKeyPairResult or the result of cls(response) - :rtype: ~azure.mgmt.compute.models.SshPublicKeyGenerateKeyPairResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def generate_key_pair( - self, - resource_group_name: str, - ssh_public_key_name: str, - parameters: Optional[Union[_models.SshGenerateKeyPairInputParameters, IO[bytes]]] = None, - **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. The name is case insensitive. - Required. - :type resource_group_name: str - :param ssh_public_key_name: The name of the SSH public key. Required. - :type ssh_public_key_name: str - :param parameters: Parameters supplied to generate the SSH public key. Is either a - SshGenerateKeyPairInputParameters type or a IO[bytes] type. Default value is None. - :type parameters: ~azure.mgmt.compute.models.SshGenerateKeyPairInputParameters or IO[bytes] - :return: SshPublicKeyGenerateKeyPairResult or the result of cls(response) - :rtype: ~azure.mgmt.compute.models.SshPublicKeyGenerateKeyPairResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - content_type = content_type if parameters else None - cls: ClsType[_models.SshPublicKeyGenerateKeyPairResult] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" if parameters else None - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - if parameters is not None: - _json = self._serialize.body(parameters, "SshGenerateKeyPairInputParameters") - else: - _json = None - - _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, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("SshPublicKeyGenerateKeyPairResult", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/operations/_usage_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/operations/_usage_operations.py deleted file mode 100644 index c678205a22e5..000000000000 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/operations/_usage_operations.py +++ /dev/null @@ -1,150 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from collections.abc import MutableMapping -from typing import Any, Callable, Optional, TypeVar - -from azure.core import PipelineClient -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models -from .._configuration import ComputeManagementClientConfiguration -from .._utils.serialization import Deserializer, Serializer - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] -List = list - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_request(location: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/usages" - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "location": _SERIALIZER.url("location", location, "str", min_length=1), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class UsageOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.compute.ComputeManagementClient`'s - :attr:`usage` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list(self, location: str, **kwargs: Any) -> ItemPaged["_models.Usage"]: - """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 name of Azure region. Required. - :type location: str - :return: An iterator like instance of either Usage or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.models.Usage] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[_models.ListUsagesResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - location=location, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - _request = HttpRequest("GET", next_link) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/operations/_virtual_machine_extension_images_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/operations/_virtual_machine_extension_images_operations.py deleted file mode 100644 index 45f36345bb9d..000000000000 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/operations/_virtual_machine_extension_images_operations.py +++ /dev/null @@ -1,357 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# 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 collections.abc import MutableMapping -from typing import Any, Callable, Optional, TypeVar - -from azure.core import PipelineClient -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models -from .._configuration import ComputeManagementClientConfiguration -from .._utils.serialization import Deserializer, Serializer - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] -List = list - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_types_request(location: str, publisher_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmextension/types", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "location": _SERIALIZER.url("location", location, "str", min_length=1), - "publisherName": _SERIALIZER.url("publisher_name", publisher_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_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: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmextension/types/{type}/versions", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "location": _SERIALIZER.url("location", location, "str", min_length=1), - "publisherName": _SERIALIZER.url("publisher_name", publisher_name, "str"), - "type": _SERIALIZER.url("type", type, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if filter is not None: - _params["$filter"] = _SERIALIZER.query("filter", filter, "str") - if top is not None: - _params["$top"] = _SERIALIZER.query("top", top, "int") - if orderby is not None: - _params["$orderby"] = _SERIALIZER.query("orderby", orderby, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_request( - location: str, publisher_name: str, type: str, version: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmextension/types/{type}/versions/{version}", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "location": _SERIALIZER.url("location", location, "str", min_length=1), - "publisherName": _SERIALIZER.url("publisher_name", publisher_name, "str"), - "type": _SERIALIZER.url("type", type, "str"), - "version": _SERIALIZER.url("version", version, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class VirtualMachineExtensionImagesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.compute.ComputeManagementClient`'s - :attr:`virtual_machine_extension_images` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @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 Azure region. Required. - :type location: str - :param publisher_name: Required. - :type publisher_name: str - :return: list of VirtualMachineExtensionImage or the result of cls(response) - :rtype: list[~azure.mgmt.compute.models.VirtualMachineExtensionImage] - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[List[_models.VirtualMachineExtensionImage]] = kwargs.pop("cls", None) - - _request = build_list_types_request( - location=location, - publisher_name=publisher_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("[VirtualMachineExtensionImage]", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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 Azure region. Required. - :type location: str - :param publisher_name: Required. - :type publisher_name: str - :param type: Required. - :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 - :return: list of VirtualMachineExtensionImage or the result of cls(response) - :rtype: list[~azure.mgmt.compute.models.VirtualMachineExtensionImage] - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[List[_models.VirtualMachineExtensionImage]] = kwargs.pop("cls", None) - - _request = build_list_versions_request( - location=location, - publisher_name=publisher_name, - type=type, - subscription_id=self._config.subscription_id, - filter=filter, - top=top, - orderby=orderby, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("[VirtualMachineExtensionImage]", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @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 Azure region. Required. - :type location: str - :param publisher_name: Required. - :type publisher_name: str - :param type: Required. - :type type: str - :param version: Required. - :type version: str - :return: VirtualMachineExtensionImage or the result of cls(response) - :rtype: ~azure.mgmt.compute.models.VirtualMachineExtensionImage - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[_models.VirtualMachineExtensionImage] = kwargs.pop("cls", None) - - _request = build_get_request( - location=location, - publisher_name=publisher_name, - type=type, - version=version, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("VirtualMachineExtensionImage", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/operations/_virtual_machine_extensions_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/operations/_virtual_machine_extensions_operations.py deleted file mode 100644 index 11665d43b8c9..000000000000 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/operations/_virtual_machine_extensions_operations.py +++ /dev/null @@ -1,921 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# 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 collections.abc import MutableMapping -from io import IOBase -from typing import Any, Callable, IO, Iterator, Optional, TypeVar, Union, cast, overload - -from azure.core import PipelineClient -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - StreamClosedError, - StreamConsumedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from .._configuration import ComputeManagementClientConfiguration -from .._utils.serialization import Deserializer, Serializer - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] -List = list - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_request( - resource_group_name: str, vm_name: str, subscription_id: str, *, expand: Optional[str] = None, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if expand is not None: - _params["$expand"] = _SERIALIZER.query("expand", expand, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -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: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), - "vmExtensionName": _SERIALIZER.url("vm_extension_name", vm_extension_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if expand is not None: - _params["$expand"] = _SERIALIZER.query("expand", expand, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, vm_name: str, vm_extension_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), - "vmExtensionName": _SERIALIZER.url("vm_extension_name", vm_extension_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_request( - resource_group_name: str, vm_name: str, vm_extension_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), - "vmExtensionName": _SERIALIZER.url("vm_extension_name", vm_extension_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, vm_name: str, vm_extension_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), - "vmExtensionName": _SERIALIZER.url("vm_extension_name", vm_extension_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -class VirtualMachineExtensionsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.compute.ComputeManagementClient`'s - :attr:`virtual_machine_extensions` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @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. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_name: The name of the virtual machine. Required. - :type vm_name: str - :param expand: The expand expression to apply on the operation. Default value is None. - :type expand: str - :return: VirtualMachineExtensionsListResult or the result of cls(response) - :rtype: ~azure.mgmt.compute.models.VirtualMachineExtensionsListResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[_models.VirtualMachineExtensionsListResult] = kwargs.pop("cls", None) - - _request = build_list_request( - resource_group_name=resource_group_name, - vm_name=vm_name, - subscription_id=self._config.subscription_id, - expand=expand, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("VirtualMachineExtensionsListResult", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_name: The name of the virtual machine. Required. - :type vm_name: str - :param vm_extension_name: The name of the virtual machine extension. Required. - :type vm_extension_name: str - :param expand: The expand expression to apply on the operation. Default value is None. - :type expand: str - :return: VirtualMachineExtension or the result of cls(response) - :rtype: ~azure.mgmt.compute.models.VirtualMachineExtension - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[_models.VirtualMachineExtension] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - vm_name=vm_name, - vm_extension_name=vm_extension_name, - subscription_id=self._config.subscription_id, - expand=expand, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("VirtualMachineExtension", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - vm_name: str, - vm_extension_name: str, - extension_parameters: Union[_models.VirtualMachineExtension, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(extension_parameters, (IOBase, bytes)): - _content = extension_parameters - else: - _json = self._serialize.body(extension_parameters, "VirtualMachineExtension") - - _request = build_create_or_update_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, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 201: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - vm_name: str, - vm_extension_name: str, - extension_parameters: _models.VirtualMachineExtension, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.VirtualMachineExtension]: - """The operation to create or update the extension. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_name: The name of the virtual machine. Required. - :type vm_name: str - :param vm_extension_name: The name of the virtual machine extension. Required. - :type vm_extension_name: str - :param extension_parameters: Parameters supplied to the Create Virtual Machine Extension - operation. Required. - :type extension_parameters: ~azure.mgmt.compute.models.VirtualMachineExtension - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either VirtualMachineExtension or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.VirtualMachineExtension] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - vm_name: str, - vm_extension_name: str, - extension_parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.VirtualMachineExtension]: - """The operation to create or update the extension. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_name: The name of the virtual machine. Required. - :type vm_name: str - :param vm_extension_name: The name of the virtual machine extension. Required. - :type vm_extension_name: str - :param extension_parameters: Parameters supplied to the Create Virtual Machine Extension - operation. Required. - :type extension_parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either VirtualMachineExtension or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.VirtualMachineExtension] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - vm_name: str, - vm_extension_name: str, - extension_parameters: Union[_models.VirtualMachineExtension, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.VirtualMachineExtension]: - """The operation to create or update the extension. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_name: The name of the virtual machine. Required. - :type vm_name: str - :param vm_extension_name: The name of the virtual machine extension. Required. - :type vm_extension_name: str - :param extension_parameters: Parameters supplied to the Create Virtual Machine Extension - operation. Is either a VirtualMachineExtension type or a IO[bytes] type. Required. - :type extension_parameters: ~azure.mgmt.compute.models.VirtualMachineExtension or IO[bytes] - :return: An instance of LROPoller that returns either VirtualMachineExtension or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.VirtualMachineExtension] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.VirtualMachineExtension] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._create_or_update_initial( - resource_group_name=resource_group_name, - 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, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("VirtualMachineExtension", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.VirtualMachineExtension].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.VirtualMachineExtension]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _update_initial( - self, - resource_group_name: str, - vm_name: str, - vm_extension_name: str, - extension_parameters: Union[_models.VirtualMachineExtensionUpdate, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(extension_parameters, (IOBase, bytes)): - _content = extension_parameters - else: - _json = self._serialize.body(extension_parameters, "VirtualMachineExtensionUpdate") - - _request = build_update_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, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update( - self, - resource_group_name: str, - vm_name: str, - vm_extension_name: str, - extension_parameters: _models.VirtualMachineExtensionUpdate, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.VirtualMachineExtension]: - """The operation to update the extension. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_name: The name of the virtual machine. Required. - :type vm_name: str - :param vm_extension_name: The name of the virtual machine extension. Required. - :type vm_extension_name: str - :param extension_parameters: Parameters supplied to the Update Virtual Machine Extension - operation. Required. - :type extension_parameters: ~azure.mgmt.compute.models.VirtualMachineExtensionUpdate - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either VirtualMachineExtension or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.VirtualMachineExtension] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update( - self, - resource_group_name: str, - vm_name: str, - vm_extension_name: str, - extension_parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.VirtualMachineExtension]: - """The operation to update the extension. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_name: The name of the virtual machine. Required. - :type vm_name: str - :param vm_extension_name: The name of the virtual machine extension. Required. - :type vm_extension_name: str - :param extension_parameters: Parameters supplied to the Update Virtual Machine Extension - operation. Required. - :type extension_parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either VirtualMachineExtension or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.VirtualMachineExtension] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_update( - self, - resource_group_name: str, - vm_name: str, - vm_extension_name: str, - extension_parameters: Union[_models.VirtualMachineExtensionUpdate, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.VirtualMachineExtension]: - """The operation to update the extension. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_name: The name of the virtual machine. Required. - :type vm_name: str - :param vm_extension_name: The name of the virtual machine extension. Required. - :type vm_extension_name: str - :param extension_parameters: Parameters supplied to the Update Virtual Machine Extension - operation. Is either a VirtualMachineExtensionUpdate type or a IO[bytes] type. Required. - :type extension_parameters: ~azure.mgmt.compute.models.VirtualMachineExtensionUpdate or - IO[bytes] - :return: An instance of LROPoller that returns either VirtualMachineExtension or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.VirtualMachineExtension] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.VirtualMachineExtension] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._update_initial( - resource_group_name=resource_group_name, - 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, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - response_headers = {} - response = pipeline_response.http_response - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = self._deserialize("VirtualMachineExtension", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.VirtualMachineExtension].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.VirtualMachineExtension]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, vm_name: str, vm_extension_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_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, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_delete( - 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. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_name: The name of the virtual machine. Required. - :type vm_name: str - :param vm_extension_name: The name of the virtual machine extension. Required. - :type vm_extension_name: str - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( - 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, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/operations/_virtual_machine_images_edge_zone_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/operations/_virtual_machine_images_edge_zone_operations.py deleted file mode 100644 index 66d3fd62caf9..000000000000 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/operations/_virtual_machine_images_edge_zone_operations.py +++ /dev/null @@ -1,575 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# 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 collections.abc import MutableMapping -from typing import Any, Callable, Optional, TypeVar - -from azure.core import PipelineClient -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models -from .._configuration import ComputeManagementClientConfiguration -from .._utils.serialization import Deserializer, Serializer - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] -List = list - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_publishers_request(location: str, edge_zone: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/edgeZones/{edgeZone}/publishers", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "location": _SERIALIZER.url("location", location, "str", min_length=1), - "edgeZone": _SERIALIZER.url("edge_zone", edge_zone, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_offers_request( - location: str, edge_zone: str, publisher_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/edgeZones/{edgeZone}/publishers/{publisherName}/artifacttypes/vmimage/offers", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "location": _SERIALIZER.url("location", location, "str", min_length=1), - "edgeZone": _SERIALIZER.url("edge_zone", edge_zone, "str"), - "publisherName": _SERIALIZER.url("publisher_name", publisher_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_skus_request( - location: str, edge_zone: str, publisher_name: str, offer: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/edgeZones/{edgeZone}/publishers/{publisherName}/artifacttypes/vmimage/offers/{offer}/skus", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "location": _SERIALIZER.url("location", location, "str", min_length=1), - "edgeZone": _SERIALIZER.url("edge_zone", edge_zone, "str"), - "publisherName": _SERIALIZER.url("publisher_name", publisher_name, "str"), - "offer": _SERIALIZER.url("offer", offer, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request( - 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: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/edgeZones/{edgeZone}/publishers/{publisherName}/artifacttypes/vmimage/offers/{offer}/skus/{skus}/versions", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "location": _SERIALIZER.url("location", location, "str", min_length=1), - "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"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if expand is not None: - _params["$expand"] = _SERIALIZER.query("expand", expand, "str") - if top is not None: - _params["$top"] = _SERIALIZER.query("top", top, "int") - if orderby is not None: - _params["$orderby"] = _SERIALIZER.query("orderby", orderby, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_request( - location: str, - edge_zone: str, - publisher_name: str, - offer: str, - skus: str, - version: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/edgeZones/{edgeZone}/publishers/{publisherName}/artifacttypes/vmimage/offers/{offer}/skus/{skus}/versions/{version}", - ) - path_format_arguments = { - "location": _SERIALIZER.url("location", location, "str", min_length=1), - "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", min_length=1), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class VirtualMachineImagesEdgeZoneOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.compute.ComputeManagementClient`'s - :attr:`virtual_machine_images_edge_zone` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @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 Azure region. Required. - :type location: str - :param edge_zone: The name of the edge zone. Required. - :type edge_zone: str - :return: list of VirtualMachineImageResource or the result of cls(response) - :rtype: list[~azure.mgmt.compute.models.VirtualMachineImageResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[List[_models.VirtualMachineImageResource]] = kwargs.pop("cls", None) - - _request = build_list_publishers_request( - location=location, - edge_zone=edge_zone, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("[VirtualMachineImageResource]", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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 Azure region. Required. - :type location: str - :param edge_zone: The name of the edge zone. Required. - :type edge_zone: str - :param publisher_name: A valid image publisher. Required. - :type publisher_name: str - :return: list of VirtualMachineImageResource or the result of cls(response) - :rtype: list[~azure.mgmt.compute.models.VirtualMachineImageResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[List[_models.VirtualMachineImageResource]] = kwargs.pop("cls", None) - - _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, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("[VirtualMachineImageResource]", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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 Azure region. Required. - :type location: str - :param edge_zone: The name of the edge zone. Required. - :type edge_zone: str - :param publisher_name: A valid image publisher. Required. - :type publisher_name: str - :param offer: A valid image publisher offer. Required. - :type offer: str - :return: list of VirtualMachineImageResource or the result of cls(response) - :rtype: list[~azure.mgmt.compute.models.VirtualMachineImageResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[List[_models.VirtualMachineImageResource]] = kwargs.pop("cls", None) - - _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, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("[VirtualMachineImageResource]", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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 Azure region. Required. - :type location: str - :param edge_zone: The name of the edge zone. Required. - :type edge_zone: str - :param publisher_name: A valid image publisher. Required. - :type publisher_name: str - :param offer: A valid image publisher offer. Required. - :type offer: str - :param skus: A valid image SKU. Required. - :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 - :return: list of VirtualMachineImageResource or the result of cls(response) - :rtype: list[~azure.mgmt.compute.models.VirtualMachineImageResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[List[_models.VirtualMachineImageResource]] = kwargs.pop("cls", None) - - _request = build_list_request( - location=location, - edge_zone=edge_zone, - publisher_name=publisher_name, - offer=offer, - skus=skus, - subscription_id=self._config.subscription_id, - expand=expand, - top=top, - orderby=orderby, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("[VirtualMachineImageResource]", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @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 Azure region. Required. - :type location: str - :param edge_zone: The name of the edge zone. Required. - :type edge_zone: str - :param publisher_name: A valid image publisher. Required. - :type publisher_name: str - :param offer: A valid image publisher offer. Required. - :type offer: str - :param skus: A valid image SKU. Required. - :type skus: str - :param version: A valid image SKU version. Required. - :type version: str - :return: VirtualMachineImage or the result of cls(response) - :rtype: ~azure.mgmt.compute.models.VirtualMachineImage - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[_models.VirtualMachineImage] = kwargs.pop("cls", None) - - _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, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("VirtualMachineImage", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/operations/_virtual_machine_images_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/operations/_virtual_machine_images_operations.py deleted file mode 100644 index 1e10fba23718..000000000000 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/operations/_virtual_machine_images_operations.py +++ /dev/null @@ -1,746 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# 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 collections.abc import MutableMapping -from typing import Any, Callable, Optional, TypeVar - -from azure.core import PipelineClient -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models -from .._configuration import ComputeManagementClientConfiguration -from .._utils.serialization import Deserializer, Serializer - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] -List = list - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_by_edge_zone_request(location: str, edge_zone: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/edgeZones/{edgeZone}/vmimages", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "location": _SERIALIZER.url("location", location, "str", min_length=1), - "edgeZone": _SERIALIZER.url("edge_zone", edge_zone, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_publishers_request(location: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers" - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "location": _SERIALIZER.url("location", location, "str", min_length=1), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_offers_request(location: str, publisher_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmimage/offers", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "location": _SERIALIZER.url("location", location, "str", min_length=1), - "publisherName": _SERIALIZER.url("publisher_name", publisher_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_skus_request( - location: str, publisher_name: str, offer: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmimage/offers/{offer}/skus", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "location": _SERIALIZER.url("location", location, "str", min_length=1), - "publisherName": _SERIALIZER.url("publisher_name", publisher_name, "str"), - "offer": _SERIALIZER.url("offer", offer, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request( - 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: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmimage/offers/{offer}/skus/{skus}/versions", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "location": _SERIALIZER.url("location", location, "str", min_length=1), - "publisherName": _SERIALIZER.url("publisher_name", publisher_name, "str"), - "offer": _SERIALIZER.url("offer", offer, "str"), - "skus": _SERIALIZER.url("skus", skus, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if expand is not None: - _params["$expand"] = _SERIALIZER.query("expand", expand, "str") - if top is not None: - _params["$top"] = _SERIALIZER.query("top", top, "int") - if orderby is not None: - _params["$orderby"] = _SERIALIZER.query("orderby", orderby, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_request( - location: str, publisher_name: str, offer: str, skus: str, version: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmimage/offers/{offer}/skus/{skus}/versions/{version}", - ) - path_format_arguments = { - "location": _SERIALIZER.url("location", location, "str", min_length=1), - "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", min_length=1), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_with_properties_request( - location: str, - publisher_name: str, - offer: str, - skus: str, - subscription_id: str, - *, - expand: str, - top: Optional[int] = None, - orderby: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmimage/offers/{offer}/skus/{skus}/versions", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "location": _SERIALIZER.url("location", location, "str", min_length=1), - "publisherName": _SERIALIZER.url("publisher_name", publisher_name, "str"), - "offer": _SERIALIZER.url("offer", offer, "str"), - "skus": _SERIALIZER.url("skus", skus, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - _params["$expand"] = _SERIALIZER.query("expand", expand, "str") - if top is not None: - _params["$top"] = _SERIALIZER.query("top", top, "int") - if orderby is not None: - _params["$orderby"] = _SERIALIZER.query("orderby", orderby, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class VirtualMachineImagesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.compute.ComputeManagementClient`'s - :attr:`virtual_machine_images` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list_by_edge_zone(self, location: str, edge_zone: str, **kwargs: Any) -> _models.VmImagesInEdgeZoneListResult: - """Gets a list of all virtual machine image versions for the specified edge zone. - - :param location: The name of Azure region. Required. - :type location: str - :param edge_zone: The name of the edge zone. Required. - :type edge_zone: str - :return: VmImagesInEdgeZoneListResult or the result of cls(response) - :rtype: ~azure.mgmt.compute.models.VmImagesInEdgeZoneListResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[_models.VmImagesInEdgeZoneListResult] = kwargs.pop("cls", None) - - _request = build_list_by_edge_zone_request( - location=location, - edge_zone=edge_zone, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("VmImagesInEdgeZoneListResult", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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 Azure region. Required. - :type location: str - :return: list of VirtualMachineImageResource or the result of cls(response) - :rtype: list[~azure.mgmt.compute.models.VirtualMachineImageResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[List[_models.VirtualMachineImageResource]] = kwargs.pop("cls", None) - - _request = build_list_publishers_request( - location=location, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("[VirtualMachineImageResource]", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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 Azure region. Required. - :type location: str - :param publisher_name: A valid image publisher. Required. - :type publisher_name: str - :return: list of VirtualMachineImageResource or the result of cls(response) - :rtype: list[~azure.mgmt.compute.models.VirtualMachineImageResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[List[_models.VirtualMachineImageResource]] = kwargs.pop("cls", None) - - _request = build_list_offers_request( - location=location, - publisher_name=publisher_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("[VirtualMachineImageResource]", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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 Azure region. Required. - :type location: str - :param publisher_name: A valid image publisher. Required. - :type publisher_name: str - :param offer: A valid image publisher offer. Required. - :type offer: str - :return: list of VirtualMachineImageResource or the result of cls(response) - :rtype: list[~azure.mgmt.compute.models.VirtualMachineImageResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[List[_models.VirtualMachineImageResource]] = kwargs.pop("cls", None) - - _request = build_list_skus_request( - location=location, - publisher_name=publisher_name, - offer=offer, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("[VirtualMachineImageResource]", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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 Azure region. Required. - :type location: str - :param publisher_name: A valid image publisher. Required. - :type publisher_name: str - :param offer: A valid image publisher offer. Required. - :type offer: str - :param skus: A valid image SKU. Required. - :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 - :return: list of VirtualMachineImageResource or the result of cls(response) - :rtype: list[~azure.mgmt.compute.models.VirtualMachineImageResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[List[_models.VirtualMachineImageResource]] = kwargs.pop("cls", None) - - _request = build_list_request( - location=location, - publisher_name=publisher_name, - offer=offer, - skus=skus, - subscription_id=self._config.subscription_id, - expand=expand, - top=top, - orderby=orderby, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("[VirtualMachineImageResource]", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @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 Azure region. Required. - :type location: str - :param publisher_name: A valid image publisher. Required. - :type publisher_name: str - :param offer: A valid image publisher offer. Required. - :type offer: str - :param skus: A valid image SKU. Required. - :type skus: str - :param version: A valid image SKU version. Required. - :type version: str - :return: VirtualMachineImage or the result of cls(response) - :rtype: ~azure.mgmt.compute.models.VirtualMachineImage - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[_models.VirtualMachineImage] = kwargs.pop("cls", None) - - _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, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("VirtualMachineImage", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def list_with_properties( - self, - location: str, - publisher_name: str, - offer: str, - skus: str, - expand: str, - top: Optional[int] = None, - orderby: Optional[str] = None, - **kwargs: Any - ) -> List[_models.VirtualMachineImage]: - """list_with_properties. - - :param location: The name of Azure region. Required. - :type location: str - :param publisher_name: A valid image publisher. Required. - :type publisher_name: str - :param offer: A valid image publisher offer. Required. - :type offer: str - :param skus: A valid image SKU. Required. - :type skus: str - :param expand: The expand expression to apply on the operation. Required. - :type expand: str - :param top: Default value is None. - :type top: int - :param orderby: Default value is None. - :type orderby: str - :return: list of VirtualMachineImage or the result of cls(response) - :rtype: list[~azure.mgmt.compute.models.VirtualMachineImage] - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[List[_models.VirtualMachineImage]] = kwargs.pop("cls", None) - - _request = build_list_with_properties_request( - location=location, - publisher_name=publisher_name, - offer=offer, - skus=skus, - subscription_id=self._config.subscription_id, - expand=expand, - top=top, - orderby=orderby, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("[VirtualMachineImage]", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/operations/_virtual_machine_run_commands_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/operations/_virtual_machine_run_commands_operations.py deleted file mode 100644 index c71306ac92b5..000000000000 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/operations/_virtual_machine_run_commands_operations.py +++ /dev/null @@ -1,1111 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression,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 collections.abc import MutableMapping -from io import IOBase -from typing import Any, Callable, IO, Iterator, Optional, TypeVar, Union, cast, overload - -from azure.core import PipelineClient -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - StreamClosedError, - StreamConsumedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from .._configuration import ComputeManagementClientConfiguration -from .._utils.serialization import Deserializer, Serializer - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] -List = list - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_request(location: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - accept = _headers.pop("Accept", "application/json, text/json") - - # Construct URL - _url = kwargs.pop( - "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/runCommands" - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "location": _SERIALIZER.url("location", location, "str", min_length=1), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_request(location: str, command_id: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - accept = _headers.pop("Accept", "application/json, text/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/runCommands/{commandId}", - ) - path_format_arguments = { - "location": _SERIALIZER.url("location", location, "str", min_length=1), - "commandId": _SERIALIZER.url("command_id", command_id, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_by_virtual_machine_request( - resource_group_name: str, vm_name: str, subscription_id: str, *, expand: Optional[str] = None, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommands", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if expand is not None: - _params["$expand"] = _SERIALIZER.query("expand", expand, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -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: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommands/{runCommandName}", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), - "runCommandName": _SERIALIZER.url("run_command_name", run_command_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if expand is not None: - _params["$expand"] = _SERIALIZER.query("expand", expand, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, vm_name: str, run_command_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommands/{runCommandName}", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), - "runCommandName": _SERIALIZER.url("run_command_name", run_command_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_request( - resource_group_name: str, vm_name: str, run_command_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommands/{runCommandName}", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), - "runCommandName": _SERIALIZER.url("run_command_name", run_command_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, vm_name: str, run_command_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommands/{runCommandName}", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), - "runCommandName": _SERIALIZER.url("run_command_name", run_command_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -class VirtualMachineRunCommandsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.compute.ComputeManagementClient`'s - :attr:`virtual_machine_run_commands` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list(self, location: str, **kwargs: Any) -> ItemPaged["_models.RunCommandDocumentBase"]: - """Lists all available run commands for a subscription in a location. - - :param location: The name of Azure region. Required. - :type location: str - :return: An iterator like instance of either RunCommandDocumentBase or the result of - cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.models.RunCommandDocumentBase] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[_models.RunCommandListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - location=location, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - _request = HttpRequest("GET", next_link) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @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 name of Azure region. Required. - :type location: str - :param command_id: Specifies a commandId of predefined built-in script. Command IDs available - for Linux are listed at https://aka.ms/RunCommandManagedLinux#available-commands, Windows at - https://aka.ms/RunCommandManagedWindows#available-commands. Required. - :type command_id: str - :return: RunCommandDocument or the result of cls(response) - :rtype: ~azure.mgmt.compute.models.RunCommandDocument - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[_models.RunCommandDocument] = kwargs.pop("cls", None) - - _request = build_get_request( - location=location, - command_id=command_id, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("RunCommandDocument", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def list_by_virtual_machine( - self, resource_group_name: str, vm_name: str, expand: Optional[str] = None, **kwargs: Any - ) -> ItemPaged["_models.VirtualMachineRunCommand"]: - """The operation to get all run commands of a Virtual Machine. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_name: The name of the VirtualMachine. Required. - :type vm_name: str - :param expand: The expand expression to apply on the operation. Default value is None. - :type expand: str - :return: An iterator like instance of either VirtualMachineRunCommand or the result of - cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.models.VirtualMachineRunCommand] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[_models.VirtualMachineRunCommandsListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_by_virtual_machine_request( - resource_group_name=resource_group_name, - vm_name=vm_name, - subscription_id=self._config.subscription_id, - expand=expand, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - _request = HttpRequest("GET", next_link) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @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. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_name: The name of the VirtualMachine. Required. - :type vm_name: str - :param run_command_name: The name of the VirtualMachineRunCommand. Required. - :type run_command_name: str - :param expand: The expand expression to apply on the operation. Default value is None. - :type expand: str - :return: VirtualMachineRunCommand or the result of cls(response) - :rtype: ~azure.mgmt.compute.models.VirtualMachineRunCommand - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[_models.VirtualMachineRunCommand] = kwargs.pop("cls", None) - - _request = build_get_by_virtual_machine_request( - resource_group_name=resource_group_name, - vm_name=vm_name, - run_command_name=run_command_name, - subscription_id=self._config.subscription_id, - expand=expand, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("VirtualMachineRunCommand", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - vm_name: str, - run_command_name: str, - run_command: Union[_models.VirtualMachineRunCommand, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(run_command, (IOBase, bytes)): - _content = run_command - else: - _json = self._serialize.body(run_command, "VirtualMachineRunCommand") - - _request = build_create_or_update_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, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 201: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - vm_name: str, - run_command_name: str, - run_command: _models.VirtualMachineRunCommand, - *, - content_type: 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. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_name: The name of the VirtualMachine. Required. - :type vm_name: str - :param run_command_name: The name of the VirtualMachineRunCommand. Required. - :type run_command_name: str - :param run_command: Parameters supplied to the Create Virtual Machine RunCommand operation. - Required. - :type run_command: ~azure.mgmt.compute.models.VirtualMachineRunCommand - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either VirtualMachineRunCommand or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.VirtualMachineRunCommand] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - vm_name: str, - run_command_name: str, - run_command: IO[bytes], - *, - content_type: 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. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_name: The name of the VirtualMachine. Required. - :type vm_name: str - :param run_command_name: The name of the VirtualMachineRunCommand. Required. - :type run_command_name: str - :param run_command: Parameters supplied to the Create Virtual Machine RunCommand operation. - Required. - :type run_command: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either VirtualMachineRunCommand or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.VirtualMachineRunCommand] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - vm_name: str, - run_command_name: str, - run_command: Union[_models.VirtualMachineRunCommand, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.VirtualMachineRunCommand]: - """The operation to create or update the run command. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_name: The name of the VirtualMachine. Required. - :type vm_name: str - :param run_command_name: The name of the VirtualMachineRunCommand. Required. - :type run_command_name: str - :param run_command: Parameters supplied to the Create Virtual Machine RunCommand operation. Is - either a VirtualMachineRunCommand type or a IO[bytes] type. Required. - :type run_command: ~azure.mgmt.compute.models.VirtualMachineRunCommand or IO[bytes] - :return: An instance of LROPoller that returns either VirtualMachineRunCommand or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.VirtualMachineRunCommand] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.VirtualMachineRunCommand] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._create_or_update_initial( - resource_group_name=resource_group_name, - vm_name=vm_name, - run_command_name=run_command_name, - run_command=run_command, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("VirtualMachineRunCommand", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.VirtualMachineRunCommand].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.VirtualMachineRunCommand]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _update_initial( - self, - resource_group_name: str, - vm_name: str, - run_command_name: str, - run_command: Union[_models.VirtualMachineRunCommandUpdate, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(run_command, (IOBase, bytes)): - _content = run_command - else: - _json = self._serialize.body(run_command, "VirtualMachineRunCommandUpdate") - - _request = build_update_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, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update( - self, - resource_group_name: str, - vm_name: str, - run_command_name: str, - run_command: _models.VirtualMachineRunCommandUpdate, - *, - content_type: 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. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_name: The name of the VirtualMachine. Required. - :type vm_name: str - :param run_command_name: The name of the VirtualMachineRunCommand. Required. - :type run_command_name: str - :param run_command: Parameters supplied to the Update Virtual Machine RunCommand operation. - Required. - :type run_command: ~azure.mgmt.compute.models.VirtualMachineRunCommandUpdate - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either VirtualMachineRunCommand or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.VirtualMachineRunCommand] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update( - self, - resource_group_name: str, - vm_name: str, - run_command_name: str, - run_command: IO[bytes], - *, - content_type: 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. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_name: The name of the VirtualMachine. Required. - :type vm_name: str - :param run_command_name: The name of the VirtualMachineRunCommand. Required. - :type run_command_name: str - :param run_command: Parameters supplied to the Update Virtual Machine RunCommand operation. - Required. - :type run_command: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either VirtualMachineRunCommand or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.VirtualMachineRunCommand] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_update( - self, - resource_group_name: str, - vm_name: str, - run_command_name: str, - run_command: Union[_models.VirtualMachineRunCommandUpdate, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.VirtualMachineRunCommand]: - """The operation to update the run command. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_name: The name of the VirtualMachine. Required. - :type vm_name: str - :param run_command_name: The name of the VirtualMachineRunCommand. Required. - :type run_command_name: str - :param run_command: Parameters supplied to the Update Virtual Machine RunCommand operation. Is - either a VirtualMachineRunCommandUpdate type or a IO[bytes] type. Required. - :type run_command: ~azure.mgmt.compute.models.VirtualMachineRunCommandUpdate or IO[bytes] - :return: An instance of LROPoller that returns either VirtualMachineRunCommand or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.VirtualMachineRunCommand] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.VirtualMachineRunCommand] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._update_initial( - resource_group_name=resource_group_name, - vm_name=vm_name, - run_command_name=run_command_name, - run_command=run_command, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - response_headers = {} - response = pipeline_response.http_response - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = self._deserialize("VirtualMachineRunCommand", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.VirtualMachineRunCommand].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.VirtualMachineRunCommand]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, vm_name: str, run_command_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_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, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_delete( - 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. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_name: The name of the VirtualMachine. Required. - :type vm_name: str - :param run_command_name: The name of the VirtualMachineRunCommand. Required. - :type run_command_name: str - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( - 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, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/operations/_virtual_machine_scale_set_extensions_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/operations/_virtual_machine_scale_set_extensions_operations.py deleted file mode 100644 index e0df57a0f89d..000000000000 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/operations/_virtual_machine_scale_set_extensions_operations.py +++ /dev/null @@ -1,938 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# 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 collections.abc import MutableMapping -from io import IOBase -from typing import Any, Callable, IO, Iterator, Optional, TypeVar, Union, cast, overload - -from azure.core import PipelineClient -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - StreamClosedError, - StreamConsumedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from .._configuration import ComputeManagementClientConfiguration -from .._utils.serialization import Deserializer, Serializer - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] -List = list - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_request( - resource_group_name: str, vm_scale_set_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_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: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), - "vmssExtensionName": _SERIALIZER.url("vmss_extension_name", vmss_extension_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if expand is not None: - _params["$expand"] = _SERIALIZER.query("expand", expand, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, vm_scale_set_name: str, vmss_extension_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), - "vmssExtensionName": _SERIALIZER.url("vmss_extension_name", vmss_extension_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_request( - resource_group_name: str, vm_scale_set_name: str, vmss_extension_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), - "vmssExtensionName": _SERIALIZER.url("vmss_extension_name", vmss_extension_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, vm_scale_set_name: str, vmss_extension_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), - "vmssExtensionName": _SERIALIZER.url("vmss_extension_name", vmss_extension_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -class VirtualMachineScaleSetExtensionsOperations: # pylint: disable=name-too-long - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.compute.ComputeManagementClient`'s - :attr:`virtual_machine_scale_set_extensions` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list( - self, resource_group_name: str, vm_scale_set_name: str, **kwargs: Any - ) -> ItemPaged["_models.VirtualMachineScaleSetExtension"]: - """Gets a list of all extensions in a VM scale set. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :return: An iterator like instance of either VirtualMachineScaleSetExtension or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.compute.models.VirtualMachineScaleSetExtension] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[_models.VirtualMachineScaleSetExtensionListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - _request = HttpRequest("GET", next_link) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @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. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param vmss_extension_name: The name of the VM scale set extension. Required. - :type vmss_extension_name: str - :param expand: The expand expression to apply on the operation. Default value is None. - :type expand: str - :return: VirtualMachineScaleSetExtension or the result of cls(response) - :rtype: ~azure.mgmt.compute.models.VirtualMachineScaleSetExtension - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[_models.VirtualMachineScaleSetExtension] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, - vmss_extension_name=vmss_extension_name, - subscription_id=self._config.subscription_id, - expand=expand, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("VirtualMachineScaleSetExtension", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - vm_scale_set_name: str, - vmss_extension_name: str, - extension_parameters: Union[_models.VirtualMachineScaleSetExtension, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(extension_parameters, (IOBase, bytes)): - _content = extension_parameters - else: - _json = self._serialize.body(extension_parameters, "VirtualMachineScaleSetExtension") - - _request = build_create_or_update_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, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 201: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - vm_scale_set_name: str, - vmss_extension_name: str, - extension_parameters: _models.VirtualMachineScaleSetExtension, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.VirtualMachineScaleSetExtension]: - """The operation to create or update an extension. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param vmss_extension_name: The name of the VM scale set extension. Required. - :type vmss_extension_name: str - :param extension_parameters: Parameters supplied to the Create VM scale set Extension - operation. Required. - :type extension_parameters: ~azure.mgmt.compute.models.VirtualMachineScaleSetExtension - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either VirtualMachineScaleSetExtension or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.VirtualMachineScaleSetExtension] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - vm_scale_set_name: str, - vmss_extension_name: str, - extension_parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.VirtualMachineScaleSetExtension]: - """The operation to create or update an extension. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param vmss_extension_name: The name of the VM scale set extension. Required. - :type vmss_extension_name: str - :param extension_parameters: Parameters supplied to the Create VM scale set Extension - operation. Required. - :type extension_parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either VirtualMachineScaleSetExtension or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.VirtualMachineScaleSetExtension] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - vm_scale_set_name: str, - vmss_extension_name: str, - extension_parameters: Union[_models.VirtualMachineScaleSetExtension, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.VirtualMachineScaleSetExtension]: - """The operation to create or update an extension. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param vmss_extension_name: The name of the VM scale set extension. Required. - :type vmss_extension_name: str - :param extension_parameters: Parameters supplied to the Create VM scale set Extension - operation. Is either a VirtualMachineScaleSetExtension type or a IO[bytes] type. Required. - :type extension_parameters: ~azure.mgmt.compute.models.VirtualMachineScaleSetExtension or - IO[bytes] - :return: An instance of LROPoller that returns either VirtualMachineScaleSetExtension or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.VirtualMachineScaleSetExtension] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.VirtualMachineScaleSetExtension] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._create_or_update_initial( - resource_group_name=resource_group_name, - 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, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("VirtualMachineScaleSetExtension", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.VirtualMachineScaleSetExtension].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.VirtualMachineScaleSetExtension]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _update_initial( - self, - resource_group_name: str, - vm_scale_set_name: str, - vmss_extension_name: str, - extension_parameters: Union[_models.VirtualMachineScaleSetExtensionUpdate, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(extension_parameters, (IOBase, bytes)): - _content = extension_parameters - else: - _json = self._serialize.body(extension_parameters, "VirtualMachineScaleSetExtensionUpdate") - - _request = build_update_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, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 201: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update( - self, - resource_group_name: str, - vm_scale_set_name: str, - vmss_extension_name: str, - extension_parameters: _models.VirtualMachineScaleSetExtensionUpdate, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.VirtualMachineScaleSetExtension]: - """The operation to update an extension. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param vmss_extension_name: The name of the VM scale set extension. Required. - :type vmss_extension_name: str - :param extension_parameters: Parameters supplied to the Update VM scale set Extension - operation. Required. - :type extension_parameters: ~azure.mgmt.compute.models.VirtualMachineScaleSetExtensionUpdate - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either VirtualMachineScaleSetExtension or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.VirtualMachineScaleSetExtension] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update( - self, - resource_group_name: str, - vm_scale_set_name: str, - vmss_extension_name: str, - extension_parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.VirtualMachineScaleSetExtension]: - """The operation to update an extension. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param vmss_extension_name: The name of the VM scale set extension. Required. - :type vmss_extension_name: str - :param extension_parameters: Parameters supplied to the Update VM scale set Extension - operation. Required. - :type extension_parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either VirtualMachineScaleSetExtension or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.VirtualMachineScaleSetExtension] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_update( - self, - resource_group_name: str, - vm_scale_set_name: str, - vmss_extension_name: str, - extension_parameters: Union[_models.VirtualMachineScaleSetExtensionUpdate, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.VirtualMachineScaleSetExtension]: - """The operation to update an extension. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param vmss_extension_name: The name of the VM scale set extension. Required. - :type vmss_extension_name: str - :param extension_parameters: Parameters supplied to the Update VM scale set Extension - operation. Is either a VirtualMachineScaleSetExtensionUpdate type or a IO[bytes] type. - Required. - :type extension_parameters: ~azure.mgmt.compute.models.VirtualMachineScaleSetExtensionUpdate or - IO[bytes] - :return: An instance of LROPoller that returns either VirtualMachineScaleSetExtension or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.VirtualMachineScaleSetExtension] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.VirtualMachineScaleSetExtension] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._update_initial( - resource_group_name=resource_group_name, - 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, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("VirtualMachineScaleSetExtension", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.VirtualMachineScaleSetExtension].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.VirtualMachineScaleSetExtension]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, vm_scale_set_name: str, vmss_extension_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_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, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_delete( - 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. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param vmss_extension_name: The name of the VM scale set extension. Required. - :type vmss_extension_name: str - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( - 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, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/operations/_virtual_machine_scale_set_rolling_upgrades_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/operations/_virtual_machine_scale_set_rolling_upgrades_operations.py deleted file mode 100644 index 24a9984e9114..000000000000 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/operations/_virtual_machine_scale_set_rolling_upgrades_operations.py +++ /dev/null @@ -1,585 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# 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 collections.abc import MutableMapping -from typing import Any, Callable, Iterator, Optional, TypeVar, Union, cast - -from azure.core import PipelineClient -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - StreamClosedError, - StreamConsumedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from .._configuration import ComputeManagementClientConfiguration -from .._utils.serialization import Deserializer, Serializer - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] -List = list - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_start_extension_upgrade_request( - resource_group_name: str, vm_scale_set_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensionRollingUpgrade", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_start_os_upgrade_request( - resource_group_name: str, vm_scale_set_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/osRollingUpgrade", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_cancel_request( - resource_group_name: str, vm_scale_set_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/rollingUpgrades/cancel", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_latest_request( - resource_group_name: str, vm_scale_set_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/rollingUpgrades/latest", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class VirtualMachineScaleSetRollingUpgradesOperations: # pylint: disable=name-too-long - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.compute.ComputeManagementClient`'s - :attr:`virtual_machine_scale_set_rolling_upgrades` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - def _start_extension_upgrade_initial( - self, resource_group_name: str, vm_scale_set_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_start_extension_upgrade_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, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_start_extension_upgrade( - 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. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._start_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, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _start_os_upgrade_initial( - self, resource_group_name: str, vm_scale_set_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_start_os_upgrade_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, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_start_os_upgrade( - 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. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._start_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, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _cancel_initial(self, resource_group_name: str, vm_scale_set_name: str, **kwargs: Any) -> Iterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_cancel_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, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_cancel(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. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._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, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # 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. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :return: RollingUpgradeStatusInfo or the result of cls(response) - :rtype: ~azure.mgmt.compute.models.RollingUpgradeStatusInfo - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[_models.RollingUpgradeStatusInfo] = kwargs.pop("cls", None) - - _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, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("RollingUpgradeStatusInfo", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/operations/_virtual_machine_scale_set_vm_extensions_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/operations/_virtual_machine_scale_set_vm_extensions_operations.py deleted file mode 100644 index 82cd8f30057c..000000000000 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/operations/_virtual_machine_scale_set_vm_extensions_operations.py +++ /dev/null @@ -1,998 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# 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 collections.abc import MutableMapping -from io import IOBase -from typing import Any, Callable, IO, Iterator, Optional, TypeVar, Union, cast, overload - -from azure.core import PipelineClient -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - StreamClosedError, - StreamConsumedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from .._configuration import ComputeManagementClientConfiguration -from .._utils.serialization import Deserializer, Serializer - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] -List = list - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -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: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/extensions", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), - "instanceId": _SERIALIZER.url("instance_id", instance_id, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if expand is not None: - _params["$expand"] = _SERIALIZER.query("expand", expand, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -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: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/extensions/{vmExtensionName}", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "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"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if expand is not None: - _params["$expand"] = _SERIALIZER.query("expand", expand, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, - vm_scale_set_name: str, - instance_id: str, - vm_extension_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/extensions/{vmExtensionName}", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "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"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_request( - resource_group_name: str, - vm_scale_set_name: str, - instance_id: str, - vm_extension_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/extensions/{vmExtensionName}", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "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"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, - vm_scale_set_name: str, - instance_id: str, - vm_extension_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/extensions/{vmExtensionName}", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "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"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -class VirtualMachineScaleSetVMExtensionsOperations: # pylint: disable=name-too-long - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.compute.ComputeManagementClient`'s - :attr:`virtual_machine_scale_set_vm_extensions` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @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. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param instance_id: The instance ID of the virtual machine. Required. - :type instance_id: str - :param expand: The expand expression to apply on the operation. Default value is None. - :type expand: str - :return: VirtualMachineScaleSetVMExtensionsListResult or the result of cls(response) - :rtype: ~azure.mgmt.compute.models.VirtualMachineScaleSetVMExtensionsListResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[_models.VirtualMachineScaleSetVMExtensionsListResult] = kwargs.pop("cls", None) - - _request = build_list_request( - resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, - instance_id=instance_id, - subscription_id=self._config.subscription_id, - expand=expand, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize( - "VirtualMachineScaleSetVMExtensionsListResult", pipeline_response.http_response - ) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param instance_id: The instance ID of the virtual machine. Required. - :type instance_id: str - :param vm_extension_name: The name of the virtual machine extension. Required. - :type vm_extension_name: str - :param expand: The expand expression to apply on the operation. Default value is None. - :type expand: str - :return: VirtualMachineScaleSetVMExtension or the result of cls(response) - :rtype: ~azure.mgmt.compute.models.VirtualMachineScaleSetVMExtension - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[_models.VirtualMachineScaleSetVMExtension] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, - instance_id=instance_id, - vm_extension_name=vm_extension_name, - subscription_id=self._config.subscription_id, - expand=expand, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("VirtualMachineScaleSetVMExtension", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - vm_scale_set_name: str, - instance_id: str, - vm_extension_name: str, - extension_parameters: Union[_models.VirtualMachineScaleSetVMExtension, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(extension_parameters, (IOBase, bytes)): - _content = extension_parameters - else: - _json = self._serialize.body(extension_parameters, "VirtualMachineScaleSetVMExtension") - - _request = build_create_or_update_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, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 201: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - 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, - *, - content_type: str = "application/json", - **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. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param instance_id: The instance ID of the virtual machine. Required. - :type instance_id: str - :param vm_extension_name: The name of the virtual machine extension. Required. - :type vm_extension_name: str - :param extension_parameters: Parameters supplied to the Create Virtual Machine Extension - operation. Required. - :type extension_parameters: ~azure.mgmt.compute.models.VirtualMachineScaleSetVMExtension - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either VirtualMachineScaleSetVMExtension or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.VirtualMachineScaleSetVMExtension] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - vm_scale_set_name: str, - instance_id: str, - vm_extension_name: str, - extension_parameters: IO[bytes], - *, - content_type: str = "application/json", - **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. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param instance_id: The instance ID of the virtual machine. Required. - :type instance_id: str - :param vm_extension_name: The name of the virtual machine extension. Required. - :type vm_extension_name: str - :param extension_parameters: Parameters supplied to the Create Virtual Machine Extension - operation. Required. - :type extension_parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either VirtualMachineScaleSetVMExtension or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.VirtualMachineScaleSetVMExtension] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @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: Union[_models.VirtualMachineScaleSetVMExtension, IO[bytes]], - **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. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param instance_id: The instance ID of the virtual machine. Required. - :type instance_id: str - :param vm_extension_name: The name of the virtual machine extension. Required. - :type vm_extension_name: str - :param extension_parameters: Parameters supplied to the Create Virtual Machine Extension - operation. Is either a VirtualMachineScaleSetVMExtension type or a IO[bytes] type. Required. - :type extension_parameters: ~azure.mgmt.compute.models.VirtualMachineScaleSetVMExtension or - IO[bytes] - :return: An instance of LROPoller that returns either VirtualMachineScaleSetVMExtension or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.VirtualMachineScaleSetVMExtension] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.VirtualMachineScaleSetVMExtension] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._create_or_update_initial( - resource_group_name=resource_group_name, - 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, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("VirtualMachineScaleSetVMExtension", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.VirtualMachineScaleSetVMExtension].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.VirtualMachineScaleSetVMExtension]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _update_initial( - self, - resource_group_name: str, - vm_scale_set_name: str, - instance_id: str, - vm_extension_name: str, - extension_parameters: Union[_models.VirtualMachineScaleSetVMExtensionUpdate, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(extension_parameters, (IOBase, bytes)): - _content = extension_parameters - else: - _json = self._serialize.body(extension_parameters, "VirtualMachineScaleSetVMExtensionUpdate") - - _request = build_update_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, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update( - self, - resource_group_name: str, - vm_scale_set_name: str, - instance_id: str, - vm_extension_name: str, - extension_parameters: _models.VirtualMachineScaleSetVMExtensionUpdate, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.VirtualMachineScaleSetVMExtension]: - """The operation to update the VMSS VM extension. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param instance_id: The instance ID of the virtual machine. Required. - :type instance_id: str - :param vm_extension_name: The name of the virtual machine extension. Required. - :type vm_extension_name: str - :param extension_parameters: Parameters supplied to the Update Virtual Machine Extension - operation. Required. - :type extension_parameters: ~azure.mgmt.compute.models.VirtualMachineScaleSetVMExtensionUpdate - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either VirtualMachineScaleSetVMExtension or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.VirtualMachineScaleSetVMExtension] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update( - self, - resource_group_name: str, - vm_scale_set_name: str, - instance_id: str, - vm_extension_name: str, - extension_parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.VirtualMachineScaleSetVMExtension]: - """The operation to update the VMSS VM extension. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param instance_id: The instance ID of the virtual machine. Required. - :type instance_id: str - :param vm_extension_name: The name of the virtual machine extension. Required. - :type vm_extension_name: str - :param extension_parameters: Parameters supplied to the Update Virtual Machine Extension - operation. Required. - :type extension_parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either VirtualMachineScaleSetVMExtension or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.VirtualMachineScaleSetVMExtension] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_update( - self, - resource_group_name: str, - vm_scale_set_name: str, - instance_id: str, - vm_extension_name: str, - extension_parameters: Union[_models.VirtualMachineScaleSetVMExtensionUpdate, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.VirtualMachineScaleSetVMExtension]: - """The operation to update the VMSS VM extension. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param instance_id: The instance ID of the virtual machine. Required. - :type instance_id: str - :param vm_extension_name: The name of the virtual machine extension. Required. - :type vm_extension_name: str - :param extension_parameters: Parameters supplied to the Update Virtual Machine Extension - operation. Is either a VirtualMachineScaleSetVMExtensionUpdate type or a IO[bytes] type. - Required. - :type extension_parameters: ~azure.mgmt.compute.models.VirtualMachineScaleSetVMExtensionUpdate - or IO[bytes] - :return: An instance of LROPoller that returns either VirtualMachineScaleSetVMExtension or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.VirtualMachineScaleSetVMExtension] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.VirtualMachineScaleSetVMExtension] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._update_initial( - resource_group_name=resource_group_name, - 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, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - response_headers = {} - response = pipeline_response.http_response - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = self._deserialize("VirtualMachineScaleSetVMExtension", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.VirtualMachineScaleSetVMExtension].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.VirtualMachineScaleSetVMExtension]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, vm_scale_set_name: str, instance_id: str, vm_extension_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_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, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_delete( - 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. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param instance_id: The instance ID of the virtual machine. Required. - :type instance_id: str - :param vm_extension_name: The name of the virtual machine extension. Required. - :type vm_extension_name: str - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( - 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, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/operations/_virtual_machine_scale_set_vm_run_commands_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/operations/_virtual_machine_scale_set_vm_run_commands_operations.py deleted file mode 100644 index 7db24a6425d4..000000000000 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/operations/_virtual_machine_scale_set_vm_run_commands_operations.py +++ /dev/null @@ -1,1002 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression,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 collections.abc import MutableMapping -from io import IOBase -from typing import Any, Callable, IO, Iterator, Optional, TypeVar, Union, cast, overload - -from azure.core import PipelineClient -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - StreamClosedError, - StreamConsumedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from .._configuration import ComputeManagementClientConfiguration -from .._utils.serialization import Deserializer, Serializer - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] -List = list - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -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: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/runCommands", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), - "instanceId": _SERIALIZER.url("instance_id", instance_id, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if expand is not None: - _params["$expand"] = _SERIALIZER.query("expand", expand, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -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: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/runCommands/{runCommandName}", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "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"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if expand is not None: - _params["$expand"] = _SERIALIZER.query("expand", expand, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, - vm_scale_set_name: str, - instance_id: str, - run_command_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/runCommands/{runCommandName}", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "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"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_request( - resource_group_name: str, - vm_scale_set_name: str, - instance_id: str, - run_command_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/runCommands/{runCommandName}", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "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"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, - vm_scale_set_name: str, - instance_id: str, - run_command_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/runCommands/{runCommandName}", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "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"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -class VirtualMachineScaleSetVMRunCommandsOperations: # pylint: disable=name-too-long - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.compute.ComputeManagementClient`'s - :attr:`virtual_machine_scale_set_vm_run_commands` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list( - self, - resource_group_name: str, - vm_scale_set_name: str, - instance_id: str, - expand: Optional[str] = None, - **kwargs: Any - ) -> ItemPaged["_models.VirtualMachineRunCommand"]: - """The operation to get all run commands of an instance in Virtual Machine Scaleset. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VirtualMachineScaleSet. Required. - :type vm_scale_set_name: str - :param instance_id: The name of the VirtualMachineScaleSetVM. Required. - :type instance_id: str - :param expand: The expand expression to apply on the operation. Default value is None. - :type expand: str - :return: An iterator like instance of either VirtualMachineRunCommand or the result of - cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.models.VirtualMachineRunCommand] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[_models.VirtualMachineRunCommandsListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, - instance_id=instance_id, - subscription_id=self._config.subscription_id, - expand=expand, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - _request = HttpRequest("GET", next_link) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @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. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VirtualMachineScaleSet. Required. - :type vm_scale_set_name: str - :param instance_id: The name of the VirtualMachineScaleSetVM. Required. - :type instance_id: str - :param run_command_name: The name of the VirtualMachineRunCommand. Required. - :type run_command_name: str - :param expand: The expand expression to apply on the operation. Default value is None. - :type expand: str - :return: VirtualMachineRunCommand or the result of cls(response) - :rtype: ~azure.mgmt.compute.models.VirtualMachineRunCommand - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[_models.VirtualMachineRunCommand] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, - instance_id=instance_id, - run_command_name=run_command_name, - subscription_id=self._config.subscription_id, - expand=expand, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("VirtualMachineRunCommand", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - vm_scale_set_name: str, - instance_id: str, - run_command_name: str, - run_command: Union[_models.VirtualMachineRunCommand, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(run_command, (IOBase, bytes)): - _content = run_command - else: - _json = self._serialize.body(run_command, "VirtualMachineRunCommand") - - _request = build_create_or_update_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, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 201: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - 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: 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. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VirtualMachineScaleSet. Required. - :type vm_scale_set_name: str - :param instance_id: The name of the VirtualMachineScaleSetVM. Required. - :type instance_id: str - :param run_command_name: The name of the VirtualMachineRunCommand. Required. - :type run_command_name: str - :param run_command: Parameters supplied to the Create Virtual Machine RunCommand operation. - Required. - :type run_command: ~azure.mgmt.compute.models.VirtualMachineRunCommand - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either VirtualMachineRunCommand or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.VirtualMachineRunCommand] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - vm_scale_set_name: str, - instance_id: str, - run_command_name: str, - run_command: IO[bytes], - *, - content_type: 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. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VirtualMachineScaleSet. Required. - :type vm_scale_set_name: str - :param instance_id: The name of the VirtualMachineScaleSetVM. Required. - :type instance_id: str - :param run_command_name: The name of the VirtualMachineRunCommand. Required. - :type run_command_name: str - :param run_command: Parameters supplied to the Create Virtual Machine RunCommand operation. - Required. - :type run_command: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either VirtualMachineRunCommand or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.VirtualMachineRunCommand] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @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: Union[_models.VirtualMachineRunCommand, IO[bytes]], - **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. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VirtualMachineScaleSet. Required. - :type vm_scale_set_name: str - :param instance_id: The name of the VirtualMachineScaleSetVM. Required. - :type instance_id: str - :param run_command_name: The name of the VirtualMachineRunCommand. Required. - :type run_command_name: str - :param run_command: Parameters supplied to the Create Virtual Machine RunCommand operation. Is - either a VirtualMachineRunCommand type or a IO[bytes] type. Required. - :type run_command: ~azure.mgmt.compute.models.VirtualMachineRunCommand or IO[bytes] - :return: An instance of LROPoller that returns either VirtualMachineRunCommand or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.VirtualMachineRunCommand] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.VirtualMachineRunCommand] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._create_or_update_initial( - resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, - instance_id=instance_id, - run_command_name=run_command_name, - run_command=run_command, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("VirtualMachineRunCommand", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.VirtualMachineRunCommand].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.VirtualMachineRunCommand]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _update_initial( - self, - resource_group_name: str, - vm_scale_set_name: str, - instance_id: str, - run_command_name: str, - run_command: Union[_models.VirtualMachineRunCommandUpdate, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(run_command, (IOBase, bytes)): - _content = run_command - else: - _json = self._serialize.body(run_command, "VirtualMachineRunCommandUpdate") - - _request = build_update_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, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - 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: 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. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VirtualMachineScaleSet. Required. - :type vm_scale_set_name: str - :param instance_id: The name of the VirtualMachineScaleSetVM. Required. - :type instance_id: str - :param run_command_name: The name of the VirtualMachineRunCommand. Required. - :type run_command_name: str - :param run_command: Resource create parameters. Required. - :type run_command: ~azure.mgmt.compute.models.VirtualMachineRunCommandUpdate - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either VirtualMachineRunCommand or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.VirtualMachineRunCommand] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update( - self, - resource_group_name: str, - vm_scale_set_name: str, - instance_id: str, - run_command_name: str, - run_command: IO[bytes], - *, - content_type: 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. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VirtualMachineScaleSet. Required. - :type vm_scale_set_name: str - :param instance_id: The name of the VirtualMachineScaleSetVM. Required. - :type instance_id: str - :param run_command_name: The name of the VirtualMachineRunCommand. Required. - :type run_command_name: str - :param run_command: Resource create parameters. Required. - :type run_command: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either VirtualMachineRunCommand or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.VirtualMachineRunCommand] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_update( - self, - resource_group_name: str, - vm_scale_set_name: str, - instance_id: str, - run_command_name: str, - run_command: Union[_models.VirtualMachineRunCommandUpdate, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.VirtualMachineRunCommand]: - """The operation to update the VMSS VM run command. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VirtualMachineScaleSet. Required. - :type vm_scale_set_name: str - :param instance_id: The name of the VirtualMachineScaleSetVM. Required. - :type instance_id: str - :param run_command_name: The name of the VirtualMachineRunCommand. Required. - :type run_command_name: str - :param run_command: Resource create parameters. Is either a VirtualMachineRunCommandUpdate type - or a IO[bytes] type. Required. - :type run_command: ~azure.mgmt.compute.models.VirtualMachineRunCommandUpdate or IO[bytes] - :return: An instance of LROPoller that returns either VirtualMachineRunCommand or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.VirtualMachineRunCommand] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.VirtualMachineRunCommand] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._update_initial( - resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, - instance_id=instance_id, - run_command_name=run_command_name, - run_command=run_command, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - response_headers = {} - response = pipeline_response.http_response - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = self._deserialize("VirtualMachineRunCommand", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.VirtualMachineRunCommand].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.VirtualMachineRunCommand]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, vm_scale_set_name: str, instance_id: str, run_command_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_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, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_delete( - 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. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VirtualMachineScaleSet. Required. - :type vm_scale_set_name: str - :param instance_id: The name of the VirtualMachineScaleSetVM. Required. - :type instance_id: str - :param run_command_name: The name of the VirtualMachineRunCommand. Required. - :type run_command_name: str - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( - 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, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/operations/_virtual_machine_scale_set_vms_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/operations/_virtual_machine_scale_set_vms_operations.py deleted file mode 100644 index 93f4f3a70fca..000000000000 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/operations/_virtual_machine_scale_set_vms_operations.py +++ /dev/null @@ -1,3067 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression,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 collections.abc import MutableMapping -from io import IOBase -from typing import Any, Callable, IO, Iterator, Optional, TypeVar, Union, cast, overload - -from azure.core import PipelineClient -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - StreamClosedError, - StreamConsumedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from .._configuration import ComputeManagementClientConfiguration -from .._utils.serialization import Deserializer, Serializer - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] -List = list - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -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: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{virtualMachineScaleSetName}/virtualMachines", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "virtualMachineScaleSetName": _SERIALIZER.url( - "virtual_machine_scale_set_name", virtual_machine_scale_set_name, "str" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if filter is not None: - _params["$filter"] = _SERIALIZER.query("filter", filter, "str") - if select is not None: - _params["$select"] = _SERIALIZER.query("select", select, "str") - if expand is not None: - _params["$expand"] = _SERIALIZER.query("expand", expand, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -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: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), - "instanceId": _SERIALIZER.url("instance_id", instance_id, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if expand is not None: - _params["$expand"] = _SERIALIZER.query("expand", expand, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_request( - resource_group_name: str, - vm_scale_set_name: str, - instance_id: str, - subscription_id: str, - *, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), - "instanceId": _SERIALIZER.url("instance_id", instance_id, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if if_match is not None: - _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") - if if_none_match is not None: - _headers["If-None-Match"] = _SERIALIZER.header("if_none_match", if_none_match, "str") - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, - vm_scale_set_name: str, - instance_id: str, - subscription_id: str, - *, - force_deletion: Optional[bool] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), - "instanceId": _SERIALIZER.url("instance_id", instance_id, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if force_deletion is not None: - _params["forceDeletion"] = _SERIALIZER.query("force_deletion", force_deletion, "bool") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_approve_rolling_upgrade_request( - resource_group_name: str, vm_scale_set_name: str, instance_id: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/approveRollingUpgrade", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), - "instanceId": _SERIALIZER.url("instance_id", instance_id, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_attach_detach_data_disks_request( - resource_group_name: str, vm_scale_set_name: str, instance_id: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/attachDetachDataDisks", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), - "instanceId": _SERIALIZER.url("instance_id", instance_id, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_deallocate_request( - resource_group_name: str, vm_scale_set_name: str, instance_id: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/deallocate", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), - "instanceId": _SERIALIZER.url("instance_id", instance_id, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_instance_view_request( - resource_group_name: str, vm_scale_set_name: str, instance_id: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/instanceView", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), - "instanceId": _SERIALIZER.url("instance_id", instance_id, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_perform_maintenance_request( - resource_group_name: str, vm_scale_set_name: str, instance_id: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/performMaintenance", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), - "instanceId": _SERIALIZER.url("instance_id", instance_id, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_power_off_request( - resource_group_name: str, - vm_scale_set_name: str, - instance_id: str, - subscription_id: str, - *, - skip_shutdown: Optional[bool] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/powerOff", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), - "instanceId": _SERIALIZER.url("instance_id", instance_id, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if skip_shutdown is not None: - _params["skipShutdown"] = _SERIALIZER.query("skip_shutdown", skip_shutdown, "bool") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_redeploy_request( - resource_group_name: str, vm_scale_set_name: str, instance_id: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/redeploy", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), - "instanceId": _SERIALIZER.url("instance_id", instance_id, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_reimage_request( - resource_group_name: str, vm_scale_set_name: str, instance_id: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/reimage", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), - "instanceId": _SERIALIZER.url("instance_id", instance_id, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_reimage_all_request( - resource_group_name: str, vm_scale_set_name: str, instance_id: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/reimageall", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), - "instanceId": _SERIALIZER.url("instance_id", instance_id, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_restart_request( - resource_group_name: str, vm_scale_set_name: str, instance_id: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/restart", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), - "instanceId": _SERIALIZER.url("instance_id", instance_id, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_retrieve_boot_diagnostics_data_request( # pylint: disable=name-too-long - 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: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/retrieveBootDiagnosticsData", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), - "instanceId": _SERIALIZER.url("instance_id", instance_id, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if sas_uri_expiration_time_in_minutes is not None: - _params["sasUriExpirationTimeInMinutes"] = _SERIALIZER.query( - "sas_uri_expiration_time_in_minutes", sas_uri_expiration_time_in_minutes, "int" - ) - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_run_command_request( - resource_group_name: str, vm_scale_set_name: str, instance_id: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/runCommand", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), - "instanceId": _SERIALIZER.url("instance_id", instance_id, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_simulate_eviction_request( - resource_group_name: str, vm_scale_set_name: str, instance_id: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/simulateEviction", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), - "instanceId": _SERIALIZER.url("instance_id", instance_id, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_start_request( - resource_group_name: str, vm_scale_set_name: str, instance_id: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/start", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), - "instanceId": _SERIALIZER.url("instance_id", instance_id, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class VirtualMachineScaleSetVMsOperations: # pylint: disable=too-many-public-methods - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.compute.ComputeManagementClient`'s - :attr:`virtual_machine_scale_set_vms` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @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 - ) -> ItemPaged["_models.VirtualMachineScaleSetVM"]: - """Gets a list of all virtual machines in a VM scale sets. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param virtual_machine_scale_set_name: The name of the VirtualMachineScaleSet. Required. - :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 - :return: An iterator like instance of either VirtualMachineScaleSetVM or the result of - cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.models.VirtualMachineScaleSetVM] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[_models.VirtualMachineScaleSetVMListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - virtual_machine_scale_set_name=virtual_machine_scale_set_name, - subscription_id=self._config.subscription_id, - filter=filter, - select=select, - expand=expand, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - _request = HttpRequest("GET", next_link) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @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. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param instance_id: The instance ID of the virtual machine. Required. - :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. Known values are: "instanceView", "userData", and "resiliencyView". Default value is - None. - :type expand: str or ~azure.mgmt.compute.models.InstanceViewTypes - :return: VirtualMachineScaleSetVM or the result of cls(response) - :rtype: ~azure.mgmt.compute.models.VirtualMachineScaleSetVM - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[_models.VirtualMachineScaleSetVM] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, - instance_id=instance_id, - subscription_id=self._config.subscription_id, - expand=expand, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("VirtualMachineScaleSetVM", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _update_initial( - self, - resource_group_name: str, - vm_scale_set_name: str, - instance_id: str, - parameters: Union[_models.VirtualMachineScaleSetVM, IO[bytes]], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "VirtualMachineScaleSetVM") - - _request = build_update_request( - resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, - instance_id=instance_id, - subscription_id=self._config.subscription_id, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update( - self, - resource_group_name: str, - vm_scale_set_name: str, - instance_id: str, - parameters: _models.VirtualMachineScaleSetVM, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.VirtualMachineScaleSetVM]: - """Updates a virtual machine of a VM scale set. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param instance_id: The instance ID of the virtual machine. Required. - :type instance_id: str - :param parameters: Parameters supplied to the Update Virtual Machine Scale Sets VM operation. - Required. - :type parameters: ~azure.mgmt.compute.models.VirtualMachineScaleSetVM - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing record set. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either VirtualMachineScaleSetVM or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.VirtualMachineScaleSetVM] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update( - self, - resource_group_name: str, - vm_scale_set_name: str, - instance_id: str, - parameters: IO[bytes], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.VirtualMachineScaleSetVM]: - """Updates a virtual machine of a VM scale set. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param instance_id: The instance ID of the virtual machine. Required. - :type instance_id: str - :param parameters: Parameters supplied to the Update Virtual Machine Scale Sets VM operation. - Required. - :type parameters: IO[bytes] - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing record set. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either VirtualMachineScaleSetVM or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.VirtualMachineScaleSetVM] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_update( - self, - resource_group_name: str, - vm_scale_set_name: str, - instance_id: str, - parameters: Union[_models.VirtualMachineScaleSetVM, IO[bytes]], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any - ) -> LROPoller[_models.VirtualMachineScaleSetVM]: - """Updates a virtual machine of a VM scale set. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param instance_id: The instance ID of the virtual machine. Required. - :type instance_id: str - :param parameters: Parameters supplied to the Update Virtual Machine Scale Sets VM operation. - Is either a VirtualMachineScaleSetVM type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.compute.models.VirtualMachineScaleSetVM or IO[bytes] - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing record set. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :return: An instance of LROPoller that returns either VirtualMachineScaleSetVM or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.VirtualMachineScaleSetVM] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.VirtualMachineScaleSetVM] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._update_initial( - resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, - instance_id=instance_id, - parameters=parameters, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("VirtualMachineScaleSetVM", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.VirtualMachineScaleSetVM].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.VirtualMachineScaleSetVM]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, - resource_group_name: str, - vm_scale_set_name: str, - instance_id: str, - force_deletion: Optional[bool] = None, - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, - instance_id=instance_id, - subscription_id=self._config.subscription_id, - force_deletion=force_deletion, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_delete( - 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. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param instance_id: The instance ID of the virtual machine. Required. - :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 - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( - 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, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _approve_rolling_upgrade_initial( - self, resource_group_name: str, vm_scale_set_name: str, instance_id: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_approve_rolling_upgrade_request( - resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, - instance_id=instance_id, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [202]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_approve_rolling_upgrade( - self, resource_group_name: str, vm_scale_set_name: str, instance_id: str, **kwargs: Any - ) -> LROPoller[None]: - """Approve upgrade on deferred rolling upgrade for OS disk on a VM scale set instance. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param instance_id: The instance ID of the virtual machine. Required. - :type instance_id: str - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._approve_rolling_upgrade_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, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _attach_detach_data_disks_initial( - self, - resource_group_name: str, - vm_scale_set_name: str, - instance_id: str, - parameters: Union[_models.AttachDetachDataDisksRequest, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "AttachDetachDataDisksRequest") - - _request = build_attach_detach_data_disks_request( - resource_group_name=resource_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, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_attach_detach_data_disks( - self, - resource_group_name: str, - vm_scale_set_name: str, - instance_id: str, - parameters: _models.AttachDetachDataDisksRequest, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.StorageProfile]: - """Attach and detach data disks to/from a virtual machine in a VM scale set. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param instance_id: The instance ID of the virtual machine. Required. - :type instance_id: str - :param parameters: Parameters supplied to the attach and detach data disks operation on a - Virtual Machine Scale Sets VM. Required. - :type parameters: ~azure.mgmt.compute.models.AttachDetachDataDisksRequest - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either StorageProfile or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.StorageProfile] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_attach_detach_data_disks( - self, - resource_group_name: str, - vm_scale_set_name: str, - instance_id: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.StorageProfile]: - """Attach and detach data disks to/from a virtual machine in a VM scale set. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param instance_id: The instance ID of the virtual machine. Required. - :type instance_id: str - :param parameters: Parameters supplied to the attach and detach data disks operation on a - Virtual Machine Scale Sets VM. Required. - :type parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either StorageProfile or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.StorageProfile] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_attach_detach_data_disks( - self, - resource_group_name: str, - vm_scale_set_name: str, - instance_id: str, - parameters: Union[_models.AttachDetachDataDisksRequest, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.StorageProfile]: - """Attach and detach data disks to/from a virtual machine in a VM scale set. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param instance_id: The instance ID of the virtual machine. Required. - :type instance_id: str - :param parameters: Parameters supplied to the attach and detach data disks operation on a - Virtual Machine Scale Sets VM. Is either a AttachDetachDataDisksRequest type or a IO[bytes] - type. Required. - :type parameters: ~azure.mgmt.compute.models.AttachDetachDataDisksRequest or IO[bytes] - :return: An instance of LROPoller that returns either StorageProfile or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.StorageProfile] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.StorageProfile] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._attach_detach_data_disks_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, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("StorageProfile", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.StorageProfile].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.StorageProfile]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _deallocate_initial( - self, resource_group_name: str, vm_scale_set_name: str, instance_id: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_deallocate_request( - resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, - instance_id=instance_id, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_deallocate( - 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. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param instance_id: The instance ID of the virtual machine. Required. - :type instance_id: str - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._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, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # 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. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param instance_id: The instance ID of the virtual machine. Required. - :type instance_id: str - :return: VirtualMachineScaleSetVMInstanceView or the result of cls(response) - :rtype: ~azure.mgmt.compute.models.VirtualMachineScaleSetVMInstanceView - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[_models.VirtualMachineScaleSetVMInstanceView] = kwargs.pop("cls", None) - - _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, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("VirtualMachineScaleSetVMInstanceView", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _perform_maintenance_initial( - self, resource_group_name: str, vm_scale_set_name: str, instance_id: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_perform_maintenance_request( - resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, - instance_id=instance_id, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_perform_maintenance( - 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. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param instance_id: The instance ID of the virtual machine. Required. - :type instance_id: str - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._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, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _power_off_initial( - self, - resource_group_name: str, - vm_scale_set_name: str, - instance_id: str, - skip_shutdown: Optional[bool] = None, - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_power_off_request( - resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, - instance_id=instance_id, - subscription_id=self._config.subscription_id, - skip_shutdown=skip_shutdown, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_power_off( - self, - resource_group_name: str, - vm_scale_set_name: str, - instance_id: str, - skip_shutdown: Optional[bool] = None, - **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. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param instance_id: The instance ID of the virtual machine. Required. - :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 None. - :type skip_shutdown: bool - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._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, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _redeploy_initial( - self, resource_group_name: str, vm_scale_set_name: str, instance_id: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_redeploy_request( - resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, - instance_id=instance_id, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_redeploy( - 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. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param instance_id: The instance ID of the virtual machine. Required. - :type instance_id: str - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._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, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _reimage_initial( - self, - resource_group_name: str, - vm_scale_set_name: str, - instance_id: str, - vm_scale_set_vm_reimage_input: Optional[ - Union[_models.VirtualMachineScaleSetVMReimageParameters, IO[bytes]] - ] = None, - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - content_type = content_type if vm_scale_set_vm_reimage_input else None - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" if vm_scale_set_vm_reimage_input else None - _json = None - _content = None - if isinstance(vm_scale_set_vm_reimage_input, (IOBase, bytes)): - _content = vm_scale_set_vm_reimage_input - else: - 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( - resource_group_name=resource_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, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_reimage( - self, - resource_group_name: str, - vm_scale_set_name: str, - instance_id: str, - vm_scale_set_vm_reimage_input: Optional[_models.VirtualMachineScaleSetVMReimageParameters] = None, - *, - content_type: str = "application/json", - **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. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param instance_id: The instance ID of the virtual machine. Required. - :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.models.VirtualMachineScaleSetVMReimageParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_reimage( - self, - resource_group_name: str, - vm_scale_set_name: str, - instance_id: str, - vm_scale_set_vm_reimage_input: Optional[IO[bytes]] = None, - *, - content_type: str = "application/json", - **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. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param instance_id: The instance ID of the virtual machine. Required. - :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: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_reimage( - self, - resource_group_name: str, - vm_scale_set_name: str, - instance_id: str, - vm_scale_set_vm_reimage_input: Optional[ - Union[_models.VirtualMachineScaleSetVMReimageParameters, IO[bytes]] - ] = 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. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param instance_id: The instance ID of the virtual machine. Required. - :type instance_id: str - :param vm_scale_set_vm_reimage_input: Parameters for the Reimaging Virtual machine in ScaleSet. - Is either a VirtualMachineScaleSetVMReimageParameters type or a IO[bytes] type. Default value - is None. - :type vm_scale_set_vm_reimage_input: - ~azure.mgmt.compute.models.VirtualMachineScaleSetVMReimageParameters or IO[bytes] - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - content_type = content_type if vm_scale_set_vm_reimage_input else None - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._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, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _reimage_all_initial( - self, resource_group_name: str, vm_scale_set_name: str, instance_id: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_reimage_all_request( - resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, - instance_id=instance_id, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_reimage_all( - 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. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param instance_id: The instance ID of the virtual machine. Required. - :type instance_id: str - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._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, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _restart_initial( - self, resource_group_name: str, vm_scale_set_name: str, instance_id: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_restart_request( - resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, - instance_id=instance_id, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_restart( - 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. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param instance_id: The instance ID of the virtual machine. Required. - :type instance_id: str - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._restart_initial( - resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, - instance_id=instance_id, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # 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. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param instance_id: The instance ID of the virtual machine. Required. - :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. **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 - :return: RetrieveBootDiagnosticsDataResult or the result of cls(response) - :rtype: ~azure.mgmt.compute.models.RetrieveBootDiagnosticsDataResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[_models.RetrieveBootDiagnosticsDataResult] = kwargs.pop("cls", None) - - _request = build_retrieve_boot_diagnostics_data_request( - resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, - instance_id=instance_id, - subscription_id=self._config.subscription_id, - sas_uri_expiration_time_in_minutes=sas_uri_expiration_time_in_minutes, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("RetrieveBootDiagnosticsDataResult", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _run_command_initial( - self, - resource_group_name: str, - vm_scale_set_name: str, - instance_id: str, - parameters: Union[_models.RunCommandInput, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "RunCommandInput") - - _request = build_run_command_request( - resource_group_name=resource_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, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_run_command( - self, - resource_group_name: str, - vm_scale_set_name: str, - instance_id: str, - parameters: _models.RunCommandInput, - *, - content_type: 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. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param instance_id: The instance ID of the virtual machine. Required. - :type instance_id: str - :param parameters: Parameters supplied to the Run command operation. Required. - :type parameters: ~azure.mgmt.compute.models.RunCommandInput - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either RunCommandResult or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.RunCommandResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_run_command( - self, - resource_group_name: str, - vm_scale_set_name: str, - instance_id: str, - parameters: IO[bytes], - *, - content_type: 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. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param instance_id: The instance ID of the virtual machine. Required. - :type instance_id: str - :param parameters: Parameters supplied to the Run command operation. Required. - :type parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either RunCommandResult or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.RunCommandResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_run_command( - self, - resource_group_name: str, - vm_scale_set_name: str, - instance_id: str, - parameters: Union[_models.RunCommandInput, IO[bytes]], - **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. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param instance_id: The instance ID of the virtual machine. Required. - :type instance_id: str - :param parameters: Parameters supplied to the Run command operation. Is either a - RunCommandInput type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.compute.models.RunCommandInput or IO[bytes] - :return: An instance of LROPoller that returns either RunCommandResult or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.RunCommandResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.RunCommandResult] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._run_command_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, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("RunCommandResult", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.RunCommandResult].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.RunCommandResult]( - self._client, raw_result, get_long_running_output, polling_method # 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. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param instance_id: The instance ID of the virtual machine. Required. - :type instance_id: str - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - - _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, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [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, {}) # type: ignore - - def _start_initial( - self, resource_group_name: str, vm_scale_set_name: str, instance_id: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_start_request( - resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, - instance_id=instance_id, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_start( - 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. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param instance_id: The instance ID of the virtual machine. Required. - :type instance_id: str - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._start_initial( - resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, - instance_id=instance_id, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/operations/_virtual_machine_scale_sets_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/operations/_virtual_machine_scale_sets_operations.py deleted file mode 100644 index a3be666bf27a..000000000000 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/operations/_virtual_machine_scale_sets_operations.py +++ /dev/null @@ -1,5054 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression,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 collections.abc import MutableMapping -from io import IOBase -from typing import Any, Callable, IO, Iterator, Optional, TypeVar, Union, cast, overload - -from azure.core import PipelineClient -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - StreamClosedError, - StreamConsumedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from .._configuration import ComputeManagementClientConfiguration -from .._utils.serialization import Deserializer, Serializer - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] -List = list - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_by_location_request(location: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/virtualMachineScaleSets", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "location": _SERIALIZER.url("location", location, "str", min_length=1), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_all_request(subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - accept = _headers.pop("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", min_length=1), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request(resource_group_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_request( - resource_group_name: str, - vm_scale_set_name: str, - subscription_id: str, - *, - expand: Optional[Union[str, _models.ExpandTypesForGetVMScaleSets]] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if expand is not None: - _params["$expand"] = _SERIALIZER.query("expand", expand, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, - vm_scale_set_name: str, - subscription_id: str, - *, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if if_match is not None: - _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") - if if_none_match is not None: - _headers["If-None-Match"] = _SERIALIZER.header("if_none_match", if_none_match, "str") - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_request( - resource_group_name: str, - vm_scale_set_name: str, - subscription_id: str, - *, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if if_match is not None: - _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") - if if_none_match is not None: - _headers["If-None-Match"] = _SERIALIZER.header("if_none_match", if_none_match, "str") - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, - vm_scale_set_name: str, - subscription_id: str, - *, - force_deletion: Optional[bool] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if force_deletion is not None: - _params["forceDeletion"] = _SERIALIZER.query("force_deletion", force_deletion, "bool") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_approve_rolling_upgrade_request( - resource_group_name: str, vm_scale_set_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/approveRollingUpgrade", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_convert_to_single_placement_group_request( # pylint: disable=name-too-long - resource_group_name: str, vm_scale_set_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/convertToSinglePlacementGroup", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_deallocate_request( - resource_group_name: str, - vm_scale_set_name: str, - subscription_id: str, - *, - hibernate: Optional[bool] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/deallocate", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if hibernate is not None: - _params["hibernate"] = _SERIALIZER.query("hibernate", hibernate, "bool") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_instances_request( - resource_group_name: str, - vm_scale_set_name: str, - subscription_id: str, - *, - force_deletion: Optional[bool] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/delete", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if force_deletion is not None: - _params["forceDeletion"] = _SERIALIZER.query("force_deletion", force_deletion, "bool") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_force_recovery_service_fabric_platform_update_domain_walk_request( # pylint: disable=name-too-long - 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: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/forceRecoveryServiceFabricPlatformUpdateDomainWalk", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - _params["platformUpdateDomain"] = _SERIALIZER.query("platform_update_domain", platform_update_domain, "int") - if zone is not None: - _params["zone"] = _SERIALIZER.query("zone", zone, "str") - if placement_group_id is not None: - _params["placementGroupId"] = _SERIALIZER.query("placement_group_id", placement_group_id, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_instance_view_request( - resource_group_name: str, vm_scale_set_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/instanceView", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_instances_request( - resource_group_name: str, vm_scale_set_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/manualupgrade", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_os_upgrade_history_request( - resource_group_name: str, vm_scale_set_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/osUpgradeHistory", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_perform_maintenance_request( - resource_group_name: str, vm_scale_set_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/performMaintenance", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_power_off_request( - resource_group_name: str, - vm_scale_set_name: str, - subscription_id: str, - *, - skip_shutdown: Optional[bool] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/poweroff", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if skip_shutdown is not None: - _params["skipShutdown"] = _SERIALIZER.query("skip_shutdown", skip_shutdown, "bool") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_reapply_request( - resource_group_name: str, vm_scale_set_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/reapply", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_redeploy_request( - resource_group_name: str, vm_scale_set_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/redeploy", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_reimage_request( - resource_group_name: str, vm_scale_set_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/reimage", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_reimage_all_request( - resource_group_name: str, vm_scale_set_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/reimageall", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_restart_request( - resource_group_name: str, vm_scale_set_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/restart", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_scale_out_request( - resource_group_name: str, vm_scale_set_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/scaleOut", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_set_orchestration_service_state_request( # pylint: disable=name-too-long - resource_group_name: str, vm_scale_set_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/setOrchestrationServiceState", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_skus_request( - resource_group_name: str, vm_scale_set_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/skus", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_start_request( - resource_group_name: str, vm_scale_set_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/start", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class VirtualMachineScaleSetsOperations: # pylint: disable=too-many-public-methods - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.compute.ComputeManagementClient`'s - :attr:`virtual_machine_scale_sets` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list_by_location(self, location: str, **kwargs: Any) -> ItemPaged["_models.VirtualMachineScaleSet"]: - """Gets all the VM scale sets under the specified subscription for the specified location. - - :param location: The name of Azure region. Required. - :type location: str - :return: An iterator like instance of either VirtualMachineScaleSet or the result of - cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.models.VirtualMachineScaleSet] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[_models.VirtualMachineScaleSetListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_by_location_request( - location=location, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - _request = HttpRequest("GET", next_link) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @distributed_trace - def list_all(self, **kwargs: Any) -> ItemPaged["_models.VirtualMachineScaleSet"]: - """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. - - :return: An iterator like instance of either VirtualMachineScaleSet or the result of - cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.models.VirtualMachineScaleSet] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[_models.VirtualMachineScaleSetListWithLinkResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_all_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - _request = HttpRequest("GET", next_link) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @distributed_trace - def list(self, resource_group_name: str, **kwargs: Any) -> ItemPaged["_models.VirtualMachineScaleSet"]: - """Gets a list of all VM scale sets under a resource group. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :return: An iterator like instance of either VirtualMachineScaleSet or the result of - cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.models.VirtualMachineScaleSet] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[_models.VirtualMachineScaleSetListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - _request = HttpRequest("GET", next_link) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @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. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :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. "userData" Default value is None. - :type expand: str or ~azure.mgmt.compute.models.ExpandTypesForGetVMScaleSets - :return: VirtualMachineScaleSet or the result of cls(response) - :rtype: ~azure.mgmt.compute.models.VirtualMachineScaleSet - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[_models.VirtualMachineScaleSet] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, - subscription_id=self._config.subscription_id, - expand=expand, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("VirtualMachineScaleSet", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - vm_scale_set_name: str, - parameters: Union[_models.VirtualMachineScaleSet, IO[bytes]], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "VirtualMachineScaleSet") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 201: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - vm_scale_set_name: str, - parameters: _models.VirtualMachineScaleSet, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.VirtualMachineScaleSet]: - """Create or update a VM scale set. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param parameters: The scale set object. Required. - :type parameters: ~azure.mgmt.compute.models.VirtualMachineScaleSet - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing record set. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either VirtualMachineScaleSet or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.VirtualMachineScaleSet] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - vm_scale_set_name: str, - parameters: IO[bytes], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.VirtualMachineScaleSet]: - """Create or update a VM scale set. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param parameters: The scale set object. Required. - :type parameters: IO[bytes] - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing record set. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either VirtualMachineScaleSet or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.VirtualMachineScaleSet] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - vm_scale_set_name: str, - parameters: Union[_models.VirtualMachineScaleSet, IO[bytes]], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any - ) -> LROPoller[_models.VirtualMachineScaleSet]: - """Create or update a VM scale set. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param parameters: The scale set object. Is either a VirtualMachineScaleSet type or a IO[bytes] - type. Required. - :type parameters: ~azure.mgmt.compute.models.VirtualMachineScaleSet or IO[bytes] - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing record set. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :return: An instance of LROPoller that returns either VirtualMachineScaleSet or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.VirtualMachineScaleSet] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.VirtualMachineScaleSet] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._create_or_update_initial( - resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, - parameters=parameters, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("VirtualMachineScaleSet", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.VirtualMachineScaleSet].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.VirtualMachineScaleSet]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _update_initial( - self, - resource_group_name: str, - vm_scale_set_name: str, - parameters: Union[_models.VirtualMachineScaleSetUpdate, IO[bytes]], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "VirtualMachineScaleSetUpdate") - - _request = build_update_request( - resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update( - self, - resource_group_name: str, - vm_scale_set_name: str, - parameters: _models.VirtualMachineScaleSetUpdate, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.VirtualMachineScaleSet]: - """Update a VM scale set. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param parameters: The scale set object. Required. - :type parameters: ~azure.mgmt.compute.models.VirtualMachineScaleSetUpdate - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing record set. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either VirtualMachineScaleSet or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.VirtualMachineScaleSet] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update( - self, - resource_group_name: str, - vm_scale_set_name: str, - parameters: IO[bytes], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.VirtualMachineScaleSet]: - """Update a VM scale set. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param parameters: The scale set object. Required. - :type parameters: IO[bytes] - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing record set. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either VirtualMachineScaleSet or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.VirtualMachineScaleSet] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_update( - self, - resource_group_name: str, - vm_scale_set_name: str, - parameters: Union[_models.VirtualMachineScaleSetUpdate, IO[bytes]], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any - ) -> LROPoller[_models.VirtualMachineScaleSet]: - """Update a VM scale set. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param parameters: The scale set object. Is either a VirtualMachineScaleSetUpdate type or a - IO[bytes] type. Required. - :type parameters: ~azure.mgmt.compute.models.VirtualMachineScaleSetUpdate or IO[bytes] - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing record set. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :return: An instance of LROPoller that returns either VirtualMachineScaleSet or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.VirtualMachineScaleSet] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.VirtualMachineScaleSet] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._update_initial( - resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, - parameters=parameters, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - response_headers = {} - response = pipeline_response.http_response - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = self._deserialize("VirtualMachineScaleSet", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.VirtualMachineScaleSet].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.VirtualMachineScaleSet]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, vm_scale_set_name: str, force_deletion: Optional[bool] = None, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, - subscription_id=self._config.subscription_id, - force_deletion=force_deletion, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_delete( - 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. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :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 - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( - 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, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _approve_rolling_upgrade_initial( - self, - resource_group_name: str, - vm_scale_set_name: str, - vm_instance_i_ds: Optional[Union[_models.VirtualMachineScaleSetVMInstanceIDs, IO[bytes]]] = None, - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - content_type = content_type if vm_instance_i_ds else None - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" if vm_instance_i_ds else None - _json = None - _content = None - if isinstance(vm_instance_i_ds, (IOBase, bytes)): - _content = vm_instance_i_ds - else: - if vm_instance_i_ds is not None: - _json = self._serialize.body(vm_instance_i_ds, "VirtualMachineScaleSetVMInstanceIDs") - else: - _json = None - - _request = build_approve_rolling_upgrade_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, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [202]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_approve_rolling_upgrade( - self, - resource_group_name: str, - vm_scale_set_name: str, - vm_instance_i_ds: Optional[_models.VirtualMachineScaleSetVMInstanceIDs] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[None]: - """Approve upgrade on deferred rolling upgrades for OS disks in the virtual machines in a VM scale - set. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :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.models.VirtualMachineScaleSetVMInstanceIDs - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_approve_rolling_upgrade( - self, - resource_group_name: str, - vm_scale_set_name: str, - vm_instance_i_ds: Optional[IO[bytes]] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[None]: - """Approve upgrade on deferred rolling upgrades for OS disks in the virtual machines in a VM scale - set. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :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: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_approve_rolling_upgrade( - self, - resource_group_name: str, - vm_scale_set_name: str, - vm_instance_i_ds: Optional[Union[_models.VirtualMachineScaleSetVMInstanceIDs, IO[bytes]]] = None, - **kwargs: Any - ) -> LROPoller[None]: - """Approve upgrade on deferred rolling upgrades for OS disks in the virtual machines in a VM scale - set. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param vm_instance_i_ds: A list of virtual machine instance IDs from the VM scale set. Is - either a VirtualMachineScaleSetVMInstanceIDs type or a IO[bytes] type. Default value is None. - :type vm_instance_i_ds: ~azure.mgmt.compute.models.VirtualMachineScaleSetVMInstanceIDs or - IO[bytes] - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - content_type = content_type if vm_instance_i_ds else None - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._approve_rolling_upgrade_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, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @overload - def convert_to_single_placement_group( - self, - resource_group_name: str, - vm_scale_set_name: str, - parameters: _models.VMScaleSetConvertToSinglePlacementGroupInput, - *, - content_type: str = "application/json", - **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. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param parameters: The input object for ConvertToSinglePlacementGroup API. Required. - :type parameters: ~azure.mgmt.compute.models.VMScaleSetConvertToSinglePlacementGroupInput - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def convert_to_single_placement_group( - self, - resource_group_name: str, - vm_scale_set_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **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. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param parameters: The input object for ConvertToSinglePlacementGroup API. Required. - :type parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def convert_to_single_placement_group( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - vm_scale_set_name: str, - parameters: Union[_models.VMScaleSetConvertToSinglePlacementGroupInput, IO[bytes]], - **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. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param parameters: The input object for ConvertToSinglePlacementGroup API. Is either a - VMScaleSetConvertToSinglePlacementGroupInput type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.compute.models.VMScaleSetConvertToSinglePlacementGroupInput or - IO[bytes] - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _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, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - def _deallocate_initial( - self, - resource_group_name: str, - vm_scale_set_name: str, - hibernate: Optional[bool] = None, - vm_instance_i_ds: Optional[Union[_models.VirtualMachineScaleSetVMInstanceIDs, IO[bytes]]] = None, - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - content_type = content_type if vm_instance_i_ds else None - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" if vm_instance_i_ds else None - _json = None - _content = None - if isinstance(vm_instance_i_ds, (IOBase, bytes)): - _content = vm_instance_i_ds - else: - if vm_instance_i_ds is not None: - _json = self._serialize.body(vm_instance_i_ds, "VirtualMachineScaleSetVMInstanceIDs") - else: - _json = None - - _request = build_deallocate_request( - resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, - subscription_id=self._config.subscription_id, - hibernate=hibernate, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_deallocate( - self, - resource_group_name: str, - vm_scale_set_name: str, - hibernate: Optional[bool] = None, - vm_instance_i_ds: Optional[_models.VirtualMachineScaleSetVMInstanceIDs] = None, - *, - content_type: str = "application/json", - **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. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param hibernate: Optional parameter to hibernate a virtual machine from the VM scale set. - (This feature is available for VMSS with Flexible OrchestrationMode only). Default value is - None. - :type hibernate: 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.models.VirtualMachineScaleSetVMInstanceIDs - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_deallocate( - self, - resource_group_name: str, - vm_scale_set_name: str, - hibernate: Optional[bool] = None, - vm_instance_i_ds: Optional[IO[bytes]] = None, - *, - content_type: str = "application/json", - **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. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param hibernate: Optional parameter to hibernate a virtual machine from the VM scale set. - (This feature is available for VMSS with Flexible OrchestrationMode only). Default value is - None. - :type hibernate: 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: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_deallocate( - self, - resource_group_name: str, - vm_scale_set_name: str, - hibernate: Optional[bool] = None, - vm_instance_i_ds: Optional[Union[_models.VirtualMachineScaleSetVMInstanceIDs, IO[bytes]]] = 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. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param hibernate: Optional parameter to hibernate a virtual machine from the VM scale set. - (This feature is available for VMSS with Flexible OrchestrationMode only). Default value is - None. - :type hibernate: bool - :param vm_instance_i_ds: A list of virtual machine instance IDs from the VM scale set. Is - either a VirtualMachineScaleSetVMInstanceIDs type or a IO[bytes] type. Default value is None. - :type vm_instance_i_ds: ~azure.mgmt.compute.models.VirtualMachineScaleSetVMInstanceIDs or - IO[bytes] - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - content_type = content_type if vm_instance_i_ds else None - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._deallocate_initial( - resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, - hibernate=hibernate, - vm_instance_i_ds=vm_instance_i_ds, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _delete_instances_initial( - self, - resource_group_name: str, - vm_scale_set_name: str, - vm_instance_i_ds: Union[_models.VirtualMachineScaleSetVMInstanceRequiredIDs, IO[bytes]], - force_deletion: Optional[bool] = None, - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(vm_instance_i_ds, (IOBase, bytes)): - _content = vm_instance_i_ds - else: - _json = self._serialize.body(vm_instance_i_ds, "VirtualMachineScaleSetVMInstanceRequiredIDs") - - _request = build_delete_instances_request( - resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, - subscription_id=self._config.subscription_id, - force_deletion=force_deletion, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_delete_instances( - self, - resource_group_name: str, - vm_scale_set_name: str, - vm_instance_i_ds: _models.VirtualMachineScaleSetVMInstanceRequiredIDs, - force_deletion: Optional[bool] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[None]: - """Deletes virtual machines in a VM scale set. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param vm_instance_i_ds: A list of virtual machine instance IDs from the VM scale set. - Required. - :type vm_instance_i_ds: ~azure.mgmt.compute.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 content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_delete_instances( - self, - resource_group_name: str, - vm_scale_set_name: str, - vm_instance_i_ds: IO[bytes], - force_deletion: Optional[bool] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[None]: - """Deletes virtual machines in a VM scale set. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param vm_instance_i_ds: A list of virtual machine instance IDs from the VM scale set. - Required. - :type vm_instance_i_ds: IO[bytes] - :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 content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_delete_instances( - self, - resource_group_name: str, - vm_scale_set_name: str, - vm_instance_i_ds: Union[_models.VirtualMachineScaleSetVMInstanceRequiredIDs, IO[bytes]], - 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. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param vm_instance_i_ds: A list of virtual machine instance IDs from the VM scale set. Is - either a VirtualMachineScaleSetVMInstanceRequiredIDs type or a IO[bytes] type. Required. - :type vm_instance_i_ds: ~azure.mgmt.compute.models.VirtualMachineScaleSetVMInstanceRequiredIDs - or IO[bytes] - :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 - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._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, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def force_recovery_service_fabric_platform_update_domain_walk( # pylint: disable=name-too-long - 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. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param platform_update_domain: The platform update domain for which a manual recovery walk is - requested. Required. - :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 - :return: RecoveryWalkResponse or the result of cls(response) - :rtype: ~azure.mgmt.compute.models.RecoveryWalkResponse - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[_models.RecoveryWalkResponse] = kwargs.pop("cls", None) - - _request = build_force_recovery_service_fabric_platform_update_domain_walk_request( - resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, - subscription_id=self._config.subscription_id, - platform_update_domain=platform_update_domain, - zone=zone, - placement_group_id=placement_group_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("RecoveryWalkResponse", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :return: VirtualMachineScaleSetInstanceView or the result of cls(response) - :rtype: ~azure.mgmt.compute.models.VirtualMachineScaleSetInstanceView - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[_models.VirtualMachineScaleSetInstanceView] = kwargs.pop("cls", None) - - _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, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("VirtualMachineScaleSetInstanceView", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _update_instances_initial( - self, - resource_group_name: str, - vm_scale_set_name: str, - vm_instance_i_ds: Union[_models.VirtualMachineScaleSetVMInstanceRequiredIDs, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(vm_instance_i_ds, (IOBase, bytes)): - _content = vm_instance_i_ds - else: - _json = self._serialize.body(vm_instance_i_ds, "VirtualMachineScaleSetVMInstanceRequiredIDs") - - _request = build_update_instances_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, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update_instances( - self, - resource_group_name: str, - vm_scale_set_name: str, - vm_instance_i_ds: _models.VirtualMachineScaleSetVMInstanceRequiredIDs, - *, - content_type: str = "application/json", - **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. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param vm_instance_i_ds: A list of virtual machine instance IDs from the VM scale set. - Required. - :type vm_instance_i_ds: ~azure.mgmt.compute.models.VirtualMachineScaleSetVMInstanceRequiredIDs - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update_instances( - self, - resource_group_name: str, - vm_scale_set_name: str, - vm_instance_i_ds: IO[bytes], - *, - content_type: str = "application/json", - **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. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param vm_instance_i_ds: A list of virtual machine instance IDs from the VM scale set. - Required. - :type vm_instance_i_ds: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_update_instances( - self, - resource_group_name: str, - vm_scale_set_name: str, - vm_instance_i_ds: Union[_models.VirtualMachineScaleSetVMInstanceRequiredIDs, IO[bytes]], - **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. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param vm_instance_i_ds: A list of virtual machine instance IDs from the VM scale set. Is - either a VirtualMachineScaleSetVMInstanceRequiredIDs type or a IO[bytes] type. Required. - :type vm_instance_i_ds: ~azure.mgmt.compute.models.VirtualMachineScaleSetVMInstanceRequiredIDs - or IO[bytes] - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._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, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def get_os_upgrade_history( - self, resource_group_name: str, vm_scale_set_name: str, **kwargs: Any - ) -> ItemPaged["_models.UpgradeOperationHistoricalStatusInfo"]: - """Gets list of OS upgrades on a VM scale set instance. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :return: An iterator like instance of either UpgradeOperationHistoricalStatusInfo or the result - of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.compute.models.UpgradeOperationHistoricalStatusInfo] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[_models.VirtualMachineScaleSetListOSUpgradeHistory] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_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, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - _request = HttpRequest("GET", next_link) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - def _perform_maintenance_initial( - self, - resource_group_name: str, - vm_scale_set_name: str, - vm_instance_i_ds: Optional[Union[_models.VirtualMachineScaleSetVMInstanceIDs, IO[bytes]]] = None, - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - content_type = content_type if vm_instance_i_ds else None - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" if vm_instance_i_ds else None - _json = None - _content = None - if isinstance(vm_instance_i_ds, (IOBase, bytes)): - _content = vm_instance_i_ds - else: - 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( - resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_perform_maintenance( - self, - resource_group_name: str, - vm_scale_set_name: str, - vm_instance_i_ds: Optional[_models.VirtualMachineScaleSetVMInstanceIDs] = None, - *, - content_type: str = "application/json", - **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. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :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.models.VirtualMachineScaleSetVMInstanceIDs - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_perform_maintenance( - self, - resource_group_name: str, - vm_scale_set_name: str, - vm_instance_i_ds: Optional[IO[bytes]] = None, - *, - content_type: str = "application/json", - **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. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :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: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_perform_maintenance( - self, - resource_group_name: str, - vm_scale_set_name: str, - vm_instance_i_ds: Optional[Union[_models.VirtualMachineScaleSetVMInstanceIDs, IO[bytes]]] = 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. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param vm_instance_i_ds: A list of virtual machine instance IDs from the VM scale set. Is - either a VirtualMachineScaleSetVMInstanceIDs type or a IO[bytes] type. Default value is None. - :type vm_instance_i_ds: ~azure.mgmt.compute.models.VirtualMachineScaleSetVMInstanceIDs or - IO[bytes] - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - content_type = content_type if vm_instance_i_ds else None - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._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, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _power_off_initial( - self, - resource_group_name: str, - vm_scale_set_name: str, - skip_shutdown: Optional[bool] = None, - vm_instance_i_ds: Optional[Union[_models.VirtualMachineScaleSetVMInstanceIDs, IO[bytes]]] = None, - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - content_type = content_type if vm_instance_i_ds else None - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" if vm_instance_i_ds else None - _json = None - _content = None - if isinstance(vm_instance_i_ds, (IOBase, bytes)): - _content = vm_instance_i_ds - else: - 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( - resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, - subscription_id=self._config.subscription_id, - skip_shutdown=skip_shutdown, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_power_off( - self, - resource_group_name: str, - vm_scale_set_name: str, - skip_shutdown: Optional[bool] = None, - vm_instance_i_ds: Optional[_models.VirtualMachineScaleSetVMInstanceIDs] = None, - *, - content_type: str = "application/json", - **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. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :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 None. - :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.models.VirtualMachineScaleSetVMInstanceIDs - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_power_off( - self, - resource_group_name: str, - vm_scale_set_name: str, - skip_shutdown: Optional[bool] = None, - vm_instance_i_ds: Optional[IO[bytes]] = None, - *, - content_type: str = "application/json", - **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. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :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 None. - :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: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_power_off( - self, - resource_group_name: str, - vm_scale_set_name: str, - skip_shutdown: Optional[bool] = None, - vm_instance_i_ds: Optional[Union[_models.VirtualMachineScaleSetVMInstanceIDs, IO[bytes]]] = 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. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :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 None. - :type skip_shutdown: bool - :param vm_instance_i_ds: A list of virtual machine instance IDs from the VM scale set. Is - either a VirtualMachineScaleSetVMInstanceIDs type or a IO[bytes] type. Default value is None. - :type vm_instance_i_ds: ~azure.mgmt.compute.models.VirtualMachineScaleSetVMInstanceIDs or - IO[bytes] - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - content_type = content_type if vm_instance_i_ds else None - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._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, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _reapply_initial(self, resource_group_name: str, vm_scale_set_name: str, **kwargs: Any) -> Iterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_reapply_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, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_reapply(self, resource_group_name: str, vm_scale_set_name: str, **kwargs: Any) -> LROPoller[None]: - """Reapplies the Virtual Machine Scale Set Virtual Machine Profile to the Virtual Machine - Instances. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._reapply_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, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _redeploy_initial( - self, - resource_group_name: str, - vm_scale_set_name: str, - vm_instance_i_ds: Optional[Union[_models.VirtualMachineScaleSetVMInstanceIDs, IO[bytes]]] = None, - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - content_type = content_type if vm_instance_i_ds else None - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" if vm_instance_i_ds else None - _json = None - _content = None - if isinstance(vm_instance_i_ds, (IOBase, bytes)): - _content = vm_instance_i_ds - else: - if vm_instance_i_ds is not None: - _json = self._serialize.body(vm_instance_i_ds, "VirtualMachineScaleSetVMInstanceIDs") - else: - _json = None - - _request = build_redeploy_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, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_redeploy( - self, - resource_group_name: str, - vm_scale_set_name: str, - vm_instance_i_ds: Optional[_models.VirtualMachineScaleSetVMInstanceIDs] = None, - *, - content_type: str = "application/json", - **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. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :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.models.VirtualMachineScaleSetVMInstanceIDs - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_redeploy( - self, - resource_group_name: str, - vm_scale_set_name: str, - vm_instance_i_ds: Optional[IO[bytes]] = None, - *, - content_type: str = "application/json", - **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. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :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: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_redeploy( - self, - resource_group_name: str, - vm_scale_set_name: str, - vm_instance_i_ds: Optional[Union[_models.VirtualMachineScaleSetVMInstanceIDs, IO[bytes]]] = 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. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param vm_instance_i_ds: A list of virtual machine instance IDs from the VM scale set. Is - either a VirtualMachineScaleSetVMInstanceIDs type or a IO[bytes] type. Default value is None. - :type vm_instance_i_ds: ~azure.mgmt.compute.models.VirtualMachineScaleSetVMInstanceIDs or - IO[bytes] - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - content_type = content_type if vm_instance_i_ds else None - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._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, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _reimage_initial( - self, - resource_group_name: str, - vm_scale_set_name: str, - vm_scale_set_reimage_input: Optional[Union[_models.VirtualMachineScaleSetReimageParameters, IO[bytes]]] = None, - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - content_type = content_type if vm_scale_set_reimage_input else None - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" if vm_scale_set_reimage_input else None - _json = None - _content = None - if isinstance(vm_scale_set_reimage_input, (IOBase, bytes)): - _content = vm_scale_set_reimage_input - else: - 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( - resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_reimage( - self, - resource_group_name: str, - vm_scale_set_name: str, - vm_scale_set_reimage_input: Optional[_models.VirtualMachineScaleSetReimageParameters] = None, - *, - content_type: str = "application/json", - **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. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :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.models.VirtualMachineScaleSetReimageParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_reimage( - self, - resource_group_name: str, - vm_scale_set_name: str, - vm_scale_set_reimage_input: Optional[IO[bytes]] = None, - *, - content_type: str = "application/json", - **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. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :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: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_reimage( - self, - resource_group_name: str, - vm_scale_set_name: str, - vm_scale_set_reimage_input: Optional[Union[_models.VirtualMachineScaleSetReimageParameters, IO[bytes]]] = 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. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param vm_scale_set_reimage_input: Parameters for Reimaging VM ScaleSet. Is either a - VirtualMachineScaleSetReimageParameters type or a IO[bytes] type. Default value is None. - :type vm_scale_set_reimage_input: - ~azure.mgmt.compute.models.VirtualMachineScaleSetReimageParameters or IO[bytes] - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - content_type = content_type if vm_scale_set_reimage_input else None - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._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, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _reimage_all_initial( - self, - resource_group_name: str, - vm_scale_set_name: str, - vm_instance_i_ds: Optional[Union[_models.VirtualMachineScaleSetVMInstanceIDs, IO[bytes]]] = None, - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - content_type = content_type if vm_instance_i_ds else None - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" if vm_instance_i_ds else None - _json = None - _content = None - if isinstance(vm_instance_i_ds, (IOBase, bytes)): - _content = vm_instance_i_ds - else: - 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( - resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_reimage_all( - self, - resource_group_name: str, - vm_scale_set_name: str, - vm_instance_i_ds: Optional[_models.VirtualMachineScaleSetVMInstanceIDs] = None, - *, - content_type: str = "application/json", - **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. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :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.models.VirtualMachineScaleSetVMInstanceIDs - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_reimage_all( - self, - resource_group_name: str, - vm_scale_set_name: str, - vm_instance_i_ds: Optional[IO[bytes]] = None, - *, - content_type: str = "application/json", - **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. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :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: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_reimage_all( - self, - resource_group_name: str, - vm_scale_set_name: str, - vm_instance_i_ds: Optional[Union[_models.VirtualMachineScaleSetVMInstanceIDs, IO[bytes]]] = 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. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param vm_instance_i_ds: A list of virtual machine instance IDs from the VM scale set. Is - either a VirtualMachineScaleSetVMInstanceIDs type or a IO[bytes] type. Default value is None. - :type vm_instance_i_ds: ~azure.mgmt.compute.models.VirtualMachineScaleSetVMInstanceIDs or - IO[bytes] - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - content_type = content_type if vm_instance_i_ds else None - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._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, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _restart_initial( - self, - resource_group_name: str, - vm_scale_set_name: str, - vm_instance_i_ds: Optional[Union[_models.VirtualMachineScaleSetVMInstanceIDs, IO[bytes]]] = None, - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - content_type = content_type if vm_instance_i_ds else None - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" if vm_instance_i_ds else None - _json = None - _content = None - if isinstance(vm_instance_i_ds, (IOBase, bytes)): - _content = vm_instance_i_ds - else: - if vm_instance_i_ds is not None: - _json = self._serialize.body(vm_instance_i_ds, "VirtualMachineScaleSetVMInstanceIDs") - else: - _json = None - - _request = build_restart_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, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_restart( - self, - resource_group_name: str, - vm_scale_set_name: str, - vm_instance_i_ds: Optional[_models.VirtualMachineScaleSetVMInstanceIDs] = None, - *, - content_type: str = "application/json", - **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. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :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.models.VirtualMachineScaleSetVMInstanceIDs - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_restart( - self, - resource_group_name: str, - vm_scale_set_name: str, - vm_instance_i_ds: Optional[IO[bytes]] = None, - *, - content_type: str = "application/json", - **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. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :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: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_restart( - self, - resource_group_name: str, - vm_scale_set_name: str, - vm_instance_i_ds: Optional[Union[_models.VirtualMachineScaleSetVMInstanceIDs, IO[bytes]]] = 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. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param vm_instance_i_ds: A list of virtual machine instance IDs from the VM scale set. Is - either a VirtualMachineScaleSetVMInstanceIDs type or a IO[bytes] type. Default value is None. - :type vm_instance_i_ds: ~azure.mgmt.compute.models.VirtualMachineScaleSetVMInstanceIDs or - IO[bytes] - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - content_type = content_type if vm_instance_i_ds else None - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._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, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _scale_out_initial( - self, - resource_group_name: str, - vm_scale_set_name: str, - parameters: Union[_models.VMScaleSetScaleOutInput, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "VMScaleSetScaleOutInput") - - _request = build_scale_out_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, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_scale_out( - self, - resource_group_name: str, - vm_scale_set_name: str, - parameters: _models.VMScaleSetScaleOutInput, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[None]: - """Scales out one or more virtual machines in a VM scale set. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param parameters: The input object for ScaleOut API. Required. - :type parameters: ~azure.mgmt.compute.models.VMScaleSetScaleOutInput - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_scale_out( - self, - resource_group_name: str, - vm_scale_set_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[None]: - """Scales out one or more virtual machines in a VM scale set. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param parameters: The input object for ScaleOut API. Required. - :type parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_scale_out( - self, - resource_group_name: str, - vm_scale_set_name: str, - parameters: Union[_models.VMScaleSetScaleOutInput, IO[bytes]], - **kwargs: Any - ) -> LROPoller[None]: - """Scales out one or more virtual machines in a VM scale set. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param parameters: The input object for ScaleOut API. Is either a VMScaleSetScaleOutInput type - or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.compute.models.VMScaleSetScaleOutInput or IO[bytes] - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._scale_out_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, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _set_orchestration_service_state_initial( - self, - resource_group_name: str, - vm_scale_set_name: str, - parameters: Union[_models.OrchestrationServiceStateInput, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "OrchestrationServiceStateInput") - - _request = build_set_orchestration_service_state_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, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_set_orchestration_service_state( - self, - resource_group_name: str, - vm_scale_set_name: str, - parameters: _models.OrchestrationServiceStateInput, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[None]: - """Changes ServiceState property for a given service. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param parameters: The input object for SetOrchestrationServiceState API. Required. - :type parameters: ~azure.mgmt.compute.models.OrchestrationServiceStateInput - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_set_orchestration_service_state( - self, - resource_group_name: str, - vm_scale_set_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[None]: - """Changes ServiceState property for a given service. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param parameters: The input object for SetOrchestrationServiceState API. Required. - :type parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_set_orchestration_service_state( - self, - resource_group_name: str, - vm_scale_set_name: str, - parameters: Union[_models.OrchestrationServiceStateInput, IO[bytes]], - **kwargs: Any - ) -> LROPoller[None]: - """Changes ServiceState property for a given service. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param parameters: The input object for SetOrchestrationServiceState API. Is either a - OrchestrationServiceStateInput type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.compute.models.OrchestrationServiceStateInput or IO[bytes] - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._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, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list_skus( - self, resource_group_name: str, vm_scale_set_name: str, **kwargs: Any - ) -> ItemPaged["_models.VirtualMachineScaleSetSku"]: - """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. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :return: An iterator like instance of either VirtualMachineScaleSetSku or the result of - cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.models.VirtualMachineScaleSetSku] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[_models.VirtualMachineScaleSetListSkusResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_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, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - _request = HttpRequest("GET", next_link) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - def _start_initial( - self, - resource_group_name: str, - vm_scale_set_name: str, - vm_instance_i_ds: Optional[Union[_models.VirtualMachineScaleSetVMInstanceIDs, IO[bytes]]] = None, - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - content_type = content_type if vm_instance_i_ds else None - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" if vm_instance_i_ds else None - _json = None - _content = None - if isinstance(vm_instance_i_ds, (IOBase, bytes)): - _content = vm_instance_i_ds - else: - if vm_instance_i_ds is not None: - _json = self._serialize.body(vm_instance_i_ds, "VirtualMachineScaleSetVMInstanceIDs") - else: - _json = None - - _request = build_start_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, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_start( - self, - resource_group_name: str, - vm_scale_set_name: str, - vm_instance_i_ds: Optional[_models.VirtualMachineScaleSetVMInstanceIDs] = None, - *, - content_type: str = "application/json", - **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. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :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.models.VirtualMachineScaleSetVMInstanceIDs - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_start( - self, - resource_group_name: str, - vm_scale_set_name: str, - vm_instance_i_ds: Optional[IO[bytes]] = None, - *, - content_type: str = "application/json", - **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. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :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: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_start( - self, - resource_group_name: str, - vm_scale_set_name: str, - vm_instance_i_ds: Optional[Union[_models.VirtualMachineScaleSetVMInstanceIDs, IO[bytes]]] = 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. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param vm_instance_i_ds: A list of virtual machine instance IDs from the VM scale set. Is - either a VirtualMachineScaleSetVMInstanceIDs type or a IO[bytes] type. Default value is None. - :type vm_instance_i_ds: ~azure.mgmt.compute.models.VirtualMachineScaleSetVMInstanceIDs or - IO[bytes] - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - content_type = content_type if vm_instance_i_ds else None - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._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, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/operations/_virtual_machine_sizes_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/operations/_virtual_machine_sizes_operations.py deleted file mode 100644 index 9baafdfd05c3..000000000000 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/operations/_virtual_machine_sizes_operations.py +++ /dev/null @@ -1,150 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from collections.abc import MutableMapping -from typing import Any, Callable, Optional, TypeVar - -from azure.core import PipelineClient -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models -from .._configuration import ComputeManagementClientConfiguration -from .._utils.serialization import Deserializer, Serializer - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] -List = list - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_request(location: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/vmSizes" - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "location": _SERIALIZER.url("location", location, "str", min_length=1), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class VirtualMachineSizesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.compute.ComputeManagementClient`'s - :attr:`virtual_machine_sizes` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list(self, location: str, **kwargs: Any) -> ItemPaged["_models.VirtualMachineSize"]: - """This API is deprecated. Use `Resources Skus - `_. - - :param location: The name of Azure region. Required. - :type location: str - :return: An iterator like instance of either VirtualMachineSize or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.models.VirtualMachineSize] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[_models.VirtualMachineSizeListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - location=location, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - _request = HttpRequest("GET", next_link) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/operations/_virtual_machines_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/operations/_virtual_machines_operations.py deleted file mode 100644 index 057e4e4f1ae1..000000000000 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/operations/_virtual_machines_operations.py +++ /dev/null @@ -1,4447 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression,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 collections.abc import MutableMapping -from io import IOBase -from typing import Any, Callable, IO, Iterator, Optional, TypeVar, Union, cast, overload - -from azure.core import PipelineClient -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - StreamClosedError, - StreamConsumedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from .._configuration import ComputeManagementClientConfiguration -from .._utils.serialization import Deserializer, Serializer - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] -List = list - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_by_location_request(location: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/virtualMachines", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "location": _SERIALIZER.url("location", location, "str", min_length=1), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_all_request( - subscription_id: str, - *, - status_only: Optional[str] = None, - filter: Optional[str] = None, - expand: Optional[Union[str, _models.ExpandTypesForListVMs]] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - accept = _headers.pop("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", min_length=1), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if status_only is not None: - _params["statusOnly"] = _SERIALIZER.query("status_only", status_only, "str") - if filter is not None: - _params["$filter"] = _SERIALIZER.query("filter", filter, "str") - if expand is not None: - _params["$expand"] = _SERIALIZER.query("expand", expand, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request( - resource_group_name: str, - subscription_id: str, - *, - filter: Optional[str] = None, - expand: Optional[Union[str, _models.ExpandTypeForListVMs]] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if filter is not None: - _params["$filter"] = _SERIALIZER.query("filter", filter, "str") - if expand is not None: - _params["$expand"] = _SERIALIZER.query("expand", expand, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_request( - resource_group_name: str, - vm_name: str, - subscription_id: str, - *, - expand: Optional[Union[str, _models.InstanceViewTypes]] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if expand is not None: - _params["$expand"] = _SERIALIZER.query("expand", expand, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, - vm_name: str, - subscription_id: str, - *, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if if_match is not None: - _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") - if if_none_match is not None: - _headers["If-None-Match"] = _SERIALIZER.header("if_none_match", if_none_match, "str") - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_request( - resource_group_name: str, - vm_name: str, - subscription_id: str, - *, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if if_match is not None: - _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") - if if_none_match is not None: - _headers["If-None-Match"] = _SERIALIZER.header("if_none_match", if_none_match, "str") - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, - vm_name: str, - subscription_id: str, - *, - force_deletion: Optional[bool] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if force_deletion is not None: - _params["forceDeletion"] = _SERIALIZER.query("force_deletion", force_deletion, "bool") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_assess_patches_request( - resource_group_name: str, vm_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/assessPatches", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_attach_detach_data_disks_request( - resource_group_name: str, vm_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/attachDetachDataDisks", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_capture_request(resource_group_name: str, vm_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/capture", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_convert_to_managed_disks_request( - resource_group_name: str, vm_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/convertToManagedDisks", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_deallocate_request( - resource_group_name: str, vm_name: str, subscription_id: str, *, hibernate: Optional[bool] = None, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/deallocate", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if hibernate is not None: - _params["hibernate"] = _SERIALIZER.query("hibernate", hibernate, "bool") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_generalize_request( - resource_group_name: str, vm_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/generalize", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_install_patches_request( - resource_group_name: str, vm_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/installPatches", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_instance_view_request( - resource_group_name: str, vm_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/instanceView", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_migrate_to_vm_scale_set_request( - resource_group_name: str, vm_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/migrateToVirtualMachineScaleSet", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_perform_maintenance_request( - resource_group_name: str, vm_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/performMaintenance", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_power_off_request( - resource_group_name: str, vm_name: str, subscription_id: str, *, skip_shutdown: Optional[bool] = None, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/powerOff", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if skip_shutdown is not None: - _params["skipShutdown"] = _SERIALIZER.query("skip_shutdown", skip_shutdown, "bool") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_reapply_request(resource_group_name: str, vm_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/reapply", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_redeploy_request(resource_group_name: str, vm_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/redeploy", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_reimage_request(resource_group_name: str, vm_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/reimage", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_restart_request(resource_group_name: str, vm_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/restart", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_retrieve_boot_diagnostics_data_request( # pylint: disable=name-too-long - resource_group_name: str, - vm_name: str, - subscription_id: str, - *, - sas_uri_expiration_time_in_minutes: Optional[int] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/retrieveBootDiagnosticsData", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if sas_uri_expiration_time_in_minutes is not None: - _params["sasUriExpirationTimeInMinutes"] = _SERIALIZER.query( - "sas_uri_expiration_time_in_minutes", sas_uri_expiration_time_in_minutes, "int" - ) - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_run_command_request( - resource_group_name: str, vm_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommand", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_simulate_eviction_request( - resource_group_name: str, vm_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/simulateEviction", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_start_request(resource_group_name: str, vm_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/start", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_available_sizes_request( - resource_group_name: str, vm_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/vmSizes", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class VirtualMachinesOperations: # pylint: disable=too-many-public-methods - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.compute.ComputeManagementClient`'s - :attr:`virtual_machines` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list_by_location(self, location: str, **kwargs: Any) -> ItemPaged["_models.VirtualMachine"]: - """Gets all the virtual machines under the specified subscription for the specified location. - - :param location: The name of Azure region. Required. - :type location: str - :return: An iterator like instance of either VirtualMachine or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.models.VirtualMachine] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[_models.VirtualMachineListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_by_location_request( - location=location, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - _request = HttpRequest("GET", next_link) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @distributed_trace - def list_all( - self, - status_only: Optional[str] = None, - filter: Optional[str] = None, - expand: Optional[Union[str, _models.ExpandTypesForListVMs]] = None, - **kwargs: Any - ) -> ItemPaged["_models.VirtualMachine"]: - """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 - :param expand: The expand expression to apply on operation. 'instanceView' enables fetching run - time status of all Virtual Machines, this can only be specified if a valid $filter option is - specified. "instanceView" Default value is None. - :type expand: str or ~azure.mgmt.compute.models.ExpandTypesForListVMs - :return: An iterator like instance of either VirtualMachine or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.models.VirtualMachine] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[_models.VirtualMachineListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_all_request( - subscription_id=self._config.subscription_id, - status_only=status_only, - filter=filter, - expand=expand, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - _request = HttpRequest("GET", next_link) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @distributed_trace - def list( - self, - resource_group_name: str, - filter: Optional[str] = None, - expand: Optional[Union[str, _models.ExpandTypeForListVMs]] = None, - **kwargs: Any - ) -> ItemPaged["_models.VirtualMachine"]: - """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. The name is case insensitive. - Required. - :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 - :param expand: The expand expression to apply on operation. 'instanceView' enables fetching run - time status of all Virtual Machines, this can only be specified if a valid $filter option is - specified. "instanceView" Default value is None. - :type expand: str or ~azure.mgmt.compute.models.ExpandTypeForListVMs - :return: An iterator like instance of either VirtualMachine or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.models.VirtualMachine] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[_models.VirtualMachineListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - filter=filter, - expand=expand, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - _request = HttpRequest("GET", next_link) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @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. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_name: The name of the virtual machine. Required. - :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. - Known values are: "instanceView", "userData", and "resiliencyView". Default value is None. - :type expand: str or ~azure.mgmt.compute.models.InstanceViewTypes - :return: VirtualMachine or the result of cls(response) - :rtype: ~azure.mgmt.compute.models.VirtualMachine - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[_models.VirtualMachine] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - vm_name=vm_name, - subscription_id=self._config.subscription_id, - expand=expand, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("VirtualMachine", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - vm_name: str, - parameters: Union[_models.VirtualMachine, IO[bytes]], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "VirtualMachine") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - vm_name=vm_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 201: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - vm_name: str, - parameters: _models.VirtualMachine, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - *, - content_type: str = "application/json", - **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. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_name: The name of the virtual machine. Required. - :type vm_name: str - :param parameters: Parameters supplied to the Create Virtual Machine operation. Required. - :type parameters: ~azure.mgmt.compute.models.VirtualMachine - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing record set. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either VirtualMachine or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.VirtualMachine] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - vm_name: str, - parameters: IO[bytes], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - *, - content_type: str = "application/json", - **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. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_name: The name of the virtual machine. Required. - :type vm_name: str - :param parameters: Parameters supplied to the Create Virtual Machine operation. Required. - :type parameters: IO[bytes] - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing record set. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either VirtualMachine or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.VirtualMachine] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - vm_name: str, - parameters: Union[_models.VirtualMachine, IO[bytes]], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **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. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_name: The name of the virtual machine. Required. - :type vm_name: str - :param parameters: Parameters supplied to the Create Virtual Machine operation. Is either a - VirtualMachine type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.compute.models.VirtualMachine or IO[bytes] - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing record set. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :return: An instance of LROPoller that returns either VirtualMachine or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.VirtualMachine] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.VirtualMachine] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._create_or_update_initial( - resource_group_name=resource_group_name, - vm_name=vm_name, - parameters=parameters, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("VirtualMachine", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.VirtualMachine].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.VirtualMachine]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _update_initial( - self, - resource_group_name: str, - vm_name: str, - parameters: Union[_models.VirtualMachineUpdate, IO[bytes]], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "VirtualMachineUpdate") - - _request = build_update_request( - resource_group_name=resource_group_name, - vm_name=vm_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update( - self, - resource_group_name: str, - vm_name: str, - parameters: _models.VirtualMachineUpdate, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.VirtualMachine]: - """The operation to update a virtual machine. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_name: The name of the virtual machine. Required. - :type vm_name: str - :param parameters: Parameters supplied to the Update Virtual Machine operation. Required. - :type parameters: ~azure.mgmt.compute.models.VirtualMachineUpdate - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing record set. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either VirtualMachine or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.VirtualMachine] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update( - self, - resource_group_name: str, - vm_name: str, - parameters: IO[bytes], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.VirtualMachine]: - """The operation to update a virtual machine. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_name: The name of the virtual machine. Required. - :type vm_name: str - :param parameters: Parameters supplied to the Update Virtual Machine operation. Required. - :type parameters: IO[bytes] - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing record set. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either VirtualMachine or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.VirtualMachine] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_update( - self, - resource_group_name: str, - vm_name: str, - parameters: Union[_models.VirtualMachineUpdate, IO[bytes]], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any - ) -> LROPoller[_models.VirtualMachine]: - """The operation to update a virtual machine. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_name: The name of the virtual machine. Required. - :type vm_name: str - :param parameters: Parameters supplied to the Update Virtual Machine operation. Is either a - VirtualMachineUpdate type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.compute.models.VirtualMachineUpdate or IO[bytes] - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing record set. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :return: An instance of LROPoller that returns either VirtualMachine or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.VirtualMachine] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.VirtualMachine] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._update_initial( - resource_group_name=resource_group_name, - vm_name=vm_name, - parameters=parameters, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - response_headers = {} - response = pipeline_response.http_response - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = self._deserialize("VirtualMachine", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.VirtualMachine].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.VirtualMachine]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, vm_name: str, force_deletion: Optional[bool] = None, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - vm_name=vm_name, - subscription_id=self._config.subscription_id, - force_deletion=force_deletion, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_delete( - 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. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_name: The name of the virtual machine. Required. - :type vm_name: str - :param force_deletion: Optional parameter to force delete virtual machines. Default value is - None. - :type force_deletion: bool - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - vm_name=vm_name, - force_deletion=force_deletion, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _assess_patches_initial(self, resource_group_name: str, vm_name: str, **kwargs: Any) -> Iterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_assess_patches_request( - resource_group_name=resource_group_name, - vm_name=vm_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # 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. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_name: The name of the virtual machine. Required. - :type vm_name: str - :return: An instance of LROPoller that returns either VirtualMachineAssessPatchesResult or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.VirtualMachineAssessPatchesResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[_models.VirtualMachineAssessPatchesResult] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._assess_patches_initial( - resource_group_name=resource_group_name, - vm_name=vm_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("VirtualMachineAssessPatchesResult", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.VirtualMachineAssessPatchesResult].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.VirtualMachineAssessPatchesResult]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _attach_detach_data_disks_initial( - self, - resource_group_name: str, - vm_name: str, - parameters: Union[_models.AttachDetachDataDisksRequest, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "AttachDetachDataDisksRequest") - - _request = build_attach_detach_data_disks_request( - 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, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_attach_detach_data_disks( - self, - resource_group_name: str, - vm_name: str, - parameters: _models.AttachDetachDataDisksRequest, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.StorageProfile]: - """Attach and detach data disks to/from the virtual machine. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_name: The name of the virtual machine. Required. - :type vm_name: str - :param parameters: Parameters supplied to the attach and detach data disks operation on the - virtual machine. Required. - :type parameters: ~azure.mgmt.compute.models.AttachDetachDataDisksRequest - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either StorageProfile or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.StorageProfile] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_attach_detach_data_disks( - self, - resource_group_name: str, - vm_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.StorageProfile]: - """Attach and detach data disks to/from the virtual machine. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_name: The name of the virtual machine. Required. - :type vm_name: str - :param parameters: Parameters supplied to the attach and detach data disks operation on the - virtual machine. Required. - :type parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either StorageProfile or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.StorageProfile] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_attach_detach_data_disks( - self, - resource_group_name: str, - vm_name: str, - parameters: Union[_models.AttachDetachDataDisksRequest, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.StorageProfile]: - """Attach and detach data disks to/from the virtual machine. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_name: The name of the virtual machine. Required. - :type vm_name: str - :param parameters: Parameters supplied to the attach and detach data disks operation on the - virtual machine. Is either a AttachDetachDataDisksRequest type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.compute.models.AttachDetachDataDisksRequest or IO[bytes] - :return: An instance of LROPoller that returns either StorageProfile or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.StorageProfile] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.StorageProfile] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._attach_detach_data_disks_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, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("StorageProfile", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.StorageProfile].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.StorageProfile]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _capture_initial( - self, - resource_group_name: str, - vm_name: str, - parameters: Union[_models.VirtualMachineCaptureParameters, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "VirtualMachineCaptureParameters") - - _request = build_capture_request( - 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, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_capture( - self, - resource_group_name: str, - vm_name: str, - parameters: _models.VirtualMachineCaptureParameters, - *, - content_type: str = "application/json", - **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. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_name: The name of the virtual machine. Required. - :type vm_name: str - :param parameters: Parameters supplied to the Capture Virtual Machine operation. Required. - :type parameters: ~azure.mgmt.compute.models.VirtualMachineCaptureParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either VirtualMachineCaptureResult or the result - of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.VirtualMachineCaptureResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_capture( - self, - resource_group_name: str, - vm_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **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. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_name: The name of the virtual machine. Required. - :type vm_name: str - :param parameters: Parameters supplied to the Capture Virtual Machine operation. Required. - :type parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either VirtualMachineCaptureResult or the result - of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.VirtualMachineCaptureResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_capture( - self, - resource_group_name: str, - vm_name: str, - parameters: Union[_models.VirtualMachineCaptureParameters, IO[bytes]], - **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. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_name: The name of the virtual machine. Required. - :type vm_name: str - :param parameters: Parameters supplied to the Capture Virtual Machine operation. Is either a - VirtualMachineCaptureParameters type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.compute.models.VirtualMachineCaptureParameters or IO[bytes] - :return: An instance of LROPoller that returns either VirtualMachineCaptureResult or the result - of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.VirtualMachineCaptureResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.VirtualMachineCaptureResult] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._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, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("VirtualMachineCaptureResult", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.VirtualMachineCaptureResult].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.VirtualMachineCaptureResult]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _convert_to_managed_disks_initial( - self, resource_group_name: str, vm_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_convert_to_managed_disks_request( - resource_group_name=resource_group_name, - vm_name=vm_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_convert_to_managed_disks(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. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_name: The name of the virtual machine. Required. - :type vm_name: str - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._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, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _deallocate_initial( - self, resource_group_name: str, vm_name: str, hibernate: Optional[bool] = None, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_deallocate_request( - resource_group_name=resource_group_name, - vm_name=vm_name, - subscription_id=self._config.subscription_id, - hibernate=hibernate, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_deallocate( - 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. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_name: The name of the virtual machine. Required. - :type vm_name: str - :param hibernate: Optional parameter to hibernate a virtual machine. Default value is None. - :type hibernate: bool - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._deallocate_initial( - resource_group_name=resource_group_name, - vm_name=vm_name, - hibernate=hibernate, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # 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. For Windows, please refer to `Create a - managed image of a generalized VM in Azure - `_. 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. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_name: The name of the virtual machine. Required. - :type vm_name: str - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_generalize_request( - resource_group_name=resource_group_name, - vm_name=vm_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - def _install_patches_initial( - self, - resource_group_name: str, - vm_name: str, - install_patches_input: Union[_models.VirtualMachineInstallPatchesParameters, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(install_patches_input, (IOBase, bytes)): - _content = install_patches_input - else: - _json = self._serialize.body(install_patches_input, "VirtualMachineInstallPatchesParameters") - - _request = build_install_patches_request( - resource_group_name=resource_group_name, - vm_name=vm_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_install_patches( - self, - resource_group_name: str, - vm_name: str, - install_patches_input: _models.VirtualMachineInstallPatchesParameters, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.VirtualMachineInstallPatchesResult]: - """Installs patches on the VM. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_name: The name of the virtual machine. Required. - :type vm_name: str - :param install_patches_input: Input for InstallPatches as directly received by the API. - Required. - :type install_patches_input: ~azure.mgmt.compute.models.VirtualMachineInstallPatchesParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either VirtualMachineInstallPatchesResult or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.VirtualMachineInstallPatchesResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_install_patches( - self, - resource_group_name: str, - vm_name: str, - install_patches_input: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.VirtualMachineInstallPatchesResult]: - """Installs patches on the VM. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_name: The name of the virtual machine. Required. - :type vm_name: str - :param install_patches_input: Input for InstallPatches as directly received by the API. - Required. - :type install_patches_input: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either VirtualMachineInstallPatchesResult or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.VirtualMachineInstallPatchesResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_install_patches( - self, - resource_group_name: str, - vm_name: str, - install_patches_input: Union[_models.VirtualMachineInstallPatchesParameters, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.VirtualMachineInstallPatchesResult]: - """Installs patches on the VM. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_name: The name of the virtual machine. Required. - :type vm_name: str - :param install_patches_input: Input for InstallPatches as directly received by the API. Is - either a VirtualMachineInstallPatchesParameters type or a IO[bytes] type. Required. - :type install_patches_input: ~azure.mgmt.compute.models.VirtualMachineInstallPatchesParameters - or IO[bytes] - :return: An instance of LROPoller that returns either VirtualMachineInstallPatchesResult or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.VirtualMachineInstallPatchesResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.VirtualMachineInstallPatchesResult] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._install_patches_initial( - resource_group_name=resource_group_name, - vm_name=vm_name, - install_patches_input=install_patches_input, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("VirtualMachineInstallPatchesResult", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.VirtualMachineInstallPatchesResult].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.VirtualMachineInstallPatchesResult]( - self._client, raw_result, get_long_running_output, polling_method # 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. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_name: The name of the virtual machine. Required. - :type vm_name: str - :return: VirtualMachineInstanceView or the result of cls(response) - :rtype: ~azure.mgmt.compute.models.VirtualMachineInstanceView - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[_models.VirtualMachineInstanceView] = kwargs.pop("cls", None) - - _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, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("VirtualMachineInstanceView", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _migrate_to_vm_scale_set_initial( - self, - resource_group_name: str, - vm_name: str, - parameters: Optional[Union[_models.MigrateVMToVirtualMachineScaleSetInput, IO[bytes]]] = None, - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - content_type = content_type if parameters else None - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" if parameters else None - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - if parameters is not None: - _json = self._serialize.body(parameters, "MigrateVMToVirtualMachineScaleSetInput") - else: - _json = None - - _request = build_migrate_to_vm_scale_set_request( - 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, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [202]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_migrate_to_vm_scale_set( - self, - resource_group_name: str, - vm_name: str, - parameters: Optional[_models.MigrateVMToVirtualMachineScaleSetInput] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[None]: - """Migrate a virtual machine from availability set to Flexible Virtual Machine Scale Set. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_name: The name of the virtual machine. Required. - :type vm_name: str - :param parameters: Parameters supplied to the Migrate Virtual Machine operation. Default value - is None. - :type parameters: ~azure.mgmt.compute.models.MigrateVMToVirtualMachineScaleSetInput - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_migrate_to_vm_scale_set( - self, - resource_group_name: str, - vm_name: str, - parameters: Optional[IO[bytes]] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[None]: - """Migrate a virtual machine from availability set to Flexible Virtual Machine Scale Set. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_name: The name of the virtual machine. Required. - :type vm_name: str - :param parameters: Parameters supplied to the Migrate Virtual Machine operation. Default value - is None. - :type parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_migrate_to_vm_scale_set( - self, - resource_group_name: str, - vm_name: str, - parameters: Optional[Union[_models.MigrateVMToVirtualMachineScaleSetInput, IO[bytes]]] = None, - **kwargs: Any - ) -> LROPoller[None]: - """Migrate a virtual machine from availability set to Flexible Virtual Machine Scale Set. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_name: The name of the virtual machine. Required. - :type vm_name: str - :param parameters: Parameters supplied to the Migrate Virtual Machine operation. Is either a - MigrateVMToVirtualMachineScaleSetInput type or a IO[bytes] type. Default value is None. - :type parameters: ~azure.mgmt.compute.models.MigrateVMToVirtualMachineScaleSetInput or - IO[bytes] - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - content_type = content_type if parameters else None - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._migrate_to_vm_scale_set_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, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _perform_maintenance_initial(self, resource_group_name: str, vm_name: str, **kwargs: Any) -> Iterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_perform_maintenance_request( - resource_group_name=resource_group_name, - vm_name=vm_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_perform_maintenance(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. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_name: The name of the virtual machine. Required. - :type vm_name: str - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._perform_maintenance_initial( - resource_group_name=resource_group_name, - vm_name=vm_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _power_off_initial( - self, resource_group_name: str, vm_name: str, skip_shutdown: Optional[bool] = None, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_power_off_request( - resource_group_name=resource_group_name, - vm_name=vm_name, - subscription_id=self._config.subscription_id, - skip_shutdown=skip_shutdown, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_power_off( - self, resource_group_name: str, vm_name: str, skip_shutdown: Optional[bool] = None, **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. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_name: The name of the virtual machine. Required. - :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 None. - :type skip_shutdown: bool - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._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, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _reapply_initial(self, resource_group_name: str, vm_name: str, **kwargs: Any) -> Iterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_reapply_request( - resource_group_name=resource_group_name, - vm_name=vm_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_reapply(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. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_name: The name of the virtual machine. Required. - :type vm_name: str - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._reapply_initial( - resource_group_name=resource_group_name, - vm_name=vm_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _redeploy_initial(self, resource_group_name: str, vm_name: str, **kwargs: Any) -> Iterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_redeploy_request( - resource_group_name=resource_group_name, - vm_name=vm_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_redeploy(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. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_name: The name of the virtual machine. Required. - :type vm_name: str - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._redeploy_initial( - resource_group_name=resource_group_name, - vm_name=vm_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _reimage_initial( - self, - resource_group_name: str, - vm_name: str, - parameters: Optional[Union[_models.VirtualMachineReimageParameters, IO[bytes]]] = None, - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - content_type = content_type if parameters else None - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" if parameters else None - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - if parameters is not None: - _json = self._serialize.body(parameters, "VirtualMachineReimageParameters") - else: - _json = None - - _request = build_reimage_request( - 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, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_reimage( - self, - resource_group_name: str, - vm_name: str, - parameters: Optional[_models.VirtualMachineReimageParameters] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[None]: - """Reimages (upgrade the operating system) a virtual machine 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. NOTE: The retaining of old OS disk depends on the value of deleteOption of OS disk. If - deleteOption is detach, the old OS disk will be preserved after reimage. If deleteOption is - delete, the old OS disk will be deleted after reimage. The deleteOption of the OS disk should - be updated accordingly before performing the reimage. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_name: The name of the virtual machine. Required. - :type vm_name: str - :param parameters: Parameters supplied to the Reimage Virtual Machine operation. Default value - is None. - :type parameters: ~azure.mgmt.compute.models.VirtualMachineReimageParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_reimage( - self, - resource_group_name: str, - vm_name: str, - parameters: Optional[IO[bytes]] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[None]: - """Reimages (upgrade the operating system) a virtual machine 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. NOTE: The retaining of old OS disk depends on the value of deleteOption of OS disk. If - deleteOption is detach, the old OS disk will be preserved after reimage. If deleteOption is - delete, the old OS disk will be deleted after reimage. The deleteOption of the OS disk should - be updated accordingly before performing the reimage. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_name: The name of the virtual machine. Required. - :type vm_name: str - :param parameters: Parameters supplied to the Reimage Virtual Machine operation. Default value - is None. - :type parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_reimage( - self, - resource_group_name: str, - vm_name: str, - parameters: Optional[Union[_models.VirtualMachineReimageParameters, IO[bytes]]] = None, - **kwargs: Any - ) -> LROPoller[None]: - """Reimages (upgrade the operating system) a virtual machine 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. NOTE: The retaining of old OS disk depends on the value of deleteOption of OS disk. If - deleteOption is detach, the old OS disk will be preserved after reimage. If deleteOption is - delete, the old OS disk will be deleted after reimage. The deleteOption of the OS disk should - be updated accordingly before performing the reimage. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_name: The name of the virtual machine. Required. - :type vm_name: str - :param parameters: Parameters supplied to the Reimage Virtual Machine operation. Is either a - VirtualMachineReimageParameters type or a IO[bytes] type. Default value is None. - :type parameters: ~azure.mgmt.compute.models.VirtualMachineReimageParameters or IO[bytes] - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - content_type = content_type if parameters else None - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._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, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _restart_initial(self, resource_group_name: str, vm_name: str, **kwargs: Any) -> Iterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_restart_request( - resource_group_name=resource_group_name, - vm_name=vm_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_restart(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. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_name: The name of the virtual machine. Required. - :type vm_name: str - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._restart_initial( - resource_group_name=resource_group_name, - vm_name=vm_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # 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. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_name: The name of the virtual machine. Required. - :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. **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 - :return: RetrieveBootDiagnosticsDataResult or the result of cls(response) - :rtype: ~azure.mgmt.compute.models.RetrieveBootDiagnosticsDataResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[_models.RetrieveBootDiagnosticsDataResult] = kwargs.pop("cls", None) - - _request = build_retrieve_boot_diagnostics_data_request( - resource_group_name=resource_group_name, - vm_name=vm_name, - subscription_id=self._config.subscription_id, - sas_uri_expiration_time_in_minutes=sas_uri_expiration_time_in_minutes, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("RetrieveBootDiagnosticsDataResult", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _run_command_initial( - self, - resource_group_name: str, - vm_name: str, - parameters: Union[_models.RunCommandInput, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "RunCommandInput") - - _request = build_run_command_request( - 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, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_run_command( - self, - resource_group_name: str, - vm_name: str, - parameters: _models.RunCommandInput, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.RunCommandResult]: - """Run command on the VM. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_name: The name of the virtual machine. Required. - :type vm_name: str - :param parameters: Parameters supplied to the Run command operation. Required. - :type parameters: ~azure.mgmt.compute.models.RunCommandInput - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either RunCommandResult or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.RunCommandResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_run_command( - self, - resource_group_name: str, - vm_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.RunCommandResult]: - """Run command on the VM. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_name: The name of the virtual machine. Required. - :type vm_name: str - :param parameters: Parameters supplied to the Run command operation. Required. - :type parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either RunCommandResult or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.RunCommandResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_run_command( - self, - resource_group_name: str, - vm_name: str, - parameters: Union[_models.RunCommandInput, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.RunCommandResult]: - """Run command on the VM. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_name: The name of the virtual machine. Required. - :type vm_name: str - :param parameters: Parameters supplied to the Run command operation. Is either a - RunCommandInput type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.compute.models.RunCommandInput or IO[bytes] - :return: An instance of LROPoller that returns either RunCommandResult or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.RunCommandResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.RunCommandResult] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._run_command_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, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("RunCommandResult", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.RunCommandResult].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.RunCommandResult]( - self._client, raw_result, get_long_running_output, polling_method # 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. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_name: The name of the virtual machine. Required. - :type vm_name: str - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - - _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, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [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, {}) # type: ignore - - def _start_initial(self, resource_group_name: str, vm_name: str, **kwargs: Any) -> Iterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_start_request( - resource_group_name=resource_group_name, - vm_name=vm_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_start(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. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_name: The name of the virtual machine. Required. - :type vm_name: str - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._start_initial( - resource_group_name=resource_group_name, - vm_name=vm_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list_available_sizes( - self, resource_group_name: str, vm_name: str, **kwargs: Any - ) -> ItemPaged["_models.VirtualMachineSize"]: - """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. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_name: The name of the virtual machine. Required. - :type vm_name: str - :return: An iterator like instance of either VirtualMachineSize or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.models.VirtualMachineSize] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - cls: ClsType[_models.VirtualMachineSizeListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_available_sizes_request( - resource_group_name=resource_group_name, - vm_name=vm_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - _request = HttpRequest("GET", next_link) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/availability_set_examples/availability_set_cancel_migration_to_virtual_machine_scale_set.py b/sdk/compute/azure-mgmt-compute/generated_samples/availability_set_examples/availability_set_cancel_migration_to_virtual_machine_scale_set.py deleted file mode 100644 index 379805cdd6bc..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/availability_set_examples/availability_set_cancel_migration_to_virtual_machine_scale_set.py +++ /dev/null @@ -1,42 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python availability_set_cancel_migration_to_virtual_machine_scale_set.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - client.availability_sets.cancel_migration_to_virtual_machine_scale_set( - resource_group_name="rgcompute", - availability_set_name="myAvailabilitySet", - ) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/availabilitySetExamples/AvailabilitySet_CancelMigrationToVirtualMachineScaleSet.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/availability_set_examples/availability_set_convert_to_virtual_machine_scale_set.py b/sdk/compute/azure-mgmt-compute/generated_samples/availability_set_examples/availability_set_convert_to_virtual_machine_scale_set.py deleted file mode 100644 index 905aa88d9d61..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/availability_set_examples/availability_set_convert_to_virtual_machine_scale_set.py +++ /dev/null @@ -1,42 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python availability_set_convert_to_virtual_machine_scale_set.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - client.availability_sets.begin_convert_to_virtual_machine_scale_set( - resource_group_name="rgcompute", - availability_set_name="myAvailabilitySet", - ).result() - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/availabilitySetExamples/AvailabilitySet_ConvertToVirtualMachineScaleSet.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/availability_set_examples/availability_set_create.py b/sdk/compute/azure-mgmt-compute/generated_samples/availability_set_examples/availability_set_create.py deleted file mode 100644 index e8492489e5c4..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/availability_set_examples/availability_set_create.py +++ /dev/null @@ -1,47 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python availability_set_create.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.availability_sets.create_or_update( - resource_group_name="myResourceGroup", - availability_set_name="myAvailabilitySet", - parameters={ - "location": "westus", - "properties": {"platformFaultDomainCount": 2, "platformUpdateDomainCount": 20}, - }, - ) - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/availabilitySetExamples/AvailabilitySet_Create.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/availability_set_examples/availability_set_create_with_scheduled_event_profile.py b/sdk/compute/azure-mgmt-compute/generated_samples/availability_set_examples/availability_set_create_with_scheduled_event_profile.py deleted file mode 100644 index 0eb1ca8a201f..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/availability_set_examples/availability_set_create_with_scheduled_event_profile.py +++ /dev/null @@ -1,47 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python availability_set_create_with_scheduled_event_profile.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.availability_sets.create_or_update( - resource_group_name="myResourceGroup", - availability_set_name="myAvailabilitySet", - parameters={ - "location": "westus", - "properties": {"platformFaultDomainCount": 2, "platformUpdateDomainCount": 20}, - }, - ) - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/availabilitySetExamples/AvailabilitySet_Create_WithScheduledEventProfile.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/availability_set_examples/availability_set_delete_maximum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/availability_set_examples/availability_set_delete_maximum_set_gen.py deleted file mode 100644 index 47e8e027f0c0..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/availability_set_examples/availability_set_delete_maximum_set_gen.py +++ /dev/null @@ -1,42 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python availability_set_delete_maximum_set_gen.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - client.availability_sets.delete( - resource_group_name="rgcompute", - availability_set_name="aaaaaaaaaaaaaaaaaaaa", - ) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/availabilitySetExamples/AvailabilitySet_Delete_MaximumSet_Gen.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/availability_set_examples/availability_set_delete_minimum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/availability_set_examples/availability_set_delete_minimum_set_gen.py deleted file mode 100644 index f23da5f67d17..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/availability_set_examples/availability_set_delete_minimum_set_gen.py +++ /dev/null @@ -1,42 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python availability_set_delete_minimum_set_gen.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - client.availability_sets.delete( - resource_group_name="rgcompute", - availability_set_name="aaaaaaaaaaa", - ) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/availabilitySetExamples/AvailabilitySet_Delete_MinimumSet_Gen.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/availability_set_examples/availability_set_get_maximum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/availability_set_examples/availability_set_get_maximum_set_gen.py deleted file mode 100644 index 83cb00570c6b..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/availability_set_examples/availability_set_get_maximum_set_gen.py +++ /dev/null @@ -1,43 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python availability_set_get_maximum_set_gen.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.availability_sets.get( - resource_group_name="rgcompute", - availability_set_name="aaaaaaaaaaaa", - ) - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/availabilitySetExamples/AvailabilitySet_Get_MaximumSet_Gen.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/availability_set_examples/availability_set_get_minimum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/availability_set_examples/availability_set_get_minimum_set_gen.py deleted file mode 100644 index 0b1ccbb960b7..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/availability_set_examples/availability_set_get_minimum_set_gen.py +++ /dev/null @@ -1,43 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python availability_set_get_minimum_set_gen.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.availability_sets.get( - resource_group_name="rgcompute", - availability_set_name="aaaaaaaaaaaaaaaaaaaa", - ) - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/availabilitySetExamples/AvailabilitySet_Get_MinimumSet_Gen.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/availability_set_examples/availability_set_list_available_sizes_maximum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/availability_set_examples/availability_set_list_available_sizes_maximum_set_gen.py deleted file mode 100644 index d301392d67b8..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/availability_set_examples/availability_set_list_available_sizes_maximum_set_gen.py +++ /dev/null @@ -1,44 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python availability_set_list_available_sizes_maximum_set_gen.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.availability_sets.list_available_sizes( - resource_group_name="rgcompute", - availability_set_name="aaaaaaaaaaaaaaaaaaaa", - ) - for item in response: - print(item) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/availabilitySetExamples/AvailabilitySet_ListAvailableSizes_MaximumSet_Gen.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/availability_set_examples/availability_set_list_available_sizes_minimum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/availability_set_examples/availability_set_list_available_sizes_minimum_set_gen.py deleted file mode 100644 index e1d9b1ff73b3..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/availability_set_examples/availability_set_list_available_sizes_minimum_set_gen.py +++ /dev/null @@ -1,44 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python availability_set_list_available_sizes_minimum_set_gen.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.availability_sets.list_available_sizes( - resource_group_name="rgcompute", - availability_set_name="aa", - ) - for item in response: - print(item) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/availabilitySetExamples/AvailabilitySet_ListAvailableSizes_MinimumSet_Gen.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/availability_set_examples/availability_set_list_by_subscription.py b/sdk/compute/azure-mgmt-compute/generated_samples/availability_set_examples/availability_set_list_by_subscription.py deleted file mode 100644 index 9357479910a9..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/availability_set_examples/availability_set_list_by_subscription.py +++ /dev/null @@ -1,41 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python availability_set_list_by_subscription.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscriptionId}", - ) - - response = client.availability_sets.list_by_subscription() - for item in response: - print(item) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/availabilitySetExamples/AvailabilitySet_ListBySubscription.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/availability_set_examples/availability_set_list_maximum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/availability_set_examples/availability_set_list_maximum_set_gen.py deleted file mode 100644 index 0440450457b9..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/availability_set_examples/availability_set_list_maximum_set_gen.py +++ /dev/null @@ -1,43 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python availability_set_list_maximum_set_gen.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.availability_sets.list( - resource_group_name="rgcompute", - ) - for item in response: - print(item) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/availabilitySetExamples/AvailabilitySet_List_MaximumSet_Gen.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/availability_set_examples/availability_set_list_minimum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/availability_set_examples/availability_set_list_minimum_set_gen.py deleted file mode 100644 index 75ef82d7ed6e..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/availability_set_examples/availability_set_list_minimum_set_gen.py +++ /dev/null @@ -1,43 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python availability_set_list_minimum_set_gen.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.availability_sets.list( - resource_group_name="rgcompute", - ) - for item in response: - print(item) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/availabilitySetExamples/AvailabilitySet_List_MinimumSet_Gen.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/availability_set_examples/availability_set_start_migration_to_virtual_machine_scale_set.py b/sdk/compute/azure-mgmt-compute/generated_samples/availability_set_examples/availability_set_start_migration_to_virtual_machine_scale_set.py deleted file mode 100644 index 12bc0313ade0..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/availability_set_examples/availability_set_start_migration_to_virtual_machine_scale_set.py +++ /dev/null @@ -1,47 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python availability_set_start_migration_to_virtual_machine_scale_set.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - client.availability_sets.start_migration_to_virtual_machine_scale_set( - resource_group_name="rgcompute", - availability_set_name="myAvailabilitySet", - parameters={ - "virtualMachineScaleSetFlexible": { - "id": "/subscriptions/{subscription-id}/resourceGroups/rgcompute/providers/Microsoft.Compute/virtualMachineScaleSets/{vmss-name}" - } - }, - ) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/availabilitySetExamples/AvailabilitySet_StartMigrationToVirtualMachineScaleSet.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/availability_set_examples/availability_set_update_maximum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/availability_set_examples/availability_set_update_maximum_set_gen.py deleted file mode 100644 index 1b7e09c6926a..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/availability_set_examples/availability_set_update_maximum_set_gen.py +++ /dev/null @@ -1,59 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python availability_set_update_maximum_set_gen.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.availability_sets.update( - resource_group_name="rgcompute", - availability_set_name="aaaaaaaaaaaaaaaaaaa", - parameters={ - "properties": { - "platformFaultDomainCount": 2, - "platformUpdateDomainCount": 20, - "proximityPlacementGroup": { - "id": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}" - }, - "virtualMachines": [ - { - "id": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}" - } - ], - }, - "sku": {"capacity": 7, "name": "DSv3-Type1", "tier": "aaa"}, - "tags": {"key2574": "aaaaaaaa"}, - }, - ) - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/availabilitySetExamples/AvailabilitySet_Update_MaximumSet_Gen.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/availability_set_examples/availability_set_validate_migration_to_virtual_machine_scale_set.py b/sdk/compute/azure-mgmt-compute/generated_samples/availability_set_examples/availability_set_validate_migration_to_virtual_machine_scale_set.py deleted file mode 100644 index d2ba73a57f25..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/availability_set_examples/availability_set_validate_migration_to_virtual_machine_scale_set.py +++ /dev/null @@ -1,47 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python availability_set_validate_migration_to_virtual_machine_scale_set.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - client.availability_sets.validate_migration_to_virtual_machine_scale_set( - resource_group_name="rgcompute", - availability_set_name="myAvailabilitySet", - parameters={ - "virtualMachineScaleSetFlexible": { - "id": "/subscriptions/{subscription-id}/resourceGroups/rgcompute/providers/Microsoft.Compute/virtualMachineScaleSets/{vmss-name}" - } - }, - ) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/availabilitySetExamples/AvailabilitySet_ValidateMigrationToVirtualMachineScaleSet.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/capacity_reservation_examples/block_capacity_reservation_create_or_update.py b/sdk/compute/azure-mgmt-compute/generated_samples/capacity_reservation_examples/block_capacity_reservation_create_or_update.py deleted file mode 100644 index 446666269306..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/capacity_reservation_examples/block_capacity_reservation_create_or_update.py +++ /dev/null @@ -1,51 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python block_capacity_reservation_create_or_update.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.capacity_reservations.begin_create_or_update( - resource_group_name="myResourceGroup", - capacity_reservation_group_name="blockCapacityReservationGroup", - capacity_reservation_name="blockCapacityReservation", - parameters={ - "location": "westus", - "properties": {"scheduleProfile": {"end": "2025-08-02", "start": "2025-08-01"}}, - "sku": {"capacity": 1, "name": "Standard_ND96isr_H100_v5"}, - "tags": {"department": "HR"}, - "zones": ["1"], - }, - ).result() - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/capacityReservationExamples/BlockCapacityReservation_CreateOrUpdate.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/capacity_reservation_examples/block_capacity_reservation_get.py b/sdk/compute/azure-mgmt-compute/generated_samples/capacity_reservation_examples/block_capacity_reservation_get.py deleted file mode 100644 index 174ef030273b..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/capacity_reservation_examples/block_capacity_reservation_get.py +++ /dev/null @@ -1,44 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python block_capacity_reservation_get.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscriptionId}", - ) - - response = client.capacity_reservations.get( - resource_group_name="myResourceGroup", - capacity_reservation_group_name="blockCapacityReservationGroup", - capacity_reservation_name="blockCapacityReservation", - ) - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/capacityReservationExamples/BlockCapacityReservation_Get.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/capacity_reservation_examples/block_capacity_reservation_group_create_or_update.py b/sdk/compute/azure-mgmt-compute/generated_samples/capacity_reservation_examples/block_capacity_reservation_group_create_or_update.py deleted file mode 100644 index c964d99ce516..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/capacity_reservation_examples/block_capacity_reservation_group_create_or_update.py +++ /dev/null @@ -1,49 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python block_capacity_reservation_group_create_or_update.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.capacity_reservation_groups.create_or_update( - resource_group_name="myResourceGroup", - capacity_reservation_group_name="blockCapacityReservationGroup", - parameters={ - "location": "westus", - "properties": {"reservationType": "Block"}, - "tags": {"department": "finance"}, - "zones": ["1", "2"], - }, - ) - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/capacityReservationExamples/BlockCapacityReservationGroup_CreateOrUpdate.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/capacity_reservation_examples/block_capacity_reservation_group_get.py b/sdk/compute/azure-mgmt-compute/generated_samples/capacity_reservation_examples/block_capacity_reservation_group_get.py deleted file mode 100644 index 6f96e2dedc5c..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/capacity_reservation_examples/block_capacity_reservation_group_get.py +++ /dev/null @@ -1,43 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python block_capacity_reservation_group_get.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscriptionId}", - ) - - response = client.capacity_reservation_groups.get( - resource_group_name="myResourceGroup", - capacity_reservation_group_name="blockCapacityReservationGroup", - ) - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/capacityReservationExamples/BlockCapacityReservationGroup_Get.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/capacity_reservation_examples/block_capacity_reservation_list_by_reservation_group.py b/sdk/compute/azure-mgmt-compute/generated_samples/capacity_reservation_examples/block_capacity_reservation_list_by_reservation_group.py deleted file mode 100644 index 6450084d2346..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/capacity_reservation_examples/block_capacity_reservation_list_by_reservation_group.py +++ /dev/null @@ -1,44 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python block_capacity_reservation_list_by_reservation_group.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.capacity_reservations.list_by_capacity_reservation_group( - resource_group_name="myResourceGroup", - capacity_reservation_group_name="blockCapacityReservationGroup", - ) - for item in response: - print(item) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/capacityReservationExamples/BlockCapacityReservation_ListByReservationGroup.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/capacity_reservation_examples/capacity_reservation_create_or_update.py b/sdk/compute/azure-mgmt-compute/generated_samples/capacity_reservation_examples/capacity_reservation_create_or_update.py deleted file mode 100644 index 86f9a0139fa4..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/capacity_reservation_examples/capacity_reservation_create_or_update.py +++ /dev/null @@ -1,50 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python capacity_reservation_create_or_update.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.capacity_reservations.begin_create_or_update( - resource_group_name="myResourceGroup", - capacity_reservation_group_name="myCapacityReservationGroup", - capacity_reservation_name="myCapacityReservation", - parameters={ - "location": "westus", - "sku": {"capacity": 4, "name": "Standard_DS1_v2"}, - "tags": {"department": "HR"}, - "zones": ["1"], - }, - ).result() - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/capacityReservationExamples/CapacityReservation_CreateOrUpdate.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/capacity_reservation_examples/capacity_reservation_delete_maximum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/capacity_reservation_examples/capacity_reservation_delete_maximum_set_gen.py deleted file mode 100644 index f8e7c3d4feb8..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/capacity_reservation_examples/capacity_reservation_delete_maximum_set_gen.py +++ /dev/null @@ -1,43 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python capacity_reservation_delete_maximum_set_gen.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - client.capacity_reservations.begin_delete( - resource_group_name="rgcompute", - capacity_reservation_group_name="aaaaaaaaaaa", - capacity_reservation_name="aaaaaaaaaaaaaaaaaaaaaaaaaaa", - ).result() - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/capacityReservationExamples/CapacityReservation_Delete_MaximumSet_Gen.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/capacity_reservation_examples/capacity_reservation_delete_minimum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/capacity_reservation_examples/capacity_reservation_delete_minimum_set_gen.py deleted file mode 100644 index a9b78a515be1..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/capacity_reservation_examples/capacity_reservation_delete_minimum_set_gen.py +++ /dev/null @@ -1,43 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python capacity_reservation_delete_minimum_set_gen.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - client.capacity_reservations.begin_delete( - resource_group_name="rgcompute", - capacity_reservation_group_name="aaa", - capacity_reservation_name="aaaaaa", - ).result() - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/capacityReservationExamples/CapacityReservation_Delete_MinimumSet_Gen.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/capacity_reservation_examples/capacity_reservation_get.py b/sdk/compute/azure-mgmt-compute/generated_samples/capacity_reservation_examples/capacity_reservation_get.py deleted file mode 100644 index 4abdb9c18fa5..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/capacity_reservation_examples/capacity_reservation_get.py +++ /dev/null @@ -1,44 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python capacity_reservation_get.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscriptionId}", - ) - - response = client.capacity_reservations.get( - resource_group_name="myResourceGroup", - capacity_reservation_group_name="myCapacityReservationGroup", - capacity_reservation_name="myCapacityReservation", - ) - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/capacityReservationExamples/CapacityReservation_Get.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/capacity_reservation_examples/capacity_reservation_group_create_or_update.py b/sdk/compute/azure-mgmt-compute/generated_samples/capacity_reservation_examples/capacity_reservation_group_create_or_update.py deleted file mode 100644 index 694bd06edade..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/capacity_reservation_examples/capacity_reservation_group_create_or_update.py +++ /dev/null @@ -1,56 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python capacity_reservation_group_create_or_update.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.capacity_reservation_groups.create_or_update( - resource_group_name="myResourceGroup", - capacity_reservation_group_name="myCapacityReservationGroup", - parameters={ - "location": "westus", - "properties": { - "sharingProfile": { - "subscriptionIds": [ - {"id": "/subscriptions/{subscription-id1}"}, - {"id": "/subscriptions/{subscription-id2}"}, - ] - } - }, - "tags": {"department": "finance"}, - "zones": ["1", "2"], - }, - ) - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/capacityReservationExamples/CapacityReservationGroup_CreateOrUpdate.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/capacity_reservation_examples/capacity_reservation_group_delete_maximum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/capacity_reservation_examples/capacity_reservation_group_delete_maximum_set_gen.py deleted file mode 100644 index 7b2f38495c69..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/capacity_reservation_examples/capacity_reservation_group_delete_maximum_set_gen.py +++ /dev/null @@ -1,42 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python capacity_reservation_group_delete_maximum_set_gen.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - client.capacity_reservation_groups.delete( - resource_group_name="rgcompute", - capacity_reservation_group_name="a", - ) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/capacityReservationExamples/CapacityReservationGroup_Delete_MaximumSet_Gen.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/capacity_reservation_examples/capacity_reservation_group_delete_minimum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/capacity_reservation_examples/capacity_reservation_group_delete_minimum_set_gen.py deleted file mode 100644 index 3386cbfbd642..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/capacity_reservation_examples/capacity_reservation_group_delete_minimum_set_gen.py +++ /dev/null @@ -1,42 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python capacity_reservation_group_delete_minimum_set_gen.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - client.capacity_reservation_groups.delete( - resource_group_name="rgcompute", - capacity_reservation_group_name="aaaaaaaaaaaaaaaaaaaaaaaaaa", - ) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/capacityReservationExamples/CapacityReservationGroup_Delete_MinimumSet_Gen.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/capacity_reservation_examples/capacity_reservation_group_get.py b/sdk/compute/azure-mgmt-compute/generated_samples/capacity_reservation_examples/capacity_reservation_group_get.py deleted file mode 100644 index ce8e403eea51..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/capacity_reservation_examples/capacity_reservation_group_get.py +++ /dev/null @@ -1,43 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python capacity_reservation_group_get.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscriptionId}", - ) - - response = client.capacity_reservation_groups.get( - resource_group_name="myResourceGroup", - capacity_reservation_group_name="myCapacityReservationGroup", - ) - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/capacityReservationExamples/CapacityReservationGroup_Get.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/capacity_reservation_examples/capacity_reservation_group_list_by_resource_group.py b/sdk/compute/azure-mgmt-compute/generated_samples/capacity_reservation_examples/capacity_reservation_group_list_by_resource_group.py deleted file mode 100644 index 43e496d21e6f..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/capacity_reservation_examples/capacity_reservation_group_list_by_resource_group.py +++ /dev/null @@ -1,43 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python capacity_reservation_group_list_by_resource_group.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.capacity_reservation_groups.list_by_resource_group( - resource_group_name="myResourceGroup", - ) - for item in response: - print(item) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/capacityReservationExamples/CapacityReservationGroup_ListByResourceGroup.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/capacity_reservation_examples/capacity_reservation_group_list_by_subscription.py b/sdk/compute/azure-mgmt-compute/generated_samples/capacity_reservation_examples/capacity_reservation_group_list_by_subscription.py deleted file mode 100644 index 47fa0b5c7ae5..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/capacity_reservation_examples/capacity_reservation_group_list_by_subscription.py +++ /dev/null @@ -1,41 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python capacity_reservation_group_list_by_subscription.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.capacity_reservation_groups.list_by_subscription() - for item in response: - print(item) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/capacityReservationExamples/CapacityReservationGroup_ListBySubscription.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/capacity_reservation_examples/capacity_reservation_group_list_by_subscription_with_resource_ids_query.py b/sdk/compute/azure-mgmt-compute/generated_samples/capacity_reservation_examples/capacity_reservation_group_list_by_subscription_with_resource_ids_query.py deleted file mode 100644 index 3a3b64d2920a..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/capacity_reservation_examples/capacity_reservation_group_list_by_subscription_with_resource_ids_query.py +++ /dev/null @@ -1,41 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python capacity_reservation_group_list_by_subscription_with_resource_ids_query.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.capacity_reservation_groups.list_by_subscription() - for item in response: - print(item) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/capacityReservationExamples/CapacityReservationGroup_ListBySubscriptionWithResourceIdsQuery.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/capacity_reservation_examples/capacity_reservation_group_update_maximum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/capacity_reservation_examples/capacity_reservation_group_update_maximum_set_gen.py deleted file mode 100644 index f685c9a92396..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/capacity_reservation_examples/capacity_reservation_group_update_maximum_set_gen.py +++ /dev/null @@ -1,44 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python capacity_reservation_group_update_maximum_set_gen.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.capacity_reservation_groups.update( - resource_group_name="rgcompute", - capacity_reservation_group_name="aaaaaaaaaaaaaaaaaaaaaa", - parameters={"properties": {"instanceView": {}}, "tags": {"key5355": "aaa"}}, - ) - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/capacityReservationExamples/CapacityReservationGroup_Update_MaximumSet_Gen.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/capacity_reservation_examples/capacity_reservation_list_by_reservation_group.py b/sdk/compute/azure-mgmt-compute/generated_samples/capacity_reservation_examples/capacity_reservation_list_by_reservation_group.py deleted file mode 100644 index 9094ed141db5..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/capacity_reservation_examples/capacity_reservation_list_by_reservation_group.py +++ /dev/null @@ -1,44 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python capacity_reservation_list_by_reservation_group.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.capacity_reservations.list_by_capacity_reservation_group( - resource_group_name="myResourceGroup", - capacity_reservation_group_name="myCapacityReservationGroup", - ) - for item in response: - print(item) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/capacityReservationExamples/CapacityReservation_ListByReservationGroup.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/capacity_reservation_examples/capacity_reservation_update_maximum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/capacity_reservation_examples/capacity_reservation_update_maximum_set_gen.py deleted file mode 100644 index 1e15a28782af..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/capacity_reservation_examples/capacity_reservation_update_maximum_set_gen.py +++ /dev/null @@ -1,62 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python capacity_reservation_update_maximum_set_gen.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.capacity_reservations.begin_update( - resource_group_name="rgcompute", - capacity_reservation_group_name="aaaaaaaaaa", - capacity_reservation_name="aaaaaaaaaaaaaaaaaaa", - parameters={ - "properties": { - "instanceView": { - "statuses": [ - { - "code": "aaaaaaaaaaaaaaaaaaaaaaa", - "displayStatus": "aaaaaa", - "level": "Info", - "message": "a", - "time": "2021-11-30T12:58:26.522Z", - } - ], - "utilizationInfo": {}, - } - }, - "sku": {"capacity": 7, "name": "Standard_DS1_v2", "tier": "aaa"}, - "tags": {"key4974": "aaaaaaaaaaaaaaaa"}, - }, - ).result() - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/capacityReservationExamples/CapacityReservation_Update_MaximumSet_Gen.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/capacity_reservation_examples/targeted_capacity_reservation_create_or_update.py b/sdk/compute/azure-mgmt-compute/generated_samples/capacity_reservation_examples/targeted_capacity_reservation_create_or_update.py deleted file mode 100644 index 15d8024add59..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/capacity_reservation_examples/targeted_capacity_reservation_create_or_update.py +++ /dev/null @@ -1,50 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python targeted_capacity_reservation_create_or_update.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.capacity_reservations.begin_create_or_update( - resource_group_name="myResourceGroup", - capacity_reservation_group_name="targetedCapacityReservationGroup", - capacity_reservation_name="targetedCapacityReservation", - parameters={ - "location": "westus", - "sku": {"capacity": 4, "name": "Standard_DS1_v2"}, - "tags": {"department": "HR"}, - "zones": ["1"], - }, - ).result() - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/capacityReservationExamples/TargetedCapacityReservation_CreateOrUpdate.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/capacity_reservation_examples/targeted_capacity_reservation_get.py b/sdk/compute/azure-mgmt-compute/generated_samples/capacity_reservation_examples/targeted_capacity_reservation_get.py deleted file mode 100644 index 405429be78f7..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/capacity_reservation_examples/targeted_capacity_reservation_get.py +++ /dev/null @@ -1,44 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python targeted_capacity_reservation_get.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscriptionId}", - ) - - response = client.capacity_reservations.get( - resource_group_name="myResourceGroup", - capacity_reservation_group_name="targetedCapacityReservationGroup", - capacity_reservation_name="targetedCapacityReservation", - ) - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/capacityReservationExamples/TargetedCapacityReservation_Get.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/capacity_reservation_examples/targeted_capacity_reservation_group_create_or_update.py b/sdk/compute/azure-mgmt-compute/generated_samples/capacity_reservation_examples/targeted_capacity_reservation_group_create_or_update.py deleted file mode 100644 index 264c6c7bcd5c..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/capacity_reservation_examples/targeted_capacity_reservation_group_create_or_update.py +++ /dev/null @@ -1,57 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python targeted_capacity_reservation_group_create_or_update.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.capacity_reservation_groups.create_or_update( - resource_group_name="myResourceGroup", - capacity_reservation_group_name="targetedCapacityReservationGroup", - parameters={ - "location": "westus", - "properties": { - "reservationType": "Targeted", - "sharingProfile": { - "subscriptionIds": [ - {"id": "/subscriptions/{subscription-id1}"}, - {"id": "/subscriptions/{subscription-id2}"}, - ] - }, - }, - "tags": {"department": "finance"}, - "zones": ["1", "2"], - }, - ) - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/capacityReservationExamples/TargetedCapacityReservationGroup_CreateOrUpdate.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/capacity_reservation_examples/targeted_capacity_reservation_group_get.py b/sdk/compute/azure-mgmt-compute/generated_samples/capacity_reservation_examples/targeted_capacity_reservation_group_get.py deleted file mode 100644 index 75b2862ab59a..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/capacity_reservation_examples/targeted_capacity_reservation_group_get.py +++ /dev/null @@ -1,43 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python targeted_capacity_reservation_group_get.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscriptionId}", - ) - - response = client.capacity_reservation_groups.get( - resource_group_name="myResourceGroup", - capacity_reservation_group_name="targetedCapacityReservationGroup", - ) - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/capacityReservationExamples/TargetedCapacityReservationGroup_Get.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/capacity_reservation_examples/targeted_capacity_reservation_list_by_reservation_group.py b/sdk/compute/azure-mgmt-compute/generated_samples/capacity_reservation_examples/targeted_capacity_reservation_list_by_reservation_group.py deleted file mode 100644 index 79b860e0c3f8..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/capacity_reservation_examples/targeted_capacity_reservation_list_by_reservation_group.py +++ /dev/null @@ -1,44 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python targeted_capacity_reservation_list_by_reservation_group.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.capacity_reservations.list_by_capacity_reservation_group( - resource_group_name="myResourceGroup", - capacity_reservation_group_name="targetedCapacityReservationGroup", - ) - for item in response: - print(item) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/capacityReservationExamples/TargetedCapacityReservation_ListByReservationGroup.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/cloud_service_create_with_multi_role.py b/sdk/compute/azure-mgmt-compute/generated_samples/cloud_service_create_with_multi_role.py deleted file mode 100644 index b1f6d5819e32..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/cloud_service_create_with_multi_role.py +++ /dev/null @@ -1,43 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python cloud_service_create_with_multi_role.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.cloud_services.begin_create_or_update( - resource_group_name="ConstosoRG", - cloud_service_name="{cs-name}", - ).result() - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2024-11-04/examples/CloudService_Create_WithMultiRole.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/cloud_service_create_with_multi_role_with_zones.py b/sdk/compute/azure-mgmt-compute/generated_samples/cloud_service_create_with_multi_role_with_zones.py deleted file mode 100644 index a33c60aacba0..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/cloud_service_create_with_multi_role_with_zones.py +++ /dev/null @@ -1,43 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python cloud_service_create_with_multi_role_with_zones.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.cloud_services.begin_create_or_update( - resource_group_name="ConstosoRG", - cloud_service_name="{cs-name}", - ).result() - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2024-11-04/examples/CloudService_Create_WithMultiRole_WithZones.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/cloud_service_create_with_single_role.py b/sdk/compute/azure-mgmt-compute/generated_samples/cloud_service_create_with_single_role.py deleted file mode 100644 index 7da75e34b09c..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/cloud_service_create_with_single_role.py +++ /dev/null @@ -1,43 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python cloud_service_create_with_single_role.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.cloud_services.begin_create_or_update( - resource_group_name="ConstosoRG", - cloud_service_name="{cs-name}", - ).result() - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2024-11-04/examples/CloudService_Create_WithSingleRole.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/cloud_service_create_with_single_role_and_certificate.py b/sdk/compute/azure-mgmt-compute/generated_samples/cloud_service_create_with_single_role_and_certificate.py deleted file mode 100644 index 3b89b3ccd0c9..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/cloud_service_create_with_single_role_and_certificate.py +++ /dev/null @@ -1,43 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python cloud_service_create_with_single_role_and_certificate.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.cloud_services.begin_create_or_update( - resource_group_name="ConstosoRG", - cloud_service_name="{cs-name}", - ).result() - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2024-11-04/examples/CloudService_Create_WithSingleRoleAndCertificate.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/cloud_service_create_with_single_role_and_rdp.py b/sdk/compute/azure-mgmt-compute/generated_samples/cloud_service_create_with_single_role_and_rdp.py deleted file mode 100644 index 4232f304eb55..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/cloud_service_create_with_single_role_and_rdp.py +++ /dev/null @@ -1,43 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python cloud_service_create_with_single_role_and_rdp.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.cloud_services.begin_create_or_update( - resource_group_name="ConstosoRG", - cloud_service_name="{cs-name}", - ).result() - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2024-11-04/examples/CloudService_Create_WithSingleRoleAndRDP.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/cloud_service_delete.py b/sdk/compute/azure-mgmt-compute/generated_samples/cloud_service_delete.py deleted file mode 100644 index d90f4be001f6..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/cloud_service_delete.py +++ /dev/null @@ -1,42 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python cloud_service_delete.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - client.cloud_services.begin_delete( - resource_group_name="ConstosoRG", - cloud_service_name="{cs-name}", - ).result() - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2024-11-04/examples/CloudService_Delete.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/cloud_service_get_instance_view_with_multi_role.py b/sdk/compute/azure-mgmt-compute/generated_samples/cloud_service_get_instance_view_with_multi_role.py deleted file mode 100644 index c0807e229ca4..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/cloud_service_get_instance_view_with_multi_role.py +++ /dev/null @@ -1,43 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python cloud_service_get_instance_view_with_multi_role.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.cloud_services.get_instance_view( - resource_group_name="ConstosoRG", - cloud_service_name="{cs-name}", - ) - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2024-11-04/examples/CloudService_Get_InstanceViewWithMultiRole.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/cloud_service_get_with_multi_role_and_rdp.py b/sdk/compute/azure-mgmt-compute/generated_samples/cloud_service_get_with_multi_role_and_rdp.py deleted file mode 100644 index 79bc4b57d8b6..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/cloud_service_get_with_multi_role_and_rdp.py +++ /dev/null @@ -1,43 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python cloud_service_get_with_multi_role_and_rdp.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.cloud_services.get( - resource_group_name="ConstosoRG", - cloud_service_name="{cs-name}", - ) - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2024-11-04/examples/CloudService_Get_WithMultiRoleAndRDP.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/cloud_service_list_by_resource_group.py b/sdk/compute/azure-mgmt-compute/generated_samples/cloud_service_list_by_resource_group.py deleted file mode 100644 index 560e851c2663..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/cloud_service_list_by_resource_group.py +++ /dev/null @@ -1,43 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python cloud_service_list_by_resource_group.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.cloud_services.list( - resource_group_name="ConstosoRG", - ) - for item in response: - print(item) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2024-11-04/examples/CloudService_List_ByResourceGroup.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/cloud_service_list_by_subscription.py b/sdk/compute/azure-mgmt-compute/generated_samples/cloud_service_list_by_subscription.py deleted file mode 100644 index 974f898952fd..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/cloud_service_list_by_subscription.py +++ /dev/null @@ -1,41 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python cloud_service_list_by_subscription.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.cloud_services.list_all() - for item in response: - print(item) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2024-11-04/examples/CloudService_List_BySubscription.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/cloud_service_os_families_list.py b/sdk/compute/azure-mgmt-compute/generated_samples/cloud_service_os_families_list.py deleted file mode 100644 index 28355d769fd5..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/cloud_service_os_families_list.py +++ /dev/null @@ -1,43 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python cloud_service_os_families_list.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.cloud_service_operating_systems.list_os_families( - location="westus2", - ) - for item in response: - print(item) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2024-11-04/examples/CloudServiceOSFamilies_List.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/cloud_service_os_family_get.py b/sdk/compute/azure-mgmt-compute/generated_samples/cloud_service_os_family_get.py deleted file mode 100644 index e75f605526d9..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/cloud_service_os_family_get.py +++ /dev/null @@ -1,43 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python cloud_service_os_family_get.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.cloud_service_operating_systems.get_os_family( - location="westus2", - os_family_name="3", - ) - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2024-11-04/examples/CloudServiceOSFamily_Get.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/cloud_service_os_version_get.py b/sdk/compute/azure-mgmt-compute/generated_samples/cloud_service_os_version_get.py deleted file mode 100644 index 45e42980d9fb..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/cloud_service_os_version_get.py +++ /dev/null @@ -1,43 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python cloud_service_os_version_get.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.cloud_service_operating_systems.get_os_version( - location="westus2", - os_version_name="WA-GUEST-OS-3.90_202010-02", - ) - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2024-11-04/examples/CloudServiceOSVersion_Get.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/cloud_service_os_version_list.py b/sdk/compute/azure-mgmt-compute/generated_samples/cloud_service_os_version_list.py deleted file mode 100644 index ca6548120c96..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/cloud_service_os_version_list.py +++ /dev/null @@ -1,43 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python cloud_service_os_version_list.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.cloud_service_operating_systems.list_os_versions( - location="westus2", - ) - for item in response: - print(item) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2024-11-04/examples/CloudServiceOSVersion_List.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/cloud_service_power_off.py b/sdk/compute/azure-mgmt-compute/generated_samples/cloud_service_power_off.py deleted file mode 100644 index 0a50f23c3ad6..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/cloud_service_power_off.py +++ /dev/null @@ -1,42 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python cloud_service_power_off.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - client.cloud_services.begin_power_off( - resource_group_name="ConstosoRG", - cloud_service_name="{cs-name}", - ).result() - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2024-11-04/examples/CloudService_PowerOff.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/cloud_service_role_get.py b/sdk/compute/azure-mgmt-compute/generated_samples/cloud_service_role_get.py deleted file mode 100644 index b24b53535af1..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/cloud_service_role_get.py +++ /dev/null @@ -1,44 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python cloud_service_role_get.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.cloud_service_roles.get( - role_name="{role-name}", - resource_group_name="ConstosoRG", - cloud_service_name="{cs-name}", - ) - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2024-11-04/examples/CloudServiceRole_Get.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/cloud_service_role_instance_delete.py b/sdk/compute/azure-mgmt-compute/generated_samples/cloud_service_role_instance_delete.py deleted file mode 100644 index c9626f7888fb..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/cloud_service_role_instance_delete.py +++ /dev/null @@ -1,43 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python cloud_service_role_instance_delete.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - client.cloud_service_role_instances.begin_delete( - role_instance_name="{roleInstance-name}", - resource_group_name="ConstosoRG", - cloud_service_name="{cs-name}", - ).result() - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2024-11-04/examples/CloudServiceRoleInstance_Delete.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/cloud_service_role_instance_delete_by_cloud_service.py b/sdk/compute/azure-mgmt-compute/generated_samples/cloud_service_role_instance_delete_by_cloud_service.py deleted file mode 100644 index 34ad242eb72a..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/cloud_service_role_instance_delete_by_cloud_service.py +++ /dev/null @@ -1,42 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python cloud_service_role_instance_delete_by_cloud_service.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - client.cloud_services.begin_delete_instances( - resource_group_name="ConstosoRG", - cloud_service_name="{cs-name}", - ).result() - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2024-11-04/examples/CloudServiceRoleInstance_Delete_ByCloudService.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/cloud_service_role_instance_get.py b/sdk/compute/azure-mgmt-compute/generated_samples/cloud_service_role_instance_get.py deleted file mode 100644 index 4d4680a92418..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/cloud_service_role_instance_get.py +++ /dev/null @@ -1,44 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python cloud_service_role_instance_get.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.cloud_service_role_instances.get( - role_instance_name="{roleInstance-name}", - resource_group_name="ConstosoRG", - cloud_service_name="{cs-name}", - ) - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2024-11-04/examples/CloudServiceRoleInstance_Get.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/cloud_service_role_instance_get_instance_view.py b/sdk/compute/azure-mgmt-compute/generated_samples/cloud_service_role_instance_get_instance_view.py deleted file mode 100644 index 22f3e69e7de2..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/cloud_service_role_instance_get_instance_view.py +++ /dev/null @@ -1,44 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python cloud_service_role_instance_get_instance_view.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.cloud_service_role_instances.get_instance_view( - role_instance_name="{roleInstance-name}", - resource_group_name="ConstosoRG", - cloud_service_name="{cs-name}", - ) - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2024-11-04/examples/CloudServiceRoleInstance_Get_InstanceView.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/cloud_service_role_instance_get_remote_desktop_file.py b/sdk/compute/azure-mgmt-compute/generated_samples/cloud_service_role_instance_get_remote_desktop_file.py deleted file mode 100644 index 8bc5597d91b9..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/cloud_service_role_instance_get_remote_desktop_file.py +++ /dev/null @@ -1,44 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python cloud_service_role_instance_get_remote_desktop_file.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.cloud_service_role_instances.get_remote_desktop_file( - role_instance_name="aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", - resource_group_name="rgcloudService", - cloud_service_name="aaaa", - ) - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2024-11-04/examples/CloudServiceRoleInstance_Get_RemoteDesktopFile.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/cloud_service_role_instance_rebuild.py b/sdk/compute/azure-mgmt-compute/generated_samples/cloud_service_role_instance_rebuild.py deleted file mode 100644 index 49fcbed0d45f..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/cloud_service_role_instance_rebuild.py +++ /dev/null @@ -1,43 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python cloud_service_role_instance_rebuild.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - client.cloud_service_role_instances.begin_rebuild( - role_instance_name="{roleInstance-name}", - resource_group_name="ConstosoRG", - cloud_service_name="{cs-name}", - ).result() - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2024-11-04/examples/CloudServiceRoleInstance_Rebuild.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/cloud_service_role_instance_rebuild_by_cloud_service.py b/sdk/compute/azure-mgmt-compute/generated_samples/cloud_service_role_instance_rebuild_by_cloud_service.py deleted file mode 100644 index 0d7bd42e4c22..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/cloud_service_role_instance_rebuild_by_cloud_service.py +++ /dev/null @@ -1,42 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python cloud_service_role_instance_rebuild_by_cloud_service.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - client.cloud_services.begin_rebuild( - resource_group_name="ConstosoRG", - cloud_service_name="{cs-name}", - ).result() - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2024-11-04/examples/CloudServiceRoleInstance_Rebuild_ByCloudService.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/cloud_service_role_instance_reimage.py b/sdk/compute/azure-mgmt-compute/generated_samples/cloud_service_role_instance_reimage.py deleted file mode 100644 index 9423eec9b8e2..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/cloud_service_role_instance_reimage.py +++ /dev/null @@ -1,43 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python cloud_service_role_instance_reimage.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - client.cloud_service_role_instances.begin_reimage( - role_instance_name="{roleInstance-name}", - resource_group_name="ConstosoRG", - cloud_service_name="{cs-name}", - ).result() - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2024-11-04/examples/CloudServiceRoleInstance_Reimage.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/cloud_service_role_instance_reimage_by_cloud_service.py b/sdk/compute/azure-mgmt-compute/generated_samples/cloud_service_role_instance_reimage_by_cloud_service.py deleted file mode 100644 index f083223b9f90..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/cloud_service_role_instance_reimage_by_cloud_service.py +++ /dev/null @@ -1,42 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python cloud_service_role_instance_reimage_by_cloud_service.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - client.cloud_services.begin_reimage( - resource_group_name="ConstosoRG", - cloud_service_name="{cs-name}", - ).result() - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2024-11-04/examples/CloudServiceRoleInstance_Reimage_ByCloudService.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/cloud_service_role_instance_restart.py b/sdk/compute/azure-mgmt-compute/generated_samples/cloud_service_role_instance_restart.py deleted file mode 100644 index c3e43a744084..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/cloud_service_role_instance_restart.py +++ /dev/null @@ -1,43 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python cloud_service_role_instance_restart.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - client.cloud_service_role_instances.begin_restart( - role_instance_name="{roleInstance-name}", - resource_group_name="ConstosoRG", - cloud_service_name="{cs-name}", - ).result() - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2024-11-04/examples/CloudServiceRoleInstance_Restart.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/cloud_service_role_instance_restart_by_cloud_service.py b/sdk/compute/azure-mgmt-compute/generated_samples/cloud_service_role_instance_restart_by_cloud_service.py deleted file mode 100644 index 56ce358e4f6d..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/cloud_service_role_instance_restart_by_cloud_service.py +++ /dev/null @@ -1,42 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python cloud_service_role_instance_restart_by_cloud_service.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - client.cloud_services.begin_restart( - resource_group_name="ConstosoRG", - cloud_service_name="{cs-name}", - ).result() - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2024-11-04/examples/CloudServiceRoleInstance_Restart_ByCloudService.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/cloud_service_role_list.py b/sdk/compute/azure-mgmt-compute/generated_samples/cloud_service_role_list.py deleted file mode 100644 index 63a0cbe33bb7..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/cloud_service_role_list.py +++ /dev/null @@ -1,44 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python cloud_service_role_list.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.cloud_service_roles.list( - resource_group_name="ConstosoRG", - cloud_service_name="{cs-name}", - ) - for item in response: - print(item) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2024-11-04/examples/CloudServiceRole_List.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/cloud_service_roles_instance_list.py b/sdk/compute/azure-mgmt-compute/generated_samples/cloud_service_roles_instance_list.py deleted file mode 100644 index 485af911d58e..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/cloud_service_roles_instance_list.py +++ /dev/null @@ -1,44 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python cloud_service_roles_instance_list.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.cloud_service_role_instances.list( - resource_group_name="ConstosoRG", - cloud_service_name="{cs-name}", - ) - for item in response: - print(item) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2024-11-04/examples/CloudServiceRolesInstance_List.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/cloud_service_start.py b/sdk/compute/azure-mgmt-compute/generated_samples/cloud_service_start.py deleted file mode 100644 index 2c476b3329f5..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/cloud_service_start.py +++ /dev/null @@ -1,42 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python cloud_service_start.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - client.cloud_services.begin_start( - resource_group_name="ConstosoRG", - cloud_service_name="{cs-name}", - ).result() - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2024-11-04/examples/CloudService_Start.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/cloud_service_update_domain_get.py b/sdk/compute/azure-mgmt-compute/generated_samples/cloud_service_update_domain_get.py deleted file mode 100644 index 089858e36412..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/cloud_service_update_domain_get.py +++ /dev/null @@ -1,44 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python cloud_service_update_domain_get.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.cloud_services_update_domain.get_update_domain( - resource_group_name="ConstosoRG", - cloud_service_name="{cs-name}", - update_domain=1, - ) - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2024-11-04/examples/CloudServiceUpdateDomain_Get.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/cloud_service_update_domain_list.py b/sdk/compute/azure-mgmt-compute/generated_samples/cloud_service_update_domain_list.py deleted file mode 100644 index b88da5d42dd8..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/cloud_service_update_domain_list.py +++ /dev/null @@ -1,44 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python cloud_service_update_domain_list.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.cloud_services_update_domain.list_update_domains( - resource_group_name="ConstosoRG", - cloud_service_name="{cs-name}", - ) - for item in response: - print(item) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2024-11-04/examples/CloudServiceUpdateDomain_List.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/cloud_service_update_domain_update.py b/sdk/compute/azure-mgmt-compute/generated_samples/cloud_service_update_domain_update.py deleted file mode 100644 index e0db89c068d9..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/cloud_service_update_domain_update.py +++ /dev/null @@ -1,43 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python cloud_service_update_domain_update.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - client.cloud_services_update_domain.begin_walk_update_domain( - resource_group_name="ConstosoRG", - cloud_service_name="{cs-name}", - update_domain=1, - ).result() - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2024-11-04/examples/CloudServiceUpdateDomain_Update.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/cloud_service_update_to_include_tags.py b/sdk/compute/azure-mgmt-compute/generated_samples/cloud_service_update_to_include_tags.py deleted file mode 100644 index 797401b358ac..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/cloud_service_update_to_include_tags.py +++ /dev/null @@ -1,43 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python cloud_service_update_to_include_tags.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.cloud_services.begin_update( - resource_group_name="ConstosoRG", - cloud_service_name="{cs-name}", - ).result() - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2024-11-04/examples/CloudService_Update_ToIncludeTags.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/community_gallery_examples/community_gallery_get.py b/sdk/compute/azure-mgmt-compute/generated_samples/community_gallery_examples/community_gallery_get.py deleted file mode 100644 index 2ee2e61a2af8..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/community_gallery_examples/community_gallery_get.py +++ /dev/null @@ -1,43 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python community_gallery_get.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.community_galleries.get( - location="myLocation", - public_gallery_name="publicGalleryName", - ) - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples/communityGalleryExamples/CommunityGallery_Get.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/community_gallery_examples/community_gallery_image_get.py b/sdk/compute/azure-mgmt-compute/generated_samples/community_gallery_examples/community_gallery_image_get.py deleted file mode 100644 index 3e48c2f15953..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/community_gallery_examples/community_gallery_image_get.py +++ /dev/null @@ -1,44 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python community_gallery_image_get.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.community_gallery_images.get( - location="myLocation", - public_gallery_name="publicGalleryName", - gallery_image_name="myGalleryImageName", - ) - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples/communityGalleryExamples/CommunityGalleryImage_Get.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/community_gallery_examples/community_gallery_image_list.py b/sdk/compute/azure-mgmt-compute/generated_samples/community_gallery_examples/community_gallery_image_list.py deleted file mode 100644 index c91a022abd0a..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/community_gallery_examples/community_gallery_image_list.py +++ /dev/null @@ -1,44 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python community_gallery_image_list.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.community_gallery_images.list( - location="myLocation", - public_gallery_name="publicGalleryName", - ) - for item in response: - print(item) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples/communityGalleryExamples/CommunityGalleryImage_List.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/community_gallery_examples/community_gallery_image_version_get.py b/sdk/compute/azure-mgmt-compute/generated_samples/community_gallery_examples/community_gallery_image_version_get.py deleted file mode 100644 index 7a1851fd07c7..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/community_gallery_examples/community_gallery_image_version_get.py +++ /dev/null @@ -1,45 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python community_gallery_image_version_get.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.community_gallery_image_versions.get( - location="myLocation", - public_gallery_name="publicGalleryName", - gallery_image_name="myGalleryImageName", - gallery_image_version_name="myGalleryImageVersionName", - ) - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples/communityGalleryExamples/CommunityGalleryImageVersion_Get.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/community_gallery_examples/community_gallery_image_version_list.py b/sdk/compute/azure-mgmt-compute/generated_samples/community_gallery_examples/community_gallery_image_version_list.py deleted file mode 100644 index 80bf1bd444f4..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/community_gallery_examples/community_gallery_image_version_list.py +++ /dev/null @@ -1,45 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python community_gallery_image_version_list.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.community_gallery_image_versions.list( - location="myLocation", - public_gallery_name="publicGalleryName", - gallery_image_name="myGalleryImageName", - ) - for item in response: - print(item) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples/communityGalleryExamples/CommunityGalleryImageVersion_List.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/compute_rp_common_examples/operations_list_maximum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/compute_rp_common_examples/operations_list_maximum_set_gen.py deleted file mode 100644 index 709509e30d03..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/compute_rp_common_examples/operations_list_maximum_set_gen.py +++ /dev/null @@ -1,41 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python operations_list_maximum_set_gen.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="SUBSCRIPTION_ID", - ) - - response = client.operations.list() - for item in response: - print(item) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/computeRPCommonExamples/Operations_List_MaximumSet_Gen.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/compute_rp_common_examples/operations_list_minimum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/compute_rp_common_examples/operations_list_minimum_set_gen.py deleted file mode 100644 index fab2182af7f0..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/compute_rp_common_examples/operations_list_minimum_set_gen.py +++ /dev/null @@ -1,41 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python operations_list_minimum_set_gen.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="SUBSCRIPTION_ID", - ) - - response = client.operations.list() - for item in response: - print(item) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/computeRPCommonExamples/Operations_List_MinimumSet_Gen.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/compute_rp_common_examples/usage_list_maximum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/compute_rp_common_examples/usage_list_maximum_set_gen.py deleted file mode 100644 index 3258b54b0839..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/compute_rp_common_examples/usage_list_maximum_set_gen.py +++ /dev/null @@ -1,43 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python usage_list_maximum_set_gen.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.usage.list( - location="4_.", - ) - for item in response: - print(item) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/computeRPCommonExamples/Usage_List_MaximumSet_Gen.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/compute_rp_common_examples/usage_list_minimum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/compute_rp_common_examples/usage_list_minimum_set_gen.py deleted file mode 100644 index 14d2a72093ff..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/compute_rp_common_examples/usage_list_minimum_set_gen.py +++ /dev/null @@ -1,43 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python usage_list_minimum_set_gen.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.usage.list( - location="_--", - ) - for item in response: - print(item) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/computeRPCommonExamples/Usage_List_MinimumSet_Gen.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/compute_rp_common_examples/virtual_machine_sizes_list_maximum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/compute_rp_common_examples/virtual_machine_sizes_list_maximum_set_gen.py deleted file mode 100644 index 2e54de039855..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/compute_rp_common_examples/virtual_machine_sizes_list_maximum_set_gen.py +++ /dev/null @@ -1,43 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_sizes_list_maximum_set_gen.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.virtual_machine_sizes.list( - location="-e", - ) - for item in response: - print(item) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/computeRPCommonExamples/VirtualMachineSizes_List_MaximumSet_Gen.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/compute_rp_common_examples/virtual_machine_sizes_list_minimum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/compute_rp_common_examples/virtual_machine_sizes_list_minimum_set_gen.py deleted file mode 100644 index 935de8363f62..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/compute_rp_common_examples/virtual_machine_sizes_list_minimum_set_gen.py +++ /dev/null @@ -1,43 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_sizes_list_minimum_set_gen.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.virtual_machine_sizes.list( - location="._..", - ) - for item in response: - print(item) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/computeRPCommonExamples/VirtualMachineSizes_List_MinimumSet_Gen.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/dedicated_host_examples/dedicated_host_create_or_update.py b/sdk/compute/azure-mgmt-compute/generated_samples/dedicated_host_examples/dedicated_host_create_or_update.py deleted file mode 100644 index bbb2d7ba6e8b..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/dedicated_host_examples/dedicated_host_create_or_update.py +++ /dev/null @@ -1,50 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python dedicated_host_create_or_update.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.dedicated_hosts.begin_create_or_update( - resource_group_name="myResourceGroup", - host_group_name="myDedicatedHostGroup", - host_name="myDedicatedHost", - parameters={ - "location": "westus", - "properties": {"platformFaultDomain": 1}, - "sku": {"name": "DSv3-Type1"}, - "tags": {"department": "HR"}, - }, - ).result() - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/dedicatedHostExamples/DedicatedHost_CreateOrUpdate.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/dedicated_host_examples/dedicated_host_delete_maximum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/dedicated_host_examples/dedicated_host_delete_maximum_set_gen.py deleted file mode 100644 index f35c1409a1d5..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/dedicated_host_examples/dedicated_host_delete_maximum_set_gen.py +++ /dev/null @@ -1,43 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python dedicated_host_delete_maximum_set_gen.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - client.dedicated_hosts.begin_delete( - resource_group_name="rgcompute", - host_group_name="aaaaaa", - host_name="aaaaaaaaaaaaaaa", - ).result() - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/dedicatedHostExamples/DedicatedHost_Delete_MaximumSet_Gen.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/dedicated_host_examples/dedicated_host_delete_minimum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/dedicated_host_examples/dedicated_host_delete_minimum_set_gen.py deleted file mode 100644 index 90fabe6c5f34..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/dedicated_host_examples/dedicated_host_delete_minimum_set_gen.py +++ /dev/null @@ -1,43 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python dedicated_host_delete_minimum_set_gen.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - client.dedicated_hosts.begin_delete( - resource_group_name="rgcompute", - host_group_name="aaaaaaaaaaaaaaa", - host_name="aaaaa", - ).result() - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/dedicatedHostExamples/DedicatedHost_Delete_MinimumSet_Gen.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/dedicated_host_examples/dedicated_host_get.py b/sdk/compute/azure-mgmt-compute/generated_samples/dedicated_host_examples/dedicated_host_get.py deleted file mode 100644 index 218d89f2eda4..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/dedicated_host_examples/dedicated_host_get.py +++ /dev/null @@ -1,44 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python dedicated_host_get.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscriptionId}", - ) - - response = client.dedicated_hosts.get( - resource_group_name="myResourceGroup", - host_group_name="myDedicatedHostGroup", - host_name="myHost", - ) - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/dedicatedHostExamples/DedicatedHost_Get.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/dedicated_host_examples/dedicated_host_group_create_or_update.py b/sdk/compute/azure-mgmt-compute/generated_samples/dedicated_host_examples/dedicated_host_group_create_or_update.py deleted file mode 100644 index a6031c6c5ff2..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/dedicated_host_examples/dedicated_host_group_create_or_update.py +++ /dev/null @@ -1,49 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python dedicated_host_group_create_or_update.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.dedicated_host_groups.create_or_update( - resource_group_name="myResourceGroup", - host_group_name="myDedicatedHostGroup", - parameters={ - "location": "westus", - "properties": {"platformFaultDomainCount": 3, "supportAutomaticPlacement": True}, - "tags": {"department": "finance"}, - "zones": ["1"], - }, - ) - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/dedicatedHostExamples/DedicatedHostGroup_CreateOrUpdate.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/dedicated_host_examples/dedicated_host_group_create_or_update_with_ultra_ssd.py b/sdk/compute/azure-mgmt-compute/generated_samples/dedicated_host_examples/dedicated_host_group_create_or_update_with_ultra_ssd.py deleted file mode 100644 index a970b10f363e..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/dedicated_host_examples/dedicated_host_group_create_or_update_with_ultra_ssd.py +++ /dev/null @@ -1,53 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python dedicated_host_group_create_or_update_with_ultra_ssd.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.dedicated_host_groups.create_or_update( - resource_group_name="myResourceGroup", - host_group_name="myDedicatedHostGroup", - parameters={ - "location": "westus", - "properties": { - "additionalCapabilities": {"ultraSSDEnabled": True}, - "platformFaultDomainCount": 3, - "supportAutomaticPlacement": True, - }, - "tags": {"department": "finance"}, - "zones": ["1"], - }, - ) - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/dedicatedHostExamples/DedicatedHostGroup_CreateOrUpdate_WithUltraSSD.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/dedicated_host_examples/dedicated_host_group_delete_maximum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/dedicated_host_examples/dedicated_host_group_delete_maximum_set_gen.py deleted file mode 100644 index 4931f18ba677..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/dedicated_host_examples/dedicated_host_group_delete_maximum_set_gen.py +++ /dev/null @@ -1,42 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python dedicated_host_group_delete_maximum_set_gen.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - client.dedicated_host_groups.delete( - resource_group_name="rgcompute", - host_group_name="a", - ) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/dedicatedHostExamples/DedicatedHostGroup_Delete_MaximumSet_Gen.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/dedicated_host_examples/dedicated_host_group_delete_minimum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/dedicated_host_examples/dedicated_host_group_delete_minimum_set_gen.py deleted file mode 100644 index b0429701fbce..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/dedicated_host_examples/dedicated_host_group_delete_minimum_set_gen.py +++ /dev/null @@ -1,42 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python dedicated_host_group_delete_minimum_set_gen.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - client.dedicated_host_groups.delete( - resource_group_name="rgcompute", - host_group_name="aaaa", - ) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/dedicatedHostExamples/DedicatedHostGroup_Delete_MinimumSet_Gen.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/dedicated_host_examples/dedicated_host_group_get.py b/sdk/compute/azure-mgmt-compute/generated_samples/dedicated_host_examples/dedicated_host_group_get.py deleted file mode 100644 index 9370655c40ee..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/dedicated_host_examples/dedicated_host_group_get.py +++ /dev/null @@ -1,43 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python dedicated_host_group_get.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscriptionId}", - ) - - response = client.dedicated_host_groups.get( - resource_group_name="myResourceGroup", - host_group_name="myDedicatedHostGroup", - ) - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/dedicatedHostExamples/DedicatedHostGroup_Get.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/dedicated_host_examples/dedicated_host_group_get_ultra_ssd_enabled_dedicated_host_group.py b/sdk/compute/azure-mgmt-compute/generated_samples/dedicated_host_examples/dedicated_host_group_get_ultra_ssd_enabled_dedicated_host_group.py deleted file mode 100644 index 1d33abb3dd6f..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/dedicated_host_examples/dedicated_host_group_get_ultra_ssd_enabled_dedicated_host_group.py +++ /dev/null @@ -1,43 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python dedicated_host_group_get_ultra_ssd_enabled_dedicated_host_group.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscriptionId}", - ) - - response = client.dedicated_host_groups.get( - resource_group_name="myResourceGroup", - host_group_name="myDedicatedHostGroup", - ) - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/dedicatedHostExamples/DedicatedHostGroup_Get_UltraSSDEnabledDedicatedHostGroup.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/dedicated_host_examples/dedicated_host_group_list_by_resource_group_maximum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/dedicated_host_examples/dedicated_host_group_list_by_resource_group_maximum_set_gen.py deleted file mode 100644 index b944e7d906df..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/dedicated_host_examples/dedicated_host_group_list_by_resource_group_maximum_set_gen.py +++ /dev/null @@ -1,43 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python dedicated_host_group_list_by_resource_group_maximum_set_gen.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.dedicated_host_groups.list_by_resource_group( - resource_group_name="rgcompute", - ) - for item in response: - print(item) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/dedicatedHostExamples/DedicatedHostGroup_ListByResourceGroup_MaximumSet_Gen.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/dedicated_host_examples/dedicated_host_group_list_by_resource_group_minimum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/dedicated_host_examples/dedicated_host_group_list_by_resource_group_minimum_set_gen.py deleted file mode 100644 index 3f13519b85fe..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/dedicated_host_examples/dedicated_host_group_list_by_resource_group_minimum_set_gen.py +++ /dev/null @@ -1,43 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python dedicated_host_group_list_by_resource_group_minimum_set_gen.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.dedicated_host_groups.list_by_resource_group( - resource_group_name="rgcompute", - ) - for item in response: - print(item) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/dedicatedHostExamples/DedicatedHostGroup_ListByResourceGroup_MinimumSet_Gen.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/dedicated_host_examples/dedicated_host_group_list_by_subscription_maximum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/dedicated_host_examples/dedicated_host_group_list_by_subscription_maximum_set_gen.py deleted file mode 100644 index aa0435190ee7..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/dedicated_host_examples/dedicated_host_group_list_by_subscription_maximum_set_gen.py +++ /dev/null @@ -1,41 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python dedicated_host_group_list_by_subscription_maximum_set_gen.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.dedicated_host_groups.list_by_subscription() - for item in response: - print(item) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/dedicatedHostExamples/DedicatedHostGroup_ListBySubscription_MaximumSet_Gen.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/dedicated_host_examples/dedicated_host_group_list_by_subscription_minimum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/dedicated_host_examples/dedicated_host_group_list_by_subscription_minimum_set_gen.py deleted file mode 100644 index df78a8f99a16..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/dedicated_host_examples/dedicated_host_group_list_by_subscription_minimum_set_gen.py +++ /dev/null @@ -1,41 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python dedicated_host_group_list_by_subscription_minimum_set_gen.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.dedicated_host_groups.list_by_subscription() - for item in response: - print(item) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/dedicatedHostExamples/DedicatedHostGroup_ListBySubscription_MinimumSet_Gen.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/dedicated_host_examples/dedicated_host_group_update_maximum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/dedicated_host_examples/dedicated_host_group_update_maximum_set_gen.py deleted file mode 100644 index 047c31b05787..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/dedicated_host_examples/dedicated_host_group_update_maximum_set_gen.py +++ /dev/null @@ -1,67 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python dedicated_host_group_update_maximum_set_gen.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.dedicated_host_groups.update( - resource_group_name="rgcompute", - host_group_name="aaaa", - parameters={ - "properties": { - "instanceView": { - "hosts": [ - { - "availableCapacity": {"allocatableVMs": [{"count": 26, "vmSize": "aaaaaaaaaaaaaaaaaaaa"}]}, - "statuses": [ - { - "code": "aaaaaaaaaaaaaaaaaaaaaaa", - "displayStatus": "aaaaaa", - "level": "Info", - "message": "a", - "time": "2021-11-30T12:58:26.522Z", - } - ], - } - ] - }, - "platformFaultDomainCount": 3, - "supportAutomaticPlacement": True, - }, - "tags": {"key9921": "aaaaaaaaaa"}, - "zones": ["aaaaaaaaaaaaaaaaaaaaaaaaaaaaa"], - }, - ) - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/dedicatedHostExamples/DedicatedHostGroup_Update_MaximumSet_Gen.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/dedicated_host_examples/dedicated_host_list_available_sizes.py b/sdk/compute/azure-mgmt-compute/generated_samples/dedicated_host_examples/dedicated_host_list_available_sizes.py deleted file mode 100644 index 20ba956950fa..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/dedicated_host_examples/dedicated_host_list_available_sizes.py +++ /dev/null @@ -1,45 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python dedicated_host_list_available_sizes.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscriptionId}", - ) - - response = client.dedicated_hosts.list_available_sizes( - resource_group_name="myResourceGroup", - host_group_name="myDedicatedHostGroup", - host_name="myHost", - ) - for item in response: - print(item) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/dedicatedHostExamples/DedicatedHost_ListAvailableSizes.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/dedicated_host_examples/dedicated_host_list_by_host_group_maximum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/dedicated_host_examples/dedicated_host_list_by_host_group_maximum_set_gen.py deleted file mode 100644 index 26984a4d5504..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/dedicated_host_examples/dedicated_host_list_by_host_group_maximum_set_gen.py +++ /dev/null @@ -1,44 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python dedicated_host_list_by_host_group_maximum_set_gen.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.dedicated_hosts.list_by_host_group( - resource_group_name="rgcompute", - host_group_name="aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", - ) - for item in response: - print(item) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/dedicatedHostExamples/DedicatedHost_ListByHostGroup_MaximumSet_Gen.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/dedicated_host_examples/dedicated_host_list_by_host_group_minimum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/dedicated_host_examples/dedicated_host_list_by_host_group_minimum_set_gen.py deleted file mode 100644 index f1ac576c77c6..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/dedicated_host_examples/dedicated_host_list_by_host_group_minimum_set_gen.py +++ /dev/null @@ -1,44 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python dedicated_host_list_by_host_group_minimum_set_gen.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.dedicated_hosts.list_by_host_group( - resource_group_name="rgcompute", - host_group_name="aaaa", - ) - for item in response: - print(item) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/dedicatedHostExamples/DedicatedHost_ListByHostGroup_MinimumSet_Gen.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/dedicated_host_examples/dedicated_host_redeploy.py b/sdk/compute/azure-mgmt-compute/generated_samples/dedicated_host_examples/dedicated_host_redeploy.py deleted file mode 100644 index d735272a869b..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/dedicated_host_examples/dedicated_host_redeploy.py +++ /dev/null @@ -1,43 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python dedicated_host_redeploy.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - client.dedicated_hosts.begin_redeploy( - resource_group_name="myResourceGroup", - host_group_name="myDedicatedHostGroup", - host_name="myHost", - ).result() - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/dedicatedHostExamples/DedicatedHost_Redeploy.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/dedicated_host_examples/dedicated_host_restart.py b/sdk/compute/azure-mgmt-compute/generated_samples/dedicated_host_examples/dedicated_host_restart.py deleted file mode 100644 index 6e4634c5a0f2..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/dedicated_host_examples/dedicated_host_restart.py +++ /dev/null @@ -1,43 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python dedicated_host_restart.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - client.dedicated_hosts.begin_restart( - resource_group_name="myResourceGroup", - host_group_name="myDedicatedHostGroup", - host_name="myHost", - ).result() - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/dedicatedHostExamples/DedicatedHost_Restart.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/dedicated_host_examples/dedicated_host_update_maximum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/dedicated_host_examples/dedicated_host_update_maximum_set_gen.py deleted file mode 100644 index 7a26abe3e54d..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/dedicated_host_examples/dedicated_host_update_maximum_set_gen.py +++ /dev/null @@ -1,64 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python dedicated_host_update_maximum_set_gen.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.dedicated_hosts.begin_update( - resource_group_name="rgcompute", - host_group_name="aaaaaaaaa", - host_name="aaaaaaaaaaaaaaaaaaaaa", - parameters={ - "properties": { - "autoReplaceOnFailure": True, - "instanceView": { - "availableCapacity": {"allocatableVMs": [{"count": 26, "vmSize": "aaaaaaaaaaaaaaaaaaaa"}]}, - "statuses": [ - { - "code": "aaaaaaaaaaaaaaaaaaaaaaa", - "displayStatus": "aaaaaa", - "level": "Info", - "message": "a", - "time": "2021-11-30T12:58:26.522Z", - } - ], - }, - "licenseType": "Windows_Server_Hybrid", - "platformFaultDomain": 1, - }, - "tags": {"key8813": "aaaaaaaaaaaaaaaaaaaaaaaaaaa"}, - }, - ).result() - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/dedicatedHostExamples/DedicatedHost_Update_MaximumSet_Gen.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/dedicated_host_examples/dedicated_host_update_resize.py b/sdk/compute/azure-mgmt-compute/generated_samples/dedicated_host_examples/dedicated_host_update_resize.py deleted file mode 100644 index 89c1bb3ba7b2..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/dedicated_host_examples/dedicated_host_update_resize.py +++ /dev/null @@ -1,45 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python dedicated_host_update_resize.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.dedicated_hosts.begin_update( - resource_group_name="rgcompute", - host_group_name="aaaaaaaaa", - host_name="aaaaaaaaaaaaaaaaaaaaa", - parameters={"sku": {"name": "DSv3-Type1"}}, - ).result() - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/dedicatedHostExamples/DedicatedHost_Update_Resize.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/disk_access_examples/disk_access_create.py b/sdk/compute/azure-mgmt-compute/generated_samples/disk_access_examples/disk_access_create.py deleted file mode 100644 index b386a0454221..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/disk_access_examples/disk_access_create.py +++ /dev/null @@ -1,44 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python disk_access_create.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.disk_accesses.begin_create_or_update( - resource_group_name="myResourceGroup", - disk_access_name="myDiskAccess", - disk_access={"location": "West US"}, - ).result() - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples/diskAccessExamples/DiskAccess_Create.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/disk_access_examples/disk_access_delete.py b/sdk/compute/azure-mgmt-compute/generated_samples/disk_access_examples/disk_access_delete.py deleted file mode 100644 index d8795d1fdfa9..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/disk_access_examples/disk_access_delete.py +++ /dev/null @@ -1,42 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python disk_access_delete.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - client.disk_accesses.begin_delete( - resource_group_name="myResourceGroup", - disk_access_name="myDiskAccess", - ).result() - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples/diskAccessExamples/DiskAccess_Delete.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/disk_access_examples/disk_access_get.py b/sdk/compute/azure-mgmt-compute/generated_samples/disk_access_examples/disk_access_get.py deleted file mode 100644 index 63ec3052b188..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/disk_access_examples/disk_access_get.py +++ /dev/null @@ -1,43 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python disk_access_get.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.disk_accesses.get( - resource_group_name="myResourceGroup", - disk_access_name="myDiskAccess", - ) - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples/diskAccessExamples/DiskAccess_Get.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/disk_access_examples/disk_access_get_with_private_endpoints.py b/sdk/compute/azure-mgmt-compute/generated_samples/disk_access_examples/disk_access_get_with_private_endpoints.py deleted file mode 100644 index 61be43042cc4..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/disk_access_examples/disk_access_get_with_private_endpoints.py +++ /dev/null @@ -1,43 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python disk_access_get_with_private_endpoints.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.disk_accesses.get( - resource_group_name="myResourceGroup", - disk_access_name="myDiskAccess", - ) - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples/diskAccessExamples/DiskAccess_Get_WithPrivateEndpoints.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/disk_access_examples/disk_access_list_by_resource_group.py b/sdk/compute/azure-mgmt-compute/generated_samples/disk_access_examples/disk_access_list_by_resource_group.py deleted file mode 100644 index c80e509c517d..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/disk_access_examples/disk_access_list_by_resource_group.py +++ /dev/null @@ -1,43 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python disk_access_list_by_resource_group.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.disk_accesses.list_by_resource_group( - resource_group_name="myResourceGroup", - ) - for item in response: - print(item) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples/diskAccessExamples/DiskAccess_ListByResourceGroup.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/disk_access_examples/disk_access_list_by_subscription.py b/sdk/compute/azure-mgmt-compute/generated_samples/disk_access_examples/disk_access_list_by_subscription.py deleted file mode 100644 index f3824da50373..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/disk_access_examples/disk_access_list_by_subscription.py +++ /dev/null @@ -1,41 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python disk_access_list_by_subscription.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.disk_accesses.list() - for item in response: - print(item) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples/diskAccessExamples/DiskAccess_ListBySubscription.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/disk_access_examples/disk_access_private_endpoint_connection_approve.py b/sdk/compute/azure-mgmt-compute/generated_samples/disk_access_examples/disk_access_private_endpoint_connection_approve.py deleted file mode 100644 index d9f24df36bd0..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/disk_access_examples/disk_access_private_endpoint_connection_approve.py +++ /dev/null @@ -1,52 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python disk_access_private_endpoint_connection_approve.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.disk_accesses.begin_update_a_private_endpoint_connection( - resource_group_name="myResourceGroup", - disk_access_name="myDiskAccess", - private_endpoint_connection_name="myPrivateEndpointConnection", - private_endpoint_connection={ - "properties": { - "privateLinkServiceConnectionState": { - "description": "Approving myPrivateEndpointConnection", - "status": "Approved", - } - } - }, - ).result() - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples/diskAccessExamples/DiskAccessPrivateEndpointConnection_Approve.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/disk_access_examples/disk_access_private_endpoint_connection_delete.py b/sdk/compute/azure-mgmt-compute/generated_samples/disk_access_examples/disk_access_private_endpoint_connection_delete.py deleted file mode 100644 index 8ceb644ac41f..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/disk_access_examples/disk_access_private_endpoint_connection_delete.py +++ /dev/null @@ -1,43 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python disk_access_private_endpoint_connection_delete.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - client.disk_accesses.begin_delete_a_private_endpoint_connection( - resource_group_name="myResourceGroup", - disk_access_name="myDiskAccess", - private_endpoint_connection_name="myPrivateEndpointConnection", - ).result() - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples/diskAccessExamples/DiskAccessPrivateEndpointConnection_Delete.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/disk_access_examples/disk_access_private_endpoint_connection_get.py b/sdk/compute/azure-mgmt-compute/generated_samples/disk_access_examples/disk_access_private_endpoint_connection_get.py deleted file mode 100644 index cba16d9db5d7..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/disk_access_examples/disk_access_private_endpoint_connection_get.py +++ /dev/null @@ -1,44 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python disk_access_private_endpoint_connection_get.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.disk_accesses.get_a_private_endpoint_connection( - resource_group_name="myResourceGroup", - disk_access_name="myDiskAccess", - private_endpoint_connection_name="myPrivateEndpointConnection", - ) - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples/diskAccessExamples/DiskAccessPrivateEndpointConnection_Get.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/disk_access_examples/disk_access_private_endpoint_connection_list_by_disk_access.py b/sdk/compute/azure-mgmt-compute/generated_samples/disk_access_examples/disk_access_private_endpoint_connection_list_by_disk_access.py deleted file mode 100644 index 513592bc7a71..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/disk_access_examples/disk_access_private_endpoint_connection_list_by_disk_access.py +++ /dev/null @@ -1,44 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python disk_access_private_endpoint_connection_list_by_disk_access.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.disk_accesses.list_private_endpoint_connections( - resource_group_name="myResourceGroup", - disk_access_name="myDiskAccess", - ) - for item in response: - print(item) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples/diskAccessExamples/DiskAccessPrivateEndpointConnection_ListByDiskAccess.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/disk_access_examples/disk_access_private_link_resources_get.py b/sdk/compute/azure-mgmt-compute/generated_samples/disk_access_examples/disk_access_private_link_resources_get.py deleted file mode 100644 index b86a599bdc88..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/disk_access_examples/disk_access_private_link_resources_get.py +++ /dev/null @@ -1,43 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python disk_access_private_link_resources_get.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.disk_accesses.get_private_link_resources( - resource_group_name="myResourceGroup", - disk_access_name="myDiskAccess", - ) - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples/diskAccessExamples/DiskAccessPrivateLinkResources_Get.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/disk_access_examples/disk_access_update.py b/sdk/compute/azure-mgmt-compute/generated_samples/disk_access_examples/disk_access_update.py deleted file mode 100644 index 9c6e98367243..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/disk_access_examples/disk_access_update.py +++ /dev/null @@ -1,44 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python disk_access_update.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.disk_accesses.begin_update( - resource_group_name="myResourceGroup", - disk_access_name="myDiskAccess", - disk_access={"tags": {"department": "Development", "project": "PrivateEndpoints"}}, - ).result() - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples/diskAccessExamples/DiskAccess_Update.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/disk_encryption_set_examples/disk_encryption_set_create.py b/sdk/compute/azure-mgmt-compute/generated_samples/disk_encryption_set_examples/disk_encryption_set_create.py deleted file mode 100644 index 409485d00123..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/disk_encryption_set_examples/disk_encryption_set_create.py +++ /dev/null @@ -1,56 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python disk_encryption_set_create.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.disk_encryption_sets.begin_create_or_update( - resource_group_name="myResourceGroup", - disk_encryption_set_name="myDiskEncryptionSet", - disk_encryption_set={ - "identity": {"type": "SystemAssigned"}, - "location": "West US", - "properties": { - "activeKey": { - "keyUrl": "https://myvmvault.vault-int.azure-int.net/keys/{key}", - "sourceVault": { - "id": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.KeyVault/vaults/myVMVault" - }, - }, - "encryptionType": "EncryptionAtRestWithCustomerKey", - }, - }, - ).result() - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples/diskEncryptionSetExamples/DiskEncryptionSet_Create.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/disk_encryption_set_examples/disk_encryption_set_create_with_key_vault_from_adifferent_subscription.py b/sdk/compute/azure-mgmt-compute/generated_samples/disk_encryption_set_examples/disk_encryption_set_create_with_key_vault_from_adifferent_subscription.py deleted file mode 100644 index 3f138c5bb1af..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/disk_encryption_set_examples/disk_encryption_set_create_with_key_vault_from_adifferent_subscription.py +++ /dev/null @@ -1,51 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python disk_encryption_set_create_with_key_vault_from_adifferent_subscription.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.disk_encryption_sets.begin_create_or_update( - resource_group_name="myResourceGroup", - disk_encryption_set_name="myDiskEncryptionSet", - disk_encryption_set={ - "identity": {"type": "SystemAssigned"}, - "location": "West US", - "properties": { - "activeKey": {"keyUrl": "https://myvaultdifferentsub.vault-int.azure-int.net/keys/{key}"}, - "encryptionType": "EncryptionAtRestWithCustomerKey", - }, - }, - ).result() - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples/diskEncryptionSetExamples/DiskEncryptionSet_Create_WithKeyVaultFromADifferentSubscription.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/disk_encryption_set_examples/disk_encryption_set_create_with_key_vault_from_adifferent_tenant.py b/sdk/compute/azure-mgmt-compute/generated_samples/disk_encryption_set_examples/disk_encryption_set_create_with_key_vault_from_adifferent_tenant.py deleted file mode 100644 index 4b7caee59699..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/disk_encryption_set_examples/disk_encryption_set_create_with_key_vault_from_adifferent_tenant.py +++ /dev/null @@ -1,57 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python disk_encryption_set_create_with_key_vault_from_adifferent_tenant.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.disk_encryption_sets.begin_create_or_update( - resource_group_name="myResourceGroup", - disk_encryption_set_name="myDiskEncryptionSet", - disk_encryption_set={ - "identity": { - "type": "UserAssigned", - "userAssignedIdentities": { - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}": {} - }, - }, - "location": "West US", - "properties": { - "activeKey": {"keyUrl": "https://myvaultdifferenttenant.vault-int.azure-int.net/keys/{key}"}, - "encryptionType": "EncryptionAtRestWithCustomerKey", - "federatedClientId": "00000000-0000-0000-0000-000000000000", - }, - }, - ).result() - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples/diskEncryptionSetExamples/DiskEncryptionSet_Create_WithKeyVaultFromADifferentTenant.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/disk_encryption_set_examples/disk_encryption_set_delete.py b/sdk/compute/azure-mgmt-compute/generated_samples/disk_encryption_set_examples/disk_encryption_set_delete.py deleted file mode 100644 index d0f4ffecd61a..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/disk_encryption_set_examples/disk_encryption_set_delete.py +++ /dev/null @@ -1,42 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python disk_encryption_set_delete.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - client.disk_encryption_sets.begin_delete( - resource_group_name="myResourceGroup", - disk_encryption_set_name="myDiskEncryptionSet", - ).result() - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples/diskEncryptionSetExamples/DiskEncryptionSet_Delete.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/disk_encryption_set_examples/disk_encryption_set_get.py b/sdk/compute/azure-mgmt-compute/generated_samples/disk_encryption_set_examples/disk_encryption_set_get.py deleted file mode 100644 index 9b4af2676097..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/disk_encryption_set_examples/disk_encryption_set_get.py +++ /dev/null @@ -1,43 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python disk_encryption_set_get.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.disk_encryption_sets.get( - resource_group_name="myResourceGroup", - disk_encryption_set_name="myDiskEncryptionSet", - ) - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples/diskEncryptionSetExamples/DiskEncryptionSet_Get.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/disk_encryption_set_examples/disk_encryption_set_get_with_auto_key_rotation_error.py b/sdk/compute/azure-mgmt-compute/generated_samples/disk_encryption_set_examples/disk_encryption_set_get_with_auto_key_rotation_error.py deleted file mode 100644 index 459417ed7000..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/disk_encryption_set_examples/disk_encryption_set_get_with_auto_key_rotation_error.py +++ /dev/null @@ -1,43 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python disk_encryption_set_get_with_auto_key_rotation_error.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.disk_encryption_sets.get( - resource_group_name="myResourceGroup", - disk_encryption_set_name="myDiskEncryptionSet", - ) - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples/diskEncryptionSetExamples/DiskEncryptionSet_Get_WithAutoKeyRotationError.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/disk_encryption_set_examples/disk_encryption_set_list_associated_resources.py b/sdk/compute/azure-mgmt-compute/generated_samples/disk_encryption_set_examples/disk_encryption_set_list_associated_resources.py deleted file mode 100644 index 6a96cede92c3..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/disk_encryption_set_examples/disk_encryption_set_list_associated_resources.py +++ /dev/null @@ -1,44 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python disk_encryption_set_list_associated_resources.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.disk_encryption_sets.list_associated_resources( - resource_group_name="myResourceGroup", - disk_encryption_set_name="myDiskEncryptionSet", - ) - for item in response: - print(item) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples/diskEncryptionSetExamples/DiskEncryptionSet_ListAssociatedResources.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/disk_encryption_set_examples/disk_encryption_set_list_by_resource_group.py b/sdk/compute/azure-mgmt-compute/generated_samples/disk_encryption_set_examples/disk_encryption_set_list_by_resource_group.py deleted file mode 100644 index 0dc4fec0afa0..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/disk_encryption_set_examples/disk_encryption_set_list_by_resource_group.py +++ /dev/null @@ -1,43 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python disk_encryption_set_list_by_resource_group.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.disk_encryption_sets.list_by_resource_group( - resource_group_name="myResourceGroup", - ) - for item in response: - print(item) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples/diskEncryptionSetExamples/DiskEncryptionSet_ListByResourceGroup.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/disk_encryption_set_examples/disk_encryption_set_list_by_subscription.py b/sdk/compute/azure-mgmt-compute/generated_samples/disk_encryption_set_examples/disk_encryption_set_list_by_subscription.py deleted file mode 100644 index 9a516db1fbf6..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/disk_encryption_set_examples/disk_encryption_set_list_by_subscription.py +++ /dev/null @@ -1,41 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python disk_encryption_set_list_by_subscription.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.disk_encryption_sets.list() - for item in response: - print(item) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples/diskEncryptionSetExamples/DiskEncryptionSet_ListBySubscription.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/disk_encryption_set_examples/disk_encryption_set_update.py b/sdk/compute/azure-mgmt-compute/generated_samples/disk_encryption_set_examples/disk_encryption_set_update.py deleted file mode 100644 index d293e0dc3703..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/disk_encryption_set_examples/disk_encryption_set_update.py +++ /dev/null @@ -1,55 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python disk_encryption_set_update.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.disk_encryption_sets.begin_update( - resource_group_name="myResourceGroup", - disk_encryption_set_name="myDiskEncryptionSet", - disk_encryption_set={ - "properties": { - "activeKey": { - "keyUrl": "https://myvmvault.vault-int.azure-int.net/keys/keyName/keyVersion", - "sourceVault": { - "id": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.KeyVault/vaults/myVMVault" - }, - }, - "encryptionType": "EncryptionAtRestWithCustomerKey", - }, - "tags": {"department": "Development", "project": "Encryption"}, - }, - ).result() - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples/diskEncryptionSetExamples/DiskEncryptionSet_Update.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/disk_encryption_set_examples/disk_encryption_set_update_with_rotation_to_latest_key_version_enabled.py b/sdk/compute/azure-mgmt-compute/generated_samples/disk_encryption_set_examples/disk_encryption_set_update_with_rotation_to_latest_key_version_enabled.py deleted file mode 100644 index e1ff39946c21..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/disk_encryption_set_examples/disk_encryption_set_update_with_rotation_to_latest_key_version_enabled.py +++ /dev/null @@ -1,51 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python disk_encryption_set_update_with_rotation_to_latest_key_version_enabled.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.disk_encryption_sets.begin_update( - resource_group_name="myResourceGroup", - disk_encryption_set_name="myDiskEncryptionSet", - disk_encryption_set={ - "identity": {"type": "SystemAssigned"}, - "properties": { - "activeKey": {"keyUrl": "https://myvaultdifferentsub.vault-int.azure-int.net/keys/keyName/keyVersion1"}, - "encryptionType": "EncryptionAtRestWithCustomerKey", - "rotationToLatestKeyVersionEnabled": True, - }, - }, - ).result() - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples/diskEncryptionSetExamples/DiskEncryptionSet_Update_WithRotationToLatestKeyVersionEnabled.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/disk_encryption_set_examples/disk_encryption_set_update_with_rotation_to_latest_key_version_enabled_in_progress.py b/sdk/compute/azure-mgmt-compute/generated_samples/disk_encryption_set_examples/disk_encryption_set_update_with_rotation_to_latest_key_version_enabled_in_progress.py deleted file mode 100644 index 4d873e4a921f..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/disk_encryption_set_examples/disk_encryption_set_update_with_rotation_to_latest_key_version_enabled_in_progress.py +++ /dev/null @@ -1,51 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python disk_encryption_set_update_with_rotation_to_latest_key_version_enabled_in_progress.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.disk_encryption_sets.begin_update( - resource_group_name="myResourceGroup", - disk_encryption_set_name="myDiskEncryptionSet", - disk_encryption_set={ - "identity": {"type": "SystemAssigned"}, - "properties": { - "activeKey": {"keyUrl": "https://myvaultdifferentsub.vault-int.azure-int.net/keys/keyName/keyVersion1"}, - "encryptionType": "EncryptionAtRestWithCustomerKey", - "rotationToLatestKeyVersionEnabled": True, - }, - }, - ).result() - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples/diskEncryptionSetExamples/DiskEncryptionSet_Update_WithRotationToLatestKeyVersionEnabledInProgress.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/disk_examples/disk_begin_get_access.py b/sdk/compute/azure-mgmt-compute/generated_samples/disk_examples/disk_begin_get_access.py deleted file mode 100644 index 946b34f4d8ed..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/disk_examples/disk_begin_get_access.py +++ /dev/null @@ -1,44 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python disk_begin_get_access.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.disks.begin_grant_access( - resource_group_name="myResourceGroup", - disk_name="myDisk", - grant_access_data={"access": "Read", "durationInSeconds": 300, "fileFormat": "VHD"}, - ).result() - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples/diskExamples/Disk_BeginGetAccess.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/disk_examples/disk_begin_get_access_with_vm_guest_state.py b/sdk/compute/azure-mgmt-compute/generated_samples/disk_examples/disk_begin_get_access_with_vm_guest_state.py deleted file mode 100644 index 32bc9c7d033e..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/disk_examples/disk_begin_get_access_with_vm_guest_state.py +++ /dev/null @@ -1,44 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python disk_begin_get_access_with_vm_guest_state.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.disks.begin_grant_access( - resource_group_name="myResourceGroup", - disk_name="myDisk", - grant_access_data={"access": "Read", "durationInSeconds": 300, "getSecureVMGuestStateSAS": True}, - ).result() - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples/diskExamples/Disk_BeginGetAccess_WithVMGuestState.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/disk_examples/disk_begin_get_access_with_vm_guest_state_and_vm_metadata.py b/sdk/compute/azure-mgmt-compute/generated_samples/disk_examples/disk_begin_get_access_with_vm_guest_state_and_vm_metadata.py deleted file mode 100644 index 908b2e2b0616..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/disk_examples/disk_begin_get_access_with_vm_guest_state_and_vm_metadata.py +++ /dev/null @@ -1,44 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python disk_begin_get_access_with_vm_guest_state_and_vm_metadata.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.disks.begin_grant_access( - resource_group_name="myResourceGroup", - disk_name="myDisk", - grant_access_data={"access": "Read", "durationInSeconds": 300, "getSecureVMGuestStateSAS": True}, - ).result() - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples/diskExamples/Disk_BeginGetAccess_WithVMGuestStateAndVMMetadata.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/disk_examples/disk_create_by_copying_asnapshot.py b/sdk/compute/azure-mgmt-compute/generated_samples/disk_examples/disk_create_by_copying_asnapshot.py deleted file mode 100644 index 71160555064c..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/disk_examples/disk_create_by_copying_asnapshot.py +++ /dev/null @@ -1,52 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python disk_create_by_copying_asnapshot.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.disks.begin_create_or_update( - resource_group_name="myResourceGroup", - disk_name="myDisk", - disk={ - "location": "West US", - "properties": { - "creationData": { - "createOption": "Copy", - "sourceResourceId": "subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot", - } - }, - }, - ).result() - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples/diskExamples/Disk_Create_ByCopyingASnapshot.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/disk_examples/disk_create_by_importing_blob_from_adifferent_subscription.py b/sdk/compute/azure-mgmt-compute/generated_samples/disk_examples/disk_create_by_importing_blob_from_adifferent_subscription.py deleted file mode 100644 index 6da34dbe312e..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/disk_examples/disk_create_by_importing_blob_from_adifferent_subscription.py +++ /dev/null @@ -1,53 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python disk_create_by_importing_blob_from_adifferent_subscription.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.disks.begin_create_or_update( - resource_group_name="myResourceGroup", - disk_name="myDisk", - disk={ - "location": "West US", - "properties": { - "creationData": { - "createOption": "Import", - "sourceUri": "https://mystorageaccount.blob.core.windows.net/osimages/osimage.vhd", - "storageAccountId": "subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Storage/storageAccounts/myStorageAccount", - } - }, - }, - ).result() - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples/diskExamples/Disk_Create_ByImportingBlobFromADifferentSubscription.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/disk_examples/disk_create_by_importing_blob_from_the_same_subscription.py b/sdk/compute/azure-mgmt-compute/generated_samples/disk_examples/disk_create_by_importing_blob_from_the_same_subscription.py deleted file mode 100644 index a0ab3ebb0785..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/disk_examples/disk_create_by_importing_blob_from_the_same_subscription.py +++ /dev/null @@ -1,52 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python disk_create_by_importing_blob_from_the_same_subscription.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.disks.begin_create_or_update( - resource_group_name="myResourceGroup", - disk_name="myDisk", - disk={ - "location": "West US", - "properties": { - "creationData": { - "createOption": "Import", - "sourceUri": "https://mystorageaccount.blob.core.windows.net/osimages/osimage.vhd", - } - }, - }, - ).result() - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples/diskExamples/Disk_Create_ByImportingBlobFromTheSameSubscription.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/disk_examples/disk_create_confidential_vm_supported_disk_encrypted_with_cmk.py b/sdk/compute/azure-mgmt-compute/generated_samples/disk_examples/disk_create_confidential_vm_supported_disk_encrypted_with_cmk.py deleted file mode 100644 index 133c3b6b5fea..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/disk_examples/disk_create_confidential_vm_supported_disk_encrypted_with_cmk.py +++ /dev/null @@ -1,59 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python disk_create_confidential_vm_supported_disk_encrypted_with_cmk.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscriptionId}", - ) - - response = client.disks.begin_create_or_update( - resource_group_name="myResourceGroup", - disk_name="myDisk", - disk={ - "location": "West US", - "properties": { - "creationData": { - "createOption": "FromImage", - "imageReference": { - "id": "/Subscriptions/{subscriptionId}/Providers/Microsoft.Compute/Locations/westus/Publishers/{publisher}/ArtifactTypes/VMImage/Offers/{offer}/Skus/{sku}/Versions/1.0.0" - }, - }, - "osType": "Windows", - "securityProfile": { - "secureVMDiskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}", - "securityType": "ConfidentialVM_DiskEncryptedWithCustomerKey", - }, - }, - }, - ).result() - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples/diskExamples/Disk_Create_ConfidentialVMSupportedDiskEncryptedWithCMK.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/disk_examples/disk_create_empty.py b/sdk/compute/azure-mgmt-compute/generated_samples/disk_examples/disk_create_empty.py deleted file mode 100644 index 0dc5defe9a3b..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/disk_examples/disk_create_empty.py +++ /dev/null @@ -1,44 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python disk_create_empty.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.disks.begin_create_or_update( - resource_group_name="myResourceGroup", - disk_name="myDisk", - disk={"location": "West US", "properties": {"creationData": {"createOption": "Empty"}, "diskSizeGB": 200}}, - ).result() - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples/diskExamples/Disk_Create_Empty.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/disk_examples/disk_create_from_an_azure_compute_gallery_community_image.py b/sdk/compute/azure-mgmt-compute/generated_samples/disk_examples/disk_create_from_an_azure_compute_gallery_community_image.py deleted file mode 100644 index f5cca43dac27..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/disk_examples/disk_create_from_an_azure_compute_gallery_community_image.py +++ /dev/null @@ -1,55 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python disk_create_from_an_azure_compute_gallery_community_image.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscriptionId}", - ) - - response = client.disks.begin_create_or_update( - resource_group_name="myResourceGroup", - disk_name="myDisk", - disk={ - "location": "West US", - "properties": { - "creationData": { - "createOption": "FromImage", - "galleryImageReference": { - "communityGalleryImageId": "/CommunityGalleries/{communityGalleryPublicGalleryName}/Images/{imageName}/Versions/1.0.0" - }, - }, - "osType": "Windows", - }, - }, - ).result() - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples/diskExamples/Disk_Create_FromAnAzureComputeGalleryCommunityImage.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/disk_examples/disk_create_from_an_azure_compute_gallery_direct_shared_image.py b/sdk/compute/azure-mgmt-compute/generated_samples/disk_examples/disk_create_from_an_azure_compute_gallery_direct_shared_image.py deleted file mode 100644 index 3f30cd3069bd..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/disk_examples/disk_create_from_an_azure_compute_gallery_direct_shared_image.py +++ /dev/null @@ -1,55 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python disk_create_from_an_azure_compute_gallery_direct_shared_image.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscriptionId}", - ) - - response = client.disks.begin_create_or_update( - resource_group_name="myResourceGroup", - disk_name="myDisk", - disk={ - "location": "West US", - "properties": { - "creationData": { - "createOption": "FromImage", - "galleryImageReference": { - "sharedGalleryImageId": "/SharedGalleries/{sharedGalleryUniqueName}/Images/{imageName}/Versions/1.0.0" - }, - }, - "osType": "Windows", - }, - }, - ).result() - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples/diskExamples/Disk_Create_FromAnAzureComputeGalleryDirectSharedImage.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/disk_examples/disk_create_from_an_azure_compute_gallery_image.py b/sdk/compute/azure-mgmt-compute/generated_samples/disk_examples/disk_create_from_an_azure_compute_gallery_image.py deleted file mode 100644 index d5b2018ab21c..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/disk_examples/disk_create_from_an_azure_compute_gallery_image.py +++ /dev/null @@ -1,55 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python disk_create_from_an_azure_compute_gallery_image.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscriptionId}", - ) - - response = client.disks.begin_create_or_update( - resource_group_name="myResourceGroup", - disk_name="myDisk", - disk={ - "location": "West US", - "properties": { - "creationData": { - "createOption": "FromImage", - "galleryImageReference": { - "id": "/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/Providers/Microsoft.Compute/Galleries/{galleryName}/Images/{imageName}/Versions/1.0.0" - }, - }, - "osType": "Windows", - }, - }, - ).result() - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples/diskExamples/Disk_Create_FromAnAzureComputeGalleryImage.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/disk_examples/disk_create_from_an_elastic_san_volume_snapshot.py b/sdk/compute/azure-mgmt-compute/generated_samples/disk_examples/disk_create_from_an_elastic_san_volume_snapshot.py deleted file mode 100644 index 7c55e6593b8a..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/disk_examples/disk_create_from_an_elastic_san_volume_snapshot.py +++ /dev/null @@ -1,52 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python disk_create_from_an_elastic_san_volume_snapshot.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.disks.begin_create_or_update( - resource_group_name="myResourceGroup", - disk_name="myDisk", - disk={ - "location": "West US", - "properties": { - "creationData": { - "createOption": "CopyFromSanSnapshot", - "elasticSanResourceId": "subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.ElasticSan/elasticSans/myElasticSan/volumegroups/myElasticSanVolumeGroup/snapshots/myElasticSanVolumeSnapshot", - } - }, - }, - ).result() - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples/diskExamples/Disk_Create_FromAnElasticSanVolumeSnapshot.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/disk_examples/disk_create_from_an_existing_managed_disk.py b/sdk/compute/azure-mgmt-compute/generated_samples/disk_examples/disk_create_from_an_existing_managed_disk.py deleted file mode 100644 index bfef703810ef..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/disk_examples/disk_create_from_an_existing_managed_disk.py +++ /dev/null @@ -1,52 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python disk_create_from_an_existing_managed_disk.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.disks.begin_create_or_update( - resource_group_name="myResourceGroup", - disk_name="myDisk2", - disk={ - "location": "West US", - "properties": { - "creationData": { - "createOption": "Copy", - "sourceResourceId": "subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myDisk1", - } - }, - }, - ).result() - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples/diskExamples/Disk_Create_FromAnExistingManagedDisk.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/disk_examples/disk_create_from_aplatform_image.py b/sdk/compute/azure-mgmt-compute/generated_samples/disk_examples/disk_create_from_aplatform_image.py deleted file mode 100644 index f41e41eca75a..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/disk_examples/disk_create_from_aplatform_image.py +++ /dev/null @@ -1,55 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python disk_create_from_aplatform_image.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscriptionId}", - ) - - response = client.disks.begin_create_or_update( - resource_group_name="myResourceGroup", - disk_name="myDisk", - disk={ - "location": "West US", - "properties": { - "creationData": { - "createOption": "FromImage", - "imageReference": { - "id": "/Subscriptions/{subscriptionId}/Providers/Microsoft.Compute/Locations/westus/Publishers/{publisher}/ArtifactTypes/VMImage/Offers/{offer}/Skus/{sku}/Versions/1.0.0" - }, - }, - "osType": "Windows", - }, - }, - ).result() - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples/diskExamples/Disk_Create_FromAPlatformImage.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/disk_examples/disk_create_from_import_secure.py b/sdk/compute/azure-mgmt-compute/generated_samples/disk_examples/disk_create_from_import_secure.py deleted file mode 100644 index 510bd4c1b948..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/disk_examples/disk_create_from_import_secure.py +++ /dev/null @@ -1,56 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python disk_create_from_import_secure.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.disks.begin_create_or_update( - resource_group_name="myResourceGroup", - disk_name="myDisk", - disk={ - "location": "West US", - "properties": { - "creationData": { - "createOption": "ImportSecure", - "securityDataUri": "https://mystorageaccount.blob.core.windows.net/osimages/vmgs.vhd", - "sourceUri": "https://mystorageaccount.blob.core.windows.net/osimages/osimage.vhd", - "storageAccountId": "subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Storage/storageAccounts/myStorageAccount", - }, - "osType": "Windows", - "securityProfile": {"securityType": "ConfidentialVM_VMGuestStateOnlyEncryptedWithPlatformKey"}, - }, - }, - ).result() - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples/diskExamples/Disk_Create_FromImportSecure.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/disk_examples/disk_create_from_import_secure_with_vm_metadata.py b/sdk/compute/azure-mgmt-compute/generated_samples/disk_examples/disk_create_from_import_secure_with_vm_metadata.py deleted file mode 100644 index b1dbbee92796..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/disk_examples/disk_create_from_import_secure_with_vm_metadata.py +++ /dev/null @@ -1,57 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python disk_create_from_import_secure_with_vm_metadata.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.disks.begin_create_or_update( - resource_group_name="myResourceGroup", - disk_name="myDisk", - disk={ - "location": "West US", - "properties": { - "creationData": { - "createOption": "ImportSecure", - "securityDataUri": "https://mystorageaccount.blob.core.windows.net/osimages/vmgs.vhd", - "securityMetadataUri": "https://mystorageaccount.blob.core.windows.net/osimages/vmmd.vhd", - "sourceUri": "https://mystorageaccount.blob.core.windows.net/osimages/osimage.vhd", - "storageAccountId": "subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Storage/storageAccounts/myStorageAccount", - }, - "osType": "Windows", - "securityProfile": {"securityType": "ConfidentialVM_VMGuestStateOnlyEncryptedWithPlatformKey"}, - }, - }, - ).result() - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples/diskExamples/Disk_Create_FromImportSecure_WithVMMetadata.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/disk_examples/disk_create_from_upload_prepared_secure.py b/sdk/compute/azure-mgmt-compute/generated_samples/disk_examples/disk_create_from_upload_prepared_secure.py deleted file mode 100644 index a0ea1e933324..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/disk_examples/disk_create_from_upload_prepared_secure.py +++ /dev/null @@ -1,51 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python disk_create_from_upload_prepared_secure.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.disks.begin_create_or_update( - resource_group_name="myResourceGroup", - disk_name="myDisk", - disk={ - "location": "West US", - "properties": { - "creationData": {"createOption": "UploadPreparedSecure", "uploadSizeBytes": 10737418752}, - "osType": "Windows", - "securityProfile": {"securityType": "TrustedLaunch"}, - }, - }, - ).result() - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples/diskExamples/Disk_Create_FromUploadPreparedSecure.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/disk_examples/disk_create_in_extended_location.py b/sdk/compute/azure-mgmt-compute/generated_samples/disk_examples/disk_create_in_extended_location.py deleted file mode 100644 index 3450b9b3fd1b..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/disk_examples/disk_create_in_extended_location.py +++ /dev/null @@ -1,48 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python disk_create_in_extended_location.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.disks.begin_create_or_update( - resource_group_name="myResourceGroup", - disk_name="myDisk", - disk={ - "extendedLocation": {"name": "{edge-zone-id}", "type": "EdgeZone"}, - "location": "West US", - "properties": {"creationData": {"createOption": "Empty"}, "diskSizeGB": 200}, - }, - ).result() - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples/diskExamples/Disk_Create_InExtendedLocation.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/disk_examples/disk_create_or_update_availability_policy.py b/sdk/compute/azure-mgmt-compute/generated_samples/disk_examples/disk_create_or_update_availability_policy.py deleted file mode 100644 index a9b33985453a..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/disk_examples/disk_create_or_update_availability_policy.py +++ /dev/null @@ -1,51 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python disk_create_or_update_availability_policy.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.disks.begin_create_or_update( - resource_group_name="myResourceGroup", - disk_name="myDisk", - disk={ - "location": "West US", - "properties": { - "availabilityPolicy": {"actionOnDiskDelay": "AutomaticReattach"}, - "creationData": {"createOption": "Empty"}, - "diskSizeGB": 1024, - }, - }, - ).result() - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples/diskExamples/Disk_CreateOrUpdate_AvailabilityPolicy.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/disk_examples/disk_create_or_update_bursting_enabled.py b/sdk/compute/azure-mgmt-compute/generated_samples/disk_examples/disk_create_or_update_bursting_enabled.py deleted file mode 100644 index a656422bba6a..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/disk_examples/disk_create_or_update_bursting_enabled.py +++ /dev/null @@ -1,44 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python disk_create_or_update_bursting_enabled.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.disks.begin_update( - resource_group_name="myResourceGroup", - disk_name="myDisk", - disk={"properties": {"burstingEnabled": True, "diskSizeGB": 1024}}, - ).result() - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples/diskExamples/Disk_CreateOrUpdate_BurstingEnabled.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/disk_examples/disk_create_performance_plus.py b/sdk/compute/azure-mgmt-compute/generated_samples/disk_examples/disk_create_performance_plus.py deleted file mode 100644 index 9fa49e35fa45..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/disk_examples/disk_create_performance_plus.py +++ /dev/null @@ -1,47 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python disk_create_performance_plus.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.disks.begin_create_or_update( - resource_group_name="myResourceGroup", - disk_name="myDisk", - disk={ - "location": "West US", - "properties": {"creationData": {"createOption": "Upload", "performancePlus": True}}, - }, - ).result() - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples/diskExamples/Disk_Create_PerformancePlus.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/disk_examples/disk_create_upload_disk.py b/sdk/compute/azure-mgmt-compute/generated_samples/disk_examples/disk_create_upload_disk.py deleted file mode 100644 index 444a2e0ec1a6..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/disk_examples/disk_create_upload_disk.py +++ /dev/null @@ -1,47 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python disk_create_upload_disk.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.disks.begin_create_or_update( - resource_group_name="myResourceGroup", - disk_name="myDisk", - disk={ - "location": "West US", - "properties": {"creationData": {"createOption": "Upload", "uploadSizeBytes": 10737418752}}, - }, - ).result() - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples/diskExamples/Disk_Create_UploadDisk.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/disk_examples/disk_create_with_data_access_auth_mode.py b/sdk/compute/azure-mgmt-compute/generated_samples/disk_examples/disk_create_with_data_access_auth_mode.py deleted file mode 100644 index 3ff02c8fe376..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/disk_examples/disk_create_with_data_access_auth_mode.py +++ /dev/null @@ -1,51 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python disk_create_with_data_access_auth_mode.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.disks.begin_create_or_update( - resource_group_name="myResourceGroup", - disk_name="myDisk", - disk={ - "location": "West US", - "properties": { - "creationData": {"createOption": "Empty"}, - "dataAccessAuthMode": "AzureActiveDirectory", - "diskSizeGB": 200, - }, - }, - ).result() - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples/diskExamples/Disk_Create_WithDataAccessAuthMode.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/disk_examples/disk_create_with_disk_access.py b/sdk/compute/azure-mgmt-compute/generated_samples/disk_examples/disk_create_with_disk_access.py deleted file mode 100644 index 120c5e9f7a96..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/disk_examples/disk_create_with_disk_access.py +++ /dev/null @@ -1,52 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python disk_create_with_disk_access.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.disks.begin_create_or_update( - resource_group_name="myResourceGroup", - disk_name="myDisk", - disk={ - "location": "West US", - "properties": { - "creationData": {"createOption": "Empty"}, - "diskAccessId": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskAccesses/{existing-diskAccess-name}", - "diskSizeGB": 200, - "networkAccessPolicy": "AllowPrivate", - }, - }, - ).result() - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples/diskExamples/Disk_Create_WithDiskAccess.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/disk_examples/disk_create_with_disk_encryption_set.py b/sdk/compute/azure-mgmt-compute/generated_samples/disk_examples/disk_create_with_disk_encryption_set.py deleted file mode 100644 index 693c401407c5..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/disk_examples/disk_create_with_disk_encryption_set.py +++ /dev/null @@ -1,53 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python disk_create_with_disk_encryption_set.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.disks.begin_create_or_update( - resource_group_name="myResourceGroup", - disk_name="myDisk", - disk={ - "location": "West US", - "properties": { - "creationData": {"createOption": "Empty"}, - "diskSizeGB": 200, - "encryption": { - "diskEncryptionSetId": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSets/{existing-diskEncryptionSet-name}" - }, - }, - }, - ).result() - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples/diskExamples/Disk_Create_WithDiskEncryptionSet.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/disk_examples/disk_create_with_logical_sector_size.py b/sdk/compute/azure-mgmt-compute/generated_samples/disk_examples/disk_create_with_logical_sector_size.py deleted file mode 100644 index d1cedd71931d..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/disk_examples/disk_create_with_logical_sector_size.py +++ /dev/null @@ -1,48 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python disk_create_with_logical_sector_size.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.disks.begin_create_or_update( - resource_group_name="myResourceGroup", - disk_name="myDisk", - disk={ - "location": "West US", - "properties": {"creationData": {"createOption": "Empty", "logicalSectorSize": 512}, "diskSizeGB": 200}, - "sku": {"name": "UltraSSD_LRS"}, - }, - ).result() - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples/diskExamples/Disk_Create_WithLogicalSectorSize.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/disk_examples/disk_create_with_optimized_for_frequent_attach.py b/sdk/compute/azure-mgmt-compute/generated_samples/disk_examples/disk_create_with_optimized_for_frequent_attach.py deleted file mode 100644 index c5b021516882..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/disk_examples/disk_create_with_optimized_for_frequent_attach.py +++ /dev/null @@ -1,51 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python disk_create_with_optimized_for_frequent_attach.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.disks.begin_create_or_update( - resource_group_name="myResourceGroup", - disk_name="myDisk", - disk={ - "location": "West US", - "properties": { - "creationData": {"createOption": "Empty"}, - "diskSizeGB": 200, - "optimizedForFrequentAttach": True, - }, - }, - ).result() - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples/diskExamples/Disk_Create_WithOptimizedForFrequentAttach.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/disk_examples/disk_create_with_premium_v2_lrsaccount_type.py b/sdk/compute/azure-mgmt-compute/generated_samples/disk_examples/disk_create_with_premium_v2_lrsaccount_type.py deleted file mode 100644 index a98b736bf308..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/disk_examples/disk_create_with_premium_v2_lrsaccount_type.py +++ /dev/null @@ -1,53 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python disk_create_with_premium_v2_lrsaccount_type.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.disks.begin_create_or_update( - resource_group_name="myResourceGroup", - disk_name="myPremiumV2Disk", - disk={ - "location": "West US", - "properties": { - "creationData": {"createOption": "Empty"}, - "diskIOPSReadWrite": 125, - "diskMBpsReadWrite": 3000, - "diskSizeGB": 200, - }, - "sku": {"name": "PremiumV2_LRS"}, - }, - ).result() - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples/diskExamples/Disk_Create_WithPremiumV2_LRSAccountType.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/disk_examples/disk_create_with_security_profile.py b/sdk/compute/azure-mgmt-compute/generated_samples/disk_examples/disk_create_with_security_profile.py deleted file mode 100644 index e3902ae61b59..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/disk_examples/disk_create_with_security_profile.py +++ /dev/null @@ -1,56 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python disk_create_with_security_profile.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.disks.begin_create_or_update( - resource_group_name="myResourceGroup", - disk_name="myDisk", - disk={ - "location": "North Central US", - "properties": { - "creationData": { - "createOption": "FromImage", - "imageReference": { - "id": "/Subscriptions/{subscriptionId}/Providers/Microsoft.Compute/Locations/uswest/Publishers/Microsoft/ArtifactTypes/VMImage/Offers/{offer}" - }, - }, - "osType": "Windows", - "securityProfile": {"securityType": "TrustedLaunch"}, - }, - }, - ).result() - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples/diskExamples/Disk_Create_WithSecurityProfile.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/disk_examples/disk_create_with_ssdzrs_account_type.py b/sdk/compute/azure-mgmt-compute/generated_samples/disk_examples/disk_create_with_ssdzrs_account_type.py deleted file mode 100644 index acd5133a5d4d..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/disk_examples/disk_create_with_ssdzrs_account_type.py +++ /dev/null @@ -1,48 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python disk_create_with_ssdzrs_account_type.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.disks.begin_create_or_update( - resource_group_name="myResourceGroup", - disk_name="myDisk", - disk={ - "location": "West US", - "properties": {"creationData": {"createOption": "Empty"}, "diskSizeGB": 200}, - "sku": {"name": "Premium_ZRS"}, - }, - ).result() - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples/diskExamples/Disk_Create_WithSSDZRSAccountType.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/disk_examples/disk_create_with_ultra_ssd_read_only.py b/sdk/compute/azure-mgmt-compute/generated_samples/disk_examples/disk_create_with_ultra_ssd_read_only.py deleted file mode 100644 index 45b0b1c65d3f..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/disk_examples/disk_create_with_ultra_ssd_read_only.py +++ /dev/null @@ -1,54 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python disk_create_with_ultra_ssd_read_only.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.disks.begin_create_or_update( - resource_group_name="myResourceGroup", - disk_name="myUltraReadOnlyDisk", - disk={ - "location": "West US", - "properties": { - "creationData": {"createOption": "Empty", "logicalSectorSize": 4096}, - "diskIOPSReadWrite": 125, - "diskMBpsReadWrite": 3000, - "diskSizeGB": 200, - "encryption": {"type": "EncryptionAtRestWithPlatformKey"}, - }, - "sku": {"name": "UltraSSD_LRS"}, - }, - ).result() - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples/diskExamples/Disk_Create_WithUltraSSD_ReadOnly.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/disk_examples/disk_delete.py b/sdk/compute/azure-mgmt-compute/generated_samples/disk_examples/disk_delete.py deleted file mode 100644 index cbd486988e07..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/disk_examples/disk_delete.py +++ /dev/null @@ -1,42 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python disk_delete.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - client.disks.begin_delete( - resource_group_name="myResourceGroup", - disk_name="myDisk", - ).result() - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples/diskExamples/Disk_Delete.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/disk_examples/disk_end_get_access.py b/sdk/compute/azure-mgmt-compute/generated_samples/disk_examples/disk_end_get_access.py deleted file mode 100644 index 2eb57ad85526..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/disk_examples/disk_end_get_access.py +++ /dev/null @@ -1,42 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python disk_end_get_access.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - client.disks.begin_revoke_access( - resource_group_name="myResourceGroup", - disk_name="myDisk", - ).result() - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples/diskExamples/Disk_EndGetAccess.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/disk_examples/disk_get.py b/sdk/compute/azure-mgmt-compute/generated_samples/disk_examples/disk_get.py deleted file mode 100644 index 803af9c8b055..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/disk_examples/disk_get.py +++ /dev/null @@ -1,43 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python disk_get.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.disks.get( - resource_group_name="myResourceGroup", - disk_name="myManagedDisk", - ) - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples/diskExamples/Disk_Get.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/disk_examples/disk_list_by_resource_group.py b/sdk/compute/azure-mgmt-compute/generated_samples/disk_examples/disk_list_by_resource_group.py deleted file mode 100644 index 42d2800a8fae..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/disk_examples/disk_list_by_resource_group.py +++ /dev/null @@ -1,43 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python disk_list_by_resource_group.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.disks.list_by_resource_group( - resource_group_name="myResourceGroup", - ) - for item in response: - print(item) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples/diskExamples/Disk_ListByResourceGroup.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/disk_examples/disk_list_by_subscription.py b/sdk/compute/azure-mgmt-compute/generated_samples/disk_examples/disk_list_by_subscription.py deleted file mode 100644 index 4c2ac4504782..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/disk_examples/disk_list_by_subscription.py +++ /dev/null @@ -1,41 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python disk_list_by_subscription.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.disks.list() - for item in response: - print(item) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples/diskExamples/Disk_ListBySubscription.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/disk_examples/disk_update_add_accelerated_networking.py b/sdk/compute/azure-mgmt-compute/generated_samples/disk_examples/disk_update_add_accelerated_networking.py deleted file mode 100644 index ed0441545e25..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/disk_examples/disk_update_add_accelerated_networking.py +++ /dev/null @@ -1,44 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python disk_update_add_accelerated_networking.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.disks.begin_update( - resource_group_name="myResourceGroup", - disk_name="myDisk", - disk={"properties": {"supportedCapabilities": {"acceleratedNetwork": False}}}, - ).result() - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples/diskExamples/Disk_Update_AddAcceleratedNetworking.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/disk_examples/disk_update_add_disk_controller_types.py b/sdk/compute/azure-mgmt-compute/generated_samples/disk_examples/disk_update_add_disk_controller_types.py deleted file mode 100644 index b3cda1c6165b..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/disk_examples/disk_update_add_disk_controller_types.py +++ /dev/null @@ -1,44 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python disk_update_add_disk_controller_types.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.disks.begin_update( - resource_group_name="myResourceGroup", - disk_name="myDisk", - disk={"properties": {"supportedCapabilities": {"diskControllerTypes": "SCSI"}}}, - ).result() - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples/diskExamples/Disk_Update_AddDiskControllerTypes.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/disk_examples/disk_update_add_purchase_plan.py b/sdk/compute/azure-mgmt-compute/generated_samples/disk_examples/disk_update_add_purchase_plan.py deleted file mode 100644 index 6e6624cfa976..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/disk_examples/disk_update_add_purchase_plan.py +++ /dev/null @@ -1,53 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python disk_update_add_purchase_plan.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.disks.begin_update( - resource_group_name="myResourceGroup", - disk_name="myDisk", - disk={ - "properties": { - "purchasePlan": { - "name": "myPurchasePlanName", - "product": "myPurchasePlanProduct", - "promotionCode": "myPurchasePlanPromotionCode", - "publisher": "myPurchasePlanPublisher", - } - } - }, - ).result() - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples/diskExamples/Disk_Update_AddPurchasePlan.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/disk_examples/disk_update_add_supports_hibernation.py b/sdk/compute/azure-mgmt-compute/generated_samples/disk_examples/disk_update_add_supports_hibernation.py deleted file mode 100644 index aca417dbf898..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/disk_examples/disk_update_add_supports_hibernation.py +++ /dev/null @@ -1,44 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python disk_update_add_supports_hibernation.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.disks.begin_update( - resource_group_name="myResourceGroup", - disk_name="myDisk", - disk={"properties": {"supportsHibernation": True}}, - ).result() - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples/diskExamples/Disk_Update_AddSupportsHibernation.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/disk_examples/disk_update_change_tier.py b/sdk/compute/azure-mgmt-compute/generated_samples/disk_examples/disk_update_change_tier.py deleted file mode 100644 index 5263940d98df..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/disk_examples/disk_update_change_tier.py +++ /dev/null @@ -1,44 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python disk_update_change_tier.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.disks.begin_update( - resource_group_name="myResourceGroup", - disk_name="myDisk", - disk={"properties": {"tier": "P30"}}, - ).result() - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples/diskExamples/Disk_Update_ChangeTier.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/disk_examples/disk_update_disable_bursting.py b/sdk/compute/azure-mgmt-compute/generated_samples/disk_examples/disk_update_disable_bursting.py deleted file mode 100644 index ec864151c171..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/disk_examples/disk_update_disable_bursting.py +++ /dev/null @@ -1,44 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python disk_update_disable_bursting.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.disks.begin_update( - resource_group_name="myResourceGroup", - disk_name="myDisk", - disk={"properties": {"burstingEnabled": False}}, - ).result() - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples/diskExamples/Disk_Update_DisableBursting.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/disk_examples/disk_update_disable_optimized_for_frequent_attach.py b/sdk/compute/azure-mgmt-compute/generated_samples/disk_examples/disk_update_disable_optimized_for_frequent_attach.py deleted file mode 100644 index 0384a0e8426e..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/disk_examples/disk_update_disable_optimized_for_frequent_attach.py +++ /dev/null @@ -1,44 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python disk_update_disable_optimized_for_frequent_attach.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.disks.begin_update( - resource_group_name="myResourceGroup", - disk_name="myDisk", - disk={"properties": {"optimizedForFrequentAttach": False}}, - ).result() - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples/diskExamples/Disk_Update_DisableOptimizedForFrequentAttach.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/disk_examples/disk_update_remove_disk_access.py b/sdk/compute/azure-mgmt-compute/generated_samples/disk_examples/disk_update_remove_disk_access.py deleted file mode 100644 index 42e0d724795f..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/disk_examples/disk_update_remove_disk_access.py +++ /dev/null @@ -1,44 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python disk_update_remove_disk_access.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.disks.begin_update( - resource_group_name="myResourceGroup", - disk_name="myDisk", - disk={"properties": {"networkAccessPolicy": "AllowAll"}}, - ).result() - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples/diskExamples/Disk_Update_RemoveDiskAccess.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/disk_examples/disk_update_to_add_architecture.py b/sdk/compute/azure-mgmt-compute/generated_samples/disk_examples/disk_update_to_add_architecture.py deleted file mode 100644 index 592968c4f742..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/disk_examples/disk_update_to_add_architecture.py +++ /dev/null @@ -1,44 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python disk_update_to_add_architecture.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.disks.begin_update( - resource_group_name="myResourceGroup", - disk_name="myDisk", - disk={"properties": {"supportedCapabilities": {"architecture": "Arm64"}}}, - ).result() - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples/diskExamples/Disk_Update_ToAddArchitecture.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/disk_restore_point_examples/disk_restore_point_begin_get_access.py b/sdk/compute/azure-mgmt-compute/generated_samples/disk_restore_point_examples/disk_restore_point_begin_get_access.py deleted file mode 100644 index 5f5c06fd4712..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/disk_restore_point_examples/disk_restore_point_begin_get_access.py +++ /dev/null @@ -1,46 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python disk_restore_point_begin_get_access.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.disk_restore_point.begin_grant_access( - resource_group_name="myResourceGroup", - restore_point_collection_name="rpc", - vm_restore_point_name="vmrp", - disk_restore_point_name="TestDisk45ceb03433006d1baee0_b70cd924-3362-4a80-93c2-9415eaa12745", - grant_access_data={"access": "Read", "durationInSeconds": 300, "fileFormat": "VHDX"}, - ).result() - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples/diskRestorePointExamples/DiskRestorePoint_BeginGetAccess.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/disk_restore_point_examples/disk_restore_point_end_get_access.py b/sdk/compute/azure-mgmt-compute/generated_samples/disk_restore_point_examples/disk_restore_point_end_get_access.py deleted file mode 100644 index 3df6841a01b0..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/disk_restore_point_examples/disk_restore_point_end_get_access.py +++ /dev/null @@ -1,44 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python disk_restore_point_end_get_access.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - client.disk_restore_point.begin_revoke_access( - resource_group_name="myResourceGroup", - restore_point_collection_name="rpc", - vm_restore_point_name="vmrp", - disk_restore_point_name="TestDisk45ceb03433006d1baee0_b70cd924-3362-4a80-93c2-9415eaa12745", - ).result() - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples/diskRestorePointExamples/DiskRestorePoint_EndGetAccess.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/disk_restore_point_examples/disk_restore_point_get.py b/sdk/compute/azure-mgmt-compute/generated_samples/disk_restore_point_examples/disk_restore_point_get.py deleted file mode 100644 index 827f9bb6c942..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/disk_restore_point_examples/disk_restore_point_get.py +++ /dev/null @@ -1,45 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python disk_restore_point_get.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.disk_restore_point.get( - resource_group_name="myResourceGroup", - restore_point_collection_name="rpc", - vm_restore_point_name="vmrp", - disk_restore_point_name="TestDisk45ceb03433006d1baee0_b70cd924-3362-4a80-93c2-9415eaa12745", - ) - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples/diskRestorePointExamples/DiskRestorePoint_Get.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/disk_restore_point_examples/disk_restore_point_get_when_source_resource_is_from_different_region.py b/sdk/compute/azure-mgmt-compute/generated_samples/disk_restore_point_examples/disk_restore_point_get_when_source_resource_is_from_different_region.py deleted file mode 100644 index 1ec50b6840ae..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/disk_restore_point_examples/disk_restore_point_get_when_source_resource_is_from_different_region.py +++ /dev/null @@ -1,45 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python disk_restore_point_get_when_source_resource_is_from_different_region.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.disk_restore_point.get( - resource_group_name="myResourceGroup", - restore_point_collection_name="rpc", - vm_restore_point_name="vmrp", - disk_restore_point_name="TestDisk45ceb03433006d1baee0_b70cd924-3362-4a80-93c2-9415eaa12745", - ) - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples/diskRestorePointExamples/DiskRestorePoint_Get_WhenSourceResourceIsFromDifferentRegion.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/disk_restore_point_examples/disk_restore_point_list_by_vm_restore_point.py b/sdk/compute/azure-mgmt-compute/generated_samples/disk_restore_point_examples/disk_restore_point_list_by_vm_restore_point.py deleted file mode 100644 index 8cbea8e80192..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/disk_restore_point_examples/disk_restore_point_list_by_vm_restore_point.py +++ /dev/null @@ -1,45 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python disk_restore_point_list_by_vm_restore_point.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.disk_restore_point.list_by_restore_point( - resource_group_name="myResourceGroup", - restore_point_collection_name="rpc", - vm_restore_point_name="vmrp", - ) - for item in response: - print(item) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples/diskRestorePointExamples/DiskRestorePoint_ListByVmRestorePoint.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/gallery_examples/community_gallery_create.py b/sdk/compute/azure-mgmt-compute/generated_samples/gallery_examples/community_gallery_create.py deleted file mode 100644 index 320d3673cf4f..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/gallery_examples/community_gallery_create.py +++ /dev/null @@ -1,58 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python community_gallery_create.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.galleries.begin_create_or_update( - resource_group_name="myResourceGroup", - gallery_name="myGalleryName", - gallery={ - "location": "West US", - "properties": { - "description": "This is the gallery description.", - "sharingProfile": { - "communityGalleryInfo": { - "eula": "eula", - "publicNamePrefix": "PirPublic", - "publisherContact": "pir@microsoft.com", - "publisherUri": "uri", - }, - "permissions": "Community", - }, - }, - }, - ).result() - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples/galleryExamples/CommunityGallery_Create.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/gallery_examples/community_gallery_get.py b/sdk/compute/azure-mgmt-compute/generated_samples/gallery_examples/community_gallery_get.py deleted file mode 100644 index c5d195e62d1c..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/gallery_examples/community_gallery_get.py +++ /dev/null @@ -1,43 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python community_gallery_get.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.galleries.get( - resource_group_name="myResourceGroup", - gallery_name="myGalleryName", - ) - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples/galleryExamples/CommunityGallery_Get.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/gallery_examples/gallery_add_to_sharing_profile.py b/sdk/compute/azure-mgmt-compute/generated_samples/gallery_examples/gallery_add_to_sharing_profile.py deleted file mode 100644 index fbd6bd74f01c..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/gallery_examples/gallery_add_to_sharing_profile.py +++ /dev/null @@ -1,53 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python gallery_add_to_sharing_profile.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.gallery_sharing_profile.begin_update( - resource_group_name="myResourceGroup", - gallery_name="myGalleryName", - sharing_update={ - "groups": [ - { - "ids": ["34a4ab42-0d72-47d9-bd1a-aed207386dac", "380fd389-260b-41aa-bad9-0a83108c370b"], - "type": "Subscriptions", - }, - {"ids": ["c24c76aa-8897-4027-9b03-8f7928b54ff6"], "type": "AADTenants"}, - ], - "operationType": "Add", - }, - ).result() - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples/galleryExamples/Gallery_AddToSharingProfile.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/gallery_examples/gallery_application_create.py b/sdk/compute/azure-mgmt-compute/generated_samples/gallery_examples/gallery_application_create.py deleted file mode 100644 index 6f29ffc1bf14..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/gallery_examples/gallery_application_create.py +++ /dev/null @@ -1,70 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python gallery_application_create.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.gallery_applications.begin_create_or_update( - resource_group_name="myResourceGroup", - gallery_name="myGalleryName", - gallery_application_name="myGalleryApplicationName", - gallery_application={ - "location": "West US", - "properties": { - "customActions": [ - { - "description": "This is the custom action description.", - "name": "myCustomAction", - "parameters": [ - { - "defaultValue": "default value of parameter.", - "description": "This is the description of the parameter", - "name": "myCustomActionParameter", - "required": False, - "type": "String", - } - ], - "script": "myCustomActionScript", - } - ], - "description": "This is the gallery application description.", - "eula": "This is the gallery application EULA.", - "privacyStatementUri": "myPrivacyStatementUri}", - "releaseNoteUri": "myReleaseNoteUri", - "supportedOSType": "Windows", - }, - }, - ).result() - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples/galleryExamples/GalleryApplication_Create.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/gallery_examples/gallery_application_delete.py b/sdk/compute/azure-mgmt-compute/generated_samples/gallery_examples/gallery_application_delete.py deleted file mode 100644 index bcfd2a28055c..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/gallery_examples/gallery_application_delete.py +++ /dev/null @@ -1,43 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python gallery_application_delete.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - client.gallery_applications.begin_delete( - resource_group_name="myResourceGroup", - gallery_name="myGalleryName", - gallery_application_name="myGalleryApplicationName", - ).result() - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples/galleryExamples/GalleryApplication_Delete.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/gallery_examples/gallery_application_get.py b/sdk/compute/azure-mgmt-compute/generated_samples/gallery_examples/gallery_application_get.py deleted file mode 100644 index 4a8a0c285f38..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/gallery_examples/gallery_application_get.py +++ /dev/null @@ -1,44 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python gallery_application_get.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.gallery_applications.get( - resource_group_name="myResourceGroup", - gallery_name="myGalleryName", - gallery_application_name="myGalleryApplicationName", - ) - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples/galleryExamples/GalleryApplication_Get.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/gallery_examples/gallery_application_list_by_gallery.py b/sdk/compute/azure-mgmt-compute/generated_samples/gallery_examples/gallery_application_list_by_gallery.py deleted file mode 100644 index 51066e7f3813..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/gallery_examples/gallery_application_list_by_gallery.py +++ /dev/null @@ -1,44 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python gallery_application_list_by_gallery.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.gallery_applications.list_by_gallery( - resource_group_name="myResourceGroup", - gallery_name="myGalleryName", - ) - for item in response: - print(item) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples/galleryExamples/GalleryApplication_ListByGallery.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/gallery_examples/gallery_application_update.py b/sdk/compute/azure-mgmt-compute/generated_samples/gallery_examples/gallery_application_update.py deleted file mode 100644 index c2b2d45150a4..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/gallery_examples/gallery_application_update.py +++ /dev/null @@ -1,69 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python gallery_application_update.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.gallery_applications.begin_update( - resource_group_name="myResourceGroup", - gallery_name="myGalleryName", - gallery_application_name="myGalleryApplicationName", - gallery_application={ - "properties": { - "customActions": [ - { - "description": "This is the custom action description.", - "name": "myCustomAction", - "parameters": [ - { - "defaultValue": "default value of parameter.", - "description": "This is the description of the parameter", - "name": "myCustomActionParameter", - "required": False, - "type": "String", - } - ], - "script": "myCustomActionScript", - } - ], - "description": "This is the gallery application description.", - "eula": "This is the gallery application EULA.", - "privacyStatementUri": "myPrivacyStatementUri}", - "releaseNoteUri": "myReleaseNoteUri", - "supportedOSType": "Windows", - } - }, - ).result() - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples/galleryExamples/GalleryApplication_Update.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/gallery_examples/gallery_application_version_create.py b/sdk/compute/azure-mgmt-compute/generated_samples/gallery_examples/gallery_application_version_create.py deleted file mode 100644 index dff365ef5f19..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/gallery_examples/gallery_application_version_create.py +++ /dev/null @@ -1,87 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python gallery_application_version_create.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.gallery_application_versions.begin_create_or_update( - resource_group_name="myResourceGroup", - gallery_name="myGalleryName", - gallery_application_name="myGalleryApplicationName", - gallery_application_version_name="1.0.0", - gallery_application_version={ - "location": "West US", - "properties": { - "publishingProfile": { - "customActions": [ - { - "description": "This is the custom action description.", - "name": "myCustomAction", - "parameters": [ - { - "defaultValue": "default value of parameter.", - "description": "This is the description of the parameter", - "name": "myCustomActionParameter", - "required": False, - "type": "String", - } - ], - "script": "myCustomActionScript", - } - ], - "endOfLifeDate": "2019-07-01T07:00:00Z", - "manageActions": { - "install": 'powershell -command "Expand-Archive -Path package.zip -DestinationPath C:\\package"', - "remove": "del C:\\package ", - }, - "replicaCount": 1, - "source": { - "mediaLink": "https://mystorageaccount.blob.core.windows.net/mycontainer/package.zip?{sasKey}" - }, - "storageAccountType": "Standard_LRS", - "targetRegions": [ - { - "excludeFromLatest": False, - "name": "West US", - "regionalReplicaCount": 1, - "storageAccountType": "Standard_LRS", - } - ], - }, - "safetyProfile": {"allowDeletionOfReplicatedLocations": False}, - }, - }, - ).result() - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples/galleryExamples/GalleryApplicationVersion_Create.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/gallery_examples/gallery_application_version_delete.py b/sdk/compute/azure-mgmt-compute/generated_samples/gallery_examples/gallery_application_version_delete.py deleted file mode 100644 index 87fc01240917..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/gallery_examples/gallery_application_version_delete.py +++ /dev/null @@ -1,44 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python gallery_application_version_delete.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - client.gallery_application_versions.begin_delete( - resource_group_name="myResourceGroup", - gallery_name="myGalleryName", - gallery_application_name="myGalleryApplicationName", - gallery_application_version_name="1.0.0", - ).result() - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples/galleryExamples/GalleryApplicationVersion_Delete.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/gallery_examples/gallery_application_version_get.py b/sdk/compute/azure-mgmt-compute/generated_samples/gallery_examples/gallery_application_version_get.py deleted file mode 100644 index 47e78c452174..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/gallery_examples/gallery_application_version_get.py +++ /dev/null @@ -1,45 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python gallery_application_version_get.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.gallery_application_versions.get( - resource_group_name="myResourceGroup", - gallery_name="myGalleryName", - gallery_application_name="myGalleryApplicationName", - gallery_application_version_name="1.0.0", - ) - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples/galleryExamples/GalleryApplicationVersion_Get.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/gallery_examples/gallery_application_version_get_with_replication_status.py b/sdk/compute/azure-mgmt-compute/generated_samples/gallery_examples/gallery_application_version_get_with_replication_status.py deleted file mode 100644 index 7278f5625adc..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/gallery_examples/gallery_application_version_get_with_replication_status.py +++ /dev/null @@ -1,45 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python gallery_application_version_get_with_replication_status.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.gallery_application_versions.get( - resource_group_name="myResourceGroup", - gallery_name="myGalleryName", - gallery_application_name="myGalleryApplicationName", - gallery_application_version_name="1.0.0", - ) - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples/galleryExamples/GalleryApplicationVersion_Get_WithReplicationStatus.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/gallery_examples/gallery_application_version_list_by_gallery_application.py b/sdk/compute/azure-mgmt-compute/generated_samples/gallery_examples/gallery_application_version_list_by_gallery_application.py deleted file mode 100644 index 9bf325caaab6..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/gallery_examples/gallery_application_version_list_by_gallery_application.py +++ /dev/null @@ -1,45 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python gallery_application_version_list_by_gallery_application.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.gallery_application_versions.list_by_gallery_application( - resource_group_name="myResourceGroup", - gallery_name="myGalleryName", - gallery_application_name="myGalleryApplicationName", - ) - for item in response: - print(item) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples/galleryExamples/GalleryApplicationVersion_ListByGalleryApplication.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/gallery_examples/gallery_application_version_update.py b/sdk/compute/azure-mgmt-compute/generated_samples/gallery_examples/gallery_application_version_update.py deleted file mode 100644 index c0b1e842151a..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/gallery_examples/gallery_application_version_update.py +++ /dev/null @@ -1,70 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python gallery_application_version_update.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.gallery_application_versions.begin_update( - resource_group_name="myResourceGroup", - gallery_name="myGalleryName", - gallery_application_name="myGalleryApplicationName", - gallery_application_version_name="1.0.0", - gallery_application_version={ - "properties": { - "publishingProfile": { - "endOfLifeDate": "2019-07-01T07:00:00Z", - "manageActions": { - "install": 'powershell -command "Expand-Archive -Path package.zip -DestinationPath C:\\package"', - "remove": "del C:\\package ", - }, - "replicaCount": 1, - "source": { - "mediaLink": "https://mystorageaccount.blob.core.windows.net/mycontainer/package.zip?{sasKey}" - }, - "storageAccountType": "Standard_LRS", - "targetRegions": [ - { - "excludeFromLatest": False, - "name": "West US", - "regionalReplicaCount": 1, - "storageAccountType": "Standard_LRS", - } - ], - }, - "safetyProfile": {"allowDeletionOfReplicatedLocations": False}, - } - }, - ).result() - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples/galleryExamples/GalleryApplicationVersion_Update.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/gallery_examples/gallery_create.py b/sdk/compute/azure-mgmt-compute/generated_samples/gallery_examples/gallery_create.py deleted file mode 100644 index 4bc1663f293d..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/gallery_examples/gallery_create.py +++ /dev/null @@ -1,44 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python gallery_create.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.galleries.begin_create_or_update( - resource_group_name="myResourceGroup", - gallery_name="myGalleryName", - gallery={"location": "West US", "properties": {"description": "This is the gallery description."}}, - ).result() - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples/galleryExamples/Gallery_Create.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/gallery_examples/gallery_create_soft_deletion_enabled.py b/sdk/compute/azure-mgmt-compute/generated_samples/gallery_examples/gallery_create_soft_deletion_enabled.py deleted file mode 100644 index 4cc2f2dadd72..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/gallery_examples/gallery_create_soft_deletion_enabled.py +++ /dev/null @@ -1,50 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python gallery_create_soft_deletion_enabled.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.galleries.begin_create_or_update( - resource_group_name="myResourceGroup", - gallery_name="myGalleryName", - gallery={ - "location": "West US", - "properties": { - "description": "This is the gallery description.", - "softDeletePolicy": {"isSoftDeleteEnabled": True}, - }, - }, - ).result() - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples/galleryExamples/Gallery_Create_SoftDeletionEnabled.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/gallery_examples/gallery_create_with_managed_identity.py b/sdk/compute/azure-mgmt-compute/generated_samples/gallery_examples/gallery_create_with_managed_identity.py deleted file mode 100644 index 904241728922..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/gallery_examples/gallery_create_with_managed_identity.py +++ /dev/null @@ -1,53 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python gallery_create_with_managed_identity.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.galleries.begin_create_or_update( - resource_group_name="myResourceGroup", - gallery_name="myGalleryName", - gallery={ - "identity": { - "type": "SystemAssigned, UserAssigned", - "userAssignedIdentities": { - "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/myIdentity": {} - }, - }, - "location": "West US", - "properties": {"description": "This is the gallery description."}, - }, - ).result() - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples/galleryExamples/Gallery_Create_WithManagedIdentity.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/gallery_examples/gallery_create_with_sharing_profile.py b/sdk/compute/azure-mgmt-compute/generated_samples/gallery_examples/gallery_create_with_sharing_profile.py deleted file mode 100644 index a7d4d881fdee..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/gallery_examples/gallery_create_with_sharing_profile.py +++ /dev/null @@ -1,50 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python gallery_create_with_sharing_profile.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.galleries.begin_create_or_update( - resource_group_name="myResourceGroup", - gallery_name="myGalleryName", - gallery={ - "location": "West US", - "properties": { - "description": "This is the gallery description.", - "sharingProfile": {"permissions": "Groups"}, - }, - }, - ).result() - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples/galleryExamples/Gallery_Create_WithSharingProfile.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/gallery_examples/gallery_delete.py b/sdk/compute/azure-mgmt-compute/generated_samples/gallery_examples/gallery_delete.py deleted file mode 100644 index 4ac78c84dfff..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/gallery_examples/gallery_delete.py +++ /dev/null @@ -1,42 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python gallery_delete.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - client.galleries.begin_delete( - resource_group_name="myResourceGroup", - gallery_name="myGalleryName", - ).result() - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples/galleryExamples/Gallery_Delete.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/gallery_examples/gallery_enable_community_gallery.py b/sdk/compute/azure-mgmt-compute/generated_samples/gallery_examples/gallery_enable_community_gallery.py deleted file mode 100644 index b19bdacd9ab7..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/gallery_examples/gallery_enable_community_gallery.py +++ /dev/null @@ -1,44 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python gallery_enable_community_gallery.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.gallery_sharing_profile.begin_update( - resource_group_name="myResourceGroup", - gallery_name="myGalleryName", - sharing_update={"operationType": "EnableCommunity"}, - ).result() - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples/galleryExamples/Gallery_EnableCommunityGallery.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/gallery_examples/gallery_get.py b/sdk/compute/azure-mgmt-compute/generated_samples/gallery_examples/gallery_get.py deleted file mode 100644 index 0efed9e39e6f..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/gallery_examples/gallery_get.py +++ /dev/null @@ -1,43 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python gallery_get.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.galleries.get( - resource_group_name="myResourceGroup", - gallery_name="myGalleryName", - ) - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples/galleryExamples/Gallery_Get.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/gallery_examples/gallery_get_with_expand_sharing_profile_groups.py b/sdk/compute/azure-mgmt-compute/generated_samples/gallery_examples/gallery_get_with_expand_sharing_profile_groups.py deleted file mode 100644 index 6329486a6041..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/gallery_examples/gallery_get_with_expand_sharing_profile_groups.py +++ /dev/null @@ -1,43 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python gallery_get_with_expand_sharing_profile_groups.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.galleries.get( - resource_group_name="myResourceGroup", - gallery_name="myGalleryName", - ) - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples/galleryExamples/Gallery_Get_WithExpandSharingProfileGroups.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/gallery_examples/gallery_get_with_managed_identity.py b/sdk/compute/azure-mgmt-compute/generated_samples/gallery_examples/gallery_get_with_managed_identity.py deleted file mode 100644 index 3c79b3674317..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/gallery_examples/gallery_get_with_managed_identity.py +++ /dev/null @@ -1,43 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python gallery_get_with_managed_identity.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.galleries.get( - resource_group_name="myResourceGroup", - gallery_name="myGalleryName", - ) - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples/galleryExamples/Gallery_Get_WithManagedIdentity.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/gallery_examples/gallery_get_with_select_permissions.py b/sdk/compute/azure-mgmt-compute/generated_samples/gallery_examples/gallery_get_with_select_permissions.py deleted file mode 100644 index f2170bd7d77b..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/gallery_examples/gallery_get_with_select_permissions.py +++ /dev/null @@ -1,43 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python gallery_get_with_select_permissions.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.galleries.get( - resource_group_name="myResourceGroup", - gallery_name="myGalleryName", - ) - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples/galleryExamples/Gallery_Get_WithSelectPermissions.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/gallery_examples/gallery_image_create.py b/sdk/compute/azure-mgmt-compute/generated_samples/gallery_examples/gallery_image_create.py deleted file mode 100644 index d6af4c64d7fd..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/gallery_examples/gallery_image_create.py +++ /dev/null @@ -1,53 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python gallery_image_create.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.gallery_images.begin_create_or_update( - resource_group_name="myResourceGroup", - gallery_name="myGalleryName", - gallery_image_name="myGalleryImageName", - gallery_image={ - "location": "West US", - "properties": { - "hyperVGeneration": "V1", - "identifier": {"offer": "myOfferName", "publisher": "myPublisherName", "sku": "mySkuName"}, - "osState": "Generalized", - "osType": "Windows", - }, - }, - ).result() - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples/galleryExamples/GalleryImage_Create.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/gallery_examples/gallery_image_delete.py b/sdk/compute/azure-mgmt-compute/generated_samples/gallery_examples/gallery_image_delete.py deleted file mode 100644 index d6d45b0e8781..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/gallery_examples/gallery_image_delete.py +++ /dev/null @@ -1,43 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python gallery_image_delete.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - client.gallery_images.begin_delete( - resource_group_name="myResourceGroup", - gallery_name="myGalleryName", - gallery_image_name="myGalleryImageName", - ).result() - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples/galleryExamples/GalleryImage_Delete.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/gallery_examples/gallery_image_get.py b/sdk/compute/azure-mgmt-compute/generated_samples/gallery_examples/gallery_image_get.py deleted file mode 100644 index 79eafe07a3f5..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/gallery_examples/gallery_image_get.py +++ /dev/null @@ -1,44 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python gallery_image_get.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.gallery_images.get( - resource_group_name="myResourceGroup", - gallery_name="myGalleryName", - gallery_image_name="myGalleryImageName", - ) - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples/galleryExamples/GalleryImage_Get.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/gallery_examples/gallery_image_list_by_gallery.py b/sdk/compute/azure-mgmt-compute/generated_samples/gallery_examples/gallery_image_list_by_gallery.py deleted file mode 100644 index 4f97b31446e1..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/gallery_examples/gallery_image_list_by_gallery.py +++ /dev/null @@ -1,44 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python gallery_image_list_by_gallery.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.gallery_images.list_by_gallery( - resource_group_name="myResourceGroup", - gallery_name="myGalleryName", - ) - for item in response: - print(item) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples/galleryExamples/GalleryImage_ListByGallery.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/gallery_examples/gallery_image_update.py b/sdk/compute/azure-mgmt-compute/generated_samples/gallery_examples/gallery_image_update.py deleted file mode 100644 index 23046405631a..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/gallery_examples/gallery_image_update.py +++ /dev/null @@ -1,52 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python gallery_image_update.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.gallery_images.begin_update( - resource_group_name="myResourceGroup", - gallery_name="myGalleryName", - gallery_image_name="myGalleryImageName", - gallery_image={ - "properties": { - "hyperVGeneration": "V1", - "identifier": {"offer": "myOfferName", "publisher": "myPublisherName", "sku": "mySkuName"}, - "osState": "Generalized", - "osType": "Windows", - } - }, - ).result() - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples/galleryExamples/GalleryImage_Update.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/gallery_examples/gallery_image_update_features.py b/sdk/compute/azure-mgmt-compute/generated_samples/gallery_examples/gallery_image_update_features.py deleted file mode 100644 index ad1f30552b9f..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/gallery_examples/gallery_image_update_features.py +++ /dev/null @@ -1,54 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python gallery_image_update_features.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.gallery_images.begin_update( - resource_group_name="myResourceGroup", - gallery_name="myGalleryName", - gallery_image_name="myGalleryImageName", - gallery_image={ - "properties": { - "allowUpdateImage": True, - "features": [{"name": "SecurityType", "startsAtVersion": "2.0.0", "value": "TrustedLaunch"}], - "hyperVGeneration": "V2", - "identifier": {"offer": "myOfferName", "publisher": "myPublisherName", "sku": "mySkuName"}, - "osState": "Generalized", - "osType": "Windows", - } - }, - ).result() - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples/galleryExamples/GalleryImage_UpdateFeatures.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/gallery_examples/gallery_image_version_create.py b/sdk/compute/azure-mgmt-compute/generated_samples/gallery_examples/gallery_image_version_create.py deleted file mode 100644 index 4854ecdb3624..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/gallery_examples/gallery_image_version_create.py +++ /dev/null @@ -1,101 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python gallery_image_version_create.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.gallery_image_versions.begin_create_or_update( - resource_group_name="myResourceGroup", - gallery_name="myGalleryName", - gallery_image_name="myGalleryImageName", - gallery_image_version_name="1.0.0", - gallery_image_version={ - "location": "West US", - "properties": { - "publishingProfile": { - "targetRegions": [ - { - "encryption": { - "dataDiskImages": [ - { - "diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myOtherWestUSDiskEncryptionSet", - "lun": 0, - }, - { - "diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet", - "lun": 1, - }, - ], - "osDiskImage": { - "diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet" - }, - }, - "excludeFromLatest": False, - "name": "West US", - "regionalReplicaCount": 1, - }, - { - "encryption": { - "dataDiskImages": [ - { - "diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myOtherEastUSDiskEncryptionSet", - "lun": 0, - }, - { - "diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet", - "lun": 1, - }, - ], - "osDiskImage": { - "diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet" - }, - }, - "excludeFromLatest": False, - "name": "East US", - "regionalReplicaCount": 2, - "storageAccountType": "Standard_ZRS", - }, - ] - }, - "safetyProfile": {"allowDeletionOfReplicatedLocations": False, "blockDeletionBeforeEndOfLife": False}, - "storageProfile": { - "source": { - "id": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/images/{imageName}" - } - }, - }, - }, - ).result() - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples/galleryExamples/GalleryImageVersion_Create.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/gallery_examples/gallery_image_version_create_with_additional_replica_sets.py b/sdk/compute/azure-mgmt-compute/generated_samples/gallery_examples/gallery_image_version_create_with_additional_replica_sets.py deleted file mode 100644 index 9404c03293a4..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/gallery_examples/gallery_image_version_create_with_additional_replica_sets.py +++ /dev/null @@ -1,104 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python gallery_image_version_create_with_additional_replica_sets.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.gallery_image_versions.begin_create_or_update( - resource_group_name="myResourceGroup", - gallery_name="myGalleryName", - gallery_image_name="myGalleryImageName", - gallery_image_version_name="1.0.0", - gallery_image_version={ - "location": "West US", - "properties": { - "publishingProfile": { - "targetRegions": [ - { - "additionalReplicaSets": [ - {"regionalReplicaCount": 1, "storageAccountType": "PreviumV2_LRS"} - ], - "encryption": { - "dataDiskImages": [ - { - "diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myOtherWestUSDiskEncryptionSet", - "lun": 0, - }, - { - "diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet", - "lun": 1, - }, - ], - "osDiskImage": { - "diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet" - }, - }, - "excludeFromLatest": False, - "name": "West US", - "regionalReplicaCount": 1, - }, - { - "encryption": { - "dataDiskImages": [ - { - "diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myOtherEastUSDiskEncryptionSet", - "lun": 0, - }, - { - "diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet", - "lun": 1, - }, - ], - "osDiskImage": { - "diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet" - }, - }, - "excludeFromLatest": False, - "name": "East US", - "regionalReplicaCount": 2, - "storageAccountType": "Standard_ZRS", - }, - ] - }, - "safetyProfile": {"allowDeletionOfReplicatedLocations": False}, - "storageProfile": { - "source": { - "id": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/images/{imageName}" - } - }, - }, - }, - ).result() - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples/galleryExamples/GalleryImageVersion_Create_WithAdditionalReplicaSets.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/gallery_examples/gallery_image_version_create_with_community_image_version_as_source.py b/sdk/compute/azure-mgmt-compute/generated_samples/gallery_examples/gallery_image_version_create_with_community_image_version_as_source.py deleted file mode 100644 index c549a73c68a9..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/gallery_examples/gallery_image_version_create_with_community_image_version_as_source.py +++ /dev/null @@ -1,101 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python gallery_image_version_create_with_community_image_version_as_source.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.gallery_image_versions.begin_create_or_update( - resource_group_name="myResourceGroup", - gallery_name="myGalleryName", - gallery_image_name="myGalleryImageName", - gallery_image_version_name="1.0.0", - gallery_image_version={ - "location": "West US", - "properties": { - "publishingProfile": { - "targetRegions": [ - { - "encryption": { - "dataDiskImages": [ - { - "diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myOtherWestUSDiskEncryptionSet", - "lun": 0, - }, - { - "diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet", - "lun": 1, - }, - ], - "osDiskImage": { - "diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet" - }, - }, - "excludeFromLatest": False, - "name": "West US", - "regionalReplicaCount": 1, - }, - { - "encryption": { - "dataDiskImages": [ - { - "diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myOtherEastUSDiskEncryptionSet", - "lun": 0, - }, - { - "diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet", - "lun": 1, - }, - ], - "osDiskImage": { - "diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet" - }, - }, - "excludeFromLatest": False, - "name": "East US", - "regionalReplicaCount": 2, - "storageAccountType": "Standard_ZRS", - }, - ] - }, - "safetyProfile": {"allowDeletionOfReplicatedLocations": False, "blockDeletionBeforeEndOfLife": False}, - "storageProfile": { - "source": { - "communityGalleryImageId": "/communityGalleries/{communityGalleryName}/images/{communityGalleryImageName}" - } - }, - }, - }, - ).result() - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples/galleryExamples/GalleryImageVersion_Create_WithCommunityImageVersionAsSource.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/gallery_examples/gallery_image_version_create_with_image_version_as_source.py b/sdk/compute/azure-mgmt-compute/generated_samples/gallery_examples/gallery_image_version_create_with_image_version_as_source.py deleted file mode 100644 index 8b7b8f7caa33..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/gallery_examples/gallery_image_version_create_with_image_version_as_source.py +++ /dev/null @@ -1,101 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python gallery_image_version_create_with_image_version_as_source.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.gallery_image_versions.begin_create_or_update( - resource_group_name="myResourceGroup", - gallery_name="myGalleryName", - gallery_image_name="myGalleryImageName", - gallery_image_version_name="1.0.0", - gallery_image_version={ - "location": "West US", - "properties": { - "publishingProfile": { - "targetRegions": [ - { - "encryption": { - "dataDiskImages": [ - { - "diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myOtherWestUSDiskEncryptionSet", - "lun": 0, - }, - { - "diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet", - "lun": 1, - }, - ], - "osDiskImage": { - "diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet" - }, - }, - "excludeFromLatest": False, - "name": "West US", - "regionalReplicaCount": 1, - }, - { - "encryption": { - "dataDiskImages": [ - { - "diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myOtherEastUSDiskEncryptionSet", - "lun": 0, - }, - { - "diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet", - "lun": 1, - }, - ], - "osDiskImage": { - "diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet" - }, - }, - "excludeFromLatest": False, - "name": "East US", - "regionalReplicaCount": 2, - "storageAccountType": "Standard_ZRS", - }, - ] - }, - "safetyProfile": {"allowDeletionOfReplicatedLocations": False, "blockDeletionBeforeEndOfLife": False}, - "storageProfile": { - "source": { - "id": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/galleries/{galleryName}/images/{imageDefinitionName}/versions/{versionName}" - } - }, - }, - }, - ).result() - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples/galleryExamples/GalleryImageVersion_Create_WithImageVersionAsSource.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/gallery_examples/gallery_image_version_create_with_shallow_replication_mode.py b/sdk/compute/azure-mgmt-compute/generated_samples/gallery_examples/gallery_image_version_create_with_shallow_replication_mode.py deleted file mode 100644 index dde20a8932cf..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/gallery_examples/gallery_image_version_create_with_shallow_replication_mode.py +++ /dev/null @@ -1,60 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python gallery_image_version_create_with_shallow_replication_mode.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.gallery_image_versions.begin_create_or_update( - resource_group_name="myResourceGroup", - gallery_name="myGalleryName", - gallery_image_name="myGalleryImageName", - gallery_image_version_name="1.0.0", - gallery_image_version={ - "location": "West US", - "properties": { - "publishingProfile": { - "replicationMode": "Shallow", - "targetRegions": [{"excludeFromLatest": False, "name": "West US", "regionalReplicaCount": 1}], - }, - "safetyProfile": {"allowDeletionOfReplicatedLocations": False, "blockDeletionBeforeEndOfLife": False}, - "storageProfile": { - "source": { - "id": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/images/{imageName}" - } - }, - }, - }, - ).result() - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples/galleryExamples/GalleryImageVersion_Create_WithShallowReplicationMode.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/gallery_examples/gallery_image_version_create_with_snapshots_as_source.py b/sdk/compute/azure-mgmt-compute/generated_samples/gallery_examples/gallery_image_version_create_with_snapshots_as_source.py deleted file mode 100644 index 74645fc710ba..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/gallery_examples/gallery_image_version_create_with_snapshots_as_source.py +++ /dev/null @@ -1,105 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python gallery_image_version_create_with_snapshots_as_source.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.gallery_image_versions.begin_create_or_update( - resource_group_name="myResourceGroup", - gallery_name="myGalleryName", - gallery_image_name="myGalleryImageName", - gallery_image_version_name="1.0.0", - gallery_image_version={ - "location": "West US", - "properties": { - "publishingProfile": { - "targetRegions": [ - { - "encryption": { - "dataDiskImages": [ - { - "diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet", - "lun": 1, - } - ], - "osDiskImage": { - "diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet" - }, - }, - "excludeFromLatest": False, - "name": "West US", - "regionalReplicaCount": 1, - }, - { - "encryption": { - "dataDiskImages": [ - { - "diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet", - "lun": 1, - } - ], - "osDiskImage": { - "diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet" - }, - }, - "excludeFromLatest": False, - "name": "East US", - "regionalReplicaCount": 2, - "storageAccountType": "Standard_ZRS", - }, - ] - }, - "safetyProfile": {"allowDeletionOfReplicatedLocations": False, "blockDeletionBeforeEndOfLife": False}, - "storageProfile": { - "dataDiskImages": [ - { - "hostCaching": "None", - "lun": 1, - "source": { - "id": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/disks/{dataDiskName}" - }, - } - ], - "osDiskImage": { - "hostCaching": "ReadOnly", - "source": { - "id": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/snapshots/{osSnapshotName}" - }, - }, - }, - }, - }, - ).result() - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples/galleryExamples/GalleryImageVersion_Create_WithSnapshotsAsSource.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/gallery_examples/gallery_image_version_create_with_target_extended_locations.py b/sdk/compute/azure-mgmt-compute/generated_samples/gallery_examples/gallery_image_version_create_with_target_extended_locations.py deleted file mode 100644 index 3f94de07c6fe..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/gallery_examples/gallery_image_version_create_with_target_extended_locations.py +++ /dev/null @@ -1,101 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python gallery_image_version_create_with_target_extended_locations.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.gallery_image_versions.begin_create_or_update( - resource_group_name="myResourceGroup", - gallery_name="myGalleryName", - gallery_image_name="myGalleryImageName", - gallery_image_version_name="1.0.0", - gallery_image_version={ - "location": "West US", - "properties": { - "publishingProfile": { - "targetRegions": [ - { - "encryption": { - "dataDiskImages": [ - { - "diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myOtherWestUSDiskEncryptionSet", - "lun": 0, - }, - { - "diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet", - "lun": 1, - }, - ], - "osDiskImage": { - "diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet" - }, - }, - "excludeFromLatest": False, - "name": "West US", - "regionalReplicaCount": 1, - }, - { - "encryption": { - "dataDiskImages": [ - { - "diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myOtherEastUSDiskEncryptionSet", - "lun": 0, - }, - { - "diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet", - "lun": 1, - }, - ], - "osDiskImage": { - "diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet" - }, - }, - "excludeFromLatest": False, - "name": "East US", - "regionalReplicaCount": 2, - "storageAccountType": "Standard_ZRS", - }, - ] - }, - "safetyProfile": {"allowDeletionOfReplicatedLocations": False, "blockDeletionBeforeEndOfLife": False}, - "storageProfile": { - "source": { - "id": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/images/{imageName}" - } - }, - }, - }, - ).result() - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples/galleryExamples/GalleryImageVersion_Create_WithTargetExtendedLocations.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/gallery_examples/gallery_image_version_create_with_vhd.py b/sdk/compute/azure-mgmt-compute/generated_samples/gallery_examples/gallery_image_version_create_with_vhd.py deleted file mode 100644 index ee9f7bb49c45..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/gallery_examples/gallery_image_version_create_with_vhd.py +++ /dev/null @@ -1,96 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python gallery_image_version_create_with_vhd.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.gallery_image_versions.begin_create_or_update( - resource_group_name="myResourceGroup", - gallery_name="myGalleryName", - gallery_image_name="myGalleryImageName", - gallery_image_version_name="1.0.0", - gallery_image_version={ - "location": "West US", - "properties": { - "publishingProfile": { - "targetRegions": [ - { - "encryption": { - "dataDiskImages": [ - { - "diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myOtherDiskEncryptionSet", - "lun": 1, - } - ], - "osDiskImage": { - "diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myDiskEncryptionSet" - }, - }, - "excludeFromLatest": False, - "name": "West US", - "regionalReplicaCount": 1, - }, - { - "excludeFromLatest": False, - "name": "East US", - "regionalReplicaCount": 2, - "storageAccountType": "Standard_ZRS", - }, - ] - }, - "safetyProfile": {"allowDeletionOfReplicatedLocations": False, "blockDeletionBeforeEndOfLife": False}, - "storageProfile": { - "dataDiskImages": [ - { - "hostCaching": "None", - "lun": 1, - "source": { - "storageAccountId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Storage/storageAccounts/{storageAccount}", - "uri": "https://gallerysourcencus.blob.core.windows.net/myvhds/Windows-Server-2012-R2-20171216-en.us-128GB.vhd", - }, - } - ], - "osDiskImage": { - "hostCaching": "ReadOnly", - "source": { - "storageAccountId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Storage/storageAccounts/{storageAccount}", - "uri": "https://gallerysourcencus.blob.core.windows.net/myvhds/Windows-Server-2012-R2-20171216-en.us-128GB.vhd", - }, - }, - }, - }, - }, - ).result() - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples/galleryExamples/GalleryImageVersion_Create_WithVHD.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/gallery_examples/gallery_image_version_create_with_vhd_uefi_settings.py b/sdk/compute/azure-mgmt-compute/generated_samples/gallery_examples/gallery_image_version_create_with_vhd_uefi_settings.py deleted file mode 100644 index 8055bf3f8717..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/gallery_examples/gallery_image_version_create_with_vhd_uefi_settings.py +++ /dev/null @@ -1,106 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python gallery_image_version_create_with_vhd_uefi_settings.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.gallery_image_versions.begin_create_or_update( - resource_group_name="myResourceGroup", - gallery_name="myGalleryName", - gallery_image_name="myGalleryImageName", - gallery_image_version_name="1.0.0", - gallery_image_version={ - "location": "West US", - "properties": { - "publishingProfile": { - "targetRegions": [ - { - "encryption": { - "dataDiskImages": [ - { - "diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myOtherDiskEncryptionSet", - "lun": 1, - } - ], - "osDiskImage": { - "diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myDiskEncryptionSet" - }, - }, - "excludeFromLatest": False, - "name": "West US", - "regionalReplicaCount": 1, - }, - { - "excludeFromLatest": False, - "name": "East US", - "regionalReplicaCount": 2, - "storageAccountType": "Standard_ZRS", - }, - ] - }, - "safetyProfile": {"allowDeletionOfReplicatedLocations": False, "blockDeletionBeforeEndOfLife": False}, - "securityProfile": { - "uefiSettings": { - "additionalSignatures": { - "db": [{"type": "x509", "value": [""]}], - "dbx": [{"type": "x509", "value": [""]}], - "kek": [{"type": "sha256", "value": [""]}], - }, - "signatureTemplateNames": ["MicrosoftUefiCertificateAuthorityTemplate"], - } - }, - "storageProfile": { - "dataDiskImages": [ - { - "hostCaching": "None", - "lun": 1, - "source": { - "storageAccountId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Storage/storageAccounts/{storageAccount}", - "uri": "https://gallerysourcencus.blob.core.windows.net/myvhds/Windows-Server-2012-R2-20171216-en.us-128GB.vhd", - }, - } - ], - "osDiskImage": { - "hostCaching": "ReadOnly", - "source": { - "storageAccountId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Storage/storageAccounts/{storageAccount}", - "uri": "https://gallerysourcencus.blob.core.windows.net/myvhds/Windows-Server-2012-R2-20171216-en.us-128GB.vhd", - }, - }, - }, - }, - }, - ).result() - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples/galleryExamples/GalleryImageVersion_Create_WithVHD_UefiSettings.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/gallery_examples/gallery_image_version_create_with_vm_as_source.py b/sdk/compute/azure-mgmt-compute/generated_samples/gallery_examples/gallery_image_version_create_with_vm_as_source.py deleted file mode 100644 index d79dbc4589d1..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/gallery_examples/gallery_image_version_create_with_vm_as_source.py +++ /dev/null @@ -1,101 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python gallery_image_version_create_with_vm_as_source.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.gallery_image_versions.begin_create_or_update( - resource_group_name="myResourceGroup", - gallery_name="myGalleryName", - gallery_image_name="myGalleryImageName", - gallery_image_version_name="1.0.0", - gallery_image_version={ - "location": "West US", - "properties": { - "publishingProfile": { - "targetRegions": [ - { - "encryption": { - "dataDiskImages": [ - { - "diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myOtherWestUSDiskEncryptionSet", - "lun": 0, - }, - { - "diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet", - "lun": 1, - }, - ], - "osDiskImage": { - "diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet" - }, - }, - "excludeFromLatest": False, - "name": "West US", - "regionalReplicaCount": 2, - }, - { - "encryption": { - "dataDiskImages": [ - { - "diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myOtherEastUSDiskEncryptionSet", - "lun": 0, - }, - { - "diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet", - "lun": 1, - }, - ], - "osDiskImage": { - "diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet" - }, - }, - "excludeFromLatest": False, - "name": "East US", - "regionalReplicaCount": 2, - "storageAccountType": "Standard_ZRS", - }, - ] - }, - "safetyProfile": {"allowDeletionOfReplicatedLocations": False, "blockDeletionBeforeEndOfLife": False}, - "storageProfile": { - "source": { - "virtualMachineId": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/virtualMachines/{vmName}" - } - }, - }, - }, - ).result() - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples/galleryExamples/GalleryImageVersion_Create_WithVmAsSource.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/gallery_examples/gallery_image_version_delete.py b/sdk/compute/azure-mgmt-compute/generated_samples/gallery_examples/gallery_image_version_delete.py deleted file mode 100644 index a91e5fe4bbc4..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/gallery_examples/gallery_image_version_delete.py +++ /dev/null @@ -1,44 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python gallery_image_version_delete.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - client.gallery_image_versions.begin_delete( - resource_group_name="myResourceGroup", - gallery_name="myGalleryName", - gallery_image_name="myGalleryImageName", - gallery_image_version_name="1.0.0", - ).result() - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples/galleryExamples/GalleryImageVersion_Delete.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/gallery_examples/gallery_image_version_get.py b/sdk/compute/azure-mgmt-compute/generated_samples/gallery_examples/gallery_image_version_get.py deleted file mode 100644 index 42cdc57aec80..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/gallery_examples/gallery_image_version_get.py +++ /dev/null @@ -1,45 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python gallery_image_version_get.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.gallery_image_versions.get( - resource_group_name="myResourceGroup", - gallery_name="myGalleryName", - gallery_image_name="myGalleryImageName", - gallery_image_version_name="1.0.0", - ) - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples/galleryExamples/GalleryImageVersion_Get.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/gallery_examples/gallery_image_version_get_with_replication_status.py b/sdk/compute/azure-mgmt-compute/generated_samples/gallery_examples/gallery_image_version_get_with_replication_status.py deleted file mode 100644 index fa07d0880d61..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/gallery_examples/gallery_image_version_get_with_replication_status.py +++ /dev/null @@ -1,45 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python gallery_image_version_get_with_replication_status.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.gallery_image_versions.get( - resource_group_name="myResourceGroup", - gallery_name="myGalleryName", - gallery_image_name="myGalleryImageName", - gallery_image_version_name="1.0.0", - ) - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples/galleryExamples/GalleryImageVersion_Get_WithReplicationStatus.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/gallery_examples/gallery_image_version_get_with_snapshots_as_source.py b/sdk/compute/azure-mgmt-compute/generated_samples/gallery_examples/gallery_image_version_get_with_snapshots_as_source.py deleted file mode 100644 index 4788a9c7ffed..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/gallery_examples/gallery_image_version_get_with_snapshots_as_source.py +++ /dev/null @@ -1,45 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python gallery_image_version_get_with_snapshots_as_source.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.gallery_image_versions.get( - resource_group_name="myResourceGroup", - gallery_name="myGalleryName", - gallery_image_name="myGalleryImageName", - gallery_image_version_name="1.0.0", - ) - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples/galleryExamples/GalleryImageVersion_Get_WithSnapshotsAsSource.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/gallery_examples/gallery_image_version_get_with_validation_profile.py b/sdk/compute/azure-mgmt-compute/generated_samples/gallery_examples/gallery_image_version_get_with_validation_profile.py deleted file mode 100644 index 4cc8a3ae34a5..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/gallery_examples/gallery_image_version_get_with_validation_profile.py +++ /dev/null @@ -1,45 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python gallery_image_version_get_with_validation_profile.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.gallery_image_versions.get( - resource_group_name="myResourceGroup", - gallery_name="myGalleryName", - gallery_image_name="myGalleryImageName", - gallery_image_version_name="1.0.0", - ) - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples/galleryExamples/GalleryImageVersion_Get_WithValidationProfile.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/gallery_examples/gallery_image_version_get_with_validation_profile_and_replication_status.py b/sdk/compute/azure-mgmt-compute/generated_samples/gallery_examples/gallery_image_version_get_with_validation_profile_and_replication_status.py deleted file mode 100644 index dfb00fc2ed89..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/gallery_examples/gallery_image_version_get_with_validation_profile_and_replication_status.py +++ /dev/null @@ -1,45 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python gallery_image_version_get_with_validation_profile_and_replication_status.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.gallery_image_versions.get( - resource_group_name="myResourceGroup", - gallery_name="myGalleryName", - gallery_image_name="myGalleryImageName", - gallery_image_version_name="1.0.0", - ) - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples/galleryExamples/GalleryImageVersion_Get_WithValidationProfileAndReplicationStatus.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/gallery_examples/gallery_image_version_get_with_vhd_as_source.py b/sdk/compute/azure-mgmt-compute/generated_samples/gallery_examples/gallery_image_version_get_with_vhd_as_source.py deleted file mode 100644 index 6c62ff903ba0..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/gallery_examples/gallery_image_version_get_with_vhd_as_source.py +++ /dev/null @@ -1,45 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python gallery_image_version_get_with_vhd_as_source.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.gallery_image_versions.get( - resource_group_name="myResourceGroup", - gallery_name="myGalleryName", - gallery_image_name="myGalleryImageName", - gallery_image_version_name="1.0.0", - ) - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples/galleryExamples/GalleryImageVersion_Get_WithVhdAsSource.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/gallery_examples/gallery_image_version_list_by_gallery_image.py b/sdk/compute/azure-mgmt-compute/generated_samples/gallery_examples/gallery_image_version_list_by_gallery_image.py deleted file mode 100644 index 62ade09b3460..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/gallery_examples/gallery_image_version_list_by_gallery_image.py +++ /dev/null @@ -1,45 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python gallery_image_version_list_by_gallery_image.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.gallery_image_versions.list_by_gallery_image( - resource_group_name="myResourceGroup", - gallery_name="myGalleryName", - gallery_image_name="myGalleryImageName", - ) - for item in response: - print(item) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples/galleryExamples/GalleryImageVersion_ListByGalleryImage.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/gallery_examples/gallery_image_version_update.py b/sdk/compute/azure-mgmt-compute/generated_samples/gallery_examples/gallery_image_version_update.py deleted file mode 100644 index 25e16edace9a..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/gallery_examples/gallery_image_version_update.py +++ /dev/null @@ -1,60 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python gallery_image_version_update.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.gallery_image_versions.begin_update( - resource_group_name="myResourceGroup", - gallery_name="myGalleryName", - gallery_image_name="myGalleryImageName", - gallery_image_version_name="1.0.0", - gallery_image_version={ - "properties": { - "publishingProfile": { - "targetRegions": [ - {"name": "West US", "regionalReplicaCount": 1}, - {"name": "East US", "regionalReplicaCount": 2, "storageAccountType": "Standard_ZRS"}, - ] - }, - "storageProfile": { - "source": { - "id": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/images/{imageName}" - } - }, - } - }, - ).result() - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples/galleryExamples/GalleryImageVersion_Update.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/gallery_examples/gallery_image_version_update_restore_soft_deleted.py b/sdk/compute/azure-mgmt-compute/generated_samples/gallery_examples/gallery_image_version_update_restore_soft_deleted.py deleted file mode 100644 index b58444c35018..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/gallery_examples/gallery_image_version_update_restore_soft_deleted.py +++ /dev/null @@ -1,46 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python gallery_image_version_update_restore_soft_deleted.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.gallery_image_versions.begin_update( - resource_group_name="myResourceGroup", - gallery_name="myGalleryName", - gallery_image_name="myGalleryImageName", - gallery_image_version_name="1.0.0", - gallery_image_version={"properties": {"restore": True, "storageProfile": {}}}, - ).result() - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples/galleryExamples/GalleryImageVersion_Update_RestoreSoftDeleted.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/gallery_examples/gallery_image_version_update_without_source_id.py b/sdk/compute/azure-mgmt-compute/generated_samples/gallery_examples/gallery_image_version_update_without_source_id.py deleted file mode 100644 index 35270ccbbbc6..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/gallery_examples/gallery_image_version_update_without_source_id.py +++ /dev/null @@ -1,56 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python gallery_image_version_update_without_source_id.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.gallery_image_versions.begin_update( - resource_group_name="myResourceGroup", - gallery_name="myGalleryName", - gallery_image_name="myGalleryImageName", - gallery_image_version_name="1.0.0", - gallery_image_version={ - "properties": { - "publishingProfile": { - "targetRegions": [ - {"name": "West US", "regionalReplicaCount": 1}, - {"name": "East US", "regionalReplicaCount": 2, "storageAccountType": "Standard_ZRS"}, - ] - }, - "storageProfile": {}, - } - }, - ).result() - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples/galleryExamples/GalleryImageVersion_Update_WithoutSourceId.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/gallery_examples/gallery_list_by_resource_group.py b/sdk/compute/azure-mgmt-compute/generated_samples/gallery_examples/gallery_list_by_resource_group.py deleted file mode 100644 index 5c019e0d63e9..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/gallery_examples/gallery_list_by_resource_group.py +++ /dev/null @@ -1,43 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python gallery_list_by_resource_group.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.galleries.list_by_resource_group( - resource_group_name="myResourceGroup", - ) - for item in response: - print(item) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples/galleryExamples/Gallery_ListByResourceGroup.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/gallery_examples/gallery_list_by_subscription.py b/sdk/compute/azure-mgmt-compute/generated_samples/gallery_examples/gallery_list_by_subscription.py deleted file mode 100644 index a0a339966761..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/gallery_examples/gallery_list_by_subscription.py +++ /dev/null @@ -1,41 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python gallery_list_by_subscription.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.galleries.list() - for item in response: - print(item) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples/galleryExamples/Gallery_ListBySubscription.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/gallery_examples/gallery_reset_sharing_profile.py b/sdk/compute/azure-mgmt-compute/generated_samples/gallery_examples/gallery_reset_sharing_profile.py deleted file mode 100644 index 752a7af5c6dd..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/gallery_examples/gallery_reset_sharing_profile.py +++ /dev/null @@ -1,44 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python gallery_reset_sharing_profile.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.gallery_sharing_profile.begin_update( - resource_group_name="myResourceGroup", - gallery_name="myGalleryName", - sharing_update={"operationType": "Reset"}, - ).result() - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples/galleryExamples/Gallery_ResetSharingProfile.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/gallery_examples/gallery_soft_deleted_resource_list_by_artifact_name.py b/sdk/compute/azure-mgmt-compute/generated_samples/gallery_examples/gallery_soft_deleted_resource_list_by_artifact_name.py deleted file mode 100644 index 47e60aa7639e..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/gallery_examples/gallery_soft_deleted_resource_list_by_artifact_name.py +++ /dev/null @@ -1,46 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python gallery_soft_deleted_resource_list_by_artifact_name.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.soft_deleted_resource.list_by_artifact_name( - resource_group_name="myResourceGroup", - gallery_name="myGalleryName", - artifact_type="images", - artifact_name="myGalleryImageName", - ) - for item in response: - print(item) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples/galleryExamples/GallerySoftDeletedResource_ListByArtifactName.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/gallery_examples/gallery_update.py b/sdk/compute/azure-mgmt-compute/generated_samples/gallery_examples/gallery_update.py deleted file mode 100644 index d128b2510bfc..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/gallery_examples/gallery_update.py +++ /dev/null @@ -1,44 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python gallery_update.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.galleries.begin_update( - resource_group_name="myResourceGroup", - gallery_name="myGalleryName", - gallery={"properties": {"description": "This is the gallery description."}}, - ).result() - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples/galleryExamples/Gallery_Update.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/gallery_resource_profile_examples/gallery_in_vm_access_control_profile_delete.py b/sdk/compute/azure-mgmt-compute/generated_samples/gallery_resource_profile_examples/gallery_in_vm_access_control_profile_delete.py deleted file mode 100644 index ced66ea588c3..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/gallery_resource_profile_examples/gallery_in_vm_access_control_profile_delete.py +++ /dev/null @@ -1,43 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python gallery_in_vm_access_control_profile_delete.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - client.gallery_in_vm_access_control_profiles.begin_delete( - resource_group_name="myResourceGroup", - gallery_name="myGalleryName", - in_vm_access_control_profile_name="myInVMAccessControlProfileName", - ).result() - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples/galleryResourceProfileExamples/GalleryInVMAccessControlProfile_Delete.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/gallery_resource_profile_examples/gallery_in_vm_access_control_profile_get.py b/sdk/compute/azure-mgmt-compute/generated_samples/gallery_resource_profile_examples/gallery_in_vm_access_control_profile_get.py deleted file mode 100644 index b73a3ffb18df..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/gallery_resource_profile_examples/gallery_in_vm_access_control_profile_get.py +++ /dev/null @@ -1,44 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python gallery_in_vm_access_control_profile_get.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.gallery_in_vm_access_control_profiles.get( - resource_group_name="myResourceGroup", - gallery_name="myGalleryName", - in_vm_access_control_profile_name="myInVMAccessControlProfileName", - ) - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples/galleryResourceProfileExamples/GalleryInVMAccessControlProfile_Get.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/gallery_resource_profile_examples/gallery_in_vm_access_control_profile_list_by_gallery.py b/sdk/compute/azure-mgmt-compute/generated_samples/gallery_resource_profile_examples/gallery_in_vm_access_control_profile_list_by_gallery.py deleted file mode 100644 index dba9a32e6602..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/gallery_resource_profile_examples/gallery_in_vm_access_control_profile_list_by_gallery.py +++ /dev/null @@ -1,44 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python gallery_in_vm_access_control_profile_list_by_gallery.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.gallery_in_vm_access_control_profiles.list_by_gallery( - resource_group_name="myResourceGroup", - gallery_name="myGalleryName", - ) - for item in response: - print(item) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples/galleryResourceProfileExamples/GalleryInVMAccessControlProfile_ListByGallery.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/gallery_resource_profile_examples/gallery_in_vm_access_control_profile_version_delete.py b/sdk/compute/azure-mgmt-compute/generated_samples/gallery_resource_profile_examples/gallery_in_vm_access_control_profile_version_delete.py deleted file mode 100644 index 331bdf26edd0..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/gallery_resource_profile_examples/gallery_in_vm_access_control_profile_version_delete.py +++ /dev/null @@ -1,44 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python gallery_in_vm_access_control_profile_version_delete.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - client.gallery_in_vm_access_control_profile_versions.begin_delete( - resource_group_name="myResourceGroup", - gallery_name="myGalleryName", - in_vm_access_control_profile_name="myInVMAccessControlProfileName", - in_vm_access_control_profile_version_name="1.0.0", - ).result() - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples/galleryResourceProfileExamples/GalleryInVMAccessControlProfileVersion_Delete.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/gallery_resource_profile_examples/gallery_in_vm_access_control_profile_version_get.py b/sdk/compute/azure-mgmt-compute/generated_samples/gallery_resource_profile_examples/gallery_in_vm_access_control_profile_version_get.py deleted file mode 100644 index 01a72b868d97..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/gallery_resource_profile_examples/gallery_in_vm_access_control_profile_version_get.py +++ /dev/null @@ -1,45 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python gallery_in_vm_access_control_profile_version_get.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.gallery_in_vm_access_control_profile_versions.get( - resource_group_name="myResourceGroup", - gallery_name="myGalleryName", - in_vm_access_control_profile_name="myInVMAccessControlProfileName", - in_vm_access_control_profile_version_name="1.0.0", - ) - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples/galleryResourceProfileExamples/GalleryInVMAccessControlProfileVersion_Get.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/gallery_resource_profile_examples/gallery_in_vm_access_control_profile_version_list_by_gallery_in_vm_access_control_profile.py b/sdk/compute/azure-mgmt-compute/generated_samples/gallery_resource_profile_examples/gallery_in_vm_access_control_profile_version_list_by_gallery_in_vm_access_control_profile.py deleted file mode 100644 index 5faef59a46a6..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/gallery_resource_profile_examples/gallery_in_vm_access_control_profile_version_list_by_gallery_in_vm_access_control_profile.py +++ /dev/null @@ -1,45 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python gallery_in_vm_access_control_profile_version_list_by_gallery_in_vm_access_control_profile.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.gallery_in_vm_access_control_profile_versions.list_by_gallery_in_vm_access_control_profile( - resource_group_name="myResourceGroup", - gallery_name="myGalleryName", - in_vm_access_control_profile_name="myInVMAccessControlProfileName", - ) - for item in response: - print(item) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples/galleryResourceProfileExamples/GalleryInVMAccessControlProfileVersion_ListByGalleryInVMAccessControlProfile.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/image_examples/image_create_data_disk_from_ablob_included.py b/sdk/compute/azure-mgmt-compute/generated_samples/image_examples/image_create_data_disk_from_ablob_included.py deleted file mode 100644 index 497e3045e9b2..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/image_examples/image_create_data_disk_from_ablob_included.py +++ /dev/null @@ -1,59 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python image_create_data_disk_from_ablob_included.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.images.begin_create_or_update( - resource_group_name="myResourceGroup", - image_name="myImage", - parameters={ - "location": "West US", - "properties": { - "storageProfile": { - "dataDisks": [ - {"blobUri": "https://mystorageaccount.blob.core.windows.net/dataimages/dataimage.vhd", "lun": 1} - ], - "osDisk": { - "blobUri": "https://mystorageaccount.blob.core.windows.net/osimages/osimage.vhd", - "osState": "Generalized", - "osType": "Linux", - }, - "zoneResilient": False, - } - }, - }, - ).result() - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/imageExamples/Image_Create_DataDiskFromABlobIncluded.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/image_examples/image_create_data_disk_from_amanaged_disk_included.py b/sdk/compute/azure-mgmt-compute/generated_samples/image_examples/image_create_data_disk_from_amanaged_disk_included.py deleted file mode 100644 index 4c8e90cfb755..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/image_examples/image_create_data_disk_from_amanaged_disk_included.py +++ /dev/null @@ -1,66 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python image_create_data_disk_from_amanaged_disk_included.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.images.begin_create_or_update( - resource_group_name="myResourceGroup", - image_name="myImage", - parameters={ - "location": "West US", - "properties": { - "storageProfile": { - "dataDisks": [ - { - "lun": 1, - "managedDisk": { - "id": "subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myManagedDisk2" - }, - } - ], - "osDisk": { - "managedDisk": { - "id": "subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myManagedDisk" - }, - "osState": "Generalized", - "osType": "Linux", - }, - "zoneResilient": False, - } - }, - }, - ).result() - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/imageExamples/Image_Create_DataDiskFromAManagedDiskIncluded.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/image_examples/image_create_data_disk_from_asnapshot_included.py b/sdk/compute/azure-mgmt-compute/generated_samples/image_examples/image_create_data_disk_from_asnapshot_included.py deleted file mode 100644 index d9945bfbd6b0..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/image_examples/image_create_data_disk_from_asnapshot_included.py +++ /dev/null @@ -1,66 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python image_create_data_disk_from_asnapshot_included.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.images.begin_create_or_update( - resource_group_name="myResourceGroup", - image_name="myImage", - parameters={ - "location": "West US", - "properties": { - "storageProfile": { - "dataDisks": [ - { - "lun": 1, - "snapshot": { - "id": "subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot2" - }, - } - ], - "osDisk": { - "osState": "Generalized", - "osType": "Linux", - "snapshot": { - "id": "subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot" - }, - }, - "zoneResilient": True, - } - }, - }, - ).result() - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/imageExamples/Image_Create_DataDiskFromASnapshotIncluded.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/image_examples/image_create_from_ablob.py b/sdk/compute/azure-mgmt-compute/generated_samples/image_examples/image_create_from_ablob.py deleted file mode 100644 index c7bddcb0044e..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/image_examples/image_create_from_ablob.py +++ /dev/null @@ -1,56 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python image_create_from_ablob.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.images.begin_create_or_update( - resource_group_name="myResourceGroup", - image_name="myImage", - parameters={ - "location": "West US", - "properties": { - "storageProfile": { - "osDisk": { - "blobUri": "https://mystorageaccount.blob.core.windows.net/osimages/osimage.vhd", - "osState": "Generalized", - "osType": "Linux", - }, - "zoneResilient": True, - } - }, - }, - ).result() - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/imageExamples/Image_CreateFromABlob.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/image_examples/image_create_from_ablob_with_disk_encryption_set.py b/sdk/compute/azure-mgmt-compute/generated_samples/image_examples/image_create_from_ablob_with_disk_encryption_set.py deleted file mode 100644 index fd50992fe0b2..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/image_examples/image_create_from_ablob_with_disk_encryption_set.py +++ /dev/null @@ -1,58 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python image_create_from_ablob_with_disk_encryption_set.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.images.begin_create_or_update( - resource_group_name="myResourceGroup", - image_name="myImage", - parameters={ - "location": "West US", - "properties": { - "storageProfile": { - "osDisk": { - "blobUri": "https://mystorageaccount.blob.core.windows.net/osimages/osimage.vhd", - "diskEncryptionSet": { - "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSets/{existing-diskEncryptionSet-name}" - }, - "osState": "Generalized", - "osType": "Linux", - } - } - }, - }, - ).result() - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/imageExamples/Image_CreateFromABlobWithDiskEncryptionSet.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/image_examples/image_create_from_amanaged_disk.py b/sdk/compute/azure-mgmt-compute/generated_samples/image_examples/image_create_from_amanaged_disk.py deleted file mode 100644 index 21ace4661998..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/image_examples/image_create_from_amanaged_disk.py +++ /dev/null @@ -1,58 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python image_create_from_amanaged_disk.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.images.begin_create_or_update( - resource_group_name="myResourceGroup", - image_name="myImage", - parameters={ - "location": "West US", - "properties": { - "storageProfile": { - "osDisk": { - "managedDisk": { - "id": "subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myManagedDisk" - }, - "osState": "Generalized", - "osType": "Linux", - }, - "zoneResilient": True, - } - }, - }, - ).result() - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/imageExamples/Image_CreateFromAManagedDisk.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/image_examples/image_create_from_amanaged_disk_with_disk_encryption_set.py b/sdk/compute/azure-mgmt-compute/generated_samples/image_examples/image_create_from_amanaged_disk_with_disk_encryption_set.py deleted file mode 100644 index 776269b9f3a2..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/image_examples/image_create_from_amanaged_disk_with_disk_encryption_set.py +++ /dev/null @@ -1,60 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python image_create_from_amanaged_disk_with_disk_encryption_set.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.images.begin_create_or_update( - resource_group_name="myResourceGroup", - image_name="myImage", - parameters={ - "location": "West US", - "properties": { - "storageProfile": { - "osDisk": { - "diskEncryptionSet": { - "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSets/{existing-diskEncryptionSet-name}" - }, - "osState": "Generalized", - "osType": "Linux", - "snapshot": { - "id": "subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot" - }, - } - } - }, - }, - ).result() - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/imageExamples/Image_CreateFromAManagedDiskWithDiskEncryptionSet.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/image_examples/image_create_from_asnapshot.py b/sdk/compute/azure-mgmt-compute/generated_samples/image_examples/image_create_from_asnapshot.py deleted file mode 100644 index 572296f54e17..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/image_examples/image_create_from_asnapshot.py +++ /dev/null @@ -1,58 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python image_create_from_asnapshot.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.images.begin_create_or_update( - resource_group_name="myResourceGroup", - image_name="myImage", - parameters={ - "location": "West US", - "properties": { - "storageProfile": { - "osDisk": { - "osState": "Generalized", - "osType": "Linux", - "snapshot": { - "id": "subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot" - }, - }, - "zoneResilient": False, - } - }, - }, - ).result() - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/imageExamples/Image_CreateFromASnapshot.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/image_examples/image_create_from_asnapshot_with_disk_encryption_set.py b/sdk/compute/azure-mgmt-compute/generated_samples/image_examples/image_create_from_asnapshot_with_disk_encryption_set.py deleted file mode 100644 index f36cc065bd54..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/image_examples/image_create_from_asnapshot_with_disk_encryption_set.py +++ /dev/null @@ -1,60 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python image_create_from_asnapshot_with_disk_encryption_set.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.images.begin_create_or_update( - resource_group_name="myResourceGroup", - image_name="myImage", - parameters={ - "location": "West US", - "properties": { - "storageProfile": { - "osDisk": { - "diskEncryptionSet": { - "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSets/{existing-diskEncryptionSet-name}" - }, - "managedDisk": { - "id": "subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myManagedDisk" - }, - "osState": "Generalized", - "osType": "Linux", - } - } - }, - }, - ).result() - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/imageExamples/Image_CreateFromASnapshotWithDiskEncryptionSet.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/image_examples/image_create_from_avm.py b/sdk/compute/azure-mgmt-compute/generated_samples/image_examples/image_create_from_avm.py deleted file mode 100644 index 023cd3735ace..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/image_examples/image_create_from_avm.py +++ /dev/null @@ -1,51 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python image_create_from_avm.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.images.begin_create_or_update( - resource_group_name="myResourceGroup", - image_name="myImage", - parameters={ - "location": "West US", - "properties": { - "sourceVirtualMachine": { - "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM" - } - }, - }, - ).result() - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/imageExamples/Image_CreateFromAVM.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/image_examples/image_get.py b/sdk/compute/azure-mgmt-compute/generated_samples/image_examples/image_get.py deleted file mode 100644 index a7450b1fdf94..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/image_examples/image_get.py +++ /dev/null @@ -1,43 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python image_get.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.images.get( - resource_group_name="myResourceGroup", - image_name="myImage", - ) - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/imageExamples/Image_Get.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/image_examples/image_list_by_resource_group.py b/sdk/compute/azure-mgmt-compute/generated_samples/image_examples/image_list_by_resource_group.py deleted file mode 100644 index 4aa62f907ca6..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/image_examples/image_list_by_resource_group.py +++ /dev/null @@ -1,43 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python image_list_by_resource_group.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.images.list_by_resource_group( - resource_group_name="myResourceGroup", - ) - for item in response: - print(item) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/imageExamples/Image_ListByResourceGroup.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/image_examples/image_list_by_subscription.py b/sdk/compute/azure-mgmt-compute/generated_samples/image_examples/image_list_by_subscription.py deleted file mode 100644 index 1d29b2765f56..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/image_examples/image_list_by_subscription.py +++ /dev/null @@ -1,41 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python image_list_by_subscription.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.images.list() - for item in response: - print(item) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/imageExamples/Image_ListBySubscription.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/image_examples/image_update.py b/sdk/compute/azure-mgmt-compute/generated_samples/image_examples/image_update.py deleted file mode 100644 index 74a5b7ab84df..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/image_examples/image_update.py +++ /dev/null @@ -1,52 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python image_update.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.images.begin_update( - resource_group_name="myResourceGroup", - image_name="myImage", - parameters={ - "properties": { - "hyperVGeneration": "V1", - "sourceVirtualMachine": { - "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM" - }, - }, - "tags": {"department": "HR"}, - }, - ).result() - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/imageExamples/Image_Update.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/image_examples/images_delete_maximum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/image_examples/images_delete_maximum_set_gen.py deleted file mode 100644 index d431dc0cf9d0..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/image_examples/images_delete_maximum_set_gen.py +++ /dev/null @@ -1,42 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python images_delete_maximum_set_gen.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - client.images.begin_delete( - resource_group_name="rgcompute", - image_name="aaaaaaaaaaaaaaaaaaaaaaaaaaa", - ).result() - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/imageExamples/Images_Delete_MaximumSet_Gen.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/image_examples/images_delete_minimum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/image_examples/images_delete_minimum_set_gen.py deleted file mode 100644 index 43a121f0f598..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/image_examples/images_delete_minimum_set_gen.py +++ /dev/null @@ -1,42 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python images_delete_minimum_set_gen.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - client.images.begin_delete( - resource_group_name="rgcompute", - image_name="aaaaaaaaaaaaaaaaaaaaaaaaaaaa", - ).result() - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/imageExamples/Images_Delete_MinimumSet_Gen.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/log_analytic_examples/log_analytics_request_rate_by_interval.py b/sdk/compute/azure-mgmt-compute/generated_samples/log_analytic_examples/log_analytics_request_rate_by_interval.py deleted file mode 100644 index e0b4175105b2..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/log_analytic_examples/log_analytics_request_rate_by_interval.py +++ /dev/null @@ -1,49 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python log_analytics_request_rate_by_interval.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.log_analytics.begin_export_request_rate_by_interval( - location="westus", - parameters={ - "blobContainerSasUri": "https://somesasuri", - "fromTime": "2018-01-21T01:54:06.862601Z", - "groupByResourceName": True, - "intervalLength": "FiveMins", - "toTime": "2018-01-23T01:54:06.862601Z", - }, - ).result() - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/logAnalyticExamples/LogAnalytics_RequestRateByInterval.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/log_analytic_examples/log_analytics_throttled_requests.py b/sdk/compute/azure-mgmt-compute/generated_samples/log_analytic_examples/log_analytics_throttled_requests.py deleted file mode 100644 index 4e2f2a543107..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/log_analytic_examples/log_analytics_throttled_requests.py +++ /dev/null @@ -1,51 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python log_analytics_throttled_requests.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.log_analytics.begin_export_throttled_requests( - location="westus", - parameters={ - "blobContainerSasUri": "https://somesasuri", - "fromTime": "2018-01-21T01:54:06.862601Z", - "groupByClientApplicationId": False, - "groupByOperationName": True, - "groupByResourceName": False, - "groupByUserAgent": False, - "toTime": "2018-01-23T01:54:06.862601Z", - }, - ).result() - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/logAnalyticExamples/LogAnalytics_ThrottledRequests.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/proximity_placement_group_examples/proximity_placement_group_create_or_update.py b/sdk/compute/azure-mgmt-compute/generated_samples/proximity_placement_group_examples/proximity_placement_group_create_or_update.py deleted file mode 100644 index 3eaf99d3ec50..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/proximity_placement_group_examples/proximity_placement_group_create_or_update.py +++ /dev/null @@ -1,48 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python proximity_placement_group_create_or_update.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.proximity_placement_groups.create_or_update( - resource_group_name="myResourceGroup", - proximity_placement_group_name="myProximityPlacementGroup", - parameters={ - "location": "westus", - "properties": {"intent": {"vmSizes": ["Basic_A0", "Basic_A2"]}, "proximityPlacementGroupType": "Standard"}, - "zones": ["1"], - }, - ) - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/proximityPlacementGroupExamples/ProximityPlacementGroup_CreateOrUpdate.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/proximity_placement_group_examples/proximity_placement_group_delete.py b/sdk/compute/azure-mgmt-compute/generated_samples/proximity_placement_group_examples/proximity_placement_group_delete.py deleted file mode 100644 index f6e0e86a5377..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/proximity_placement_group_examples/proximity_placement_group_delete.py +++ /dev/null @@ -1,42 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python proximity_placement_group_delete.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - client.proximity_placement_groups.delete( - resource_group_name="myResourceGroup", - proximity_placement_group_name="myProximityPlacementGroup", - ) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/proximityPlacementGroupExamples/ProximityPlacementGroup_Delete.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/proximity_placement_group_examples/proximity_placement_group_get.py b/sdk/compute/azure-mgmt-compute/generated_samples/proximity_placement_group_examples/proximity_placement_group_get.py deleted file mode 100644 index 19650a2a58c4..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/proximity_placement_group_examples/proximity_placement_group_get.py +++ /dev/null @@ -1,43 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python proximity_placement_group_get.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.proximity_placement_groups.get( - resource_group_name="myResourceGroup", - proximity_placement_group_name="myProximityPlacementGroup", - ) - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/proximityPlacementGroupExamples/ProximityPlacementGroup_Get.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/proximity_placement_group_examples/proximity_placement_group_list_by_resource_group.py b/sdk/compute/azure-mgmt-compute/generated_samples/proximity_placement_group_examples/proximity_placement_group_list_by_resource_group.py deleted file mode 100644 index 854f578831b2..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/proximity_placement_group_examples/proximity_placement_group_list_by_resource_group.py +++ /dev/null @@ -1,43 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python proximity_placement_group_list_by_resource_group.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.proximity_placement_groups.list_by_resource_group( - resource_group_name="myResourceGroup", - ) - for item in response: - print(item) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/proximityPlacementGroupExamples/ProximityPlacementGroup_ListByResourceGroup.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/proximity_placement_group_examples/proximity_placement_group_list_by_subscription.py b/sdk/compute/azure-mgmt-compute/generated_samples/proximity_placement_group_examples/proximity_placement_group_list_by_subscription.py deleted file mode 100644 index 1ad60a36f662..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/proximity_placement_group_examples/proximity_placement_group_list_by_subscription.py +++ /dev/null @@ -1,41 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python proximity_placement_group_list_by_subscription.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.proximity_placement_groups.list_by_subscription() - for item in response: - print(item) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/proximityPlacementGroupExamples/ProximityPlacementGroup_ListBySubscription.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/proximity_placement_group_examples/proximity_placement_group_patch.py b/sdk/compute/azure-mgmt-compute/generated_samples/proximity_placement_group_examples/proximity_placement_group_patch.py deleted file mode 100644 index 83828ad9670b..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/proximity_placement_group_examples/proximity_placement_group_patch.py +++ /dev/null @@ -1,44 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python proximity_placement_group_patch.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.proximity_placement_groups.update( - resource_group_name="myResourceGroup", - proximity_placement_group_name="myProximityPlacementGroup", - parameters={"tags": {"additionalProp1": "string"}}, - ) - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/proximityPlacementGroupExamples/ProximityPlacementGroup_Patch.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/restore_point_examples/restore_point_collection_create_or_update.py b/sdk/compute/azure-mgmt-compute/generated_samples/restore_point_examples/restore_point_collection_create_or_update.py deleted file mode 100644 index a256206c702b..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/restore_point_examples/restore_point_collection_create_or_update.py +++ /dev/null @@ -1,52 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python restore_point_collection_create_or_update.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.restore_point_collections.create_or_update( - resource_group_name="myResourceGroup", - restore_point_collection_name="myRpc", - parameters={ - "location": "norwayeast", - "properties": { - "source": { - "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM" - } - }, - "tags": {"myTag1": "tagValue1"}, - }, - ) - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/restorePointExamples/RestorePointCollection_CreateOrUpdate.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/restore_point_examples/restore_point_collection_create_or_update_for_cross_region_copy.py b/sdk/compute/azure-mgmt-compute/generated_samples/restore_point_examples/restore_point_collection_create_or_update_for_cross_region_copy.py deleted file mode 100644 index e6869dfd2d11..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/restore_point_examples/restore_point_collection_create_or_update_for_cross_region_copy.py +++ /dev/null @@ -1,52 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python restore_point_collection_create_or_update_for_cross_region_copy.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.restore_point_collections.create_or_update( - resource_group_name="myResourceGroup", - restore_point_collection_name="myRpc", - parameters={ - "location": "norwayeast", - "properties": { - "source": { - "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/restorePointCollections/sourceRpcName" - } - }, - "tags": {"myTag1": "tagValue1"}, - }, - ) - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/restorePointExamples/RestorePointCollection_CreateOrUpdate_ForCrossRegionCopy.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/restore_point_examples/restore_point_collection_delete_maximum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/restore_point_examples/restore_point_collection_delete_maximum_set_gen.py deleted file mode 100644 index 77eb154622fa..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/restore_point_examples/restore_point_collection_delete_maximum_set_gen.py +++ /dev/null @@ -1,42 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python restore_point_collection_delete_maximum_set_gen.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - client.restore_point_collections.begin_delete( - resource_group_name="rgcompute", - restore_point_collection_name="aaaaaaaaaaaaaaaaa", - ).result() - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/restorePointExamples/RestorePointCollection_Delete_MaximumSet_Gen.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/restore_point_examples/restore_point_collection_delete_minimum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/restore_point_examples/restore_point_collection_delete_minimum_set_gen.py deleted file mode 100644 index 494ce6dd00c5..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/restore_point_examples/restore_point_collection_delete_minimum_set_gen.py +++ /dev/null @@ -1,42 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python restore_point_collection_delete_minimum_set_gen.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - client.restore_point_collections.begin_delete( - resource_group_name="rgcompute", - restore_point_collection_name="aaaaaaaaaaaaaaaaaaaa", - ).result() - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/restorePointExamples/RestorePointCollection_Delete_MinimumSet_Gen.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/restore_point_examples/restore_point_collection_get.py b/sdk/compute/azure-mgmt-compute/generated_samples/restore_point_examples/restore_point_collection_get.py deleted file mode 100644 index 91ad809ef9bf..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/restore_point_examples/restore_point_collection_get.py +++ /dev/null @@ -1,43 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python restore_point_collection_get.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.restore_point_collections.get( - resource_group_name="myResourceGroup", - restore_point_collection_name="myRpc", - ) - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/restorePointExamples/RestorePointCollection_Get.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/restore_point_examples/restore_point_collection_get_with_contained_restore_points.py b/sdk/compute/azure-mgmt-compute/generated_samples/restore_point_examples/restore_point_collection_get_with_contained_restore_points.py deleted file mode 100644 index e03767e86cac..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/restore_point_examples/restore_point_collection_get_with_contained_restore_points.py +++ /dev/null @@ -1,43 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python restore_point_collection_get_with_contained_restore_points.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.restore_point_collections.get( - resource_group_name="myResourceGroup", - restore_point_collection_name="rpcName", - ) - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/restorePointExamples/RestorePointCollection_Get_WithContainedRestorePoints.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/restore_point_examples/restore_point_collection_list_by_resource_group.py b/sdk/compute/azure-mgmt-compute/generated_samples/restore_point_examples/restore_point_collection_list_by_resource_group.py deleted file mode 100644 index aa129c9ab2d5..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/restore_point_examples/restore_point_collection_list_by_resource_group.py +++ /dev/null @@ -1,43 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python restore_point_collection_list_by_resource_group.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.restore_point_collections.list( - resource_group_name="myResourceGroup", - ) - for item in response: - print(item) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/restorePointExamples/RestorePointCollection_ListByResourceGroup.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/restore_point_examples/restore_point_collection_list_by_subscription.py b/sdk/compute/azure-mgmt-compute/generated_samples/restore_point_examples/restore_point_collection_list_by_subscription.py deleted file mode 100644 index 72df688bd760..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/restore_point_examples/restore_point_collection_list_by_subscription.py +++ /dev/null @@ -1,41 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python restore_point_collection_list_by_subscription.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.restore_point_collections.list_all() - for item in response: - print(item) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/restorePointExamples/RestorePointCollection_ListBySubscription.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/restore_point_examples/restore_point_collection_update_maximum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/restore_point_examples/restore_point_collection_update_maximum_set_gen.py deleted file mode 100644 index b5694335a71b..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/restore_point_examples/restore_point_collection_update_maximum_set_gen.py +++ /dev/null @@ -1,51 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python restore_point_collection_update_maximum_set_gen.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.restore_point_collections.update( - resource_group_name="rgcompute", - restore_point_collection_name="aaaaaaaaaaaaaaaaaaaa", - parameters={ - "properties": { - "source": { - "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM" - } - }, - "tags": {"key8536": "aaaaaaaaaaaaaaaaaaa"}, - }, - ) - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/restorePointExamples/RestorePointCollection_Update_MaximumSet_Gen.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/restore_point_examples/restore_point_copy_between_regions.py b/sdk/compute/azure-mgmt-compute/generated_samples/restore_point_examples/restore_point_copy_between_regions.py deleted file mode 100644 index cbfdfc732723..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/restore_point_examples/restore_point_copy_between_regions.py +++ /dev/null @@ -1,51 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python restore_point_copy_between_regions.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.restore_points.begin_create( - resource_group_name="myResourceGroup", - restore_point_collection_name="rpcName", - restore_point_name="rpName", - parameters={ - "properties": { - "sourceRestorePoint": { - "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/restorePointCollections/sourceRpcName/restorePoints/sourceRpName" - } - } - }, - ).result() - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/restorePointExamples/RestorePoint_Copy_BetweenRegions.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/restore_point_examples/restore_point_create.py b/sdk/compute/azure-mgmt-compute/generated_samples/restore_point_examples/restore_point_create.py deleted file mode 100644 index 79df28f277d7..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/restore_point_examples/restore_point_create.py +++ /dev/null @@ -1,53 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python restore_point_create.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.restore_points.begin_create( - resource_group_name="myResourceGroup", - restore_point_collection_name="rpcName", - restore_point_name="rpName", - parameters={ - "properties": { - "excludeDisks": [ - { - "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/disk123" - } - ] - } - }, - ).result() - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/restorePointExamples/RestorePoint_Create.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/restore_point_examples/restore_point_delete_maximum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/restore_point_examples/restore_point_delete_maximum_set_gen.py deleted file mode 100644 index b867f68f9c94..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/restore_point_examples/restore_point_delete_maximum_set_gen.py +++ /dev/null @@ -1,43 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python restore_point_delete_maximum_set_gen.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - client.restore_points.begin_delete( - resource_group_name="rgcompute", - restore_point_collection_name="aaaaaaaaaaaaaaaaaaaaaa", - restore_point_name="a", - ).result() - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/restorePointExamples/RestorePoint_Delete_MaximumSet_Gen.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/restore_point_examples/restore_point_delete_minimum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/restore_point_examples/restore_point_delete_minimum_set_gen.py deleted file mode 100644 index 325e46b21dbd..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/restore_point_examples/restore_point_delete_minimum_set_gen.py +++ /dev/null @@ -1,43 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python restore_point_delete_minimum_set_gen.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - client.restore_points.begin_delete( - resource_group_name="rgcompute", - restore_point_collection_name="aaaaaaaaaaaaaaaaa", - restore_point_name="aaaaaaaaaaaaaaaaaaaaaaaa", - ).result() - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/restorePointExamples/RestorePoint_Delete_MinimumSet_Gen.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/restore_point_examples/restore_point_get.py b/sdk/compute/azure-mgmt-compute/generated_samples/restore_point_examples/restore_point_get.py deleted file mode 100644 index f9538403070e..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/restore_point_examples/restore_point_get.py +++ /dev/null @@ -1,44 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python restore_point_get.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.restore_points.get( - resource_group_name="myResourceGroup", - restore_point_collection_name="rpcName", - restore_point_name="rpName", - ) - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/restorePointExamples/RestorePoint_Get.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/restore_point_examples/restore_point_get_with_instance_view.py b/sdk/compute/azure-mgmt-compute/generated_samples/restore_point_examples/restore_point_get_with_instance_view.py deleted file mode 100644 index 08d4cd30b97b..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/restore_point_examples/restore_point_get_with_instance_view.py +++ /dev/null @@ -1,44 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python restore_point_get_with_instance_view.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.restore_points.get( - resource_group_name="myResourceGroup", - restore_point_collection_name="rpcName", - restore_point_name="rpName", - ) - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/restorePointExamples/RestorePoint_Get_WithInstanceView.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/run_command_examples/run_command_get.py b/sdk/compute/azure-mgmt-compute/generated_samples/run_command_examples/run_command_get.py deleted file mode 100644 index aac3db055c42..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/run_command_examples/run_command_get.py +++ /dev/null @@ -1,43 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python run_command_get.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="24fb23e3-6ba3-41f0-9b6e-e41131d5d61e", - ) - - response = client.virtual_machine_run_commands.get( - location="SoutheastAsia", - command_id="RunPowerShellScript", - ) - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/runCommandExamples/RunCommand_Get.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/run_command_examples/run_command_list.py b/sdk/compute/azure-mgmt-compute/generated_samples/run_command_examples/run_command_list.py deleted file mode 100644 index bf713c38b9b4..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/run_command_examples/run_command_list.py +++ /dev/null @@ -1,43 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python run_command_list.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="subid", - ) - - response = client.virtual_machine_run_commands.list( - location="SoutheastAsia", - ) - for item in response: - print(item) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/runCommandExamples/RunCommand_List.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/run_command_examples/virtual_machine_run_command.py b/sdk/compute/azure-mgmt-compute/generated_samples/run_command_examples/virtual_machine_run_command.py deleted file mode 100644 index 191bd35524f3..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/run_command_examples/virtual_machine_run_command.py +++ /dev/null @@ -1,44 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_run_command.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="24fb23e3-6ba3-41f0-9b6e-e41131d5d61e", - ) - - response = client.virtual_machines.begin_run_command( - resource_group_name="crptestar98131", - vm_name="vm3036", - parameters={"commandId": "RunPowerShellScript"}, - ).result() - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/runCommandExamples/VirtualMachineRunCommand.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/run_command_examples/virtual_machine_run_command_create_or_update.py b/sdk/compute/azure-mgmt-compute/generated_samples/run_command_examples/virtual_machine_run_command_create_or_update.py deleted file mode 100644 index 05ff93531629..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/run_command_examples/virtual_machine_run_command_create_or_update.py +++ /dev/null @@ -1,59 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_run_command_create_or_update.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.virtual_machine_run_commands.begin_create_or_update( - resource_group_name="myResourceGroup", - vm_name="myVM", - run_command_name="myRunCommand", - run_command={ - "location": "West US", - "properties": { - "asyncExecution": False, - "errorBlobUri": "https://mystorageaccount.blob.core.windows.net/scriptcontainer/scriptURI", - "outputBlobManagedIdentity": {"clientId": "22d35efb-0c99-4041-8c5b-6d24db33a69a"}, - "outputBlobUri": "https://mystorageaccount.blob.core.windows.net/myscriptoutputcontainer/MyScriptoutput.txt", - "parameters": [{"name": "param1", "value": "value1"}, {"name": "param2", "value": "value2"}], - "runAsPassword": "", - "runAsUser": "user1", - "source": {"scriptUri": "https://mystorageaccount.blob.core.windows.net/scriptcontainer/scriptURI"}, - "timeoutInSeconds": 3600, - "treatFailureAsDeploymentFailure": False, - }, - }, - ).result() - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/runCommandExamples/VirtualMachineRunCommand_CreateOrUpdate.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/run_command_examples/virtual_machine_run_command_delete.py b/sdk/compute/azure-mgmt-compute/generated_samples/run_command_examples/virtual_machine_run_command_delete.py deleted file mode 100644 index 7b4d5d2ab492..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/run_command_examples/virtual_machine_run_command_delete.py +++ /dev/null @@ -1,43 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_run_command_delete.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - client.virtual_machine_run_commands.begin_delete( - resource_group_name="myResourceGroup", - vm_name="myVM", - run_command_name="myRunCommand", - ).result() - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/runCommandExamples/VirtualMachineRunCommand_Delete.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/run_command_examples/virtual_machine_run_command_get.py b/sdk/compute/azure-mgmt-compute/generated_samples/run_command_examples/virtual_machine_run_command_get.py deleted file mode 100644 index b76f01652709..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/run_command_examples/virtual_machine_run_command_get.py +++ /dev/null @@ -1,44 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_run_command_get.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.virtual_machine_run_commands.get_by_virtual_machine( - resource_group_name="myResourceGroup", - vm_name="myVM", - run_command_name="myRunCommand", - ) - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/runCommandExamples/VirtualMachineRunCommand_Get.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/run_command_examples/virtual_machine_run_command_list.py b/sdk/compute/azure-mgmt-compute/generated_samples/run_command_examples/virtual_machine_run_command_list.py deleted file mode 100644 index 7118e5d9b019..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/run_command_examples/virtual_machine_run_command_list.py +++ /dev/null @@ -1,44 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_run_command_list.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.virtual_machine_run_commands.list_by_virtual_machine( - resource_group_name="myResourceGroup", - vm_name="myVM", - ) - for item in response: - print(item) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/runCommandExamples/VirtualMachineRunCommand_List.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/run_command_examples/virtual_machine_run_command_update.py b/sdk/compute/azure-mgmt-compute/generated_samples/run_command_examples/virtual_machine_run_command_update.py deleted file mode 100644 index 16c40cfe28f5..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/run_command_examples/virtual_machine_run_command_update.py +++ /dev/null @@ -1,57 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_run_command_update.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.virtual_machine_run_commands.begin_update( - resource_group_name="myResourceGroup", - vm_name="myVM", - run_command_name="myRunCommand", - run_command={ - "properties": { - "asyncExecution": False, - "errorBlobManagedIdentity": {"objectId": "4231e4d2-33e4-4e23-96b2-17888afa6072"}, - "errorBlobUri": "https://mystorageaccount.blob.core.windows.net/mycontainer/MyScriptError.txt", - "outputBlobUri": "https://mystorageaccount.blob.core.windows.net/myscriptoutputcontainer/outputUri", - "parameters": [{"name": "param1", "value": "value1"}, {"name": "param2", "value": "value2"}], - "runAsPassword": "", - "runAsUser": "user1", - "source": {"script": "Write-Host Hello World! ; Remove-Item C:\test\testFile.txt"}, - "timeoutInSeconds": 3600, - } - }, - ).result() - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/runCommandExamples/VirtualMachineRunCommand_Update.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/run_command_examples/virtual_machine_scale_set_vm_run_command.py b/sdk/compute/azure-mgmt-compute/generated_samples/run_command_examples/virtual_machine_scale_set_vm_run_command.py deleted file mode 100644 index 2ba0aae36fa5..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/run_command_examples/virtual_machine_scale_set_vm_run_command.py +++ /dev/null @@ -1,45 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_scale_set_vm_run_command.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.virtual_machine_scale_set_vms.begin_run_command( - resource_group_name="myResourceGroup", - vm_scale_set_name="myVirtualMachineScaleSet", - instance_id="0", - parameters={"commandId": "RunPowerShellScript", "script": ["Write-Host Hello World!"]}, - ).result() - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/runCommandExamples/VirtualMachineScaleSetVMRunCommand.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/run_command_examples/virtual_machine_scale_set_vm_run_command_create_or_update.py b/sdk/compute/azure-mgmt-compute/generated_samples/run_command_examples/virtual_machine_scale_set_vm_run_command_create_or_update.py deleted file mode 100644 index 5e5b0ce1e58a..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/run_command_examples/virtual_machine_scale_set_vm_run_command_create_or_update.py +++ /dev/null @@ -1,64 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_scale_set_vm_run_command_create_or_update.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.virtual_machine_scale_set_vm_run_commands.begin_create_or_update( - resource_group_name="myResourceGroup", - vm_scale_set_name="myvmScaleSet", - instance_id="0", - run_command_name="myRunCommand", - run_command={ - "location": "West US", - "properties": { - "asyncExecution": False, - "errorBlobManagedIdentity": {}, - "errorBlobUri": "https://mystorageaccount.blob.core.windows.net/mycontainer/MyScriptError.txt", - "outputBlobManagedIdentity": {"clientId": "22d35efb-0c99-4041-8c5b-6d24db33a69a"}, - "outputBlobUri": "https://mystorageaccount.blob.core.windows.net/myscriptoutputcontainer/MyScriptoutput.txt", - "parameters": [{"name": "param1", "value": "value1"}, {"name": "param2", "value": "value2"}], - "runAsPassword": "", - "runAsUser": "user1", - "source": { - "scriptUri": "https://mystorageaccount.blob.core.windows.net/scriptcontainer/MyScript.ps1", - "scriptUriManagedIdentity": {"objectId": "4231e4d2-33e4-4e23-96b2-17888afa6072"}, - }, - "timeoutInSeconds": 3600, - "treatFailureAsDeploymentFailure": True, - }, - }, - ).result() - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/runCommandExamples/VirtualMachineScaleSetVMRunCommand_CreateOrUpdate.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/run_command_examples/virtual_machine_scale_set_vm_run_command_delete.py b/sdk/compute/azure-mgmt-compute/generated_samples/run_command_examples/virtual_machine_scale_set_vm_run_command_delete.py deleted file mode 100644 index d37fe9dbf905..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/run_command_examples/virtual_machine_scale_set_vm_run_command_delete.py +++ /dev/null @@ -1,44 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_scale_set_vm_run_command_delete.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - client.virtual_machine_scale_set_vm_run_commands.begin_delete( - resource_group_name="myResourceGroup", - vm_scale_set_name="myvmScaleSet", - instance_id="0", - run_command_name="myRunCommand", - ).result() - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/runCommandExamples/VirtualMachineScaleSetVMRunCommand_Delete.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/run_command_examples/virtual_machine_scale_set_vm_run_command_get.py b/sdk/compute/azure-mgmt-compute/generated_samples/run_command_examples/virtual_machine_scale_set_vm_run_command_get.py deleted file mode 100644 index 475c77c8cc2d..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/run_command_examples/virtual_machine_scale_set_vm_run_command_get.py +++ /dev/null @@ -1,45 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_scale_set_vm_run_command_get.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.virtual_machine_scale_set_vm_run_commands.get( - resource_group_name="myResourceGroup", - vm_scale_set_name="myvmScaleSet", - instance_id="0", - run_command_name="myRunCommand", - ) - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/runCommandExamples/VirtualMachineScaleSetVMRunCommand_Get.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/run_command_examples/virtual_machine_scale_set_vm_run_command_list.py b/sdk/compute/azure-mgmt-compute/generated_samples/run_command_examples/virtual_machine_scale_set_vm_run_command_list.py deleted file mode 100644 index afdd62820686..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/run_command_examples/virtual_machine_scale_set_vm_run_command_list.py +++ /dev/null @@ -1,45 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_scale_set_vm_run_command_list.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.virtual_machine_scale_set_vm_run_commands.list( - resource_group_name="myResourceGroup", - vm_scale_set_name="myvmScaleSet", - instance_id="0", - ) - for item in response: - print(item) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/runCommandExamples/VirtualMachineScaleSetVMRunCommand_List.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/run_command_examples/virtual_machine_scale_set_vm_run_command_update.py b/sdk/compute/azure-mgmt-compute/generated_samples/run_command_examples/virtual_machine_scale_set_vm_run_command_update.py deleted file mode 100644 index 877137045c82..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/run_command_examples/virtual_machine_scale_set_vm_run_command_update.py +++ /dev/null @@ -1,53 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_scale_set_vm_run_command_update.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.virtual_machine_scale_set_vm_run_commands.begin_update( - resource_group_name="myResourceGroup", - vm_scale_set_name="myvmScaleSet", - instance_id="0", - run_command_name="myRunCommand", - run_command={ - "properties": { - "source": { - "scriptUri": "https://mystorageaccount.blob.core.windows.net/scriptcontainer/MyScript.ps1", - "scriptUriManagedIdentity": {"objectId": "4231e4d2-33e4-4e23-96b2-17888afa6072"}, - } - } - }, - ).result() - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/runCommandExamples/VirtualMachineScaleSetVMRunCommand_Update.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/shared_gallery_examples/shared_gallery_get.py b/sdk/compute/azure-mgmt-compute/generated_samples/shared_gallery_examples/shared_gallery_get.py deleted file mode 100644 index 7ba3b6adfe57..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/shared_gallery_examples/shared_gallery_get.py +++ /dev/null @@ -1,43 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python shared_gallery_get.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.shared_galleries.get( - location="myLocation", - gallery_unique_name="galleryUniqueName", - ) - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples/sharedGalleryExamples/SharedGallery_Get.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/shared_gallery_examples/shared_gallery_image_get.py b/sdk/compute/azure-mgmt-compute/generated_samples/shared_gallery_examples/shared_gallery_image_get.py deleted file mode 100644 index cbd02798c241..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/shared_gallery_examples/shared_gallery_image_get.py +++ /dev/null @@ -1,44 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python shared_gallery_image_get.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.shared_gallery_images.get( - location="myLocation", - gallery_unique_name="galleryUniqueName", - gallery_image_name="myGalleryImageName", - ) - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples/sharedGalleryExamples/SharedGalleryImage_Get.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/shared_gallery_examples/shared_gallery_image_version_get.py b/sdk/compute/azure-mgmt-compute/generated_samples/shared_gallery_examples/shared_gallery_image_version_get.py deleted file mode 100644 index 8984824fd83d..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/shared_gallery_examples/shared_gallery_image_version_get.py +++ /dev/null @@ -1,45 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python shared_gallery_image_version_get.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.shared_gallery_image_versions.get( - location="myLocation", - gallery_unique_name="galleryUniqueName", - gallery_image_name="myGalleryImageName", - gallery_image_version_name="myGalleryImageVersionName", - ) - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples/sharedGalleryExamples/SharedGalleryImageVersion_Get.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/shared_gallery_examples/shared_gallery_image_versions_list.py b/sdk/compute/azure-mgmt-compute/generated_samples/shared_gallery_examples/shared_gallery_image_versions_list.py deleted file mode 100644 index 9a81d536f73c..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/shared_gallery_examples/shared_gallery_image_versions_list.py +++ /dev/null @@ -1,45 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python shared_gallery_image_versions_list.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.shared_gallery_image_versions.list( - location="myLocation", - gallery_unique_name="galleryUniqueName", - gallery_image_name="myGalleryImageName", - ) - for item in response: - print(item) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples/sharedGalleryExamples/SharedGalleryImageVersions_List.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/shared_gallery_examples/shared_gallery_images_list.py b/sdk/compute/azure-mgmt-compute/generated_samples/shared_gallery_examples/shared_gallery_images_list.py deleted file mode 100644 index 7a3ee7fceac5..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/shared_gallery_examples/shared_gallery_images_list.py +++ /dev/null @@ -1,44 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python shared_gallery_images_list.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.shared_gallery_images.list( - location="myLocation", - gallery_unique_name="galleryUniqueName", - ) - for item in response: - print(item) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples/sharedGalleryExamples/SharedGalleryImages_List.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/shared_gallery_examples/shared_gallery_list.py b/sdk/compute/azure-mgmt-compute/generated_samples/shared_gallery_examples/shared_gallery_list.py deleted file mode 100644 index 4d45108a06f1..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/shared_gallery_examples/shared_gallery_list.py +++ /dev/null @@ -1,43 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python shared_gallery_list.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.shared_galleries.list( - location="myLocation", - ) - for item in response: - print(item) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples/sharedGalleryExamples/SharedGallery_List.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/skus/list_available_resource_skus.py b/sdk/compute/azure-mgmt-compute/generated_samples/skus/list_available_resource_skus.py deleted file mode 100644 index f9b2fe7ed9da..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/skus/list_available_resource_skus.py +++ /dev/null @@ -1,41 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python list_available_resource_skus.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.resource_skus.list() - for item in response: - print(item) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/Skus/stable/2021-07-01/examples/skus/ListAvailableResourceSkus.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/skus/list_available_resource_skus_for_aregion.py b/sdk/compute/azure-mgmt-compute/generated_samples/skus/list_available_resource_skus_for_aregion.py deleted file mode 100644 index 41ec903d41ac..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/skus/list_available_resource_skus_for_aregion.py +++ /dev/null @@ -1,41 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python list_available_resource_skus_for_aregion.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.resource_skus.list() - for item in response: - print(item) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/Skus/stable/2021-07-01/examples/skus/ListAvailableResourceSkusForARegion.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/skus/list_available_resource_skus_with_extended_locations.py b/sdk/compute/azure-mgmt-compute/generated_samples/skus/list_available_resource_skus_with_extended_locations.py deleted file mode 100644 index 792fa90d1da4..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/skus/list_available_resource_skus_with_extended_locations.py +++ /dev/null @@ -1,41 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python list_available_resource_skus_with_extended_locations.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.resource_skus.list() - for item in response: - print(item) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/Skus/stable/2021-07-01/examples/skus/ListAvailableResourceSkusWithExtendedLocations.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/snapshot_examples/snapshot_begin_get_access.py b/sdk/compute/azure-mgmt-compute/generated_samples/snapshot_examples/snapshot_begin_get_access.py deleted file mode 100644 index 16f45afba14e..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/snapshot_examples/snapshot_begin_get_access.py +++ /dev/null @@ -1,44 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python snapshot_begin_get_access.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.snapshots.begin_grant_access( - resource_group_name="myResourceGroup", - snapshot_name="mySnapshot", - grant_access_data={"access": "Read", "durationInSeconds": 300, "fileFormat": "VHDX"}, - ).result() - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples/snapshotExamples/Snapshot_BeginGetAccess.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/snapshot_examples/snapshot_create_by_importing_an_unmanaged_blob_from_adifferent_subscription.py b/sdk/compute/azure-mgmt-compute/generated_samples/snapshot_examples/snapshot_create_by_importing_an_unmanaged_blob_from_adifferent_subscription.py deleted file mode 100644 index b389aba1f2f7..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/snapshot_examples/snapshot_create_by_importing_an_unmanaged_blob_from_adifferent_subscription.py +++ /dev/null @@ -1,53 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python snapshot_create_by_importing_an_unmanaged_blob_from_adifferent_subscription.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.snapshots.begin_create_or_update( - resource_group_name="myResourceGroup", - snapshot_name="mySnapshot1", - snapshot={ - "location": "West US", - "properties": { - "creationData": { - "createOption": "Import", - "sourceUri": "https://mystorageaccount.blob.core.windows.net/osimages/osimage.vhd", - "storageAccountId": "subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Storage/storageAccounts/myStorageAccount", - } - }, - }, - ).result() - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples/snapshotExamples/Snapshot_Create_ByImportingAnUnmanagedBlobFromADifferentSubscription.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/snapshot_examples/snapshot_create_by_importing_an_unmanaged_blob_from_the_same_subscription.py b/sdk/compute/azure-mgmt-compute/generated_samples/snapshot_examples/snapshot_create_by_importing_an_unmanaged_blob_from_the_same_subscription.py deleted file mode 100644 index b702ac8a1111..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/snapshot_examples/snapshot_create_by_importing_an_unmanaged_blob_from_the_same_subscription.py +++ /dev/null @@ -1,52 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python snapshot_create_by_importing_an_unmanaged_blob_from_the_same_subscription.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.snapshots.begin_create_or_update( - resource_group_name="myResourceGroup", - snapshot_name="mySnapshot1", - snapshot={ - "location": "West US", - "properties": { - "creationData": { - "createOption": "Import", - "sourceUri": "https://mystorageaccount.blob.core.windows.net/osimages/osimage.vhd", - } - }, - }, - ).result() - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples/snapshotExamples/Snapshot_Create_ByImportingAnUnmanagedBlobFromTheSameSubscription.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/snapshot_examples/snapshot_create_enhanced_provisioned_bandwidth_copy_speed.py b/sdk/compute/azure-mgmt-compute/generated_samples/snapshot_examples/snapshot_create_enhanced_provisioned_bandwidth_copy_speed.py deleted file mode 100644 index 929b05273423..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/snapshot_examples/snapshot_create_enhanced_provisioned_bandwidth_copy_speed.py +++ /dev/null @@ -1,53 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python snapshot_create_enhanced_provisioned_bandwidth_copy_speed.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.snapshots.begin_create_or_update( - resource_group_name="myResourceGroup", - snapshot_name="mySnapshot2", - snapshot={ - "location": "West US", - "properties": { - "creationData": { - "createOption": "CopyStart", - "provisionedBandwidthCopySpeed": "Enhanced", - "sourceResourceId": "subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot1", - } - }, - }, - ).result() - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples/snapshotExamples/Snapshot_Create_EnhancedProvisionedBandwidthCopySpeed.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/snapshot_examples/snapshot_create_from_an_elastic_san_volume_snapshot.py b/sdk/compute/azure-mgmt-compute/generated_samples/snapshot_examples/snapshot_create_from_an_elastic_san_volume_snapshot.py deleted file mode 100644 index fb8193c50f12..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/snapshot_examples/snapshot_create_from_an_elastic_san_volume_snapshot.py +++ /dev/null @@ -1,52 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python snapshot_create_from_an_elastic_san_volume_snapshot.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.snapshots.begin_create_or_update( - resource_group_name="myResourceGroup", - snapshot_name="mySnapshot", - snapshot={ - "location": "West US", - "properties": { - "creationData": { - "createOption": "CopyFromSanSnapshot", - "elasticSanResourceId": "subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.ElasticSan/elasticSans/myElasticSan/volumegroups/myElasticSanVolumeGroup/snapshots/myElasticSanVolumeSnapshot", - } - }, - }, - ).result() - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples/snapshotExamples/Snapshot_Create_FromAnElasticSanVolumeSnapshot.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/snapshot_examples/snapshot_create_from_an_existing_snapshot.py b/sdk/compute/azure-mgmt-compute/generated_samples/snapshot_examples/snapshot_create_from_an_existing_snapshot.py deleted file mode 100644 index aa31695541ab..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/snapshot_examples/snapshot_create_from_an_existing_snapshot.py +++ /dev/null @@ -1,52 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python snapshot_create_from_an_existing_snapshot.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.snapshots.begin_create_or_update( - resource_group_name="myResourceGroup", - snapshot_name="mySnapshot2", - snapshot={ - "location": "West US", - "properties": { - "creationData": { - "createOption": "Copy", - "sourceResourceId": "subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot1", - } - }, - }, - ).result() - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples/snapshotExamples/Snapshot_Create_FromAnExistingSnapshot.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/snapshot_examples/snapshot_create_from_an_existing_snapshot_in_different_region.py b/sdk/compute/azure-mgmt-compute/generated_samples/snapshot_examples/snapshot_create_from_an_existing_snapshot_in_different_region.py deleted file mode 100644 index dc032479e021..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/snapshot_examples/snapshot_create_from_an_existing_snapshot_in_different_region.py +++ /dev/null @@ -1,52 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python snapshot_create_from_an_existing_snapshot_in_different_region.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.snapshots.begin_create_or_update( - resource_group_name="myResourceGroup", - snapshot_name="mySnapshot2", - snapshot={ - "location": "West US", - "properties": { - "creationData": { - "createOption": "CopyStart", - "sourceResourceId": "subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot1", - } - }, - }, - ).result() - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples/snapshotExamples/Snapshot_Create_FromAnExistingSnapshotInDifferentRegion.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/snapshot_examples/snapshot_create_instant_access_snapshot.py b/sdk/compute/azure-mgmt-compute/generated_samples/snapshot_examples/snapshot_create_instant_access_snapshot.py deleted file mode 100644 index 9adf2aeef4ef..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/snapshot_examples/snapshot_create_instant_access_snapshot.py +++ /dev/null @@ -1,53 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python snapshot_create_instant_access_snapshot.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.snapshots.begin_create_or_update( - resource_group_name="myResourceGroup", - snapshot_name="mySnapshot2", - snapshot={ - "location": "West US", - "properties": { - "creationData": { - "createOption": "Copy", - "instantAccessDurationMinutes": 120, - "sourceResourceId": "subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myDisk1", - } - }, - }, - ).result() - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples/snapshotExamples/Snapshot_Create_InstantAccessSnapshot.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/snapshot_examples/snapshot_delete.py b/sdk/compute/azure-mgmt-compute/generated_samples/snapshot_examples/snapshot_delete.py deleted file mode 100644 index bd09da407119..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/snapshot_examples/snapshot_delete.py +++ /dev/null @@ -1,42 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python snapshot_delete.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - client.snapshots.begin_delete( - resource_group_name="myResourceGroup", - snapshot_name="mySnapshot", - ).result() - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples/snapshotExamples/Snapshot_Delete.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/snapshot_examples/snapshot_end_get_access.py b/sdk/compute/azure-mgmt-compute/generated_samples/snapshot_examples/snapshot_end_get_access.py deleted file mode 100644 index e2dce9abc75a..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/snapshot_examples/snapshot_end_get_access.py +++ /dev/null @@ -1,42 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python snapshot_end_get_access.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - client.snapshots.begin_revoke_access( - resource_group_name="myResourceGroup", - snapshot_name="mySnapshot", - ).result() - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples/snapshotExamples/Snapshot_EndGetAccess.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/snapshot_examples/snapshot_get.py b/sdk/compute/azure-mgmt-compute/generated_samples/snapshot_examples/snapshot_get.py deleted file mode 100644 index 48230653f77f..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/snapshot_examples/snapshot_get.py +++ /dev/null @@ -1,43 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python snapshot_get.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.snapshots.get( - resource_group_name="myResourceGroup", - snapshot_name="mySnapshot", - ) - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples/snapshotExamples/Snapshot_Get.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/snapshot_examples/snapshot_get_incremental_snapshot.py b/sdk/compute/azure-mgmt-compute/generated_samples/snapshot_examples/snapshot_get_incremental_snapshot.py deleted file mode 100644 index 1fa5a32c863c..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/snapshot_examples/snapshot_get_incremental_snapshot.py +++ /dev/null @@ -1,43 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python snapshot_get_incremental_snapshot.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.snapshots.get( - resource_group_name="myResourceGroup", - snapshot_name="myIncrementalSnapshot", - ) - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples/snapshotExamples/Snapshot_GetIncrementalSnapshot.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/snapshot_examples/snapshot_list_by_resource_group.py b/sdk/compute/azure-mgmt-compute/generated_samples/snapshot_examples/snapshot_list_by_resource_group.py deleted file mode 100644 index 61804f7485a7..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/snapshot_examples/snapshot_list_by_resource_group.py +++ /dev/null @@ -1,43 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python snapshot_list_by_resource_group.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.snapshots.list_by_resource_group( - resource_group_name="myResourceGroup", - ) - for item in response: - print(item) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples/snapshotExamples/Snapshot_ListByResourceGroup.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/snapshot_examples/snapshot_list_by_subscription.py b/sdk/compute/azure-mgmt-compute/generated_samples/snapshot_examples/snapshot_list_by_subscription.py deleted file mode 100644 index 6a37dfdaf84e..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/snapshot_examples/snapshot_list_by_subscription.py +++ /dev/null @@ -1,41 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python snapshot_list_by_subscription.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.snapshots.list() - for item in response: - print(item) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples/snapshotExamples/Snapshot_ListBySubscription.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/snapshot_examples/snapshot_update.py b/sdk/compute/azure-mgmt-compute/generated_samples/snapshot_examples/snapshot_update.py deleted file mode 100644 index 61a7d60bdde1..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/snapshot_examples/snapshot_update.py +++ /dev/null @@ -1,47 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python snapshot_update.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.snapshots.begin_update( - resource_group_name="myResourceGroup", - snapshot_name="mySnapshot", - snapshot={ - "properties": {"diskSizeGB": 20}, - "tags": {"department": "Development", "project": "UpdateSnapshots"}, - }, - ).result() - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples/snapshotExamples/Snapshot_Update.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/snapshot_examples/snapshot_update_with_accelerated_network.py b/sdk/compute/azure-mgmt-compute/generated_samples/snapshot_examples/snapshot_update_with_accelerated_network.py deleted file mode 100644 index b4ea09658e9f..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/snapshot_examples/snapshot_update_with_accelerated_network.py +++ /dev/null @@ -1,47 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python snapshot_update_with_accelerated_network.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.snapshots.begin_update( - resource_group_name="myResourceGroup", - snapshot_name="mySnapshot", - snapshot={ - "properties": {"diskSizeGB": 20, "supportedCapabilities": {"acceleratedNetwork": False}}, - "tags": {"department": "Development", "project": "UpdateSnapshots"}, - }, - ).result() - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples/snapshotExamples/Snapshot_Update_WithAcceleratedNetwork.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/ssh_public_key_examples/ssh_public_key_create.py b/sdk/compute/azure-mgmt-compute/generated_samples/ssh_public_key_examples/ssh_public_key_create.py deleted file mode 100644 index b1bdc1d40c26..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/ssh_public_key_examples/ssh_public_key_create.py +++ /dev/null @@ -1,44 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python ssh_public_key_create.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.ssh_public_keys.create( - resource_group_name="myResourceGroup", - ssh_public_key_name="mySshPublicKeyName", - parameters={"location": "westus", "properties": {"publicKey": "{ssh-rsa public key}"}}, - ) - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/sshPublicKeyExamples/SshPublicKey_Create.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/ssh_public_key_examples/ssh_public_key_delete_maximum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/ssh_public_key_examples/ssh_public_key_delete_maximum_set_gen.py deleted file mode 100644 index 22fc4b2b3786..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/ssh_public_key_examples/ssh_public_key_delete_maximum_set_gen.py +++ /dev/null @@ -1,42 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python ssh_public_key_delete_maximum_set_gen.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - client.ssh_public_keys.delete( - resource_group_name="rgcompute", - ssh_public_key_name="aaaaaaaaaa", - ) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/sshPublicKeyExamples/SshPublicKey_Delete_MaximumSet_Gen.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/ssh_public_key_examples/ssh_public_key_delete_minimum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/ssh_public_key_examples/ssh_public_key_delete_minimum_set_gen.py deleted file mode 100644 index 9865dabcb139..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/ssh_public_key_examples/ssh_public_key_delete_minimum_set_gen.py +++ /dev/null @@ -1,42 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python ssh_public_key_delete_minimum_set_gen.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - client.ssh_public_keys.delete( - resource_group_name="rgcompute", - ssh_public_key_name="aaaaaaaaaaaaaaaaaaa", - ) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/sshPublicKeyExamples/SshPublicKey_Delete_MinimumSet_Gen.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/ssh_public_key_examples/ssh_public_key_generate_key_pair.py b/sdk/compute/azure-mgmt-compute/generated_samples/ssh_public_key_examples/ssh_public_key_generate_key_pair.py deleted file mode 100644 index 919bc79ee0fd..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/ssh_public_key_examples/ssh_public_key_generate_key_pair.py +++ /dev/null @@ -1,43 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python ssh_public_key_generate_key_pair.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.ssh_public_keys.generate_key_pair( - resource_group_name="myResourceGroup", - ssh_public_key_name="mySshPublicKeyName", - ) - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/sshPublicKeyExamples/SshPublicKey_GenerateKeyPair.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/ssh_public_key_examples/ssh_public_key_generate_key_pair_encryption_with_ed25519.py b/sdk/compute/azure-mgmt-compute/generated_samples/ssh_public_key_examples/ssh_public_key_generate_key_pair_encryption_with_ed25519.py deleted file mode 100644 index 8bb0f1bff9cb..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/ssh_public_key_examples/ssh_public_key_generate_key_pair_encryption_with_ed25519.py +++ /dev/null @@ -1,43 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python ssh_public_key_generate_key_pair_encryption_with_ed25519.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.ssh_public_keys.generate_key_pair( - resource_group_name="myResourceGroup", - ssh_public_key_name="mySshPublicKeyName", - ) - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/sshPublicKeyExamples/SshPublicKey_GenerateKeyPair_EncryptionWithEd25519.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/ssh_public_key_examples/ssh_public_key_generate_key_pair_encryption_with_rsa.py b/sdk/compute/azure-mgmt-compute/generated_samples/ssh_public_key_examples/ssh_public_key_generate_key_pair_encryption_with_rsa.py deleted file mode 100644 index 8a325a190011..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/ssh_public_key_examples/ssh_public_key_generate_key_pair_encryption_with_rsa.py +++ /dev/null @@ -1,43 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python ssh_public_key_generate_key_pair_encryption_with_rsa.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.ssh_public_keys.generate_key_pair( - resource_group_name="myResourceGroup", - ssh_public_key_name="mySshPublicKeyName", - ) - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/sshPublicKeyExamples/SshPublicKey_GenerateKeyPair_EncryptionWithRSA.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/ssh_public_key_examples/ssh_public_key_get.py b/sdk/compute/azure-mgmt-compute/generated_samples/ssh_public_key_examples/ssh_public_key_get.py deleted file mode 100644 index cd2557b3ebf9..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/ssh_public_key_examples/ssh_public_key_get.py +++ /dev/null @@ -1,43 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python ssh_public_key_get.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscriptionId}", - ) - - response = client.ssh_public_keys.get( - resource_group_name="myResourceGroup", - ssh_public_key_name="mySshPublicKeyName", - ) - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/sshPublicKeyExamples/SshPublicKey_Get.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/ssh_public_key_examples/ssh_public_key_list_by_resource_group_maximum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/ssh_public_key_examples/ssh_public_key_list_by_resource_group_maximum_set_gen.py deleted file mode 100644 index 30b34db6bc72..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/ssh_public_key_examples/ssh_public_key_list_by_resource_group_maximum_set_gen.py +++ /dev/null @@ -1,43 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python ssh_public_key_list_by_resource_group_maximum_set_gen.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.ssh_public_keys.list_by_resource_group( - resource_group_name="rgcompute", - ) - for item in response: - print(item) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/sshPublicKeyExamples/SshPublicKey_ListByResourceGroup_MaximumSet_Gen.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/ssh_public_key_examples/ssh_public_key_list_by_resource_group_minimum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/ssh_public_key_examples/ssh_public_key_list_by_resource_group_minimum_set_gen.py deleted file mode 100644 index 8b1ac36544e3..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/ssh_public_key_examples/ssh_public_key_list_by_resource_group_minimum_set_gen.py +++ /dev/null @@ -1,43 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python ssh_public_key_list_by_resource_group_minimum_set_gen.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.ssh_public_keys.list_by_resource_group( - resource_group_name="rgcompute", - ) - for item in response: - print(item) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/sshPublicKeyExamples/SshPublicKey_ListByResourceGroup_MinimumSet_Gen.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/ssh_public_key_examples/ssh_public_key_list_by_subscription_maximum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/ssh_public_key_examples/ssh_public_key_list_by_subscription_maximum_set_gen.py deleted file mode 100644 index f892eb59b8d8..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/ssh_public_key_examples/ssh_public_key_list_by_subscription_maximum_set_gen.py +++ /dev/null @@ -1,41 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python ssh_public_key_list_by_subscription_maximum_set_gen.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.ssh_public_keys.list_by_subscription() - for item in response: - print(item) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/sshPublicKeyExamples/SshPublicKey_ListBySubscription_MaximumSet_Gen.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/ssh_public_key_examples/ssh_public_key_list_by_subscription_minimum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/ssh_public_key_examples/ssh_public_key_list_by_subscription_minimum_set_gen.py deleted file mode 100644 index 4044e9fa6626..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/ssh_public_key_examples/ssh_public_key_list_by_subscription_minimum_set_gen.py +++ /dev/null @@ -1,41 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python ssh_public_key_list_by_subscription_minimum_set_gen.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.ssh_public_keys.list_by_subscription() - for item in response: - print(item) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/sshPublicKeyExamples/SshPublicKey_ListBySubscription_MinimumSet_Gen.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/ssh_public_key_examples/ssh_public_key_update_maximum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/ssh_public_key_examples/ssh_public_key_update_maximum_set_gen.py deleted file mode 100644 index cac6d0615de4..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/ssh_public_key_examples/ssh_public_key_update_maximum_set_gen.py +++ /dev/null @@ -1,44 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python ssh_public_key_update_maximum_set_gen.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.ssh_public_keys.update( - resource_group_name="rgcompute", - ssh_public_key_name="aaaaaaaaaaaa", - parameters={"properties": {"publicKey": "{ssh-rsa public key}"}, "tags": {"key2854": "a"}}, - ) - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/sshPublicKeyExamples/SshPublicKey_Update_MaximumSet_Gen.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_assess_patches.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_assess_patches.py deleted file mode 100644 index 07b950d0bb5a..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_assess_patches.py +++ /dev/null @@ -1,43 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_assess_patches.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.virtual_machines.begin_assess_patches( - resource_group_name="myResourceGroupName", - vm_name="myVMName", - ).result() - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineExamples/VirtualMachine_AssessPatches.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_attach_detach_data_disks_maximum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_attach_detach_data_disks_maximum_set_gen.py deleted file mode 100644 index 262103f355e8..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_attach_detach_data_disks_maximum_set_gen.py +++ /dev/null @@ -1,77 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_attach_detach_data_disks_maximum_set_gen.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.virtual_machines.begin_attach_detach_data_disks( - resource_group_name="rgcompute", - vm_name="aaaaaaaaaaaaaaaaaaaa", - parameters={ - "dataDisksToAttach": [ - { - "caching": "ReadOnly", - "deleteOption": "Delete", - "diskEncryptionSet": { - "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSets/{existing-diskEncryptionSet-name}" - }, - "diskId": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/vmss3176_vmss3176_0_disk2_6c4f554bdafa49baa780eb2d128ff39d", - "lun": 1, - "writeAcceleratorEnabled": True, - }, - { - "caching": "ReadWrite", - "deleteOption": "Detach", - "diskEncryptionSet": { - "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSets/{existing-diskEncryptionSet-name}" - }, - "diskId": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/vmss3176_vmss3176_2_disk3_7d5e664bdafa49baa780eb2d128ff38e", - "lun": 2, - "writeAcceleratorEnabled": False, - }, - ], - "dataDisksToDetach": [ - { - "detachOption": "ForceDetach", - "diskId": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/vmss3176_vmss3176_1_disk1_1a4e784bdafa49baa780eb2d128ff65x", - }, - { - "detachOption": "ForceDetach", - "diskId": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/vmss3176_vmss3176_4_disk4_4d4e784bdafa49baa780eb2d256ff41z", - }, - ], - }, - ).result() - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineExamples/VirtualMachine_AttachDetachDataDisks_MaximumSet_Gen.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_attach_detach_data_disks_minimum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_attach_detach_data_disks_minimum_set_gen.py deleted file mode 100644 index 10ae69fa4a4d..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_attach_detach_data_disks_minimum_set_gen.py +++ /dev/null @@ -1,55 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_attach_detach_data_disks_minimum_set_gen.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.virtual_machines.begin_attach_detach_data_disks( - resource_group_name="rgcompute", - vm_name="azure-vm", - parameters={ - "dataDisksToAttach": [ - { - "diskId": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/vmss3176_vmss3176_0_disk2_6c4f554bdafa49baa780eb2d128ff39d" - } - ], - "dataDisksToDetach": [ - { - "diskId": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/vmss3176_vmss3176_1_disk1_1a4e784bdafa49baa780eb2d128ff65x" - } - ], - }, - ).result() - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineExamples/VirtualMachine_AttachDetachDataDisks_MinimumSet_Gen.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_capture_maximum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_capture_maximum_set_gen.py deleted file mode 100644 index bae403030ffa..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_capture_maximum_set_gen.py +++ /dev/null @@ -1,44 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_capture_maximum_set_gen.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.virtual_machines.begin_capture( - resource_group_name="rgcompute", - vm_name="aaaaaaaaaaaaaaaaaaaa", - parameters={"destinationContainerName": "aaaaaaa", "overwriteVhds": True, "vhdPrefix": "aaaaaaaaa"}, - ).result() - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineExamples/VirtualMachine_Capture_MaximumSet_Gen.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_capture_minimum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_capture_minimum_set_gen.py deleted file mode 100644 index df5d97877cf3..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_capture_minimum_set_gen.py +++ /dev/null @@ -1,44 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_capture_minimum_set_gen.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.virtual_machines.begin_capture( - resource_group_name="rgcompute", - vm_name="aaaaaaaaaaaaa", - parameters={"destinationContainerName": "aaaaaaa", "overwriteVhds": True, "vhdPrefix": "aaaaaaaaa"}, - ).result() - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineExamples/VirtualMachine_Capture_MinimumSet_Gen.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_convert_to_managed_disks_maximum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_convert_to_managed_disks_maximum_set_gen.py deleted file mode 100644 index 0cf74d8d6fab..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_convert_to_managed_disks_maximum_set_gen.py +++ /dev/null @@ -1,42 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_convert_to_managed_disks_maximum_set_gen.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - client.virtual_machines.begin_convert_to_managed_disks( - resource_group_name="rgcompute", - vm_name="aaaaaaa", - ).result() - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineExamples/VirtualMachine_ConvertToManagedDisks_MaximumSet_Gen.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_convert_to_managed_disks_minimum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_convert_to_managed_disks_minimum_set_gen.py deleted file mode 100644 index 73b31705736d..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_convert_to_managed_disks_minimum_set_gen.py +++ /dev/null @@ -1,42 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_convert_to_managed_disks_minimum_set_gen.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - client.virtual_machines.begin_convert_to_managed_disks( - resource_group_name="rgcompute", - vm_name="aaaaaaaaaaa", - ).result() - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineExamples/VirtualMachine_ConvertToManagedDisks_MinimumSet_Gen.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_custom_image_vm_from_an_unmanaged_generalized_os_image.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_custom_image_vm_from_an_unmanaged_generalized_os_image.py deleted file mode 100644 index 008af9e42d90..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_custom_image_vm_from_an_unmanaged_generalized_os_image.py +++ /dev/null @@ -1,76 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_create_custom_image_vm_from_an_unmanaged_generalized_os_image.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.virtual_machines.begin_create_or_update( - resource_group_name="myResourceGroup", - vm_name="{vm-name}", - parameters={ - "location": "westus", - "properties": { - "hardwareProfile": {"vmSize": "Standard_D1_v2"}, - "networkProfile": { - "networkInterfaces": [ - { - "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}", - "properties": {"primary": True}, - } - ] - }, - "osProfile": { - "adminPassword": "{your-password}", - "adminUsername": "{your-username}", - "computerName": "myVM", - }, - "storageProfile": { - "osDisk": { - "caching": "ReadWrite", - "createOption": "FromImage", - "image": { - "uri": "http://{existing-storage-account-name}.blob.core.windows.net/{existing-container-name}/{existing-generalized-os-image-blob-name}.vhd" - }, - "name": "myVMosdisk", - "osType": "Windows", - "vhd": { - "uri": "http://{existing-storage-account-name}.blob.core.windows.net/{existing-container-name}/myDisk.vhd" - }, - } - }, - }, - }, - ).result() - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineExamples/VirtualMachine_Create_CustomImageVmFromAnUnmanagedGeneralizedOsImage.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_from_acommunity_gallery_image.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_from_acommunity_gallery_image.py deleted file mode 100644 index 8b62581a37d6..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_from_acommunity_gallery_image.py +++ /dev/null @@ -1,73 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_create_from_acommunity_gallery_image.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.virtual_machines.begin_create_or_update( - resource_group_name="myResourceGroup", - vm_name="myVM", - parameters={ - "location": "westus", - "properties": { - "hardwareProfile": {"vmSize": "Standard_D1_v2"}, - "networkProfile": { - "networkInterfaces": [ - { - "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}", - "properties": {"primary": True}, - } - ] - }, - "osProfile": { - "adminPassword": "{your-password}", - "adminUsername": "{your-username}", - "computerName": "myVM", - }, - "storageProfile": { - "imageReference": { - "communityGalleryImageId": "/CommunityGalleries/galleryPublicName/Images/communityGalleryImageName/Versions/communityGalleryImageVersionName" - }, - "osDisk": { - "caching": "ReadWrite", - "createOption": "FromImage", - "managedDisk": {"storageAccountType": "Standard_LRS"}, - "name": "myVMosdisk", - }, - }, - }, - }, - ).result() - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineExamples/VirtualMachine_Create_FromACommunityGalleryImage.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_from_acustom_image.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_from_acustom_image.py deleted file mode 100644 index 485013747a4a..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_from_acustom_image.py +++ /dev/null @@ -1,73 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_create_from_acustom_image.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.virtual_machines.begin_create_or_update( - resource_group_name="myResourceGroup", - vm_name="myVM", - parameters={ - "location": "westus", - "properties": { - "hardwareProfile": {"vmSize": "Standard_D1_v2"}, - "networkProfile": { - "networkInterfaces": [ - { - "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}", - "properties": {"primary": True}, - } - ] - }, - "osProfile": { - "adminPassword": "{your-password}", - "adminUsername": "{your-username}", - "computerName": "myVM", - }, - "storageProfile": { - "imageReference": { - "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/images/{existing-custom-image-name}" - }, - "osDisk": { - "caching": "ReadWrite", - "createOption": "FromImage", - "managedDisk": {"storageAccountType": "Standard_LRS"}, - "name": "myVMosdisk", - }, - }, - }, - }, - ).result() - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineExamples/VirtualMachine_Create_FromACustomImage.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_from_ageneralized_shared_image.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_from_ageneralized_shared_image.py deleted file mode 100644 index efe276f5351d..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_from_ageneralized_shared_image.py +++ /dev/null @@ -1,73 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_create_from_ageneralized_shared_image.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.virtual_machines.begin_create_or_update( - resource_group_name="myResourceGroup", - vm_name="myVM", - parameters={ - "location": "westus", - "properties": { - "hardwareProfile": {"vmSize": "Standard_D1_v2"}, - "networkProfile": { - "networkInterfaces": [ - { - "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}", - "properties": {"primary": True}, - } - ] - }, - "osProfile": { - "adminPassword": "{your-password}", - "adminUsername": "{your-username}", - "computerName": "myVM", - }, - "storageProfile": { - "imageReference": { - "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/galleries/mySharedGallery/images/mySharedImage" - }, - "osDisk": { - "caching": "ReadWrite", - "createOption": "FromImage", - "managedDisk": {"storageAccountType": "Standard_LRS"}, - "name": "myVMosdisk", - }, - }, - }, - }, - ).result() - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineExamples/VirtualMachine_Create_FromAGeneralizedSharedImage.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_from_ashared_gallery_image.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_from_ashared_gallery_image.py deleted file mode 100644 index 83bc3711a529..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_from_ashared_gallery_image.py +++ /dev/null @@ -1,73 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_create_from_ashared_gallery_image.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.virtual_machines.begin_create_or_update( - resource_group_name="myResourceGroup", - vm_name="myVM", - parameters={ - "location": "westus", - "properties": { - "hardwareProfile": {"vmSize": "Standard_D1_v2"}, - "networkProfile": { - "networkInterfaces": [ - { - "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}", - "properties": {"primary": True}, - } - ] - }, - "osProfile": { - "adminPassword": "{your-password}", - "adminUsername": "{your-username}", - "computerName": "myVM", - }, - "storageProfile": { - "imageReference": { - "sharedGalleryImageId": "/SharedGalleries/sharedGalleryName/Images/sharedGalleryImageName/Versions/sharedGalleryImageVersionName" - }, - "osDisk": { - "caching": "ReadWrite", - "createOption": "FromImage", - "managedDisk": {"storageAccountType": "Standard_LRS"}, - "name": "myVMosdisk", - }, - }, - }, - }, - ).result() - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineExamples/VirtualMachine_Create_FromASharedGalleryImage.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_from_aspecialized_shared_image.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_from_aspecialized_shared_image.py deleted file mode 100644 index 6d1335d9e875..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_from_aspecialized_shared_image.py +++ /dev/null @@ -1,68 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_create_from_aspecialized_shared_image.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.virtual_machines.begin_create_or_update( - resource_group_name="myResourceGroup", - vm_name="myVM", - parameters={ - "location": "westus", - "properties": { - "hardwareProfile": {"vmSize": "Standard_D1_v2"}, - "networkProfile": { - "networkInterfaces": [ - { - "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}", - "properties": {"primary": True}, - } - ] - }, - "storageProfile": { - "imageReference": { - "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/galleries/mySharedGallery/images/mySharedImage" - }, - "osDisk": { - "caching": "ReadWrite", - "createOption": "FromImage", - "managedDisk": {"storageAccountType": "Standard_LRS"}, - "name": "myVMosdisk", - }, - }, - }, - }, - ).result() - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineExamples/VirtualMachine_Create_FromASpecializedSharedImage.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_in_an_availability_set.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_in_an_availability_set.py deleted file mode 100644 index 5667ea029756..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_in_an_availability_set.py +++ /dev/null @@ -1,79 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_create_in_an_availability_set.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.virtual_machines.begin_create_or_update( - resource_group_name="myResourceGroup", - vm_name="myVM", - parameters={ - "location": "westus", - "properties": { - "availabilitySet": { - "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/availabilitySets/{existing-availability-set-name}" - }, - "hardwareProfile": {"vmSize": "Standard_D1_v2"}, - "networkProfile": { - "networkInterfaces": [ - { - "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}", - "properties": {"primary": True}, - } - ] - }, - "osProfile": { - "adminPassword": "{your-password}", - "adminUsername": "{your-username}", - "computerName": "myVM", - }, - "storageProfile": { - "imageReference": { - "offer": "WindowsServer", - "publisher": "MicrosoftWindowsServer", - "sku": "2016-Datacenter", - "version": "latest", - }, - "osDisk": { - "caching": "ReadWrite", - "createOption": "FromImage", - "managedDisk": {"storageAccountType": "Standard_LRS"}, - "name": "myVMosdisk", - }, - }, - }, - }, - ).result() - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineExamples/VirtualMachine_Create_InAnAvailabilitySet.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_in_avmss_with_customer_assigned_platform_fault_domain.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_in_avmss_with_customer_assigned_platform_fault_domain.py deleted file mode 100644 index a35fbfbb3738..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_in_avmss_with_customer_assigned_platform_fault_domain.py +++ /dev/null @@ -1,80 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_create_in_avmss_with_customer_assigned_platform_fault_domain.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.virtual_machines.begin_create_or_update( - resource_group_name="myResourceGroup", - vm_name="myVM", - parameters={ - "location": "westus", - "properties": { - "hardwareProfile": {"vmSize": "Standard_D1_v2"}, - "networkProfile": { - "networkInterfaces": [ - { - "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}", - "properties": {"primary": True}, - } - ] - }, - "osProfile": { - "adminPassword": "{your-password}", - "adminUsername": "{your-username}", - "computerName": "myVM", - }, - "platformFaultDomain": 1, - "storageProfile": { - "imageReference": { - "offer": "WindowsServer", - "publisher": "MicrosoftWindowsServer", - "sku": "2016-Datacenter", - "version": "latest", - }, - "osDisk": { - "caching": "ReadWrite", - "createOption": "FromImage", - "managedDisk": {"storageAccountType": "Standard_LRS"}, - "name": "myVMosdisk", - }, - }, - "virtualMachineScaleSet": { - "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachineScaleSets/{existing-flex-vmss-name-with-platformFaultDomainCount-greater-than-1}" - }, - }, - }, - ).result() - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineExamples/VirtualMachine_Create_InAVmssWithCustomerAssignedPlatformFaultDomain.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_linux_vm_with_automatic_by_platform_settings.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_linux_vm_with_automatic_by_platform_settings.py deleted file mode 100644 index 6fe1e74a2bda..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_linux_vm_with_automatic_by_platform_settings.py +++ /dev/null @@ -1,87 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_create_linux_vm_with_automatic_by_platform_settings.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.virtual_machines.begin_create_or_update( - resource_group_name="myResourceGroup", - vm_name="myVM", - parameters={ - "location": "westus", - "properties": { - "hardwareProfile": {"vmSize": "Standard_D2s_v3"}, - "networkProfile": { - "networkInterfaces": [ - { - "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}", - "properties": {"primary": True}, - } - ] - }, - "osProfile": { - "adminPassword": "{your-password}", - "adminUsername": "{your-username}", - "computerName": "myVM", - "linuxConfiguration": { - "patchSettings": { - "assessmentMode": "AutomaticByPlatform", - "automaticByPlatformSettings": { - "bypassPlatformSafetyChecksOnUserSchedule": True, - "rebootSetting": "Never", - }, - "patchMode": "AutomaticByPlatform", - }, - "provisionVMAgent": True, - }, - }, - "storageProfile": { - "imageReference": { - "offer": "UbuntuServer", - "publisher": "Canonical", - "sku": "16.04-LTS", - "version": "latest", - }, - "osDisk": { - "caching": "ReadWrite", - "createOption": "FromImage", - "managedDisk": {"storageAccountType": "Premium_LRS"}, - "name": "myVMosdisk", - }, - }, - }, - }, - ).result() - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineExamples/VirtualMachine_Create_LinuxVmWithAutomaticByPlatformSettings.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_linux_vm_with_patch_setting_assessment_mode_of_image_default.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_linux_vm_with_patch_setting_assessment_mode_of_image_default.py deleted file mode 100644 index 3be67d4060d1..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_linux_vm_with_patch_setting_assessment_mode_of_image_default.py +++ /dev/null @@ -1,80 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_create_linux_vm_with_patch_setting_assessment_mode_of_image_default.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.virtual_machines.begin_create_or_update( - resource_group_name="myResourceGroup", - vm_name="myVM", - parameters={ - "location": "westus", - "properties": { - "hardwareProfile": {"vmSize": "Standard_D2s_v3"}, - "networkProfile": { - "networkInterfaces": [ - { - "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}", - "properties": {"primary": True}, - } - ] - }, - "osProfile": { - "adminPassword": "{your-password}", - "adminUsername": "{your-username}", - "computerName": "myVM", - "linuxConfiguration": { - "patchSettings": {"assessmentMode": "ImageDefault"}, - "provisionVMAgent": True, - }, - }, - "storageProfile": { - "imageReference": { - "offer": "UbuntuServer", - "publisher": "Canonical", - "sku": "16.04-LTS", - "version": "latest", - }, - "osDisk": { - "caching": "ReadWrite", - "createOption": "FromImage", - "managedDisk": {"storageAccountType": "Premium_LRS"}, - "name": "myVMosdisk", - }, - }, - }, - }, - ).result() - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineExamples/VirtualMachine_Create_LinuxVmWithPatchSettingAssessmentModeOfImageDefault.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_linux_vm_with_patch_setting_mode_of_image_default.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_linux_vm_with_patch_setting_mode_of_image_default.py deleted file mode 100644 index 643d8d456f7d..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_linux_vm_with_patch_setting_mode_of_image_default.py +++ /dev/null @@ -1,77 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_create_linux_vm_with_patch_setting_mode_of_image_default.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.virtual_machines.begin_create_or_update( - resource_group_name="myResourceGroup", - vm_name="myVM", - parameters={ - "location": "westus", - "properties": { - "hardwareProfile": {"vmSize": "Standard_D2s_v3"}, - "networkProfile": { - "networkInterfaces": [ - { - "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}", - "properties": {"primary": True}, - } - ] - }, - "osProfile": { - "adminPassword": "{your-password}", - "adminUsername": "{your-username}", - "computerName": "myVM", - "linuxConfiguration": {"patchSettings": {"patchMode": "ImageDefault"}, "provisionVMAgent": True}, - }, - "storageProfile": { - "imageReference": { - "offer": "UbuntuServer", - "publisher": "Canonical", - "sku": "16.04-LTS", - "version": "latest", - }, - "osDisk": { - "caching": "ReadWrite", - "createOption": "FromImage", - "managedDisk": {"storageAccountType": "Premium_LRS"}, - "name": "myVMosdisk", - }, - }, - }, - }, - ).result() - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineExamples/VirtualMachine_Create_LinuxVmWithPatchSettingModeOfImageDefault.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_linux_vm_with_patch_setting_modes_of_automatic_by_platform.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_linux_vm_with_patch_setting_modes_of_automatic_by_platform.py deleted file mode 100644 index 9969c20c4e7d..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_linux_vm_with_patch_setting_modes_of_automatic_by_platform.py +++ /dev/null @@ -1,80 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_create_linux_vm_with_patch_setting_modes_of_automatic_by_platform.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.virtual_machines.begin_create_or_update( - resource_group_name="myResourceGroup", - vm_name="myVM", - parameters={ - "location": "westus", - "properties": { - "hardwareProfile": {"vmSize": "Standard_D2s_v3"}, - "networkProfile": { - "networkInterfaces": [ - { - "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}", - "properties": {"primary": True}, - } - ] - }, - "osProfile": { - "adminPassword": "{your-password}", - "adminUsername": "{your-username}", - "computerName": "myVM", - "linuxConfiguration": { - "patchSettings": {"assessmentMode": "AutomaticByPlatform", "patchMode": "AutomaticByPlatform"}, - "provisionVMAgent": True, - }, - }, - "storageProfile": { - "imageReference": { - "offer": "UbuntuServer", - "publisher": "Canonical", - "sku": "16.04-LTS", - "version": "latest", - }, - "osDisk": { - "caching": "ReadWrite", - "createOption": "FromImage", - "managedDisk": {"storageAccountType": "Premium_LRS"}, - "name": "myVMosdisk", - }, - }, - }, - }, - ).result() - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineExamples/VirtualMachine_Create_LinuxVmWithPatchSettingModesOfAutomaticByPlatform.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_platform_image_vm_with_unmanaged_os_and_data_disks.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_platform_image_vm_with_unmanaged_os_and_data_disks.py deleted file mode 100644 index a1db32247e50..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_platform_image_vm_with_unmanaged_os_and_data_disks.py +++ /dev/null @@ -1,96 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_create_platform_image_vm_with_unmanaged_os_and_data_disks.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.virtual_machines.begin_create_or_update( - resource_group_name="myResourceGroup", - vm_name="{vm-name}", - parameters={ - "location": "westus", - "properties": { - "hardwareProfile": {"vmSize": "Standard_D2_v2"}, - "networkProfile": { - "networkInterfaces": [ - { - "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}", - "properties": {"primary": True}, - } - ] - }, - "osProfile": { - "adminPassword": "{your-password}", - "adminUsername": "{your-username}", - "computerName": "myVM", - }, - "storageProfile": { - "dataDisks": [ - { - "createOption": "Empty", - "diskSizeGB": 1023, - "lun": 0, - "vhd": { - "uri": "http://{existing-storage-account-name}.blob.core.windows.net/{existing-container-name}/myDisk0.vhd" - }, - }, - { - "createOption": "Empty", - "diskSizeGB": 1023, - "lun": 1, - "vhd": { - "uri": "http://{existing-storage-account-name}.blob.core.windows.net/{existing-container-name}/myDisk1.vhd" - }, - }, - ], - "imageReference": { - "offer": "WindowsServer", - "publisher": "MicrosoftWindowsServer", - "sku": "2016-Datacenter", - "version": "latest", - }, - "osDisk": { - "caching": "ReadWrite", - "createOption": "FromImage", - "name": "myVMosdisk", - "vhd": { - "uri": "http://{existing-storage-account-name}.blob.core.windows.net/{existing-container-name}/myDisk.vhd" - }, - }, - }, - }, - }, - ).result() - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineExamples/VirtualMachine_Create_PlatformImageVmWithUnmanagedOsAndDataDisks.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_windows_vm_with_automatic_by_platform_settings.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_windows_vm_with_automatic_by_platform_settings.py deleted file mode 100644 index 5593de3e1c37..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_windows_vm_with_automatic_by_platform_settings.py +++ /dev/null @@ -1,88 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_create_windows_vm_with_automatic_by_platform_settings.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.virtual_machines.begin_create_or_update( - resource_group_name="myResourceGroup", - vm_name="myVM", - parameters={ - "location": "westus", - "properties": { - "hardwareProfile": {"vmSize": "Standard_D1_v2"}, - "networkProfile": { - "networkInterfaces": [ - { - "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}", - "properties": {"primary": True}, - } - ] - }, - "osProfile": { - "adminPassword": "{your-password}", - "adminUsername": "{your-username}", - "computerName": "myVM", - "windowsConfiguration": { - "enableAutomaticUpdates": True, - "patchSettings": { - "assessmentMode": "AutomaticByPlatform", - "automaticByPlatformSettings": { - "bypassPlatformSafetyChecksOnUserSchedule": False, - "rebootSetting": "Never", - }, - "patchMode": "AutomaticByPlatform", - }, - "provisionVMAgent": True, - }, - }, - "storageProfile": { - "imageReference": { - "offer": "WindowsServer", - "publisher": "MicrosoftWindowsServer", - "sku": "2016-Datacenter", - "version": "latest", - }, - "osDisk": { - "caching": "ReadWrite", - "createOption": "FromImage", - "managedDisk": {"storageAccountType": "Premium_LRS"}, - "name": "myVMosdisk", - }, - }, - }, - }, - ).result() - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineExamples/VirtualMachine_Create_WindowsVmWithAutomaticByPlatformSettings.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_windows_vm_with_patch_setting_assessment_mode_of_image_default.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_windows_vm_with_patch_setting_assessment_mode_of_image_default.py deleted file mode 100644 index 88dc841f5aa6..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_windows_vm_with_patch_setting_assessment_mode_of_image_default.py +++ /dev/null @@ -1,81 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_create_windows_vm_with_patch_setting_assessment_mode_of_image_default.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.virtual_machines.begin_create_or_update( - resource_group_name="myResourceGroup", - vm_name="myVM", - parameters={ - "location": "westus", - "properties": { - "hardwareProfile": {"vmSize": "Standard_D1_v2"}, - "networkProfile": { - "networkInterfaces": [ - { - "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}", - "properties": {"primary": True}, - } - ] - }, - "osProfile": { - "adminPassword": "{your-password}", - "adminUsername": "{your-username}", - "computerName": "myVM", - "windowsConfiguration": { - "enableAutomaticUpdates": True, - "patchSettings": {"assessmentMode": "ImageDefault"}, - "provisionVMAgent": True, - }, - }, - "storageProfile": { - "imageReference": { - "offer": "WindowsServer", - "publisher": "MicrosoftWindowsServer", - "sku": "2016-Datacenter", - "version": "latest", - }, - "osDisk": { - "caching": "ReadWrite", - "createOption": "FromImage", - "managedDisk": {"storageAccountType": "Premium_LRS"}, - "name": "myVMosdisk", - }, - }, - }, - }, - ).result() - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineExamples/VirtualMachine_Create_WindowsVmWithPatchSettingAssessmentModeOfImageDefault.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_windows_vm_with_patch_setting_mode_of_automatic_by_os.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_windows_vm_with_patch_setting_mode_of_automatic_by_os.py deleted file mode 100644 index 749d682df108..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_windows_vm_with_patch_setting_mode_of_automatic_by_os.py +++ /dev/null @@ -1,81 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_create_windows_vm_with_patch_setting_mode_of_automatic_by_os.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.virtual_machines.begin_create_or_update( - resource_group_name="myResourceGroup", - vm_name="myVM", - parameters={ - "location": "westus", - "properties": { - "hardwareProfile": {"vmSize": "Standard_D1_v2"}, - "networkProfile": { - "networkInterfaces": [ - { - "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/nsgExistingNic", - "properties": {"primary": True}, - } - ] - }, - "osProfile": { - "adminPassword": "{your-password}", - "adminUsername": "{your-username}", - "computerName": "myVM", - "windowsConfiguration": { - "enableAutomaticUpdates": True, - "patchSettings": {"patchMode": "AutomaticByOS"}, - "provisionVMAgent": True, - }, - }, - "storageProfile": { - "imageReference": { - "offer": "WindowsServer", - "publisher": "MicrosoftWindowsServer", - "sku": "2016-Datacenter", - "version": "latest", - }, - "osDisk": { - "caching": "ReadWrite", - "createOption": "FromImage", - "managedDisk": {"storageAccountType": "Premium_LRS"}, - "name": "myVMosdisk", - }, - }, - }, - }, - ).result() - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineExamples/VirtualMachine_Create_WindowsVmWithPatchSettingModeOfAutomaticByOS.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_windows_vm_with_patch_setting_mode_of_automatic_by_platform_and_enable_hot_patching_true.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_windows_vm_with_patch_setting_mode_of_automatic_by_platform_and_enable_hot_patching_true.py deleted file mode 100644 index 539df7e63695..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_windows_vm_with_patch_setting_mode_of_automatic_by_platform_and_enable_hot_patching_true.py +++ /dev/null @@ -1,81 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_create_windows_vm_with_patch_setting_mode_of_automatic_by_platform_and_enable_hot_patching_true.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.virtual_machines.begin_create_or_update( - resource_group_name="myResourceGroup", - vm_name="myVM", - parameters={ - "location": "westus", - "properties": { - "hardwareProfile": {"vmSize": "Standard_D1_v2"}, - "networkProfile": { - "networkInterfaces": [ - { - "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}", - "properties": {"primary": True}, - } - ] - }, - "osProfile": { - "adminPassword": "{your-password}", - "adminUsername": "{your-username}", - "computerName": "myVM", - "windowsConfiguration": { - "enableAutomaticUpdates": True, - "patchSettings": {"enableHotpatching": True, "patchMode": "AutomaticByPlatform"}, - "provisionVMAgent": True, - }, - }, - "storageProfile": { - "imageReference": { - "offer": "WindowsServer", - "publisher": "MicrosoftWindowsServer", - "sku": "2016-Datacenter", - "version": "latest", - }, - "osDisk": { - "caching": "ReadWrite", - "createOption": "FromImage", - "managedDisk": {"storageAccountType": "Premium_LRS"}, - "name": "myVMosdisk", - }, - }, - }, - }, - ).result() - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineExamples/VirtualMachine_Create_WindowsVmWithPatchSettingModeOfAutomaticByPlatformAndEnableHotPatchingTrue.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_windows_vm_with_patch_setting_mode_of_manual.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_windows_vm_with_patch_setting_mode_of_manual.py deleted file mode 100644 index e8244890c51a..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_windows_vm_with_patch_setting_mode_of_manual.py +++ /dev/null @@ -1,81 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_create_windows_vm_with_patch_setting_mode_of_manual.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.virtual_machines.begin_create_or_update( - resource_group_name="myResourceGroup", - vm_name="myVM", - parameters={ - "location": "westus", - "properties": { - "hardwareProfile": {"vmSize": "Standard_D1_v2"}, - "networkProfile": { - "networkInterfaces": [ - { - "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}", - "properties": {"primary": True}, - } - ] - }, - "osProfile": { - "adminPassword": "{your-password}", - "adminUsername": "{your-username}", - "computerName": "myVM", - "windowsConfiguration": { - "enableAutomaticUpdates": True, - "patchSettings": {"patchMode": "Manual"}, - "provisionVMAgent": True, - }, - }, - "storageProfile": { - "imageReference": { - "offer": "WindowsServer", - "publisher": "MicrosoftWindowsServer", - "sku": "2016-Datacenter", - "version": "latest", - }, - "osDisk": { - "caching": "ReadWrite", - "createOption": "FromImage", - "managedDisk": {"storageAccountType": "Premium_LRS"}, - "name": "myVMosdisk", - }, - }, - }, - }, - ).result() - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineExamples/VirtualMachine_Create_WindowsVmWithPatchSettingModeOfManual.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_windows_vm_with_patch_setting_modes_of_automatic_by_platform.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_windows_vm_with_patch_setting_modes_of_automatic_by_platform.py deleted file mode 100644 index d1d7c82a5f9e..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_windows_vm_with_patch_setting_modes_of_automatic_by_platform.py +++ /dev/null @@ -1,81 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_create_windows_vm_with_patch_setting_modes_of_automatic_by_platform.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.virtual_machines.begin_create_or_update( - resource_group_name="myResourceGroup", - vm_name="myVM", - parameters={ - "location": "westus", - "properties": { - "hardwareProfile": {"vmSize": "Standard_D1_v2"}, - "networkProfile": { - "networkInterfaces": [ - { - "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}", - "properties": {"primary": True}, - } - ] - }, - "osProfile": { - "adminPassword": "{your-password}", - "adminUsername": "{your-username}", - "computerName": "myVM", - "windowsConfiguration": { - "enableAutomaticUpdates": True, - "patchSettings": {"assessmentMode": "AutomaticByPlatform", "patchMode": "AutomaticByPlatform"}, - "provisionVMAgent": True, - }, - }, - "storageProfile": { - "imageReference": { - "offer": "WindowsServer", - "publisher": "MicrosoftWindowsServer", - "sku": "2016-Datacenter", - "version": "latest", - }, - "osDisk": { - "caching": "ReadWrite", - "createOption": "FromImage", - "managedDisk": {"storageAccountType": "Premium_LRS"}, - "name": "myVMosdisk", - }, - }, - }, - }, - ).result() - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineExamples/VirtualMachine_Create_WindowsVmWithPatchSettingModesOfAutomaticByPlatform.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_with_adiff_os_disk.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_with_adiff_os_disk.py deleted file mode 100644 index e32ff3d6de6d..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_with_adiff_os_disk.py +++ /dev/null @@ -1,78 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_create_with_adiff_os_disk.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.virtual_machines.begin_create_or_update( - resource_group_name="myResourceGroup", - vm_name="myVM", - parameters={ - "location": "westus", - "plan": {"name": "windows2016", "product": "windows-data-science-vm", "publisher": "microsoft-ads"}, - "properties": { - "hardwareProfile": {"vmSize": "Standard_DS1_v2"}, - "networkProfile": { - "networkInterfaces": [ - { - "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}", - "properties": {"primary": True}, - } - ] - }, - "osProfile": { - "adminPassword": "{your-password}", - "adminUsername": "{your-username}", - "computerName": "myVM", - }, - "storageProfile": { - "imageReference": { - "offer": "windows-data-science-vm", - "publisher": "microsoft-ads", - "sku": "windows2016", - "version": "latest", - }, - "osDisk": { - "caching": "ReadOnly", - "createOption": "FromImage", - "diffDiskSettings": {"option": "Local"}, - "managedDisk": {"storageAccountType": "Standard_LRS"}, - "name": "myVMosdisk", - }, - }, - }, - }, - ).result() - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineExamples/VirtualMachine_Create_WithADiffOsDisk.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_with_adiff_os_disk_using_diff_disk_placement_as_cache_disk.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_with_adiff_os_disk_using_diff_disk_placement_as_cache_disk.py deleted file mode 100644 index c60208611503..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_with_adiff_os_disk_using_diff_disk_placement_as_cache_disk.py +++ /dev/null @@ -1,78 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_create_with_adiff_os_disk_using_diff_disk_placement_as_cache_disk.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.virtual_machines.begin_create_or_update( - resource_group_name="myResourceGroup", - vm_name="myVM", - parameters={ - "location": "westus", - "plan": {"name": "windows2016", "product": "windows-data-science-vm", "publisher": "microsoft-ads"}, - "properties": { - "hardwareProfile": {"vmSize": "Standard_DS1_v2"}, - "networkProfile": { - "networkInterfaces": [ - { - "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}", - "properties": {"primary": True}, - } - ] - }, - "osProfile": { - "adminPassword": "{your-password}", - "adminUsername": "{your-username}", - "computerName": "myVM", - }, - "storageProfile": { - "imageReference": { - "offer": "windows-data-science-vm", - "publisher": "microsoft-ads", - "sku": "windows2016", - "version": "latest", - }, - "osDisk": { - "caching": "ReadOnly", - "createOption": "FromImage", - "diffDiskSettings": {"option": "Local", "placement": "CacheDisk"}, - "managedDisk": {"storageAccountType": "Standard_LRS"}, - "name": "myVMosdisk", - }, - }, - }, - }, - ).result() - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineExamples/VirtualMachine_Create_WithADiffOsDiskUsingDiffDiskPlacementAsCacheDisk.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_with_adiff_os_disk_using_diff_disk_placement_as_nvme_disk.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_with_adiff_os_disk_using_diff_disk_placement_as_nvme_disk.py deleted file mode 100644 index 6ecb27d2ccf0..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_with_adiff_os_disk_using_diff_disk_placement_as_nvme_disk.py +++ /dev/null @@ -1,78 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_create_with_adiff_os_disk_using_diff_disk_placement_as_nvme_disk.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.virtual_machines.begin_create_or_update( - resource_group_name="myResourceGroup", - vm_name="myVM", - parameters={ - "location": "westus", - "plan": {"name": "windows2016", "product": "windows-data-science-vm", "publisher": "microsoft-ads"}, - "properties": { - "hardwareProfile": {"vmSize": "Standard_DS1_v2"}, - "networkProfile": { - "networkInterfaces": [ - { - "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}", - "properties": {"primary": True}, - } - ] - }, - "osProfile": { - "adminPassword": "{your-password}", - "adminUsername": "{your-username}", - "computerName": "myVM", - }, - "storageProfile": { - "imageReference": { - "offer": "windows-data-science-vm", - "publisher": "microsoft-ads", - "sku": "windows2016", - "version": "latest", - }, - "osDisk": { - "caching": "ReadOnly", - "createOption": "FromImage", - "diffDiskSettings": {"option": "Local", "placement": "NvmeDisk"}, - "managedDisk": {"storageAccountType": "Standard_LRS"}, - "name": "myVMosdisk", - }, - }, - }, - }, - ).result() - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineExamples/VirtualMachine_Create_WithADiffOsDiskUsingDiffDiskPlacementAsNvmeDisk.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_with_adiff_os_disk_using_diff_disk_placement_as_resource_disk.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_with_adiff_os_disk_using_diff_disk_placement_as_resource_disk.py deleted file mode 100644 index fbc6f3ff0241..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_with_adiff_os_disk_using_diff_disk_placement_as_resource_disk.py +++ /dev/null @@ -1,78 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_create_with_adiff_os_disk_using_diff_disk_placement_as_resource_disk.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.virtual_machines.begin_create_or_update( - resource_group_name="myResourceGroup", - vm_name="myVM", - parameters={ - "location": "westus", - "plan": {"name": "windows2016", "product": "windows-data-science-vm", "publisher": "microsoft-ads"}, - "properties": { - "hardwareProfile": {"vmSize": "Standard_DS1_v2"}, - "networkProfile": { - "networkInterfaces": [ - { - "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}", - "properties": {"primary": True}, - } - ] - }, - "osProfile": { - "adminPassword": "{your-password}", - "adminUsername": "{your-username}", - "computerName": "myVM", - }, - "storageProfile": { - "imageReference": { - "offer": "windows-data-science-vm", - "publisher": "microsoft-ads", - "sku": "windows2016", - "version": "latest", - }, - "osDisk": { - "caching": "ReadOnly", - "createOption": "FromImage", - "diffDiskSettings": {"option": "Local", "placement": "ResourceDisk"}, - "managedDisk": {"storageAccountType": "Standard_LRS"}, - "name": "myVMosdisk", - }, - }, - }, - }, - ).result() - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineExamples/VirtualMachine_Create_WithADiffOsDiskUsingDiffDiskPlacementAsResourceDisk.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_with_amarketplace_image_plan.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_with_amarketplace_image_plan.py deleted file mode 100644 index 2aa61bf7bb13..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_with_amarketplace_image_plan.py +++ /dev/null @@ -1,77 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_create_with_amarketplace_image_plan.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.virtual_machines.begin_create_or_update( - resource_group_name="myResourceGroup", - vm_name="myVM", - parameters={ - "location": "westus", - "plan": {"name": "windows2016", "product": "windows-data-science-vm", "publisher": "microsoft-ads"}, - "properties": { - "hardwareProfile": {"vmSize": "Standard_D1_v2"}, - "networkProfile": { - "networkInterfaces": [ - { - "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}", - "properties": {"primary": True}, - } - ] - }, - "osProfile": { - "adminPassword": "{your-password}", - "adminUsername": "{your-username}", - "computerName": "myVM", - }, - "storageProfile": { - "imageReference": { - "offer": "windows-data-science-vm", - "publisher": "microsoft-ads", - "sku": "windows2016", - "version": "latest", - }, - "osDisk": { - "caching": "ReadWrite", - "createOption": "FromImage", - "managedDisk": {"storageAccountType": "Standard_LRS"}, - "name": "myVMosdisk", - }, - }, - }, - }, - ).result() - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineExamples/VirtualMachine_Create_WithAMarketplaceImagePlan.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_with_application_profile.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_with_application_profile.py deleted file mode 100644 index 510baa56899d..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_with_application_profile.py +++ /dev/null @@ -1,91 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_create_with_application_profile.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.virtual_machines.begin_create_or_update( - resource_group_name="myResourceGroup", - vm_name="myVM", - parameters={ - "location": "westus", - "properties": { - "applicationProfile": { - "galleryApplications": [ - { - "configurationReference": "https://mystorageaccount.blob.core.windows.net/configurations/settings.config", - "enableAutomaticUpgrade": False, - "order": 1, - "packageReferenceId": "/subscriptions/32c17a9e-aa7b-4ba5-a45b-e324116b6fdb/resourceGroups/myresourceGroupName2/providers/Microsoft.Compute/galleries/myGallery1/applications/MyApplication1/versions/1.0", - "tags": "myTag1", - "treatFailureAsDeploymentFailure": False, - }, - { - "packageReferenceId": "/subscriptions/32c17a9e-aa7b-4ba5-a45b-e324116b6fdg/resourceGroups/myresourceGroupName3/providers/Microsoft.Compute/galleries/myGallery2/applications/MyApplication2/versions/1.1" - }, - ] - }, - "hardwareProfile": {"vmSize": "Standard_D1_v2"}, - "networkProfile": { - "networkInterfaces": [ - { - "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}", - "properties": {"primary": True}, - } - ] - }, - "osProfile": { - "adminPassword": "{your-password}", - "adminUsername": "{your-username}", - "computerName": "myVM", - }, - "storageProfile": { - "imageReference": { - "offer": "{image_offer}", - "publisher": "{image_publisher}", - "sku": "{image_sku}", - "version": "latest", - }, - "osDisk": { - "caching": "ReadWrite", - "createOption": "FromImage", - "managedDisk": {"storageAccountType": "Standard_LRS"}, - "name": "myVMosdisk", - }, - }, - }, - }, - ).result() - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineExamples/VirtualMachine_Create_WithApplicationProfile.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_with_boot_diagnostics.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_with_boot_diagnostics.py deleted file mode 100644 index 762b83f832c7..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_with_boot_diagnostics.py +++ /dev/null @@ -1,82 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_create_with_boot_diagnostics.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.virtual_machines.begin_create_or_update( - resource_group_name="myResourceGroup", - vm_name="myVM", - parameters={ - "location": "westus", - "properties": { - "diagnosticsProfile": { - "bootDiagnostics": { - "enabled": True, - "storageUri": "http://{existing-storage-account-name}.blob.core.windows.net", - } - }, - "hardwareProfile": {"vmSize": "Standard_D1_v2"}, - "networkProfile": { - "networkInterfaces": [ - { - "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}", - "properties": {"primary": True}, - } - ] - }, - "osProfile": { - "adminPassword": "{your-password}", - "adminUsername": "{your-username}", - "computerName": "myVM", - }, - "storageProfile": { - "imageReference": { - "offer": "WindowsServer", - "publisher": "MicrosoftWindowsServer", - "sku": "2016-Datacenter", - "version": "latest", - }, - "osDisk": { - "caching": "ReadWrite", - "createOption": "FromImage", - "managedDisk": {"storageAccountType": "Standard_LRS"}, - "name": "myVMosdisk", - }, - }, - }, - }, - ).result() - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineExamples/VirtualMachine_Create_WithBootDiagnostics.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_with_capacity_reservation.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_with_capacity_reservation.py deleted file mode 100644 index e18f3d6f3313..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_with_capacity_reservation.py +++ /dev/null @@ -1,82 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_create_with_capacity_reservation.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.virtual_machines.begin_create_or_update( - resource_group_name="myResourceGroup", - vm_name="myVM", - parameters={ - "location": "westus", - "plan": {"name": "windows2016", "product": "windows-data-science-vm", "publisher": "microsoft-ads"}, - "properties": { - "capacityReservation": { - "capacityReservationGroup": { - "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/CapacityReservationGroups/{crgName}" - } - }, - "hardwareProfile": {"vmSize": "Standard_DS1_v2"}, - "networkProfile": { - "networkInterfaces": [ - { - "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}", - "properties": {"primary": True}, - } - ] - }, - "osProfile": { - "adminPassword": "{your-password}", - "adminUsername": "{your-username}", - "computerName": "myVM", - }, - "storageProfile": { - "imageReference": { - "offer": "windows-data-science-vm", - "publisher": "microsoft-ads", - "sku": "windows2016", - "version": "latest", - }, - "osDisk": { - "caching": "ReadOnly", - "createOption": "FromImage", - "managedDisk": {"storageAccountType": "Standard_LRS"}, - "name": "myVMosdisk", - }, - }, - }, - }, - ).result() - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineExamples/VirtualMachine_Create_WithCapacityReservation.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_with_data_disks_from_source_resource.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_with_data_disks_from_source_resource.py deleted file mode 100644 index 3343834b2385..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_with_data_disks_from_source_resource.py +++ /dev/null @@ -1,102 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_create_with_data_disks_from_source_resource.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.virtual_machines.begin_create_or_update( - resource_group_name="myResourceGroup", - vm_name="myVM", - parameters={ - "location": "westus", - "properties": { - "hardwareProfile": {"vmSize": "Standard_D2_v2"}, - "networkProfile": { - "networkInterfaces": [ - { - "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}", - "properties": {"primary": True}, - } - ] - }, - "osProfile": { - "adminPassword": "{your-password}", - "adminUsername": "{your-username}", - "computerName": "myVM", - }, - "storageProfile": { - "dataDisks": [ - { - "createOption": "Copy", - "diskSizeGB": 1023, - "lun": 0, - "sourceResource": { - "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/{existing-snapshot-name}" - }, - }, - { - "createOption": "Copy", - "diskSizeGB": 1023, - "lun": 1, - "sourceResource": { - "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/{existing-disk-name}" - }, - }, - { - "createOption": "Restore", - "diskSizeGB": 1023, - "lun": 2, - "sourceResource": { - "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/restorePointCollections/{existing-rpc-name}/restorePoints/{existing-rp-name}/diskRestorePoints/{existing-disk-restore-point-name}" - }, - }, - ], - "imageReference": { - "offer": "WindowsServer", - "publisher": "MicrosoftWindowsServer", - "sku": "2016-Datacenter", - "version": "latest", - }, - "osDisk": { - "caching": "ReadWrite", - "createOption": "FromImage", - "managedDisk": {"storageAccountType": "Standard_LRS"}, - "name": "myVMosdisk", - }, - }, - }, - }, - ).result() - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineExamples/VirtualMachine_Create_WithDataDisksFromSourceResource.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_with_disk_controller_type.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_with_disk_controller_type.py deleted file mode 100644 index 53960a17567a..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_with_disk_controller_type.py +++ /dev/null @@ -1,92 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_create_with_disk_controller_type.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.virtual_machines.begin_create_or_update( - resource_group_name="myResourceGroup", - vm_name="myVM", - parameters={ - "location": "westus", - "properties": { - "diagnosticsProfile": { - "bootDiagnostics": { - "enabled": True, - "storageUri": "http://{existing-storage-account-name}.blob.core.windows.net", - } - }, - "hardwareProfile": {"vmSize": "Standard_D4_v3"}, - "networkProfile": { - "networkInterfaces": [ - { - "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}", - "properties": {"primary": True}, - } - ] - }, - "osProfile": { - "adminPassword": "{your-password}", - "adminUsername": "{your-username}", - "computerName": "myVM", - }, - "scheduledEventsPolicy": { - "allInstancesDown": {"automaticallyApprove": True}, - "scheduledEventsAdditionalPublishingTargets": { - "eventGridAndResourceGraph": {"enable": True, "scheduledEventsApiVersion": "2020-07-01"} - }, - "userInitiatedReboot": {"automaticallyApprove": True}, - "userInitiatedRedeploy": {"automaticallyApprove": True}, - }, - "storageProfile": { - "diskControllerType": "NVMe", - "imageReference": { - "offer": "WindowsServer", - "publisher": "MicrosoftWindowsServer", - "sku": "2016-Datacenter", - "version": "latest", - }, - "osDisk": { - "caching": "ReadWrite", - "createOption": "FromImage", - "managedDisk": {"storageAccountType": "Standard_LRS"}, - "name": "myVMosdisk", - }, - }, - "userData": "U29tZSBDdXN0b20gRGF0YQ==", - }, - }, - ).result() - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineExamples/VirtualMachine_Create_WithDiskControllerType.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_with_disk_encryption_set_resource.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_with_disk_encryption_set_resource.py deleted file mode 100644 index 6cbcaa455e25..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_with_disk_encryption_set_resource.py +++ /dev/null @@ -1,105 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_create_with_disk_encryption_set_resource.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.virtual_machines.begin_create_or_update( - resource_group_name="myResourceGroup", - vm_name="myVM", - parameters={ - "location": "westus", - "properties": { - "hardwareProfile": {"vmSize": "Standard_D1_v2"}, - "networkProfile": { - "networkInterfaces": [ - { - "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}", - "properties": {"primary": True}, - } - ] - }, - "osProfile": { - "adminPassword": "{your-password}", - "adminUsername": "{your-username}", - "computerName": "myVM", - }, - "storageProfile": { - "dataDisks": [ - { - "caching": "ReadWrite", - "createOption": "Empty", - "diskSizeGB": 1023, - "lun": 0, - "managedDisk": { - "diskEncryptionSet": { - "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSets/{existing-diskEncryptionSet-name}" - }, - "storageAccountType": "Standard_LRS", - }, - }, - { - "caching": "ReadWrite", - "createOption": "Attach", - "diskSizeGB": 1023, - "lun": 1, - "managedDisk": { - "diskEncryptionSet": { - "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSets/{existing-diskEncryptionSet-name}" - }, - "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/{existing-managed-disk-name}", - "storageAccountType": "Standard_LRS", - }, - }, - ], - "imageReference": { - "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/images/{existing-custom-image-name}" - }, - "osDisk": { - "caching": "ReadWrite", - "createOption": "FromImage", - "managedDisk": { - "diskEncryptionSet": { - "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSets/{existing-diskEncryptionSet-name}" - }, - "storageAccountType": "Standard_LRS", - }, - "name": "myVMosdisk", - }, - }, - }, - }, - ).result() - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineExamples/VirtualMachine_Create_WithDiskEncryptionSetResource.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_with_empty_data_disks.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_with_empty_data_disks.py deleted file mode 100644 index 823c81281096..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_with_empty_data_disks.py +++ /dev/null @@ -1,80 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_create_with_empty_data_disks.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.virtual_machines.begin_create_or_update( - resource_group_name="myResourceGroup", - vm_name="myVM", - parameters={ - "location": "westus", - "properties": { - "hardwareProfile": {"vmSize": "Standard_D2_v2"}, - "networkProfile": { - "networkInterfaces": [ - { - "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}", - "properties": {"primary": True}, - } - ] - }, - "osProfile": { - "adminPassword": "{your-password}", - "adminUsername": "{your-username}", - "computerName": "myVM", - }, - "storageProfile": { - "dataDisks": [ - {"createOption": "Empty", "diskSizeGB": 1023, "lun": 0}, - {"createOption": "Empty", "diskSizeGB": 1023, "lun": 1}, - ], - "imageReference": { - "offer": "WindowsServer", - "publisher": "MicrosoftWindowsServer", - "sku": "2016-Datacenter", - "version": "latest", - }, - "osDisk": { - "caching": "ReadWrite", - "createOption": "FromImage", - "managedDisk": {"storageAccountType": "Standard_LRS"}, - "name": "myVMosdisk", - }, - }, - }, - }, - ).result() - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineExamples/VirtualMachine_Create_WithEmptyDataDisks.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_with_encryption_at_host.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_with_encryption_at_host.py deleted file mode 100644 index e4329fbd6896..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_with_encryption_at_host.py +++ /dev/null @@ -1,78 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_create_with_encryption_at_host.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.virtual_machines.begin_create_or_update( - resource_group_name="myResourceGroup", - vm_name="myVM", - parameters={ - "location": "westus", - "plan": {"name": "windows2016", "product": "windows-data-science-vm", "publisher": "microsoft-ads"}, - "properties": { - "hardwareProfile": {"vmSize": "Standard_DS1_v2"}, - "networkProfile": { - "networkInterfaces": [ - { - "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}", - "properties": {"primary": True}, - } - ] - }, - "osProfile": { - "adminPassword": "{your-password}", - "adminUsername": "{your-username}", - "computerName": "myVM", - }, - "securityProfile": {"encryptionAtHost": True}, - "storageProfile": { - "imageReference": { - "offer": "windows-data-science-vm", - "publisher": "microsoft-ads", - "sku": "windows2016", - "version": "latest", - }, - "osDisk": { - "caching": "ReadOnly", - "createOption": "FromImage", - "managedDisk": {"storageAccountType": "Standard_LRS"}, - "name": "myVMosdisk", - }, - }, - }, - }, - ).result() - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineExamples/VirtualMachine_Create_WithEncryptionAtHost.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_with_encryption_identity.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_with_encryption_identity.py deleted file mode 100644 index 58099f34eaf1..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_with_encryption_identity.py +++ /dev/null @@ -1,87 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_create_with_encryption_identity.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.virtual_machines.begin_create_or_update( - resource_group_name="myResourceGroup", - vm_name="myVM", - parameters={ - "identity": { - "type": "UserAssigned", - "userAssignedIdentities": { - "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/myIdentity": {} - }, - }, - "location": "westus", - "properties": { - "hardwareProfile": {"vmSize": "Standard_D2s_v3"}, - "networkProfile": { - "networkInterfaces": [ - { - "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}", - "properties": {"primary": True}, - } - ] - }, - "osProfile": { - "adminPassword": "{your-password}", - "adminUsername": "{your-username}", - "computerName": "myVM", - }, - "securityProfile": { - "encryptionIdentity": { - "userAssignedIdentityResourceId": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/myIdentity" - } - }, - "storageProfile": { - "imageReference": { - "offer": "WindowsServer", - "publisher": "MicrosoftWindowsServer", - "sku": "2019-Datacenter", - "version": "latest", - }, - "osDisk": { - "caching": "ReadOnly", - "createOption": "FromImage", - "managedDisk": {"storageAccountType": "StandardSSD_LRS"}, - "name": "myVMosdisk", - }, - }, - }, - }, - ).result() - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineExamples/VirtualMachine_Create_WithEncryptionIdentity.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_with_extensions_time_budget.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_with_extensions_time_budget.py deleted file mode 100644 index 166dadae6af8..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_with_extensions_time_budget.py +++ /dev/null @@ -1,83 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_create_with_extensions_time_budget.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.virtual_machines.begin_create_or_update( - resource_group_name="myResourceGroup", - vm_name="myVM", - parameters={ - "location": "westus", - "properties": { - "diagnosticsProfile": { - "bootDiagnostics": { - "enabled": True, - "storageUri": "http://{existing-storage-account-name}.blob.core.windows.net", - } - }, - "extensionsTimeBudget": "PT30M", - "hardwareProfile": {"vmSize": "Standard_D1_v2"}, - "networkProfile": { - "networkInterfaces": [ - { - "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}", - "properties": {"primary": True}, - } - ] - }, - "osProfile": { - "adminPassword": "{your-password}", - "adminUsername": "{your-username}", - "computerName": "myVM", - }, - "storageProfile": { - "imageReference": { - "offer": "WindowsServer", - "publisher": "MicrosoftWindowsServer", - "sku": "2016-Datacenter", - "version": "latest", - }, - "osDisk": { - "caching": "ReadWrite", - "createOption": "FromImage", - "managedDisk": {"storageAccountType": "Standard_LRS"}, - "name": "myVMosdisk", - }, - }, - }, - }, - ).result() - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineExamples/VirtualMachine_Create_WithExtensionsTimeBudget.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_with_hibernation_enabled.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_with_hibernation_enabled.py deleted file mode 100644 index b55f3dbb41a4..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_with_hibernation_enabled.py +++ /dev/null @@ -1,83 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_create_with_hibernation_enabled.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.virtual_machines.begin_create_or_update( - resource_group_name="myResourceGroup", - vm_name="{vm-name}", - parameters={ - "location": "eastus2euap", - "properties": { - "additionalCapabilities": {"hibernationEnabled": True}, - "diagnosticsProfile": { - "bootDiagnostics": { - "enabled": True, - "storageUri": "http://{existing-storage-account-name}.blob.core.windows.net", - } - }, - "hardwareProfile": {"vmSize": "Standard_D2s_v3"}, - "networkProfile": { - "networkInterfaces": [ - { - "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}", - "properties": {"primary": True}, - } - ] - }, - "osProfile": { - "adminPassword": "{your-password}", - "adminUsername": "{your-username}", - "computerName": "{vm-name}", - }, - "storageProfile": { - "imageReference": { - "offer": "WindowsServer", - "publisher": "MicrosoftWindowsServer", - "sku": "2019-Datacenter", - "version": "latest", - }, - "osDisk": { - "caching": "ReadWrite", - "createOption": "FromImage", - "managedDisk": {"storageAccountType": "Standard_LRS"}, - "name": "vmOSdisk", - }, - }, - }, - }, - ).result() - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineExamples/VirtualMachine_Create_WithHibernationEnabled.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_with_managed_boot_diagnostics.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_with_managed_boot_diagnostics.py deleted file mode 100644 index 1bfa7774af51..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_with_managed_boot_diagnostics.py +++ /dev/null @@ -1,77 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_create_with_managed_boot_diagnostics.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.virtual_machines.begin_create_or_update( - resource_group_name="myResourceGroup", - vm_name="myVM", - parameters={ - "location": "westus", - "properties": { - "diagnosticsProfile": {"bootDiagnostics": {"enabled": True}}, - "hardwareProfile": {"vmSize": "Standard_D1_v2"}, - "networkProfile": { - "networkInterfaces": [ - { - "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}", - "properties": {"primary": True}, - } - ] - }, - "osProfile": { - "adminPassword": "{your-password}", - "adminUsername": "{your-username}", - "computerName": "myVM", - }, - "storageProfile": { - "imageReference": { - "offer": "WindowsServer", - "publisher": "MicrosoftWindowsServer", - "sku": "2016-Datacenter", - "version": "latest", - }, - "osDisk": { - "caching": "ReadWrite", - "createOption": "FromImage", - "managedDisk": {"storageAccountType": "Standard_LRS"}, - "name": "myVMosdisk", - }, - }, - }, - }, - ).result() - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineExamples/VirtualMachine_Create_WithManagedBootDiagnostics.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_with_network_interface_configuration.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_with_network_interface_configuration.py deleted file mode 100644 index 9a086ad689c9..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_with_network_interface_configuration.py +++ /dev/null @@ -1,98 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_create_with_network_interface_configuration.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.virtual_machines.begin_create_or_update( - resource_group_name="myResourceGroup", - vm_name="myVM", - parameters={ - "location": "westus", - "properties": { - "hardwareProfile": {"vmSize": "Standard_D1_v2"}, - "networkProfile": { - "networkApiVersion": "2020-11-01", - "networkInterfaceConfigurations": [ - { - "name": "{nic-config-name}", - "properties": { - "deleteOption": "Delete", - "ipConfigurations": [ - { - "name": "{ip-config-name}", - "properties": { - "primary": True, - "publicIPAddressConfiguration": { - "name": "{publicIP-config-name}", - "properties": { - "deleteOption": "Detach", - "publicIPAllocationMethod": "Static", - }, - "sku": {"name": "Basic", "tier": "Global"}, - "tags": {"pipTag": "tag"}, - }, - }, - } - ], - "primary": True, - }, - "tags": {"nicTag": "tag"}, - } - ], - }, - "osProfile": { - "adminPassword": "{your-password}", - "adminUsername": "{your-username}", - "computerName": "myVM", - }, - "storageProfile": { - "imageReference": { - "offer": "WindowsServer", - "publisher": "MicrosoftWindowsServer", - "sku": "2016-Datacenter", - "version": "latest", - }, - "osDisk": { - "caching": "ReadWrite", - "createOption": "FromImage", - "managedDisk": {"storageAccountType": "Standard_LRS"}, - "name": "myVMosdisk", - }, - }, - }, - }, - ).result() - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineExamples/VirtualMachine_Create_WithNetworkInterfaceConfiguration.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_with_network_interface_configuration_dns_settings.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_with_network_interface_configuration_dns_settings.py deleted file mode 100644 index 519ef599da25..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_with_network_interface_configuration_dns_settings.py +++ /dev/null @@ -1,100 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_create_with_network_interface_configuration_dns_settings.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.virtual_machines.begin_create_or_update( - resource_group_name="myResourceGroup", - vm_name="myVM", - parameters={ - "location": "westus", - "properties": { - "hardwareProfile": {"vmSize": "Standard_D1_v2"}, - "networkProfile": { - "networkApiVersion": "2020-11-01", - "networkInterfaceConfigurations": [ - { - "name": "{nic-config-name}", - "properties": { - "deleteOption": "Delete", - "ipConfigurations": [ - { - "name": "{ip-config-name}", - "properties": { - "primary": True, - "publicIPAddressConfiguration": { - "name": "{publicIP-config-name}", - "properties": { - "deleteOption": "Detach", - "dnsSettings": { - "domainNameLabel": "aaaaa", - "domainNameLabelScope": "TenantReuse", - }, - "publicIPAllocationMethod": "Static", - }, - "sku": {"name": "Basic", "tier": "Global"}, - }, - }, - } - ], - "primary": True, - }, - } - ], - }, - "osProfile": { - "adminPassword": "{your-password}", - "adminUsername": "{your-username}", - "computerName": "myVM", - }, - "storageProfile": { - "imageReference": { - "offer": "WindowsServer", - "publisher": "MicrosoftWindowsServer", - "sku": "2016-Datacenter", - "version": "latest", - }, - "osDisk": { - "caching": "ReadWrite", - "createOption": "FromImage", - "managedDisk": {"storageAccountType": "Standard_LRS"}, - "name": "myVMosdisk", - }, - }, - }, - }, - ).result() - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineExamples/VirtualMachine_Create_WithNetworkInterfaceConfigurationDnsSettings.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_with_password_authentication.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_with_password_authentication.py deleted file mode 100644 index 975b41110322..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_with_password_authentication.py +++ /dev/null @@ -1,76 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_create_with_password_authentication.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.virtual_machines.begin_create_or_update( - resource_group_name="myResourceGroup", - vm_name="myVM", - parameters={ - "location": "westus", - "properties": { - "hardwareProfile": {"vmSize": "Standard_D1_v2"}, - "networkProfile": { - "networkInterfaces": [ - { - "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}", - "properties": {"primary": True}, - } - ] - }, - "osProfile": { - "adminPassword": "{your-password}", - "adminUsername": "{your-username}", - "computerName": "myVM", - }, - "storageProfile": { - "imageReference": { - "offer": "WindowsServer", - "publisher": "MicrosoftWindowsServer", - "sku": "2016-Datacenter", - "version": "latest", - }, - "osDisk": { - "caching": "ReadWrite", - "createOption": "FromImage", - "managedDisk": {"storageAccountType": "Standard_LRS"}, - "name": "myVMosdisk", - }, - }, - }, - }, - ).result() - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineExamples/VirtualMachine_Create_WithPasswordAuthentication.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_with_placement.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_with_placement.py deleted file mode 100644 index af77639e7f9e..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_with_placement.py +++ /dev/null @@ -1,78 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_create_with_placement.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.virtual_machines.begin_create_or_update( - resource_group_name="myResourceGroup", - vm_name="myVM", - parameters={ - "location": "westus2", - "placement": {"includeZones": ["1", "3"], "zonePlacementPolicy": "Any"}, - "plan": {"name": "windows2016", "product": "windows-data-science-vm", "publisher": "microsoft-ads"}, - "properties": { - "hardwareProfile": {"vmSize": "Standard_DS1_v2"}, - "networkProfile": { - "networkInterfaces": [ - { - "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}", - "properties": {"primary": True}, - } - ] - }, - "osProfile": { - "adminPassword": "{your-password}", - "adminUsername": "{your-username}", - "computerName": "myVM", - }, - "storageProfile": { - "imageReference": { - "offer": "windows-data-science-vm", - "publisher": "microsoft-ads", - "sku": "windows2016", - "version": "latest", - }, - "osDisk": { - "caching": "ReadOnly", - "createOption": "FromImage", - "managedDisk": {"storageAccountType": "Standard_LRS"}, - "name": "myVMosdisk", - }, - }, - }, - }, - ).result() - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineExamples/VirtualMachine_Create_WithPlacement.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_with_premium_storage.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_with_premium_storage.py deleted file mode 100644 index b31a0f418172..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_with_premium_storage.py +++ /dev/null @@ -1,76 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_create_with_premium_storage.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.virtual_machines.begin_create_or_update( - resource_group_name="myResourceGroup", - vm_name="myVM", - parameters={ - "location": "westus", - "properties": { - "hardwareProfile": {"vmSize": "Standard_D1_v2"}, - "networkProfile": { - "networkInterfaces": [ - { - "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}", - "properties": {"primary": True}, - } - ] - }, - "osProfile": { - "adminPassword": "{your-password}", - "adminUsername": "{your-username}", - "computerName": "myVM", - }, - "storageProfile": { - "imageReference": { - "offer": "WindowsServer", - "publisher": "MicrosoftWindowsServer", - "sku": "2016-Datacenter", - "version": "latest", - }, - "osDisk": { - "caching": "ReadWrite", - "createOption": "FromImage", - "managedDisk": {"storageAccountType": "Premium_LRS"}, - "name": "myVMosdisk", - }, - }, - }, - }, - ).result() - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineExamples/VirtualMachine_Create_WithPremiumStorage.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_with_proxy_agent_settings.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_with_proxy_agent_settings.py deleted file mode 100644 index 55c200cbda54..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_with_proxy_agent_settings.py +++ /dev/null @@ -1,79 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_create_with_proxy_agent_settings.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.virtual_machines.begin_create_or_update( - resource_group_name="myResourceGroup", - vm_name="myVM", - parameters={ - "location": "westus", - "properties": { - "hardwareProfile": {"vmSize": "Standard_D2s_v3"}, - "networkProfile": { - "networkInterfaces": [ - { - "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}", - "properties": {"primary": True}, - } - ] - }, - "osProfile": { - "adminPassword": "{your-password}", - "adminUsername": "{your-username}", - "computerName": "myVM", - }, - "securityProfile": { - "proxyAgentSettings": {"enabled": True, "imds": {"mode": "Audit"}, "wireServer": {"mode": "Audit"}} - }, - "storageProfile": { - "imageReference": { - "offer": "WindowsServer", - "publisher": "MicrosoftWindowsServer", - "sku": "2019-Datacenter", - "version": "latest", - }, - "osDisk": { - "caching": "ReadOnly", - "createOption": "FromImage", - "managedDisk": {"storageAccountType": "StandardSSD_LRS"}, - "name": "myVMosdisk", - }, - }, - }, - }, - ).result() - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineExamples/VirtualMachine_Create_WithProxyAgentSettings.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_with_scheduled_events_profile.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_with_scheduled_events_profile.py deleted file mode 100644 index 5aed5a8295de..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_with_scheduled_events_profile.py +++ /dev/null @@ -1,94 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_create_with_scheduled_events_profile.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.virtual_machines.begin_create_or_update( - resource_group_name="myResourceGroup", - vm_name="myVM", - parameters={ - "location": "westus", - "properties": { - "diagnosticsProfile": { - "bootDiagnostics": { - "enabled": True, - "storageUri": "http://{existing-storage-account-name}.blob.core.windows.net", - } - }, - "hardwareProfile": {"vmSize": "Standard_D1_v2"}, - "networkProfile": { - "networkInterfaces": [ - { - "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}", - "properties": {"primary": True}, - } - ] - }, - "osProfile": { - "adminPassword": "{your-password}", - "adminUsername": "{your-username}", - "computerName": "myVM", - }, - "scheduledEventsPolicy": { - "allInstancesDown": {"automaticallyApprove": True}, - "scheduledEventsAdditionalPublishingTargets": { - "eventGridAndResourceGraph": {"enable": True, "scheduledEventsApiVersion": "2020-07-01"} - }, - "userInitiatedReboot": {"automaticallyApprove": True}, - "userInitiatedRedeploy": {"automaticallyApprove": True}, - }, - "scheduledEventsProfile": { - "osImageNotificationProfile": {"enable": True, "notBeforeTimeout": "PT15M"}, - "terminateNotificationProfile": {"enable": True, "notBeforeTimeout": "PT10M"}, - }, - "storageProfile": { - "imageReference": { - "offer": "WindowsServer", - "publisher": "MicrosoftWindowsServer", - "sku": "2016-Datacenter", - "version": "latest", - }, - "osDisk": { - "caching": "ReadWrite", - "createOption": "FromImage", - "managedDisk": {"storageAccountType": "Standard_LRS"}, - "name": "myVMosdisk", - }, - }, - }, - }, - ).result() - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineExamples/VirtualMachine_Create_WithScheduledEventsProfile.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_with_security_type_confidential_vm.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_with_security_type_confidential_vm.py deleted file mode 100644 index 2cedb6bab108..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_with_security_type_confidential_vm.py +++ /dev/null @@ -1,83 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_create_with_security_type_confidential_vm.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.virtual_machines.begin_create_or_update( - resource_group_name="myResourceGroup", - vm_name="myVM", - parameters={ - "location": "westus", - "properties": { - "hardwareProfile": {"vmSize": "Standard_DC2as_v5"}, - "networkProfile": { - "networkInterfaces": [ - { - "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}", - "properties": {"primary": True}, - } - ] - }, - "osProfile": { - "adminPassword": "{your-password}", - "adminUsername": "{your-username}", - "computerName": "myVM", - }, - "securityProfile": { - "securityType": "ConfidentialVM", - "uefiSettings": {"secureBootEnabled": True, "vTpmEnabled": True}, - }, - "storageProfile": { - "imageReference": { - "offer": "2019-datacenter-cvm", - "publisher": "MicrosoftWindowsServer", - "sku": "windows-cvm", - "version": "17763.2183.2109130127", - }, - "osDisk": { - "caching": "ReadOnly", - "createOption": "FromImage", - "managedDisk": { - "securityProfile": {"securityEncryptionType": "DiskWithVMGuestState"}, - "storageAccountType": "StandardSSD_LRS", - }, - "name": "myVMosdisk", - }, - }, - }, - }, - ).result() - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineExamples/VirtualMachine_Create_WithSecurityTypeConfidentialVM.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_with_security_type_confidential_vm_with_customer_managed_keys.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_with_security_type_confidential_vm_with_customer_managed_keys.py deleted file mode 100644 index c3562e6702d0..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_with_security_type_confidential_vm_with_customer_managed_keys.py +++ /dev/null @@ -1,88 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_create_with_security_type_confidential_vm_with_customer_managed_keys.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.virtual_machines.begin_create_or_update( - resource_group_name="myResourceGroup", - vm_name="myVM", - parameters={ - "location": "westus", - "properties": { - "hardwareProfile": {"vmSize": "Standard_DC2as_v5"}, - "networkProfile": { - "networkInterfaces": [ - { - "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}", - "properties": {"primary": True}, - } - ] - }, - "osProfile": { - "adminPassword": "{your-password}", - "adminUsername": "{your-username}", - "computerName": "myVM", - }, - "securityProfile": { - "securityType": "ConfidentialVM", - "uefiSettings": {"secureBootEnabled": True, "vTpmEnabled": True}, - }, - "storageProfile": { - "imageReference": { - "offer": "2019-datacenter-cvm", - "publisher": "MicrosoftWindowsServer", - "sku": "windows-cvm", - "version": "17763.2183.2109130127", - }, - "osDisk": { - "caching": "ReadOnly", - "createOption": "FromImage", - "managedDisk": { - "securityProfile": { - "diskEncryptionSet": { - "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSets/{existing-diskEncryptionSet-name}" - }, - "securityEncryptionType": "DiskWithVMGuestState", - }, - "storageAccountType": "StandardSSD_LRS", - }, - "name": "myVMosdisk", - }, - }, - }, - }, - ).result() - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineExamples/VirtualMachine_Create_WithSecurityTypeConfidentialVMWithCustomerManagedKeys.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_with_security_type_confidential_vm_with_non_persisted_tpm.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_with_security_type_confidential_vm_with_non_persisted_tpm.py deleted file mode 100644 index a253d9e3de01..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_with_security_type_confidential_vm_with_non_persisted_tpm.py +++ /dev/null @@ -1,83 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_create_with_security_type_confidential_vm_with_non_persisted_tpm.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.virtual_machines.begin_create_or_update( - resource_group_name="myResourceGroup", - vm_name="myVM", - parameters={ - "location": "westus", - "properties": { - "hardwareProfile": {"vmSize": "Standard_DC2es_v5"}, - "networkProfile": { - "networkInterfaces": [ - { - "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}", - "properties": {"primary": True}, - } - ] - }, - "osProfile": { - "adminPassword": "{your-password}", - "adminUsername": "{your-username}", - "computerName": "myVM", - }, - "securityProfile": { - "securityType": "ConfidentialVM", - "uefiSettings": {"secureBootEnabled": False, "vTpmEnabled": True}, - }, - "storageProfile": { - "imageReference": { - "offer": "2022-datacenter-cvm", - "publisher": "UbuntuServer", - "sku": "linux-cvm", - "version": "17763.2183.2109130127", - }, - "osDisk": { - "caching": "ReadOnly", - "createOption": "FromImage", - "managedDisk": { - "securityProfile": {"securityEncryptionType": "NonPersistedTPM"}, - "storageAccountType": "StandardSSD_LRS", - }, - "name": "myVMosdisk", - }, - }, - }, - }, - ).result() - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineExamples/VirtualMachine_Create_WithSecurityTypeConfidentialVMWithNonPersistedTPM.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_with_ssh_authentication.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_with_ssh_authentication.py deleted file mode 100644 index 917cea11de10..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_with_ssh_authentication.py +++ /dev/null @@ -1,86 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_create_with_ssh_authentication.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.virtual_machines.begin_create_or_update( - resource_group_name="myResourceGroup", - vm_name="myVM", - parameters={ - "location": "westus", - "properties": { - "hardwareProfile": {"vmSize": "Standard_D1_v2"}, - "networkProfile": { - "networkInterfaces": [ - { - "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}", - "properties": {"primary": True}, - } - ] - }, - "osProfile": { - "adminUsername": "{your-username}", - "computerName": "myVM", - "linuxConfiguration": { - "disablePasswordAuthentication": True, - "ssh": { - "publicKeys": [ - { - "keyData": "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCeClRAk2ipUs/l5voIsDC5q9RI+YSRd1Bvd/O+axgY4WiBzG+4FwJWZm/mLLe5DoOdHQwmU2FrKXZSW4w2sYE70KeWnrFViCOX5MTVvJgPE8ClugNl8RWth/tU849DvM9sT7vFgfVSHcAS2yDRyDlueii+8nF2ym8XWAPltFVCyLHRsyBp5YPqK8JFYIa1eybKsY3hEAxRCA+/7bq8et+Gj3coOsuRmrehav7rE6N12Pb80I6ofa6SM5XNYq4Xk0iYNx7R3kdz0Jj9XgZYWjAHjJmT0gTRoOnt6upOuxK7xI/ykWrllgpXrCPu3Ymz+c+ujaqcxDopnAl2lmf69/J1", - "path": "/home/{your-username}/.ssh/authorized_keys", - } - ] - }, - }, - }, - "storageProfile": { - "imageReference": { - "offer": "{image_offer}", - "publisher": "{image_publisher}", - "sku": "{image_sku}", - "version": "latest", - }, - "osDisk": { - "caching": "ReadWrite", - "createOption": "FromImage", - "managedDisk": {"storageAccountType": "Standard_LRS"}, - "name": "myVMosdisk", - }, - }, - }, - }, - ).result() - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineExamples/VirtualMachine_Create_WithSshAuthentication.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_with_uefi_settings.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_with_uefi_settings.py deleted file mode 100644 index f268ee539569..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_with_uefi_settings.py +++ /dev/null @@ -1,80 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_create_with_uefi_settings.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.virtual_machines.begin_create_or_update( - resource_group_name="myResourceGroup", - vm_name="myVM", - parameters={ - "location": "westus", - "properties": { - "hardwareProfile": {"vmSize": "Standard_D2s_v3"}, - "networkProfile": { - "networkInterfaces": [ - { - "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}", - "properties": {"primary": True}, - } - ] - }, - "osProfile": { - "adminPassword": "{your-password}", - "adminUsername": "{your-username}", - "computerName": "myVM", - }, - "securityProfile": { - "securityType": "TrustedLaunch", - "uefiSettings": {"secureBootEnabled": True, "vTpmEnabled": True}, - }, - "storageProfile": { - "imageReference": { - "offer": "windowsserver-gen2preview-preview", - "publisher": "MicrosoftWindowsServer", - "sku": "windows10-tvm", - "version": "18363.592.2001092016", - }, - "osDisk": { - "caching": "ReadOnly", - "createOption": "FromImage", - "managedDisk": {"storageAccountType": "StandardSSD_LRS"}, - "name": "myVMosdisk", - }, - }, - }, - }, - ).result() - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineExamples/VirtualMachine_Create_WithUefiSettings.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_with_user_data.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_with_user_data.py deleted file mode 100644 index b13ebea43140..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_with_user_data.py +++ /dev/null @@ -1,83 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_create_with_user_data.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.virtual_machines.begin_create_or_update( - resource_group_name="myResourceGroup", - vm_name="{vm-name}", - parameters={ - "location": "westus", - "properties": { - "diagnosticsProfile": { - "bootDiagnostics": { - "enabled": True, - "storageUri": "http://{existing-storage-account-name}.blob.core.windows.net", - } - }, - "hardwareProfile": {"vmSize": "Standard_D1_v2"}, - "networkProfile": { - "networkInterfaces": [ - { - "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}", - "properties": {"primary": True}, - } - ] - }, - "osProfile": { - "adminPassword": "{your-password}", - "adminUsername": "{your-username}", - "computerName": "{vm-name}", - }, - "storageProfile": { - "imageReference": { - "offer": "WindowsServer", - "publisher": "MicrosoftWindowsServer", - "sku": "2016-Datacenter", - "version": "latest", - }, - "osDisk": { - "caching": "ReadWrite", - "createOption": "FromImage", - "managedDisk": {"storageAccountType": "Standard_LRS"}, - "name": "vmOSdisk", - }, - }, - "userData": "RXhhbXBsZSBVc2VyRGF0YQ==", - }, - }, - ).result() - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineExamples/VirtualMachine_Create_WithUserData.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_with_vm_size_properties.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_with_vm_size_properties.py deleted file mode 100644 index 65e06f2ed518..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_with_vm_size_properties.py +++ /dev/null @@ -1,86 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_create_with_vm_size_properties.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.virtual_machines.begin_create_or_update( - resource_group_name="myResourceGroup", - vm_name="myVM", - parameters={ - "location": "westus", - "properties": { - "diagnosticsProfile": { - "bootDiagnostics": { - "enabled": True, - "storageUri": "http://{existing-storage-account-name}.blob.core.windows.net", - } - }, - "hardwareProfile": { - "vmSize": "Standard_D4_v3", - "vmSizeProperties": {"vCPUsAvailable": 1, "vCPUsPerCore": 1}, - }, - "networkProfile": { - "networkInterfaces": [ - { - "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}", - "properties": {"primary": True}, - } - ] - }, - "osProfile": { - "adminPassword": "{your-password}", - "adminUsername": "{your-username}", - "computerName": "myVM", - }, - "storageProfile": { - "imageReference": { - "offer": "WindowsServer", - "publisher": "MicrosoftWindowsServer", - "sku": "2016-Datacenter", - "version": "latest", - }, - "osDisk": { - "caching": "ReadWrite", - "createOption": "FromImage", - "managedDisk": {"storageAccountType": "Standard_LRS"}, - "name": "myVMosdisk", - }, - }, - "userData": "U29tZSBDdXN0b20gRGF0YQ==", - }, - }, - ).result() - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineExamples/VirtualMachine_Create_WithVMSizeProperties.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_deallocate_maximum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_deallocate_maximum_set_gen.py deleted file mode 100644 index 1c8453ed1020..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_deallocate_maximum_set_gen.py +++ /dev/null @@ -1,42 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_deallocate_maximum_set_gen.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - client.virtual_machines.begin_deallocate( - resource_group_name="rgcompute", - vm_name="aaaaaaaaaa", - ).result() - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineExamples/VirtualMachine_Deallocate_MaximumSet_Gen.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_deallocate_minimum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_deallocate_minimum_set_gen.py deleted file mode 100644 index 35e67b807e5a..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_deallocate_minimum_set_gen.py +++ /dev/null @@ -1,42 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_deallocate_minimum_set_gen.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - client.virtual_machines.begin_deallocate( - resource_group_name="rgcompute", - vm_name="aaaaaaaaaaaaaaaa", - ).result() - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineExamples/VirtualMachine_Deallocate_MinimumSet_Gen.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_delete_force.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_delete_force.py deleted file mode 100644 index 7ac1c33de214..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_delete_force.py +++ /dev/null @@ -1,42 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_delete_force.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - client.virtual_machines.begin_delete( - resource_group_name="myResourceGroup", - vm_name="myVM", - ).result() - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineExamples/VirtualMachine_Delete_Force.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_extension_create_or_update_maximum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_extension_create_or_update_maximum_set_gen.py deleted file mode 100644 index 10efbb0a9174..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_extension_create_or_update_maximum_set_gen.py +++ /dev/null @@ -1,82 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_extension_create_or_update_maximum_set_gen.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.virtual_machine_extensions.begin_create_or_update( - resource_group_name="rgcompute", - vm_name="aaaaaaaaaaaaaaaaaaaaaaaa", - vm_extension_name="aaaaaaaaaaaaa", - extension_parameters={ - "location": "westus", - "properties": { - "autoUpgradeMinorVersion": True, - "enableAutomaticUpgrade": True, - "forceUpdateTag": "a", - "instanceView": { - "name": "aaaaaaaaaaaaaaaaa", - "statuses": [ - { - "code": "aaaaaaaaaaaaaaaaaaaaaaa", - "displayStatus": "aaaaaa", - "level": "Info", - "message": "a", - "time": "2021-11-30T12:58:26.522Z", - } - ], - "substatuses": [ - { - "code": "aaaaaaaaaaaaaaaaaaaaaaa", - "displayStatus": "aaaaaa", - "level": "Info", - "message": "a", - "time": "2021-11-30T12:58:26.522Z", - } - ], - "type": "aaaaaaaaa", - "typeHandlerVersion": "aaaaaaaaaaaaaaaaaaaaaaaaaa", - }, - "protectedSettings": {}, - "publisher": "extPublisher", - "settings": {}, - "suppressFailures": True, - "type": "extType", - "typeHandlerVersion": "1.2", - }, - "tags": {"key9183": "aa"}, - }, - ).result() - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineExamples/VirtualMachineExtension_CreateOrUpdate_MaximumSet_Gen.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_extension_create_or_update_minimum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_extension_create_or_update_minimum_set_gen.py deleted file mode 100644 index 94521e415e86..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_extension_create_or_update_minimum_set_gen.py +++ /dev/null @@ -1,45 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_extension_create_or_update_minimum_set_gen.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.virtual_machine_extensions.begin_create_or_update( - resource_group_name="rgcompute", - vm_name="myVM", - vm_extension_name="myVMExtension", - extension_parameters={"location": "westus"}, - ).result() - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineExamples/VirtualMachineExtension_CreateOrUpdate_MinimumSet_Gen.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_extension_delete_maximum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_extension_delete_maximum_set_gen.py deleted file mode 100644 index 9de9674b1922..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_extension_delete_maximum_set_gen.py +++ /dev/null @@ -1,43 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_extension_delete_maximum_set_gen.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - client.virtual_machine_extensions.begin_delete( - resource_group_name="rgcompute", - vm_name="aaaaaaaaaaaaa", - vm_extension_name="aaaaaaaaaaaaaaaaaaaaaaaaaaaaa", - ).result() - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineExamples/VirtualMachineExtension_Delete_MaximumSet_Gen.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_extension_delete_minimum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_extension_delete_minimum_set_gen.py deleted file mode 100644 index 000d72f69e81..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_extension_delete_minimum_set_gen.py +++ /dev/null @@ -1,43 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_extension_delete_minimum_set_gen.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - client.virtual_machine_extensions.begin_delete( - resource_group_name="rgcompute", - vm_name="aaaaaaaaaaaaaaaaaaaaaaaaa", - vm_extension_name="aa", - ).result() - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineExamples/VirtualMachineExtension_Delete_MinimumSet_Gen.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_extension_get_maximum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_extension_get_maximum_set_gen.py deleted file mode 100644 index e94a10513286..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_extension_get_maximum_set_gen.py +++ /dev/null @@ -1,44 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_extension_get_maximum_set_gen.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.virtual_machine_extensions.get( - resource_group_name="rgcompute", - vm_name="aaaaaaaaaaaaaaaaaaaaaaaaaaaaa", - vm_extension_name="aaaaaaa", - ) - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineExamples/VirtualMachineExtension_Get_MaximumSet_Gen.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_extension_get_minimum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_extension_get_minimum_set_gen.py deleted file mode 100644 index 39f705488d52..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_extension_get_minimum_set_gen.py +++ /dev/null @@ -1,44 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_extension_get_minimum_set_gen.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.virtual_machine_extensions.get( - resource_group_name="rgcompute", - vm_name="myVM", - vm_extension_name="myVMExtension", - ) - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineExamples/VirtualMachineExtension_Get_MinimumSet_Gen.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_extension_list_maximum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_extension_list_maximum_set_gen.py deleted file mode 100644 index da056df68f9d..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_extension_list_maximum_set_gen.py +++ /dev/null @@ -1,43 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_extension_list_maximum_set_gen.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.virtual_machine_extensions.list( - resource_group_name="rgcompute", - vm_name="aaaaaaaaaaaaa", - ) - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineExamples/VirtualMachineExtension_List_MaximumSet_Gen.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_extension_list_minimum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_extension_list_minimum_set_gen.py deleted file mode 100644 index df8732fa41f9..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_extension_list_minimum_set_gen.py +++ /dev/null @@ -1,43 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_extension_list_minimum_set_gen.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.virtual_machine_extensions.list( - resource_group_name="rgcompute", - vm_name="aaaaaaaaaaaaaaaaaaaaaaaaaaa", - ) - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineExamples/VirtualMachineExtension_List_MinimumSet_Gen.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_extension_update.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_extension_update.py deleted file mode 100644 index e89e09575a45..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_extension_update.py +++ /dev/null @@ -1,60 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_extension_update.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.virtual_machine_extensions.begin_update( - resource_group_name="myResourceGroup", - vm_name="myVM", - vm_extension_name="myVMExtension", - extension_parameters={ - "properties": { - "autoUpgradeMinorVersion": True, - "protectedSettingsFromKeyVault": { - "secretUrl": "https://kvName.vault.azure.net/secrets/secretName/79b88b3a6f5440ffb2e73e44a0db712e", - "sourceVault": { - "id": "/subscriptions/a53f7094-a16c-47af-abe4-b05c05d0d79a/resourceGroups/myResourceGroup/providers/Microsoft.KeyVault/vaults/kvName" - }, - }, - "publisher": "extPublisher", - "settings": {"UserName": "xyz@microsoft.com"}, - "suppressFailures": True, - "type": "extType", - "typeHandlerVersion": "1.2", - } - }, - ).result() - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineExamples/VirtualMachineExtension_Update.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_generalize.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_generalize.py deleted file mode 100644 index 9de597ba8067..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_generalize.py +++ /dev/null @@ -1,42 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_generalize.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - client.virtual_machines.generalize( - resource_group_name="myResourceGroup", - vm_name="myVMName", - ) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineExamples/VirtualMachine_Generalize.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_get.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_get.py deleted file mode 100644 index 58039a584939..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_get.py +++ /dev/null @@ -1,43 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_get.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.virtual_machines.get( - resource_group_name="myResourceGroup", - vm_name="myVM", - ) - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineExamples/VirtualMachine_Get.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_get_auto_placed_on_dedicated_host_group.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_get_auto_placed_on_dedicated_host_group.py deleted file mode 100644 index ba905ad1b43a..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_get_auto_placed_on_dedicated_host_group.py +++ /dev/null @@ -1,43 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_get_auto_placed_on_dedicated_host_group.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.virtual_machines.get( - resource_group_name="myResourceGroup", - vm_name="myVM", - ) - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineExamples/VirtualMachine_Get_AutoPlacedOnDedicatedHostGroup.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_get_instance_view.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_get_instance_view.py deleted file mode 100644 index 26eb4e1f5737..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_get_instance_view.py +++ /dev/null @@ -1,43 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_get_instance_view.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.virtual_machines.instance_view( - resource_group_name="myResourceGroup", - vm_name="myVM", - ) - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineExamples/VirtualMachine_Get_InstanceView.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_get_instance_view_auto_placed_on_dedicated_host_group.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_get_instance_view_auto_placed_on_dedicated_host_group.py deleted file mode 100644 index 88b5e70c565d..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_get_instance_view_auto_placed_on_dedicated_host_group.py +++ /dev/null @@ -1,43 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_get_instance_view_auto_placed_on_dedicated_host_group.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.virtual_machines.instance_view( - resource_group_name="myResourceGroup", - vm_name="myVM", - ) - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineExamples/VirtualMachine_Get_InstanceViewAutoPlacedOnDedicatedHostGroup.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_get_with_disk_controller_type.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_get_with_disk_controller_type.py deleted file mode 100644 index 3219677a4ac1..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_get_with_disk_controller_type.py +++ /dev/null @@ -1,43 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_get_with_disk_controller_type.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.virtual_machines.get( - resource_group_name="myResourceGroup", - vm_name="myVM", - ) - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineExamples/VirtualMachine_Get_WithDiskControllerType.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_get_with_vm_size_properties.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_get_with_vm_size_properties.py deleted file mode 100644 index 0d9f6150d052..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_get_with_vm_size_properties.py +++ /dev/null @@ -1,43 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_get_with_vm_size_properties.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.virtual_machines.get( - resource_group_name="myResourceGroup", - vm_name="myVM", - ) - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineExamples/VirtualMachine_Get_WithVMSizeProperties.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_install_patches.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_install_patches.py deleted file mode 100644 index 541c42488f10..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_install_patches.py +++ /dev/null @@ -1,53 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_install_patches.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.virtual_machines.begin_install_patches( - resource_group_name="myResourceGroupName", - vm_name="myVMName", - install_patches_input={ - "maximumDuration": "PT4H", - "rebootSetting": "IfRequired", - "windowsParameters": { - "classificationsToInclude": ["Critical", "Security"], - "maxPatchPublishDate": "2020-11-19T02:36:43.0539904+00:00", - "patchNameMasksToExclude": ["*Windows*"], - "patchNameMasksToInclude": ["*SQL*"], - }, - }, - ).result() - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineExamples/VirtualMachine_InstallPatches.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_list_all_maximum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_list_all_maximum_set_gen.py deleted file mode 100644 index 91ddb04da56e..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_list_all_maximum_set_gen.py +++ /dev/null @@ -1,41 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_list_all_maximum_set_gen.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.virtual_machines.list_all() - for item in response: - print(item) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineExamples/VirtualMachine_ListAll_MaximumSet_Gen.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_list_all_minimum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_list_all_minimum_set_gen.py deleted file mode 100644 index 48669972c92e..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_list_all_minimum_set_gen.py +++ /dev/null @@ -1,41 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_list_all_minimum_set_gen.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.virtual_machines.list_all() - for item in response: - print(item) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineExamples/VirtualMachine_ListAll_MinimumSet_Gen.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_list_available_vm_sizes.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_list_available_vm_sizes.py deleted file mode 100644 index c96bb50752ed..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_list_available_vm_sizes.py +++ /dev/null @@ -1,44 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_list_available_vm_sizes.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.virtual_machines.list_available_sizes( - resource_group_name="myResourceGroup", - vm_name="myVmName", - ) - for item in response: - print(item) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineExamples/VirtualMachine_ListAvailableVmSizes.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_list_by_subscription_by_location.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_list_by_subscription_by_location.py deleted file mode 100644 index a301378fef44..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_list_by_subscription_by_location.py +++ /dev/null @@ -1,43 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_list_by_subscription_by_location.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscriptionId}", - ) - - response = client.virtual_machines.list_by_location( - location="eastus", - ) - for item in response: - print(item) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineExamples/VirtualMachine_ListBySubscription_ByLocation.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_list_maximum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_list_maximum_set_gen.py deleted file mode 100644 index 10ee4ddf7e86..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_list_maximum_set_gen.py +++ /dev/null @@ -1,43 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_list_maximum_set_gen.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.virtual_machines.list( - resource_group_name="rgcompute", - ) - for item in response: - print(item) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineExamples/VirtualMachine_List_MaximumSet_Gen.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_list_minimum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_list_minimum_set_gen.py deleted file mode 100644 index 79b4b39bf56e..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_list_minimum_set_gen.py +++ /dev/null @@ -1,43 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_list_minimum_set_gen.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.virtual_machines.list( - resource_group_name="rgcompute", - ) - for item in response: - print(item) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineExamples/VirtualMachine_List_MinimumSet_Gen.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_migrate_to_virtual_machine_scale_set.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_migrate_to_virtual_machine_scale_set.py deleted file mode 100644 index a51bbf8d3a42..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_migrate_to_virtual_machine_scale_set.py +++ /dev/null @@ -1,42 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_migrate_to_virtual_machine_scale_set.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - client.virtual_machines.begin_migrate_to_vm_scale_set( - resource_group_name="myResourceGroup", - vm_name="myVMName", - ).result() - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineExamples/VirtualMachine_MigrateToVirtualMachineScaleSet.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_perform_maintenance_maximum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_perform_maintenance_maximum_set_gen.py deleted file mode 100644 index 1bd5b2535995..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_perform_maintenance_maximum_set_gen.py +++ /dev/null @@ -1,42 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_perform_maintenance_maximum_set_gen.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - client.virtual_machines.begin_perform_maintenance( - resource_group_name="rgcompute", - vm_name="aaaaaaa", - ).result() - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineExamples/VirtualMachine_PerformMaintenance_MaximumSet_Gen.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_perform_maintenance_minimum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_perform_maintenance_minimum_set_gen.py deleted file mode 100644 index f0d9ea87a7ac..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_perform_maintenance_minimum_set_gen.py +++ /dev/null @@ -1,42 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_perform_maintenance_minimum_set_gen.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - client.virtual_machines.begin_perform_maintenance( - resource_group_name="rgcompute", - vm_name="aaaaaaaaaa", - ).result() - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineExamples/VirtualMachine_PerformMaintenance_MinimumSet_Gen.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_power_off_maximum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_power_off_maximum_set_gen.py deleted file mode 100644 index 9acbae901c8f..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_power_off_maximum_set_gen.py +++ /dev/null @@ -1,42 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_power_off_maximum_set_gen.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - client.virtual_machines.begin_power_off( - resource_group_name="rgcompute", - vm_name="aaaaaaaaaaaaaaaaaaaaaaaaaaa", - ).result() - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineExamples/VirtualMachine_PowerOff_MaximumSet_Gen.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_power_off_minimum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_power_off_minimum_set_gen.py deleted file mode 100644 index 38ab6600144d..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_power_off_minimum_set_gen.py +++ /dev/null @@ -1,42 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_power_off_minimum_set_gen.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - client.virtual_machines.begin_power_off( - resource_group_name="rgcompute", - vm_name="aaaaaaaaaaaaaaaaaa", - ).result() - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineExamples/VirtualMachine_PowerOff_MinimumSet_Gen.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_reapply.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_reapply.py deleted file mode 100644 index 42b3089d2b89..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_reapply.py +++ /dev/null @@ -1,42 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_reapply.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - client.virtual_machines.begin_reapply( - resource_group_name="ResourceGroup", - vm_name="VMName", - ).result() - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineExamples/VirtualMachine_Reapply.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_redeploy_maximum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_redeploy_maximum_set_gen.py deleted file mode 100644 index f9dc1203c62c..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_redeploy_maximum_set_gen.py +++ /dev/null @@ -1,42 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_redeploy_maximum_set_gen.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - client.virtual_machines.begin_redeploy( - resource_group_name="rgcompute", - vm_name="a", - ).result() - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineExamples/VirtualMachine_Redeploy_MaximumSet_Gen.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_redeploy_minimum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_redeploy_minimum_set_gen.py deleted file mode 100644 index 880c9d8e07e5..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_redeploy_minimum_set_gen.py +++ /dev/null @@ -1,42 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_redeploy_minimum_set_gen.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - client.virtual_machines.begin_redeploy( - resource_group_name="rgcompute", - vm_name="aaaaaaaaaaaaaaa", - ).result() - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineExamples/VirtualMachine_Redeploy_MinimumSet_Gen.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_reimage.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_reimage.py deleted file mode 100644 index 1cb3d612cf2c..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_reimage.py +++ /dev/null @@ -1,42 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_reimage.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - client.virtual_machines.begin_reimage( - resource_group_name="myResourceGroup", - vm_name="myVMName", - ).result() - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineExamples/VirtualMachine_Reimage.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_reimage_non_ephemeral_vms.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_reimage_non_ephemeral_vms.py deleted file mode 100644 index 0cb046821ca9..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_reimage_non_ephemeral_vms.py +++ /dev/null @@ -1,42 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_reimage_non_ephemeral_vms.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - client.virtual_machines.begin_reimage( - resource_group_name="myResourceGroup", - vm_name="myVMName", - ).result() - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineExamples/VirtualMachine_Reimage_NonEphemeralVMs.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_restart_maximum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_restart_maximum_set_gen.py deleted file mode 100644 index 6b40f33ab155..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_restart_maximum_set_gen.py +++ /dev/null @@ -1,42 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_restart_maximum_set_gen.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - client.virtual_machines.begin_restart( - resource_group_name="rgcompute", - vm_name="aaaaaaaaaaaaaaaaaaaa", - ).result() - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineExamples/VirtualMachine_Restart_MaximumSet_Gen.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_restart_minimum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_restart_minimum_set_gen.py deleted file mode 100644 index 4a6fad045223..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_restart_minimum_set_gen.py +++ /dev/null @@ -1,42 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_restart_minimum_set_gen.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - client.virtual_machines.begin_restart( - resource_group_name="rgcompute", - vm_name="aaa", - ).result() - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineExamples/VirtualMachine_Restart_MinimumSet_Gen.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_retrieve_boot_diagnostics_data.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_retrieve_boot_diagnostics_data.py deleted file mode 100644 index 0b524e292cac..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_retrieve_boot_diagnostics_data.py +++ /dev/null @@ -1,43 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_retrieve_boot_diagnostics_data.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.virtual_machines.retrieve_boot_diagnostics_data( - resource_group_name="ResourceGroup", - vm_name="VMName", - ) - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineExamples/VirtualMachine_RetrieveBootDiagnosticsData.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_simulate_eviction.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_simulate_eviction.py deleted file mode 100644 index f3f097c8ce23..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_simulate_eviction.py +++ /dev/null @@ -1,42 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_simulate_eviction.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - client.virtual_machines.simulate_eviction( - resource_group_name="ResourceGroup", - vm_name="VMName", - ) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineExamples/VirtualMachine_SimulateEviction.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_start_maximum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_start_maximum_set_gen.py deleted file mode 100644 index e6bf3c751415..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_start_maximum_set_gen.py +++ /dev/null @@ -1,42 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_start_maximum_set_gen.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - client.virtual_machines.begin_start( - resource_group_name="rgcompute", - vm_name="aaaaaaaaaaaaaaaaaaaa", - ).result() - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineExamples/VirtualMachine_Start_MaximumSet_Gen.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_start_minimum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_start_minimum_set_gen.py deleted file mode 100644 index 9bc86b9405b1..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_start_minimum_set_gen.py +++ /dev/null @@ -1,42 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_start_minimum_set_gen.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - client.virtual_machines.begin_start( - resource_group_name="rgcompute", - vm_name="aaaaa", - ).result() - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineExamples/VirtualMachine_Start_MinimumSet_Gen.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_update_detach_data_disk_using_to_be_detached_property.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_update_detach_data_disk_using_to_be_detached_property.py deleted file mode 100644 index 8035693986c7..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_update_detach_data_disk_using_to_be_detached_property.py +++ /dev/null @@ -1,79 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_update_detach_data_disk_using_to_be_detached_property.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.virtual_machines.begin_update( - resource_group_name="myResourceGroup", - vm_name="myVM", - parameters={ - "properties": { - "hardwareProfile": {"vmSize": "Standard_D2_v2"}, - "networkProfile": { - "networkInterfaces": [ - { - "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}", - "properties": {"primary": True}, - } - ] - }, - "osProfile": { - "adminPassword": "{your-password}", - "adminUsername": "{your-username}", - "computerName": "myVM", - }, - "storageProfile": { - "dataDisks": [ - {"createOption": "Empty", "diskSizeGB": 1023, "lun": 0, "toBeDetached": True}, - {"createOption": "Empty", "diskSizeGB": 1023, "lun": 1, "toBeDetached": False}, - ], - "imageReference": { - "offer": "WindowsServer", - "publisher": "MicrosoftWindowsServer", - "sku": "2016-Datacenter", - "version": "latest", - }, - "osDisk": { - "caching": "ReadWrite", - "createOption": "FromImage", - "managedDisk": {"storageAccountType": "Standard_LRS"}, - "name": "myVMosdisk", - }, - }, - } - }, - ).result() - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineExamples/VirtualMachine_Update_DetachDataDiskUsingToBeDetachedProperty.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_update_force_detach_data_disk.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_update_force_detach_data_disk.py deleted file mode 100644 index 6685f17930be..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_update_force_detach_data_disk.py +++ /dev/null @@ -1,85 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_update_force_detach_data_disk.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.virtual_machines.begin_update( - resource_group_name="myResourceGroup", - vm_name="myVM", - parameters={ - "properties": { - "hardwareProfile": {"vmSize": "Standard_D2_v2"}, - "networkProfile": { - "networkInterfaces": [ - { - "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}", - "properties": {"primary": True}, - } - ] - }, - "osProfile": { - "adminPassword": "{your-password}", - "adminUsername": "{your-username}", - "computerName": "myVM", - }, - "storageProfile": { - "dataDisks": [ - { - "createOption": "Empty", - "detachOption": "ForceDetach", - "diskSizeGB": 1023, - "lun": 0, - "toBeDetached": True, - }, - {"createOption": "Empty", "diskSizeGB": 1023, "lun": 1, "toBeDetached": False}, - ], - "imageReference": { - "offer": "WindowsServer", - "publisher": "MicrosoftWindowsServer", - "sku": "2016-Datacenter", - "version": "latest", - }, - "osDisk": { - "caching": "ReadWrite", - "createOption": "FromImage", - "managedDisk": {"storageAccountType": "Standard_LRS"}, - "name": "myVMosdisk", - }, - }, - } - }, - ).result() - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineExamples/VirtualMachine_Update_ForceDetachDataDisk.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_extension_image_examples/virtual_machine_extension_image_get_maximum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_extension_image_examples/virtual_machine_extension_image_get_maximum_set_gen.py deleted file mode 100644 index 437dc8c2bfc0..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_extension_image_examples/virtual_machine_extension_image_get_maximum_set_gen.py +++ /dev/null @@ -1,45 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_extension_image_get_maximum_set_gen.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.virtual_machine_extension_images.get( - location="aaaaaaaaaaaaa", - publisher_name="aaaaaaaaaaaaaaaaaaaa", - type="aaaaaaaaaaaaaaaaaa", - version="aaaaaaaaaaaaaa", - ) - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineExtensionImageExamples/VirtualMachineExtensionImage_Get_MaximumSet_Gen.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_extension_image_examples/virtual_machine_extension_image_get_minimum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_extension_image_examples/virtual_machine_extension_image_get_minimum_set_gen.py deleted file mode 100644 index b65cc2d2ed30..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_extension_image_examples/virtual_machine_extension_image_get_minimum_set_gen.py +++ /dev/null @@ -1,45 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_extension_image_get_minimum_set_gen.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.virtual_machine_extension_images.get( - location="aaaaaaaaaaaaaa", - publisher_name="aaaaaaaaaaaaaaaaaaaaaaaaaa", - type="aa", - version="aaa", - ) - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineExtensionImageExamples/VirtualMachineExtensionImage_Get_MinimumSet_Gen.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_extension_image_examples/virtual_machine_extension_image_list_types_maximum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_extension_image_examples/virtual_machine_extension_image_list_types_maximum_set_gen.py deleted file mode 100644 index 05a403baabe4..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_extension_image_examples/virtual_machine_extension_image_list_types_maximum_set_gen.py +++ /dev/null @@ -1,43 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_extension_image_list_types_maximum_set_gen.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.virtual_machine_extension_images.list_types( - location="aaaaaaaaaaaaaaaaaaaaaaaaaa", - publisher_name="aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", - ) - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineExtensionImageExamples/VirtualMachineExtensionImage_ListTypes_MaximumSet_Gen.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_extension_image_examples/virtual_machine_extension_image_list_types_minimum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_extension_image_examples/virtual_machine_extension_image_list_types_minimum_set_gen.py deleted file mode 100644 index d355ca51be35..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_extension_image_examples/virtual_machine_extension_image_list_types_minimum_set_gen.py +++ /dev/null @@ -1,43 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_extension_image_list_types_minimum_set_gen.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.virtual_machine_extension_images.list_types( - location="aaaa", - publisher_name="aa", - ) - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineExtensionImageExamples/VirtualMachineExtensionImage_ListTypes_MinimumSet_Gen.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_extension_image_examples/virtual_machine_extension_image_list_versions_maximum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_extension_image_examples/virtual_machine_extension_image_list_versions_maximum_set_gen.py deleted file mode 100644 index 21258f87ef7e..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_extension_image_examples/virtual_machine_extension_image_list_versions_maximum_set_gen.py +++ /dev/null @@ -1,44 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_extension_image_list_versions_maximum_set_gen.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.virtual_machine_extension_images.list_versions( - location="aaaaaaaaaaaaaaaaaaaaaaaaaa", - publisher_name="aaaaaaaaaaaaaaaaaaaa", - type="aaaaaaaaaaaaaaaaaa", - ) - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineExtensionImageExamples/VirtualMachineExtensionImage_ListVersions_MaximumSet_Gen.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_extension_image_examples/virtual_machine_extension_image_list_versions_minimum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_extension_image_examples/virtual_machine_extension_image_list_versions_minimum_set_gen.py deleted file mode 100644 index 8f53d2b6d08e..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_extension_image_examples/virtual_machine_extension_image_list_versions_minimum_set_gen.py +++ /dev/null @@ -1,44 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_extension_image_list_versions_minimum_set_gen.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.virtual_machine_extension_images.list_versions( - location="aaaaaaaaa", - publisher_name="aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", - type="aaaa", - ) - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineExtensionImageExamples/VirtualMachineExtensionImage_ListVersions_MinimumSet_Gen.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_image_examples/virtual_machine_image_get_maximum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_image_examples/virtual_machine_image_get_maximum_set_gen.py deleted file mode 100644 index eff3238ba7d4..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_image_examples/virtual_machine_image_get_maximum_set_gen.py +++ /dev/null @@ -1,46 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_image_get_maximum_set_gen.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.virtual_machine_images.get( - location="aaaaaa", - publisher_name="aaa", - offer="aaaaaaaaaaaaaaaaaaaaaaaaaaaaa", - skus="aaaaaaaaaaaaaaaaaaaaaaaaaaa", - version="aaaaaaaaaaaaaaaaaaa", - ) - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineImageExamples/VirtualMachineImage_Get_MaximumSet_Gen.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_image_examples/virtual_machine_image_get_minimum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_image_examples/virtual_machine_image_get_minimum_set_gen.py deleted file mode 100644 index 6d881fe757ed..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_image_examples/virtual_machine_image_get_minimum_set_gen.py +++ /dev/null @@ -1,46 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_image_get_minimum_set_gen.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.virtual_machine_images.get( - location="aaaaaaaaaaaa", - publisher_name="aaaaaaaaaaa", - offer="aa", - skus="aaaaaaaaa", - version="aaaaaaaaaaaaaaaaaaaaaaaaaaaaa", - ) - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineImageExamples/VirtualMachineImage_Get_MinimumSet_Gen.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_image_examples/virtual_machine_image_list_maximum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_image_examples/virtual_machine_image_list_maximum_set_gen.py deleted file mode 100644 index d036a365f581..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_image_examples/virtual_machine_image_list_maximum_set_gen.py +++ /dev/null @@ -1,45 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_image_list_maximum_set_gen.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.virtual_machine_images.list( - location="aaaaaaaaaaaaaaa", - publisher_name="aaaaaa", - offer="aaaaaaaaaaaaaaaa", - skus="aaaaaaaaaaaaaaaaaaaaaaa", - ) - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineImageExamples/VirtualMachineImage_List_MaximumSet_Gen.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_image_examples/virtual_machine_image_list_minimum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_image_examples/virtual_machine_image_list_minimum_set_gen.py deleted file mode 100644 index ce13ebb6f37f..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_image_examples/virtual_machine_image_list_minimum_set_gen.py +++ /dev/null @@ -1,45 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_image_list_minimum_set_gen.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.virtual_machine_images.list( - location="aaaaaaa", - publisher_name="aaaaaaaaaaa", - offer="aaaaaaaaaa", - skus="aaaaaa", - ) - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineImageExamples/VirtualMachineImage_List_MinimumSet_Gen.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_image_examples/virtual_machine_image_list_offers_maximum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_image_examples/virtual_machine_image_list_offers_maximum_set_gen.py deleted file mode 100644 index 13351f641f0b..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_image_examples/virtual_machine_image_list_offers_maximum_set_gen.py +++ /dev/null @@ -1,43 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_image_list_offers_maximum_set_gen.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.virtual_machine_images.list_offers( - location="aaaaaaa", - publisher_name="aaaaaaaa", - ) - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineImageExamples/VirtualMachineImage_ListOffers_MaximumSet_Gen.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_image_examples/virtual_machine_image_list_offers_minimum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_image_examples/virtual_machine_image_list_offers_minimum_set_gen.py deleted file mode 100644 index 2d2e7089634f..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_image_examples/virtual_machine_image_list_offers_minimum_set_gen.py +++ /dev/null @@ -1,43 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_image_list_offers_minimum_set_gen.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.virtual_machine_images.list_offers( - location="aaaaaaaaaaaaaaaaa", - publisher_name="aaaaaaaaaaaaaaaaaaaaaaaaaaaa", - ) - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineImageExamples/VirtualMachineImage_ListOffers_MinimumSet_Gen.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_image_examples/virtual_machine_image_list_publishers_maximum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_image_examples/virtual_machine_image_list_publishers_maximum_set_gen.py deleted file mode 100644 index a748eb024d1d..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_image_examples/virtual_machine_image_list_publishers_maximum_set_gen.py +++ /dev/null @@ -1,42 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_image_list_publishers_maximum_set_gen.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.virtual_machine_images.list_publishers( - location="aaaaa", - ) - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineImageExamples/VirtualMachineImage_ListPublishers_MaximumSet_Gen.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_image_examples/virtual_machine_image_list_publishers_minimum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_image_examples/virtual_machine_image_list_publishers_minimum_set_gen.py deleted file mode 100644 index e3156c571dbf..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_image_examples/virtual_machine_image_list_publishers_minimum_set_gen.py +++ /dev/null @@ -1,42 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_image_list_publishers_minimum_set_gen.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.virtual_machine_images.list_publishers( - location="aaaaaaaaaaaaaaaaaaaaaaaaaaa", - ) - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineImageExamples/VirtualMachineImage_ListPublishers_MinimumSet_Gen.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_image_examples/virtual_machine_image_list_skus_maximum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_image_examples/virtual_machine_image_list_skus_maximum_set_gen.py deleted file mode 100644 index 706f1c2f14f5..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_image_examples/virtual_machine_image_list_skus_maximum_set_gen.py +++ /dev/null @@ -1,44 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_image_list_skus_maximum_set_gen.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.virtual_machine_images.list_skus( - location="aaaa", - publisher_name="aaaaaaaaaaaaaaaaaaaaaaaaaaaa", - offer="aaaaaaa", - ) - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineImageExamples/VirtualMachineImage_ListSkus_MaximumSet_Gen.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_image_examples/virtual_machine_image_list_skus_minimum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_image_examples/virtual_machine_image_list_skus_minimum_set_gen.py deleted file mode 100644 index ef24c54717a9..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_image_examples/virtual_machine_image_list_skus_minimum_set_gen.py +++ /dev/null @@ -1,44 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_image_list_skus_minimum_set_gen.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.virtual_machine_images.list_skus( - location="aaaa", - publisher_name="aaaaaaaaaaaaa", - offer="aaaaaaa", - ) - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineImageExamples/VirtualMachineImage_ListSkus_MinimumSet_Gen.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_image_examples/virtual_machine_images_edge_zone_get_maximum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_image_examples/virtual_machine_images_edge_zone_get_maximum_set_gen.py deleted file mode 100644 index c547f213a98a..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_image_examples/virtual_machine_images_edge_zone_get_maximum_set_gen.py +++ /dev/null @@ -1,47 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_images_edge_zone_get_maximum_set_gen.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.virtual_machine_images_edge_zone.get( - location="aaaaaaaaaaaaaaaaaaaaaaaa", - edge_zone="aaaaaaaa", - publisher_name="aaaaaaaaaaaaaaaaaaaaaaa", - offer="aaaaaaaaaaaaaaaaaaaaaaaaaaa", - skus="aaaaaaaaaa", - version="aaaaaaaaaaaaaaaaaaaaaaaaaaa", - ) - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineImageExamples/VirtualMachineImagesEdgeZone_Get_MaximumSet_Gen.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_image_examples/virtual_machine_images_edge_zone_get_minimum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_image_examples/virtual_machine_images_edge_zone_get_minimum_set_gen.py deleted file mode 100644 index 9ed4dd4b33fb..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_image_examples/virtual_machine_images_edge_zone_get_minimum_set_gen.py +++ /dev/null @@ -1,47 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_images_edge_zone_get_minimum_set_gen.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.virtual_machine_images_edge_zone.get( - location="aaaaaaaaaaaaaaaaaaaaaaa", - edge_zone="aaaaaaaaaaaaaaaaaaaaaaaaaaaaa", - publisher_name="aaaaaaaaaaaaaaaaaaaaaaaaaaaaa", - offer="aaaaaaaaaaa", - skus="aaaaaaaaaaaaaaaaaa", - version="aa", - ) - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineImageExamples/VirtualMachineImagesEdgeZone_Get_MinimumSet_Gen.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_image_examples/virtual_machine_images_edge_zone_list_by_edge_zone_maximum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_image_examples/virtual_machine_images_edge_zone_list_by_edge_zone_maximum_set_gen.py deleted file mode 100644 index 84ec794ebdd4..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_image_examples/virtual_machine_images_edge_zone_list_by_edge_zone_maximum_set_gen.py +++ /dev/null @@ -1,43 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_images_edge_zone_list_by_edge_zone_maximum_set_gen.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="5ece5940-d962-4dad-a98f-ca9ac0f021a5", - ) - - response = client.virtual_machine_images.list_by_edge_zone( - location="WestUS", - edge_zone="microsoftlosangeles1", - ) - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineImageExamples/VirtualMachineImagesEdgeZone_ListByEdgeZone_MaximumSet_Gen.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_image_examples/virtual_machine_images_edge_zone_list_by_edge_zone_minimum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_image_examples/virtual_machine_images_edge_zone_list_by_edge_zone_minimum_set_gen.py deleted file mode 100644 index 9e75dc6976ed..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_image_examples/virtual_machine_images_edge_zone_list_by_edge_zone_minimum_set_gen.py +++ /dev/null @@ -1,43 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_images_edge_zone_list_by_edge_zone_minimum_set_gen.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="5ece5940-d962-4dad-a98f-ca9ac0f021a5", - ) - - response = client.virtual_machine_images.list_by_edge_zone( - location="WestUS", - edge_zone="microsoftlosangeles1", - ) - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineImageExamples/VirtualMachineImagesEdgeZone_ListByEdgeZone_MinimumSet_Gen.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_image_examples/virtual_machine_images_edge_zone_list_maximum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_image_examples/virtual_machine_images_edge_zone_list_maximum_set_gen.py deleted file mode 100644 index 593688ddf7b4..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_image_examples/virtual_machine_images_edge_zone_list_maximum_set_gen.py +++ /dev/null @@ -1,46 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_images_edge_zone_list_maximum_set_gen.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.virtual_machine_images_edge_zone.list( - location="aaaaaaaaaaaaaaa", - edge_zone="aaaaaaaaaaaaaaaaaaaaaaaaa", - publisher_name="aaaa", - offer="aaaaaaaaaaaaaaaaaaaaaaaaaa", - skus="aaaaaaaaaaaaaaaaaaaaaaa", - ) - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineImageExamples/VirtualMachineImagesEdgeZone_List_MaximumSet_Gen.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_image_examples/virtual_machine_images_edge_zone_list_minimum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_image_examples/virtual_machine_images_edge_zone_list_minimum_set_gen.py deleted file mode 100644 index 9e958caea29e..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_image_examples/virtual_machine_images_edge_zone_list_minimum_set_gen.py +++ /dev/null @@ -1,46 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_images_edge_zone_list_minimum_set_gen.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.virtual_machine_images_edge_zone.list( - location="aaaaaaaaaaaaaaaaaaaaaaaaaaaaa", - edge_zone="aaaaa", - publisher_name="aaaaaaaaaaaaaaaaaaa", - offer="aaaaaaaaaaaaaaaaaaaaaaaaaaa", - skus="aaaaaaaaaaaaaaaaaaaaaaaaaaaaa", - ) - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineImageExamples/VirtualMachineImagesEdgeZone_List_MinimumSet_Gen.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_image_examples/virtual_machine_images_edge_zone_list_offers_maximum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_image_examples/virtual_machine_images_edge_zone_list_offers_maximum_set_gen.py deleted file mode 100644 index db04913d0ff8..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_image_examples/virtual_machine_images_edge_zone_list_offers_maximum_set_gen.py +++ /dev/null @@ -1,44 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_images_edge_zone_list_offers_maximum_set_gen.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.virtual_machine_images_edge_zone.list_offers( - location="aaaaaaaaaaaaaaaaaa", - edge_zone="aaaaaaaaaaaaaaaaaaa", - publisher_name="aaaaaaaaaaaaa", - ) - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineImageExamples/VirtualMachineImagesEdgeZone_ListOffers_MaximumSet_Gen.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_image_examples/virtual_machine_images_edge_zone_list_offers_minimum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_image_examples/virtual_machine_images_edge_zone_list_offers_minimum_set_gen.py deleted file mode 100644 index dbff8bb513d3..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_image_examples/virtual_machine_images_edge_zone_list_offers_minimum_set_gen.py +++ /dev/null @@ -1,44 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_images_edge_zone_list_offers_minimum_set_gen.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.virtual_machine_images_edge_zone.list_offers( - location="aaaaaaaaaaaaaa", - edge_zone="aaaaaaaaaaaaaaaaaaaaa", - publisher_name="aaaaaaaaaaaaaaaaaaaaaaaaaaa", - ) - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineImageExamples/VirtualMachineImagesEdgeZone_ListOffers_MinimumSet_Gen.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_image_examples/virtual_machine_images_edge_zone_list_publishers_maximum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_image_examples/virtual_machine_images_edge_zone_list_publishers_maximum_set_gen.py deleted file mode 100644 index 8ed166e68d16..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_image_examples/virtual_machine_images_edge_zone_list_publishers_maximum_set_gen.py +++ /dev/null @@ -1,43 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_images_edge_zone_list_publishers_maximum_set_gen.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.virtual_machine_images_edge_zone.list_publishers( - location="aaaaaa", - edge_zone="aaaaaaaaaaaaaaaaaaaaaaaaaaa", - ) - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineImageExamples/VirtualMachineImagesEdgeZone_ListPublishers_MaximumSet_Gen.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_image_examples/virtual_machine_images_edge_zone_list_publishers_minimum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_image_examples/virtual_machine_images_edge_zone_list_publishers_minimum_set_gen.py deleted file mode 100644 index 029300fdeaa4..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_image_examples/virtual_machine_images_edge_zone_list_publishers_minimum_set_gen.py +++ /dev/null @@ -1,43 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_images_edge_zone_list_publishers_minimum_set_gen.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.virtual_machine_images_edge_zone.list_publishers( - location="aaaa", - edge_zone="aaaaaaaaaaaaaaaaaaaaaaa", - ) - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineImageExamples/VirtualMachineImagesEdgeZone_ListPublishers_MinimumSet_Gen.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_image_examples/virtual_machine_images_edge_zone_list_skus_maximum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_image_examples/virtual_machine_images_edge_zone_list_skus_maximum_set_gen.py deleted file mode 100644 index ce4d465c013e..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_image_examples/virtual_machine_images_edge_zone_list_skus_maximum_set_gen.py +++ /dev/null @@ -1,45 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_images_edge_zone_list_skus_maximum_set_gen.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.virtual_machine_images_edge_zone.list_skus( - location="aaaaaaaaaaaa", - edge_zone="aaaaa", - publisher_name="aaaaaaaaaaaa", - offer="aaaaaaaaaaaa", - ) - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineImageExamples/VirtualMachineImagesEdgeZone_ListSkus_MaximumSet_Gen.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_image_examples/virtual_machine_images_edge_zone_list_skus_minimum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_image_examples/virtual_machine_images_edge_zone_list_skus_minimum_set_gen.py deleted file mode 100644 index 6f0a66a39272..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_image_examples/virtual_machine_images_edge_zone_list_skus_minimum_set_gen.py +++ /dev/null @@ -1,45 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_images_edge_zone_list_skus_minimum_set_gen.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.virtual_machine_images_edge_zone.list_skus( - location="aaaaaaaaaaaaaaaaaaaa", - edge_zone="aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", - publisher_name="aaaaaaaaa", - offer="aaaaaaaaaaaa", - ) - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineImageExamples/VirtualMachineImagesEdgeZone_ListSkus_MinimumSet_Gen.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_image_examples/virtual_machine_images_list_with_properties_maximum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_image_examples/virtual_machine_images_list_with_properties_maximum_set_gen.py deleted file mode 100644 index fb7bcfcf75a9..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_image_examples/virtual_machine_images_list_with_properties_maximum_set_gen.py +++ /dev/null @@ -1,46 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_images_list_with_properties_maximum_set_gen.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.virtual_machine_images.list_with_properties( - location="eastus", - publisher_name="MicrosoftWindowsServer", - offer="WindowsServer", - skus="2022-datacenter-azure-edition", - expand="Properties", - ) - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineImageExamples/VirtualMachineImages_ListWithProperties_MaximumSet_Gen.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_image_examples/virtual_machine_images_list_with_properties_minimum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_image_examples/virtual_machine_images_list_with_properties_minimum_set_gen.py deleted file mode 100644 index e4261e3cd182..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_image_examples/virtual_machine_images_list_with_properties_minimum_set_gen.py +++ /dev/null @@ -1,46 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_images_list_with_properties_minimum_set_gen.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.virtual_machine_images.list_with_properties( - location="eastus", - publisher_name="MicrosoftWindowsServer", - offer="WindowsServer", - skus="2022-datacenter-azure-edition", - expand="Properties", - ) - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineImageExamples/VirtualMachineImages_ListWithProperties_MinimumSet_Gen.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_approve_rolling_upgrade.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_approve_rolling_upgrade.py deleted file mode 100644 index 6d49d808ad04..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_approve_rolling_upgrade.py +++ /dev/null @@ -1,42 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_scale_set_approve_rolling_upgrade.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - client.virtual_machine_scale_sets.begin_approve_rolling_upgrade( - resource_group_name="rgcompute", - vm_scale_set_name="vmssToApproveRollingUpgradeOn", - ).result() - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_ApproveRollingUpgrade.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_convert_to_single_placement_group_maximum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_convert_to_single_placement_group_maximum_set_gen.py deleted file mode 100644 index 2c2200072116..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_convert_to_single_placement_group_maximum_set_gen.py +++ /dev/null @@ -1,43 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_scale_set_convert_to_single_placement_group_maximum_set_gen.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - client.virtual_machine_scale_sets.convert_to_single_placement_group( - resource_group_name="rgcompute", - vm_scale_set_name="aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", - parameters={"activePlacementGroupId": "aaaaaaaaaaaaaaaaaaaaaaaaaaa"}, - ) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_ConvertToSinglePlacementGroup_MaximumSet_Gen.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_a_with_diff_os_disk_using_diff_disk_placement.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_a_with_diff_os_disk_using_diff_disk_placement.py deleted file mode 100644 index ce021f6f2e1a..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_a_with_diff_os_disk_using_diff_disk_placement.py +++ /dev/null @@ -1,94 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_scale_set_create_a_with_diff_os_disk_using_diff_disk_placement.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.virtual_machine_scale_sets.begin_create_or_update( - resource_group_name="myResourceGroup", - vm_scale_set_name="{vmss-name}", - parameters={ - "location": "westus", - "plan": {"name": "windows2016", "product": "windows-data-science-vm", "publisher": "microsoft-ads"}, - "properties": { - "overprovision": True, - "upgradePolicy": {"mode": "Manual"}, - "virtualMachineProfile": { - "networkProfile": { - "networkInterfaceConfigurations": [ - { - "name": "{vmss-name}", - "properties": { - "enableIPForwarding": True, - "ipConfigurations": [ - { - "name": "{vmss-name}", - "properties": { - "subnet": { - "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}" - } - }, - } - ], - "primary": True, - }, - } - ] - }, - "osProfile": { - "adminPassword": "{your-password}", - "adminUsername": "{your-username}", - "computerNamePrefix": "{vmss-name}", - }, - "storageProfile": { - "imageReference": { - "offer": "windows-data-science-vm", - "publisher": "microsoft-ads", - "sku": "windows2016", - "version": "latest", - }, - "osDisk": { - "caching": "ReadOnly", - "createOption": "FromImage", - "diffDiskSettings": {"option": "Local", "placement": "ResourceDisk"}, - "managedDisk": {"storageAccountType": "Standard_LRS"}, - }, - }, - }, - }, - "sku": {"capacity": 3, "name": "Standard_DS1_v2", "tier": "Standard"}, - }, - ).result() - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_CreateA_WithDiffOsDiskUsingDiffDiskPlacement.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_a_with_diff_os_disk_using_diff_disk_placement_as_nvme_disk.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_a_with_diff_os_disk_using_diff_disk_placement_as_nvme_disk.py deleted file mode 100644 index 0b6ccd848f46..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_a_with_diff_os_disk_using_diff_disk_placement_as_nvme_disk.py +++ /dev/null @@ -1,94 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_scale_set_create_a_with_diff_os_disk_using_diff_disk_placement_as_nvme_disk.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.virtual_machine_scale_sets.begin_create_or_update( - resource_group_name="myResourceGroup", - vm_scale_set_name="{vmss-name}", - parameters={ - "location": "westus", - "plan": {"name": "windows2016", "product": "windows-data-science-vm", "publisher": "microsoft-ads"}, - "properties": { - "overprovision": True, - "upgradePolicy": {"mode": "Manual"}, - "virtualMachineProfile": { - "networkProfile": { - "networkInterfaceConfigurations": [ - { - "name": "{vmss-name}", - "properties": { - "enableIPForwarding": True, - "ipConfigurations": [ - { - "name": "{vmss-name}", - "properties": { - "subnet": { - "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}" - } - }, - } - ], - "primary": True, - }, - } - ] - }, - "osProfile": { - "adminPassword": "{your-password}", - "adminUsername": "{your-username}", - "computerNamePrefix": "{vmss-name}", - }, - "storageProfile": { - "imageReference": { - "offer": "windows-data-science-vm", - "publisher": "microsoft-ads", - "sku": "windows2016", - "version": "latest", - }, - "osDisk": { - "caching": "ReadOnly", - "createOption": "FromImage", - "diffDiskSettings": {"option": "Local", "placement": "NvmeDisk"}, - "managedDisk": {"storageAccountType": "Standard_LRS"}, - }, - }, - }, - }, - "sku": {"capacity": 3, "name": "Standard_DS1_v2", "tier": "Standard"}, - }, - ).result() - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_CreateA_WithDiffOsDiskUsingDiffDiskPlacementAsNvmeDisk.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_custom_image_from_an_unmanaged_generalized_os_image.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_custom_image_from_an_unmanaged_generalized_os_image.py deleted file mode 100644 index 005823cd447e..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_custom_image_from_an_unmanaged_generalized_os_image.py +++ /dev/null @@ -1,89 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_scale_set_create_custom_image_from_an_unmanaged_generalized_os_image.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.virtual_machine_scale_sets.begin_create_or_update( - resource_group_name="myResourceGroup", - vm_scale_set_name="{vmss-name}", - parameters={ - "location": "westus", - "properties": { - "overprovision": True, - "upgradePolicy": {"mode": "Manual"}, - "virtualMachineProfile": { - "networkProfile": { - "networkInterfaceConfigurations": [ - { - "name": "{vmss-name}", - "properties": { - "enableIPForwarding": True, - "ipConfigurations": [ - { - "name": "{vmss-name}", - "properties": { - "subnet": { - "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}" - } - }, - } - ], - "primary": True, - }, - } - ] - }, - "osProfile": { - "adminPassword": "{your-password}", - "adminUsername": "{your-username}", - "computerNamePrefix": "{vmss-name}", - }, - "storageProfile": { - "osDisk": { - "caching": "ReadWrite", - "createOption": "FromImage", - "image": { - "uri": "http://{existing-storage-account-name}.blob.core.windows.net/{existing-container-name}/{existing-generalized-os-image-blob-name}.vhd" - }, - "name": "osDisk", - } - }, - }, - }, - "sku": {"capacity": 3, "name": "Standard_D1_v2", "tier": "Standard"}, - }, - ).result() - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_CustomImageFromAnUnmanagedGeneralizedOsImage.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_from_acustom_image.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_from_acustom_image.py deleted file mode 100644 index 2805d33e482f..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_from_acustom_image.py +++ /dev/null @@ -1,89 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_scale_set_create_from_acustom_image.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.virtual_machine_scale_sets.begin_create_or_update( - resource_group_name="myResourceGroup", - vm_scale_set_name="{vmss-name}", - parameters={ - "location": "westus", - "properties": { - "overprovision": True, - "upgradePolicy": {"mode": "Manual"}, - "virtualMachineProfile": { - "networkProfile": { - "networkInterfaceConfigurations": [ - { - "name": "{vmss-name}", - "properties": { - "enableIPForwarding": True, - "ipConfigurations": [ - { - "name": "{vmss-name}", - "properties": { - "subnet": { - "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}" - } - }, - } - ], - "primary": True, - }, - } - ] - }, - "osProfile": { - "adminPassword": "{your-password}", - "adminUsername": "{your-username}", - "computerNamePrefix": "{vmss-name}", - }, - "storageProfile": { - "imageReference": { - "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/images/{existing-custom-image-name}" - }, - "osDisk": { - "caching": "ReadWrite", - "createOption": "FromImage", - "managedDisk": {"storageAccountType": "Standard_LRS"}, - }, - }, - }, - }, - "sku": {"capacity": 3, "name": "Standard_D1_v2", "tier": "Standard"}, - }, - ).result() - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_FromACustomImage.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_from_ageneralized_shared_image.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_from_ageneralized_shared_image.py deleted file mode 100644 index 330998c7336e..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_from_ageneralized_shared_image.py +++ /dev/null @@ -1,89 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_scale_set_create_from_ageneralized_shared_image.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.virtual_machine_scale_sets.begin_create_or_update( - resource_group_name="myResourceGroup", - vm_scale_set_name="{vmss-name}", - parameters={ - "location": "westus", - "properties": { - "overprovision": True, - "upgradePolicy": {"mode": "Manual"}, - "virtualMachineProfile": { - "networkProfile": { - "networkInterfaceConfigurations": [ - { - "name": "{vmss-name}", - "properties": { - "enableIPForwarding": True, - "ipConfigurations": [ - { - "name": "{vmss-name}", - "properties": { - "subnet": { - "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}" - } - }, - } - ], - "primary": True, - }, - } - ] - }, - "osProfile": { - "adminPassword": "{your-password}", - "adminUsername": "{your-username}", - "computerNamePrefix": "{vmss-name}", - }, - "storageProfile": { - "imageReference": { - "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/galleries/mySharedGallery/images/mySharedImage" - }, - "osDisk": { - "caching": "ReadWrite", - "createOption": "FromImage", - "managedDisk": {"storageAccountType": "Standard_LRS"}, - }, - }, - }, - }, - "sku": {"capacity": 3, "name": "Standard_D1_v2", "tier": "Standard"}, - }, - ).result() - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_FromAGeneralizedSharedImage.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_from_aspecialized_shared_image.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_from_aspecialized_shared_image.py deleted file mode 100644 index d7eb8d88cdc7..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_from_aspecialized_shared_image.py +++ /dev/null @@ -1,84 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_scale_set_create_from_aspecialized_shared_image.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.virtual_machine_scale_sets.begin_create_or_update( - resource_group_name="myResourceGroup", - vm_scale_set_name="{vmss-name}", - parameters={ - "location": "westus", - "properties": { - "overprovision": True, - "upgradePolicy": {"mode": "Manual"}, - "virtualMachineProfile": { - "networkProfile": { - "networkInterfaceConfigurations": [ - { - "name": "{vmss-name}", - "properties": { - "enableIPForwarding": True, - "ipConfigurations": [ - { - "name": "{vmss-name}", - "properties": { - "subnet": { - "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}" - } - }, - } - ], - "primary": True, - }, - } - ] - }, - "storageProfile": { - "imageReference": { - "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/galleries/mySharedGallery/images/mySharedImage" - }, - "osDisk": { - "caching": "ReadWrite", - "createOption": "FromImage", - "managedDisk": {"storageAccountType": "Standard_LRS"}, - }, - }, - }, - }, - "sku": {"capacity": 3, "name": "Standard_D1_v2", "tier": "Standard"}, - }, - ).result() - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_FromASpecializedSharedImage.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_from_with_disable_tcp_state_tracking_network_interface.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_from_with_disable_tcp_state_tracking_network_interface.py deleted file mode 100644 index e8c3bad90d8e..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_from_with_disable_tcp_state_tracking_network_interface.py +++ /dev/null @@ -1,112 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_scale_set_create_from_with_disable_tcp_state_tracking_network_interface.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.virtual_machine_scale_sets.begin_create_or_update( - resource_group_name="myResourceGroup", - vm_scale_set_name="{vmss-name}", - parameters={ - "location": "westus", - "properties": { - "overprovision": True, - "upgradePolicy": {"mode": "Manual"}, - "virtualMachineProfile": { - "networkProfile": { - "networkInterfaceConfigurations": [ - { - "name": "{nicConfig1-name}", - "properties": { - "disableTcpStateTracking": True, - "enableAcceleratedNetworking": True, - "enableIPForwarding": True, - "ipConfigurations": [ - { - "name": "{vmss-name}", - "properties": { - "subnet": { - "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}" - } - }, - } - ], - "primary": True, - }, - }, - { - "name": "{nicConfig2-name}", - "properties": { - "disableTcpStateTracking": False, - "enableAcceleratedNetworking": False, - "enableIPForwarding": False, - "ipConfigurations": [ - { - "name": "{nicConfig2-name}", - "properties": { - "primary": True, - "privateIPAddressVersion": "IPv4", - "subnet": { - "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-fpga-subnet-name2}" - }, - }, - } - ], - "primary": False, - }, - }, - ] - }, - "osProfile": { - "adminPassword": "{your-password}", - "adminUsername": "{your-username}", - "computerNamePrefix": "{vmss-name}", - }, - "storageProfile": { - "imageReference": { - "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/images/{existing-custom-image-name}" - }, - "osDisk": { - "caching": "ReadWrite", - "createOption": "FromImage", - "managedDisk": {"storageAccountType": "Standard_LRS"}, - }, - }, - }, - }, - "sku": {"capacity": 3, "name": "Standard_D1_v2", "tier": "Standard"}, - }, - ).result() - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_FromWithDisableTcpStateTrackingNetworkInterface.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_from_with_fpga_network_interface.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_from_with_fpga_network_interface.py deleted file mode 100644 index 6706aa399730..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_from_with_fpga_network_interface.py +++ /dev/null @@ -1,110 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_scale_set_create_from_with_fpga_network_interface.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.virtual_machine_scale_sets.begin_create_or_update( - resource_group_name="myResourceGroup", - vm_scale_set_name="{vmss-name}", - parameters={ - "location": "westus", - "properties": { - "overprovision": True, - "upgradePolicy": {"mode": "Manual"}, - "virtualMachineProfile": { - "networkProfile": { - "networkInterfaceConfigurations": [ - { - "name": "{vmss-name}", - "properties": { - "enableIPForwarding": True, - "ipConfigurations": [ - { - "name": "{vmss-name}", - "properties": { - "subnet": { - "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}" - } - }, - } - ], - "primary": True, - }, - }, - { - "name": "{fpgaNic-Name}", - "properties": { - "enableAcceleratedNetworking": False, - "enableFpga": True, - "enableIPForwarding": False, - "ipConfigurations": [ - { - "name": "{fpgaNic-Name}", - "properties": { - "primary": True, - "privateIPAddressVersion": "IPv4", - "subnet": { - "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-fpga-subnet-name}" - }, - }, - } - ], - "primary": False, - }, - }, - ] - }, - "osProfile": { - "adminPassword": "{your-password}", - "adminUsername": "{your-username}", - "computerNamePrefix": "{vmss-name}", - }, - "storageProfile": { - "imageReference": { - "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/images/{existing-custom-image-name}" - }, - "osDisk": { - "caching": "ReadWrite", - "createOption": "FromImage", - "managedDisk": {"storageAccountType": "Standard_LRS"}, - }, - }, - }, - }, - "sku": {"capacity": 3, "name": "Standard_D1_v2", "tier": "Standard"}, - }, - ).result() - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_FromWithFpgaNetworkInterface.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_from_with_network_interface_with_dns_settings.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_from_with_network_interface_with_dns_settings.py deleted file mode 100644 index 1edf6e164022..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_from_with_network_interface_with_dns_settings.py +++ /dev/null @@ -1,126 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_scale_set_create_from_with_network_interface_with_dns_settings.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.virtual_machine_scale_sets.begin_create_or_update( - resource_group_name="myResourceGroup", - vm_scale_set_name="{vmss-name}", - parameters={ - "location": "westus", - "properties": { - "overprovision": True, - "upgradePolicy": {"mode": "Manual"}, - "virtualMachineProfile": { - "networkProfile": { - "networkInterfaceConfigurations": [ - { - "name": "{nicConfig1-name}", - "properties": { - "auxiliaryMode": "AcceleratedConnections", - "auxiliarySku": "A1", - "disableTcpStateTracking": True, - "enableAcceleratedNetworking": True, - "enableIPForwarding": True, - "ipConfigurations": [ - { - "name": "{vmss-name}", - "properties": { - "subnet": { - "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}" - } - }, - } - ], - "primary": True, - }, - "tags": {"nicTag": "tag"}, - }, - { - "name": "{nicConfig2-name}", - "properties": { - "disableTcpStateTracking": False, - "enableAcceleratedNetworking": False, - "enableIPForwarding": False, - "ipConfigurations": [ - { - "name": "{nicConfig2-name}", - "properties": { - "primary": True, - "privateIPAddressVersion": "IPv4", - "publicIPAddressConfiguration": { - "name": "publicip", - "properties": { - "dnsSettings": { - "domainNameLabel": "vmsstestlabel01", - "domainNameLabelScope": "NoReuse", - }, - "idleTimeoutInMinutes": 10, - }, - "tags": {"pipTag": "tag"}, - }, - "subnet": { - "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-fpga-subnet-name2}" - }, - }, - } - ], - "primary": False, - }, - }, - ] - }, - "osProfile": { - "adminPassword": "{your-password}", - "adminUsername": "{your-username}", - "computerNamePrefix": "{vmss-name}", - }, - "storageProfile": { - "imageReference": { - "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/images/{existing-custom-image-name}" - }, - "osDisk": { - "caching": "ReadWrite", - "createOption": "FromImage", - "managedDisk": {"storageAccountType": "Standard_LRS"}, - }, - }, - }, - }, - "sku": {"capacity": 3, "name": "Standard_D1_v2", "tier": "Standard"}, - }, - ).result() - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_FromWithNetworkInterfaceWithDnsSettings.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_platform_image_with_unmanaged_os_disks.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_platform_image_with_unmanaged_os_disks.py deleted file mode 100644 index c1c4ab41b1a8..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_platform_image_with_unmanaged_os_disks.py +++ /dev/null @@ -1,99 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_scale_set_create_platform_image_with_unmanaged_os_disks.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.virtual_machine_scale_sets.begin_create_or_update( - resource_group_name="myResourceGroup", - vm_scale_set_name="{vmss-name}", - parameters={ - "location": "westus", - "properties": { - "overprovision": True, - "upgradePolicy": {"mode": "Manual"}, - "virtualMachineProfile": { - "networkProfile": { - "networkInterfaceConfigurations": [ - { - "name": "{vmss-name}", - "properties": { - "enableIPForwarding": True, - "ipConfigurations": [ - { - "name": "{vmss-name}", - "properties": { - "subnet": { - "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}" - } - }, - } - ], - "primary": True, - }, - } - ] - }, - "osProfile": { - "adminPassword": "{your-password}", - "adminUsername": "{your-username}", - "computerNamePrefix": "{vmss-name}", - }, - "storageProfile": { - "imageReference": { - "offer": "WindowsServer", - "publisher": "MicrosoftWindowsServer", - "sku": "2016-Datacenter", - "version": "latest", - }, - "osDisk": { - "caching": "ReadWrite", - "createOption": "FromImage", - "name": "osDisk", - "vhdContainers": [ - "http://{existing-storage-account-name-0}.blob.core.windows.net/vhdContainer", - "http://{existing-storage-account-name-1}.blob.core.windows.net/vhdContainer", - "http://{existing-storage-account-name-2}.blob.core.windows.net/vhdContainer", - "http://{existing-storage-account-name-3}.blob.core.windows.net/vhdContainer", - "http://{existing-storage-account-name-4}.blob.core.windows.net/vhdContainer", - ], - }, - }, - }, - }, - "sku": {"capacity": 3, "name": "Standard_D1_v2", "tier": "Standard"}, - }, - ).result() - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_PlatformImageWithUnmanagedOsDisks.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_amarketplace_image_plan.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_amarketplace_image_plan.py deleted file mode 100644 index 67186abaefdb..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_amarketplace_image_plan.py +++ /dev/null @@ -1,93 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_scale_set_create_with_amarketplace_image_plan.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.virtual_machine_scale_sets.begin_create_or_update( - resource_group_name="myResourceGroup", - vm_scale_set_name="{vmss-name}", - parameters={ - "location": "westus", - "plan": {"name": "windows2016", "product": "windows-data-science-vm", "publisher": "microsoft-ads"}, - "properties": { - "overprovision": True, - "upgradePolicy": {"mode": "Manual"}, - "virtualMachineProfile": { - "networkProfile": { - "networkInterfaceConfigurations": [ - { - "name": "{vmss-name}", - "properties": { - "enableIPForwarding": True, - "ipConfigurations": [ - { - "name": "{vmss-name}", - "properties": { - "subnet": { - "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}" - } - }, - } - ], - "primary": True, - }, - } - ] - }, - "osProfile": { - "adminPassword": "{your-password}", - "adminUsername": "{your-username}", - "computerNamePrefix": "{vmss-name}", - }, - "storageProfile": { - "imageReference": { - "offer": "windows-data-science-vm", - "publisher": "microsoft-ads", - "sku": "windows2016", - "version": "latest", - }, - "osDisk": { - "caching": "ReadWrite", - "createOption": "FromImage", - "managedDisk": {"storageAccountType": "Standard_LRS"}, - }, - }, - }, - }, - "sku": {"capacity": 3, "name": "Standard_D1_v2", "tier": "Standard"}, - }, - ).result() - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithAMarketplaceImagePlan.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_application_profile.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_application_profile.py deleted file mode 100644 index f85c2136630c..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_application_profile.py +++ /dev/null @@ -1,107 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_scale_set_create_with_application_profile.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.virtual_machine_scale_sets.begin_create_or_update( - resource_group_name="myResourceGroup", - vm_scale_set_name="{vmss-name}", - parameters={ - "location": "westus", - "properties": { - "overprovision": True, - "upgradePolicy": {"mode": "Manual"}, - "virtualMachineProfile": { - "applicationProfile": { - "galleryApplications": [ - { - "configurationReference": "https://mystorageaccount.blob.core.windows.net/configurations/settings.config", - "enableAutomaticUpgrade": False, - "order": 1, - "packageReferenceId": "/subscriptions/32c17a9e-aa7b-4ba5-a45b-e324116b6fdb/resourceGroups/myresourceGroupName2/providers/Microsoft.Compute/galleries/myGallery1/applications/MyApplication1/versions/1.0", - "tags": "myTag1", - "treatFailureAsDeploymentFailure": True, - }, - { - "packageReferenceId": "/subscriptions/32c17a9e-aa7b-4ba5-a45b-e324116b6fdg/resourceGroups/myresourceGroupName3/providers/Microsoft.Compute/galleries/myGallery2/applications/MyApplication2/versions/1.1" - }, - ] - }, - "networkProfile": { - "networkInterfaceConfigurations": [ - { - "name": "{vmss-name}", - "properties": { - "enableIPForwarding": True, - "ipConfigurations": [ - { - "name": "{vmss-name}", - "properties": { - "subnet": { - "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}" - } - }, - } - ], - "primary": True, - }, - } - ] - }, - "osProfile": { - "adminPassword": "{your-password}", - "adminUsername": "{your-username}", - "computerNamePrefix": "{vmss-name}", - }, - "storageProfile": { - "imageReference": { - "offer": "WindowsServer", - "publisher": "MicrosoftWindowsServer", - "sku": "2016-Datacenter", - "version": "latest", - }, - "osDisk": { - "caching": "ReadWrite", - "createOption": "FromImage", - "managedDisk": {"storageAccountType": "Standard_LRS"}, - }, - }, - }, - }, - "sku": {"capacity": 3, "name": "Standard_D1_v2", "tier": "Standard"}, - }, - ).result() - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithApplicationProfile.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_automatic_repairs.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_automatic_repairs.py deleted file mode 100644 index fe8994211226..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_automatic_repairs.py +++ /dev/null @@ -1,101 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_scale_set_create_with_automatic_repairs.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.virtual_machine_scale_sets.begin_create_or_update( - resource_group_name="myResourceGroup", - vm_scale_set_name="{vmss-name}", - parameters={ - "location": "westus", - "properties": { - "automaticRepairsPolicy": {"enabled": True, "gracePeriod": "PT10M"}, - "overprovision": True, - "scheduledEventsPolicy": { - "allInstancesDown": {"automaticallyApprove": True}, - "scheduledEventsAdditionalPublishingTargets": { - "eventGridAndResourceGraph": {"enable": True, "scheduledEventsApiVersion": "2020-07-01"} - }, - "userInitiatedReboot": {"automaticallyApprove": True}, - "userInitiatedRedeploy": {"automaticallyApprove": True}, - }, - "upgradePolicy": {"mode": "Manual"}, - "virtualMachineProfile": { - "networkProfile": { - "networkInterfaceConfigurations": [ - { - "name": "{vmss-name}", - "properties": { - "enableIPForwarding": True, - "ipConfigurations": [ - { - "name": "{vmss-name}", - "properties": { - "subnet": { - "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}" - } - }, - } - ], - "primary": True, - }, - } - ] - }, - "osProfile": { - "adminPassword": "{your-password}", - "adminUsername": "{your-username}", - "computerNamePrefix": "{vmss-name}", - }, - "storageProfile": { - "imageReference": { - "offer": "WindowsServer", - "publisher": "MicrosoftWindowsServer", - "sku": "2016-Datacenter", - "version": "latest", - }, - "osDisk": { - "caching": "ReadWrite", - "createOption": "FromImage", - "managedDisk": {"storageAccountType": "Standard_LRS"}, - }, - }, - }, - }, - "sku": {"capacity": 3, "name": "Standard_D1_v2", "tier": "Standard"}, - }, - ).result() - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithAutomaticRepairs.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_automatic_zone_rebalancing_policy.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_automatic_zone_rebalancing_policy.py deleted file mode 100644 index f45f27347300..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_automatic_zone_rebalancing_policy.py +++ /dev/null @@ -1,99 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_scale_set_create_with_automatic_zone_rebalancing_policy.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.virtual_machine_scale_sets.begin_create_or_update( - resource_group_name="myResourceGroup", - vm_scale_set_name="{vmss-name}", - parameters={ - "location": "westus", - "properties": { - "overprovision": False, - "resiliencyPolicy": { - "automaticZoneRebalancingPolicy": { - "enabled": True, - "rebalanceBehavior": "CreateBeforeDelete", - "rebalanceStrategy": "Recreate", - } - }, - "upgradePolicy": {"mode": "Manual"}, - "virtualMachineProfile": { - "networkProfile": { - "networkInterfaceConfigurations": [ - { - "name": "{vmss-name}", - "properties": { - "enableIPForwarding": True, - "ipConfigurations": [ - { - "name": "{vmss-name}", - "properties": { - "subnet": { - "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}" - } - }, - } - ], - "primary": True, - }, - } - ] - }, - "osProfile": { - "adminPassword": "{your-password}", - "adminUsername": "{your-username}", - "computerNamePrefix": "{vmss-name}", - }, - "storageProfile": { - "imageReference": { - "offer": "WindowsServer", - "publisher": "MicrosoftWindowsServer", - "sku": "2016-Datacenter", - "version": "latest", - }, - "osDisk": { - "caching": "ReadWrite", - "createOption": "FromImage", - "managedDisk": {"storageAccountType": "Standard_LRS"}, - }, - }, - }, - }, - "sku": {"capacity": 3, "name": "Standard_D1_v2", "tier": "Standard"}, - }, - ).result() - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithAutomaticZoneRebalancingPolicy.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_azure_application_gateway.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_azure_application_gateway.py deleted file mode 100644 index 2ac2ea0bedf7..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_azure_application_gateway.py +++ /dev/null @@ -1,97 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_scale_set_create_with_azure_application_gateway.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.virtual_machine_scale_sets.begin_create_or_update( - resource_group_name="myResourceGroup", - vm_scale_set_name="{vmss-name}", - parameters={ - "location": "westus", - "properties": { - "overprovision": True, - "upgradePolicy": {"mode": "Manual"}, - "virtualMachineProfile": { - "networkProfile": { - "networkInterfaceConfigurations": [ - { - "name": "{vmss-name}", - "properties": { - "enableIPForwarding": True, - "ipConfigurations": [ - { - "name": "{vmss-name}", - "properties": { - "applicationGatewayBackendAddressPools": [ - { - "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/applicationGateways/{existing-application-gateway-name}/backendAddressPools/{existing-backend-address-pool-name}" - } - ], - "subnet": { - "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}" - }, - }, - } - ], - "primary": True, - }, - } - ] - }, - "osProfile": { - "adminPassword": "{your-password}", - "adminUsername": "{your-username}", - "computerNamePrefix": "{vmss-name}", - }, - "storageProfile": { - "imageReference": { - "offer": "WindowsServer", - "publisher": "MicrosoftWindowsServer", - "sku": "2016-Datacenter", - "version": "latest", - }, - "osDisk": { - "caching": "ReadWrite", - "createOption": "FromImage", - "managedDisk": {"storageAccountType": "Standard_LRS"}, - }, - }, - }, - }, - "sku": {"capacity": 3, "name": "Standard_D1_v2", "tier": "Standard"}, - }, - ).result() - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithAzureApplicationGateway.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_azure_load_balancer.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_azure_load_balancer.py deleted file mode 100644 index c1728858794f..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_azure_load_balancer.py +++ /dev/null @@ -1,106 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_scale_set_create_with_azure_load_balancer.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.virtual_machine_scale_sets.begin_create_or_update( - resource_group_name="myResourceGroup", - vm_scale_set_name="{vmss-name}", - parameters={ - "location": "westus", - "properties": { - "overprovision": True, - "upgradePolicy": {"mode": "Manual"}, - "virtualMachineProfile": { - "networkProfile": { - "networkInterfaceConfigurations": [ - { - "name": "{vmss-name}", - "properties": { - "enableIPForwarding": True, - "ipConfigurations": [ - { - "name": "{vmss-name}", - "properties": { - "loadBalancerBackendAddressPools": [ - { - "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/loadBalancers/{existing-load-balancer-name}/backendAddressPools/{existing-backend-address-pool-name}" - } - ], - "loadBalancerInboundNatPools": [ - { - "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/loadBalancers/{existing-load-balancer-name}/inboundNatPools/{existing-nat-pool-name}" - } - ], - "publicIPAddressConfiguration": { - "name": "{vmss-name}", - "properties": {"publicIPAddressVersion": "IPv4"}, - }, - "subnet": { - "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}" - }, - }, - } - ], - "primary": True, - }, - } - ] - }, - "osProfile": { - "adminPassword": "{your-password}", - "adminUsername": "{your-username}", - "computerNamePrefix": "{vmss-name}", - }, - "storageProfile": { - "imageReference": { - "offer": "WindowsServer", - "publisher": "MicrosoftWindowsServer", - "sku": "2016-Datacenter", - "version": "latest", - }, - "osDisk": { - "caching": "ReadWrite", - "createOption": "FromImage", - "managedDisk": {"storageAccountType": "Standard_LRS"}, - }, - }, - }, - }, - "sku": {"capacity": 3, "name": "Standard_D1_v2", "tier": "Standard"}, - }, - ).result() - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithAzureLoadBalancer.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_boot_diagnostics.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_boot_diagnostics.py deleted file mode 100644 index e5e15a204671..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_boot_diagnostics.py +++ /dev/null @@ -1,98 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_scale_set_create_with_boot_diagnostics.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.virtual_machine_scale_sets.begin_create_or_update( - resource_group_name="myResourceGroup", - vm_scale_set_name="{vmss-name}", - parameters={ - "location": "westus", - "properties": { - "overprovision": True, - "upgradePolicy": {"mode": "Manual"}, - "virtualMachineProfile": { - "diagnosticsProfile": { - "bootDiagnostics": { - "enabled": True, - "storageUri": "http://{existing-storage-account-name}.blob.core.windows.net", - } - }, - "networkProfile": { - "networkInterfaceConfigurations": [ - { - "name": "{vmss-name}", - "properties": { - "enableIPForwarding": True, - "ipConfigurations": [ - { - "name": "{vmss-name}", - "properties": { - "subnet": { - "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}" - } - }, - } - ], - "primary": True, - }, - } - ] - }, - "osProfile": { - "adminPassword": "{your-password}", - "adminUsername": "{your-username}", - "computerNamePrefix": "{vmss-name}", - }, - "storageProfile": { - "imageReference": { - "offer": "WindowsServer", - "publisher": "MicrosoftWindowsServer", - "sku": "2016-Datacenter", - "version": "latest", - }, - "osDisk": { - "caching": "ReadWrite", - "createOption": "FromImage", - "managedDisk": {"storageAccountType": "Standard_LRS"}, - }, - }, - }, - }, - "sku": {"capacity": 3, "name": "Standard_D1_v2", "tier": "Standard"}, - }, - ).result() - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithBootDiagnostics.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_capacity_reservation.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_capacity_reservation.py deleted file mode 100644 index fe66c3a26236..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_capacity_reservation.py +++ /dev/null @@ -1,97 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_scale_set_create_with_capacity_reservation.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.virtual_machine_scale_sets.begin_create_or_update( - resource_group_name="myResourceGroup", - vm_scale_set_name="{vmss-name}", - parameters={ - "location": "westus", - "properties": { - "overprovision": True, - "upgradePolicy": {"mode": "Manual"}, - "virtualMachineProfile": { - "capacityReservation": { - "capacityReservationGroup": { - "id": "subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/CapacityReservationGroups/{crgName}" - } - }, - "networkProfile": { - "networkInterfaceConfigurations": [ - { - "name": "{vmss-name}", - "properties": { - "enableIPForwarding": True, - "ipConfigurations": [ - { - "name": "{vmss-name}", - "properties": { - "subnet": { - "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}" - } - }, - } - ], - "primary": True, - }, - } - ] - }, - "osProfile": { - "adminPassword": "{your-password}", - "adminUsername": "{your-username}", - "computerNamePrefix": "{vmss-name}", - }, - "storageProfile": { - "imageReference": { - "offer": "WindowsServer", - "publisher": "MicrosoftWindowsServer", - "sku": "2016-Datacenter", - "version": "latest", - }, - "osDisk": { - "caching": "ReadWrite", - "createOption": "FromImage", - "managedDisk": {"storageAccountType": "Standard_LRS"}, - }, - }, - }, - }, - "sku": {"capacity": 3, "name": "Standard_DS1_v2", "tier": "Standard"}, - }, - ).result() - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithCapacityReservation.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_diff_os_disk.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_diff_os_disk.py deleted file mode 100644 index 38e62af62c62..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_diff_os_disk.py +++ /dev/null @@ -1,94 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_scale_set_create_with_diff_os_disk.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.virtual_machine_scale_sets.begin_create_or_update( - resource_group_name="myResourceGroup", - vm_scale_set_name="{vmss-name}", - parameters={ - "location": "westus", - "plan": {"name": "windows2016", "product": "windows-data-science-vm", "publisher": "microsoft-ads"}, - "properties": { - "overprovision": True, - "upgradePolicy": {"mode": "Manual"}, - "virtualMachineProfile": { - "networkProfile": { - "networkInterfaceConfigurations": [ - { - "name": "{vmss-name}", - "properties": { - "enableIPForwarding": True, - "ipConfigurations": [ - { - "name": "{vmss-name}", - "properties": { - "subnet": { - "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}" - } - }, - } - ], - "primary": True, - }, - } - ] - }, - "osProfile": { - "adminPassword": "{your-password}", - "adminUsername": "{your-username}", - "computerNamePrefix": "{vmss-name}", - }, - "storageProfile": { - "imageReference": { - "offer": "windows-data-science-vm", - "publisher": "microsoft-ads", - "sku": "windows2016", - "version": "latest", - }, - "osDisk": { - "caching": "ReadOnly", - "createOption": "FromImage", - "diffDiskSettings": {"option": "Local"}, - "managedDisk": {"storageAccountType": "Standard_LRS"}, - }, - }, - }, - }, - "sku": {"capacity": 3, "name": "Standard_DS1_v2", "tier": "Standard"}, - }, - ).result() - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithDiffOsDisk.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_disk_controller_type.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_disk_controller_type.py deleted file mode 100644 index 37d6553c2336..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_disk_controller_type.py +++ /dev/null @@ -1,103 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_scale_set_create_with_disk_controller_type.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.virtual_machine_scale_sets.begin_create_or_update( - resource_group_name="myResourceGroup", - vm_scale_set_name="{vmss-name}", - parameters={ - "location": "westus", - "properties": { - "overprovision": True, - "scheduledEventsPolicy": { - "allInstancesDown": {"automaticallyApprove": True}, - "scheduledEventsAdditionalPublishingTargets": { - "eventGridAndResourceGraph": {"enable": True, "scheduledEventsApiVersion": "2020-07-01"} - }, - "userInitiatedReboot": {"automaticallyApprove": True}, - "userInitiatedRedeploy": {"automaticallyApprove": True}, - }, - "upgradePolicy": {"mode": "Manual"}, - "virtualMachineProfile": { - "hardwareProfile": {"vmSizeProperties": {"vCPUsAvailable": 1, "vCPUsPerCore": 1}}, - "networkProfile": { - "networkInterfaceConfigurations": [ - { - "name": "{vmss-name}", - "properties": { - "enableIPForwarding": True, - "ipConfigurations": [ - { - "name": "{vmss-name}", - "properties": { - "subnet": { - "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}" - } - }, - } - ], - "primary": True, - }, - } - ] - }, - "osProfile": { - "adminPassword": "{your-password}", - "adminUsername": "{your-username}", - "computerNamePrefix": "{vmss-name}", - }, - "storageProfile": { - "diskControllerType": "NVMe", - "imageReference": { - "offer": "WindowsServer", - "publisher": "MicrosoftWindowsServer", - "sku": "2016-Datacenter", - "version": "latest", - }, - "osDisk": { - "caching": "ReadWrite", - "createOption": "FromImage", - "managedDisk": {"storageAccountType": "Standard_LRS"}, - }, - }, - "userData": "RXhhbXBsZSBVc2VyRGF0YQ==", - }, - }, - "sku": {"capacity": 3, "name": "Standard_D1_v2", "tier": "Standard"}, - }, - ).result() - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithDiskControllerType.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_disk_encryption_set_resource.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_disk_encryption_set_resource.py deleted file mode 100644 index 7dee4be6c458..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_disk_encryption_set_resource.py +++ /dev/null @@ -1,108 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_scale_set_create_with_disk_encryption_set_resource.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.virtual_machine_scale_sets.begin_create_or_update( - resource_group_name="myResourceGroup", - vm_scale_set_name="{vmss-name}", - parameters={ - "location": "westus", - "properties": { - "overprovision": True, - "upgradePolicy": {"mode": "Manual"}, - "virtualMachineProfile": { - "networkProfile": { - "networkInterfaceConfigurations": [ - { - "name": "{vmss-name}", - "properties": { - "enableIPForwarding": True, - "ipConfigurations": [ - { - "name": "{vmss-name}", - "properties": { - "subnet": { - "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}" - } - }, - } - ], - "primary": True, - }, - } - ] - }, - "osProfile": { - "adminPassword": "{your-password}", - "adminUsername": "{your-username}", - "computerNamePrefix": "{vmss-name}", - }, - "storageProfile": { - "dataDisks": [ - { - "caching": "ReadWrite", - "createOption": "Empty", - "diskSizeGB": 1023, - "lun": 0, - "managedDisk": { - "diskEncryptionSet": { - "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSets/{existing-diskEncryptionSet-name}" - }, - "storageAccountType": "Standard_LRS", - }, - } - ], - "imageReference": { - "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/images/{existing-custom-image-name}" - }, - "osDisk": { - "caching": "ReadWrite", - "createOption": "FromImage", - "managedDisk": { - "diskEncryptionSet": { - "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSets/{existing-diskEncryptionSet-name}" - }, - "storageAccountType": "Standard_LRS", - }, - }, - }, - }, - }, - "sku": {"capacity": 3, "name": "Standard_DS1_v2", "tier": "Standard"}, - }, - ).result() - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithDiskEncryptionSetResource.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_empty_data_disks_on_each_vm.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_empty_data_disks_on_each_vm.py deleted file mode 100644 index 6ab5b961e492..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_empty_data_disks_on_each_vm.py +++ /dev/null @@ -1,97 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_scale_set_create_with_empty_data_disks_on_each_vm.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.virtual_machine_scale_sets.begin_create_or_update( - resource_group_name="myResourceGroup", - vm_scale_set_name="{vmss-name}", - parameters={ - "location": "westus", - "properties": { - "overprovision": True, - "upgradePolicy": {"mode": "Manual"}, - "virtualMachineProfile": { - "networkProfile": { - "networkInterfaceConfigurations": [ - { - "name": "{vmss-name}", - "properties": { - "enableIPForwarding": True, - "ipConfigurations": [ - { - "name": "{vmss-name}", - "properties": { - "subnet": { - "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}" - } - }, - } - ], - "primary": True, - }, - } - ] - }, - "osProfile": { - "adminPassword": "{your-password}", - "adminUsername": "{your-username}", - "computerNamePrefix": "{vmss-name}", - }, - "storageProfile": { - "dataDisks": [ - {"createOption": "Empty", "diskSizeGB": 1023, "lun": 0}, - {"createOption": "Empty", "diskSizeGB": 1023, "lun": 1}, - ], - "imageReference": { - "offer": "WindowsServer", - "publisher": "MicrosoftWindowsServer", - "sku": "2016-Datacenter", - "version": "latest", - }, - "osDisk": { - "caching": "ReadWrite", - "createOption": "FromImage", - "diskSizeGB": 512, - "managedDisk": {"storageAccountType": "Standard_LRS"}, - }, - }, - }, - }, - "sku": {"capacity": 3, "name": "Standard_D2_v2", "tier": "Standard"}, - }, - ).result() - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithEmptyDataDisksOnEachVm.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_encryption_at_host.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_encryption_at_host.py deleted file mode 100644 index fa397e929396..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_encryption_at_host.py +++ /dev/null @@ -1,94 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_scale_set_create_with_encryption_at_host.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.virtual_machine_scale_sets.begin_create_or_update( - resource_group_name="myResourceGroup", - vm_scale_set_name="{vmss-name}", - parameters={ - "location": "westus", - "plan": {"name": "windows2016", "product": "windows-data-science-vm", "publisher": "microsoft-ads"}, - "properties": { - "overprovision": True, - "upgradePolicy": {"mode": "Manual"}, - "virtualMachineProfile": { - "networkProfile": { - "networkInterfaceConfigurations": [ - { - "name": "{vmss-name}", - "properties": { - "enableIPForwarding": True, - "ipConfigurations": [ - { - "name": "{vmss-name}", - "properties": { - "subnet": { - "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}" - } - }, - } - ], - "primary": True, - }, - } - ] - }, - "osProfile": { - "adminPassword": "{your-password}", - "adminUsername": "{your-username}", - "computerNamePrefix": "{vmss-name}", - }, - "securityProfile": {"encryptionAtHost": True}, - "storageProfile": { - "imageReference": { - "offer": "windows-data-science-vm", - "publisher": "microsoft-ads", - "sku": "windows2016", - "version": "latest", - }, - "osDisk": { - "caching": "ReadOnly", - "createOption": "FromImage", - "managedDisk": {"storageAccountType": "Standard_LRS"}, - }, - }, - }, - }, - "sku": {"capacity": 3, "name": "Standard_DS1_v2", "tier": "Standard"}, - }, - ).result() - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithEncryptionAtHost.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_extensions_suppress_failures_enabled.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_extensions_suppress_failures_enabled.py deleted file mode 100644 index 919528881af8..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_extensions_suppress_failures_enabled.py +++ /dev/null @@ -1,113 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_scale_set_create_with_extensions_suppress_failures_enabled.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.virtual_machine_scale_sets.begin_create_or_update( - resource_group_name="myResourceGroup", - vm_scale_set_name="{vmss-name}", - parameters={ - "location": "westus", - "properties": { - "overprovision": True, - "upgradePolicy": {"mode": "Manual"}, - "virtualMachineProfile": { - "diagnosticsProfile": { - "bootDiagnostics": { - "enabled": True, - "storageUri": "http://{existing-storage-account-name}.blob.core.windows.net", - } - }, - "extensionProfile": { - "extensions": [ - { - "name": "{extension-name}", - "properties": { - "autoUpgradeMinorVersion": False, - "publisher": "{extension-Publisher}", - "settings": {}, - "suppressFailures": True, - "type": "{extension-Type}", - "typeHandlerVersion": "{handler-version}", - }, - } - ] - }, - "networkProfile": { - "networkInterfaceConfigurations": [ - { - "name": "{vmss-name}", - "properties": { - "enableIPForwarding": True, - "ipConfigurations": [ - { - "name": "{vmss-name}", - "properties": { - "subnet": { - "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}" - } - }, - } - ], - "primary": True, - }, - } - ] - }, - "osProfile": { - "adminPassword": "{your-password}", - "adminUsername": "{your-username}", - "computerNamePrefix": "{vmss-name}", - }, - "storageProfile": { - "imageReference": { - "offer": "WindowsServer", - "publisher": "MicrosoftWindowsServer", - "sku": "2016-Datacenter", - "version": "latest", - }, - "osDisk": { - "caching": "ReadWrite", - "createOption": "FromImage", - "managedDisk": {"storageAccountType": "Standard_LRS"}, - }, - }, - }, - }, - "sku": {"capacity": 3, "name": "Standard_D1_v2", "tier": "Standard"}, - }, - ).result() - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithExtensionsSuppressFailuresEnabled.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_extensions_time_budget.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_extensions_time_budget.py deleted file mode 100644 index d73ea455685f..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_extensions_time_budget.py +++ /dev/null @@ -1,113 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_scale_set_create_with_extensions_time_budget.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.virtual_machine_scale_sets.begin_create_or_update( - resource_group_name="myResourceGroup", - vm_scale_set_name="{vmss-name}", - parameters={ - "location": "westus", - "properties": { - "overprovision": True, - "upgradePolicy": {"mode": "Manual"}, - "virtualMachineProfile": { - "diagnosticsProfile": { - "bootDiagnostics": { - "enabled": True, - "storageUri": "http://{existing-storage-account-name}.blob.core.windows.net", - } - }, - "extensionProfile": { - "extensions": [ - { - "name": "{extension-name}", - "properties": { - "autoUpgradeMinorVersion": False, - "publisher": "{extension-Publisher}", - "settings": {}, - "type": "{extension-Type}", - "typeHandlerVersion": "{handler-version}", - }, - } - ], - "extensionsTimeBudget": "PT1H20M", - }, - "networkProfile": { - "networkInterfaceConfigurations": [ - { - "name": "{vmss-name}", - "properties": { - "enableIPForwarding": True, - "ipConfigurations": [ - { - "name": "{vmss-name}", - "properties": { - "subnet": { - "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}" - } - }, - } - ], - "primary": True, - }, - } - ] - }, - "osProfile": { - "adminPassword": "{your-password}", - "adminUsername": "{your-username}", - "computerNamePrefix": "{vmss-name}", - }, - "storageProfile": { - "imageReference": { - "offer": "WindowsServer", - "publisher": "MicrosoftWindowsServer", - "sku": "2016-Datacenter", - "version": "latest", - }, - "osDisk": { - "caching": "ReadWrite", - "createOption": "FromImage", - "managedDisk": {"storageAccountType": "Standard_LRS"}, - }, - }, - }, - }, - "sku": {"capacity": 3, "name": "Standard_D1_v2", "tier": "Standard"}, - }, - ).result() - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithExtensionsTimeBudget.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_high_speed_interconnect_placement.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_high_speed_interconnect_placement.py deleted file mode 100644 index 21975715f0e3..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_high_speed_interconnect_placement.py +++ /dev/null @@ -1,102 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_scale_set_create_with_high_speed_interconnect_placement.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.virtual_machine_scale_sets.begin_create_or_update( - resource_group_name="myResourceGroup", - vm_scale_set_name="{vmss-name}", - parameters={ - "location": "westus", - "properties": { - "highSpeedInterconnectPlacement": "None", - "orchestrationMode": "Flexible", - "platformFaultDomainCount": 1, - "virtualMachineProfile": { - "networkProfile": { - "networkApiVersion": "2020-11-01", - "networkInterfaceConfigurations": [ - { - "name": "{vmss-name}", - "properties": { - "enableAcceleratedNetworking": False, - "enableIPForwarding": True, - "ipConfigurations": [ - { - "name": "{vmss-name}", - "properties": { - "applicationGatewayBackendAddressPools": [], - "loadBalancerBackendAddressPools": [], - "primary": True, - "publicIPAddressConfiguration": { - "name": "{vmss-name}", - "properties": {"idleTimeoutInMinutes": 15}, - }, - "subnet": { - "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}" - }, - }, - } - ], - "primary": True, - }, - } - ], - }, - "osProfile": { - "adminPassword": "{your-password}", - "adminUsername": "{your-username}", - "computerNamePrefix": "{vmss-name}", - }, - "storageProfile": { - "imageReference": { - "offer": "0001-com-ubuntu-server-focal", - "publisher": "Canonical", - "sku": "20_04-lts-gen2", - "version": "latest", - }, - "osDisk": { - "caching": "ReadWrite", - "createOption": "FromImage", - "managedDisk": {"storageAccountType": "Standard_LRS"}, - }, - }, - }, - }, - "sku": {"capacity": 2, "name": "Standard_D1_v2", "tier": "Standard"}, - }, - ).result() - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithHighSpeedInterconnectPlacement.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_managed_boot_diagnostics.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_managed_boot_diagnostics.py deleted file mode 100644 index 9bd4c89bb675..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_managed_boot_diagnostics.py +++ /dev/null @@ -1,93 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_scale_set_create_with_managed_boot_diagnostics.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.virtual_machine_scale_sets.begin_create_or_update( - resource_group_name="myResourceGroup", - vm_scale_set_name="{vmss-name}", - parameters={ - "location": "westus", - "properties": { - "overprovision": True, - "upgradePolicy": {"mode": "Manual"}, - "virtualMachineProfile": { - "diagnosticsProfile": {"bootDiagnostics": {"enabled": True}}, - "networkProfile": { - "networkInterfaceConfigurations": [ - { - "name": "{vmss-name}", - "properties": { - "enableIPForwarding": True, - "ipConfigurations": [ - { - "name": "{vmss-name}", - "properties": { - "subnet": { - "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}" - } - }, - } - ], - "primary": True, - }, - } - ] - }, - "osProfile": { - "adminPassword": "{your-password}", - "adminUsername": "{your-username}", - "computerNamePrefix": "{vmss-name}", - }, - "storageProfile": { - "imageReference": { - "offer": "WindowsServer", - "publisher": "MicrosoftWindowsServer", - "sku": "2016-Datacenter", - "version": "latest", - }, - "osDisk": { - "caching": "ReadWrite", - "createOption": "FromImage", - "managedDisk": {"storageAccountType": "Standard_LRS"}, - }, - }, - }, - }, - "sku": {"capacity": 3, "name": "Standard_D1_v2", "tier": "Standard"}, - }, - ).result() - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithManagedBootDiagnostics.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_max_instance_percent_per_zone_policy.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_max_instance_percent_per_zone_policy.py deleted file mode 100644 index 0ee83cf936f8..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_max_instance_percent_per_zone_policy.py +++ /dev/null @@ -1,95 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_scale_set_create_with_max_instance_percent_per_zone_policy.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.virtual_machine_scale_sets.begin_create_or_update( - resource_group_name="myResourceGroup", - vm_scale_set_name="{vmss-name}", - parameters={ - "location": "westus", - "properties": { - "overprovision": False, - "resiliencyPolicy": { - "zoneAllocationPolicy": {"maxInstancePercentPerZonePolicy": {"enabled": True, "value": 50}} - }, - "upgradePolicy": {"mode": "Manual"}, - "virtualMachineProfile": { - "networkProfile": { - "networkInterfaceConfigurations": [ - { - "name": "{vmss-name}", - "properties": { - "enableIPForwarding": True, - "ipConfigurations": [ - { - "name": "{vmss-name}", - "properties": { - "subnet": { - "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}" - } - }, - } - ], - "primary": True, - }, - } - ] - }, - "osProfile": { - "adminPassword": "{your-password}", - "adminUsername": "{your-username}", - "computerNamePrefix": "{vmss-name}", - }, - "storageProfile": { - "imageReference": { - "offer": "WindowsServer", - "publisher": "MicrosoftWindowsServer", - "sku": "2016-Datacenter", - "version": "latest", - }, - "osDisk": { - "caching": "ReadWrite", - "createOption": "FromImage", - "managedDisk": {"storageAccountType": "Standard_LRS"}, - }, - }, - }, - }, - "sku": {"capacity": 3, "name": "Standard_D1_v2", "tier": "Standard"}, - }, - ).result() - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithMaxInstancePercentPerZonePolicy.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_max_zone_count.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_max_zone_count.py deleted file mode 100644 index 27bdf81830fa..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_max_zone_count.py +++ /dev/null @@ -1,94 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_scale_set_create_with_max_zone_count.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.virtual_machine_scale_sets.begin_create_or_update( - resource_group_name="myResourceGroup", - vm_scale_set_name="{vmss-name}", - parameters={ - "location": "westus", - "placement": {"zonePlacementPolicy": "Auto"}, - "properties": { - "overprovision": False, - "resiliencyPolicy": {"zoneAllocationPolicy": {"maxZoneCount": 2}}, - "upgradePolicy": {"mode": "Manual"}, - "virtualMachineProfile": { - "networkProfile": { - "networkInterfaceConfigurations": [ - { - "name": "{vmss-name}", - "properties": { - "enableIPForwarding": True, - "ipConfigurations": [ - { - "name": "{vmss-name}", - "properties": { - "subnet": { - "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}" - } - }, - } - ], - "primary": True, - }, - } - ] - }, - "osProfile": { - "adminPassword": "{your-password}", - "adminUsername": "{your-username}", - "computerNamePrefix": "{vmss-name}", - }, - "storageProfile": { - "imageReference": { - "offer": "WindowsServer", - "publisher": "MicrosoftWindowsServer", - "sku": "2016-Datacenter", - "version": "latest", - }, - "osDisk": { - "caching": "ReadWrite", - "createOption": "FromImage", - "managedDisk": {"storageAccountType": "Standard_LRS"}, - }, - }, - }, - }, - "sku": {"capacity": 3, "name": "Standard_D1_v2", "tier": "Standard"}, - }, - ).result() - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithMaxZoneCount.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_os_image_scheduled_event_enabled.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_os_image_scheduled_event_enabled.py deleted file mode 100644 index ce0cd122e6b4..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_os_image_scheduled_event_enabled.py +++ /dev/null @@ -1,95 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_scale_set_create_with_os_image_scheduled_event_enabled.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.virtual_machine_scale_sets.begin_create_or_update( - resource_group_name="myResourceGroup", - vm_scale_set_name="{vmss-name}", - parameters={ - "location": "westus", - "properties": { - "overprovision": True, - "upgradePolicy": {"mode": "Manual"}, - "virtualMachineProfile": { - "networkProfile": { - "networkInterfaceConfigurations": [ - { - "name": "{vmss-name}", - "properties": { - "enableIPForwarding": True, - "ipConfigurations": [ - { - "name": "{vmss-name}", - "properties": { - "subnet": { - "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}" - } - }, - } - ], - "primary": True, - }, - } - ] - }, - "osProfile": { - "adminPassword": "{your-password}", - "adminUsername": "{your-username}", - "computerNamePrefix": "{vmss-name}", - }, - "scheduledEventsProfile": { - "osImageNotificationProfile": {"enable": True, "notBeforeTimeout": "PT15M"} - }, - "storageProfile": { - "imageReference": { - "offer": "WindowsServer", - "publisher": "MicrosoftWindowsServer", - "sku": "2016-Datacenter", - "version": "latest", - }, - "osDisk": { - "caching": "ReadWrite", - "createOption": "FromImage", - "managedDisk": {"storageAccountType": "Standard_LRS"}, - }, - }, - }, - }, - "sku": {"capacity": 3, "name": "Standard_D1_v2", "tier": "Standard"}, - }, - ).result() - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithOSImageScheduledEventEnabled.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_password_authentication.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_password_authentication.py deleted file mode 100644 index ce469c155e3f..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_password_authentication.py +++ /dev/null @@ -1,92 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_scale_set_create_with_password_authentication.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.virtual_machine_scale_sets.begin_create_or_update( - resource_group_name="myResourceGroup", - vm_scale_set_name="{vmss-name}", - parameters={ - "location": "westus", - "properties": { - "overprovision": True, - "upgradePolicy": {"mode": "Manual"}, - "virtualMachineProfile": { - "networkProfile": { - "networkInterfaceConfigurations": [ - { - "name": "{vmss-name}", - "properties": { - "enableIPForwarding": True, - "ipConfigurations": [ - { - "name": "{vmss-name}", - "properties": { - "subnet": { - "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}" - } - }, - } - ], - "primary": True, - }, - } - ] - }, - "osProfile": { - "adminPassword": "{your-password}", - "adminUsername": "{your-username}", - "computerNamePrefix": "{vmss-name}", - }, - "storageProfile": { - "imageReference": { - "offer": "WindowsServer", - "publisher": "MicrosoftWindowsServer", - "sku": "2016-Datacenter", - "version": "latest", - }, - "osDisk": { - "caching": "ReadWrite", - "createOption": "FromImage", - "managedDisk": {"storageAccountType": "Standard_LRS"}, - }, - }, - }, - }, - "sku": {"capacity": 3, "name": "Standard_D1_v2", "tier": "Standard"}, - }, - ).result() - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithPasswordAuthentication.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_placement.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_placement.py deleted file mode 100644 index 51bc17dc2dab..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_placement.py +++ /dev/null @@ -1,93 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_scale_set_create_with_placement.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.virtual_machine_scale_sets.begin_create_or_update( - resource_group_name="myResourceGroup", - vm_scale_set_name="{vmss-name}", - parameters={ - "location": "westus", - "placement": {"includeZones": ["1", "3"], "zonePlacementPolicy": "Auto"}, - "properties": { - "overprovision": False, - "upgradePolicy": {"mode": "Manual"}, - "virtualMachineProfile": { - "networkProfile": { - "networkInterfaceConfigurations": [ - { - "name": "{vmss-name}", - "properties": { - "enableIPForwarding": True, - "ipConfigurations": [ - { - "name": "{vmss-name}", - "properties": { - "subnet": { - "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}" - } - }, - } - ], - "primary": True, - }, - } - ] - }, - "osProfile": { - "adminPassword": "{your-password}", - "adminUsername": "{your-username}", - "computerNamePrefix": "{vmss-name}", - }, - "storageProfile": { - "imageReference": { - "offer": "WindowsServer", - "publisher": "MicrosoftWindowsServer", - "sku": "2016-Datacenter", - "version": "latest", - }, - "osDisk": { - "caching": "ReadWrite", - "createOption": "FromImage", - "managedDisk": {"storageAccountType": "Standard_LRS"}, - }, - }, - }, - }, - "sku": {"capacity": 3, "name": "Standard_D1_v2", "tier": "Standard"}, - }, - ).result() - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithPlacement.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_premium_storage.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_premium_storage.py deleted file mode 100644 index 3e3c0e201d5a..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_premium_storage.py +++ /dev/null @@ -1,92 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_scale_set_create_with_premium_storage.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.virtual_machine_scale_sets.begin_create_or_update( - resource_group_name="myResourceGroup", - vm_scale_set_name="{vmss-name}", - parameters={ - "location": "westus", - "properties": { - "overprovision": True, - "upgradePolicy": {"mode": "Manual"}, - "virtualMachineProfile": { - "networkProfile": { - "networkInterfaceConfigurations": [ - { - "name": "{vmss-name}", - "properties": { - "enableIPForwarding": True, - "ipConfigurations": [ - { - "name": "{vmss-name}", - "properties": { - "subnet": { - "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}" - } - }, - } - ], - "primary": True, - }, - } - ] - }, - "osProfile": { - "adminPassword": "{your-password}", - "adminUsername": "{your-username}", - "computerNamePrefix": "{vmss-name}", - }, - "storageProfile": { - "imageReference": { - "offer": "WindowsServer", - "publisher": "MicrosoftWindowsServer", - "sku": "2016-Datacenter", - "version": "latest", - }, - "osDisk": { - "caching": "ReadWrite", - "createOption": "FromImage", - "managedDisk": {"storageAccountType": "Premium_LRS"}, - }, - }, - }, - }, - "sku": {"capacity": 3, "name": "Standard_D1_v2", "tier": "Standard"}, - }, - ).result() - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithPremiumStorage.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_priority_mix_policy.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_priority_mix_policy.py deleted file mode 100644 index b6e345dbda72..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_priority_mix_policy.py +++ /dev/null @@ -1,99 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_scale_set_create_with_priority_mix_policy.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.virtual_machine_scale_sets.begin_create_or_update( - resource_group_name="myResourceGroup", - vm_scale_set_name="{vmss-name}", - parameters={ - "location": "westus", - "properties": { - "orchestrationMode": "Flexible", - "platformFaultDomainCount": 1, - "priorityMixPolicy": {"baseRegularPriorityCount": 10, "regularPriorityPercentageAboveBase": 50}, - "virtualMachineProfile": { - "networkProfile": { - "networkApiVersion": "2020-11-01", - "networkInterfaceConfigurations": [ - { - "name": "{vmss-name}", - "properties": { - "enableAcceleratedNetworking": False, - "enableIPForwarding": True, - "ipConfigurations": [ - { - "name": "{vmss-name}", - "properties": { - "applicationGatewayBackendAddressPools": [], - "loadBalancerBackendAddressPools": [], - "primary": True, - "publicIPAddressConfiguration": { - "name": "{vmss-name}", - "properties": {"idleTimeoutInMinutes": 15}, - }, - "subnet": { - "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}" - }, - }, - } - ], - "primary": True, - }, - } - ], - }, - "osProfile": {"adminUsername": "{your-username}", "computerNamePrefix": "{vmss-name}"}, - "priority": "Spot", - "storageProfile": { - "imageReference": { - "offer": "0001-com-ubuntu-server-focal", - "publisher": "Canonical", - "sku": "20_04-lts-gen2", - "version": "latest", - }, - "osDisk": { - "caching": "ReadWrite", - "createOption": "FromImage", - "managedDisk": {"storageAccountType": "Standard_LRS"}, - }, - }, - }, - }, - "sku": {"capacity": 2, "name": "Standard_A8m_v2", "tier": "Standard"}, - }, - ).result() - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithPriorityMixPolicy.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_protected_settings_from_key_vault.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_protected_settings_from_key_vault.py deleted file mode 100644 index 893547f1e1f1..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_protected_settings_from_key_vault.py +++ /dev/null @@ -1,118 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_scale_set_create_with_protected_settings_from_key_vault.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.virtual_machine_scale_sets.begin_create_or_update( - resource_group_name="myResourceGroup", - vm_scale_set_name="{vmss-name}", - parameters={ - "location": "westus", - "properties": { - "overprovision": True, - "upgradePolicy": {"mode": "Manual"}, - "virtualMachineProfile": { - "diagnosticsProfile": { - "bootDiagnostics": { - "enabled": True, - "storageUri": "http://{existing-storage-account-name}.blob.core.windows.net", - } - }, - "extensionProfile": { - "extensions": [ - { - "name": "{extension-name}", - "properties": { - "autoUpgradeMinorVersion": False, - "protectedSettingsFromKeyVault": { - "secretUrl": "https://kvName.vault.azure.net/secrets/secretName/79b88b3a6f5440ffb2e73e44a0db712e", - "sourceVault": { - "id": "/subscriptions/a53f7094-a16c-47af-abe4-b05c05d0d79a/resourceGroups/myResourceGroup/providers/Microsoft.KeyVault/vaults/kvName" - }, - }, - "publisher": "{extension-Publisher}", - "settings": {}, - "type": "{extension-Type}", - "typeHandlerVersion": "{handler-version}", - }, - } - ] - }, - "networkProfile": { - "networkInterfaceConfigurations": [ - { - "name": "{vmss-name}", - "properties": { - "enableIPForwarding": True, - "ipConfigurations": [ - { - "name": "{vmss-name}", - "properties": { - "subnet": { - "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}" - } - }, - } - ], - "primary": True, - }, - } - ] - }, - "osProfile": { - "adminPassword": "{your-password}", - "adminUsername": "{your-username}", - "computerNamePrefix": "{vmss-name}", - }, - "storageProfile": { - "imageReference": { - "offer": "WindowsServer", - "publisher": "MicrosoftWindowsServer", - "sku": "2016-Datacenter", - "version": "latest", - }, - "osDisk": { - "caching": "ReadWrite", - "createOption": "FromImage", - "managedDisk": {"storageAccountType": "Standard_LRS"}, - }, - }, - }, - }, - "sku": {"capacity": 3, "name": "Standard_D1_v2", "tier": "Standard"}, - }, - ).result() - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithProtectedSettingsFromKeyVault.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_proxy_agent_settings.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_proxy_agent_settings.py deleted file mode 100644 index b2cc28adb5f7..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_proxy_agent_settings.py +++ /dev/null @@ -1,100 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_scale_set_create_with_proxy_agent_settings.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.virtual_machine_scale_sets.begin_create_or_update( - resource_group_name="myResourceGroup", - vm_scale_set_name="{vmss-name}", - parameters={ - "location": "westus", - "properties": { - "overprovision": True, - "upgradePolicy": {"mode": "Manual"}, - "virtualMachineProfile": { - "networkProfile": { - "networkInterfaceConfigurations": [ - { - "name": "{vmss-name}", - "properties": { - "enableIPForwarding": True, - "ipConfigurations": [ - { - "name": "{vmss-name}", - "properties": { - "subnet": { - "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}" - } - }, - } - ], - "primary": True, - }, - } - ] - }, - "osProfile": {"adminUsername": "{your-username}", "computerNamePrefix": "{vmss-name}"}, - "securityProfile": { - "proxyAgentSettings": { - "addProxyAgentExtension": True, - "enabled": True, - "imds": { - "inVMAccessControlProfileReferenceId": "/subscriptions/{sub-id}/resourceGroups/{rg}/providers/Microsoft.Compute/galleries/{gallery-name}/inVMAccessControlProfiles/{profile-name}/versions/{version}" - }, - "wireServer": { - "inVMAccessControlProfileReferenceId": "/subscriptions/{sub-id}/resourceGroups/{rg}/providers/Microsoft.Compute/galleries/{gallery-name}/inVMAccessControlProfiles/{profile-name}/versions/{version}" - }, - } - }, - "storageProfile": { - "imageReference": { - "offer": "0001-com-ubuntu-server-jammy", - "publisher": "Canonical", - "sku": "22_04-lts-gen2", - "version": "latest", - }, - "osDisk": { - "caching": "ReadOnly", - "createOption": "FromImage", - "managedDisk": {"storageAccountType": "StandardSSD_LRS"}, - }, - }, - }, - }, - "sku": {"capacity": 3, "name": "Standard_D2s_v3", "tier": "Standard"}, - }, - ).result() - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithProxyAgentSettings.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_resilient_vm_creation_policy.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_resilient_vm_creation_policy.py deleted file mode 100644 index 011f6dbd972a..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_resilient_vm_creation_policy.py +++ /dev/null @@ -1,93 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_scale_set_create_with_resilient_vm_creation_policy.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.virtual_machine_scale_sets.begin_create_or_update( - resource_group_name="myResourceGroup", - vm_scale_set_name="{vmss-name}", - parameters={ - "location": "westus", - "properties": { - "overprovision": False, - "resiliencyPolicy": {"resilientVMCreationPolicy": {"enabled": True}}, - "upgradePolicy": {"mode": "Manual"}, - "virtualMachineProfile": { - "networkProfile": { - "networkInterfaceConfigurations": [ - { - "name": "{vmss-name}", - "properties": { - "enableIPForwarding": True, - "ipConfigurations": [ - { - "name": "{vmss-name}", - "properties": { - "subnet": { - "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}" - } - }, - } - ], - "primary": True, - }, - } - ] - }, - "osProfile": { - "adminPassword": "{your-password}", - "adminUsername": "{your-username}", - "computerNamePrefix": "{vmss-name}", - }, - "storageProfile": { - "imageReference": { - "offer": "WindowsServer", - "publisher": "MicrosoftWindowsServer", - "sku": "2016-Datacenter", - "version": "latest", - }, - "osDisk": { - "caching": "ReadWrite", - "createOption": "FromImage", - "managedDisk": {"storageAccountType": "Standard_LRS"}, - }, - }, - }, - }, - "sku": {"capacity": 3, "name": "Standard_D1_v2", "tier": "Standard"}, - }, - ).result() - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithResilientVMCreationPolicy.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_resilient_vm_deletion_policy.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_resilient_vm_deletion_policy.py deleted file mode 100644 index a501e473df25..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_resilient_vm_deletion_policy.py +++ /dev/null @@ -1,93 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_scale_set_create_with_resilient_vm_deletion_policy.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.virtual_machine_scale_sets.begin_create_or_update( - resource_group_name="myResourceGroup", - vm_scale_set_name="{vmss-name}", - parameters={ - "location": "westus", - "properties": { - "overprovision": False, - "resiliencyPolicy": {"resilientVMDeletionPolicy": {"enabled": True}}, - "upgradePolicy": {"mode": "Manual"}, - "virtualMachineProfile": { - "networkProfile": { - "networkInterfaceConfigurations": [ - { - "name": "{vmss-name}", - "properties": { - "enableIPForwarding": True, - "ipConfigurations": [ - { - "name": "{vmss-name}", - "properties": { - "subnet": { - "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}" - } - }, - } - ], - "primary": True, - }, - } - ] - }, - "osProfile": { - "adminPassword": "{your-password}", - "adminUsername": "{your-username}", - "computerNamePrefix": "{vmss-name}", - }, - "storageProfile": { - "imageReference": { - "offer": "WindowsServer", - "publisher": "MicrosoftWindowsServer", - "sku": "2016-Datacenter", - "version": "latest", - }, - "osDisk": { - "caching": "ReadWrite", - "createOption": "FromImage", - "managedDisk": {"storageAccountType": "Standard_LRS"}, - }, - }, - }, - }, - "sku": {"capacity": 3, "name": "Standard_D1_v2", "tier": "Standard"}, - }, - ).result() - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithResilientVMDeletionPolicy.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_scale_in_policy.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_scale_in_policy.py deleted file mode 100644 index c4a978b7d993..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_scale_in_policy.py +++ /dev/null @@ -1,93 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_scale_set_create_with_scale_in_policy.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.virtual_machine_scale_sets.begin_create_or_update( - resource_group_name="myResourceGroup", - vm_scale_set_name="{vmss-name}", - parameters={ - "location": "westus", - "properties": { - "overprovision": True, - "scaleInPolicy": {"forceDeletion": True, "prioritizeUnhealthyVMs": True, "rules": ["OldestVM"]}, - "upgradePolicy": {"mode": "Manual"}, - "virtualMachineProfile": { - "networkProfile": { - "networkInterfaceConfigurations": [ - { - "name": "{vmss-name}", - "properties": { - "enableIPForwarding": True, - "ipConfigurations": [ - { - "name": "{vmss-name}", - "properties": { - "subnet": { - "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}" - } - }, - } - ], - "primary": True, - }, - } - ] - }, - "osProfile": { - "adminPassword": "{your-password}", - "adminUsername": "{your-username}", - "computerNamePrefix": "{vmss-name}", - }, - "storageProfile": { - "imageReference": { - "offer": "WindowsServer", - "publisher": "MicrosoftWindowsServer", - "sku": "2016-Datacenter", - "version": "latest", - }, - "osDisk": { - "caching": "ReadWrite", - "createOption": "FromImage", - "managedDisk": {"storageAccountType": "Standard_LRS"}, - }, - }, - }, - }, - "sku": {"capacity": 3, "name": "Standard_D1_v2", "tier": "Standard"}, - }, - ).result() - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithScaleInPolicy.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_security_posture_reference.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_security_posture_reference.py deleted file mode 100644 index 5dbce404f787..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_security_posture_reference.py +++ /dev/null @@ -1,91 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_scale_set_create_with_security_posture_reference.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.virtual_machine_scale_sets.begin_create_or_update( - resource_group_name="myResourceGroup", - vm_scale_set_name="{vmss-name}", - parameters={ - "location": "eastus2euap", - "properties": { - "overprovision": True, - "upgradePolicy": {"automaticOSUpgradePolicy": {"enableAutomaticOSUpgrade": True}, "mode": "Automatic"}, - "virtualMachineProfile": { - "networkProfile": { - "networkInterfaceConfigurations": [ - { - "name": "{vmss-name}", - "properties": { - "enableIPForwarding": True, - "ipConfigurations": [ - { - "name": "{vmss-name}", - "properties": { - "subnet": { - "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}" - } - }, - } - ], - "primary": True, - }, - } - ] - }, - "osProfile": { - "adminPassword": "{your-password}", - "adminUsername": "{your-username}", - "computerNamePrefix": "{vmss-name}", - }, - "securityPostureReference": { - "id": "/CommunityGalleries/{communityGalleryName}/securityPostures/{securityPostureName}/versions/{major.minor.patch}|{major.*}|latest" - }, - "storageProfile": { - "imageReference": { - "offer": "WindowsServer", - "publisher": "MicrosoftWindowsServer", - "sku": "2022-Datacenter", - "version": "latest", - }, - "osDisk": {"caching": "ReadWrite", "createOption": "FromImage", "name": "osDisk"}, - }, - }, - }, - "sku": {"capacity": 3, "name": "Standard_A1", "tier": "Standard"}, - }, - ).result() - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithSecurityPostureReference.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_security_type_confidential_vm.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_security_type_confidential_vm.py deleted file mode 100644 index 37853b1a32c7..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_security_type_confidential_vm.py +++ /dev/null @@ -1,99 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_scale_set_create_with_security_type_confidential_vm.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.virtual_machine_scale_sets.begin_create_or_update( - resource_group_name="myResourceGroup", - vm_scale_set_name="{vmss-name}", - parameters={ - "location": "westus", - "properties": { - "overprovision": True, - "upgradePolicy": {"mode": "Manual"}, - "virtualMachineProfile": { - "networkProfile": { - "networkInterfaceConfigurations": [ - { - "name": "{vmss-name}", - "properties": { - "enableIPForwarding": True, - "ipConfigurations": [ - { - "name": "{vmss-name}", - "properties": { - "subnet": { - "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}" - } - }, - } - ], - "primary": True, - }, - } - ] - }, - "osProfile": { - "adminPassword": "{your-password}", - "adminUsername": "{your-username}", - "computerNamePrefix": "{vmss-name}", - }, - "securityProfile": { - "securityType": "ConfidentialVM", - "uefiSettings": {"secureBootEnabled": True, "vTpmEnabled": True}, - }, - "storageProfile": { - "imageReference": { - "offer": "2019-datacenter-cvm", - "publisher": "MicrosoftWindowsServer", - "sku": "windows-cvm", - "version": "17763.2183.2109130127", - }, - "osDisk": { - "caching": "ReadOnly", - "createOption": "FromImage", - "managedDisk": { - "securityProfile": {"securityEncryptionType": "VMGuestStateOnly"}, - "storageAccountType": "StandardSSD_LRS", - }, - }, - }, - }, - }, - "sku": {"capacity": 3, "name": "Standard_DC2as_v5", "tier": "Standard"}, - }, - ).result() - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithSecurityTypeConfidentialVM.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_security_type_confidential_vm_with_non_persisted_tpm.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_security_type_confidential_vm_with_non_persisted_tpm.py deleted file mode 100644 index a08b6fa895d7..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_security_type_confidential_vm_with_non_persisted_tpm.py +++ /dev/null @@ -1,99 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_scale_set_create_with_security_type_confidential_vm_with_non_persisted_tpm.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.virtual_machine_scale_sets.begin_create_or_update( - resource_group_name="myResourceGroup", - vm_scale_set_name="{vmss-name}", - parameters={ - "location": "westus", - "properties": { - "overprovision": True, - "upgradePolicy": {"mode": "Manual"}, - "virtualMachineProfile": { - "networkProfile": { - "networkInterfaceConfigurations": [ - { - "name": "{vmss-name}", - "properties": { - "enableIPForwarding": True, - "ipConfigurations": [ - { - "name": "{vmss-name}", - "properties": { - "subnet": { - "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}" - } - }, - } - ], - "primary": True, - }, - } - ] - }, - "osProfile": { - "adminPassword": "{your-password}", - "adminUsername": "{your-username}", - "computerNamePrefix": "{vmss-name}", - }, - "securityProfile": { - "securityType": "ConfidentialVM", - "uefiSettings": {"secureBootEnabled": False, "vTpmEnabled": True}, - }, - "storageProfile": { - "imageReference": { - "offer": "2022-datacenter-cvm", - "publisher": "UbuntuServer", - "sku": "linux-cvm", - "version": "17763.2183.2109130127", - }, - "osDisk": { - "caching": "ReadOnly", - "createOption": "FromImage", - "managedDisk": { - "securityProfile": {"securityEncryptionType": "NonPersistedTPM"}, - "storageAccountType": "StandardSSD_LRS", - }, - }, - }, - }, - }, - "sku": {"capacity": 3, "name": "Standard_DC2es_v5", "tier": "Standard"}, - }, - ).result() - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithSecurityTypeConfidentialVMWithNonPersistedTPM.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_service_artifact_reference.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_service_artifact_reference.py deleted file mode 100644 index 7d1cf6ffa58d..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_service_artifact_reference.py +++ /dev/null @@ -1,91 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_scale_set_create_with_service_artifact_reference.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.virtual_machine_scale_sets.begin_create_or_update( - resource_group_name="myResourceGroup", - vm_scale_set_name="{vmss-name}", - parameters={ - "location": "eastus2euap", - "properties": { - "overprovision": True, - "upgradePolicy": {"automaticOSUpgradePolicy": {"enableAutomaticOSUpgrade": True}, "mode": "Automatic"}, - "virtualMachineProfile": { - "networkProfile": { - "networkInterfaceConfigurations": [ - { - "name": "{vmss-name}", - "properties": { - "enableIPForwarding": True, - "ipConfigurations": [ - { - "name": "{vmss-name}", - "properties": { - "subnet": { - "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}" - } - }, - } - ], - "primary": True, - }, - } - ] - }, - "osProfile": { - "adminPassword": "{your-password}", - "adminUsername": "{your-username}", - "computerNamePrefix": "{vmss-name}", - }, - "serviceArtifactReference": { - "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/galleries/myGalleryName/serviceArtifacts/serviceArtifactName/vmArtifactsProfiles/vmArtifactsProfilesName" - }, - "storageProfile": { - "imageReference": { - "offer": "WindowsServer", - "publisher": "MicrosoftWindowsServer", - "sku": "2022-Datacenter", - "version": "latest", - }, - "osDisk": {"caching": "ReadWrite", "createOption": "FromImage", "name": "osDisk"}, - }, - }, - }, - "sku": {"capacity": 3, "name": "Standard_A1", "tier": "Standard"}, - }, - ).result() - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithServiceArtifactReference.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_sku_profile.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_sku_profile.py deleted file mode 100644 index 91b767173b60..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_sku_profile.py +++ /dev/null @@ -1,100 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_scale_set_create_with_sku_profile.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.virtual_machine_scale_sets.begin_create_or_update( - resource_group_name="myResourceGroup", - vm_scale_set_name="{vmss-name}", - parameters={ - "location": "westus", - "properties": { - "orchestrationMode": "Flexible", - "priorityMixPolicy": {"baseRegularPriorityCount": 4, "regularPriorityPercentageAboveBase": 50}, - "singlePlacementGroup": False, - "skuProfile": { - "allocationStrategy": "CapacityOptimized", - "vmSizes": [{"name": "Standard_D8s_v5"}, {"name": "Standard_E16s_v5"}, {"name": "Standard_D2s_v5"}], - }, - "virtualMachineProfile": { - "billingProfile": {"maxPrice": -1}, - "evictionPolicy": "Deallocate", - "networkProfile": { - "networkInterfaceConfigurations": [ - { - "name": "{vmss-name}", - "properties": { - "enableIPForwarding": True, - "ipConfigurations": [ - { - "name": "{vmss-name}", - "properties": { - "subnet": { - "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}" - } - }, - } - ], - "primary": True, - }, - } - ] - }, - "osProfile": { - "adminPassword": "{your-password}", - "adminUsername": "{your-username}", - "computerNamePrefix": "{vmss-name}", - }, - "priority": "Spot", - "storageProfile": { - "imageReference": { - "offer": "WindowsServer", - "publisher": "MicrosoftWindowsServer", - "sku": "2016-Datacenter", - "version": "latest", - }, - "osDisk": { - "caching": "ReadWrite", - "createOption": "FromImage", - "managedDisk": {"storageAccountType": "Standard_LRS"}, - }, - }, - }, - }, - "sku": {"capacity": 10, "name": "Mix"}, - }, - ).result() - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithSkuProfile.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_sku_profile_prioritized.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_sku_profile_prioritized.py deleted file mode 100644 index 068d2b57480a..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_sku_profile_prioritized.py +++ /dev/null @@ -1,104 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_scale_set_create_with_sku_profile_prioritized.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.virtual_machine_scale_sets.begin_create_or_update( - resource_group_name="myResourceGroup", - vm_scale_set_name="{vmss-name}", - parameters={ - "location": "westus", - "properties": { - "orchestrationMode": "Flexible", - "priorityMixPolicy": {"baseRegularPriorityCount": 4, "regularPriorityPercentageAboveBase": 50}, - "singlePlacementGroup": False, - "skuProfile": { - "allocationStrategy": "Prioritized", - "vmSizes": [ - {"name": "Standard_D8s_v5", "rank": 0}, - {"name": "Standard_E16s_v5", "rank": 1}, - {"name": "Standard_D2s_v5", "rank": 2}, - ], - }, - "virtualMachineProfile": { - "billingProfile": {"maxPrice": -1}, - "evictionPolicy": "Deallocate", - "networkProfile": { - "networkInterfaceConfigurations": [ - { - "name": "{vmss-name}", - "properties": { - "enableIPForwarding": True, - "ipConfigurations": [ - { - "name": "{vmss-name}", - "properties": { - "subnet": { - "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}" - } - }, - } - ], - "primary": True, - }, - } - ] - }, - "osProfile": { - "adminPassword": "{your-password}", - "adminUsername": "{your-username}", - "computerNamePrefix": "{vmss-name}", - }, - "priority": "Spot", - "storageProfile": { - "imageReference": { - "offer": "WindowsServer", - "publisher": "MicrosoftWindowsServer", - "sku": "2016-Datacenter", - "version": "latest", - }, - "osDisk": { - "caching": "ReadWrite", - "createOption": "FromImage", - "managedDisk": {"storageAccountType": "Standard_LRS"}, - }, - }, - }, - }, - "sku": {"capacity": 10, "name": "Mix"}, - }, - ).result() - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithSkuProfile_Prioritized.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_spot_restore_policy.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_spot_restore_policy.py deleted file mode 100644 index 7fb74fb56152..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_spot_restore_policy.py +++ /dev/null @@ -1,96 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_scale_set_create_with_spot_restore_policy.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.virtual_machine_scale_sets.begin_create_or_update( - resource_group_name="myResourceGroup", - vm_scale_set_name="{vmss-name}", - parameters={ - "location": "westus", - "properties": { - "overprovision": True, - "spotRestorePolicy": {"enabled": True, "restoreTimeout": "PT1H"}, - "upgradePolicy": {"mode": "Manual"}, - "virtualMachineProfile": { - "billingProfile": {"maxPrice": -1}, - "evictionPolicy": "Deallocate", - "networkProfile": { - "networkInterfaceConfigurations": [ - { - "name": "{vmss-name}", - "properties": { - "enableIPForwarding": True, - "ipConfigurations": [ - { - "name": "{vmss-name}", - "properties": { - "subnet": { - "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}" - } - }, - } - ], - "primary": True, - }, - } - ] - }, - "osProfile": { - "adminPassword": "{your-password}", - "adminUsername": "{your-username}", - "computerNamePrefix": "{vmss-name}", - }, - "priority": "Spot", - "storageProfile": { - "imageReference": { - "offer": "WindowsServer", - "publisher": "MicrosoftWindowsServer", - "sku": "2016-Datacenter", - "version": "latest", - }, - "osDisk": { - "caching": "ReadWrite", - "createOption": "FromImage", - "managedDisk": {"storageAccountType": "Standard_LRS"}, - }, - }, - }, - }, - "sku": {"capacity": 2, "name": "Standard_A8m_v2", "tier": "Standard"}, - }, - ).result() - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithSpotRestorePolicy.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_ssh_authentication.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_ssh_authentication.py deleted file mode 100644 index 3db2db7ceede..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_ssh_authentication.py +++ /dev/null @@ -1,102 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_scale_set_create_with_ssh_authentication.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.virtual_machine_scale_sets.begin_create_or_update( - resource_group_name="myResourceGroup", - vm_scale_set_name="{vmss-name}", - parameters={ - "location": "westus", - "properties": { - "overprovision": True, - "upgradePolicy": {"mode": "Manual"}, - "virtualMachineProfile": { - "networkProfile": { - "networkInterfaceConfigurations": [ - { - "name": "{vmss-name}", - "properties": { - "enableIPForwarding": True, - "ipConfigurations": [ - { - "name": "{vmss-name}", - "properties": { - "subnet": { - "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}" - } - }, - } - ], - "primary": True, - }, - } - ] - }, - "osProfile": { - "adminUsername": "{your-username}", - "computerNamePrefix": "{vmss-name}", - "linuxConfiguration": { - "disablePasswordAuthentication": True, - "ssh": { - "publicKeys": [ - { - "keyData": "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCeClRAk2ipUs/l5voIsDC5q9RI+YSRd1Bvd/O+axgY4WiBzG+4FwJWZm/mLLe5DoOdHQwmU2FrKXZSW4w2sYE70KeWnrFViCOX5MTVvJgPE8ClugNl8RWth/tU849DvM9sT7vFgfVSHcAS2yDRyDlueii+8nF2ym8XWAPltFVCyLHRsyBp5YPqK8JFYIa1eybKsY3hEAxRCA+/7bq8et+Gj3coOsuRmrehav7rE6N12Pb80I6ofa6SM5XNYq4Xk0iYNx7R3kdz0Jj9XgZYWjAHjJmT0gTRoOnt6upOuxK7xI/ykWrllgpXrCPu3Ymz+c+ujaqcxDopnAl2lmf69/J1", - "path": "/home/{your-username}/.ssh/authorized_keys", - } - ] - }, - }, - }, - "storageProfile": { - "imageReference": { - "offer": "WindowsServer", - "publisher": "MicrosoftWindowsServer", - "sku": "2016-Datacenter", - "version": "latest", - }, - "osDisk": { - "caching": "ReadWrite", - "createOption": "FromImage", - "managedDisk": {"storageAccountType": "Standard_LRS"}, - }, - }, - }, - }, - "sku": {"capacity": 3, "name": "Standard_D1_v2", "tier": "Standard"}, - }, - ).result() - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithSshAuthentication.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_terminate_scheduled_event_enabled.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_terminate_scheduled_event_enabled.py deleted file mode 100644 index 10d37b1c47f2..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_terminate_scheduled_event_enabled.py +++ /dev/null @@ -1,95 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_scale_set_create_with_terminate_scheduled_event_enabled.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.virtual_machine_scale_sets.begin_create_or_update( - resource_group_name="myResourceGroup", - vm_scale_set_name="{vmss-name}", - parameters={ - "location": "westus", - "properties": { - "overprovision": True, - "upgradePolicy": {"mode": "Manual"}, - "virtualMachineProfile": { - "networkProfile": { - "networkInterfaceConfigurations": [ - { - "name": "{vmss-name}", - "properties": { - "enableIPForwarding": True, - "ipConfigurations": [ - { - "name": "{vmss-name}", - "properties": { - "subnet": { - "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}" - } - }, - } - ], - "primary": True, - }, - } - ] - }, - "osProfile": { - "adminPassword": "{your-password}", - "adminUsername": "{your-username}", - "computerNamePrefix": "{vmss-name}", - }, - "scheduledEventsProfile": { - "terminateNotificationProfile": {"enable": True, "notBeforeTimeout": "PT5M"} - }, - "storageProfile": { - "imageReference": { - "offer": "WindowsServer", - "publisher": "MicrosoftWindowsServer", - "sku": "2016-Datacenter", - "version": "latest", - }, - "osDisk": { - "caching": "ReadWrite", - "createOption": "FromImage", - "managedDisk": {"storageAccountType": "Standard_LRS"}, - }, - }, - }, - }, - "sku": {"capacity": 3, "name": "Standard_D1_v2", "tier": "Standard"}, - }, - ).result() - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithTerminateScheduledEventEnabled.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_uefi_settings.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_uefi_settings.py deleted file mode 100644 index 799b5e30c03a..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_uefi_settings.py +++ /dev/null @@ -1,96 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_scale_set_create_with_uefi_settings.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.virtual_machine_scale_sets.begin_create_or_update( - resource_group_name="myResourceGroup", - vm_scale_set_name="{vmss-name}", - parameters={ - "location": "westus", - "properties": { - "overprovision": True, - "upgradePolicy": {"mode": "Manual"}, - "virtualMachineProfile": { - "networkProfile": { - "networkInterfaceConfigurations": [ - { - "name": "{vmss-name}", - "properties": { - "enableIPForwarding": True, - "ipConfigurations": [ - { - "name": "{vmss-name}", - "properties": { - "subnet": { - "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}" - } - }, - } - ], - "primary": True, - }, - } - ] - }, - "osProfile": { - "adminPassword": "{your-password}", - "adminUsername": "{your-username}", - "computerNamePrefix": "{vmss-name}", - }, - "securityProfile": { - "securityType": "TrustedLaunch", - "uefiSettings": {"secureBootEnabled": True, "vTpmEnabled": True}, - }, - "storageProfile": { - "imageReference": { - "offer": "windowsserver-gen2preview-preview", - "publisher": "MicrosoftWindowsServer", - "sku": "windows10-tvm", - "version": "18363.592.2001092016", - }, - "osDisk": { - "caching": "ReadOnly", - "createOption": "FromImage", - "managedDisk": {"storageAccountType": "StandardSSD_LRS"}, - }, - }, - }, - }, - "sku": {"capacity": 3, "name": "Standard_D2s_v3", "tier": "Standard"}, - }, - ).result() - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithUefiSettings.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_user_data.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_user_data.py deleted file mode 100644 index 3cf7968a9c4d..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_user_data.py +++ /dev/null @@ -1,93 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_scale_set_create_with_user_data.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.virtual_machine_scale_sets.begin_create_or_update( - resource_group_name="myResourceGroup", - vm_scale_set_name="{vmss-name}", - parameters={ - "location": "westus", - "properties": { - "overprovision": True, - "upgradePolicy": {"mode": "Manual"}, - "virtualMachineProfile": { - "networkProfile": { - "networkInterfaceConfigurations": [ - { - "name": "{vmss-name}", - "properties": { - "enableIPForwarding": True, - "ipConfigurations": [ - { - "name": "{vmss-name}", - "properties": { - "subnet": { - "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}" - } - }, - } - ], - "primary": True, - }, - } - ] - }, - "osProfile": { - "adminPassword": "{your-password}", - "adminUsername": "{your-username}", - "computerNamePrefix": "{vmss-name}", - }, - "storageProfile": { - "imageReference": { - "offer": "WindowsServer", - "publisher": "MicrosoftWindowsServer", - "sku": "2016-Datacenter", - "version": "latest", - }, - "osDisk": { - "caching": "ReadWrite", - "createOption": "FromImage", - "managedDisk": {"storageAccountType": "Standard_LRS"}, - }, - }, - "userData": "RXhhbXBsZSBVc2VyRGF0YQ==", - }, - }, - "sku": {"capacity": 3, "name": "Standard_D1_v2", "tier": "Standard"}, - }, - ).result() - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithUserData.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_vm_size_properties.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_vm_size_properties.py deleted file mode 100644 index 890e4589ee46..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_vm_size_properties.py +++ /dev/null @@ -1,94 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_scale_set_create_with_vm_size_properties.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.virtual_machine_scale_sets.begin_create_or_update( - resource_group_name="myResourceGroup", - vm_scale_set_name="{vmss-name}", - parameters={ - "location": "westus", - "properties": { - "overprovision": True, - "upgradePolicy": {"mode": "Manual"}, - "virtualMachineProfile": { - "hardwareProfile": {"vmSizeProperties": {"vCPUsAvailable": 1, "vCPUsPerCore": 1}}, - "networkProfile": { - "networkInterfaceConfigurations": [ - { - "name": "{vmss-name}", - "properties": { - "enableIPForwarding": True, - "ipConfigurations": [ - { - "name": "{vmss-name}", - "properties": { - "subnet": { - "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}" - } - }, - } - ], - "primary": True, - }, - } - ] - }, - "osProfile": { - "adminPassword": "{your-password}", - "adminUsername": "{your-username}", - "computerNamePrefix": "{vmss-name}", - }, - "storageProfile": { - "imageReference": { - "offer": "WindowsServer", - "publisher": "MicrosoftWindowsServer", - "sku": "2016-Datacenter", - "version": "latest", - }, - "osDisk": { - "caching": "ReadWrite", - "createOption": "FromImage", - "managedDisk": {"storageAccountType": "Standard_LRS"}, - }, - }, - "userData": "RXhhbXBsZSBVc2VyRGF0YQ==", - }, - }, - "sku": {"capacity": 3, "name": "Standard_D1_v2", "tier": "Standard"}, - }, - ).result() - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithVMSizeProperties.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_vms_in_different_zones.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_vms_in_different_zones.py deleted file mode 100644 index cacd182782eb..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_vms_in_different_zones.py +++ /dev/null @@ -1,98 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_scale_set_create_with_vms_in_different_zones.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.virtual_machine_scale_sets.begin_create_or_update( - resource_group_name="myResourceGroup", - vm_scale_set_name="{vmss-name}", - parameters={ - "location": "centralus", - "properties": { - "overprovision": True, - "upgradePolicy": {"mode": "Automatic"}, - "virtualMachineProfile": { - "networkProfile": { - "networkInterfaceConfigurations": [ - { - "name": "{vmss-name}", - "properties": { - "enableIPForwarding": True, - "ipConfigurations": [ - { - "name": "{vmss-name}", - "properties": { - "subnet": { - "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}" - } - }, - } - ], - "primary": True, - }, - } - ] - }, - "osProfile": { - "adminPassword": "{your-password}", - "adminUsername": "{your-username}", - "computerNamePrefix": "{vmss-name}", - }, - "storageProfile": { - "dataDisks": [ - {"createOption": "Empty", "diskSizeGB": 1023, "lun": 0}, - {"createOption": "Empty", "diskSizeGB": 1023, "lun": 1}, - ], - "imageReference": { - "offer": "WindowsServer", - "publisher": "MicrosoftWindowsServer", - "sku": "2016-Datacenter", - "version": "latest", - }, - "osDisk": { - "caching": "ReadWrite", - "createOption": "FromImage", - "diskSizeGB": 512, - "managedDisk": {"storageAccountType": "Standard_LRS"}, - }, - }, - }, - }, - "sku": {"capacity": 2, "name": "Standard_A1_v2", "tier": "Standard"}, - "zones": ["1", "3"], - }, - ).result() - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithVMsInDifferentZones.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_zonal_platform_fault_domain_align_mode.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_zonal_platform_fault_domain_align_mode.py deleted file mode 100644 index 86571100361a..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_zonal_platform_fault_domain_align_mode.py +++ /dev/null @@ -1,98 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_scale_set_create_with_zonal_platform_fault_domain_align_mode.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.virtual_machine_scale_sets.begin_create_or_update( - resource_group_name="myResourceGroup", - vm_scale_set_name="{vmss-name}", - parameters={ - "location": "westus", - "properties": { - "overprovision": True, - "scheduledEventsPolicy": { - "scheduledEventsAdditionalPublishingTargets": {"eventGridAndResourceGraph": {"enable": True}}, - "userInitiatedReboot": {"automaticallyApprove": True}, - "userInitiatedRedeploy": {"automaticallyApprove": True}, - }, - "upgradePolicy": {"mode": "Manual"}, - "virtualMachineProfile": { - "networkProfile": { - "networkInterfaceConfigurations": [ - { - "name": "{vmss-name}", - "properties": { - "enableIPForwarding": True, - "ipConfigurations": [ - { - "name": "{vmss-name}", - "properties": { - "subnet": { - "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}" - } - }, - } - ], - "primary": True, - }, - } - ] - }, - "osProfile": { - "adminPassword": "{your-password}", - "adminUsername": "{your-username}", - "computerNamePrefix": "{vmss-name}", - }, - "storageProfile": { - "imageReference": { - "offer": "WindowsServer", - "publisher": "MicrosoftWindowsServer", - "sku": "2016-Datacenter", - "version": "latest", - }, - "osDisk": { - "caching": "ReadWrite", - "createOption": "FromImage", - "managedDisk": {"storageAccountType": "Standard_LRS"}, - }, - }, - }, - "zonalPlatformFaultDomainAlignMode": "Aligned", - }, - "sku": {"capacity": 3, "name": "Standard_D1_v2", "tier": "Standard"}, - }, - ).result() - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithZonalPlatformFaultDomainAlignMode.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_deallocate_maximum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_deallocate_maximum_set_gen.py deleted file mode 100644 index 88366ad5e59d..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_deallocate_maximum_set_gen.py +++ /dev/null @@ -1,42 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_scale_set_deallocate_maximum_set_gen.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - client.virtual_machine_scale_sets.begin_deallocate( - resource_group_name="rgcompute", - vm_scale_set_name="aaaaaaaaaaaaaaaaaaaaaaaaaaaa", - ).result() - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Deallocate_MaximumSet_Gen.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_deallocate_minimum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_deallocate_minimum_set_gen.py deleted file mode 100644 index 01d2c2c41a77..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_deallocate_minimum_set_gen.py +++ /dev/null @@ -1,42 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_scale_set_deallocate_minimum_set_gen.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - client.virtual_machine_scale_sets.begin_deallocate( - resource_group_name="rgcompute", - vm_scale_set_name="aaaaaaaaaaaaaaaaaaaaaaaa", - ).result() - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Deallocate_MinimumSet_Gen.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_delete_force.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_delete_force.py deleted file mode 100644 index 69f197802c5b..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_delete_force.py +++ /dev/null @@ -1,42 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_scale_set_delete_force.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - client.virtual_machine_scale_sets.begin_delete( - resource_group_name="myResourceGroup", - vm_scale_set_name="myvmScaleSet", - ).result() - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Delete_Force.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_extension_create_or_update_maximum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_extension_create_or_update_maximum_set_gen.py deleted file mode 100644 index 062e97b88911..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_extension_create_or_update_maximum_set_gen.py +++ /dev/null @@ -1,59 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_scale_set_extension_create_or_update_maximum_set_gen.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.virtual_machine_scale_set_extensions.begin_create_or_update( - resource_group_name="rgcompute", - vm_scale_set_name="aaaaaaa", - vmss_extension_name="aaaaaaaaaaaaaaaaaaaaa", - extension_parameters={ - "name": "{extension-name}", - "properties": { - "autoUpgradeMinorVersion": True, - "enableAutomaticUpgrade": True, - "forceUpdateTag": "aaaaaaaaa", - "protectedSettings": {}, - "provisionAfterExtensions": ["aa"], - "publisher": "{extension-Publisher}", - "settings": {}, - "suppressFailures": True, - "type": "{extension-Type}", - "typeHandlerVersion": "{handler-version}", - }, - }, - ).result() - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetExtension_CreateOrUpdate_MaximumSet_Gen.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_extension_delete_maximum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_extension_delete_maximum_set_gen.py deleted file mode 100644 index fa2b17c7777e..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_extension_delete_maximum_set_gen.py +++ /dev/null @@ -1,43 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_scale_set_extension_delete_maximum_set_gen.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - client.virtual_machine_scale_set_extensions.begin_delete( - resource_group_name="rgcompute", - vm_scale_set_name="aaaaaaaaaaaaaaaaaaaaaaaaaaaaa", - vmss_extension_name="aaaaaaaaaaaaaaaaaaaaaaaa", - ).result() - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetExtension_Delete_MaximumSet_Gen.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_extension_delete_minimum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_extension_delete_minimum_set_gen.py deleted file mode 100644 index e38aa727f617..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_extension_delete_minimum_set_gen.py +++ /dev/null @@ -1,43 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_scale_set_extension_delete_minimum_set_gen.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - client.virtual_machine_scale_set_extensions.begin_delete( - resource_group_name="rgcompute", - vm_scale_set_name="aaaa", - vmss_extension_name="aaaaaaaaaaaaaaaaaaaaaaa", - ).result() - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetExtension_Delete_MinimumSet_Gen.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_extension_get_maximum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_extension_get_maximum_set_gen.py deleted file mode 100644 index 9a4bcac0a252..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_extension_get_maximum_set_gen.py +++ /dev/null @@ -1,44 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_scale_set_extension_get_maximum_set_gen.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.virtual_machine_scale_set_extensions.get( - resource_group_name="rgcompute", - vm_scale_set_name="aaaaaaaaaaaaaaaaaaaaaaaa", - vmss_extension_name="aaaaaaaaaaaaaaaaaaaa", - ) - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetExtension_Get_MaximumSet_Gen.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_extension_get_minimum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_extension_get_minimum_set_gen.py deleted file mode 100644 index 0ce83d835c1c..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_extension_get_minimum_set_gen.py +++ /dev/null @@ -1,44 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_scale_set_extension_get_minimum_set_gen.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.virtual_machine_scale_set_extensions.get( - resource_group_name="rgcompute", - vm_scale_set_name="a", - vmss_extension_name="aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", - ) - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetExtension_Get_MinimumSet_Gen.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_extension_list_maximum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_extension_list_maximum_set_gen.py deleted file mode 100644 index 11aef675ae16..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_extension_list_maximum_set_gen.py +++ /dev/null @@ -1,44 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_scale_set_extension_list_maximum_set_gen.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.virtual_machine_scale_set_extensions.list( - resource_group_name="rgcompute", - vm_scale_set_name="aaaaaaaaaaaaaaaaaaaa", - ) - for item in response: - print(item) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetExtension_List_MaximumSet_Gen.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_extension_list_minimum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_extension_list_minimum_set_gen.py deleted file mode 100644 index e8a34a3b46cd..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_extension_list_minimum_set_gen.py +++ /dev/null @@ -1,44 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_scale_set_extension_list_minimum_set_gen.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.virtual_machine_scale_set_extensions.list( - resource_group_name="rgcompute", - vm_scale_set_name="aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", - ) - for item in response: - print(item) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetExtension_List_MinimumSet_Gen.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_extension_rolling_upgrade.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_extension_rolling_upgrade.py deleted file mode 100644 index 7366ead5220e..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_extension_rolling_upgrade.py +++ /dev/null @@ -1,42 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_scale_set_extension_rolling_upgrade.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - client.virtual_machine_scale_set_rolling_upgrades.begin_start_extension_upgrade( - resource_group_name="myResourceGroup", - vm_scale_set_name="{vmss-name}", - ).result() - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetExtension_RollingUpgrade.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_extension_update_maximum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_extension_update_maximum_set_gen.py deleted file mode 100644 index f65bd602108f..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_extension_update_maximum_set_gen.py +++ /dev/null @@ -1,58 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_scale_set_extension_update_maximum_set_gen.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.virtual_machine_scale_set_extensions.begin_update( - resource_group_name="rgcompute", - vm_scale_set_name="aaaaaaaaaaaaaaaaaaaaaaaaaaaaa", - vmss_extension_name="aaaa", - extension_parameters={ - "properties": { - "autoUpgradeMinorVersion": True, - "enableAutomaticUpgrade": True, - "forceUpdateTag": "aaaaaaaaa", - "protectedSettings": {}, - "provisionAfterExtensions": ["aa"], - "publisher": "{extension-Publisher}", - "settings": {}, - "suppressFailures": True, - "type": "{extension-Type}", - "typeHandlerVersion": "{handler-version}", - } - }, - ).result() - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetExtension_Update_MaximumSet_Gen.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_force_recovery_service_fabric_platform_update_domain_walk_maximum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_force_recovery_service_fabric_platform_update_domain_walk_maximum_set_gen.py deleted file mode 100644 index 165fbd263ad0..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_force_recovery_service_fabric_platform_update_domain_walk_maximum_set_gen.py +++ /dev/null @@ -1,44 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_scale_set_force_recovery_service_fabric_platform_update_domain_walk_maximum_set_gen.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.virtual_machine_scale_sets.force_recovery_service_fabric_platform_update_domain_walk( - resource_group_name="rgcompute", - vm_scale_set_name="aaaaaaaaaaaaaaaa", - platform_update_domain=30, - ) - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_ForceRecoveryServiceFabricPlatformUpdateDomainWalk_MaximumSet_Gen.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_force_recovery_service_fabric_platform_update_domain_walk_minimum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_force_recovery_service_fabric_platform_update_domain_walk_minimum_set_gen.py deleted file mode 100644 index d93902d9db23..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_force_recovery_service_fabric_platform_update_domain_walk_minimum_set_gen.py +++ /dev/null @@ -1,44 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_scale_set_force_recovery_service_fabric_platform_update_domain_walk_minimum_set_gen.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.virtual_machine_scale_sets.force_recovery_service_fabric_platform_update_domain_walk( - resource_group_name="rgcompute", - vm_scale_set_name="aaaaaaaaaaaa", - platform_update_domain=9, - ) - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_ForceRecoveryServiceFabricPlatformUpdateDomainWalk_MinimumSet_Gen.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_get.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_get.py deleted file mode 100644 index 39b07f89b268..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_get.py +++ /dev/null @@ -1,43 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_scale_set_get.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.virtual_machine_scale_sets.get( - resource_group_name="myResourceGroup", - vm_scale_set_name="myVirtualMachineScaleSet", - ) - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Get.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_get_auto_placed_on_dedicated_host_group.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_get_auto_placed_on_dedicated_host_group.py deleted file mode 100644 index a550578e47ca..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_get_auto_placed_on_dedicated_host_group.py +++ /dev/null @@ -1,43 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_scale_set_get_auto_placed_on_dedicated_host_group.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.virtual_machine_scale_sets.get( - resource_group_name="myResourceGroup", - vm_scale_set_name="myVirtualMachineScaleSet", - ) - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Get_AutoPlacedOnDedicatedHostGroup.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_get_instance_view_maximum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_get_instance_view_maximum_set_gen.py deleted file mode 100644 index 00a7ff95a134..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_get_instance_view_maximum_set_gen.py +++ /dev/null @@ -1,43 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_scale_set_get_instance_view_maximum_set_gen.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.virtual_machine_scale_sets.get_instance_view( - resource_group_name="rgcompute", - vm_scale_set_name="aaaaaaaaaaaaaaa", - ) - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_GetInstanceView_MaximumSet_Gen.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_get_instance_view_minimum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_get_instance_view_minimum_set_gen.py deleted file mode 100644 index b79ed5a62199..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_get_instance_view_minimum_set_gen.py +++ /dev/null @@ -1,43 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_scale_set_get_instance_view_minimum_set_gen.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.virtual_machine_scale_sets.get_instance_view( - resource_group_name="rgcompute", - vm_scale_set_name="aaaaaaaaaaaaaaa", - ) - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_GetInstanceView_MinimumSet_Gen.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_get_os_upgrade_history_maximum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_get_os_upgrade_history_maximum_set_gen.py deleted file mode 100644 index 1ffc5bf4d0b1..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_get_os_upgrade_history_maximum_set_gen.py +++ /dev/null @@ -1,44 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_scale_set_get_os_upgrade_history_maximum_set_gen.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.virtual_machine_scale_sets.get_os_upgrade_history( - resource_group_name="rgcompute", - vm_scale_set_name="aaaaaa", - ) - for item in response: - print(item) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_GetOSUpgradeHistory_MaximumSet_Gen.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_get_os_upgrade_history_minimum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_get_os_upgrade_history_minimum_set_gen.py deleted file mode 100644 index f106067d1dc9..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_get_os_upgrade_history_minimum_set_gen.py +++ /dev/null @@ -1,44 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_scale_set_get_os_upgrade_history_minimum_set_gen.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.virtual_machine_scale_sets.get_os_upgrade_history( - resource_group_name="rgcompute", - vm_scale_set_name="aaaaaaaaaaaaaaaaaaaaaaaaaa", - ) - for item in response: - print(item) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_GetOSUpgradeHistory_MinimumSet_Gen.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_get_with_disk_controller_type.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_get_with_disk_controller_type.py deleted file mode 100644 index 15e0f6ac6440..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_get_with_disk_controller_type.py +++ /dev/null @@ -1,43 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_scale_set_get_with_disk_controller_type.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.virtual_machine_scale_sets.get( - resource_group_name="myResourceGroup", - vm_scale_set_name="myVirtualMachineScaleSet", - ) - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Get_WithDiskControllerType.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_get_with_user_data.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_get_with_user_data.py deleted file mode 100644 index af750ac3fc60..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_get_with_user_data.py +++ /dev/null @@ -1,43 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_scale_set_get_with_user_data.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.virtual_machine_scale_sets.get( - resource_group_name="myResourceGroup", - vm_scale_set_name="myVirtualMachineScaleSet", - ) - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Get_WithUserData.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_list_all_maximum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_list_all_maximum_set_gen.py deleted file mode 100644 index 6581f4f1606b..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_list_all_maximum_set_gen.py +++ /dev/null @@ -1,41 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_scale_set_list_all_maximum_set_gen.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.virtual_machine_scale_sets.list_all() - for item in response: - print(item) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_ListAll_MaximumSet_Gen.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_list_all_minimum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_list_all_minimum_set_gen.py deleted file mode 100644 index fe99a41c368b..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_list_all_minimum_set_gen.py +++ /dev/null @@ -1,41 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_scale_set_list_all_minimum_set_gen.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.virtual_machine_scale_sets.list_all() - for item in response: - print(item) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_ListAll_MinimumSet_Gen.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_list_by_subscription_by_location.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_list_by_subscription_by_location.py deleted file mode 100644 index ba46ba734fea..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_list_by_subscription_by_location.py +++ /dev/null @@ -1,43 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_scale_set_list_by_subscription_by_location.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.virtual_machine_scale_sets.list_by_location( - location="eastus", - ) - for item in response: - print(item) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_ListBySubscription_ByLocation.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_list_maximum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_list_maximum_set_gen.py deleted file mode 100644 index f5c352d3983b..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_list_maximum_set_gen.py +++ /dev/null @@ -1,43 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_scale_set_list_maximum_set_gen.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.virtual_machine_scale_sets.list( - resource_group_name="rgcompute", - ) - for item in response: - print(item) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_List_MaximumSet_Gen.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_list_minimum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_list_minimum_set_gen.py deleted file mode 100644 index 2cf6229fe889..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_list_minimum_set_gen.py +++ /dev/null @@ -1,43 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_scale_set_list_minimum_set_gen.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.virtual_machine_scale_sets.list( - resource_group_name="rgcompute", - ) - for item in response: - print(item) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_List_MinimumSet_Gen.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_list_skus_maximum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_list_skus_maximum_set_gen.py deleted file mode 100644 index 5aa24321f114..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_list_skus_maximum_set_gen.py +++ /dev/null @@ -1,44 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_scale_set_list_skus_maximum_set_gen.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.virtual_machine_scale_sets.list_skus( - resource_group_name="rgcompute", - vm_scale_set_name="aaaaaa", - ) - for item in response: - print(item) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_ListSkus_MaximumSet_Gen.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_list_skus_minimum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_list_skus_minimum_set_gen.py deleted file mode 100644 index 3fb3558036d7..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_list_skus_minimum_set_gen.py +++ /dev/null @@ -1,44 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_scale_set_list_skus_minimum_set_gen.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.virtual_machine_scale_sets.list_skus( - resource_group_name="rgcompute", - vm_scale_set_name="aaaaaaaaaaaaaaaa", - ) - for item in response: - print(item) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_ListSkus_MinimumSet_Gen.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_perform_maintenance_maximum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_perform_maintenance_maximum_set_gen.py deleted file mode 100644 index e8f80259043b..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_perform_maintenance_maximum_set_gen.py +++ /dev/null @@ -1,42 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_scale_set_perform_maintenance_maximum_set_gen.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - client.virtual_machine_scale_sets.begin_perform_maintenance( - resource_group_name="rgcompute", - vm_scale_set_name="aaaaaaaaaaa", - ).result() - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_PerformMaintenance_MaximumSet_Gen.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_perform_maintenance_minimum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_perform_maintenance_minimum_set_gen.py deleted file mode 100644 index 6a4fcbc04f15..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_perform_maintenance_minimum_set_gen.py +++ /dev/null @@ -1,42 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_scale_set_perform_maintenance_minimum_set_gen.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - client.virtual_machine_scale_sets.begin_perform_maintenance( - resource_group_name="rgcompute", - vm_scale_set_name="aa", - ).result() - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_PerformMaintenance_MinimumSet_Gen.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_power_off_maximum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_power_off_maximum_set_gen.py deleted file mode 100644 index 2c55314b1d7d..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_power_off_maximum_set_gen.py +++ /dev/null @@ -1,42 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_scale_set_power_off_maximum_set_gen.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - client.virtual_machine_scale_sets.begin_power_off( - resource_group_name="rgcompute", - vm_scale_set_name="aaaaaaaaaaaaaaaaaa", - ).result() - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_PowerOff_MaximumSet_Gen.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_power_off_minimum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_power_off_minimum_set_gen.py deleted file mode 100644 index eebfde52da72..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_power_off_minimum_set_gen.py +++ /dev/null @@ -1,42 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_scale_set_power_off_minimum_set_gen.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - client.virtual_machine_scale_sets.begin_power_off( - resource_group_name="rgcompute", - vm_scale_set_name="a", - ).result() - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_PowerOff_MinimumSet_Gen.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_reapply_maximum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_reapply_maximum_set_gen.py deleted file mode 100644 index 45cabb6e1b84..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_reapply_maximum_set_gen.py +++ /dev/null @@ -1,42 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_scale_set_reapply_maximum_set_gen.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="b4f1213b-cacc-4816-8bfb-f30f90643de8", - ) - - client.virtual_machine_scale_sets.begin_reapply( - resource_group_name="VirtualMachineScaleSetReapplyTestRG", - vm_scale_set_name="VMSSReapply-Test-ScaleSet", - ).result() - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Reapply_MaximumSet_Gen.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_reapply_minimum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_reapply_minimum_set_gen.py deleted file mode 100644 index c517090df913..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_reapply_minimum_set_gen.py +++ /dev/null @@ -1,42 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_scale_set_reapply_minimum_set_gen.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="b4f1213b-cacc-4816-8bfb-f30f90643de8", - ) - - client.virtual_machine_scale_sets.begin_reapply( - resource_group_name="VirtualMachineScaleSetReapplyTestRG", - vm_scale_set_name="VMSSReapply-Test-ScaleSet", - ).result() - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Reapply_MinimumSet_Gen.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_redeploy_maximum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_redeploy_maximum_set_gen.py deleted file mode 100644 index 1367faba6969..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_redeploy_maximum_set_gen.py +++ /dev/null @@ -1,42 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_scale_set_redeploy_maximum_set_gen.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - client.virtual_machine_scale_sets.begin_redeploy( - resource_group_name="rgcompute", - vm_scale_set_name="aaaaaaaaaaaaaaaaaaaaaaaaaaaaa", - ).result() - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Redeploy_MaximumSet_Gen.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_redeploy_minimum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_redeploy_minimum_set_gen.py deleted file mode 100644 index 568442405d98..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_redeploy_minimum_set_gen.py +++ /dev/null @@ -1,42 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_scale_set_redeploy_minimum_set_gen.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - client.virtual_machine_scale_sets.begin_redeploy( - resource_group_name="rgcompute", - vm_scale_set_name="aaaaaaaaaaaaaaaaaaaaaa", - ).result() - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Redeploy_MinimumSet_Gen.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_reimage_all_maximum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_reimage_all_maximum_set_gen.py deleted file mode 100644 index 21e9f3e9a4cf..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_reimage_all_maximum_set_gen.py +++ /dev/null @@ -1,42 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_scale_set_reimage_all_maximum_set_gen.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - client.virtual_machine_scale_sets.begin_reimage_all( - resource_group_name="rgcompute", - vm_scale_set_name="aaaaaaaaaaaa", - ).result() - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_ReimageAll_MaximumSet_Gen.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_reimage_all_minimum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_reimage_all_minimum_set_gen.py deleted file mode 100644 index e9a2e443cc7d..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_reimage_all_minimum_set_gen.py +++ /dev/null @@ -1,42 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_scale_set_reimage_all_minimum_set_gen.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - client.virtual_machine_scale_sets.begin_reimage_all( - resource_group_name="rgcompute", - vm_scale_set_name="aaaaaaaaaaaaaaaaaaaaaa", - ).result() - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_ReimageAll_MinimumSet_Gen.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_reimage_maximum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_reimage_maximum_set_gen.py deleted file mode 100644 index 4341d0e83846..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_reimage_maximum_set_gen.py +++ /dev/null @@ -1,42 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_scale_set_reimage_maximum_set_gen.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - client.virtual_machine_scale_sets.begin_reimage( - resource_group_name="rgcompute", - vm_scale_set_name="aaaaaaaaaaaaaaaaaaaaaaaaaa", - ).result() - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Reimage_MaximumSet_Gen.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_reimage_minimum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_reimage_minimum_set_gen.py deleted file mode 100644 index 79f8ae332839..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_reimage_minimum_set_gen.py +++ /dev/null @@ -1,42 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_scale_set_reimage_minimum_set_gen.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - client.virtual_machine_scale_sets.begin_reimage( - resource_group_name="rgcompute", - vm_scale_set_name="aaaaaaaaaaaaaaaaaaaaaaaaaaaa", - ).result() - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Reimage_MinimumSet_Gen.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_restart_maximum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_restart_maximum_set_gen.py deleted file mode 100644 index 7214f3df8de6..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_restart_maximum_set_gen.py +++ /dev/null @@ -1,42 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_scale_set_restart_maximum_set_gen.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - client.virtual_machine_scale_sets.begin_restart( - resource_group_name="rgcompute", - vm_scale_set_name="aaaaaaaaaaaaaaaaaaa", - ).result() - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Restart_MaximumSet_Gen.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_restart_minimum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_restart_minimum_set_gen.py deleted file mode 100644 index 79b1626b706c..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_restart_minimum_set_gen.py +++ /dev/null @@ -1,42 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_scale_set_restart_minimum_set_gen.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - client.virtual_machine_scale_sets.begin_restart( - resource_group_name="rgcompute", - vm_scale_set_name="aaaa", - ).result() - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Restart_MinimumSet_Gen.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_rolling_upgrade_cancel_maximum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_rolling_upgrade_cancel_maximum_set_gen.py deleted file mode 100644 index 42a218fdf744..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_rolling_upgrade_cancel_maximum_set_gen.py +++ /dev/null @@ -1,42 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_scale_set_rolling_upgrade_cancel_maximum_set_gen.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - client.virtual_machine_scale_set_rolling_upgrades.begin_cancel( - resource_group_name="rgcompute", - vm_scale_set_name="aaaaa", - ).result() - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetRollingUpgrade_Cancel_MaximumSet_Gen.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_rolling_upgrade_cancel_minimum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_rolling_upgrade_cancel_minimum_set_gen.py deleted file mode 100644 index 0a6d4fc96646..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_rolling_upgrade_cancel_minimum_set_gen.py +++ /dev/null @@ -1,42 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_scale_set_rolling_upgrade_cancel_minimum_set_gen.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - client.virtual_machine_scale_set_rolling_upgrades.begin_cancel( - resource_group_name="rgcompute", - vm_scale_set_name="aaaaaa", - ).result() - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetRollingUpgrade_Cancel_MinimumSet_Gen.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_rolling_upgrade_get_latest_maximum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_rolling_upgrade_get_latest_maximum_set_gen.py deleted file mode 100644 index cb49edd1abee..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_rolling_upgrade_get_latest_maximum_set_gen.py +++ /dev/null @@ -1,43 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_scale_set_rolling_upgrade_get_latest_maximum_set_gen.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.virtual_machine_scale_set_rolling_upgrades.get_latest( - resource_group_name="rgcompute", - vm_scale_set_name="aaaaaaaaaaaaaaaaaaaaaaaaa", - ) - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetRollingUpgrade_GetLatest_MaximumSet_Gen.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_rolling_upgrade_get_latest_minimum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_rolling_upgrade_get_latest_minimum_set_gen.py deleted file mode 100644 index 410501838af6..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_rolling_upgrade_get_latest_minimum_set_gen.py +++ /dev/null @@ -1,43 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_scale_set_rolling_upgrade_get_latest_minimum_set_gen.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.virtual_machine_scale_set_rolling_upgrades.get_latest( - resource_group_name="rgcompute", - vm_scale_set_name="aaaaaaaaaaaaaaaaa", - ) - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetRollingUpgrade_GetLatest_MinimumSet_Gen.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_rolling_upgrade_start_os_upgrade_maximum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_rolling_upgrade_start_os_upgrade_maximum_set_gen.py deleted file mode 100644 index 04acda0dd9b1..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_rolling_upgrade_start_os_upgrade_maximum_set_gen.py +++ /dev/null @@ -1,42 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_scale_set_rolling_upgrade_start_os_upgrade_maximum_set_gen.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - client.virtual_machine_scale_set_rolling_upgrades.begin_start_os_upgrade( - resource_group_name="rgcompute", - vm_scale_set_name="aaaa", - ).result() - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetRollingUpgrade_StartOSUpgrade_MaximumSet_Gen.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_rolling_upgrade_start_os_upgrade_minimum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_rolling_upgrade_start_os_upgrade_minimum_set_gen.py deleted file mode 100644 index 50070562fd46..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_rolling_upgrade_start_os_upgrade_minimum_set_gen.py +++ /dev/null @@ -1,42 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_scale_set_rolling_upgrade_start_os_upgrade_minimum_set_gen.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - client.virtual_machine_scale_set_rolling_upgrades.begin_start_os_upgrade( - resource_group_name="rgcompute", - vm_scale_set_name="aaaaaaaaaaaaaaaaaa", - ).result() - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetRollingUpgrade_StartOSUpgrade_MinimumSet_Gen.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_scale_out.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_scale_out.py deleted file mode 100644 index 5ab10863c3c1..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_scale_out.py +++ /dev/null @@ -1,43 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_scale_set_scale_out.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - client.virtual_machine_scale_sets.begin_scale_out( - resource_group_name="myResourceGroup", - vm_scale_set_name="{vmss-name}", - parameters={"capacity": 5, "properties": {"zone": "1"}}, - ).result() - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_ScaleOut.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_set_orchestration_service_state_maximum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_set_orchestration_service_state_maximum_set_gen.py deleted file mode 100644 index 442b6aae5d3e..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_set_orchestration_service_state_maximum_set_gen.py +++ /dev/null @@ -1,43 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_scale_set_set_orchestration_service_state_maximum_set_gen.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - client.virtual_machine_scale_sets.begin_set_orchestration_service_state( - resource_group_name="rgcompute", - vm_scale_set_name="aaaaaaaaaaaaaaaa", - parameters={"action": "Resume", "serviceName": "AutomaticRepairs"}, - ).result() - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_SetOrchestrationServiceState_MaximumSet_Gen.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_set_orchestration_service_state_minimum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_set_orchestration_service_state_minimum_set_gen.py deleted file mode 100644 index 4da959d7a8f1..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_set_orchestration_service_state_minimum_set_gen.py +++ /dev/null @@ -1,43 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_scale_set_set_orchestration_service_state_minimum_set_gen.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - client.virtual_machine_scale_sets.begin_set_orchestration_service_state( - resource_group_name="rgcompute", - vm_scale_set_name="aaaaaaaaaaaaaaaaaaaaaaaa", - parameters={"action": "Resume", "serviceName": "AutomaticRepairs"}, - ).result() - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_SetOrchestrationServiceState_MinimumSet_Gen.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_start_maximum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_start_maximum_set_gen.py deleted file mode 100644 index d705aadc47f9..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_start_maximum_set_gen.py +++ /dev/null @@ -1,42 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_scale_set_start_maximum_set_gen.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - client.virtual_machine_scale_sets.begin_start( - resource_group_name="rgcompute", - vm_scale_set_name="aaaaaaaaaaaaaaaaaaaaaaaa", - ).result() - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Start_MaximumSet_Gen.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_start_minimum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_start_minimum_set_gen.py deleted file mode 100644 index 290e908ae211..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_start_minimum_set_gen.py +++ /dev/null @@ -1,42 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_scale_set_start_minimum_set_gen.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - client.virtual_machine_scale_sets.begin_start( - resource_group_name="rgcompute", - vm_scale_set_name="aaaaaaaaaaaaaaaaaaa", - ).result() - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Start_MinimumSet_Gen.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_update_maximum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_update_maximum_set_gen.py deleted file mode 100644 index 23843c248eab..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_update_maximum_set_gen.py +++ /dev/null @@ -1,271 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_scale_set_update_maximum_set_gen.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.virtual_machine_scale_sets.begin_update( - resource_group_name="rgcompute", - vm_scale_set_name="aaaaaaaaaaaaa", - parameters={ - "identity": {"type": "SystemAssigned", "userAssignedIdentities": {"key3951": {}}}, - "plan": { - "name": "windows2016", - "product": "windows-data-science-vm", - "promotionCode": "aaaaaaaaaa", - "publisher": "microsoft-ads", - }, - "properties": { - "additionalCapabilities": {"hibernationEnabled": True, "ultraSSDEnabled": True}, - "automaticRepairsPolicy": {"enabled": True, "gracePeriod": "PT30M"}, - "doNotRunExtensionsOnOverprovisionedVMs": True, - "overprovision": True, - "proximityPlacementGroup": { - "id": "subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot" - }, - "scaleInPolicy": {"forceDeletion": True, "rules": ["OldestVM"]}, - "singlePlacementGroup": True, - "upgradePolicy": { - "automaticOSUpgradePolicy": { - "disableAutomaticRollback": True, - "enableAutomaticOSUpgrade": True, - "osRollingUpgradeDeferral": True, - }, - "mode": "Manual", - "rollingUpgradePolicy": { - "enableCrossZoneUpgrade": True, - "maxBatchInstancePercent": 49, - "maxSurge": True, - "maxUnhealthyInstancePercent": 81, - "maxUnhealthyUpgradedInstancePercent": 98, - "pauseTimeBetweenBatches": "aaaaaaaaaaaaaaa", - "prioritizeUnhealthyInstances": True, - "rollbackFailedInstancesOnPolicyBreach": True, - }, - }, - "virtualMachineProfile": { - "billingProfile": {"maxPrice": -1}, - "diagnosticsProfile": { - "bootDiagnostics": { - "enabled": True, - "storageUri": "http://{existing-storage-account-name}.blob.core.windows.net", - } - }, - "extensionProfile": { - "extensions": [ - { - "name": "{extension-name}", - "properties": { - "autoUpgradeMinorVersion": True, - "enableAutomaticUpgrade": True, - "forceUpdateTag": "aaaaaaaaa", - "protectedSettings": {}, - "provisionAfterExtensions": ["aa"], - "publisher": "{extension-Publisher}", - "settings": {}, - "suppressFailures": True, - "type": "{extension-Type}", - "typeHandlerVersion": "{handler-version}", - }, - } - ], - "extensionsTimeBudget": "PT1H20M", - }, - "licenseType": "aaaaaaaaaaaa", - "networkProfile": { - "healthProbe": { - "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/disk123" - }, - "networkApiVersion": "2020-11-01", - "networkInterfaceConfigurations": [ - { - "name": "aaaaaaaa", - "properties": { - "deleteOption": "Delete", - "dnsSettings": {"dnsServers": []}, - "enableAcceleratedNetworking": True, - "enableFpga": True, - "enableIPForwarding": True, - "ipConfigurations": [ - { - "name": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaa", - "properties": { - "applicationGatewayBackendAddressPools": [ - { - "id": "subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot" - } - ], - "applicationSecurityGroups": [ - { - "id": "subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot" - } - ], - "loadBalancerBackendAddressPools": [ - { - "id": "subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot" - } - ], - "loadBalancerInboundNatPools": [ - { - "id": "subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot" - } - ], - "primary": True, - "privateIPAddressVersion": "IPv4", - "publicIPAddressConfiguration": { - "name": "a", - "properties": { - "deleteOption": "Delete", - "dnsSettings": {"domainNameLabel": "aaaaaaaaaaaaaaaaaa"}, - "idleTimeoutInMinutes": 3, - }, - }, - "subnet": { - "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/disk123" - }, - }, - } - ], - "networkSecurityGroup": { - "id": "subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot" - }, - "primary": True, - }, - } - ], - }, - "osProfile": { - "customData": "aaaaaaaaaaaaaaaaaaaaaaaaaa", - "linuxConfiguration": { - "disablePasswordAuthentication": True, - "patchSettings": {"assessmentMode": "ImageDefault", "patchMode": "ImageDefault"}, - "provisionVMAgent": True, - "ssh": { - "publicKeys": [ - { - "keyData": "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCeClRAk2ipUs/l5voIsDC5q9RI+YSRd1Bvd/O+axgY4WiBzG+4FwJWZm/mLLe5DoOdHQwmU2FrKXZSW4w2sYE70KeWnrFViCOX5MTVvJgPE8ClugNl8RWth/tU849DvM9sT7vFgfVSHcAS2yDRyDlueii+8nF2ym8XWAPltFVCyLHRsyBp5YPqK8JFYIa1eybKsY3hEAxRCA+/7bq8et+Gj3coOsuRmrehav7rE6N12Pb80I6ofa6SM5XNYq4Xk0iYNx7R3kdz0Jj9XgZYWjAHjJmT0gTRoOnt6upOuxK7xI/ykWrllgpXrCPu3Ymz+c+ujaqcxDopnAl2lmf69/J1", - "path": "/home/{your-username}/.ssh/authorized_keys", - } - ] - }, - }, - "secrets": [ - { - "sourceVault": { - "id": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}" - }, - "vaultCertificates": [ - {"certificateStore": "aaaaaaaaaaaaaaaaaaaaaaaaa", "certificateUrl": "aaaaaaa"} - ], - } - ], - "windowsConfiguration": { - "additionalUnattendContent": [ - { - "componentName": "Microsoft-Windows-Shell-Setup", - "content": "aaaaaaaaaaaaaaaaaaaa", - "passName": "OobeSystem", - "settingName": "AutoLogon", - } - ], - "enableAutomaticUpdates": True, - "patchSettings": { - "assessmentMode": "ImageDefault", - "automaticByPlatformSettings": {"rebootSetting": "Never"}, - "enableHotpatching": True, - "patchMode": "AutomaticByPlatform", - }, - "provisionVMAgent": True, - "timeZone": "aaaaaaaaaaaaaaaa", - "winRM": {"listeners": [{"certificateUrl": "aaaaaaaaaaaaaaaaaaaaaa", "protocol": "Http"}]}, - }, - }, - "scheduledEventsProfile": { - "terminateNotificationProfile": {"enable": True, "notBeforeTimeout": "PT10M"} - }, - "securityProfile": { - "encryptionAtHost": True, - "securityType": "TrustedLaunch", - "uefiSettings": {"secureBootEnabled": True, "vTpmEnabled": True}, - }, - "storageProfile": { - "dataDisks": [ - { - "caching": "None", - "createOption": "Empty", - "diskIOPSReadWrite": 28, - "diskMBpsReadWrite": 15, - "diskSizeGB": 1023, - "lun": 26, - "managedDisk": { - "diskEncryptionSet": {"id": "aaaaaaaaaaaa"}, - "storageAccountType": "Standard_LRS", - }, - "name": "aaaaaaaaaaaaaaaaaaaaaaaaaa", - "writeAcceleratorEnabled": True, - } - ], - "imageReference": { - "id": "aaaaaaaaaaaaaaaaaaa", - "offer": "WindowsServer", - "publisher": "MicrosoftWindowsServer", - "sharedGalleryImageId": "aaaaaa", - "sku": "2016-Datacenter", - "version": "latest", - }, - "osDisk": { - "caching": "ReadWrite", - "diffDiskSettings": {"option": "Local", "placement": "CacheDisk"}, - "diskSizeGB": 6, - "image": { - "uri": "http://{existing-storage-account-name}.blob.core.windows.net/{existing-container-name}/myDisk.vhd" - }, - "managedDisk": { - "diskEncryptionSet": {"id": "aaaaaaaaaaaa"}, - "storageAccountType": "Standard_LRS", - }, - "vhdContainers": ["aa"], - "writeAcceleratorEnabled": True, - }, - }, - "userData": "aaaaaaaaaaaaa", - }, - }, - "sku": {"capacity": 7, "name": "DSv3-Type1", "tier": "aaa"}, - "tags": {"key246": "aaaaaaaaaaaaaaaaaaaaaaaa"}, - "zones": ["1", "2", "3"], - }, - ).result() - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Update_MaximumSet_Gen.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_approve_rolling_upgrade.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_approve_rolling_upgrade.py deleted file mode 100644 index a1d08f5bd982..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_approve_rolling_upgrade.py +++ /dev/null @@ -1,43 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_scale_set_vm_approve_rolling_upgrade.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - client.virtual_machine_scale_set_vms.begin_approve_rolling_upgrade( - resource_group_name="rgcompute", - vm_scale_set_name="vmssToApproveRollingUpgradeOn", - instance_id="0123", - ).result() - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_ApproveRollingUpgrade.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_attach_detach_data_disks_maximum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_attach_detach_data_disks_maximum_set_gen.py deleted file mode 100644 index 62bb844156d6..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_attach_detach_data_disks_maximum_set_gen.py +++ /dev/null @@ -1,76 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_scale_set_vm_attach_detach_data_disks_maximum_set_gen.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.virtual_machine_scale_set_vms.begin_attach_detach_data_disks( - resource_group_name="rgcompute", - vm_scale_set_name="azure-vmscaleset", - instance_id="0", - parameters={ - "dataDisksToAttach": [ - { - "caching": "ReadOnly", - "diskEncryptionSet": { - "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSets/{existing-diskEncryptionSet-name}" - }, - "diskId": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/vmss3176_vmss3176_0_disk2_6c4f554bdafa49baa780eb2d128ff39d", - "lun": 1, - "writeAcceleratorEnabled": True, - }, - { - "caching": "ReadWrite", - "diskEncryptionSet": { - "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSets/{existing-diskEncryptionSet-name}" - }, - "diskId": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/vmss3176_vmss3176_2_disk3_7d5e664bdafa49baa780eb2d128ff38e", - "lun": 2, - "writeAcceleratorEnabled": False, - }, - ], - "dataDisksToDetach": [ - { - "detachOption": "ForceDetach", - "diskId": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/vmss3176_vmss3176_1_disk1_1a4e784bdafa49baa780eb2d128ff65x", - }, - { - "detachOption": "ForceDetach", - "diskId": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/vmss3176_vmss3176_4_disk4_4d4e784bdafa49baa780eb2d256ff41z", - }, - ], - }, - ).result() - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_AttachDetachDataDisks_MaximumSet_Gen.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_attach_detach_data_disks_minimum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_attach_detach_data_disks_minimum_set_gen.py deleted file mode 100644 index a40416e2c0bc..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_attach_detach_data_disks_minimum_set_gen.py +++ /dev/null @@ -1,56 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_scale_set_vm_attach_detach_data_disks_minimum_set_gen.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.virtual_machine_scale_set_vms.begin_attach_detach_data_disks( - resource_group_name="rgcompute", - vm_scale_set_name="azure-vmscaleset", - instance_id="0", - parameters={ - "dataDisksToAttach": [ - { - "diskId": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/vmss3176_vmss3176_0_disk2_6c4f554bdafa49baa780eb2d128ff39d" - } - ], - "dataDisksToDetach": [ - { - "diskId": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/vmss3176_vmss3176_1_disk1_1a4e784bdafa49baa780eb2d128ff65x" - } - ], - }, - ).result() - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_AttachDetachDataDisks_MinimumSet_Gen.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_deallocate_maximum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_deallocate_maximum_set_gen.py deleted file mode 100644 index 97bcf724bf82..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_deallocate_maximum_set_gen.py +++ /dev/null @@ -1,43 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_scale_set_vm_deallocate_maximum_set_gen.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - client.virtual_machine_scale_set_vms.begin_deallocate( - resource_group_name="rgcompute", - vm_scale_set_name="aaaaaaaaaaaaaaaaaaaaaaaa", - instance_id="aaaaaaaaaaaaaaaaaaaaaa", - ).result() - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_Deallocate_MaximumSet_Gen.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_deallocate_minimum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_deallocate_minimum_set_gen.py deleted file mode 100644 index d31d6be520ac..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_deallocate_minimum_set_gen.py +++ /dev/null @@ -1,43 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_scale_set_vm_deallocate_minimum_set_gen.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - client.virtual_machine_scale_set_vms.begin_deallocate( - resource_group_name="rgcompute", - vm_scale_set_name="aaaaaaaaaaaaaaaaaaaaaaaa", - instance_id="aaaaaa", - ).result() - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_Deallocate_MinimumSet_Gen.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_delete_force.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_delete_force.py deleted file mode 100644 index 800c9a3481dc..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_delete_force.py +++ /dev/null @@ -1,43 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_scale_set_vm_delete_force.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - client.virtual_machine_scale_set_vms.begin_delete( - resource_group_name="myResourceGroup", - vm_scale_set_name="myvmScaleSet", - instance_id="0", - ).result() - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_Delete_Force.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_extension_create.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_extension_create.py deleted file mode 100644 index cd07c4416dc8..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_extension_create.py +++ /dev/null @@ -1,54 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_scale_set_vm_extension_create.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.virtual_machine_scale_set_vm_extensions.begin_create_or_update( - resource_group_name="myResourceGroup", - vm_scale_set_name="myvmScaleSet", - instance_id="0", - vm_extension_name="myVMExtension", - extension_parameters={ - "properties": { - "autoUpgradeMinorVersion": True, - "publisher": "extPublisher", - "settings": {"UserName": "xyz@microsoft.com"}, - "type": "extType", - "typeHandlerVersion": "1.2", - } - }, - ).result() - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetVMExtension_Create.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_extension_delete.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_extension_delete.py deleted file mode 100644 index 80d7f1fee6b5..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_extension_delete.py +++ /dev/null @@ -1,44 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_scale_set_vm_extension_delete.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - client.virtual_machine_scale_set_vm_extensions.begin_delete( - resource_group_name="myResourceGroup", - vm_scale_set_name="myvmScaleSet", - instance_id="0", - vm_extension_name="myVMExtension", - ).result() - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetVMExtension_Delete.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_extension_get.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_extension_get.py deleted file mode 100644 index 6199980a7c7b..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_extension_get.py +++ /dev/null @@ -1,45 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_scale_set_vm_extension_get.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.virtual_machine_scale_set_vm_extensions.get( - resource_group_name="myResourceGroup", - vm_scale_set_name="myvmScaleSet", - instance_id="0", - vm_extension_name="myVMExtension", - ) - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetVMExtension_Get.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_extension_list.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_extension_list.py deleted file mode 100644 index 8e2aa73199b5..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_extension_list.py +++ /dev/null @@ -1,44 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_scale_set_vm_extension_list.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.virtual_machine_scale_set_vm_extensions.list( - resource_group_name="myResourceGroup", - vm_scale_set_name="myvmScaleSet", - instance_id="0", - ) - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetVMExtension_List.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_extension_update.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_extension_update.py deleted file mode 100644 index c31c8ac16d17..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_extension_update.py +++ /dev/null @@ -1,54 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_scale_set_vm_extension_update.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.virtual_machine_scale_set_vm_extensions.begin_update( - resource_group_name="myResourceGroup", - vm_scale_set_name="myvmScaleSet", - instance_id="0", - vm_extension_name="myVMExtension", - extension_parameters={ - "properties": { - "autoUpgradeMinorVersion": True, - "publisher": "extPublisher", - "settings": {"UserName": "xyz@microsoft.com"}, - "type": "extType", - "typeHandlerVersion": "1.2", - } - }, - ).result() - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetVMExtension_Update.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_get_instance_view_auto_placed_on_dedicated_host_group.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_get_instance_view_auto_placed_on_dedicated_host_group.py deleted file mode 100644 index beb0402c99ad..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_get_instance_view_auto_placed_on_dedicated_host_group.py +++ /dev/null @@ -1,44 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_scale_set_vm_get_instance_view_auto_placed_on_dedicated_host_group.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.virtual_machine_scale_set_vms.get_instance_view( - resource_group_name="myResourceGroup", - vm_scale_set_name="myVirtualMachineScaleSet", - instance_id="0", - ) - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_Get_InstanceViewAutoPlacedOnDedicatedHostGroup.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_get_with_resilient_vm_deletion_status.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_get_with_resilient_vm_deletion_status.py deleted file mode 100644 index 86b237d35748..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_get_with_resilient_vm_deletion_status.py +++ /dev/null @@ -1,44 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_scale_set_vm_get_with_resilient_vm_deletion_status.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.virtual_machine_scale_set_vms.get( - resource_group_name="myResourceGroup", - vm_scale_set_name="{vmss-name}", - instance_id="1", - ) - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_Get_WithResilientVMDeletionStatus.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_get_with_user_data.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_get_with_user_data.py deleted file mode 100644 index 5bc278017021..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_get_with_user_data.py +++ /dev/null @@ -1,44 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_scale_set_vm_get_with_user_data.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.virtual_machine_scale_set_vms.get( - resource_group_name="myResourceGroup", - vm_scale_set_name="{vmss-name}", - instance_id="0", - ) - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_Get_WithUserData.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_get_with_vm_size_properties.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_get_with_vm_size_properties.py deleted file mode 100644 index 9848ae833a5c..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_get_with_vm_size_properties.py +++ /dev/null @@ -1,44 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_scale_set_vm_get_with_vm_size_properties.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.virtual_machine_scale_set_vms.get( - resource_group_name="myResourceGroup", - vm_scale_set_name="{vmss-name}", - instance_id="0", - ) - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_Get_WithVMSizeProperties.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_list_maximum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_list_maximum_set_gen.py deleted file mode 100644 index 2613d7bd4f5c..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_list_maximum_set_gen.py +++ /dev/null @@ -1,44 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_scale_set_vm_list_maximum_set_gen.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.virtual_machine_scale_set_vms.list( - resource_group_name="rgcompute", - virtual_machine_scale_set_name="aaaaaaaaaaaaaaaaaaaaaa", - ) - for item in response: - print(item) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_List_MaximumSet_Gen.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_list_minimum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_list_minimum_set_gen.py deleted file mode 100644 index 9c6bd1e14d5e..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_list_minimum_set_gen.py +++ /dev/null @@ -1,44 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_scale_set_vm_list_minimum_set_gen.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.virtual_machine_scale_set_vms.list( - resource_group_name="rgcompute", - virtual_machine_scale_set_name="aaaaaaaaaaaaaa", - ) - for item in response: - print(item) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_List_MinimumSet_Gen.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_list_with_resiliency_view.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_list_with_resiliency_view.py deleted file mode 100644 index 8f3a059c5997..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_list_with_resiliency_view.py +++ /dev/null @@ -1,44 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_scale_set_vm_list_with_resiliency_view.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.virtual_machine_scale_set_vms.list( - resource_group_name="resourceGroupname", - virtual_machine_scale_set_name="vmssName", - ) - for item in response: - print(item) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_List_WithResiliencyView.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_perform_maintenance_maximum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_perform_maintenance_maximum_set_gen.py deleted file mode 100644 index 5606b8e11cc7..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_perform_maintenance_maximum_set_gen.py +++ /dev/null @@ -1,43 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_scale_set_vm_perform_maintenance_maximum_set_gen.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - client.virtual_machine_scale_set_vms.begin_perform_maintenance( - resource_group_name="rgcompute", - vm_scale_set_name="aaaaaaaaaaaaaa", - instance_id="aaaaaaaaaaaa", - ).result() - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_PerformMaintenance_MaximumSet_Gen.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_perform_maintenance_minimum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_perform_maintenance_minimum_set_gen.py deleted file mode 100644 index a135d6503439..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_perform_maintenance_minimum_set_gen.py +++ /dev/null @@ -1,43 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_scale_set_vm_perform_maintenance_minimum_set_gen.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - client.virtual_machine_scale_set_vms.begin_perform_maintenance( - resource_group_name="rgcompute", - vm_scale_set_name="aaaaaaaaaa", - instance_id="aaaa", - ).result() - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_PerformMaintenance_MinimumSet_Gen.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_power_off_maximum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_power_off_maximum_set_gen.py deleted file mode 100644 index 49824dcc4090..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_power_off_maximum_set_gen.py +++ /dev/null @@ -1,43 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_scale_set_vm_power_off_maximum_set_gen.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - client.virtual_machine_scale_set_vms.begin_power_off( - resource_group_name="rgcompute", - vm_scale_set_name="aaaaaa", - instance_id="aaaaaaaaa", - ).result() - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_PowerOff_MaximumSet_Gen.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_power_off_minimum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_power_off_minimum_set_gen.py deleted file mode 100644 index 79bb55ab9e5d..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_power_off_minimum_set_gen.py +++ /dev/null @@ -1,43 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_scale_set_vm_power_off_minimum_set_gen.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - client.virtual_machine_scale_set_vms.begin_power_off( - resource_group_name="rgcompute", - vm_scale_set_name="aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", - instance_id="aaaaaaaaaaaaaaaaaaaaaa", - ).result() - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_PowerOff_MinimumSet_Gen.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_redeploy_maximum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_redeploy_maximum_set_gen.py deleted file mode 100644 index 7d18398fbe38..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_redeploy_maximum_set_gen.py +++ /dev/null @@ -1,43 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_scale_set_vm_redeploy_maximum_set_gen.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - client.virtual_machine_scale_set_vms.begin_redeploy( - resource_group_name="rgcompute", - vm_scale_set_name="aaaaaaaaaaaaaaaaaaaaaaa", - instance_id="aaaaaaaaaaaaaaaaaaaaaaaaaaaaa", - ).result() - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_Redeploy_MaximumSet_Gen.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_redeploy_minimum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_redeploy_minimum_set_gen.py deleted file mode 100644 index fab3b0dc11d4..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_redeploy_minimum_set_gen.py +++ /dev/null @@ -1,43 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_scale_set_vm_redeploy_minimum_set_gen.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - client.virtual_machine_scale_set_vms.begin_redeploy( - resource_group_name="rgcompute", - vm_scale_set_name="aaaaaaaaaaaaa", - instance_id="aaaaaaaaaaaaaaaaaaaaaaaaaaaaa", - ).result() - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_Redeploy_MinimumSet_Gen.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_reimage_all_maximum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_reimage_all_maximum_set_gen.py deleted file mode 100644 index 8f28ec52e796..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_reimage_all_maximum_set_gen.py +++ /dev/null @@ -1,43 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_scale_set_vm_reimage_all_maximum_set_gen.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - client.virtual_machine_scale_set_vms.begin_reimage_all( - resource_group_name="rgcompute", - vm_scale_set_name="aaaaaaaaaaaaaaaaaaaaaaaa", - instance_id="aaaaaaaaaaaaaaaaaaa", - ).result() - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_ReimageAll_MaximumSet_Gen.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_reimage_all_minimum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_reimage_all_minimum_set_gen.py deleted file mode 100644 index 1e4466060afa..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_reimage_all_minimum_set_gen.py +++ /dev/null @@ -1,43 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_scale_set_vm_reimage_all_minimum_set_gen.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - client.virtual_machine_scale_set_vms.begin_reimage_all( - resource_group_name="rgcompute", - vm_scale_set_name="aaaaaaaaaaaaaaaaaaaaaaaaa", - instance_id="aaaaaaaaaaaaaaaaaaaaaaaaaaaa", - ).result() - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_ReimageAll_MinimumSet_Gen.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_reimage_maximum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_reimage_maximum_set_gen.py deleted file mode 100644 index 75f5a1489992..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_reimage_maximum_set_gen.py +++ /dev/null @@ -1,43 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_scale_set_vm_reimage_maximum_set_gen.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - client.virtual_machine_scale_set_vms.begin_reimage( - resource_group_name="rgcompute", - vm_scale_set_name="aaaaaaaaaaaaaaaa", - instance_id="aaaaaaaaaaaaaaaaaaaaaaaaaaaaa", - ).result() - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_Reimage_MaximumSet_Gen.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_reimage_minimum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_reimage_minimum_set_gen.py deleted file mode 100644 index 68cdfbcf837e..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_reimage_minimum_set_gen.py +++ /dev/null @@ -1,43 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_scale_set_vm_reimage_minimum_set_gen.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - client.virtual_machine_scale_set_vms.begin_reimage( - resource_group_name="rgcompute", - vm_scale_set_name="aaaaaaa", - instance_id="aaaaaaaaaaaaa", - ).result() - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_Reimage_MinimumSet_Gen.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_restart_maximum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_restart_maximum_set_gen.py deleted file mode 100644 index a21c56676388..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_restart_maximum_set_gen.py +++ /dev/null @@ -1,43 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_scale_set_vm_restart_maximum_set_gen.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - client.virtual_machine_scale_set_vms.begin_restart( - resource_group_name="rgcompute", - vm_scale_set_name="aa", - instance_id="aaaaaaaaaaaaaaaaa", - ).result() - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_Restart_MaximumSet_Gen.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_restart_minimum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_restart_minimum_set_gen.py deleted file mode 100644 index 50324da1d971..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_restart_minimum_set_gen.py +++ /dev/null @@ -1,43 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_scale_set_vm_restart_minimum_set_gen.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - client.virtual_machine_scale_set_vms.begin_restart( - resource_group_name="rgcompute", - vm_scale_set_name="aaaaaaaaaaaa", - instance_id="aaaaaa", - ).result() - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_Restart_MinimumSet_Gen.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_retrieve_boot_diagnostics_data.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_retrieve_boot_diagnostics_data.py deleted file mode 100644 index 8c0249480fe1..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_retrieve_boot_diagnostics_data.py +++ /dev/null @@ -1,44 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_scale_set_vm_retrieve_boot_diagnostics_data.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.virtual_machine_scale_set_vms.retrieve_boot_diagnostics_data( - resource_group_name="ResourceGroup", - vm_scale_set_name="myvmScaleSet", - instance_id="0", - ) - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_RetrieveBootDiagnosticsData.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_simulate_eviction.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_simulate_eviction.py deleted file mode 100644 index 9473e31579f9..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_simulate_eviction.py +++ /dev/null @@ -1,43 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_scale_set_vm_simulate_eviction.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - client.virtual_machine_scale_set_vms.simulate_eviction( - resource_group_name="ResourceGroup", - vm_scale_set_name="VmScaleSetName", - instance_id="InstanceId", - ) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_SimulateEviction.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_start_maximum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_start_maximum_set_gen.py deleted file mode 100644 index 66ca61bcf858..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_start_maximum_set_gen.py +++ /dev/null @@ -1,43 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_scale_set_vm_start_maximum_set_gen.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - client.virtual_machine_scale_set_vms.begin_start( - resource_group_name="rgcompute", - vm_scale_set_name="aaaaaaaaaaaaaa", - instance_id="aaaaaaaaaaaaa", - ).result() - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_Start_MaximumSet_Gen.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_start_minimum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_start_minimum_set_gen.py deleted file mode 100644 index 706324558bd6..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_start_minimum_set_gen.py +++ /dev/null @@ -1,43 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_scale_set_vm_start_minimum_set_gen.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - client.virtual_machine_scale_set_vms.begin_start( - resource_group_name="rgcompute", - vm_scale_set_name="aaaaaaaaaaaaaaaaaaaaaaaa", - instance_id="aaaaaaaaaaaaaaaaa", - ).result() - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_Start_MinimumSet_Gen.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_update_maximum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_update_maximum_set_gen.py deleted file mode 100644 index 14bdc54e46cf..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_update_maximum_set_gen.py +++ /dev/null @@ -1,442 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_scale_set_vm_update_maximum_set_gen.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.virtual_machine_scale_set_vms.begin_update( - resource_group_name="rgcompute", - vm_scale_set_name="aaaaaaaaaaaaaa", - instance_id="aaaaaaaaaaaaaaaaaaaaaaaaaaaaa", - parameters={ - "location": "westus", - "plan": { - "name": "aaaaaaaaaa", - "product": "aaaaaaaaaaaaaaaaaaaa", - "promotionCode": "aaaaaaaaaaaaaaaaaaaa", - "publisher": "aaaaaaaaaaaaaaaaaaaaaa", - }, - "properties": { - "additionalCapabilities": {"hibernationEnabled": True, "ultraSSDEnabled": True}, - "availabilitySet": { - "id": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}" - }, - "diagnosticsProfile": {"bootDiagnostics": {"enabled": True, "storageUri": "aaaaaaaaaaaaa"}}, - "hardwareProfile": { - "vmSize": "Basic_A0", - "vmSizeProperties": {"vCPUsAvailable": 9, "vCPUsPerCore": 12}, - }, - "instanceView": { - "bootDiagnostics": { - "status": { - "code": "aaaaaaaaaaaaaaaaaaaaaaa", - "displayStatus": "aaaaaa", - "level": "Info", - "message": "a", - "time": "2021-11-30T12:58:26.522Z", - } - }, - "disks": [ - { - "encryptionSettings": [ - { - "diskEncryptionKey": { - "secretUrl": "aaaaaaaa", - "sourceVault": { - "id": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}" - }, - }, - "enabled": True, - "keyEncryptionKey": { - "keyUrl": "aaaaaaaaaaaaaa", - "sourceVault": { - "id": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}" - }, - }, - } - ], - "name": "aaaaaaaaaaa", - "statuses": [ - { - "code": "aaaaaaaaaaaaaaaaaaaaaaa", - "displayStatus": "aaaaaa", - "level": "Info", - "message": "a", - "time": "2021-11-30T12:58:26.522Z", - } - ], - } - ], - "extensions": [ - { - "name": "aaaaaaaaaaaaaaaaa", - "statuses": [ - { - "code": "aaaaaaaaaaaaaaaaaaaaaaa", - "displayStatus": "aaaaaa", - "level": "Info", - "message": "a", - "time": "2021-11-30T12:58:26.522Z", - } - ], - "substatuses": [ - { - "code": "aaaaaaaaaaaaaaaaaaaaaaa", - "displayStatus": "aaaaaa", - "level": "Info", - "message": "a", - "time": "2021-11-30T12:58:26.522Z", - } - ], - "type": "aaaaaaaaa", - "typeHandlerVersion": "aaaaaaaaaaaaaaaaaaaaaaaaaa", - } - ], - "maintenanceRedeployStatus": { - "isCustomerInitiatedMaintenanceAllowed": True, - "lastOperationMessage": "aaaaaa", - "lastOperationResultCode": "None", - "maintenanceWindowEndTime": "2021-11-30T12:58:26.531Z", - "maintenanceWindowStartTime": "2021-11-30T12:58:26.531Z", - "preMaintenanceWindowEndTime": "2021-11-30T12:58:26.531Z", - "preMaintenanceWindowStartTime": "2021-11-30T12:58:26.531Z", - }, - "placementGroupId": "aaa", - "platformFaultDomain": 14, - "platformUpdateDomain": 23, - "rdpThumbPrint": "aaaaaaaaaaaaaaaaaaaaaaaaaaa", - "statuses": [ - { - "code": "aaaaaaaaaaaaaaaaaaaaaaa", - "displayStatus": "aaaaaa", - "level": "Info", - "message": "a", - "time": "2021-11-30T12:58:26.522Z", - } - ], - "vmAgent": { - "extensionHandlers": [ - { - "status": { - "code": "aaaaaaaaaaaaaaaaaaaaaaa", - "displayStatus": "aaaaaa", - "level": "Info", - "message": "a", - "time": "2021-11-30T12:58:26.522Z", - }, - "type": "aaaaaaaaaaaaa", - "typeHandlerVersion": "aaaaa", - } - ], - "statuses": [ - { - "code": "aaaaaaaaaaaaaaaaaaaaaaa", - "displayStatus": "aaaaaa", - "level": "Info", - "message": "a", - "time": "2021-11-30T12:58:26.522Z", - } - ], - "vmAgentVersion": "aaaaaaaaaaaaaaaaaaaaaaa", - }, - "vmHealth": { - "status": { - "code": "aaaaaaaaaaaaaaaaaaaaaaa", - "displayStatus": "aaaaaa", - "level": "Info", - "message": "a", - "time": "2021-11-30T12:58:26.522Z", - } - }, - }, - "licenseType": "aaaaaaaaaa", - "networkProfile": { - "networkApiVersion": "2020-11-01", - "networkInterfaceConfigurations": [ - { - "name": "aaaaaaaaaaa", - "properties": { - "deleteOption": "Delete", - "dnsSettings": {"dnsServers": ["aaaaaa"]}, - "dscpConfiguration": { - "id": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}" - }, - "enableAcceleratedNetworking": True, - "enableFpga": True, - "enableIPForwarding": True, - "ipConfigurations": [ - { - "name": "aa", - "properties": { - "applicationGatewayBackendAddressPools": [ - { - "id": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}" - } - ], - "applicationSecurityGroups": [ - { - "id": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}" - } - ], - "loadBalancerBackendAddressPools": [ - { - "id": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}" - } - ], - "primary": True, - "privateIPAddressVersion": "IPv4", - "publicIPAddressConfiguration": { - "name": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaa", - "properties": { - "deleteOption": "Delete", - "dnsSettings": {"domainNameLabel": "aaaaaaaaaaaaaaaaaaaaaaaaa"}, - "idleTimeoutInMinutes": 2, - "ipTags": [ - { - "ipTagType": "aaaaaaaaaaaaaaaaaaaaaaaaa", - "tag": "aaaaaaaaaaaaaaaaaaaa", - } - ], - "publicIPAddressVersion": "IPv4", - "publicIPAllocationMethod": "Dynamic", - "publicIPPrefix": { - "id": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}" - }, - }, - "sku": {"name": "Basic", "tier": "Regional"}, - }, - "subnet": { - "id": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}" - }, - }, - } - ], - "networkSecurityGroup": { - "id": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}" - }, - "primary": True, - }, - } - ], - "networkInterfaces": [ - { - "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachineScaleSets/{vmss-name}/virtualMachines/0/networkInterfaces/vmsstestnetconfig5415", - "properties": {"deleteOption": "Delete", "primary": True}, - } - ], - }, - "networkProfileConfiguration": { - "networkInterfaceConfigurations": [ - { - "name": "vmsstestnetconfig5415", - "properties": { - "deleteOption": "Delete", - "dnsSettings": {"dnsServers": []}, - "enableAcceleratedNetworking": True, - "enableFpga": True, - "enableIPForwarding": True, - "ipConfigurations": [ - { - "name": "vmsstestnetconfig9693", - "properties": { - "applicationGatewayBackendAddressPools": [ - { - "id": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}" - } - ], - "applicationSecurityGroups": [ - { - "id": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}" - } - ], - "loadBalancerBackendAddressPools": [ - { - "id": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}" - } - ], - "loadBalancerInboundNatPools": [ - { - "id": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}" - } - ], - "primary": True, - "privateIPAddressVersion": "IPv4", - "publicIPAddressConfiguration": { - "name": "aaaaaaaaaaaaaaaaaa", - "properties": { - "deleteOption": "Delete", - "dnsSettings": {"domainNameLabel": "aaaaaaaaaaaaaaaaaa"}, - "idleTimeoutInMinutes": 18, - "ipTags": [ - {"ipTagType": "aaaaaaa", "tag": "aaaaaaaaaaaaaaaaaaaaaaaaaaa"} - ], - "publicIPAddressVersion": "IPv4", - "publicIPPrefix": { - "id": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}" - }, - }, - "sku": {"name": "Basic", "tier": "Regional"}, - }, - "subnet": { - "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/vn4071/subnets/sn5503" - }, - }, - } - ], - "networkSecurityGroup": { - "id": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}" - }, - "primary": True, - }, - } - ] - }, - "osProfile": { - "adminPassword": "aaaaaaaaaaaaaaaa", - "adminUsername": "Foo12", - "allowExtensionOperations": True, - "computerName": "test000000", - "customData": "aaaa", - "linuxConfiguration": { - "disablePasswordAuthentication": True, - "patchSettings": {"assessmentMode": "ImageDefault", "patchMode": "ImageDefault"}, - "provisionVMAgent": True, - "ssh": {"publicKeys": [{"keyData": "aaaaaa", "path": "aaa"}]}, - }, - "requireGuestProvisionSignal": True, - "secrets": [], - "windowsConfiguration": { - "additionalUnattendContent": [ - { - "componentName": "Microsoft-Windows-Shell-Setup", - "content": "aaaaaaaaaaaaaaaaaaaa", - "passName": "OobeSystem", - "settingName": "AutoLogon", - } - ], - "enableAutomaticUpdates": True, - "patchSettings": { - "assessmentMode": "ImageDefault", - "enableHotpatching": True, - "patchMode": "Manual", - }, - "provisionVMAgent": True, - "timeZone": "aaaaaaaaaaaaaaaaaaaaaaaaaaa", - "winRM": {"listeners": [{"certificateUrl": "aaaaaaaaaaaaaaaaaaaaaa", "protocol": "Http"}]}, - }, - }, - "protectionPolicy": {"protectFromScaleIn": True, "protectFromScaleSetActions": True}, - "securityProfile": { - "encryptionAtHost": True, - "securityType": "TrustedLaunch", - "uefiSettings": {"secureBootEnabled": True, "vTpmEnabled": True}, - }, - "storageProfile": { - "dataDisks": [ - { - "caching": "None", - "createOption": "Empty", - "deleteOption": "Delete", - "detachOption": "ForceDetach", - "diskSizeGB": 128, - "image": { - "uri": "https://{storageAccountName}.blob.core.windows.net/{containerName}/{vhdName}.vhd" - }, - "lun": 1, - "managedDisk": { - "diskEncryptionSet": {"id": "aaaaaaaaaaaa"}, - "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/vmss3176_vmss3176_0_disk2_6c4f554bdafa49baa780eb2d128ff39d", - "storageAccountType": "Standard_LRS", - }, - "name": "vmss3176_vmss3176_0_disk2_6c4f554bdafa49baa780eb2d128ff39d", - "toBeDetached": True, - "vhd": { - "uri": "https://{storageAccountName}.blob.core.windows.net/{containerName}/{vhdName}.vhd" - }, - "writeAcceleratorEnabled": True, - } - ], - "imageReference": { - "id": "a", - "offer": "WindowsServer", - "publisher": "MicrosoftWindowsServer", - "sharedGalleryImageId": "aaaaaaaaaaaaaaaaaaaa", - "sku": "2012-R2-Datacenter", - "version": "4.127.20180315", - }, - "osDisk": { - "caching": "None", - "createOption": "FromImage", - "deleteOption": "Delete", - "diffDiskSettings": {"option": "Local", "placement": "CacheDisk"}, - "diskSizeGB": 127, - "encryptionSettings": { - "diskEncryptionKey": { - "secretUrl": "aaaaaaaa", - "sourceVault": { - "id": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}" - }, - }, - "enabled": True, - "keyEncryptionKey": { - "keyUrl": "aaaaaaaaaaaaaa", - "sourceVault": { - "id": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}" - }, - }, - }, - "image": { - "uri": "https://{storageAccountName}.blob.core.windows.net/{containerName}/{vhdName}.vhd" - }, - "managedDisk": { - "diskEncryptionSet": {"id": "aaaaaaaaaaaa"}, - "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/vmss3176_vmss3176_0_OsDisk_1_6d72b805e50e4de6830303c5055077fc", - "storageAccountType": "Standard_LRS", - }, - "name": "vmss3176_vmss3176_0_OsDisk_1_6d72b805e50e4de6830303c5055077fc", - "osType": "Windows", - "vhd": { - "uri": "https://{storageAccountName}.blob.core.windows.net/{containerName}/{vhdName}.vhd" - }, - "writeAcceleratorEnabled": True, - }, - }, - "userData": "RXhhbXBsZSBVc2VyRGF0YQ==", - }, - "sku": {"capacity": 29, "name": "Classic", "tier": "aaaaaaaaaaaaaa"}, - "tags": {}, - }, - ).result() - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_Update_MaximumSet_Gen.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_update_minimum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_update_minimum_set_gen.py deleted file mode 100644 index cea788477505..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_update_minimum_set_gen.py +++ /dev/null @@ -1,45 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.compute import ComputeManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-compute -# USAGE - python virtual_machine_scale_set_vm_update_minimum_set_gen.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ComputeManagementClient( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.virtual_machine_scale_set_vms.begin_update( - resource_group_name="rgcompute", - vm_scale_set_name="aaaaaaaaaaaaaaaaaa", - instance_id="aaaaaaaaaaaaaaaaaaaa", - parameters={"location": "westus"}, - ).result() - print(response) - - -# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_Update_MinimumSet_Gen.json -if __name__ == "__main__": - main() diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/conftest.py b/sdk/compute/azure-mgmt-compute/generated_tests/conftest.py index c36a70b6cce1..987867109ab2 100644 --- a/sdk/compute/azure-mgmt-compute/generated_tests/conftest.py +++ b/sdk/compute/azure-mgmt-compute/generated_tests/conftest.py @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import os @@ -21,14 +21,14 @@ # For security, please avoid record sensitive identity information in recordings @pytest.fixture(scope="session", autouse=True) def add_sanitizers(test_proxy): - computemanagement_subscription_id = os.environ.get("AZURE_SUBSCRIPTION_ID", "00000000-0000-0000-0000-000000000000") - computemanagement_tenant_id = os.environ.get("AZURE_TENANT_ID", "00000000-0000-0000-0000-000000000000") - computemanagement_client_id = os.environ.get("AZURE_CLIENT_ID", "00000000-0000-0000-0000-000000000000") - computemanagement_client_secret = os.environ.get("AZURE_CLIENT_SECRET", "00000000-0000-0000-0000-000000000000") - add_general_regex_sanitizer(regex=computemanagement_subscription_id, value="00000000-0000-0000-0000-000000000000") - add_general_regex_sanitizer(regex=computemanagement_tenant_id, value="00000000-0000-0000-0000-000000000000") - add_general_regex_sanitizer(regex=computemanagement_client_id, value="00000000-0000-0000-0000-000000000000") - add_general_regex_sanitizer(regex=computemanagement_client_secret, value="00000000-0000-0000-0000-000000000000") + compute_subscription_id = os.environ.get("AZURE_SUBSCRIPTION_ID", "00000000-0000-0000-0000-000000000000") + compute_tenant_id = os.environ.get("AZURE_TENANT_ID", "00000000-0000-0000-0000-000000000000") + compute_client_id = os.environ.get("AZURE_CLIENT_ID", "00000000-0000-0000-0000-000000000000") + compute_client_secret = os.environ.get("AZURE_CLIENT_SECRET", "00000000-0000-0000-0000-000000000000") + add_general_regex_sanitizer(regex=compute_subscription_id, value="00000000-0000-0000-0000-000000000000") + add_general_regex_sanitizer(regex=compute_tenant_id, value="00000000-0000-0000-0000-000000000000") + add_general_regex_sanitizer(regex=compute_client_id, value="00000000-0000-0000-0000-000000000000") + add_general_regex_sanitizer(regex=compute_client_secret, value="00000000-0000-0000-0000-000000000000") add_header_regex_sanitizer(key="Set-Cookie", value="[set-cookie;]") add_header_regex_sanitizer(key="Cookie", value="cookie;") diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_availability_sets_operations.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_availability_sets_operations.py similarity index 63% rename from sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_availability_sets_operations.py rename to sdk/compute/azure-mgmt-compute/generated_tests/test_compute_availability_sets_operations.py index a92c3216139a..3f804efa0e68 100644 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_availability_sets_operations.py +++ b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_availability_sets_operations.py @@ -2,11 +2,11 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.compute import ComputeManagementClient +from azure.mgmt.compute import ComputeClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy @@ -14,30 +14,9 @@ @pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestComputeManagementAvailabilitySetsOperations(AzureMgmtRecordedTestCase): +class TestComputeAvailabilitySetsOperations(AzureMgmtRecordedTestCase): def setup_method(self, method): - self.client = self.create_mgmt_client(ComputeManagementClient) - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_availability_sets_list_by_subscription(self, resource_group): - response = self.client.availability_sets.list_by_subscription( - api_version="2025-04-01", - ) - result = [r for r in response] - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_availability_sets_list(self, resource_group): - response = self.client.availability_sets.list( - resource_group_name=resource_group.name, - api_version="2025-04-01", - ) - result = [r for r in response] - # please add some check logic here by yourself - # ... + self.client = self.create_mgmt_client(ComputeClient) @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy @@ -45,7 +24,6 @@ def test_availability_sets_get(self, resource_group): response = self.client.availability_sets.get( resource_group_name=resource_group.name, availability_set_name="str", - api_version="2025-04-01", ) # please add some check logic here by yourself @@ -57,31 +35,41 @@ def test_availability_sets_create_or_update(self, resource_group): response = self.client.availability_sets.create_or_update( resource_group_name=resource_group.name, availability_set_name="str", - parameters={ + resource={ "location": "str", "id": "str", "name": "str", - "platformFaultDomainCount": 0, - "platformUpdateDomainCount": 0, - "proximityPlacementGroup": {"id": "str"}, - "scheduledEventsPolicy": { - "allInstancesDown": {"automaticallyApprove": bool}, - "scheduledEventsAdditionalPublishingTargets": { - "eventGridAndResourceGraph": {"enable": bool, "scheduledEventsApiVersion": "str"} + "properties": { + "platformFaultDomainCount": 0, + "platformUpdateDomainCount": 0, + "proximityPlacementGroup": {"id": "str"}, + "scheduledEventsPolicy": { + "allInstancesDown": {"automaticallyApprove": bool}, + "scheduledEventsAdditionalPublishingTargets": { + "eventGridAndResourceGraph": {"enable": bool, "scheduledEventsApiVersion": "str"} + }, + "userInitiatedReboot": {"automaticallyApprove": bool}, + "userInitiatedRedeploy": {"automaticallyApprove": bool}, }, - "userInitiatedReboot": {"automaticallyApprove": bool}, - "userInitiatedRedeploy": {"automaticallyApprove": bool}, + "statuses": [ + { + "code": "str", + "displayStatus": "str", + "level": "str", + "message": "str", + "time": "2020-02-20 00:00:00", + } + ], + "virtualMachineScaleSetMigrationInfo": { + "defaultVirtualMachineScaleSetInfo": { + "constrainedMaximumCapacity": bool, + "defaultVirtualMachineScaleSet": {"id": "str"}, + }, + "migrateToVirtualMachineScaleSet": {"id": "str"}, + }, + "virtualMachines": [{"id": "str"}], }, "sku": {"capacity": 0, "name": "str", "tier": "str"}, - "statuses": [ - { - "code": "str", - "displayStatus": "str", - "level": "str", - "message": "str", - "time": "2020-02-20 00:00:00", - } - ], "systemData": { "createdAt": "2020-02-20 00:00:00", "createdBy": "str", @@ -92,16 +80,7 @@ def test_availability_sets_create_or_update(self, resource_group): }, "tags": {"str": "str"}, "type": "str", - "virtualMachineScaleSetMigrationInfo": { - "defaultVirtualMachineScaleSetInfo": { - "constrainedMaximumCapacity": bool, - "defaultVirtualMachineScaleSet": {"id": "str"}, - }, - "migrateToVirtualMachineScaleSet": {"id": "str"}, - }, - "virtualMachines": [{"id": "str"}], }, - api_version="2025-04-01", ) # please add some check logic here by yourself @@ -113,39 +92,40 @@ def test_availability_sets_update(self, resource_group): response = self.client.availability_sets.update( resource_group_name=resource_group.name, availability_set_name="str", - parameters={ - "platformFaultDomainCount": 0, - "platformUpdateDomainCount": 0, - "proximityPlacementGroup": {"id": "str"}, - "scheduledEventsPolicy": { - "allInstancesDown": {"automaticallyApprove": bool}, - "scheduledEventsAdditionalPublishingTargets": { - "eventGridAndResourceGraph": {"enable": bool, "scheduledEventsApiVersion": "str"} + properties={ + "properties": { + "platformFaultDomainCount": 0, + "platformUpdateDomainCount": 0, + "proximityPlacementGroup": {"id": "str"}, + "scheduledEventsPolicy": { + "allInstancesDown": {"automaticallyApprove": bool}, + "scheduledEventsAdditionalPublishingTargets": { + "eventGridAndResourceGraph": {"enable": bool, "scheduledEventsApiVersion": "str"} + }, + "userInitiatedReboot": {"automaticallyApprove": bool}, + "userInitiatedRedeploy": {"automaticallyApprove": bool}, + }, + "statuses": [ + { + "code": "str", + "displayStatus": "str", + "level": "str", + "message": "str", + "time": "2020-02-20 00:00:00", + } + ], + "virtualMachineScaleSetMigrationInfo": { + "defaultVirtualMachineScaleSetInfo": { + "constrainedMaximumCapacity": bool, + "defaultVirtualMachineScaleSet": {"id": "str"}, + }, + "migrateToVirtualMachineScaleSet": {"id": "str"}, }, - "userInitiatedReboot": {"automaticallyApprove": bool}, - "userInitiatedRedeploy": {"automaticallyApprove": bool}, + "virtualMachines": [{"id": "str"}], }, "sku": {"capacity": 0, "name": "str", "tier": "str"}, - "statuses": [ - { - "code": "str", - "displayStatus": "str", - "level": "str", - "message": "str", - "time": "2020-02-20 00:00:00", - } - ], "tags": {"str": "str"}, - "virtualMachineScaleSetMigrationInfo": { - "defaultVirtualMachineScaleSetInfo": { - "constrainedMaximumCapacity": bool, - "defaultVirtualMachineScaleSet": {"id": "str"}, - }, - "migrateToVirtualMachineScaleSet": {"id": "str"}, - }, - "virtualMachines": [{"id": "str"}], }, - api_version="2025-04-01", ) # please add some check logic here by yourself @@ -157,7 +137,6 @@ def test_availability_sets_delete(self, resource_group): response = self.client.availability_sets.delete( resource_group_name=resource_group.name, availability_set_name="str", - api_version="2025-04-01", ) # please add some check logic here by yourself @@ -165,25 +144,30 @@ def test_availability_sets_delete(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_availability_sets_cancel_migration_to_virtual_machine_scale_set(self, resource_group): - response = self.client.availability_sets.cancel_migration_to_virtual_machine_scale_set( + def test_availability_sets_list(self, resource_group): + response = self.client.availability_sets.list( resource_group_name=resource_group.name, - availability_set_name="str", - api_version="2025-04-01", ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_availability_sets_list_by_subscription(self, resource_group): + response = self.client.availability_sets.list_by_subscription() + result = [r for r in response] # please add some check logic here by yourself # ... @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_availability_sets_begin_convert_to_virtual_machine_scale_set(self, resource_group): - response = self.client.availability_sets.begin_convert_to_virtual_machine_scale_set( + def test_availability_sets_list_available_sizes(self, resource_group): + response = self.client.availability_sets.list_available_sizes( resource_group_name=resource_group.name, availability_set_name="str", - api_version="2025-04-01", - ).result() # call '.result()' to poll until service return final result - + ) + result = [r for r in response] # please add some check logic here by yourself # ... @@ -193,8 +177,18 @@ def test_availability_sets_start_migration_to_virtual_machine_scale_set(self, re response = self.client.availability_sets.start_migration_to_virtual_machine_scale_set( resource_group_name=resource_group.name, availability_set_name="str", - parameters={"virtualMachineScaleSetFlexible": {"id": "str"}}, - api_version="2025-04-01", + body={"virtualMachineScaleSetFlexible": {"id": "str"}}, + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_availability_sets_cancel_migration_to_virtual_machine_scale_set(self, resource_group): + response = self.client.availability_sets.cancel_migration_to_virtual_machine_scale_set( + resource_group_name=resource_group.name, + availability_set_name="str", ) # please add some check logic here by yourself @@ -206,8 +200,7 @@ def test_availability_sets_validate_migration_to_virtual_machine_scale_set(self, response = self.client.availability_sets.validate_migration_to_virtual_machine_scale_set( resource_group_name=resource_group.name, availability_set_name="str", - parameters={"virtualMachineScaleSetFlexible": {"id": "str"}}, - api_version="2025-04-01", + body={"virtualMachineScaleSetFlexible": {"id": "str"}}, ) # please add some check logic here by yourself @@ -215,12 +208,11 @@ def test_availability_sets_validate_migration_to_virtual_machine_scale_set(self, @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_availability_sets_list_available_sizes(self, resource_group): - response = self.client.availability_sets.list_available_sizes( + def test_availability_sets_begin_convert_to_virtual_machine_scale_set(self, resource_group): + response = self.client.availability_sets.begin_convert_to_virtual_machine_scale_set( resource_group_name=resource_group.name, availability_set_name="str", - api_version="2025-04-01", - ) - result = [r for r in response] + ).result() # call '.result()' to poll until service return final result + # please add some check logic here by yourself # ... diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_availability_sets_operations_async.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_availability_sets_operations_async.py similarity index 64% rename from sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_availability_sets_operations_async.py rename to sdk/compute/azure-mgmt-compute/generated_tests/test_compute_availability_sets_operations_async.py index 6905a3b18210..02396d05af70 100644 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_availability_sets_operations_async.py +++ b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_availability_sets_operations_async.py @@ -2,11 +2,11 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.compute.aio import ComputeManagementClient +from azure.mgmt.compute.aio import ComputeClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer from devtools_testutils.aio import recorded_by_proxy_async @@ -15,30 +15,9 @@ @pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestComputeManagementAvailabilitySetsOperationsAsync(AzureMgmtRecordedTestCase): +class TestComputeAvailabilitySetsOperationsAsync(AzureMgmtRecordedTestCase): def setup_method(self, method): - self.client = self.create_mgmt_client(ComputeManagementClient, is_async=True) - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_availability_sets_list_by_subscription(self, resource_group): - response = self.client.availability_sets.list_by_subscription( - api_version="2025-04-01", - ) - result = [r async for r in response] - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_availability_sets_list(self, resource_group): - response = self.client.availability_sets.list( - resource_group_name=resource_group.name, - api_version="2025-04-01", - ) - result = [r async for r in response] - # please add some check logic here by yourself - # ... + self.client = self.create_mgmt_client(ComputeClient, is_async=True) @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async @@ -46,7 +25,6 @@ async def test_availability_sets_get(self, resource_group): response = await self.client.availability_sets.get( resource_group_name=resource_group.name, availability_set_name="str", - api_version="2025-04-01", ) # please add some check logic here by yourself @@ -58,31 +36,41 @@ async def test_availability_sets_create_or_update(self, resource_group): response = await self.client.availability_sets.create_or_update( resource_group_name=resource_group.name, availability_set_name="str", - parameters={ + resource={ "location": "str", "id": "str", "name": "str", - "platformFaultDomainCount": 0, - "platformUpdateDomainCount": 0, - "proximityPlacementGroup": {"id": "str"}, - "scheduledEventsPolicy": { - "allInstancesDown": {"automaticallyApprove": bool}, - "scheduledEventsAdditionalPublishingTargets": { - "eventGridAndResourceGraph": {"enable": bool, "scheduledEventsApiVersion": "str"} + "properties": { + "platformFaultDomainCount": 0, + "platformUpdateDomainCount": 0, + "proximityPlacementGroup": {"id": "str"}, + "scheduledEventsPolicy": { + "allInstancesDown": {"automaticallyApprove": bool}, + "scheduledEventsAdditionalPublishingTargets": { + "eventGridAndResourceGraph": {"enable": bool, "scheduledEventsApiVersion": "str"} + }, + "userInitiatedReboot": {"automaticallyApprove": bool}, + "userInitiatedRedeploy": {"automaticallyApprove": bool}, + }, + "statuses": [ + { + "code": "str", + "displayStatus": "str", + "level": "str", + "message": "str", + "time": "2020-02-20 00:00:00", + } + ], + "virtualMachineScaleSetMigrationInfo": { + "defaultVirtualMachineScaleSetInfo": { + "constrainedMaximumCapacity": bool, + "defaultVirtualMachineScaleSet": {"id": "str"}, + }, + "migrateToVirtualMachineScaleSet": {"id": "str"}, }, - "userInitiatedReboot": {"automaticallyApprove": bool}, - "userInitiatedRedeploy": {"automaticallyApprove": bool}, + "virtualMachines": [{"id": "str"}], }, "sku": {"capacity": 0, "name": "str", "tier": "str"}, - "statuses": [ - { - "code": "str", - "displayStatus": "str", - "level": "str", - "message": "str", - "time": "2020-02-20 00:00:00", - } - ], "systemData": { "createdAt": "2020-02-20 00:00:00", "createdBy": "str", @@ -93,16 +81,7 @@ async def test_availability_sets_create_or_update(self, resource_group): }, "tags": {"str": "str"}, "type": "str", - "virtualMachineScaleSetMigrationInfo": { - "defaultVirtualMachineScaleSetInfo": { - "constrainedMaximumCapacity": bool, - "defaultVirtualMachineScaleSet": {"id": "str"}, - }, - "migrateToVirtualMachineScaleSet": {"id": "str"}, - }, - "virtualMachines": [{"id": "str"}], }, - api_version="2025-04-01", ) # please add some check logic here by yourself @@ -114,39 +93,40 @@ async def test_availability_sets_update(self, resource_group): response = await self.client.availability_sets.update( resource_group_name=resource_group.name, availability_set_name="str", - parameters={ - "platformFaultDomainCount": 0, - "platformUpdateDomainCount": 0, - "proximityPlacementGroup": {"id": "str"}, - "scheduledEventsPolicy": { - "allInstancesDown": {"automaticallyApprove": bool}, - "scheduledEventsAdditionalPublishingTargets": { - "eventGridAndResourceGraph": {"enable": bool, "scheduledEventsApiVersion": "str"} + properties={ + "properties": { + "platformFaultDomainCount": 0, + "platformUpdateDomainCount": 0, + "proximityPlacementGroup": {"id": "str"}, + "scheduledEventsPolicy": { + "allInstancesDown": {"automaticallyApprove": bool}, + "scheduledEventsAdditionalPublishingTargets": { + "eventGridAndResourceGraph": {"enable": bool, "scheduledEventsApiVersion": "str"} + }, + "userInitiatedReboot": {"automaticallyApprove": bool}, + "userInitiatedRedeploy": {"automaticallyApprove": bool}, + }, + "statuses": [ + { + "code": "str", + "displayStatus": "str", + "level": "str", + "message": "str", + "time": "2020-02-20 00:00:00", + } + ], + "virtualMachineScaleSetMigrationInfo": { + "defaultVirtualMachineScaleSetInfo": { + "constrainedMaximumCapacity": bool, + "defaultVirtualMachineScaleSet": {"id": "str"}, + }, + "migrateToVirtualMachineScaleSet": {"id": "str"}, }, - "userInitiatedReboot": {"automaticallyApprove": bool}, - "userInitiatedRedeploy": {"automaticallyApprove": bool}, + "virtualMachines": [{"id": "str"}], }, "sku": {"capacity": 0, "name": "str", "tier": "str"}, - "statuses": [ - { - "code": "str", - "displayStatus": "str", - "level": "str", - "message": "str", - "time": "2020-02-20 00:00:00", - } - ], "tags": {"str": "str"}, - "virtualMachineScaleSetMigrationInfo": { - "defaultVirtualMachineScaleSetInfo": { - "constrainedMaximumCapacity": bool, - "defaultVirtualMachineScaleSet": {"id": "str"}, - }, - "migrateToVirtualMachineScaleSet": {"id": "str"}, - }, - "virtualMachines": [{"id": "str"}], }, - api_version="2025-04-01", ) # please add some check logic here by yourself @@ -158,7 +138,6 @@ async def test_availability_sets_delete(self, resource_group): response = await self.client.availability_sets.delete( resource_group_name=resource_group.name, availability_set_name="str", - api_version="2025-04-01", ) # please add some check logic here by yourself @@ -166,27 +145,30 @@ async def test_availability_sets_delete(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_availability_sets_cancel_migration_to_virtual_machine_scale_set(self, resource_group): - response = await self.client.availability_sets.cancel_migration_to_virtual_machine_scale_set( + async def test_availability_sets_list(self, resource_group): + response = self.client.availability_sets.list( resource_group_name=resource_group.name, - availability_set_name="str", - api_version="2025-04-01", ) - + result = [r async for r in response] # please add some check logic here by yourself # ... @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_availability_sets_begin_convert_to_virtual_machine_scale_set(self, resource_group): - response = await ( - await self.client.availability_sets.begin_convert_to_virtual_machine_scale_set( - resource_group_name=resource_group.name, - availability_set_name="str", - api_version="2025-04-01", - ) - ).result() # call '.result()' to poll until service return final result + async def test_availability_sets_list_by_subscription(self, resource_group): + response = self.client.availability_sets.list_by_subscription() + result = [r async for r in response] + # please add some check logic here by yourself + # ... + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_availability_sets_list_available_sizes(self, resource_group): + response = self.client.availability_sets.list_available_sizes( + resource_group_name=resource_group.name, + availability_set_name="str", + ) + result = [r async for r in response] # please add some check logic here by yourself # ... @@ -196,8 +178,7 @@ async def test_availability_sets_start_migration_to_virtual_machine_scale_set(se response = await self.client.availability_sets.start_migration_to_virtual_machine_scale_set( resource_group_name=resource_group.name, availability_set_name="str", - parameters={"virtualMachineScaleSetFlexible": {"id": "str"}}, - api_version="2025-04-01", + body={"virtualMachineScaleSetFlexible": {"id": "str"}}, ) # please add some check logic here by yourself @@ -205,12 +186,10 @@ async def test_availability_sets_start_migration_to_virtual_machine_scale_set(se @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_availability_sets_validate_migration_to_virtual_machine_scale_set(self, resource_group): - response = await self.client.availability_sets.validate_migration_to_virtual_machine_scale_set( + async def test_availability_sets_cancel_migration_to_virtual_machine_scale_set(self, resource_group): + response = await self.client.availability_sets.cancel_migration_to_virtual_machine_scale_set( resource_group_name=resource_group.name, availability_set_name="str", - parameters={"virtualMachineScaleSetFlexible": {"id": "str"}}, - api_version="2025-04-01", ) # please add some check logic here by yourself @@ -218,12 +197,25 @@ async def test_availability_sets_validate_migration_to_virtual_machine_scale_set @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_availability_sets_list_available_sizes(self, resource_group): - response = self.client.availability_sets.list_available_sizes( + async def test_availability_sets_validate_migration_to_virtual_machine_scale_set(self, resource_group): + response = await self.client.availability_sets.validate_migration_to_virtual_machine_scale_set( resource_group_name=resource_group.name, availability_set_name="str", - api_version="2025-04-01", + body={"virtualMachineScaleSetFlexible": {"id": "str"}}, ) - result = [r async for r in response] + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_availability_sets_begin_convert_to_virtual_machine_scale_set(self, resource_group): + response = await ( + await self.client.availability_sets.begin_convert_to_virtual_machine_scale_set( + resource_group_name=resource_group.name, + availability_set_name="str", + ) + ).result() # call '.result()' to poll until service return final result + # please add some check logic here by yourself # ... diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_capacity_reservation_groups_operations.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_capacity_reservation_groups_operations.py similarity index 58% rename from sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_capacity_reservation_groups_operations.py rename to sdk/compute/azure-mgmt-compute/generated_tests/test_compute_capacity_reservation_groups_operations.py index d5dc85f1bb46..d290397704aa 100644 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_capacity_reservation_groups_operations.py +++ b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_capacity_reservation_groups_operations.py @@ -2,11 +2,11 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.compute import ComputeManagementClient +from azure.mgmt.compute import ComputeClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy @@ -14,30 +14,9 @@ @pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestComputeManagementCapacityReservationGroupsOperations(AzureMgmtRecordedTestCase): +class TestComputeCapacityReservationGroupsOperations(AzureMgmtRecordedTestCase): def setup_method(self, method): - self.client = self.create_mgmt_client(ComputeManagementClient) - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_capacity_reservation_groups_list_by_subscription(self, resource_group): - response = self.client.capacity_reservation_groups.list_by_subscription( - api_version="2025-04-01", - ) - result = [r for r in response] - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_capacity_reservation_groups_list_by_resource_group(self, resource_group): - response = self.client.capacity_reservation_groups.list_by_resource_group( - resource_group_name=resource_group.name, - api_version="2025-04-01", - ) - result = [r for r in response] - # please add some check logic here by yourself - # ... + self.client = self.create_mgmt_client(ComputeClient) @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy @@ -45,7 +24,6 @@ def test_capacity_reservation_groups_get(self, resource_group): response = self.client.capacity_reservation_groups.get( resource_group_name=resource_group.name, capacity_reservation_group_name="str", - api_version="2025-04-01", ) # please add some check logic here by yourself @@ -57,31 +35,34 @@ def test_capacity_reservation_groups_create_or_update(self, resource_group): response = self.client.capacity_reservation_groups.create_or_update( resource_group_name=resource_group.name, capacity_reservation_group_name="str", - parameters={ + resource={ "location": "str", - "capacityReservations": [{"id": "str"}], "id": "str", - "instanceView": { - "capacityReservations": [ - { - "name": "str", - "statuses": [ - { - "code": "str", - "displayStatus": "str", - "level": "str", - "message": "str", - "time": "2020-02-20 00:00:00", - } - ], - "utilizationInfo": {"currentCapacity": 0, "virtualMachinesAllocated": [{"id": "str"}]}, - } - ], - "sharedSubscriptionIds": [{"id": "str"}], - }, "name": "str", - "reservationType": "str", - "sharingProfile": {"subscriptionIds": [{"id": "str"}]}, + "properties": { + "capacityReservations": [{"id": "str"}], + "instanceView": { + "capacityReservations": [ + { + "name": "str", + "statuses": [ + { + "code": "str", + "displayStatus": "str", + "level": "str", + "message": "str", + "time": "2020-02-20 00:00:00", + } + ], + "utilizationInfo": {"currentCapacity": 0, "virtualMachinesAllocated": [{"id": "str"}]}, + } + ], + "sharedSubscriptionIds": [{"id": "str"}], + }, + "reservationType": "str", + "sharingProfile": {"subscriptionIds": [{"id": "str"}]}, + "virtualMachinesAssociated": [{"id": "str"}], + }, "systemData": { "createdAt": "2020-02-20 00:00:00", "createdBy": "str", @@ -92,10 +73,8 @@ def test_capacity_reservation_groups_create_or_update(self, resource_group): }, "tags": {"str": "str"}, "type": "str", - "virtualMachinesAssociated": [{"id": "str"}], "zones": ["str"], }, - api_version="2025-04-01", ) # please add some check logic here by yourself @@ -107,32 +86,33 @@ def test_capacity_reservation_groups_update(self, resource_group): response = self.client.capacity_reservation_groups.update( resource_group_name=resource_group.name, capacity_reservation_group_name="str", - parameters={ - "capacityReservations": [{"id": "str"}], - "instanceView": { - "capacityReservations": [ - { - "name": "str", - "statuses": [ - { - "code": "str", - "displayStatus": "str", - "level": "str", - "message": "str", - "time": "2020-02-20 00:00:00", - } - ], - "utilizationInfo": {"currentCapacity": 0, "virtualMachinesAllocated": [{"id": "str"}]}, - } - ], - "sharedSubscriptionIds": [{"id": "str"}], + properties={ + "properties": { + "capacityReservations": [{"id": "str"}], + "instanceView": { + "capacityReservations": [ + { + "name": "str", + "statuses": [ + { + "code": "str", + "displayStatus": "str", + "level": "str", + "message": "str", + "time": "2020-02-20 00:00:00", + } + ], + "utilizationInfo": {"currentCapacity": 0, "virtualMachinesAllocated": [{"id": "str"}]}, + } + ], + "sharedSubscriptionIds": [{"id": "str"}], + }, + "reservationType": "str", + "sharingProfile": {"subscriptionIds": [{"id": "str"}]}, + "virtualMachinesAssociated": [{"id": "str"}], }, - "reservationType": "str", - "sharingProfile": {"subscriptionIds": [{"id": "str"}]}, "tags": {"str": "str"}, - "virtualMachinesAssociated": [{"id": "str"}], }, - api_version="2025-04-01", ) # please add some check logic here by yourself @@ -144,8 +124,25 @@ def test_capacity_reservation_groups_delete(self, resource_group): response = self.client.capacity_reservation_groups.delete( resource_group_name=resource_group.name, capacity_reservation_group_name="str", - api_version="2025-04-01", ) # please add some check logic here by yourself # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_capacity_reservation_groups_list_by_resource_group(self, resource_group): + response = self.client.capacity_reservation_groups.list_by_resource_group( + resource_group_name=resource_group.name, + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_capacity_reservation_groups_list_by_subscription(self, resource_group): + response = self.client.capacity_reservation_groups.list_by_subscription() + result = [r for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_capacity_reservation_groups_operations_async.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_capacity_reservation_groups_operations_async.py similarity index 59% rename from sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_capacity_reservation_groups_operations_async.py rename to sdk/compute/azure-mgmt-compute/generated_tests/test_compute_capacity_reservation_groups_operations_async.py index 921bf4df5bef..5fd3fed74465 100644 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_capacity_reservation_groups_operations_async.py +++ b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_capacity_reservation_groups_operations_async.py @@ -2,11 +2,11 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.compute.aio import ComputeManagementClient +from azure.mgmt.compute.aio import ComputeClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer from devtools_testutils.aio import recorded_by_proxy_async @@ -15,30 +15,9 @@ @pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestComputeManagementCapacityReservationGroupsOperationsAsync(AzureMgmtRecordedTestCase): +class TestComputeCapacityReservationGroupsOperationsAsync(AzureMgmtRecordedTestCase): def setup_method(self, method): - self.client = self.create_mgmt_client(ComputeManagementClient, is_async=True) - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_capacity_reservation_groups_list_by_subscription(self, resource_group): - response = self.client.capacity_reservation_groups.list_by_subscription( - api_version="2025-04-01", - ) - result = [r async for r in response] - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_capacity_reservation_groups_list_by_resource_group(self, resource_group): - response = self.client.capacity_reservation_groups.list_by_resource_group( - resource_group_name=resource_group.name, - api_version="2025-04-01", - ) - result = [r async for r in response] - # please add some check logic here by yourself - # ... + self.client = self.create_mgmt_client(ComputeClient, is_async=True) @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async @@ -46,7 +25,6 @@ async def test_capacity_reservation_groups_get(self, resource_group): response = await self.client.capacity_reservation_groups.get( resource_group_name=resource_group.name, capacity_reservation_group_name="str", - api_version="2025-04-01", ) # please add some check logic here by yourself @@ -58,31 +36,34 @@ async def test_capacity_reservation_groups_create_or_update(self, resource_group response = await self.client.capacity_reservation_groups.create_or_update( resource_group_name=resource_group.name, capacity_reservation_group_name="str", - parameters={ + resource={ "location": "str", - "capacityReservations": [{"id": "str"}], "id": "str", - "instanceView": { - "capacityReservations": [ - { - "name": "str", - "statuses": [ - { - "code": "str", - "displayStatus": "str", - "level": "str", - "message": "str", - "time": "2020-02-20 00:00:00", - } - ], - "utilizationInfo": {"currentCapacity": 0, "virtualMachinesAllocated": [{"id": "str"}]}, - } - ], - "sharedSubscriptionIds": [{"id": "str"}], - }, "name": "str", - "reservationType": "str", - "sharingProfile": {"subscriptionIds": [{"id": "str"}]}, + "properties": { + "capacityReservations": [{"id": "str"}], + "instanceView": { + "capacityReservations": [ + { + "name": "str", + "statuses": [ + { + "code": "str", + "displayStatus": "str", + "level": "str", + "message": "str", + "time": "2020-02-20 00:00:00", + } + ], + "utilizationInfo": {"currentCapacity": 0, "virtualMachinesAllocated": [{"id": "str"}]}, + } + ], + "sharedSubscriptionIds": [{"id": "str"}], + }, + "reservationType": "str", + "sharingProfile": {"subscriptionIds": [{"id": "str"}]}, + "virtualMachinesAssociated": [{"id": "str"}], + }, "systemData": { "createdAt": "2020-02-20 00:00:00", "createdBy": "str", @@ -93,10 +74,8 @@ async def test_capacity_reservation_groups_create_or_update(self, resource_group }, "tags": {"str": "str"}, "type": "str", - "virtualMachinesAssociated": [{"id": "str"}], "zones": ["str"], }, - api_version="2025-04-01", ) # please add some check logic here by yourself @@ -108,32 +87,33 @@ async def test_capacity_reservation_groups_update(self, resource_group): response = await self.client.capacity_reservation_groups.update( resource_group_name=resource_group.name, capacity_reservation_group_name="str", - parameters={ - "capacityReservations": [{"id": "str"}], - "instanceView": { - "capacityReservations": [ - { - "name": "str", - "statuses": [ - { - "code": "str", - "displayStatus": "str", - "level": "str", - "message": "str", - "time": "2020-02-20 00:00:00", - } - ], - "utilizationInfo": {"currentCapacity": 0, "virtualMachinesAllocated": [{"id": "str"}]}, - } - ], - "sharedSubscriptionIds": [{"id": "str"}], + properties={ + "properties": { + "capacityReservations": [{"id": "str"}], + "instanceView": { + "capacityReservations": [ + { + "name": "str", + "statuses": [ + { + "code": "str", + "displayStatus": "str", + "level": "str", + "message": "str", + "time": "2020-02-20 00:00:00", + } + ], + "utilizationInfo": {"currentCapacity": 0, "virtualMachinesAllocated": [{"id": "str"}]}, + } + ], + "sharedSubscriptionIds": [{"id": "str"}], + }, + "reservationType": "str", + "sharingProfile": {"subscriptionIds": [{"id": "str"}]}, + "virtualMachinesAssociated": [{"id": "str"}], }, - "reservationType": "str", - "sharingProfile": {"subscriptionIds": [{"id": "str"}]}, "tags": {"str": "str"}, - "virtualMachinesAssociated": [{"id": "str"}], }, - api_version="2025-04-01", ) # please add some check logic here by yourself @@ -145,8 +125,25 @@ async def test_capacity_reservation_groups_delete(self, resource_group): response = await self.client.capacity_reservation_groups.delete( resource_group_name=resource_group.name, capacity_reservation_group_name="str", - api_version="2025-04-01", ) # please add some check logic here by yourself # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_capacity_reservation_groups_list_by_resource_group(self, resource_group): + response = self.client.capacity_reservation_groups.list_by_resource_group( + resource_group_name=resource_group.name, + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_capacity_reservation_groups_list_by_subscription(self, resource_group): + response = self.client.capacity_reservation_groups.list_by_subscription() + result = [r async for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_capacity_reservations_operations.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_capacity_reservations_operations.py similarity index 63% rename from sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_capacity_reservations_operations.py rename to sdk/compute/azure-mgmt-compute/generated_tests/test_compute_capacity_reservations_operations.py index bcc31d9fd582..48b5dbb524b4 100644 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_capacity_reservations_operations.py +++ b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_capacity_reservations_operations.py @@ -2,11 +2,11 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.compute import ComputeManagementClient +from azure.mgmt.compute import ComputeClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy @@ -14,21 +14,9 @@ @pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestComputeManagementCapacityReservationsOperations(AzureMgmtRecordedTestCase): +class TestComputeCapacityReservationsOperations(AzureMgmtRecordedTestCase): def setup_method(self, method): - self.client = self.create_mgmt_client(ComputeManagementClient) - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_capacity_reservations_list_by_capacity_reservation_group(self, resource_group): - response = self.client.capacity_reservations.list_by_capacity_reservation_group( - resource_group_name=resource_group.name, - capacity_reservation_group_name="str", - api_version="2025-04-01", - ) - result = [r for r in response] - # please add some check logic here by yourself - # ... + self.client = self.create_mgmt_client(ComputeClient) @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy @@ -37,7 +25,6 @@ def test_capacity_reservations_get(self, resource_group): resource_group_name=resource_group.name, capacity_reservation_group_name="str", capacity_reservation_name="str", - api_version="2025-04-01", ) # please add some check logic here by yourself @@ -50,28 +37,32 @@ def test_capacity_reservations_begin_create_or_update(self, resource_group): resource_group_name=resource_group.name, capacity_reservation_group_name="str", capacity_reservation_name="str", - parameters={ + resource={ "location": "str", "sku": {"capacity": 0, "name": "str", "tier": "str"}, "id": "str", - "instanceView": { - "statuses": [ - { - "code": "str", - "displayStatus": "str", - "level": "str", - "message": "str", - "time": "2020-02-20 00:00:00", - } - ], - "utilizationInfo": {"currentCapacity": 0, "virtualMachinesAllocated": [{"id": "str"}]}, - }, "name": "str", - "platformFaultDomainCount": 0, - "provisioningState": "str", - "provisioningTime": "2020-02-20 00:00:00", - "reservationId": "str", - "scheduleProfile": {"end": "str", "start": "str"}, + "properties": { + "instanceView": { + "statuses": [ + { + "code": "str", + "displayStatus": "str", + "level": "str", + "message": "str", + "time": "2020-02-20 00:00:00", + } + ], + "utilizationInfo": {"currentCapacity": 0, "virtualMachinesAllocated": [{"id": "str"}]}, + }, + "platformFaultDomainCount": 0, + "provisioningState": "str", + "provisioningTime": "2020-02-20 00:00:00", + "reservationId": "str", + "scheduleProfile": {"end": "str", "start": "str"}, + "timeCreated": "2020-02-20 00:00:00", + "virtualMachinesAssociated": [{"id": "str"}], + }, "systemData": { "createdAt": "2020-02-20 00:00:00", "createdBy": "str", @@ -81,12 +72,9 @@ def test_capacity_reservations_begin_create_or_update(self, resource_group): "lastModifiedByType": "str", }, "tags": {"str": "str"}, - "timeCreated": "2020-02-20 00:00:00", "type": "str", - "virtualMachinesAssociated": [{"id": "str"}], "zones": ["str"], }, - api_version="2025-04-01", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -99,30 +87,31 @@ def test_capacity_reservations_begin_update(self, resource_group): resource_group_name=resource_group.name, capacity_reservation_group_name="str", capacity_reservation_name="str", - parameters={ - "instanceView": { - "statuses": [ - { - "code": "str", - "displayStatus": "str", - "level": "str", - "message": "str", - "time": "2020-02-20 00:00:00", - } - ], - "utilizationInfo": {"currentCapacity": 0, "virtualMachinesAllocated": [{"id": "str"}]}, + properties={ + "properties": { + "instanceView": { + "statuses": [ + { + "code": "str", + "displayStatus": "str", + "level": "str", + "message": "str", + "time": "2020-02-20 00:00:00", + } + ], + "utilizationInfo": {"currentCapacity": 0, "virtualMachinesAllocated": [{"id": "str"}]}, + }, + "platformFaultDomainCount": 0, + "provisioningState": "str", + "provisioningTime": "2020-02-20 00:00:00", + "reservationId": "str", + "scheduleProfile": {"end": "str", "start": "str"}, + "timeCreated": "2020-02-20 00:00:00", + "virtualMachinesAssociated": [{"id": "str"}], }, - "platformFaultDomainCount": 0, - "provisioningState": "str", - "provisioningTime": "2020-02-20 00:00:00", - "reservationId": "str", - "scheduleProfile": {"end": "str", "start": "str"}, "sku": {"capacity": 0, "name": "str", "tier": "str"}, "tags": {"str": "str"}, - "timeCreated": "2020-02-20 00:00:00", - "virtualMachinesAssociated": [{"id": "str"}], }, - api_version="2025-04-01", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -135,8 +124,18 @@ def test_capacity_reservations_begin_delete(self, resource_group): resource_group_name=resource_group.name, capacity_reservation_group_name="str", capacity_reservation_name="str", - api_version="2025-04-01", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_capacity_reservations_list_by_capacity_reservation_group(self, resource_group): + response = self.client.capacity_reservations.list_by_capacity_reservation_group( + resource_group_name=resource_group.name, + capacity_reservation_group_name="str", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_capacity_reservations_operations_async.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_capacity_reservations_operations_async.py similarity index 63% rename from sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_capacity_reservations_operations_async.py rename to sdk/compute/azure-mgmt-compute/generated_tests/test_compute_capacity_reservations_operations_async.py index c8239b1a67d9..8698fca2281a 100644 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_capacity_reservations_operations_async.py +++ b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_capacity_reservations_operations_async.py @@ -2,11 +2,11 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.compute.aio import ComputeManagementClient +from azure.mgmt.compute.aio import ComputeClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer from devtools_testutils.aio import recorded_by_proxy_async @@ -15,21 +15,9 @@ @pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestComputeManagementCapacityReservationsOperationsAsync(AzureMgmtRecordedTestCase): +class TestComputeCapacityReservationsOperationsAsync(AzureMgmtRecordedTestCase): def setup_method(self, method): - self.client = self.create_mgmt_client(ComputeManagementClient, is_async=True) - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_capacity_reservations_list_by_capacity_reservation_group(self, resource_group): - response = self.client.capacity_reservations.list_by_capacity_reservation_group( - resource_group_name=resource_group.name, - capacity_reservation_group_name="str", - api_version="2025-04-01", - ) - result = [r async for r in response] - # please add some check logic here by yourself - # ... + self.client = self.create_mgmt_client(ComputeClient, is_async=True) @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async @@ -38,7 +26,6 @@ async def test_capacity_reservations_get(self, resource_group): resource_group_name=resource_group.name, capacity_reservation_group_name="str", capacity_reservation_name="str", - api_version="2025-04-01", ) # please add some check logic here by yourself @@ -52,28 +39,32 @@ async def test_capacity_reservations_begin_create_or_update(self, resource_group resource_group_name=resource_group.name, capacity_reservation_group_name="str", capacity_reservation_name="str", - parameters={ + resource={ "location": "str", "sku": {"capacity": 0, "name": "str", "tier": "str"}, "id": "str", - "instanceView": { - "statuses": [ - { - "code": "str", - "displayStatus": "str", - "level": "str", - "message": "str", - "time": "2020-02-20 00:00:00", - } - ], - "utilizationInfo": {"currentCapacity": 0, "virtualMachinesAllocated": [{"id": "str"}]}, - }, "name": "str", - "platformFaultDomainCount": 0, - "provisioningState": "str", - "provisioningTime": "2020-02-20 00:00:00", - "reservationId": "str", - "scheduleProfile": {"end": "str", "start": "str"}, + "properties": { + "instanceView": { + "statuses": [ + { + "code": "str", + "displayStatus": "str", + "level": "str", + "message": "str", + "time": "2020-02-20 00:00:00", + } + ], + "utilizationInfo": {"currentCapacity": 0, "virtualMachinesAllocated": [{"id": "str"}]}, + }, + "platformFaultDomainCount": 0, + "provisioningState": "str", + "provisioningTime": "2020-02-20 00:00:00", + "reservationId": "str", + "scheduleProfile": {"end": "str", "start": "str"}, + "timeCreated": "2020-02-20 00:00:00", + "virtualMachinesAssociated": [{"id": "str"}], + }, "systemData": { "createdAt": "2020-02-20 00:00:00", "createdBy": "str", @@ -83,12 +74,9 @@ async def test_capacity_reservations_begin_create_or_update(self, resource_group "lastModifiedByType": "str", }, "tags": {"str": "str"}, - "timeCreated": "2020-02-20 00:00:00", "type": "str", - "virtualMachinesAssociated": [{"id": "str"}], "zones": ["str"], }, - api_version="2025-04-01", ) ).result() # call '.result()' to poll until service return final result @@ -103,30 +91,31 @@ async def test_capacity_reservations_begin_update(self, resource_group): resource_group_name=resource_group.name, capacity_reservation_group_name="str", capacity_reservation_name="str", - parameters={ - "instanceView": { - "statuses": [ - { - "code": "str", - "displayStatus": "str", - "level": "str", - "message": "str", - "time": "2020-02-20 00:00:00", - } - ], - "utilizationInfo": {"currentCapacity": 0, "virtualMachinesAllocated": [{"id": "str"}]}, + properties={ + "properties": { + "instanceView": { + "statuses": [ + { + "code": "str", + "displayStatus": "str", + "level": "str", + "message": "str", + "time": "2020-02-20 00:00:00", + } + ], + "utilizationInfo": {"currentCapacity": 0, "virtualMachinesAllocated": [{"id": "str"}]}, + }, + "platformFaultDomainCount": 0, + "provisioningState": "str", + "provisioningTime": "2020-02-20 00:00:00", + "reservationId": "str", + "scheduleProfile": {"end": "str", "start": "str"}, + "timeCreated": "2020-02-20 00:00:00", + "virtualMachinesAssociated": [{"id": "str"}], }, - "platformFaultDomainCount": 0, - "provisioningState": "str", - "provisioningTime": "2020-02-20 00:00:00", - "reservationId": "str", - "scheduleProfile": {"end": "str", "start": "str"}, "sku": {"capacity": 0, "name": "str", "tier": "str"}, "tags": {"str": "str"}, - "timeCreated": "2020-02-20 00:00:00", - "virtualMachinesAssociated": [{"id": "str"}], }, - api_version="2025-04-01", ) ).result() # call '.result()' to poll until service return final result @@ -141,9 +130,19 @@ async def test_capacity_reservations_begin_delete(self, resource_group): resource_group_name=resource_group.name, capacity_reservation_group_name="str", capacity_reservation_name="str", - api_version="2025-04-01", ) ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_capacity_reservations_list_by_capacity_reservation_group(self, resource_group): + response = self.client.capacity_reservations.list_by_capacity_reservation_group( + resource_group_name=resource_group.name, + capacity_reservation_group_name="str", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_community_galleries_operations.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_community_galleries_operations.py similarity index 77% rename from sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_community_galleries_operations.py rename to sdk/compute/azure-mgmt-compute/generated_tests/test_compute_community_galleries_operations.py index ba0628ce44c8..6ef315649cf2 100644 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_community_galleries_operations.py +++ b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_community_galleries_operations.py @@ -2,11 +2,11 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.compute import ComputeManagementClient +from azure.mgmt.compute import ComputeClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy @@ -14,9 +14,9 @@ @pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestComputeManagementCommunityGalleriesOperations(AzureMgmtRecordedTestCase): +class TestComputeCommunityGalleriesOperations(AzureMgmtRecordedTestCase): def setup_method(self, method): - self.client = self.create_mgmt_client(ComputeManagementClient) + self.client = self.create_mgmt_client(ComputeClient) @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy @@ -24,7 +24,6 @@ def test_community_galleries_get(self, resource_group): response = self.client.community_galleries.get( location="str", public_gallery_name="str", - api_version="2024-03-03", ) # please add some check logic here by yourself diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_community_galleries_operations_async.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_community_galleries_operations_async.py similarity index 76% rename from sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_community_galleries_operations_async.py rename to sdk/compute/azure-mgmt-compute/generated_tests/test_compute_community_galleries_operations_async.py index 1cb772cba04d..8d951d4ee9e5 100644 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_community_galleries_operations_async.py +++ b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_community_galleries_operations_async.py @@ -2,11 +2,11 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.compute.aio import ComputeManagementClient +from azure.mgmt.compute.aio import ComputeClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer from devtools_testutils.aio import recorded_by_proxy_async @@ -15,9 +15,9 @@ @pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestComputeManagementCommunityGalleriesOperationsAsync(AzureMgmtRecordedTestCase): +class TestComputeCommunityGalleriesOperationsAsync(AzureMgmtRecordedTestCase): def setup_method(self, method): - self.client = self.create_mgmt_client(ComputeManagementClient, is_async=True) + self.client = self.create_mgmt_client(ComputeClient, is_async=True) @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async @@ -25,7 +25,6 @@ async def test_community_galleries_get(self, resource_group): response = await self.client.community_galleries.get( location="str", public_gallery_name="str", - api_version="2024-03-03", ) # please add some check logic here by yourself diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_community_gallery_image_versions_operations.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_community_gallery_image_versions_operations.py similarity index 81% rename from sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_community_gallery_image_versions_operations.py rename to sdk/compute/azure-mgmt-compute/generated_tests/test_compute_community_gallery_image_versions_operations.py index 210f8e04fa92..ce28eb7cd93d 100644 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_community_gallery_image_versions_operations.py +++ b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_community_gallery_image_versions_operations.py @@ -2,11 +2,11 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.compute import ComputeManagementClient +from azure.mgmt.compute import ComputeClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy @@ -14,33 +14,31 @@ @pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestComputeManagementCommunityGalleryImageVersionsOperations(AzureMgmtRecordedTestCase): +class TestComputeCommunityGalleryImageVersionsOperations(AzureMgmtRecordedTestCase): def setup_method(self, method): - self.client = self.create_mgmt_client(ComputeManagementClient) + self.client = self.create_mgmt_client(ComputeClient) @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_community_gallery_image_versions_list(self, resource_group): - response = self.client.community_gallery_image_versions.list( + def test_community_gallery_image_versions_get(self, resource_group): + response = self.client.community_gallery_image_versions.get( location="str", public_gallery_name="str", gallery_image_name="str", - api_version="2024-03-03", + gallery_image_version_name="str", ) - result = [r for r in response] + # please add some check logic here by yourself # ... @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_community_gallery_image_versions_get(self, resource_group): - response = self.client.community_gallery_image_versions.get( + def test_community_gallery_image_versions_list(self, resource_group): + response = self.client.community_gallery_image_versions.list( location="str", public_gallery_name="str", gallery_image_name="str", - gallery_image_version_name="str", - api_version="2024-03-03", ) - + result = [r for r in response] # please add some check logic here by yourself # ... diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_community_gallery_image_versions_operations_async.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_community_gallery_image_versions_operations_async.py similarity index 81% rename from sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_community_gallery_image_versions_operations_async.py rename to sdk/compute/azure-mgmt-compute/generated_tests/test_compute_community_gallery_image_versions_operations_async.py index ed16ba163817..74b32e9524a7 100644 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_community_gallery_image_versions_operations_async.py +++ b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_community_gallery_image_versions_operations_async.py @@ -2,11 +2,11 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.compute.aio import ComputeManagementClient +from azure.mgmt.compute.aio import ComputeClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer from devtools_testutils.aio import recorded_by_proxy_async @@ -15,33 +15,31 @@ @pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestComputeManagementCommunityGalleryImageVersionsOperationsAsync(AzureMgmtRecordedTestCase): +class TestComputeCommunityGalleryImageVersionsOperationsAsync(AzureMgmtRecordedTestCase): def setup_method(self, method): - self.client = self.create_mgmt_client(ComputeManagementClient, is_async=True) + self.client = self.create_mgmt_client(ComputeClient, is_async=True) @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_community_gallery_image_versions_list(self, resource_group): - response = self.client.community_gallery_image_versions.list( + async def test_community_gallery_image_versions_get(self, resource_group): + response = await self.client.community_gallery_image_versions.get( location="str", public_gallery_name="str", gallery_image_name="str", - api_version="2024-03-03", + gallery_image_version_name="str", ) - result = [r async for r in response] + # please add some check logic here by yourself # ... @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_community_gallery_image_versions_get(self, resource_group): - response = await self.client.community_gallery_image_versions.get( + async def test_community_gallery_image_versions_list(self, resource_group): + response = self.client.community_gallery_image_versions.list( location="str", public_gallery_name="str", gallery_image_name="str", - gallery_image_version_name="str", - api_version="2024-03-03", ) - + result = [r async for r in response] # please add some check logic here by yourself # ... diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_community_gallery_images_operations.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_community_gallery_images_operations.py similarity index 80% rename from sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_community_gallery_images_operations.py rename to sdk/compute/azure-mgmt-compute/generated_tests/test_compute_community_gallery_images_operations.py index 6a4cf21b6688..e66823705b85 100644 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_community_gallery_images_operations.py +++ b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_community_gallery_images_operations.py @@ -2,11 +2,11 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.compute import ComputeManagementClient +from azure.mgmt.compute import ComputeClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy @@ -14,31 +14,29 @@ @pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestComputeManagementCommunityGalleryImagesOperations(AzureMgmtRecordedTestCase): +class TestComputeCommunityGalleryImagesOperations(AzureMgmtRecordedTestCase): def setup_method(self, method): - self.client = self.create_mgmt_client(ComputeManagementClient) + self.client = self.create_mgmt_client(ComputeClient) @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_community_gallery_images_list(self, resource_group): - response = self.client.community_gallery_images.list( + def test_community_gallery_images_get(self, resource_group): + response = self.client.community_gallery_images.get( location="str", public_gallery_name="str", - api_version="2024-03-03", + gallery_image_name="str", ) - result = [r for r in response] + # please add some check logic here by yourself # ... @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_community_gallery_images_get(self, resource_group): - response = self.client.community_gallery_images.get( + def test_community_gallery_images_list(self, resource_group): + response = self.client.community_gallery_images.list( location="str", public_gallery_name="str", - gallery_image_name="str", - api_version="2024-03-03", ) - + result = [r for r in response] # please add some check logic here by yourself # ... diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_community_gallery_images_operations_async.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_community_gallery_images_operations_async.py similarity index 80% rename from sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_community_gallery_images_operations_async.py rename to sdk/compute/azure-mgmt-compute/generated_tests/test_compute_community_gallery_images_operations_async.py index 3fa06862e321..e5544f7e8fe6 100644 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_community_gallery_images_operations_async.py +++ b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_community_gallery_images_operations_async.py @@ -2,11 +2,11 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.compute.aio import ComputeManagementClient +from azure.mgmt.compute.aio import ComputeClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer from devtools_testutils.aio import recorded_by_proxy_async @@ -15,31 +15,29 @@ @pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestComputeManagementCommunityGalleryImagesOperationsAsync(AzureMgmtRecordedTestCase): +class TestComputeCommunityGalleryImagesOperationsAsync(AzureMgmtRecordedTestCase): def setup_method(self, method): - self.client = self.create_mgmt_client(ComputeManagementClient, is_async=True) + self.client = self.create_mgmt_client(ComputeClient, is_async=True) @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_community_gallery_images_list(self, resource_group): - response = self.client.community_gallery_images.list( + async def test_community_gallery_images_get(self, resource_group): + response = await self.client.community_gallery_images.get( location="str", public_gallery_name="str", - api_version="2024-03-03", + gallery_image_name="str", ) - result = [r async for r in response] + # please add some check logic here by yourself # ... @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_community_gallery_images_get(self, resource_group): - response = await self.client.community_gallery_images.get( + async def test_community_gallery_images_list(self, resource_group): + response = self.client.community_gallery_images.list( location="str", public_gallery_name="str", - gallery_image_name="str", - api_version="2024-03-03", ) - + result = [r async for r in response] # please add some check logic here by yourself # ... diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_dedicated_host_groups_operations.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_dedicated_host_groups_operations.py similarity index 59% rename from sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_dedicated_host_groups_operations.py rename to sdk/compute/azure-mgmt-compute/generated_tests/test_compute_dedicated_host_groups_operations.py index 324b6bb900e9..ea23f5683fc5 100644 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_dedicated_host_groups_operations.py +++ b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_dedicated_host_groups_operations.py @@ -2,11 +2,11 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.compute import ComputeManagementClient +from azure.mgmt.compute import ComputeClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy @@ -14,30 +14,9 @@ @pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestComputeManagementDedicatedHostGroupsOperations(AzureMgmtRecordedTestCase): +class TestComputeDedicatedHostGroupsOperations(AzureMgmtRecordedTestCase): def setup_method(self, method): - self.client = self.create_mgmt_client(ComputeManagementClient) - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_dedicated_host_groups_list_by_subscription(self, resource_group): - response = self.client.dedicated_host_groups.list_by_subscription( - api_version="2025-04-01", - ) - result = [r for r in response] - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_dedicated_host_groups_list_by_resource_group(self, resource_group): - response = self.client.dedicated_host_groups.list_by_resource_group( - resource_group_name=resource_group.name, - api_version="2025-04-01", - ) - result = [r for r in response] - # please add some check logic here by yourself - # ... + self.client = self.create_mgmt_client(ComputeClient) @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy @@ -45,7 +24,6 @@ def test_dedicated_host_groups_get(self, resource_group): response = self.client.dedicated_host_groups.get( resource_group_name=resource_group.name, host_group_name="str", - api_version="2025-04-01", ) # please add some check logic here by yourself @@ -57,32 +35,34 @@ def test_dedicated_host_groups_create_or_update(self, resource_group): response = self.client.dedicated_host_groups.create_or_update( resource_group_name=resource_group.name, host_group_name="str", - parameters={ + resource={ "location": "str", - "additionalCapabilities": {"ultraSSDEnabled": bool}, - "hosts": [{"id": "str"}], "id": "str", - "instanceView": { - "hosts": [ - { - "assetId": "str", - "availableCapacity": {"allocatableVMs": [{"count": 0.0, "vmSize": "str"}]}, - "name": "str", - "statuses": [ - { - "code": "str", - "displayStatus": "str", - "level": "str", - "message": "str", - "time": "2020-02-20 00:00:00", - } - ], - } - ] - }, "name": "str", - "platformFaultDomainCount": 0, - "supportAutomaticPlacement": bool, + "properties": { + "platformFaultDomainCount": 0, + "additionalCapabilities": {"ultraSSDEnabled": bool}, + "hosts": [{"id": "str"}], + "instanceView": { + "hosts": [ + { + "assetId": "str", + "availableCapacity": {"allocatableVMs": [{"count": 0.0, "vmSize": "str"}]}, + "name": "str", + "statuses": [ + { + "code": "str", + "displayStatus": "str", + "level": "str", + "message": "str", + "time": "2020-02-20 00:00:00", + } + ], + } + ] + }, + "supportAutomaticPlacement": bool, + }, "systemData": { "createdAt": "2020-02-20 00:00:00", "createdBy": "str", @@ -95,7 +75,6 @@ def test_dedicated_host_groups_create_or_update(self, resource_group): "type": "str", "zones": ["str"], }, - api_version="2025-04-01", ) # please add some check logic here by yourself @@ -107,33 +86,34 @@ def test_dedicated_host_groups_update(self, resource_group): response = self.client.dedicated_host_groups.update( resource_group_name=resource_group.name, host_group_name="str", - parameters={ - "additionalCapabilities": {"ultraSSDEnabled": bool}, - "hosts": [{"id": "str"}], - "instanceView": { - "hosts": [ - { - "assetId": "str", - "availableCapacity": {"allocatableVMs": [{"count": 0.0, "vmSize": "str"}]}, - "name": "str", - "statuses": [ - { - "code": "str", - "displayStatus": "str", - "level": "str", - "message": "str", - "time": "2020-02-20 00:00:00", - } - ], - } - ] + properties={ + "properties": { + "platformFaultDomainCount": 0, + "additionalCapabilities": {"ultraSSDEnabled": bool}, + "hosts": [{"id": "str"}], + "instanceView": { + "hosts": [ + { + "assetId": "str", + "availableCapacity": {"allocatableVMs": [{"count": 0.0, "vmSize": "str"}]}, + "name": "str", + "statuses": [ + { + "code": "str", + "displayStatus": "str", + "level": "str", + "message": "str", + "time": "2020-02-20 00:00:00", + } + ], + } + ] + }, + "supportAutomaticPlacement": bool, }, - "platformFaultDomainCount": 0, - "supportAutomaticPlacement": bool, "tags": {"str": "str"}, "zones": ["str"], }, - api_version="2025-04-01", ) # please add some check logic here by yourself @@ -145,8 +125,25 @@ def test_dedicated_host_groups_delete(self, resource_group): response = self.client.dedicated_host_groups.delete( resource_group_name=resource_group.name, host_group_name="str", - api_version="2025-04-01", ) # please add some check logic here by yourself # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_dedicated_host_groups_list_by_resource_group(self, resource_group): + response = self.client.dedicated_host_groups.list_by_resource_group( + resource_group_name=resource_group.name, + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_dedicated_host_groups_list_by_subscription(self, resource_group): + response = self.client.dedicated_host_groups.list_by_subscription() + result = [r for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_dedicated_host_groups_operations_async.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_dedicated_host_groups_operations_async.py similarity index 60% rename from sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_dedicated_host_groups_operations_async.py rename to sdk/compute/azure-mgmt-compute/generated_tests/test_compute_dedicated_host_groups_operations_async.py index bb7a6ef355bb..225c412e1f4e 100644 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_dedicated_host_groups_operations_async.py +++ b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_dedicated_host_groups_operations_async.py @@ -2,11 +2,11 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.compute.aio import ComputeManagementClient +from azure.mgmt.compute.aio import ComputeClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer from devtools_testutils.aio import recorded_by_proxy_async @@ -15,30 +15,9 @@ @pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestComputeManagementDedicatedHostGroupsOperationsAsync(AzureMgmtRecordedTestCase): +class TestComputeDedicatedHostGroupsOperationsAsync(AzureMgmtRecordedTestCase): def setup_method(self, method): - self.client = self.create_mgmt_client(ComputeManagementClient, is_async=True) - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_dedicated_host_groups_list_by_subscription(self, resource_group): - response = self.client.dedicated_host_groups.list_by_subscription( - api_version="2025-04-01", - ) - result = [r async for r in response] - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_dedicated_host_groups_list_by_resource_group(self, resource_group): - response = self.client.dedicated_host_groups.list_by_resource_group( - resource_group_name=resource_group.name, - api_version="2025-04-01", - ) - result = [r async for r in response] - # please add some check logic here by yourself - # ... + self.client = self.create_mgmt_client(ComputeClient, is_async=True) @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async @@ -46,7 +25,6 @@ async def test_dedicated_host_groups_get(self, resource_group): response = await self.client.dedicated_host_groups.get( resource_group_name=resource_group.name, host_group_name="str", - api_version="2025-04-01", ) # please add some check logic here by yourself @@ -58,32 +36,34 @@ async def test_dedicated_host_groups_create_or_update(self, resource_group): response = await self.client.dedicated_host_groups.create_or_update( resource_group_name=resource_group.name, host_group_name="str", - parameters={ + resource={ "location": "str", - "additionalCapabilities": {"ultraSSDEnabled": bool}, - "hosts": [{"id": "str"}], "id": "str", - "instanceView": { - "hosts": [ - { - "assetId": "str", - "availableCapacity": {"allocatableVMs": [{"count": 0.0, "vmSize": "str"}]}, - "name": "str", - "statuses": [ - { - "code": "str", - "displayStatus": "str", - "level": "str", - "message": "str", - "time": "2020-02-20 00:00:00", - } - ], - } - ] - }, "name": "str", - "platformFaultDomainCount": 0, - "supportAutomaticPlacement": bool, + "properties": { + "platformFaultDomainCount": 0, + "additionalCapabilities": {"ultraSSDEnabled": bool}, + "hosts": [{"id": "str"}], + "instanceView": { + "hosts": [ + { + "assetId": "str", + "availableCapacity": {"allocatableVMs": [{"count": 0.0, "vmSize": "str"}]}, + "name": "str", + "statuses": [ + { + "code": "str", + "displayStatus": "str", + "level": "str", + "message": "str", + "time": "2020-02-20 00:00:00", + } + ], + } + ] + }, + "supportAutomaticPlacement": bool, + }, "systemData": { "createdAt": "2020-02-20 00:00:00", "createdBy": "str", @@ -96,7 +76,6 @@ async def test_dedicated_host_groups_create_or_update(self, resource_group): "type": "str", "zones": ["str"], }, - api_version="2025-04-01", ) # please add some check logic here by yourself @@ -108,33 +87,34 @@ async def test_dedicated_host_groups_update(self, resource_group): response = await self.client.dedicated_host_groups.update( resource_group_name=resource_group.name, host_group_name="str", - parameters={ - "additionalCapabilities": {"ultraSSDEnabled": bool}, - "hosts": [{"id": "str"}], - "instanceView": { - "hosts": [ - { - "assetId": "str", - "availableCapacity": {"allocatableVMs": [{"count": 0.0, "vmSize": "str"}]}, - "name": "str", - "statuses": [ - { - "code": "str", - "displayStatus": "str", - "level": "str", - "message": "str", - "time": "2020-02-20 00:00:00", - } - ], - } - ] + properties={ + "properties": { + "platformFaultDomainCount": 0, + "additionalCapabilities": {"ultraSSDEnabled": bool}, + "hosts": [{"id": "str"}], + "instanceView": { + "hosts": [ + { + "assetId": "str", + "availableCapacity": {"allocatableVMs": [{"count": 0.0, "vmSize": "str"}]}, + "name": "str", + "statuses": [ + { + "code": "str", + "displayStatus": "str", + "level": "str", + "message": "str", + "time": "2020-02-20 00:00:00", + } + ], + } + ] + }, + "supportAutomaticPlacement": bool, }, - "platformFaultDomainCount": 0, - "supportAutomaticPlacement": bool, "tags": {"str": "str"}, "zones": ["str"], }, - api_version="2025-04-01", ) # please add some check logic here by yourself @@ -146,8 +126,25 @@ async def test_dedicated_host_groups_delete(self, resource_group): response = await self.client.dedicated_host_groups.delete( resource_group_name=resource_group.name, host_group_name="str", - api_version="2025-04-01", ) # please add some check logic here by yourself # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_dedicated_host_groups_list_by_resource_group(self, resource_group): + response = self.client.dedicated_host_groups.list_by_resource_group( + resource_group_name=resource_group.name, + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_dedicated_host_groups_list_by_subscription(self, resource_group): + response = self.client.dedicated_host_groups.list_by_subscription() + result = [r async for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_dedicated_hosts_operations.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_dedicated_hosts_operations.py similarity index 69% rename from sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_dedicated_hosts_operations.py rename to sdk/compute/azure-mgmt-compute/generated_tests/test_compute_dedicated_hosts_operations.py index a36dc7b202cb..40e786b15592 100644 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_dedicated_hosts_operations.py +++ b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_dedicated_hosts_operations.py @@ -2,11 +2,11 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.compute import ComputeManagementClient +from azure.mgmt.compute import ComputeClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy @@ -14,21 +14,9 @@ @pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestComputeManagementDedicatedHostsOperations(AzureMgmtRecordedTestCase): +class TestComputeDedicatedHostsOperations(AzureMgmtRecordedTestCase): def setup_method(self, method): - self.client = self.create_mgmt_client(ComputeManagementClient) - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_dedicated_hosts_list_by_host_group(self, resource_group): - response = self.client.dedicated_hosts.list_by_host_group( - resource_group_name=resource_group.name, - host_group_name="str", - api_version="2025-04-01", - ) - result = [r for r in response] - # please add some check logic here by yourself - # ... + self.client = self.create_mgmt_client(ComputeClient) @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy @@ -37,7 +25,6 @@ def test_dedicated_hosts_get(self, resource_group): resource_group_name=resource_group.name, host_group_name="str", host_name="str", - api_version="2025-04-01", ) # please add some check logic here by yourself @@ -50,30 +37,34 @@ def test_dedicated_hosts_begin_create_or_update(self, resource_group): resource_group_name=resource_group.name, host_group_name="str", host_name="str", - parameters={ + resource={ "location": "str", "sku": {"capacity": 0, "name": "str", "tier": "str"}, - "autoReplaceOnFailure": bool, - "hostId": "str", "id": "str", - "instanceView": { - "assetId": "str", - "availableCapacity": {"allocatableVMs": [{"count": 0.0, "vmSize": "str"}]}, - "statuses": [ - { - "code": "str", - "displayStatus": "str", - "level": "str", - "message": "str", - "time": "2020-02-20 00:00:00", - } - ], - }, - "licenseType": "str", "name": "str", - "platformFaultDomain": 0, - "provisioningState": "str", - "provisioningTime": "2020-02-20 00:00:00", + "properties": { + "autoReplaceOnFailure": bool, + "hostId": "str", + "instanceView": { + "assetId": "str", + "availableCapacity": {"allocatableVMs": [{"count": 0.0, "vmSize": "str"}]}, + "statuses": [ + { + "code": "str", + "displayStatus": "str", + "level": "str", + "message": "str", + "time": "2020-02-20 00:00:00", + } + ], + }, + "licenseType": "str", + "platformFaultDomain": 0, + "provisioningState": "str", + "provisioningTime": "2020-02-20 00:00:00", + "timeCreated": "2020-02-20 00:00:00", + "virtualMachines": [{"id": "str"}], + }, "systemData": { "createdAt": "2020-02-20 00:00:00", "createdBy": "str", @@ -83,11 +74,8 @@ def test_dedicated_hosts_begin_create_or_update(self, resource_group): "lastModifiedByType": "str", }, "tags": {"str": "str"}, - "timeCreated": "2020-02-20 00:00:00", "type": "str", - "virtualMachines": [{"id": "str"}], }, - api_version="2025-04-01", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -100,32 +88,33 @@ def test_dedicated_hosts_begin_update(self, resource_group): resource_group_name=resource_group.name, host_group_name="str", host_name="str", - parameters={ - "autoReplaceOnFailure": bool, - "hostId": "str", - "instanceView": { - "assetId": "str", - "availableCapacity": {"allocatableVMs": [{"count": 0.0, "vmSize": "str"}]}, - "statuses": [ - { - "code": "str", - "displayStatus": "str", - "level": "str", - "message": "str", - "time": "2020-02-20 00:00:00", - } - ], + properties={ + "properties": { + "autoReplaceOnFailure": bool, + "hostId": "str", + "instanceView": { + "assetId": "str", + "availableCapacity": {"allocatableVMs": [{"count": 0.0, "vmSize": "str"}]}, + "statuses": [ + { + "code": "str", + "displayStatus": "str", + "level": "str", + "message": "str", + "time": "2020-02-20 00:00:00", + } + ], + }, + "licenseType": "str", + "platformFaultDomain": 0, + "provisioningState": "str", + "provisioningTime": "2020-02-20 00:00:00", + "timeCreated": "2020-02-20 00:00:00", + "virtualMachines": [{"id": "str"}], }, - "licenseType": "str", - "platformFaultDomain": 0, - "provisioningState": "str", - "provisioningTime": "2020-02-20 00:00:00", "sku": {"capacity": 0, "name": "str", "tier": "str"}, "tags": {"str": "str"}, - "timeCreated": "2020-02-20 00:00:00", - "virtualMachines": [{"id": "str"}], }, - api_version="2025-04-01", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -138,12 +127,22 @@ def test_dedicated_hosts_begin_delete(self, resource_group): resource_group_name=resource_group.name, host_group_name="str", host_name="str", - api_version="2025-04-01", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself # ... + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_dedicated_hosts_list_by_host_group(self, resource_group): + response = self.client.dedicated_hosts.list_by_host_group( + resource_group_name=resource_group.name, + host_group_name="str", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy def test_dedicated_hosts_list_available_sizes(self, resource_group): @@ -151,7 +150,6 @@ def test_dedicated_hosts_list_available_sizes(self, resource_group): resource_group_name=resource_group.name, host_group_name="str", host_name="str", - api_version="2025-04-01", ) result = [r for r in response] # please add some check logic here by yourself @@ -164,7 +162,6 @@ def test_dedicated_hosts_begin_redeploy(self, resource_group): resource_group_name=resource_group.name, host_group_name="str", host_name="str", - api_version="2025-04-01", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -177,7 +174,6 @@ def test_dedicated_hosts_begin_restart(self, resource_group): resource_group_name=resource_group.name, host_group_name="str", host_name="str", - api_version="2025-04-01", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_dedicated_hosts_operations_async.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_dedicated_hosts_operations_async.py similarity index 68% rename from sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_dedicated_hosts_operations_async.py rename to sdk/compute/azure-mgmt-compute/generated_tests/test_compute_dedicated_hosts_operations_async.py index d56858a6d619..daaae60d724f 100644 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_dedicated_hosts_operations_async.py +++ b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_dedicated_hosts_operations_async.py @@ -2,11 +2,11 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.compute.aio import ComputeManagementClient +from azure.mgmt.compute.aio import ComputeClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer from devtools_testutils.aio import recorded_by_proxy_async @@ -15,21 +15,9 @@ @pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestComputeManagementDedicatedHostsOperationsAsync(AzureMgmtRecordedTestCase): +class TestComputeDedicatedHostsOperationsAsync(AzureMgmtRecordedTestCase): def setup_method(self, method): - self.client = self.create_mgmt_client(ComputeManagementClient, is_async=True) - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_dedicated_hosts_list_by_host_group(self, resource_group): - response = self.client.dedicated_hosts.list_by_host_group( - resource_group_name=resource_group.name, - host_group_name="str", - api_version="2025-04-01", - ) - result = [r async for r in response] - # please add some check logic here by yourself - # ... + self.client = self.create_mgmt_client(ComputeClient, is_async=True) @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async @@ -38,7 +26,6 @@ async def test_dedicated_hosts_get(self, resource_group): resource_group_name=resource_group.name, host_group_name="str", host_name="str", - api_version="2025-04-01", ) # please add some check logic here by yourself @@ -52,30 +39,34 @@ async def test_dedicated_hosts_begin_create_or_update(self, resource_group): resource_group_name=resource_group.name, host_group_name="str", host_name="str", - parameters={ + resource={ "location": "str", "sku": {"capacity": 0, "name": "str", "tier": "str"}, - "autoReplaceOnFailure": bool, - "hostId": "str", "id": "str", - "instanceView": { - "assetId": "str", - "availableCapacity": {"allocatableVMs": [{"count": 0.0, "vmSize": "str"}]}, - "statuses": [ - { - "code": "str", - "displayStatus": "str", - "level": "str", - "message": "str", - "time": "2020-02-20 00:00:00", - } - ], - }, - "licenseType": "str", "name": "str", - "platformFaultDomain": 0, - "provisioningState": "str", - "provisioningTime": "2020-02-20 00:00:00", + "properties": { + "autoReplaceOnFailure": bool, + "hostId": "str", + "instanceView": { + "assetId": "str", + "availableCapacity": {"allocatableVMs": [{"count": 0.0, "vmSize": "str"}]}, + "statuses": [ + { + "code": "str", + "displayStatus": "str", + "level": "str", + "message": "str", + "time": "2020-02-20 00:00:00", + } + ], + }, + "licenseType": "str", + "platformFaultDomain": 0, + "provisioningState": "str", + "provisioningTime": "2020-02-20 00:00:00", + "timeCreated": "2020-02-20 00:00:00", + "virtualMachines": [{"id": "str"}], + }, "systemData": { "createdAt": "2020-02-20 00:00:00", "createdBy": "str", @@ -85,11 +76,8 @@ async def test_dedicated_hosts_begin_create_or_update(self, resource_group): "lastModifiedByType": "str", }, "tags": {"str": "str"}, - "timeCreated": "2020-02-20 00:00:00", "type": "str", - "virtualMachines": [{"id": "str"}], }, - api_version="2025-04-01", ) ).result() # call '.result()' to poll until service return final result @@ -104,32 +92,33 @@ async def test_dedicated_hosts_begin_update(self, resource_group): resource_group_name=resource_group.name, host_group_name="str", host_name="str", - parameters={ - "autoReplaceOnFailure": bool, - "hostId": "str", - "instanceView": { - "assetId": "str", - "availableCapacity": {"allocatableVMs": [{"count": 0.0, "vmSize": "str"}]}, - "statuses": [ - { - "code": "str", - "displayStatus": "str", - "level": "str", - "message": "str", - "time": "2020-02-20 00:00:00", - } - ], + properties={ + "properties": { + "autoReplaceOnFailure": bool, + "hostId": "str", + "instanceView": { + "assetId": "str", + "availableCapacity": {"allocatableVMs": [{"count": 0.0, "vmSize": "str"}]}, + "statuses": [ + { + "code": "str", + "displayStatus": "str", + "level": "str", + "message": "str", + "time": "2020-02-20 00:00:00", + } + ], + }, + "licenseType": "str", + "platformFaultDomain": 0, + "provisioningState": "str", + "provisioningTime": "2020-02-20 00:00:00", + "timeCreated": "2020-02-20 00:00:00", + "virtualMachines": [{"id": "str"}], }, - "licenseType": "str", - "platformFaultDomain": 0, - "provisioningState": "str", - "provisioningTime": "2020-02-20 00:00:00", "sku": {"capacity": 0, "name": "str", "tier": "str"}, "tags": {"str": "str"}, - "timeCreated": "2020-02-20 00:00:00", - "virtualMachines": [{"id": "str"}], }, - api_version="2025-04-01", ) ).result() # call '.result()' to poll until service return final result @@ -144,13 +133,23 @@ async def test_dedicated_hosts_begin_delete(self, resource_group): resource_group_name=resource_group.name, host_group_name="str", host_name="str", - api_version="2025-04-01", ) ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself # ... + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_dedicated_hosts_list_by_host_group(self, resource_group): + response = self.client.dedicated_hosts.list_by_host_group( + resource_group_name=resource_group.name, + host_group_name="str", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async async def test_dedicated_hosts_list_available_sizes(self, resource_group): @@ -158,7 +157,6 @@ async def test_dedicated_hosts_list_available_sizes(self, resource_group): resource_group_name=resource_group.name, host_group_name="str", host_name="str", - api_version="2025-04-01", ) result = [r async for r in response] # please add some check logic here by yourself @@ -172,7 +170,6 @@ async def test_dedicated_hosts_begin_redeploy(self, resource_group): resource_group_name=resource_group.name, host_group_name="str", host_name="str", - api_version="2025-04-01", ) ).result() # call '.result()' to poll until service return final result @@ -187,7 +184,6 @@ async def test_dedicated_hosts_begin_restart(self, resource_group): resource_group_name=resource_group.name, host_group_name="str", host_name="str", - api_version="2025-04-01", ) ).result() # call '.result()' to poll until service return final result diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_disk_accesses_operations.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_disk_accesses_operations.py new file mode 100644 index 000000000000..af4e07b037e3 --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_disk_accesses_operations.py @@ -0,0 +1,137 @@ +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.compute import ComputeClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestComputeDiskAccessesOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ComputeClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_disk_accesses_get(self, resource_group): + response = self.client.disk_accesses.get( + resource_group_name=resource_group.name, + disk_access_name="str", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_disk_accesses_begin_create_or_update(self, resource_group): + response = self.client.disk_accesses.begin_create_or_update( + resource_group_name=resource_group.name, + disk_access_name="str", + resource={ + "location": "str", + "extendedLocation": {"name": "str", "type": "str"}, + "id": "str", + "name": "str", + "properties": { + "privateEndpointConnections": [ + { + "id": "str", + "name": "str", + "properties": { + "privateLinkServiceConnectionState": { + "actionsRequired": "str", + "description": "str", + "status": "str", + }, + "privateEndpoint": {"id": "str"}, + "provisioningState": "str", + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + } + ], + "provisioningState": "str", + "timeCreated": "2020-02-20 00:00:00", + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "tags": {"str": "str"}, + "type": "str", + }, + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_disk_accesses_begin_update(self, resource_group): + response = self.client.disk_accesses.begin_update( + resource_group_name=resource_group.name, + disk_access_name="str", + properties={"tags": {"str": "str"}}, + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_disk_accesses_begin_delete(self, resource_group): + response = self.client.disk_accesses.begin_delete( + resource_group_name=resource_group.name, + disk_access_name="str", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_disk_accesses_list_by_resource_group(self, resource_group): + response = self.client.disk_accesses.list_by_resource_group( + resource_group_name=resource_group.name, + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_disk_accesses_list(self, resource_group): + response = self.client.disk_accesses.list() + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_disk_accesses_get_private_link_resources(self, resource_group): + response = self.client.disk_accesses.get_private_link_resources( + resource_group_name=resource_group.name, + disk_access_name="str", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_disk_accesses_operations_async.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_disk_accesses_operations_async.py new file mode 100644 index 000000000000..0e6e90a20314 --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_disk_accesses_operations_async.py @@ -0,0 +1,144 @@ +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.compute.aio import ComputeClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestComputeDiskAccessesOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ComputeClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_disk_accesses_get(self, resource_group): + response = await self.client.disk_accesses.get( + resource_group_name=resource_group.name, + disk_access_name="str", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_disk_accesses_begin_create_or_update(self, resource_group): + response = await ( + await self.client.disk_accesses.begin_create_or_update( + resource_group_name=resource_group.name, + disk_access_name="str", + resource={ + "location": "str", + "extendedLocation": {"name": "str", "type": "str"}, + "id": "str", + "name": "str", + "properties": { + "privateEndpointConnections": [ + { + "id": "str", + "name": "str", + "properties": { + "privateLinkServiceConnectionState": { + "actionsRequired": "str", + "description": "str", + "status": "str", + }, + "privateEndpoint": {"id": "str"}, + "provisioningState": "str", + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + } + ], + "provisioningState": "str", + "timeCreated": "2020-02-20 00:00:00", + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "tags": {"str": "str"}, + "type": "str", + }, + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_disk_accesses_begin_update(self, resource_group): + response = await ( + await self.client.disk_accesses.begin_update( + resource_group_name=resource_group.name, + disk_access_name="str", + properties={"tags": {"str": "str"}}, + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_disk_accesses_begin_delete(self, resource_group): + response = await ( + await self.client.disk_accesses.begin_delete( + resource_group_name=resource_group.name, + disk_access_name="str", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_disk_accesses_list_by_resource_group(self, resource_group): + response = self.client.disk_accesses.list_by_resource_group( + resource_group_name=resource_group.name, + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_disk_accesses_list(self, resource_group): + response = self.client.disk_accesses.list() + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_disk_accesses_get_private_link_resources(self, resource_group): + response = await self.client.disk_accesses.get_private_link_resources( + resource_group_name=resource_group.name, + disk_access_name="str", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_disk_encryption_sets_operations.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_disk_encryption_sets_operations.py similarity index 74% rename from sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_disk_encryption_sets_operations.py rename to sdk/compute/azure-mgmt-compute/generated_tests/test_compute_disk_encryption_sets_operations.py index 7200129948d7..9f5b7438a27e 100644 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_disk_encryption_sets_operations.py +++ b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_disk_encryption_sets_operations.py @@ -2,11 +2,11 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.compute import ComputeManagementClient +from azure.mgmt.compute import ComputeClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy @@ -14,30 +14,9 @@ @pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestComputeManagementDiskEncryptionSetsOperations(AzureMgmtRecordedTestCase): +class TestComputeDiskEncryptionSetsOperations(AzureMgmtRecordedTestCase): def setup_method(self, method): - self.client = self.create_mgmt_client(ComputeManagementClient) - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_disk_encryption_sets_list(self, resource_group): - response = self.client.disk_encryption_sets.list( - api_version="2025-01-02", - ) - result = [r for r in response] - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_disk_encryption_sets_list_by_resource_group(self, resource_group): - response = self.client.disk_encryption_sets.list_by_resource_group( - resource_group_name=resource_group.name, - api_version="2025-01-02", - ) - result = [r for r in response] - # please add some check logic here by yourself - # ... + self.client = self.create_mgmt_client(ComputeClient) @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy @@ -45,7 +24,6 @@ def test_disk_encryption_sets_get(self, resource_group): response = self.client.disk_encryption_sets.get( resource_group_name=resource_group.name, disk_encryption_set_name="str", - api_version="2025-01-02", ) # please add some check logic here by yourself @@ -57,18 +35,8 @@ def test_disk_encryption_sets_begin_create_or_update(self, resource_group): response = self.client.disk_encryption_sets.begin_create_or_update( resource_group_name=resource_group.name, disk_encryption_set_name="str", - disk_encryption_set={ + resource={ "location": "str", - "activeKey": {"keyUrl": "str", "sourceVault": {"id": "str"}}, - "autoKeyRotationError": { - "code": "str", - "details": [{"code": "str", "message": "str", "target": "str"}], - "innererror": {"errordetail": "str", "exceptiontype": "str"}, - "message": "str", - "target": "str", - }, - "encryptionType": "str", - "federatedClientId": "str", "id": "str", "identity": { "principalId": "str", @@ -76,11 +44,23 @@ def test_disk_encryption_sets_begin_create_or_update(self, resource_group): "type": "str", "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, }, - "lastKeyRotationTimestamp": "2020-02-20 00:00:00", "name": "str", - "previousKeys": [{"keyUrl": "str", "sourceVault": {"id": "str"}}], - "provisioningState": "str", - "rotationToLatestKeyVersionEnabled": bool, + "properties": { + "activeKey": {"keyUrl": "str", "sourceVault": {"id": "str"}}, + "autoKeyRotationError": { + "code": "str", + "details": [{"code": "str", "message": "str", "target": "str"}], + "innererror": {"errordetail": "str", "exceptiontype": "str"}, + "message": "str", + "target": "str", + }, + "encryptionType": "str", + "federatedClientId": "str", + "lastKeyRotationTimestamp": "2020-02-20 00:00:00", + "previousKeys": [{"keyUrl": "str", "sourceVault": {"id": "str"}}], + "provisioningState": "str", + "rotationToLatestKeyVersionEnabled": bool, + }, "systemData": { "createdAt": "2020-02-20 00:00:00", "createdBy": "str", @@ -92,7 +72,6 @@ def test_disk_encryption_sets_begin_create_or_update(self, resource_group): "tags": {"str": "str"}, "type": "str", }, - api_version="2025-01-02", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -104,20 +83,21 @@ def test_disk_encryption_sets_begin_update(self, resource_group): response = self.client.disk_encryption_sets.begin_update( resource_group_name=resource_group.name, disk_encryption_set_name="str", - disk_encryption_set={ - "activeKey": {"keyUrl": "str", "sourceVault": {"id": "str"}}, - "encryptionType": "str", - "federatedClientId": "str", + properties={ "identity": { "principalId": "str", "tenantId": "str", "type": "str", "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, }, - "rotationToLatestKeyVersionEnabled": bool, + "properties": { + "activeKey": {"keyUrl": "str", "sourceVault": {"id": "str"}}, + "encryptionType": "str", + "federatedClientId": "str", + "rotationToLatestKeyVersionEnabled": bool, + }, "tags": {"str": "str"}, }, - api_version="2025-01-02", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -129,19 +109,35 @@ def test_disk_encryption_sets_begin_delete(self, resource_group): response = self.client.disk_encryption_sets.begin_delete( resource_group_name=resource_group.name, disk_encryption_set_name="str", - api_version="2025-01-02", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself # ... + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_disk_encryption_sets_list_by_resource_group(self, resource_group): + response = self.client.disk_encryption_sets.list_by_resource_group( + resource_group_name=resource_group.name, + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_disk_encryption_sets_list(self, resource_group): + response = self.client.disk_encryption_sets.list() + result = [r for r in response] + # please add some check logic here by yourself + # ... + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy def test_disk_encryption_sets_list_associated_resources(self, resource_group): response = self.client.disk_encryption_sets.list_associated_resources( resource_group_name=resource_group.name, disk_encryption_set_name="str", - api_version="2025-01-02", ) result = [r for r in response] # please add some check logic here by yourself diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_disk_encryption_sets_operations_async.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_disk_encryption_sets_operations_async.py similarity index 74% rename from sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_disk_encryption_sets_operations_async.py rename to sdk/compute/azure-mgmt-compute/generated_tests/test_compute_disk_encryption_sets_operations_async.py index 96e93b90ba81..c73dd9faadbb 100644 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_disk_encryption_sets_operations_async.py +++ b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_disk_encryption_sets_operations_async.py @@ -2,11 +2,11 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.compute.aio import ComputeManagementClient +from azure.mgmt.compute.aio import ComputeClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer from devtools_testutils.aio import recorded_by_proxy_async @@ -15,30 +15,9 @@ @pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestComputeManagementDiskEncryptionSetsOperationsAsync(AzureMgmtRecordedTestCase): +class TestComputeDiskEncryptionSetsOperationsAsync(AzureMgmtRecordedTestCase): def setup_method(self, method): - self.client = self.create_mgmt_client(ComputeManagementClient, is_async=True) - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_disk_encryption_sets_list(self, resource_group): - response = self.client.disk_encryption_sets.list( - api_version="2025-01-02", - ) - result = [r async for r in response] - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_disk_encryption_sets_list_by_resource_group(self, resource_group): - response = self.client.disk_encryption_sets.list_by_resource_group( - resource_group_name=resource_group.name, - api_version="2025-01-02", - ) - result = [r async for r in response] - # please add some check logic here by yourself - # ... + self.client = self.create_mgmt_client(ComputeClient, is_async=True) @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async @@ -46,7 +25,6 @@ async def test_disk_encryption_sets_get(self, resource_group): response = await self.client.disk_encryption_sets.get( resource_group_name=resource_group.name, disk_encryption_set_name="str", - api_version="2025-01-02", ) # please add some check logic here by yourself @@ -59,18 +37,8 @@ async def test_disk_encryption_sets_begin_create_or_update(self, resource_group) await self.client.disk_encryption_sets.begin_create_or_update( resource_group_name=resource_group.name, disk_encryption_set_name="str", - disk_encryption_set={ + resource={ "location": "str", - "activeKey": {"keyUrl": "str", "sourceVault": {"id": "str"}}, - "autoKeyRotationError": { - "code": "str", - "details": [{"code": "str", "message": "str", "target": "str"}], - "innererror": {"errordetail": "str", "exceptiontype": "str"}, - "message": "str", - "target": "str", - }, - "encryptionType": "str", - "federatedClientId": "str", "id": "str", "identity": { "principalId": "str", @@ -78,11 +46,23 @@ async def test_disk_encryption_sets_begin_create_or_update(self, resource_group) "type": "str", "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, }, - "lastKeyRotationTimestamp": "2020-02-20 00:00:00", "name": "str", - "previousKeys": [{"keyUrl": "str", "sourceVault": {"id": "str"}}], - "provisioningState": "str", - "rotationToLatestKeyVersionEnabled": bool, + "properties": { + "activeKey": {"keyUrl": "str", "sourceVault": {"id": "str"}}, + "autoKeyRotationError": { + "code": "str", + "details": [{"code": "str", "message": "str", "target": "str"}], + "innererror": {"errordetail": "str", "exceptiontype": "str"}, + "message": "str", + "target": "str", + }, + "encryptionType": "str", + "federatedClientId": "str", + "lastKeyRotationTimestamp": "2020-02-20 00:00:00", + "previousKeys": [{"keyUrl": "str", "sourceVault": {"id": "str"}}], + "provisioningState": "str", + "rotationToLatestKeyVersionEnabled": bool, + }, "systemData": { "createdAt": "2020-02-20 00:00:00", "createdBy": "str", @@ -94,7 +74,6 @@ async def test_disk_encryption_sets_begin_create_or_update(self, resource_group) "tags": {"str": "str"}, "type": "str", }, - api_version="2025-01-02", ) ).result() # call '.result()' to poll until service return final result @@ -108,20 +87,21 @@ async def test_disk_encryption_sets_begin_update(self, resource_group): await self.client.disk_encryption_sets.begin_update( resource_group_name=resource_group.name, disk_encryption_set_name="str", - disk_encryption_set={ - "activeKey": {"keyUrl": "str", "sourceVault": {"id": "str"}}, - "encryptionType": "str", - "federatedClientId": "str", + properties={ "identity": { "principalId": "str", "tenantId": "str", "type": "str", "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, }, - "rotationToLatestKeyVersionEnabled": bool, + "properties": { + "activeKey": {"keyUrl": "str", "sourceVault": {"id": "str"}}, + "encryptionType": "str", + "federatedClientId": "str", + "rotationToLatestKeyVersionEnabled": bool, + }, "tags": {"str": "str"}, }, - api_version="2025-01-02", ) ).result() # call '.result()' to poll until service return final result @@ -135,20 +115,36 @@ async def test_disk_encryption_sets_begin_delete(self, resource_group): await self.client.disk_encryption_sets.begin_delete( resource_group_name=resource_group.name, disk_encryption_set_name="str", - api_version="2025-01-02", ) ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself # ... + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_disk_encryption_sets_list_by_resource_group(self, resource_group): + response = self.client.disk_encryption_sets.list_by_resource_group( + resource_group_name=resource_group.name, + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_disk_encryption_sets_list(self, resource_group): + response = self.client.disk_encryption_sets.list() + result = [r async for r in response] + # please add some check logic here by yourself + # ... + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async async def test_disk_encryption_sets_list_associated_resources(self, resource_group): response = self.client.disk_encryption_sets.list_associated_resources( resource_group_name=resource_group.name, disk_encryption_set_name="str", - api_version="2025-01-02", ) result = [r async for r in response] # please add some check logic here by yourself diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_disk_restore_point_operations.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_disk_restore_points_operations.py similarity index 65% rename from sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_disk_restore_point_operations.py rename to sdk/compute/azure-mgmt-compute/generated_tests/test_compute_disk_restore_points_operations.py index 4c3f1158e319..507c1afb2a1d 100644 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_disk_restore_point_operations.py +++ b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_disk_restore_points_operations.py @@ -2,11 +2,11 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.compute import ComputeManagementClient +from azure.mgmt.compute import ComputeClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy @@ -14,52 +14,44 @@ @pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestComputeManagementDiskRestorePointOperations(AzureMgmtRecordedTestCase): +class TestComputeDiskRestorePointsOperations(AzureMgmtRecordedTestCase): def setup_method(self, method): - self.client = self.create_mgmt_client(ComputeManagementClient) + self.client = self.create_mgmt_client(ComputeClient) @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_disk_restore_point_list_by_restore_point(self, resource_group): - response = self.client.disk_restore_point.list_by_restore_point( + def test_disk_restore_points_get(self, resource_group): + response = self.client.disk_restore_points.get( resource_group_name=resource_group.name, restore_point_collection_name="str", vm_restore_point_name="str", - api_version="2025-01-02", + disk_restore_point_name="str", ) - result = [r for r in response] + # please add some check logic here by yourself # ... @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_disk_restore_point_get(self, resource_group): - response = self.client.disk_restore_point.get( + def test_disk_restore_points_list_by_restore_point(self, resource_group): + response = self.client.disk_restore_points.list_by_restore_point( resource_group_name=resource_group.name, restore_point_collection_name="str", vm_restore_point_name="str", - disk_restore_point_name="str", - api_version="2025-01-02", ) - + result = [r for r in response] # please add some check logic here by yourself # ... @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_disk_restore_point_begin_grant_access(self, resource_group): - response = self.client.disk_restore_point.begin_grant_access( + def test_disk_restore_points_begin_grant_access(self, resource_group): + response = self.client.disk_restore_points.begin_grant_access( resource_group_name=resource_group.name, restore_point_collection_name="str", vm_restore_point_name="str", disk_restore_point_name="str", - grant_access_data={ - "access": "str", - "durationInSeconds": 0, - "fileFormat": "str", - "getSecureVMGuestStateSAS": bool, - }, - api_version="2025-01-02", + body={"access": "str", "durationInSeconds": 0, "fileFormat": "str", "getSecureVMGuestStateSAS": bool}, ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -67,13 +59,12 @@ def test_disk_restore_point_begin_grant_access(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_disk_restore_point_begin_revoke_access(self, resource_group): - response = self.client.disk_restore_point.begin_revoke_access( + def test_disk_restore_points_begin_revoke_access(self, resource_group): + response = self.client.disk_restore_points.begin_revoke_access( resource_group_name=resource_group.name, restore_point_collection_name="str", vm_restore_point_name="str", disk_restore_point_name="str", - api_version="2025-01-02", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_disk_restore_point_operations_async.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_disk_restore_points_operations_async.py similarity index 66% rename from sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_disk_restore_point_operations_async.py rename to sdk/compute/azure-mgmt-compute/generated_tests/test_compute_disk_restore_points_operations_async.py index 2379fe1cca08..665880703605 100644 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_disk_restore_point_operations_async.py +++ b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_disk_restore_points_operations_async.py @@ -2,11 +2,11 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.compute.aio import ComputeManagementClient +from azure.mgmt.compute.aio import ComputeClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer from devtools_testutils.aio import recorded_by_proxy_async @@ -15,53 +15,45 @@ @pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestComputeManagementDiskRestorePointOperationsAsync(AzureMgmtRecordedTestCase): +class TestComputeDiskRestorePointsOperationsAsync(AzureMgmtRecordedTestCase): def setup_method(self, method): - self.client = self.create_mgmt_client(ComputeManagementClient, is_async=True) + self.client = self.create_mgmt_client(ComputeClient, is_async=True) @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_disk_restore_point_list_by_restore_point(self, resource_group): - response = self.client.disk_restore_point.list_by_restore_point( + async def test_disk_restore_points_get(self, resource_group): + response = await self.client.disk_restore_points.get( resource_group_name=resource_group.name, restore_point_collection_name="str", vm_restore_point_name="str", - api_version="2025-01-02", + disk_restore_point_name="str", ) - result = [r async for r in response] + # please add some check logic here by yourself # ... @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_disk_restore_point_get(self, resource_group): - response = await self.client.disk_restore_point.get( + async def test_disk_restore_points_list_by_restore_point(self, resource_group): + response = self.client.disk_restore_points.list_by_restore_point( resource_group_name=resource_group.name, restore_point_collection_name="str", vm_restore_point_name="str", - disk_restore_point_name="str", - api_version="2025-01-02", ) - + result = [r async for r in response] # please add some check logic here by yourself # ... @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_disk_restore_point_begin_grant_access(self, resource_group): + async def test_disk_restore_points_begin_grant_access(self, resource_group): response = await ( - await self.client.disk_restore_point.begin_grant_access( + await self.client.disk_restore_points.begin_grant_access( resource_group_name=resource_group.name, restore_point_collection_name="str", vm_restore_point_name="str", disk_restore_point_name="str", - grant_access_data={ - "access": "str", - "durationInSeconds": 0, - "fileFormat": "str", - "getSecureVMGuestStateSAS": bool, - }, - api_version="2025-01-02", + body={"access": "str", "durationInSeconds": 0, "fileFormat": "str", "getSecureVMGuestStateSAS": bool}, ) ).result() # call '.result()' to poll until service return final result @@ -70,14 +62,13 @@ async def test_disk_restore_point_begin_grant_access(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_disk_restore_point_begin_revoke_access(self, resource_group): + async def test_disk_restore_points_begin_revoke_access(self, resource_group): response = await ( - await self.client.disk_restore_point.begin_revoke_access( + await self.client.disk_restore_points.begin_revoke_access( resource_group_name=resource_group.name, restore_point_collection_name="str", vm_restore_point_name="str", disk_restore_point_name="str", - api_version="2025-01-02", ) ).result() # call '.result()' to poll until service return final result diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_disks_operations_async.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_disks_operations.py similarity index 67% rename from sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_disks_operations_async.py rename to sdk/compute/azure-mgmt-compute/generated_tests/test_compute_disks_operations.py index 9bf5df3fa1ac..d72931fb619a 100644 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_disks_operations_async.py +++ b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_disks_operations.py @@ -2,70 +2,47 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.compute.aio import ComputeManagementClient +from azure.mgmt.compute import ComputeClient -from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer -from devtools_testutils.aio import recorded_by_proxy_async +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy AZURE_LOCATION = "eastus" @pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestComputeManagementDisksOperationsAsync(AzureMgmtRecordedTestCase): +class TestComputeDisksOperations(AzureMgmtRecordedTestCase): def setup_method(self, method): - self.client = self.create_mgmt_client(ComputeManagementClient, is_async=True) + self.client = self.create_mgmt_client(ComputeClient) @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_disks_list(self, resource_group): - response = self.client.disks.list( - api_version="2025-01-02", - ) - result = [r async for r in response] - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_disks_list_by_resource_group(self, resource_group): - response = self.client.disks.list_by_resource_group( - resource_group_name=resource_group.name, - api_version="2025-01-02", - ) - result = [r async for r in response] - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_disks_get(self, resource_group): - response = await self.client.disks.get( + @recorded_by_proxy + def test_disks_get(self, resource_group): + response = self.client.disks.get( resource_group_name=resource_group.name, disk_name="str", - api_version="2025-01-02", ) # please add some check logic here by yourself # ... @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_disks_begin_create_or_update(self, resource_group): - response = await ( - await self.client.disks.begin_create_or_update( - resource_group_name=resource_group.name, - disk_name="str", - disk={ - "location": "str", - "LastOwnershipUpdateTime": "2020-02-20 00:00:00", - "availabilityPolicy": {"actionOnDiskDelay": "str"}, - "burstingEnabled": bool, - "burstingEnabledTime": "2020-02-20 00:00:00", - "completionPercent": 0.0, + @recorded_by_proxy + def test_disks_begin_create_or_update(self, resource_group): + response = self.client.disks.begin_create_or_update( + resource_group_name=resource_group.name, + disk_name="str", + resource={ + "location": "str", + "extendedLocation": {"name": "str", "type": "str"}, + "id": "str", + "managedBy": "str", + "managedByExtended": ["str"], + "name": "str", + "properties": { "creationData": { "createOption": "str", "elasticSanResourceId": "str", @@ -93,6 +70,11 @@ async def test_disks_begin_create_or_update(self, resource_group): "storageAccountId": "str", "uploadSizeBytes": 0, }, + "LastOwnershipUpdateTime": "2020-02-20 00:00:00", + "availabilityPolicy": {"actionOnDiskDelay": "str"}, + "burstingEnabled": bool, + "burstingEnabledTime": "2020-02-20 00:00:00", + "completionPercent": 0.0, "dataAccessAuthMode": "str", "diskAccessId": "str", "diskIOPSReadOnly": 0, @@ -113,13 +95,8 @@ async def test_disks_begin_create_or_update(self, resource_group): ], "encryptionSettingsVersion": "str", }, - "extendedLocation": {"name": "str", "type": "str"}, "hyperVGeneration": "str", - "id": "str", - "managedBy": "str", - "managedByExtended": ["str"], "maxShares": 0, - "name": "str", "networkAccessPolicy": "str", "optimizedForFrequentAttach": bool, "osType": "str", @@ -129,7 +106,6 @@ async def test_disks_begin_create_or_update(self, resource_group): "purchasePlan": {"name": "str", "product": "str", "publisher": "str", "promotionCode": "str"}, "securityProfile": {"secureVMDiskEncryptionSetId": "str", "securityType": "str"}, "shareInfo": [{"vmUri": "str"}], - "sku": {"name": "str", "tier": "str"}, "supportedCapabilities": { "acceleratedNetwork": bool, "architecture": "str", @@ -137,36 +113,36 @@ async def test_disks_begin_create_or_update(self, resource_group): "supportedSecurityOption": "str", }, "supportsHibernation": bool, - "systemData": { - "createdAt": "2020-02-20 00:00:00", - "createdBy": "str", - "createdByType": "str", - "lastModifiedAt": "2020-02-20 00:00:00", - "lastModifiedBy": "str", - "lastModifiedByType": "str", - }, - "tags": {"str": "str"}, "tier": "str", "timeCreated": "2020-02-20 00:00:00", - "type": "str", "uniqueId": "str", - "zones": ["str"], }, - api_version="2025-01-02", - ) + "sku": {"name": "str", "tier": "str"}, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "tags": {"str": "str"}, + "type": "str", + "zones": ["str"], + }, ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself # ... @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_disks_begin_update(self, resource_group): - response = await ( - await self.client.disks.begin_update( - resource_group_name=resource_group.name, - disk_name="str", - disk={ + @recorded_by_proxy + def test_disks_begin_update(self, resource_group): + response = self.client.disks.begin_update( + resource_group_name=resource_group.name, + disk_name="str", + properties={ + "properties": { "availabilityPolicy": {"actionOnDiskDelay": "str"}, "burstingEnabled": bool, "dataAccessAuthMode": "str", @@ -194,7 +170,6 @@ async def test_disks_begin_update(self, resource_group): "propertyUpdatesInProgress": {"targetTier": "str"}, "publicNetworkAccess": "str", "purchasePlan": {"name": "str", "product": "str", "publisher": "str", "promotionCode": "str"}, - "sku": {"name": "str", "tier": "str"}, "supportedCapabilities": { "acceleratedNetwork": bool, "architecture": "str", @@ -202,59 +177,63 @@ async def test_disks_begin_update(self, resource_group): "supportedSecurityOption": "str", }, "supportsHibernation": bool, - "tags": {"str": "str"}, "tier": "str", }, - api_version="2025-01-02", - ) + "sku": {"name": "str", "tier": "str"}, + "tags": {"str": "str"}, + }, ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself # ... @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_disks_begin_delete(self, resource_group): - response = await ( - await self.client.disks.begin_delete( - resource_group_name=resource_group.name, - disk_name="str", - api_version="2025-01-02", - ) + @recorded_by_proxy + def test_disks_begin_delete(self, resource_group): + response = self.client.disks.begin_delete( + resource_group_name=resource_group.name, + disk_name="str", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself # ... @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_disks_begin_grant_access(self, resource_group): - response = await ( - await self.client.disks.begin_grant_access( - resource_group_name=resource_group.name, - disk_name="str", - grant_access_data={ - "access": "str", - "durationInSeconds": 0, - "fileFormat": "str", - "getSecureVMGuestStateSAS": bool, - }, - api_version="2025-01-02", - ) + @recorded_by_proxy + def test_disks_list_by_resource_group(self, resource_group): + response = self.client.disks.list_by_resource_group( + resource_group_name=resource_group.name, + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_disks_list(self, resource_group): + response = self.client.disks.list() + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_disks_begin_grant_access(self, resource_group): + response = self.client.disks.begin_grant_access( + resource_group_name=resource_group.name, + disk_name="str", + body={"access": "str", "durationInSeconds": 0, "fileFormat": "str", "getSecureVMGuestStateSAS": bool}, ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself # ... @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_disks_begin_revoke_access(self, resource_group): - response = await ( - await self.client.disks.begin_revoke_access( - resource_group_name=resource_group.name, - disk_name="str", - api_version="2025-01-02", - ) + @recorded_by_proxy + def test_disks_begin_revoke_access(self, resource_group): + response = self.client.disks.begin_revoke_access( + resource_group_name=resource_group.name, + disk_name="str", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_disks_operations_async.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_disks_operations_async.py new file mode 100644 index 000000000000..18659051a461 --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_disks_operations_async.py @@ -0,0 +1,251 @@ +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.compute.aio import ComputeClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestComputeDisksOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ComputeClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_disks_get(self, resource_group): + response = await self.client.disks.get( + resource_group_name=resource_group.name, + disk_name="str", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_disks_begin_create_or_update(self, resource_group): + response = await ( + await self.client.disks.begin_create_or_update( + resource_group_name=resource_group.name, + disk_name="str", + resource={ + "location": "str", + "extendedLocation": {"name": "str", "type": "str"}, + "id": "str", + "managedBy": "str", + "managedByExtended": ["str"], + "name": "str", + "properties": { + "creationData": { + "createOption": "str", + "elasticSanResourceId": "str", + "galleryImageReference": { + "communityGalleryImageId": "str", + "id": "str", + "lun": 0, + "sharedGalleryImageId": "str", + }, + "imageReference": { + "communityGalleryImageId": "str", + "id": "str", + "lun": 0, + "sharedGalleryImageId": "str", + }, + "instantAccessDurationMinutes": 0, + "logicalSectorSize": 0, + "performancePlus": bool, + "provisionedBandwidthCopySpeed": "str", + "securityDataUri": "str", + "securityMetadataUri": "str", + "sourceResourceId": "str", + "sourceUniqueId": "str", + "sourceUri": "str", + "storageAccountId": "str", + "uploadSizeBytes": 0, + }, + "LastOwnershipUpdateTime": "2020-02-20 00:00:00", + "availabilityPolicy": {"actionOnDiskDelay": "str"}, + "burstingEnabled": bool, + "burstingEnabledTime": "2020-02-20 00:00:00", + "completionPercent": 0.0, + "dataAccessAuthMode": "str", + "diskAccessId": "str", + "diskIOPSReadOnly": 0, + "diskIOPSReadWrite": 0, + "diskMBpsReadOnly": 0, + "diskMBpsReadWrite": 0, + "diskSizeBytes": 0, + "diskSizeGB": 0, + "diskState": "str", + "encryption": {"diskEncryptionSetId": "str", "type": "str"}, + "encryptionSettingsCollection": { + "enabled": bool, + "encryptionSettings": [ + { + "diskEncryptionKey": {"secretUrl": "str", "sourceVault": {"id": "str"}}, + "keyEncryptionKey": {"keyUrl": "str", "sourceVault": {"id": "str"}}, + } + ], + "encryptionSettingsVersion": "str", + }, + "hyperVGeneration": "str", + "maxShares": 0, + "networkAccessPolicy": "str", + "optimizedForFrequentAttach": bool, + "osType": "str", + "propertyUpdatesInProgress": {"targetTier": "str"}, + "provisioningState": "str", + "publicNetworkAccess": "str", + "purchasePlan": {"name": "str", "product": "str", "publisher": "str", "promotionCode": "str"}, + "securityProfile": {"secureVMDiskEncryptionSetId": "str", "securityType": "str"}, + "shareInfo": [{"vmUri": "str"}], + "supportedCapabilities": { + "acceleratedNetwork": bool, + "architecture": "str", + "diskControllerTypes": "str", + "supportedSecurityOption": "str", + }, + "supportsHibernation": bool, + "tier": "str", + "timeCreated": "2020-02-20 00:00:00", + "uniqueId": "str", + }, + "sku": {"name": "str", "tier": "str"}, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "tags": {"str": "str"}, + "type": "str", + "zones": ["str"], + }, + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_disks_begin_update(self, resource_group): + response = await ( + await self.client.disks.begin_update( + resource_group_name=resource_group.name, + disk_name="str", + properties={ + "properties": { + "availabilityPolicy": {"actionOnDiskDelay": "str"}, + "burstingEnabled": bool, + "dataAccessAuthMode": "str", + "diskAccessId": "str", + "diskIOPSReadOnly": 0, + "diskIOPSReadWrite": 0, + "diskMBpsReadOnly": 0, + "diskMBpsReadWrite": 0, + "diskSizeGB": 0, + "encryption": {"diskEncryptionSetId": "str", "type": "str"}, + "encryptionSettingsCollection": { + "enabled": bool, + "encryptionSettings": [ + { + "diskEncryptionKey": {"secretUrl": "str", "sourceVault": {"id": "str"}}, + "keyEncryptionKey": {"keyUrl": "str", "sourceVault": {"id": "str"}}, + } + ], + "encryptionSettingsVersion": "str", + }, + "maxShares": 0, + "networkAccessPolicy": "str", + "optimizedForFrequentAttach": bool, + "osType": "str", + "propertyUpdatesInProgress": {"targetTier": "str"}, + "publicNetworkAccess": "str", + "purchasePlan": {"name": "str", "product": "str", "publisher": "str", "promotionCode": "str"}, + "supportedCapabilities": { + "acceleratedNetwork": bool, + "architecture": "str", + "diskControllerTypes": "str", + "supportedSecurityOption": "str", + }, + "supportsHibernation": bool, + "tier": "str", + }, + "sku": {"name": "str", "tier": "str"}, + "tags": {"str": "str"}, + }, + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_disks_begin_delete(self, resource_group): + response = await ( + await self.client.disks.begin_delete( + resource_group_name=resource_group.name, + disk_name="str", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_disks_list_by_resource_group(self, resource_group): + response = self.client.disks.list_by_resource_group( + resource_group_name=resource_group.name, + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_disks_list(self, resource_group): + response = self.client.disks.list() + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_disks_begin_grant_access(self, resource_group): + response = await ( + await self.client.disks.begin_grant_access( + resource_group_name=resource_group.name, + disk_name="str", + body={"access": "str", "durationInSeconds": 0, "fileFormat": "str", "getSecureVMGuestStateSAS": bool}, + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_disks_begin_revoke_access(self, resource_group): + response = await ( + await self.client.disks.begin_revoke_access( + resource_group_name=resource_group.name, + disk_name="str", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_galleries_operations.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_galleries_operations.py similarity index 55% rename from sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_galleries_operations.py rename to sdk/compute/azure-mgmt-compute/generated_tests/test_compute_galleries_operations.py index 2f6977623afc..397af067dc36 100644 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_galleries_operations.py +++ b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_galleries_operations.py @@ -2,11 +2,11 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.compute import ComputeManagementClient +from azure.mgmt.compute import ComputeClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy @@ -14,30 +14,9 @@ @pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestComputeManagementGalleriesOperations(AzureMgmtRecordedTestCase): +class TestComputeGalleriesOperations(AzureMgmtRecordedTestCase): def setup_method(self, method): - self.client = self.create_mgmt_client(ComputeManagementClient) - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_galleries_list(self, resource_group): - response = self.client.galleries.list( - api_version="2024-03-03", - ) - result = [r for r in response] - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_galleries_list_by_resource_group(self, resource_group): - response = self.client.galleries.list_by_resource_group( - resource_group_name=resource_group.name, - api_version="2024-03-03", - ) - result = [r for r in response] - # please add some check logic here by yourself - # ... + self.client = self.create_mgmt_client(ComputeClient) @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy @@ -45,7 +24,6 @@ def test_galleries_get(self, resource_group): response = self.client.galleries.get( resource_group_name=resource_group.name, gallery_name="str", - api_version="2024-03-03", ) # please add some check logic here by yourself @@ -57,11 +35,9 @@ def test_galleries_begin_create_or_update(self, resource_group): response = self.client.galleries.begin_create_or_update( resource_group_name=resource_group.name, gallery_name="str", - gallery={ + resource={ "location": "str", - "description": "str", "id": "str", - "identifier": {"uniqueName": "str"}, "identity": { "principalId": "str", "tenantId": "str", @@ -69,24 +45,28 @@ def test_galleries_begin_create_or_update(self, resource_group): "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, }, "name": "str", - "provisioningState": "str", - "sharingProfile": { - "communityGalleryInfo": { - "communityGalleryEnabled": bool, - "eula": "str", - "publicNamePrefix": "str", - "publicNames": ["str"], - "publisherContact": "str", - "publisherUri": "str", + "properties": { + "description": "str", + "identifier": {"uniqueName": "str"}, + "provisioningState": "str", + "sharingProfile": { + "communityGalleryInfo": { + "communityGalleryEnabled": bool, + "eula": "str", + "publicNamePrefix": "str", + "publicNames": ["str"], + "publisherContact": "str", + "publisherUri": "str", + }, + "groups": [{"ids": ["str"], "type": "str"}], + "permissions": "str", }, - "groups": [{"ids": ["str"], "type": "str"}], - "permissions": "str", - }, - "sharingStatus": { - "aggregatedState": "str", - "summary": [{"details": "str", "region": "str", "state": "str"}], + "sharingStatus": { + "aggregatedState": "str", + "summary": [{"details": "str", "region": "str", "state": "str"}], + }, + "softDeletePolicy": {"isSoftDeleteEnabled": bool}, }, - "softDeletePolicy": {"isSoftDeleteEnabled": bool}, "systemData": { "createdAt": "2020-02-20 00:00:00", "createdBy": "str", @@ -98,7 +78,6 @@ def test_galleries_begin_create_or_update(self, resource_group): "tags": {"str": "str"}, "type": "str", }, - api_version="2024-03-03", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -110,10 +89,8 @@ def test_galleries_begin_update(self, resource_group): response = self.client.galleries.begin_update( resource_group_name=resource_group.name, gallery_name="str", - gallery={ - "description": "str", + properties={ "id": "str", - "identifier": {"uniqueName": "str"}, "identity": { "principalId": "str", "tenantId": "str", @@ -121,28 +98,31 @@ def test_galleries_begin_update(self, resource_group): "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, }, "name": "str", - "provisioningState": "str", - "sharingProfile": { - "communityGalleryInfo": { - "communityGalleryEnabled": bool, - "eula": "str", - "publicNamePrefix": "str", - "publicNames": ["str"], - "publisherContact": "str", - "publisherUri": "str", + "properties": { + "description": "str", + "identifier": {"uniqueName": "str"}, + "provisioningState": "str", + "sharingProfile": { + "communityGalleryInfo": { + "communityGalleryEnabled": bool, + "eula": "str", + "publicNamePrefix": "str", + "publicNames": ["str"], + "publisherContact": "str", + "publisherUri": "str", + }, + "groups": [{"ids": ["str"], "type": "str"}], + "permissions": "str", }, - "groups": [{"ids": ["str"], "type": "str"}], - "permissions": "str", - }, - "sharingStatus": { - "aggregatedState": "str", - "summary": [{"details": "str", "region": "str", "state": "str"}], + "sharingStatus": { + "aggregatedState": "str", + "summary": [{"details": "str", "region": "str", "state": "str"}], + }, + "softDeletePolicy": {"isSoftDeleteEnabled": bool}, }, - "softDeletePolicy": {"isSoftDeleteEnabled": bool}, "tags": {"str": "str"}, "type": "str", }, - api_version="2024-03-03", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -154,7 +134,49 @@ def test_galleries_begin_delete(self, resource_group): response = self.client.galleries.begin_delete( resource_group_name=resource_group.name, gallery_name="str", - api_version="2024-03-03", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_galleries_list_by_resource_group(self, resource_group): + response = self.client.galleries.list_by_resource_group( + resource_group_name=resource_group.name, + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_galleries_list(self, resource_group): + response = self.client.galleries.list() + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_galleries_list_by_artifact_name(self, resource_group): + response = self.client.galleries.list_by_artifact_name( + resource_group_name=resource_group.name, + gallery_name="str", + artifact_type="str", + artifact_name="str", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_galleries_begin_gallery_sharing_profile_update(self, resource_group): + response = self.client.galleries.begin_gallery_sharing_profile_update( + resource_group_name=resource_group.name, + gallery_name="str", + body={"operationType": "str", "groups": [{"ids": ["str"], "type": "str"}]}, ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_galleries_operations_async.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_galleries_operations_async.py similarity index 56% rename from sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_galleries_operations_async.py rename to sdk/compute/azure-mgmt-compute/generated_tests/test_compute_galleries_operations_async.py index 5998c641acd9..672d77bf92a8 100644 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_galleries_operations_async.py +++ b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_galleries_operations_async.py @@ -2,11 +2,11 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.compute.aio import ComputeManagementClient +from azure.mgmt.compute.aio import ComputeClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer from devtools_testutils.aio import recorded_by_proxy_async @@ -15,30 +15,9 @@ @pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestComputeManagementGalleriesOperationsAsync(AzureMgmtRecordedTestCase): +class TestComputeGalleriesOperationsAsync(AzureMgmtRecordedTestCase): def setup_method(self, method): - self.client = self.create_mgmt_client(ComputeManagementClient, is_async=True) - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_galleries_list(self, resource_group): - response = self.client.galleries.list( - api_version="2024-03-03", - ) - result = [r async for r in response] - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_galleries_list_by_resource_group(self, resource_group): - response = self.client.galleries.list_by_resource_group( - resource_group_name=resource_group.name, - api_version="2024-03-03", - ) - result = [r async for r in response] - # please add some check logic here by yourself - # ... + self.client = self.create_mgmt_client(ComputeClient, is_async=True) @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async @@ -46,7 +25,6 @@ async def test_galleries_get(self, resource_group): response = await self.client.galleries.get( resource_group_name=resource_group.name, gallery_name="str", - api_version="2024-03-03", ) # please add some check logic here by yourself @@ -59,11 +37,9 @@ async def test_galleries_begin_create_or_update(self, resource_group): await self.client.galleries.begin_create_or_update( resource_group_name=resource_group.name, gallery_name="str", - gallery={ + resource={ "location": "str", - "description": "str", "id": "str", - "identifier": {"uniqueName": "str"}, "identity": { "principalId": "str", "tenantId": "str", @@ -71,24 +47,28 @@ async def test_galleries_begin_create_or_update(self, resource_group): "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, }, "name": "str", - "provisioningState": "str", - "sharingProfile": { - "communityGalleryInfo": { - "communityGalleryEnabled": bool, - "eula": "str", - "publicNamePrefix": "str", - "publicNames": ["str"], - "publisherContact": "str", - "publisherUri": "str", + "properties": { + "description": "str", + "identifier": {"uniqueName": "str"}, + "provisioningState": "str", + "sharingProfile": { + "communityGalleryInfo": { + "communityGalleryEnabled": bool, + "eula": "str", + "publicNamePrefix": "str", + "publicNames": ["str"], + "publisherContact": "str", + "publisherUri": "str", + }, + "groups": [{"ids": ["str"], "type": "str"}], + "permissions": "str", }, - "groups": [{"ids": ["str"], "type": "str"}], - "permissions": "str", - }, - "sharingStatus": { - "aggregatedState": "str", - "summary": [{"details": "str", "region": "str", "state": "str"}], + "sharingStatus": { + "aggregatedState": "str", + "summary": [{"details": "str", "region": "str", "state": "str"}], + }, + "softDeletePolicy": {"isSoftDeleteEnabled": bool}, }, - "softDeletePolicy": {"isSoftDeleteEnabled": bool}, "systemData": { "createdAt": "2020-02-20 00:00:00", "createdBy": "str", @@ -100,7 +80,6 @@ async def test_galleries_begin_create_or_update(self, resource_group): "tags": {"str": "str"}, "type": "str", }, - api_version="2024-03-03", ) ).result() # call '.result()' to poll until service return final result @@ -114,10 +93,8 @@ async def test_galleries_begin_update(self, resource_group): await self.client.galleries.begin_update( resource_group_name=resource_group.name, gallery_name="str", - gallery={ - "description": "str", + properties={ "id": "str", - "identifier": {"uniqueName": "str"}, "identity": { "principalId": "str", "tenantId": "str", @@ -125,28 +102,31 @@ async def test_galleries_begin_update(self, resource_group): "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, }, "name": "str", - "provisioningState": "str", - "sharingProfile": { - "communityGalleryInfo": { - "communityGalleryEnabled": bool, - "eula": "str", - "publicNamePrefix": "str", - "publicNames": ["str"], - "publisherContact": "str", - "publisherUri": "str", + "properties": { + "description": "str", + "identifier": {"uniqueName": "str"}, + "provisioningState": "str", + "sharingProfile": { + "communityGalleryInfo": { + "communityGalleryEnabled": bool, + "eula": "str", + "publicNamePrefix": "str", + "publicNames": ["str"], + "publisherContact": "str", + "publisherUri": "str", + }, + "groups": [{"ids": ["str"], "type": "str"}], + "permissions": "str", }, - "groups": [{"ids": ["str"], "type": "str"}], - "permissions": "str", - }, - "sharingStatus": { - "aggregatedState": "str", - "summary": [{"details": "str", "region": "str", "state": "str"}], + "sharingStatus": { + "aggregatedState": "str", + "summary": [{"details": "str", "region": "str", "state": "str"}], + }, + "softDeletePolicy": {"isSoftDeleteEnabled": bool}, }, - "softDeletePolicy": {"isSoftDeleteEnabled": bool}, "tags": {"str": "str"}, "type": "str", }, - api_version="2024-03-03", ) ).result() # call '.result()' to poll until service return final result @@ -160,7 +140,51 @@ async def test_galleries_begin_delete(self, resource_group): await self.client.galleries.begin_delete( resource_group_name=resource_group.name, gallery_name="str", - api_version="2024-03-03", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_galleries_list_by_resource_group(self, resource_group): + response = self.client.galleries.list_by_resource_group( + resource_group_name=resource_group.name, + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_galleries_list(self, resource_group): + response = self.client.galleries.list() + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_galleries_list_by_artifact_name(self, resource_group): + response = self.client.galleries.list_by_artifact_name( + resource_group_name=resource_group.name, + gallery_name="str", + artifact_type="str", + artifact_name="str", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_galleries_begin_gallery_sharing_profile_update(self, resource_group): + response = await ( + await self.client.galleries.begin_gallery_sharing_profile_update( + resource_group_name=resource_group.name, + gallery_name="str", + body={"operationType": "str", "groups": [{"ids": ["str"], "type": "str"}]}, ) ).result() # call '.result()' to poll until service return final result diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_gallery_application_versions_operations_async.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_gallery_application_versions_operations.py similarity index 77% rename from sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_gallery_application_versions_operations_async.py rename to sdk/compute/azure-mgmt-compute/generated_tests/test_compute_gallery_application_versions_operations.py index 5706338bb083..a12438aaf394 100644 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_gallery_application_versions_operations_async.py +++ b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_gallery_application_versions_operations.py @@ -2,64 +2,48 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.compute.aio import ComputeManagementClient +from azure.mgmt.compute import ComputeClient -from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer -from devtools_testutils.aio import recorded_by_proxy_async +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy AZURE_LOCATION = "eastus" @pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestComputeManagementGalleryApplicationVersionsOperationsAsync(AzureMgmtRecordedTestCase): +class TestComputeGalleryApplicationVersionsOperations(AzureMgmtRecordedTestCase): def setup_method(self, method): - self.client = self.create_mgmt_client(ComputeManagementClient, is_async=True) + self.client = self.create_mgmt_client(ComputeClient) @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_gallery_application_versions_list_by_gallery_application(self, resource_group): - response = self.client.gallery_application_versions.list_by_gallery_application( + @recorded_by_proxy + def test_gallery_application_versions_get(self, resource_group): + response = self.client.gallery_application_versions.get( resource_group_name=resource_group.name, gallery_name="str", gallery_application_name="str", - api_version="2024-03-03", + gallery_application_version_name="str", ) - result = [r async for r in response] + # please add some check logic here by yourself # ... @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_gallery_application_versions_get(self, resource_group): - response = await self.client.gallery_application_versions.get( + @recorded_by_proxy + def test_gallery_application_versions_begin_create_or_update(self, resource_group): + response = self.client.gallery_application_versions.begin_create_or_update( resource_group_name=resource_group.name, gallery_name="str", gallery_application_name="str", gallery_application_version_name="str", - api_version="2024-03-03", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_gallery_application_versions_begin_create_or_update(self, resource_group): - response = await ( - await self.client.gallery_application_versions.begin_create_or_update( - resource_group_name=resource_group.name, - gallery_name="str", - gallery_application_name="str", - gallery_application_version_name="str", - gallery_application_version={ - "location": "str", - "id": "str", - "name": "str", - "provisioningState": "str", + resource={ + "location": "str", + "id": "str", + "name": "str", + "properties": { "publishingProfile": { "source": {"mediaLink": "str", "defaultConfigurationLink": "str"}, "advancedSettings": {"str": "str"}, @@ -130,42 +114,41 @@ async def test_gallery_application_versions_begin_create_or_update(self, resourc } ], }, + "provisioningState": "str", "replicationStatus": { "aggregatedState": "str", "summary": [{"details": "str", "progress": 0, "region": "str", "state": "str"}], }, "safetyProfile": {"allowDeletionOfReplicatedLocations": bool}, - "systemData": { - "createdAt": "2020-02-20 00:00:00", - "createdBy": "str", - "createdByType": "str", - "lastModifiedAt": "2020-02-20 00:00:00", - "lastModifiedBy": "str", - "lastModifiedByType": "str", - }, - "tags": {"str": "str"}, - "type": "str", }, - api_version="2024-03-03", - ) + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "tags": {"str": "str"}, + "type": "str", + }, ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself # ... @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_gallery_application_versions_begin_update(self, resource_group): - response = await ( - await self.client.gallery_application_versions.begin_update( - resource_group_name=resource_group.name, - gallery_name="str", - gallery_application_name="str", - gallery_application_version_name="str", - gallery_application_version={ - "id": "str", - "name": "str", - "provisioningState": "str", + @recorded_by_proxy + def test_gallery_application_versions_begin_update(self, resource_group): + response = self.client.gallery_application_versions.begin_update( + resource_group_name=resource_group.name, + gallery_name="str", + gallery_application_name="str", + gallery_application_version_name="str", + properties={ + "id": "str", + "name": "str", + "properties": { "publishingProfile": { "source": {"mediaLink": "str", "defaultConfigurationLink": "str"}, "advancedSettings": {"str": "str"}, @@ -236,33 +219,42 @@ async def test_gallery_application_versions_begin_update(self, resource_group): } ], }, + "provisioningState": "str", "replicationStatus": { "aggregatedState": "str", "summary": [{"details": "str", "progress": 0, "region": "str", "state": "str"}], }, "safetyProfile": {"allowDeletionOfReplicatedLocations": bool}, - "tags": {"str": "str"}, - "type": "str", }, - api_version="2024-03-03", - ) + "tags": {"str": "str"}, + "type": "str", + }, ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself # ... @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_gallery_application_versions_begin_delete(self, resource_group): - response = await ( - await self.client.gallery_application_versions.begin_delete( - resource_group_name=resource_group.name, - gallery_name="str", - gallery_application_name="str", - gallery_application_version_name="str", - api_version="2024-03-03", - ) + @recorded_by_proxy + def test_gallery_application_versions_begin_delete(self, resource_group): + response = self.client.gallery_application_versions.begin_delete( + resource_group_name=resource_group.name, + gallery_name="str", + gallery_application_name="str", + gallery_application_version_name="str", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_gallery_application_versions_list_by_gallery_application(self, resource_group): + response = self.client.gallery_application_versions.list_by_gallery_application( + resource_group_name=resource_group.name, + gallery_name="str", + gallery_application_name="str", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_gallery_application_versions_operations_async.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_gallery_application_versions_operations_async.py new file mode 100644 index 000000000000..6cacc6041fa9 --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_gallery_application_versions_operations_async.py @@ -0,0 +1,267 @@ +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.compute.aio import ComputeClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestComputeGalleryApplicationVersionsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ComputeClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_gallery_application_versions_get(self, resource_group): + response = await self.client.gallery_application_versions.get( + resource_group_name=resource_group.name, + gallery_name="str", + gallery_application_name="str", + gallery_application_version_name="str", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_gallery_application_versions_begin_create_or_update(self, resource_group): + response = await ( + await self.client.gallery_application_versions.begin_create_or_update( + resource_group_name=resource_group.name, + gallery_name="str", + gallery_application_name="str", + gallery_application_version_name="str", + resource={ + "location": "str", + "id": "str", + "name": "str", + "properties": { + "publishingProfile": { + "source": {"mediaLink": "str", "defaultConfigurationLink": "str"}, + "advancedSettings": {"str": "str"}, + "customActions": [ + { + "name": "str", + "script": "str", + "description": "str", + "parameters": [ + { + "name": "str", + "defaultValue": "str", + "description": "str", + "required": bool, + "type": "str", + } + ], + } + ], + "enableHealthCheck": bool, + "endOfLifeDate": "2020-02-20 00:00:00", + "excludeFromLatest": bool, + "manageActions": {"install": "str", "remove": "str", "update": "str"}, + "publishedDate": "2020-02-20 00:00:00", + "replicaCount": 0, + "replicationMode": "str", + "settings": { + "configFileName": "str", + "packageFileName": "str", + "scriptBehaviorAfterReboot": "str", + }, + "storageAccountType": "str", + "targetExtendedLocations": [ + { + "encryption": { + "dataDiskImages": [{"lun": 0, "diskEncryptionSetId": "str"}], + "osDiskImage": { + "diskEncryptionSetId": "str", + "securityProfile": { + "confidentialVMEncryptionType": "str", + "secureVMDiskEncryptionSetId": "str", + }, + }, + }, + "extendedLocation": {"name": "str", "type": "str"}, + "extendedLocationReplicaCount": 0, + "name": "str", + "storageAccountType": "str", + } + ], + "targetRegions": [ + { + "name": "str", + "additionalReplicaSets": [{"regionalReplicaCount": 0, "storageAccountType": "str"}], + "encryption": { + "dataDiskImages": [{"lun": 0, "diskEncryptionSetId": "str"}], + "osDiskImage": { + "diskEncryptionSetId": "str", + "securityProfile": { + "confidentialVMEncryptionType": "str", + "secureVMDiskEncryptionSetId": "str", + }, + }, + }, + "excludeFromLatest": bool, + "regionalReplicaCount": 0, + "storageAccountType": "str", + } + ], + }, + "provisioningState": "str", + "replicationStatus": { + "aggregatedState": "str", + "summary": [{"details": "str", "progress": 0, "region": "str", "state": "str"}], + }, + "safetyProfile": {"allowDeletionOfReplicatedLocations": bool}, + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "tags": {"str": "str"}, + "type": "str", + }, + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_gallery_application_versions_begin_update(self, resource_group): + response = await ( + await self.client.gallery_application_versions.begin_update( + resource_group_name=resource_group.name, + gallery_name="str", + gallery_application_name="str", + gallery_application_version_name="str", + properties={ + "id": "str", + "name": "str", + "properties": { + "publishingProfile": { + "source": {"mediaLink": "str", "defaultConfigurationLink": "str"}, + "advancedSettings": {"str": "str"}, + "customActions": [ + { + "name": "str", + "script": "str", + "description": "str", + "parameters": [ + { + "name": "str", + "defaultValue": "str", + "description": "str", + "required": bool, + "type": "str", + } + ], + } + ], + "enableHealthCheck": bool, + "endOfLifeDate": "2020-02-20 00:00:00", + "excludeFromLatest": bool, + "manageActions": {"install": "str", "remove": "str", "update": "str"}, + "publishedDate": "2020-02-20 00:00:00", + "replicaCount": 0, + "replicationMode": "str", + "settings": { + "configFileName": "str", + "packageFileName": "str", + "scriptBehaviorAfterReboot": "str", + }, + "storageAccountType": "str", + "targetExtendedLocations": [ + { + "encryption": { + "dataDiskImages": [{"lun": 0, "diskEncryptionSetId": "str"}], + "osDiskImage": { + "diskEncryptionSetId": "str", + "securityProfile": { + "confidentialVMEncryptionType": "str", + "secureVMDiskEncryptionSetId": "str", + }, + }, + }, + "extendedLocation": {"name": "str", "type": "str"}, + "extendedLocationReplicaCount": 0, + "name": "str", + "storageAccountType": "str", + } + ], + "targetRegions": [ + { + "name": "str", + "additionalReplicaSets": [{"regionalReplicaCount": 0, "storageAccountType": "str"}], + "encryption": { + "dataDiskImages": [{"lun": 0, "diskEncryptionSetId": "str"}], + "osDiskImage": { + "diskEncryptionSetId": "str", + "securityProfile": { + "confidentialVMEncryptionType": "str", + "secureVMDiskEncryptionSetId": "str", + }, + }, + }, + "excludeFromLatest": bool, + "regionalReplicaCount": 0, + "storageAccountType": "str", + } + ], + }, + "provisioningState": "str", + "replicationStatus": { + "aggregatedState": "str", + "summary": [{"details": "str", "progress": 0, "region": "str", "state": "str"}], + }, + "safetyProfile": {"allowDeletionOfReplicatedLocations": bool}, + }, + "tags": {"str": "str"}, + "type": "str", + }, + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_gallery_application_versions_begin_delete(self, resource_group): + response = await ( + await self.client.gallery_application_versions.begin_delete( + resource_group_name=resource_group.name, + gallery_name="str", + gallery_application_name="str", + gallery_application_version_name="str", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_gallery_application_versions_list_by_gallery_application(self, resource_group): + response = self.client.gallery_application_versions.list_by_gallery_application( + resource_group_name=resource_group.name, + gallery_name="str", + gallery_application_name="str", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_gallery_applications_operations.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_gallery_applications_operations.py similarity index 62% rename from sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_gallery_applications_operations.py rename to sdk/compute/azure-mgmt-compute/generated_tests/test_compute_gallery_applications_operations.py index c81326a741a3..c4c9c9a482b5 100644 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_gallery_applications_operations.py +++ b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_gallery_applications_operations.py @@ -2,11 +2,11 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.compute import ComputeManagementClient +from azure.mgmt.compute import ComputeClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy @@ -14,21 +14,9 @@ @pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestComputeManagementGalleryApplicationsOperations(AzureMgmtRecordedTestCase): +class TestComputeGalleryApplicationsOperations(AzureMgmtRecordedTestCase): def setup_method(self, method): - self.client = self.create_mgmt_client(ComputeManagementClient) - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_gallery_applications_list_by_gallery(self, resource_group): - response = self.client.gallery_applications.list_by_gallery( - resource_group_name=resource_group.name, - gallery_name="str", - api_version="2024-03-03", - ) - result = [r for r in response] - # please add some check logic here by yourself - # ... + self.client = self.create_mgmt_client(ComputeClient) @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy @@ -37,7 +25,6 @@ def test_gallery_applications_get(self, resource_group): resource_group_name=resource_group.name, gallery_name="str", gallery_application_name="str", - api_version="2024-03-03", ) # please add some check logic here by yourself @@ -50,32 +37,34 @@ def test_gallery_applications_begin_create_or_update(self, resource_group): resource_group_name=resource_group.name, gallery_name="str", gallery_application_name="str", - gallery_application={ + resource={ "location": "str", - "customActions": [ - { - "name": "str", - "script": "str", - "description": "str", - "parameters": [ - { - "name": "str", - "defaultValue": "str", - "description": "str", - "required": bool, - "type": "str", - } - ], - } - ], - "description": "str", - "endOfLifeDate": "2020-02-20 00:00:00", - "eula": "str", "id": "str", "name": "str", - "privacyStatementUri": "str", - "releaseNoteUri": "str", - "supportedOSType": "str", + "properties": { + "supportedOSType": "str", + "customActions": [ + { + "name": "str", + "script": "str", + "description": "str", + "parameters": [ + { + "name": "str", + "defaultValue": "str", + "description": "str", + "required": bool, + "type": "str", + } + ], + } + ], + "description": "str", + "endOfLifeDate": "2020-02-20 00:00:00", + "eula": "str", + "privacyStatementUri": "str", + "releaseNoteUri": "str", + }, "systemData": { "createdAt": "2020-02-20 00:00:00", "createdBy": "str", @@ -87,7 +76,6 @@ def test_gallery_applications_begin_create_or_update(self, resource_group): "tags": {"str": "str"}, "type": "str", }, - api_version="2024-03-03", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -100,35 +88,36 @@ def test_gallery_applications_begin_update(self, resource_group): resource_group_name=resource_group.name, gallery_name="str", gallery_application_name="str", - gallery_application={ - "customActions": [ - { - "name": "str", - "script": "str", - "description": "str", - "parameters": [ - { - "name": "str", - "defaultValue": "str", - "description": "str", - "required": bool, - "type": "str", - } - ], - } - ], - "description": "str", - "endOfLifeDate": "2020-02-20 00:00:00", - "eula": "str", + properties={ "id": "str", "name": "str", - "privacyStatementUri": "str", - "releaseNoteUri": "str", - "supportedOSType": "str", + "properties": { + "supportedOSType": "str", + "customActions": [ + { + "name": "str", + "script": "str", + "description": "str", + "parameters": [ + { + "name": "str", + "defaultValue": "str", + "description": "str", + "required": bool, + "type": "str", + } + ], + } + ], + "description": "str", + "endOfLifeDate": "2020-02-20 00:00:00", + "eula": "str", + "privacyStatementUri": "str", + "releaseNoteUri": "str", + }, "tags": {"str": "str"}, "type": "str", }, - api_version="2024-03-03", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -141,8 +130,18 @@ def test_gallery_applications_begin_delete(self, resource_group): resource_group_name=resource_group.name, gallery_name="str", gallery_application_name="str", - api_version="2024-03-03", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_gallery_applications_list_by_gallery(self, resource_group): + response = self.client.gallery_applications.list_by_gallery( + resource_group_name=resource_group.name, + gallery_name="str", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_gallery_applications_operations_async.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_gallery_applications_operations_async.py similarity index 61% rename from sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_gallery_applications_operations_async.py rename to sdk/compute/azure-mgmt-compute/generated_tests/test_compute_gallery_applications_operations_async.py index 59590bf54cac..5ee58a607f24 100644 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_gallery_applications_operations_async.py +++ b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_gallery_applications_operations_async.py @@ -2,11 +2,11 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.compute.aio import ComputeManagementClient +from azure.mgmt.compute.aio import ComputeClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer from devtools_testutils.aio import recorded_by_proxy_async @@ -15,21 +15,9 @@ @pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestComputeManagementGalleryApplicationsOperationsAsync(AzureMgmtRecordedTestCase): +class TestComputeGalleryApplicationsOperationsAsync(AzureMgmtRecordedTestCase): def setup_method(self, method): - self.client = self.create_mgmt_client(ComputeManagementClient, is_async=True) - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_gallery_applications_list_by_gallery(self, resource_group): - response = self.client.gallery_applications.list_by_gallery( - resource_group_name=resource_group.name, - gallery_name="str", - api_version="2024-03-03", - ) - result = [r async for r in response] - # please add some check logic here by yourself - # ... + self.client = self.create_mgmt_client(ComputeClient, is_async=True) @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async @@ -38,7 +26,6 @@ async def test_gallery_applications_get(self, resource_group): resource_group_name=resource_group.name, gallery_name="str", gallery_application_name="str", - api_version="2024-03-03", ) # please add some check logic here by yourself @@ -52,32 +39,34 @@ async def test_gallery_applications_begin_create_or_update(self, resource_group) resource_group_name=resource_group.name, gallery_name="str", gallery_application_name="str", - gallery_application={ + resource={ "location": "str", - "customActions": [ - { - "name": "str", - "script": "str", - "description": "str", - "parameters": [ - { - "name": "str", - "defaultValue": "str", - "description": "str", - "required": bool, - "type": "str", - } - ], - } - ], - "description": "str", - "endOfLifeDate": "2020-02-20 00:00:00", - "eula": "str", "id": "str", "name": "str", - "privacyStatementUri": "str", - "releaseNoteUri": "str", - "supportedOSType": "str", + "properties": { + "supportedOSType": "str", + "customActions": [ + { + "name": "str", + "script": "str", + "description": "str", + "parameters": [ + { + "name": "str", + "defaultValue": "str", + "description": "str", + "required": bool, + "type": "str", + } + ], + } + ], + "description": "str", + "endOfLifeDate": "2020-02-20 00:00:00", + "eula": "str", + "privacyStatementUri": "str", + "releaseNoteUri": "str", + }, "systemData": { "createdAt": "2020-02-20 00:00:00", "createdBy": "str", @@ -89,7 +78,6 @@ async def test_gallery_applications_begin_create_or_update(self, resource_group) "tags": {"str": "str"}, "type": "str", }, - api_version="2024-03-03", ) ).result() # call '.result()' to poll until service return final result @@ -104,35 +92,36 @@ async def test_gallery_applications_begin_update(self, resource_group): resource_group_name=resource_group.name, gallery_name="str", gallery_application_name="str", - gallery_application={ - "customActions": [ - { - "name": "str", - "script": "str", - "description": "str", - "parameters": [ - { - "name": "str", - "defaultValue": "str", - "description": "str", - "required": bool, - "type": "str", - } - ], - } - ], - "description": "str", - "endOfLifeDate": "2020-02-20 00:00:00", - "eula": "str", + properties={ "id": "str", "name": "str", - "privacyStatementUri": "str", - "releaseNoteUri": "str", - "supportedOSType": "str", + "properties": { + "supportedOSType": "str", + "customActions": [ + { + "name": "str", + "script": "str", + "description": "str", + "parameters": [ + { + "name": "str", + "defaultValue": "str", + "description": "str", + "required": bool, + "type": "str", + } + ], + } + ], + "description": "str", + "endOfLifeDate": "2020-02-20 00:00:00", + "eula": "str", + "privacyStatementUri": "str", + "releaseNoteUri": "str", + }, "tags": {"str": "str"}, "type": "str", }, - api_version="2024-03-03", ) ).result() # call '.result()' to poll until service return final result @@ -147,9 +136,19 @@ async def test_gallery_applications_begin_delete(self, resource_group): resource_group_name=resource_group.name, gallery_name="str", gallery_application_name="str", - api_version="2024-03-03", ) ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_gallery_applications_list_by_gallery(self, resource_group): + response = self.client.gallery_applications.list_by_gallery( + resource_group_name=resource_group.name, + gallery_name="str", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_gallery_image_versions_operations_async.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_gallery_image_versions_operations.py similarity index 80% rename from sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_gallery_image_versions_operations_async.py rename to sdk/compute/azure-mgmt-compute/generated_tests/test_compute_gallery_image_versions_operations.py index b9b26b64d3c4..b326a465f5ab 100644 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_gallery_image_versions_operations_async.py +++ b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_gallery_image_versions_operations.py @@ -2,63 +2,64 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.compute.aio import ComputeManagementClient +from azure.mgmt.compute import ComputeClient -from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer -from devtools_testutils.aio import recorded_by_proxy_async +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy AZURE_LOCATION = "eastus" @pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestComputeManagementGalleryImageVersionsOperationsAsync(AzureMgmtRecordedTestCase): +class TestComputeGalleryImageVersionsOperations(AzureMgmtRecordedTestCase): def setup_method(self, method): - self.client = self.create_mgmt_client(ComputeManagementClient, is_async=True) + self.client = self.create_mgmt_client(ComputeClient) @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_gallery_image_versions_list_by_gallery_image(self, resource_group): - response = self.client.gallery_image_versions.list_by_gallery_image( + @recorded_by_proxy + def test_gallery_image_versions_get(self, resource_group): + response = self.client.gallery_image_versions.get( resource_group_name=resource_group.name, gallery_name="str", gallery_image_name="str", - api_version="2024-03-03", + gallery_image_version_name="str", ) - result = [r async for r in response] + # please add some check logic here by yourself # ... @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_gallery_image_versions_get(self, resource_group): - response = await self.client.gallery_image_versions.get( + @recorded_by_proxy + def test_gallery_image_versions_begin_create_or_update(self, resource_group): + response = self.client.gallery_image_versions.begin_create_or_update( resource_group_name=resource_group.name, gallery_name="str", gallery_image_name="str", gallery_image_version_name="str", - api_version="2024-03-03", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_gallery_image_versions_begin_create_or_update(self, resource_group): - response = await ( - await self.client.gallery_image_versions.begin_create_or_update( - resource_group_name=resource_group.name, - gallery_name="str", - gallery_image_name="str", - gallery_image_version_name="str", - gallery_image_version={ - "location": "str", - "id": "str", - "name": "str", + resource={ + "location": "str", + "id": "str", + "name": "str", + "properties": { + "storageProfile": { + "dataDiskImages": [ + { + "lun": 0, + "hostCaching": "str", + "sizeInGB": 0, + "source": {"id": "str", "storageAccountId": "str", "uri": "str"}, + } + ], + "osDiskImage": { + "hostCaching": "str", + "sizeInGB": 0, + "source": {"id": "str", "storageAccountId": "str", "uri": "str"}, + }, + "source": {"communityGalleryImageId": "str", "id": "str", "virtualMachineId": "str"}, + }, "provisioningState": "str", "publishingProfile": { "endOfLifeDate": "2020-02-20 00:00:00", @@ -127,6 +128,42 @@ async def test_gallery_image_versions_begin_create_or_update(self, resource_grou "signatureTemplateNames": ["str"], } }, + "validationsProfile": { + "executedValidations": [ + {"executionTime": "2020-02-20 00:00:00", "status": "str", "type": "str", "version": "str"} + ], + "platformAttributes": [{"name": "str", "value": "str"}], + "validationEtag": "str", + }, + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "tags": {"str": "str"}, + "type": "str", + }, + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_gallery_image_versions_begin_update(self, resource_group): + response = self.client.gallery_image_versions.begin_update( + resource_group_name=resource_group.name, + gallery_name="str", + gallery_image_name="str", + gallery_image_version_name="str", + properties={ + "id": "str", + "name": "str", + "properties": { "storageProfile": { "dataDiskImages": [ { @@ -143,43 +180,6 @@ async def test_gallery_image_versions_begin_create_or_update(self, resource_grou }, "source": {"communityGalleryImageId": "str", "id": "str", "virtualMachineId": "str"}, }, - "systemData": { - "createdAt": "2020-02-20 00:00:00", - "createdBy": "str", - "createdByType": "str", - "lastModifiedAt": "2020-02-20 00:00:00", - "lastModifiedBy": "str", - "lastModifiedByType": "str", - }, - "tags": {"str": "str"}, - "type": "str", - "validationsProfile": { - "executedValidations": [ - {"executionTime": "2020-02-20 00:00:00", "status": "str", "type": "str", "version": "str"} - ], - "platformAttributes": [{"name": "str", "value": "str"}], - "validationEtag": "str", - }, - }, - api_version="2024-03-03", - ) - ).result() # call '.result()' to poll until service return final result - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_gallery_image_versions_begin_update(self, resource_group): - response = await ( - await self.client.gallery_image_versions.begin_update( - resource_group_name=resource_group.name, - gallery_name="str", - gallery_image_name="str", - gallery_image_version_name="str", - gallery_image_version={ - "id": "str", - "name": "str", "provisioningState": "str", "publishingProfile": { "endOfLifeDate": "2020-02-20 00:00:00", @@ -248,24 +248,6 @@ async def test_gallery_image_versions_begin_update(self, resource_group): "signatureTemplateNames": ["str"], } }, - "storageProfile": { - "dataDiskImages": [ - { - "lun": 0, - "hostCaching": "str", - "sizeInGB": 0, - "source": {"id": "str", "storageAccountId": "str", "uri": "str"}, - } - ], - "osDiskImage": { - "hostCaching": "str", - "sizeInGB": 0, - "source": {"id": "str", "storageAccountId": "str", "uri": "str"}, - }, - "source": {"communityGalleryImageId": "str", "id": "str", "virtualMachineId": "str"}, - }, - "tags": {"str": "str"}, - "type": "str", "validationsProfile": { "executedValidations": [ {"executionTime": "2020-02-20 00:00:00", "status": "str", "type": "str", "version": "str"} @@ -274,25 +256,35 @@ async def test_gallery_image_versions_begin_update(self, resource_group): "validationEtag": "str", }, }, - api_version="2024-03-03", - ) + "tags": {"str": "str"}, + "type": "str", + }, ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself # ... @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_gallery_image_versions_begin_delete(self, resource_group): - response = await ( - await self.client.gallery_image_versions.begin_delete( - resource_group_name=resource_group.name, - gallery_name="str", - gallery_image_name="str", - gallery_image_version_name="str", - api_version="2024-03-03", - ) + @recorded_by_proxy + def test_gallery_image_versions_begin_delete(self, resource_group): + response = self.client.gallery_image_versions.begin_delete( + resource_group_name=resource_group.name, + gallery_name="str", + gallery_image_name="str", + gallery_image_version_name="str", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_gallery_image_versions_list_by_gallery_image(self, resource_group): + response = self.client.gallery_image_versions.list_by_gallery_image( + resource_group_name=resource_group.name, + gallery_name="str", + gallery_image_name="str", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_gallery_image_versions_operations_async.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_gallery_image_versions_operations_async.py new file mode 100644 index 000000000000..4cbbee94d79a --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_gallery_image_versions_operations_async.py @@ -0,0 +1,307 @@ +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.compute.aio import ComputeClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestComputeGalleryImageVersionsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ComputeClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_gallery_image_versions_get(self, resource_group): + response = await self.client.gallery_image_versions.get( + resource_group_name=resource_group.name, + gallery_name="str", + gallery_image_name="str", + gallery_image_version_name="str", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_gallery_image_versions_begin_create_or_update(self, resource_group): + response = await ( + await self.client.gallery_image_versions.begin_create_or_update( + resource_group_name=resource_group.name, + gallery_name="str", + gallery_image_name="str", + gallery_image_version_name="str", + resource={ + "location": "str", + "id": "str", + "name": "str", + "properties": { + "storageProfile": { + "dataDiskImages": [ + { + "lun": 0, + "hostCaching": "str", + "sizeInGB": 0, + "source": {"id": "str", "storageAccountId": "str", "uri": "str"}, + } + ], + "osDiskImage": { + "hostCaching": "str", + "sizeInGB": 0, + "source": {"id": "str", "storageAccountId": "str", "uri": "str"}, + }, + "source": {"communityGalleryImageId": "str", "id": "str", "virtualMachineId": "str"}, + }, + "provisioningState": "str", + "publishingProfile": { + "endOfLifeDate": "2020-02-20 00:00:00", + "excludeFromLatest": bool, + "publishedDate": "2020-02-20 00:00:00", + "replicaCount": 0, + "replicationMode": "str", + "storageAccountType": "str", + "targetExtendedLocations": [ + { + "encryption": { + "dataDiskImages": [{"lun": 0, "diskEncryptionSetId": "str"}], + "osDiskImage": { + "diskEncryptionSetId": "str", + "securityProfile": { + "confidentialVMEncryptionType": "str", + "secureVMDiskEncryptionSetId": "str", + }, + }, + }, + "extendedLocation": {"name": "str", "type": "str"}, + "extendedLocationReplicaCount": 0, + "name": "str", + "storageAccountType": "str", + } + ], + "targetRegions": [ + { + "name": "str", + "additionalReplicaSets": [{"regionalReplicaCount": 0, "storageAccountType": "str"}], + "encryption": { + "dataDiskImages": [{"lun": 0, "diskEncryptionSetId": "str"}], + "osDiskImage": { + "diskEncryptionSetId": "str", + "securityProfile": { + "confidentialVMEncryptionType": "str", + "secureVMDiskEncryptionSetId": "str", + }, + }, + }, + "excludeFromLatest": bool, + "regionalReplicaCount": 0, + "storageAccountType": "str", + } + ], + }, + "replicationStatus": { + "aggregatedState": "str", + "summary": [{"details": "str", "progress": 0, "region": "str", "state": "str"}], + }, + "restore": bool, + "safetyProfile": { + "allowDeletionOfReplicatedLocations": bool, + "blockDeletionBeforeEndOfLife": bool, + "policyViolations": [{"category": "str", "details": "str"}], + "reportedForPolicyViolation": bool, + }, + "securityProfile": { + "uefiSettings": { + "additionalSignatures": { + "db": [{"type": "str", "value": ["str"]}], + "dbx": [{"type": "str", "value": ["str"]}], + "kek": [{"type": "str", "value": ["str"]}], + "pk": {"type": "str", "value": ["str"]}, + }, + "signatureTemplateNames": ["str"], + } + }, + "validationsProfile": { + "executedValidations": [ + { + "executionTime": "2020-02-20 00:00:00", + "status": "str", + "type": "str", + "version": "str", + } + ], + "platformAttributes": [{"name": "str", "value": "str"}], + "validationEtag": "str", + }, + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "tags": {"str": "str"}, + "type": "str", + }, + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_gallery_image_versions_begin_update(self, resource_group): + response = await ( + await self.client.gallery_image_versions.begin_update( + resource_group_name=resource_group.name, + gallery_name="str", + gallery_image_name="str", + gallery_image_version_name="str", + properties={ + "id": "str", + "name": "str", + "properties": { + "storageProfile": { + "dataDiskImages": [ + { + "lun": 0, + "hostCaching": "str", + "sizeInGB": 0, + "source": {"id": "str", "storageAccountId": "str", "uri": "str"}, + } + ], + "osDiskImage": { + "hostCaching": "str", + "sizeInGB": 0, + "source": {"id": "str", "storageAccountId": "str", "uri": "str"}, + }, + "source": {"communityGalleryImageId": "str", "id": "str", "virtualMachineId": "str"}, + }, + "provisioningState": "str", + "publishingProfile": { + "endOfLifeDate": "2020-02-20 00:00:00", + "excludeFromLatest": bool, + "publishedDate": "2020-02-20 00:00:00", + "replicaCount": 0, + "replicationMode": "str", + "storageAccountType": "str", + "targetExtendedLocations": [ + { + "encryption": { + "dataDiskImages": [{"lun": 0, "diskEncryptionSetId": "str"}], + "osDiskImage": { + "diskEncryptionSetId": "str", + "securityProfile": { + "confidentialVMEncryptionType": "str", + "secureVMDiskEncryptionSetId": "str", + }, + }, + }, + "extendedLocation": {"name": "str", "type": "str"}, + "extendedLocationReplicaCount": 0, + "name": "str", + "storageAccountType": "str", + } + ], + "targetRegions": [ + { + "name": "str", + "additionalReplicaSets": [{"regionalReplicaCount": 0, "storageAccountType": "str"}], + "encryption": { + "dataDiskImages": [{"lun": 0, "diskEncryptionSetId": "str"}], + "osDiskImage": { + "diskEncryptionSetId": "str", + "securityProfile": { + "confidentialVMEncryptionType": "str", + "secureVMDiskEncryptionSetId": "str", + }, + }, + }, + "excludeFromLatest": bool, + "regionalReplicaCount": 0, + "storageAccountType": "str", + } + ], + }, + "replicationStatus": { + "aggregatedState": "str", + "summary": [{"details": "str", "progress": 0, "region": "str", "state": "str"}], + }, + "restore": bool, + "safetyProfile": { + "allowDeletionOfReplicatedLocations": bool, + "blockDeletionBeforeEndOfLife": bool, + "policyViolations": [{"category": "str", "details": "str"}], + "reportedForPolicyViolation": bool, + }, + "securityProfile": { + "uefiSettings": { + "additionalSignatures": { + "db": [{"type": "str", "value": ["str"]}], + "dbx": [{"type": "str", "value": ["str"]}], + "kek": [{"type": "str", "value": ["str"]}], + "pk": {"type": "str", "value": ["str"]}, + }, + "signatureTemplateNames": ["str"], + } + }, + "validationsProfile": { + "executedValidations": [ + { + "executionTime": "2020-02-20 00:00:00", + "status": "str", + "type": "str", + "version": "str", + } + ], + "platformAttributes": [{"name": "str", "value": "str"}], + "validationEtag": "str", + }, + }, + "tags": {"str": "str"}, + "type": "str", + }, + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_gallery_image_versions_begin_delete(self, resource_group): + response = await ( + await self.client.gallery_image_versions.begin_delete( + resource_group_name=resource_group.name, + gallery_name="str", + gallery_image_name="str", + gallery_image_version_name="str", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_gallery_image_versions_list_by_gallery_image(self, resource_group): + response = self.client.gallery_image_versions.list_by_gallery_image( + resource_group_name=resource_group.name, + gallery_name="str", + gallery_image_name="str", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_gallery_images_operations.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_gallery_images_operations.py similarity index 62% rename from sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_gallery_images_operations.py rename to sdk/compute/azure-mgmt-compute/generated_tests/test_compute_gallery_images_operations.py index cd6acdce2e5f..75015b05988a 100644 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_gallery_images_operations.py +++ b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_gallery_images_operations.py @@ -2,11 +2,11 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.compute import ComputeManagementClient +from azure.mgmt.compute import ComputeClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy @@ -14,21 +14,9 @@ @pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestComputeManagementGalleryImagesOperations(AzureMgmtRecordedTestCase): +class TestComputeGalleryImagesOperations(AzureMgmtRecordedTestCase): def setup_method(self, method): - self.client = self.create_mgmt_client(ComputeManagementClient) - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_gallery_images_list_by_gallery(self, resource_group): - response = self.client.gallery_images.list_by_gallery( - resource_group_name=resource_group.name, - gallery_name="str", - api_version="2024-03-03", - ) - result = [r for r in response] - # please add some check logic here by yourself - # ... + self.client = self.create_mgmt_client(ComputeClient) @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy @@ -37,7 +25,6 @@ def test_gallery_images_get(self, resource_group): resource_group_name=resource_group.name, gallery_name="str", gallery_image_name="str", - api_version="2024-03-03", ) # please add some check logic here by yourself @@ -50,26 +37,28 @@ def test_gallery_images_begin_create_or_update(self, resource_group): resource_group_name=resource_group.name, gallery_name="str", gallery_image_name="str", - gallery_image={ + resource={ "location": "str", - "allowUpdateImage": bool, - "architecture": "str", - "description": "str", - "disallowed": {"diskTypes": ["str"]}, - "endOfLifeDate": "2020-02-20 00:00:00", - "eula": "str", - "features": [{"name": "str", "startsAtVersion": "str", "value": "str"}], - "hyperVGeneration": "str", "id": "str", - "identifier": {"offer": "str", "publisher": "str", "sku": "str"}, "name": "str", - "osState": "str", - "osType": "str", - "privacyStatementUri": "str", - "provisioningState": "str", - "purchasePlan": {"name": "str", "product": "str", "publisher": "str"}, - "recommended": {"memory": {"max": 0, "min": 0}, "vCPUs": {"max": 0, "min": 0}}, - "releaseNoteUri": "str", + "properties": { + "identifier": {"offer": "str", "publisher": "str", "sku": "str"}, + "osState": "str", + "osType": "str", + "allowUpdateImage": bool, + "architecture": "str", + "description": "str", + "disallowed": {"diskTypes": ["str"]}, + "endOfLifeDate": "2020-02-20 00:00:00", + "eula": "str", + "features": [{"name": "str", "startsAtVersion": "str", "value": "str"}], + "hyperVGeneration": "str", + "privacyStatementUri": "str", + "provisioningState": "str", + "purchasePlan": {"name": "str", "product": "str", "publisher": "str"}, + "recommended": {"memory": {"max": 0, "min": 0}, "vCPUs": {"max": 0, "min": 0}}, + "releaseNoteUri": "str", + }, "systemData": { "createdAt": "2020-02-20 00:00:00", "createdBy": "str", @@ -81,7 +70,6 @@ def test_gallery_images_begin_create_or_update(self, resource_group): "tags": {"str": "str"}, "type": "str", }, - api_version="2024-03-03", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -94,29 +82,30 @@ def test_gallery_images_begin_update(self, resource_group): resource_group_name=resource_group.name, gallery_name="str", gallery_image_name="str", - gallery_image={ - "allowUpdateImage": bool, - "architecture": "str", - "description": "str", - "disallowed": {"diskTypes": ["str"]}, - "endOfLifeDate": "2020-02-20 00:00:00", - "eula": "str", - "features": [{"name": "str", "startsAtVersion": "str", "value": "str"}], - "hyperVGeneration": "str", + properties={ "id": "str", - "identifier": {"offer": "str", "publisher": "str", "sku": "str"}, "name": "str", - "osState": "str", - "osType": "str", - "privacyStatementUri": "str", - "provisioningState": "str", - "purchasePlan": {"name": "str", "product": "str", "publisher": "str"}, - "recommended": {"memory": {"max": 0, "min": 0}, "vCPUs": {"max": 0, "min": 0}}, - "releaseNoteUri": "str", + "properties": { + "identifier": {"offer": "str", "publisher": "str", "sku": "str"}, + "osState": "str", + "osType": "str", + "allowUpdateImage": bool, + "architecture": "str", + "description": "str", + "disallowed": {"diskTypes": ["str"]}, + "endOfLifeDate": "2020-02-20 00:00:00", + "eula": "str", + "features": [{"name": "str", "startsAtVersion": "str", "value": "str"}], + "hyperVGeneration": "str", + "privacyStatementUri": "str", + "provisioningState": "str", + "purchasePlan": {"name": "str", "product": "str", "publisher": "str"}, + "recommended": {"memory": {"max": 0, "min": 0}, "vCPUs": {"max": 0, "min": 0}}, + "releaseNoteUri": "str", + }, "tags": {"str": "str"}, "type": "str", }, - api_version="2024-03-03", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -129,8 +118,18 @@ def test_gallery_images_begin_delete(self, resource_group): resource_group_name=resource_group.name, gallery_name="str", gallery_image_name="str", - api_version="2024-03-03", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_gallery_images_list_by_gallery(self, resource_group): + response = self.client.gallery_images.list_by_gallery( + resource_group_name=resource_group.name, + gallery_name="str", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_gallery_images_operations_async.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_gallery_images_operations_async.py similarity index 62% rename from sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_gallery_images_operations_async.py rename to sdk/compute/azure-mgmt-compute/generated_tests/test_compute_gallery_images_operations_async.py index 5b3e35899cc5..90919ae7e3e4 100644 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_gallery_images_operations_async.py +++ b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_gallery_images_operations_async.py @@ -2,11 +2,11 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.compute.aio import ComputeManagementClient +from azure.mgmt.compute.aio import ComputeClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer from devtools_testutils.aio import recorded_by_proxy_async @@ -15,21 +15,9 @@ @pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestComputeManagementGalleryImagesOperationsAsync(AzureMgmtRecordedTestCase): +class TestComputeGalleryImagesOperationsAsync(AzureMgmtRecordedTestCase): def setup_method(self, method): - self.client = self.create_mgmt_client(ComputeManagementClient, is_async=True) - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_gallery_images_list_by_gallery(self, resource_group): - response = self.client.gallery_images.list_by_gallery( - resource_group_name=resource_group.name, - gallery_name="str", - api_version="2024-03-03", - ) - result = [r async for r in response] - # please add some check logic here by yourself - # ... + self.client = self.create_mgmt_client(ComputeClient, is_async=True) @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async @@ -38,7 +26,6 @@ async def test_gallery_images_get(self, resource_group): resource_group_name=resource_group.name, gallery_name="str", gallery_image_name="str", - api_version="2024-03-03", ) # please add some check logic here by yourself @@ -52,26 +39,28 @@ async def test_gallery_images_begin_create_or_update(self, resource_group): resource_group_name=resource_group.name, gallery_name="str", gallery_image_name="str", - gallery_image={ + resource={ "location": "str", - "allowUpdateImage": bool, - "architecture": "str", - "description": "str", - "disallowed": {"diskTypes": ["str"]}, - "endOfLifeDate": "2020-02-20 00:00:00", - "eula": "str", - "features": [{"name": "str", "startsAtVersion": "str", "value": "str"}], - "hyperVGeneration": "str", "id": "str", - "identifier": {"offer": "str", "publisher": "str", "sku": "str"}, "name": "str", - "osState": "str", - "osType": "str", - "privacyStatementUri": "str", - "provisioningState": "str", - "purchasePlan": {"name": "str", "product": "str", "publisher": "str"}, - "recommended": {"memory": {"max": 0, "min": 0}, "vCPUs": {"max": 0, "min": 0}}, - "releaseNoteUri": "str", + "properties": { + "identifier": {"offer": "str", "publisher": "str", "sku": "str"}, + "osState": "str", + "osType": "str", + "allowUpdateImage": bool, + "architecture": "str", + "description": "str", + "disallowed": {"diskTypes": ["str"]}, + "endOfLifeDate": "2020-02-20 00:00:00", + "eula": "str", + "features": [{"name": "str", "startsAtVersion": "str", "value": "str"}], + "hyperVGeneration": "str", + "privacyStatementUri": "str", + "provisioningState": "str", + "purchasePlan": {"name": "str", "product": "str", "publisher": "str"}, + "recommended": {"memory": {"max": 0, "min": 0}, "vCPUs": {"max": 0, "min": 0}}, + "releaseNoteUri": "str", + }, "systemData": { "createdAt": "2020-02-20 00:00:00", "createdBy": "str", @@ -83,7 +72,6 @@ async def test_gallery_images_begin_create_or_update(self, resource_group): "tags": {"str": "str"}, "type": "str", }, - api_version="2024-03-03", ) ).result() # call '.result()' to poll until service return final result @@ -98,29 +86,30 @@ async def test_gallery_images_begin_update(self, resource_group): resource_group_name=resource_group.name, gallery_name="str", gallery_image_name="str", - gallery_image={ - "allowUpdateImage": bool, - "architecture": "str", - "description": "str", - "disallowed": {"diskTypes": ["str"]}, - "endOfLifeDate": "2020-02-20 00:00:00", - "eula": "str", - "features": [{"name": "str", "startsAtVersion": "str", "value": "str"}], - "hyperVGeneration": "str", + properties={ "id": "str", - "identifier": {"offer": "str", "publisher": "str", "sku": "str"}, "name": "str", - "osState": "str", - "osType": "str", - "privacyStatementUri": "str", - "provisioningState": "str", - "purchasePlan": {"name": "str", "product": "str", "publisher": "str"}, - "recommended": {"memory": {"max": 0, "min": 0}, "vCPUs": {"max": 0, "min": 0}}, - "releaseNoteUri": "str", + "properties": { + "identifier": {"offer": "str", "publisher": "str", "sku": "str"}, + "osState": "str", + "osType": "str", + "allowUpdateImage": bool, + "architecture": "str", + "description": "str", + "disallowed": {"diskTypes": ["str"]}, + "endOfLifeDate": "2020-02-20 00:00:00", + "eula": "str", + "features": [{"name": "str", "startsAtVersion": "str", "value": "str"}], + "hyperVGeneration": "str", + "privacyStatementUri": "str", + "provisioningState": "str", + "purchasePlan": {"name": "str", "product": "str", "publisher": "str"}, + "recommended": {"memory": {"max": 0, "min": 0}, "vCPUs": {"max": 0, "min": 0}}, + "releaseNoteUri": "str", + }, "tags": {"str": "str"}, "type": "str", }, - api_version="2024-03-03", ) ).result() # call '.result()' to poll until service return final result @@ -135,9 +124,19 @@ async def test_gallery_images_begin_delete(self, resource_group): resource_group_name=resource_group.name, gallery_name="str", gallery_image_name="str", - api_version="2024-03-03", ) ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_gallery_images_list_by_gallery(self, resource_group): + response = self.client.gallery_images.list_by_gallery( + resource_group_name=resource_group.name, + gallery_name="str", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_gallery_in_vm_access_control_profile_versions_operations_async.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_gallery_in_vm_access_control_profile_versions_operations.py similarity index 66% rename from sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_gallery_in_vm_access_control_profile_versions_operations_async.py rename to sdk/compute/azure-mgmt-compute/generated_tests/test_compute_gallery_in_vm_access_control_profile_versions_operations.py index b09e8cfc2f9d..dc34a185dfb6 100644 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_gallery_in_vm_access_control_profile_versions_operations_async.py +++ b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_gallery_in_vm_access_control_profile_versions_operations.py @@ -2,70 +2,51 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.compute.aio import ComputeManagementClient +from azure.mgmt.compute import ComputeClient -from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer -from devtools_testutils.aio import recorded_by_proxy_async +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy AZURE_LOCATION = "eastus" @pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestComputeManagementGalleryInVMAccessControlProfileVersionsOperationsAsync(AzureMgmtRecordedTestCase): +class TestComputeGalleryInVMAccessControlProfileVersionsOperations(AzureMgmtRecordedTestCase): def setup_method(self, method): - self.client = self.create_mgmt_client(ComputeManagementClient, is_async=True) + self.client = self.create_mgmt_client(ComputeClient) @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_gallery_in_vm_access_control_profile_versions_list_by_gallery_in_vm_access_control_profile( - self, resource_group - ): - response = ( - self.client.gallery_in_vm_access_control_profile_versions.list_by_gallery_in_vm_access_control_profile( - resource_group_name=resource_group.name, - gallery_name="str", - in_vm_access_control_profile_name="str", - api_version="2024-03-03", - ) - ) - result = [r async for r in response] - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_gallery_in_vm_access_control_profile_versions_get(self, resource_group): - response = await self.client.gallery_in_vm_access_control_profile_versions.get( + @recorded_by_proxy + def test_gallery_in_vm_access_control_profile_versions_get(self, resource_group): + response = self.client.gallery_in_vm_access_control_profile_versions.get( resource_group_name=resource_group.name, gallery_name="str", in_vm_access_control_profile_name="str", in_vm_access_control_profile_version_name="str", - api_version="2024-03-03", ) # please add some check logic here by yourself # ... @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_gallery_in_vm_access_control_profile_versions_begin_create_or_update(self, resource_group): - response = await ( - await self.client.gallery_in_vm_access_control_profile_versions.begin_create_or_update( - resource_group_name=resource_group.name, - gallery_name="str", - in_vm_access_control_profile_name="str", - in_vm_access_control_profile_version_name="str", - gallery_in_vm_access_control_profile_version={ - "location": "str", + @recorded_by_proxy + def test_gallery_in_vm_access_control_profile_versions_begin_create_or_update(self, resource_group): + response = self.client.gallery_in_vm_access_control_profile_versions.begin_create_or_update( + resource_group_name=resource_group.name, + gallery_name="str", + in_vm_access_control_profile_name="str", + in_vm_access_control_profile_version_name="str", + resource={ + "location": "str", + "id": "str", + "name": "str", + "properties": { "defaultAccess": "str", - "excludeFromLatest": bool, - "id": "str", "mode": "str", - "name": "str", + "excludeFromLatest": bool, "provisioningState": "str", "publishedDate": "2020-02-20 00:00:00", "replicationStatus": { @@ -86,15 +67,6 @@ async def test_gallery_in_vm_access_control_profile_versions_begin_create_or_upd "roleAssignments": [{"identities": ["str"], "role": "str"}], "roles": [{"name": "str", "privileges": ["str"]}], }, - "systemData": { - "createdAt": "2020-02-20 00:00:00", - "createdBy": "str", - "createdByType": "str", - "lastModifiedAt": "2020-02-20 00:00:00", - "lastModifiedBy": "str", - "lastModifiedByType": "str", - }, - "tags": {"str": "str"}, "targetLocations": [ { "name": "str", @@ -114,30 +86,38 @@ async def test_gallery_in_vm_access_control_profile_versions_begin_create_or_upd "storageAccountType": "str", } ], - "type": "str", }, - api_version="2024-03-03", - ) + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "tags": {"str": "str"}, + "type": "str", + }, ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself # ... @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_gallery_in_vm_access_control_profile_versions_begin_update(self, resource_group): - response = await ( - await self.client.gallery_in_vm_access_control_profile_versions.begin_update( - resource_group_name=resource_group.name, - gallery_name="str", - in_vm_access_control_profile_name="str", - in_vm_access_control_profile_version_name="str", - gallery_in_vm_access_control_profile_version={ + @recorded_by_proxy + def test_gallery_in_vm_access_control_profile_versions_begin_update(self, resource_group): + response = self.client.gallery_in_vm_access_control_profile_versions.begin_update( + resource_group_name=resource_group.name, + gallery_name="str", + in_vm_access_control_profile_name="str", + in_vm_access_control_profile_version_name="str", + properties={ + "id": "str", + "name": "str", + "properties": { "defaultAccess": "str", - "excludeFromLatest": bool, - "id": "str", "mode": "str", - "name": "str", + "excludeFromLatest": bool, "provisioningState": "str", "publishedDate": "2020-02-20 00:00:00", "replicationStatus": { @@ -158,7 +138,6 @@ async def test_gallery_in_vm_access_control_profile_versions_begin_update(self, "roleAssignments": [{"identities": ["str"], "role": "str"}], "roles": [{"name": "str", "privileges": ["str"]}], }, - "tags": {"str": "str"}, "targetLocations": [ { "name": "str", @@ -178,27 +157,40 @@ async def test_gallery_in_vm_access_control_profile_versions_begin_update(self, "storageAccountType": "str", } ], - "type": "str", }, - api_version="2024-03-03", - ) + "tags": {"str": "str"}, + "type": "str", + }, + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_gallery_in_vm_access_control_profile_versions_begin_delete(self, resource_group): + response = self.client.gallery_in_vm_access_control_profile_versions.begin_delete( + resource_group_name=resource_group.name, + gallery_name="str", + in_vm_access_control_profile_name="str", + in_vm_access_control_profile_version_name="str", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself # ... @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_gallery_in_vm_access_control_profile_versions_begin_delete(self, resource_group): - response = await ( - await self.client.gallery_in_vm_access_control_profile_versions.begin_delete( + @recorded_by_proxy + def test_gallery_in_vm_access_control_profile_versions_list_by_gallery_in_vm_access_control_profile( + self, resource_group + ): + response = ( + self.client.gallery_in_vm_access_control_profile_versions.list_by_gallery_in_vm_access_control_profile( resource_group_name=resource_group.name, gallery_name="str", in_vm_access_control_profile_name="str", - in_vm_access_control_profile_version_name="str", - api_version="2024-03-03", ) - ).result() # call '.result()' to poll until service return final result - + ) + result = [r for r in response] # please add some check logic here by yourself # ... diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_gallery_in_vm_access_control_profile_versions_operations_async.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_gallery_in_vm_access_control_profile_versions_operations_async.py new file mode 100644 index 000000000000..d262c41a37ea --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_gallery_in_vm_access_control_profile_versions_operations_async.py @@ -0,0 +1,203 @@ +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.compute.aio import ComputeClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestComputeGalleryInVMAccessControlProfileVersionsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ComputeClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_gallery_in_vm_access_control_profile_versions_get(self, resource_group): + response = await self.client.gallery_in_vm_access_control_profile_versions.get( + resource_group_name=resource_group.name, + gallery_name="str", + in_vm_access_control_profile_name="str", + in_vm_access_control_profile_version_name="str", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_gallery_in_vm_access_control_profile_versions_begin_create_or_update(self, resource_group): + response = await ( + await self.client.gallery_in_vm_access_control_profile_versions.begin_create_or_update( + resource_group_name=resource_group.name, + gallery_name="str", + in_vm_access_control_profile_name="str", + in_vm_access_control_profile_version_name="str", + resource={ + "location": "str", + "id": "str", + "name": "str", + "properties": { + "defaultAccess": "str", + "mode": "str", + "excludeFromLatest": bool, + "provisioningState": "str", + "publishedDate": "2020-02-20 00:00:00", + "replicationStatus": { + "aggregatedState": "str", + "summary": [{"details": "str", "progress": 0, "region": "str", "state": "str"}], + }, + "rules": { + "identities": [ + { + "name": "str", + "exePath": "str", + "groupName": "str", + "processName": "str", + "userName": "str", + } + ], + "privileges": [{"name": "str", "path": "str", "queryParameters": {"str": "str"}}], + "roleAssignments": [{"identities": ["str"], "role": "str"}], + "roles": [{"name": "str", "privileges": ["str"]}], + }, + "targetLocations": [ + { + "name": "str", + "additionalReplicaSets": [{"regionalReplicaCount": 0, "storageAccountType": "str"}], + "encryption": { + "dataDiskImages": [{"lun": 0, "diskEncryptionSetId": "str"}], + "osDiskImage": { + "diskEncryptionSetId": "str", + "securityProfile": { + "confidentialVMEncryptionType": "str", + "secureVMDiskEncryptionSetId": "str", + }, + }, + }, + "excludeFromLatest": bool, + "regionalReplicaCount": 0, + "storageAccountType": "str", + } + ], + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "tags": {"str": "str"}, + "type": "str", + }, + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_gallery_in_vm_access_control_profile_versions_begin_update(self, resource_group): + response = await ( + await self.client.gallery_in_vm_access_control_profile_versions.begin_update( + resource_group_name=resource_group.name, + gallery_name="str", + in_vm_access_control_profile_name="str", + in_vm_access_control_profile_version_name="str", + properties={ + "id": "str", + "name": "str", + "properties": { + "defaultAccess": "str", + "mode": "str", + "excludeFromLatest": bool, + "provisioningState": "str", + "publishedDate": "2020-02-20 00:00:00", + "replicationStatus": { + "aggregatedState": "str", + "summary": [{"details": "str", "progress": 0, "region": "str", "state": "str"}], + }, + "rules": { + "identities": [ + { + "name": "str", + "exePath": "str", + "groupName": "str", + "processName": "str", + "userName": "str", + } + ], + "privileges": [{"name": "str", "path": "str", "queryParameters": {"str": "str"}}], + "roleAssignments": [{"identities": ["str"], "role": "str"}], + "roles": [{"name": "str", "privileges": ["str"]}], + }, + "targetLocations": [ + { + "name": "str", + "additionalReplicaSets": [{"regionalReplicaCount": 0, "storageAccountType": "str"}], + "encryption": { + "dataDiskImages": [{"lun": 0, "diskEncryptionSetId": "str"}], + "osDiskImage": { + "diskEncryptionSetId": "str", + "securityProfile": { + "confidentialVMEncryptionType": "str", + "secureVMDiskEncryptionSetId": "str", + }, + }, + }, + "excludeFromLatest": bool, + "regionalReplicaCount": 0, + "storageAccountType": "str", + } + ], + }, + "tags": {"str": "str"}, + "type": "str", + }, + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_gallery_in_vm_access_control_profile_versions_begin_delete(self, resource_group): + response = await ( + await self.client.gallery_in_vm_access_control_profile_versions.begin_delete( + resource_group_name=resource_group.name, + gallery_name="str", + in_vm_access_control_profile_name="str", + in_vm_access_control_profile_version_name="str", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_gallery_in_vm_access_control_profile_versions_list_by_gallery_in_vm_access_control_profile( + self, resource_group + ): + response = ( + self.client.gallery_in_vm_access_control_profile_versions.list_by_gallery_in_vm_access_control_profile( + resource_group_name=resource_group.name, + gallery_name="str", + in_vm_access_control_profile_name="str", + ) + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_gallery_in_vm_access_control_profiles_operations.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_gallery_in_vm_access_control_profiles_operations.py similarity index 88% rename from sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_gallery_in_vm_access_control_profiles_operations.py rename to sdk/compute/azure-mgmt-compute/generated_tests/test_compute_gallery_in_vm_access_control_profiles_operations.py index 27ad627a636c..298f4a94febc 100644 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_gallery_in_vm_access_control_profiles_operations.py +++ b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_gallery_in_vm_access_control_profiles_operations.py @@ -2,11 +2,11 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.compute import ComputeManagementClient +from azure.mgmt.compute import ComputeClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy @@ -14,21 +14,9 @@ @pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestComputeManagementGalleryInVMAccessControlProfilesOperations(AzureMgmtRecordedTestCase): +class TestComputeGalleryInVMAccessControlProfilesOperations(AzureMgmtRecordedTestCase): def setup_method(self, method): - self.client = self.create_mgmt_client(ComputeManagementClient) - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_gallery_in_vm_access_control_profiles_list_by_gallery(self, resource_group): - response = self.client.gallery_in_vm_access_control_profiles.list_by_gallery( - resource_group_name=resource_group.name, - gallery_name="str", - api_version="2024-03-03", - ) - result = [r for r in response] - # please add some check logic here by yourself - # ... + self.client = self.create_mgmt_client(ComputeClient) @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy @@ -37,7 +25,6 @@ def test_gallery_in_vm_access_control_profiles_get(self, resource_group): resource_group_name=resource_group.name, gallery_name="str", in_vm_access_control_profile_name="str", - api_version="2024-03-03", ) # please add some check logic here by yourself @@ -50,7 +37,7 @@ def test_gallery_in_vm_access_control_profiles_begin_create_or_update(self, reso resource_group_name=resource_group.name, gallery_name="str", in_vm_access_control_profile_name="str", - gallery_in_vm_access_control_profile={ + resource={ "location": "str", "id": "str", "name": "str", @@ -71,7 +58,6 @@ def test_gallery_in_vm_access_control_profiles_begin_create_or_update(self, reso "tags": {"str": "str"}, "type": "str", }, - api_version="2024-03-03", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -84,7 +70,7 @@ def test_gallery_in_vm_access_control_profiles_begin_update(self, resource_group resource_group_name=resource_group.name, gallery_name="str", in_vm_access_control_profile_name="str", - gallery_in_vm_access_control_profile={ + properties={ "id": "str", "name": "str", "properties": { @@ -96,7 +82,6 @@ def test_gallery_in_vm_access_control_profiles_begin_update(self, resource_group "tags": {"str": "str"}, "type": "str", }, - api_version="2024-03-03", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -109,8 +94,18 @@ def test_gallery_in_vm_access_control_profiles_begin_delete(self, resource_group resource_group_name=resource_group.name, gallery_name="str", in_vm_access_control_profile_name="str", - api_version="2024-03-03", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_gallery_in_vm_access_control_profiles_list_by_gallery(self, resource_group): + response = self.client.gallery_in_vm_access_control_profiles.list_by_gallery( + resource_group_name=resource_group.name, + gallery_name="str", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_gallery_in_vm_access_control_profiles_operations_async.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_gallery_in_vm_access_control_profiles_operations_async.py similarity index 88% rename from sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_gallery_in_vm_access_control_profiles_operations_async.py rename to sdk/compute/azure-mgmt-compute/generated_tests/test_compute_gallery_in_vm_access_control_profiles_operations_async.py index f333ae860955..6a0050302124 100644 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_gallery_in_vm_access_control_profiles_operations_async.py +++ b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_gallery_in_vm_access_control_profiles_operations_async.py @@ -2,11 +2,11 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.compute.aio import ComputeManagementClient +from azure.mgmt.compute.aio import ComputeClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer from devtools_testutils.aio import recorded_by_proxy_async @@ -15,21 +15,9 @@ @pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestComputeManagementGalleryInVMAccessControlProfilesOperationsAsync(AzureMgmtRecordedTestCase): +class TestComputeGalleryInVMAccessControlProfilesOperationsAsync(AzureMgmtRecordedTestCase): def setup_method(self, method): - self.client = self.create_mgmt_client(ComputeManagementClient, is_async=True) - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_gallery_in_vm_access_control_profiles_list_by_gallery(self, resource_group): - response = self.client.gallery_in_vm_access_control_profiles.list_by_gallery( - resource_group_name=resource_group.name, - gallery_name="str", - api_version="2024-03-03", - ) - result = [r async for r in response] - # please add some check logic here by yourself - # ... + self.client = self.create_mgmt_client(ComputeClient, is_async=True) @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async @@ -38,7 +26,6 @@ async def test_gallery_in_vm_access_control_profiles_get(self, resource_group): resource_group_name=resource_group.name, gallery_name="str", in_vm_access_control_profile_name="str", - api_version="2024-03-03", ) # please add some check logic here by yourself @@ -52,7 +39,7 @@ async def test_gallery_in_vm_access_control_profiles_begin_create_or_update(self resource_group_name=resource_group.name, gallery_name="str", in_vm_access_control_profile_name="str", - gallery_in_vm_access_control_profile={ + resource={ "location": "str", "id": "str", "name": "str", @@ -73,7 +60,6 @@ async def test_gallery_in_vm_access_control_profiles_begin_create_or_update(self "tags": {"str": "str"}, "type": "str", }, - api_version="2024-03-03", ) ).result() # call '.result()' to poll until service return final result @@ -88,7 +74,7 @@ async def test_gallery_in_vm_access_control_profiles_begin_update(self, resource resource_group_name=resource_group.name, gallery_name="str", in_vm_access_control_profile_name="str", - gallery_in_vm_access_control_profile={ + properties={ "id": "str", "name": "str", "properties": { @@ -100,7 +86,6 @@ async def test_gallery_in_vm_access_control_profiles_begin_update(self, resource "tags": {"str": "str"}, "type": "str", }, - api_version="2024-03-03", ) ).result() # call '.result()' to poll until service return final result @@ -115,9 +100,19 @@ async def test_gallery_in_vm_access_control_profiles_begin_delete(self, resource resource_group_name=resource_group.name, gallery_name="str", in_vm_access_control_profile_name="str", - api_version="2024-03-03", ) ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_gallery_in_vm_access_control_profiles_list_by_gallery(self, resource_group): + response = self.client.gallery_in_vm_access_control_profiles.list_by_gallery( + resource_group_name=resource_group.name, + gallery_name="str", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_images_operations.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_images_operations.py similarity index 65% rename from sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_images_operations.py rename to sdk/compute/azure-mgmt-compute/generated_tests/test_compute_images_operations.py index c0fb9eaf24af..c65629d2dc95 100644 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_images_operations.py +++ b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_images_operations.py @@ -2,11 +2,11 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.compute import ComputeManagementClient +from azure.mgmt.compute import ComputeClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy @@ -14,30 +14,9 @@ @pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestComputeManagementImagesOperations(AzureMgmtRecordedTestCase): +class TestComputeImagesOperations(AzureMgmtRecordedTestCase): def setup_method(self, method): - self.client = self.create_mgmt_client(ComputeManagementClient) - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_images_list(self, resource_group): - response = self.client.images.list( - api_version="2025-04-01", - ) - result = [r for r in response] - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_images_list_by_resource_group(self, resource_group): - response = self.client.images.list_by_resource_group( - resource_group_name=resource_group.name, - api_version="2025-04-01", - ) - result = [r for r in response] - # please add some check logic here by yourself - # ... + self.client = self.create_mgmt_client(ComputeClient) @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy @@ -45,7 +24,6 @@ def test_images_get(self, resource_group): response = self.client.images.get( resource_group_name=resource_group.name, image_name="str", - api_version="2025-04-01", ) # please add some check logic here by yourself @@ -57,18 +35,31 @@ def test_images_begin_create_or_update(self, resource_group): response = self.client.images.begin_create_or_update( resource_group_name=resource_group.name, image_name="str", - parameters={ + resource={ "location": "str", "extendedLocation": {"name": "str", "type": "str"}, - "hyperVGeneration": "str", "id": "str", "name": "str", - "provisioningState": "str", - "sourceVirtualMachine": {"id": "str"}, - "storageProfile": { - "dataDisks": [ - { - "lun": 0, + "properties": { + "hyperVGeneration": "str", + "provisioningState": "str", + "sourceVirtualMachine": {"id": "str"}, + "storageProfile": { + "dataDisks": [ + { + "lun": 0, + "blobUri": "str", + "caching": "str", + "diskEncryptionSet": {"id": "str"}, + "diskSizeGB": 0, + "managedDisk": {"id": "str"}, + "snapshot": {"id": "str"}, + "storageAccountType": "str", + } + ], + "osDisk": { + "osState": "str", + "osType": "str", "blobUri": "str", "caching": "str", "diskEncryptionSet": {"id": "str"}, @@ -76,20 +67,9 @@ def test_images_begin_create_or_update(self, resource_group): "managedDisk": {"id": "str"}, "snapshot": {"id": "str"}, "storageAccountType": "str", - } - ], - "osDisk": { - "osState": "str", - "osType": "str", - "blobUri": "str", - "caching": "str", - "diskEncryptionSet": {"id": "str"}, - "diskSizeGB": 0, - "managedDisk": {"id": "str"}, - "snapshot": {"id": "str"}, - "storageAccountType": "str", + }, + "zoneResilient": bool, }, - "zoneResilient": bool, }, "systemData": { "createdAt": "2020-02-20 00:00:00", @@ -102,7 +82,6 @@ def test_images_begin_create_or_update(self, resource_group): "tags": {"str": "str"}, "type": "str", }, - api_version="2025-04-01", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -114,14 +93,27 @@ def test_images_begin_update(self, resource_group): response = self.client.images.begin_update( resource_group_name=resource_group.name, image_name="str", - parameters={ - "hyperVGeneration": "str", - "provisioningState": "str", - "sourceVirtualMachine": {"id": "str"}, - "storageProfile": { - "dataDisks": [ - { - "lun": 0, + properties={ + "properties": { + "hyperVGeneration": "str", + "provisioningState": "str", + "sourceVirtualMachine": {"id": "str"}, + "storageProfile": { + "dataDisks": [ + { + "lun": 0, + "blobUri": "str", + "caching": "str", + "diskEncryptionSet": {"id": "str"}, + "diskSizeGB": 0, + "managedDisk": {"id": "str"}, + "snapshot": {"id": "str"}, + "storageAccountType": "str", + } + ], + "osDisk": { + "osState": "str", + "osType": "str", "blobUri": "str", "caching": "str", "diskEncryptionSet": {"id": "str"}, @@ -129,24 +121,12 @@ def test_images_begin_update(self, resource_group): "managedDisk": {"id": "str"}, "snapshot": {"id": "str"}, "storageAccountType": "str", - } - ], - "osDisk": { - "osState": "str", - "osType": "str", - "blobUri": "str", - "caching": "str", - "diskEncryptionSet": {"id": "str"}, - "diskSizeGB": 0, - "managedDisk": {"id": "str"}, - "snapshot": {"id": "str"}, - "storageAccountType": "str", + }, + "zoneResilient": bool, }, - "zoneResilient": bool, }, "tags": {"str": "str"}, }, - api_version="2025-04-01", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -158,8 +138,25 @@ def test_images_begin_delete(self, resource_group): response = self.client.images.begin_delete( resource_group_name=resource_group.name, image_name="str", - api_version="2025-04-01", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_images_list_by_resource_group(self, resource_group): + response = self.client.images.list_by_resource_group( + resource_group_name=resource_group.name, + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_images_list(self, resource_group): + response = self.client.images.list() + result = [r for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_images_operations_async.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_images_operations_async.py similarity index 65% rename from sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_images_operations_async.py rename to sdk/compute/azure-mgmt-compute/generated_tests/test_compute_images_operations_async.py index 3cb8c155802f..d770d41df980 100644 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_images_operations_async.py +++ b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_images_operations_async.py @@ -2,11 +2,11 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.compute.aio import ComputeManagementClient +from azure.mgmt.compute.aio import ComputeClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer from devtools_testutils.aio import recorded_by_proxy_async @@ -15,30 +15,9 @@ @pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestComputeManagementImagesOperationsAsync(AzureMgmtRecordedTestCase): +class TestComputeImagesOperationsAsync(AzureMgmtRecordedTestCase): def setup_method(self, method): - self.client = self.create_mgmt_client(ComputeManagementClient, is_async=True) - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_images_list(self, resource_group): - response = self.client.images.list( - api_version="2025-04-01", - ) - result = [r async for r in response] - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_images_list_by_resource_group(self, resource_group): - response = self.client.images.list_by_resource_group( - resource_group_name=resource_group.name, - api_version="2025-04-01", - ) - result = [r async for r in response] - # please add some check logic here by yourself - # ... + self.client = self.create_mgmt_client(ComputeClient, is_async=True) @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async @@ -46,7 +25,6 @@ async def test_images_get(self, resource_group): response = await self.client.images.get( resource_group_name=resource_group.name, image_name="str", - api_version="2025-04-01", ) # please add some check logic here by yourself @@ -59,18 +37,31 @@ async def test_images_begin_create_or_update(self, resource_group): await self.client.images.begin_create_or_update( resource_group_name=resource_group.name, image_name="str", - parameters={ + resource={ "location": "str", "extendedLocation": {"name": "str", "type": "str"}, - "hyperVGeneration": "str", "id": "str", "name": "str", - "provisioningState": "str", - "sourceVirtualMachine": {"id": "str"}, - "storageProfile": { - "dataDisks": [ - { - "lun": 0, + "properties": { + "hyperVGeneration": "str", + "provisioningState": "str", + "sourceVirtualMachine": {"id": "str"}, + "storageProfile": { + "dataDisks": [ + { + "lun": 0, + "blobUri": "str", + "caching": "str", + "diskEncryptionSet": {"id": "str"}, + "diskSizeGB": 0, + "managedDisk": {"id": "str"}, + "snapshot": {"id": "str"}, + "storageAccountType": "str", + } + ], + "osDisk": { + "osState": "str", + "osType": "str", "blobUri": "str", "caching": "str", "diskEncryptionSet": {"id": "str"}, @@ -78,20 +69,9 @@ async def test_images_begin_create_or_update(self, resource_group): "managedDisk": {"id": "str"}, "snapshot": {"id": "str"}, "storageAccountType": "str", - } - ], - "osDisk": { - "osState": "str", - "osType": "str", - "blobUri": "str", - "caching": "str", - "diskEncryptionSet": {"id": "str"}, - "diskSizeGB": 0, - "managedDisk": {"id": "str"}, - "snapshot": {"id": "str"}, - "storageAccountType": "str", + }, + "zoneResilient": bool, }, - "zoneResilient": bool, }, "systemData": { "createdAt": "2020-02-20 00:00:00", @@ -104,7 +84,6 @@ async def test_images_begin_create_or_update(self, resource_group): "tags": {"str": "str"}, "type": "str", }, - api_version="2025-04-01", ) ).result() # call '.result()' to poll until service return final result @@ -118,14 +97,27 @@ async def test_images_begin_update(self, resource_group): await self.client.images.begin_update( resource_group_name=resource_group.name, image_name="str", - parameters={ - "hyperVGeneration": "str", - "provisioningState": "str", - "sourceVirtualMachine": {"id": "str"}, - "storageProfile": { - "dataDisks": [ - { - "lun": 0, + properties={ + "properties": { + "hyperVGeneration": "str", + "provisioningState": "str", + "sourceVirtualMachine": {"id": "str"}, + "storageProfile": { + "dataDisks": [ + { + "lun": 0, + "blobUri": "str", + "caching": "str", + "diskEncryptionSet": {"id": "str"}, + "diskSizeGB": 0, + "managedDisk": {"id": "str"}, + "snapshot": {"id": "str"}, + "storageAccountType": "str", + } + ], + "osDisk": { + "osState": "str", + "osType": "str", "blobUri": "str", "caching": "str", "diskEncryptionSet": {"id": "str"}, @@ -133,24 +125,12 @@ async def test_images_begin_update(self, resource_group): "managedDisk": {"id": "str"}, "snapshot": {"id": "str"}, "storageAccountType": "str", - } - ], - "osDisk": { - "osState": "str", - "osType": "str", - "blobUri": "str", - "caching": "str", - "diskEncryptionSet": {"id": "str"}, - "diskSizeGB": 0, - "managedDisk": {"id": "str"}, - "snapshot": {"id": "str"}, - "storageAccountType": "str", + }, + "zoneResilient": bool, }, - "zoneResilient": bool, }, "tags": {"str": "str"}, }, - api_version="2025-04-01", ) ).result() # call '.result()' to poll until service return final result @@ -164,9 +144,26 @@ async def test_images_begin_delete(self, resource_group): await self.client.images.begin_delete( resource_group_name=resource_group.name, image_name="str", - api_version="2025-04-01", ) ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_images_list_by_resource_group(self, resource_group): + response = self.client.images.list_by_resource_group( + resource_group_name=resource_group.name, + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_images_list(self, resource_group): + response = self.client.images.list() + result = [r async for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_log_analytics_operations.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_log_analytics_operation_group_operations.py similarity index 73% rename from sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_log_analytics_operations.py rename to sdk/compute/azure-mgmt-compute/generated_tests/test_compute_log_analytics_operation_group_operations.py index 3bfcc591ad65..7bd56e2f23be 100644 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_log_analytics_operations.py +++ b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_log_analytics_operation_group_operations.py @@ -2,11 +2,11 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.compute import ComputeManagementClient +from azure.mgmt.compute import ComputeClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy @@ -14,16 +14,16 @@ @pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestComputeManagementLogAnalyticsOperations(AzureMgmtRecordedTestCase): +class TestComputeLogAnalyticsOperationGroupOperations(AzureMgmtRecordedTestCase): def setup_method(self, method): - self.client = self.create_mgmt_client(ComputeManagementClient) + self.client = self.create_mgmt_client(ComputeClient) @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_log_analytics_begin_export_request_rate_by_interval(self, resource_group): - response = self.client.log_analytics.begin_export_request_rate_by_interval( + def test_log_analytics_operation_group_begin_export_request_rate_by_interval(self, resource_group): + response = self.client.log_analytics_operation_group.begin_export_request_rate_by_interval( location="str", - parameters={ + body={ "blobContainerSasUri": "str", "fromTime": "2020-02-20 00:00:00", "intervalLength": "str", @@ -34,7 +34,6 @@ def test_log_analytics_begin_export_request_rate_by_interval(self, resource_grou "groupByThrottlePolicy": bool, "groupByUserAgent": bool, }, - api_version="2025-04-01", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -42,10 +41,10 @@ def test_log_analytics_begin_export_request_rate_by_interval(self, resource_grou @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_log_analytics_begin_export_throttled_requests(self, resource_group): - response = self.client.log_analytics.begin_export_throttled_requests( + def test_log_analytics_operation_group_begin_export_throttled_requests(self, resource_group): + response = self.client.log_analytics_operation_group.begin_export_throttled_requests( location="str", - parameters={ + body={ "blobContainerSasUri": "str", "fromTime": "2020-02-20 00:00:00", "toTime": "2020-02-20 00:00:00", @@ -55,7 +54,6 @@ def test_log_analytics_begin_export_throttled_requests(self, resource_group): "groupByThrottlePolicy": bool, "groupByUserAgent": bool, }, - api_version="2025-04-01", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_log_analytics_operations_async.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_log_analytics_operation_group_operations_async.py similarity index 74% rename from sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_log_analytics_operations_async.py rename to sdk/compute/azure-mgmt-compute/generated_tests/test_compute_log_analytics_operation_group_operations_async.py index 78df8256922a..578fee737f46 100644 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_log_analytics_operations_async.py +++ b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_log_analytics_operation_group_operations_async.py @@ -2,11 +2,11 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.compute.aio import ComputeManagementClient +from azure.mgmt.compute.aio import ComputeClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer from devtools_testutils.aio import recorded_by_proxy_async @@ -15,17 +15,17 @@ @pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestComputeManagementLogAnalyticsOperationsAsync(AzureMgmtRecordedTestCase): +class TestComputeLogAnalyticsOperationGroupOperationsAsync(AzureMgmtRecordedTestCase): def setup_method(self, method): - self.client = self.create_mgmt_client(ComputeManagementClient, is_async=True) + self.client = self.create_mgmt_client(ComputeClient, is_async=True) @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_log_analytics_begin_export_request_rate_by_interval(self, resource_group): + async def test_log_analytics_operation_group_begin_export_request_rate_by_interval(self, resource_group): response = await ( - await self.client.log_analytics.begin_export_request_rate_by_interval( + await self.client.log_analytics_operation_group.begin_export_request_rate_by_interval( location="str", - parameters={ + body={ "blobContainerSasUri": "str", "fromTime": "2020-02-20 00:00:00", "intervalLength": "str", @@ -36,7 +36,6 @@ async def test_log_analytics_begin_export_request_rate_by_interval(self, resourc "groupByThrottlePolicy": bool, "groupByUserAgent": bool, }, - api_version="2025-04-01", ) ).result() # call '.result()' to poll until service return final result @@ -45,11 +44,11 @@ async def test_log_analytics_begin_export_request_rate_by_interval(self, resourc @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_log_analytics_begin_export_throttled_requests(self, resource_group): + async def test_log_analytics_operation_group_begin_export_throttled_requests(self, resource_group): response = await ( - await self.client.log_analytics.begin_export_throttled_requests( + await self.client.log_analytics_operation_group.begin_export_throttled_requests( location="str", - parameters={ + body={ "blobContainerSasUri": "str", "fromTime": "2020-02-20 00:00:00", "toTime": "2020-02-20 00:00:00", @@ -59,7 +58,6 @@ async def test_log_analytics_begin_export_throttled_requests(self, resource_grou "groupByThrottlePolicy": bool, "groupByUserAgent": bool, }, - api_version="2025-04-01", ) ).result() # call '.result()' to poll until service return final result diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_cloud_service_operating_systems_operations.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_cloud_service_operating_systems_operations.py deleted file mode 100644 index 20a0a6ae4058..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_cloud_service_operating_systems_operations.py +++ /dev/null @@ -1,65 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import pytest -from azure.mgmt.compute import ComputeManagementClient - -from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy - -AZURE_LOCATION = "eastus" - - -@pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestComputeManagementCloudServiceOperatingSystemsOperations(AzureMgmtRecordedTestCase): - def setup_method(self, method): - self.client = self.create_mgmt_client(ComputeManagementClient) - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_cloud_service_operating_systems_get_os_version(self, resource_group): - response = self.client.cloud_service_operating_systems.get_os_version( - location="str", - os_version_name="str", - api_version="2024-11-04", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_cloud_service_operating_systems_list_os_versions(self, resource_group): - response = self.client.cloud_service_operating_systems.list_os_versions( - location="str", - api_version="2024-11-04", - ) - result = [r for r in response] - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_cloud_service_operating_systems_get_os_family(self, resource_group): - response = self.client.cloud_service_operating_systems.get_os_family( - location="str", - os_family_name="str", - api_version="2024-11-04", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_cloud_service_operating_systems_list_os_families(self, resource_group): - response = self.client.cloud_service_operating_systems.list_os_families( - location="str", - api_version="2024-11-04", - ) - result = [r for r in response] - # please add some check logic here by yourself - # ... diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_cloud_service_operating_systems_operations_async.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_cloud_service_operating_systems_operations_async.py deleted file mode 100644 index 57b7b4e8c2a5..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_cloud_service_operating_systems_operations_async.py +++ /dev/null @@ -1,66 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import pytest -from azure.mgmt.compute.aio import ComputeManagementClient - -from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer -from devtools_testutils.aio import recorded_by_proxy_async - -AZURE_LOCATION = "eastus" - - -@pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestComputeManagementCloudServiceOperatingSystemsOperationsAsync(AzureMgmtRecordedTestCase): - def setup_method(self, method): - self.client = self.create_mgmt_client(ComputeManagementClient, is_async=True) - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_cloud_service_operating_systems_get_os_version(self, resource_group): - response = await self.client.cloud_service_operating_systems.get_os_version( - location="str", - os_version_name="str", - api_version="2024-11-04", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_cloud_service_operating_systems_list_os_versions(self, resource_group): - response = self.client.cloud_service_operating_systems.list_os_versions( - location="str", - api_version="2024-11-04", - ) - result = [r async for r in response] - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_cloud_service_operating_systems_get_os_family(self, resource_group): - response = await self.client.cloud_service_operating_systems.get_os_family( - location="str", - os_family_name="str", - api_version="2024-11-04", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_cloud_service_operating_systems_list_os_families(self, resource_group): - response = self.client.cloud_service_operating_systems.list_os_families( - location="str", - api_version="2024-11-04", - ) - result = [r async for r in response] - # please add some check logic here by yourself - # ... diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_cloud_service_role_instances_operations.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_cloud_service_role_instances_operations.py deleted file mode 100644 index bd075118a29d..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_cloud_service_role_instances_operations.py +++ /dev/null @@ -1,122 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import pytest -from azure.mgmt.compute import ComputeManagementClient - -from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy - -AZURE_LOCATION = "eastus" - - -@pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestComputeManagementCloudServiceRoleInstancesOperations(AzureMgmtRecordedTestCase): - def setup_method(self, method): - self.client = self.create_mgmt_client(ComputeManagementClient) - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_cloud_service_role_instances_begin_delete(self, resource_group): - response = self.client.cloud_service_role_instances.begin_delete( - role_instance_name="str", - resource_group_name=resource_group.name, - cloud_service_name="str", - api_version="2024-11-04", - ).result() # call '.result()' to poll until service return final result - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_cloud_service_role_instances_get(self, resource_group): - response = self.client.cloud_service_role_instances.get( - role_instance_name="str", - resource_group_name=resource_group.name, - cloud_service_name="str", - api_version="2024-11-04", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_cloud_service_role_instances_get_instance_view(self, resource_group): - response = self.client.cloud_service_role_instances.get_instance_view( - role_instance_name="str", - resource_group_name=resource_group.name, - cloud_service_name="str", - api_version="2024-11-04", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_cloud_service_role_instances_list(self, resource_group): - response = self.client.cloud_service_role_instances.list( - resource_group_name=resource_group.name, - cloud_service_name="str", - api_version="2024-11-04", - ) - result = [r for r in response] - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_cloud_service_role_instances_begin_restart(self, resource_group): - response = self.client.cloud_service_role_instances.begin_restart( - role_instance_name="str", - resource_group_name=resource_group.name, - cloud_service_name="str", - api_version="2024-11-04", - ).result() # call '.result()' to poll until service return final result - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_cloud_service_role_instances_begin_reimage(self, resource_group): - response = self.client.cloud_service_role_instances.begin_reimage( - role_instance_name="str", - resource_group_name=resource_group.name, - cloud_service_name="str", - api_version="2024-11-04", - ).result() # call '.result()' to poll until service return final result - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_cloud_service_role_instances_begin_rebuild(self, resource_group): - response = self.client.cloud_service_role_instances.begin_rebuild( - role_instance_name="str", - resource_group_name=resource_group.name, - cloud_service_name="str", - api_version="2024-11-04", - ).result() # call '.result()' to poll until service return final result - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_cloud_service_role_instances_get_remote_desktop_file(self, resource_group): - response = self.client.cloud_service_role_instances.get_remote_desktop_file( - role_instance_name="str", - resource_group_name=resource_group.name, - cloud_service_name="str", - api_version="2024-11-04", - ) - - # please add some check logic here by yourself - # ... diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_cloud_service_role_instances_operations_async.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_cloud_service_role_instances_operations_async.py deleted file mode 100644 index 41a423723d1c..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_cloud_service_role_instances_operations_async.py +++ /dev/null @@ -1,131 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import pytest -from azure.mgmt.compute.aio import ComputeManagementClient - -from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer -from devtools_testutils.aio import recorded_by_proxy_async - -AZURE_LOCATION = "eastus" - - -@pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestComputeManagementCloudServiceRoleInstancesOperationsAsync(AzureMgmtRecordedTestCase): - def setup_method(self, method): - self.client = self.create_mgmt_client(ComputeManagementClient, is_async=True) - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_cloud_service_role_instances_begin_delete(self, resource_group): - response = await ( - await self.client.cloud_service_role_instances.begin_delete( - role_instance_name="str", - resource_group_name=resource_group.name, - cloud_service_name="str", - api_version="2024-11-04", - ) - ).result() # call '.result()' to poll until service return final result - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_cloud_service_role_instances_get(self, resource_group): - response = await self.client.cloud_service_role_instances.get( - role_instance_name="str", - resource_group_name=resource_group.name, - cloud_service_name="str", - api_version="2024-11-04", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_cloud_service_role_instances_get_instance_view(self, resource_group): - response = await self.client.cloud_service_role_instances.get_instance_view( - role_instance_name="str", - resource_group_name=resource_group.name, - cloud_service_name="str", - api_version="2024-11-04", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_cloud_service_role_instances_list(self, resource_group): - response = self.client.cloud_service_role_instances.list( - resource_group_name=resource_group.name, - cloud_service_name="str", - api_version="2024-11-04", - ) - result = [r async for r in response] - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_cloud_service_role_instances_begin_restart(self, resource_group): - response = await ( - await self.client.cloud_service_role_instances.begin_restart( - role_instance_name="str", - resource_group_name=resource_group.name, - cloud_service_name="str", - api_version="2024-11-04", - ) - ).result() # call '.result()' to poll until service return final result - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_cloud_service_role_instances_begin_reimage(self, resource_group): - response = await ( - await self.client.cloud_service_role_instances.begin_reimage( - role_instance_name="str", - resource_group_name=resource_group.name, - cloud_service_name="str", - api_version="2024-11-04", - ) - ).result() # call '.result()' to poll until service return final result - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_cloud_service_role_instances_begin_rebuild(self, resource_group): - response = await ( - await self.client.cloud_service_role_instances.begin_rebuild( - role_instance_name="str", - resource_group_name=resource_group.name, - cloud_service_name="str", - api_version="2024-11-04", - ) - ).result() # call '.result()' to poll until service return final result - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_cloud_service_role_instances_get_remote_desktop_file(self, resource_group): - response = await self.client.cloud_service_role_instances.get_remote_desktop_file( - role_instance_name="str", - resource_group_name=resource_group.name, - cloud_service_name="str", - api_version="2024-11-04", - ) - - # please add some check logic here by yourself - # ... diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_cloud_service_roles_operations.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_cloud_service_roles_operations.py deleted file mode 100644 index 60efffd99f02..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_cloud_service_roles_operations.py +++ /dev/null @@ -1,44 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import pytest -from azure.mgmt.compute import ComputeManagementClient - -from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy - -AZURE_LOCATION = "eastus" - - -@pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestComputeManagementCloudServiceRolesOperations(AzureMgmtRecordedTestCase): - def setup_method(self, method): - self.client = self.create_mgmt_client(ComputeManagementClient) - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_cloud_service_roles_get(self, resource_group): - response = self.client.cloud_service_roles.get( - role_name="str", - resource_group_name=resource_group.name, - cloud_service_name="str", - api_version="2024-11-04", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_cloud_service_roles_list(self, resource_group): - response = self.client.cloud_service_roles.list( - resource_group_name=resource_group.name, - cloud_service_name="str", - api_version="2024-11-04", - ) - result = [r for r in response] - # please add some check logic here by yourself - # ... diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_cloud_service_roles_operations_async.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_cloud_service_roles_operations_async.py deleted file mode 100644 index 179c7e979563..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_cloud_service_roles_operations_async.py +++ /dev/null @@ -1,45 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import pytest -from azure.mgmt.compute.aio import ComputeManagementClient - -from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer -from devtools_testutils.aio import recorded_by_proxy_async - -AZURE_LOCATION = "eastus" - - -@pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestComputeManagementCloudServiceRolesOperationsAsync(AzureMgmtRecordedTestCase): - def setup_method(self, method): - self.client = self.create_mgmt_client(ComputeManagementClient, is_async=True) - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_cloud_service_roles_get(self, resource_group): - response = await self.client.cloud_service_roles.get( - role_name="str", - resource_group_name=resource_group.name, - cloud_service_name="str", - api_version="2024-11-04", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_cloud_service_roles_list(self, resource_group): - response = self.client.cloud_service_roles.list( - resource_group_name=resource_group.name, - cloud_service_name="str", - api_version="2024-11-04", - ) - result = [r async for r in response] - # please add some check logic here by yourself - # ... diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_cloud_services_operations.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_cloud_services_operations.py deleted file mode 100644 index 5a3f00457ffd..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_cloud_services_operations.py +++ /dev/null @@ -1,172 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import pytest -from azure.mgmt.compute import ComputeManagementClient - -from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy - -AZURE_LOCATION = "eastus" - - -@pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestComputeManagementCloudServicesOperations(AzureMgmtRecordedTestCase): - def setup_method(self, method): - self.client = self.create_mgmt_client(ComputeManagementClient) - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_cloud_services_begin_create_or_update(self, resource_group): - response = self.client.cloud_services.begin_create_or_update( - resource_group_name=resource_group.name, - cloud_service_name="str", - api_version="2024-11-04", - ).result() # call '.result()' to poll until service return final result - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_cloud_services_begin_update(self, resource_group): - response = self.client.cloud_services.begin_update( - resource_group_name=resource_group.name, - cloud_service_name="str", - api_version="2024-11-04", - ).result() # call '.result()' to poll until service return final result - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_cloud_services_begin_delete(self, resource_group): - response = self.client.cloud_services.begin_delete( - resource_group_name=resource_group.name, - cloud_service_name="str", - api_version="2024-11-04", - ).result() # call '.result()' to poll until service return final result - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_cloud_services_get(self, resource_group): - response = self.client.cloud_services.get( - resource_group_name=resource_group.name, - cloud_service_name="str", - api_version="2024-11-04", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_cloud_services_get_instance_view(self, resource_group): - response = self.client.cloud_services.get_instance_view( - resource_group_name=resource_group.name, - cloud_service_name="str", - api_version="2024-11-04", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_cloud_services_list_all(self, resource_group): - response = self.client.cloud_services.list_all( - api_version="2024-11-04", - ) - result = [r for r in response] - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_cloud_services_list(self, resource_group): - response = self.client.cloud_services.list( - resource_group_name=resource_group.name, - api_version="2024-11-04", - ) - result = [r for r in response] - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_cloud_services_begin_start(self, resource_group): - response = self.client.cloud_services.begin_start( - resource_group_name=resource_group.name, - cloud_service_name="str", - api_version="2024-11-04", - ).result() # call '.result()' to poll until service return final result - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_cloud_services_begin_power_off(self, resource_group): - response = self.client.cloud_services.begin_power_off( - resource_group_name=resource_group.name, - cloud_service_name="str", - api_version="2024-11-04", - ).result() # call '.result()' to poll until service return final result - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_cloud_services_begin_restart(self, resource_group): - response = self.client.cloud_services.begin_restart( - resource_group_name=resource_group.name, - cloud_service_name="str", - api_version="2024-11-04", - ).result() # call '.result()' to poll until service return final result - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_cloud_services_begin_reimage(self, resource_group): - response = self.client.cloud_services.begin_reimage( - resource_group_name=resource_group.name, - cloud_service_name="str", - api_version="2024-11-04", - ).result() # call '.result()' to poll until service return final result - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_cloud_services_begin_rebuild(self, resource_group): - response = self.client.cloud_services.begin_rebuild( - resource_group_name=resource_group.name, - cloud_service_name="str", - api_version="2024-11-04", - ).result() # call '.result()' to poll until service return final result - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_cloud_services_begin_delete_instances(self, resource_group): - response = self.client.cloud_services.begin_delete_instances( - resource_group_name=resource_group.name, - cloud_service_name="str", - api_version="2024-11-04", - ).result() # call '.result()' to poll until service return final result - - # please add some check logic here by yourself - # ... diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_cloud_services_operations_async.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_cloud_services_operations_async.py deleted file mode 100644 index 9cb662e43bba..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_cloud_services_operations_async.py +++ /dev/null @@ -1,191 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import pytest -from azure.mgmt.compute.aio import ComputeManagementClient - -from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer -from devtools_testutils.aio import recorded_by_proxy_async - -AZURE_LOCATION = "eastus" - - -@pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestComputeManagementCloudServicesOperationsAsync(AzureMgmtRecordedTestCase): - def setup_method(self, method): - self.client = self.create_mgmt_client(ComputeManagementClient, is_async=True) - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_cloud_services_begin_create_or_update(self, resource_group): - response = await ( - await self.client.cloud_services.begin_create_or_update( - resource_group_name=resource_group.name, - cloud_service_name="str", - api_version="2024-11-04", - ) - ).result() # call '.result()' to poll until service return final result - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_cloud_services_begin_update(self, resource_group): - response = await ( - await self.client.cloud_services.begin_update( - resource_group_name=resource_group.name, - cloud_service_name="str", - api_version="2024-11-04", - ) - ).result() # call '.result()' to poll until service return final result - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_cloud_services_begin_delete(self, resource_group): - response = await ( - await self.client.cloud_services.begin_delete( - resource_group_name=resource_group.name, - cloud_service_name="str", - api_version="2024-11-04", - ) - ).result() # call '.result()' to poll until service return final result - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_cloud_services_get(self, resource_group): - response = await self.client.cloud_services.get( - resource_group_name=resource_group.name, - cloud_service_name="str", - api_version="2024-11-04", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_cloud_services_get_instance_view(self, resource_group): - response = await self.client.cloud_services.get_instance_view( - resource_group_name=resource_group.name, - cloud_service_name="str", - api_version="2024-11-04", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_cloud_services_list_all(self, resource_group): - response = self.client.cloud_services.list_all( - api_version="2024-11-04", - ) - result = [r async for r in response] - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_cloud_services_list(self, resource_group): - response = self.client.cloud_services.list( - resource_group_name=resource_group.name, - api_version="2024-11-04", - ) - result = [r async for r in response] - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_cloud_services_begin_start(self, resource_group): - response = await ( - await self.client.cloud_services.begin_start( - resource_group_name=resource_group.name, - cloud_service_name="str", - api_version="2024-11-04", - ) - ).result() # call '.result()' to poll until service return final result - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_cloud_services_begin_power_off(self, resource_group): - response = await ( - await self.client.cloud_services.begin_power_off( - resource_group_name=resource_group.name, - cloud_service_name="str", - api_version="2024-11-04", - ) - ).result() # call '.result()' to poll until service return final result - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_cloud_services_begin_restart(self, resource_group): - response = await ( - await self.client.cloud_services.begin_restart( - resource_group_name=resource_group.name, - cloud_service_name="str", - api_version="2024-11-04", - ) - ).result() # call '.result()' to poll until service return final result - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_cloud_services_begin_reimage(self, resource_group): - response = await ( - await self.client.cloud_services.begin_reimage( - resource_group_name=resource_group.name, - cloud_service_name="str", - api_version="2024-11-04", - ) - ).result() # call '.result()' to poll until service return final result - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_cloud_services_begin_rebuild(self, resource_group): - response = await ( - await self.client.cloud_services.begin_rebuild( - resource_group_name=resource_group.name, - cloud_service_name="str", - api_version="2024-11-04", - ) - ).result() # call '.result()' to poll until service return final result - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_cloud_services_begin_delete_instances(self, resource_group): - response = await ( - await self.client.cloud_services.begin_delete_instances( - resource_group_name=resource_group.name, - cloud_service_name="str", - api_version="2024-11-04", - ) - ).result() # call '.result()' to poll until service return final result - - # please add some check logic here by yourself - # ... diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_cloud_services_update_domain_operations.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_cloud_services_update_domain_operations.py deleted file mode 100644 index 7482e2c75eef..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_cloud_services_update_domain_operations.py +++ /dev/null @@ -1,57 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import pytest -from azure.mgmt.compute import ComputeManagementClient - -from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy - -AZURE_LOCATION = "eastus" - - -@pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestComputeManagementCloudServicesUpdateDomainOperations(AzureMgmtRecordedTestCase): - def setup_method(self, method): - self.client = self.create_mgmt_client(ComputeManagementClient) - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_cloud_services_update_domain_begin_walk_update_domain(self, resource_group): - response = self.client.cloud_services_update_domain.begin_walk_update_domain( - resource_group_name=resource_group.name, - cloud_service_name="str", - update_domain=0, - api_version="2024-11-04", - ).result() # call '.result()' to poll until service return final result - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_cloud_services_update_domain_get_update_domain(self, resource_group): - response = self.client.cloud_services_update_domain.get_update_domain( - resource_group_name=resource_group.name, - cloud_service_name="str", - update_domain=0, - api_version="2024-11-04", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_cloud_services_update_domain_list_update_domains(self, resource_group): - response = self.client.cloud_services_update_domain.list_update_domains( - resource_group_name=resource_group.name, - cloud_service_name="str", - api_version="2024-11-04", - ) - result = [r for r in response] - # please add some check logic here by yourself - # ... diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_cloud_services_update_domain_operations_async.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_cloud_services_update_domain_operations_async.py deleted file mode 100644 index 59df1d30db4d..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_cloud_services_update_domain_operations_async.py +++ /dev/null @@ -1,60 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import pytest -from azure.mgmt.compute.aio import ComputeManagementClient - -from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer -from devtools_testutils.aio import recorded_by_proxy_async - -AZURE_LOCATION = "eastus" - - -@pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestComputeManagementCloudServicesUpdateDomainOperationsAsync(AzureMgmtRecordedTestCase): - def setup_method(self, method): - self.client = self.create_mgmt_client(ComputeManagementClient, is_async=True) - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_cloud_services_update_domain_begin_walk_update_domain(self, resource_group): - response = await ( - await self.client.cloud_services_update_domain.begin_walk_update_domain( - resource_group_name=resource_group.name, - cloud_service_name="str", - update_domain=0, - api_version="2024-11-04", - ) - ).result() # call '.result()' to poll until service return final result - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_cloud_services_update_domain_get_update_domain(self, resource_group): - response = await self.client.cloud_services_update_domain.get_update_domain( - resource_group_name=resource_group.name, - cloud_service_name="str", - update_domain=0, - api_version="2024-11-04", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_cloud_services_update_domain_list_update_domains(self, resource_group): - response = self.client.cloud_services_update_domain.list_update_domains( - resource_group_name=resource_group.name, - cloud_service_name="str", - api_version="2024-11-04", - ) - result = [r async for r in response] - # please add some check logic here by yourself - # ... diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_disk_accesses_operations.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_disk_accesses_operations.py deleted file mode 100644 index 546c069438a2..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_disk_accesses_operations.py +++ /dev/null @@ -1,208 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import pytest -from azure.mgmt.compute import ComputeManagementClient - -from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy - -AZURE_LOCATION = "eastus" - - -@pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestComputeManagementDiskAccessesOperations(AzureMgmtRecordedTestCase): - def setup_method(self, method): - self.client = self.create_mgmt_client(ComputeManagementClient) - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_disk_accesses_list(self, resource_group): - response = self.client.disk_accesses.list( - api_version="2025-01-02", - ) - result = [r for r in response] - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_disk_accesses_list_by_resource_group(self, resource_group): - response = self.client.disk_accesses.list_by_resource_group( - resource_group_name=resource_group.name, - api_version="2025-01-02", - ) - result = [r for r in response] - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_disk_accesses_get(self, resource_group): - response = self.client.disk_accesses.get( - resource_group_name=resource_group.name, - disk_access_name="str", - api_version="2025-01-02", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_disk_accesses_begin_create_or_update(self, resource_group): - response = self.client.disk_accesses.begin_create_or_update( - resource_group_name=resource_group.name, - disk_access_name="str", - disk_access={ - "location": "str", - "extendedLocation": {"name": "str", "type": "str"}, - "id": "str", - "name": "str", - "privateEndpointConnections": [ - { - "id": "str", - "name": "str", - "privateEndpoint": {"id": "str"}, - "privateLinkServiceConnectionState": { - "actionsRequired": "str", - "description": "str", - "status": "str", - }, - "provisioningState": "str", - "systemData": { - "createdAt": "2020-02-20 00:00:00", - "createdBy": "str", - "createdByType": "str", - "lastModifiedAt": "2020-02-20 00:00:00", - "lastModifiedBy": "str", - "lastModifiedByType": "str", - }, - "type": "str", - } - ], - "provisioningState": "str", - "systemData": { - "createdAt": "2020-02-20 00:00:00", - "createdBy": "str", - "createdByType": "str", - "lastModifiedAt": "2020-02-20 00:00:00", - "lastModifiedBy": "str", - "lastModifiedByType": "str", - }, - "tags": {"str": "str"}, - "timeCreated": "2020-02-20 00:00:00", - "type": "str", - }, - api_version="2025-01-02", - ).result() # call '.result()' to poll until service return final result - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_disk_accesses_begin_update(self, resource_group): - response = self.client.disk_accesses.begin_update( - resource_group_name=resource_group.name, - disk_access_name="str", - disk_access={"tags": {"str": "str"}}, - api_version="2025-01-02", - ).result() # call '.result()' to poll until service return final result - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_disk_accesses_begin_delete(self, resource_group): - response = self.client.disk_accesses.begin_delete( - resource_group_name=resource_group.name, - disk_access_name="str", - api_version="2025-01-02", - ).result() # call '.result()' to poll until service return final result - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_disk_accesses_list_private_endpoint_connections(self, resource_group): - response = self.client.disk_accesses.list_private_endpoint_connections( - resource_group_name=resource_group.name, - disk_access_name="str", - api_version="2025-01-02", - ) - result = [r for r in response] - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_disk_accesses_get_a_private_endpoint_connection(self, resource_group): - response = self.client.disk_accesses.get_a_private_endpoint_connection( - resource_group_name=resource_group.name, - disk_access_name="str", - private_endpoint_connection_name="str", - api_version="2025-01-02", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_disk_accesses_begin_update_a_private_endpoint_connection(self, resource_group): - response = self.client.disk_accesses.begin_update_a_private_endpoint_connection( - resource_group_name=resource_group.name, - disk_access_name="str", - private_endpoint_connection_name="str", - private_endpoint_connection={ - "id": "str", - "name": "str", - "privateEndpoint": {"id": "str"}, - "privateLinkServiceConnectionState": {"actionsRequired": "str", "description": "str", "status": "str"}, - "provisioningState": "str", - "systemData": { - "createdAt": "2020-02-20 00:00:00", - "createdBy": "str", - "createdByType": "str", - "lastModifiedAt": "2020-02-20 00:00:00", - "lastModifiedBy": "str", - "lastModifiedByType": "str", - }, - "type": "str", - }, - api_version="2025-01-02", - ).result() # call '.result()' to poll until service return final result - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_disk_accesses_begin_delete_a_private_endpoint_connection(self, resource_group): - response = self.client.disk_accesses.begin_delete_a_private_endpoint_connection( - resource_group_name=resource_group.name, - disk_access_name="str", - private_endpoint_connection_name="str", - api_version="2025-01-02", - ).result() # call '.result()' to poll until service return final result - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_disk_accesses_get_private_link_resources(self, resource_group): - response = self.client.disk_accesses.get_private_link_resources( - resource_group_name=resource_group.name, - disk_access_name="str", - api_version="2025-01-02", - ) - - # please add some check logic here by yourself - # ... diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_disk_accesses_operations_async.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_disk_accesses_operations_async.py deleted file mode 100644 index dc6d33376f2a..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_disk_accesses_operations_async.py +++ /dev/null @@ -1,223 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import pytest -from azure.mgmt.compute.aio import ComputeManagementClient - -from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer -from devtools_testutils.aio import recorded_by_proxy_async - -AZURE_LOCATION = "eastus" - - -@pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestComputeManagementDiskAccessesOperationsAsync(AzureMgmtRecordedTestCase): - def setup_method(self, method): - self.client = self.create_mgmt_client(ComputeManagementClient, is_async=True) - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_disk_accesses_list(self, resource_group): - response = self.client.disk_accesses.list( - api_version="2025-01-02", - ) - result = [r async for r in response] - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_disk_accesses_list_by_resource_group(self, resource_group): - response = self.client.disk_accesses.list_by_resource_group( - resource_group_name=resource_group.name, - api_version="2025-01-02", - ) - result = [r async for r in response] - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_disk_accesses_get(self, resource_group): - response = await self.client.disk_accesses.get( - resource_group_name=resource_group.name, - disk_access_name="str", - api_version="2025-01-02", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_disk_accesses_begin_create_or_update(self, resource_group): - response = await ( - await self.client.disk_accesses.begin_create_or_update( - resource_group_name=resource_group.name, - disk_access_name="str", - disk_access={ - "location": "str", - "extendedLocation": {"name": "str", "type": "str"}, - "id": "str", - "name": "str", - "privateEndpointConnections": [ - { - "id": "str", - "name": "str", - "privateEndpoint": {"id": "str"}, - "privateLinkServiceConnectionState": { - "actionsRequired": "str", - "description": "str", - "status": "str", - }, - "provisioningState": "str", - "systemData": { - "createdAt": "2020-02-20 00:00:00", - "createdBy": "str", - "createdByType": "str", - "lastModifiedAt": "2020-02-20 00:00:00", - "lastModifiedBy": "str", - "lastModifiedByType": "str", - }, - "type": "str", - } - ], - "provisioningState": "str", - "systemData": { - "createdAt": "2020-02-20 00:00:00", - "createdBy": "str", - "createdByType": "str", - "lastModifiedAt": "2020-02-20 00:00:00", - "lastModifiedBy": "str", - "lastModifiedByType": "str", - }, - "tags": {"str": "str"}, - "timeCreated": "2020-02-20 00:00:00", - "type": "str", - }, - api_version="2025-01-02", - ) - ).result() # call '.result()' to poll until service return final result - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_disk_accesses_begin_update(self, resource_group): - response = await ( - await self.client.disk_accesses.begin_update( - resource_group_name=resource_group.name, - disk_access_name="str", - disk_access={"tags": {"str": "str"}}, - api_version="2025-01-02", - ) - ).result() # call '.result()' to poll until service return final result - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_disk_accesses_begin_delete(self, resource_group): - response = await ( - await self.client.disk_accesses.begin_delete( - resource_group_name=resource_group.name, - disk_access_name="str", - api_version="2025-01-02", - ) - ).result() # call '.result()' to poll until service return final result - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_disk_accesses_list_private_endpoint_connections(self, resource_group): - response = self.client.disk_accesses.list_private_endpoint_connections( - resource_group_name=resource_group.name, - disk_access_name="str", - api_version="2025-01-02", - ) - result = [r async for r in response] - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_disk_accesses_get_a_private_endpoint_connection(self, resource_group): - response = await self.client.disk_accesses.get_a_private_endpoint_connection( - resource_group_name=resource_group.name, - disk_access_name="str", - private_endpoint_connection_name="str", - api_version="2025-01-02", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_disk_accesses_begin_update_a_private_endpoint_connection(self, resource_group): - response = await ( - await self.client.disk_accesses.begin_update_a_private_endpoint_connection( - resource_group_name=resource_group.name, - disk_access_name="str", - private_endpoint_connection_name="str", - private_endpoint_connection={ - "id": "str", - "name": "str", - "privateEndpoint": {"id": "str"}, - "privateLinkServiceConnectionState": { - "actionsRequired": "str", - "description": "str", - "status": "str", - }, - "provisioningState": "str", - "systemData": { - "createdAt": "2020-02-20 00:00:00", - "createdBy": "str", - "createdByType": "str", - "lastModifiedAt": "2020-02-20 00:00:00", - "lastModifiedBy": "str", - "lastModifiedByType": "str", - }, - "type": "str", - }, - api_version="2025-01-02", - ) - ).result() # call '.result()' to poll until service return final result - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_disk_accesses_begin_delete_a_private_endpoint_connection(self, resource_group): - response = await ( - await self.client.disk_accesses.begin_delete_a_private_endpoint_connection( - resource_group_name=resource_group.name, - disk_access_name="str", - private_endpoint_connection_name="str", - api_version="2025-01-02", - ) - ).result() # call '.result()' to poll until service return final result - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_disk_accesses_get_private_link_resources(self, resource_group): - response = await self.client.disk_accesses.get_private_link_resources( - resource_group_name=resource_group.name, - disk_access_name="str", - api_version="2025-01-02", - ) - - # please add some check logic here by yourself - # ... diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_disks_operations.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_disks_operations.py deleted file mode 100644 index 762bc08faba8..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_disks_operations.py +++ /dev/null @@ -1,250 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import pytest -from azure.mgmt.compute import ComputeManagementClient - -from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy - -AZURE_LOCATION = "eastus" - - -@pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestComputeManagementDisksOperations(AzureMgmtRecordedTestCase): - def setup_method(self, method): - self.client = self.create_mgmt_client(ComputeManagementClient) - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_disks_list(self, resource_group): - response = self.client.disks.list( - api_version="2025-01-02", - ) - result = [r for r in response] - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_disks_list_by_resource_group(self, resource_group): - response = self.client.disks.list_by_resource_group( - resource_group_name=resource_group.name, - api_version="2025-01-02", - ) - result = [r for r in response] - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_disks_get(self, resource_group): - response = self.client.disks.get( - resource_group_name=resource_group.name, - disk_name="str", - api_version="2025-01-02", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_disks_begin_create_or_update(self, resource_group): - response = self.client.disks.begin_create_or_update( - resource_group_name=resource_group.name, - disk_name="str", - disk={ - "location": "str", - "LastOwnershipUpdateTime": "2020-02-20 00:00:00", - "availabilityPolicy": {"actionOnDiskDelay": "str"}, - "burstingEnabled": bool, - "burstingEnabledTime": "2020-02-20 00:00:00", - "completionPercent": 0.0, - "creationData": { - "createOption": "str", - "elasticSanResourceId": "str", - "galleryImageReference": { - "communityGalleryImageId": "str", - "id": "str", - "lun": 0, - "sharedGalleryImageId": "str", - }, - "imageReference": { - "communityGalleryImageId": "str", - "id": "str", - "lun": 0, - "sharedGalleryImageId": "str", - }, - "instantAccessDurationMinutes": 0, - "logicalSectorSize": 0, - "performancePlus": bool, - "provisionedBandwidthCopySpeed": "str", - "securityDataUri": "str", - "securityMetadataUri": "str", - "sourceResourceId": "str", - "sourceUniqueId": "str", - "sourceUri": "str", - "storageAccountId": "str", - "uploadSizeBytes": 0, - }, - "dataAccessAuthMode": "str", - "diskAccessId": "str", - "diskIOPSReadOnly": 0, - "diskIOPSReadWrite": 0, - "diskMBpsReadOnly": 0, - "diskMBpsReadWrite": 0, - "diskSizeBytes": 0, - "diskSizeGB": 0, - "diskState": "str", - "encryption": {"diskEncryptionSetId": "str", "type": "str"}, - "encryptionSettingsCollection": { - "enabled": bool, - "encryptionSettings": [ - { - "diskEncryptionKey": {"secretUrl": "str", "sourceVault": {"id": "str"}}, - "keyEncryptionKey": {"keyUrl": "str", "sourceVault": {"id": "str"}}, - } - ], - "encryptionSettingsVersion": "str", - }, - "extendedLocation": {"name": "str", "type": "str"}, - "hyperVGeneration": "str", - "id": "str", - "managedBy": "str", - "managedByExtended": ["str"], - "maxShares": 0, - "name": "str", - "networkAccessPolicy": "str", - "optimizedForFrequentAttach": bool, - "osType": "str", - "propertyUpdatesInProgress": {"targetTier": "str"}, - "provisioningState": "str", - "publicNetworkAccess": "str", - "purchasePlan": {"name": "str", "product": "str", "publisher": "str", "promotionCode": "str"}, - "securityProfile": {"secureVMDiskEncryptionSetId": "str", "securityType": "str"}, - "shareInfo": [{"vmUri": "str"}], - "sku": {"name": "str", "tier": "str"}, - "supportedCapabilities": { - "acceleratedNetwork": bool, - "architecture": "str", - "diskControllerTypes": "str", - "supportedSecurityOption": "str", - }, - "supportsHibernation": bool, - "systemData": { - "createdAt": "2020-02-20 00:00:00", - "createdBy": "str", - "createdByType": "str", - "lastModifiedAt": "2020-02-20 00:00:00", - "lastModifiedBy": "str", - "lastModifiedByType": "str", - }, - "tags": {"str": "str"}, - "tier": "str", - "timeCreated": "2020-02-20 00:00:00", - "type": "str", - "uniqueId": "str", - "zones": ["str"], - }, - api_version="2025-01-02", - ).result() # call '.result()' to poll until service return final result - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_disks_begin_update(self, resource_group): - response = self.client.disks.begin_update( - resource_group_name=resource_group.name, - disk_name="str", - disk={ - "availabilityPolicy": {"actionOnDiskDelay": "str"}, - "burstingEnabled": bool, - "dataAccessAuthMode": "str", - "diskAccessId": "str", - "diskIOPSReadOnly": 0, - "diskIOPSReadWrite": 0, - "diskMBpsReadOnly": 0, - "diskMBpsReadWrite": 0, - "diskSizeGB": 0, - "encryption": {"diskEncryptionSetId": "str", "type": "str"}, - "encryptionSettingsCollection": { - "enabled": bool, - "encryptionSettings": [ - { - "diskEncryptionKey": {"secretUrl": "str", "sourceVault": {"id": "str"}}, - "keyEncryptionKey": {"keyUrl": "str", "sourceVault": {"id": "str"}}, - } - ], - "encryptionSettingsVersion": "str", - }, - "maxShares": 0, - "networkAccessPolicy": "str", - "optimizedForFrequentAttach": bool, - "osType": "str", - "propertyUpdatesInProgress": {"targetTier": "str"}, - "publicNetworkAccess": "str", - "purchasePlan": {"name": "str", "product": "str", "publisher": "str", "promotionCode": "str"}, - "sku": {"name": "str", "tier": "str"}, - "supportedCapabilities": { - "acceleratedNetwork": bool, - "architecture": "str", - "diskControllerTypes": "str", - "supportedSecurityOption": "str", - }, - "supportsHibernation": bool, - "tags": {"str": "str"}, - "tier": "str", - }, - api_version="2025-01-02", - ).result() # call '.result()' to poll until service return final result - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_disks_begin_delete(self, resource_group): - response = self.client.disks.begin_delete( - resource_group_name=resource_group.name, - disk_name="str", - api_version="2025-01-02", - ).result() # call '.result()' to poll until service return final result - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_disks_begin_grant_access(self, resource_group): - response = self.client.disks.begin_grant_access( - resource_group_name=resource_group.name, - disk_name="str", - grant_access_data={ - "access": "str", - "durationInSeconds": 0, - "fileFormat": "str", - "getSecureVMGuestStateSAS": bool, - }, - api_version="2025-01-02", - ).result() # call '.result()' to poll until service return final result - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_disks_begin_revoke_access(self, resource_group): - response = self.client.disks.begin_revoke_access( - resource_group_name=resource_group.name, - disk_name="str", - api_version="2025-01-02", - ).result() # call '.result()' to poll until service return final result - - # please add some check logic here by yourself - # ... diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_gallery_application_versions_operations.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_gallery_application_versions_operations.py deleted file mode 100644 index e123b60737b2..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_gallery_application_versions_operations.py +++ /dev/null @@ -1,253 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import pytest -from azure.mgmt.compute import ComputeManagementClient - -from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy - -AZURE_LOCATION = "eastus" - - -@pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestComputeManagementGalleryApplicationVersionsOperations(AzureMgmtRecordedTestCase): - def setup_method(self, method): - self.client = self.create_mgmt_client(ComputeManagementClient) - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_gallery_application_versions_list_by_gallery_application(self, resource_group): - response = self.client.gallery_application_versions.list_by_gallery_application( - resource_group_name=resource_group.name, - gallery_name="str", - gallery_application_name="str", - api_version="2024-03-03", - ) - result = [r for r in response] - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_gallery_application_versions_get(self, resource_group): - response = self.client.gallery_application_versions.get( - resource_group_name=resource_group.name, - gallery_name="str", - gallery_application_name="str", - gallery_application_version_name="str", - api_version="2024-03-03", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_gallery_application_versions_begin_create_or_update(self, resource_group): - response = self.client.gallery_application_versions.begin_create_or_update( - resource_group_name=resource_group.name, - gallery_name="str", - gallery_application_name="str", - gallery_application_version_name="str", - gallery_application_version={ - "location": "str", - "id": "str", - "name": "str", - "provisioningState": "str", - "publishingProfile": { - "source": {"mediaLink": "str", "defaultConfigurationLink": "str"}, - "advancedSettings": {"str": "str"}, - "customActions": [ - { - "name": "str", - "script": "str", - "description": "str", - "parameters": [ - { - "name": "str", - "defaultValue": "str", - "description": "str", - "required": bool, - "type": "str", - } - ], - } - ], - "enableHealthCheck": bool, - "endOfLifeDate": "2020-02-20 00:00:00", - "excludeFromLatest": bool, - "manageActions": {"install": "str", "remove": "str", "update": "str"}, - "publishedDate": "2020-02-20 00:00:00", - "replicaCount": 0, - "replicationMode": "str", - "settings": {"configFileName": "str", "packageFileName": "str", "scriptBehaviorAfterReboot": "str"}, - "storageAccountType": "str", - "targetExtendedLocations": [ - { - "encryption": { - "dataDiskImages": [{"lun": 0, "diskEncryptionSetId": "str"}], - "osDiskImage": { - "diskEncryptionSetId": "str", - "securityProfile": { - "confidentialVMEncryptionType": "str", - "secureVMDiskEncryptionSetId": "str", - }, - }, - }, - "extendedLocation": {"name": "str", "type": "str"}, - "extendedLocationReplicaCount": 0, - "name": "str", - "storageAccountType": "str", - } - ], - "targetRegions": [ - { - "name": "str", - "additionalReplicaSets": [{"regionalReplicaCount": 0, "storageAccountType": "str"}], - "encryption": { - "dataDiskImages": [{"lun": 0, "diskEncryptionSetId": "str"}], - "osDiskImage": { - "diskEncryptionSetId": "str", - "securityProfile": { - "confidentialVMEncryptionType": "str", - "secureVMDiskEncryptionSetId": "str", - }, - }, - }, - "excludeFromLatest": bool, - "regionalReplicaCount": 0, - "storageAccountType": "str", - } - ], - }, - "replicationStatus": { - "aggregatedState": "str", - "summary": [{"details": "str", "progress": 0, "region": "str", "state": "str"}], - }, - "safetyProfile": {"allowDeletionOfReplicatedLocations": bool}, - "systemData": { - "createdAt": "2020-02-20 00:00:00", - "createdBy": "str", - "createdByType": "str", - "lastModifiedAt": "2020-02-20 00:00:00", - "lastModifiedBy": "str", - "lastModifiedByType": "str", - }, - "tags": {"str": "str"}, - "type": "str", - }, - api_version="2024-03-03", - ).result() # call '.result()' to poll until service return final result - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_gallery_application_versions_begin_update(self, resource_group): - response = self.client.gallery_application_versions.begin_update( - resource_group_name=resource_group.name, - gallery_name="str", - gallery_application_name="str", - gallery_application_version_name="str", - gallery_application_version={ - "id": "str", - "name": "str", - "provisioningState": "str", - "publishingProfile": { - "source": {"mediaLink": "str", "defaultConfigurationLink": "str"}, - "advancedSettings": {"str": "str"}, - "customActions": [ - { - "name": "str", - "script": "str", - "description": "str", - "parameters": [ - { - "name": "str", - "defaultValue": "str", - "description": "str", - "required": bool, - "type": "str", - } - ], - } - ], - "enableHealthCheck": bool, - "endOfLifeDate": "2020-02-20 00:00:00", - "excludeFromLatest": bool, - "manageActions": {"install": "str", "remove": "str", "update": "str"}, - "publishedDate": "2020-02-20 00:00:00", - "replicaCount": 0, - "replicationMode": "str", - "settings": {"configFileName": "str", "packageFileName": "str", "scriptBehaviorAfterReboot": "str"}, - "storageAccountType": "str", - "targetExtendedLocations": [ - { - "encryption": { - "dataDiskImages": [{"lun": 0, "diskEncryptionSetId": "str"}], - "osDiskImage": { - "diskEncryptionSetId": "str", - "securityProfile": { - "confidentialVMEncryptionType": "str", - "secureVMDiskEncryptionSetId": "str", - }, - }, - }, - "extendedLocation": {"name": "str", "type": "str"}, - "extendedLocationReplicaCount": 0, - "name": "str", - "storageAccountType": "str", - } - ], - "targetRegions": [ - { - "name": "str", - "additionalReplicaSets": [{"regionalReplicaCount": 0, "storageAccountType": "str"}], - "encryption": { - "dataDiskImages": [{"lun": 0, "diskEncryptionSetId": "str"}], - "osDiskImage": { - "diskEncryptionSetId": "str", - "securityProfile": { - "confidentialVMEncryptionType": "str", - "secureVMDiskEncryptionSetId": "str", - }, - }, - }, - "excludeFromLatest": bool, - "regionalReplicaCount": 0, - "storageAccountType": "str", - } - ], - }, - "replicationStatus": { - "aggregatedState": "str", - "summary": [{"details": "str", "progress": 0, "region": "str", "state": "str"}], - }, - "safetyProfile": {"allowDeletionOfReplicatedLocations": bool}, - "tags": {"str": "str"}, - "type": "str", - }, - api_version="2024-03-03", - ).result() # call '.result()' to poll until service return final result - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_gallery_application_versions_begin_delete(self, resource_group): - response = self.client.gallery_application_versions.begin_delete( - resource_group_name=resource_group.name, - gallery_name="str", - gallery_application_name="str", - gallery_application_version_name="str", - api_version="2024-03-03", - ).result() # call '.result()' to poll until service return final result - - # please add some check logic here by yourself - # ... diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_gallery_image_versions_operations.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_gallery_image_versions_operations.py deleted file mode 100644 index a15b7f907c55..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_gallery_image_versions_operations.py +++ /dev/null @@ -1,291 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import pytest -from azure.mgmt.compute import ComputeManagementClient - -from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy - -AZURE_LOCATION = "eastus" - - -@pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestComputeManagementGalleryImageVersionsOperations(AzureMgmtRecordedTestCase): - def setup_method(self, method): - self.client = self.create_mgmt_client(ComputeManagementClient) - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_gallery_image_versions_list_by_gallery_image(self, resource_group): - response = self.client.gallery_image_versions.list_by_gallery_image( - resource_group_name=resource_group.name, - gallery_name="str", - gallery_image_name="str", - api_version="2024-03-03", - ) - result = [r for r in response] - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_gallery_image_versions_get(self, resource_group): - response = self.client.gallery_image_versions.get( - resource_group_name=resource_group.name, - gallery_name="str", - gallery_image_name="str", - gallery_image_version_name="str", - api_version="2024-03-03", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_gallery_image_versions_begin_create_or_update(self, resource_group): - response = self.client.gallery_image_versions.begin_create_or_update( - resource_group_name=resource_group.name, - gallery_name="str", - gallery_image_name="str", - gallery_image_version_name="str", - gallery_image_version={ - "location": "str", - "id": "str", - "name": "str", - "provisioningState": "str", - "publishingProfile": { - "endOfLifeDate": "2020-02-20 00:00:00", - "excludeFromLatest": bool, - "publishedDate": "2020-02-20 00:00:00", - "replicaCount": 0, - "replicationMode": "str", - "storageAccountType": "str", - "targetExtendedLocations": [ - { - "encryption": { - "dataDiskImages": [{"lun": 0, "diskEncryptionSetId": "str"}], - "osDiskImage": { - "diskEncryptionSetId": "str", - "securityProfile": { - "confidentialVMEncryptionType": "str", - "secureVMDiskEncryptionSetId": "str", - }, - }, - }, - "extendedLocation": {"name": "str", "type": "str"}, - "extendedLocationReplicaCount": 0, - "name": "str", - "storageAccountType": "str", - } - ], - "targetRegions": [ - { - "name": "str", - "additionalReplicaSets": [{"regionalReplicaCount": 0, "storageAccountType": "str"}], - "encryption": { - "dataDiskImages": [{"lun": 0, "diskEncryptionSetId": "str"}], - "osDiskImage": { - "diskEncryptionSetId": "str", - "securityProfile": { - "confidentialVMEncryptionType": "str", - "secureVMDiskEncryptionSetId": "str", - }, - }, - }, - "excludeFromLatest": bool, - "regionalReplicaCount": 0, - "storageAccountType": "str", - } - ], - }, - "replicationStatus": { - "aggregatedState": "str", - "summary": [{"details": "str", "progress": 0, "region": "str", "state": "str"}], - }, - "restore": bool, - "safetyProfile": { - "allowDeletionOfReplicatedLocations": bool, - "blockDeletionBeforeEndOfLife": bool, - "policyViolations": [{"category": "str", "details": "str"}], - "reportedForPolicyViolation": bool, - }, - "securityProfile": { - "uefiSettings": { - "additionalSignatures": { - "db": [{"type": "str", "value": ["str"]}], - "dbx": [{"type": "str", "value": ["str"]}], - "kek": [{"type": "str", "value": ["str"]}], - "pk": {"type": "str", "value": ["str"]}, - }, - "signatureTemplateNames": ["str"], - } - }, - "storageProfile": { - "dataDiskImages": [ - { - "lun": 0, - "hostCaching": "str", - "sizeInGB": 0, - "source": {"id": "str", "storageAccountId": "str", "uri": "str"}, - } - ], - "osDiskImage": { - "hostCaching": "str", - "sizeInGB": 0, - "source": {"id": "str", "storageAccountId": "str", "uri": "str"}, - }, - "source": {"communityGalleryImageId": "str", "id": "str", "virtualMachineId": "str"}, - }, - "systemData": { - "createdAt": "2020-02-20 00:00:00", - "createdBy": "str", - "createdByType": "str", - "lastModifiedAt": "2020-02-20 00:00:00", - "lastModifiedBy": "str", - "lastModifiedByType": "str", - }, - "tags": {"str": "str"}, - "type": "str", - "validationsProfile": { - "executedValidations": [ - {"executionTime": "2020-02-20 00:00:00", "status": "str", "type": "str", "version": "str"} - ], - "platformAttributes": [{"name": "str", "value": "str"}], - "validationEtag": "str", - }, - }, - api_version="2024-03-03", - ).result() # call '.result()' to poll until service return final result - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_gallery_image_versions_begin_update(self, resource_group): - response = self.client.gallery_image_versions.begin_update( - resource_group_name=resource_group.name, - gallery_name="str", - gallery_image_name="str", - gallery_image_version_name="str", - gallery_image_version={ - "id": "str", - "name": "str", - "provisioningState": "str", - "publishingProfile": { - "endOfLifeDate": "2020-02-20 00:00:00", - "excludeFromLatest": bool, - "publishedDate": "2020-02-20 00:00:00", - "replicaCount": 0, - "replicationMode": "str", - "storageAccountType": "str", - "targetExtendedLocations": [ - { - "encryption": { - "dataDiskImages": [{"lun": 0, "diskEncryptionSetId": "str"}], - "osDiskImage": { - "diskEncryptionSetId": "str", - "securityProfile": { - "confidentialVMEncryptionType": "str", - "secureVMDiskEncryptionSetId": "str", - }, - }, - }, - "extendedLocation": {"name": "str", "type": "str"}, - "extendedLocationReplicaCount": 0, - "name": "str", - "storageAccountType": "str", - } - ], - "targetRegions": [ - { - "name": "str", - "additionalReplicaSets": [{"regionalReplicaCount": 0, "storageAccountType": "str"}], - "encryption": { - "dataDiskImages": [{"lun": 0, "diskEncryptionSetId": "str"}], - "osDiskImage": { - "diskEncryptionSetId": "str", - "securityProfile": { - "confidentialVMEncryptionType": "str", - "secureVMDiskEncryptionSetId": "str", - }, - }, - }, - "excludeFromLatest": bool, - "regionalReplicaCount": 0, - "storageAccountType": "str", - } - ], - }, - "replicationStatus": { - "aggregatedState": "str", - "summary": [{"details": "str", "progress": 0, "region": "str", "state": "str"}], - }, - "restore": bool, - "safetyProfile": { - "allowDeletionOfReplicatedLocations": bool, - "blockDeletionBeforeEndOfLife": bool, - "policyViolations": [{"category": "str", "details": "str"}], - "reportedForPolicyViolation": bool, - }, - "securityProfile": { - "uefiSettings": { - "additionalSignatures": { - "db": [{"type": "str", "value": ["str"]}], - "dbx": [{"type": "str", "value": ["str"]}], - "kek": [{"type": "str", "value": ["str"]}], - "pk": {"type": "str", "value": ["str"]}, - }, - "signatureTemplateNames": ["str"], - } - }, - "storageProfile": { - "dataDiskImages": [ - { - "lun": 0, - "hostCaching": "str", - "sizeInGB": 0, - "source": {"id": "str", "storageAccountId": "str", "uri": "str"}, - } - ], - "osDiskImage": { - "hostCaching": "str", - "sizeInGB": 0, - "source": {"id": "str", "storageAccountId": "str", "uri": "str"}, - }, - "source": {"communityGalleryImageId": "str", "id": "str", "virtualMachineId": "str"}, - }, - "tags": {"str": "str"}, - "type": "str", - "validationsProfile": { - "executedValidations": [ - {"executionTime": "2020-02-20 00:00:00", "status": "str", "type": "str", "version": "str"} - ], - "platformAttributes": [{"name": "str", "value": "str"}], - "validationEtag": "str", - }, - }, - api_version="2024-03-03", - ).result() # call '.result()' to poll until service return final result - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_gallery_image_versions_begin_delete(self, resource_group): - response = self.client.gallery_image_versions.begin_delete( - resource_group_name=resource_group.name, - gallery_name="str", - gallery_image_name="str", - gallery_image_version_name="str", - api_version="2024-03-03", - ).result() # call '.result()' to poll until service return final result - - # please add some check logic here by yourself - # ... diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_gallery_in_vm_access_control_profile_versions_operations.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_gallery_in_vm_access_control_profile_versions_operations.py deleted file mode 100644 index dd7bc3f2c426..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_gallery_in_vm_access_control_profile_versions_operations.py +++ /dev/null @@ -1,185 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import pytest -from azure.mgmt.compute import ComputeManagementClient - -from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy - -AZURE_LOCATION = "eastus" - - -@pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestComputeManagementGalleryInVMAccessControlProfileVersionsOperations(AzureMgmtRecordedTestCase): - def setup_method(self, method): - self.client = self.create_mgmt_client(ComputeManagementClient) - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_gallery_in_vm_access_control_profile_versions_list_by_gallery_in_vm_access_control_profile( - self, resource_group - ): - response = ( - self.client.gallery_in_vm_access_control_profile_versions.list_by_gallery_in_vm_access_control_profile( - resource_group_name=resource_group.name, - gallery_name="str", - in_vm_access_control_profile_name="str", - api_version="2024-03-03", - ) - ) - result = [r for r in response] - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_gallery_in_vm_access_control_profile_versions_get(self, resource_group): - response = self.client.gallery_in_vm_access_control_profile_versions.get( - resource_group_name=resource_group.name, - gallery_name="str", - in_vm_access_control_profile_name="str", - in_vm_access_control_profile_version_name="str", - api_version="2024-03-03", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_gallery_in_vm_access_control_profile_versions_begin_create_or_update(self, resource_group): - response = self.client.gallery_in_vm_access_control_profile_versions.begin_create_or_update( - resource_group_name=resource_group.name, - gallery_name="str", - in_vm_access_control_profile_name="str", - in_vm_access_control_profile_version_name="str", - gallery_in_vm_access_control_profile_version={ - "location": "str", - "defaultAccess": "str", - "excludeFromLatest": bool, - "id": "str", - "mode": "str", - "name": "str", - "provisioningState": "str", - "publishedDate": "2020-02-20 00:00:00", - "replicationStatus": { - "aggregatedState": "str", - "summary": [{"details": "str", "progress": 0, "region": "str", "state": "str"}], - }, - "rules": { - "identities": [ - {"name": "str", "exePath": "str", "groupName": "str", "processName": "str", "userName": "str"} - ], - "privileges": [{"name": "str", "path": "str", "queryParameters": {"str": "str"}}], - "roleAssignments": [{"identities": ["str"], "role": "str"}], - "roles": [{"name": "str", "privileges": ["str"]}], - }, - "systemData": { - "createdAt": "2020-02-20 00:00:00", - "createdBy": "str", - "createdByType": "str", - "lastModifiedAt": "2020-02-20 00:00:00", - "lastModifiedBy": "str", - "lastModifiedByType": "str", - }, - "tags": {"str": "str"}, - "targetLocations": [ - { - "name": "str", - "additionalReplicaSets": [{"regionalReplicaCount": 0, "storageAccountType": "str"}], - "encryption": { - "dataDiskImages": [{"lun": 0, "diskEncryptionSetId": "str"}], - "osDiskImage": { - "diskEncryptionSetId": "str", - "securityProfile": { - "confidentialVMEncryptionType": "str", - "secureVMDiskEncryptionSetId": "str", - }, - }, - }, - "excludeFromLatest": bool, - "regionalReplicaCount": 0, - "storageAccountType": "str", - } - ], - "type": "str", - }, - api_version="2024-03-03", - ).result() # call '.result()' to poll until service return final result - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_gallery_in_vm_access_control_profile_versions_begin_update(self, resource_group): - response = self.client.gallery_in_vm_access_control_profile_versions.begin_update( - resource_group_name=resource_group.name, - gallery_name="str", - in_vm_access_control_profile_name="str", - in_vm_access_control_profile_version_name="str", - gallery_in_vm_access_control_profile_version={ - "defaultAccess": "str", - "excludeFromLatest": bool, - "id": "str", - "mode": "str", - "name": "str", - "provisioningState": "str", - "publishedDate": "2020-02-20 00:00:00", - "replicationStatus": { - "aggregatedState": "str", - "summary": [{"details": "str", "progress": 0, "region": "str", "state": "str"}], - }, - "rules": { - "identities": [ - {"name": "str", "exePath": "str", "groupName": "str", "processName": "str", "userName": "str"} - ], - "privileges": [{"name": "str", "path": "str", "queryParameters": {"str": "str"}}], - "roleAssignments": [{"identities": ["str"], "role": "str"}], - "roles": [{"name": "str", "privileges": ["str"]}], - }, - "tags": {"str": "str"}, - "targetLocations": [ - { - "name": "str", - "additionalReplicaSets": [{"regionalReplicaCount": 0, "storageAccountType": "str"}], - "encryption": { - "dataDiskImages": [{"lun": 0, "diskEncryptionSetId": "str"}], - "osDiskImage": { - "diskEncryptionSetId": "str", - "securityProfile": { - "confidentialVMEncryptionType": "str", - "secureVMDiskEncryptionSetId": "str", - }, - }, - }, - "excludeFromLatest": bool, - "regionalReplicaCount": 0, - "storageAccountType": "str", - } - ], - "type": "str", - }, - api_version="2024-03-03", - ).result() # call '.result()' to poll until service return final result - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_gallery_in_vm_access_control_profile_versions_begin_delete(self, resource_group): - response = self.client.gallery_in_vm_access_control_profile_versions.begin_delete( - resource_group_name=resource_group.name, - gallery_name="str", - in_vm_access_control_profile_name="str", - in_vm_access_control_profile_version_name="str", - api_version="2024-03-03", - ).result() # call '.result()' to poll until service return final result - - # please add some check logic here by yourself - # ... diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_gallery_sharing_profile_operations.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_gallery_sharing_profile_operations.py deleted file mode 100644 index 95b76dbe528e..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_gallery_sharing_profile_operations.py +++ /dev/null @@ -1,32 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import pytest -from azure.mgmt.compute import ComputeManagementClient - -from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy - -AZURE_LOCATION = "eastus" - - -@pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestComputeManagementGallerySharingProfileOperations(AzureMgmtRecordedTestCase): - def setup_method(self, method): - self.client = self.create_mgmt_client(ComputeManagementClient) - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_gallery_sharing_profile_begin_update(self, resource_group): - response = self.client.gallery_sharing_profile.begin_update( - resource_group_name=resource_group.name, - gallery_name="str", - sharing_update={"operationType": "str", "groups": [{"ids": ["str"], "type": "str"}]}, - api_version="2024-03-03", - ).result() # call '.result()' to poll until service return final result - - # please add some check logic here by yourself - # ... diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_gallery_sharing_profile_operations_async.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_gallery_sharing_profile_operations_async.py deleted file mode 100644 index 99bdd2593629..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_gallery_sharing_profile_operations_async.py +++ /dev/null @@ -1,35 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import pytest -from azure.mgmt.compute.aio import ComputeManagementClient - -from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer -from devtools_testutils.aio import recorded_by_proxy_async - -AZURE_LOCATION = "eastus" - - -@pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestComputeManagementGallerySharingProfileOperationsAsync(AzureMgmtRecordedTestCase): - def setup_method(self, method): - self.client = self.create_mgmt_client(ComputeManagementClient, is_async=True) - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_gallery_sharing_profile_begin_update(self, resource_group): - response = await ( - await self.client.gallery_sharing_profile.begin_update( - resource_group_name=resource_group.name, - gallery_name="str", - sharing_update={"operationType": "str", "groups": [{"ids": ["str"], "type": "str"}]}, - api_version="2024-03-03", - ) - ).result() # call '.result()' to poll until service return final result - - # please add some check logic here by yourself - # ... diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_restore_point_collections_operations.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_restore_point_collections_operations.py deleted file mode 100644 index 6a2bca76735c..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_restore_point_collections_operations.py +++ /dev/null @@ -1,464 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import pytest -from azure.mgmt.compute import ComputeManagementClient - -from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy - -AZURE_LOCATION = "eastus" - - -@pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestComputeManagementRestorePointCollectionsOperations(AzureMgmtRecordedTestCase): - def setup_method(self, method): - self.client = self.create_mgmt_client(ComputeManagementClient) - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_restore_point_collections_list_all(self, resource_group): - response = self.client.restore_point_collections.list_all( - api_version="2025-04-01", - ) - result = [r for r in response] - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_restore_point_collections_list(self, resource_group): - response = self.client.restore_point_collections.list( - resource_group_name=resource_group.name, - api_version="2025-04-01", - ) - result = [r for r in response] - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_restore_point_collections_get(self, resource_group): - response = self.client.restore_point_collections.get( - resource_group_name=resource_group.name, - restore_point_collection_name="str", - api_version="2025-04-01", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_restore_point_collections_create_or_update(self, resource_group): - response = self.client.restore_point_collections.create_or_update( - resource_group_name=resource_group.name, - restore_point_collection_name="str", - parameters={ - "location": "str", - "id": "str", - "name": "str", - "provisioningState": "str", - "restorePointCollectionId": "str", - "restorePoints": [ - { - "consistencyMode": "str", - "excludeDisks": [{"id": "str"}], - "id": "str", - "instanceView": { - "diskRestorePoints": [ - { - "id": "str", - "replicationStatus": { - "completionPercent": 0, - "status": { - "code": "str", - "displayStatus": "str", - "level": "str", - "message": "str", - "time": "2020-02-20 00:00:00", - }, - }, - } - ], - "statuses": [ - { - "code": "str", - "displayStatus": "str", - "level": "str", - "message": "str", - "time": "2020-02-20 00:00:00", - } - ], - }, - "name": "str", - "provisioningState": "str", - "sourceMetadata": { - "diagnosticsProfile": {"bootDiagnostics": {"enabled": bool, "storageUri": "str"}}, - "hardwareProfile": { - "vmSize": "str", - "vmSizeProperties": {"vCPUsAvailable": 0, "vCPUsPerCore": 0}, - }, - "hyperVGeneration": "str", - "licenseType": "str", - "location": "str", - "osProfile": { - "adminPassword": "str", - "adminUsername": "str", - "allowExtensionOperations": bool, - "computerName": "str", - "customData": "str", - "linuxConfiguration": { - "disablePasswordAuthentication": bool, - "enableVMAgentPlatformUpdates": bool, - "patchSettings": { - "assessmentMode": "str", - "automaticByPlatformSettings": { - "bypassPlatformSafetyChecksOnUserSchedule": bool, - "rebootSetting": "str", - }, - "patchMode": "str", - }, - "provisionVMAgent": bool, - "ssh": {"publicKeys": [{"keyData": "str", "path": "str"}]}, - }, - "requireGuestProvisionSignal": bool, - "secrets": [ - { - "sourceVault": {"id": "str"}, - "vaultCertificates": [{"certificateStore": "str", "certificateUrl": "str"}], - } - ], - "windowsConfiguration": { - "additionalUnattendContent": [ - { - "componentName": "Microsoft-Windows-Shell-Setup", - "content": "str", - "passName": "OobeSystem", - "settingName": "str", - } - ], - "enableAutomaticUpdates": bool, - "enableVMAgentPlatformUpdates": bool, - "patchSettings": { - "assessmentMode": "str", - "automaticByPlatformSettings": { - "bypassPlatformSafetyChecksOnUserSchedule": bool, - "rebootSetting": "str", - }, - "enableHotpatching": bool, - "patchMode": "str", - }, - "provisionVMAgent": bool, - "timeZone": "str", - "winRM": {"listeners": [{"certificateUrl": "str", "protocol": "str"}]}, - }, - }, - "securityProfile": { - "encryptionAtHost": bool, - "encryptionIdentity": {"userAssignedIdentityResourceId": "str"}, - "proxyAgentSettings": { - "addProxyAgentExtension": bool, - "enabled": bool, - "imds": {"inVMAccessControlProfileReferenceId": "str", "mode": "str"}, - "keyIncarnationId": 0, - "mode": "str", - "wireServer": {"inVMAccessControlProfileReferenceId": "str", "mode": "str"}, - }, - "securityType": "str", - "uefiSettings": {"secureBootEnabled": bool, "vTpmEnabled": bool}, - }, - "storageProfile": { - "dataDisks": [ - { - "caching": "str", - "diskRestorePoint": { - "encryption": {"diskEncryptionSet": {"id": "str"}, "type": "str"}, - "id": "str", - "sourceDiskRestorePoint": {"id": "str"}, - }, - "diskSizeGB": 0, - "lun": 0, - "managedDisk": { - "diskEncryptionSet": {"id": "str"}, - "id": "str", - "securityProfile": { - "diskEncryptionSet": {"id": "str"}, - "securityEncryptionType": "str", - }, - "storageAccountType": "str", - }, - "name": "str", - "writeAcceleratorEnabled": bool, - } - ], - "diskControllerType": "str", - "osDisk": { - "caching": "str", - "diskRestorePoint": { - "encryption": {"diskEncryptionSet": {"id": "str"}, "type": "str"}, - "id": "str", - "sourceDiskRestorePoint": {"id": "str"}, - }, - "diskSizeGB": 0, - "encryptionSettings": { - "diskEncryptionKey": {"secretUrl": "str", "sourceVault": {"id": "str"}}, - "enabled": bool, - "keyEncryptionKey": {"keyUrl": "str", "sourceVault": {"id": "str"}}, - }, - "managedDisk": { - "diskEncryptionSet": {"id": "str"}, - "id": "str", - "securityProfile": { - "diskEncryptionSet": {"id": "str"}, - "securityEncryptionType": "str", - }, - "storageAccountType": "str", - }, - "name": "str", - "osType": "str", - "writeAcceleratorEnabled": bool, - }, - }, - "userData": "str", - "vmId": "str", - }, - "sourceRestorePoint": {"id": "str"}, - "systemData": { - "createdAt": "2020-02-20 00:00:00", - "createdBy": "str", - "createdByType": "str", - "lastModifiedAt": "2020-02-20 00:00:00", - "lastModifiedBy": "str", - "lastModifiedByType": "str", - }, - "timeCreated": "2020-02-20 00:00:00", - "type": "str", - } - ], - "source": {"id": "str", "location": "str"}, - "systemData": { - "createdAt": "2020-02-20 00:00:00", - "createdBy": "str", - "createdByType": "str", - "lastModifiedAt": "2020-02-20 00:00:00", - "lastModifiedBy": "str", - "lastModifiedByType": "str", - }, - "tags": {"str": "str"}, - "type": "str", - }, - api_version="2025-04-01", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_restore_point_collections_update(self, resource_group): - response = self.client.restore_point_collections.update( - resource_group_name=resource_group.name, - restore_point_collection_name="str", - parameters={ - "provisioningState": "str", - "restorePointCollectionId": "str", - "restorePoints": [ - { - "consistencyMode": "str", - "excludeDisks": [{"id": "str"}], - "id": "str", - "instanceView": { - "diskRestorePoints": [ - { - "id": "str", - "replicationStatus": { - "completionPercent": 0, - "status": { - "code": "str", - "displayStatus": "str", - "level": "str", - "message": "str", - "time": "2020-02-20 00:00:00", - }, - }, - } - ], - "statuses": [ - { - "code": "str", - "displayStatus": "str", - "level": "str", - "message": "str", - "time": "2020-02-20 00:00:00", - } - ], - }, - "name": "str", - "provisioningState": "str", - "sourceMetadata": { - "diagnosticsProfile": {"bootDiagnostics": {"enabled": bool, "storageUri": "str"}}, - "hardwareProfile": { - "vmSize": "str", - "vmSizeProperties": {"vCPUsAvailable": 0, "vCPUsPerCore": 0}, - }, - "hyperVGeneration": "str", - "licenseType": "str", - "location": "str", - "osProfile": { - "adminPassword": "str", - "adminUsername": "str", - "allowExtensionOperations": bool, - "computerName": "str", - "customData": "str", - "linuxConfiguration": { - "disablePasswordAuthentication": bool, - "enableVMAgentPlatformUpdates": bool, - "patchSettings": { - "assessmentMode": "str", - "automaticByPlatformSettings": { - "bypassPlatformSafetyChecksOnUserSchedule": bool, - "rebootSetting": "str", - }, - "patchMode": "str", - }, - "provisionVMAgent": bool, - "ssh": {"publicKeys": [{"keyData": "str", "path": "str"}]}, - }, - "requireGuestProvisionSignal": bool, - "secrets": [ - { - "sourceVault": {"id": "str"}, - "vaultCertificates": [{"certificateStore": "str", "certificateUrl": "str"}], - } - ], - "windowsConfiguration": { - "additionalUnattendContent": [ - { - "componentName": "Microsoft-Windows-Shell-Setup", - "content": "str", - "passName": "OobeSystem", - "settingName": "str", - } - ], - "enableAutomaticUpdates": bool, - "enableVMAgentPlatformUpdates": bool, - "patchSettings": { - "assessmentMode": "str", - "automaticByPlatformSettings": { - "bypassPlatformSafetyChecksOnUserSchedule": bool, - "rebootSetting": "str", - }, - "enableHotpatching": bool, - "patchMode": "str", - }, - "provisionVMAgent": bool, - "timeZone": "str", - "winRM": {"listeners": [{"certificateUrl": "str", "protocol": "str"}]}, - }, - }, - "securityProfile": { - "encryptionAtHost": bool, - "encryptionIdentity": {"userAssignedIdentityResourceId": "str"}, - "proxyAgentSettings": { - "addProxyAgentExtension": bool, - "enabled": bool, - "imds": {"inVMAccessControlProfileReferenceId": "str", "mode": "str"}, - "keyIncarnationId": 0, - "mode": "str", - "wireServer": {"inVMAccessControlProfileReferenceId": "str", "mode": "str"}, - }, - "securityType": "str", - "uefiSettings": {"secureBootEnabled": bool, "vTpmEnabled": bool}, - }, - "storageProfile": { - "dataDisks": [ - { - "caching": "str", - "diskRestorePoint": { - "encryption": {"diskEncryptionSet": {"id": "str"}, "type": "str"}, - "id": "str", - "sourceDiskRestorePoint": {"id": "str"}, - }, - "diskSizeGB": 0, - "lun": 0, - "managedDisk": { - "diskEncryptionSet": {"id": "str"}, - "id": "str", - "securityProfile": { - "diskEncryptionSet": {"id": "str"}, - "securityEncryptionType": "str", - }, - "storageAccountType": "str", - }, - "name": "str", - "writeAcceleratorEnabled": bool, - } - ], - "diskControllerType": "str", - "osDisk": { - "caching": "str", - "diskRestorePoint": { - "encryption": {"diskEncryptionSet": {"id": "str"}, "type": "str"}, - "id": "str", - "sourceDiskRestorePoint": {"id": "str"}, - }, - "diskSizeGB": 0, - "encryptionSettings": { - "diskEncryptionKey": {"secretUrl": "str", "sourceVault": {"id": "str"}}, - "enabled": bool, - "keyEncryptionKey": {"keyUrl": "str", "sourceVault": {"id": "str"}}, - }, - "managedDisk": { - "diskEncryptionSet": {"id": "str"}, - "id": "str", - "securityProfile": { - "diskEncryptionSet": {"id": "str"}, - "securityEncryptionType": "str", - }, - "storageAccountType": "str", - }, - "name": "str", - "osType": "str", - "writeAcceleratorEnabled": bool, - }, - }, - "userData": "str", - "vmId": "str", - }, - "sourceRestorePoint": {"id": "str"}, - "systemData": { - "createdAt": "2020-02-20 00:00:00", - "createdBy": "str", - "createdByType": "str", - "lastModifiedAt": "2020-02-20 00:00:00", - "lastModifiedBy": "str", - "lastModifiedByType": "str", - }, - "timeCreated": "2020-02-20 00:00:00", - "type": "str", - } - ], - "source": {"id": "str", "location": "str"}, - "tags": {"str": "str"}, - }, - api_version="2025-04-01", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_restore_point_collections_begin_delete(self, resource_group): - response = self.client.restore_point_collections.begin_delete( - resource_group_name=resource_group.name, - restore_point_collection_name="str", - api_version="2025-04-01", - ).result() # call '.result()' to poll until service return final result - - # please add some check logic here by yourself - # ... diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_restore_point_collections_operations_async.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_restore_point_collections_operations_async.py deleted file mode 100644 index 6ff7103f15bc..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_restore_point_collections_operations_async.py +++ /dev/null @@ -1,467 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import pytest -from azure.mgmt.compute.aio import ComputeManagementClient - -from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer -from devtools_testutils.aio import recorded_by_proxy_async - -AZURE_LOCATION = "eastus" - - -@pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestComputeManagementRestorePointCollectionsOperationsAsync(AzureMgmtRecordedTestCase): - def setup_method(self, method): - self.client = self.create_mgmt_client(ComputeManagementClient, is_async=True) - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_restore_point_collections_list_all(self, resource_group): - response = self.client.restore_point_collections.list_all( - api_version="2025-04-01", - ) - result = [r async for r in response] - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_restore_point_collections_list(self, resource_group): - response = self.client.restore_point_collections.list( - resource_group_name=resource_group.name, - api_version="2025-04-01", - ) - result = [r async for r in response] - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_restore_point_collections_get(self, resource_group): - response = await self.client.restore_point_collections.get( - resource_group_name=resource_group.name, - restore_point_collection_name="str", - api_version="2025-04-01", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_restore_point_collections_create_or_update(self, resource_group): - response = await self.client.restore_point_collections.create_or_update( - resource_group_name=resource_group.name, - restore_point_collection_name="str", - parameters={ - "location": "str", - "id": "str", - "name": "str", - "provisioningState": "str", - "restorePointCollectionId": "str", - "restorePoints": [ - { - "consistencyMode": "str", - "excludeDisks": [{"id": "str"}], - "id": "str", - "instanceView": { - "diskRestorePoints": [ - { - "id": "str", - "replicationStatus": { - "completionPercent": 0, - "status": { - "code": "str", - "displayStatus": "str", - "level": "str", - "message": "str", - "time": "2020-02-20 00:00:00", - }, - }, - } - ], - "statuses": [ - { - "code": "str", - "displayStatus": "str", - "level": "str", - "message": "str", - "time": "2020-02-20 00:00:00", - } - ], - }, - "name": "str", - "provisioningState": "str", - "sourceMetadata": { - "diagnosticsProfile": {"bootDiagnostics": {"enabled": bool, "storageUri": "str"}}, - "hardwareProfile": { - "vmSize": "str", - "vmSizeProperties": {"vCPUsAvailable": 0, "vCPUsPerCore": 0}, - }, - "hyperVGeneration": "str", - "licenseType": "str", - "location": "str", - "osProfile": { - "adminPassword": "str", - "adminUsername": "str", - "allowExtensionOperations": bool, - "computerName": "str", - "customData": "str", - "linuxConfiguration": { - "disablePasswordAuthentication": bool, - "enableVMAgentPlatformUpdates": bool, - "patchSettings": { - "assessmentMode": "str", - "automaticByPlatformSettings": { - "bypassPlatformSafetyChecksOnUserSchedule": bool, - "rebootSetting": "str", - }, - "patchMode": "str", - }, - "provisionVMAgent": bool, - "ssh": {"publicKeys": [{"keyData": "str", "path": "str"}]}, - }, - "requireGuestProvisionSignal": bool, - "secrets": [ - { - "sourceVault": {"id": "str"}, - "vaultCertificates": [{"certificateStore": "str", "certificateUrl": "str"}], - } - ], - "windowsConfiguration": { - "additionalUnattendContent": [ - { - "componentName": "Microsoft-Windows-Shell-Setup", - "content": "str", - "passName": "OobeSystem", - "settingName": "str", - } - ], - "enableAutomaticUpdates": bool, - "enableVMAgentPlatformUpdates": bool, - "patchSettings": { - "assessmentMode": "str", - "automaticByPlatformSettings": { - "bypassPlatformSafetyChecksOnUserSchedule": bool, - "rebootSetting": "str", - }, - "enableHotpatching": bool, - "patchMode": "str", - }, - "provisionVMAgent": bool, - "timeZone": "str", - "winRM": {"listeners": [{"certificateUrl": "str", "protocol": "str"}]}, - }, - }, - "securityProfile": { - "encryptionAtHost": bool, - "encryptionIdentity": {"userAssignedIdentityResourceId": "str"}, - "proxyAgentSettings": { - "addProxyAgentExtension": bool, - "enabled": bool, - "imds": {"inVMAccessControlProfileReferenceId": "str", "mode": "str"}, - "keyIncarnationId": 0, - "mode": "str", - "wireServer": {"inVMAccessControlProfileReferenceId": "str", "mode": "str"}, - }, - "securityType": "str", - "uefiSettings": {"secureBootEnabled": bool, "vTpmEnabled": bool}, - }, - "storageProfile": { - "dataDisks": [ - { - "caching": "str", - "diskRestorePoint": { - "encryption": {"diskEncryptionSet": {"id": "str"}, "type": "str"}, - "id": "str", - "sourceDiskRestorePoint": {"id": "str"}, - }, - "diskSizeGB": 0, - "lun": 0, - "managedDisk": { - "diskEncryptionSet": {"id": "str"}, - "id": "str", - "securityProfile": { - "diskEncryptionSet": {"id": "str"}, - "securityEncryptionType": "str", - }, - "storageAccountType": "str", - }, - "name": "str", - "writeAcceleratorEnabled": bool, - } - ], - "diskControllerType": "str", - "osDisk": { - "caching": "str", - "diskRestorePoint": { - "encryption": {"diskEncryptionSet": {"id": "str"}, "type": "str"}, - "id": "str", - "sourceDiskRestorePoint": {"id": "str"}, - }, - "diskSizeGB": 0, - "encryptionSettings": { - "diskEncryptionKey": {"secretUrl": "str", "sourceVault": {"id": "str"}}, - "enabled": bool, - "keyEncryptionKey": {"keyUrl": "str", "sourceVault": {"id": "str"}}, - }, - "managedDisk": { - "diskEncryptionSet": {"id": "str"}, - "id": "str", - "securityProfile": { - "diskEncryptionSet": {"id": "str"}, - "securityEncryptionType": "str", - }, - "storageAccountType": "str", - }, - "name": "str", - "osType": "str", - "writeAcceleratorEnabled": bool, - }, - }, - "userData": "str", - "vmId": "str", - }, - "sourceRestorePoint": {"id": "str"}, - "systemData": { - "createdAt": "2020-02-20 00:00:00", - "createdBy": "str", - "createdByType": "str", - "lastModifiedAt": "2020-02-20 00:00:00", - "lastModifiedBy": "str", - "lastModifiedByType": "str", - }, - "timeCreated": "2020-02-20 00:00:00", - "type": "str", - } - ], - "source": {"id": "str", "location": "str"}, - "systemData": { - "createdAt": "2020-02-20 00:00:00", - "createdBy": "str", - "createdByType": "str", - "lastModifiedAt": "2020-02-20 00:00:00", - "lastModifiedBy": "str", - "lastModifiedByType": "str", - }, - "tags": {"str": "str"}, - "type": "str", - }, - api_version="2025-04-01", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_restore_point_collections_update(self, resource_group): - response = await self.client.restore_point_collections.update( - resource_group_name=resource_group.name, - restore_point_collection_name="str", - parameters={ - "provisioningState": "str", - "restorePointCollectionId": "str", - "restorePoints": [ - { - "consistencyMode": "str", - "excludeDisks": [{"id": "str"}], - "id": "str", - "instanceView": { - "diskRestorePoints": [ - { - "id": "str", - "replicationStatus": { - "completionPercent": 0, - "status": { - "code": "str", - "displayStatus": "str", - "level": "str", - "message": "str", - "time": "2020-02-20 00:00:00", - }, - }, - } - ], - "statuses": [ - { - "code": "str", - "displayStatus": "str", - "level": "str", - "message": "str", - "time": "2020-02-20 00:00:00", - } - ], - }, - "name": "str", - "provisioningState": "str", - "sourceMetadata": { - "diagnosticsProfile": {"bootDiagnostics": {"enabled": bool, "storageUri": "str"}}, - "hardwareProfile": { - "vmSize": "str", - "vmSizeProperties": {"vCPUsAvailable": 0, "vCPUsPerCore": 0}, - }, - "hyperVGeneration": "str", - "licenseType": "str", - "location": "str", - "osProfile": { - "adminPassword": "str", - "adminUsername": "str", - "allowExtensionOperations": bool, - "computerName": "str", - "customData": "str", - "linuxConfiguration": { - "disablePasswordAuthentication": bool, - "enableVMAgentPlatformUpdates": bool, - "patchSettings": { - "assessmentMode": "str", - "automaticByPlatformSettings": { - "bypassPlatformSafetyChecksOnUserSchedule": bool, - "rebootSetting": "str", - }, - "patchMode": "str", - }, - "provisionVMAgent": bool, - "ssh": {"publicKeys": [{"keyData": "str", "path": "str"}]}, - }, - "requireGuestProvisionSignal": bool, - "secrets": [ - { - "sourceVault": {"id": "str"}, - "vaultCertificates": [{"certificateStore": "str", "certificateUrl": "str"}], - } - ], - "windowsConfiguration": { - "additionalUnattendContent": [ - { - "componentName": "Microsoft-Windows-Shell-Setup", - "content": "str", - "passName": "OobeSystem", - "settingName": "str", - } - ], - "enableAutomaticUpdates": bool, - "enableVMAgentPlatformUpdates": bool, - "patchSettings": { - "assessmentMode": "str", - "automaticByPlatformSettings": { - "bypassPlatformSafetyChecksOnUserSchedule": bool, - "rebootSetting": "str", - }, - "enableHotpatching": bool, - "patchMode": "str", - }, - "provisionVMAgent": bool, - "timeZone": "str", - "winRM": {"listeners": [{"certificateUrl": "str", "protocol": "str"}]}, - }, - }, - "securityProfile": { - "encryptionAtHost": bool, - "encryptionIdentity": {"userAssignedIdentityResourceId": "str"}, - "proxyAgentSettings": { - "addProxyAgentExtension": bool, - "enabled": bool, - "imds": {"inVMAccessControlProfileReferenceId": "str", "mode": "str"}, - "keyIncarnationId": 0, - "mode": "str", - "wireServer": {"inVMAccessControlProfileReferenceId": "str", "mode": "str"}, - }, - "securityType": "str", - "uefiSettings": {"secureBootEnabled": bool, "vTpmEnabled": bool}, - }, - "storageProfile": { - "dataDisks": [ - { - "caching": "str", - "diskRestorePoint": { - "encryption": {"diskEncryptionSet": {"id": "str"}, "type": "str"}, - "id": "str", - "sourceDiskRestorePoint": {"id": "str"}, - }, - "diskSizeGB": 0, - "lun": 0, - "managedDisk": { - "diskEncryptionSet": {"id": "str"}, - "id": "str", - "securityProfile": { - "diskEncryptionSet": {"id": "str"}, - "securityEncryptionType": "str", - }, - "storageAccountType": "str", - }, - "name": "str", - "writeAcceleratorEnabled": bool, - } - ], - "diskControllerType": "str", - "osDisk": { - "caching": "str", - "diskRestorePoint": { - "encryption": {"diskEncryptionSet": {"id": "str"}, "type": "str"}, - "id": "str", - "sourceDiskRestorePoint": {"id": "str"}, - }, - "diskSizeGB": 0, - "encryptionSettings": { - "diskEncryptionKey": {"secretUrl": "str", "sourceVault": {"id": "str"}}, - "enabled": bool, - "keyEncryptionKey": {"keyUrl": "str", "sourceVault": {"id": "str"}}, - }, - "managedDisk": { - "diskEncryptionSet": {"id": "str"}, - "id": "str", - "securityProfile": { - "diskEncryptionSet": {"id": "str"}, - "securityEncryptionType": "str", - }, - "storageAccountType": "str", - }, - "name": "str", - "osType": "str", - "writeAcceleratorEnabled": bool, - }, - }, - "userData": "str", - "vmId": "str", - }, - "sourceRestorePoint": {"id": "str"}, - "systemData": { - "createdAt": "2020-02-20 00:00:00", - "createdBy": "str", - "createdByType": "str", - "lastModifiedAt": "2020-02-20 00:00:00", - "lastModifiedBy": "str", - "lastModifiedByType": "str", - }, - "timeCreated": "2020-02-20 00:00:00", - "type": "str", - } - ], - "source": {"id": "str", "location": "str"}, - "tags": {"str": "str"}, - }, - api_version="2025-04-01", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_restore_point_collections_begin_delete(self, resource_group): - response = await ( - await self.client.restore_point_collections.begin_delete( - resource_group_name=resource_group.name, - restore_point_collection_name="str", - api_version="2025-04-01", - ) - ).result() # call '.result()' to poll until service return final result - - # please add some check logic here by yourself - # ... diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_restore_points_operations.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_restore_points_operations.py deleted file mode 100644 index 511d548739d1..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_restore_points_operations.py +++ /dev/null @@ -1,229 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import pytest -from azure.mgmt.compute import ComputeManagementClient - -from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy - -AZURE_LOCATION = "eastus" - - -@pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestComputeManagementRestorePointsOperations(AzureMgmtRecordedTestCase): - def setup_method(self, method): - self.client = self.create_mgmt_client(ComputeManagementClient) - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_restore_points_get(self, resource_group): - response = self.client.restore_points.get( - resource_group_name=resource_group.name, - restore_point_collection_name="str", - restore_point_name="str", - api_version="2025-04-01", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_restore_points_begin_create(self, resource_group): - response = self.client.restore_points.begin_create( - resource_group_name=resource_group.name, - restore_point_collection_name="str", - restore_point_name="str", - parameters={ - "consistencyMode": "str", - "excludeDisks": [{"id": "str"}], - "id": "str", - "instanceView": { - "diskRestorePoints": [ - { - "id": "str", - "replicationStatus": { - "completionPercent": 0, - "status": { - "code": "str", - "displayStatus": "str", - "level": "str", - "message": "str", - "time": "2020-02-20 00:00:00", - }, - }, - } - ], - "statuses": [ - { - "code": "str", - "displayStatus": "str", - "level": "str", - "message": "str", - "time": "2020-02-20 00:00:00", - } - ], - }, - "name": "str", - "provisioningState": "str", - "sourceMetadata": { - "diagnosticsProfile": {"bootDiagnostics": {"enabled": bool, "storageUri": "str"}}, - "hardwareProfile": {"vmSize": "str", "vmSizeProperties": {"vCPUsAvailable": 0, "vCPUsPerCore": 0}}, - "hyperVGeneration": "str", - "licenseType": "str", - "location": "str", - "osProfile": { - "adminPassword": "str", - "adminUsername": "str", - "allowExtensionOperations": bool, - "computerName": "str", - "customData": "str", - "linuxConfiguration": { - "disablePasswordAuthentication": bool, - "enableVMAgentPlatformUpdates": bool, - "patchSettings": { - "assessmentMode": "str", - "automaticByPlatformSettings": { - "bypassPlatformSafetyChecksOnUserSchedule": bool, - "rebootSetting": "str", - }, - "patchMode": "str", - }, - "provisionVMAgent": bool, - "ssh": {"publicKeys": [{"keyData": "str", "path": "str"}]}, - }, - "requireGuestProvisionSignal": bool, - "secrets": [ - { - "sourceVault": {"id": "str"}, - "vaultCertificates": [{"certificateStore": "str", "certificateUrl": "str"}], - } - ], - "windowsConfiguration": { - "additionalUnattendContent": [ - { - "componentName": "Microsoft-Windows-Shell-Setup", - "content": "str", - "passName": "OobeSystem", - "settingName": "str", - } - ], - "enableAutomaticUpdates": bool, - "enableVMAgentPlatformUpdates": bool, - "patchSettings": { - "assessmentMode": "str", - "automaticByPlatformSettings": { - "bypassPlatformSafetyChecksOnUserSchedule": bool, - "rebootSetting": "str", - }, - "enableHotpatching": bool, - "patchMode": "str", - }, - "provisionVMAgent": bool, - "timeZone": "str", - "winRM": {"listeners": [{"certificateUrl": "str", "protocol": "str"}]}, - }, - }, - "securityProfile": { - "encryptionAtHost": bool, - "encryptionIdentity": {"userAssignedIdentityResourceId": "str"}, - "proxyAgentSettings": { - "addProxyAgentExtension": bool, - "enabled": bool, - "imds": {"inVMAccessControlProfileReferenceId": "str", "mode": "str"}, - "keyIncarnationId": 0, - "mode": "str", - "wireServer": {"inVMAccessControlProfileReferenceId": "str", "mode": "str"}, - }, - "securityType": "str", - "uefiSettings": {"secureBootEnabled": bool, "vTpmEnabled": bool}, - }, - "storageProfile": { - "dataDisks": [ - { - "caching": "str", - "diskRestorePoint": { - "encryption": {"diskEncryptionSet": {"id": "str"}, "type": "str"}, - "id": "str", - "sourceDiskRestorePoint": {"id": "str"}, - }, - "diskSizeGB": 0, - "lun": 0, - "managedDisk": { - "diskEncryptionSet": {"id": "str"}, - "id": "str", - "securityProfile": { - "diskEncryptionSet": {"id": "str"}, - "securityEncryptionType": "str", - }, - "storageAccountType": "str", - }, - "name": "str", - "writeAcceleratorEnabled": bool, - } - ], - "diskControllerType": "str", - "osDisk": { - "caching": "str", - "diskRestorePoint": { - "encryption": {"diskEncryptionSet": {"id": "str"}, "type": "str"}, - "id": "str", - "sourceDiskRestorePoint": {"id": "str"}, - }, - "diskSizeGB": 0, - "encryptionSettings": { - "diskEncryptionKey": {"secretUrl": "str", "sourceVault": {"id": "str"}}, - "enabled": bool, - "keyEncryptionKey": {"keyUrl": "str", "sourceVault": {"id": "str"}}, - }, - "managedDisk": { - "diskEncryptionSet": {"id": "str"}, - "id": "str", - "securityProfile": { - "diskEncryptionSet": {"id": "str"}, - "securityEncryptionType": "str", - }, - "storageAccountType": "str", - }, - "name": "str", - "osType": "str", - "writeAcceleratorEnabled": bool, - }, - }, - "userData": "str", - "vmId": "str", - }, - "sourceRestorePoint": {"id": "str"}, - "systemData": { - "createdAt": "2020-02-20 00:00:00", - "createdBy": "str", - "createdByType": "str", - "lastModifiedAt": "2020-02-20 00:00:00", - "lastModifiedBy": "str", - "lastModifiedByType": "str", - }, - "timeCreated": "2020-02-20 00:00:00", - "type": "str", - }, - api_version="2025-04-01", - ).result() # call '.result()' to poll until service return final result - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_restore_points_begin_delete(self, resource_group): - response = self.client.restore_points.begin_delete( - resource_group_name=resource_group.name, - restore_point_collection_name="str", - restore_point_name="str", - api_version="2025-04-01", - ).result() # call '.result()' to poll until service return final result - - # please add some check logic here by yourself - # ... diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_snapshots_operations.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_snapshots_operations.py deleted file mode 100644 index fa9f33621d07..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_snapshots_operations.py +++ /dev/null @@ -1,229 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import pytest -from azure.mgmt.compute import ComputeManagementClient - -from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy - -AZURE_LOCATION = "eastus" - - -@pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestComputeManagementSnapshotsOperations(AzureMgmtRecordedTestCase): - def setup_method(self, method): - self.client = self.create_mgmt_client(ComputeManagementClient) - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_snapshots_list(self, resource_group): - response = self.client.snapshots.list( - api_version="2025-01-02", - ) - result = [r for r in response] - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_snapshots_list_by_resource_group(self, resource_group): - response = self.client.snapshots.list_by_resource_group( - resource_group_name=resource_group.name, - api_version="2025-01-02", - ) - result = [r for r in response] - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_snapshots_get(self, resource_group): - response = self.client.snapshots.get( - resource_group_name=resource_group.name, - snapshot_name="str", - api_version="2025-01-02", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_snapshots_begin_create_or_update(self, resource_group): - response = self.client.snapshots.begin_create_or_update( - resource_group_name=resource_group.name, - snapshot_name="str", - snapshot={ - "location": "str", - "completionPercent": 0.0, - "copyCompletionError": {"errorCode": "str", "errorMessage": "str"}, - "creationData": { - "createOption": "str", - "elasticSanResourceId": "str", - "galleryImageReference": { - "communityGalleryImageId": "str", - "id": "str", - "lun": 0, - "sharedGalleryImageId": "str", - }, - "imageReference": { - "communityGalleryImageId": "str", - "id": "str", - "lun": 0, - "sharedGalleryImageId": "str", - }, - "instantAccessDurationMinutes": 0, - "logicalSectorSize": 0, - "performancePlus": bool, - "provisionedBandwidthCopySpeed": "str", - "securityDataUri": "str", - "securityMetadataUri": "str", - "sourceResourceId": "str", - "sourceUniqueId": "str", - "sourceUri": "str", - "storageAccountId": "str", - "uploadSizeBytes": 0, - }, - "dataAccessAuthMode": "str", - "diskAccessId": "str", - "diskSizeBytes": 0, - "diskSizeGB": 0, - "diskState": "str", - "encryption": {"diskEncryptionSetId": "str", "type": "str"}, - "encryptionSettingsCollection": { - "enabled": bool, - "encryptionSettings": [ - { - "diskEncryptionKey": {"secretUrl": "str", "sourceVault": {"id": "str"}}, - "keyEncryptionKey": {"keyUrl": "str", "sourceVault": {"id": "str"}}, - } - ], - "encryptionSettingsVersion": "str", - }, - "extendedLocation": {"name": "str", "type": "str"}, - "hyperVGeneration": "str", - "id": "str", - "incremental": bool, - "incrementalSnapshotFamilyId": "str", - "managedBy": "str", - "name": "str", - "networkAccessPolicy": "str", - "osType": "str", - "provisioningState": "str", - "publicNetworkAccess": "str", - "purchasePlan": {"name": "str", "product": "str", "publisher": "str", "promotionCode": "str"}, - "securityProfile": {"secureVMDiskEncryptionSetId": "str", "securityType": "str"}, - "sku": {"name": "str", "tier": "str"}, - "snapshotAccessState": "str", - "supportedCapabilities": { - "acceleratedNetwork": bool, - "architecture": "str", - "diskControllerTypes": "str", - "supportedSecurityOption": "str", - }, - "supportsHibernation": bool, - "systemData": { - "createdAt": "2020-02-20 00:00:00", - "createdBy": "str", - "createdByType": "str", - "lastModifiedAt": "2020-02-20 00:00:00", - "lastModifiedBy": "str", - "lastModifiedByType": "str", - }, - "tags": {"str": "str"}, - "timeCreated": "2020-02-20 00:00:00", - "type": "str", - "uniqueId": "str", - }, - api_version="2025-01-02", - ).result() # call '.result()' to poll until service return final result - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_snapshots_begin_update(self, resource_group): - response = self.client.snapshots.begin_update( - resource_group_name=resource_group.name, - snapshot_name="str", - snapshot={ - "dataAccessAuthMode": "str", - "diskAccessId": "str", - "diskSizeGB": 0, - "encryption": {"diskEncryptionSetId": "str", "type": "str"}, - "encryptionSettingsCollection": { - "enabled": bool, - "encryptionSettings": [ - { - "diskEncryptionKey": {"secretUrl": "str", "sourceVault": {"id": "str"}}, - "keyEncryptionKey": {"keyUrl": "str", "sourceVault": {"id": "str"}}, - } - ], - "encryptionSettingsVersion": "str", - }, - "networkAccessPolicy": "str", - "osType": "str", - "publicNetworkAccess": "str", - "sku": {"name": "str", "tier": "str"}, - "snapshotAccessState": "str", - "supportedCapabilities": { - "acceleratedNetwork": bool, - "architecture": "str", - "diskControllerTypes": "str", - "supportedSecurityOption": "str", - }, - "supportsHibernation": bool, - "tags": {"str": "str"}, - }, - api_version="2025-01-02", - ).result() # call '.result()' to poll until service return final result - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_snapshots_begin_delete(self, resource_group): - response = self.client.snapshots.begin_delete( - resource_group_name=resource_group.name, - snapshot_name="str", - api_version="2025-01-02", - ).result() # call '.result()' to poll until service return final result - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_snapshots_begin_grant_access(self, resource_group): - response = self.client.snapshots.begin_grant_access( - resource_group_name=resource_group.name, - snapshot_name="str", - grant_access_data={ - "access": "str", - "durationInSeconds": 0, - "fileFormat": "str", - "getSecureVMGuestStateSAS": bool, - }, - api_version="2025-01-02", - ).result() # call '.result()' to poll until service return final result - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_snapshots_begin_revoke_access(self, resource_group): - response = self.client.snapshots.begin_revoke_access( - resource_group_name=resource_group.name, - snapshot_name="str", - api_version="2025-01-02", - ).result() # call '.result()' to poll until service return final result - - # please add some check logic here by yourself - # ... diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_soft_deleted_resource_operations.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_soft_deleted_resource_operations.py deleted file mode 100644 index e237bc87e609..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_soft_deleted_resource_operations.py +++ /dev/null @@ -1,33 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import pytest -from azure.mgmt.compute import ComputeManagementClient - -from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy - -AZURE_LOCATION = "eastus" - - -@pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestComputeManagementSoftDeletedResourceOperations(AzureMgmtRecordedTestCase): - def setup_method(self, method): - self.client = self.create_mgmt_client(ComputeManagementClient) - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_soft_deleted_resource_list_by_artifact_name(self, resource_group): - response = self.client.soft_deleted_resource.list_by_artifact_name( - resource_group_name=resource_group.name, - gallery_name="str", - artifact_type="str", - artifact_name="str", - api_version="2024-03-03", - ) - result = [r for r in response] - # please add some check logic here by yourself - # ... diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_soft_deleted_resource_operations_async.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_soft_deleted_resource_operations_async.py deleted file mode 100644 index ab5ac1e31e48..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_soft_deleted_resource_operations_async.py +++ /dev/null @@ -1,34 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import pytest -from azure.mgmt.compute.aio import ComputeManagementClient - -from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer -from devtools_testutils.aio import recorded_by_proxy_async - -AZURE_LOCATION = "eastus" - - -@pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestComputeManagementSoftDeletedResourceOperationsAsync(AzureMgmtRecordedTestCase): - def setup_method(self, method): - self.client = self.create_mgmt_client(ComputeManagementClient, is_async=True) - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_soft_deleted_resource_list_by_artifact_name(self, resource_group): - response = self.client.soft_deleted_resource.list_by_artifact_name( - resource_group_name=resource_group.name, - gallery_name="str", - artifact_type="str", - artifact_name="str", - api_version="2024-03-03", - ) - result = [r async for r in response] - # please add some check logic here by yourself - # ... diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_virtual_machine_run_commands_operations.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_virtual_machine_run_commands_operations.py deleted file mode 100644 index ce43bd9ed0ef..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_virtual_machine_run_commands_operations.py +++ /dev/null @@ -1,200 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import pytest -from azure.mgmt.compute import ComputeManagementClient - -from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy - -AZURE_LOCATION = "eastus" - - -@pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestComputeManagementVirtualMachineRunCommandsOperations(AzureMgmtRecordedTestCase): - def setup_method(self, method): - self.client = self.create_mgmt_client(ComputeManagementClient) - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_virtual_machine_run_commands_list(self, resource_group): - response = self.client.virtual_machine_run_commands.list( - location="str", - api_version="2025-04-01", - ) - result = [r for r in response] - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_virtual_machine_run_commands_get(self, resource_group): - response = self.client.virtual_machine_run_commands.get( - location="str", - command_id="str", - api_version="2025-04-01", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_virtual_machine_run_commands_list_by_virtual_machine(self, resource_group): - response = self.client.virtual_machine_run_commands.list_by_virtual_machine( - resource_group_name=resource_group.name, - vm_name="str", - api_version="2025-04-01", - ) - result = [r for r in response] - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_virtual_machine_run_commands_get_by_virtual_machine(self, resource_group): - response = self.client.virtual_machine_run_commands.get_by_virtual_machine( - resource_group_name=resource_group.name, - vm_name="str", - run_command_name="str", - api_version="2025-04-01", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_virtual_machine_run_commands_begin_create_or_update(self, resource_group): - response = self.client.virtual_machine_run_commands.begin_create_or_update( - resource_group_name=resource_group.name, - vm_name="str", - run_command_name="str", - run_command={ - "location": "str", - "asyncExecution": bool, - "errorBlobManagedIdentity": {"clientId": "str", "objectId": "str"}, - "errorBlobUri": "str", - "id": "str", - "instanceView": { - "endTime": "2020-02-20 00:00:00", - "error": "str", - "executionMessage": "str", - "executionState": "str", - "exitCode": 0, - "output": "str", - "startTime": "2020-02-20 00:00:00", - "statuses": [ - { - "code": "str", - "displayStatus": "str", - "level": "str", - "message": "str", - "time": "2020-02-20 00:00:00", - } - ], - }, - "name": "str", - "outputBlobManagedIdentity": {"clientId": "str", "objectId": "str"}, - "outputBlobUri": "str", - "parameters": [{"name": "str", "value": "str"}], - "protectedParameters": [{"name": "str", "value": "str"}], - "provisioningState": "str", - "runAsPassword": "str", - "runAsUser": "str", - "source": { - "commandId": "str", - "galleryScriptReferenceId": "str", - "script": "str", - "scriptShell": "str", - "scriptUri": "str", - "scriptUriManagedIdentity": {"clientId": "str", "objectId": "str"}, - }, - "systemData": { - "createdAt": "2020-02-20 00:00:00", - "createdBy": "str", - "createdByType": "str", - "lastModifiedAt": "2020-02-20 00:00:00", - "lastModifiedBy": "str", - "lastModifiedByType": "str", - }, - "tags": {"str": "str"}, - "timeoutInSeconds": 0, - "treatFailureAsDeploymentFailure": bool, - "type": "str", - }, - api_version="2025-04-01", - ).result() # call '.result()' to poll until service return final result - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_virtual_machine_run_commands_begin_update(self, resource_group): - response = self.client.virtual_machine_run_commands.begin_update( - resource_group_name=resource_group.name, - vm_name="str", - run_command_name="str", - run_command={ - "asyncExecution": bool, - "errorBlobManagedIdentity": {"clientId": "str", "objectId": "str"}, - "errorBlobUri": "str", - "instanceView": { - "endTime": "2020-02-20 00:00:00", - "error": "str", - "executionMessage": "str", - "executionState": "str", - "exitCode": 0, - "output": "str", - "startTime": "2020-02-20 00:00:00", - "statuses": [ - { - "code": "str", - "displayStatus": "str", - "level": "str", - "message": "str", - "time": "2020-02-20 00:00:00", - } - ], - }, - "outputBlobManagedIdentity": {"clientId": "str", "objectId": "str"}, - "outputBlobUri": "str", - "parameters": [{"name": "str", "value": "str"}], - "protectedParameters": [{"name": "str", "value": "str"}], - "provisioningState": "str", - "runAsPassword": "str", - "runAsUser": "str", - "source": { - "commandId": "str", - "galleryScriptReferenceId": "str", - "script": "str", - "scriptShell": "str", - "scriptUri": "str", - "scriptUriManagedIdentity": {"clientId": "str", "objectId": "str"}, - }, - "tags": {"str": "str"}, - "timeoutInSeconds": 0, - "treatFailureAsDeploymentFailure": bool, - }, - api_version="2025-04-01", - ).result() # call '.result()' to poll until service return final result - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_virtual_machine_run_commands_begin_delete(self, resource_group): - response = self.client.virtual_machine_run_commands.begin_delete( - resource_group_name=resource_group.name, - vm_name="str", - run_command_name="str", - api_version="2025-04-01", - ).result() # call '.result()' to poll until service return final result - - # please add some check logic here by yourself - # ... diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_virtual_machine_scale_set_rolling_upgrades_operations.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_virtual_machine_scale_set_rolling_upgrades_operations.py deleted file mode 100644 index 465d6a41f59c..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_virtual_machine_scale_set_rolling_upgrades_operations.py +++ /dev/null @@ -1,67 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import pytest -from azure.mgmt.compute import ComputeManagementClient - -from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy - -AZURE_LOCATION = "eastus" - - -@pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestComputeManagementVirtualMachineScaleSetRollingUpgradesOperations(AzureMgmtRecordedTestCase): - def setup_method(self, method): - self.client = self.create_mgmt_client(ComputeManagementClient) - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_virtual_machine_scale_set_rolling_upgrades_begin_start_extension_upgrade(self, resource_group): - response = self.client.virtual_machine_scale_set_rolling_upgrades.begin_start_extension_upgrade( - resource_group_name=resource_group.name, - vm_scale_set_name="str", - api_version="2025-04-01", - ).result() # call '.result()' to poll until service return final result - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_virtual_machine_scale_set_rolling_upgrades_begin_start_os_upgrade(self, resource_group): - response = self.client.virtual_machine_scale_set_rolling_upgrades.begin_start_os_upgrade( - resource_group_name=resource_group.name, - vm_scale_set_name="str", - api_version="2025-04-01", - ).result() # call '.result()' to poll until service return final result - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_virtual_machine_scale_set_rolling_upgrades_begin_cancel(self, resource_group): - response = self.client.virtual_machine_scale_set_rolling_upgrades.begin_cancel( - resource_group_name=resource_group.name, - vm_scale_set_name="str", - api_version="2025-04-01", - ).result() # call '.result()' to poll until service return final result - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_virtual_machine_scale_set_rolling_upgrades_get_latest(self, resource_group): - response = self.client.virtual_machine_scale_set_rolling_upgrades.get_latest( - resource_group_name=resource_group.name, - vm_scale_set_name="str", - api_version="2025-04-01", - ) - - # please add some check logic here by yourself - # ... diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_virtual_machine_scale_set_rolling_upgrades_operations_async.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_virtual_machine_scale_set_rolling_upgrades_operations_async.py deleted file mode 100644 index 6f21c3d8e4c5..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_virtual_machine_scale_set_rolling_upgrades_operations_async.py +++ /dev/null @@ -1,74 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import pytest -from azure.mgmt.compute.aio import ComputeManagementClient - -from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer -from devtools_testutils.aio import recorded_by_proxy_async - -AZURE_LOCATION = "eastus" - - -@pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestComputeManagementVirtualMachineScaleSetRollingUpgradesOperationsAsync(AzureMgmtRecordedTestCase): - def setup_method(self, method): - self.client = self.create_mgmt_client(ComputeManagementClient, is_async=True) - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_virtual_machine_scale_set_rolling_upgrades_begin_start_extension_upgrade(self, resource_group): - response = await ( - await self.client.virtual_machine_scale_set_rolling_upgrades.begin_start_extension_upgrade( - resource_group_name=resource_group.name, - vm_scale_set_name="str", - api_version="2025-04-01", - ) - ).result() # call '.result()' to poll until service return final result - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_virtual_machine_scale_set_rolling_upgrades_begin_start_os_upgrade(self, resource_group): - response = await ( - await self.client.virtual_machine_scale_set_rolling_upgrades.begin_start_os_upgrade( - resource_group_name=resource_group.name, - vm_scale_set_name="str", - api_version="2025-04-01", - ) - ).result() # call '.result()' to poll until service return final result - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_virtual_machine_scale_set_rolling_upgrades_begin_cancel(self, resource_group): - response = await ( - await self.client.virtual_machine_scale_set_rolling_upgrades.begin_cancel( - resource_group_name=resource_group.name, - vm_scale_set_name="str", - api_version="2025-04-01", - ) - ).result() # call '.result()' to poll until service return final result - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_virtual_machine_scale_set_rolling_upgrades_get_latest(self, resource_group): - response = await self.client.virtual_machine_scale_set_rolling_upgrades.get_latest( - resource_group_name=resource_group.name, - vm_scale_set_name="str", - api_version="2025-04-01", - ) - - # please add some check logic here by yourself - # ... diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_virtual_machine_scale_set_vm_extensions_operations.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_virtual_machine_scale_set_vm_extensions_operations.py deleted file mode 100644 index 3813f4c34787..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_virtual_machine_scale_set_vm_extensions_operations.py +++ /dev/null @@ -1,142 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import pytest -from azure.mgmt.compute import ComputeManagementClient - -from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy - -AZURE_LOCATION = "eastus" - - -@pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestComputeManagementVirtualMachineScaleSetVMExtensionsOperations(AzureMgmtRecordedTestCase): - def setup_method(self, method): - self.client = self.create_mgmt_client(ComputeManagementClient) - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_virtual_machine_scale_set_vm_extensions_list(self, resource_group): - response = self.client.virtual_machine_scale_set_vm_extensions.list( - resource_group_name=resource_group.name, - vm_scale_set_name="str", - instance_id="str", - api_version="2025-04-01", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_virtual_machine_scale_set_vm_extensions_get(self, resource_group): - response = self.client.virtual_machine_scale_set_vm_extensions.get( - resource_group_name=resource_group.name, - vm_scale_set_name="str", - instance_id="str", - vm_extension_name="str", - api_version="2025-04-01", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_virtual_machine_scale_set_vm_extensions_begin_create_or_update(self, resource_group): - response = self.client.virtual_machine_scale_set_vm_extensions.begin_create_or_update( - resource_group_name=resource_group.name, - vm_scale_set_name="str", - instance_id="str", - vm_extension_name="str", - extension_parameters={ - "autoUpgradeMinorVersion": bool, - "enableAutomaticUpgrade": bool, - "forceUpdateTag": "str", - "id": "str", - "instanceView": { - "name": "str", - "statuses": [ - { - "code": "str", - "displayStatus": "str", - "level": "str", - "message": "str", - "time": "2020-02-20 00:00:00", - } - ], - "substatuses": [ - { - "code": "str", - "displayStatus": "str", - "level": "str", - "message": "str", - "time": "2020-02-20 00:00:00", - } - ], - "type": "str", - "typeHandlerVersion": "str", - }, - "location": "str", - "name": "str", - "protectedSettings": {}, - "protectedSettingsFromKeyVault": {"secretUrl": "str", "sourceVault": {"id": "str"}}, - "provisionAfterExtensions": ["str"], - "provisioningState": "str", - "publisher": "str", - "settings": {}, - "suppressFailures": bool, - "type": "str", - "typeHandlerVersion": "str", - }, - api_version="2025-04-01", - ).result() # call '.result()' to poll until service return final result - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_virtual_machine_scale_set_vm_extensions_begin_update(self, resource_group): - response = self.client.virtual_machine_scale_set_vm_extensions.begin_update( - resource_group_name=resource_group.name, - vm_scale_set_name="str", - instance_id="str", - vm_extension_name="str", - extension_parameters={ - "autoUpgradeMinorVersion": bool, - "enableAutomaticUpgrade": bool, - "forceUpdateTag": "str", - "id": "str", - "name": "str", - "protectedSettings": {}, - "protectedSettingsFromKeyVault": {"secretUrl": "str", "sourceVault": {"id": "str"}}, - "publisher": "str", - "settings": {}, - "suppressFailures": bool, - "type": "str", - "typeHandlerVersion": "str", - }, - api_version="2025-04-01", - ).result() # call '.result()' to poll until service return final result - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_virtual_machine_scale_set_vm_extensions_begin_delete(self, resource_group): - response = self.client.virtual_machine_scale_set_vm_extensions.begin_delete( - resource_group_name=resource_group.name, - vm_scale_set_name="str", - instance_id="str", - vm_extension_name="str", - api_version="2025-04-01", - ).result() # call '.result()' to poll until service return final result - - # please add some check logic here by yourself - # ... diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_virtual_machine_scale_set_vm_run_commands_operations.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_virtual_machine_scale_set_vm_run_commands_operations.py deleted file mode 100644 index a525559f91c1..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_virtual_machine_scale_set_vm_run_commands_operations.py +++ /dev/null @@ -1,182 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import pytest -from azure.mgmt.compute import ComputeManagementClient - -from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy - -AZURE_LOCATION = "eastus" - - -@pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestComputeManagementVirtualMachineScaleSetVMRunCommandsOperations(AzureMgmtRecordedTestCase): - def setup_method(self, method): - self.client = self.create_mgmt_client(ComputeManagementClient) - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_virtual_machine_scale_set_vm_run_commands_list(self, resource_group): - response = self.client.virtual_machine_scale_set_vm_run_commands.list( - resource_group_name=resource_group.name, - vm_scale_set_name="str", - instance_id="str", - api_version="2025-04-01", - ) - result = [r for r in response] - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_virtual_machine_scale_set_vm_run_commands_get(self, resource_group): - response = self.client.virtual_machine_scale_set_vm_run_commands.get( - resource_group_name=resource_group.name, - vm_scale_set_name="str", - instance_id="str", - run_command_name="str", - api_version="2025-04-01", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_virtual_machine_scale_set_vm_run_commands_begin_create_or_update(self, resource_group): - response = self.client.virtual_machine_scale_set_vm_run_commands.begin_create_or_update( - resource_group_name=resource_group.name, - vm_scale_set_name="str", - instance_id="str", - run_command_name="str", - run_command={ - "location": "str", - "asyncExecution": bool, - "errorBlobManagedIdentity": {"clientId": "str", "objectId": "str"}, - "errorBlobUri": "str", - "id": "str", - "instanceView": { - "endTime": "2020-02-20 00:00:00", - "error": "str", - "executionMessage": "str", - "executionState": "str", - "exitCode": 0, - "output": "str", - "startTime": "2020-02-20 00:00:00", - "statuses": [ - { - "code": "str", - "displayStatus": "str", - "level": "str", - "message": "str", - "time": "2020-02-20 00:00:00", - } - ], - }, - "name": "str", - "outputBlobManagedIdentity": {"clientId": "str", "objectId": "str"}, - "outputBlobUri": "str", - "parameters": [{"name": "str", "value": "str"}], - "protectedParameters": [{"name": "str", "value": "str"}], - "provisioningState": "str", - "runAsPassword": "str", - "runAsUser": "str", - "source": { - "commandId": "str", - "galleryScriptReferenceId": "str", - "script": "str", - "scriptShell": "str", - "scriptUri": "str", - "scriptUriManagedIdentity": {"clientId": "str", "objectId": "str"}, - }, - "systemData": { - "createdAt": "2020-02-20 00:00:00", - "createdBy": "str", - "createdByType": "str", - "lastModifiedAt": "2020-02-20 00:00:00", - "lastModifiedBy": "str", - "lastModifiedByType": "str", - }, - "tags": {"str": "str"}, - "timeoutInSeconds": 0, - "treatFailureAsDeploymentFailure": bool, - "type": "str", - }, - api_version="2025-04-01", - ).result() # call '.result()' to poll until service return final result - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_virtual_machine_scale_set_vm_run_commands_begin_update(self, resource_group): - response = self.client.virtual_machine_scale_set_vm_run_commands.begin_update( - resource_group_name=resource_group.name, - vm_scale_set_name="str", - instance_id="str", - run_command_name="str", - run_command={ - "asyncExecution": bool, - "errorBlobManagedIdentity": {"clientId": "str", "objectId": "str"}, - "errorBlobUri": "str", - "instanceView": { - "endTime": "2020-02-20 00:00:00", - "error": "str", - "executionMessage": "str", - "executionState": "str", - "exitCode": 0, - "output": "str", - "startTime": "2020-02-20 00:00:00", - "statuses": [ - { - "code": "str", - "displayStatus": "str", - "level": "str", - "message": "str", - "time": "2020-02-20 00:00:00", - } - ], - }, - "outputBlobManagedIdentity": {"clientId": "str", "objectId": "str"}, - "outputBlobUri": "str", - "parameters": [{"name": "str", "value": "str"}], - "protectedParameters": [{"name": "str", "value": "str"}], - "provisioningState": "str", - "runAsPassword": "str", - "runAsUser": "str", - "source": { - "commandId": "str", - "galleryScriptReferenceId": "str", - "script": "str", - "scriptShell": "str", - "scriptUri": "str", - "scriptUriManagedIdentity": {"clientId": "str", "objectId": "str"}, - }, - "tags": {"str": "str"}, - "timeoutInSeconds": 0, - "treatFailureAsDeploymentFailure": bool, - }, - api_version="2025-04-01", - ).result() # call '.result()' to poll until service return final result - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_virtual_machine_scale_set_vm_run_commands_begin_delete(self, resource_group): - response = self.client.virtual_machine_scale_set_vm_run_commands.begin_delete( - resource_group_name=resource_group.name, - vm_scale_set_name="str", - instance_id="str", - run_command_name="str", - api_version="2025-04-01", - ).result() # call '.result()' to poll until service return final result - - # please add some check logic here by yourself - # ... diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_virtual_machine_scale_set_vms_operations.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_virtual_machine_scale_set_vms_operations.py deleted file mode 100644 index 38a59c42b091..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_virtual_machine_scale_set_vms_operations.py +++ /dev/null @@ -1,691 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import pytest -from azure.mgmt.compute import ComputeManagementClient - -from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy - -AZURE_LOCATION = "eastus" - - -@pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestComputeManagementVirtualMachineScaleSetVMsOperations(AzureMgmtRecordedTestCase): - def setup_method(self, method): - self.client = self.create_mgmt_client(ComputeManagementClient) - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_virtual_machine_scale_set_vms_list(self, resource_group): - response = self.client.virtual_machine_scale_set_vms.list( - resource_group_name=resource_group.name, - virtual_machine_scale_set_name="str", - api_version="2025-04-01", - ) - result = [r for r in response] - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_virtual_machine_scale_set_vms_get(self, resource_group): - response = self.client.virtual_machine_scale_set_vms.get( - resource_group_name=resource_group.name, - vm_scale_set_name="str", - instance_id="str", - api_version="2025-04-01", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_virtual_machine_scale_set_vms_begin_update(self, resource_group): - response = self.client.virtual_machine_scale_set_vms.begin_update( - resource_group_name=resource_group.name, - vm_scale_set_name="str", - instance_id="str", - parameters={ - "location": "str", - "additionalCapabilities": {"hibernationEnabled": bool, "ultraSSDEnabled": bool}, - "availabilitySet": {"id": "str"}, - "diagnosticsProfile": {"bootDiagnostics": {"enabled": bool, "storageUri": "str"}}, - "etag": "str", - "hardwareProfile": {"vmSize": "str", "vmSizeProperties": {"vCPUsAvailable": 0, "vCPUsPerCore": 0}}, - "id": "str", - "identity": { - "principalId": "str", - "tenantId": "str", - "type": "str", - "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, - }, - "instanceId": "str", - "instanceView": { - "assignedHost": "str", - "bootDiagnostics": { - "consoleScreenshotBlobUri": "str", - "serialConsoleLogBlobUri": "str", - "status": { - "code": "str", - "displayStatus": "str", - "level": "str", - "message": "str", - "time": "2020-02-20 00:00:00", - }, - }, - "computerName": "str", - "disks": [ - { - "encryptionSettings": [ - { - "diskEncryptionKey": {"secretUrl": "str", "sourceVault": {"id": "str"}}, - "enabled": bool, - "keyEncryptionKey": {"keyUrl": "str", "sourceVault": {"id": "str"}}, - } - ], - "name": "str", - "statuses": [ - { - "code": "str", - "displayStatus": "str", - "level": "str", - "message": "str", - "time": "2020-02-20 00:00:00", - } - ], - } - ], - "extensions": [ - { - "name": "str", - "statuses": [ - { - "code": "str", - "displayStatus": "str", - "level": "str", - "message": "str", - "time": "2020-02-20 00:00:00", - } - ], - "substatuses": [ - { - "code": "str", - "displayStatus": "str", - "level": "str", - "message": "str", - "time": "2020-02-20 00:00:00", - } - ], - "type": "str", - "typeHandlerVersion": "str", - } - ], - "hyperVGeneration": "str", - "maintenanceRedeployStatus": { - "isCustomerInitiatedMaintenanceAllowed": bool, - "lastOperationMessage": "str", - "lastOperationResultCode": "str", - "maintenanceWindowEndTime": "2020-02-20 00:00:00", - "maintenanceWindowStartTime": "2020-02-20 00:00:00", - "preMaintenanceWindowEndTime": "2020-02-20 00:00:00", - "preMaintenanceWindowStartTime": "2020-02-20 00:00:00", - }, - "osName": "str", - "osVersion": "str", - "placementGroupId": "str", - "platformFaultDomain": 0, - "platformUpdateDomain": 0, - "rdpThumbPrint": "str", - "statuses": [ - { - "code": "str", - "displayStatus": "str", - "level": "str", - "message": "str", - "time": "2020-02-20 00:00:00", - } - ], - "vmAgent": { - "extensionHandlers": [ - { - "status": { - "code": "str", - "displayStatus": "str", - "level": "str", - "message": "str", - "time": "2020-02-20 00:00:00", - }, - "type": "str", - "typeHandlerVersion": "str", - } - ], - "statuses": [ - { - "code": "str", - "displayStatus": "str", - "level": "str", - "message": "str", - "time": "2020-02-20 00:00:00", - } - ], - "vmAgentVersion": "str", - }, - "vmHealth": { - "status": { - "code": "str", - "displayStatus": "str", - "level": "str", - "message": "str", - "time": "2020-02-20 00:00:00", - } - }, - }, - "latestModelApplied": bool, - "licenseType": "str", - "modelDefinitionApplied": "str", - "name": "str", - "networkProfile": { - "networkApiVersion": "str", - "networkInterfaceConfigurations": [ - { - "name": "str", - "auxiliaryMode": "str", - "auxiliarySku": "str", - "deleteOption": "str", - "disableTcpStateTracking": bool, - "dnsSettings": {"dnsServers": ["str"]}, - "dscpConfiguration": {"id": "str"}, - "enableAcceleratedNetworking": bool, - "enableFpga": bool, - "enableIPForwarding": bool, - "ipConfigurations": [ - { - "name": "str", - "applicationGatewayBackendAddressPools": [{"id": "str"}], - "applicationSecurityGroups": [{"id": "str"}], - "loadBalancerBackendAddressPools": [{"id": "str"}], - "primary": bool, - "privateIPAddressVersion": "str", - "publicIPAddressConfiguration": { - "name": "str", - "deleteOption": "str", - "dnsSettings": {"domainNameLabel": "str", "domainNameLabelScope": "str"}, - "idleTimeoutInMinutes": 0, - "ipTags": [{"ipTagType": "str", "tag": "str"}], - "publicIPAddressVersion": "str", - "publicIPAllocationMethod": "str", - "publicIPPrefix": {"id": "str"}, - "sku": {"name": "str", "tier": "str"}, - "tags": {"str": "str"}, - }, - "subnet": {"id": "str"}, - } - ], - "networkSecurityGroup": {"id": "str"}, - "primary": bool, - "tags": {"str": "str"}, - } - ], - "networkInterfaces": [{"deleteOption": "str", "id": "str", "primary": bool}], - }, - "networkProfileConfiguration": { - "networkInterfaceConfigurations": [ - { - "name": "str", - "auxiliaryMode": "str", - "auxiliarySku": "str", - "deleteOption": "str", - "disableTcpStateTracking": bool, - "dnsSettings": {"dnsServers": ["str"]}, - "enableAcceleratedNetworking": bool, - "enableFpga": bool, - "enableIPForwarding": bool, - "ipConfigurations": [ - { - "name": "str", - "applicationGatewayBackendAddressPools": [{"id": "str"}], - "applicationSecurityGroups": [{"id": "str"}], - "loadBalancerBackendAddressPools": [{"id": "str"}], - "loadBalancerInboundNatPools": [{"id": "str"}], - "primary": bool, - "privateIPAddressVersion": "str", - "publicIPAddressConfiguration": { - "name": "str", - "deleteOption": "str", - "dnsSettings": {"domainNameLabel": "str", "domainNameLabelScope": "str"}, - "idleTimeoutInMinutes": 0, - "ipTags": [{"ipTagType": "str", "tag": "str"}], - "publicIPAddressVersion": "str", - "publicIPPrefix": {"id": "str"}, - "sku": {"name": "str", "tier": "str"}, - "tags": {"str": "str"}, - }, - "subnet": {"id": "str"}, - } - ], - "networkSecurityGroup": {"id": "str"}, - "primary": bool, - "tags": {"str": "str"}, - } - ] - }, - "osProfile": { - "adminPassword": "str", - "adminUsername": "str", - "allowExtensionOperations": bool, - "computerName": "str", - "customData": "str", - "linuxConfiguration": { - "disablePasswordAuthentication": bool, - "enableVMAgentPlatformUpdates": bool, - "patchSettings": { - "assessmentMode": "str", - "automaticByPlatformSettings": { - "bypassPlatformSafetyChecksOnUserSchedule": bool, - "rebootSetting": "str", - }, - "patchMode": "str", - }, - "provisionVMAgent": bool, - "ssh": {"publicKeys": [{"keyData": "str", "path": "str"}]}, - }, - "requireGuestProvisionSignal": bool, - "secrets": [ - { - "sourceVault": {"id": "str"}, - "vaultCertificates": [{"certificateStore": "str", "certificateUrl": "str"}], - } - ], - "windowsConfiguration": { - "additionalUnattendContent": [ - { - "componentName": "Microsoft-Windows-Shell-Setup", - "content": "str", - "passName": "OobeSystem", - "settingName": "str", - } - ], - "enableAutomaticUpdates": bool, - "enableVMAgentPlatformUpdates": bool, - "patchSettings": { - "assessmentMode": "str", - "automaticByPlatformSettings": { - "bypassPlatformSafetyChecksOnUserSchedule": bool, - "rebootSetting": "str", - }, - "enableHotpatching": bool, - "patchMode": "str", - }, - "provisionVMAgent": bool, - "timeZone": "str", - "winRM": {"listeners": [{"certificateUrl": "str", "protocol": "str"}]}, - }, - }, - "plan": {"name": "str", "product": "str", "promotionCode": "str", "publisher": "str"}, - "protectionPolicy": {"protectFromScaleIn": bool, "protectFromScaleSetActions": bool}, - "provisioningState": "str", - "resilientVMDeletionStatus": "str", - "resources": [ - { - "location": "str", - "autoUpgradeMinorVersion": bool, - "enableAutomaticUpgrade": bool, - "forceUpdateTag": "str", - "id": "str", - "instanceView": { - "name": "str", - "statuses": [ - { - "code": "str", - "displayStatus": "str", - "level": "str", - "message": "str", - "time": "2020-02-20 00:00:00", - } - ], - "substatuses": [ - { - "code": "str", - "displayStatus": "str", - "level": "str", - "message": "str", - "time": "2020-02-20 00:00:00", - } - ], - "type": "str", - "typeHandlerVersion": "str", - }, - "name": "str", - "protectedSettings": {}, - "protectedSettingsFromKeyVault": {"secretUrl": "str", "sourceVault": {"id": "str"}}, - "provisionAfterExtensions": ["str"], - "provisioningState": "str", - "publisher": "str", - "settings": {}, - "suppressFailures": bool, - "systemData": { - "createdAt": "2020-02-20 00:00:00", - "createdBy": "str", - "createdByType": "str", - "lastModifiedAt": "2020-02-20 00:00:00", - "lastModifiedBy": "str", - "lastModifiedByType": "str", - }, - "tags": {"str": "str"}, - "type": "str", - "typeHandlerVersion": "str", - } - ], - "securityProfile": { - "encryptionAtHost": bool, - "encryptionIdentity": {"userAssignedIdentityResourceId": "str"}, - "proxyAgentSettings": { - "addProxyAgentExtension": bool, - "enabled": bool, - "imds": {"inVMAccessControlProfileReferenceId": "str", "mode": "str"}, - "keyIncarnationId": 0, - "mode": "str", - "wireServer": {"inVMAccessControlProfileReferenceId": "str", "mode": "str"}, - }, - "securityType": "str", - "uefiSettings": {"secureBootEnabled": bool, "vTpmEnabled": bool}, - }, - "sku": {"capacity": 0, "name": "str", "tier": "str"}, - "storageProfile": { - "alignRegionalDisksToVMZone": bool, - "dataDisks": [ - { - "createOption": "str", - "lun": 0, - "caching": "str", - "deleteOption": "str", - "detachOption": "str", - "diskIOPSReadWrite": 0, - "diskMBpsReadWrite": 0, - "diskSizeGB": 0, - "image": {"uri": "str"}, - "managedDisk": { - "diskEncryptionSet": {"id": "str"}, - "id": "str", - "securityProfile": { - "diskEncryptionSet": {"id": "str"}, - "securityEncryptionType": "str", - }, - "storageAccountType": "str", - }, - "name": "str", - "sourceResource": {"id": "str"}, - "toBeDetached": bool, - "vhd": {"uri": "str"}, - "writeAcceleratorEnabled": bool, - } - ], - "diskControllerType": "str", - "imageReference": { - "communityGalleryImageId": "str", - "exactVersion": "str", - "id": "str", - "offer": "str", - "publisher": "str", - "sharedGalleryImageId": "str", - "sku": "str", - "version": "str", - }, - "osDisk": { - "createOption": "str", - "caching": "str", - "deleteOption": "str", - "diffDiskSettings": {"option": "str", "placement": "str"}, - "diskSizeGB": 0, - "encryptionSettings": { - "diskEncryptionKey": {"secretUrl": "str", "sourceVault": {"id": "str"}}, - "enabled": bool, - "keyEncryptionKey": {"keyUrl": "str", "sourceVault": {"id": "str"}}, - }, - "image": {"uri": "str"}, - "managedDisk": { - "diskEncryptionSet": {"id": "str"}, - "id": "str", - "securityProfile": {"diskEncryptionSet": {"id": "str"}, "securityEncryptionType": "str"}, - "storageAccountType": "str", - }, - "name": "str", - "osType": "str", - "vhd": {"uri": "str"}, - "writeAcceleratorEnabled": bool, - }, - }, - "systemData": { - "createdAt": "2020-02-20 00:00:00", - "createdBy": "str", - "createdByType": "str", - "lastModifiedAt": "2020-02-20 00:00:00", - "lastModifiedBy": "str", - "lastModifiedByType": "str", - }, - "tags": {"str": "str"}, - "timeCreated": "2020-02-20 00:00:00", - "type": "str", - "userData": "str", - "vmId": "str", - "zones": ["str"], - }, - api_version="2025-04-01", - ).result() # call '.result()' to poll until service return final result - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_virtual_machine_scale_set_vms_begin_delete(self, resource_group): - response = self.client.virtual_machine_scale_set_vms.begin_delete( - resource_group_name=resource_group.name, - vm_scale_set_name="str", - instance_id="str", - api_version="2025-04-01", - ).result() # call '.result()' to poll until service return final result - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_virtual_machine_scale_set_vms_begin_approve_rolling_upgrade(self, resource_group): - response = self.client.virtual_machine_scale_set_vms.begin_approve_rolling_upgrade( - resource_group_name=resource_group.name, - vm_scale_set_name="str", - instance_id="str", - api_version="2025-04-01", - ).result() # call '.result()' to poll until service return final result - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_virtual_machine_scale_set_vms_begin_attach_detach_data_disks(self, resource_group): - response = self.client.virtual_machine_scale_set_vms.begin_attach_detach_data_disks( - resource_group_name=resource_group.name, - vm_scale_set_name="str", - instance_id="str", - parameters={ - "dataDisksToAttach": [ - { - "diskId": "str", - "caching": "str", - "deleteOption": "str", - "diskEncryptionSet": {"id": "str"}, - "lun": 0, - "writeAcceleratorEnabled": bool, - } - ], - "dataDisksToDetach": [{"diskId": "str", "detachOption": "str"}], - }, - api_version="2025-04-01", - ).result() # call '.result()' to poll until service return final result - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_virtual_machine_scale_set_vms_begin_deallocate(self, resource_group): - response = self.client.virtual_machine_scale_set_vms.begin_deallocate( - resource_group_name=resource_group.name, - vm_scale_set_name="str", - instance_id="str", - api_version="2025-04-01", - ).result() # call '.result()' to poll until service return final result - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_virtual_machine_scale_set_vms_get_instance_view(self, resource_group): - response = self.client.virtual_machine_scale_set_vms.get_instance_view( - resource_group_name=resource_group.name, - vm_scale_set_name="str", - instance_id="str", - api_version="2025-04-01", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_virtual_machine_scale_set_vms_begin_perform_maintenance(self, resource_group): - response = self.client.virtual_machine_scale_set_vms.begin_perform_maintenance( - resource_group_name=resource_group.name, - vm_scale_set_name="str", - instance_id="str", - api_version="2025-04-01", - ).result() # call '.result()' to poll until service return final result - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_virtual_machine_scale_set_vms_begin_power_off(self, resource_group): - response = self.client.virtual_machine_scale_set_vms.begin_power_off( - resource_group_name=resource_group.name, - vm_scale_set_name="str", - instance_id="str", - api_version="2025-04-01", - ).result() # call '.result()' to poll until service return final result - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_virtual_machine_scale_set_vms_begin_redeploy(self, resource_group): - response = self.client.virtual_machine_scale_set_vms.begin_redeploy( - resource_group_name=resource_group.name, - vm_scale_set_name="str", - instance_id="str", - api_version="2025-04-01", - ).result() # call '.result()' to poll until service return final result - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_virtual_machine_scale_set_vms_begin_reimage(self, resource_group): - response = self.client.virtual_machine_scale_set_vms.begin_reimage( - resource_group_name=resource_group.name, - vm_scale_set_name="str", - instance_id="str", - api_version="2025-04-01", - ).result() # call '.result()' to poll until service return final result - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_virtual_machine_scale_set_vms_begin_reimage_all(self, resource_group): - response = self.client.virtual_machine_scale_set_vms.begin_reimage_all( - resource_group_name=resource_group.name, - vm_scale_set_name="str", - instance_id="str", - api_version="2025-04-01", - ).result() # call '.result()' to poll until service return final result - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_virtual_machine_scale_set_vms_begin_restart(self, resource_group): - response = self.client.virtual_machine_scale_set_vms.begin_restart( - resource_group_name=resource_group.name, - vm_scale_set_name="str", - instance_id="str", - api_version="2025-04-01", - ).result() # call '.result()' to poll until service return final result - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_virtual_machine_scale_set_vms_retrieve_boot_diagnostics_data(self, resource_group): - response = self.client.virtual_machine_scale_set_vms.retrieve_boot_diagnostics_data( - resource_group_name=resource_group.name, - vm_scale_set_name="str", - instance_id="str", - api_version="2025-04-01", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_virtual_machine_scale_set_vms_begin_run_command(self, resource_group): - response = self.client.virtual_machine_scale_set_vms.begin_run_command( - resource_group_name=resource_group.name, - vm_scale_set_name="str", - instance_id="str", - parameters={"commandId": "str", "parameters": [{"name": "str", "value": "str"}], "script": ["str"]}, - api_version="2025-04-01", - ).result() # call '.result()' to poll until service return final result - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_virtual_machine_scale_set_vms_simulate_eviction(self, resource_group): - response = self.client.virtual_machine_scale_set_vms.simulate_eviction( - resource_group_name=resource_group.name, - vm_scale_set_name="str", - instance_id="str", - api_version="2025-04-01", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_virtual_machine_scale_set_vms_begin_start(self, resource_group): - response = self.client.virtual_machine_scale_set_vms.begin_start( - resource_group_name=resource_group.name, - vm_scale_set_name="str", - instance_id="str", - api_version="2025-04-01", - ).result() # call '.result()' to poll until service return final result - - # please add some check logic here by yourself - # ... diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_virtual_machine_scale_sets_operations.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_virtual_machine_scale_sets_operations.py deleted file mode 100644 index 3961a22c6a63..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_virtual_machine_scale_sets_operations.py +++ /dev/null @@ -1,873 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import pytest -from azure.mgmt.compute import ComputeManagementClient - -from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy - -AZURE_LOCATION = "eastus" - - -@pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestComputeManagementVirtualMachineScaleSetsOperations(AzureMgmtRecordedTestCase): - def setup_method(self, method): - self.client = self.create_mgmt_client(ComputeManagementClient) - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_virtual_machine_scale_sets_list_by_location(self, resource_group): - response = self.client.virtual_machine_scale_sets.list_by_location( - location="str", - api_version="2025-04-01", - ) - result = [r for r in response] - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_virtual_machine_scale_sets_list_all(self, resource_group): - response = self.client.virtual_machine_scale_sets.list_all( - api_version="2025-04-01", - ) - result = [r for r in response] - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_virtual_machine_scale_sets_list(self, resource_group): - response = self.client.virtual_machine_scale_sets.list( - resource_group_name=resource_group.name, - api_version="2025-04-01", - ) - result = [r for r in response] - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_virtual_machine_scale_sets_get(self, resource_group): - response = self.client.virtual_machine_scale_sets.get( - resource_group_name=resource_group.name, - vm_scale_set_name="str", - api_version="2025-04-01", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_virtual_machine_scale_sets_begin_create_or_update(self, resource_group): - response = self.client.virtual_machine_scale_sets.begin_create_or_update( - resource_group_name=resource_group.name, - vm_scale_set_name="str", - parameters={ - "location": "str", - "additionalCapabilities": {"hibernationEnabled": bool, "ultraSSDEnabled": bool}, - "automaticRepairsPolicy": {"enabled": bool, "gracePeriod": "str", "repairAction": "str"}, - "constrainedMaximumCapacity": bool, - "doNotRunExtensionsOnOverprovisionedVMs": bool, - "etag": "str", - "extendedLocation": {"name": "str", "type": "str"}, - "highSpeedInterconnectPlacement": "str", - "hostGroup": {"id": "str"}, - "id": "str", - "identity": { - "principalId": "str", - "tenantId": "str", - "type": "str", - "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, - }, - "name": "str", - "orchestrationMode": "str", - "overprovision": bool, - "placement": {"excludeZones": ["str"], "includeZones": ["str"], "zonePlacementPolicy": "str"}, - "plan": {"name": "str", "product": "str", "promotionCode": "str", "publisher": "str"}, - "platformFaultDomainCount": 0, - "priorityMixPolicy": {"baseRegularPriorityCount": 0, "regularPriorityPercentageAboveBase": 0}, - "provisioningState": "str", - "proximityPlacementGroup": {"id": "str"}, - "resiliencyPolicy": { - "automaticZoneRebalancingPolicy": { - "enabled": bool, - "rebalanceBehavior": "str", - "rebalanceStrategy": "str", - }, - "resilientVMCreationPolicy": {"enabled": bool}, - "resilientVMDeletionPolicy": {"enabled": bool}, - "zoneAllocationPolicy": { - "maxInstancePercentPerZonePolicy": {"enabled": bool, "value": 0}, - "maxZoneCount": 0, - }, - }, - "scaleInPolicy": {"forceDeletion": bool, "prioritizeUnhealthyVMs": bool, "rules": ["str"]}, - "scheduledEventsPolicy": { - "allInstancesDown": {"automaticallyApprove": bool}, - "scheduledEventsAdditionalPublishingTargets": { - "eventGridAndResourceGraph": {"enable": bool, "scheduledEventsApiVersion": "str"} - }, - "userInitiatedReboot": {"automaticallyApprove": bool}, - "userInitiatedRedeploy": {"automaticallyApprove": bool}, - }, - "singlePlacementGroup": bool, - "sku": {"capacity": 0, "name": "str", "tier": "str"}, - "skuProfile": {"allocationStrategy": "str", "vmSizes": [{"name": "str", "rank": 0}]}, - "spotRestorePolicy": {"enabled": bool, "restoreTimeout": "str"}, - "systemData": { - "createdAt": "2020-02-20 00:00:00", - "createdBy": "str", - "createdByType": "str", - "lastModifiedAt": "2020-02-20 00:00:00", - "lastModifiedBy": "str", - "lastModifiedByType": "str", - }, - "tags": {"str": "str"}, - "timeCreated": "2020-02-20 00:00:00", - "type": "str", - "uniqueId": "str", - "upgradePolicy": { - "automaticOSUpgradePolicy": { - "disableAutomaticRollback": bool, - "enableAutomaticOSUpgrade": bool, - "osRollingUpgradeDeferral": bool, - "useRollingUpgradePolicy": bool, - }, - "mode": "str", - "rollingUpgradePolicy": { - "enableCrossZoneUpgrade": bool, - "maxBatchInstancePercent": 0, - "maxSurge": bool, - "maxUnhealthyInstancePercent": 0, - "maxUnhealthyUpgradedInstancePercent": 0, - "pauseTimeBetweenBatches": "str", - "prioritizeUnhealthyInstances": bool, - "rollbackFailedInstancesOnPolicyBreach": bool, - }, - }, - "virtualMachineProfile": { - "applicationProfile": { - "galleryApplications": [ - { - "packageReferenceId": "str", - "configurationReference": "str", - "enableAutomaticUpgrade": bool, - "order": 0, - "tags": "str", - "treatFailureAsDeploymentFailure": bool, - } - ] - }, - "billingProfile": {"maxPrice": 0.0}, - "capacityReservation": {"capacityReservationGroup": {"id": "str"}}, - "diagnosticsProfile": {"bootDiagnostics": {"enabled": bool, "storageUri": "str"}}, - "evictionPolicy": "str", - "extensionProfile": { - "extensions": [ - { - "autoUpgradeMinorVersion": bool, - "enableAutomaticUpgrade": bool, - "forceUpdateTag": "str", - "id": "str", - "name": "str", - "protectedSettings": {}, - "protectedSettingsFromKeyVault": {"secretUrl": "str", "sourceVault": {"id": "str"}}, - "provisionAfterExtensions": ["str"], - "provisioningState": "str", - "publisher": "str", - "settings": {}, - "suppressFailures": bool, - "type": "str", - "typeHandlerVersion": "str", - } - ], - "extensionsTimeBudget": "str", - }, - "hardwareProfile": {"vmSizeProperties": {"vCPUsAvailable": 0, "vCPUsPerCore": 0}}, - "licenseType": "str", - "networkProfile": { - "healthProbe": {"id": "str"}, - "networkApiVersion": "str", - "networkInterfaceConfigurations": [ - { - "name": "str", - "auxiliaryMode": "str", - "auxiliarySku": "str", - "deleteOption": "str", - "disableTcpStateTracking": bool, - "dnsSettings": {"dnsServers": ["str"]}, - "enableAcceleratedNetworking": bool, - "enableFpga": bool, - "enableIPForwarding": bool, - "ipConfigurations": [ - { - "name": "str", - "applicationGatewayBackendAddressPools": [{"id": "str"}], - "applicationSecurityGroups": [{"id": "str"}], - "loadBalancerBackendAddressPools": [{"id": "str"}], - "loadBalancerInboundNatPools": [{"id": "str"}], - "primary": bool, - "privateIPAddressVersion": "str", - "publicIPAddressConfiguration": { - "name": "str", - "deleteOption": "str", - "dnsSettings": {"domainNameLabel": "str", "domainNameLabelScope": "str"}, - "idleTimeoutInMinutes": 0, - "ipTags": [{"ipTagType": "str", "tag": "str"}], - "publicIPAddressVersion": "str", - "publicIPPrefix": {"id": "str"}, - "sku": {"name": "str", "tier": "str"}, - "tags": {"str": "str"}, - }, - "subnet": {"id": "str"}, - } - ], - "networkSecurityGroup": {"id": "str"}, - "primary": bool, - "tags": {"str": "str"}, - } - ], - }, - "osProfile": { - "adminPassword": "str", - "adminUsername": "str", - "allowExtensionOperations": bool, - "computerNamePrefix": "str", - "customData": "str", - "linuxConfiguration": { - "disablePasswordAuthentication": bool, - "enableVMAgentPlatformUpdates": bool, - "patchSettings": { - "assessmentMode": "str", - "automaticByPlatformSettings": { - "bypassPlatformSafetyChecksOnUserSchedule": bool, - "rebootSetting": "str", - }, - "patchMode": "str", - }, - "provisionVMAgent": bool, - "ssh": {"publicKeys": [{"keyData": "str", "path": "str"}]}, - }, - "requireGuestProvisionSignal": bool, - "secrets": [ - { - "sourceVault": {"id": "str"}, - "vaultCertificates": [{"certificateStore": "str", "certificateUrl": "str"}], - } - ], - "windowsConfiguration": { - "additionalUnattendContent": [ - { - "componentName": "Microsoft-Windows-Shell-Setup", - "content": "str", - "passName": "OobeSystem", - "settingName": "str", - } - ], - "enableAutomaticUpdates": bool, - "enableVMAgentPlatformUpdates": bool, - "patchSettings": { - "assessmentMode": "str", - "automaticByPlatformSettings": { - "bypassPlatformSafetyChecksOnUserSchedule": bool, - "rebootSetting": "str", - }, - "enableHotpatching": bool, - "patchMode": "str", - }, - "provisionVMAgent": bool, - "timeZone": "str", - "winRM": {"listeners": [{"certificateUrl": "str", "protocol": "str"}]}, - }, - }, - "priority": "str", - "scheduledEventsProfile": { - "osImageNotificationProfile": {"enable": bool, "notBeforeTimeout": "str"}, - "terminateNotificationProfile": {"enable": bool, "notBeforeTimeout": "str"}, - }, - "securityPostureReference": {"id": "str", "excludeExtensions": ["str"], "isOverridable": bool}, - "securityProfile": { - "encryptionAtHost": bool, - "encryptionIdentity": {"userAssignedIdentityResourceId": "str"}, - "proxyAgentSettings": { - "addProxyAgentExtension": bool, - "enabled": bool, - "imds": {"inVMAccessControlProfileReferenceId": "str", "mode": "str"}, - "keyIncarnationId": 0, - "mode": "str", - "wireServer": {"inVMAccessControlProfileReferenceId": "str", "mode": "str"}, - }, - "securityType": "str", - "uefiSettings": {"secureBootEnabled": bool, "vTpmEnabled": bool}, - }, - "serviceArtifactReference": {"id": "str"}, - "storageProfile": { - "dataDisks": [ - { - "createOption": "str", - "lun": 0, - "caching": "str", - "deleteOption": "str", - "diskIOPSReadWrite": 0, - "diskMBpsReadWrite": 0, - "diskSizeGB": 0, - "managedDisk": { - "diskEncryptionSet": {"id": "str"}, - "securityProfile": { - "diskEncryptionSet": {"id": "str"}, - "securityEncryptionType": "str", - }, - "storageAccountType": "str", - }, - "name": "str", - "writeAcceleratorEnabled": bool, - } - ], - "diskControllerType": "str", - "imageReference": { - "communityGalleryImageId": "str", - "exactVersion": "str", - "id": "str", - "offer": "str", - "publisher": "str", - "sharedGalleryImageId": "str", - "sku": "str", - "version": "str", - }, - "osDisk": { - "createOption": "str", - "caching": "str", - "deleteOption": "str", - "diffDiskSettings": {"option": "str", "placement": "str"}, - "diskSizeGB": 0, - "image": {"uri": "str"}, - "managedDisk": { - "diskEncryptionSet": {"id": "str"}, - "securityProfile": { - "diskEncryptionSet": {"id": "str"}, - "securityEncryptionType": "str", - }, - "storageAccountType": "str", - }, - "name": "str", - "osType": "str", - "vhdContainers": ["str"], - "writeAcceleratorEnabled": bool, - }, - }, - "timeCreated": "2020-02-20 00:00:00", - "userData": "str", - }, - "zonalPlatformFaultDomainAlignMode": "str", - "zoneBalance": bool, - "zones": ["str"], - }, - api_version="2025-04-01", - ).result() # call '.result()' to poll until service return final result - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_virtual_machine_scale_sets_begin_update(self, resource_group): - response = self.client.virtual_machine_scale_sets.begin_update( - resource_group_name=resource_group.name, - vm_scale_set_name="str", - parameters={ - "additionalCapabilities": {"hibernationEnabled": bool, "ultraSSDEnabled": bool}, - "automaticRepairsPolicy": {"enabled": bool, "gracePeriod": "str", "repairAction": "str"}, - "doNotRunExtensionsOnOverprovisionedVMs": bool, - "identity": { - "principalId": "str", - "tenantId": "str", - "type": "str", - "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, - }, - "overprovision": bool, - "plan": {"name": "str", "product": "str", "promotionCode": "str", "publisher": "str"}, - "priorityMixPolicy": {"baseRegularPriorityCount": 0, "regularPriorityPercentageAboveBase": 0}, - "proximityPlacementGroup": {"id": "str"}, - "resiliencyPolicy": { - "automaticZoneRebalancingPolicy": { - "enabled": bool, - "rebalanceBehavior": "str", - "rebalanceStrategy": "str", - }, - "resilientVMCreationPolicy": {"enabled": bool}, - "resilientVMDeletionPolicy": {"enabled": bool}, - "zoneAllocationPolicy": { - "maxInstancePercentPerZonePolicy": {"enabled": bool, "value": 0}, - "maxZoneCount": 0, - }, - }, - "scaleInPolicy": {"forceDeletion": bool, "prioritizeUnhealthyVMs": bool, "rules": ["str"]}, - "singlePlacementGroup": bool, - "sku": {"capacity": 0, "name": "str", "tier": "str"}, - "skuProfile": {"allocationStrategy": "str", "vmSizes": [{"name": "str", "rank": 0}]}, - "spotRestorePolicy": {"enabled": bool, "restoreTimeout": "str"}, - "tags": {"str": "str"}, - "upgradePolicy": { - "automaticOSUpgradePolicy": { - "disableAutomaticRollback": bool, - "enableAutomaticOSUpgrade": bool, - "osRollingUpgradeDeferral": bool, - "useRollingUpgradePolicy": bool, - }, - "mode": "str", - "rollingUpgradePolicy": { - "enableCrossZoneUpgrade": bool, - "maxBatchInstancePercent": 0, - "maxSurge": bool, - "maxUnhealthyInstancePercent": 0, - "maxUnhealthyUpgradedInstancePercent": 0, - "pauseTimeBetweenBatches": "str", - "prioritizeUnhealthyInstances": bool, - "rollbackFailedInstancesOnPolicyBreach": bool, - }, - }, - "virtualMachineProfile": { - "billingProfile": {"maxPrice": 0.0}, - "diagnosticsProfile": {"bootDiagnostics": {"enabled": bool, "storageUri": "str"}}, - "extensionProfile": { - "extensions": [ - { - "autoUpgradeMinorVersion": bool, - "enableAutomaticUpgrade": bool, - "forceUpdateTag": "str", - "id": "str", - "name": "str", - "protectedSettings": {}, - "protectedSettingsFromKeyVault": {"secretUrl": "str", "sourceVault": {"id": "str"}}, - "provisionAfterExtensions": ["str"], - "provisioningState": "str", - "publisher": "str", - "settings": {}, - "suppressFailures": bool, - "type": "str", - "typeHandlerVersion": "str", - } - ], - "extensionsTimeBudget": "str", - }, - "hardwareProfile": {"vmSizeProperties": {"vCPUsAvailable": 0, "vCPUsPerCore": 0}}, - "licenseType": "str", - "networkProfile": { - "healthProbe": {"id": "str"}, - "networkApiVersion": "str", - "networkInterfaceConfigurations": [ - { - "auxiliaryMode": "str", - "auxiliarySku": "str", - "deleteOption": "str", - "disableTcpStateTracking": bool, - "dnsSettings": {"dnsServers": ["str"]}, - "enableAcceleratedNetworking": bool, - "enableFpga": bool, - "enableIPForwarding": bool, - "ipConfigurations": [ - { - "applicationGatewayBackendAddressPools": [{"id": "str"}], - "applicationSecurityGroups": [{"id": "str"}], - "loadBalancerBackendAddressPools": [{"id": "str"}], - "loadBalancerInboundNatPools": [{"id": "str"}], - "name": "str", - "primary": bool, - "privateIPAddressVersion": "str", - "publicIPAddressConfiguration": { - "deleteOption": "str", - "dnsSettings": {"domainNameLabel": "str", "domainNameLabelScope": "str"}, - "idleTimeoutInMinutes": 0, - "name": "str", - "publicIPPrefix": {"id": "str"}, - "tags": {"str": "str"}, - }, - "subnet": {"id": "str"}, - } - ], - "name": "str", - "networkSecurityGroup": {"id": "str"}, - "primary": bool, - "tags": {"str": "str"}, - } - ], - }, - "osProfile": { - "customData": "str", - "linuxConfiguration": { - "disablePasswordAuthentication": bool, - "enableVMAgentPlatformUpdates": bool, - "patchSettings": { - "assessmentMode": "str", - "automaticByPlatformSettings": { - "bypassPlatformSafetyChecksOnUserSchedule": bool, - "rebootSetting": "str", - }, - "patchMode": "str", - }, - "provisionVMAgent": bool, - "ssh": {"publicKeys": [{"keyData": "str", "path": "str"}]}, - }, - "secrets": [ - { - "sourceVault": {"id": "str"}, - "vaultCertificates": [{"certificateStore": "str", "certificateUrl": "str"}], - } - ], - "windowsConfiguration": { - "additionalUnattendContent": [ - { - "componentName": "Microsoft-Windows-Shell-Setup", - "content": "str", - "passName": "OobeSystem", - "settingName": "str", - } - ], - "enableAutomaticUpdates": bool, - "enableVMAgentPlatformUpdates": bool, - "patchSettings": { - "assessmentMode": "str", - "automaticByPlatformSettings": { - "bypassPlatformSafetyChecksOnUserSchedule": bool, - "rebootSetting": "str", - }, - "enableHotpatching": bool, - "patchMode": "str", - }, - "provisionVMAgent": bool, - "timeZone": "str", - "winRM": {"listeners": [{"certificateUrl": "str", "protocol": "str"}]}, - }, - }, - "scheduledEventsProfile": { - "osImageNotificationProfile": {"enable": bool, "notBeforeTimeout": "str"}, - "terminateNotificationProfile": {"enable": bool, "notBeforeTimeout": "str"}, - }, - "securityPostureReference": {"excludeExtensions": ["str"], "id": "str", "isOverridable": bool}, - "securityProfile": { - "encryptionAtHost": bool, - "encryptionIdentity": {"userAssignedIdentityResourceId": "str"}, - "proxyAgentSettings": { - "addProxyAgentExtension": bool, - "enabled": bool, - "imds": {"inVMAccessControlProfileReferenceId": "str", "mode": "str"}, - "keyIncarnationId": 0, - "mode": "str", - "wireServer": {"inVMAccessControlProfileReferenceId": "str", "mode": "str"}, - }, - "securityType": "str", - "uefiSettings": {"secureBootEnabled": bool, "vTpmEnabled": bool}, - }, - "storageProfile": { - "dataDisks": [ - { - "createOption": "str", - "lun": 0, - "caching": "str", - "deleteOption": "str", - "diskIOPSReadWrite": 0, - "diskMBpsReadWrite": 0, - "diskSizeGB": 0, - "managedDisk": { - "diskEncryptionSet": {"id": "str"}, - "securityProfile": { - "diskEncryptionSet": {"id": "str"}, - "securityEncryptionType": "str", - }, - "storageAccountType": "str", - }, - "name": "str", - "writeAcceleratorEnabled": bool, - } - ], - "diskControllerType": "str", - "imageReference": { - "communityGalleryImageId": "str", - "exactVersion": "str", - "id": "str", - "offer": "str", - "publisher": "str", - "sharedGalleryImageId": "str", - "sku": "str", - "version": "str", - }, - "osDisk": { - "caching": "str", - "deleteOption": "str", - "diffDiskSettings": {"option": "str", "placement": "str"}, - "diskSizeGB": 0, - "image": {"uri": "str"}, - "managedDisk": { - "diskEncryptionSet": {"id": "str"}, - "securityProfile": { - "diskEncryptionSet": {"id": "str"}, - "securityEncryptionType": "str", - }, - "storageAccountType": "str", - }, - "vhdContainers": ["str"], - "writeAcceleratorEnabled": bool, - }, - }, - "userData": "str", - }, - "zonalPlatformFaultDomainAlignMode": "str", - "zones": ["str"], - }, - api_version="2025-04-01", - ).result() # call '.result()' to poll until service return final result - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_virtual_machine_scale_sets_begin_delete(self, resource_group): - response = self.client.virtual_machine_scale_sets.begin_delete( - resource_group_name=resource_group.name, - vm_scale_set_name="str", - api_version="2025-04-01", - ).result() # call '.result()' to poll until service return final result - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_virtual_machine_scale_sets_begin_approve_rolling_upgrade(self, resource_group): - response = self.client.virtual_machine_scale_sets.begin_approve_rolling_upgrade( - resource_group_name=resource_group.name, - vm_scale_set_name="str", - api_version="2025-04-01", - ).result() # call '.result()' to poll until service return final result - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_virtual_machine_scale_sets_convert_to_single_placement_group(self, resource_group): - response = self.client.virtual_machine_scale_sets.convert_to_single_placement_group( - resource_group_name=resource_group.name, - vm_scale_set_name="str", - parameters={"activePlacementGroupId": "str"}, - api_version="2025-04-01", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_virtual_machine_scale_sets_begin_deallocate(self, resource_group): - response = self.client.virtual_machine_scale_sets.begin_deallocate( - resource_group_name=resource_group.name, - vm_scale_set_name="str", - api_version="2025-04-01", - ).result() # call '.result()' to poll until service return final result - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_virtual_machine_scale_sets_begin_delete_instances(self, resource_group): - response = self.client.virtual_machine_scale_sets.begin_delete_instances( - resource_group_name=resource_group.name, - vm_scale_set_name="str", - vm_instance_i_ds={"instanceIds": ["str"]}, - api_version="2025-04-01", - ).result() # call '.result()' to poll until service return final result - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_virtual_machine_scale_sets_force_recovery_service_fabric_platform_update_domain_walk(self, resource_group): - response = self.client.virtual_machine_scale_sets.force_recovery_service_fabric_platform_update_domain_walk( - resource_group_name=resource_group.name, - vm_scale_set_name="str", - platform_update_domain=0, - api_version="2025-04-01", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_virtual_machine_scale_sets_get_instance_view(self, resource_group): - response = self.client.virtual_machine_scale_sets.get_instance_view( - resource_group_name=resource_group.name, - vm_scale_set_name="str", - api_version="2025-04-01", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_virtual_machine_scale_sets_begin_update_instances(self, resource_group): - response = self.client.virtual_machine_scale_sets.begin_update_instances( - resource_group_name=resource_group.name, - vm_scale_set_name="str", - vm_instance_i_ds={"instanceIds": ["str"]}, - api_version="2025-04-01", - ).result() # call '.result()' to poll until service return final result - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_virtual_machine_scale_sets_get_os_upgrade_history(self, resource_group): - response = self.client.virtual_machine_scale_sets.get_os_upgrade_history( - resource_group_name=resource_group.name, - vm_scale_set_name="str", - api_version="2025-04-01", - ) - result = [r for r in response] - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_virtual_machine_scale_sets_begin_perform_maintenance(self, resource_group): - response = self.client.virtual_machine_scale_sets.begin_perform_maintenance( - resource_group_name=resource_group.name, - vm_scale_set_name="str", - api_version="2025-04-01", - ).result() # call '.result()' to poll until service return final result - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_virtual_machine_scale_sets_begin_power_off(self, resource_group): - response = self.client.virtual_machine_scale_sets.begin_power_off( - resource_group_name=resource_group.name, - vm_scale_set_name="str", - api_version="2025-04-01", - ).result() # call '.result()' to poll until service return final result - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_virtual_machine_scale_sets_begin_reapply(self, resource_group): - response = self.client.virtual_machine_scale_sets.begin_reapply( - resource_group_name=resource_group.name, - vm_scale_set_name="str", - api_version="2025-04-01", - ).result() # call '.result()' to poll until service return final result - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_virtual_machine_scale_sets_begin_redeploy(self, resource_group): - response = self.client.virtual_machine_scale_sets.begin_redeploy( - resource_group_name=resource_group.name, - vm_scale_set_name="str", - api_version="2025-04-01", - ).result() # call '.result()' to poll until service return final result - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_virtual_machine_scale_sets_begin_reimage(self, resource_group): - response = self.client.virtual_machine_scale_sets.begin_reimage( - resource_group_name=resource_group.name, - vm_scale_set_name="str", - api_version="2025-04-01", - ).result() # call '.result()' to poll until service return final result - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_virtual_machine_scale_sets_begin_reimage_all(self, resource_group): - response = self.client.virtual_machine_scale_sets.begin_reimage_all( - resource_group_name=resource_group.name, - vm_scale_set_name="str", - api_version="2025-04-01", - ).result() # call '.result()' to poll until service return final result - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_virtual_machine_scale_sets_begin_restart(self, resource_group): - response = self.client.virtual_machine_scale_sets.begin_restart( - resource_group_name=resource_group.name, - vm_scale_set_name="str", - api_version="2025-04-01", - ).result() # call '.result()' to poll until service return final result - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_virtual_machine_scale_sets_begin_scale_out(self, resource_group): - response = self.client.virtual_machine_scale_sets.begin_scale_out( - resource_group_name=resource_group.name, - vm_scale_set_name="str", - parameters={"capacity": 0, "properties": {"zone": "str"}}, - api_version="2025-04-01", - ).result() # call '.result()' to poll until service return final result - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_virtual_machine_scale_sets_begin_set_orchestration_service_state(self, resource_group): - response = self.client.virtual_machine_scale_sets.begin_set_orchestration_service_state( - resource_group_name=resource_group.name, - vm_scale_set_name="str", - parameters={"action": "str", "serviceName": "str"}, - api_version="2025-04-01", - ).result() # call '.result()' to poll until service return final result - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_virtual_machine_scale_sets_list_skus(self, resource_group): - response = self.client.virtual_machine_scale_sets.list_skus( - resource_group_name=resource_group.name, - vm_scale_set_name="str", - api_version="2025-04-01", - ) - result = [r for r in response] - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_virtual_machine_scale_sets_begin_start(self, resource_group): - response = self.client.virtual_machine_scale_sets.begin_start( - resource_group_name=resource_group.name, - vm_scale_set_name="str", - api_version="2025-04-01", - ).result() # call '.result()' to poll until service return final result - - # please add some check logic here by yourself - # ... diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_virtual_machines_operations.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_virtual_machines_operations.py deleted file mode 100644 index 25c6522deec9..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_virtual_machines_operations.py +++ /dev/null @@ -1,1229 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import pytest -from azure.mgmt.compute import ComputeManagementClient - -from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy - -AZURE_LOCATION = "eastus" - - -@pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestComputeManagementVirtualMachinesOperations(AzureMgmtRecordedTestCase): - def setup_method(self, method): - self.client = self.create_mgmt_client(ComputeManagementClient) - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_virtual_machines_list_by_location(self, resource_group): - response = self.client.virtual_machines.list_by_location( - location="str", - api_version="2025-04-01", - ) - result = [r for r in response] - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_virtual_machines_list_all(self, resource_group): - response = self.client.virtual_machines.list_all( - api_version="2025-04-01", - ) - result = [r for r in response] - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_virtual_machines_list(self, resource_group): - response = self.client.virtual_machines.list( - resource_group_name=resource_group.name, - api_version="2025-04-01", - ) - result = [r for r in response] - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_virtual_machines_get(self, resource_group): - response = self.client.virtual_machines.get( - resource_group_name=resource_group.name, - vm_name="str", - api_version="2025-04-01", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_virtual_machines_begin_create_or_update(self, resource_group): - response = self.client.virtual_machines.begin_create_or_update( - resource_group_name=resource_group.name, - vm_name="str", - parameters={ - "location": "str", - "additionalCapabilities": {"hibernationEnabled": bool, "ultraSSDEnabled": bool}, - "applicationProfile": { - "galleryApplications": [ - { - "packageReferenceId": "str", - "configurationReference": "str", - "enableAutomaticUpgrade": bool, - "order": 0, - "tags": "str", - "treatFailureAsDeploymentFailure": bool, - } - ] - }, - "availabilitySet": {"id": "str"}, - "billingProfile": {"maxPrice": 0.0}, - "capacityReservation": {"capacityReservationGroup": {"id": "str"}}, - "diagnosticsProfile": {"bootDiagnostics": {"enabled": bool, "storageUri": "str"}}, - "etag": "str", - "evictionPolicy": "str", - "extendedLocation": {"name": "str", "type": "str"}, - "extensionsTimeBudget": "str", - "hardwareProfile": {"vmSize": "str", "vmSizeProperties": {"vCPUsAvailable": 0, "vCPUsPerCore": 0}}, - "host": {"id": "str"}, - "hostGroup": {"id": "str"}, - "id": "str", - "identity": { - "principalId": "str", - "tenantId": "str", - "type": "str", - "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, - }, - "instanceView": { - "assignedHost": "str", - "bootDiagnostics": { - "consoleScreenshotBlobUri": "str", - "serialConsoleLogBlobUri": "str", - "status": { - "code": "str", - "displayStatus": "str", - "level": "str", - "message": "str", - "time": "2020-02-20 00:00:00", - }, - }, - "computerName": "str", - "disks": [ - { - "encryptionSettings": [ - { - "diskEncryptionKey": {"secretUrl": "str", "sourceVault": {"id": "str"}}, - "enabled": bool, - "keyEncryptionKey": {"keyUrl": "str", "sourceVault": {"id": "str"}}, - } - ], - "name": "str", - "statuses": [ - { - "code": "str", - "displayStatus": "str", - "level": "str", - "message": "str", - "time": "2020-02-20 00:00:00", - } - ], - } - ], - "extensions": [ - { - "name": "str", - "statuses": [ - { - "code": "str", - "displayStatus": "str", - "level": "str", - "message": "str", - "time": "2020-02-20 00:00:00", - } - ], - "substatuses": [ - { - "code": "str", - "displayStatus": "str", - "level": "str", - "message": "str", - "time": "2020-02-20 00:00:00", - } - ], - "type": "str", - "typeHandlerVersion": "str", - } - ], - "hyperVGeneration": "str", - "isVMInStandbyPool": bool, - "maintenanceRedeployStatus": { - "isCustomerInitiatedMaintenanceAllowed": bool, - "lastOperationMessage": "str", - "lastOperationResultCode": "str", - "maintenanceWindowEndTime": "2020-02-20 00:00:00", - "maintenanceWindowStartTime": "2020-02-20 00:00:00", - "preMaintenanceWindowEndTime": "2020-02-20 00:00:00", - "preMaintenanceWindowStartTime": "2020-02-20 00:00:00", - }, - "osName": "str", - "osVersion": "str", - "patchStatus": { - "availablePatchSummary": { - "assessmentActivityId": "str", - "criticalAndSecurityPatchCount": 0, - "error": { - "code": "str", - "details": [{"code": "str", "message": "str", "target": "str"}], - "innererror": {"errordetail": "str", "exceptiontype": "str"}, - "message": "str", - "target": "str", - }, - "lastModifiedTime": "2020-02-20 00:00:00", - "otherPatchCount": 0, - "rebootPending": bool, - "startTime": "2020-02-20 00:00:00", - "status": "str", - }, - "configurationStatuses": [ - { - "code": "str", - "displayStatus": "str", - "level": "str", - "message": "str", - "time": "2020-02-20 00:00:00", - } - ], - "lastPatchInstallationSummary": { - "error": { - "code": "str", - "details": [{"code": "str", "message": "str", "target": "str"}], - "innererror": {"errordetail": "str", "exceptiontype": "str"}, - "message": "str", - "target": "str", - }, - "excludedPatchCount": 0, - "failedPatchCount": 0, - "installationActivityId": "str", - "installedPatchCount": 0, - "lastModifiedTime": "2020-02-20 00:00:00", - "maintenanceWindowExceeded": bool, - "notSelectedPatchCount": 0, - "pendingPatchCount": 0, - "startTime": "2020-02-20 00:00:00", - "status": "str", - }, - }, - "platformFaultDomain": 0, - "platformUpdateDomain": 0, - "rdpThumbPrint": "str", - "statuses": [ - { - "code": "str", - "displayStatus": "str", - "level": "str", - "message": "str", - "time": "2020-02-20 00:00:00", - } - ], - "vmAgent": { - "extensionHandlers": [ - { - "status": { - "code": "str", - "displayStatus": "str", - "level": "str", - "message": "str", - "time": "2020-02-20 00:00:00", - }, - "type": "str", - "typeHandlerVersion": "str", - } - ], - "statuses": [ - { - "code": "str", - "displayStatus": "str", - "level": "str", - "message": "str", - "time": "2020-02-20 00:00:00", - } - ], - "vmAgentVersion": "str", - }, - "vmHealth": { - "status": { - "code": "str", - "displayStatus": "str", - "level": "str", - "message": "str", - "time": "2020-02-20 00:00:00", - } - }, - }, - "licenseType": "str", - "managedBy": "str", - "name": "str", - "networkProfile": { - "networkApiVersion": "str", - "networkInterfaceConfigurations": [ - { - "name": "str", - "auxiliaryMode": "str", - "auxiliarySku": "str", - "deleteOption": "str", - "disableTcpStateTracking": bool, - "dnsSettings": {"dnsServers": ["str"]}, - "dscpConfiguration": {"id": "str"}, - "enableAcceleratedNetworking": bool, - "enableFpga": bool, - "enableIPForwarding": bool, - "ipConfigurations": [ - { - "name": "str", - "applicationGatewayBackendAddressPools": [{"id": "str"}], - "applicationSecurityGroups": [{"id": "str"}], - "loadBalancerBackendAddressPools": [{"id": "str"}], - "primary": bool, - "privateIPAddressVersion": "str", - "publicIPAddressConfiguration": { - "name": "str", - "deleteOption": "str", - "dnsSettings": {"domainNameLabel": "str", "domainNameLabelScope": "str"}, - "idleTimeoutInMinutes": 0, - "ipTags": [{"ipTagType": "str", "tag": "str"}], - "publicIPAddressVersion": "str", - "publicIPAllocationMethod": "str", - "publicIPPrefix": {"id": "str"}, - "sku": {"name": "str", "tier": "str"}, - "tags": {"str": "str"}, - }, - "subnet": {"id": "str"}, - } - ], - "networkSecurityGroup": {"id": "str"}, - "primary": bool, - "tags": {"str": "str"}, - } - ], - "networkInterfaces": [{"deleteOption": "str", "id": "str", "primary": bool}], - }, - "osProfile": { - "adminPassword": "str", - "adminUsername": "str", - "allowExtensionOperations": bool, - "computerName": "str", - "customData": "str", - "linuxConfiguration": { - "disablePasswordAuthentication": bool, - "enableVMAgentPlatformUpdates": bool, - "patchSettings": { - "assessmentMode": "str", - "automaticByPlatformSettings": { - "bypassPlatformSafetyChecksOnUserSchedule": bool, - "rebootSetting": "str", - }, - "patchMode": "str", - }, - "provisionVMAgent": bool, - "ssh": {"publicKeys": [{"keyData": "str", "path": "str"}]}, - }, - "requireGuestProvisionSignal": bool, - "secrets": [ - { - "sourceVault": {"id": "str"}, - "vaultCertificates": [{"certificateStore": "str", "certificateUrl": "str"}], - } - ], - "windowsConfiguration": { - "additionalUnattendContent": [ - { - "componentName": "Microsoft-Windows-Shell-Setup", - "content": "str", - "passName": "OobeSystem", - "settingName": "str", - } - ], - "enableAutomaticUpdates": bool, - "enableVMAgentPlatformUpdates": bool, - "patchSettings": { - "assessmentMode": "str", - "automaticByPlatformSettings": { - "bypassPlatformSafetyChecksOnUserSchedule": bool, - "rebootSetting": "str", - }, - "enableHotpatching": bool, - "patchMode": "str", - }, - "provisionVMAgent": bool, - "timeZone": "str", - "winRM": {"listeners": [{"certificateUrl": "str", "protocol": "str"}]}, - }, - }, - "placement": {"excludeZones": ["str"], "includeZones": ["str"], "zonePlacementPolicy": "str"}, - "plan": {"name": "str", "product": "str", "promotionCode": "str", "publisher": "str"}, - "platformFaultDomain": 0, - "priority": "str", - "provisioningState": "str", - "proximityPlacementGroup": {"id": "str"}, - "resources": [ - { - "location": "str", - "autoUpgradeMinorVersion": bool, - "enableAutomaticUpgrade": bool, - "forceUpdateTag": "str", - "id": "str", - "instanceView": { - "name": "str", - "statuses": [ - { - "code": "str", - "displayStatus": "str", - "level": "str", - "message": "str", - "time": "2020-02-20 00:00:00", - } - ], - "substatuses": [ - { - "code": "str", - "displayStatus": "str", - "level": "str", - "message": "str", - "time": "2020-02-20 00:00:00", - } - ], - "type": "str", - "typeHandlerVersion": "str", - }, - "name": "str", - "protectedSettings": {}, - "protectedSettingsFromKeyVault": {"secretUrl": "str", "sourceVault": {"id": "str"}}, - "provisionAfterExtensions": ["str"], - "provisioningState": "str", - "publisher": "str", - "settings": {}, - "suppressFailures": bool, - "systemData": { - "createdAt": "2020-02-20 00:00:00", - "createdBy": "str", - "createdByType": "str", - "lastModifiedAt": "2020-02-20 00:00:00", - "lastModifiedBy": "str", - "lastModifiedByType": "str", - }, - "tags": {"str": "str"}, - "type": "str", - "typeHandlerVersion": "str", - } - ], - "scheduledEventsPolicy": { - "allInstancesDown": {"automaticallyApprove": bool}, - "scheduledEventsAdditionalPublishingTargets": { - "eventGridAndResourceGraph": {"enable": bool, "scheduledEventsApiVersion": "str"} - }, - "userInitiatedReboot": {"automaticallyApprove": bool}, - "userInitiatedRedeploy": {"automaticallyApprove": bool}, - }, - "scheduledEventsProfile": { - "osImageNotificationProfile": {"enable": bool, "notBeforeTimeout": "str"}, - "terminateNotificationProfile": {"enable": bool, "notBeforeTimeout": "str"}, - }, - "securityProfile": { - "encryptionAtHost": bool, - "encryptionIdentity": {"userAssignedIdentityResourceId": "str"}, - "proxyAgentSettings": { - "addProxyAgentExtension": bool, - "enabled": bool, - "imds": {"inVMAccessControlProfileReferenceId": "str", "mode": "str"}, - "keyIncarnationId": 0, - "mode": "str", - "wireServer": {"inVMAccessControlProfileReferenceId": "str", "mode": "str"}, - }, - "securityType": "str", - "uefiSettings": {"secureBootEnabled": bool, "vTpmEnabled": bool}, - }, - "storageProfile": { - "alignRegionalDisksToVMZone": bool, - "dataDisks": [ - { - "createOption": "str", - "lun": 0, - "caching": "str", - "deleteOption": "str", - "detachOption": "str", - "diskIOPSReadWrite": 0, - "diskMBpsReadWrite": 0, - "diskSizeGB": 0, - "image": {"uri": "str"}, - "managedDisk": { - "diskEncryptionSet": {"id": "str"}, - "id": "str", - "securityProfile": { - "diskEncryptionSet": {"id": "str"}, - "securityEncryptionType": "str", - }, - "storageAccountType": "str", - }, - "name": "str", - "sourceResource": {"id": "str"}, - "toBeDetached": bool, - "vhd": {"uri": "str"}, - "writeAcceleratorEnabled": bool, - } - ], - "diskControllerType": "str", - "imageReference": { - "communityGalleryImageId": "str", - "exactVersion": "str", - "id": "str", - "offer": "str", - "publisher": "str", - "sharedGalleryImageId": "str", - "sku": "str", - "version": "str", - }, - "osDisk": { - "createOption": "str", - "caching": "str", - "deleteOption": "str", - "diffDiskSettings": {"option": "str", "placement": "str"}, - "diskSizeGB": 0, - "encryptionSettings": { - "diskEncryptionKey": {"secretUrl": "str", "sourceVault": {"id": "str"}}, - "enabled": bool, - "keyEncryptionKey": {"keyUrl": "str", "sourceVault": {"id": "str"}}, - }, - "image": {"uri": "str"}, - "managedDisk": { - "diskEncryptionSet": {"id": "str"}, - "id": "str", - "securityProfile": {"diskEncryptionSet": {"id": "str"}, "securityEncryptionType": "str"}, - "storageAccountType": "str", - }, - "name": "str", - "osType": "str", - "vhd": {"uri": "str"}, - "writeAcceleratorEnabled": bool, - }, - }, - "systemData": { - "createdAt": "2020-02-20 00:00:00", - "createdBy": "str", - "createdByType": "str", - "lastModifiedAt": "2020-02-20 00:00:00", - "lastModifiedBy": "str", - "lastModifiedByType": "str", - }, - "tags": {"str": "str"}, - "timeCreated": "2020-02-20 00:00:00", - "type": "str", - "userData": "str", - "virtualMachineScaleSet": {"id": "str"}, - "vmId": "str", - "zones": ["str"], - }, - api_version="2025-04-01", - ).result() # call '.result()' to poll until service return final result - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_virtual_machines_begin_update(self, resource_group): - response = self.client.virtual_machines.begin_update( - resource_group_name=resource_group.name, - vm_name="str", - parameters={ - "additionalCapabilities": {"hibernationEnabled": bool, "ultraSSDEnabled": bool}, - "applicationProfile": { - "galleryApplications": [ - { - "packageReferenceId": "str", - "configurationReference": "str", - "enableAutomaticUpgrade": bool, - "order": 0, - "tags": "str", - "treatFailureAsDeploymentFailure": bool, - } - ] - }, - "availabilitySet": {"id": "str"}, - "billingProfile": {"maxPrice": 0.0}, - "capacityReservation": {"capacityReservationGroup": {"id": "str"}}, - "diagnosticsProfile": {"bootDiagnostics": {"enabled": bool, "storageUri": "str"}}, - "evictionPolicy": "str", - "extensionsTimeBudget": "str", - "hardwareProfile": {"vmSize": "str", "vmSizeProperties": {"vCPUsAvailable": 0, "vCPUsPerCore": 0}}, - "host": {"id": "str"}, - "hostGroup": {"id": "str"}, - "identity": { - "principalId": "str", - "tenantId": "str", - "type": "str", - "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, - }, - "instanceView": { - "assignedHost": "str", - "bootDiagnostics": { - "consoleScreenshotBlobUri": "str", - "serialConsoleLogBlobUri": "str", - "status": { - "code": "str", - "displayStatus": "str", - "level": "str", - "message": "str", - "time": "2020-02-20 00:00:00", - }, - }, - "computerName": "str", - "disks": [ - { - "encryptionSettings": [ - { - "diskEncryptionKey": {"secretUrl": "str", "sourceVault": {"id": "str"}}, - "enabled": bool, - "keyEncryptionKey": {"keyUrl": "str", "sourceVault": {"id": "str"}}, - } - ], - "name": "str", - "statuses": [ - { - "code": "str", - "displayStatus": "str", - "level": "str", - "message": "str", - "time": "2020-02-20 00:00:00", - } - ], - } - ], - "extensions": [ - { - "name": "str", - "statuses": [ - { - "code": "str", - "displayStatus": "str", - "level": "str", - "message": "str", - "time": "2020-02-20 00:00:00", - } - ], - "substatuses": [ - { - "code": "str", - "displayStatus": "str", - "level": "str", - "message": "str", - "time": "2020-02-20 00:00:00", - } - ], - "type": "str", - "typeHandlerVersion": "str", - } - ], - "hyperVGeneration": "str", - "isVMInStandbyPool": bool, - "maintenanceRedeployStatus": { - "isCustomerInitiatedMaintenanceAllowed": bool, - "lastOperationMessage": "str", - "lastOperationResultCode": "str", - "maintenanceWindowEndTime": "2020-02-20 00:00:00", - "maintenanceWindowStartTime": "2020-02-20 00:00:00", - "preMaintenanceWindowEndTime": "2020-02-20 00:00:00", - "preMaintenanceWindowStartTime": "2020-02-20 00:00:00", - }, - "osName": "str", - "osVersion": "str", - "patchStatus": { - "availablePatchSummary": { - "assessmentActivityId": "str", - "criticalAndSecurityPatchCount": 0, - "error": { - "code": "str", - "details": [{"code": "str", "message": "str", "target": "str"}], - "innererror": {"errordetail": "str", "exceptiontype": "str"}, - "message": "str", - "target": "str", - }, - "lastModifiedTime": "2020-02-20 00:00:00", - "otherPatchCount": 0, - "rebootPending": bool, - "startTime": "2020-02-20 00:00:00", - "status": "str", - }, - "configurationStatuses": [ - { - "code": "str", - "displayStatus": "str", - "level": "str", - "message": "str", - "time": "2020-02-20 00:00:00", - } - ], - "lastPatchInstallationSummary": { - "error": { - "code": "str", - "details": [{"code": "str", "message": "str", "target": "str"}], - "innererror": {"errordetail": "str", "exceptiontype": "str"}, - "message": "str", - "target": "str", - }, - "excludedPatchCount": 0, - "failedPatchCount": 0, - "installationActivityId": "str", - "installedPatchCount": 0, - "lastModifiedTime": "2020-02-20 00:00:00", - "maintenanceWindowExceeded": bool, - "notSelectedPatchCount": 0, - "pendingPatchCount": 0, - "startTime": "2020-02-20 00:00:00", - "status": "str", - }, - }, - "platformFaultDomain": 0, - "platformUpdateDomain": 0, - "rdpThumbPrint": "str", - "statuses": [ - { - "code": "str", - "displayStatus": "str", - "level": "str", - "message": "str", - "time": "2020-02-20 00:00:00", - } - ], - "vmAgent": { - "extensionHandlers": [ - { - "status": { - "code": "str", - "displayStatus": "str", - "level": "str", - "message": "str", - "time": "2020-02-20 00:00:00", - }, - "type": "str", - "typeHandlerVersion": "str", - } - ], - "statuses": [ - { - "code": "str", - "displayStatus": "str", - "level": "str", - "message": "str", - "time": "2020-02-20 00:00:00", - } - ], - "vmAgentVersion": "str", - }, - "vmHealth": { - "status": { - "code": "str", - "displayStatus": "str", - "level": "str", - "message": "str", - "time": "2020-02-20 00:00:00", - } - }, - }, - "licenseType": "str", - "networkProfile": { - "networkApiVersion": "str", - "networkInterfaceConfigurations": [ - { - "name": "str", - "auxiliaryMode": "str", - "auxiliarySku": "str", - "deleteOption": "str", - "disableTcpStateTracking": bool, - "dnsSettings": {"dnsServers": ["str"]}, - "dscpConfiguration": {"id": "str"}, - "enableAcceleratedNetworking": bool, - "enableFpga": bool, - "enableIPForwarding": bool, - "ipConfigurations": [ - { - "name": "str", - "applicationGatewayBackendAddressPools": [{"id": "str"}], - "applicationSecurityGroups": [{"id": "str"}], - "loadBalancerBackendAddressPools": [{"id": "str"}], - "primary": bool, - "privateIPAddressVersion": "str", - "publicIPAddressConfiguration": { - "name": "str", - "deleteOption": "str", - "dnsSettings": {"domainNameLabel": "str", "domainNameLabelScope": "str"}, - "idleTimeoutInMinutes": 0, - "ipTags": [{"ipTagType": "str", "tag": "str"}], - "publicIPAddressVersion": "str", - "publicIPAllocationMethod": "str", - "publicIPPrefix": {"id": "str"}, - "sku": {"name": "str", "tier": "str"}, - "tags": {"str": "str"}, - }, - "subnet": {"id": "str"}, - } - ], - "networkSecurityGroup": {"id": "str"}, - "primary": bool, - "tags": {"str": "str"}, - } - ], - "networkInterfaces": [{"deleteOption": "str", "id": "str", "primary": bool}], - }, - "osProfile": { - "adminPassword": "str", - "adminUsername": "str", - "allowExtensionOperations": bool, - "computerName": "str", - "customData": "str", - "linuxConfiguration": { - "disablePasswordAuthentication": bool, - "enableVMAgentPlatformUpdates": bool, - "patchSettings": { - "assessmentMode": "str", - "automaticByPlatformSettings": { - "bypassPlatformSafetyChecksOnUserSchedule": bool, - "rebootSetting": "str", - }, - "patchMode": "str", - }, - "provisionVMAgent": bool, - "ssh": {"publicKeys": [{"keyData": "str", "path": "str"}]}, - }, - "requireGuestProvisionSignal": bool, - "secrets": [ - { - "sourceVault": {"id": "str"}, - "vaultCertificates": [{"certificateStore": "str", "certificateUrl": "str"}], - } - ], - "windowsConfiguration": { - "additionalUnattendContent": [ - { - "componentName": "Microsoft-Windows-Shell-Setup", - "content": "str", - "passName": "OobeSystem", - "settingName": "str", - } - ], - "enableAutomaticUpdates": bool, - "enableVMAgentPlatformUpdates": bool, - "patchSettings": { - "assessmentMode": "str", - "automaticByPlatformSettings": { - "bypassPlatformSafetyChecksOnUserSchedule": bool, - "rebootSetting": "str", - }, - "enableHotpatching": bool, - "patchMode": "str", - }, - "provisionVMAgent": bool, - "timeZone": "str", - "winRM": {"listeners": [{"certificateUrl": "str", "protocol": "str"}]}, - }, - }, - "plan": {"name": "str", "product": "str", "promotionCode": "str", "publisher": "str"}, - "platformFaultDomain": 0, - "priority": "str", - "provisioningState": "str", - "proximityPlacementGroup": {"id": "str"}, - "scheduledEventsPolicy": { - "allInstancesDown": {"automaticallyApprove": bool}, - "scheduledEventsAdditionalPublishingTargets": { - "eventGridAndResourceGraph": {"enable": bool, "scheduledEventsApiVersion": "str"} - }, - "userInitiatedReboot": {"automaticallyApprove": bool}, - "userInitiatedRedeploy": {"automaticallyApprove": bool}, - }, - "scheduledEventsProfile": { - "osImageNotificationProfile": {"enable": bool, "notBeforeTimeout": "str"}, - "terminateNotificationProfile": {"enable": bool, "notBeforeTimeout": "str"}, - }, - "securityProfile": { - "encryptionAtHost": bool, - "encryptionIdentity": {"userAssignedIdentityResourceId": "str"}, - "proxyAgentSettings": { - "addProxyAgentExtension": bool, - "enabled": bool, - "imds": {"inVMAccessControlProfileReferenceId": "str", "mode": "str"}, - "keyIncarnationId": 0, - "mode": "str", - "wireServer": {"inVMAccessControlProfileReferenceId": "str", "mode": "str"}, - }, - "securityType": "str", - "uefiSettings": {"secureBootEnabled": bool, "vTpmEnabled": bool}, - }, - "storageProfile": { - "alignRegionalDisksToVMZone": bool, - "dataDisks": [ - { - "createOption": "str", - "lun": 0, - "caching": "str", - "deleteOption": "str", - "detachOption": "str", - "diskIOPSReadWrite": 0, - "diskMBpsReadWrite": 0, - "diskSizeGB": 0, - "image": {"uri": "str"}, - "managedDisk": { - "diskEncryptionSet": {"id": "str"}, - "id": "str", - "securityProfile": { - "diskEncryptionSet": {"id": "str"}, - "securityEncryptionType": "str", - }, - "storageAccountType": "str", - }, - "name": "str", - "sourceResource": {"id": "str"}, - "toBeDetached": bool, - "vhd": {"uri": "str"}, - "writeAcceleratorEnabled": bool, - } - ], - "diskControllerType": "str", - "imageReference": { - "communityGalleryImageId": "str", - "exactVersion": "str", - "id": "str", - "offer": "str", - "publisher": "str", - "sharedGalleryImageId": "str", - "sku": "str", - "version": "str", - }, - "osDisk": { - "createOption": "str", - "caching": "str", - "deleteOption": "str", - "diffDiskSettings": {"option": "str", "placement": "str"}, - "diskSizeGB": 0, - "encryptionSettings": { - "diskEncryptionKey": {"secretUrl": "str", "sourceVault": {"id": "str"}}, - "enabled": bool, - "keyEncryptionKey": {"keyUrl": "str", "sourceVault": {"id": "str"}}, - }, - "image": {"uri": "str"}, - "managedDisk": { - "diskEncryptionSet": {"id": "str"}, - "id": "str", - "securityProfile": {"diskEncryptionSet": {"id": "str"}, "securityEncryptionType": "str"}, - "storageAccountType": "str", - }, - "name": "str", - "osType": "str", - "vhd": {"uri": "str"}, - "writeAcceleratorEnabled": bool, - }, - }, - "tags": {"str": "str"}, - "timeCreated": "2020-02-20 00:00:00", - "userData": "str", - "virtualMachineScaleSet": {"id": "str"}, - "vmId": "str", - "zones": ["str"], - }, - api_version="2025-04-01", - ).result() # call '.result()' to poll until service return final result - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_virtual_machines_begin_delete(self, resource_group): - response = self.client.virtual_machines.begin_delete( - resource_group_name=resource_group.name, - vm_name="str", - api_version="2025-04-01", - ).result() # call '.result()' to poll until service return final result - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_virtual_machines_begin_assess_patches(self, resource_group): - response = self.client.virtual_machines.begin_assess_patches( - resource_group_name=resource_group.name, - vm_name="str", - api_version="2025-04-01", - ).result() # call '.result()' to poll until service return final result - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_virtual_machines_begin_attach_detach_data_disks(self, resource_group): - response = self.client.virtual_machines.begin_attach_detach_data_disks( - resource_group_name=resource_group.name, - vm_name="str", - parameters={ - "dataDisksToAttach": [ - { - "diskId": "str", - "caching": "str", - "deleteOption": "str", - "diskEncryptionSet": {"id": "str"}, - "lun": 0, - "writeAcceleratorEnabled": bool, - } - ], - "dataDisksToDetach": [{"diskId": "str", "detachOption": "str"}], - }, - api_version="2025-04-01", - ).result() # call '.result()' to poll until service return final result - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_virtual_machines_begin_capture(self, resource_group): - response = self.client.virtual_machines.begin_capture( - resource_group_name=resource_group.name, - vm_name="str", - parameters={"destinationContainerName": "str", "overwriteVhds": bool, "vhdPrefix": "str"}, - api_version="2025-04-01", - ).result() # call '.result()' to poll until service return final result - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_virtual_machines_begin_convert_to_managed_disks(self, resource_group): - response = self.client.virtual_machines.begin_convert_to_managed_disks( - resource_group_name=resource_group.name, - vm_name="str", - api_version="2025-04-01", - ).result() # call '.result()' to poll until service return final result - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_virtual_machines_begin_deallocate(self, resource_group): - response = self.client.virtual_machines.begin_deallocate( - resource_group_name=resource_group.name, - vm_name="str", - api_version="2025-04-01", - ).result() # call '.result()' to poll until service return final result - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_virtual_machines_generalize(self, resource_group): - response = self.client.virtual_machines.generalize( - resource_group_name=resource_group.name, - vm_name="str", - api_version="2025-04-01", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_virtual_machines_begin_install_patches(self, resource_group): - response = self.client.virtual_machines.begin_install_patches( - resource_group_name=resource_group.name, - vm_name="str", - install_patches_input={ - "rebootSetting": "str", - "linuxParameters": { - "classificationsToInclude": ["str"], - "maintenanceRunId": "str", - "packageNameMasksToExclude": ["str"], - "packageNameMasksToInclude": ["str"], - }, - "maximumDuration": "1 day, 0:00:00", - "windowsParameters": { - "classificationsToInclude": ["str"], - "excludeKbsRequiringReboot": bool, - "kbNumbersToExclude": ["str"], - "kbNumbersToInclude": ["str"], - "maxPatchPublishDate": "2020-02-20 00:00:00", - "patchNameMasksToExclude": ["str"], - "patchNameMasksToInclude": ["str"], - }, - }, - api_version="2025-04-01", - ).result() # call '.result()' to poll until service return final result - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_virtual_machines_instance_view(self, resource_group): - response = self.client.virtual_machines.instance_view( - resource_group_name=resource_group.name, - vm_name="str", - api_version="2025-04-01", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_virtual_machines_begin_migrate_to_vm_scale_set(self, resource_group): - response = self.client.virtual_machines.begin_migrate_to_vm_scale_set( - resource_group_name=resource_group.name, - vm_name="str", - api_version="2025-04-01", - ).result() # call '.result()' to poll until service return final result - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_virtual_machines_begin_perform_maintenance(self, resource_group): - response = self.client.virtual_machines.begin_perform_maintenance( - resource_group_name=resource_group.name, - vm_name="str", - api_version="2025-04-01", - ).result() # call '.result()' to poll until service return final result - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_virtual_machines_begin_power_off(self, resource_group): - response = self.client.virtual_machines.begin_power_off( - resource_group_name=resource_group.name, - vm_name="str", - api_version="2025-04-01", - ).result() # call '.result()' to poll until service return final result - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_virtual_machines_begin_reapply(self, resource_group): - response = self.client.virtual_machines.begin_reapply( - resource_group_name=resource_group.name, - vm_name="str", - api_version="2025-04-01", - ).result() # call '.result()' to poll until service return final result - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_virtual_machines_begin_redeploy(self, resource_group): - response = self.client.virtual_machines.begin_redeploy( - resource_group_name=resource_group.name, - vm_name="str", - api_version="2025-04-01", - ).result() # call '.result()' to poll until service return final result - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_virtual_machines_begin_reimage(self, resource_group): - response = self.client.virtual_machines.begin_reimage( - resource_group_name=resource_group.name, - vm_name="str", - api_version="2025-04-01", - ).result() # call '.result()' to poll until service return final result - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_virtual_machines_begin_restart(self, resource_group): - response = self.client.virtual_machines.begin_restart( - resource_group_name=resource_group.name, - vm_name="str", - api_version="2025-04-01", - ).result() # call '.result()' to poll until service return final result - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_virtual_machines_retrieve_boot_diagnostics_data(self, resource_group): - response = self.client.virtual_machines.retrieve_boot_diagnostics_data( - resource_group_name=resource_group.name, - vm_name="str", - api_version="2025-04-01", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_virtual_machines_begin_run_command(self, resource_group): - response = self.client.virtual_machines.begin_run_command( - resource_group_name=resource_group.name, - vm_name="str", - parameters={"commandId": "str", "parameters": [{"name": "str", "value": "str"}], "script": ["str"]}, - api_version="2025-04-01", - ).result() # call '.result()' to poll until service return final result - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_virtual_machines_simulate_eviction(self, resource_group): - response = self.client.virtual_machines.simulate_eviction( - resource_group_name=resource_group.name, - vm_name="str", - api_version="2025-04-01", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_virtual_machines_begin_start(self, resource_group): - response = self.client.virtual_machines.begin_start( - resource_group_name=resource_group.name, - vm_name="str", - api_version="2025-04-01", - ).result() # call '.result()' to poll until service return final result - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_virtual_machines_list_available_sizes(self, resource_group): - response = self.client.virtual_machines.list_available_sizes( - resource_group_name=resource_group.name, - vm_name="str", - api_version="2025-04-01", - ) - result = [r for r in response] - # please add some check logic here by yourself - # ... diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_operations.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_operations.py similarity index 72% rename from sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_operations.py rename to sdk/compute/azure-mgmt-compute/generated_tests/test_compute_operations.py index 83a61a0a8486..817198929844 100644 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_operations.py +++ b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_operations.py @@ -2,11 +2,11 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.compute import ComputeManagementClient +from azure.mgmt.compute import ComputeClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy @@ -14,16 +14,14 @@ @pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestComputeManagementOperations(AzureMgmtRecordedTestCase): +class TestComputeOperations(AzureMgmtRecordedTestCase): def setup_method(self, method): - self.client = self.create_mgmt_client(ComputeManagementClient) + self.client = self.create_mgmt_client(ComputeClient) @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy def test_operations_list(self, resource_group): - response = self.client.operations.list( - api_version="2025-04-01", - ) + response = self.client.operations.list() result = [r for r in response] # please add some check logic here by yourself # ... diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_operations_async.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_operations_async.py similarity index 72% rename from sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_operations_async.py rename to sdk/compute/azure-mgmt-compute/generated_tests/test_compute_operations_async.py index b6adb9c49b92..674d9a07f80b 100644 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_operations_async.py +++ b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_operations_async.py @@ -2,11 +2,11 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.compute.aio import ComputeManagementClient +from azure.mgmt.compute.aio import ComputeClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer from devtools_testutils.aio import recorded_by_proxy_async @@ -15,16 +15,14 @@ @pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestComputeManagementOperationsAsync(AzureMgmtRecordedTestCase): +class TestComputeOperationsAsync(AzureMgmtRecordedTestCase): def setup_method(self, method): - self.client = self.create_mgmt_client(ComputeManagementClient, is_async=True) + self.client = self.create_mgmt_client(ComputeClient, is_async=True) @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async async def test_operations_list(self, resource_group): - response = self.client.operations.list( - api_version="2025-04-01", - ) + response = self.client.operations.list() result = [r async for r in response] # please add some check logic here by yourself # ... diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_private_endpoint_connections_operations.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_private_endpoint_connections_operations.py new file mode 100644 index 000000000000..c8b6447825c2 --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_private_endpoint_connections_operations.py @@ -0,0 +1,88 @@ +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.compute import ComputeClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestComputePrivateEndpointConnectionsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ComputeClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_private_endpoint_connections_get_a_private_endpoint_connection(self, resource_group): + response = self.client.private_endpoint_connections.get_a_private_endpoint_connection( + resource_group_name=resource_group.name, + disk_access_name="str", + private_endpoint_connection_name="str", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_private_endpoint_connections_begin_update_a_private_endpoint_connection(self, resource_group): + response = self.client.private_endpoint_connections.begin_update_a_private_endpoint_connection( + resource_group_name=resource_group.name, + disk_access_name="str", + private_endpoint_connection_name="str", + resource={ + "id": "str", + "name": "str", + "properties": { + "privateLinkServiceConnectionState": { + "actionsRequired": "str", + "description": "str", + "status": "str", + }, + "privateEndpoint": {"id": "str"}, + "provisioningState": "str", + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_private_endpoint_connections_begin_delete_a_private_endpoint_connection(self, resource_group): + response = self.client.private_endpoint_connections.begin_delete_a_private_endpoint_connection( + resource_group_name=resource_group.name, + disk_access_name="str", + private_endpoint_connection_name="str", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_private_endpoint_connections_list_private_endpoint_connections(self, resource_group): + response = self.client.private_endpoint_connections.list_private_endpoint_connections( + resource_group_name=resource_group.name, + disk_access_name="str", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_private_endpoint_connections_operations_async.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_private_endpoint_connections_operations_async.py new file mode 100644 index 000000000000..4ef527b65ce8 --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_private_endpoint_connections_operations_async.py @@ -0,0 +1,93 @@ +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.compute.aio import ComputeClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestComputePrivateEndpointConnectionsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ComputeClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_private_endpoint_connections_get_a_private_endpoint_connection(self, resource_group): + response = await self.client.private_endpoint_connections.get_a_private_endpoint_connection( + resource_group_name=resource_group.name, + disk_access_name="str", + private_endpoint_connection_name="str", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_private_endpoint_connections_begin_update_a_private_endpoint_connection(self, resource_group): + response = await ( + await self.client.private_endpoint_connections.begin_update_a_private_endpoint_connection( + resource_group_name=resource_group.name, + disk_access_name="str", + private_endpoint_connection_name="str", + resource={ + "id": "str", + "name": "str", + "properties": { + "privateLinkServiceConnectionState": { + "actionsRequired": "str", + "description": "str", + "status": "str", + }, + "privateEndpoint": {"id": "str"}, + "provisioningState": "str", + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_private_endpoint_connections_begin_delete_a_private_endpoint_connection(self, resource_group): + response = await ( + await self.client.private_endpoint_connections.begin_delete_a_private_endpoint_connection( + resource_group_name=resource_group.name, + disk_access_name="str", + private_endpoint_connection_name="str", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_private_endpoint_connections_list_private_endpoint_connections(self, resource_group): + response = self.client.private_endpoint_connections.list_private_endpoint_connections( + resource_group_name=resource_group.name, + disk_access_name="str", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_proximity_placement_groups_operations.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_proximity_placement_groups_operations.py similarity index 61% rename from sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_proximity_placement_groups_operations.py rename to sdk/compute/azure-mgmt-compute/generated_tests/test_compute_proximity_placement_groups_operations.py index 2d6d41f2cf6a..e3c6ae06a589 100644 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_proximity_placement_groups_operations.py +++ b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_proximity_placement_groups_operations.py @@ -2,11 +2,11 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.compute import ComputeManagementClient +from azure.mgmt.compute import ComputeClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy @@ -14,30 +14,9 @@ @pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestComputeManagementProximityPlacementGroupsOperations(AzureMgmtRecordedTestCase): +class TestComputeProximityPlacementGroupsOperations(AzureMgmtRecordedTestCase): def setup_method(self, method): - self.client = self.create_mgmt_client(ComputeManagementClient) - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_proximity_placement_groups_list_by_subscription(self, resource_group): - response = self.client.proximity_placement_groups.list_by_subscription( - api_version="2025-04-01", - ) - result = [r for r in response] - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_proximity_placement_groups_list_by_resource_group(self, resource_group): - response = self.client.proximity_placement_groups.list_by_resource_group( - resource_group_name=resource_group.name, - api_version="2025-04-01", - ) - result = [r for r in response] - # please add some check logic here by yourself - # ... + self.client = self.create_mgmt_client(ComputeClient) @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy @@ -45,7 +24,6 @@ def test_proximity_placement_groups_get(self, resource_group): response = self.client.proximity_placement_groups.get( resource_group_name=resource_group.name, proximity_placement_group_name="str", - api_version="2025-04-01", ) # please add some check logic here by yourself @@ -57,31 +35,57 @@ def test_proximity_placement_groups_create_or_update(self, resource_group): response = self.client.proximity_placement_groups.create_or_update( resource_group_name=resource_group.name, proximity_placement_group_name="str", - parameters={ + resource={ "location": "str", - "availabilitySets": [ - { - "colocationStatus": { - "code": "str", - "displayStatus": "str", - "level": "str", - "message": "str", - "time": "2020-02-20 00:00:00", - }, - "id": "str", - } - ], - "colocationStatus": { - "code": "str", - "displayStatus": "str", - "level": "str", - "message": "str", - "time": "2020-02-20 00:00:00", - }, "id": "str", - "intent": {"vmSizes": ["str"]}, "name": "str", - "proximityPlacementGroupType": "str", + "properties": { + "availabilitySets": [ + { + "colocationStatus": { + "code": "str", + "displayStatus": "str", + "level": "str", + "message": "str", + "time": "2020-02-20 00:00:00", + }, + "id": "str", + } + ], + "colocationStatus": { + "code": "str", + "displayStatus": "str", + "level": "str", + "message": "str", + "time": "2020-02-20 00:00:00", + }, + "intent": {"vmSizes": ["str"]}, + "proximityPlacementGroupType": "str", + "virtualMachineScaleSets": [ + { + "colocationStatus": { + "code": "str", + "displayStatus": "str", + "level": "str", + "message": "str", + "time": "2020-02-20 00:00:00", + }, + "id": "str", + } + ], + "virtualMachines": [ + { + "colocationStatus": { + "code": "str", + "displayStatus": "str", + "level": "str", + "message": "str", + "time": "2020-02-20 00:00:00", + }, + "id": "str", + } + ], + }, "systemData": { "createdAt": "2020-02-20 00:00:00", "createdBy": "str", @@ -92,33 +96,8 @@ def test_proximity_placement_groups_create_or_update(self, resource_group): }, "tags": {"str": "str"}, "type": "str", - "virtualMachineScaleSets": [ - { - "colocationStatus": { - "code": "str", - "displayStatus": "str", - "level": "str", - "message": "str", - "time": "2020-02-20 00:00:00", - }, - "id": "str", - } - ], - "virtualMachines": [ - { - "colocationStatus": { - "code": "str", - "displayStatus": "str", - "level": "str", - "message": "str", - "time": "2020-02-20 00:00:00", - }, - "id": "str", - } - ], "zones": ["str"], }, - api_version="2025-04-01", ) # please add some check logic here by yourself @@ -130,8 +109,7 @@ def test_proximity_placement_groups_update(self, resource_group): response = self.client.proximity_placement_groups.update( resource_group_name=resource_group.name, proximity_placement_group_name="str", - parameters={"tags": {"str": "str"}}, - api_version="2025-04-01", + properties={"tags": {"str": "str"}}, ) # please add some check logic here by yourself @@ -143,8 +121,25 @@ def test_proximity_placement_groups_delete(self, resource_group): response = self.client.proximity_placement_groups.delete( resource_group_name=resource_group.name, proximity_placement_group_name="str", - api_version="2025-04-01", ) # please add some check logic here by yourself # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_proximity_placement_groups_list_by_resource_group(self, resource_group): + response = self.client.proximity_placement_groups.list_by_resource_group( + resource_group_name=resource_group.name, + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_proximity_placement_groups_list_by_subscription(self, resource_group): + response = self.client.proximity_placement_groups.list_by_subscription() + result = [r for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_proximity_placement_groups_operations_async.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_proximity_placement_groups_operations_async.py similarity index 61% rename from sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_proximity_placement_groups_operations_async.py rename to sdk/compute/azure-mgmt-compute/generated_tests/test_compute_proximity_placement_groups_operations_async.py index 2eea70d5e5bd..eb80cff4c044 100644 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_proximity_placement_groups_operations_async.py +++ b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_proximity_placement_groups_operations_async.py @@ -2,11 +2,11 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.compute.aio import ComputeManagementClient +from azure.mgmt.compute.aio import ComputeClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer from devtools_testutils.aio import recorded_by_proxy_async @@ -15,30 +15,9 @@ @pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestComputeManagementProximityPlacementGroupsOperationsAsync(AzureMgmtRecordedTestCase): +class TestComputeProximityPlacementGroupsOperationsAsync(AzureMgmtRecordedTestCase): def setup_method(self, method): - self.client = self.create_mgmt_client(ComputeManagementClient, is_async=True) - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_proximity_placement_groups_list_by_subscription(self, resource_group): - response = self.client.proximity_placement_groups.list_by_subscription( - api_version="2025-04-01", - ) - result = [r async for r in response] - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_proximity_placement_groups_list_by_resource_group(self, resource_group): - response = self.client.proximity_placement_groups.list_by_resource_group( - resource_group_name=resource_group.name, - api_version="2025-04-01", - ) - result = [r async for r in response] - # please add some check logic here by yourself - # ... + self.client = self.create_mgmt_client(ComputeClient, is_async=True) @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async @@ -46,7 +25,6 @@ async def test_proximity_placement_groups_get(self, resource_group): response = await self.client.proximity_placement_groups.get( resource_group_name=resource_group.name, proximity_placement_group_name="str", - api_version="2025-04-01", ) # please add some check logic here by yourself @@ -58,31 +36,57 @@ async def test_proximity_placement_groups_create_or_update(self, resource_group) response = await self.client.proximity_placement_groups.create_or_update( resource_group_name=resource_group.name, proximity_placement_group_name="str", - parameters={ + resource={ "location": "str", - "availabilitySets": [ - { - "colocationStatus": { - "code": "str", - "displayStatus": "str", - "level": "str", - "message": "str", - "time": "2020-02-20 00:00:00", - }, - "id": "str", - } - ], - "colocationStatus": { - "code": "str", - "displayStatus": "str", - "level": "str", - "message": "str", - "time": "2020-02-20 00:00:00", - }, "id": "str", - "intent": {"vmSizes": ["str"]}, "name": "str", - "proximityPlacementGroupType": "str", + "properties": { + "availabilitySets": [ + { + "colocationStatus": { + "code": "str", + "displayStatus": "str", + "level": "str", + "message": "str", + "time": "2020-02-20 00:00:00", + }, + "id": "str", + } + ], + "colocationStatus": { + "code": "str", + "displayStatus": "str", + "level": "str", + "message": "str", + "time": "2020-02-20 00:00:00", + }, + "intent": {"vmSizes": ["str"]}, + "proximityPlacementGroupType": "str", + "virtualMachineScaleSets": [ + { + "colocationStatus": { + "code": "str", + "displayStatus": "str", + "level": "str", + "message": "str", + "time": "2020-02-20 00:00:00", + }, + "id": "str", + } + ], + "virtualMachines": [ + { + "colocationStatus": { + "code": "str", + "displayStatus": "str", + "level": "str", + "message": "str", + "time": "2020-02-20 00:00:00", + }, + "id": "str", + } + ], + }, "systemData": { "createdAt": "2020-02-20 00:00:00", "createdBy": "str", @@ -93,33 +97,8 @@ async def test_proximity_placement_groups_create_or_update(self, resource_group) }, "tags": {"str": "str"}, "type": "str", - "virtualMachineScaleSets": [ - { - "colocationStatus": { - "code": "str", - "displayStatus": "str", - "level": "str", - "message": "str", - "time": "2020-02-20 00:00:00", - }, - "id": "str", - } - ], - "virtualMachines": [ - { - "colocationStatus": { - "code": "str", - "displayStatus": "str", - "level": "str", - "message": "str", - "time": "2020-02-20 00:00:00", - }, - "id": "str", - } - ], "zones": ["str"], }, - api_version="2025-04-01", ) # please add some check logic here by yourself @@ -131,8 +110,7 @@ async def test_proximity_placement_groups_update(self, resource_group): response = await self.client.proximity_placement_groups.update( resource_group_name=resource_group.name, proximity_placement_group_name="str", - parameters={"tags": {"str": "str"}}, - api_version="2025-04-01", + properties={"tags": {"str": "str"}}, ) # please add some check logic here by yourself @@ -144,8 +122,25 @@ async def test_proximity_placement_groups_delete(self, resource_group): response = await self.client.proximity_placement_groups.delete( resource_group_name=resource_group.name, proximity_placement_group_name="str", - api_version="2025-04-01", ) # please add some check logic here by yourself # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_proximity_placement_groups_list_by_resource_group(self, resource_group): + response = self.client.proximity_placement_groups.list_by_resource_group( + resource_group_name=resource_group.name, + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_proximity_placement_groups_list_by_subscription(self, resource_group): + response = self.client.proximity_placement_groups.list_by_subscription() + result = [r async for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_resource_skus_operations.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_resource_skus_operations.py similarity index 72% rename from sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_resource_skus_operations.py rename to sdk/compute/azure-mgmt-compute/generated_tests/test_compute_resource_skus_operations.py index 9ad4d78493c1..121b648b5a35 100644 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_resource_skus_operations.py +++ b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_resource_skus_operations.py @@ -2,11 +2,11 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.compute import ComputeManagementClient +from azure.mgmt.compute import ComputeClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy @@ -14,16 +14,14 @@ @pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestComputeManagementResourceSkusOperations(AzureMgmtRecordedTestCase): +class TestComputeResourceSkusOperations(AzureMgmtRecordedTestCase): def setup_method(self, method): - self.client = self.create_mgmt_client(ComputeManagementClient) + self.client = self.create_mgmt_client(ComputeClient) @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy def test_resource_skus_list(self, resource_group): - response = self.client.resource_skus.list( - api_version="2021-07-01", - ) + response = self.client.resource_skus.list() result = [r for r in response] # please add some check logic here by yourself # ... diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_resource_skus_operations_async.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_resource_skus_operations_async.py similarity index 71% rename from sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_resource_skus_operations_async.py rename to sdk/compute/azure-mgmt-compute/generated_tests/test_compute_resource_skus_operations_async.py index 670b37802ffb..c4d8fcb6866b 100644 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_resource_skus_operations_async.py +++ b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_resource_skus_operations_async.py @@ -2,11 +2,11 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.compute.aio import ComputeManagementClient +from azure.mgmt.compute.aio import ComputeClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer from devtools_testutils.aio import recorded_by_proxy_async @@ -15,16 +15,14 @@ @pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestComputeManagementResourceSkusOperationsAsync(AzureMgmtRecordedTestCase): +class TestComputeResourceSkusOperationsAsync(AzureMgmtRecordedTestCase): def setup_method(self, method): - self.client = self.create_mgmt_client(ComputeManagementClient, is_async=True) + self.client = self.create_mgmt_client(ComputeClient, is_async=True) @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async async def test_resource_skus_list(self, resource_group): - response = self.client.resource_skus.list( - api_version="2021-07-01", - ) + response = self.client.resource_skus.list() result = [r async for r in response] # please add some check logic here by yourself # ... diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_restore_point_collections_operations.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_restore_point_collections_operations.py new file mode 100644 index 000000000000..bea58cc661a6 --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_restore_point_collections_operations.py @@ -0,0 +1,469 @@ +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.compute import ComputeClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestComputeRestorePointCollectionsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ComputeClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_restore_point_collections_get(self, resource_group): + response = self.client.restore_point_collections.get( + resource_group_name=resource_group.name, + restore_point_collection_name="str", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_restore_point_collections_create_or_update(self, resource_group): + response = self.client.restore_point_collections.create_or_update( + resource_group_name=resource_group.name, + restore_point_collection_name="str", + resource={ + "location": "str", + "id": "str", + "name": "str", + "properties": { + "provisioningState": "str", + "restorePointCollectionId": "str", + "restorePoints": [ + { + "id": "str", + "name": "str", + "properties": { + "consistencyMode": "str", + "excludeDisks": [{"id": "str"}], + "instanceView": { + "diskRestorePoints": [ + { + "id": "str", + "replicationStatus": { + "completionPercent": 0, + "status": { + "code": "str", + "displayStatus": "str", + "level": "str", + "message": "str", + "time": "2020-02-20 00:00:00", + }, + }, + } + ], + "statuses": [ + { + "code": "str", + "displayStatus": "str", + "level": "str", + "message": "str", + "time": "2020-02-20 00:00:00", + } + ], + }, + "provisioningState": "str", + "sourceMetadata": { + "diagnosticsProfile": {"bootDiagnostics": {"enabled": bool, "storageUri": "str"}}, + "hardwareProfile": { + "vmSize": "str", + "vmSizeProperties": {"vCPUsAvailable": 0, "vCPUsPerCore": 0}, + }, + "hyperVGeneration": "str", + "licenseType": "str", + "location": "str", + "osProfile": { + "adminPassword": "str", + "adminUsername": "str", + "allowExtensionOperations": bool, + "computerName": "str", + "customData": "str", + "linuxConfiguration": { + "disablePasswordAuthentication": bool, + "enableVMAgentPlatformUpdates": bool, + "patchSettings": { + "assessmentMode": "str", + "automaticByPlatformSettings": { + "bypassPlatformSafetyChecksOnUserSchedule": bool, + "rebootSetting": "str", + }, + "patchMode": "str", + }, + "provisionVMAgent": bool, + "ssh": {"publicKeys": [{"keyData": "str", "path": "str"}]}, + }, + "requireGuestProvisionSignal": bool, + "secrets": [ + { + "sourceVault": {"id": "str"}, + "vaultCertificates": [ + {"certificateStore": "str", "certificateUrl": "str"} + ], + } + ], + "windowsConfiguration": { + "additionalUnattendContent": [ + { + "componentName": "Microsoft-Windows-Shell-Setup", + "content": "str", + "passName": "str", + "settingName": "str", + } + ], + "enableAutomaticUpdates": bool, + "enableVMAgentPlatformUpdates": bool, + "patchSettings": { + "assessmentMode": "str", + "automaticByPlatformSettings": { + "bypassPlatformSafetyChecksOnUserSchedule": bool, + "rebootSetting": "str", + }, + "enableHotpatching": bool, + "patchMode": "str", + }, + "provisionVMAgent": bool, + "timeZone": "str", + "winRM": {"listeners": [{"certificateUrl": "str", "protocol": "str"}]}, + }, + }, + "securityProfile": { + "encryptionAtHost": bool, + "encryptionIdentity": {"userAssignedIdentityResourceId": "str"}, + "proxyAgentSettings": { + "addProxyAgentExtension": bool, + "enabled": bool, + "imds": {"inVMAccessControlProfileReferenceId": "str", "mode": "str"}, + "keyIncarnationId": 0, + "mode": "str", + "wireServer": {"inVMAccessControlProfileReferenceId": "str", "mode": "str"}, + }, + "securityType": "str", + "uefiSettings": {"secureBootEnabled": bool, "vTpmEnabled": bool}, + }, + "storageProfile": { + "dataDisks": [ + { + "caching": "str", + "diskRestorePoint": { + "encryption": {"diskEncryptionSet": {"id": "str"}, "type": "str"}, + "id": "str", + "sourceDiskRestorePoint": {"id": "str"}, + }, + "diskSizeGB": 0, + "lun": 0, + "managedDisk": { + "diskEncryptionSet": {"id": "str"}, + "id": "str", + "securityProfile": { + "diskEncryptionSet": {"id": "str"}, + "securityEncryptionType": "str", + }, + "storageAccountType": "str", + }, + "name": "str", + "writeAcceleratorEnabled": bool, + } + ], + "diskControllerType": "str", + "osDisk": { + "caching": "str", + "diskRestorePoint": { + "encryption": {"diskEncryptionSet": {"id": "str"}, "type": "str"}, + "id": "str", + "sourceDiskRestorePoint": {"id": "str"}, + }, + "diskSizeGB": 0, + "encryptionSettings": { + "diskEncryptionKey": {"secretUrl": "str", "sourceVault": {"id": "str"}}, + "enabled": bool, + "keyEncryptionKey": {"keyUrl": "str", "sourceVault": {"id": "str"}}, + }, + "managedDisk": { + "diskEncryptionSet": {"id": "str"}, + "id": "str", + "securityProfile": { + "diskEncryptionSet": {"id": "str"}, + "securityEncryptionType": "str", + }, + "storageAccountType": "str", + }, + "name": "str", + "osType": "str", + "writeAcceleratorEnabled": bool, + }, + }, + "userData": "str", + "vmId": "str", + }, + "sourceRestorePoint": {"id": "str"}, + "timeCreated": "2020-02-20 00:00:00", + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + } + ], + "source": {"id": "str", "location": "str"}, + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "tags": {"str": "str"}, + "type": "str", + }, + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_restore_point_collections_update(self, resource_group): + response = self.client.restore_point_collections.update( + resource_group_name=resource_group.name, + restore_point_collection_name="str", + properties={ + "properties": { + "provisioningState": "str", + "restorePointCollectionId": "str", + "restorePoints": [ + { + "id": "str", + "name": "str", + "properties": { + "consistencyMode": "str", + "excludeDisks": [{"id": "str"}], + "instanceView": { + "diskRestorePoints": [ + { + "id": "str", + "replicationStatus": { + "completionPercent": 0, + "status": { + "code": "str", + "displayStatus": "str", + "level": "str", + "message": "str", + "time": "2020-02-20 00:00:00", + }, + }, + } + ], + "statuses": [ + { + "code": "str", + "displayStatus": "str", + "level": "str", + "message": "str", + "time": "2020-02-20 00:00:00", + } + ], + }, + "provisioningState": "str", + "sourceMetadata": { + "diagnosticsProfile": {"bootDiagnostics": {"enabled": bool, "storageUri": "str"}}, + "hardwareProfile": { + "vmSize": "str", + "vmSizeProperties": {"vCPUsAvailable": 0, "vCPUsPerCore": 0}, + }, + "hyperVGeneration": "str", + "licenseType": "str", + "location": "str", + "osProfile": { + "adminPassword": "str", + "adminUsername": "str", + "allowExtensionOperations": bool, + "computerName": "str", + "customData": "str", + "linuxConfiguration": { + "disablePasswordAuthentication": bool, + "enableVMAgentPlatformUpdates": bool, + "patchSettings": { + "assessmentMode": "str", + "automaticByPlatformSettings": { + "bypassPlatformSafetyChecksOnUserSchedule": bool, + "rebootSetting": "str", + }, + "patchMode": "str", + }, + "provisionVMAgent": bool, + "ssh": {"publicKeys": [{"keyData": "str", "path": "str"}]}, + }, + "requireGuestProvisionSignal": bool, + "secrets": [ + { + "sourceVault": {"id": "str"}, + "vaultCertificates": [ + {"certificateStore": "str", "certificateUrl": "str"} + ], + } + ], + "windowsConfiguration": { + "additionalUnattendContent": [ + { + "componentName": "Microsoft-Windows-Shell-Setup", + "content": "str", + "passName": "str", + "settingName": "str", + } + ], + "enableAutomaticUpdates": bool, + "enableVMAgentPlatformUpdates": bool, + "patchSettings": { + "assessmentMode": "str", + "automaticByPlatformSettings": { + "bypassPlatformSafetyChecksOnUserSchedule": bool, + "rebootSetting": "str", + }, + "enableHotpatching": bool, + "patchMode": "str", + }, + "provisionVMAgent": bool, + "timeZone": "str", + "winRM": {"listeners": [{"certificateUrl": "str", "protocol": "str"}]}, + }, + }, + "securityProfile": { + "encryptionAtHost": bool, + "encryptionIdentity": {"userAssignedIdentityResourceId": "str"}, + "proxyAgentSettings": { + "addProxyAgentExtension": bool, + "enabled": bool, + "imds": {"inVMAccessControlProfileReferenceId": "str", "mode": "str"}, + "keyIncarnationId": 0, + "mode": "str", + "wireServer": {"inVMAccessControlProfileReferenceId": "str", "mode": "str"}, + }, + "securityType": "str", + "uefiSettings": {"secureBootEnabled": bool, "vTpmEnabled": bool}, + }, + "storageProfile": { + "dataDisks": [ + { + "caching": "str", + "diskRestorePoint": { + "encryption": {"diskEncryptionSet": {"id": "str"}, "type": "str"}, + "id": "str", + "sourceDiskRestorePoint": {"id": "str"}, + }, + "diskSizeGB": 0, + "lun": 0, + "managedDisk": { + "diskEncryptionSet": {"id": "str"}, + "id": "str", + "securityProfile": { + "diskEncryptionSet": {"id": "str"}, + "securityEncryptionType": "str", + }, + "storageAccountType": "str", + }, + "name": "str", + "writeAcceleratorEnabled": bool, + } + ], + "diskControllerType": "str", + "osDisk": { + "caching": "str", + "diskRestorePoint": { + "encryption": {"diskEncryptionSet": {"id": "str"}, "type": "str"}, + "id": "str", + "sourceDiskRestorePoint": {"id": "str"}, + }, + "diskSizeGB": 0, + "encryptionSettings": { + "diskEncryptionKey": {"secretUrl": "str", "sourceVault": {"id": "str"}}, + "enabled": bool, + "keyEncryptionKey": {"keyUrl": "str", "sourceVault": {"id": "str"}}, + }, + "managedDisk": { + "diskEncryptionSet": {"id": "str"}, + "id": "str", + "securityProfile": { + "diskEncryptionSet": {"id": "str"}, + "securityEncryptionType": "str", + }, + "storageAccountType": "str", + }, + "name": "str", + "osType": "str", + "writeAcceleratorEnabled": bool, + }, + }, + "userData": "str", + "vmId": "str", + }, + "sourceRestorePoint": {"id": "str"}, + "timeCreated": "2020-02-20 00:00:00", + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + } + ], + "source": {"id": "str", "location": "str"}, + }, + "tags": {"str": "str"}, + }, + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_restore_point_collections_begin_delete(self, resource_group): + response = self.client.restore_point_collections.begin_delete( + resource_group_name=resource_group.name, + restore_point_collection_name="str", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_restore_point_collections_list(self, resource_group): + response = self.client.restore_point_collections.list( + resource_group_name=resource_group.name, + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_restore_point_collections_list_all(self, resource_group): + response = self.client.restore_point_collections.list_all() + result = [r for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_restore_point_collections_operations_async.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_restore_point_collections_operations_async.py new file mode 100644 index 000000000000..2ceaf524771d --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_restore_point_collections_operations_async.py @@ -0,0 +1,472 @@ +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.compute.aio import ComputeClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestComputeRestorePointCollectionsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ComputeClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_restore_point_collections_get(self, resource_group): + response = await self.client.restore_point_collections.get( + resource_group_name=resource_group.name, + restore_point_collection_name="str", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_restore_point_collections_create_or_update(self, resource_group): + response = await self.client.restore_point_collections.create_or_update( + resource_group_name=resource_group.name, + restore_point_collection_name="str", + resource={ + "location": "str", + "id": "str", + "name": "str", + "properties": { + "provisioningState": "str", + "restorePointCollectionId": "str", + "restorePoints": [ + { + "id": "str", + "name": "str", + "properties": { + "consistencyMode": "str", + "excludeDisks": [{"id": "str"}], + "instanceView": { + "diskRestorePoints": [ + { + "id": "str", + "replicationStatus": { + "completionPercent": 0, + "status": { + "code": "str", + "displayStatus": "str", + "level": "str", + "message": "str", + "time": "2020-02-20 00:00:00", + }, + }, + } + ], + "statuses": [ + { + "code": "str", + "displayStatus": "str", + "level": "str", + "message": "str", + "time": "2020-02-20 00:00:00", + } + ], + }, + "provisioningState": "str", + "sourceMetadata": { + "diagnosticsProfile": {"bootDiagnostics": {"enabled": bool, "storageUri": "str"}}, + "hardwareProfile": { + "vmSize": "str", + "vmSizeProperties": {"vCPUsAvailable": 0, "vCPUsPerCore": 0}, + }, + "hyperVGeneration": "str", + "licenseType": "str", + "location": "str", + "osProfile": { + "adminPassword": "str", + "adminUsername": "str", + "allowExtensionOperations": bool, + "computerName": "str", + "customData": "str", + "linuxConfiguration": { + "disablePasswordAuthentication": bool, + "enableVMAgentPlatformUpdates": bool, + "patchSettings": { + "assessmentMode": "str", + "automaticByPlatformSettings": { + "bypassPlatformSafetyChecksOnUserSchedule": bool, + "rebootSetting": "str", + }, + "patchMode": "str", + }, + "provisionVMAgent": bool, + "ssh": {"publicKeys": [{"keyData": "str", "path": "str"}]}, + }, + "requireGuestProvisionSignal": bool, + "secrets": [ + { + "sourceVault": {"id": "str"}, + "vaultCertificates": [ + {"certificateStore": "str", "certificateUrl": "str"} + ], + } + ], + "windowsConfiguration": { + "additionalUnattendContent": [ + { + "componentName": "Microsoft-Windows-Shell-Setup", + "content": "str", + "passName": "str", + "settingName": "str", + } + ], + "enableAutomaticUpdates": bool, + "enableVMAgentPlatformUpdates": bool, + "patchSettings": { + "assessmentMode": "str", + "automaticByPlatformSettings": { + "bypassPlatformSafetyChecksOnUserSchedule": bool, + "rebootSetting": "str", + }, + "enableHotpatching": bool, + "patchMode": "str", + }, + "provisionVMAgent": bool, + "timeZone": "str", + "winRM": {"listeners": [{"certificateUrl": "str", "protocol": "str"}]}, + }, + }, + "securityProfile": { + "encryptionAtHost": bool, + "encryptionIdentity": {"userAssignedIdentityResourceId": "str"}, + "proxyAgentSettings": { + "addProxyAgentExtension": bool, + "enabled": bool, + "imds": {"inVMAccessControlProfileReferenceId": "str", "mode": "str"}, + "keyIncarnationId": 0, + "mode": "str", + "wireServer": {"inVMAccessControlProfileReferenceId": "str", "mode": "str"}, + }, + "securityType": "str", + "uefiSettings": {"secureBootEnabled": bool, "vTpmEnabled": bool}, + }, + "storageProfile": { + "dataDisks": [ + { + "caching": "str", + "diskRestorePoint": { + "encryption": {"diskEncryptionSet": {"id": "str"}, "type": "str"}, + "id": "str", + "sourceDiskRestorePoint": {"id": "str"}, + }, + "diskSizeGB": 0, + "lun": 0, + "managedDisk": { + "diskEncryptionSet": {"id": "str"}, + "id": "str", + "securityProfile": { + "diskEncryptionSet": {"id": "str"}, + "securityEncryptionType": "str", + }, + "storageAccountType": "str", + }, + "name": "str", + "writeAcceleratorEnabled": bool, + } + ], + "diskControllerType": "str", + "osDisk": { + "caching": "str", + "diskRestorePoint": { + "encryption": {"diskEncryptionSet": {"id": "str"}, "type": "str"}, + "id": "str", + "sourceDiskRestorePoint": {"id": "str"}, + }, + "diskSizeGB": 0, + "encryptionSettings": { + "diskEncryptionKey": {"secretUrl": "str", "sourceVault": {"id": "str"}}, + "enabled": bool, + "keyEncryptionKey": {"keyUrl": "str", "sourceVault": {"id": "str"}}, + }, + "managedDisk": { + "diskEncryptionSet": {"id": "str"}, + "id": "str", + "securityProfile": { + "diskEncryptionSet": {"id": "str"}, + "securityEncryptionType": "str", + }, + "storageAccountType": "str", + }, + "name": "str", + "osType": "str", + "writeAcceleratorEnabled": bool, + }, + }, + "userData": "str", + "vmId": "str", + }, + "sourceRestorePoint": {"id": "str"}, + "timeCreated": "2020-02-20 00:00:00", + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + } + ], + "source": {"id": "str", "location": "str"}, + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "tags": {"str": "str"}, + "type": "str", + }, + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_restore_point_collections_update(self, resource_group): + response = await self.client.restore_point_collections.update( + resource_group_name=resource_group.name, + restore_point_collection_name="str", + properties={ + "properties": { + "provisioningState": "str", + "restorePointCollectionId": "str", + "restorePoints": [ + { + "id": "str", + "name": "str", + "properties": { + "consistencyMode": "str", + "excludeDisks": [{"id": "str"}], + "instanceView": { + "diskRestorePoints": [ + { + "id": "str", + "replicationStatus": { + "completionPercent": 0, + "status": { + "code": "str", + "displayStatus": "str", + "level": "str", + "message": "str", + "time": "2020-02-20 00:00:00", + }, + }, + } + ], + "statuses": [ + { + "code": "str", + "displayStatus": "str", + "level": "str", + "message": "str", + "time": "2020-02-20 00:00:00", + } + ], + }, + "provisioningState": "str", + "sourceMetadata": { + "diagnosticsProfile": {"bootDiagnostics": {"enabled": bool, "storageUri": "str"}}, + "hardwareProfile": { + "vmSize": "str", + "vmSizeProperties": {"vCPUsAvailable": 0, "vCPUsPerCore": 0}, + }, + "hyperVGeneration": "str", + "licenseType": "str", + "location": "str", + "osProfile": { + "adminPassword": "str", + "adminUsername": "str", + "allowExtensionOperations": bool, + "computerName": "str", + "customData": "str", + "linuxConfiguration": { + "disablePasswordAuthentication": bool, + "enableVMAgentPlatformUpdates": bool, + "patchSettings": { + "assessmentMode": "str", + "automaticByPlatformSettings": { + "bypassPlatformSafetyChecksOnUserSchedule": bool, + "rebootSetting": "str", + }, + "patchMode": "str", + }, + "provisionVMAgent": bool, + "ssh": {"publicKeys": [{"keyData": "str", "path": "str"}]}, + }, + "requireGuestProvisionSignal": bool, + "secrets": [ + { + "sourceVault": {"id": "str"}, + "vaultCertificates": [ + {"certificateStore": "str", "certificateUrl": "str"} + ], + } + ], + "windowsConfiguration": { + "additionalUnattendContent": [ + { + "componentName": "Microsoft-Windows-Shell-Setup", + "content": "str", + "passName": "str", + "settingName": "str", + } + ], + "enableAutomaticUpdates": bool, + "enableVMAgentPlatformUpdates": bool, + "patchSettings": { + "assessmentMode": "str", + "automaticByPlatformSettings": { + "bypassPlatformSafetyChecksOnUserSchedule": bool, + "rebootSetting": "str", + }, + "enableHotpatching": bool, + "patchMode": "str", + }, + "provisionVMAgent": bool, + "timeZone": "str", + "winRM": {"listeners": [{"certificateUrl": "str", "protocol": "str"}]}, + }, + }, + "securityProfile": { + "encryptionAtHost": bool, + "encryptionIdentity": {"userAssignedIdentityResourceId": "str"}, + "proxyAgentSettings": { + "addProxyAgentExtension": bool, + "enabled": bool, + "imds": {"inVMAccessControlProfileReferenceId": "str", "mode": "str"}, + "keyIncarnationId": 0, + "mode": "str", + "wireServer": {"inVMAccessControlProfileReferenceId": "str", "mode": "str"}, + }, + "securityType": "str", + "uefiSettings": {"secureBootEnabled": bool, "vTpmEnabled": bool}, + }, + "storageProfile": { + "dataDisks": [ + { + "caching": "str", + "diskRestorePoint": { + "encryption": {"diskEncryptionSet": {"id": "str"}, "type": "str"}, + "id": "str", + "sourceDiskRestorePoint": {"id": "str"}, + }, + "diskSizeGB": 0, + "lun": 0, + "managedDisk": { + "diskEncryptionSet": {"id": "str"}, + "id": "str", + "securityProfile": { + "diskEncryptionSet": {"id": "str"}, + "securityEncryptionType": "str", + }, + "storageAccountType": "str", + }, + "name": "str", + "writeAcceleratorEnabled": bool, + } + ], + "diskControllerType": "str", + "osDisk": { + "caching": "str", + "diskRestorePoint": { + "encryption": {"diskEncryptionSet": {"id": "str"}, "type": "str"}, + "id": "str", + "sourceDiskRestorePoint": {"id": "str"}, + }, + "diskSizeGB": 0, + "encryptionSettings": { + "diskEncryptionKey": {"secretUrl": "str", "sourceVault": {"id": "str"}}, + "enabled": bool, + "keyEncryptionKey": {"keyUrl": "str", "sourceVault": {"id": "str"}}, + }, + "managedDisk": { + "diskEncryptionSet": {"id": "str"}, + "id": "str", + "securityProfile": { + "diskEncryptionSet": {"id": "str"}, + "securityEncryptionType": "str", + }, + "storageAccountType": "str", + }, + "name": "str", + "osType": "str", + "writeAcceleratorEnabled": bool, + }, + }, + "userData": "str", + "vmId": "str", + }, + "sourceRestorePoint": {"id": "str"}, + "timeCreated": "2020-02-20 00:00:00", + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + } + ], + "source": {"id": "str", "location": "str"}, + }, + "tags": {"str": "str"}, + }, + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_restore_point_collections_begin_delete(self, resource_group): + response = await ( + await self.client.restore_point_collections.begin_delete( + resource_group_name=resource_group.name, + restore_point_collection_name="str", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_restore_point_collections_list(self, resource_group): + response = self.client.restore_point_collections.list( + resource_group_name=resource_group.name, + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_restore_point_collections_list_all(self, resource_group): + response = self.client.restore_point_collections.list_all() + result = [r async for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_restore_points_operations_async.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_restore_points_operations.py similarity index 84% rename from sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_restore_points_operations_async.py rename to sdk/compute/azure-mgmt-compute/generated_tests/test_compute_restore_points_operations.py index d1133b905f9c..c5b69bb08630 100644 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_restore_points_operations_async.py +++ b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_restore_points_operations.py @@ -2,48 +2,47 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.compute.aio import ComputeManagementClient +from azure.mgmt.compute import ComputeClient -from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer -from devtools_testutils.aio import recorded_by_proxy_async +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy AZURE_LOCATION = "eastus" @pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestComputeManagementRestorePointsOperationsAsync(AzureMgmtRecordedTestCase): +class TestComputeRestorePointsOperations(AzureMgmtRecordedTestCase): def setup_method(self, method): - self.client = self.create_mgmt_client(ComputeManagementClient, is_async=True) + self.client = self.create_mgmt_client(ComputeClient) @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_restore_points_get(self, resource_group): - response = await self.client.restore_points.get( + @recorded_by_proxy + def test_restore_points_get(self, resource_group): + response = self.client.restore_points.get( resource_group_name=resource_group.name, restore_point_collection_name="str", restore_point_name="str", - api_version="2025-04-01", ) # please add some check logic here by yourself # ... @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_restore_points_begin_create(self, resource_group): - response = await ( - await self.client.restore_points.begin_create( - resource_group_name=resource_group.name, - restore_point_collection_name="str", - restore_point_name="str", - parameters={ + @recorded_by_proxy + def test_restore_points_begin_create(self, resource_group): + response = self.client.restore_points.begin_create( + resource_group_name=resource_group.name, + restore_point_collection_name="str", + restore_point_name="str", + resource={ + "id": "str", + "name": "str", + "properties": { "consistencyMode": "str", "excludeDisks": [{"id": "str"}], - "id": "str", "instanceView": { "diskRestorePoints": [ { @@ -70,7 +69,6 @@ async def test_restore_points_begin_create(self, resource_group): } ], }, - "name": "str", "provisioningState": "str", "sourceMetadata": { "diagnosticsProfile": {"bootDiagnostics": {"enabled": bool, "storageUri": "str"}}, @@ -113,7 +111,7 @@ async def test_restore_points_begin_create(self, resource_group): { "componentName": "Microsoft-Windows-Shell-Setup", "content": "str", - "passName": "OobeSystem", + "passName": "str", "settingName": "str", } ], @@ -203,34 +201,30 @@ async def test_restore_points_begin_create(self, resource_group): "vmId": "str", }, "sourceRestorePoint": {"id": "str"}, - "systemData": { - "createdAt": "2020-02-20 00:00:00", - "createdBy": "str", - "createdByType": "str", - "lastModifiedAt": "2020-02-20 00:00:00", - "lastModifiedBy": "str", - "lastModifiedByType": "str", - }, "timeCreated": "2020-02-20 00:00:00", - "type": "str", }, - api_version="2025-04-01", - ) + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself # ... @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_restore_points_begin_delete(self, resource_group): - response = await ( - await self.client.restore_points.begin_delete( - resource_group_name=resource_group.name, - restore_point_collection_name="str", - restore_point_name="str", - api_version="2025-04-01", - ) + @recorded_by_proxy + def test_restore_points_begin_delete(self, resource_group): + response = self.client.restore_points.begin_delete( + resource_group_name=resource_group.name, + restore_point_collection_name="str", + restore_point_name="str", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_restore_points_operations_async.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_restore_points_operations_async.py new file mode 100644 index 000000000000..80b7cdcc7323 --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_restore_points_operations_async.py @@ -0,0 +1,236 @@ +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.compute.aio import ComputeClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestComputeRestorePointsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ComputeClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_restore_points_get(self, resource_group): + response = await self.client.restore_points.get( + resource_group_name=resource_group.name, + restore_point_collection_name="str", + restore_point_name="str", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_restore_points_begin_create(self, resource_group): + response = await ( + await self.client.restore_points.begin_create( + resource_group_name=resource_group.name, + restore_point_collection_name="str", + restore_point_name="str", + resource={ + "id": "str", + "name": "str", + "properties": { + "consistencyMode": "str", + "excludeDisks": [{"id": "str"}], + "instanceView": { + "diskRestorePoints": [ + { + "id": "str", + "replicationStatus": { + "completionPercent": 0, + "status": { + "code": "str", + "displayStatus": "str", + "level": "str", + "message": "str", + "time": "2020-02-20 00:00:00", + }, + }, + } + ], + "statuses": [ + { + "code": "str", + "displayStatus": "str", + "level": "str", + "message": "str", + "time": "2020-02-20 00:00:00", + } + ], + }, + "provisioningState": "str", + "sourceMetadata": { + "diagnosticsProfile": {"bootDiagnostics": {"enabled": bool, "storageUri": "str"}}, + "hardwareProfile": { + "vmSize": "str", + "vmSizeProperties": {"vCPUsAvailable": 0, "vCPUsPerCore": 0}, + }, + "hyperVGeneration": "str", + "licenseType": "str", + "location": "str", + "osProfile": { + "adminPassword": "str", + "adminUsername": "str", + "allowExtensionOperations": bool, + "computerName": "str", + "customData": "str", + "linuxConfiguration": { + "disablePasswordAuthentication": bool, + "enableVMAgentPlatformUpdates": bool, + "patchSettings": { + "assessmentMode": "str", + "automaticByPlatformSettings": { + "bypassPlatformSafetyChecksOnUserSchedule": bool, + "rebootSetting": "str", + }, + "patchMode": "str", + }, + "provisionVMAgent": bool, + "ssh": {"publicKeys": [{"keyData": "str", "path": "str"}]}, + }, + "requireGuestProvisionSignal": bool, + "secrets": [ + { + "sourceVault": {"id": "str"}, + "vaultCertificates": [{"certificateStore": "str", "certificateUrl": "str"}], + } + ], + "windowsConfiguration": { + "additionalUnattendContent": [ + { + "componentName": "Microsoft-Windows-Shell-Setup", + "content": "str", + "passName": "str", + "settingName": "str", + } + ], + "enableAutomaticUpdates": bool, + "enableVMAgentPlatformUpdates": bool, + "patchSettings": { + "assessmentMode": "str", + "automaticByPlatformSettings": { + "bypassPlatformSafetyChecksOnUserSchedule": bool, + "rebootSetting": "str", + }, + "enableHotpatching": bool, + "patchMode": "str", + }, + "provisionVMAgent": bool, + "timeZone": "str", + "winRM": {"listeners": [{"certificateUrl": "str", "protocol": "str"}]}, + }, + }, + "securityProfile": { + "encryptionAtHost": bool, + "encryptionIdentity": {"userAssignedIdentityResourceId": "str"}, + "proxyAgentSettings": { + "addProxyAgentExtension": bool, + "enabled": bool, + "imds": {"inVMAccessControlProfileReferenceId": "str", "mode": "str"}, + "keyIncarnationId": 0, + "mode": "str", + "wireServer": {"inVMAccessControlProfileReferenceId": "str", "mode": "str"}, + }, + "securityType": "str", + "uefiSettings": {"secureBootEnabled": bool, "vTpmEnabled": bool}, + }, + "storageProfile": { + "dataDisks": [ + { + "caching": "str", + "diskRestorePoint": { + "encryption": {"diskEncryptionSet": {"id": "str"}, "type": "str"}, + "id": "str", + "sourceDiskRestorePoint": {"id": "str"}, + }, + "diskSizeGB": 0, + "lun": 0, + "managedDisk": { + "diskEncryptionSet": {"id": "str"}, + "id": "str", + "securityProfile": { + "diskEncryptionSet": {"id": "str"}, + "securityEncryptionType": "str", + }, + "storageAccountType": "str", + }, + "name": "str", + "writeAcceleratorEnabled": bool, + } + ], + "diskControllerType": "str", + "osDisk": { + "caching": "str", + "diskRestorePoint": { + "encryption": {"diskEncryptionSet": {"id": "str"}, "type": "str"}, + "id": "str", + "sourceDiskRestorePoint": {"id": "str"}, + }, + "diskSizeGB": 0, + "encryptionSettings": { + "diskEncryptionKey": {"secretUrl": "str", "sourceVault": {"id": "str"}}, + "enabled": bool, + "keyEncryptionKey": {"keyUrl": "str", "sourceVault": {"id": "str"}}, + }, + "managedDisk": { + "diskEncryptionSet": {"id": "str"}, + "id": "str", + "securityProfile": { + "diskEncryptionSet": {"id": "str"}, + "securityEncryptionType": "str", + }, + "storageAccountType": "str", + }, + "name": "str", + "osType": "str", + "writeAcceleratorEnabled": bool, + }, + }, + "userData": "str", + "vmId": "str", + }, + "sourceRestorePoint": {"id": "str"}, + "timeCreated": "2020-02-20 00:00:00", + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_restore_points_begin_delete(self, resource_group): + response = await ( + await self.client.restore_points.begin_delete( + resource_group_name=resource_group.name, + restore_point_collection_name="str", + restore_point_name="str", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_rolling_upgrade_status_infos_operations.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_rolling_upgrade_status_infos_operations.py new file mode 100644 index 000000000000..b1292020ccc4 --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_rolling_upgrade_status_infos_operations.py @@ -0,0 +1,30 @@ +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.compute import ComputeClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestComputeRollingUpgradeStatusInfosOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ComputeClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_rolling_upgrade_status_infos_get_latest(self, resource_group): + response = self.client.rolling_upgrade_status_infos.get_latest( + resource_group_name=resource_group.name, + vm_scale_set_name="str", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_rolling_upgrade_status_infos_operations_async.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_rolling_upgrade_status_infos_operations_async.py new file mode 100644 index 000000000000..443790999cef --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_rolling_upgrade_status_infos_operations_async.py @@ -0,0 +1,31 @@ +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.compute.aio import ComputeClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestComputeRollingUpgradeStatusInfosOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ComputeClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_rolling_upgrade_status_infos_get_latest(self, resource_group): + response = await self.client.rolling_upgrade_status_infos.get_latest( + resource_group_name=resource_group.name, + vm_scale_set_name="str", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_shared_galleries_operations.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_shared_galleries_operations.py similarity index 80% rename from sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_shared_galleries_operations.py rename to sdk/compute/azure-mgmt-compute/generated_tests/test_compute_shared_galleries_operations.py index 5cee7b14fc5e..4e9058898103 100644 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_shared_galleries_operations.py +++ b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_shared_galleries_operations.py @@ -2,11 +2,11 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.compute import ComputeManagementClient +from azure.mgmt.compute import ComputeClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy @@ -14,29 +14,27 @@ @pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestComputeManagementSharedGalleriesOperations(AzureMgmtRecordedTestCase): +class TestComputeSharedGalleriesOperations(AzureMgmtRecordedTestCase): def setup_method(self, method): - self.client = self.create_mgmt_client(ComputeManagementClient) + self.client = self.create_mgmt_client(ComputeClient) @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_shared_galleries_list(self, resource_group): - response = self.client.shared_galleries.list( + def test_shared_galleries_get(self, resource_group): + response = self.client.shared_galleries.get( location="str", - api_version="2024-03-03", + gallery_unique_name="str", ) - result = [r for r in response] + # please add some check logic here by yourself # ... @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_shared_galleries_get(self, resource_group): - response = self.client.shared_galleries.get( + def test_shared_galleries_list(self, resource_group): + response = self.client.shared_galleries.list( location="str", - gallery_unique_name="str", - api_version="2024-03-03", ) - + result = [r for r in response] # please add some check logic here by yourself # ... diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_shared_galleries_operations_async.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_shared_galleries_operations_async.py similarity index 79% rename from sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_shared_galleries_operations_async.py rename to sdk/compute/azure-mgmt-compute/generated_tests/test_compute_shared_galleries_operations_async.py index d81d95e45226..88f686b0038f 100644 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_shared_galleries_operations_async.py +++ b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_shared_galleries_operations_async.py @@ -2,11 +2,11 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.compute.aio import ComputeManagementClient +from azure.mgmt.compute.aio import ComputeClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer from devtools_testutils.aio import recorded_by_proxy_async @@ -15,29 +15,27 @@ @pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestComputeManagementSharedGalleriesOperationsAsync(AzureMgmtRecordedTestCase): +class TestComputeSharedGalleriesOperationsAsync(AzureMgmtRecordedTestCase): def setup_method(self, method): - self.client = self.create_mgmt_client(ComputeManagementClient, is_async=True) + self.client = self.create_mgmt_client(ComputeClient, is_async=True) @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_shared_galleries_list(self, resource_group): - response = self.client.shared_galleries.list( + async def test_shared_galleries_get(self, resource_group): + response = await self.client.shared_galleries.get( location="str", - api_version="2024-03-03", + gallery_unique_name="str", ) - result = [r async for r in response] + # please add some check logic here by yourself # ... @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_shared_galleries_get(self, resource_group): - response = await self.client.shared_galleries.get( + async def test_shared_galleries_list(self, resource_group): + response = self.client.shared_galleries.list( location="str", - gallery_unique_name="str", - api_version="2024-03-03", ) - + result = [r async for r in response] # please add some check logic here by yourself # ... diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_shared_gallery_image_versions_operations.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_shared_gallery_image_versions_operations.py similarity index 81% rename from sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_shared_gallery_image_versions_operations.py rename to sdk/compute/azure-mgmt-compute/generated_tests/test_compute_shared_gallery_image_versions_operations.py index 53c6e1a5a4de..bba65dde264b 100644 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_shared_gallery_image_versions_operations.py +++ b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_shared_gallery_image_versions_operations.py @@ -2,11 +2,11 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.compute import ComputeManagementClient +from azure.mgmt.compute import ComputeClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy @@ -14,33 +14,31 @@ @pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestComputeManagementSharedGalleryImageVersionsOperations(AzureMgmtRecordedTestCase): +class TestComputeSharedGalleryImageVersionsOperations(AzureMgmtRecordedTestCase): def setup_method(self, method): - self.client = self.create_mgmt_client(ComputeManagementClient) + self.client = self.create_mgmt_client(ComputeClient) @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_shared_gallery_image_versions_list(self, resource_group): - response = self.client.shared_gallery_image_versions.list( + def test_shared_gallery_image_versions_get(self, resource_group): + response = self.client.shared_gallery_image_versions.get( location="str", gallery_unique_name="str", gallery_image_name="str", - api_version="2024-03-03", + gallery_image_version_name="str", ) - result = [r for r in response] + # please add some check logic here by yourself # ... @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_shared_gallery_image_versions_get(self, resource_group): - response = self.client.shared_gallery_image_versions.get( + def test_shared_gallery_image_versions_list(self, resource_group): + response = self.client.shared_gallery_image_versions.list( location="str", gallery_unique_name="str", gallery_image_name="str", - gallery_image_version_name="str", - api_version="2024-03-03", ) - + result = [r for r in response] # please add some check logic here by yourself # ... diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_shared_gallery_image_versions_operations_async.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_shared_gallery_image_versions_operations_async.py similarity index 81% rename from sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_shared_gallery_image_versions_operations_async.py rename to sdk/compute/azure-mgmt-compute/generated_tests/test_compute_shared_gallery_image_versions_operations_async.py index bc252ec17625..f799f9419a77 100644 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_shared_gallery_image_versions_operations_async.py +++ b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_shared_gallery_image_versions_operations_async.py @@ -2,11 +2,11 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.compute.aio import ComputeManagementClient +from azure.mgmt.compute.aio import ComputeClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer from devtools_testutils.aio import recorded_by_proxy_async @@ -15,33 +15,31 @@ @pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestComputeManagementSharedGalleryImageVersionsOperationsAsync(AzureMgmtRecordedTestCase): +class TestComputeSharedGalleryImageVersionsOperationsAsync(AzureMgmtRecordedTestCase): def setup_method(self, method): - self.client = self.create_mgmt_client(ComputeManagementClient, is_async=True) + self.client = self.create_mgmt_client(ComputeClient, is_async=True) @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_shared_gallery_image_versions_list(self, resource_group): - response = self.client.shared_gallery_image_versions.list( + async def test_shared_gallery_image_versions_get(self, resource_group): + response = await self.client.shared_gallery_image_versions.get( location="str", gallery_unique_name="str", gallery_image_name="str", - api_version="2024-03-03", + gallery_image_version_name="str", ) - result = [r async for r in response] + # please add some check logic here by yourself # ... @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_shared_gallery_image_versions_get(self, resource_group): - response = await self.client.shared_gallery_image_versions.get( + async def test_shared_gallery_image_versions_list(self, resource_group): + response = self.client.shared_gallery_image_versions.list( location="str", gallery_unique_name="str", gallery_image_name="str", - gallery_image_version_name="str", - api_version="2024-03-03", ) - + result = [r async for r in response] # please add some check logic here by yourself # ... diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_shared_gallery_images_operations.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_shared_gallery_images_operations.py similarity index 80% rename from sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_shared_gallery_images_operations.py rename to sdk/compute/azure-mgmt-compute/generated_tests/test_compute_shared_gallery_images_operations.py index ebacb911f457..836a65da78ed 100644 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_shared_gallery_images_operations.py +++ b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_shared_gallery_images_operations.py @@ -2,11 +2,11 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.compute import ComputeManagementClient +from azure.mgmt.compute import ComputeClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy @@ -14,31 +14,29 @@ @pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestComputeManagementSharedGalleryImagesOperations(AzureMgmtRecordedTestCase): +class TestComputeSharedGalleryImagesOperations(AzureMgmtRecordedTestCase): def setup_method(self, method): - self.client = self.create_mgmt_client(ComputeManagementClient) + self.client = self.create_mgmt_client(ComputeClient) @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_shared_gallery_images_list(self, resource_group): - response = self.client.shared_gallery_images.list( + def test_shared_gallery_images_get(self, resource_group): + response = self.client.shared_gallery_images.get( location="str", gallery_unique_name="str", - api_version="2024-03-03", + gallery_image_name="str", ) - result = [r for r in response] + # please add some check logic here by yourself # ... @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_shared_gallery_images_get(self, resource_group): - response = self.client.shared_gallery_images.get( + def test_shared_gallery_images_list(self, resource_group): + response = self.client.shared_gallery_images.list( location="str", gallery_unique_name="str", - gallery_image_name="str", - api_version="2024-03-03", ) - + result = [r for r in response] # please add some check logic here by yourself # ... diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_shared_gallery_images_operations_async.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_shared_gallery_images_operations_async.py similarity index 80% rename from sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_shared_gallery_images_operations_async.py rename to sdk/compute/azure-mgmt-compute/generated_tests/test_compute_shared_gallery_images_operations_async.py index d8130bc363b5..0eadbd46033b 100644 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_shared_gallery_images_operations_async.py +++ b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_shared_gallery_images_operations_async.py @@ -2,11 +2,11 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.compute.aio import ComputeManagementClient +from azure.mgmt.compute.aio import ComputeClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer from devtools_testutils.aio import recorded_by_proxy_async @@ -15,31 +15,29 @@ @pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestComputeManagementSharedGalleryImagesOperationsAsync(AzureMgmtRecordedTestCase): +class TestComputeSharedGalleryImagesOperationsAsync(AzureMgmtRecordedTestCase): def setup_method(self, method): - self.client = self.create_mgmt_client(ComputeManagementClient, is_async=True) + self.client = self.create_mgmt_client(ComputeClient, is_async=True) @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_shared_gallery_images_list(self, resource_group): - response = self.client.shared_gallery_images.list( + async def test_shared_gallery_images_get(self, resource_group): + response = await self.client.shared_gallery_images.get( location="str", gallery_unique_name="str", - api_version="2024-03-03", + gallery_image_name="str", ) - result = [r async for r in response] + # please add some check logic here by yourself # ... @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_shared_gallery_images_get(self, resource_group): - response = await self.client.shared_gallery_images.get( + async def test_shared_gallery_images_list(self, resource_group): + response = self.client.shared_gallery_images.list( location="str", gallery_unique_name="str", - gallery_image_name="str", - api_version="2024-03-03", ) - + result = [r async for r in response] # please add some check logic here by yourself # ... diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_snapshots_operations_async.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_snapshots_operations.py similarity index 64% rename from sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_snapshots_operations_async.py rename to sdk/compute/azure-mgmt-compute/generated_tests/test_compute_snapshots_operations.py index 7a5db5865d05..01093212a8f9 100644 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_snapshots_operations_async.py +++ b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_snapshots_operations.py @@ -2,67 +2,46 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.compute.aio import ComputeManagementClient +from azure.mgmt.compute import ComputeClient -from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer -from devtools_testutils.aio import recorded_by_proxy_async +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy AZURE_LOCATION = "eastus" @pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestComputeManagementSnapshotsOperationsAsync(AzureMgmtRecordedTestCase): +class TestComputeSnapshotsOperations(AzureMgmtRecordedTestCase): def setup_method(self, method): - self.client = self.create_mgmt_client(ComputeManagementClient, is_async=True) + self.client = self.create_mgmt_client(ComputeClient) @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_snapshots_list(self, resource_group): - response = self.client.snapshots.list( - api_version="2025-01-02", - ) - result = [r async for r in response] - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_snapshots_list_by_resource_group(self, resource_group): - response = self.client.snapshots.list_by_resource_group( - resource_group_name=resource_group.name, - api_version="2025-01-02", - ) - result = [r async for r in response] - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_snapshots_get(self, resource_group): - response = await self.client.snapshots.get( + @recorded_by_proxy + def test_snapshots_get(self, resource_group): + response = self.client.snapshots.get( resource_group_name=resource_group.name, snapshot_name="str", - api_version="2025-01-02", ) # please add some check logic here by yourself # ... @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_snapshots_begin_create_or_update(self, resource_group): - response = await ( - await self.client.snapshots.begin_create_or_update( - resource_group_name=resource_group.name, - snapshot_name="str", - snapshot={ - "location": "str", - "completionPercent": 0.0, - "copyCompletionError": {"errorCode": "str", "errorMessage": "str"}, + @recorded_by_proxy + def test_snapshots_begin_create_or_update(self, resource_group): + response = self.client.snapshots.begin_create_or_update( + resource_group_name=resource_group.name, + snapshot_name="str", + resource={ + "location": "str", + "extendedLocation": {"name": "str", "type": "str"}, + "id": "str", + "managedBy": "str", + "name": "str", + "properties": { "creationData": { "createOption": "str", "elasticSanResourceId": "str", @@ -90,6 +69,8 @@ async def test_snapshots_begin_create_or_update(self, resource_group): "storageAccountId": "str", "uploadSizeBytes": 0, }, + "completionPercent": 0.0, + "copyCompletionError": {"errorCode": "str", "errorMessage": "str"}, "dataAccessAuthMode": "str", "diskAccessId": "str", "diskSizeBytes": 0, @@ -106,20 +87,15 @@ async def test_snapshots_begin_create_or_update(self, resource_group): ], "encryptionSettingsVersion": "str", }, - "extendedLocation": {"name": "str", "type": "str"}, "hyperVGeneration": "str", - "id": "str", "incremental": bool, "incrementalSnapshotFamilyId": "str", - "managedBy": "str", - "name": "str", "networkAccessPolicy": "str", "osType": "str", "provisioningState": "str", "publicNetworkAccess": "str", "purchasePlan": {"name": "str", "product": "str", "publisher": "str", "promotionCode": "str"}, "securityProfile": {"secureVMDiskEncryptionSetId": "str", "securityType": "str"}, - "sku": {"name": "str", "tier": "str"}, "snapshotAccessState": "str", "supportedCapabilities": { "acceleratedNetwork": bool, @@ -128,34 +104,34 @@ async def test_snapshots_begin_create_or_update(self, resource_group): "supportedSecurityOption": "str", }, "supportsHibernation": bool, - "systemData": { - "createdAt": "2020-02-20 00:00:00", - "createdBy": "str", - "createdByType": "str", - "lastModifiedAt": "2020-02-20 00:00:00", - "lastModifiedBy": "str", - "lastModifiedByType": "str", - }, - "tags": {"str": "str"}, "timeCreated": "2020-02-20 00:00:00", - "type": "str", "uniqueId": "str", }, - api_version="2025-01-02", - ) + "sku": {"name": "str", "tier": "str"}, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "tags": {"str": "str"}, + "type": "str", + }, ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself # ... @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_snapshots_begin_update(self, resource_group): - response = await ( - await self.client.snapshots.begin_update( - resource_group_name=resource_group.name, - snapshot_name="str", - snapshot={ + @recorded_by_proxy + def test_snapshots_begin_update(self, resource_group): + response = self.client.snapshots.begin_update( + resource_group_name=resource_group.name, + snapshot_name="str", + properties={ + "properties": { "dataAccessAuthMode": "str", "diskAccessId": "str", "diskSizeGB": 0, @@ -173,7 +149,6 @@ async def test_snapshots_begin_update(self, resource_group): "networkAccessPolicy": "str", "osType": "str", "publicNetworkAccess": "str", - "sku": {"name": "str", "tier": "str"}, "snapshotAccessState": "str", "supportedCapabilities": { "acceleratedNetwork": bool, @@ -182,58 +157,62 @@ async def test_snapshots_begin_update(self, resource_group): "supportedSecurityOption": "str", }, "supportsHibernation": bool, - "tags": {"str": "str"}, }, - api_version="2025-01-02", - ) + "sku": {"name": "str", "tier": "str"}, + "tags": {"str": "str"}, + }, ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself # ... @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_snapshots_begin_delete(self, resource_group): - response = await ( - await self.client.snapshots.begin_delete( - resource_group_name=resource_group.name, - snapshot_name="str", - api_version="2025-01-02", - ) + @recorded_by_proxy + def test_snapshots_begin_delete(self, resource_group): + response = self.client.snapshots.begin_delete( + resource_group_name=resource_group.name, + snapshot_name="str", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself # ... @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_snapshots_begin_grant_access(self, resource_group): - response = await ( - await self.client.snapshots.begin_grant_access( - resource_group_name=resource_group.name, - snapshot_name="str", - grant_access_data={ - "access": "str", - "durationInSeconds": 0, - "fileFormat": "str", - "getSecureVMGuestStateSAS": bool, - }, - api_version="2025-01-02", - ) + @recorded_by_proxy + def test_snapshots_list_by_resource_group(self, resource_group): + response = self.client.snapshots.list_by_resource_group( + resource_group_name=resource_group.name, + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_snapshots_list(self, resource_group): + response = self.client.snapshots.list() + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_snapshots_begin_grant_access(self, resource_group): + response = self.client.snapshots.begin_grant_access( + resource_group_name=resource_group.name, + snapshot_name="str", + body={"access": "str", "durationInSeconds": 0, "fileFormat": "str", "getSecureVMGuestStateSAS": bool}, ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself # ... @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_snapshots_begin_revoke_access(self, resource_group): - response = await ( - await self.client.snapshots.begin_revoke_access( - resource_group_name=resource_group.name, - snapshot_name="str", - api_version="2025-01-02", - ) + @recorded_by_proxy + def test_snapshots_begin_revoke_access(self, resource_group): + response = self.client.snapshots.begin_revoke_access( + resource_group_name=resource_group.name, + snapshot_name="str", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_snapshots_operations_async.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_snapshots_operations_async.py new file mode 100644 index 000000000000..55938680d583 --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_snapshots_operations_async.py @@ -0,0 +1,230 @@ +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.compute.aio import ComputeClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestComputeSnapshotsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ComputeClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_snapshots_get(self, resource_group): + response = await self.client.snapshots.get( + resource_group_name=resource_group.name, + snapshot_name="str", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_snapshots_begin_create_or_update(self, resource_group): + response = await ( + await self.client.snapshots.begin_create_or_update( + resource_group_name=resource_group.name, + snapshot_name="str", + resource={ + "location": "str", + "extendedLocation": {"name": "str", "type": "str"}, + "id": "str", + "managedBy": "str", + "name": "str", + "properties": { + "creationData": { + "createOption": "str", + "elasticSanResourceId": "str", + "galleryImageReference": { + "communityGalleryImageId": "str", + "id": "str", + "lun": 0, + "sharedGalleryImageId": "str", + }, + "imageReference": { + "communityGalleryImageId": "str", + "id": "str", + "lun": 0, + "sharedGalleryImageId": "str", + }, + "instantAccessDurationMinutes": 0, + "logicalSectorSize": 0, + "performancePlus": bool, + "provisionedBandwidthCopySpeed": "str", + "securityDataUri": "str", + "securityMetadataUri": "str", + "sourceResourceId": "str", + "sourceUniqueId": "str", + "sourceUri": "str", + "storageAccountId": "str", + "uploadSizeBytes": 0, + }, + "completionPercent": 0.0, + "copyCompletionError": {"errorCode": "str", "errorMessage": "str"}, + "dataAccessAuthMode": "str", + "diskAccessId": "str", + "diskSizeBytes": 0, + "diskSizeGB": 0, + "diskState": "str", + "encryption": {"diskEncryptionSetId": "str", "type": "str"}, + "encryptionSettingsCollection": { + "enabled": bool, + "encryptionSettings": [ + { + "diskEncryptionKey": {"secretUrl": "str", "sourceVault": {"id": "str"}}, + "keyEncryptionKey": {"keyUrl": "str", "sourceVault": {"id": "str"}}, + } + ], + "encryptionSettingsVersion": "str", + }, + "hyperVGeneration": "str", + "incremental": bool, + "incrementalSnapshotFamilyId": "str", + "networkAccessPolicy": "str", + "osType": "str", + "provisioningState": "str", + "publicNetworkAccess": "str", + "purchasePlan": {"name": "str", "product": "str", "publisher": "str", "promotionCode": "str"}, + "securityProfile": {"secureVMDiskEncryptionSetId": "str", "securityType": "str"}, + "snapshotAccessState": "str", + "supportedCapabilities": { + "acceleratedNetwork": bool, + "architecture": "str", + "diskControllerTypes": "str", + "supportedSecurityOption": "str", + }, + "supportsHibernation": bool, + "timeCreated": "2020-02-20 00:00:00", + "uniqueId": "str", + }, + "sku": {"name": "str", "tier": "str"}, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "tags": {"str": "str"}, + "type": "str", + }, + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_snapshots_begin_update(self, resource_group): + response = await ( + await self.client.snapshots.begin_update( + resource_group_name=resource_group.name, + snapshot_name="str", + properties={ + "properties": { + "dataAccessAuthMode": "str", + "diskAccessId": "str", + "diskSizeGB": 0, + "encryption": {"diskEncryptionSetId": "str", "type": "str"}, + "encryptionSettingsCollection": { + "enabled": bool, + "encryptionSettings": [ + { + "diskEncryptionKey": {"secretUrl": "str", "sourceVault": {"id": "str"}}, + "keyEncryptionKey": {"keyUrl": "str", "sourceVault": {"id": "str"}}, + } + ], + "encryptionSettingsVersion": "str", + }, + "networkAccessPolicy": "str", + "osType": "str", + "publicNetworkAccess": "str", + "snapshotAccessState": "str", + "supportedCapabilities": { + "acceleratedNetwork": bool, + "architecture": "str", + "diskControllerTypes": "str", + "supportedSecurityOption": "str", + }, + "supportsHibernation": bool, + }, + "sku": {"name": "str", "tier": "str"}, + "tags": {"str": "str"}, + }, + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_snapshots_begin_delete(self, resource_group): + response = await ( + await self.client.snapshots.begin_delete( + resource_group_name=resource_group.name, + snapshot_name="str", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_snapshots_list_by_resource_group(self, resource_group): + response = self.client.snapshots.list_by_resource_group( + resource_group_name=resource_group.name, + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_snapshots_list(self, resource_group): + response = self.client.snapshots.list() + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_snapshots_begin_grant_access(self, resource_group): + response = await ( + await self.client.snapshots.begin_grant_access( + resource_group_name=resource_group.name, + snapshot_name="str", + body={"access": "str", "durationInSeconds": 0, "fileFormat": "str", "getSecureVMGuestStateSAS": bool}, + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_snapshots_begin_revoke_access(self, resource_group): + response = await ( + await self.client.snapshots.begin_revoke_access( + resource_group_name=resource_group.name, + snapshot_name="str", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_ssh_public_keys_operations.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_ssh_public_key_resources_operations.py similarity index 65% rename from sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_ssh_public_keys_operations.py rename to sdk/compute/azure-mgmt-compute/generated_tests/test_compute_ssh_public_key_resources_operations.py index 34e6157d8d9e..59552e788990 100644 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_ssh_public_keys_operations.py +++ b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_ssh_public_key_resources_operations.py @@ -2,11 +2,11 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.compute import ComputeManagementClient +from azure.mgmt.compute import ComputeClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy @@ -14,38 +14,16 @@ @pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestComputeManagementSshPublicKeysOperations(AzureMgmtRecordedTestCase): +class TestComputeSshPublicKeyResourcesOperations(AzureMgmtRecordedTestCase): def setup_method(self, method): - self.client = self.create_mgmt_client(ComputeManagementClient) + self.client = self.create_mgmt_client(ComputeClient) @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_ssh_public_keys_list_by_subscription(self, resource_group): - response = self.client.ssh_public_keys.list_by_subscription( - api_version="2025-04-01", - ) - result = [r for r in response] - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_ssh_public_keys_list_by_resource_group(self, resource_group): - response = self.client.ssh_public_keys.list_by_resource_group( - resource_group_name=resource_group.name, - api_version="2025-04-01", - ) - result = [r for r in response] - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_ssh_public_keys_get(self, resource_group): - response = self.client.ssh_public_keys.get( + def test_ssh_public_key_resources_get(self, resource_group): + response = self.client.ssh_public_key_resources.get( resource_group_name=resource_group.name, ssh_public_key_name="str", - api_version="2025-04-01", ) # please add some check logic here by yourself @@ -53,15 +31,15 @@ def test_ssh_public_keys_get(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_ssh_public_keys_create(self, resource_group): - response = self.client.ssh_public_keys.create( + def test_ssh_public_key_resources_create(self, resource_group): + response = self.client.ssh_public_key_resources.create( resource_group_name=resource_group.name, ssh_public_key_name="str", - parameters={ + resource={ "location": "str", "id": "str", "name": "str", - "publicKey": "str", + "properties": {"publicKey": "str"}, "systemData": { "createdAt": "2020-02-20 00:00:00", "createdBy": "str", @@ -73,7 +51,6 @@ def test_ssh_public_keys_create(self, resource_group): "tags": {"str": "str"}, "type": "str", }, - api_version="2025-04-01", ) # please add some check logic here by yourself @@ -81,12 +58,11 @@ def test_ssh_public_keys_create(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_ssh_public_keys_update(self, resource_group): - response = self.client.ssh_public_keys.update( + def test_ssh_public_key_resources_update(self, resource_group): + response = self.client.ssh_public_key_resources.update( resource_group_name=resource_group.name, ssh_public_key_name="str", - parameters={"publicKey": "str", "tags": {"str": "str"}}, - api_version="2025-04-01", + properties={"properties": {"publicKey": "str"}, "tags": {"str": "str"}}, ) # please add some check logic here by yourself @@ -94,11 +70,10 @@ def test_ssh_public_keys_update(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_ssh_public_keys_delete(self, resource_group): - response = self.client.ssh_public_keys.delete( + def test_ssh_public_key_resources_delete(self, resource_group): + response = self.client.ssh_public_key_resources.delete( resource_group_name=resource_group.name, ssh_public_key_name="str", - api_version="2025-04-01", ) # please add some check logic here by yourself @@ -106,11 +81,28 @@ def test_ssh_public_keys_delete(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_ssh_public_keys_generate_key_pair(self, resource_group): - response = self.client.ssh_public_keys.generate_key_pair( + def test_ssh_public_key_resources_list_by_resource_group(self, resource_group): + response = self.client.ssh_public_key_resources.list_by_resource_group( + resource_group_name=resource_group.name, + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_ssh_public_key_resources_list_by_subscription(self, resource_group): + response = self.client.ssh_public_key_resources.list_by_subscription() + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_ssh_public_key_resources_generate_key_pair(self, resource_group): + response = self.client.ssh_public_key_resources.generate_key_pair( resource_group_name=resource_group.name, ssh_public_key_name="str", - api_version="2025-04-01", ) # please add some check logic here by yourself diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_ssh_public_keys_operations_async.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_ssh_public_key_resources_operations_async.py similarity index 65% rename from sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_ssh_public_keys_operations_async.py rename to sdk/compute/azure-mgmt-compute/generated_tests/test_compute_ssh_public_key_resources_operations_async.py index 9c12dbf30b58..81de981dd74c 100644 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_ssh_public_keys_operations_async.py +++ b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_ssh_public_key_resources_operations_async.py @@ -2,11 +2,11 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.compute.aio import ComputeManagementClient +from azure.mgmt.compute.aio import ComputeClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer from devtools_testutils.aio import recorded_by_proxy_async @@ -15,38 +15,16 @@ @pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestComputeManagementSshPublicKeysOperationsAsync(AzureMgmtRecordedTestCase): +class TestComputeSshPublicKeyResourcesOperationsAsync(AzureMgmtRecordedTestCase): def setup_method(self, method): - self.client = self.create_mgmt_client(ComputeManagementClient, is_async=True) + self.client = self.create_mgmt_client(ComputeClient, is_async=True) @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_ssh_public_keys_list_by_subscription(self, resource_group): - response = self.client.ssh_public_keys.list_by_subscription( - api_version="2025-04-01", - ) - result = [r async for r in response] - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_ssh_public_keys_list_by_resource_group(self, resource_group): - response = self.client.ssh_public_keys.list_by_resource_group( - resource_group_name=resource_group.name, - api_version="2025-04-01", - ) - result = [r async for r in response] - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_ssh_public_keys_get(self, resource_group): - response = await self.client.ssh_public_keys.get( + async def test_ssh_public_key_resources_get(self, resource_group): + response = await self.client.ssh_public_key_resources.get( resource_group_name=resource_group.name, ssh_public_key_name="str", - api_version="2025-04-01", ) # please add some check logic here by yourself @@ -54,15 +32,15 @@ async def test_ssh_public_keys_get(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_ssh_public_keys_create(self, resource_group): - response = await self.client.ssh_public_keys.create( + async def test_ssh_public_key_resources_create(self, resource_group): + response = await self.client.ssh_public_key_resources.create( resource_group_name=resource_group.name, ssh_public_key_name="str", - parameters={ + resource={ "location": "str", "id": "str", "name": "str", - "publicKey": "str", + "properties": {"publicKey": "str"}, "systemData": { "createdAt": "2020-02-20 00:00:00", "createdBy": "str", @@ -74,7 +52,6 @@ async def test_ssh_public_keys_create(self, resource_group): "tags": {"str": "str"}, "type": "str", }, - api_version="2025-04-01", ) # please add some check logic here by yourself @@ -82,12 +59,11 @@ async def test_ssh_public_keys_create(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_ssh_public_keys_update(self, resource_group): - response = await self.client.ssh_public_keys.update( + async def test_ssh_public_key_resources_update(self, resource_group): + response = await self.client.ssh_public_key_resources.update( resource_group_name=resource_group.name, ssh_public_key_name="str", - parameters={"publicKey": "str", "tags": {"str": "str"}}, - api_version="2025-04-01", + properties={"properties": {"publicKey": "str"}, "tags": {"str": "str"}}, ) # please add some check logic here by yourself @@ -95,11 +71,10 @@ async def test_ssh_public_keys_update(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_ssh_public_keys_delete(self, resource_group): - response = await self.client.ssh_public_keys.delete( + async def test_ssh_public_key_resources_delete(self, resource_group): + response = await self.client.ssh_public_key_resources.delete( resource_group_name=resource_group.name, ssh_public_key_name="str", - api_version="2025-04-01", ) # please add some check logic here by yourself @@ -107,11 +82,28 @@ async def test_ssh_public_keys_delete(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_ssh_public_keys_generate_key_pair(self, resource_group): - response = await self.client.ssh_public_keys.generate_key_pair( + async def test_ssh_public_key_resources_list_by_resource_group(self, resource_group): + response = self.client.ssh_public_key_resources.list_by_resource_group( + resource_group_name=resource_group.name, + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_ssh_public_key_resources_list_by_subscription(self, resource_group): + response = self.client.ssh_public_key_resources.list_by_subscription() + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_ssh_public_key_resources_generate_key_pair(self, resource_group): + response = await self.client.ssh_public_key_resources.generate_key_pair( resource_group_name=resource_group.name, ssh_public_key_name="str", - api_version="2025-04-01", ) # please add some check logic here by yourself diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_usage_operations.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_usage_operation_group_operations.py similarity index 70% rename from sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_usage_operations.py rename to sdk/compute/azure-mgmt-compute/generated_tests/test_compute_usage_operation_group_operations.py index ea8399e28830..b6b947cdacb4 100644 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_usage_operations.py +++ b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_usage_operation_group_operations.py @@ -2,11 +2,11 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.compute import ComputeManagementClient +from azure.mgmt.compute import ComputeClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy @@ -14,16 +14,15 @@ @pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestComputeManagementUsageOperations(AzureMgmtRecordedTestCase): +class TestComputeUsageOperationGroupOperations(AzureMgmtRecordedTestCase): def setup_method(self, method): - self.client = self.create_mgmt_client(ComputeManagementClient) + self.client = self.create_mgmt_client(ComputeClient) @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_usage_list(self, resource_group): - response = self.client.usage.list( + def test_usage_operation_group_list(self, resource_group): + response = self.client.usage_operation_group.list( location="str", - api_version="2025-04-01", ) result = [r for r in response] # please add some check logic here by yourself diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_usage_operations_async.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_usage_operation_group_operations_async.py similarity index 70% rename from sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_usage_operations_async.py rename to sdk/compute/azure-mgmt-compute/generated_tests/test_compute_usage_operation_group_operations_async.py index 0ed47ef4b4b9..eea19701d43e 100644 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_usage_operations_async.py +++ b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_usage_operation_group_operations_async.py @@ -2,11 +2,11 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.compute.aio import ComputeManagementClient +from azure.mgmt.compute.aio import ComputeClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer from devtools_testutils.aio import recorded_by_proxy_async @@ -15,16 +15,15 @@ @pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestComputeManagementUsageOperationsAsync(AzureMgmtRecordedTestCase): +class TestComputeUsageOperationGroupOperationsAsync(AzureMgmtRecordedTestCase): def setup_method(self, method): - self.client = self.create_mgmt_client(ComputeManagementClient, is_async=True) + self.client = self.create_mgmt_client(ComputeClient, is_async=True) @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_usage_list(self, resource_group): - response = self.client.usage.list( + async def test_usage_operation_group_list(self, resource_group): + response = self.client.usage_operation_group.list( location="str", - api_version="2025-04-01", ) result = [r async for r in response] # please add some check logic here by yourself diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_virtual_machine_extension_images_operations.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machine_extension_images_operations.py similarity index 82% rename from sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_virtual_machine_extension_images_operations.py rename to sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machine_extension_images_operations.py index e62e413d54ef..1366109a2543 100644 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_virtual_machine_extension_images_operations.py +++ b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machine_extension_images_operations.py @@ -2,11 +2,11 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.compute import ComputeManagementClient +from azure.mgmt.compute import ComputeClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy @@ -14,17 +14,18 @@ @pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestComputeManagementVirtualMachineExtensionImagesOperations(AzureMgmtRecordedTestCase): +class TestComputeVirtualMachineExtensionImagesOperations(AzureMgmtRecordedTestCase): def setup_method(self, method): - self.client = self.create_mgmt_client(ComputeManagementClient) + self.client = self.create_mgmt_client(ComputeClient) @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_virtual_machine_extension_images_list_types(self, resource_group): - response = self.client.virtual_machine_extension_images.list_types( + def test_virtual_machine_extension_images_get(self, resource_group): + response = self.client.virtual_machine_extension_images.get( location="str", publisher_name="str", - api_version="2025-04-01", + type="str", + version="str", ) # please add some check logic here by yourself @@ -32,12 +33,10 @@ def test_virtual_machine_extension_images_list_types(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_virtual_machine_extension_images_list_versions(self, resource_group): - response = self.client.virtual_machine_extension_images.list_versions( + def test_virtual_machine_extension_images_list_types(self, resource_group): + response = self.client.virtual_machine_extension_images.list_types( location="str", publisher_name="str", - type="str", - api_version="2025-04-01", ) # please add some check logic here by yourself @@ -45,13 +44,11 @@ def test_virtual_machine_extension_images_list_versions(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_virtual_machine_extension_images_get(self, resource_group): - response = self.client.virtual_machine_extension_images.get( + def test_virtual_machine_extension_images_list_versions(self, resource_group): + response = self.client.virtual_machine_extension_images.list_versions( location="str", publisher_name="str", type="str", - version="str", - api_version="2025-04-01", ) # please add some check logic here by yourself diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_virtual_machine_extension_images_operations_async.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machine_extension_images_operations_async.py similarity index 82% rename from sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_virtual_machine_extension_images_operations_async.py rename to sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machine_extension_images_operations_async.py index c723ceebe3a6..e44a2a14dafe 100644 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_virtual_machine_extension_images_operations_async.py +++ b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machine_extension_images_operations_async.py @@ -2,11 +2,11 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.compute.aio import ComputeManagementClient +from azure.mgmt.compute.aio import ComputeClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer from devtools_testutils.aio import recorded_by_proxy_async @@ -15,17 +15,18 @@ @pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestComputeManagementVirtualMachineExtensionImagesOperationsAsync(AzureMgmtRecordedTestCase): +class TestComputeVirtualMachineExtensionImagesOperationsAsync(AzureMgmtRecordedTestCase): def setup_method(self, method): - self.client = self.create_mgmt_client(ComputeManagementClient, is_async=True) + self.client = self.create_mgmt_client(ComputeClient, is_async=True) @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_virtual_machine_extension_images_list_types(self, resource_group): - response = await self.client.virtual_machine_extension_images.list_types( + async def test_virtual_machine_extension_images_get(self, resource_group): + response = await self.client.virtual_machine_extension_images.get( location="str", publisher_name="str", - api_version="2025-04-01", + type="str", + version="str", ) # please add some check logic here by yourself @@ -33,12 +34,10 @@ async def test_virtual_machine_extension_images_list_types(self, resource_group) @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_virtual_machine_extension_images_list_versions(self, resource_group): - response = await self.client.virtual_machine_extension_images.list_versions( + async def test_virtual_machine_extension_images_list_types(self, resource_group): + response = await self.client.virtual_machine_extension_images.list_types( location="str", publisher_name="str", - type="str", - api_version="2025-04-01", ) # please add some check logic here by yourself @@ -46,13 +45,11 @@ async def test_virtual_machine_extension_images_list_versions(self, resource_gro @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_virtual_machine_extension_images_get(self, resource_group): - response = await self.client.virtual_machine_extension_images.get( + async def test_virtual_machine_extension_images_list_versions(self, resource_group): + response = await self.client.virtual_machine_extension_images.list_versions( location="str", publisher_name="str", type="str", - version="str", - api_version="2025-04-01", ) # please add some check logic here by yourself diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_virtual_machine_extensions_operations.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machine_extensions_operations.py similarity index 60% rename from sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_virtual_machine_extensions_operations.py rename to sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machine_extensions_operations.py index 2ed8a9045d74..f64175b55a22 100644 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_virtual_machine_extensions_operations.py +++ b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machine_extensions_operations.py @@ -2,11 +2,11 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.compute import ComputeManagementClient +from azure.mgmt.compute import ComputeClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy @@ -14,21 +14,9 @@ @pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestComputeManagementVirtualMachineExtensionsOperations(AzureMgmtRecordedTestCase): +class TestComputeVirtualMachineExtensionsOperations(AzureMgmtRecordedTestCase): def setup_method(self, method): - self.client = self.create_mgmt_client(ComputeManagementClient) - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_virtual_machine_extensions_list(self, resource_group): - response = self.client.virtual_machine_extensions.list( - resource_group_name=resource_group.name, - vm_name="str", - api_version="2025-04-01", - ) - - # please add some check logic here by yourself - # ... + self.client = self.create_mgmt_client(ComputeClient) @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy @@ -37,7 +25,6 @@ def test_virtual_machine_extensions_get(self, resource_group): resource_group_name=resource_group.name, vm_name="str", vm_extension_name="str", - api_version="2025-04-01", ) # please add some check logic here by yourself @@ -50,43 +37,47 @@ def test_virtual_machine_extensions_begin_create_or_update(self, resource_group) resource_group_name=resource_group.name, vm_name="str", vm_extension_name="str", - extension_parameters={ + resource={ "location": "str", - "autoUpgradeMinorVersion": bool, - "enableAutomaticUpgrade": bool, - "forceUpdateTag": "str", "id": "str", - "instanceView": { - "name": "str", - "statuses": [ - { - "code": "str", - "displayStatus": "str", - "level": "str", - "message": "str", - "time": "2020-02-20 00:00:00", - } - ], - "substatuses": [ - { - "code": "str", - "displayStatus": "str", - "level": "str", - "message": "str", - "time": "2020-02-20 00:00:00", - } - ], + "name": "str", + "properties": { + "autoUpgradeMinorVersion": bool, + "enableAutomaticUpgrade": bool, + "forceUpdateTag": "str", + "instanceView": { + "name": "str", + "statuses": [ + { + "code": "str", + "displayStatus": "str", + "level": "str", + "message": "str", + "time": "2020-02-20 00:00:00", + } + ], + "substatuses": [ + { + "code": "str", + "displayStatus": "str", + "level": "str", + "message": "str", + "time": "2020-02-20 00:00:00", + } + ], + "type": "str", + "typeHandlerVersion": "str", + }, + "protectedSettings": {}, + "protectedSettingsFromKeyVault": {"secretUrl": "str", "sourceVault": {"id": "str"}}, + "provisionAfterExtensions": ["str"], + "provisioningState": "str", + "publisher": "str", + "settings": {}, + "suppressFailures": bool, "type": "str", "typeHandlerVersion": "str", }, - "name": "str", - "protectedSettings": {}, - "protectedSettingsFromKeyVault": {"secretUrl": "str", "sourceVault": {"id": "str"}}, - "provisionAfterExtensions": ["str"], - "provisioningState": "str", - "publisher": "str", - "settings": {}, - "suppressFailures": bool, "systemData": { "createdAt": "2020-02-20 00:00:00", "createdBy": "str", @@ -97,9 +88,7 @@ def test_virtual_machine_extensions_begin_create_or_update(self, resource_group) }, "tags": {"str": "str"}, "type": "str", - "typeHandlerVersion": "str", }, - api_version="2025-04-01", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -112,20 +101,21 @@ def test_virtual_machine_extensions_begin_update(self, resource_group): resource_group_name=resource_group.name, vm_name="str", vm_extension_name="str", - extension_parameters={ - "autoUpgradeMinorVersion": bool, - "enableAutomaticUpgrade": bool, - "forceUpdateTag": "str", - "protectedSettings": {}, - "protectedSettingsFromKeyVault": {"secretUrl": "str", "sourceVault": {"id": "str"}}, - "publisher": "str", - "settings": {}, - "suppressFailures": bool, + properties={ + "properties": { + "autoUpgradeMinorVersion": bool, + "enableAutomaticUpgrade": bool, + "forceUpdateTag": "str", + "protectedSettings": {}, + "protectedSettingsFromKeyVault": {"secretUrl": "str", "sourceVault": {"id": "str"}}, + "publisher": "str", + "settings": {}, + "suppressFailures": bool, + "type": "str", + "typeHandlerVersion": "str", + }, "tags": {"str": "str"}, - "type": "str", - "typeHandlerVersion": "str", }, - api_version="2025-04-01", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -138,8 +128,18 @@ def test_virtual_machine_extensions_begin_delete(self, resource_group): resource_group_name=resource_group.name, vm_name="str", vm_extension_name="str", - api_version="2025-04-01", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_virtual_machine_extensions_list(self, resource_group): + response = self.client.virtual_machine_extensions.list( + resource_group_name=resource_group.name, + vm_name="str", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_virtual_machine_extensions_operations_async.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machine_extensions_operations_async.py similarity index 59% rename from sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_virtual_machine_extensions_operations_async.py rename to sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machine_extensions_operations_async.py index b0af73eda8f4..db9db66a58e7 100644 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_virtual_machine_extensions_operations_async.py +++ b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machine_extensions_operations_async.py @@ -2,11 +2,11 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.compute.aio import ComputeManagementClient +from azure.mgmt.compute.aio import ComputeClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer from devtools_testutils.aio import recorded_by_proxy_async @@ -15,21 +15,9 @@ @pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestComputeManagementVirtualMachineExtensionsOperationsAsync(AzureMgmtRecordedTestCase): +class TestComputeVirtualMachineExtensionsOperationsAsync(AzureMgmtRecordedTestCase): def setup_method(self, method): - self.client = self.create_mgmt_client(ComputeManagementClient, is_async=True) - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_virtual_machine_extensions_list(self, resource_group): - response = await self.client.virtual_machine_extensions.list( - resource_group_name=resource_group.name, - vm_name="str", - api_version="2025-04-01", - ) - - # please add some check logic here by yourself - # ... + self.client = self.create_mgmt_client(ComputeClient, is_async=True) @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async @@ -38,7 +26,6 @@ async def test_virtual_machine_extensions_get(self, resource_group): resource_group_name=resource_group.name, vm_name="str", vm_extension_name="str", - api_version="2025-04-01", ) # please add some check logic here by yourself @@ -52,43 +39,47 @@ async def test_virtual_machine_extensions_begin_create_or_update(self, resource_ resource_group_name=resource_group.name, vm_name="str", vm_extension_name="str", - extension_parameters={ + resource={ "location": "str", - "autoUpgradeMinorVersion": bool, - "enableAutomaticUpgrade": bool, - "forceUpdateTag": "str", "id": "str", - "instanceView": { - "name": "str", - "statuses": [ - { - "code": "str", - "displayStatus": "str", - "level": "str", - "message": "str", - "time": "2020-02-20 00:00:00", - } - ], - "substatuses": [ - { - "code": "str", - "displayStatus": "str", - "level": "str", - "message": "str", - "time": "2020-02-20 00:00:00", - } - ], + "name": "str", + "properties": { + "autoUpgradeMinorVersion": bool, + "enableAutomaticUpgrade": bool, + "forceUpdateTag": "str", + "instanceView": { + "name": "str", + "statuses": [ + { + "code": "str", + "displayStatus": "str", + "level": "str", + "message": "str", + "time": "2020-02-20 00:00:00", + } + ], + "substatuses": [ + { + "code": "str", + "displayStatus": "str", + "level": "str", + "message": "str", + "time": "2020-02-20 00:00:00", + } + ], + "type": "str", + "typeHandlerVersion": "str", + }, + "protectedSettings": {}, + "protectedSettingsFromKeyVault": {"secretUrl": "str", "sourceVault": {"id": "str"}}, + "provisionAfterExtensions": ["str"], + "provisioningState": "str", + "publisher": "str", + "settings": {}, + "suppressFailures": bool, "type": "str", "typeHandlerVersion": "str", }, - "name": "str", - "protectedSettings": {}, - "protectedSettingsFromKeyVault": {"secretUrl": "str", "sourceVault": {"id": "str"}}, - "provisionAfterExtensions": ["str"], - "provisioningState": "str", - "publisher": "str", - "settings": {}, - "suppressFailures": bool, "systemData": { "createdAt": "2020-02-20 00:00:00", "createdBy": "str", @@ -99,9 +90,7 @@ async def test_virtual_machine_extensions_begin_create_or_update(self, resource_ }, "tags": {"str": "str"}, "type": "str", - "typeHandlerVersion": "str", }, - api_version="2025-04-01", ) ).result() # call '.result()' to poll until service return final result @@ -116,20 +105,21 @@ async def test_virtual_machine_extensions_begin_update(self, resource_group): resource_group_name=resource_group.name, vm_name="str", vm_extension_name="str", - extension_parameters={ - "autoUpgradeMinorVersion": bool, - "enableAutomaticUpgrade": bool, - "forceUpdateTag": "str", - "protectedSettings": {}, - "protectedSettingsFromKeyVault": {"secretUrl": "str", "sourceVault": {"id": "str"}}, - "publisher": "str", - "settings": {}, - "suppressFailures": bool, + properties={ + "properties": { + "autoUpgradeMinorVersion": bool, + "enableAutomaticUpgrade": bool, + "forceUpdateTag": "str", + "protectedSettings": {}, + "protectedSettingsFromKeyVault": {"secretUrl": "str", "sourceVault": {"id": "str"}}, + "publisher": "str", + "settings": {}, + "suppressFailures": bool, + "type": "str", + "typeHandlerVersion": "str", + }, "tags": {"str": "str"}, - "type": "str", - "typeHandlerVersion": "str", }, - api_version="2025-04-01", ) ).result() # call '.result()' to poll until service return final result @@ -144,9 +134,19 @@ async def test_virtual_machine_extensions_begin_delete(self, resource_group): resource_group_name=resource_group.name, vm_name="str", vm_extension_name="str", - api_version="2025-04-01", ) ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_virtual_machine_extensions_list(self, resource_group): + response = self.client.virtual_machine_extensions.list( + resource_group_name=resource_group.name, + vm_name="str", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_virtual_machine_images_edge_zone_operations.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machine_images_edge_zone_operation_group_operations.py similarity index 62% rename from sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_virtual_machine_images_edge_zone_operations.py rename to sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machine_images_edge_zone_operation_group_operations.py index 5a4893d8d99d..94d56dc585e9 100644 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_virtual_machine_images_edge_zone_operations.py +++ b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machine_images_edge_zone_operation_group_operations.py @@ -2,11 +2,11 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.compute import ComputeManagementClient +from azure.mgmt.compute import ComputeClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy @@ -14,17 +14,16 @@ @pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestComputeManagementVirtualMachineImagesEdgeZoneOperations(AzureMgmtRecordedTestCase): +class TestComputeVirtualMachineImagesEdgeZoneOperationGroupOperations(AzureMgmtRecordedTestCase): def setup_method(self, method): - self.client = self.create_mgmt_client(ComputeManagementClient) + self.client = self.create_mgmt_client(ComputeClient) @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_virtual_machine_images_edge_zone_list_publishers(self, resource_group): - response = self.client.virtual_machine_images_edge_zone.list_publishers( + def test_virtual_machine_images_edge_zone_operation_group_list_publishers(self, resource_group): + response = self.client.virtual_machine_images_edge_zone_operation_group.list_publishers( location="str", edge_zone="str", - api_version="2025-04-01", ) # please add some check logic here by yourself @@ -32,12 +31,11 @@ def test_virtual_machine_images_edge_zone_list_publishers(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_virtual_machine_images_edge_zone_list_offers(self, resource_group): - response = self.client.virtual_machine_images_edge_zone.list_offers( + def test_virtual_machine_images_edge_zone_operation_group_list_offers(self, resource_group): + response = self.client.virtual_machine_images_edge_zone_operation_group.list_offers( location="str", edge_zone="str", publisher_name="str", - api_version="2025-04-01", ) # please add some check logic here by yourself @@ -45,13 +43,12 @@ def test_virtual_machine_images_edge_zone_list_offers(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_virtual_machine_images_edge_zone_list_skus(self, resource_group): - response = self.client.virtual_machine_images_edge_zone.list_skus( + def test_virtual_machine_images_edge_zone_operation_group_list_skus(self, resource_group): + response = self.client.virtual_machine_images_edge_zone_operation_group.list_skus( location="str", edge_zone="str", publisher_name="str", offer="str", - api_version="2025-04-01", ) # please add some check logic here by yourself @@ -59,14 +56,13 @@ def test_virtual_machine_images_edge_zone_list_skus(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_virtual_machine_images_edge_zone_list(self, resource_group): - response = self.client.virtual_machine_images_edge_zone.list( + def test_virtual_machine_images_edge_zone_operation_group_list(self, resource_group): + response = self.client.virtual_machine_images_edge_zone_operation_group.list( location="str", edge_zone="str", publisher_name="str", offer="str", skus="str", - api_version="2025-04-01", ) # please add some check logic here by yourself @@ -74,15 +70,14 @@ def test_virtual_machine_images_edge_zone_list(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_virtual_machine_images_edge_zone_get(self, resource_group): - response = self.client.virtual_machine_images_edge_zone.get( + def test_virtual_machine_images_edge_zone_operation_group_get(self, resource_group): + response = self.client.virtual_machine_images_edge_zone_operation_group.get( location="str", edge_zone="str", publisher_name="str", offer="str", skus="str", version="str", - api_version="2025-04-01", ) # please add some check logic here by yourself diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_virtual_machine_images_edge_zone_operations_async.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machine_images_edge_zone_operation_group_operations_async.py similarity index 71% rename from sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_virtual_machine_images_edge_zone_operations_async.py rename to sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machine_images_edge_zone_operation_group_operations_async.py index 7262f8b3d908..dcd17089afd3 100644 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_virtual_machine_images_edge_zone_operations_async.py +++ b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machine_images_edge_zone_operation_group_operations_async.py @@ -2,11 +2,11 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.compute.aio import ComputeManagementClient +from azure.mgmt.compute.aio import ComputeClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer from devtools_testutils.aio import recorded_by_proxy_async @@ -15,17 +15,16 @@ @pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestComputeManagementVirtualMachineImagesEdgeZoneOperationsAsync(AzureMgmtRecordedTestCase): +class TestComputeVirtualMachineImagesEdgeZoneOperationGroupOperationsAsync(AzureMgmtRecordedTestCase): def setup_method(self, method): - self.client = self.create_mgmt_client(ComputeManagementClient, is_async=True) + self.client = self.create_mgmt_client(ComputeClient, is_async=True) @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_virtual_machine_images_edge_zone_list_publishers(self, resource_group): - response = await self.client.virtual_machine_images_edge_zone.list_publishers( + async def test_virtual_machine_images_edge_zone_operation_group_list_publishers(self, resource_group): + response = await self.client.virtual_machine_images_edge_zone_operation_group.list_publishers( location="str", edge_zone="str", - api_version="2025-04-01", ) # please add some check logic here by yourself @@ -33,12 +32,11 @@ async def test_virtual_machine_images_edge_zone_list_publishers(self, resource_g @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_virtual_machine_images_edge_zone_list_offers(self, resource_group): - response = await self.client.virtual_machine_images_edge_zone.list_offers( + async def test_virtual_machine_images_edge_zone_operation_group_list_offers(self, resource_group): + response = await self.client.virtual_machine_images_edge_zone_operation_group.list_offers( location="str", edge_zone="str", publisher_name="str", - api_version="2025-04-01", ) # please add some check logic here by yourself @@ -46,13 +44,12 @@ async def test_virtual_machine_images_edge_zone_list_offers(self, resource_group @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_virtual_machine_images_edge_zone_list_skus(self, resource_group): - response = await self.client.virtual_machine_images_edge_zone.list_skus( + async def test_virtual_machine_images_edge_zone_operation_group_list_skus(self, resource_group): + response = await self.client.virtual_machine_images_edge_zone_operation_group.list_skus( location="str", edge_zone="str", publisher_name="str", offer="str", - api_version="2025-04-01", ) # please add some check logic here by yourself @@ -60,14 +57,13 @@ async def test_virtual_machine_images_edge_zone_list_skus(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_virtual_machine_images_edge_zone_list(self, resource_group): - response = await self.client.virtual_machine_images_edge_zone.list( + async def test_virtual_machine_images_edge_zone_operation_group_list(self, resource_group): + response = await self.client.virtual_machine_images_edge_zone_operation_group.list( location="str", edge_zone="str", publisher_name="str", offer="str", skus="str", - api_version="2025-04-01", ) # please add some check logic here by yourself @@ -75,15 +71,14 @@ async def test_virtual_machine_images_edge_zone_list(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_virtual_machine_images_edge_zone_get(self, resource_group): - response = await self.client.virtual_machine_images_edge_zone.get( + async def test_virtual_machine_images_edge_zone_operation_group_get(self, resource_group): + response = await self.client.virtual_machine_images_edge_zone_operation_group.get( location="str", edge_zone="str", publisher_name="str", offer="str", skus="str", version="str", - api_version="2025-04-01", ) # please add some check logic here by yourself diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_virtual_machine_images_operations.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machine_images_operation_group_operations.py similarity index 62% rename from sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_virtual_machine_images_operations.py rename to sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machine_images_operation_group_operations.py index 59bf7aa7bd15..1d99b65f8732 100644 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_virtual_machine_images_operations.py +++ b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machine_images_operation_group_operations.py @@ -2,11 +2,11 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.compute import ComputeManagementClient +from azure.mgmt.compute import ComputeClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy @@ -14,17 +14,16 @@ @pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestComputeManagementVirtualMachineImagesOperations(AzureMgmtRecordedTestCase): +class TestComputeVirtualMachineImagesOperationGroupOperations(AzureMgmtRecordedTestCase): def setup_method(self, method): - self.client = self.create_mgmt_client(ComputeManagementClient) + self.client = self.create_mgmt_client(ComputeClient) @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_virtual_machine_images_list_by_edge_zone(self, resource_group): - response = self.client.virtual_machine_images.list_by_edge_zone( + def test_virtual_machine_images_operation_group_list_by_edge_zone(self, resource_group): + response = self.client.virtual_machine_images_operation_group.list_by_edge_zone( location="str", edge_zone="str", - api_version="2025-04-01", ) # please add some check logic here by yourself @@ -32,10 +31,9 @@ def test_virtual_machine_images_list_by_edge_zone(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_virtual_machine_images_list_publishers(self, resource_group): - response = self.client.virtual_machine_images.list_publishers( + def test_virtual_machine_images_operation_group_list_publishers(self, resource_group): + response = self.client.virtual_machine_images_operation_group.list_publishers( location="str", - api_version="2025-04-01", ) # please add some check logic here by yourself @@ -43,11 +41,10 @@ def test_virtual_machine_images_list_publishers(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_virtual_machine_images_list_offers(self, resource_group): - response = self.client.virtual_machine_images.list_offers( + def test_virtual_machine_images_operation_group_list_offers(self, resource_group): + response = self.client.virtual_machine_images_operation_group.list_offers( location="str", publisher_name="str", - api_version="2025-04-01", ) # please add some check logic here by yourself @@ -55,12 +52,11 @@ def test_virtual_machine_images_list_offers(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_virtual_machine_images_list_skus(self, resource_group): - response = self.client.virtual_machine_images.list_skus( + def test_virtual_machine_images_operation_group_list_skus(self, resource_group): + response = self.client.virtual_machine_images_operation_group.list_skus( location="str", publisher_name="str", offer="str", - api_version="2025-04-01", ) # please add some check logic here by yourself @@ -68,13 +64,12 @@ def test_virtual_machine_images_list_skus(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_virtual_machine_images_list(self, resource_group): - response = self.client.virtual_machine_images.list( + def test_virtual_machine_images_operation_group_list(self, resource_group): + response = self.client.virtual_machine_images_operation_group.list( location="str", publisher_name="str", offer="str", skus="str", - api_version="2025-04-01", ) # please add some check logic here by yourself @@ -82,14 +77,13 @@ def test_virtual_machine_images_list(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_virtual_machine_images_get(self, resource_group): - response = self.client.virtual_machine_images.get( + def test_virtual_machine_images_operation_group_list_with_properties(self, resource_group): + response = self.client.virtual_machine_images_operation_group.list_with_properties( location="str", publisher_name="str", offer="str", skus="str", - version="str", - api_version="2025-04-01", + expand="str", ) # please add some check logic here by yourself @@ -97,14 +91,13 @@ def test_virtual_machine_images_get(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_virtual_machine_images_list_with_properties(self, resource_group): - response = self.client.virtual_machine_images.list_with_properties( + def test_virtual_machine_images_operation_group_get(self, resource_group): + response = self.client.virtual_machine_images_operation_group.get( location="str", publisher_name="str", offer="str", skus="str", - expand="str", - api_version="2025-04-01", + version="str", ) # please add some check logic here by yourself diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_virtual_machine_images_operations_async.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machine_images_operation_group_operations_async.py similarity index 61% rename from sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_virtual_machine_images_operations_async.py rename to sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machine_images_operation_group_operations_async.py index 50c3065b0e4b..1e33d773dffd 100644 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_virtual_machine_images_operations_async.py +++ b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machine_images_operation_group_operations_async.py @@ -2,11 +2,11 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.compute.aio import ComputeManagementClient +from azure.mgmt.compute.aio import ComputeClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer from devtools_testutils.aio import recorded_by_proxy_async @@ -15,17 +15,16 @@ @pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestComputeManagementVirtualMachineImagesOperationsAsync(AzureMgmtRecordedTestCase): +class TestComputeVirtualMachineImagesOperationGroupOperationsAsync(AzureMgmtRecordedTestCase): def setup_method(self, method): - self.client = self.create_mgmt_client(ComputeManagementClient, is_async=True) + self.client = self.create_mgmt_client(ComputeClient, is_async=True) @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_virtual_machine_images_list_by_edge_zone(self, resource_group): - response = await self.client.virtual_machine_images.list_by_edge_zone( + async def test_virtual_machine_images_operation_group_list_by_edge_zone(self, resource_group): + response = await self.client.virtual_machine_images_operation_group.list_by_edge_zone( location="str", edge_zone="str", - api_version="2025-04-01", ) # please add some check logic here by yourself @@ -33,10 +32,9 @@ async def test_virtual_machine_images_list_by_edge_zone(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_virtual_machine_images_list_publishers(self, resource_group): - response = await self.client.virtual_machine_images.list_publishers( + async def test_virtual_machine_images_operation_group_list_publishers(self, resource_group): + response = await self.client.virtual_machine_images_operation_group.list_publishers( location="str", - api_version="2025-04-01", ) # please add some check logic here by yourself @@ -44,11 +42,10 @@ async def test_virtual_machine_images_list_publishers(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_virtual_machine_images_list_offers(self, resource_group): - response = await self.client.virtual_machine_images.list_offers( + async def test_virtual_machine_images_operation_group_list_offers(self, resource_group): + response = await self.client.virtual_machine_images_operation_group.list_offers( location="str", publisher_name="str", - api_version="2025-04-01", ) # please add some check logic here by yourself @@ -56,12 +53,11 @@ async def test_virtual_machine_images_list_offers(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_virtual_machine_images_list_skus(self, resource_group): - response = await self.client.virtual_machine_images.list_skus( + async def test_virtual_machine_images_operation_group_list_skus(self, resource_group): + response = await self.client.virtual_machine_images_operation_group.list_skus( location="str", publisher_name="str", offer="str", - api_version="2025-04-01", ) # please add some check logic here by yourself @@ -69,13 +65,12 @@ async def test_virtual_machine_images_list_skus(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_virtual_machine_images_list(self, resource_group): - response = await self.client.virtual_machine_images.list( + async def test_virtual_machine_images_operation_group_list(self, resource_group): + response = await self.client.virtual_machine_images_operation_group.list( location="str", publisher_name="str", offer="str", skus="str", - api_version="2025-04-01", ) # please add some check logic here by yourself @@ -83,14 +78,13 @@ async def test_virtual_machine_images_list(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_virtual_machine_images_get(self, resource_group): - response = await self.client.virtual_machine_images.get( + async def test_virtual_machine_images_operation_group_list_with_properties(self, resource_group): + response = await self.client.virtual_machine_images_operation_group.list_with_properties( location="str", publisher_name="str", offer="str", skus="str", - version="str", - api_version="2025-04-01", + expand="str", ) # please add some check logic here by yourself @@ -98,14 +92,13 @@ async def test_virtual_machine_images_get(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_virtual_machine_images_list_with_properties(self, resource_group): - response = await self.client.virtual_machine_images.list_with_properties( + async def test_virtual_machine_images_operation_group_get(self, resource_group): + response = await self.client.virtual_machine_images_operation_group.get( location="str", publisher_name="str", offer="str", skus="str", - expand="str", - api_version="2025-04-01", + version="str", ) # please add some check logic here by yourself diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machine_run_commands_operation_group_operations.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machine_run_commands_operation_group_operations.py new file mode 100644 index 000000000000..36103ad0e459 --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machine_run_commands_operation_group_operations.py @@ -0,0 +1,40 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.compute import ComputeClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestComputeVirtualMachineRunCommandsOperationGroupOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ComputeClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_virtual_machine_run_commands_operation_group_list(self, resource_group): + response = self.client.virtual_machine_run_commands_operation_group.list( + location="str", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_virtual_machine_run_commands_operation_group_get(self, resource_group): + response = self.client.virtual_machine_run_commands_operation_group.get( + location="str", + command_id="str", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machine_run_commands_operation_group_operations_async.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machine_run_commands_operation_group_operations_async.py new file mode 100644 index 000000000000..e6eb328daa3d --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machine_run_commands_operation_group_operations_async.py @@ -0,0 +1,41 @@ +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.compute.aio import ComputeClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestComputeVirtualMachineRunCommandsOperationGroupOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ComputeClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_virtual_machine_run_commands_operation_group_list(self, resource_group): + response = self.client.virtual_machine_run_commands_operation_group.list( + location="str", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_virtual_machine_run_commands_operation_group_get(self, resource_group): + response = await self.client.virtual_machine_run_commands_operation_group.get( + location="str", + command_id="str", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_virtual_machine_run_commands_operations_async.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machine_run_commands_operations.py similarity index 61% rename from sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_virtual_machine_run_commands_operations_async.py rename to sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machine_run_commands_operations.py index 393fbbea1d9d..edb043f7356d 100644 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_virtual_machine_run_commands_operations_async.py +++ b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machine_run_commands_operations.py @@ -2,85 +2,49 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.compute.aio import ComputeManagementClient +from azure.mgmt.compute import ComputeClient -from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer -from devtools_testutils.aio import recorded_by_proxy_async +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy AZURE_LOCATION = "eastus" @pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestComputeManagementVirtualMachineRunCommandsOperationsAsync(AzureMgmtRecordedTestCase): +class TestComputeVirtualMachineRunCommandsOperations(AzureMgmtRecordedTestCase): def setup_method(self, method): - self.client = self.create_mgmt_client(ComputeManagementClient, is_async=True) + self.client = self.create_mgmt_client(ComputeClient) @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_virtual_machine_run_commands_list(self, resource_group): - response = self.client.virtual_machine_run_commands.list( - location="str", - api_version="2025-04-01", - ) - result = [r async for r in response] - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_virtual_machine_run_commands_get(self, resource_group): - response = await self.client.virtual_machine_run_commands.get( - location="str", - command_id="str", - api_version="2025-04-01", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_virtual_machine_run_commands_list_by_virtual_machine(self, resource_group): - response = self.client.virtual_machine_run_commands.list_by_virtual_machine( + @recorded_by_proxy + def test_virtual_machine_run_commands_get_by_virtual_machine(self, resource_group): + response = self.client.virtual_machine_run_commands.get_by_virtual_machine( resource_group_name=resource_group.name, vm_name="str", - api_version="2025-04-01", + run_command_name="str", ) - result = [r async for r in response] + # please add some check logic here by yourself # ... @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_virtual_machine_run_commands_get_by_virtual_machine(self, resource_group): - response = await self.client.virtual_machine_run_commands.get_by_virtual_machine( + @recorded_by_proxy + def test_virtual_machine_run_commands_begin_create_or_update(self, resource_group): + response = self.client.virtual_machine_run_commands.begin_create_or_update( resource_group_name=resource_group.name, vm_name="str", run_command_name="str", - api_version="2025-04-01", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_virtual_machine_run_commands_begin_create_or_update(self, resource_group): - response = await ( - await self.client.virtual_machine_run_commands.begin_create_or_update( - resource_group_name=resource_group.name, - vm_name="str", - run_command_name="str", - run_command={ - "location": "str", + body={ + "location": "str", + "id": "str", + "name": "str", + "properties": { "asyncExecution": bool, "errorBlobManagedIdentity": {"clientId": "str", "objectId": "str"}, "errorBlobUri": "str", - "id": "str", "instanceView": { "endTime": "2020-02-20 00:00:00", "error": "str", @@ -99,7 +63,6 @@ async def test_virtual_machine_run_commands_begin_create_or_update(self, resourc } ], }, - "name": "str", "outputBlobManagedIdentity": {"clientId": "str", "objectId": "str"}, "outputBlobUri": "str", "parameters": [{"name": "str", "value": "str"}], @@ -115,35 +78,34 @@ async def test_virtual_machine_run_commands_begin_create_or_update(self, resourc "scriptUri": "str", "scriptUriManagedIdentity": {"clientId": "str", "objectId": "str"}, }, - "systemData": { - "createdAt": "2020-02-20 00:00:00", - "createdBy": "str", - "createdByType": "str", - "lastModifiedAt": "2020-02-20 00:00:00", - "lastModifiedBy": "str", - "lastModifiedByType": "str", - }, - "tags": {"str": "str"}, "timeoutInSeconds": 0, "treatFailureAsDeploymentFailure": bool, - "type": "str", }, - api_version="2025-04-01", - ) + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "tags": {"str": "str"}, + "type": "str", + }, ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself # ... @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_virtual_machine_run_commands_begin_update(self, resource_group): - response = await ( - await self.client.virtual_machine_run_commands.begin_update( - resource_group_name=resource_group.name, - vm_name="str", - run_command_name="str", - run_command={ + @recorded_by_proxy + def test_virtual_machine_run_commands_begin_update(self, resource_group): + response = self.client.virtual_machine_run_commands.begin_update( + resource_group_name=resource_group.name, + vm_name="str", + run_command_name="str", + body={ + "properties": { "asyncExecution": bool, "errorBlobManagedIdentity": {"clientId": "str", "objectId": "str"}, "errorBlobUri": "str", @@ -180,28 +142,35 @@ async def test_virtual_machine_run_commands_begin_update(self, resource_group): "scriptUri": "str", "scriptUriManagedIdentity": {"clientId": "str", "objectId": "str"}, }, - "tags": {"str": "str"}, "timeoutInSeconds": 0, "treatFailureAsDeploymentFailure": bool, }, - api_version="2025-04-01", - ) + "tags": {"str": "str"}, + }, ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself # ... @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_virtual_machine_run_commands_begin_delete(self, resource_group): - response = await ( - await self.client.virtual_machine_run_commands.begin_delete( - resource_group_name=resource_group.name, - vm_name="str", - run_command_name="str", - api_version="2025-04-01", - ) + @recorded_by_proxy + def test_virtual_machine_run_commands_begin_delete(self, resource_group): + response = self.client.virtual_machine_run_commands.begin_delete( + resource_group_name=resource_group.name, + vm_name="str", + run_command_name="str", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_virtual_machine_run_commands_list_by_virtual_machine(self, resource_group): + response = self.client.virtual_machine_run_commands.list_by_virtual_machine( + resource_group_name=resource_group.name, + vm_name="str", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machine_run_commands_operations_async.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machine_run_commands_operations_async.py new file mode 100644 index 000000000000..1e79ef9db4c8 --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machine_run_commands_operations_async.py @@ -0,0 +1,183 @@ +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.compute.aio import ComputeClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestComputeVirtualMachineRunCommandsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ComputeClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_virtual_machine_run_commands_get_by_virtual_machine(self, resource_group): + response = await self.client.virtual_machine_run_commands.get_by_virtual_machine( + resource_group_name=resource_group.name, + vm_name="str", + run_command_name="str", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_virtual_machine_run_commands_begin_create_or_update(self, resource_group): + response = await ( + await self.client.virtual_machine_run_commands.begin_create_or_update( + resource_group_name=resource_group.name, + vm_name="str", + run_command_name="str", + body={ + "location": "str", + "id": "str", + "name": "str", + "properties": { + "asyncExecution": bool, + "errorBlobManagedIdentity": {"clientId": "str", "objectId": "str"}, + "errorBlobUri": "str", + "instanceView": { + "endTime": "2020-02-20 00:00:00", + "error": "str", + "executionMessage": "str", + "executionState": "str", + "exitCode": 0, + "output": "str", + "startTime": "2020-02-20 00:00:00", + "statuses": [ + { + "code": "str", + "displayStatus": "str", + "level": "str", + "message": "str", + "time": "2020-02-20 00:00:00", + } + ], + }, + "outputBlobManagedIdentity": {"clientId": "str", "objectId": "str"}, + "outputBlobUri": "str", + "parameters": [{"name": "str", "value": "str"}], + "protectedParameters": [{"name": "str", "value": "str"}], + "provisioningState": "str", + "runAsPassword": "str", + "runAsUser": "str", + "source": { + "commandId": "str", + "galleryScriptReferenceId": "str", + "script": "str", + "scriptShell": "str", + "scriptUri": "str", + "scriptUriManagedIdentity": {"clientId": "str", "objectId": "str"}, + }, + "timeoutInSeconds": 0, + "treatFailureAsDeploymentFailure": bool, + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "tags": {"str": "str"}, + "type": "str", + }, + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_virtual_machine_run_commands_begin_update(self, resource_group): + response = await ( + await self.client.virtual_machine_run_commands.begin_update( + resource_group_name=resource_group.name, + vm_name="str", + run_command_name="str", + body={ + "properties": { + "asyncExecution": bool, + "errorBlobManagedIdentity": {"clientId": "str", "objectId": "str"}, + "errorBlobUri": "str", + "instanceView": { + "endTime": "2020-02-20 00:00:00", + "error": "str", + "executionMessage": "str", + "executionState": "str", + "exitCode": 0, + "output": "str", + "startTime": "2020-02-20 00:00:00", + "statuses": [ + { + "code": "str", + "displayStatus": "str", + "level": "str", + "message": "str", + "time": "2020-02-20 00:00:00", + } + ], + }, + "outputBlobManagedIdentity": {"clientId": "str", "objectId": "str"}, + "outputBlobUri": "str", + "parameters": [{"name": "str", "value": "str"}], + "protectedParameters": [{"name": "str", "value": "str"}], + "provisioningState": "str", + "runAsPassword": "str", + "runAsUser": "str", + "source": { + "commandId": "str", + "galleryScriptReferenceId": "str", + "script": "str", + "scriptShell": "str", + "scriptUri": "str", + "scriptUriManagedIdentity": {"clientId": "str", "objectId": "str"}, + }, + "timeoutInSeconds": 0, + "treatFailureAsDeploymentFailure": bool, + }, + "tags": {"str": "str"}, + }, + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_virtual_machine_run_commands_begin_delete(self, resource_group): + response = await ( + await self.client.virtual_machine_run_commands.begin_delete( + resource_group_name=resource_group.name, + vm_name="str", + run_command_name="str", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_virtual_machine_run_commands_list_by_virtual_machine(self, resource_group): + response = self.client.virtual_machine_run_commands.list_by_virtual_machine( + resource_group_name=resource_group.name, + vm_name="str", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_virtual_machine_scale_set_extensions_operations.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machine_scale_set_extensions_operations.py similarity index 67% rename from sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_virtual_machine_scale_set_extensions_operations.py rename to sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machine_scale_set_extensions_operations.py index 20652e57f88a..ddb85a53d40b 100644 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_virtual_machine_scale_set_extensions_operations.py +++ b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machine_scale_set_extensions_operations.py @@ -2,11 +2,11 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.compute import ComputeManagementClient +from azure.mgmt.compute import ComputeClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy @@ -14,21 +14,9 @@ @pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestComputeManagementVirtualMachineScaleSetExtensionsOperations(AzureMgmtRecordedTestCase): +class TestComputeVirtualMachineScaleSetExtensionsOperations(AzureMgmtRecordedTestCase): def setup_method(self, method): - self.client = self.create_mgmt_client(ComputeManagementClient) - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_virtual_machine_scale_set_extensions_list(self, resource_group): - response = self.client.virtual_machine_scale_set_extensions.list( - resource_group_name=resource_group.name, - vm_scale_set_name="str", - api_version="2025-04-01", - ) - result = [r for r in response] - # please add some check logic here by yourself - # ... + self.client = self.create_mgmt_client(ComputeClient) @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy @@ -37,7 +25,6 @@ def test_virtual_machine_scale_set_extensions_get(self, resource_group): resource_group_name=resource_group.name, vm_scale_set_name="str", vmss_extension_name="str", - api_version="2025-04-01", ) # please add some check logic here by yourself @@ -50,23 +37,25 @@ def test_virtual_machine_scale_set_extensions_begin_create_or_update(self, resou resource_group_name=resource_group.name, vm_scale_set_name="str", vmss_extension_name="str", - extension_parameters={ - "autoUpgradeMinorVersion": bool, - "enableAutomaticUpgrade": bool, - "forceUpdateTag": "str", + resource={ "id": "str", "name": "str", - "protectedSettings": {}, - "protectedSettingsFromKeyVault": {"secretUrl": "str", "sourceVault": {"id": "str"}}, - "provisionAfterExtensions": ["str"], - "provisioningState": "str", - "publisher": "str", - "settings": {}, - "suppressFailures": bool, + "properties": { + "autoUpgradeMinorVersion": bool, + "enableAutomaticUpgrade": bool, + "forceUpdateTag": "str", + "protectedSettings": {}, + "protectedSettingsFromKeyVault": {"secretUrl": "str", "sourceVault": {"id": "str"}}, + "provisionAfterExtensions": ["str"], + "provisioningState": "str", + "publisher": "str", + "settings": {}, + "suppressFailures": bool, + "type": "str", + "typeHandlerVersion": "str", + }, "type": "str", - "typeHandlerVersion": "str", }, - api_version="2025-04-01", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -79,23 +68,25 @@ def test_virtual_machine_scale_set_extensions_begin_update(self, resource_group) resource_group_name=resource_group.name, vm_scale_set_name="str", vmss_extension_name="str", - extension_parameters={ - "autoUpgradeMinorVersion": bool, - "enableAutomaticUpgrade": bool, - "forceUpdateTag": "str", + properties={ "id": "str", "name": "str", - "protectedSettings": {}, - "protectedSettingsFromKeyVault": {"secretUrl": "str", "sourceVault": {"id": "str"}}, - "provisionAfterExtensions": ["str"], - "provisioningState": "str", - "publisher": "str", - "settings": {}, - "suppressFailures": bool, + "properties": { + "autoUpgradeMinorVersion": bool, + "enableAutomaticUpgrade": bool, + "forceUpdateTag": "str", + "protectedSettings": {}, + "protectedSettingsFromKeyVault": {"secretUrl": "str", "sourceVault": {"id": "str"}}, + "provisionAfterExtensions": ["str"], + "provisioningState": "str", + "publisher": "str", + "settings": {}, + "suppressFailures": bool, + "type": "str", + "typeHandlerVersion": "str", + }, "type": "str", - "typeHandlerVersion": "str", }, - api_version="2025-04-01", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -108,8 +99,18 @@ def test_virtual_machine_scale_set_extensions_begin_delete(self, resource_group) resource_group_name=resource_group.name, vm_scale_set_name="str", vmss_extension_name="str", - api_version="2025-04-01", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_virtual_machine_scale_set_extensions_list(self, resource_group): + response = self.client.virtual_machine_scale_set_extensions.list( + resource_group_name=resource_group.name, + vm_scale_set_name="str", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_virtual_machine_scale_set_extensions_operations_async.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machine_scale_set_extensions_operations_async.py similarity index 67% rename from sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_virtual_machine_scale_set_extensions_operations_async.py rename to sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machine_scale_set_extensions_operations_async.py index 2deeee38dd48..fe1be863374f 100644 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_virtual_machine_scale_set_extensions_operations_async.py +++ b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machine_scale_set_extensions_operations_async.py @@ -2,11 +2,11 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.compute.aio import ComputeManagementClient +from azure.mgmt.compute.aio import ComputeClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer from devtools_testutils.aio import recorded_by_proxy_async @@ -15,21 +15,9 @@ @pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestComputeManagementVirtualMachineScaleSetExtensionsOperationsAsync(AzureMgmtRecordedTestCase): +class TestComputeVirtualMachineScaleSetExtensionsOperationsAsync(AzureMgmtRecordedTestCase): def setup_method(self, method): - self.client = self.create_mgmt_client(ComputeManagementClient, is_async=True) - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_virtual_machine_scale_set_extensions_list(self, resource_group): - response = self.client.virtual_machine_scale_set_extensions.list( - resource_group_name=resource_group.name, - vm_scale_set_name="str", - api_version="2025-04-01", - ) - result = [r async for r in response] - # please add some check logic here by yourself - # ... + self.client = self.create_mgmt_client(ComputeClient, is_async=True) @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async @@ -38,7 +26,6 @@ async def test_virtual_machine_scale_set_extensions_get(self, resource_group): resource_group_name=resource_group.name, vm_scale_set_name="str", vmss_extension_name="str", - api_version="2025-04-01", ) # please add some check logic here by yourself @@ -52,23 +39,25 @@ async def test_virtual_machine_scale_set_extensions_begin_create_or_update(self, resource_group_name=resource_group.name, vm_scale_set_name="str", vmss_extension_name="str", - extension_parameters={ - "autoUpgradeMinorVersion": bool, - "enableAutomaticUpgrade": bool, - "forceUpdateTag": "str", + resource={ "id": "str", "name": "str", - "protectedSettings": {}, - "protectedSettingsFromKeyVault": {"secretUrl": "str", "sourceVault": {"id": "str"}}, - "provisionAfterExtensions": ["str"], - "provisioningState": "str", - "publisher": "str", - "settings": {}, - "suppressFailures": bool, + "properties": { + "autoUpgradeMinorVersion": bool, + "enableAutomaticUpgrade": bool, + "forceUpdateTag": "str", + "protectedSettings": {}, + "protectedSettingsFromKeyVault": {"secretUrl": "str", "sourceVault": {"id": "str"}}, + "provisionAfterExtensions": ["str"], + "provisioningState": "str", + "publisher": "str", + "settings": {}, + "suppressFailures": bool, + "type": "str", + "typeHandlerVersion": "str", + }, "type": "str", - "typeHandlerVersion": "str", }, - api_version="2025-04-01", ) ).result() # call '.result()' to poll until service return final result @@ -83,23 +72,25 @@ async def test_virtual_machine_scale_set_extensions_begin_update(self, resource_ resource_group_name=resource_group.name, vm_scale_set_name="str", vmss_extension_name="str", - extension_parameters={ - "autoUpgradeMinorVersion": bool, - "enableAutomaticUpgrade": bool, - "forceUpdateTag": "str", + properties={ "id": "str", "name": "str", - "protectedSettings": {}, - "protectedSettingsFromKeyVault": {"secretUrl": "str", "sourceVault": {"id": "str"}}, - "provisionAfterExtensions": ["str"], - "provisioningState": "str", - "publisher": "str", - "settings": {}, - "suppressFailures": bool, + "properties": { + "autoUpgradeMinorVersion": bool, + "enableAutomaticUpgrade": bool, + "forceUpdateTag": "str", + "protectedSettings": {}, + "protectedSettingsFromKeyVault": {"secretUrl": "str", "sourceVault": {"id": "str"}}, + "provisionAfterExtensions": ["str"], + "provisioningState": "str", + "publisher": "str", + "settings": {}, + "suppressFailures": bool, + "type": "str", + "typeHandlerVersion": "str", + }, "type": "str", - "typeHandlerVersion": "str", }, - api_version="2025-04-01", ) ).result() # call '.result()' to poll until service return final result @@ -114,9 +105,19 @@ async def test_virtual_machine_scale_set_extensions_begin_delete(self, resource_ resource_group_name=resource_group.name, vm_scale_set_name="str", vmss_extension_name="str", - api_version="2025-04-01", ) ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_virtual_machine_scale_set_extensions_list(self, resource_group): + response = self.client.virtual_machine_scale_set_extensions.list( + resource_group_name=resource_group.name, + vm_scale_set_name="str", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_virtual_machine_scale_set_vm_extensions_operations_async.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machine_scale_set_vm_extensions_operations.py similarity index 61% rename from sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_virtual_machine_scale_set_vm_extensions_operations_async.py rename to sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machine_scale_set_vm_extensions_operations.py index 4faff9681292..a29712b498c1 100644 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_virtual_machine_scale_set_vm_extensions_operations_async.py +++ b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machine_scale_set_vm_extensions_operations.py @@ -2,64 +2,51 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.compute.aio import ComputeManagementClient +from azure.mgmt.compute import ComputeClient -from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer -from devtools_testutils.aio import recorded_by_proxy_async +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy AZURE_LOCATION = "eastus" @pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestComputeManagementVirtualMachineScaleSetVMExtensionsOperationsAsync(AzureMgmtRecordedTestCase): +class TestComputeVirtualMachineScaleSetVMExtensionsOperations(AzureMgmtRecordedTestCase): def setup_method(self, method): - self.client = self.create_mgmt_client(ComputeManagementClient, is_async=True) + self.client = self.create_mgmt_client(ComputeClient) @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_virtual_machine_scale_set_vm_extensions_list(self, resource_group): - response = await self.client.virtual_machine_scale_set_vm_extensions.list( + @recorded_by_proxy + def test_virtual_machine_scale_set_vm_extensions_get(self, resource_group): + response = self.client.virtual_machine_scale_set_vm_extensions.get( resource_group_name=resource_group.name, vm_scale_set_name="str", instance_id="str", - api_version="2025-04-01", + vm_extension_name="str", ) # please add some check logic here by yourself # ... @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_virtual_machine_scale_set_vm_extensions_get(self, resource_group): - response = await self.client.virtual_machine_scale_set_vm_extensions.get( + @recorded_by_proxy + def test_virtual_machine_scale_set_vm_extensions_begin_create_or_update(self, resource_group): + response = self.client.virtual_machine_scale_set_vm_extensions.begin_create_or_update( resource_group_name=resource_group.name, vm_scale_set_name="str", instance_id="str", vm_extension_name="str", - api_version="2025-04-01", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_virtual_machine_scale_set_vm_extensions_begin_create_or_update(self, resource_group): - response = await ( - await self.client.virtual_machine_scale_set_vm_extensions.begin_create_or_update( - resource_group_name=resource_group.name, - vm_scale_set_name="str", - instance_id="str", - vm_extension_name="str", - extension_parameters={ + resource={ + "id": "str", + "location": "str", + "name": "str", + "properties": { "autoUpgradeMinorVersion": bool, "enableAutomaticUpgrade": bool, "forceUpdateTag": "str", - "id": "str", "instanceView": { "name": "str", "statuses": [ @@ -83,8 +70,6 @@ async def test_virtual_machine_scale_set_vm_extensions_begin_create_or_update(se "type": "str", "typeHandlerVersion": "str", }, - "location": "str", - "name": "str", "protectedSettings": {}, "protectedSettingsFromKeyVault": {"secretUrl": "str", "sourceVault": {"id": "str"}}, "provisionAfterExtensions": ["str"], @@ -95,28 +80,28 @@ async def test_virtual_machine_scale_set_vm_extensions_begin_create_or_update(se "type": "str", "typeHandlerVersion": "str", }, - api_version="2025-04-01", - ) + "type": "str", + }, ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself # ... @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_virtual_machine_scale_set_vm_extensions_begin_update(self, resource_group): - response = await ( - await self.client.virtual_machine_scale_set_vm_extensions.begin_update( - resource_group_name=resource_group.name, - vm_scale_set_name="str", - instance_id="str", - vm_extension_name="str", - extension_parameters={ + @recorded_by_proxy + def test_virtual_machine_scale_set_vm_extensions_begin_update(self, resource_group): + response = self.client.virtual_machine_scale_set_vm_extensions.begin_update( + resource_group_name=resource_group.name, + vm_scale_set_name="str", + instance_id="str", + vm_extension_name="str", + properties={ + "id": "str", + "name": "str", + "properties": { "autoUpgradeMinorVersion": bool, "enableAutomaticUpgrade": bool, "forceUpdateTag": "str", - "id": "str", - "name": "str", "protectedSettings": {}, "protectedSettingsFromKeyVault": {"secretUrl": "str", "sourceVault": {"id": "str"}}, "publisher": "str", @@ -125,25 +110,34 @@ async def test_virtual_machine_scale_set_vm_extensions_begin_update(self, resour "type": "str", "typeHandlerVersion": "str", }, - api_version="2025-04-01", - ) + "type": "str", + }, ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself # ... @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_virtual_machine_scale_set_vm_extensions_begin_delete(self, resource_group): - response = await ( - await self.client.virtual_machine_scale_set_vm_extensions.begin_delete( - resource_group_name=resource_group.name, - vm_scale_set_name="str", - instance_id="str", - vm_extension_name="str", - api_version="2025-04-01", - ) + @recorded_by_proxy + def test_virtual_machine_scale_set_vm_extensions_begin_delete(self, resource_group): + response = self.client.virtual_machine_scale_set_vm_extensions.begin_delete( + resource_group_name=resource_group.name, + vm_scale_set_name="str", + instance_id="str", + vm_extension_name="str", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_virtual_machine_scale_set_vm_extensions_list(self, resource_group): + response = self.client.virtual_machine_scale_set_vm_extensions.list( + resource_group_name=resource_group.name, + vm_scale_set_name="str", + instance_id="str", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machine_scale_set_vm_extensions_operations_async.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machine_scale_set_vm_extensions_operations_async.py new file mode 100644 index 000000000000..d54c11e93736 --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machine_scale_set_vm_extensions_operations_async.py @@ -0,0 +1,150 @@ +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.compute.aio import ComputeClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestComputeVirtualMachineScaleSetVMExtensionsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ComputeClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_virtual_machine_scale_set_vm_extensions_get(self, resource_group): + response = await self.client.virtual_machine_scale_set_vm_extensions.get( + resource_group_name=resource_group.name, + vm_scale_set_name="str", + instance_id="str", + vm_extension_name="str", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_virtual_machine_scale_set_vm_extensions_begin_create_or_update(self, resource_group): + response = await ( + await self.client.virtual_machine_scale_set_vm_extensions.begin_create_or_update( + resource_group_name=resource_group.name, + vm_scale_set_name="str", + instance_id="str", + vm_extension_name="str", + resource={ + "id": "str", + "location": "str", + "name": "str", + "properties": { + "autoUpgradeMinorVersion": bool, + "enableAutomaticUpgrade": bool, + "forceUpdateTag": "str", + "instanceView": { + "name": "str", + "statuses": [ + { + "code": "str", + "displayStatus": "str", + "level": "str", + "message": "str", + "time": "2020-02-20 00:00:00", + } + ], + "substatuses": [ + { + "code": "str", + "displayStatus": "str", + "level": "str", + "message": "str", + "time": "2020-02-20 00:00:00", + } + ], + "type": "str", + "typeHandlerVersion": "str", + }, + "protectedSettings": {}, + "protectedSettingsFromKeyVault": {"secretUrl": "str", "sourceVault": {"id": "str"}}, + "provisionAfterExtensions": ["str"], + "provisioningState": "str", + "publisher": "str", + "settings": {}, + "suppressFailures": bool, + "type": "str", + "typeHandlerVersion": "str", + }, + "type": "str", + }, + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_virtual_machine_scale_set_vm_extensions_begin_update(self, resource_group): + response = await ( + await self.client.virtual_machine_scale_set_vm_extensions.begin_update( + resource_group_name=resource_group.name, + vm_scale_set_name="str", + instance_id="str", + vm_extension_name="str", + properties={ + "id": "str", + "name": "str", + "properties": { + "autoUpgradeMinorVersion": bool, + "enableAutomaticUpgrade": bool, + "forceUpdateTag": "str", + "protectedSettings": {}, + "protectedSettingsFromKeyVault": {"secretUrl": "str", "sourceVault": {"id": "str"}}, + "publisher": "str", + "settings": {}, + "suppressFailures": bool, + "type": "str", + "typeHandlerVersion": "str", + }, + "type": "str", + }, + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_virtual_machine_scale_set_vm_extensions_begin_delete(self, resource_group): + response = await ( + await self.client.virtual_machine_scale_set_vm_extensions.begin_delete( + resource_group_name=resource_group.name, + vm_scale_set_name="str", + instance_id="str", + vm_extension_name="str", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_virtual_machine_scale_set_vm_extensions_list(self, resource_group): + response = self.client.virtual_machine_scale_set_vm_extensions.list( + resource_group_name=resource_group.name, + vm_scale_set_name="str", + instance_id="str", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_virtual_machine_scale_set_vm_run_commands_operations_async.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machine_scale_set_vm_run_commands_operations.py similarity index 65% rename from sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_virtual_machine_scale_set_vm_run_commands_operations_async.py rename to sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machine_scale_set_vm_run_commands_operations.py index c56c365f2a7a..26638a4bc711 100644 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_virtual_machine_scale_set_vm_run_commands_operations_async.py +++ b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machine_scale_set_vm_run_commands_operations.py @@ -2,65 +2,51 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.compute.aio import ComputeManagementClient +from azure.mgmt.compute import ComputeClient -from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer -from devtools_testutils.aio import recorded_by_proxy_async +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy AZURE_LOCATION = "eastus" @pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestComputeManagementVirtualMachineScaleSetVMRunCommandsOperationsAsync(AzureMgmtRecordedTestCase): +class TestComputeVirtualMachineScaleSetVMRunCommandsOperations(AzureMgmtRecordedTestCase): def setup_method(self, method): - self.client = self.create_mgmt_client(ComputeManagementClient, is_async=True) + self.client = self.create_mgmt_client(ComputeClient) @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_virtual_machine_scale_set_vm_run_commands_list(self, resource_group): - response = self.client.virtual_machine_scale_set_vm_run_commands.list( + @recorded_by_proxy + def test_virtual_machine_scale_set_vm_run_commands_get(self, resource_group): + response = self.client.virtual_machine_scale_set_vm_run_commands.get( resource_group_name=resource_group.name, vm_scale_set_name="str", instance_id="str", - api_version="2025-04-01", + run_command_name="str", ) - result = [r async for r in response] + # please add some check logic here by yourself # ... @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_virtual_machine_scale_set_vm_run_commands_get(self, resource_group): - response = await self.client.virtual_machine_scale_set_vm_run_commands.get( + @recorded_by_proxy + def test_virtual_machine_scale_set_vm_run_commands_begin_create_or_update(self, resource_group): + response = self.client.virtual_machine_scale_set_vm_run_commands.begin_create_or_update( resource_group_name=resource_group.name, vm_scale_set_name="str", instance_id="str", run_command_name="str", - api_version="2025-04-01", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_virtual_machine_scale_set_vm_run_commands_begin_create_or_update(self, resource_group): - response = await ( - await self.client.virtual_machine_scale_set_vm_run_commands.begin_create_or_update( - resource_group_name=resource_group.name, - vm_scale_set_name="str", - instance_id="str", - run_command_name="str", - run_command={ - "location": "str", + body={ + "location": "str", + "id": "str", + "name": "str", + "properties": { "asyncExecution": bool, "errorBlobManagedIdentity": {"clientId": "str", "objectId": "str"}, "errorBlobUri": "str", - "id": "str", "instanceView": { "endTime": "2020-02-20 00:00:00", "error": "str", @@ -79,7 +65,6 @@ async def test_virtual_machine_scale_set_vm_run_commands_begin_create_or_update( } ], }, - "name": "str", "outputBlobManagedIdentity": {"clientId": "str", "objectId": "str"}, "outputBlobUri": "str", "parameters": [{"name": "str", "value": "str"}], @@ -95,36 +80,35 @@ async def test_virtual_machine_scale_set_vm_run_commands_begin_create_or_update( "scriptUri": "str", "scriptUriManagedIdentity": {"clientId": "str", "objectId": "str"}, }, - "systemData": { - "createdAt": "2020-02-20 00:00:00", - "createdBy": "str", - "createdByType": "str", - "lastModifiedAt": "2020-02-20 00:00:00", - "lastModifiedBy": "str", - "lastModifiedByType": "str", - }, - "tags": {"str": "str"}, "timeoutInSeconds": 0, "treatFailureAsDeploymentFailure": bool, - "type": "str", }, - api_version="2025-04-01", - ) + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "tags": {"str": "str"}, + "type": "str", + }, ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself # ... @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_virtual_machine_scale_set_vm_run_commands_begin_update(self, resource_group): - response = await ( - await self.client.virtual_machine_scale_set_vm_run_commands.begin_update( - resource_group_name=resource_group.name, - vm_scale_set_name="str", - instance_id="str", - run_command_name="str", - run_command={ + @recorded_by_proxy + def test_virtual_machine_scale_set_vm_run_commands_begin_update(self, resource_group): + response = self.client.virtual_machine_scale_set_vm_run_commands.begin_update( + resource_group_name=resource_group.name, + vm_scale_set_name="str", + instance_id="str", + run_command_name="str", + body={ + "properties": { "asyncExecution": bool, "errorBlobManagedIdentity": {"clientId": "str", "objectId": "str"}, "errorBlobUri": "str", @@ -161,29 +145,37 @@ async def test_virtual_machine_scale_set_vm_run_commands_begin_update(self, reso "scriptUri": "str", "scriptUriManagedIdentity": {"clientId": "str", "objectId": "str"}, }, - "tags": {"str": "str"}, "timeoutInSeconds": 0, "treatFailureAsDeploymentFailure": bool, }, - api_version="2025-04-01", - ) + "tags": {"str": "str"}, + }, ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself # ... @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_virtual_machine_scale_set_vm_run_commands_begin_delete(self, resource_group): - response = await ( - await self.client.virtual_machine_scale_set_vm_run_commands.begin_delete( - resource_group_name=resource_group.name, - vm_scale_set_name="str", - instance_id="str", - run_command_name="str", - api_version="2025-04-01", - ) + @recorded_by_proxy + def test_virtual_machine_scale_set_vm_run_commands_begin_delete(self, resource_group): + response = self.client.virtual_machine_scale_set_vm_run_commands.begin_delete( + resource_group_name=resource_group.name, + vm_scale_set_name="str", + instance_id="str", + run_command_name="str", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_virtual_machine_scale_set_vm_run_commands_list(self, resource_group): + response = self.client.virtual_machine_scale_set_vm_run_commands.list( + resource_group_name=resource_group.name, + vm_scale_set_name="str", + instance_id="str", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machine_scale_set_vm_run_commands_operations_async.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machine_scale_set_vm_run_commands_operations_async.py new file mode 100644 index 000000000000..37655fa7a6b1 --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machine_scale_set_vm_run_commands_operations_async.py @@ -0,0 +1,188 @@ +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.compute.aio import ComputeClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestComputeVirtualMachineScaleSetVMRunCommandsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ComputeClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_virtual_machine_scale_set_vm_run_commands_get(self, resource_group): + response = await self.client.virtual_machine_scale_set_vm_run_commands.get( + resource_group_name=resource_group.name, + vm_scale_set_name="str", + instance_id="str", + run_command_name="str", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_virtual_machine_scale_set_vm_run_commands_begin_create_or_update(self, resource_group): + response = await ( + await self.client.virtual_machine_scale_set_vm_run_commands.begin_create_or_update( + resource_group_name=resource_group.name, + vm_scale_set_name="str", + instance_id="str", + run_command_name="str", + body={ + "location": "str", + "id": "str", + "name": "str", + "properties": { + "asyncExecution": bool, + "errorBlobManagedIdentity": {"clientId": "str", "objectId": "str"}, + "errorBlobUri": "str", + "instanceView": { + "endTime": "2020-02-20 00:00:00", + "error": "str", + "executionMessage": "str", + "executionState": "str", + "exitCode": 0, + "output": "str", + "startTime": "2020-02-20 00:00:00", + "statuses": [ + { + "code": "str", + "displayStatus": "str", + "level": "str", + "message": "str", + "time": "2020-02-20 00:00:00", + } + ], + }, + "outputBlobManagedIdentity": {"clientId": "str", "objectId": "str"}, + "outputBlobUri": "str", + "parameters": [{"name": "str", "value": "str"}], + "protectedParameters": [{"name": "str", "value": "str"}], + "provisioningState": "str", + "runAsPassword": "str", + "runAsUser": "str", + "source": { + "commandId": "str", + "galleryScriptReferenceId": "str", + "script": "str", + "scriptShell": "str", + "scriptUri": "str", + "scriptUriManagedIdentity": {"clientId": "str", "objectId": "str"}, + }, + "timeoutInSeconds": 0, + "treatFailureAsDeploymentFailure": bool, + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "tags": {"str": "str"}, + "type": "str", + }, + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_virtual_machine_scale_set_vm_run_commands_begin_update(self, resource_group): + response = await ( + await self.client.virtual_machine_scale_set_vm_run_commands.begin_update( + resource_group_name=resource_group.name, + vm_scale_set_name="str", + instance_id="str", + run_command_name="str", + body={ + "properties": { + "asyncExecution": bool, + "errorBlobManagedIdentity": {"clientId": "str", "objectId": "str"}, + "errorBlobUri": "str", + "instanceView": { + "endTime": "2020-02-20 00:00:00", + "error": "str", + "executionMessage": "str", + "executionState": "str", + "exitCode": 0, + "output": "str", + "startTime": "2020-02-20 00:00:00", + "statuses": [ + { + "code": "str", + "displayStatus": "str", + "level": "str", + "message": "str", + "time": "2020-02-20 00:00:00", + } + ], + }, + "outputBlobManagedIdentity": {"clientId": "str", "objectId": "str"}, + "outputBlobUri": "str", + "parameters": [{"name": "str", "value": "str"}], + "protectedParameters": [{"name": "str", "value": "str"}], + "provisioningState": "str", + "runAsPassword": "str", + "runAsUser": "str", + "source": { + "commandId": "str", + "galleryScriptReferenceId": "str", + "script": "str", + "scriptShell": "str", + "scriptUri": "str", + "scriptUriManagedIdentity": {"clientId": "str", "objectId": "str"}, + }, + "timeoutInSeconds": 0, + "treatFailureAsDeploymentFailure": bool, + }, + "tags": {"str": "str"}, + }, + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_virtual_machine_scale_set_vm_run_commands_begin_delete(self, resource_group): + response = await ( + await self.client.virtual_machine_scale_set_vm_run_commands.begin_delete( + resource_group_name=resource_group.name, + vm_scale_set_name="str", + instance_id="str", + run_command_name="str", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_virtual_machine_scale_set_vm_run_commands_list(self, resource_group): + response = self.client.virtual_machine_scale_set_vm_run_commands.list( + resource_group_name=resource_group.name, + vm_scale_set_name="str", + instance_id="str", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_virtual_machine_scale_set_vms_operations_async.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machine_scale_set_vms_operations.py similarity index 60% rename from sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_virtual_machine_scale_set_vms_operations_async.py rename to sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machine_scale_set_vms_operations.py index 0e209ffc96da..986812639db4 100644 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_virtual_machine_scale_set_vms_operations_async.py +++ b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machine_scale_set_vms_operations.py @@ -2,71 +2,59 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.compute.aio import ComputeManagementClient +from azure.mgmt.compute import ComputeClient -from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer -from devtools_testutils.aio import recorded_by_proxy_async +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy AZURE_LOCATION = "eastus" @pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestComputeManagementVirtualMachineScaleSetVMsOperationsAsync(AzureMgmtRecordedTestCase): +class TestComputeVirtualMachineScaleSetVMSOperations(AzureMgmtRecordedTestCase): def setup_method(self, method): - self.client = self.create_mgmt_client(ComputeManagementClient, is_async=True) + self.client = self.create_mgmt_client(ComputeClient) @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_virtual_machine_scale_set_vms_list(self, resource_group): - response = self.client.virtual_machine_scale_set_vms.list( - resource_group_name=resource_group.name, - virtual_machine_scale_set_name="str", - api_version="2025-04-01", - ) - result = [r async for r in response] - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_virtual_machine_scale_set_vms_get(self, resource_group): - response = await self.client.virtual_machine_scale_set_vms.get( + @recorded_by_proxy + def test_virtual_machine_scale_set_vms_get(self, resource_group): + response = self.client.virtual_machine_scale_set_vms.get( resource_group_name=resource_group.name, vm_scale_set_name="str", instance_id="str", - api_version="2025-04-01", ) # please add some check logic here by yourself # ... @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_virtual_machine_scale_set_vms_begin_update(self, resource_group): - response = await ( - await self.client.virtual_machine_scale_set_vms.begin_update( - resource_group_name=resource_group.name, - vm_scale_set_name="str", - instance_id="str", - parameters={ - "location": "str", + @recorded_by_proxy + def test_virtual_machine_scale_set_vms_begin_update(self, resource_group): + response = self.client.virtual_machine_scale_set_vms.begin_update( + resource_group_name=resource_group.name, + vm_scale_set_name="str", + instance_id="str", + resource={ + "location": "str", + "etag": "str", + "id": "str", + "identity": { + "principalId": "str", + "tenantId": "str", + "type": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, + "instanceId": "str", + "name": "str", + "plan": {"name": "str", "product": "str", "promotionCode": "str", "publisher": "str"}, + "properties": { "additionalCapabilities": {"hibernationEnabled": bool, "ultraSSDEnabled": bool}, "availabilitySet": {"id": "str"}, "diagnosticsProfile": {"bootDiagnostics": {"enabled": bool, "storageUri": "str"}}, - "etag": "str", "hardwareProfile": {"vmSize": "str", "vmSizeProperties": {"vCPUsAvailable": 0, "vCPUsPerCore": 0}}, - "id": "str", - "identity": { - "principalId": "str", - "tenantId": "str", - "type": "str", - "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, - }, - "instanceId": "str", "instanceView": { "assignedHost": "str", "bootDiagnostics": { @@ -190,88 +178,105 @@ async def test_virtual_machine_scale_set_vms_begin_update(self, resource_group): "latestModelApplied": bool, "licenseType": "str", "modelDefinitionApplied": "str", - "name": "str", "networkProfile": { "networkApiVersion": "str", "networkInterfaceConfigurations": [ { "name": "str", - "auxiliaryMode": "str", - "auxiliarySku": "str", - "deleteOption": "str", - "disableTcpStateTracking": bool, - "dnsSettings": {"dnsServers": ["str"]}, - "dscpConfiguration": {"id": "str"}, - "enableAcceleratedNetworking": bool, - "enableFpga": bool, - "enableIPForwarding": bool, - "ipConfigurations": [ - { - "name": "str", - "applicationGatewayBackendAddressPools": [{"id": "str"}], - "applicationSecurityGroups": [{"id": "str"}], - "loadBalancerBackendAddressPools": [{"id": "str"}], - "primary": bool, - "privateIPAddressVersion": "str", - "publicIPAddressConfiguration": { + "properties": { + "ipConfigurations": [ + { "name": "str", - "deleteOption": "str", - "dnsSettings": {"domainNameLabel": "str", "domainNameLabelScope": "str"}, - "idleTimeoutInMinutes": 0, - "ipTags": [{"ipTagType": "str", "tag": "str"}], - "publicIPAddressVersion": "str", - "publicIPAllocationMethod": "str", - "publicIPPrefix": {"id": "str"}, - "sku": {"name": "str", "tier": "str"}, - "tags": {"str": "str"}, - }, - "subnet": {"id": "str"}, - } - ], - "networkSecurityGroup": {"id": "str"}, - "primary": bool, + "properties": { + "applicationGatewayBackendAddressPools": [{"id": "str"}], + "applicationSecurityGroups": [{"id": "str"}], + "loadBalancerBackendAddressPools": [{"id": "str"}], + "primary": bool, + "privateIPAddressVersion": "str", + "publicIPAddressConfiguration": { + "name": "str", + "properties": { + "deleteOption": "str", + "dnsSettings": { + "domainNameLabel": "str", + "domainNameLabelScope": "str", + }, + "idleTimeoutInMinutes": 0, + "ipTags": [{"ipTagType": "str", "tag": "str"}], + "publicIPAddressVersion": "str", + "publicIPAllocationMethod": "str", + "publicIPPrefix": {"id": "str"}, + }, + "sku": {"name": "str", "tier": "str"}, + "tags": {"str": "str"}, + }, + "subnet": {"id": "str"}, + }, + } + ], + "auxiliaryMode": "str", + "auxiliarySku": "str", + "deleteOption": "str", + "disableTcpStateTracking": bool, + "dnsSettings": {"dnsServers": ["str"]}, + "dscpConfiguration": {"id": "str"}, + "enableAcceleratedNetworking": bool, + "enableFpga": bool, + "enableIPForwarding": bool, + "networkSecurityGroup": {"id": "str"}, + "primary": bool, + }, "tags": {"str": "str"}, } ], - "networkInterfaces": [{"deleteOption": "str", "id": "str", "primary": bool}], + "networkInterfaces": [{"id": "str", "properties": {"deleteOption": "str", "primary": bool}}], }, "networkProfileConfiguration": { "networkInterfaceConfigurations": [ { "name": "str", - "auxiliaryMode": "str", - "auxiliarySku": "str", - "deleteOption": "str", - "disableTcpStateTracking": bool, - "dnsSettings": {"dnsServers": ["str"]}, - "enableAcceleratedNetworking": bool, - "enableFpga": bool, - "enableIPForwarding": bool, - "ipConfigurations": [ - { - "name": "str", - "applicationGatewayBackendAddressPools": [{"id": "str"}], - "applicationSecurityGroups": [{"id": "str"}], - "loadBalancerBackendAddressPools": [{"id": "str"}], - "loadBalancerInboundNatPools": [{"id": "str"}], - "primary": bool, - "privateIPAddressVersion": "str", - "publicIPAddressConfiguration": { + "properties": { + "ipConfigurations": [ + { "name": "str", - "deleteOption": "str", - "dnsSettings": {"domainNameLabel": "str", "domainNameLabelScope": "str"}, - "idleTimeoutInMinutes": 0, - "ipTags": [{"ipTagType": "str", "tag": "str"}], - "publicIPAddressVersion": "str", - "publicIPPrefix": {"id": "str"}, - "sku": {"name": "str", "tier": "str"}, - "tags": {"str": "str"}, - }, - "subnet": {"id": "str"}, - } - ], - "networkSecurityGroup": {"id": "str"}, - "primary": bool, + "properties": { + "applicationGatewayBackendAddressPools": [{"id": "str"}], + "applicationSecurityGroups": [{"id": "str"}], + "loadBalancerBackendAddressPools": [{"id": "str"}], + "loadBalancerInboundNatPools": [{"id": "str"}], + "primary": bool, + "privateIPAddressVersion": "str", + "publicIPAddressConfiguration": { + "name": "str", + "properties": { + "deleteOption": "str", + "dnsSettings": { + "domainNameLabel": "str", + "domainNameLabelScope": "str", + }, + "idleTimeoutInMinutes": 0, + "ipTags": [{"ipTagType": "str", "tag": "str"}], + "publicIPAddressVersion": "str", + "publicIPPrefix": {"id": "str"}, + }, + "sku": {"name": "str", "tier": "str"}, + "tags": {"str": "str"}, + }, + "subnet": {"id": "str"}, + }, + } + ], + "auxiliaryMode": "str", + "auxiliarySku": "str", + "deleteOption": "str", + "disableTcpStateTracking": bool, + "dnsSettings": {"dnsServers": ["str"]}, + "enableAcceleratedNetworking": bool, + "enableFpga": bool, + "enableIPForwarding": bool, + "networkSecurityGroup": {"id": "str"}, + "primary": bool, + }, "tags": {"str": "str"}, } ] @@ -308,7 +313,7 @@ async def test_virtual_machine_scale_set_vms_begin_update(self, resource_group): { "componentName": "Microsoft-Windows-Shell-Setup", "content": "str", - "passName": "OobeSystem", + "passName": "str", "settingName": "str", } ], @@ -328,61 +333,9 @@ async def test_virtual_machine_scale_set_vms_begin_update(self, resource_group): "winRM": {"listeners": [{"certificateUrl": "str", "protocol": "str"}]}, }, }, - "plan": {"name": "str", "product": "str", "promotionCode": "str", "publisher": "str"}, "protectionPolicy": {"protectFromScaleIn": bool, "protectFromScaleSetActions": bool}, "provisioningState": "str", "resilientVMDeletionStatus": "str", - "resources": [ - { - "location": "str", - "autoUpgradeMinorVersion": bool, - "enableAutomaticUpgrade": bool, - "forceUpdateTag": "str", - "id": "str", - "instanceView": { - "name": "str", - "statuses": [ - { - "code": "str", - "displayStatus": "str", - "level": "str", - "message": "str", - "time": "2020-02-20 00:00:00", - } - ], - "substatuses": [ - { - "code": "str", - "displayStatus": "str", - "level": "str", - "message": "str", - "time": "2020-02-20 00:00:00", - } - ], - "type": "str", - "typeHandlerVersion": "str", - }, - "name": "str", - "protectedSettings": {}, - "protectedSettingsFromKeyVault": {"secretUrl": "str", "sourceVault": {"id": "str"}}, - "provisionAfterExtensions": ["str"], - "provisioningState": "str", - "publisher": "str", - "settings": {}, - "suppressFailures": bool, - "systemData": { - "createdAt": "2020-02-20 00:00:00", - "createdBy": "str", - "createdByType": "str", - "lastModifiedAt": "2020-02-20 00:00:00", - "lastModifiedBy": "str", - "lastModifiedByType": "str", - }, - "tags": {"str": "str"}, - "type": "str", - "typeHandlerVersion": "str", - } - ], "securityProfile": { "encryptionAtHost": bool, "encryptionIdentity": {"userAssignedIdentityResourceId": "str"}, @@ -397,7 +350,6 @@ async def test_virtual_machine_scale_set_vms_begin_update(self, resource_group): "securityType": "str", "uefiSettings": {"secureBootEnabled": bool, "vTpmEnabled": bool}, }, - "sku": {"capacity": 0, "name": "str", "tier": "str"}, "storageProfile": { "alignRegionalDisksToVMZone": bool, "dataDisks": [ @@ -465,256 +417,282 @@ async def test_virtual_machine_scale_set_vms_begin_update(self, resource_group): "writeAcceleratorEnabled": bool, }, }, - "systemData": { - "createdAt": "2020-02-20 00:00:00", - "createdBy": "str", - "createdByType": "str", - "lastModifiedAt": "2020-02-20 00:00:00", - "lastModifiedBy": "str", - "lastModifiedByType": "str", - }, - "tags": {"str": "str"}, "timeCreated": "2020-02-20 00:00:00", - "type": "str", "userData": "str", "vmId": "str", - "zones": ["str"], }, - api_version="2025-04-01", - ) + "resources": [ + { + "location": "str", + "id": "str", + "name": "str", + "properties": { + "autoUpgradeMinorVersion": bool, + "enableAutomaticUpgrade": bool, + "forceUpdateTag": "str", + "instanceView": { + "name": "str", + "statuses": [ + { + "code": "str", + "displayStatus": "str", + "level": "str", + "message": "str", + "time": "2020-02-20 00:00:00", + } + ], + "substatuses": [ + { + "code": "str", + "displayStatus": "str", + "level": "str", + "message": "str", + "time": "2020-02-20 00:00:00", + } + ], + "type": "str", + "typeHandlerVersion": "str", + }, + "protectedSettings": {}, + "protectedSettingsFromKeyVault": {"secretUrl": "str", "sourceVault": {"id": "str"}}, + "provisionAfterExtensions": ["str"], + "provisioningState": "str", + "publisher": "str", + "settings": {}, + "suppressFailures": bool, + "type": "str", + "typeHandlerVersion": "str", + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "tags": {"str": "str"}, + "type": "str", + } + ], + "sku": {"capacity": 0, "name": "str", "tier": "str"}, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "tags": {"str": "str"}, + "type": "str", + "zones": ["str"], + }, ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself # ... @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_virtual_machine_scale_set_vms_begin_delete(self, resource_group): - response = await ( - await self.client.virtual_machine_scale_set_vms.begin_delete( - resource_group_name=resource_group.name, - vm_scale_set_name="str", - instance_id="str", - api_version="2025-04-01", - ) + @recorded_by_proxy + def test_virtual_machine_scale_set_vms_begin_delete(self, resource_group): + response = self.client.virtual_machine_scale_set_vms.begin_delete( + resource_group_name=resource_group.name, + vm_scale_set_name="str", + instance_id="str", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself # ... @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_virtual_machine_scale_set_vms_begin_approve_rolling_upgrade(self, resource_group): - response = await ( - await self.client.virtual_machine_scale_set_vms.begin_approve_rolling_upgrade( - resource_group_name=resource_group.name, - vm_scale_set_name="str", - instance_id="str", - api_version="2025-04-01", - ) - ).result() # call '.result()' to poll until service return final result - + @recorded_by_proxy + def test_virtual_machine_scale_set_vms_list(self, resource_group): + response = self.client.virtual_machine_scale_set_vms.list( + resource_group_name=resource_group.name, + virtual_machine_scale_set_name="str", + ) + result = [r for r in response] # please add some check logic here by yourself # ... @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_virtual_machine_scale_set_vms_begin_attach_detach_data_disks(self, resource_group): - response = await ( - await self.client.virtual_machine_scale_set_vms.begin_attach_detach_data_disks( - resource_group_name=resource_group.name, - vm_scale_set_name="str", - instance_id="str", - parameters={ - "dataDisksToAttach": [ - { - "diskId": "str", - "caching": "str", - "deleteOption": "str", - "diskEncryptionSet": {"id": "str"}, - "lun": 0, - "writeAcceleratorEnabled": bool, - } - ], - "dataDisksToDetach": [{"diskId": "str", "detachOption": "str"}], - }, - api_version="2025-04-01", - ) + @recorded_by_proxy + def test_virtual_machine_scale_set_vms_begin_approve_rolling_upgrade(self, resource_group): + response = self.client.virtual_machine_scale_set_vms.begin_approve_rolling_upgrade( + resource_group_name=resource_group.name, + vm_scale_set_name="str", + instance_id="str", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself # ... @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_virtual_machine_scale_set_vms_begin_deallocate(self, resource_group): - response = await ( - await self.client.virtual_machine_scale_set_vms.begin_deallocate( - resource_group_name=resource_group.name, - vm_scale_set_name="str", - instance_id="str", - api_version="2025-04-01", - ) + @recorded_by_proxy + def test_virtual_machine_scale_set_vms_begin_deallocate(self, resource_group): + response = self.client.virtual_machine_scale_set_vms.begin_deallocate( + resource_group_name=resource_group.name, + vm_scale_set_name="str", + instance_id="str", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself # ... @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_virtual_machine_scale_set_vms_get_instance_view(self, resource_group): - response = await self.client.virtual_machine_scale_set_vms.get_instance_view( + @recorded_by_proxy + def test_virtual_machine_scale_set_vms_get_instance_view(self, resource_group): + response = self.client.virtual_machine_scale_set_vms.get_instance_view( resource_group_name=resource_group.name, vm_scale_set_name="str", instance_id="str", - api_version="2025-04-01", ) # please add some check logic here by yourself # ... @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_virtual_machine_scale_set_vms_begin_perform_maintenance(self, resource_group): - response = await ( - await self.client.virtual_machine_scale_set_vms.begin_perform_maintenance( - resource_group_name=resource_group.name, - vm_scale_set_name="str", - instance_id="str", - api_version="2025-04-01", - ) + @recorded_by_proxy + def test_virtual_machine_scale_set_vms_begin_reimage(self, resource_group): + response = self.client.virtual_machine_scale_set_vms.begin_reimage( + resource_group_name=resource_group.name, + vm_scale_set_name="str", + instance_id="str", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself # ... @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_virtual_machine_scale_set_vms_begin_power_off(self, resource_group): - response = await ( - await self.client.virtual_machine_scale_set_vms.begin_power_off( - resource_group_name=resource_group.name, - vm_scale_set_name="str", - instance_id="str", - api_version="2025-04-01", - ) + @recorded_by_proxy + def test_virtual_machine_scale_set_vms_begin_reimage_all(self, resource_group): + response = self.client.virtual_machine_scale_set_vms.begin_reimage_all( + resource_group_name=resource_group.name, + vm_scale_set_name="str", + instance_id="str", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself # ... @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_virtual_machine_scale_set_vms_begin_redeploy(self, resource_group): - response = await ( - await self.client.virtual_machine_scale_set_vms.begin_redeploy( - resource_group_name=resource_group.name, - vm_scale_set_name="str", - instance_id="str", - api_version="2025-04-01", - ) - ).result() # call '.result()' to poll until service return final result + @recorded_by_proxy + def test_virtual_machine_scale_set_vms_simulate_eviction(self, resource_group): + response = self.client.virtual_machine_scale_set_vms.simulate_eviction( + resource_group_name=resource_group.name, + vm_scale_set_name="str", + instance_id="str", + ) # please add some check logic here by yourself # ... @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_virtual_machine_scale_set_vms_begin_reimage(self, resource_group): - response = await ( - await self.client.virtual_machine_scale_set_vms.begin_reimage( - resource_group_name=resource_group.name, - vm_scale_set_name="str", - instance_id="str", - api_version="2025-04-01", - ) + @recorded_by_proxy + def test_virtual_machine_scale_set_vms_begin_attach_detach_data_disks(self, resource_group): + response = self.client.virtual_machine_scale_set_vms.begin_attach_detach_data_disks( + resource_group_name=resource_group.name, + vm_scale_set_name="str", + instance_id="str", + body={ + "dataDisksToAttach": [ + { + "diskId": "str", + "caching": "str", + "deleteOption": "str", + "diskEncryptionSet": {"id": "str"}, + "lun": 0, + "writeAcceleratorEnabled": bool, + } + ], + "dataDisksToDetach": [{"diskId": "str", "detachOption": "str"}], + }, ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself # ... @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_virtual_machine_scale_set_vms_begin_reimage_all(self, resource_group): - response = await ( - await self.client.virtual_machine_scale_set_vms.begin_reimage_all( - resource_group_name=resource_group.name, - vm_scale_set_name="str", - instance_id="str", - api_version="2025-04-01", - ) + @recorded_by_proxy + def test_virtual_machine_scale_set_vms_begin_perform_maintenance(self, resource_group): + response = self.client.virtual_machine_scale_set_vms.begin_perform_maintenance( + resource_group_name=resource_group.name, + vm_scale_set_name="str", + instance_id="str", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself # ... @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_virtual_machine_scale_set_vms_begin_restart(self, resource_group): - response = await ( - await self.client.virtual_machine_scale_set_vms.begin_restart( - resource_group_name=resource_group.name, - vm_scale_set_name="str", - instance_id="str", - api_version="2025-04-01", - ) + @recorded_by_proxy + def test_virtual_machine_scale_set_vms_begin_power_off(self, resource_group): + response = self.client.virtual_machine_scale_set_vms.begin_power_off( + resource_group_name=resource_group.name, + vm_scale_set_name="str", + instance_id="str", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself # ... @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_virtual_machine_scale_set_vms_retrieve_boot_diagnostics_data(self, resource_group): - response = await self.client.virtual_machine_scale_set_vms.retrieve_boot_diagnostics_data( + @recorded_by_proxy + def test_virtual_machine_scale_set_vms_begin_redeploy(self, resource_group): + response = self.client.virtual_machine_scale_set_vms.begin_redeploy( resource_group_name=resource_group.name, vm_scale_set_name="str", instance_id="str", - api_version="2025-04-01", - ) + ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself # ... @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_virtual_machine_scale_set_vms_begin_run_command(self, resource_group): - response = await ( - await self.client.virtual_machine_scale_set_vms.begin_run_command( - resource_group_name=resource_group.name, - vm_scale_set_name="str", - instance_id="str", - parameters={"commandId": "str", "parameters": [{"name": "str", "value": "str"}], "script": ["str"]}, - api_version="2025-04-01", - ) + @recorded_by_proxy + def test_virtual_machine_scale_set_vms_begin_restart(self, resource_group): + response = self.client.virtual_machine_scale_set_vms.begin_restart( + resource_group_name=resource_group.name, + vm_scale_set_name="str", + instance_id="str", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself # ... @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_virtual_machine_scale_set_vms_simulate_eviction(self, resource_group): - response = await self.client.virtual_machine_scale_set_vms.simulate_eviction( + @recorded_by_proxy + def test_virtual_machine_scale_set_vms_retrieve_boot_diagnostics_data(self, resource_group): + response = self.client.virtual_machine_scale_set_vms.retrieve_boot_diagnostics_data( resource_group_name=resource_group.name, vm_scale_set_name="str", instance_id="str", - api_version="2025-04-01", ) # please add some check logic here by yourself # ... @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_virtual_machine_scale_set_vms_begin_start(self, resource_group): - response = await ( - await self.client.virtual_machine_scale_set_vms.begin_start( - resource_group_name=resource_group.name, - vm_scale_set_name="str", - instance_id="str", - api_version="2025-04-01", - ) + @recorded_by_proxy + def test_virtual_machine_scale_set_vms_begin_start(self, resource_group): + response = self.client.virtual_machine_scale_set_vms.begin_start( + resource_group_name=resource_group.name, + vm_scale_set_name="str", + instance_id="str", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_virtual_machine_scale_set_vms_begin_run_command(self, resource_group): + response = self.client.virtual_machine_scale_set_vms.begin_run_command( + resource_group_name=resource_group.name, + vm_scale_set_name="str", + instance_id="str", + body={"commandId": "str", "parameters": [{"name": "str", "value": "str"}], "script": ["str"]}, ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machine_scale_set_vms_operations_async.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machine_scale_set_vms_operations_async.py new file mode 100644 index 000000000000..eb1ea6bb0c73 --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machine_scale_set_vms_operations_async.py @@ -0,0 +1,731 @@ +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.compute.aio import ComputeClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestComputeVirtualMachineScaleSetVMSOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ComputeClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_virtual_machine_scale_set_vms_get(self, resource_group): + response = await self.client.virtual_machine_scale_set_vms.get( + resource_group_name=resource_group.name, + vm_scale_set_name="str", + instance_id="str", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_virtual_machine_scale_set_vms_begin_update(self, resource_group): + response = await ( + await self.client.virtual_machine_scale_set_vms.begin_update( + resource_group_name=resource_group.name, + vm_scale_set_name="str", + instance_id="str", + resource={ + "location": "str", + "etag": "str", + "id": "str", + "identity": { + "principalId": "str", + "tenantId": "str", + "type": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, + "instanceId": "str", + "name": "str", + "plan": {"name": "str", "product": "str", "promotionCode": "str", "publisher": "str"}, + "properties": { + "additionalCapabilities": {"hibernationEnabled": bool, "ultraSSDEnabled": bool}, + "availabilitySet": {"id": "str"}, + "diagnosticsProfile": {"bootDiagnostics": {"enabled": bool, "storageUri": "str"}}, + "hardwareProfile": { + "vmSize": "str", + "vmSizeProperties": {"vCPUsAvailable": 0, "vCPUsPerCore": 0}, + }, + "instanceView": { + "assignedHost": "str", + "bootDiagnostics": { + "consoleScreenshotBlobUri": "str", + "serialConsoleLogBlobUri": "str", + "status": { + "code": "str", + "displayStatus": "str", + "level": "str", + "message": "str", + "time": "2020-02-20 00:00:00", + }, + }, + "computerName": "str", + "disks": [ + { + "encryptionSettings": [ + { + "diskEncryptionKey": {"secretUrl": "str", "sourceVault": {"id": "str"}}, + "enabled": bool, + "keyEncryptionKey": {"keyUrl": "str", "sourceVault": {"id": "str"}}, + } + ], + "name": "str", + "statuses": [ + { + "code": "str", + "displayStatus": "str", + "level": "str", + "message": "str", + "time": "2020-02-20 00:00:00", + } + ], + } + ], + "extensions": [ + { + "name": "str", + "statuses": [ + { + "code": "str", + "displayStatus": "str", + "level": "str", + "message": "str", + "time": "2020-02-20 00:00:00", + } + ], + "substatuses": [ + { + "code": "str", + "displayStatus": "str", + "level": "str", + "message": "str", + "time": "2020-02-20 00:00:00", + } + ], + "type": "str", + "typeHandlerVersion": "str", + } + ], + "hyperVGeneration": "str", + "maintenanceRedeployStatus": { + "isCustomerInitiatedMaintenanceAllowed": bool, + "lastOperationMessage": "str", + "lastOperationResultCode": "str", + "maintenanceWindowEndTime": "2020-02-20 00:00:00", + "maintenanceWindowStartTime": "2020-02-20 00:00:00", + "preMaintenanceWindowEndTime": "2020-02-20 00:00:00", + "preMaintenanceWindowStartTime": "2020-02-20 00:00:00", + }, + "osName": "str", + "osVersion": "str", + "placementGroupId": "str", + "platformFaultDomain": 0, + "platformUpdateDomain": 0, + "rdpThumbPrint": "str", + "statuses": [ + { + "code": "str", + "displayStatus": "str", + "level": "str", + "message": "str", + "time": "2020-02-20 00:00:00", + } + ], + "vmAgent": { + "extensionHandlers": [ + { + "status": { + "code": "str", + "displayStatus": "str", + "level": "str", + "message": "str", + "time": "2020-02-20 00:00:00", + }, + "type": "str", + "typeHandlerVersion": "str", + } + ], + "statuses": [ + { + "code": "str", + "displayStatus": "str", + "level": "str", + "message": "str", + "time": "2020-02-20 00:00:00", + } + ], + "vmAgentVersion": "str", + }, + "vmHealth": { + "status": { + "code": "str", + "displayStatus": "str", + "level": "str", + "message": "str", + "time": "2020-02-20 00:00:00", + } + }, + }, + "latestModelApplied": bool, + "licenseType": "str", + "modelDefinitionApplied": "str", + "networkProfile": { + "networkApiVersion": "str", + "networkInterfaceConfigurations": [ + { + "name": "str", + "properties": { + "ipConfigurations": [ + { + "name": "str", + "properties": { + "applicationGatewayBackendAddressPools": [{"id": "str"}], + "applicationSecurityGroups": [{"id": "str"}], + "loadBalancerBackendAddressPools": [{"id": "str"}], + "primary": bool, + "privateIPAddressVersion": "str", + "publicIPAddressConfiguration": { + "name": "str", + "properties": { + "deleteOption": "str", + "dnsSettings": { + "domainNameLabel": "str", + "domainNameLabelScope": "str", + }, + "idleTimeoutInMinutes": 0, + "ipTags": [{"ipTagType": "str", "tag": "str"}], + "publicIPAddressVersion": "str", + "publicIPAllocationMethod": "str", + "publicIPPrefix": {"id": "str"}, + }, + "sku": {"name": "str", "tier": "str"}, + "tags": {"str": "str"}, + }, + "subnet": {"id": "str"}, + }, + } + ], + "auxiliaryMode": "str", + "auxiliarySku": "str", + "deleteOption": "str", + "disableTcpStateTracking": bool, + "dnsSettings": {"dnsServers": ["str"]}, + "dscpConfiguration": {"id": "str"}, + "enableAcceleratedNetworking": bool, + "enableFpga": bool, + "enableIPForwarding": bool, + "networkSecurityGroup": {"id": "str"}, + "primary": bool, + }, + "tags": {"str": "str"}, + } + ], + "networkInterfaces": [ + {"id": "str", "properties": {"deleteOption": "str", "primary": bool}} + ], + }, + "networkProfileConfiguration": { + "networkInterfaceConfigurations": [ + { + "name": "str", + "properties": { + "ipConfigurations": [ + { + "name": "str", + "properties": { + "applicationGatewayBackendAddressPools": [{"id": "str"}], + "applicationSecurityGroups": [{"id": "str"}], + "loadBalancerBackendAddressPools": [{"id": "str"}], + "loadBalancerInboundNatPools": [{"id": "str"}], + "primary": bool, + "privateIPAddressVersion": "str", + "publicIPAddressConfiguration": { + "name": "str", + "properties": { + "deleteOption": "str", + "dnsSettings": { + "domainNameLabel": "str", + "domainNameLabelScope": "str", + }, + "idleTimeoutInMinutes": 0, + "ipTags": [{"ipTagType": "str", "tag": "str"}], + "publicIPAddressVersion": "str", + "publicIPPrefix": {"id": "str"}, + }, + "sku": {"name": "str", "tier": "str"}, + "tags": {"str": "str"}, + }, + "subnet": {"id": "str"}, + }, + } + ], + "auxiliaryMode": "str", + "auxiliarySku": "str", + "deleteOption": "str", + "disableTcpStateTracking": bool, + "dnsSettings": {"dnsServers": ["str"]}, + "enableAcceleratedNetworking": bool, + "enableFpga": bool, + "enableIPForwarding": bool, + "networkSecurityGroup": {"id": "str"}, + "primary": bool, + }, + "tags": {"str": "str"}, + } + ] + }, + "osProfile": { + "adminPassword": "str", + "adminUsername": "str", + "allowExtensionOperations": bool, + "computerName": "str", + "customData": "str", + "linuxConfiguration": { + "disablePasswordAuthentication": bool, + "enableVMAgentPlatformUpdates": bool, + "patchSettings": { + "assessmentMode": "str", + "automaticByPlatformSettings": { + "bypassPlatformSafetyChecksOnUserSchedule": bool, + "rebootSetting": "str", + }, + "patchMode": "str", + }, + "provisionVMAgent": bool, + "ssh": {"publicKeys": [{"keyData": "str", "path": "str"}]}, + }, + "requireGuestProvisionSignal": bool, + "secrets": [ + { + "sourceVault": {"id": "str"}, + "vaultCertificates": [{"certificateStore": "str", "certificateUrl": "str"}], + } + ], + "windowsConfiguration": { + "additionalUnattendContent": [ + { + "componentName": "Microsoft-Windows-Shell-Setup", + "content": "str", + "passName": "str", + "settingName": "str", + } + ], + "enableAutomaticUpdates": bool, + "enableVMAgentPlatformUpdates": bool, + "patchSettings": { + "assessmentMode": "str", + "automaticByPlatformSettings": { + "bypassPlatformSafetyChecksOnUserSchedule": bool, + "rebootSetting": "str", + }, + "enableHotpatching": bool, + "patchMode": "str", + }, + "provisionVMAgent": bool, + "timeZone": "str", + "winRM": {"listeners": [{"certificateUrl": "str", "protocol": "str"}]}, + }, + }, + "protectionPolicy": {"protectFromScaleIn": bool, "protectFromScaleSetActions": bool}, + "provisioningState": "str", + "resilientVMDeletionStatus": "str", + "securityProfile": { + "encryptionAtHost": bool, + "encryptionIdentity": {"userAssignedIdentityResourceId": "str"}, + "proxyAgentSettings": { + "addProxyAgentExtension": bool, + "enabled": bool, + "imds": {"inVMAccessControlProfileReferenceId": "str", "mode": "str"}, + "keyIncarnationId": 0, + "mode": "str", + "wireServer": {"inVMAccessControlProfileReferenceId": "str", "mode": "str"}, + }, + "securityType": "str", + "uefiSettings": {"secureBootEnabled": bool, "vTpmEnabled": bool}, + }, + "storageProfile": { + "alignRegionalDisksToVMZone": bool, + "dataDisks": [ + { + "createOption": "str", + "lun": 0, + "caching": "str", + "deleteOption": "str", + "detachOption": "str", + "diskIOPSReadWrite": 0, + "diskMBpsReadWrite": 0, + "diskSizeGB": 0, + "image": {"uri": "str"}, + "managedDisk": { + "diskEncryptionSet": {"id": "str"}, + "id": "str", + "securityProfile": { + "diskEncryptionSet": {"id": "str"}, + "securityEncryptionType": "str", + }, + "storageAccountType": "str", + }, + "name": "str", + "sourceResource": {"id": "str"}, + "toBeDetached": bool, + "vhd": {"uri": "str"}, + "writeAcceleratorEnabled": bool, + } + ], + "diskControllerType": "str", + "imageReference": { + "communityGalleryImageId": "str", + "exactVersion": "str", + "id": "str", + "offer": "str", + "publisher": "str", + "sharedGalleryImageId": "str", + "sku": "str", + "version": "str", + }, + "osDisk": { + "createOption": "str", + "caching": "str", + "deleteOption": "str", + "diffDiskSettings": {"option": "str", "placement": "str"}, + "diskSizeGB": 0, + "encryptionSettings": { + "diskEncryptionKey": {"secretUrl": "str", "sourceVault": {"id": "str"}}, + "enabled": bool, + "keyEncryptionKey": {"keyUrl": "str", "sourceVault": {"id": "str"}}, + }, + "image": {"uri": "str"}, + "managedDisk": { + "diskEncryptionSet": {"id": "str"}, + "id": "str", + "securityProfile": { + "diskEncryptionSet": {"id": "str"}, + "securityEncryptionType": "str", + }, + "storageAccountType": "str", + }, + "name": "str", + "osType": "str", + "vhd": {"uri": "str"}, + "writeAcceleratorEnabled": bool, + }, + }, + "timeCreated": "2020-02-20 00:00:00", + "userData": "str", + "vmId": "str", + }, + "resources": [ + { + "location": "str", + "id": "str", + "name": "str", + "properties": { + "autoUpgradeMinorVersion": bool, + "enableAutomaticUpgrade": bool, + "forceUpdateTag": "str", + "instanceView": { + "name": "str", + "statuses": [ + { + "code": "str", + "displayStatus": "str", + "level": "str", + "message": "str", + "time": "2020-02-20 00:00:00", + } + ], + "substatuses": [ + { + "code": "str", + "displayStatus": "str", + "level": "str", + "message": "str", + "time": "2020-02-20 00:00:00", + } + ], + "type": "str", + "typeHandlerVersion": "str", + }, + "protectedSettings": {}, + "protectedSettingsFromKeyVault": {"secretUrl": "str", "sourceVault": {"id": "str"}}, + "provisionAfterExtensions": ["str"], + "provisioningState": "str", + "publisher": "str", + "settings": {}, + "suppressFailures": bool, + "type": "str", + "typeHandlerVersion": "str", + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "tags": {"str": "str"}, + "type": "str", + } + ], + "sku": {"capacity": 0, "name": "str", "tier": "str"}, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "tags": {"str": "str"}, + "type": "str", + "zones": ["str"], + }, + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_virtual_machine_scale_set_vms_begin_delete(self, resource_group): + response = await ( + await self.client.virtual_machine_scale_set_vms.begin_delete( + resource_group_name=resource_group.name, + vm_scale_set_name="str", + instance_id="str", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_virtual_machine_scale_set_vms_list(self, resource_group): + response = self.client.virtual_machine_scale_set_vms.list( + resource_group_name=resource_group.name, + virtual_machine_scale_set_name="str", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_virtual_machine_scale_set_vms_begin_approve_rolling_upgrade(self, resource_group): + response = await ( + await self.client.virtual_machine_scale_set_vms.begin_approve_rolling_upgrade( + resource_group_name=resource_group.name, + vm_scale_set_name="str", + instance_id="str", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_virtual_machine_scale_set_vms_begin_deallocate(self, resource_group): + response = await ( + await self.client.virtual_machine_scale_set_vms.begin_deallocate( + resource_group_name=resource_group.name, + vm_scale_set_name="str", + instance_id="str", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_virtual_machine_scale_set_vms_get_instance_view(self, resource_group): + response = await self.client.virtual_machine_scale_set_vms.get_instance_view( + resource_group_name=resource_group.name, + vm_scale_set_name="str", + instance_id="str", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_virtual_machine_scale_set_vms_begin_reimage(self, resource_group): + response = await ( + await self.client.virtual_machine_scale_set_vms.begin_reimage( + resource_group_name=resource_group.name, + vm_scale_set_name="str", + instance_id="str", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_virtual_machine_scale_set_vms_begin_reimage_all(self, resource_group): + response = await ( + await self.client.virtual_machine_scale_set_vms.begin_reimage_all( + resource_group_name=resource_group.name, + vm_scale_set_name="str", + instance_id="str", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_virtual_machine_scale_set_vms_simulate_eviction(self, resource_group): + response = await self.client.virtual_machine_scale_set_vms.simulate_eviction( + resource_group_name=resource_group.name, + vm_scale_set_name="str", + instance_id="str", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_virtual_machine_scale_set_vms_begin_attach_detach_data_disks(self, resource_group): + response = await ( + await self.client.virtual_machine_scale_set_vms.begin_attach_detach_data_disks( + resource_group_name=resource_group.name, + vm_scale_set_name="str", + instance_id="str", + body={ + "dataDisksToAttach": [ + { + "diskId": "str", + "caching": "str", + "deleteOption": "str", + "diskEncryptionSet": {"id": "str"}, + "lun": 0, + "writeAcceleratorEnabled": bool, + } + ], + "dataDisksToDetach": [{"diskId": "str", "detachOption": "str"}], + }, + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_virtual_machine_scale_set_vms_begin_perform_maintenance(self, resource_group): + response = await ( + await self.client.virtual_machine_scale_set_vms.begin_perform_maintenance( + resource_group_name=resource_group.name, + vm_scale_set_name="str", + instance_id="str", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_virtual_machine_scale_set_vms_begin_power_off(self, resource_group): + response = await ( + await self.client.virtual_machine_scale_set_vms.begin_power_off( + resource_group_name=resource_group.name, + vm_scale_set_name="str", + instance_id="str", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_virtual_machine_scale_set_vms_begin_redeploy(self, resource_group): + response = await ( + await self.client.virtual_machine_scale_set_vms.begin_redeploy( + resource_group_name=resource_group.name, + vm_scale_set_name="str", + instance_id="str", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_virtual_machine_scale_set_vms_begin_restart(self, resource_group): + response = await ( + await self.client.virtual_machine_scale_set_vms.begin_restart( + resource_group_name=resource_group.name, + vm_scale_set_name="str", + instance_id="str", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_virtual_machine_scale_set_vms_retrieve_boot_diagnostics_data(self, resource_group): + response = await self.client.virtual_machine_scale_set_vms.retrieve_boot_diagnostics_data( + resource_group_name=resource_group.name, + vm_scale_set_name="str", + instance_id="str", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_virtual_machine_scale_set_vms_begin_start(self, resource_group): + response = await ( + await self.client.virtual_machine_scale_set_vms.begin_start( + resource_group_name=resource_group.name, + vm_scale_set_name="str", + instance_id="str", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_virtual_machine_scale_set_vms_begin_run_command(self, resource_group): + response = await ( + await self.client.virtual_machine_scale_set_vms.begin_run_command( + resource_group_name=resource_group.name, + vm_scale_set_name="str", + instance_id="str", + body={"commandId": "str", "parameters": [{"name": "str", "value": "str"}], "script": ["str"]}, + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machine_scale_sets_operation_group_operations.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machine_scale_sets_operation_group_operations.py new file mode 100644 index 000000000000..dc9a5882e001 --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machine_scale_sets_operation_group_operations.py @@ -0,0 +1,29 @@ +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.compute import ComputeClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestComputeVirtualMachineScaleSetsOperationGroupOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ComputeClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_virtual_machine_scale_sets_operation_group_list_by_location(self, resource_group): + response = self.client.virtual_machine_scale_sets_operation_group.list_by_location( + location="str", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machine_scale_sets_operation_group_operations_async.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machine_scale_sets_operation_group_operations_async.py new file mode 100644 index 000000000000..4b8dcb689f14 --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machine_scale_sets_operation_group_operations_async.py @@ -0,0 +1,30 @@ +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.compute.aio import ComputeClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestComputeVirtualMachineScaleSetsOperationGroupOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ComputeClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_virtual_machine_scale_sets_operation_group_list_by_location(self, resource_group): + response = self.client.virtual_machine_scale_sets_operation_group.list_by_location( + location="str", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_virtual_machine_scale_sets_operations_async.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machine_scale_sets_operations.py similarity index 63% rename from sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_virtual_machine_scale_sets_operations_async.py rename to sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machine_scale_sets_operations.py index 55ed2eaf8cfe..c1a551c31a9f 100644 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_virtual_machine_scale_sets_operations_async.py +++ b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machine_scale_sets_operations.py @@ -2,96 +2,62 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.compute.aio import ComputeManagementClient +from azure.mgmt.compute import ComputeClient -from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer -from devtools_testutils.aio import recorded_by_proxy_async +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy AZURE_LOCATION = "eastus" @pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestComputeManagementVirtualMachineScaleSetsOperationsAsync(AzureMgmtRecordedTestCase): +class TestComputeVirtualMachineScaleSetsOperations(AzureMgmtRecordedTestCase): def setup_method(self, method): - self.client = self.create_mgmt_client(ComputeManagementClient, is_async=True) + self.client = self.create_mgmt_client(ComputeClient) @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_virtual_machine_scale_sets_list_by_location(self, resource_group): - response = self.client.virtual_machine_scale_sets.list_by_location( - location="str", - api_version="2025-04-01", - ) - result = [r async for r in response] - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_virtual_machine_scale_sets_list_all(self, resource_group): - response = self.client.virtual_machine_scale_sets.list_all( - api_version="2025-04-01", - ) - result = [r async for r in response] - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_virtual_machine_scale_sets_list(self, resource_group): - response = self.client.virtual_machine_scale_sets.list( - resource_group_name=resource_group.name, - api_version="2025-04-01", - ) - result = [r async for r in response] - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_virtual_machine_scale_sets_get(self, resource_group): - response = await self.client.virtual_machine_scale_sets.get( + @recorded_by_proxy + def test_virtual_machine_scale_sets_get(self, resource_group): + response = self.client.virtual_machine_scale_sets.get( resource_group_name=resource_group.name, vm_scale_set_name="str", - api_version="2025-04-01", ) # please add some check logic here by yourself # ... @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_virtual_machine_scale_sets_begin_create_or_update(self, resource_group): - response = await ( - await self.client.virtual_machine_scale_sets.begin_create_or_update( - resource_group_name=resource_group.name, - vm_scale_set_name="str", - parameters={ - "location": "str", + @recorded_by_proxy + def test_virtual_machine_scale_sets_begin_create_or_update(self, resource_group): + response = self.client.virtual_machine_scale_sets.begin_create_or_update( + resource_group_name=resource_group.name, + vm_scale_set_name="str", + resource={ + "location": "str", + "etag": "str", + "extendedLocation": {"name": "str", "type": "str"}, + "id": "str", + "identity": { + "principalId": "str", + "tenantId": "str", + "type": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, + "name": "str", + "placement": {"excludeZones": ["str"], "includeZones": ["str"], "zonePlacementPolicy": "str"}, + "plan": {"name": "str", "product": "str", "promotionCode": "str", "publisher": "str"}, + "properties": { "additionalCapabilities": {"hibernationEnabled": bool, "ultraSSDEnabled": bool}, "automaticRepairsPolicy": {"enabled": bool, "gracePeriod": "str", "repairAction": "str"}, "constrainedMaximumCapacity": bool, "doNotRunExtensionsOnOverprovisionedVMs": bool, - "etag": "str", - "extendedLocation": {"name": "str", "type": "str"}, "highSpeedInterconnectPlacement": "str", "hostGroup": {"id": "str"}, - "id": "str", - "identity": { - "principalId": "str", - "tenantId": "str", - "type": "str", - "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, - }, - "name": "str", "orchestrationMode": "str", "overprovision": bool, - "placement": {"excludeZones": ["str"], "includeZones": ["str"], "zonePlacementPolicy": "str"}, - "plan": {"name": "str", "product": "str", "promotionCode": "str", "publisher": "str"}, "platformFaultDomainCount": 0, "priorityMixPolicy": {"baseRegularPriorityCount": 0, "regularPriorityPercentageAboveBase": 0}, "provisioningState": "str", @@ -119,20 +85,9 @@ async def test_virtual_machine_scale_sets_begin_create_or_update(self, resource_ "userInitiatedRedeploy": {"automaticallyApprove": bool}, }, "singlePlacementGroup": bool, - "sku": {"capacity": 0, "name": "str", "tier": "str"}, "skuProfile": {"allocationStrategy": "str", "vmSizes": [{"name": "str", "rank": 0}]}, "spotRestorePolicy": {"enabled": bool, "restoreTimeout": "str"}, - "systemData": { - "createdAt": "2020-02-20 00:00:00", - "createdBy": "str", - "createdByType": "str", - "lastModifiedAt": "2020-02-20 00:00:00", - "lastModifiedBy": "str", - "lastModifiedByType": "str", - }, - "tags": {"str": "str"}, "timeCreated": "2020-02-20 00:00:00", - "type": "str", "uniqueId": "str", "upgradePolicy": { "automaticOSUpgradePolicy": { @@ -173,20 +128,26 @@ async def test_virtual_machine_scale_sets_begin_create_or_update(self, resource_ "extensionProfile": { "extensions": [ { - "autoUpgradeMinorVersion": bool, - "enableAutomaticUpgrade": bool, - "forceUpdateTag": "str", "id": "str", "name": "str", - "protectedSettings": {}, - "protectedSettingsFromKeyVault": {"secretUrl": "str", "sourceVault": {"id": "str"}}, - "provisionAfterExtensions": ["str"], - "provisioningState": "str", - "publisher": "str", - "settings": {}, - "suppressFailures": bool, + "properties": { + "autoUpgradeMinorVersion": bool, + "enableAutomaticUpgrade": bool, + "forceUpdateTag": "str", + "protectedSettings": {}, + "protectedSettingsFromKeyVault": { + "secretUrl": "str", + "sourceVault": {"id": "str"}, + }, + "provisionAfterExtensions": ["str"], + "provisioningState": "str", + "publisher": "str", + "settings": {}, + "suppressFailures": bool, + "type": "str", + "typeHandlerVersion": "str", + }, "type": "str", - "typeHandlerVersion": "str", } ], "extensionsTimeBudget": "str", @@ -199,42 +160,48 @@ async def test_virtual_machine_scale_sets_begin_create_or_update(self, resource_ "networkInterfaceConfigurations": [ { "name": "str", - "auxiliaryMode": "str", - "auxiliarySku": "str", - "deleteOption": "str", - "disableTcpStateTracking": bool, - "dnsSettings": {"dnsServers": ["str"]}, - "enableAcceleratedNetworking": bool, - "enableFpga": bool, - "enableIPForwarding": bool, - "ipConfigurations": [ - { - "name": "str", - "applicationGatewayBackendAddressPools": [{"id": "str"}], - "applicationSecurityGroups": [{"id": "str"}], - "loadBalancerBackendAddressPools": [{"id": "str"}], - "loadBalancerInboundNatPools": [{"id": "str"}], - "primary": bool, - "privateIPAddressVersion": "str", - "publicIPAddressConfiguration": { + "properties": { + "ipConfigurations": [ + { "name": "str", - "deleteOption": "str", - "dnsSettings": { - "domainNameLabel": "str", - "domainNameLabelScope": "str", + "properties": { + "applicationGatewayBackendAddressPools": [{"id": "str"}], + "applicationSecurityGroups": [{"id": "str"}], + "loadBalancerBackendAddressPools": [{"id": "str"}], + "loadBalancerInboundNatPools": [{"id": "str"}], + "primary": bool, + "privateIPAddressVersion": "str", + "publicIPAddressConfiguration": { + "name": "str", + "properties": { + "deleteOption": "str", + "dnsSettings": { + "domainNameLabel": "str", + "domainNameLabelScope": "str", + }, + "idleTimeoutInMinutes": 0, + "ipTags": [{"ipTagType": "str", "tag": "str"}], + "publicIPAddressVersion": "str", + "publicIPPrefix": {"id": "str"}, + }, + "sku": {"name": "str", "tier": "str"}, + "tags": {"str": "str"}, + }, + "subnet": {"id": "str"}, }, - "idleTimeoutInMinutes": 0, - "ipTags": [{"ipTagType": "str", "tag": "str"}], - "publicIPAddressVersion": "str", - "publicIPPrefix": {"id": "str"}, - "sku": {"name": "str", "tier": "str"}, - "tags": {"str": "str"}, - }, - "subnet": {"id": "str"}, - } - ], - "networkSecurityGroup": {"id": "str"}, - "primary": bool, + } + ], + "auxiliaryMode": "str", + "auxiliarySku": "str", + "deleteOption": "str", + "disableTcpStateTracking": bool, + "dnsSettings": {"dnsServers": ["str"]}, + "enableAcceleratedNetworking": bool, + "enableFpga": bool, + "enableIPForwarding": bool, + "networkSecurityGroup": {"id": "str"}, + "primary": bool, + }, "tags": {"str": "str"}, } ], @@ -271,7 +238,7 @@ async def test_virtual_machine_scale_sets_begin_create_or_update(self, resource_ { "componentName": "Microsoft-Windows-Shell-Setup", "content": "str", - "passName": "OobeSystem", + "passName": "str", "settingName": "str", } ], @@ -371,34 +338,44 @@ async def test_virtual_machine_scale_sets_begin_create_or_update(self, resource_ }, "zonalPlatformFaultDomainAlignMode": "str", "zoneBalance": bool, - "zones": ["str"], }, - api_version="2025-04-01", - ) + "sku": {"capacity": 0, "name": "str", "tier": "str"}, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "tags": {"str": "str"}, + "type": "str", + "zones": ["str"], + }, ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself # ... @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_virtual_machine_scale_sets_begin_update(self, resource_group): - response = await ( - await self.client.virtual_machine_scale_sets.begin_update( - resource_group_name=resource_group.name, - vm_scale_set_name="str", - parameters={ + @recorded_by_proxy + def test_virtual_machine_scale_sets_begin_update(self, resource_group): + response = self.client.virtual_machine_scale_sets.begin_update( + resource_group_name=resource_group.name, + vm_scale_set_name="str", + properties={ + "identity": { + "principalId": "str", + "tenantId": "str", + "type": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, + "plan": {"name": "str", "product": "str", "promotionCode": "str", "publisher": "str"}, + "properties": { "additionalCapabilities": {"hibernationEnabled": bool, "ultraSSDEnabled": bool}, "automaticRepairsPolicy": {"enabled": bool, "gracePeriod": "str", "repairAction": "str"}, "doNotRunExtensionsOnOverprovisionedVMs": bool, - "identity": { - "principalId": "str", - "tenantId": "str", - "type": "str", - "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, - }, "overprovision": bool, - "plan": {"name": "str", "product": "str", "promotionCode": "str", "publisher": "str"}, "priorityMixPolicy": {"baseRegularPriorityCount": 0, "regularPriorityPercentageAboveBase": 0}, "proximityPlacementGroup": {"id": "str"}, "resiliencyPolicy": { @@ -416,10 +393,8 @@ async def test_virtual_machine_scale_sets_begin_update(self, resource_group): }, "scaleInPolicy": {"forceDeletion": bool, "prioritizeUnhealthyVMs": bool, "rules": ["str"]}, "singlePlacementGroup": bool, - "sku": {"capacity": 0, "name": "str", "tier": "str"}, "skuProfile": {"allocationStrategy": "str", "vmSizes": [{"name": "str", "rank": 0}]}, "spotRestorePolicy": {"enabled": bool, "restoreTimeout": "str"}, - "tags": {"str": "str"}, "upgradePolicy": { "automaticOSUpgradePolicy": { "disableAutomaticRollback": bool, @@ -445,20 +420,26 @@ async def test_virtual_machine_scale_sets_begin_update(self, resource_group): "extensionProfile": { "extensions": [ { - "autoUpgradeMinorVersion": bool, - "enableAutomaticUpgrade": bool, - "forceUpdateTag": "str", "id": "str", "name": "str", - "protectedSettings": {}, - "protectedSettingsFromKeyVault": {"secretUrl": "str", "sourceVault": {"id": "str"}}, - "provisionAfterExtensions": ["str"], - "provisioningState": "str", - "publisher": "str", - "settings": {}, - "suppressFailures": bool, + "properties": { + "autoUpgradeMinorVersion": bool, + "enableAutomaticUpgrade": bool, + "forceUpdateTag": "str", + "protectedSettings": {}, + "protectedSettingsFromKeyVault": { + "secretUrl": "str", + "sourceVault": {"id": "str"}, + }, + "provisionAfterExtensions": ["str"], + "provisioningState": "str", + "publisher": "str", + "settings": {}, + "suppressFailures": bool, + "type": "str", + "typeHandlerVersion": "str", + }, "type": "str", - "typeHandlerVersion": "str", } ], "extensionsTimeBudget": "str", @@ -470,40 +451,46 @@ async def test_virtual_machine_scale_sets_begin_update(self, resource_group): "networkApiVersion": "str", "networkInterfaceConfigurations": [ { - "auxiliaryMode": "str", - "auxiliarySku": "str", - "deleteOption": "str", - "disableTcpStateTracking": bool, - "dnsSettings": {"dnsServers": ["str"]}, - "enableAcceleratedNetworking": bool, - "enableFpga": bool, - "enableIPForwarding": bool, - "ipConfigurations": [ - { - "applicationGatewayBackendAddressPools": [{"id": "str"}], - "applicationSecurityGroups": [{"id": "str"}], - "loadBalancerBackendAddressPools": [{"id": "str"}], - "loadBalancerInboundNatPools": [{"id": "str"}], - "name": "str", - "primary": bool, - "privateIPAddressVersion": "str", - "publicIPAddressConfiguration": { - "deleteOption": "str", - "dnsSettings": { - "domainNameLabel": "str", - "domainNameLabelScope": "str", - }, - "idleTimeoutInMinutes": 0, - "name": "str", - "publicIPPrefix": {"id": "str"}, - "tags": {"str": "str"}, - }, - "subnet": {"id": "str"}, - } - ], "name": "str", - "networkSecurityGroup": {"id": "str"}, - "primary": bool, + "properties": { + "auxiliaryMode": "str", + "auxiliarySku": "str", + "deleteOption": "str", + "disableTcpStateTracking": bool, + "dnsSettings": {"dnsServers": ["str"]}, + "enableAcceleratedNetworking": bool, + "enableFpga": bool, + "enableIPForwarding": bool, + "ipConfigurations": [ + { + "name": "str", + "properties": { + "applicationGatewayBackendAddressPools": [{"id": "str"}], + "applicationSecurityGroups": [{"id": "str"}], + "loadBalancerBackendAddressPools": [{"id": "str"}], + "loadBalancerInboundNatPools": [{"id": "str"}], + "primary": bool, + "privateIPAddressVersion": "str", + "publicIPAddressConfiguration": { + "name": "str", + "properties": { + "deleteOption": "str", + "dnsSettings": { + "domainNameLabel": "str", + "domainNameLabelScope": "str", + }, + "idleTimeoutInMinutes": 0, + "publicIPPrefix": {"id": "str"}, + }, + "tags": {"str": "str"}, + }, + "subnet": {"id": "str"}, + }, + } + ], + "networkSecurityGroup": {"id": "str"}, + "primary": bool, + }, "tags": {"str": "str"}, } ], @@ -535,7 +522,7 @@ async def test_virtual_machine_scale_sets_begin_update(self, resource_group): { "componentName": "Microsoft-Windows-Shell-Setup", "content": "str", - "passName": "OobeSystem", + "passName": "str", "settingName": "str", } ], @@ -628,290 +615,288 @@ async def test_virtual_machine_scale_sets_begin_update(self, resource_group): "userData": "str", }, "zonalPlatformFaultDomainAlignMode": "str", - "zones": ["str"], }, - api_version="2025-04-01", - ) + "sku": {"capacity": 0, "name": "str", "tier": "str"}, + "tags": {"str": "str"}, + "zones": ["str"], + }, ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself # ... @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_virtual_machine_scale_sets_begin_delete(self, resource_group): - response = await ( - await self.client.virtual_machine_scale_sets.begin_delete( - resource_group_name=resource_group.name, - vm_scale_set_name="str", - api_version="2025-04-01", - ) + @recorded_by_proxy + def test_virtual_machine_scale_sets_begin_delete(self, resource_group): + response = self.client.virtual_machine_scale_sets.begin_delete( + resource_group_name=resource_group.name, + vm_scale_set_name="str", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself # ... @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_virtual_machine_scale_sets_begin_approve_rolling_upgrade(self, resource_group): - response = await ( - await self.client.virtual_machine_scale_sets.begin_approve_rolling_upgrade( - resource_group_name=resource_group.name, - vm_scale_set_name="str", - api_version="2025-04-01", - ) + @recorded_by_proxy + def test_virtual_machine_scale_sets_list(self, resource_group): + response = self.client.virtual_machine_scale_sets.list( + resource_group_name=resource_group.name, + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_virtual_machine_scale_sets_list_all(self, resource_group): + response = self.client.virtual_machine_scale_sets.list_all() + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_virtual_machine_scale_sets_begin_approve_rolling_upgrade(self, resource_group): + response = self.client.virtual_machine_scale_sets.begin_approve_rolling_upgrade( + resource_group_name=resource_group.name, + vm_scale_set_name="str", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself # ... @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_virtual_machine_scale_sets_convert_to_single_placement_group(self, resource_group): - response = await self.client.virtual_machine_scale_sets.convert_to_single_placement_group( + @recorded_by_proxy + def test_virtual_machine_scale_sets_convert_to_single_placement_group(self, resource_group): + response = self.client.virtual_machine_scale_sets.convert_to_single_placement_group( resource_group_name=resource_group.name, vm_scale_set_name="str", - parameters={"activePlacementGroupId": "str"}, - api_version="2025-04-01", + body={"activePlacementGroupId": "str"}, ) # please add some check logic here by yourself # ... @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_virtual_machine_scale_sets_begin_deallocate(self, resource_group): - response = await ( - await self.client.virtual_machine_scale_sets.begin_deallocate( - resource_group_name=resource_group.name, - vm_scale_set_name="str", - api_version="2025-04-01", - ) + @recorded_by_proxy + def test_virtual_machine_scale_sets_begin_deallocate(self, resource_group): + response = self.client.virtual_machine_scale_sets.begin_deallocate( + resource_group_name=resource_group.name, + vm_scale_set_name="str", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself # ... @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_virtual_machine_scale_sets_begin_delete_instances(self, resource_group): - response = await ( - await self.client.virtual_machine_scale_sets.begin_delete_instances( - resource_group_name=resource_group.name, - vm_scale_set_name="str", - vm_instance_i_ds={"instanceIds": ["str"]}, - api_version="2025-04-01", - ) + @recorded_by_proxy + def test_virtual_machine_scale_sets_begin_delete_instances(self, resource_group): + response = self.client.virtual_machine_scale_sets.begin_delete_instances( + resource_group_name=resource_group.name, + vm_scale_set_name="str", + body={"instanceIds": ["str"]}, ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself # ... @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_virtual_machine_scale_sets_force_recovery_service_fabric_platform_update_domain_walk( - self, resource_group - ): - response = ( - await self.client.virtual_machine_scale_sets.force_recovery_service_fabric_platform_update_domain_walk( - resource_group_name=resource_group.name, - vm_scale_set_name="str", - platform_update_domain=0, - api_version="2025-04-01", - ) + @recorded_by_proxy + def test_virtual_machine_scale_sets_force_recovery_service_fabric_platform_update_domain_walk(self, resource_group): + response = self.client.virtual_machine_scale_sets.force_recovery_service_fabric_platform_update_domain_walk( + resource_group_name=resource_group.name, + vm_scale_set_name="str", + platform_update_domain=0, ) # please add some check logic here by yourself # ... @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_virtual_machine_scale_sets_get_instance_view(self, resource_group): - response = await self.client.virtual_machine_scale_sets.get_instance_view( + @recorded_by_proxy + def test_virtual_machine_scale_sets_get_instance_view(self, resource_group): + response = self.client.virtual_machine_scale_sets.get_instance_view( resource_group_name=resource_group.name, vm_scale_set_name="str", - api_version="2025-04-01", ) # please add some check logic here by yourself # ... @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_virtual_machine_scale_sets_begin_update_instances(self, resource_group): - response = await ( - await self.client.virtual_machine_scale_sets.begin_update_instances( - resource_group_name=resource_group.name, - vm_scale_set_name="str", - vm_instance_i_ds={"instanceIds": ["str"]}, - api_version="2025-04-01", - ) + @recorded_by_proxy + def test_virtual_machine_scale_sets_begin_update_instances(self, resource_group): + response = self.client.virtual_machine_scale_sets.begin_update_instances( + resource_group_name=resource_group.name, + vm_scale_set_name="str", + body={"instanceIds": ["str"]}, ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself # ... @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_virtual_machine_scale_sets_get_os_upgrade_history(self, resource_group): + @recorded_by_proxy + def test_virtual_machine_scale_sets_get_os_upgrade_history(self, resource_group): response = self.client.virtual_machine_scale_sets.get_os_upgrade_history( resource_group_name=resource_group.name, vm_scale_set_name="str", - api_version="2025-04-01", ) - result = [r async for r in response] + result = [r for r in response] # please add some check logic here by yourself # ... @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_virtual_machine_scale_sets_begin_perform_maintenance(self, resource_group): - response = await ( - await self.client.virtual_machine_scale_sets.begin_perform_maintenance( - resource_group_name=resource_group.name, - vm_scale_set_name="str", - api_version="2025-04-01", - ) + @recorded_by_proxy + def test_virtual_machine_scale_sets_begin_perform_maintenance(self, resource_group): + response = self.client.virtual_machine_scale_sets.begin_perform_maintenance( + resource_group_name=resource_group.name, + vm_scale_set_name="str", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself # ... @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_virtual_machine_scale_sets_begin_power_off(self, resource_group): - response = await ( - await self.client.virtual_machine_scale_sets.begin_power_off( - resource_group_name=resource_group.name, - vm_scale_set_name="str", - api_version="2025-04-01", - ) + @recorded_by_proxy + def test_virtual_machine_scale_sets_begin_power_off(self, resource_group): + response = self.client.virtual_machine_scale_sets.begin_power_off( + resource_group_name=resource_group.name, + vm_scale_set_name="str", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself # ... @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_virtual_machine_scale_sets_begin_reapply(self, resource_group): - response = await ( - await self.client.virtual_machine_scale_sets.begin_reapply( - resource_group_name=resource_group.name, - vm_scale_set_name="str", - api_version="2025-04-01", - ) + @recorded_by_proxy + def test_virtual_machine_scale_sets_begin_reapply(self, resource_group): + response = self.client.virtual_machine_scale_sets.begin_reapply( + resource_group_name=resource_group.name, + vm_scale_set_name="str", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself # ... @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_virtual_machine_scale_sets_begin_redeploy(self, resource_group): - response = await ( - await self.client.virtual_machine_scale_sets.begin_redeploy( - resource_group_name=resource_group.name, - vm_scale_set_name="str", - api_version="2025-04-01", - ) + @recorded_by_proxy + def test_virtual_machine_scale_sets_begin_redeploy(self, resource_group): + response = self.client.virtual_machine_scale_sets.begin_redeploy( + resource_group_name=resource_group.name, + vm_scale_set_name="str", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself # ... @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_virtual_machine_scale_sets_begin_reimage(self, resource_group): - response = await ( - await self.client.virtual_machine_scale_sets.begin_reimage( - resource_group_name=resource_group.name, - vm_scale_set_name="str", - api_version="2025-04-01", - ) + @recorded_by_proxy + def test_virtual_machine_scale_sets_begin_reimage(self, resource_group): + response = self.client.virtual_machine_scale_sets.begin_reimage( + resource_group_name=resource_group.name, + vm_scale_set_name="str", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself # ... @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_virtual_machine_scale_sets_begin_reimage_all(self, resource_group): - response = await ( - await self.client.virtual_machine_scale_sets.begin_reimage_all( - resource_group_name=resource_group.name, - vm_scale_set_name="str", - api_version="2025-04-01", - ) + @recorded_by_proxy + def test_virtual_machine_scale_sets_begin_reimage_all(self, resource_group): + response = self.client.virtual_machine_scale_sets.begin_reimage_all( + resource_group_name=resource_group.name, + vm_scale_set_name="str", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself # ... @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_virtual_machine_scale_sets_begin_restart(self, resource_group): - response = await ( - await self.client.virtual_machine_scale_sets.begin_restart( - resource_group_name=resource_group.name, - vm_scale_set_name="str", - api_version="2025-04-01", - ) + @recorded_by_proxy + def test_virtual_machine_scale_sets_begin_restart(self, resource_group): + response = self.client.virtual_machine_scale_sets.begin_restart( + resource_group_name=resource_group.name, + vm_scale_set_name="str", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself # ... @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_virtual_machine_scale_sets_begin_scale_out(self, resource_group): - response = await ( - await self.client.virtual_machine_scale_sets.begin_scale_out( - resource_group_name=resource_group.name, - vm_scale_set_name="str", - parameters={"capacity": 0, "properties": {"zone": "str"}}, - api_version="2025-04-01", - ) + @recorded_by_proxy + def test_virtual_machine_scale_sets_begin_set_orchestration_service_state(self, resource_group): + response = self.client.virtual_machine_scale_sets.begin_set_orchestration_service_state( + resource_group_name=resource_group.name, + vm_scale_set_name="str", + body={"action": "str", "serviceName": "str"}, ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself # ... @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_virtual_machine_scale_sets_begin_set_orchestration_service_state(self, resource_group): - response = await ( - await self.client.virtual_machine_scale_sets.begin_set_orchestration_service_state( - resource_group_name=resource_group.name, - vm_scale_set_name="str", - parameters={"action": "str", "serviceName": "str"}, - api_version="2025-04-01", - ) + @recorded_by_proxy + def test_virtual_machine_scale_sets_list_skus(self, resource_group): + response = self.client.virtual_machine_scale_sets.list_skus( + resource_group_name=resource_group.name, + vm_scale_set_name="str", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_virtual_machine_scale_sets_begin_start(self, resource_group): + response = self.client.virtual_machine_scale_sets.begin_start( + resource_group_name=resource_group.name, + vm_scale_set_name="str", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself # ... @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_virtual_machine_scale_sets_list_skus(self, resource_group): - response = self.client.virtual_machine_scale_sets.list_skus( + @recorded_by_proxy + def test_virtual_machine_scale_sets_begin_start_extension_upgrade(self, resource_group): + response = self.client.virtual_machine_scale_sets.begin_start_extension_upgrade( resource_group_name=resource_group.name, vm_scale_set_name="str", - api_version="2025-04-01", - ) - result = [r async for r in response] + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_virtual_machine_scale_sets_begin_start_os_upgrade(self, resource_group): + response = self.client.virtual_machine_scale_sets.begin_start_os_upgrade( + resource_group_name=resource_group.name, + vm_scale_set_name="str", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_virtual_machine_scale_sets_begin_cancel(self, resource_group): + response = self.client.virtual_machine_scale_sets.begin_cancel( + resource_group_name=resource_group.name, + vm_scale_set_name="str", + ).result() # call '.result()' to poll until service return final result + # please add some check logic here by yourself # ... @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_virtual_machine_scale_sets_begin_start(self, resource_group): - response = await ( - await self.client.virtual_machine_scale_sets.begin_start( - resource_group_name=resource_group.name, - vm_scale_set_name="str", - api_version="2025-04-01", - ) + @recorded_by_proxy + def test_virtual_machine_scale_sets_begin_scale_out(self, resource_group): + response = self.client.virtual_machine_scale_sets.begin_scale_out( + resource_group_name=resource_group.name, + vm_scale_set_name="str", + body={"capacity": 0, "properties": {"zone": "str"}}, ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machine_scale_sets_operations_async.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machine_scale_sets_operations_async.py new file mode 100644 index 000000000000..fab13dde8c52 --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machine_scale_sets_operations_async.py @@ -0,0 +1,956 @@ +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.compute.aio import ComputeClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestComputeVirtualMachineScaleSetsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ComputeClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_virtual_machine_scale_sets_get(self, resource_group): + response = await self.client.virtual_machine_scale_sets.get( + resource_group_name=resource_group.name, + vm_scale_set_name="str", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_virtual_machine_scale_sets_begin_create_or_update(self, resource_group): + response = await ( + await self.client.virtual_machine_scale_sets.begin_create_or_update( + resource_group_name=resource_group.name, + vm_scale_set_name="str", + resource={ + "location": "str", + "etag": "str", + "extendedLocation": {"name": "str", "type": "str"}, + "id": "str", + "identity": { + "principalId": "str", + "tenantId": "str", + "type": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, + "name": "str", + "placement": {"excludeZones": ["str"], "includeZones": ["str"], "zonePlacementPolicy": "str"}, + "plan": {"name": "str", "product": "str", "promotionCode": "str", "publisher": "str"}, + "properties": { + "additionalCapabilities": {"hibernationEnabled": bool, "ultraSSDEnabled": bool}, + "automaticRepairsPolicy": {"enabled": bool, "gracePeriod": "str", "repairAction": "str"}, + "constrainedMaximumCapacity": bool, + "doNotRunExtensionsOnOverprovisionedVMs": bool, + "highSpeedInterconnectPlacement": "str", + "hostGroup": {"id": "str"}, + "orchestrationMode": "str", + "overprovision": bool, + "platformFaultDomainCount": 0, + "priorityMixPolicy": {"baseRegularPriorityCount": 0, "regularPriorityPercentageAboveBase": 0}, + "provisioningState": "str", + "proximityPlacementGroup": {"id": "str"}, + "resiliencyPolicy": { + "automaticZoneRebalancingPolicy": { + "enabled": bool, + "rebalanceBehavior": "str", + "rebalanceStrategy": "str", + }, + "resilientVMCreationPolicy": {"enabled": bool}, + "resilientVMDeletionPolicy": {"enabled": bool}, + "zoneAllocationPolicy": { + "maxInstancePercentPerZonePolicy": {"enabled": bool, "value": 0}, + "maxZoneCount": 0, + }, + }, + "scaleInPolicy": {"forceDeletion": bool, "prioritizeUnhealthyVMs": bool, "rules": ["str"]}, + "scheduledEventsPolicy": { + "allInstancesDown": {"automaticallyApprove": bool}, + "scheduledEventsAdditionalPublishingTargets": { + "eventGridAndResourceGraph": {"enable": bool, "scheduledEventsApiVersion": "str"} + }, + "userInitiatedReboot": {"automaticallyApprove": bool}, + "userInitiatedRedeploy": {"automaticallyApprove": bool}, + }, + "singlePlacementGroup": bool, + "skuProfile": {"allocationStrategy": "str", "vmSizes": [{"name": "str", "rank": 0}]}, + "spotRestorePolicy": {"enabled": bool, "restoreTimeout": "str"}, + "timeCreated": "2020-02-20 00:00:00", + "uniqueId": "str", + "upgradePolicy": { + "automaticOSUpgradePolicy": { + "disableAutomaticRollback": bool, + "enableAutomaticOSUpgrade": bool, + "osRollingUpgradeDeferral": bool, + "useRollingUpgradePolicy": bool, + }, + "mode": "str", + "rollingUpgradePolicy": { + "enableCrossZoneUpgrade": bool, + "maxBatchInstancePercent": 0, + "maxSurge": bool, + "maxUnhealthyInstancePercent": 0, + "maxUnhealthyUpgradedInstancePercent": 0, + "pauseTimeBetweenBatches": "str", + "prioritizeUnhealthyInstances": bool, + "rollbackFailedInstancesOnPolicyBreach": bool, + }, + }, + "virtualMachineProfile": { + "applicationProfile": { + "galleryApplications": [ + { + "packageReferenceId": "str", + "configurationReference": "str", + "enableAutomaticUpgrade": bool, + "order": 0, + "tags": "str", + "treatFailureAsDeploymentFailure": bool, + } + ] + }, + "billingProfile": {"maxPrice": 0.0}, + "capacityReservation": {"capacityReservationGroup": {"id": "str"}}, + "diagnosticsProfile": {"bootDiagnostics": {"enabled": bool, "storageUri": "str"}}, + "evictionPolicy": "str", + "extensionProfile": { + "extensions": [ + { + "id": "str", + "name": "str", + "properties": { + "autoUpgradeMinorVersion": bool, + "enableAutomaticUpgrade": bool, + "forceUpdateTag": "str", + "protectedSettings": {}, + "protectedSettingsFromKeyVault": { + "secretUrl": "str", + "sourceVault": {"id": "str"}, + }, + "provisionAfterExtensions": ["str"], + "provisioningState": "str", + "publisher": "str", + "settings": {}, + "suppressFailures": bool, + "type": "str", + "typeHandlerVersion": "str", + }, + "type": "str", + } + ], + "extensionsTimeBudget": "str", + }, + "hardwareProfile": {"vmSizeProperties": {"vCPUsAvailable": 0, "vCPUsPerCore": 0}}, + "licenseType": "str", + "networkProfile": { + "healthProbe": {"id": "str"}, + "networkApiVersion": "str", + "networkInterfaceConfigurations": [ + { + "name": "str", + "properties": { + "ipConfigurations": [ + { + "name": "str", + "properties": { + "applicationGatewayBackendAddressPools": [{"id": "str"}], + "applicationSecurityGroups": [{"id": "str"}], + "loadBalancerBackendAddressPools": [{"id": "str"}], + "loadBalancerInboundNatPools": [{"id": "str"}], + "primary": bool, + "privateIPAddressVersion": "str", + "publicIPAddressConfiguration": { + "name": "str", + "properties": { + "deleteOption": "str", + "dnsSettings": { + "domainNameLabel": "str", + "domainNameLabelScope": "str", + }, + "idleTimeoutInMinutes": 0, + "ipTags": [{"ipTagType": "str", "tag": "str"}], + "publicIPAddressVersion": "str", + "publicIPPrefix": {"id": "str"}, + }, + "sku": {"name": "str", "tier": "str"}, + "tags": {"str": "str"}, + }, + "subnet": {"id": "str"}, + }, + } + ], + "auxiliaryMode": "str", + "auxiliarySku": "str", + "deleteOption": "str", + "disableTcpStateTracking": bool, + "dnsSettings": {"dnsServers": ["str"]}, + "enableAcceleratedNetworking": bool, + "enableFpga": bool, + "enableIPForwarding": bool, + "networkSecurityGroup": {"id": "str"}, + "primary": bool, + }, + "tags": {"str": "str"}, + } + ], + }, + "osProfile": { + "adminPassword": "str", + "adminUsername": "str", + "allowExtensionOperations": bool, + "computerNamePrefix": "str", + "customData": "str", + "linuxConfiguration": { + "disablePasswordAuthentication": bool, + "enableVMAgentPlatformUpdates": bool, + "patchSettings": { + "assessmentMode": "str", + "automaticByPlatformSettings": { + "bypassPlatformSafetyChecksOnUserSchedule": bool, + "rebootSetting": "str", + }, + "patchMode": "str", + }, + "provisionVMAgent": bool, + "ssh": {"publicKeys": [{"keyData": "str", "path": "str"}]}, + }, + "requireGuestProvisionSignal": bool, + "secrets": [ + { + "sourceVault": {"id": "str"}, + "vaultCertificates": [{"certificateStore": "str", "certificateUrl": "str"}], + } + ], + "windowsConfiguration": { + "additionalUnattendContent": [ + { + "componentName": "Microsoft-Windows-Shell-Setup", + "content": "str", + "passName": "str", + "settingName": "str", + } + ], + "enableAutomaticUpdates": bool, + "enableVMAgentPlatformUpdates": bool, + "patchSettings": { + "assessmentMode": "str", + "automaticByPlatformSettings": { + "bypassPlatformSafetyChecksOnUserSchedule": bool, + "rebootSetting": "str", + }, + "enableHotpatching": bool, + "patchMode": "str", + }, + "provisionVMAgent": bool, + "timeZone": "str", + "winRM": {"listeners": [{"certificateUrl": "str", "protocol": "str"}]}, + }, + }, + "priority": "str", + "scheduledEventsProfile": { + "osImageNotificationProfile": {"enable": bool, "notBeforeTimeout": "str"}, + "terminateNotificationProfile": {"enable": bool, "notBeforeTimeout": "str"}, + }, + "securityPostureReference": { + "id": "str", + "excludeExtensions": ["str"], + "isOverridable": bool, + }, + "securityProfile": { + "encryptionAtHost": bool, + "encryptionIdentity": {"userAssignedIdentityResourceId": "str"}, + "proxyAgentSettings": { + "addProxyAgentExtension": bool, + "enabled": bool, + "imds": {"inVMAccessControlProfileReferenceId": "str", "mode": "str"}, + "keyIncarnationId": 0, + "mode": "str", + "wireServer": {"inVMAccessControlProfileReferenceId": "str", "mode": "str"}, + }, + "securityType": "str", + "uefiSettings": {"secureBootEnabled": bool, "vTpmEnabled": bool}, + }, + "serviceArtifactReference": {"id": "str"}, + "storageProfile": { + "dataDisks": [ + { + "createOption": "str", + "lun": 0, + "caching": "str", + "deleteOption": "str", + "diskIOPSReadWrite": 0, + "diskMBpsReadWrite": 0, + "diskSizeGB": 0, + "managedDisk": { + "diskEncryptionSet": {"id": "str"}, + "securityProfile": { + "diskEncryptionSet": {"id": "str"}, + "securityEncryptionType": "str", + }, + "storageAccountType": "str", + }, + "name": "str", + "writeAcceleratorEnabled": bool, + } + ], + "diskControllerType": "str", + "imageReference": { + "communityGalleryImageId": "str", + "exactVersion": "str", + "id": "str", + "offer": "str", + "publisher": "str", + "sharedGalleryImageId": "str", + "sku": "str", + "version": "str", + }, + "osDisk": { + "createOption": "str", + "caching": "str", + "deleteOption": "str", + "diffDiskSettings": {"option": "str", "placement": "str"}, + "diskSizeGB": 0, + "image": {"uri": "str"}, + "managedDisk": { + "diskEncryptionSet": {"id": "str"}, + "securityProfile": { + "diskEncryptionSet": {"id": "str"}, + "securityEncryptionType": "str", + }, + "storageAccountType": "str", + }, + "name": "str", + "osType": "str", + "vhdContainers": ["str"], + "writeAcceleratorEnabled": bool, + }, + }, + "timeCreated": "2020-02-20 00:00:00", + "userData": "str", + }, + "zonalPlatformFaultDomainAlignMode": "str", + "zoneBalance": bool, + }, + "sku": {"capacity": 0, "name": "str", "tier": "str"}, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "tags": {"str": "str"}, + "type": "str", + "zones": ["str"], + }, + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_virtual_machine_scale_sets_begin_update(self, resource_group): + response = await ( + await self.client.virtual_machine_scale_sets.begin_update( + resource_group_name=resource_group.name, + vm_scale_set_name="str", + properties={ + "identity": { + "principalId": "str", + "tenantId": "str", + "type": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, + "plan": {"name": "str", "product": "str", "promotionCode": "str", "publisher": "str"}, + "properties": { + "additionalCapabilities": {"hibernationEnabled": bool, "ultraSSDEnabled": bool}, + "automaticRepairsPolicy": {"enabled": bool, "gracePeriod": "str", "repairAction": "str"}, + "doNotRunExtensionsOnOverprovisionedVMs": bool, + "overprovision": bool, + "priorityMixPolicy": {"baseRegularPriorityCount": 0, "regularPriorityPercentageAboveBase": 0}, + "proximityPlacementGroup": {"id": "str"}, + "resiliencyPolicy": { + "automaticZoneRebalancingPolicy": { + "enabled": bool, + "rebalanceBehavior": "str", + "rebalanceStrategy": "str", + }, + "resilientVMCreationPolicy": {"enabled": bool}, + "resilientVMDeletionPolicy": {"enabled": bool}, + "zoneAllocationPolicy": { + "maxInstancePercentPerZonePolicy": {"enabled": bool, "value": 0}, + "maxZoneCount": 0, + }, + }, + "scaleInPolicy": {"forceDeletion": bool, "prioritizeUnhealthyVMs": bool, "rules": ["str"]}, + "singlePlacementGroup": bool, + "skuProfile": {"allocationStrategy": "str", "vmSizes": [{"name": "str", "rank": 0}]}, + "spotRestorePolicy": {"enabled": bool, "restoreTimeout": "str"}, + "upgradePolicy": { + "automaticOSUpgradePolicy": { + "disableAutomaticRollback": bool, + "enableAutomaticOSUpgrade": bool, + "osRollingUpgradeDeferral": bool, + "useRollingUpgradePolicy": bool, + }, + "mode": "str", + "rollingUpgradePolicy": { + "enableCrossZoneUpgrade": bool, + "maxBatchInstancePercent": 0, + "maxSurge": bool, + "maxUnhealthyInstancePercent": 0, + "maxUnhealthyUpgradedInstancePercent": 0, + "pauseTimeBetweenBatches": "str", + "prioritizeUnhealthyInstances": bool, + "rollbackFailedInstancesOnPolicyBreach": bool, + }, + }, + "virtualMachineProfile": { + "billingProfile": {"maxPrice": 0.0}, + "diagnosticsProfile": {"bootDiagnostics": {"enabled": bool, "storageUri": "str"}}, + "extensionProfile": { + "extensions": [ + { + "id": "str", + "name": "str", + "properties": { + "autoUpgradeMinorVersion": bool, + "enableAutomaticUpgrade": bool, + "forceUpdateTag": "str", + "protectedSettings": {}, + "protectedSettingsFromKeyVault": { + "secretUrl": "str", + "sourceVault": {"id": "str"}, + }, + "provisionAfterExtensions": ["str"], + "provisioningState": "str", + "publisher": "str", + "settings": {}, + "suppressFailures": bool, + "type": "str", + "typeHandlerVersion": "str", + }, + "type": "str", + } + ], + "extensionsTimeBudget": "str", + }, + "hardwareProfile": {"vmSizeProperties": {"vCPUsAvailable": 0, "vCPUsPerCore": 0}}, + "licenseType": "str", + "networkProfile": { + "healthProbe": {"id": "str"}, + "networkApiVersion": "str", + "networkInterfaceConfigurations": [ + { + "name": "str", + "properties": { + "auxiliaryMode": "str", + "auxiliarySku": "str", + "deleteOption": "str", + "disableTcpStateTracking": bool, + "dnsSettings": {"dnsServers": ["str"]}, + "enableAcceleratedNetworking": bool, + "enableFpga": bool, + "enableIPForwarding": bool, + "ipConfigurations": [ + { + "name": "str", + "properties": { + "applicationGatewayBackendAddressPools": [{"id": "str"}], + "applicationSecurityGroups": [{"id": "str"}], + "loadBalancerBackendAddressPools": [{"id": "str"}], + "loadBalancerInboundNatPools": [{"id": "str"}], + "primary": bool, + "privateIPAddressVersion": "str", + "publicIPAddressConfiguration": { + "name": "str", + "properties": { + "deleteOption": "str", + "dnsSettings": { + "domainNameLabel": "str", + "domainNameLabelScope": "str", + }, + "idleTimeoutInMinutes": 0, + "publicIPPrefix": {"id": "str"}, + }, + "tags": {"str": "str"}, + }, + "subnet": {"id": "str"}, + }, + } + ], + "networkSecurityGroup": {"id": "str"}, + "primary": bool, + }, + "tags": {"str": "str"}, + } + ], + }, + "osProfile": { + "customData": "str", + "linuxConfiguration": { + "disablePasswordAuthentication": bool, + "enableVMAgentPlatformUpdates": bool, + "patchSettings": { + "assessmentMode": "str", + "automaticByPlatformSettings": { + "bypassPlatformSafetyChecksOnUserSchedule": bool, + "rebootSetting": "str", + }, + "patchMode": "str", + }, + "provisionVMAgent": bool, + "ssh": {"publicKeys": [{"keyData": "str", "path": "str"}]}, + }, + "secrets": [ + { + "sourceVault": {"id": "str"}, + "vaultCertificates": [{"certificateStore": "str", "certificateUrl": "str"}], + } + ], + "windowsConfiguration": { + "additionalUnattendContent": [ + { + "componentName": "Microsoft-Windows-Shell-Setup", + "content": "str", + "passName": "str", + "settingName": "str", + } + ], + "enableAutomaticUpdates": bool, + "enableVMAgentPlatformUpdates": bool, + "patchSettings": { + "assessmentMode": "str", + "automaticByPlatformSettings": { + "bypassPlatformSafetyChecksOnUserSchedule": bool, + "rebootSetting": "str", + }, + "enableHotpatching": bool, + "patchMode": "str", + }, + "provisionVMAgent": bool, + "timeZone": "str", + "winRM": {"listeners": [{"certificateUrl": "str", "protocol": "str"}]}, + }, + }, + "scheduledEventsProfile": { + "osImageNotificationProfile": {"enable": bool, "notBeforeTimeout": "str"}, + "terminateNotificationProfile": {"enable": bool, "notBeforeTimeout": "str"}, + }, + "securityPostureReference": { + "excludeExtensions": ["str"], + "id": "str", + "isOverridable": bool, + }, + "securityProfile": { + "encryptionAtHost": bool, + "encryptionIdentity": {"userAssignedIdentityResourceId": "str"}, + "proxyAgentSettings": { + "addProxyAgentExtension": bool, + "enabled": bool, + "imds": {"inVMAccessControlProfileReferenceId": "str", "mode": "str"}, + "keyIncarnationId": 0, + "mode": "str", + "wireServer": {"inVMAccessControlProfileReferenceId": "str", "mode": "str"}, + }, + "securityType": "str", + "uefiSettings": {"secureBootEnabled": bool, "vTpmEnabled": bool}, + }, + "storageProfile": { + "dataDisks": [ + { + "createOption": "str", + "lun": 0, + "caching": "str", + "deleteOption": "str", + "diskIOPSReadWrite": 0, + "diskMBpsReadWrite": 0, + "diskSizeGB": 0, + "managedDisk": { + "diskEncryptionSet": {"id": "str"}, + "securityProfile": { + "diskEncryptionSet": {"id": "str"}, + "securityEncryptionType": "str", + }, + "storageAccountType": "str", + }, + "name": "str", + "writeAcceleratorEnabled": bool, + } + ], + "diskControllerType": "str", + "imageReference": { + "communityGalleryImageId": "str", + "exactVersion": "str", + "id": "str", + "offer": "str", + "publisher": "str", + "sharedGalleryImageId": "str", + "sku": "str", + "version": "str", + }, + "osDisk": { + "caching": "str", + "deleteOption": "str", + "diffDiskSettings": {"option": "str", "placement": "str"}, + "diskSizeGB": 0, + "image": {"uri": "str"}, + "managedDisk": { + "diskEncryptionSet": {"id": "str"}, + "securityProfile": { + "diskEncryptionSet": {"id": "str"}, + "securityEncryptionType": "str", + }, + "storageAccountType": "str", + }, + "vhdContainers": ["str"], + "writeAcceleratorEnabled": bool, + }, + }, + "userData": "str", + }, + "zonalPlatformFaultDomainAlignMode": "str", + }, + "sku": {"capacity": 0, "name": "str", "tier": "str"}, + "tags": {"str": "str"}, + "zones": ["str"], + }, + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_virtual_machine_scale_sets_begin_delete(self, resource_group): + response = await ( + await self.client.virtual_machine_scale_sets.begin_delete( + resource_group_name=resource_group.name, + vm_scale_set_name="str", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_virtual_machine_scale_sets_list(self, resource_group): + response = self.client.virtual_machine_scale_sets.list( + resource_group_name=resource_group.name, + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_virtual_machine_scale_sets_list_all(self, resource_group): + response = self.client.virtual_machine_scale_sets.list_all() + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_virtual_machine_scale_sets_begin_approve_rolling_upgrade(self, resource_group): + response = await ( + await self.client.virtual_machine_scale_sets.begin_approve_rolling_upgrade( + resource_group_name=resource_group.name, + vm_scale_set_name="str", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_virtual_machine_scale_sets_convert_to_single_placement_group(self, resource_group): + response = await self.client.virtual_machine_scale_sets.convert_to_single_placement_group( + resource_group_name=resource_group.name, + vm_scale_set_name="str", + body={"activePlacementGroupId": "str"}, + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_virtual_machine_scale_sets_begin_deallocate(self, resource_group): + response = await ( + await self.client.virtual_machine_scale_sets.begin_deallocate( + resource_group_name=resource_group.name, + vm_scale_set_name="str", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_virtual_machine_scale_sets_begin_delete_instances(self, resource_group): + response = await ( + await self.client.virtual_machine_scale_sets.begin_delete_instances( + resource_group_name=resource_group.name, + vm_scale_set_name="str", + body={"instanceIds": ["str"]}, + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_virtual_machine_scale_sets_force_recovery_service_fabric_platform_update_domain_walk( + self, resource_group + ): + response = ( + await self.client.virtual_machine_scale_sets.force_recovery_service_fabric_platform_update_domain_walk( + resource_group_name=resource_group.name, + vm_scale_set_name="str", + platform_update_domain=0, + ) + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_virtual_machine_scale_sets_get_instance_view(self, resource_group): + response = await self.client.virtual_machine_scale_sets.get_instance_view( + resource_group_name=resource_group.name, + vm_scale_set_name="str", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_virtual_machine_scale_sets_begin_update_instances(self, resource_group): + response = await ( + await self.client.virtual_machine_scale_sets.begin_update_instances( + resource_group_name=resource_group.name, + vm_scale_set_name="str", + body={"instanceIds": ["str"]}, + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_virtual_machine_scale_sets_get_os_upgrade_history(self, resource_group): + response = self.client.virtual_machine_scale_sets.get_os_upgrade_history( + resource_group_name=resource_group.name, + vm_scale_set_name="str", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_virtual_machine_scale_sets_begin_perform_maintenance(self, resource_group): + response = await ( + await self.client.virtual_machine_scale_sets.begin_perform_maintenance( + resource_group_name=resource_group.name, + vm_scale_set_name="str", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_virtual_machine_scale_sets_begin_power_off(self, resource_group): + response = await ( + await self.client.virtual_machine_scale_sets.begin_power_off( + resource_group_name=resource_group.name, + vm_scale_set_name="str", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_virtual_machine_scale_sets_begin_reapply(self, resource_group): + response = await ( + await self.client.virtual_machine_scale_sets.begin_reapply( + resource_group_name=resource_group.name, + vm_scale_set_name="str", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_virtual_machine_scale_sets_begin_redeploy(self, resource_group): + response = await ( + await self.client.virtual_machine_scale_sets.begin_redeploy( + resource_group_name=resource_group.name, + vm_scale_set_name="str", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_virtual_machine_scale_sets_begin_reimage(self, resource_group): + response = await ( + await self.client.virtual_machine_scale_sets.begin_reimage( + resource_group_name=resource_group.name, + vm_scale_set_name="str", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_virtual_machine_scale_sets_begin_reimage_all(self, resource_group): + response = await ( + await self.client.virtual_machine_scale_sets.begin_reimage_all( + resource_group_name=resource_group.name, + vm_scale_set_name="str", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_virtual_machine_scale_sets_begin_restart(self, resource_group): + response = await ( + await self.client.virtual_machine_scale_sets.begin_restart( + resource_group_name=resource_group.name, + vm_scale_set_name="str", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_virtual_machine_scale_sets_begin_set_orchestration_service_state(self, resource_group): + response = await ( + await self.client.virtual_machine_scale_sets.begin_set_orchestration_service_state( + resource_group_name=resource_group.name, + vm_scale_set_name="str", + body={"action": "str", "serviceName": "str"}, + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_virtual_machine_scale_sets_list_skus(self, resource_group): + response = self.client.virtual_machine_scale_sets.list_skus( + resource_group_name=resource_group.name, + vm_scale_set_name="str", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_virtual_machine_scale_sets_begin_start(self, resource_group): + response = await ( + await self.client.virtual_machine_scale_sets.begin_start( + resource_group_name=resource_group.name, + vm_scale_set_name="str", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_virtual_machine_scale_sets_begin_start_extension_upgrade(self, resource_group): + response = await ( + await self.client.virtual_machine_scale_sets.begin_start_extension_upgrade( + resource_group_name=resource_group.name, + vm_scale_set_name="str", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_virtual_machine_scale_sets_begin_start_os_upgrade(self, resource_group): + response = await ( + await self.client.virtual_machine_scale_sets.begin_start_os_upgrade( + resource_group_name=resource_group.name, + vm_scale_set_name="str", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_virtual_machine_scale_sets_begin_cancel(self, resource_group): + response = await ( + await self.client.virtual_machine_scale_sets.begin_cancel( + resource_group_name=resource_group.name, + vm_scale_set_name="str", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_virtual_machine_scale_sets_begin_scale_out(self, resource_group): + response = await ( + await self.client.virtual_machine_scale_sets.begin_scale_out( + resource_group_name=resource_group.name, + vm_scale_set_name="str", + body={"capacity": 0, "properties": {"zone": "str"}}, + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machine_sizes_operation_group_operations.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machine_sizes_operation_group_operations.py new file mode 100644 index 000000000000..c7e09fa0dab6 --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machine_sizes_operation_group_operations.py @@ -0,0 +1,29 @@ +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.compute import ComputeClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestComputeVirtualMachineSizesOperationGroupOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ComputeClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_virtual_machine_sizes_operation_group_list(self, resource_group): + response = self.client.virtual_machine_sizes_operation_group.list( + location="str", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machine_sizes_operation_group_operations_async.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machine_sizes_operation_group_operations_async.py new file mode 100644 index 000000000000..7f97374cbf7c --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machine_sizes_operation_group_operations_async.py @@ -0,0 +1,30 @@ +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.compute.aio import ComputeClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestComputeVirtualMachineSizesOperationGroupOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ComputeClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_virtual_machine_sizes_operation_group_list(self, resource_group): + response = self.client.virtual_machine_sizes_operation_group.list( + location="str", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_virtual_machine_sizes_operations.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machines_operation_group_operations.py similarity index 69% rename from sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_virtual_machine_sizes_operations.py rename to sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machines_operation_group_operations.py index 4960a3a4b0b5..76b8792fc771 100644 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_virtual_machine_sizes_operations.py +++ b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machines_operation_group_operations.py @@ -2,11 +2,11 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.compute import ComputeManagementClient +from azure.mgmt.compute import ComputeClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy @@ -14,16 +14,15 @@ @pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestComputeManagementVirtualMachineSizesOperations(AzureMgmtRecordedTestCase): +class TestComputeVirtualMachinesOperationGroupOperations(AzureMgmtRecordedTestCase): def setup_method(self, method): - self.client = self.create_mgmt_client(ComputeManagementClient) + self.client = self.create_mgmt_client(ComputeClient) @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_virtual_machine_sizes_list(self, resource_group): - response = self.client.virtual_machine_sizes.list( + def test_virtual_machines_operation_group_list_by_location(self, resource_group): + response = self.client.virtual_machines_operation_group.list_by_location( location="str", - api_version="2025-04-01", ) result = [r for r in response] # please add some check logic here by yourself diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_virtual_machine_sizes_operations_async.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machines_operation_group_operations_async.py similarity index 69% rename from sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_virtual_machine_sizes_operations_async.py rename to sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machines_operation_group_operations_async.py index 008c5a8c366d..f4eb6d1542e0 100644 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_virtual_machine_sizes_operations_async.py +++ b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machines_operation_group_operations_async.py @@ -2,11 +2,11 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.compute.aio import ComputeManagementClient +from azure.mgmt.compute.aio import ComputeClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer from devtools_testutils.aio import recorded_by_proxy_async @@ -15,16 +15,15 @@ @pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestComputeManagementVirtualMachineSizesOperationsAsync(AzureMgmtRecordedTestCase): +class TestComputeVirtualMachinesOperationGroupOperationsAsync(AzureMgmtRecordedTestCase): def setup_method(self, method): - self.client = self.create_mgmt_client(ComputeManagementClient, is_async=True) + self.client = self.create_mgmt_client(ComputeClient, is_async=True) @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_virtual_machine_sizes_list(self, resource_group): - response = self.client.virtual_machine_sizes.list( + async def test_virtual_machines_operation_group_list_by_location(self, resource_group): + response = self.client.virtual_machines_operation_group.list_by_location( location="str", - api_version="2025-04-01", ) result = [r async for r in response] # please add some check logic here by yourself diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_virtual_machines_operations_async.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machines_operations.py similarity index 72% rename from sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_virtual_machines_operations_async.py rename to sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machines_operations.py index bb3d4eb95dee..19b601fb8827 100644 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_virtual_machines_operations_async.py +++ b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machines_operations.py @@ -3,76 +3,55 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.compute.aio import ComputeManagementClient +from azure.mgmt.compute import ComputeClient -from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer -from devtools_testutils.aio import recorded_by_proxy_async +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy AZURE_LOCATION = "eastus" @pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestComputeManagementVirtualMachinesOperationsAsync(AzureMgmtRecordedTestCase): +class TestComputeVirtualMachinesOperations(AzureMgmtRecordedTestCase): def setup_method(self, method): - self.client = self.create_mgmt_client(ComputeManagementClient, is_async=True) + self.client = self.create_mgmt_client(ComputeClient) @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_virtual_machines_list_by_location(self, resource_group): - response = self.client.virtual_machines.list_by_location( - location="str", - api_version="2025-04-01", - ) - result = [r async for r in response] - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_virtual_machines_list_all(self, resource_group): - response = self.client.virtual_machines.list_all( - api_version="2025-04-01", - ) - result = [r async for r in response] - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_virtual_machines_list(self, resource_group): - response = self.client.virtual_machines.list( - resource_group_name=resource_group.name, - api_version="2025-04-01", - ) - result = [r async for r in response] - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_virtual_machines_get(self, resource_group): - response = await self.client.virtual_machines.get( + @recorded_by_proxy + def test_virtual_machines_get(self, resource_group): + response = self.client.virtual_machines.get( resource_group_name=resource_group.name, vm_name="str", - api_version="2025-04-01", ) # please add some check logic here by yourself # ... @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_virtual_machines_begin_create_or_update(self, resource_group): - response = await ( - await self.client.virtual_machines.begin_create_or_update( - resource_group_name=resource_group.name, - vm_name="str", - parameters={ - "location": "str", + @recorded_by_proxy + def test_virtual_machines_begin_create_or_update(self, resource_group): + response = self.client.virtual_machines.begin_create_or_update( + resource_group_name=resource_group.name, + vm_name="str", + resource={ + "location": "str", + "etag": "str", + "extendedLocation": {"name": "str", "type": "str"}, + "id": "str", + "identity": { + "principalId": "str", + "tenantId": "str", + "type": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, + "managedBy": "str", + "name": "str", + "placement": {"excludeZones": ["str"], "includeZones": ["str"], "zonePlacementPolicy": "str"}, + "plan": {"name": "str", "product": "str", "promotionCode": "str", "publisher": "str"}, + "properties": { "additionalCapabilities": {"hibernationEnabled": bool, "ultraSSDEnabled": bool}, "applicationProfile": { "galleryApplications": [ @@ -90,20 +69,11 @@ async def test_virtual_machines_begin_create_or_update(self, resource_group): "billingProfile": {"maxPrice": 0.0}, "capacityReservation": {"capacityReservationGroup": {"id": "str"}}, "diagnosticsProfile": {"bootDiagnostics": {"enabled": bool, "storageUri": "str"}}, - "etag": "str", "evictionPolicy": "str", - "extendedLocation": {"name": "str", "type": "str"}, "extensionsTimeBudget": "str", "hardwareProfile": {"vmSize": "str", "vmSizeProperties": {"vCPUsAvailable": 0, "vCPUsPerCore": 0}}, "host": {"id": "str"}, "hostGroup": {"id": "str"}, - "id": "str", - "identity": { - "principalId": "str", - "tenantId": "str", - "type": "str", - "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, - }, "instanceView": { "assignedHost": "str", "bootDiagnostics": { @@ -271,51 +241,58 @@ async def test_virtual_machines_begin_create_or_update(self, resource_group): }, }, "licenseType": "str", - "managedBy": "str", - "name": "str", "networkProfile": { "networkApiVersion": "str", "networkInterfaceConfigurations": [ { "name": "str", - "auxiliaryMode": "str", - "auxiliarySku": "str", - "deleteOption": "str", - "disableTcpStateTracking": bool, - "dnsSettings": {"dnsServers": ["str"]}, - "dscpConfiguration": {"id": "str"}, - "enableAcceleratedNetworking": bool, - "enableFpga": bool, - "enableIPForwarding": bool, - "ipConfigurations": [ - { - "name": "str", - "applicationGatewayBackendAddressPools": [{"id": "str"}], - "applicationSecurityGroups": [{"id": "str"}], - "loadBalancerBackendAddressPools": [{"id": "str"}], - "primary": bool, - "privateIPAddressVersion": "str", - "publicIPAddressConfiguration": { + "properties": { + "ipConfigurations": [ + { "name": "str", - "deleteOption": "str", - "dnsSettings": {"domainNameLabel": "str", "domainNameLabelScope": "str"}, - "idleTimeoutInMinutes": 0, - "ipTags": [{"ipTagType": "str", "tag": "str"}], - "publicIPAddressVersion": "str", - "publicIPAllocationMethod": "str", - "publicIPPrefix": {"id": "str"}, - "sku": {"name": "str", "tier": "str"}, - "tags": {"str": "str"}, - }, - "subnet": {"id": "str"}, - } - ], - "networkSecurityGroup": {"id": "str"}, - "primary": bool, + "properties": { + "applicationGatewayBackendAddressPools": [{"id": "str"}], + "applicationSecurityGroups": [{"id": "str"}], + "loadBalancerBackendAddressPools": [{"id": "str"}], + "primary": bool, + "privateIPAddressVersion": "str", + "publicIPAddressConfiguration": { + "name": "str", + "properties": { + "deleteOption": "str", + "dnsSettings": { + "domainNameLabel": "str", + "domainNameLabelScope": "str", + }, + "idleTimeoutInMinutes": 0, + "ipTags": [{"ipTagType": "str", "tag": "str"}], + "publicIPAddressVersion": "str", + "publicIPAllocationMethod": "str", + "publicIPPrefix": {"id": "str"}, + }, + "sku": {"name": "str", "tier": "str"}, + "tags": {"str": "str"}, + }, + "subnet": {"id": "str"}, + }, + } + ], + "auxiliaryMode": "str", + "auxiliarySku": "str", + "deleteOption": "str", + "disableTcpStateTracking": bool, + "dnsSettings": {"dnsServers": ["str"]}, + "dscpConfiguration": {"id": "str"}, + "enableAcceleratedNetworking": bool, + "enableFpga": bool, + "enableIPForwarding": bool, + "networkSecurityGroup": {"id": "str"}, + "primary": bool, + }, "tags": {"str": "str"}, } ], - "networkInterfaces": [{"deleteOption": "str", "id": "str", "primary": bool}], + "networkInterfaces": [{"id": "str", "properties": {"deleteOption": "str", "primary": bool}}], }, "osProfile": { "adminPassword": "str", @@ -349,7 +326,7 @@ async def test_virtual_machines_begin_create_or_update(self, resource_group): { "componentName": "Microsoft-Windows-Shell-Setup", "content": "str", - "passName": "OobeSystem", + "passName": "str", "settingName": "str", } ], @@ -369,63 +346,10 @@ async def test_virtual_machines_begin_create_or_update(self, resource_group): "winRM": {"listeners": [{"certificateUrl": "str", "protocol": "str"}]}, }, }, - "placement": {"excludeZones": ["str"], "includeZones": ["str"], "zonePlacementPolicy": "str"}, - "plan": {"name": "str", "product": "str", "promotionCode": "str", "publisher": "str"}, "platformFaultDomain": 0, "priority": "str", "provisioningState": "str", "proximityPlacementGroup": {"id": "str"}, - "resources": [ - { - "location": "str", - "autoUpgradeMinorVersion": bool, - "enableAutomaticUpgrade": bool, - "forceUpdateTag": "str", - "id": "str", - "instanceView": { - "name": "str", - "statuses": [ - { - "code": "str", - "displayStatus": "str", - "level": "str", - "message": "str", - "time": "2020-02-20 00:00:00", - } - ], - "substatuses": [ - { - "code": "str", - "displayStatus": "str", - "level": "str", - "message": "str", - "time": "2020-02-20 00:00:00", - } - ], - "type": "str", - "typeHandlerVersion": "str", - }, - "name": "str", - "protectedSettings": {}, - "protectedSettingsFromKeyVault": {"secretUrl": "str", "sourceVault": {"id": "str"}}, - "provisionAfterExtensions": ["str"], - "provisioningState": "str", - "publisher": "str", - "settings": {}, - "suppressFailures": bool, - "systemData": { - "createdAt": "2020-02-20 00:00:00", - "createdBy": "str", - "createdByType": "str", - "lastModifiedAt": "2020-02-20 00:00:00", - "lastModifiedBy": "str", - "lastModifiedByType": "str", - }, - "tags": {"str": "str"}, - "type": "str", - "typeHandlerVersion": "str", - } - ], "scheduledEventsPolicy": { "allInstancesDown": {"automaticallyApprove": bool}, "scheduledEventsAdditionalPublishingTargets": { @@ -519,37 +443,97 @@ async def test_virtual_machines_begin_create_or_update(self, resource_group): "writeAcceleratorEnabled": bool, }, }, - "systemData": { - "createdAt": "2020-02-20 00:00:00", - "createdBy": "str", - "createdByType": "str", - "lastModifiedAt": "2020-02-20 00:00:00", - "lastModifiedBy": "str", - "lastModifiedByType": "str", - }, - "tags": {"str": "str"}, "timeCreated": "2020-02-20 00:00:00", - "type": "str", "userData": "str", "virtualMachineScaleSet": {"id": "str"}, "vmId": "str", - "zones": ["str"], }, - api_version="2025-04-01", - ) + "resources": [ + { + "location": "str", + "id": "str", + "name": "str", + "properties": { + "autoUpgradeMinorVersion": bool, + "enableAutomaticUpgrade": bool, + "forceUpdateTag": "str", + "instanceView": { + "name": "str", + "statuses": [ + { + "code": "str", + "displayStatus": "str", + "level": "str", + "message": "str", + "time": "2020-02-20 00:00:00", + } + ], + "substatuses": [ + { + "code": "str", + "displayStatus": "str", + "level": "str", + "message": "str", + "time": "2020-02-20 00:00:00", + } + ], + "type": "str", + "typeHandlerVersion": "str", + }, + "protectedSettings": {}, + "protectedSettingsFromKeyVault": {"secretUrl": "str", "sourceVault": {"id": "str"}}, + "provisionAfterExtensions": ["str"], + "provisioningState": "str", + "publisher": "str", + "settings": {}, + "suppressFailures": bool, + "type": "str", + "typeHandlerVersion": "str", + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "tags": {"str": "str"}, + "type": "str", + } + ], + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "tags": {"str": "str"}, + "type": "str", + "zones": ["str"], + }, ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself # ... @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_virtual_machines_begin_update(self, resource_group): - response = await ( - await self.client.virtual_machines.begin_update( - resource_group_name=resource_group.name, - vm_name="str", - parameters={ + @recorded_by_proxy + def test_virtual_machines_begin_update(self, resource_group): + response = self.client.virtual_machines.begin_update( + resource_group_name=resource_group.name, + vm_name="str", + properties={ + "identity": { + "principalId": "str", + "tenantId": "str", + "type": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, + "plan": {"name": "str", "product": "str", "promotionCode": "str", "publisher": "str"}, + "properties": { "additionalCapabilities": {"hibernationEnabled": bool, "ultraSSDEnabled": bool}, "applicationProfile": { "galleryApplications": [ @@ -572,12 +556,6 @@ async def test_virtual_machines_begin_update(self, resource_group): "hardwareProfile": {"vmSize": "str", "vmSizeProperties": {"vCPUsAvailable": 0, "vCPUsPerCore": 0}}, "host": {"id": "str"}, "hostGroup": {"id": "str"}, - "identity": { - "principalId": "str", - "tenantId": "str", - "type": "str", - "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, - }, "instanceView": { "assignedHost": "str", "bootDiagnostics": { @@ -750,44 +728,53 @@ async def test_virtual_machines_begin_update(self, resource_group): "networkInterfaceConfigurations": [ { "name": "str", - "auxiliaryMode": "str", - "auxiliarySku": "str", - "deleteOption": "str", - "disableTcpStateTracking": bool, - "dnsSettings": {"dnsServers": ["str"]}, - "dscpConfiguration": {"id": "str"}, - "enableAcceleratedNetworking": bool, - "enableFpga": bool, - "enableIPForwarding": bool, - "ipConfigurations": [ - { - "name": "str", - "applicationGatewayBackendAddressPools": [{"id": "str"}], - "applicationSecurityGroups": [{"id": "str"}], - "loadBalancerBackendAddressPools": [{"id": "str"}], - "primary": bool, - "privateIPAddressVersion": "str", - "publicIPAddressConfiguration": { + "properties": { + "ipConfigurations": [ + { "name": "str", - "deleteOption": "str", - "dnsSettings": {"domainNameLabel": "str", "domainNameLabelScope": "str"}, - "idleTimeoutInMinutes": 0, - "ipTags": [{"ipTagType": "str", "tag": "str"}], - "publicIPAddressVersion": "str", - "publicIPAllocationMethod": "str", - "publicIPPrefix": {"id": "str"}, - "sku": {"name": "str", "tier": "str"}, - "tags": {"str": "str"}, - }, - "subnet": {"id": "str"}, - } - ], - "networkSecurityGroup": {"id": "str"}, - "primary": bool, + "properties": { + "applicationGatewayBackendAddressPools": [{"id": "str"}], + "applicationSecurityGroups": [{"id": "str"}], + "loadBalancerBackendAddressPools": [{"id": "str"}], + "primary": bool, + "privateIPAddressVersion": "str", + "publicIPAddressConfiguration": { + "name": "str", + "properties": { + "deleteOption": "str", + "dnsSettings": { + "domainNameLabel": "str", + "domainNameLabelScope": "str", + }, + "idleTimeoutInMinutes": 0, + "ipTags": [{"ipTagType": "str", "tag": "str"}], + "publicIPAddressVersion": "str", + "publicIPAllocationMethod": "str", + "publicIPPrefix": {"id": "str"}, + }, + "sku": {"name": "str", "tier": "str"}, + "tags": {"str": "str"}, + }, + "subnet": {"id": "str"}, + }, + } + ], + "auxiliaryMode": "str", + "auxiliarySku": "str", + "deleteOption": "str", + "disableTcpStateTracking": bool, + "dnsSettings": {"dnsServers": ["str"]}, + "dscpConfiguration": {"id": "str"}, + "enableAcceleratedNetworking": bool, + "enableFpga": bool, + "enableIPForwarding": bool, + "networkSecurityGroup": {"id": "str"}, + "primary": bool, + }, "tags": {"str": "str"}, } ], - "networkInterfaces": [{"deleteOption": "str", "id": "str", "primary": bool}], + "networkInterfaces": [{"id": "str", "properties": {"deleteOption": "str", "primary": bool}}], }, "osProfile": { "adminPassword": "str", @@ -821,7 +808,7 @@ async def test_virtual_machines_begin_update(self, resource_group): { "componentName": "Microsoft-Windows-Shell-Setup", "content": "str", - "passName": "OobeSystem", + "passName": "str", "settingName": "str", } ], @@ -841,7 +828,6 @@ async def test_virtual_machines_begin_update(self, resource_group): "winRM": {"listeners": [{"certificateUrl": "str", "protocol": "str"}]}, }, }, - "plan": {"name": "str", "product": "str", "promotionCode": "str", "publisher": "str"}, "platformFaultDomain": 0, "priority": "str", "provisioningState": "str", @@ -939,334 +925,298 @@ async def test_virtual_machines_begin_update(self, resource_group): "writeAcceleratorEnabled": bool, }, }, - "tags": {"str": "str"}, "timeCreated": "2020-02-20 00:00:00", "userData": "str", "virtualMachineScaleSet": {"id": "str"}, "vmId": "str", - "zones": ["str"], }, - api_version="2025-04-01", - ) + "tags": {"str": "str"}, + "zones": ["str"], + }, ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself # ... @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_virtual_machines_begin_delete(self, resource_group): - response = await ( - await self.client.virtual_machines.begin_delete( - resource_group_name=resource_group.name, - vm_name="str", - api_version="2025-04-01", - ) + @recorded_by_proxy + def test_virtual_machines_begin_delete(self, resource_group): + response = self.client.virtual_machines.begin_delete( + resource_group_name=resource_group.name, + vm_name="str", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself # ... @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_virtual_machines_begin_assess_patches(self, resource_group): - response = await ( - await self.client.virtual_machines.begin_assess_patches( - resource_group_name=resource_group.name, - vm_name="str", - api_version="2025-04-01", - ) + @recorded_by_proxy + def test_virtual_machines_list(self, resource_group): + response = self.client.virtual_machines.list( + resource_group_name=resource_group.name, + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_virtual_machines_list_all(self, resource_group): + response = self.client.virtual_machines.list_all() + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_virtual_machines_begin_assess_patches(self, resource_group): + response = self.client.virtual_machines.begin_assess_patches( + resource_group_name=resource_group.name, + vm_name="str", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself # ... @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_virtual_machines_begin_attach_detach_data_disks(self, resource_group): - response = await ( - await self.client.virtual_machines.begin_attach_detach_data_disks( - resource_group_name=resource_group.name, - vm_name="str", - parameters={ - "dataDisksToAttach": [ - { - "diskId": "str", - "caching": "str", - "deleteOption": "str", - "diskEncryptionSet": {"id": "str"}, - "lun": 0, - "writeAcceleratorEnabled": bool, - } - ], - "dataDisksToDetach": [{"diskId": "str", "detachOption": "str"}], - }, - api_version="2025-04-01", - ) + @recorded_by_proxy + def test_virtual_machines_begin_attach_detach_data_disks(self, resource_group): + response = self.client.virtual_machines.begin_attach_detach_data_disks( + resource_group_name=resource_group.name, + vm_name="str", + body={ + "dataDisksToAttach": [ + { + "diskId": "str", + "caching": "str", + "deleteOption": "str", + "diskEncryptionSet": {"id": "str"}, + "lun": 0, + "writeAcceleratorEnabled": bool, + } + ], + "dataDisksToDetach": [{"diskId": "str", "detachOption": "str"}], + }, ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself # ... @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_virtual_machines_begin_capture(self, resource_group): - response = await ( - await self.client.virtual_machines.begin_capture( - resource_group_name=resource_group.name, - vm_name="str", - parameters={"destinationContainerName": "str", "overwriteVhds": bool, "vhdPrefix": "str"}, - api_version="2025-04-01", - ) + @recorded_by_proxy + def test_virtual_machines_begin_capture(self, resource_group): + response = self.client.virtual_machines.begin_capture( + resource_group_name=resource_group.name, + vm_name="str", + body={"destinationContainerName": "str", "overwriteVhds": bool, "vhdPrefix": "str"}, ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself # ... @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_virtual_machines_begin_convert_to_managed_disks(self, resource_group): - response = await ( - await self.client.virtual_machines.begin_convert_to_managed_disks( - resource_group_name=resource_group.name, - vm_name="str", - api_version="2025-04-01", - ) + @recorded_by_proxy + def test_virtual_machines_begin_convert_to_managed_disks(self, resource_group): + response = self.client.virtual_machines.begin_convert_to_managed_disks( + resource_group_name=resource_group.name, + vm_name="str", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself # ... @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_virtual_machines_begin_deallocate(self, resource_group): - response = await ( - await self.client.virtual_machines.begin_deallocate( - resource_group_name=resource_group.name, - vm_name="str", - api_version="2025-04-01", - ) + @recorded_by_proxy + def test_virtual_machines_begin_deallocate(self, resource_group): + response = self.client.virtual_machines.begin_deallocate( + resource_group_name=resource_group.name, + vm_name="str", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself # ... @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_virtual_machines_generalize(self, resource_group): - response = await self.client.virtual_machines.generalize( + @recorded_by_proxy + def test_virtual_machines_generalize(self, resource_group): + response = self.client.virtual_machines.generalize( resource_group_name=resource_group.name, vm_name="str", - api_version="2025-04-01", ) # please add some check logic here by yourself # ... @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_virtual_machines_begin_install_patches(self, resource_group): - response = await ( - await self.client.virtual_machines.begin_install_patches( - resource_group_name=resource_group.name, - vm_name="str", - install_patches_input={ - "rebootSetting": "str", - "linuxParameters": { - "classificationsToInclude": ["str"], - "maintenanceRunId": "str", - "packageNameMasksToExclude": ["str"], - "packageNameMasksToInclude": ["str"], - }, - "maximumDuration": "1 day, 0:00:00", - "windowsParameters": { - "classificationsToInclude": ["str"], - "excludeKbsRequiringReboot": bool, - "kbNumbersToExclude": ["str"], - "kbNumbersToInclude": ["str"], - "maxPatchPublishDate": "2020-02-20 00:00:00", - "patchNameMasksToExclude": ["str"], - "patchNameMasksToInclude": ["str"], - }, + @recorded_by_proxy + def test_virtual_machines_begin_install_patches(self, resource_group): + response = self.client.virtual_machines.begin_install_patches( + resource_group_name=resource_group.name, + vm_name="str", + body={ + "rebootSetting": "str", + "linuxParameters": { + "classificationsToInclude": ["str"], + "maintenanceRunId": "str", + "packageNameMasksToExclude": ["str"], + "packageNameMasksToInclude": ["str"], }, - api_version="2025-04-01", - ) + "maximumDuration": "1 day, 0:00:00", + "windowsParameters": { + "classificationsToInclude": ["str"], + "excludeKbsRequiringReboot": bool, + "kbNumbersToExclude": ["str"], + "kbNumbersToInclude": ["str"], + "maxPatchPublishDate": "2020-02-20 00:00:00", + "patchNameMasksToExclude": ["str"], + "patchNameMasksToInclude": ["str"], + }, + }, ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself # ... @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_virtual_machines_instance_view(self, resource_group): - response = await self.client.virtual_machines.instance_view( + @recorded_by_proxy + def test_virtual_machines_instance_view(self, resource_group): + response = self.client.virtual_machines.instance_view( resource_group_name=resource_group.name, vm_name="str", - api_version="2025-04-01", ) # please add some check logic here by yourself # ... @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_virtual_machines_begin_migrate_to_vm_scale_set(self, resource_group): - response = await ( - await self.client.virtual_machines.begin_migrate_to_vm_scale_set( - resource_group_name=resource_group.name, - vm_name="str", - api_version="2025-04-01", - ) + @recorded_by_proxy + def test_virtual_machines_begin_perform_maintenance(self, resource_group): + response = self.client.virtual_machines.begin_perform_maintenance( + resource_group_name=resource_group.name, + vm_name="str", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself # ... @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_virtual_machines_begin_perform_maintenance(self, resource_group): - response = await ( - await self.client.virtual_machines.begin_perform_maintenance( - resource_group_name=resource_group.name, - vm_name="str", - api_version="2025-04-01", - ) + @recorded_by_proxy + def test_virtual_machines_begin_power_off(self, resource_group): + response = self.client.virtual_machines.begin_power_off( + resource_group_name=resource_group.name, + vm_name="str", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself # ... @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_virtual_machines_begin_power_off(self, resource_group): - response = await ( - await self.client.virtual_machines.begin_power_off( - resource_group_name=resource_group.name, - vm_name="str", - api_version="2025-04-01", - ) + @recorded_by_proxy + def test_virtual_machines_begin_reapply(self, resource_group): + response = self.client.virtual_machines.begin_reapply( + resource_group_name=resource_group.name, + vm_name="str", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself # ... @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_virtual_machines_begin_reapply(self, resource_group): - response = await ( - await self.client.virtual_machines.begin_reapply( - resource_group_name=resource_group.name, - vm_name="str", - api_version="2025-04-01", - ) + @recorded_by_proxy + def test_virtual_machines_begin_redeploy(self, resource_group): + response = self.client.virtual_machines.begin_redeploy( + resource_group_name=resource_group.name, + vm_name="str", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself # ... @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_virtual_machines_begin_redeploy(self, resource_group): - response = await ( - await self.client.virtual_machines.begin_redeploy( - resource_group_name=resource_group.name, - vm_name="str", - api_version="2025-04-01", - ) + @recorded_by_proxy + def test_virtual_machines_begin_reimage(self, resource_group): + response = self.client.virtual_machines.begin_reimage( + resource_group_name=resource_group.name, + vm_name="str", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself # ... @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_virtual_machines_begin_reimage(self, resource_group): - response = await ( - await self.client.virtual_machines.begin_reimage( - resource_group_name=resource_group.name, - vm_name="str", - api_version="2025-04-01", - ) + @recorded_by_proxy + def test_virtual_machines_begin_restart(self, resource_group): + response = self.client.virtual_machines.begin_restart( + resource_group_name=resource_group.name, + vm_name="str", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself # ... @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_virtual_machines_begin_restart(self, resource_group): - response = await ( - await self.client.virtual_machines.begin_restart( - resource_group_name=resource_group.name, - vm_name="str", - api_version="2025-04-01", - ) - ).result() # call '.result()' to poll until service return final result + @recorded_by_proxy + def test_virtual_machines_retrieve_boot_diagnostics_data(self, resource_group): + response = self.client.virtual_machines.retrieve_boot_diagnostics_data( + resource_group_name=resource_group.name, + vm_name="str", + ) # please add some check logic here by yourself # ... @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_virtual_machines_retrieve_boot_diagnostics_data(self, resource_group): - response = await self.client.virtual_machines.retrieve_boot_diagnostics_data( + @recorded_by_proxy + def test_virtual_machines_simulate_eviction(self, resource_group): + response = self.client.virtual_machines.simulate_eviction( resource_group_name=resource_group.name, vm_name="str", - api_version="2025-04-01", ) # please add some check logic here by yourself # ... @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_virtual_machines_begin_run_command(self, resource_group): - response = await ( - await self.client.virtual_machines.begin_run_command( - resource_group_name=resource_group.name, - vm_name="str", - parameters={"commandId": "str", "parameters": [{"name": "str", "value": "str"}], "script": ["str"]}, - api_version="2025-04-01", - ) + @recorded_by_proxy + def test_virtual_machines_begin_start(self, resource_group): + response = self.client.virtual_machines.begin_start( + resource_group_name=resource_group.name, + vm_name="str", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself # ... @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_virtual_machines_simulate_eviction(self, resource_group): - response = await self.client.virtual_machines.simulate_eviction( + @recorded_by_proxy + def test_virtual_machines_list_available_sizes(self, resource_group): + response = self.client.virtual_machines.list_available_sizes( resource_group_name=resource_group.name, vm_name="str", - api_version="2025-04-01", ) - + result = [r for r in response] # please add some check logic here by yourself # ... @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_virtual_machines_begin_start(self, resource_group): - response = await ( - await self.client.virtual_machines.begin_start( - resource_group_name=resource_group.name, - vm_name="str", - api_version="2025-04-01", - ) + @recorded_by_proxy + def test_virtual_machines_begin_run_command(self, resource_group): + response = self.client.virtual_machines.begin_run_command( + resource_group_name=resource_group.name, + vm_name="str", + body={"commandId": "str", "parameters": [{"name": "str", "value": "str"}], "script": ["str"]}, ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself # ... @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_virtual_machines_list_available_sizes(self, resource_group): - response = self.client.virtual_machines.list_available_sizes( + @recorded_by_proxy + def test_virtual_machines_begin_migrate_to_vm_scale_set(self, resource_group): + response = self.client.virtual_machines.begin_migrate_to_vm_scale_set( resource_group_name=resource_group.name, vm_name="str", - api_version="2025-04-01", - ) - result = [r async for r in response] + ).result() # call '.result()' to poll until service return final result + # please add some check logic here by yourself # ... diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machines_operations_async.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machines_operations_async.py new file mode 100644 index 000000000000..f0e8cf219a09 --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machines_operations_async.py @@ -0,0 +1,1269 @@ +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.compute.aio import ComputeClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestComputeVirtualMachinesOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ComputeClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_virtual_machines_get(self, resource_group): + response = await self.client.virtual_machines.get( + resource_group_name=resource_group.name, + vm_name="str", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_virtual_machines_begin_create_or_update(self, resource_group): + response = await ( + await self.client.virtual_machines.begin_create_or_update( + resource_group_name=resource_group.name, + vm_name="str", + resource={ + "location": "str", + "etag": "str", + "extendedLocation": {"name": "str", "type": "str"}, + "id": "str", + "identity": { + "principalId": "str", + "tenantId": "str", + "type": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, + "managedBy": "str", + "name": "str", + "placement": {"excludeZones": ["str"], "includeZones": ["str"], "zonePlacementPolicy": "str"}, + "plan": {"name": "str", "product": "str", "promotionCode": "str", "publisher": "str"}, + "properties": { + "additionalCapabilities": {"hibernationEnabled": bool, "ultraSSDEnabled": bool}, + "applicationProfile": { + "galleryApplications": [ + { + "packageReferenceId": "str", + "configurationReference": "str", + "enableAutomaticUpgrade": bool, + "order": 0, + "tags": "str", + "treatFailureAsDeploymentFailure": bool, + } + ] + }, + "availabilitySet": {"id": "str"}, + "billingProfile": {"maxPrice": 0.0}, + "capacityReservation": {"capacityReservationGroup": {"id": "str"}}, + "diagnosticsProfile": {"bootDiagnostics": {"enabled": bool, "storageUri": "str"}}, + "evictionPolicy": "str", + "extensionsTimeBudget": "str", + "hardwareProfile": { + "vmSize": "str", + "vmSizeProperties": {"vCPUsAvailable": 0, "vCPUsPerCore": 0}, + }, + "host": {"id": "str"}, + "hostGroup": {"id": "str"}, + "instanceView": { + "assignedHost": "str", + "bootDiagnostics": { + "consoleScreenshotBlobUri": "str", + "serialConsoleLogBlobUri": "str", + "status": { + "code": "str", + "displayStatus": "str", + "level": "str", + "message": "str", + "time": "2020-02-20 00:00:00", + }, + }, + "computerName": "str", + "disks": [ + { + "encryptionSettings": [ + { + "diskEncryptionKey": {"secretUrl": "str", "sourceVault": {"id": "str"}}, + "enabled": bool, + "keyEncryptionKey": {"keyUrl": "str", "sourceVault": {"id": "str"}}, + } + ], + "name": "str", + "statuses": [ + { + "code": "str", + "displayStatus": "str", + "level": "str", + "message": "str", + "time": "2020-02-20 00:00:00", + } + ], + } + ], + "extensions": [ + { + "name": "str", + "statuses": [ + { + "code": "str", + "displayStatus": "str", + "level": "str", + "message": "str", + "time": "2020-02-20 00:00:00", + } + ], + "substatuses": [ + { + "code": "str", + "displayStatus": "str", + "level": "str", + "message": "str", + "time": "2020-02-20 00:00:00", + } + ], + "type": "str", + "typeHandlerVersion": "str", + } + ], + "hyperVGeneration": "str", + "isVMInStandbyPool": bool, + "maintenanceRedeployStatus": { + "isCustomerInitiatedMaintenanceAllowed": bool, + "lastOperationMessage": "str", + "lastOperationResultCode": "str", + "maintenanceWindowEndTime": "2020-02-20 00:00:00", + "maintenanceWindowStartTime": "2020-02-20 00:00:00", + "preMaintenanceWindowEndTime": "2020-02-20 00:00:00", + "preMaintenanceWindowStartTime": "2020-02-20 00:00:00", + }, + "osName": "str", + "osVersion": "str", + "patchStatus": { + "availablePatchSummary": { + "assessmentActivityId": "str", + "criticalAndSecurityPatchCount": 0, + "error": { + "code": "str", + "details": [{"code": "str", "message": "str", "target": "str"}], + "innererror": {"errordetail": "str", "exceptiontype": "str"}, + "message": "str", + "target": "str", + }, + "lastModifiedTime": "2020-02-20 00:00:00", + "otherPatchCount": 0, + "rebootPending": bool, + "startTime": "2020-02-20 00:00:00", + "status": "str", + }, + "configurationStatuses": [ + { + "code": "str", + "displayStatus": "str", + "level": "str", + "message": "str", + "time": "2020-02-20 00:00:00", + } + ], + "lastPatchInstallationSummary": { + "error": { + "code": "str", + "details": [{"code": "str", "message": "str", "target": "str"}], + "innererror": {"errordetail": "str", "exceptiontype": "str"}, + "message": "str", + "target": "str", + }, + "excludedPatchCount": 0, + "failedPatchCount": 0, + "installationActivityId": "str", + "installedPatchCount": 0, + "lastModifiedTime": "2020-02-20 00:00:00", + "maintenanceWindowExceeded": bool, + "notSelectedPatchCount": 0, + "pendingPatchCount": 0, + "startTime": "2020-02-20 00:00:00", + "status": "str", + }, + }, + "platformFaultDomain": 0, + "platformUpdateDomain": 0, + "rdpThumbPrint": "str", + "statuses": [ + { + "code": "str", + "displayStatus": "str", + "level": "str", + "message": "str", + "time": "2020-02-20 00:00:00", + } + ], + "vmAgent": { + "extensionHandlers": [ + { + "status": { + "code": "str", + "displayStatus": "str", + "level": "str", + "message": "str", + "time": "2020-02-20 00:00:00", + }, + "type": "str", + "typeHandlerVersion": "str", + } + ], + "statuses": [ + { + "code": "str", + "displayStatus": "str", + "level": "str", + "message": "str", + "time": "2020-02-20 00:00:00", + } + ], + "vmAgentVersion": "str", + }, + "vmHealth": { + "status": { + "code": "str", + "displayStatus": "str", + "level": "str", + "message": "str", + "time": "2020-02-20 00:00:00", + } + }, + }, + "licenseType": "str", + "networkProfile": { + "networkApiVersion": "str", + "networkInterfaceConfigurations": [ + { + "name": "str", + "properties": { + "ipConfigurations": [ + { + "name": "str", + "properties": { + "applicationGatewayBackendAddressPools": [{"id": "str"}], + "applicationSecurityGroups": [{"id": "str"}], + "loadBalancerBackendAddressPools": [{"id": "str"}], + "primary": bool, + "privateIPAddressVersion": "str", + "publicIPAddressConfiguration": { + "name": "str", + "properties": { + "deleteOption": "str", + "dnsSettings": { + "domainNameLabel": "str", + "domainNameLabelScope": "str", + }, + "idleTimeoutInMinutes": 0, + "ipTags": [{"ipTagType": "str", "tag": "str"}], + "publicIPAddressVersion": "str", + "publicIPAllocationMethod": "str", + "publicIPPrefix": {"id": "str"}, + }, + "sku": {"name": "str", "tier": "str"}, + "tags": {"str": "str"}, + }, + "subnet": {"id": "str"}, + }, + } + ], + "auxiliaryMode": "str", + "auxiliarySku": "str", + "deleteOption": "str", + "disableTcpStateTracking": bool, + "dnsSettings": {"dnsServers": ["str"]}, + "dscpConfiguration": {"id": "str"}, + "enableAcceleratedNetworking": bool, + "enableFpga": bool, + "enableIPForwarding": bool, + "networkSecurityGroup": {"id": "str"}, + "primary": bool, + }, + "tags": {"str": "str"}, + } + ], + "networkInterfaces": [ + {"id": "str", "properties": {"deleteOption": "str", "primary": bool}} + ], + }, + "osProfile": { + "adminPassword": "str", + "adminUsername": "str", + "allowExtensionOperations": bool, + "computerName": "str", + "customData": "str", + "linuxConfiguration": { + "disablePasswordAuthentication": bool, + "enableVMAgentPlatformUpdates": bool, + "patchSettings": { + "assessmentMode": "str", + "automaticByPlatformSettings": { + "bypassPlatformSafetyChecksOnUserSchedule": bool, + "rebootSetting": "str", + }, + "patchMode": "str", + }, + "provisionVMAgent": bool, + "ssh": {"publicKeys": [{"keyData": "str", "path": "str"}]}, + }, + "requireGuestProvisionSignal": bool, + "secrets": [ + { + "sourceVault": {"id": "str"}, + "vaultCertificates": [{"certificateStore": "str", "certificateUrl": "str"}], + } + ], + "windowsConfiguration": { + "additionalUnattendContent": [ + { + "componentName": "Microsoft-Windows-Shell-Setup", + "content": "str", + "passName": "str", + "settingName": "str", + } + ], + "enableAutomaticUpdates": bool, + "enableVMAgentPlatformUpdates": bool, + "patchSettings": { + "assessmentMode": "str", + "automaticByPlatformSettings": { + "bypassPlatformSafetyChecksOnUserSchedule": bool, + "rebootSetting": "str", + }, + "enableHotpatching": bool, + "patchMode": "str", + }, + "provisionVMAgent": bool, + "timeZone": "str", + "winRM": {"listeners": [{"certificateUrl": "str", "protocol": "str"}]}, + }, + }, + "platformFaultDomain": 0, + "priority": "str", + "provisioningState": "str", + "proximityPlacementGroup": {"id": "str"}, + "scheduledEventsPolicy": { + "allInstancesDown": {"automaticallyApprove": bool}, + "scheduledEventsAdditionalPublishingTargets": { + "eventGridAndResourceGraph": {"enable": bool, "scheduledEventsApiVersion": "str"} + }, + "userInitiatedReboot": {"automaticallyApprove": bool}, + "userInitiatedRedeploy": {"automaticallyApprove": bool}, + }, + "scheduledEventsProfile": { + "osImageNotificationProfile": {"enable": bool, "notBeforeTimeout": "str"}, + "terminateNotificationProfile": {"enable": bool, "notBeforeTimeout": "str"}, + }, + "securityProfile": { + "encryptionAtHost": bool, + "encryptionIdentity": {"userAssignedIdentityResourceId": "str"}, + "proxyAgentSettings": { + "addProxyAgentExtension": bool, + "enabled": bool, + "imds": {"inVMAccessControlProfileReferenceId": "str", "mode": "str"}, + "keyIncarnationId": 0, + "mode": "str", + "wireServer": {"inVMAccessControlProfileReferenceId": "str", "mode": "str"}, + }, + "securityType": "str", + "uefiSettings": {"secureBootEnabled": bool, "vTpmEnabled": bool}, + }, + "storageProfile": { + "alignRegionalDisksToVMZone": bool, + "dataDisks": [ + { + "createOption": "str", + "lun": 0, + "caching": "str", + "deleteOption": "str", + "detachOption": "str", + "diskIOPSReadWrite": 0, + "diskMBpsReadWrite": 0, + "diskSizeGB": 0, + "image": {"uri": "str"}, + "managedDisk": { + "diskEncryptionSet": {"id": "str"}, + "id": "str", + "securityProfile": { + "diskEncryptionSet": {"id": "str"}, + "securityEncryptionType": "str", + }, + "storageAccountType": "str", + }, + "name": "str", + "sourceResource": {"id": "str"}, + "toBeDetached": bool, + "vhd": {"uri": "str"}, + "writeAcceleratorEnabled": bool, + } + ], + "diskControllerType": "str", + "imageReference": { + "communityGalleryImageId": "str", + "exactVersion": "str", + "id": "str", + "offer": "str", + "publisher": "str", + "sharedGalleryImageId": "str", + "sku": "str", + "version": "str", + }, + "osDisk": { + "createOption": "str", + "caching": "str", + "deleteOption": "str", + "diffDiskSettings": {"option": "str", "placement": "str"}, + "diskSizeGB": 0, + "encryptionSettings": { + "diskEncryptionKey": {"secretUrl": "str", "sourceVault": {"id": "str"}}, + "enabled": bool, + "keyEncryptionKey": {"keyUrl": "str", "sourceVault": {"id": "str"}}, + }, + "image": {"uri": "str"}, + "managedDisk": { + "diskEncryptionSet": {"id": "str"}, + "id": "str", + "securityProfile": { + "diskEncryptionSet": {"id": "str"}, + "securityEncryptionType": "str", + }, + "storageAccountType": "str", + }, + "name": "str", + "osType": "str", + "vhd": {"uri": "str"}, + "writeAcceleratorEnabled": bool, + }, + }, + "timeCreated": "2020-02-20 00:00:00", + "userData": "str", + "virtualMachineScaleSet": {"id": "str"}, + "vmId": "str", + }, + "resources": [ + { + "location": "str", + "id": "str", + "name": "str", + "properties": { + "autoUpgradeMinorVersion": bool, + "enableAutomaticUpgrade": bool, + "forceUpdateTag": "str", + "instanceView": { + "name": "str", + "statuses": [ + { + "code": "str", + "displayStatus": "str", + "level": "str", + "message": "str", + "time": "2020-02-20 00:00:00", + } + ], + "substatuses": [ + { + "code": "str", + "displayStatus": "str", + "level": "str", + "message": "str", + "time": "2020-02-20 00:00:00", + } + ], + "type": "str", + "typeHandlerVersion": "str", + }, + "protectedSettings": {}, + "protectedSettingsFromKeyVault": {"secretUrl": "str", "sourceVault": {"id": "str"}}, + "provisionAfterExtensions": ["str"], + "provisioningState": "str", + "publisher": "str", + "settings": {}, + "suppressFailures": bool, + "type": "str", + "typeHandlerVersion": "str", + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "tags": {"str": "str"}, + "type": "str", + } + ], + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "tags": {"str": "str"}, + "type": "str", + "zones": ["str"], + }, + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_virtual_machines_begin_update(self, resource_group): + response = await ( + await self.client.virtual_machines.begin_update( + resource_group_name=resource_group.name, + vm_name="str", + properties={ + "identity": { + "principalId": "str", + "tenantId": "str", + "type": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, + "plan": {"name": "str", "product": "str", "promotionCode": "str", "publisher": "str"}, + "properties": { + "additionalCapabilities": {"hibernationEnabled": bool, "ultraSSDEnabled": bool}, + "applicationProfile": { + "galleryApplications": [ + { + "packageReferenceId": "str", + "configurationReference": "str", + "enableAutomaticUpgrade": bool, + "order": 0, + "tags": "str", + "treatFailureAsDeploymentFailure": bool, + } + ] + }, + "availabilitySet": {"id": "str"}, + "billingProfile": {"maxPrice": 0.0}, + "capacityReservation": {"capacityReservationGroup": {"id": "str"}}, + "diagnosticsProfile": {"bootDiagnostics": {"enabled": bool, "storageUri": "str"}}, + "evictionPolicy": "str", + "extensionsTimeBudget": "str", + "hardwareProfile": { + "vmSize": "str", + "vmSizeProperties": {"vCPUsAvailable": 0, "vCPUsPerCore": 0}, + }, + "host": {"id": "str"}, + "hostGroup": {"id": "str"}, + "instanceView": { + "assignedHost": "str", + "bootDiagnostics": { + "consoleScreenshotBlobUri": "str", + "serialConsoleLogBlobUri": "str", + "status": { + "code": "str", + "displayStatus": "str", + "level": "str", + "message": "str", + "time": "2020-02-20 00:00:00", + }, + }, + "computerName": "str", + "disks": [ + { + "encryptionSettings": [ + { + "diskEncryptionKey": {"secretUrl": "str", "sourceVault": {"id": "str"}}, + "enabled": bool, + "keyEncryptionKey": {"keyUrl": "str", "sourceVault": {"id": "str"}}, + } + ], + "name": "str", + "statuses": [ + { + "code": "str", + "displayStatus": "str", + "level": "str", + "message": "str", + "time": "2020-02-20 00:00:00", + } + ], + } + ], + "extensions": [ + { + "name": "str", + "statuses": [ + { + "code": "str", + "displayStatus": "str", + "level": "str", + "message": "str", + "time": "2020-02-20 00:00:00", + } + ], + "substatuses": [ + { + "code": "str", + "displayStatus": "str", + "level": "str", + "message": "str", + "time": "2020-02-20 00:00:00", + } + ], + "type": "str", + "typeHandlerVersion": "str", + } + ], + "hyperVGeneration": "str", + "isVMInStandbyPool": bool, + "maintenanceRedeployStatus": { + "isCustomerInitiatedMaintenanceAllowed": bool, + "lastOperationMessage": "str", + "lastOperationResultCode": "str", + "maintenanceWindowEndTime": "2020-02-20 00:00:00", + "maintenanceWindowStartTime": "2020-02-20 00:00:00", + "preMaintenanceWindowEndTime": "2020-02-20 00:00:00", + "preMaintenanceWindowStartTime": "2020-02-20 00:00:00", + }, + "osName": "str", + "osVersion": "str", + "patchStatus": { + "availablePatchSummary": { + "assessmentActivityId": "str", + "criticalAndSecurityPatchCount": 0, + "error": { + "code": "str", + "details": [{"code": "str", "message": "str", "target": "str"}], + "innererror": {"errordetail": "str", "exceptiontype": "str"}, + "message": "str", + "target": "str", + }, + "lastModifiedTime": "2020-02-20 00:00:00", + "otherPatchCount": 0, + "rebootPending": bool, + "startTime": "2020-02-20 00:00:00", + "status": "str", + }, + "configurationStatuses": [ + { + "code": "str", + "displayStatus": "str", + "level": "str", + "message": "str", + "time": "2020-02-20 00:00:00", + } + ], + "lastPatchInstallationSummary": { + "error": { + "code": "str", + "details": [{"code": "str", "message": "str", "target": "str"}], + "innererror": {"errordetail": "str", "exceptiontype": "str"}, + "message": "str", + "target": "str", + }, + "excludedPatchCount": 0, + "failedPatchCount": 0, + "installationActivityId": "str", + "installedPatchCount": 0, + "lastModifiedTime": "2020-02-20 00:00:00", + "maintenanceWindowExceeded": bool, + "notSelectedPatchCount": 0, + "pendingPatchCount": 0, + "startTime": "2020-02-20 00:00:00", + "status": "str", + }, + }, + "platformFaultDomain": 0, + "platformUpdateDomain": 0, + "rdpThumbPrint": "str", + "statuses": [ + { + "code": "str", + "displayStatus": "str", + "level": "str", + "message": "str", + "time": "2020-02-20 00:00:00", + } + ], + "vmAgent": { + "extensionHandlers": [ + { + "status": { + "code": "str", + "displayStatus": "str", + "level": "str", + "message": "str", + "time": "2020-02-20 00:00:00", + }, + "type": "str", + "typeHandlerVersion": "str", + } + ], + "statuses": [ + { + "code": "str", + "displayStatus": "str", + "level": "str", + "message": "str", + "time": "2020-02-20 00:00:00", + } + ], + "vmAgentVersion": "str", + }, + "vmHealth": { + "status": { + "code": "str", + "displayStatus": "str", + "level": "str", + "message": "str", + "time": "2020-02-20 00:00:00", + } + }, + }, + "licenseType": "str", + "networkProfile": { + "networkApiVersion": "str", + "networkInterfaceConfigurations": [ + { + "name": "str", + "properties": { + "ipConfigurations": [ + { + "name": "str", + "properties": { + "applicationGatewayBackendAddressPools": [{"id": "str"}], + "applicationSecurityGroups": [{"id": "str"}], + "loadBalancerBackendAddressPools": [{"id": "str"}], + "primary": bool, + "privateIPAddressVersion": "str", + "publicIPAddressConfiguration": { + "name": "str", + "properties": { + "deleteOption": "str", + "dnsSettings": { + "domainNameLabel": "str", + "domainNameLabelScope": "str", + }, + "idleTimeoutInMinutes": 0, + "ipTags": [{"ipTagType": "str", "tag": "str"}], + "publicIPAddressVersion": "str", + "publicIPAllocationMethod": "str", + "publicIPPrefix": {"id": "str"}, + }, + "sku": {"name": "str", "tier": "str"}, + "tags": {"str": "str"}, + }, + "subnet": {"id": "str"}, + }, + } + ], + "auxiliaryMode": "str", + "auxiliarySku": "str", + "deleteOption": "str", + "disableTcpStateTracking": bool, + "dnsSettings": {"dnsServers": ["str"]}, + "dscpConfiguration": {"id": "str"}, + "enableAcceleratedNetworking": bool, + "enableFpga": bool, + "enableIPForwarding": bool, + "networkSecurityGroup": {"id": "str"}, + "primary": bool, + }, + "tags": {"str": "str"}, + } + ], + "networkInterfaces": [ + {"id": "str", "properties": {"deleteOption": "str", "primary": bool}} + ], + }, + "osProfile": { + "adminPassword": "str", + "adminUsername": "str", + "allowExtensionOperations": bool, + "computerName": "str", + "customData": "str", + "linuxConfiguration": { + "disablePasswordAuthentication": bool, + "enableVMAgentPlatformUpdates": bool, + "patchSettings": { + "assessmentMode": "str", + "automaticByPlatformSettings": { + "bypassPlatformSafetyChecksOnUserSchedule": bool, + "rebootSetting": "str", + }, + "patchMode": "str", + }, + "provisionVMAgent": bool, + "ssh": {"publicKeys": [{"keyData": "str", "path": "str"}]}, + }, + "requireGuestProvisionSignal": bool, + "secrets": [ + { + "sourceVault": {"id": "str"}, + "vaultCertificates": [{"certificateStore": "str", "certificateUrl": "str"}], + } + ], + "windowsConfiguration": { + "additionalUnattendContent": [ + { + "componentName": "Microsoft-Windows-Shell-Setup", + "content": "str", + "passName": "str", + "settingName": "str", + } + ], + "enableAutomaticUpdates": bool, + "enableVMAgentPlatformUpdates": bool, + "patchSettings": { + "assessmentMode": "str", + "automaticByPlatformSettings": { + "bypassPlatformSafetyChecksOnUserSchedule": bool, + "rebootSetting": "str", + }, + "enableHotpatching": bool, + "patchMode": "str", + }, + "provisionVMAgent": bool, + "timeZone": "str", + "winRM": {"listeners": [{"certificateUrl": "str", "protocol": "str"}]}, + }, + }, + "platformFaultDomain": 0, + "priority": "str", + "provisioningState": "str", + "proximityPlacementGroup": {"id": "str"}, + "scheduledEventsPolicy": { + "allInstancesDown": {"automaticallyApprove": bool}, + "scheduledEventsAdditionalPublishingTargets": { + "eventGridAndResourceGraph": {"enable": bool, "scheduledEventsApiVersion": "str"} + }, + "userInitiatedReboot": {"automaticallyApprove": bool}, + "userInitiatedRedeploy": {"automaticallyApprove": bool}, + }, + "scheduledEventsProfile": { + "osImageNotificationProfile": {"enable": bool, "notBeforeTimeout": "str"}, + "terminateNotificationProfile": {"enable": bool, "notBeforeTimeout": "str"}, + }, + "securityProfile": { + "encryptionAtHost": bool, + "encryptionIdentity": {"userAssignedIdentityResourceId": "str"}, + "proxyAgentSettings": { + "addProxyAgentExtension": bool, + "enabled": bool, + "imds": {"inVMAccessControlProfileReferenceId": "str", "mode": "str"}, + "keyIncarnationId": 0, + "mode": "str", + "wireServer": {"inVMAccessControlProfileReferenceId": "str", "mode": "str"}, + }, + "securityType": "str", + "uefiSettings": {"secureBootEnabled": bool, "vTpmEnabled": bool}, + }, + "storageProfile": { + "alignRegionalDisksToVMZone": bool, + "dataDisks": [ + { + "createOption": "str", + "lun": 0, + "caching": "str", + "deleteOption": "str", + "detachOption": "str", + "diskIOPSReadWrite": 0, + "diskMBpsReadWrite": 0, + "diskSizeGB": 0, + "image": {"uri": "str"}, + "managedDisk": { + "diskEncryptionSet": {"id": "str"}, + "id": "str", + "securityProfile": { + "diskEncryptionSet": {"id": "str"}, + "securityEncryptionType": "str", + }, + "storageAccountType": "str", + }, + "name": "str", + "sourceResource": {"id": "str"}, + "toBeDetached": bool, + "vhd": {"uri": "str"}, + "writeAcceleratorEnabled": bool, + } + ], + "diskControllerType": "str", + "imageReference": { + "communityGalleryImageId": "str", + "exactVersion": "str", + "id": "str", + "offer": "str", + "publisher": "str", + "sharedGalleryImageId": "str", + "sku": "str", + "version": "str", + }, + "osDisk": { + "createOption": "str", + "caching": "str", + "deleteOption": "str", + "diffDiskSettings": {"option": "str", "placement": "str"}, + "diskSizeGB": 0, + "encryptionSettings": { + "diskEncryptionKey": {"secretUrl": "str", "sourceVault": {"id": "str"}}, + "enabled": bool, + "keyEncryptionKey": {"keyUrl": "str", "sourceVault": {"id": "str"}}, + }, + "image": {"uri": "str"}, + "managedDisk": { + "diskEncryptionSet": {"id": "str"}, + "id": "str", + "securityProfile": { + "diskEncryptionSet": {"id": "str"}, + "securityEncryptionType": "str", + }, + "storageAccountType": "str", + }, + "name": "str", + "osType": "str", + "vhd": {"uri": "str"}, + "writeAcceleratorEnabled": bool, + }, + }, + "timeCreated": "2020-02-20 00:00:00", + "userData": "str", + "virtualMachineScaleSet": {"id": "str"}, + "vmId": "str", + }, + "tags": {"str": "str"}, + "zones": ["str"], + }, + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_virtual_machines_begin_delete(self, resource_group): + response = await ( + await self.client.virtual_machines.begin_delete( + resource_group_name=resource_group.name, + vm_name="str", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_virtual_machines_list(self, resource_group): + response = self.client.virtual_machines.list( + resource_group_name=resource_group.name, + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_virtual_machines_list_all(self, resource_group): + response = self.client.virtual_machines.list_all() + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_virtual_machines_begin_assess_patches(self, resource_group): + response = await ( + await self.client.virtual_machines.begin_assess_patches( + resource_group_name=resource_group.name, + vm_name="str", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_virtual_machines_begin_attach_detach_data_disks(self, resource_group): + response = await ( + await self.client.virtual_machines.begin_attach_detach_data_disks( + resource_group_name=resource_group.name, + vm_name="str", + body={ + "dataDisksToAttach": [ + { + "diskId": "str", + "caching": "str", + "deleteOption": "str", + "diskEncryptionSet": {"id": "str"}, + "lun": 0, + "writeAcceleratorEnabled": bool, + } + ], + "dataDisksToDetach": [{"diskId": "str", "detachOption": "str"}], + }, + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_virtual_machines_begin_capture(self, resource_group): + response = await ( + await self.client.virtual_machines.begin_capture( + resource_group_name=resource_group.name, + vm_name="str", + body={"destinationContainerName": "str", "overwriteVhds": bool, "vhdPrefix": "str"}, + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_virtual_machines_begin_convert_to_managed_disks(self, resource_group): + response = await ( + await self.client.virtual_machines.begin_convert_to_managed_disks( + resource_group_name=resource_group.name, + vm_name="str", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_virtual_machines_begin_deallocate(self, resource_group): + response = await ( + await self.client.virtual_machines.begin_deallocate( + resource_group_name=resource_group.name, + vm_name="str", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_virtual_machines_generalize(self, resource_group): + response = await self.client.virtual_machines.generalize( + resource_group_name=resource_group.name, + vm_name="str", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_virtual_machines_begin_install_patches(self, resource_group): + response = await ( + await self.client.virtual_machines.begin_install_patches( + resource_group_name=resource_group.name, + vm_name="str", + body={ + "rebootSetting": "str", + "linuxParameters": { + "classificationsToInclude": ["str"], + "maintenanceRunId": "str", + "packageNameMasksToExclude": ["str"], + "packageNameMasksToInclude": ["str"], + }, + "maximumDuration": "1 day, 0:00:00", + "windowsParameters": { + "classificationsToInclude": ["str"], + "excludeKbsRequiringReboot": bool, + "kbNumbersToExclude": ["str"], + "kbNumbersToInclude": ["str"], + "maxPatchPublishDate": "2020-02-20 00:00:00", + "patchNameMasksToExclude": ["str"], + "patchNameMasksToInclude": ["str"], + }, + }, + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_virtual_machines_instance_view(self, resource_group): + response = await self.client.virtual_machines.instance_view( + resource_group_name=resource_group.name, + vm_name="str", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_virtual_machines_begin_perform_maintenance(self, resource_group): + response = await ( + await self.client.virtual_machines.begin_perform_maintenance( + resource_group_name=resource_group.name, + vm_name="str", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_virtual_machines_begin_power_off(self, resource_group): + response = await ( + await self.client.virtual_machines.begin_power_off( + resource_group_name=resource_group.name, + vm_name="str", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_virtual_machines_begin_reapply(self, resource_group): + response = await ( + await self.client.virtual_machines.begin_reapply( + resource_group_name=resource_group.name, + vm_name="str", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_virtual_machines_begin_redeploy(self, resource_group): + response = await ( + await self.client.virtual_machines.begin_redeploy( + resource_group_name=resource_group.name, + vm_name="str", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_virtual_machines_begin_reimage(self, resource_group): + response = await ( + await self.client.virtual_machines.begin_reimage( + resource_group_name=resource_group.name, + vm_name="str", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_virtual_machines_begin_restart(self, resource_group): + response = await ( + await self.client.virtual_machines.begin_restart( + resource_group_name=resource_group.name, + vm_name="str", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_virtual_machines_retrieve_boot_diagnostics_data(self, resource_group): + response = await self.client.virtual_machines.retrieve_boot_diagnostics_data( + resource_group_name=resource_group.name, + vm_name="str", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_virtual_machines_simulate_eviction(self, resource_group): + response = await self.client.virtual_machines.simulate_eviction( + resource_group_name=resource_group.name, + vm_name="str", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_virtual_machines_begin_start(self, resource_group): + response = await ( + await self.client.virtual_machines.begin_start( + resource_group_name=resource_group.name, + vm_name="str", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_virtual_machines_list_available_sizes(self, resource_group): + response = self.client.virtual_machines.list_available_sizes( + resource_group_name=resource_group.name, + vm_name="str", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_virtual_machines_begin_run_command(self, resource_group): + response = await ( + await self.client.virtual_machines.begin_run_command( + resource_group_name=resource_group.name, + vm_name="str", + body={"commandId": "str", "parameters": [{"name": "str", "value": "str"}], "script": ["str"]}, + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_virtual_machines_begin_migrate_to_vm_scale_set(self, resource_group): + response = await ( + await self.client.virtual_machines.begin_migrate_to_vm_scale_set( + resource_group_name=resource_group.name, + vm_name="str", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/compute/azure-mgmt-compute/pyproject.toml b/sdk/compute/azure-mgmt-compute/pyproject.toml index abcaf586efb9..e17b669e16f3 100644 --- a/sdk/compute/azure-mgmt-compute/pyproject.toml +++ b/sdk/compute/azure-mgmt-compute/pyproject.toml @@ -29,7 +29,7 @@ keywords = [ "azure sdk", ] dependencies = [ - "msrest>=0.7.1", + "isodate>=0.6.1", "azure-mgmt-core>=1.6.0", "typing-extensions>=4.6.0", ] @@ -54,8 +54,8 @@ content-type = "text/markdown" [tool.setuptools.packages.find] exclude = [ "tests*", - "samples*", "generated_tests*", + "samples*", "generated_samples*", "doc*", "azure", diff --git a/sdk/compute/azure-mgmt-compute/tests/test_mgmt_compute_disks.py b/sdk/compute/azure-mgmt-compute/tests/test_mgmt_compute_disks.py index dad35d6e4139..a62c94d8e75a 100644 --- a/sdk/compute/azure-mgmt-compute/tests/test_mgmt_compute_disks.py +++ b/sdk/compute/azure-mgmt-compute/tests/test_mgmt_compute_disks.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding: utf-8 # ------------------------------------------------------------------------- diff --git a/sdk/compute/azure-mgmt-compute/tests/test_mgmt_compute_galleries.py b/sdk/compute/azure-mgmt-compute/tests/test_mgmt_compute_galleries.py index f4105c2b3ee0..bddf7704ba92 100644 --- a/sdk/compute/azure-mgmt-compute/tests/test_mgmt_compute_galleries.py +++ b/sdk/compute/azure-mgmt-compute/tests/test_mgmt_compute_galleries.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding: utf-8 # ------------------------------------------------------------------------- diff --git a/sdk/compute/azure-mgmt-compute/tests/test_mgmt_compute_vm.py b/sdk/compute/azure-mgmt-compute/tests/test_mgmt_compute_vm.py index 552d79a3a807..b0fbac1fc170 100644 --- a/sdk/compute/azure-mgmt-compute/tests/test_mgmt_compute_vm.py +++ b/sdk/compute/azure-mgmt-compute/tests/test_mgmt_compute_vm.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding: utf-8 # ------------------------------------------------------------------------- diff --git a/sdk/compute/azure-mgmt-compute/tests/test_mgmt_compute_vmss.py b/sdk/compute/azure-mgmt-compute/tests/test_mgmt_compute_vmss.py index 9137deebd671..aa37be03adb6 100644 --- a/sdk/compute/azure-mgmt-compute/tests/test_mgmt_compute_vmss.py +++ b/sdk/compute/azure-mgmt-compute/tests/test_mgmt_compute_vmss.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression,too-many-lines # coding: utf-8 # ------------------------------------------------------------------------- diff --git a/sdk/compute/azure-mgmt-compute/tsp-location.yaml b/sdk/compute/azure-mgmt-compute/tsp-location.yaml new file mode 100644 index 000000000000..d42f91570606 --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/tsp-location.yaml @@ -0,0 +1,9 @@ +directory: specification/compute/Combine.Management +commit: 0c8dc3a0a993706e0847f04332ea307a8144ae40 +repo: Azure/azure-rest-api-specs +additionalDirectories: +- specification/compute/Common.Management +- specification/compute/Compute.Management +- specification/compute/Disk.Management +- specification/compute/Gallery.Management +- specification/compute/Sku.Management From bf27f038c76ec6cd43875df4e692fa1195895c3d Mon Sep 17 00:00:00 2001 From: Yuchao Yan Date: Mon, 13 Oct 2025 10:26:00 +0800 Subject: [PATCH 2/4] generate from typespec --- sdk/compute/azure-mgmt-compute/CHANGELOG.md | 207 +- .../apiview-properties.json | 18 +- .../azure/mgmt/compute/_client.py | 12 +- .../azure/mgmt/compute/aio/_client.py | 12 +- .../mgmt/compute/aio/operations/__init__.py | 4 +- .../compute/aio/operations/_operations.py | 4222 ++++++++-------- .../azure/mgmt/compute/models/_models.py | 2193 +++++++- .../azure/mgmt/compute/operations/__init__.py | 4 +- .../mgmt/compute/operations/_operations.py | 4500 +++++++++-------- ...st_compute_availability_sets_operations.py | 8 +- ...pute_availability_sets_operations_async.py | 8 +- ..._capacity_reservation_groups_operations.py | 4 +- ...ity_reservation_groups_operations_async.py | 4 +- ...ompute_capacity_reservations_operations.py | 4 +- ..._capacity_reservations_operations_async.py | 4 +- ...ompute_dedicated_host_groups_operations.py | 4 +- ..._dedicated_host_groups_operations_async.py | 4 +- ...test_compute_dedicated_hosts_operations.py | 4 +- ...ompute_dedicated_hosts_operations_async.py | 4 +- .../test_compute_disk_accesses_operations.py | 4 +- ..._compute_disk_accesses_operations_async.py | 4 +- ...compute_disk_encryption_sets_operations.py | 4 +- ...e_disk_encryption_sets_operations_async.py | 4 +- ..._compute_disk_restore_point_operations.py} | 25 +- ...te_disk_restore_point_operations_async.py} | 25 +- .../test_compute_disks_operations.py | 11 +- .../test_compute_disks_operations_async.py | 11 +- .../test_compute_galleries_operations.py | 6 +- ...test_compute_galleries_operations_async.py | 6 +- ...gallery_application_versions_operations.py | 4 +- ...y_application_versions_operations_async.py | 4 +- ...compute_gallery_applications_operations.py | 4 +- ...e_gallery_applications_operations_async.py | 4 +- ...mpute_gallery_image_versions_operations.py | 4 +- ...gallery_image_versions_operations_async.py | 4 +- .../test_compute_gallery_images_operations.py | 4 +- ...compute_gallery_images_operations_async.py | 4 +- ...ess_control_profile_versions_operations.py | 4 +- ...ntrol_profile_versions_operations_async.py | 4 +- ...n_vm_access_control_profiles_operations.py | 4 +- ...ccess_control_profiles_operations_async.py | 4 +- .../test_compute_images_operations.py | 4 +- .../test_compute_images_operations_async.py | 4 +- ...og_analytics_operation_group_operations.py | 4 +- ...lytics_operation_group_operations_async.py | 4 +- ...private_endpoint_connections_operations.py | 2 +- ...e_endpoint_connections_operations_async.py | 2 +- ...e_proximity_placement_groups_operations.py | 4 +- ...imity_placement_groups_operations_async.py | 4 +- ...te_restore_point_collections_operations.py | 4 +- ...tore_point_collections_operations_async.py | 4 +- .../test_compute_restore_points_operations.py | 2 +- ...compute_restore_points_operations_async.py | 2 +- .../test_compute_snapshots_operations.py | 11 +- ...test_compute_snapshots_operations_async.py | 11 +- ...ute_ssh_public_key_resources_operations.py | 4 +- ...h_public_key_resources_operations_async.py | 4 +- ...e_virtual_machine_extensions_operations.py | 4 +- ...ual_machine_extensions_operations_async.py | 4 +- ...virtual_machine_run_commands_operations.py | 4 +- ...l_machine_run_commands_operations_async.py | 4 +- ...machine_scale_set_extensions_operations.py | 4 +- ...e_scale_set_extensions_operations_async.py | 4 +- ...hine_scale_set_vm_extensions_operations.py | 4 +- ...cale_set_vm_extensions_operations_async.py | 4 +- ...ne_scale_set_vm_run_commands_operations.py | 4 +- ...le_set_vm_run_commands_operations_async.py | 4 +- ...irtual_machine_scale_set_vms_operations.py | 6 +- ..._machine_scale_set_vms_operations_async.py | 6 +- ...e_virtual_machine_scale_sets_operations.py | 14 +- ...ual_machine_scale_sets_operations_async.py | 14 +- ...est_compute_virtual_machines_operations.py | 12 +- ...mpute_virtual_machines_operations_async.py | 12 +- 73 files changed, 6851 insertions(+), 4691 deletions(-) rename sdk/compute/azure-mgmt-compute/generated_tests/{test_compute_disk_restore_points_operations.py => test_compute_disk_restore_point_operations.py} (74%) rename sdk/compute/azure-mgmt-compute/generated_tests/{test_compute_disk_restore_points_operations_async.py => test_compute_disk_restore_point_operations_async.py} (75%) diff --git a/sdk/compute/azure-mgmt-compute/CHANGELOG.md b/sdk/compute/azure-mgmt-compute/CHANGELOG.md index 3c4dd04dc68b..e7dc8eef44c8 100644 --- a/sdk/compute/azure-mgmt-compute/CHANGELOG.md +++ b/sdk/compute/azure-mgmt-compute/CHANGELOG.md @@ -32,10 +32,8 @@ - Model `Usage` added property `unit` - Model `UserArtifactManage` added property `update_property` - Model `VirtualMachineRunCommandUpdate` added property `properties` - - Model `VirtualMachineScaleSetExtension` added property `vm_type` - Model `VirtualMachineScaleSetExtensionUpdate` added property `properties` - Model `VirtualMachineScaleSetVMExtension` added property `properties` - - Model `VirtualMachineScaleSetVMExtension` added property `vm_type` - Model `VirtualMachineScaleSetVMExtensionUpdate` added property `properties` - Model `VirtualMachineUpdate` added property `properties` - Added model `ApproveRollingUpgradeParameterBody` @@ -71,7 +69,6 @@ - Model `VirtualMachinesOperations` added parameter `match_condition` in method `begin_create_or_update` - Model `VirtualMachinesOperations` added parameter `etag` in method `begin_update` - Model `VirtualMachinesOperations` added parameter `match_condition` in method `begin_update` - - Added model `DiskRestorePointsOperations` - Added model `LogAnalyticsOperationGroupOperations` - Added model `PrivateEndpointConnectionsOperations` - Added model `RollingUpgradeStatusInfosOperations` @@ -230,7 +227,6 @@ - Model `VirtualMachineScaleSetExtensionUpdate` deleted or renamed its instance variable `provision_after_extensions` - Model `VirtualMachineScaleSetExtensionUpdate` deleted or renamed its instance variable `suppress_failures` - Model `VirtualMachineScaleSetExtensionUpdate` deleted or renamed its instance variable `protected_settings_from_key_vault` - - Model `VirtualMachineScaleSetVMExtension` deleted or renamed its instance variable `type` - Model `VirtualMachineScaleSetVMExtension` deleted or renamed its instance variable `force_update_tag` - Model `VirtualMachineScaleSetVMExtension` deleted or renamed its instance variable `publisher` - Model `VirtualMachineScaleSetVMExtension` deleted or renamed its instance variable `type_properties_type` @@ -347,192 +343,60 @@ - Deleted or renamed model `VirtualMachineScaleSetListOSUpgradeHistory` - Deleted or renamed model `VirtualMachineScaleSetListSkusResult` - Deleted or renamed model `VirtualMachineScaleSetListWithLinkResult` - - Method `AvailabilitySetsOperations.create_or_update` inserted a `positional_or_keyword` parameter `resource` - - Method `AvailabilitySetsOperations.create_or_update` deleted or renamed its parameter `parameters` of kind `positional_or_keyword` - Method `AvailabilitySetsOperations.list_by_subscription` changed its parameter `expand` from `positional_or_keyword` to `keyword_only` - - Method `AvailabilitySetsOperations.start_migration_to_virtual_machine_scale_set` inserted a `positional_or_keyword` parameter `body` - - Method `AvailabilitySetsOperations.start_migration_to_virtual_machine_scale_set` deleted or renamed its parameter `parameters` of kind `positional_or_keyword` - - Method `AvailabilitySetsOperations.update` inserted a `positional_or_keyword` parameter `properties` - - Method `AvailabilitySetsOperations.update` deleted or renamed its parameter `parameters` of kind `positional_or_keyword` - - Method `AvailabilitySetsOperations.validate_migration_to_virtual_machine_scale_set` inserted a `positional_or_keyword` parameter `body` - - Method `AvailabilitySetsOperations.validate_migration_to_virtual_machine_scale_set` deleted or renamed its parameter `parameters` of kind `positional_or_keyword` - - Method `CapacityReservationGroupsOperations.create_or_update` inserted a `positional_or_keyword` parameter `resource` - - Method `CapacityReservationGroupsOperations.create_or_update` deleted or renamed its parameter `parameters` of kind `positional_or_keyword` - Method `CapacityReservationGroupsOperations.get` changed its parameter `expand` from `positional_or_keyword` to `keyword_only` - Method `CapacityReservationGroupsOperations.list_by_resource_group` changed its parameter `expand` from `positional_or_keyword` to `keyword_only` - Method `CapacityReservationGroupsOperations.list_by_subscription` changed its parameter `expand` from `positional_or_keyword` to `keyword_only` - Method `CapacityReservationGroupsOperations.list_by_subscription` changed its parameter `resource_ids_only` from `positional_or_keyword` to `keyword_only` - - Method `CapacityReservationGroupsOperations.update` inserted a `positional_or_keyword` parameter `properties` - - Method `CapacityReservationGroupsOperations.update` deleted or renamed its parameter `parameters` of kind `positional_or_keyword` - - Method `CapacityReservationsOperations.begin_create_or_update` inserted a `positional_or_keyword` parameter `resource` - - Method `CapacityReservationsOperations.begin_create_or_update` deleted or renamed its parameter `parameters` of kind `positional_or_keyword` - - Method `CapacityReservationsOperations.begin_update` inserted a `positional_or_keyword` parameter `properties` - - Method `CapacityReservationsOperations.begin_update` deleted or renamed its parameter `parameters` of kind `positional_or_keyword` - Method `CapacityReservationsOperations.get` changed its parameter `expand` from `positional_or_keyword` to `keyword_only` - - Method `DedicatedHostGroupsOperations.create_or_update` inserted a `positional_or_keyword` parameter `resource` - - Method `DedicatedHostGroupsOperations.create_or_update` deleted or renamed its parameter `parameters` of kind `positional_or_keyword` - Method `DedicatedHostGroupsOperations.get` changed its parameter `expand` from `positional_or_keyword` to `keyword_only` - - Method `DedicatedHostGroupsOperations.update` inserted a `positional_or_keyword` parameter `properties` - - Method `DedicatedHostGroupsOperations.update` deleted or renamed its parameter `parameters` of kind `positional_or_keyword` - - Method `DedicatedHostsOperations.begin_create_or_update` inserted a `positional_or_keyword` parameter `resource` - - Method `DedicatedHostsOperations.begin_create_or_update` deleted or renamed its parameter `parameters` of kind `positional_or_keyword` - - Method `DedicatedHostsOperations.begin_update` inserted a `positional_or_keyword` parameter `properties` - - Method `DedicatedHostsOperations.begin_update` deleted or renamed its parameter `parameters` of kind `positional_or_keyword` - Method `DedicatedHostsOperations.get` changed its parameter `expand` from `positional_or_keyword` to `keyword_only` - - Method `DiskAccessesOperations.begin_create_or_update` inserted a `positional_or_keyword` parameter `resource` - - Method `DiskAccessesOperations.begin_create_or_update` deleted or renamed its parameter `disk_access` of kind `positional_or_keyword` - - Method `DiskAccessesOperations.begin_update` inserted a `positional_or_keyword` parameter `properties` - - Method `DiskAccessesOperations.begin_update` deleted or renamed its parameter `disk_access` of kind `positional_or_keyword` - Deleted or renamed method `DiskAccessesOperations.begin_delete_a_private_endpoint_connection` - Deleted or renamed method `DiskAccessesOperations.begin_update_a_private_endpoint_connection` - Deleted or renamed method `DiskAccessesOperations.get_a_private_endpoint_connection` - Deleted or renamed method `DiskAccessesOperations.list_private_endpoint_connections` - - Method `DiskEncryptionSetsOperations.begin_create_or_update` inserted a `positional_or_keyword` parameter `resource` - - Method `DiskEncryptionSetsOperations.begin_create_or_update` deleted or renamed its parameter `disk_encryption_set` of kind `positional_or_keyword` - - Method `DiskEncryptionSetsOperations.begin_update` inserted a `positional_or_keyword` parameter `properties` - - Method `DiskEncryptionSetsOperations.begin_update` deleted or renamed its parameter `disk_encryption_set` of kind `positional_or_keyword` - - Method `DisksOperations.begin_create_or_update` inserted a `positional_or_keyword` parameter `resource` - - Method `DisksOperations.begin_create_or_update` deleted or renamed its parameter `disk` of kind `positional_or_keyword` - - Method `DisksOperations.begin_grant_access` inserted a `positional_or_keyword` parameter `body` - - Method `DisksOperations.begin_grant_access` deleted or renamed its parameter `grant_access_data` of kind `positional_or_keyword` - - Method `DisksOperations.begin_update` inserted a `positional_or_keyword` parameter `properties` - - Method `DisksOperations.begin_update` deleted or renamed its parameter `disk` of kind `positional_or_keyword` - - Method `GalleriesOperations.begin_create_or_update` inserted a `positional_or_keyword` parameter `resource` - - Method `GalleriesOperations.begin_create_or_update` deleted or renamed its parameter `gallery` of kind `positional_or_keyword` - - Method `GalleriesOperations.begin_update` inserted a `positional_or_keyword` parameter `properties` - - Method `GalleriesOperations.begin_update` deleted or renamed its parameter `gallery` of kind `positional_or_keyword` - Method `GalleriesOperations.get` changed its parameter `select` from `positional_or_keyword` to `keyword_only` - Method `GalleriesOperations.get` changed its parameter `expand` from `positional_or_keyword` to `keyword_only` - - Method `GalleryApplicationVersionsOperations.begin_create_or_update` inserted a `positional_or_keyword` parameter `resource` - - Method `GalleryApplicationVersionsOperations.begin_create_or_update` deleted or renamed its parameter `gallery_application_version` of kind `positional_or_keyword` - - Method `GalleryApplicationVersionsOperations.begin_update` inserted a `positional_or_keyword` parameter `properties` - - Method `GalleryApplicationVersionsOperations.begin_update` deleted or renamed its parameter `gallery_application_version` of kind `positional_or_keyword` - Method `GalleryApplicationVersionsOperations.get` changed its parameter `expand` from `positional_or_keyword` to `keyword_only` - - Method `GalleryApplicationsOperations.begin_create_or_update` inserted a `positional_or_keyword` parameter `resource` - - Method `GalleryApplicationsOperations.begin_create_or_update` deleted or renamed its parameter `gallery_application` of kind `positional_or_keyword` - - Method `GalleryApplicationsOperations.begin_update` inserted a `positional_or_keyword` parameter `properties` - - Method `GalleryApplicationsOperations.begin_update` deleted or renamed its parameter `gallery_application` of kind `positional_or_keyword` - - Method `GalleryImageVersionsOperations.begin_create_or_update` inserted a `positional_or_keyword` parameter `resource` - - Method `GalleryImageVersionsOperations.begin_create_or_update` deleted or renamed its parameter `gallery_image_version` of kind `positional_or_keyword` - - Method `GalleryImageVersionsOperations.begin_update` inserted a `positional_or_keyword` parameter `properties` - - Method `GalleryImageVersionsOperations.begin_update` deleted or renamed its parameter `gallery_image_version` of kind `positional_or_keyword` - Method `GalleryImageVersionsOperations.get` changed its parameter `expand` from `positional_or_keyword` to `keyword_only` - - Method `GalleryImagesOperations.begin_create_or_update` inserted a `positional_or_keyword` parameter `resource` - - Method `GalleryImagesOperations.begin_create_or_update` deleted or renamed its parameter `gallery_image` of kind `positional_or_keyword` - - Method `GalleryImagesOperations.begin_update` inserted a `positional_or_keyword` parameter `properties` - - Method `GalleryImagesOperations.begin_update` deleted or renamed its parameter `gallery_image` of kind `positional_or_keyword` - - Method `GalleryInVMAccessControlProfileVersionsOperations.begin_create_or_update` inserted a `positional_or_keyword` parameter `resource` - - Method `GalleryInVMAccessControlProfileVersionsOperations.begin_create_or_update` deleted or renamed its parameter `gallery_in_vm_access_control_profile_version` of kind `positional_or_keyword` - - Method `GalleryInVMAccessControlProfileVersionsOperations.begin_update` inserted a `positional_or_keyword` parameter `properties` - - Method `GalleryInVMAccessControlProfileVersionsOperations.begin_update` deleted or renamed its parameter `gallery_in_vm_access_control_profile_version` of kind `positional_or_keyword` - - Method `GalleryInVMAccessControlProfilesOperations.begin_create_or_update` inserted a `positional_or_keyword` parameter `resource` - - Method `GalleryInVMAccessControlProfilesOperations.begin_create_or_update` deleted or renamed its parameter `gallery_in_vm_access_control_profile` of kind `positional_or_keyword` - - Method `GalleryInVMAccessControlProfilesOperations.begin_update` inserted a `positional_or_keyword` parameter `properties` - - Method `GalleryInVMAccessControlProfilesOperations.begin_update` deleted or renamed its parameter `gallery_in_vm_access_control_profile` of kind `positional_or_keyword` - - Method `ImagesOperations.begin_create_or_update` inserted a `positional_or_keyword` parameter `resource` - - Method `ImagesOperations.begin_create_or_update` deleted or renamed its parameter `parameters` of kind `positional_or_keyword` - - Method `ImagesOperations.begin_update` inserted a `positional_or_keyword` parameter `properties` - - Method `ImagesOperations.begin_update` deleted or renamed its parameter `parameters` of kind `positional_or_keyword` - Method `ImagesOperations.get` changed its parameter `expand` from `positional_or_keyword` to `keyword_only` - - Method `ProximityPlacementGroupsOperations.create_or_update` inserted a `positional_or_keyword` parameter `resource` - - Method `ProximityPlacementGroupsOperations.create_or_update` deleted or renamed its parameter `parameters` of kind `positional_or_keyword` - Method `ProximityPlacementGroupsOperations.get` changed its parameter `include_colocation_status` from `positional_or_keyword` to `keyword_only` - - Method `ProximityPlacementGroupsOperations.update` inserted a `positional_or_keyword` parameter `properties` - - Method `ProximityPlacementGroupsOperations.update` deleted or renamed its parameter `parameters` of kind `positional_or_keyword` - Method `ResourceSkusOperations.list` changed its parameter `include_extended_locations` from `positional_or_keyword` to `keyword_only` - - Method `RestorePointCollectionsOperations.create_or_update` inserted a `positional_or_keyword` parameter `resource` - - Method `RestorePointCollectionsOperations.create_or_update` deleted or renamed its parameter `parameters` of kind `positional_or_keyword` - Method `RestorePointCollectionsOperations.get` changed its parameter `expand` from `positional_or_keyword` to `keyword_only` - - Method `RestorePointCollectionsOperations.update` inserted a `positional_or_keyword` parameter `properties` - - Method `RestorePointCollectionsOperations.update` deleted or renamed its parameter `parameters` of kind `positional_or_keyword` - - Method `RestorePointsOperations.begin_create` inserted a `positional_or_keyword` parameter `resource` - - Method `RestorePointsOperations.begin_create` deleted or renamed its parameter `parameters` of kind `positional_or_keyword` - Method `RestorePointsOperations.get` changed its parameter `expand` from `positional_or_keyword` to `keyword_only` - Method `SharedGalleriesOperations.list` changed its parameter `shared_to` from `positional_or_keyword` to `keyword_only` - Method `SharedGalleryImageVersionsOperations.list` changed its parameter `shared_to` from `positional_or_keyword` to `keyword_only` - Method `SharedGalleryImagesOperations.list` changed its parameter `shared_to` from `positional_or_keyword` to `keyword_only` - - Method `SnapshotsOperations.begin_create_or_update` inserted a `positional_or_keyword` parameter `resource` - - Method `SnapshotsOperations.begin_create_or_update` deleted or renamed its parameter `snapshot` of kind `positional_or_keyword` - - Method `SnapshotsOperations.begin_grant_access` inserted a `positional_or_keyword` parameter `body` - - Method `SnapshotsOperations.begin_grant_access` deleted or renamed its parameter `grant_access_data` of kind `positional_or_keyword` - - Method `SnapshotsOperations.begin_update` inserted a `positional_or_keyword` parameter `properties` - - Method `SnapshotsOperations.begin_update` deleted or renamed its parameter `snapshot` of kind `positional_or_keyword` - Method `VirtualMachineExtensionImagesOperations.list_versions` changed its parameter `orderby` from `positional_or_keyword` to `keyword_only` - - Method `VirtualMachineExtensionsOperations.begin_create_or_update` inserted a `positional_or_keyword` parameter `resource` - - Method `VirtualMachineExtensionsOperations.begin_create_or_update` deleted or renamed its parameter `extension_parameters` of kind `positional_or_keyword` - - Method `VirtualMachineExtensionsOperations.begin_update` inserted a `positional_or_keyword` parameter `properties` - - Method `VirtualMachineExtensionsOperations.begin_update` deleted or renamed its parameter `extension_parameters` of kind `positional_or_keyword` - Method `VirtualMachineExtensionsOperations.get` changed its parameter `expand` from `positional_or_keyword` to `keyword_only` - Method `VirtualMachineExtensionsOperations.list` changed its parameter `expand` from `positional_or_keyword` to `keyword_only` - - Method `VirtualMachineRunCommandsOperations.begin_create_or_update` inserted a `positional_or_keyword` parameter `body` - - Method `VirtualMachineRunCommandsOperations.begin_create_or_update` deleted or renamed its parameter `run_command` of kind `positional_or_keyword` - - Method `VirtualMachineRunCommandsOperations.begin_update` inserted a `positional_or_keyword` parameter `body` - - Method `VirtualMachineRunCommandsOperations.begin_update` deleted or renamed its parameter `run_command` of kind `positional_or_keyword` - Method `VirtualMachineRunCommandsOperations.get_by_virtual_machine` changed its parameter `expand` from `positional_or_keyword` to `keyword_only` - Method `VirtualMachineRunCommandsOperations.list_by_virtual_machine` changed its parameter `expand` from `positional_or_keyword` to `keyword_only` - Deleted or renamed method `VirtualMachineRunCommandsOperations.get` - Deleted or renamed method `VirtualMachineRunCommandsOperations.list` - - Method `VirtualMachineScaleSetExtensionsOperations.begin_create_or_update` inserted a `positional_or_keyword` parameter `resource` - - Method `VirtualMachineScaleSetExtensionsOperations.begin_create_or_update` deleted or renamed its parameter `extension_parameters` of kind `positional_or_keyword` - - Method `VirtualMachineScaleSetExtensionsOperations.begin_update` inserted a `positional_or_keyword` parameter `properties` - - Method `VirtualMachineScaleSetExtensionsOperations.begin_update` deleted or renamed its parameter `extension_parameters` of kind `positional_or_keyword` - Method `VirtualMachineScaleSetExtensionsOperations.get` changed its parameter `expand` from `positional_or_keyword` to `keyword_only` - - Method `VirtualMachineScaleSetVMExtensionsOperations.begin_create_or_update` inserted a `positional_or_keyword` parameter `resource` - - Method `VirtualMachineScaleSetVMExtensionsOperations.begin_create_or_update` deleted or renamed its parameter `extension_parameters` of kind `positional_or_keyword` - - Method `VirtualMachineScaleSetVMExtensionsOperations.begin_update` inserted a `positional_or_keyword` parameter `properties` - - Method `VirtualMachineScaleSetVMExtensionsOperations.begin_update` deleted or renamed its parameter `extension_parameters` of kind `positional_or_keyword` - Method `VirtualMachineScaleSetVMExtensionsOperations.get` changed its parameter `expand` from `positional_or_keyword` to `keyword_only` - Method `VirtualMachineScaleSetVMExtensionsOperations.list` changed its parameter `expand` from `positional_or_keyword` to `keyword_only` - - Method `VirtualMachineScaleSetVMRunCommandsOperations.begin_create_or_update` inserted a `positional_or_keyword` parameter `body` - - Method `VirtualMachineScaleSetVMRunCommandsOperations.begin_create_or_update` deleted or renamed its parameter `run_command` of kind `positional_or_keyword` - - Method `VirtualMachineScaleSetVMRunCommandsOperations.begin_update` inserted a `positional_or_keyword` parameter `body` - - Method `VirtualMachineScaleSetVMRunCommandsOperations.begin_update` deleted or renamed its parameter `run_command` of kind `positional_or_keyword` - Method `VirtualMachineScaleSetVMRunCommandsOperations.get` changed its parameter `expand` from `positional_or_keyword` to `keyword_only` - Method `VirtualMachineScaleSetVMRunCommandsOperations.list` changed its parameter `expand` from `positional_or_keyword` to `keyword_only` - - Method `VirtualMachineScaleSetsOperations.begin_create_or_update` inserted a `positional_or_keyword` parameter `resource` - - Method `VirtualMachineScaleSetsOperations.begin_create_or_update` deleted or renamed its parameter `parameters` of kind `positional_or_keyword` - Method `VirtualMachineScaleSetsOperations.begin_create_or_update` deleted or renamed its parameter `if_match` of kind `positional_or_keyword` - Method `VirtualMachineScaleSetsOperations.begin_create_or_update` deleted or renamed its parameter `if_none_match` of kind `positional_or_keyword` - Method `VirtualMachineScaleSetsOperations.begin_deallocate` changed its parameter `hibernate` from `positional_or_keyword` to `keyword_only` - Method `VirtualMachineScaleSetsOperations.begin_delete` changed its parameter `force_deletion` from `positional_or_keyword` to `keyword_only` - Method `VirtualMachineScaleSetsOperations.begin_delete_instances` changed its parameter `force_deletion` from `positional_or_keyword` to `keyword_only` - - Method `VirtualMachineScaleSetsOperations.begin_delete_instances` inserted a `positional_or_keyword` parameter `body` - - Method `VirtualMachineScaleSetsOperations.begin_delete_instances` deleted or renamed its parameter `vm_instance_i_ds` of kind `positional_or_keyword` - Method `VirtualMachineScaleSetsOperations.begin_power_off` changed its parameter `skip_shutdown` from `positional_or_keyword` to `keyword_only` - - Method `VirtualMachineScaleSetsOperations.begin_scale_out` inserted a `positional_or_keyword` parameter `body` - - Method `VirtualMachineScaleSetsOperations.begin_scale_out` deleted or renamed its parameter `parameters` of kind `positional_or_keyword` - - Method `VirtualMachineScaleSetsOperations.begin_set_orchestration_service_state` inserted a `positional_or_keyword` parameter `body` - - Method `VirtualMachineScaleSetsOperations.begin_set_orchestration_service_state` deleted or renamed its parameter `parameters` of kind `positional_or_keyword` - - Method `VirtualMachineScaleSetsOperations.begin_update` inserted a `positional_or_keyword` parameter `properties` - - Method `VirtualMachineScaleSetsOperations.begin_update` deleted or renamed its parameter `parameters` of kind `positional_or_keyword` - Method `VirtualMachineScaleSetsOperations.begin_update` deleted or renamed its parameter `if_match` of kind `positional_or_keyword` - Method `VirtualMachineScaleSetsOperations.begin_update` deleted or renamed its parameter `if_none_match` of kind `positional_or_keyword` - - Method `VirtualMachineScaleSetsOperations.begin_update_instances` inserted a `positional_or_keyword` parameter `body` - - Method `VirtualMachineScaleSetsOperations.begin_update_instances` deleted or renamed its parameter `vm_instance_i_ds` of kind `positional_or_keyword` - - Method `VirtualMachineScaleSetsOperations.convert_to_single_placement_group` inserted a `positional_or_keyword` parameter `body` - - Method `VirtualMachineScaleSetsOperations.convert_to_single_placement_group` deleted or renamed its parameter `parameters` of kind `positional_or_keyword` - Method `VirtualMachineScaleSetsOperations.force_recovery_service_fabric_platform_update_domain_walk` changed its parameter `platform_update_domain` from `positional_or_keyword` to `keyword_only` - Method `VirtualMachineScaleSetsOperations.force_recovery_service_fabric_platform_update_domain_walk` changed its parameter `zone` from `positional_or_keyword` to `keyword_only` - Method `VirtualMachineScaleSetsOperations.force_recovery_service_fabric_platform_update_domain_walk` changed its parameter `placement_group_id` from `positional_or_keyword` to `keyword_only` - Method `VirtualMachineScaleSetsOperations.get` changed its parameter `expand` from `positional_or_keyword` to `keyword_only` - Deleted or renamed method `VirtualMachineScaleSetsOperations.list_by_location` - - Method `VirtualMachinesOperations.begin_attach_detach_data_disks` inserted a `positional_or_keyword` parameter `body` - - Method `VirtualMachinesOperations.begin_attach_detach_data_disks` deleted or renamed its parameter `parameters` of kind `positional_or_keyword` - - Method `VirtualMachinesOperations.begin_capture` inserted a `positional_or_keyword` parameter `body` - - Method `VirtualMachinesOperations.begin_capture` deleted or renamed its parameter `parameters` of kind `positional_or_keyword` - - Method `VirtualMachinesOperations.begin_create_or_update` inserted a `positional_or_keyword` parameter `resource` - - Method `VirtualMachinesOperations.begin_create_or_update` deleted or renamed its parameter `parameters` of kind `positional_or_keyword` - Method `VirtualMachinesOperations.begin_create_or_update` deleted or renamed its parameter `if_match` of kind `positional_or_keyword` - Method `VirtualMachinesOperations.begin_create_or_update` deleted or renamed its parameter `if_none_match` of kind `positional_or_keyword` - Method `VirtualMachinesOperations.begin_deallocate` changed its parameter `hibernate` from `positional_or_keyword` to `keyword_only` - Method `VirtualMachinesOperations.begin_delete` changed its parameter `force_deletion` from `positional_or_keyword` to `keyword_only` - - Method `VirtualMachinesOperations.begin_install_patches` inserted a `positional_or_keyword` parameter `body` - - Method `VirtualMachinesOperations.begin_install_patches` deleted or renamed its parameter `install_patches_input` of kind `positional_or_keyword` - Method `VirtualMachinesOperations.begin_power_off` changed its parameter `skip_shutdown` from `positional_or_keyword` to `keyword_only` - - Method `VirtualMachinesOperations.begin_run_command` inserted a `positional_or_keyword` parameter `body` - - Method `VirtualMachinesOperations.begin_run_command` deleted or renamed its parameter `parameters` of kind `positional_or_keyword` - - Method `VirtualMachinesOperations.begin_update` inserted a `positional_or_keyword` parameter `properties` - - Method `VirtualMachinesOperations.begin_update` deleted or renamed its parameter `parameters` of kind `positional_or_keyword` - Method `VirtualMachinesOperations.begin_update` deleted or renamed its parameter `if_match` of kind `positional_or_keyword` - Method `VirtualMachinesOperations.begin_update` deleted or renamed its parameter `if_none_match` of kind `positional_or_keyword` - Method `VirtualMachinesOperations.get` changed its parameter `expand` from `positional_or_keyword` to `keyword_only` @@ -546,7 +410,6 @@ - Deleted or renamed model `CloudServiceRolesOperations` - Deleted or renamed model `CloudServicesOperations` - Deleted or renamed model `CloudServicesUpdateDomainOperations` - - Deleted or renamed model `DiskRestorePointOperations` - Deleted or renamed model `GallerySharingProfileOperations` - Deleted or renamed model `LogAnalyticsOperations` - Deleted or renamed model `SoftDeletedResourceOperations` @@ -557,74 +420,12 @@ - Deleted or renamed model `VirtualMachineScaleSetRollingUpgradesOperations` - Deleted or renamed model `VirtualMachineScaleSetVMsOperations` - Deleted or renamed model `VirtualMachineSizesOperations` - - Method `SnapshotsOperations.begin_grant_access` re-ordered its parameters from `['self', 'resource_group_name', 'snapshot_name', 'grant_access_data', 'kwargs']` to `['self', 'resource_group_name', 'snapshot_name', 'body', 'kwargs']` - - Method `SnapshotsOperations.begin_create_or_update` re-ordered its parameters from `['self', 'resource_group_name', 'snapshot_name', 'snapshot', 'kwargs']` to `['self', 'resource_group_name', 'snapshot_name', 'resource', 'kwargs']` - - Method `SnapshotsOperations.begin_update` re-ordered its parameters from `['self', 'resource_group_name', 'snapshot_name', 'snapshot', 'kwargs']` to `['self', 'resource_group_name', 'snapshot_name', 'properties', 'kwargs']` - - Method `VirtualMachineScaleSetsOperations.begin_update_instances` re-ordered its parameters from `['self', 'resource_group_name', 'vm_scale_set_name', 'vm_instance_i_ds', 'kwargs']` to `['self', 'resource_group_name', 'vm_scale_set_name', 'body', 'kwargs']` - Method `VirtualMachineScaleSetsOperations.begin_deallocate` re-ordered its parameters from `['self', 'resource_group_name', 'vm_scale_set_name', 'hibernate', 'vm_instance_i_ds', 'kwargs']` to `['self', 'resource_group_name', 'vm_scale_set_name', 'vm_instance_i_ds', 'hibernate', 'kwargs']` - - Method `VirtualMachineScaleSetsOperations.begin_update` re-ordered its parameters from `['self', 'resource_group_name', 'vm_scale_set_name', 'parameters', 'if_match', 'if_none_match', 'kwargs']` to `['self', 'resource_group_name', 'vm_scale_set_name', 'properties', 'etag', 'match_condition', 'kwargs']` - - Method `VirtualMachineScaleSetsOperations.begin_delete_instances` re-ordered its parameters from `['self', 'resource_group_name', 'vm_scale_set_name', 'vm_instance_i_ds', 'force_deletion', 'kwargs']` to `['self', 'resource_group_name', 'vm_scale_set_name', 'body', 'force_deletion', 'kwargs']` - - Method `VirtualMachineScaleSetsOperations.begin_create_or_update` re-ordered its parameters from `['self', 'resource_group_name', 'vm_scale_set_name', 'parameters', 'if_match', 'if_none_match', 'kwargs']` to `['self', 'resource_group_name', 'vm_scale_set_name', 'resource', 'etag', 'match_condition', 'kwargs']` + - Method `VirtualMachineScaleSetsOperations.begin_update` re-ordered its parameters from `['self', 'resource_group_name', 'vm_scale_set_name', 'parameters', 'if_match', 'if_none_match', 'kwargs']` to `['self', 'resource_group_name', 'vm_scale_set_name', 'parameters', 'etag', 'match_condition', 'kwargs']` + - Method `VirtualMachineScaleSetsOperations.begin_create_or_update` re-ordered its parameters from `['self', 'resource_group_name', 'vm_scale_set_name', 'parameters', 'if_match', 'if_none_match', 'kwargs']` to `['self', 'resource_group_name', 'vm_scale_set_name', 'parameters', 'etag', 'match_condition', 'kwargs']` - Method `VirtualMachineScaleSetsOperations.begin_power_off` re-ordered its parameters from `['self', 'resource_group_name', 'vm_scale_set_name', 'skip_shutdown', 'vm_instance_i_ds', 'kwargs']` to `['self', 'resource_group_name', 'vm_scale_set_name', 'vm_instance_i_ds', 'skip_shutdown', 'kwargs']` - - Method `VirtualMachineScaleSetsOperations.begin_scale_out` re-ordered its parameters from `['self', 'resource_group_name', 'vm_scale_set_name', 'parameters', 'kwargs']` to `['self', 'resource_group_name', 'vm_scale_set_name', 'body', 'kwargs']` - - Method `VirtualMachineScaleSetsOperations.begin_set_orchestration_service_state` re-ordered its parameters from `['self', 'resource_group_name', 'vm_scale_set_name', 'parameters', 'kwargs']` to `['self', 'resource_group_name', 'vm_scale_set_name', 'body', 'kwargs']` - - Method `VirtualMachineScaleSetsOperations.convert_to_single_placement_group` re-ordered its parameters from `['self', 'resource_group_name', 'vm_scale_set_name', 'parameters', 'kwargs']` to `['self', 'resource_group_name', 'vm_scale_set_name', 'body', 'kwargs']` - - Method `RestorePointsOperations.begin_create` re-ordered its parameters from `['self', 'resource_group_name', 'restore_point_collection_name', 'restore_point_name', 'parameters', 'kwargs']` to `['self', 'resource_group_name', 'restore_point_collection_name', 'restore_point_name', 'resource', 'kwargs']` - - Method `DedicatedHostsOperations.begin_create_or_update` re-ordered its parameters from `['self', 'resource_group_name', 'host_group_name', 'host_name', 'parameters', 'kwargs']` to `['self', 'resource_group_name', 'host_group_name', 'host_name', 'resource', 'kwargs']` - - Method `DedicatedHostsOperations.begin_update` re-ordered its parameters from `['self', 'resource_group_name', 'host_group_name', 'host_name', 'parameters', 'kwargs']` to `['self', 'resource_group_name', 'host_group_name', 'host_name', 'properties', 'kwargs']` - - Method `ImagesOperations.begin_create_or_update` re-ordered its parameters from `['self', 'resource_group_name', 'image_name', 'parameters', 'kwargs']` to `['self', 'resource_group_name', 'image_name', 'resource', 'kwargs']` - - Method `ImagesOperations.begin_update` re-ordered its parameters from `['self', 'resource_group_name', 'image_name', 'parameters', 'kwargs']` to `['self', 'resource_group_name', 'image_name', 'properties', 'kwargs']` - - Method `DisksOperations.begin_grant_access` re-ordered its parameters from `['self', 'resource_group_name', 'disk_name', 'grant_access_data', 'kwargs']` to `['self', 'resource_group_name', 'disk_name', 'body', 'kwargs']` - - Method `DisksOperations.begin_create_or_update` re-ordered its parameters from `['self', 'resource_group_name', 'disk_name', 'disk', 'kwargs']` to `['self', 'resource_group_name', 'disk_name', 'resource', 'kwargs']` - - Method `DisksOperations.begin_update` re-ordered its parameters from `['self', 'resource_group_name', 'disk_name', 'disk', 'kwargs']` to `['self', 'resource_group_name', 'disk_name', 'properties', 'kwargs']` - - Method `DiskAccessesOperations.begin_create_or_update` re-ordered its parameters from `['self', 'resource_group_name', 'disk_access_name', 'disk_access', 'kwargs']` to `['self', 'resource_group_name', 'disk_access_name', 'resource', 'kwargs']` - - Method `DiskAccessesOperations.begin_update` re-ordered its parameters from `['self', 'resource_group_name', 'disk_access_name', 'disk_access', 'kwargs']` to `['self', 'resource_group_name', 'disk_access_name', 'properties', 'kwargs']` - - Method `GalleriesOperations.begin_create_or_update` re-ordered its parameters from `['self', 'resource_group_name', 'gallery_name', 'gallery', 'kwargs']` to `['self', 'resource_group_name', 'gallery_name', 'resource', 'kwargs']` - - Method `GalleriesOperations.begin_update` re-ordered its parameters from `['self', 'resource_group_name', 'gallery_name', 'gallery', 'kwargs']` to `['self', 'resource_group_name', 'gallery_name', 'properties', 'kwargs']` - - Method `VirtualMachineRunCommandsOperations.begin_create_or_update` re-ordered its parameters from `['self', 'resource_group_name', 'vm_name', 'run_command_name', 'run_command', 'kwargs']` to `['self', 'resource_group_name', 'vm_name', 'run_command_name', 'body', 'kwargs']` - - Method `VirtualMachineRunCommandsOperations.begin_update` re-ordered its parameters from `['self', 'resource_group_name', 'vm_name', 'run_command_name', 'run_command', 'kwargs']` to `['self', 'resource_group_name', 'vm_name', 'run_command_name', 'body', 'kwargs']` - - Method `GalleryInVMAccessControlProfileVersionsOperations.begin_create_or_update` re-ordered its parameters from `['self', 'resource_group_name', 'gallery_name', 'in_vm_access_control_profile_name', 'in_vm_access_control_profile_version_name', 'gallery_in_vm_access_control_profile_version', 'kwargs']` to `['self', 'resource_group_name', 'gallery_name', 'in_vm_access_control_profile_name', 'in_vm_access_control_profile_version_name', 'resource', 'kwargs']` - - Method `GalleryInVMAccessControlProfileVersionsOperations.begin_update` re-ordered its parameters from `['self', 'resource_group_name', 'gallery_name', 'in_vm_access_control_profile_name', 'in_vm_access_control_profile_version_name', 'gallery_in_vm_access_control_profile_version', 'kwargs']` to `['self', 'resource_group_name', 'gallery_name', 'in_vm_access_control_profile_name', 'in_vm_access_control_profile_version_name', 'properties', 'kwargs']` - - Method `VirtualMachineScaleSetVMRunCommandsOperations.begin_create_or_update` re-ordered its parameters from `['self', 'resource_group_name', 'vm_scale_set_name', 'instance_id', 'run_command_name', 'run_command', 'kwargs']` to `['self', 'resource_group_name', 'vm_scale_set_name', 'instance_id', 'run_command_name', 'body', 'kwargs']` - - Method `VirtualMachineScaleSetVMRunCommandsOperations.begin_update` re-ordered its parameters from `['self', 'resource_group_name', 'vm_scale_set_name', 'instance_id', 'run_command_name', 'run_command', 'kwargs']` to `['self', 'resource_group_name', 'vm_scale_set_name', 'instance_id', 'run_command_name', 'body', 'kwargs']` - - Method `ProximityPlacementGroupsOperations.create_or_update` re-ordered its parameters from `['self', 'resource_group_name', 'proximity_placement_group_name', 'parameters', 'kwargs']` to `['self', 'resource_group_name', 'proximity_placement_group_name', 'resource', 'kwargs']` - - Method `ProximityPlacementGroupsOperations.update` re-ordered its parameters from `['self', 'resource_group_name', 'proximity_placement_group_name', 'parameters', 'kwargs']` to `['self', 'resource_group_name', 'proximity_placement_group_name', 'properties', 'kwargs']` - - Method `GalleryApplicationsOperations.begin_create_or_update` re-ordered its parameters from `['self', 'resource_group_name', 'gallery_name', 'gallery_application_name', 'gallery_application', 'kwargs']` to `['self', 'resource_group_name', 'gallery_name', 'gallery_application_name', 'resource', 'kwargs']` - - Method `GalleryApplicationsOperations.begin_update` re-ordered its parameters from `['self', 'resource_group_name', 'gallery_name', 'gallery_application_name', 'gallery_application', 'kwargs']` to `['self', 'resource_group_name', 'gallery_name', 'gallery_application_name', 'properties', 'kwargs']` - - Method `DiskEncryptionSetsOperations.begin_create_or_update` re-ordered its parameters from `['self', 'resource_group_name', 'disk_encryption_set_name', 'disk_encryption_set', 'kwargs']` to `['self', 'resource_group_name', 'disk_encryption_set_name', 'resource', 'kwargs']` - - Method `DiskEncryptionSetsOperations.begin_update` re-ordered its parameters from `['self', 'resource_group_name', 'disk_encryption_set_name', 'disk_encryption_set', 'kwargs']` to `['self', 'resource_group_name', 'disk_encryption_set_name', 'properties', 'kwargs']` - - Method `CapacityReservationsOperations.begin_create_or_update` re-ordered its parameters from `['self', 'resource_group_name', 'capacity_reservation_group_name', 'capacity_reservation_name', 'parameters', 'kwargs']` to `['self', 'resource_group_name', 'capacity_reservation_group_name', 'capacity_reservation_name', 'resource', 'kwargs']` - - Method `CapacityReservationsOperations.begin_update` re-ordered its parameters from `['self', 'resource_group_name', 'capacity_reservation_group_name', 'capacity_reservation_name', 'parameters', 'kwargs']` to `['self', 'resource_group_name', 'capacity_reservation_group_name', 'capacity_reservation_name', 'properties', 'kwargs']` - - Method `GalleryApplicationVersionsOperations.begin_create_or_update` re-ordered its parameters from `['self', 'resource_group_name', 'gallery_name', 'gallery_application_name', 'gallery_application_version_name', 'gallery_application_version', 'kwargs']` to `['self', 'resource_group_name', 'gallery_name', 'gallery_application_name', 'gallery_application_version_name', 'resource', 'kwargs']` - - Method `GalleryApplicationVersionsOperations.begin_update` re-ordered its parameters from `['self', 'resource_group_name', 'gallery_name', 'gallery_application_name', 'gallery_application_version_name', 'gallery_application_version', 'kwargs']` to `['self', 'resource_group_name', 'gallery_name', 'gallery_application_name', 'gallery_application_version_name', 'properties', 'kwargs']` - - Method `DedicatedHostGroupsOperations.create_or_update` re-ordered its parameters from `['self', 'resource_group_name', 'host_group_name', 'parameters', 'kwargs']` to `['self', 'resource_group_name', 'host_group_name', 'resource', 'kwargs']` - - Method `DedicatedHostGroupsOperations.update` re-ordered its parameters from `['self', 'resource_group_name', 'host_group_name', 'parameters', 'kwargs']` to `['self', 'resource_group_name', 'host_group_name', 'properties', 'kwargs']` - - Method `GalleryImageVersionsOperations.begin_create_or_update` re-ordered its parameters from `['self', 'resource_group_name', 'gallery_name', 'gallery_image_name', 'gallery_image_version_name', 'gallery_image_version', 'kwargs']` to `['self', 'resource_group_name', 'gallery_name', 'gallery_image_name', 'gallery_image_version_name', 'resource', 'kwargs']` - - Method `GalleryImageVersionsOperations.begin_update` re-ordered its parameters from `['self', 'resource_group_name', 'gallery_name', 'gallery_image_name', 'gallery_image_version_name', 'gallery_image_version', 'kwargs']` to `['self', 'resource_group_name', 'gallery_name', 'gallery_image_name', 'gallery_image_version_name', 'properties', 'kwargs']` - - Method `VirtualMachineScaleSetExtensionsOperations.begin_create_or_update` re-ordered its parameters from `['self', 'resource_group_name', 'vm_scale_set_name', 'vmss_extension_name', 'extension_parameters', 'kwargs']` to `['self', 'resource_group_name', 'vm_scale_set_name', 'vmss_extension_name', 'resource', 'kwargs']` - - Method `VirtualMachineScaleSetExtensionsOperations.begin_update` re-ordered its parameters from `['self', 'resource_group_name', 'vm_scale_set_name', 'vmss_extension_name', 'extension_parameters', 'kwargs']` to `['self', 'resource_group_name', 'vm_scale_set_name', 'vmss_extension_name', 'properties', 'kwargs']` - - Method `GalleryImagesOperations.begin_create_or_update` re-ordered its parameters from `['self', 'resource_group_name', 'gallery_name', 'gallery_image_name', 'gallery_image', 'kwargs']` to `['self', 'resource_group_name', 'gallery_name', 'gallery_image_name', 'resource', 'kwargs']` - - Method `GalleryImagesOperations.begin_update` re-ordered its parameters from `['self', 'resource_group_name', 'gallery_name', 'gallery_image_name', 'gallery_image', 'kwargs']` to `['self', 'resource_group_name', 'gallery_name', 'gallery_image_name', 'properties', 'kwargs']` - - Method `GalleryInVMAccessControlProfilesOperations.begin_create_or_update` re-ordered its parameters from `['self', 'resource_group_name', 'gallery_name', 'in_vm_access_control_profile_name', 'gallery_in_vm_access_control_profile', 'kwargs']` to `['self', 'resource_group_name', 'gallery_name', 'in_vm_access_control_profile_name', 'resource', 'kwargs']` - - Method `GalleryInVMAccessControlProfilesOperations.begin_update` re-ordered its parameters from `['self', 'resource_group_name', 'gallery_name', 'in_vm_access_control_profile_name', 'gallery_in_vm_access_control_profile', 'kwargs']` to `['self', 'resource_group_name', 'gallery_name', 'in_vm_access_control_profile_name', 'properties', 'kwargs']` - - Method `AvailabilitySetsOperations.validate_migration_to_virtual_machine_scale_set` re-ordered its parameters from `['self', 'resource_group_name', 'availability_set_name', 'parameters', 'kwargs']` to `['self', 'resource_group_name', 'availability_set_name', 'body', 'kwargs']` - - Method `AvailabilitySetsOperations.update` re-ordered its parameters from `['self', 'resource_group_name', 'availability_set_name', 'parameters', 'kwargs']` to `['self', 'resource_group_name', 'availability_set_name', 'properties', 'kwargs']` - - Method `AvailabilitySetsOperations.create_or_update` re-ordered its parameters from `['self', 'resource_group_name', 'availability_set_name', 'parameters', 'kwargs']` to `['self', 'resource_group_name', 'availability_set_name', 'resource', 'kwargs']` - - Method `AvailabilitySetsOperations.start_migration_to_virtual_machine_scale_set` re-ordered its parameters from `['self', 'resource_group_name', 'availability_set_name', 'parameters', 'kwargs']` to `['self', 'resource_group_name', 'availability_set_name', 'body', 'kwargs']` - - Method `CapacityReservationGroupsOperations.create_or_update` re-ordered its parameters from `['self', 'resource_group_name', 'capacity_reservation_group_name', 'parameters', 'kwargs']` to `['self', 'resource_group_name', 'capacity_reservation_group_name', 'resource', 'kwargs']` - - Method `CapacityReservationGroupsOperations.update` re-ordered its parameters from `['self', 'resource_group_name', 'capacity_reservation_group_name', 'parameters', 'kwargs']` to `['self', 'resource_group_name', 'capacity_reservation_group_name', 'properties', 'kwargs']` - - Method `VirtualMachineScaleSetVMExtensionsOperations.begin_create_or_update` re-ordered its parameters from `['self', 'resource_group_name', 'vm_scale_set_name', 'instance_id', 'vm_extension_name', 'extension_parameters', 'kwargs']` to `['self', 'resource_group_name', 'vm_scale_set_name', 'instance_id', 'vm_extension_name', 'resource', 'kwargs']` - - Method `VirtualMachineScaleSetVMExtensionsOperations.begin_update` re-ordered its parameters from `['self', 'resource_group_name', 'vm_scale_set_name', 'instance_id', 'vm_extension_name', 'extension_parameters', 'kwargs']` to `['self', 'resource_group_name', 'vm_scale_set_name', 'instance_id', 'vm_extension_name', 'properties', 'kwargs']` - - Method `VirtualMachinesOperations.begin_update` re-ordered its parameters from `['self', 'resource_group_name', 'vm_name', 'parameters', 'if_match', 'if_none_match', 'kwargs']` to `['self', 'resource_group_name', 'vm_name', 'properties', 'etag', 'match_condition', 'kwargs']` - - Method `VirtualMachinesOperations.begin_capture` re-ordered its parameters from `['self', 'resource_group_name', 'vm_name', 'parameters', 'kwargs']` to `['self', 'resource_group_name', 'vm_name', 'body', 'kwargs']` - - Method `VirtualMachinesOperations.begin_attach_detach_data_disks` re-ordered its parameters from `['self', 'resource_group_name', 'vm_name', 'parameters', 'kwargs']` to `['self', 'resource_group_name', 'vm_name', 'body', 'kwargs']` - - Method `VirtualMachinesOperations.begin_install_patches` re-ordered its parameters from `['self', 'resource_group_name', 'vm_name', 'install_patches_input', 'kwargs']` to `['self', 'resource_group_name', 'vm_name', 'body', 'kwargs']` - - Method `VirtualMachinesOperations.begin_run_command` re-ordered its parameters from `['self', 'resource_group_name', 'vm_name', 'parameters', 'kwargs']` to `['self', 'resource_group_name', 'vm_name', 'body', 'kwargs']` - - Method `VirtualMachinesOperations.begin_create_or_update` re-ordered its parameters from `['self', 'resource_group_name', 'vm_name', 'parameters', 'if_match', 'if_none_match', 'kwargs']` to `['self', 'resource_group_name', 'vm_name', 'resource', 'etag', 'match_condition', 'kwargs']` - - Method `VirtualMachineExtensionsOperations.begin_create_or_update` re-ordered its parameters from `['self', 'resource_group_name', 'vm_name', 'vm_extension_name', 'extension_parameters', 'kwargs']` to `['self', 'resource_group_name', 'vm_name', 'vm_extension_name', 'resource', 'kwargs']` - - Method `VirtualMachineExtensionsOperations.begin_update` re-ordered its parameters from `['self', 'resource_group_name', 'vm_name', 'vm_extension_name', 'extension_parameters', 'kwargs']` to `['self', 'resource_group_name', 'vm_name', 'vm_extension_name', 'properties', 'kwargs']` - - Method `RestorePointCollectionsOperations.create_or_update` re-ordered its parameters from `['self', 'resource_group_name', 'restore_point_collection_name', 'parameters', 'kwargs']` to `['self', 'resource_group_name', 'restore_point_collection_name', 'resource', 'kwargs']` - - Method `RestorePointCollectionsOperations.update` re-ordered its parameters from `['self', 'resource_group_name', 'restore_point_collection_name', 'parameters', 'kwargs']` to `['self', 'resource_group_name', 'restore_point_collection_name', 'properties', 'kwargs']` + - Method `VirtualMachinesOperations.begin_update` re-ordered its parameters from `['self', 'resource_group_name', 'vm_name', 'parameters', 'if_match', 'if_none_match', 'kwargs']` to `['self', 'resource_group_name', 'vm_name', 'parameters', 'etag', 'match_condition', 'kwargs']` + - Method `VirtualMachinesOperations.begin_create_or_update` re-ordered its parameters from `['self', 'resource_group_name', 'vm_name', 'parameters', 'if_match', 'if_none_match', 'kwargs']` to `['self', 'resource_group_name', 'vm_name', 'parameters', 'etag', 'match_condition', 'kwargs']` ## 37.0.1 (2025-10-09) diff --git a/sdk/compute/azure-mgmt-compute/apiview-properties.json b/sdk/compute/azure-mgmt-compute/apiview-properties.json index e1cfe4228ad6..d48b9292fc4e 100644 --- a/sdk/compute/azure-mgmt-compute/apiview-properties.json +++ b/sdk/compute/azure-mgmt-compute/apiview-properties.json @@ -1051,14 +1051,6 @@ "azure.mgmt.compute.aio.operations.DiskEncryptionSetsOperations.list": "Microsoft.Compute.DiskEncryptionSets.list", "azure.mgmt.compute.operations.DiskEncryptionSetsOperations.list_associated_resources": "Microsoft.Compute.DiskEncryptionSets.listAssociatedResources", "azure.mgmt.compute.aio.operations.DiskEncryptionSetsOperations.list_associated_resources": "Microsoft.Compute.DiskEncryptionSets.listAssociatedResources", - "azure.mgmt.compute.operations.DiskRestorePointsOperations.get": "Microsoft.Compute.DiskRestorePoints.get", - "azure.mgmt.compute.aio.operations.DiskRestorePointsOperations.get": "Microsoft.Compute.DiskRestorePoints.get", - "azure.mgmt.compute.operations.DiskRestorePointsOperations.list_by_restore_point": "Microsoft.Compute.DiskRestorePoints.listByRestorePoint", - "azure.mgmt.compute.aio.operations.DiskRestorePointsOperations.list_by_restore_point": "Microsoft.Compute.DiskRestorePoints.listByRestorePoint", - "azure.mgmt.compute.operations.DiskRestorePointsOperations.begin_grant_access": "Microsoft.Compute.DiskRestorePoints.grantAccess", - "azure.mgmt.compute.aio.operations.DiskRestorePointsOperations.begin_grant_access": "Microsoft.Compute.DiskRestorePoints.grantAccess", - "azure.mgmt.compute.operations.DiskRestorePointsOperations.begin_revoke_access": "Microsoft.Compute.DiskRestorePoints.revokeAccess", - "azure.mgmt.compute.aio.operations.DiskRestorePointsOperations.begin_revoke_access": "Microsoft.Compute.DiskRestorePoints.revokeAccess", "azure.mgmt.compute.operations.SnapshotsOperations.get": "Microsoft.Compute.Snapshots.get", "azure.mgmt.compute.aio.operations.SnapshotsOperations.get": "Microsoft.Compute.Snapshots.get", "azure.mgmt.compute.operations.SnapshotsOperations.begin_create_or_update": "Microsoft.Compute.Snapshots.createOrUpdate", @@ -1174,6 +1166,14 @@ "azure.mgmt.compute.operations.CommunityGalleryImageVersionsOperations.list": "Microsoft.Compute.CommunityGalleryImageVersions.list", "azure.mgmt.compute.aio.operations.CommunityGalleryImageVersionsOperations.list": "Microsoft.Compute.CommunityGalleryImageVersions.list", "azure.mgmt.compute.operations.ResourceSkusOperations.list": "Microsoft.Compute.ResourceSkus.list", - "azure.mgmt.compute.aio.operations.ResourceSkusOperations.list": "Microsoft.Compute.ResourceSkus.list" + "azure.mgmt.compute.aio.operations.ResourceSkusOperations.list": "Microsoft.Compute.ResourceSkus.list", + "azure.mgmt.compute.operations.DiskRestorePointOperations.get": "Microsoft.Compute.DiskRestorePoints.get", + "azure.mgmt.compute.aio.operations.DiskRestorePointOperations.get": "Microsoft.Compute.DiskRestorePoints.get", + "azure.mgmt.compute.operations.DiskRestorePointOperations.list_by_restore_point": "Microsoft.Compute.DiskRestorePoints.listByRestorePoint", + "azure.mgmt.compute.aio.operations.DiskRestorePointOperations.list_by_restore_point": "Microsoft.Compute.DiskRestorePoints.listByRestorePoint", + "azure.mgmt.compute.operations.DiskRestorePointOperations.begin_grant_access": "Microsoft.Compute.DiskRestorePoints.grantAccess", + "azure.mgmt.compute.aio.operations.DiskRestorePointOperations.begin_grant_access": "Microsoft.Compute.DiskRestorePoints.grantAccess", + "azure.mgmt.compute.operations.DiskRestorePointOperations.begin_revoke_access": "Microsoft.Compute.DiskRestorePoints.revokeAccess", + "azure.mgmt.compute.aio.operations.DiskRestorePointOperations.begin_revoke_access": "Microsoft.Compute.DiskRestorePoints.revokeAccess" } } \ No newline at end of file diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/_client.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/_client.py index 94520f94cb47..d9f61ea9c980 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/_client.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/_client.py @@ -30,7 +30,7 @@ DedicatedHostsOperations, DiskAccessesOperations, DiskEncryptionSetsOperations, - DiskRestorePointsOperations, + DiskRestorePointOperations, DisksOperations, GalleriesOperations, GalleryApplicationVersionsOperations, @@ -174,8 +174,6 @@ class ComputeClient: # pylint: disable=too-many-instance-attributes azure.mgmt.compute.operations.PrivateEndpointConnectionsOperations :ivar disk_encryption_sets: DiskEncryptionSetsOperations operations :vartype disk_encryption_sets: azure.mgmt.compute.operations.DiskEncryptionSetsOperations - :ivar disk_restore_points: DiskRestorePointsOperations operations - :vartype disk_restore_points: azure.mgmt.compute.operations.DiskRestorePointsOperations :ivar snapshots: SnapshotsOperations operations :vartype snapshots: azure.mgmt.compute.operations.SnapshotsOperations :ivar galleries: GalleriesOperations operations @@ -214,6 +212,8 @@ class ComputeClient: # pylint: disable=too-many-instance-attributes azure.mgmt.compute.operations.CommunityGalleryImageVersionsOperations :ivar resource_skus: ResourceSkusOperations operations :vartype resource_skus: azure.mgmt.compute.operations.ResourceSkusOperations + :ivar disk_restore_point: DiskRestorePointOperations operations + :vartype disk_restore_point: azure.mgmt.compute.operations.DiskRestorePointOperations :param credential: Credential used to authenticate requests to the service. Required. :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: The ID of the target subscription. The value must be an UUID. Required. @@ -364,9 +364,6 @@ def __init__( self.disk_encryption_sets = DiskEncryptionSetsOperations( self._client, self._config, self._serialize, self._deserialize ) - self.disk_restore_points = DiskRestorePointsOperations( - self._client, self._config, self._serialize, self._deserialize - ) self.snapshots = SnapshotsOperations(self._client, self._config, self._serialize, self._deserialize) self.galleries = GalleriesOperations(self._client, self._config, self._serialize, self._deserialize) self.gallery_images = GalleryImagesOperations(self._client, self._config, self._serialize, self._deserialize) @@ -404,6 +401,9 @@ def __init__( self._client, self._config, self._serialize, self._deserialize ) self.resource_skus = ResourceSkusOperations(self._client, self._config, self._serialize, self._deserialize) + self.disk_restore_point = DiskRestorePointOperations( + self._client, self._config, self._serialize, self._deserialize + ) def send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: Any) -> HttpResponse: """Runs the network request through the client's chained policies. diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/_client.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/_client.py index 09e0189999bf..9842feedeb17 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/_client.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/_client.py @@ -30,7 +30,7 @@ DedicatedHostsOperations, DiskAccessesOperations, DiskEncryptionSetsOperations, - DiskRestorePointsOperations, + DiskRestorePointOperations, DisksOperations, GalleriesOperations, GalleryApplicationVersionsOperations, @@ -175,8 +175,6 @@ class ComputeClient: # pylint: disable=too-many-instance-attributes azure.mgmt.compute.aio.operations.PrivateEndpointConnectionsOperations :ivar disk_encryption_sets: DiskEncryptionSetsOperations operations :vartype disk_encryption_sets: azure.mgmt.compute.aio.operations.DiskEncryptionSetsOperations - :ivar disk_restore_points: DiskRestorePointsOperations operations - :vartype disk_restore_points: azure.mgmt.compute.aio.operations.DiskRestorePointsOperations :ivar snapshots: SnapshotsOperations operations :vartype snapshots: azure.mgmt.compute.aio.operations.SnapshotsOperations :ivar galleries: GalleriesOperations operations @@ -216,6 +214,8 @@ class ComputeClient: # pylint: disable=too-many-instance-attributes azure.mgmt.compute.aio.operations.CommunityGalleryImageVersionsOperations :ivar resource_skus: ResourceSkusOperations operations :vartype resource_skus: azure.mgmt.compute.aio.operations.ResourceSkusOperations + :ivar disk_restore_point: DiskRestorePointOperations operations + :vartype disk_restore_point: azure.mgmt.compute.aio.operations.DiskRestorePointOperations :param credential: Credential used to authenticate requests to the service. Required. :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: The ID of the target subscription. The value must be an UUID. Required. @@ -368,9 +368,6 @@ def __init__( self.disk_encryption_sets = DiskEncryptionSetsOperations( self._client, self._config, self._serialize, self._deserialize ) - self.disk_restore_points = DiskRestorePointsOperations( - self._client, self._config, self._serialize, self._deserialize - ) self.snapshots = SnapshotsOperations(self._client, self._config, self._serialize, self._deserialize) self.galleries = GalleriesOperations(self._client, self._config, self._serialize, self._deserialize) self.gallery_images = GalleryImagesOperations(self._client, self._config, self._serialize, self._deserialize) @@ -408,6 +405,9 @@ def __init__( self._client, self._config, self._serialize, self._deserialize ) self.resource_skus = ResourceSkusOperations(self._client, self._config, self._serialize, self._deserialize) + self.disk_restore_point = DiskRestorePointOperations( + self._client, self._config, self._serialize, self._deserialize + ) def send_request( self, request: HttpRequest, *, stream: bool = False, **kwargs: Any diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/operations/__init__.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/operations/__init__.py index e7c7e55a0228..1480dc504db2 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/operations/__init__.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/operations/__init__.py @@ -45,7 +45,6 @@ from ._operations import DiskAccessesOperations # type: ignore from ._operations import PrivateEndpointConnectionsOperations # type: ignore from ._operations import DiskEncryptionSetsOperations # type: ignore -from ._operations import DiskRestorePointsOperations # type: ignore from ._operations import SnapshotsOperations # type: ignore from ._operations import GalleriesOperations # type: ignore from ._operations import GalleryImagesOperations # type: ignore @@ -61,6 +60,7 @@ from ._operations import CommunityGalleryImagesOperations # type: ignore from ._operations import CommunityGalleryImageVersionsOperations # type: ignore from ._operations import ResourceSkusOperations # type: ignore +from ._operations import DiskRestorePointOperations # type: ignore from ._patch import __all__ as _patch_all from ._patch import * @@ -100,7 +100,6 @@ "DiskAccessesOperations", "PrivateEndpointConnectionsOperations", "DiskEncryptionSetsOperations", - "DiskRestorePointsOperations", "SnapshotsOperations", "GalleriesOperations", "GalleryImagesOperations", @@ -116,6 +115,7 @@ "CommunityGalleryImagesOperations", "CommunityGalleryImageVersionsOperations", "ResourceSkusOperations", + "DiskRestorePointOperations", ] __all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/operations/_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/operations/_operations.py index 633503f7f0f3..7518c90ba8f9 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/operations/_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/operations/_operations.py @@ -94,10 +94,10 @@ build_disk_encryption_sets_list_by_resource_group_request, build_disk_encryption_sets_list_request, build_disk_encryption_sets_update_request, - build_disk_restore_points_get_request, - build_disk_restore_points_grant_access_request, - build_disk_restore_points_list_by_restore_point_request, - build_disk_restore_points_revoke_access_request, + build_disk_restore_point_get_request, + build_disk_restore_point_grant_access_request, + build_disk_restore_point_list_by_restore_point_request, + build_disk_restore_point_revoke_access_request, build_disks_create_or_update_request, build_disks_delete_request, build_disks_get_request, @@ -522,7 +522,7 @@ async def _create_or_update_initial( self, resource_group_name: str, vm_scale_set_name: str, - resource: Union[_models.VirtualMachineScaleSet, JSON, IO[bytes]], + parameters: Union[_models.VirtualMachineScaleSet, JSON, IO[bytes]], *, etag: Optional[str] = None, match_condition: Optional[MatchConditions] = None, @@ -550,10 +550,10 @@ async def _create_or_update_initial( content_type = content_type or "application/json" _content = None - if isinstance(resource, (IOBase, bytes)): - _content = resource + if isinstance(parameters, (IOBase, bytes)): + _content = parameters else: - _content = json.dumps(resource, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore _request = build_virtual_machine_scale_sets_create_or_update_request( resource_group_name=resource_group_name, @@ -605,7 +605,7 @@ async def begin_create_or_update( self, resource_group_name: str, vm_scale_set_name: str, - resource: _models.VirtualMachineScaleSet, + parameters: _models.VirtualMachineScaleSet, *, content_type: str = "application/json", etag: Optional[str] = None, @@ -619,8 +619,8 @@ async def begin_create_or_update( :type resource_group_name: str :param vm_scale_set_name: The name of the VM scale set. Required. :type vm_scale_set_name: str - :param resource: The scale set object. Required. - :type resource: ~azure.mgmt.compute.models.VirtualMachineScaleSet + :param parameters: The scale set object. Required. + :type parameters: ~azure.mgmt.compute.models.VirtualMachineScaleSet :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -639,7 +639,7 @@ async def begin_create_or_update( self, resource_group_name: str, vm_scale_set_name: str, - resource: JSON, + parameters: JSON, *, content_type: str = "application/json", etag: Optional[str] = None, @@ -653,8 +653,8 @@ async def begin_create_or_update( :type resource_group_name: str :param vm_scale_set_name: The name of the VM scale set. Required. :type vm_scale_set_name: str - :param resource: The scale set object. Required. - :type resource: JSON + :param parameters: The scale set object. Required. + :type parameters: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -673,7 +673,7 @@ async def begin_create_or_update( self, resource_group_name: str, vm_scale_set_name: str, - resource: IO[bytes], + parameters: IO[bytes], *, content_type: str = "application/json", etag: Optional[str] = None, @@ -687,8 +687,8 @@ async def begin_create_or_update( :type resource_group_name: str :param vm_scale_set_name: The name of the VM scale set. Required. :type vm_scale_set_name: str - :param resource: The scale set object. Required. - :type resource: IO[bytes] + :param parameters: The scale set object. Required. + :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str @@ -707,7 +707,7 @@ async def begin_create_or_update( self, resource_group_name: str, vm_scale_set_name: str, - resource: Union[_models.VirtualMachineScaleSet, JSON, IO[bytes]], + parameters: Union[_models.VirtualMachineScaleSet, JSON, IO[bytes]], *, etag: Optional[str] = None, match_condition: Optional[MatchConditions] = None, @@ -720,9 +720,9 @@ async def begin_create_or_update( :type resource_group_name: str :param vm_scale_set_name: The name of the VM scale set. Required. :type vm_scale_set_name: str - :param resource: The scale set object. Is one of the following types: VirtualMachineScaleSet, + :param parameters: The scale set object. Is one of the following types: VirtualMachineScaleSet, JSON, IO[bytes] Required. - :type resource: ~azure.mgmt.compute.models.VirtualMachineScaleSet or JSON or IO[bytes] + :type parameters: ~azure.mgmt.compute.models.VirtualMachineScaleSet or JSON or IO[bytes] :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is None. :paramtype etag: str @@ -744,7 +744,7 @@ async def begin_create_or_update( raw_result = await self._create_or_update_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, - resource=resource, + parameters=parameters, etag=etag, match_condition=match_condition, content_type=content_type, @@ -785,7 +785,7 @@ async def _update_initial( self, resource_group_name: str, vm_scale_set_name: str, - properties: Union[_models.VirtualMachineScaleSetUpdate, JSON, IO[bytes]], + parameters: Union[_models.VirtualMachineScaleSetUpdate, JSON, IO[bytes]], *, etag: Optional[str] = None, match_condition: Optional[MatchConditions] = None, @@ -813,10 +813,10 @@ async def _update_initial( content_type = content_type or "application/json" _content = None - if isinstance(properties, (IOBase, bytes)): - _content = properties + if isinstance(parameters, (IOBase, bytes)): + _content = parameters else: - _content = json.dumps(properties, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore _request = build_virtual_machine_scale_sets_update_request( resource_group_name=resource_group_name, @@ -867,7 +867,7 @@ async def begin_update( self, resource_group_name: str, vm_scale_set_name: str, - properties: _models.VirtualMachineScaleSetUpdate, + parameters: _models.VirtualMachineScaleSetUpdate, *, content_type: str = "application/json", etag: Optional[str] = None, @@ -881,8 +881,8 @@ async def begin_update( :type resource_group_name: str :param vm_scale_set_name: The name of the VM scale set. Required. :type vm_scale_set_name: str - :param properties: The scale set object. Required. - :type properties: ~azure.mgmt.compute.models.VirtualMachineScaleSetUpdate + :param parameters: The scale set object. Required. + :type parameters: ~azure.mgmt.compute.models.VirtualMachineScaleSetUpdate :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -901,7 +901,7 @@ async def begin_update( self, resource_group_name: str, vm_scale_set_name: str, - properties: JSON, + parameters: JSON, *, content_type: str = "application/json", etag: Optional[str] = None, @@ -915,8 +915,8 @@ async def begin_update( :type resource_group_name: str :param vm_scale_set_name: The name of the VM scale set. Required. :type vm_scale_set_name: str - :param properties: The scale set object. Required. - :type properties: JSON + :param parameters: The scale set object. Required. + :type parameters: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -935,7 +935,7 @@ async def begin_update( self, resource_group_name: str, vm_scale_set_name: str, - properties: IO[bytes], + parameters: IO[bytes], *, content_type: str = "application/json", etag: Optional[str] = None, @@ -949,8 +949,8 @@ async def begin_update( :type resource_group_name: str :param vm_scale_set_name: The name of the VM scale set. Required. :type vm_scale_set_name: str - :param properties: The scale set object. Required. - :type properties: IO[bytes] + :param parameters: The scale set object. Required. + :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str @@ -969,7 +969,7 @@ async def begin_update( self, resource_group_name: str, vm_scale_set_name: str, - properties: Union[_models.VirtualMachineScaleSetUpdate, JSON, IO[bytes]], + parameters: Union[_models.VirtualMachineScaleSetUpdate, JSON, IO[bytes]], *, etag: Optional[str] = None, match_condition: Optional[MatchConditions] = None, @@ -982,9 +982,9 @@ async def begin_update( :type resource_group_name: str :param vm_scale_set_name: The name of the VM scale set. Required. :type vm_scale_set_name: str - :param properties: The scale set object. Is one of the following types: + :param parameters: The scale set object. Is one of the following types: VirtualMachineScaleSetUpdate, JSON, IO[bytes] Required. - :type properties: ~azure.mgmt.compute.models.VirtualMachineScaleSetUpdate or JSON or IO[bytes] + :type parameters: ~azure.mgmt.compute.models.VirtualMachineScaleSetUpdate or JSON or IO[bytes] :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is None. :paramtype etag: str @@ -1006,7 +1006,7 @@ async def begin_update( raw_result = await self._update_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, - properties=properties, + parameters=parameters, etag=etag, match_condition=match_condition, content_type=content_type, @@ -1579,7 +1579,7 @@ async def convert_to_single_placement_group( self, resource_group_name: str, vm_scale_set_name: str, - body: _models.VMScaleSetConvertToSinglePlacementGroupInput, + parameters: _models.VMScaleSetConvertToSinglePlacementGroupInput, *, content_type: str = "application/json", **kwargs: Any @@ -1591,8 +1591,8 @@ async def convert_to_single_placement_group( :type resource_group_name: str :param vm_scale_set_name: The name of the VM scale set. Required. :type vm_scale_set_name: str - :param body: The input object for ConvertToSinglePlacementGroup API. Required. - :type body: ~azure.mgmt.compute.models.VMScaleSetConvertToSinglePlacementGroupInput + :param parameters: The input object for ConvertToSinglePlacementGroup API. Required. + :type parameters: ~azure.mgmt.compute.models.VMScaleSetConvertToSinglePlacementGroupInput :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -1606,7 +1606,7 @@ async def convert_to_single_placement_group( self, resource_group_name: str, vm_scale_set_name: str, - body: JSON, + parameters: JSON, *, content_type: str = "application/json", **kwargs: Any @@ -1618,8 +1618,8 @@ async def convert_to_single_placement_group( :type resource_group_name: str :param vm_scale_set_name: The name of the VM scale set. Required. :type vm_scale_set_name: str - :param body: The input object for ConvertToSinglePlacementGroup API. Required. - :type body: JSON + :param parameters: The input object for ConvertToSinglePlacementGroup API. Required. + :type parameters: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -1633,7 +1633,7 @@ async def convert_to_single_placement_group( self, resource_group_name: str, vm_scale_set_name: str, - body: IO[bytes], + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -1645,8 +1645,8 @@ async def convert_to_single_placement_group( :type resource_group_name: str :param vm_scale_set_name: The name of the VM scale set. Required. :type vm_scale_set_name: str - :param body: The input object for ConvertToSinglePlacementGroup API. Required. - :type body: IO[bytes] + :param parameters: The input object for ConvertToSinglePlacementGroup API. Required. + :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str @@ -1660,7 +1660,7 @@ async def convert_to_single_placement_group( self, resource_group_name: str, vm_scale_set_name: str, - body: Union[_models.VMScaleSetConvertToSinglePlacementGroupInput, JSON, IO[bytes]], + parameters: Union[_models.VMScaleSetConvertToSinglePlacementGroupInput, JSON, IO[bytes]], **kwargs: Any ) -> None: """Converts SinglePlacementGroup property to false for a existing virtual machine scale set. @@ -1670,10 +1670,10 @@ async def convert_to_single_placement_group( :type resource_group_name: str :param vm_scale_set_name: The name of the VM scale set. Required. :type vm_scale_set_name: str - :param body: The input object for ConvertToSinglePlacementGroup API. Is one of the following - types: VMScaleSetConvertToSinglePlacementGroupInput, JSON, IO[bytes] Required. - :type body: ~azure.mgmt.compute.models.VMScaleSetConvertToSinglePlacementGroupInput or JSON or - IO[bytes] + :param parameters: The input object for ConvertToSinglePlacementGroup API. Is one of the + following types: VMScaleSetConvertToSinglePlacementGroupInput, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.compute.models.VMScaleSetConvertToSinglePlacementGroupInput or + JSON or IO[bytes] :return: None :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -1694,10 +1694,10 @@ async def convert_to_single_placement_group( content_type = content_type or "application/json" _content = None - if isinstance(body, (IOBase, bytes)): - _content = body + if isinstance(parameters, (IOBase, bytes)): + _content = parameters else: - _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore _request = build_virtual_machine_scale_sets_convert_to_single_placement_group_request( resource_group_name=resource_group_name, @@ -2010,7 +2010,7 @@ async def _delete_instances_initial( self, resource_group_name: str, vm_scale_set_name: str, - body: Union[_models.VirtualMachineScaleSetVMInstanceRequiredIDs, JSON, IO[bytes]], + vm_instance_i_ds: Union[_models.VirtualMachineScaleSetVMInstanceRequiredIDs, JSON, IO[bytes]], *, force_deletion: Optional[bool] = None, **kwargs: Any @@ -2031,10 +2031,10 @@ async def _delete_instances_initial( content_type = content_type or "application/json" _content = None - if isinstance(body, (IOBase, bytes)): - _content = body + if isinstance(vm_instance_i_ds, (IOBase, bytes)): + _content = vm_instance_i_ds else: - _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(vm_instance_i_ds, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore _request = build_virtual_machine_scale_sets_delete_instances_request( resource_group_name=resource_group_name, @@ -2085,7 +2085,7 @@ async def begin_delete_instances( self, resource_group_name: str, vm_scale_set_name: str, - body: _models.VirtualMachineScaleSetVMInstanceRequiredIDs, + vm_instance_i_ds: _models.VirtualMachineScaleSetVMInstanceRequiredIDs, *, force_deletion: Optional[bool] = None, content_type: str = "application/json", @@ -2098,8 +2098,9 @@ async def begin_delete_instances( :type resource_group_name: str :param vm_scale_set_name: The name of the VM scale set. Required. :type vm_scale_set_name: str - :param body: A list of virtual machine instance IDs from the VM scale set. Required. - :type body: ~azure.mgmt.compute.models.VirtualMachineScaleSetVMInstanceRequiredIDs + :param vm_instance_i_ds: A list of virtual machine instance IDs from the VM scale set. + Required. + :type vm_instance_i_ds: ~azure.mgmt.compute.models.VirtualMachineScaleSetVMInstanceRequiredIDs :keyword force_deletion: Optional parameter to force delete virtual machines from the VM scale set. (Feature in Preview). Default value is None. :paramtype force_deletion: bool @@ -2117,7 +2118,7 @@ async def begin_delete_instances( self, resource_group_name: str, vm_scale_set_name: str, - body: JSON, + vm_instance_i_ds: JSON, *, force_deletion: Optional[bool] = None, content_type: str = "application/json", @@ -2130,8 +2131,9 @@ async def begin_delete_instances( :type resource_group_name: str :param vm_scale_set_name: The name of the VM scale set. Required. :type vm_scale_set_name: str - :param body: A list of virtual machine instance IDs from the VM scale set. Required. - :type body: JSON + :param vm_instance_i_ds: A list of virtual machine instance IDs from the VM scale set. + Required. + :type vm_instance_i_ds: JSON :keyword force_deletion: Optional parameter to force delete virtual machines from the VM scale set. (Feature in Preview). Default value is None. :paramtype force_deletion: bool @@ -2149,7 +2151,7 @@ async def begin_delete_instances( self, resource_group_name: str, vm_scale_set_name: str, - body: IO[bytes], + vm_instance_i_ds: IO[bytes], *, force_deletion: Optional[bool] = None, content_type: str = "application/json", @@ -2162,8 +2164,9 @@ async def begin_delete_instances( :type resource_group_name: str :param vm_scale_set_name: The name of the VM scale set. Required. :type vm_scale_set_name: str - :param body: A list of virtual machine instance IDs from the VM scale set. Required. - :type body: IO[bytes] + :param vm_instance_i_ds: A list of virtual machine instance IDs from the VM scale set. + Required. + :type vm_instance_i_ds: IO[bytes] :keyword force_deletion: Optional parameter to force delete virtual machines from the VM scale set. (Feature in Preview). Default value is None. :paramtype force_deletion: bool @@ -2181,7 +2184,7 @@ async def begin_delete_instances( self, resource_group_name: str, vm_scale_set_name: str, - body: Union[_models.VirtualMachineScaleSetVMInstanceRequiredIDs, JSON, IO[bytes]], + vm_instance_i_ds: Union[_models.VirtualMachineScaleSetVMInstanceRequiredIDs, JSON, IO[bytes]], *, force_deletion: Optional[bool] = None, **kwargs: Any @@ -2193,10 +2196,10 @@ async def begin_delete_instances( :type resource_group_name: str :param vm_scale_set_name: The name of the VM scale set. Required. :type vm_scale_set_name: str - :param body: A list of virtual machine instance IDs from the VM scale set. Is one of the - following types: VirtualMachineScaleSetVMInstanceRequiredIDs, JSON, IO[bytes] Required. - :type body: ~azure.mgmt.compute.models.VirtualMachineScaleSetVMInstanceRequiredIDs or JSON or - IO[bytes] + :param vm_instance_i_ds: A list of virtual machine instance IDs from the VM scale set. Is one + of the following types: VirtualMachineScaleSetVMInstanceRequiredIDs, JSON, IO[bytes] Required. + :type vm_instance_i_ds: ~azure.mgmt.compute.models.VirtualMachineScaleSetVMInstanceRequiredIDs + or JSON or IO[bytes] :keyword force_deletion: Optional parameter to force delete virtual machines from the VM scale set. (Feature in Preview). Default value is None. :paramtype force_deletion: bool @@ -2217,7 +2220,7 @@ async def begin_delete_instances( raw_result = await self._delete_instances_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, - body=body, + vm_instance_i_ds=vm_instance_i_ds, force_deletion=force_deletion, content_type=content_type, cls=lambda x, y, z: x, @@ -2423,7 +2426,7 @@ async def _update_instances_initial( self, resource_group_name: str, vm_scale_set_name: str, - body: Union[_models.VirtualMachineScaleSetVMInstanceRequiredIDs, JSON, IO[bytes]], + vm_instance_i_ds: Union[_models.VirtualMachineScaleSetVMInstanceRequiredIDs, JSON, IO[bytes]], **kwargs: Any ) -> AsyncIterator[bytes]: error_map: MutableMapping = { @@ -2442,10 +2445,10 @@ async def _update_instances_initial( content_type = content_type or "application/json" _content = None - if isinstance(body, (IOBase, bytes)): - _content = body + if isinstance(vm_instance_i_ds, (IOBase, bytes)): + _content = vm_instance_i_ds else: - _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(vm_instance_i_ds, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore _request = build_virtual_machine_scale_sets_update_instances_request( resource_group_name=resource_group_name, @@ -2495,7 +2498,7 @@ async def begin_update_instances( self, resource_group_name: str, vm_scale_set_name: str, - body: _models.VirtualMachineScaleSetVMInstanceRequiredIDs, + vm_instance_i_ds: _models.VirtualMachineScaleSetVMInstanceRequiredIDs, *, content_type: str = "application/json", **kwargs: Any @@ -2507,8 +2510,9 @@ async def begin_update_instances( :type resource_group_name: str :param vm_scale_set_name: The name of the VM scale set. Required. :type vm_scale_set_name: str - :param body: A list of virtual machine instance IDs from the VM scale set. Required. - :type body: ~azure.mgmt.compute.models.VirtualMachineScaleSetVMInstanceRequiredIDs + :param vm_instance_i_ds: A list of virtual machine instance IDs from the VM scale set. + Required. + :type vm_instance_i_ds: ~azure.mgmt.compute.models.VirtualMachineScaleSetVMInstanceRequiredIDs :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -2523,7 +2527,7 @@ async def begin_update_instances( self, resource_group_name: str, vm_scale_set_name: str, - body: JSON, + vm_instance_i_ds: JSON, *, content_type: str = "application/json", **kwargs: Any @@ -2535,8 +2539,9 @@ async def begin_update_instances( :type resource_group_name: str :param vm_scale_set_name: The name of the VM scale set. Required. :type vm_scale_set_name: str - :param body: A list of virtual machine instance IDs from the VM scale set. Required. - :type body: JSON + :param vm_instance_i_ds: A list of virtual machine instance IDs from the VM scale set. + Required. + :type vm_instance_i_ds: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -2551,7 +2556,7 @@ async def begin_update_instances( self, resource_group_name: str, vm_scale_set_name: str, - body: IO[bytes], + vm_instance_i_ds: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -2563,8 +2568,9 @@ async def begin_update_instances( :type resource_group_name: str :param vm_scale_set_name: The name of the VM scale set. Required. :type vm_scale_set_name: str - :param body: A list of virtual machine instance IDs from the VM scale set. Required. - :type body: IO[bytes] + :param vm_instance_i_ds: A list of virtual machine instance IDs from the VM scale set. + Required. + :type vm_instance_i_ds: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str @@ -2579,7 +2585,7 @@ async def begin_update_instances( self, resource_group_name: str, vm_scale_set_name: str, - body: Union[_models.VirtualMachineScaleSetVMInstanceRequiredIDs, JSON, IO[bytes]], + vm_instance_i_ds: Union[_models.VirtualMachineScaleSetVMInstanceRequiredIDs, JSON, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[_models.OkResponse]: """Upgrades one or more virtual machines to the latest SKU set in the VM scale set model. @@ -2589,10 +2595,10 @@ async def begin_update_instances( :type resource_group_name: str :param vm_scale_set_name: The name of the VM scale set. Required. :type vm_scale_set_name: str - :param body: A list of virtual machine instance IDs from the VM scale set. Is one of the - following types: VirtualMachineScaleSetVMInstanceRequiredIDs, JSON, IO[bytes] Required. - :type body: ~azure.mgmt.compute.models.VirtualMachineScaleSetVMInstanceRequiredIDs or JSON or - IO[bytes] + :param vm_instance_i_ds: A list of virtual machine instance IDs from the VM scale set. Is one + of the following types: VirtualMachineScaleSetVMInstanceRequiredIDs, JSON, IO[bytes] Required. + :type vm_instance_i_ds: ~azure.mgmt.compute.models.VirtualMachineScaleSetVMInstanceRequiredIDs + or JSON or IO[bytes] :return: An instance of AsyncLROPoller that returns OkResponse. The OkResponse is compatible with MutableMapping :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.OkResponse] @@ -2610,7 +2616,7 @@ async def begin_update_instances( raw_result = await self._update_instances_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, - body=body, + vm_instance_i_ds=vm_instance_i_ds, content_type=content_type, cls=lambda x, y, z: x, headers=_headers, @@ -4412,7 +4418,7 @@ async def _set_orchestration_service_state_initial( self, resource_group_name: str, vm_scale_set_name: str, - body: Union[_models.OrchestrationServiceStateInput, JSON, IO[bytes]], + parameters: Union[_models.OrchestrationServiceStateInput, JSON, IO[bytes]], **kwargs: Any ) -> AsyncIterator[bytes]: error_map: MutableMapping = { @@ -4431,10 +4437,10 @@ async def _set_orchestration_service_state_initial( content_type = content_type or "application/json" _content = None - if isinstance(body, (IOBase, bytes)): - _content = body + if isinstance(parameters, (IOBase, bytes)): + _content = parameters else: - _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore _request = build_virtual_machine_scale_sets_set_orchestration_service_state_request( resource_group_name=resource_group_name, @@ -4484,7 +4490,7 @@ async def begin_set_orchestration_service_state( self, resource_group_name: str, vm_scale_set_name: str, - body: _models.OrchestrationServiceStateInput, + parameters: _models.OrchestrationServiceStateInput, *, content_type: str = "application/json", **kwargs: Any @@ -4496,8 +4502,8 @@ async def begin_set_orchestration_service_state( :type resource_group_name: str :param vm_scale_set_name: The name of the VM scale set. Required. :type vm_scale_set_name: str - :param body: The input object for SetOrchestrationServiceState API. Required. - :type body: ~azure.mgmt.compute.models.OrchestrationServiceStateInput + :param parameters: The input object for SetOrchestrationServiceState API. Required. + :type parameters: ~azure.mgmt.compute.models.OrchestrationServiceStateInput :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -4512,7 +4518,7 @@ async def begin_set_orchestration_service_state( self, resource_group_name: str, vm_scale_set_name: str, - body: JSON, + parameters: JSON, *, content_type: str = "application/json", **kwargs: Any @@ -4524,8 +4530,8 @@ async def begin_set_orchestration_service_state( :type resource_group_name: str :param vm_scale_set_name: The name of the VM scale set. Required. :type vm_scale_set_name: str - :param body: The input object for SetOrchestrationServiceState API. Required. - :type body: JSON + :param parameters: The input object for SetOrchestrationServiceState API. Required. + :type parameters: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -4540,7 +4546,7 @@ async def begin_set_orchestration_service_state( self, resource_group_name: str, vm_scale_set_name: str, - body: IO[bytes], + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -4552,8 +4558,8 @@ async def begin_set_orchestration_service_state( :type resource_group_name: str :param vm_scale_set_name: The name of the VM scale set. Required. :type vm_scale_set_name: str - :param body: The input object for SetOrchestrationServiceState API. Required. - :type body: IO[bytes] + :param parameters: The input object for SetOrchestrationServiceState API. Required. + :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str @@ -4568,7 +4574,7 @@ async def begin_set_orchestration_service_state( self, resource_group_name: str, vm_scale_set_name: str, - body: Union[_models.OrchestrationServiceStateInput, JSON, IO[bytes]], + parameters: Union[_models.OrchestrationServiceStateInput, JSON, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[_models.OkResponse]: """Changes ServiceState property for a given service. @@ -4578,9 +4584,10 @@ async def begin_set_orchestration_service_state( :type resource_group_name: str :param vm_scale_set_name: The name of the VM scale set. Required. :type vm_scale_set_name: str - :param body: The input object for SetOrchestrationServiceState API. Is one of the following - types: OrchestrationServiceStateInput, JSON, IO[bytes] Required. - :type body: ~azure.mgmt.compute.models.OrchestrationServiceStateInput or JSON or IO[bytes] + :param parameters: The input object for SetOrchestrationServiceState API. Is one of the + following types: OrchestrationServiceStateInput, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.compute.models.OrchestrationServiceStateInput or JSON or + IO[bytes] :return: An instance of AsyncLROPoller that returns OkResponse. The OkResponse is compatible with MutableMapping :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.OkResponse] @@ -4598,7 +4605,7 @@ async def begin_set_orchestration_service_state( raw_result = await self._set_orchestration_service_state_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, - body=body, + parameters=parameters, content_type=content_type, cls=lambda x, y, z: x, headers=_headers, @@ -5374,7 +5381,7 @@ async def _scale_out_initial( self, resource_group_name: str, vm_scale_set_name: str, - body: Union[_models.VMScaleSetScaleOutInput, JSON, IO[bytes]], + parameters: Union[_models.VMScaleSetScaleOutInput, JSON, IO[bytes]], **kwargs: Any ) -> AsyncIterator[bytes]: error_map: MutableMapping = { @@ -5393,10 +5400,10 @@ async def _scale_out_initial( content_type = content_type or "application/json" _content = None - if isinstance(body, (IOBase, bytes)): - _content = body + if isinstance(parameters, (IOBase, bytes)): + _content = parameters else: - _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore _request = build_virtual_machine_scale_sets_scale_out_request( resource_group_name=resource_group_name, @@ -5446,7 +5453,7 @@ async def begin_scale_out( self, resource_group_name: str, vm_scale_set_name: str, - body: _models.VMScaleSetScaleOutInput, + parameters: _models.VMScaleSetScaleOutInput, *, content_type: str = "application/json", **kwargs: Any @@ -5458,8 +5465,8 @@ async def begin_scale_out( :type resource_group_name: str :param vm_scale_set_name: The name of the VM scale set. Required. :type vm_scale_set_name: str - :param body: The input object for ScaleOut API. Required. - :type body: ~azure.mgmt.compute.models.VMScaleSetScaleOutInput + :param parameters: The input object for ScaleOut API. Required. + :type parameters: ~azure.mgmt.compute.models.VMScaleSetScaleOutInput :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -5474,7 +5481,7 @@ async def begin_scale_out( self, resource_group_name: str, vm_scale_set_name: str, - body: JSON, + parameters: JSON, *, content_type: str = "application/json", **kwargs: Any @@ -5486,8 +5493,8 @@ async def begin_scale_out( :type resource_group_name: str :param vm_scale_set_name: The name of the VM scale set. Required. :type vm_scale_set_name: str - :param body: The input object for ScaleOut API. Required. - :type body: JSON + :param parameters: The input object for ScaleOut API. Required. + :type parameters: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -5502,7 +5509,7 @@ async def begin_scale_out( self, resource_group_name: str, vm_scale_set_name: str, - body: IO[bytes], + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -5514,8 +5521,8 @@ async def begin_scale_out( :type resource_group_name: str :param vm_scale_set_name: The name of the VM scale set. Required. :type vm_scale_set_name: str - :param body: The input object for ScaleOut API. Required. - :type body: IO[bytes] + :param parameters: The input object for ScaleOut API. Required. + :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str @@ -5537,7 +5544,7 @@ async def begin_scale_out( self, resource_group_name: str, vm_scale_set_name: str, - body: Union[_models.VMScaleSetScaleOutInput, JSON, IO[bytes]], + parameters: Union[_models.VMScaleSetScaleOutInput, JSON, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[_models.OkResponse]: """Scales out one or more virtual machines in a VM scale set. @@ -5547,9 +5554,9 @@ async def begin_scale_out( :type resource_group_name: str :param vm_scale_set_name: The name of the VM scale set. Required. :type vm_scale_set_name: str - :param body: The input object for ScaleOut API. Is one of the following types: + :param parameters: The input object for ScaleOut API. Is one of the following types: VMScaleSetScaleOutInput, JSON, IO[bytes] Required. - :type body: ~azure.mgmt.compute.models.VMScaleSetScaleOutInput or JSON or IO[bytes] + :type parameters: ~azure.mgmt.compute.models.VMScaleSetScaleOutInput or JSON or IO[bytes] :return: An instance of AsyncLROPoller that returns OkResponse. The OkResponse is compatible with MutableMapping :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.OkResponse] @@ -5567,7 +5574,7 @@ async def begin_scale_out( raw_result = await self._scale_out_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, - body=body, + parameters=parameters, content_type=content_type, cls=lambda x, y, z: x, headers=_headers, @@ -5802,7 +5809,7 @@ async def _create_or_update_initial( resource_group_name: str, vm_scale_set_name: str, vmss_extension_name: str, - resource: Union[_models.VirtualMachineScaleSetExtension, JSON, IO[bytes]], + extension_parameters: Union[_models.VirtualMachineScaleSetExtension, JSON, IO[bytes]], **kwargs: Any ) -> AsyncIterator[bytes]: error_map: MutableMapping = { @@ -5821,10 +5828,10 @@ async def _create_or_update_initial( content_type = content_type or "application/json" _content = None - if isinstance(resource, (IOBase, bytes)): - _content = resource + if isinstance(extension_parameters, (IOBase, bytes)): + _content = extension_parameters else: - _content = json.dumps(resource, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(extension_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore _request = build_virtual_machine_scale_set_extensions_create_or_update_request( resource_group_name=resource_group_name, @@ -5876,7 +5883,7 @@ async def begin_create_or_update( resource_group_name: str, vm_scale_set_name: str, vmss_extension_name: str, - resource: _models.VirtualMachineScaleSetExtension, + extension_parameters: _models.VirtualMachineScaleSetExtension, *, content_type: str = "application/json", **kwargs: Any @@ -5890,8 +5897,9 @@ async def begin_create_or_update( :type vm_scale_set_name: str :param vmss_extension_name: The name of the VM scale set extension. Required. :type vmss_extension_name: str - :param resource: Parameters supplied to the Create VM scale set Extension operation. Required. - :type resource: ~azure.mgmt.compute.models.VirtualMachineScaleSetExtension + :param extension_parameters: Parameters supplied to the Create VM scale set Extension + operation. Required. + :type extension_parameters: ~azure.mgmt.compute.models.VirtualMachineScaleSetExtension :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -5906,7 +5914,7 @@ async def begin_create_or_update( resource_group_name: str, vm_scale_set_name: str, vmss_extension_name: str, - resource: JSON, + extension_parameters: JSON, *, content_type: str = "application/json", **kwargs: Any @@ -5920,8 +5928,9 @@ async def begin_create_or_update( :type vm_scale_set_name: str :param vmss_extension_name: The name of the VM scale set extension. Required. :type vmss_extension_name: str - :param resource: Parameters supplied to the Create VM scale set Extension operation. Required. - :type resource: JSON + :param extension_parameters: Parameters supplied to the Create VM scale set Extension + operation. Required. + :type extension_parameters: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -5936,7 +5945,7 @@ async def begin_create_or_update( resource_group_name: str, vm_scale_set_name: str, vmss_extension_name: str, - resource: IO[bytes], + extension_parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -5950,8 +5959,9 @@ async def begin_create_or_update( :type vm_scale_set_name: str :param vmss_extension_name: The name of the VM scale set extension. Required. :type vmss_extension_name: str - :param resource: Parameters supplied to the Create VM scale set Extension operation. Required. - :type resource: IO[bytes] + :param extension_parameters: Parameters supplied to the Create VM scale set Extension + operation. Required. + :type extension_parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str @@ -5966,7 +5976,7 @@ async def begin_create_or_update( resource_group_name: str, vm_scale_set_name: str, vmss_extension_name: str, - resource: Union[_models.VirtualMachineScaleSetExtension, JSON, IO[bytes]], + extension_parameters: Union[_models.VirtualMachineScaleSetExtension, JSON, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[None]: """The operation to create or update an extension. @@ -5978,9 +5988,11 @@ async def begin_create_or_update( :type vm_scale_set_name: str :param vmss_extension_name: The name of the VM scale set extension. Required. :type vmss_extension_name: str - :param resource: Parameters supplied to the Create VM scale set Extension operation. Is one of - the following types: VirtualMachineScaleSetExtension, JSON, IO[bytes] Required. - :type resource: ~azure.mgmt.compute.models.VirtualMachineScaleSetExtension or JSON or IO[bytes] + :param extension_parameters: Parameters supplied to the Create VM scale set Extension + operation. Is one of the following types: VirtualMachineScaleSetExtension, JSON, IO[bytes] + Required. + :type extension_parameters: ~azure.mgmt.compute.models.VirtualMachineScaleSetExtension or JSON + or IO[bytes] :return: An instance of AsyncLROPoller that returns None :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -5998,7 +6010,7 @@ async def begin_create_or_update( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vmss_extension_name=vmss_extension_name, - resource=resource, + extension_parameters=extension_parameters, content_type=content_type, cls=lambda x, y, z: x, headers=_headers, @@ -6038,7 +6050,7 @@ async def _update_initial( resource_group_name: str, vm_scale_set_name: str, vmss_extension_name: str, - properties: Union[_models.VirtualMachineScaleSetExtensionUpdate, JSON, IO[bytes]], + extension_parameters: Union[_models.VirtualMachineScaleSetExtensionUpdate, JSON, IO[bytes]], **kwargs: Any ) -> AsyncIterator[bytes]: error_map: MutableMapping = { @@ -6057,10 +6069,10 @@ async def _update_initial( content_type = content_type or "application/json" _content = None - if isinstance(properties, (IOBase, bytes)): - _content = properties + if isinstance(extension_parameters, (IOBase, bytes)): + _content = extension_parameters else: - _content = json.dumps(properties, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(extension_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore _request = build_virtual_machine_scale_set_extensions_update_request( resource_group_name=resource_group_name, @@ -6112,7 +6124,7 @@ async def begin_update( resource_group_name: str, vm_scale_set_name: str, vmss_extension_name: str, - properties: _models.VirtualMachineScaleSetExtensionUpdate, + extension_parameters: _models.VirtualMachineScaleSetExtensionUpdate, *, content_type: str = "application/json", **kwargs: Any @@ -6126,9 +6138,9 @@ async def begin_update( :type vm_scale_set_name: str :param vmss_extension_name: The name of the VM scale set extension. Required. :type vmss_extension_name: str - :param properties: Parameters supplied to the Update VM scale set Extension operation. - Required. - :type properties: ~azure.mgmt.compute.models.VirtualMachineScaleSetExtensionUpdate + :param extension_parameters: Parameters supplied to the Update VM scale set Extension + operation. Required. + :type extension_parameters: ~azure.mgmt.compute.models.VirtualMachineScaleSetExtensionUpdate :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -6143,7 +6155,7 @@ async def begin_update( resource_group_name: str, vm_scale_set_name: str, vmss_extension_name: str, - properties: JSON, + extension_parameters: JSON, *, content_type: str = "application/json", **kwargs: Any @@ -6157,9 +6169,9 @@ async def begin_update( :type vm_scale_set_name: str :param vmss_extension_name: The name of the VM scale set extension. Required. :type vmss_extension_name: str - :param properties: Parameters supplied to the Update VM scale set Extension operation. - Required. - :type properties: JSON + :param extension_parameters: Parameters supplied to the Update VM scale set Extension + operation. Required. + :type extension_parameters: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -6174,7 +6186,7 @@ async def begin_update( resource_group_name: str, vm_scale_set_name: str, vmss_extension_name: str, - properties: IO[bytes], + extension_parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -6188,9 +6200,9 @@ async def begin_update( :type vm_scale_set_name: str :param vmss_extension_name: The name of the VM scale set extension. Required. :type vmss_extension_name: str - :param properties: Parameters supplied to the Update VM scale set Extension operation. - Required. - :type properties: IO[bytes] + :param extension_parameters: Parameters supplied to the Update VM scale set Extension + operation. Required. + :type extension_parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str @@ -6205,7 +6217,7 @@ async def begin_update( resource_group_name: str, vm_scale_set_name: str, vmss_extension_name: str, - properties: Union[_models.VirtualMachineScaleSetExtensionUpdate, JSON, IO[bytes]], + extension_parameters: Union[_models.VirtualMachineScaleSetExtensionUpdate, JSON, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[None]: """The operation to update an extension. @@ -6217,10 +6229,11 @@ async def begin_update( :type vm_scale_set_name: str :param vmss_extension_name: The name of the VM scale set extension. Required. :type vmss_extension_name: str - :param properties: Parameters supplied to the Update VM scale set Extension operation. Is one - of the following types: VirtualMachineScaleSetExtensionUpdate, JSON, IO[bytes] Required. - :type properties: ~azure.mgmt.compute.models.VirtualMachineScaleSetExtensionUpdate or JSON or - IO[bytes] + :param extension_parameters: Parameters supplied to the Update VM scale set Extension + operation. Is one of the following types: VirtualMachineScaleSetExtensionUpdate, JSON, + IO[bytes] Required. + :type extension_parameters: ~azure.mgmt.compute.models.VirtualMachineScaleSetExtensionUpdate or + JSON or IO[bytes] :return: An instance of AsyncLROPoller that returns None :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -6238,7 +6251,7 @@ async def begin_update( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vmss_extension_name=vmss_extension_name, - properties=properties, + extension_parameters=extension_parameters, content_type=content_type, cls=lambda x, y, z: x, headers=_headers, @@ -6594,7 +6607,7 @@ async def _update_initial( resource_group_name: str, vm_scale_set_name: str, instance_id: str, - resource: Union[_models.VirtualMachineScaleSetVM, JSON, IO[bytes]], + parameters: Union[_models.VirtualMachineScaleSetVM, JSON, IO[bytes]], *, etag: Optional[str] = None, match_condition: Optional[MatchConditions] = None, @@ -6622,10 +6635,10 @@ async def _update_initial( content_type = content_type or "application/json" _content = None - if isinstance(resource, (IOBase, bytes)): - _content = resource + if isinstance(parameters, (IOBase, bytes)): + _content = parameters else: - _content = json.dumps(resource, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore _request = build_virtual_machine_scale_set_vms_update_request( resource_group_name=resource_group_name, @@ -6679,7 +6692,7 @@ async def begin_update( resource_group_name: str, vm_scale_set_name: str, instance_id: str, - resource: _models.VirtualMachineScaleSetVM, + parameters: _models.VirtualMachineScaleSetVM, *, content_type: str = "application/json", etag: Optional[str] = None, @@ -6695,9 +6708,9 @@ async def begin_update( :type vm_scale_set_name: str :param instance_id: The instance ID of the virtual machine. Required. :type instance_id: str - :param resource: Parameters supplied to the Update Virtual Machine Scale Sets VM operation. + :param parameters: Parameters supplied to the Update Virtual Machine Scale Sets VM operation. Required. - :type resource: ~azure.mgmt.compute.models.VirtualMachineScaleSetVM + :type parameters: ~azure.mgmt.compute.models.VirtualMachineScaleSetVM :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -6717,7 +6730,7 @@ async def begin_update( resource_group_name: str, vm_scale_set_name: str, instance_id: str, - resource: JSON, + parameters: JSON, *, content_type: str = "application/json", etag: Optional[str] = None, @@ -6733,9 +6746,9 @@ async def begin_update( :type vm_scale_set_name: str :param instance_id: The instance ID of the virtual machine. Required. :type instance_id: str - :param resource: Parameters supplied to the Update Virtual Machine Scale Sets VM operation. + :param parameters: Parameters supplied to the Update Virtual Machine Scale Sets VM operation. Required. - :type resource: JSON + :type parameters: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -6755,7 +6768,7 @@ async def begin_update( resource_group_name: str, vm_scale_set_name: str, instance_id: str, - resource: IO[bytes], + parameters: IO[bytes], *, content_type: str = "application/json", etag: Optional[str] = None, @@ -6771,9 +6784,9 @@ async def begin_update( :type vm_scale_set_name: str :param instance_id: The instance ID of the virtual machine. Required. :type instance_id: str - :param resource: Parameters supplied to the Update Virtual Machine Scale Sets VM operation. + :param parameters: Parameters supplied to the Update Virtual Machine Scale Sets VM operation. Required. - :type resource: IO[bytes] + :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str @@ -6793,7 +6806,7 @@ async def begin_update( resource_group_name: str, vm_scale_set_name: str, instance_id: str, - resource: Union[_models.VirtualMachineScaleSetVM, JSON, IO[bytes]], + parameters: Union[_models.VirtualMachineScaleSetVM, JSON, IO[bytes]], *, etag: Optional[str] = None, match_condition: Optional[MatchConditions] = None, @@ -6808,9 +6821,9 @@ async def begin_update( :type vm_scale_set_name: str :param instance_id: The instance ID of the virtual machine. Required. :type instance_id: str - :param resource: Parameters supplied to the Update Virtual Machine Scale Sets VM operation. Is - one of the following types: VirtualMachineScaleSetVM, JSON, IO[bytes] Required. - :type resource: ~azure.mgmt.compute.models.VirtualMachineScaleSetVM or JSON or IO[bytes] + :param parameters: Parameters supplied to the Update Virtual Machine Scale Sets VM operation. + Is one of the following types: VirtualMachineScaleSetVM, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.compute.models.VirtualMachineScaleSetVM or JSON or IO[bytes] :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is None. :paramtype etag: str @@ -6833,7 +6846,7 @@ async def begin_update( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, - resource=resource, + parameters=parameters, etag=etag, match_condition=match_condition, content_type=content_type, @@ -7903,7 +7916,7 @@ async def _attach_detach_data_disks_initial( resource_group_name: str, vm_scale_set_name: str, instance_id: str, - body: Union[_models.AttachDetachDataDisksRequest, JSON, IO[bytes]], + parameters: Union[_models.AttachDetachDataDisksRequest, JSON, IO[bytes]], **kwargs: Any ) -> AsyncIterator[bytes]: error_map: MutableMapping = { @@ -7922,10 +7935,10 @@ async def _attach_detach_data_disks_initial( content_type = content_type or "application/json" _content = None - if isinstance(body, (IOBase, bytes)): - _content = body + if isinstance(parameters, (IOBase, bytes)): + _content = parameters else: - _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore _request = build_virtual_machine_scale_set_vms_attach_detach_data_disks_request( resource_group_name=resource_group_name, @@ -7977,7 +7990,7 @@ async def begin_attach_detach_data_disks( resource_group_name: str, vm_scale_set_name: str, instance_id: str, - body: _models.AttachDetachDataDisksRequest, + parameters: _models.AttachDetachDataDisksRequest, *, content_type: str = "application/json", **kwargs: Any @@ -7991,9 +8004,9 @@ async def begin_attach_detach_data_disks( :type vm_scale_set_name: str :param instance_id: The instance ID of the virtual machine. Required. :type instance_id: str - :param body: Parameters supplied to the attach and detach data disks operation on a Virtual - Machine Scale Sets VM. Required. - :type body: ~azure.mgmt.compute.models.AttachDetachDataDisksRequest + :param parameters: Parameters supplied to the attach and detach data disks operation on a + Virtual Machine Scale Sets VM. Required. + :type parameters: ~azure.mgmt.compute.models.AttachDetachDataDisksRequest :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -8009,7 +8022,7 @@ async def begin_attach_detach_data_disks( resource_group_name: str, vm_scale_set_name: str, instance_id: str, - body: JSON, + parameters: JSON, *, content_type: str = "application/json", **kwargs: Any @@ -8023,9 +8036,9 @@ async def begin_attach_detach_data_disks( :type vm_scale_set_name: str :param instance_id: The instance ID of the virtual machine. Required. :type instance_id: str - :param body: Parameters supplied to the attach and detach data disks operation on a Virtual - Machine Scale Sets VM. Required. - :type body: JSON + :param parameters: Parameters supplied to the attach and detach data disks operation on a + Virtual Machine Scale Sets VM. Required. + :type parameters: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -8041,7 +8054,7 @@ async def begin_attach_detach_data_disks( resource_group_name: str, vm_scale_set_name: str, instance_id: str, - body: IO[bytes], + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -8055,9 +8068,9 @@ async def begin_attach_detach_data_disks( :type vm_scale_set_name: str :param instance_id: The instance ID of the virtual machine. Required. :type instance_id: str - :param body: Parameters supplied to the attach and detach data disks operation on a Virtual - Machine Scale Sets VM. Required. - :type body: IO[bytes] + :param parameters: Parameters supplied to the attach and detach data disks operation on a + Virtual Machine Scale Sets VM. Required. + :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str @@ -8073,7 +8086,7 @@ async def begin_attach_detach_data_disks( resource_group_name: str, vm_scale_set_name: str, instance_id: str, - body: Union[_models.AttachDetachDataDisksRequest, JSON, IO[bytes]], + parameters: Union[_models.AttachDetachDataDisksRequest, JSON, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[_models.StorageProfile]: """Attach and detach data disks to/from a virtual machine in a VM scale set. @@ -8085,10 +8098,10 @@ async def begin_attach_detach_data_disks( :type vm_scale_set_name: str :param instance_id: The instance ID of the virtual machine. Required. :type instance_id: str - :param body: Parameters supplied to the attach and detach data disks operation on a Virtual - Machine Scale Sets VM. Is one of the following types: AttachDetachDataDisksRequest, JSON, - IO[bytes] Required. - :type body: ~azure.mgmt.compute.models.AttachDetachDataDisksRequest or JSON or IO[bytes] + :param parameters: Parameters supplied to the attach and detach data disks operation on a + Virtual Machine Scale Sets VM. Is one of the following types: AttachDetachDataDisksRequest, + JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.compute.models.AttachDetachDataDisksRequest or JSON or IO[bytes] :return: An instance of AsyncLROPoller that returns StorageProfile. The StorageProfile is compatible with MutableMapping :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.StorageProfile] @@ -8107,7 +8120,7 @@ async def begin_attach_detach_data_disks( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, - body=body, + parameters=parameters, content_type=content_type, cls=lambda x, y, z: x, headers=_headers, @@ -8911,7 +8924,7 @@ async def _run_command_initial( resource_group_name: str, vm_scale_set_name: str, instance_id: str, - body: Union[_models.RunCommandInput, JSON, IO[bytes]], + parameters: Union[_models.RunCommandInput, JSON, IO[bytes]], **kwargs: Any ) -> AsyncIterator[bytes]: error_map: MutableMapping = { @@ -8930,10 +8943,10 @@ async def _run_command_initial( content_type = content_type or "application/json" _content = None - if isinstance(body, (IOBase, bytes)): - _content = body + if isinstance(parameters, (IOBase, bytes)): + _content = parameters else: - _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore _request = build_virtual_machine_scale_set_vms_run_command_request( resource_group_name=resource_group_name, @@ -8985,7 +8998,7 @@ async def begin_run_command( resource_group_name: str, vm_scale_set_name: str, instance_id: str, - body: _models.RunCommandInput, + parameters: _models.RunCommandInput, *, content_type: str = "application/json", **kwargs: Any @@ -8999,8 +9012,8 @@ async def begin_run_command( :type vm_scale_set_name: str :param instance_id: The instance ID of the virtual machine. Required. :type instance_id: str - :param body: Parameters supplied to the Run command operation. Required. - :type body: ~azure.mgmt.compute.models.RunCommandInput + :param parameters: Parameters supplied to the Run command operation. Required. + :type parameters: ~azure.mgmt.compute.models.RunCommandInput :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -9016,7 +9029,7 @@ async def begin_run_command( resource_group_name: str, vm_scale_set_name: str, instance_id: str, - body: JSON, + parameters: JSON, *, content_type: str = "application/json", **kwargs: Any @@ -9030,8 +9043,8 @@ async def begin_run_command( :type vm_scale_set_name: str :param instance_id: The instance ID of the virtual machine. Required. :type instance_id: str - :param body: Parameters supplied to the Run command operation. Required. - :type body: JSON + :param parameters: Parameters supplied to the Run command operation. Required. + :type parameters: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -9047,7 +9060,7 @@ async def begin_run_command( resource_group_name: str, vm_scale_set_name: str, instance_id: str, - body: IO[bytes], + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -9061,8 +9074,8 @@ async def begin_run_command( :type vm_scale_set_name: str :param instance_id: The instance ID of the virtual machine. Required. :type instance_id: str - :param body: Parameters supplied to the Run command operation. Required. - :type body: IO[bytes] + :param parameters: Parameters supplied to the Run command operation. Required. + :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str @@ -9078,7 +9091,7 @@ async def begin_run_command( resource_group_name: str, vm_scale_set_name: str, instance_id: str, - body: Union[_models.RunCommandInput, JSON, IO[bytes]], + parameters: Union[_models.RunCommandInput, JSON, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[_models.RunCommandResult]: """Run command on a virtual machine in a VM scale set. @@ -9090,9 +9103,9 @@ async def begin_run_command( :type vm_scale_set_name: str :param instance_id: The instance ID of the virtual machine. Required. :type instance_id: str - :param body: Parameters supplied to the Run command operation. Is one of the following types: - RunCommandInput, JSON, IO[bytes] Required. - :type body: ~azure.mgmt.compute.models.RunCommandInput or JSON or IO[bytes] + :param parameters: Parameters supplied to the Run command operation. Is one of the following + types: RunCommandInput, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.compute.models.RunCommandInput or JSON or IO[bytes] :return: An instance of AsyncLROPoller that returns RunCommandResult. The RunCommandResult is compatible with MutableMapping :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.RunCommandResult] @@ -9111,7 +9124,7 @@ async def begin_run_command( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, - body=body, + parameters=parameters, content_type=content_type, cls=lambda x, y, z: x, headers=_headers, @@ -9264,7 +9277,7 @@ async def _create_or_update_initial( vm_scale_set_name: str, instance_id: str, vm_extension_name: str, - resource: Union[_models.VirtualMachineScaleSetVMExtension, JSON, IO[bytes]], + extension_parameters: Union[_models.VirtualMachineScaleSetVMExtension, JSON, IO[bytes]], **kwargs: Any ) -> AsyncIterator[bytes]: error_map: MutableMapping = { @@ -9283,10 +9296,10 @@ async def _create_or_update_initial( content_type = content_type or "application/json" _content = None - if isinstance(resource, (IOBase, bytes)): - _content = resource + if isinstance(extension_parameters, (IOBase, bytes)): + _content = extension_parameters else: - _content = json.dumps(resource, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(extension_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore _request = build_virtual_machine_scale_set_vm_extensions_create_or_update_request( resource_group_name=resource_group_name, @@ -9340,7 +9353,7 @@ async def begin_create_or_update( vm_scale_set_name: str, instance_id: str, vm_extension_name: str, - resource: _models.VirtualMachineScaleSetVMExtension, + extension_parameters: _models.VirtualMachineScaleSetVMExtension, *, content_type: str = "application/json", **kwargs: Any @@ -9356,9 +9369,9 @@ async def begin_create_or_update( :type instance_id: str :param vm_extension_name: The name of the virtual machine extension. Required. :type vm_extension_name: str - :param resource: Parameters supplied to the Create Virtual Machine Extension operation. - Required. - :type resource: ~azure.mgmt.compute.models.VirtualMachineScaleSetVMExtension + :param extension_parameters: Parameters supplied to the Create Virtual Machine Extension + operation. Required. + :type extension_parameters: ~azure.mgmt.compute.models.VirtualMachineScaleSetVMExtension :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -9374,7 +9387,7 @@ async def begin_create_or_update( vm_scale_set_name: str, instance_id: str, vm_extension_name: str, - resource: JSON, + extension_parameters: JSON, *, content_type: str = "application/json", **kwargs: Any @@ -9390,9 +9403,9 @@ async def begin_create_or_update( :type instance_id: str :param vm_extension_name: The name of the virtual machine extension. Required. :type vm_extension_name: str - :param resource: Parameters supplied to the Create Virtual Machine Extension operation. - Required. - :type resource: JSON + :param extension_parameters: Parameters supplied to the Create Virtual Machine Extension + operation. Required. + :type extension_parameters: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -9408,7 +9421,7 @@ async def begin_create_or_update( vm_scale_set_name: str, instance_id: str, vm_extension_name: str, - resource: IO[bytes], + extension_parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -9424,9 +9437,9 @@ async def begin_create_or_update( :type instance_id: str :param vm_extension_name: The name of the virtual machine extension. Required. :type vm_extension_name: str - :param resource: Parameters supplied to the Create Virtual Machine Extension operation. - Required. - :type resource: IO[bytes] + :param extension_parameters: Parameters supplied to the Create Virtual Machine Extension + operation. Required. + :type extension_parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str @@ -9442,7 +9455,7 @@ async def begin_create_or_update( vm_scale_set_name: str, instance_id: str, vm_extension_name: str, - resource: Union[_models.VirtualMachineScaleSetVMExtension, JSON, IO[bytes]], + extension_parameters: Union[_models.VirtualMachineScaleSetVMExtension, JSON, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[None]: """The operation to create or update the VMSS VM extension. @@ -9456,10 +9469,11 @@ async def begin_create_or_update( :type instance_id: str :param vm_extension_name: The name of the virtual machine extension. Required. :type vm_extension_name: str - :param resource: Parameters supplied to the Create Virtual Machine Extension operation. Is one - of the following types: VirtualMachineScaleSetVMExtension, JSON, IO[bytes] Required. - :type resource: ~azure.mgmt.compute.models.VirtualMachineScaleSetVMExtension or JSON or - IO[bytes] + :param extension_parameters: Parameters supplied to the Create Virtual Machine Extension + operation. Is one of the following types: VirtualMachineScaleSetVMExtension, JSON, IO[bytes] + Required. + :type extension_parameters: ~azure.mgmt.compute.models.VirtualMachineScaleSetVMExtension or + JSON or IO[bytes] :return: An instance of AsyncLROPoller that returns None :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -9478,7 +9492,7 @@ async def begin_create_or_update( vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, vm_extension_name=vm_extension_name, - resource=resource, + extension_parameters=extension_parameters, content_type=content_type, cls=lambda x, y, z: x, headers=_headers, @@ -9519,7 +9533,7 @@ async def _update_initial( vm_scale_set_name: str, instance_id: str, vm_extension_name: str, - properties: Union[_models.VirtualMachineScaleSetVMExtensionUpdate, JSON, IO[bytes]], + extension_parameters: Union[_models.VirtualMachineScaleSetVMExtensionUpdate, JSON, IO[bytes]], **kwargs: Any ) -> AsyncIterator[bytes]: error_map: MutableMapping = { @@ -9538,10 +9552,10 @@ async def _update_initial( content_type = content_type or "application/json" _content = None - if isinstance(properties, (IOBase, bytes)): - _content = properties + if isinstance(extension_parameters, (IOBase, bytes)): + _content = extension_parameters else: - _content = json.dumps(properties, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(extension_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore _request = build_virtual_machine_scale_set_vm_extensions_update_request( resource_group_name=resource_group_name, @@ -9594,7 +9608,7 @@ async def begin_update( vm_scale_set_name: str, instance_id: str, vm_extension_name: str, - properties: _models.VirtualMachineScaleSetVMExtensionUpdate, + extension_parameters: _models.VirtualMachineScaleSetVMExtensionUpdate, *, content_type: str = "application/json", **kwargs: Any @@ -9610,9 +9624,9 @@ async def begin_update( :type instance_id: str :param vm_extension_name: The name of the virtual machine extension. Required. :type vm_extension_name: str - :param properties: Parameters supplied to the Update Virtual Machine Extension operation. - Required. - :type properties: ~azure.mgmt.compute.models.VirtualMachineScaleSetVMExtensionUpdate + :param extension_parameters: Parameters supplied to the Update Virtual Machine Extension + operation. Required. + :type extension_parameters: ~azure.mgmt.compute.models.VirtualMachineScaleSetVMExtensionUpdate :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -9628,7 +9642,7 @@ async def begin_update( vm_scale_set_name: str, instance_id: str, vm_extension_name: str, - properties: JSON, + extension_parameters: JSON, *, content_type: str = "application/json", **kwargs: Any @@ -9644,9 +9658,9 @@ async def begin_update( :type instance_id: str :param vm_extension_name: The name of the virtual machine extension. Required. :type vm_extension_name: str - :param properties: Parameters supplied to the Update Virtual Machine Extension operation. - Required. - :type properties: JSON + :param extension_parameters: Parameters supplied to the Update Virtual Machine Extension + operation. Required. + :type extension_parameters: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -9662,7 +9676,7 @@ async def begin_update( vm_scale_set_name: str, instance_id: str, vm_extension_name: str, - properties: IO[bytes], + extension_parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -9678,9 +9692,9 @@ async def begin_update( :type instance_id: str :param vm_extension_name: The name of the virtual machine extension. Required. :type vm_extension_name: str - :param properties: Parameters supplied to the Update Virtual Machine Extension operation. - Required. - :type properties: IO[bytes] + :param extension_parameters: Parameters supplied to the Update Virtual Machine Extension + operation. Required. + :type extension_parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str @@ -9696,7 +9710,7 @@ async def begin_update( vm_scale_set_name: str, instance_id: str, vm_extension_name: str, - properties: Union[_models.VirtualMachineScaleSetVMExtensionUpdate, JSON, IO[bytes]], + extension_parameters: Union[_models.VirtualMachineScaleSetVMExtensionUpdate, JSON, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[None]: """The operation to update the VMSS VM extension. @@ -9710,10 +9724,11 @@ async def begin_update( :type instance_id: str :param vm_extension_name: The name of the virtual machine extension. Required. :type vm_extension_name: str - :param properties: Parameters supplied to the Update Virtual Machine Extension operation. Is - one of the following types: VirtualMachineScaleSetVMExtensionUpdate, JSON, IO[bytes] Required. - :type properties: ~azure.mgmt.compute.models.VirtualMachineScaleSetVMExtensionUpdate or JSON or - IO[bytes] + :param extension_parameters: Parameters supplied to the Update Virtual Machine Extension + operation. Is one of the following types: VirtualMachineScaleSetVMExtensionUpdate, JSON, + IO[bytes] Required. + :type extension_parameters: ~azure.mgmt.compute.models.VirtualMachineScaleSetVMExtensionUpdate + or JSON or IO[bytes] :return: An instance of AsyncLROPoller that returns None :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -9732,7 +9747,7 @@ async def begin_update( vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, vm_extension_name=vm_extension_name, - properties=properties, + extension_parameters=extension_parameters, content_type=content_type, cls=lambda x, y, z: x, headers=_headers, @@ -10099,7 +10114,7 @@ async def _create_or_update_initial( self, resource_group_name: str, vm_name: str, - resource: Union[_models.VirtualMachine, JSON, IO[bytes]], + parameters: Union[_models.VirtualMachine, JSON, IO[bytes]], *, etag: Optional[str] = None, match_condition: Optional[MatchConditions] = None, @@ -10127,10 +10142,10 @@ async def _create_or_update_initial( content_type = content_type or "application/json" _content = None - if isinstance(resource, (IOBase, bytes)): - _content = resource + if isinstance(parameters, (IOBase, bytes)): + _content = parameters else: - _content = json.dumps(resource, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore _request = build_virtual_machines_create_or_update_request( resource_group_name=resource_group_name, @@ -10182,7 +10197,7 @@ async def begin_create_or_update( self, resource_group_name: str, vm_name: str, - resource: _models.VirtualMachine, + parameters: _models.VirtualMachine, *, content_type: str = "application/json", etag: Optional[str] = None, @@ -10197,8 +10212,8 @@ async def begin_create_or_update( :type resource_group_name: str :param vm_name: The name of the virtual machine. Required. :type vm_name: str - :param resource: Parameters supplied to the Create Virtual Machine operation. Required. - :type resource: ~azure.mgmt.compute.models.VirtualMachine + :param parameters: Parameters supplied to the Create Virtual Machine operation. Required. + :type parameters: ~azure.mgmt.compute.models.VirtualMachine :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -10217,7 +10232,7 @@ async def begin_create_or_update( self, resource_group_name: str, vm_name: str, - resource: JSON, + parameters: JSON, *, content_type: str = "application/json", etag: Optional[str] = None, @@ -10232,8 +10247,8 @@ async def begin_create_or_update( :type resource_group_name: str :param vm_name: The name of the virtual machine. Required. :type vm_name: str - :param resource: Parameters supplied to the Create Virtual Machine operation. Required. - :type resource: JSON + :param parameters: Parameters supplied to the Create Virtual Machine operation. Required. + :type parameters: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -10252,7 +10267,7 @@ async def begin_create_or_update( self, resource_group_name: str, vm_name: str, - resource: IO[bytes], + parameters: IO[bytes], *, content_type: str = "application/json", etag: Optional[str] = None, @@ -10267,8 +10282,8 @@ async def begin_create_or_update( :type resource_group_name: str :param vm_name: The name of the virtual machine. Required. :type vm_name: str - :param resource: Parameters supplied to the Create Virtual Machine operation. Required. - :type resource: IO[bytes] + :param parameters: Parameters supplied to the Create Virtual Machine operation. Required. + :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str @@ -10287,7 +10302,7 @@ async def begin_create_or_update( self, resource_group_name: str, vm_name: str, - resource: Union[_models.VirtualMachine, JSON, IO[bytes]], + parameters: Union[_models.VirtualMachine, JSON, IO[bytes]], *, etag: Optional[str] = None, match_condition: Optional[MatchConditions] = None, @@ -10301,9 +10316,9 @@ async def begin_create_or_update( :type resource_group_name: str :param vm_name: The name of the virtual machine. Required. :type vm_name: str - :param resource: Parameters supplied to the Create Virtual Machine operation. Is one of the + :param parameters: Parameters supplied to the Create Virtual Machine operation. Is one of the following types: VirtualMachine, JSON, IO[bytes] Required. - :type resource: ~azure.mgmt.compute.models.VirtualMachine or JSON or IO[bytes] + :type parameters: ~azure.mgmt.compute.models.VirtualMachine or JSON or IO[bytes] :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is None. :paramtype etag: str @@ -10325,7 +10340,7 @@ async def begin_create_or_update( raw_result = await self._create_or_update_initial( resource_group_name=resource_group_name, vm_name=vm_name, - resource=resource, + parameters=parameters, etag=etag, match_condition=match_condition, content_type=content_type, @@ -10366,7 +10381,7 @@ async def _update_initial( self, resource_group_name: str, vm_name: str, - properties: Union[_models.VirtualMachineUpdate, JSON, IO[bytes]], + parameters: Union[_models.VirtualMachineUpdate, JSON, IO[bytes]], *, etag: Optional[str] = None, match_condition: Optional[MatchConditions] = None, @@ -10394,10 +10409,10 @@ async def _update_initial( content_type = content_type or "application/json" _content = None - if isinstance(properties, (IOBase, bytes)): - _content = properties + if isinstance(parameters, (IOBase, bytes)): + _content = parameters else: - _content = json.dumps(properties, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore _request = build_virtual_machines_update_request( resource_group_name=resource_group_name, @@ -10448,7 +10463,7 @@ async def begin_update( self, resource_group_name: str, vm_name: str, - properties: _models.VirtualMachineUpdate, + parameters: _models.VirtualMachineUpdate, *, content_type: str = "application/json", etag: Optional[str] = None, @@ -10462,8 +10477,8 @@ async def begin_update( :type resource_group_name: str :param vm_name: The name of the virtual machine. Required. :type vm_name: str - :param properties: Parameters supplied to the Update Virtual Machine operation. Required. - :type properties: ~azure.mgmt.compute.models.VirtualMachineUpdate + :param parameters: Parameters supplied to the Update Virtual Machine operation. Required. + :type parameters: ~azure.mgmt.compute.models.VirtualMachineUpdate :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -10482,7 +10497,7 @@ async def begin_update( self, resource_group_name: str, vm_name: str, - properties: JSON, + parameters: JSON, *, content_type: str = "application/json", etag: Optional[str] = None, @@ -10496,8 +10511,8 @@ async def begin_update( :type resource_group_name: str :param vm_name: The name of the virtual machine. Required. :type vm_name: str - :param properties: Parameters supplied to the Update Virtual Machine operation. Required. - :type properties: JSON + :param parameters: Parameters supplied to the Update Virtual Machine operation. Required. + :type parameters: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -10516,7 +10531,7 @@ async def begin_update( self, resource_group_name: str, vm_name: str, - properties: IO[bytes], + parameters: IO[bytes], *, content_type: str = "application/json", etag: Optional[str] = None, @@ -10530,8 +10545,8 @@ async def begin_update( :type resource_group_name: str :param vm_name: The name of the virtual machine. Required. :type vm_name: str - :param properties: Parameters supplied to the Update Virtual Machine operation. Required. - :type properties: IO[bytes] + :param parameters: Parameters supplied to the Update Virtual Machine operation. Required. + :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str @@ -10550,7 +10565,7 @@ async def begin_update( self, resource_group_name: str, vm_name: str, - properties: Union[_models.VirtualMachineUpdate, JSON, IO[bytes]], + parameters: Union[_models.VirtualMachineUpdate, JSON, IO[bytes]], *, etag: Optional[str] = None, match_condition: Optional[MatchConditions] = None, @@ -10563,9 +10578,9 @@ async def begin_update( :type resource_group_name: str :param vm_name: The name of the virtual machine. Required. :type vm_name: str - :param properties: Parameters supplied to the Update Virtual Machine operation. Is one of the + :param parameters: Parameters supplied to the Update Virtual Machine operation. Is one of the following types: VirtualMachineUpdate, JSON, IO[bytes] Required. - :type properties: ~azure.mgmt.compute.models.VirtualMachineUpdate or JSON or IO[bytes] + :type parameters: ~azure.mgmt.compute.models.VirtualMachineUpdate or JSON or IO[bytes] :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is None. :paramtype etag: str @@ -10587,7 +10602,7 @@ async def begin_update( raw_result = await self._update_initial( resource_group_name=resource_group_name, vm_name=vm_name, - properties=properties, + parameters=parameters, etag=etag, match_condition=match_condition, content_type=content_type, @@ -11090,7 +11105,7 @@ async def _attach_detach_data_disks_initial( self, resource_group_name: str, vm_name: str, - body: Union[_models.AttachDetachDataDisksRequest, JSON, IO[bytes]], + parameters: Union[_models.AttachDetachDataDisksRequest, JSON, IO[bytes]], **kwargs: Any ) -> AsyncIterator[bytes]: error_map: MutableMapping = { @@ -11109,10 +11124,10 @@ async def _attach_detach_data_disks_initial( content_type = content_type or "application/json" _content = None - if isinstance(body, (IOBase, bytes)): - _content = body + if isinstance(parameters, (IOBase, bytes)): + _content = parameters else: - _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore _request = build_virtual_machines_attach_detach_data_disks_request( resource_group_name=resource_group_name, @@ -11162,7 +11177,7 @@ async def begin_attach_detach_data_disks( self, resource_group_name: str, vm_name: str, - body: _models.AttachDetachDataDisksRequest, + parameters: _models.AttachDetachDataDisksRequest, *, content_type: str = "application/json", **kwargs: Any @@ -11174,9 +11189,9 @@ async def begin_attach_detach_data_disks( :type resource_group_name: str :param vm_name: The name of the virtual machine. Required. :type vm_name: str - :param body: Parameters supplied to the attach and detach data disks operation on the virtual - machine. Required. - :type body: ~azure.mgmt.compute.models.AttachDetachDataDisksRequest + :param parameters: Parameters supplied to the attach and detach data disks operation on the + virtual machine. Required. + :type parameters: ~azure.mgmt.compute.models.AttachDetachDataDisksRequest :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -11191,7 +11206,7 @@ async def begin_attach_detach_data_disks( self, resource_group_name: str, vm_name: str, - body: JSON, + parameters: JSON, *, content_type: str = "application/json", **kwargs: Any @@ -11203,9 +11218,9 @@ async def begin_attach_detach_data_disks( :type resource_group_name: str :param vm_name: The name of the virtual machine. Required. :type vm_name: str - :param body: Parameters supplied to the attach and detach data disks operation on the virtual - machine. Required. - :type body: JSON + :param parameters: Parameters supplied to the attach and detach data disks operation on the + virtual machine. Required. + :type parameters: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -11220,7 +11235,7 @@ async def begin_attach_detach_data_disks( self, resource_group_name: str, vm_name: str, - body: IO[bytes], + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -11232,9 +11247,9 @@ async def begin_attach_detach_data_disks( :type resource_group_name: str :param vm_name: The name of the virtual machine. Required. :type vm_name: str - :param body: Parameters supplied to the attach and detach data disks operation on the virtual - machine. Required. - :type body: IO[bytes] + :param parameters: Parameters supplied to the attach and detach data disks operation on the + virtual machine. Required. + :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str @@ -11249,7 +11264,7 @@ async def begin_attach_detach_data_disks( self, resource_group_name: str, vm_name: str, - body: Union[_models.AttachDetachDataDisksRequest, JSON, IO[bytes]], + parameters: Union[_models.AttachDetachDataDisksRequest, JSON, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[_models.StorageProfile]: """Attach and detach data disks to/from the virtual machine. @@ -11259,9 +11274,10 @@ async def begin_attach_detach_data_disks( :type resource_group_name: str :param vm_name: The name of the virtual machine. Required. :type vm_name: str - :param body: Parameters supplied to the attach and detach data disks operation on the virtual - machine. Is one of the following types: AttachDetachDataDisksRequest, JSON, IO[bytes] Required. - :type body: ~azure.mgmt.compute.models.AttachDetachDataDisksRequest or JSON or IO[bytes] + :param parameters: Parameters supplied to the attach and detach data disks operation on the + virtual machine. Is one of the following types: AttachDetachDataDisksRequest, JSON, IO[bytes] + Required. + :type parameters: ~azure.mgmt.compute.models.AttachDetachDataDisksRequest or JSON or IO[bytes] :return: An instance of AsyncLROPoller that returns StorageProfile. The StorageProfile is compatible with MutableMapping :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.StorageProfile] @@ -11279,7 +11295,7 @@ async def begin_attach_detach_data_disks( raw_result = await self._attach_detach_data_disks_initial( resource_group_name=resource_group_name, vm_name=vm_name, - body=body, + parameters=parameters, content_type=content_type, cls=lambda x, y, z: x, headers=_headers, @@ -11327,7 +11343,7 @@ async def _capture_initial( self, resource_group_name: str, vm_name: str, - body: Union[_models.VirtualMachineCaptureParameters, JSON, IO[bytes]], + parameters: Union[_models.VirtualMachineCaptureParameters, JSON, IO[bytes]], **kwargs: Any ) -> AsyncIterator[bytes]: error_map: MutableMapping = { @@ -11346,10 +11362,10 @@ async def _capture_initial( content_type = content_type or "application/json" _content = None - if isinstance(body, (IOBase, bytes)): - _content = body + if isinstance(parameters, (IOBase, bytes)): + _content = parameters else: - _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore _request = build_virtual_machines_capture_request( resource_group_name=resource_group_name, @@ -11399,7 +11415,7 @@ async def begin_capture( self, resource_group_name: str, vm_name: str, - body: _models.VirtualMachineCaptureParameters, + parameters: _models.VirtualMachineCaptureParameters, *, content_type: str = "application/json", **kwargs: Any @@ -11412,8 +11428,8 @@ async def begin_capture( :type resource_group_name: str :param vm_name: The name of the virtual machine. Required. :type vm_name: str - :param body: Parameters supplied to the Capture Virtual Machine operation. Required. - :type body: ~azure.mgmt.compute.models.VirtualMachineCaptureParameters + :param parameters: Parameters supplied to the Capture Virtual Machine operation. Required. + :type parameters: ~azure.mgmt.compute.models.VirtualMachineCaptureParameters :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -11429,7 +11445,7 @@ async def begin_capture( self, resource_group_name: str, vm_name: str, - body: JSON, + parameters: JSON, *, content_type: str = "application/json", **kwargs: Any @@ -11442,8 +11458,8 @@ async def begin_capture( :type resource_group_name: str :param vm_name: The name of the virtual machine. Required. :type vm_name: str - :param body: Parameters supplied to the Capture Virtual Machine operation. Required. - :type body: JSON + :param parameters: Parameters supplied to the Capture Virtual Machine operation. Required. + :type parameters: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -11459,7 +11475,7 @@ async def begin_capture( self, resource_group_name: str, vm_name: str, - body: IO[bytes], + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -11472,8 +11488,8 @@ async def begin_capture( :type resource_group_name: str :param vm_name: The name of the virtual machine. Required. :type vm_name: str - :param body: Parameters supplied to the Capture Virtual Machine operation. Required. - :type body: IO[bytes] + :param parameters: Parameters supplied to the Capture Virtual Machine operation. Required. + :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str @@ -11489,7 +11505,7 @@ async def begin_capture( self, resource_group_name: str, vm_name: str, - body: Union[_models.VirtualMachineCaptureParameters, JSON, IO[bytes]], + parameters: Union[_models.VirtualMachineCaptureParameters, JSON, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[_models.VirtualMachineCaptureResult]: """Captures the VM by copying virtual hard disks of the VM and outputs a template that can be used @@ -11500,9 +11516,10 @@ async def begin_capture( :type resource_group_name: str :param vm_name: The name of the virtual machine. Required. :type vm_name: str - :param body: Parameters supplied to the Capture Virtual Machine operation. Is one of the + :param parameters: Parameters supplied to the Capture Virtual Machine operation. Is one of the following types: VirtualMachineCaptureParameters, JSON, IO[bytes] Required. - :type body: ~azure.mgmt.compute.models.VirtualMachineCaptureParameters or JSON or IO[bytes] + :type parameters: ~azure.mgmt.compute.models.VirtualMachineCaptureParameters or JSON or + IO[bytes] :return: An instance of AsyncLROPoller that returns VirtualMachineCaptureResult. The VirtualMachineCaptureResult is compatible with MutableMapping :rtype: @@ -11521,7 +11538,7 @@ async def begin_capture( raw_result = await self._capture_initial( resource_group_name=resource_group_name, vm_name=vm_name, - body=body, + parameters=parameters, content_type=content_type, cls=lambda x, y, z: x, headers=_headers, @@ -11886,7 +11903,7 @@ async def _install_patches_initial( self, resource_group_name: str, vm_name: str, - body: Union[_models.VirtualMachineInstallPatchesParameters, JSON, IO[bytes]], + install_patches_input: Union[_models.VirtualMachineInstallPatchesParameters, JSON, IO[bytes]], **kwargs: Any ) -> AsyncIterator[bytes]: error_map: MutableMapping = { @@ -11905,10 +11922,10 @@ async def _install_patches_initial( content_type = content_type or "application/json" _content = None - if isinstance(body, (IOBase, bytes)): - _content = body + if isinstance(install_patches_input, (IOBase, bytes)): + _content = install_patches_input else: - _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(install_patches_input, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore _request = build_virtual_machines_install_patches_request( resource_group_name=resource_group_name, @@ -11958,7 +11975,7 @@ async def begin_install_patches( self, resource_group_name: str, vm_name: str, - body: _models.VirtualMachineInstallPatchesParameters, + install_patches_input: _models.VirtualMachineInstallPatchesParameters, *, content_type: str = "application/json", **kwargs: Any @@ -11970,8 +11987,9 @@ async def begin_install_patches( :type resource_group_name: str :param vm_name: The name of the virtual machine. Required. :type vm_name: str - :param body: Input for InstallPatches as directly received by the API. Required. - :type body: ~azure.mgmt.compute.models.VirtualMachineInstallPatchesParameters + :param install_patches_input: Input for InstallPatches as directly received by the API. + Required. + :type install_patches_input: ~azure.mgmt.compute.models.VirtualMachineInstallPatchesParameters :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -11987,7 +12005,7 @@ async def begin_install_patches( self, resource_group_name: str, vm_name: str, - body: JSON, + install_patches_input: JSON, *, content_type: str = "application/json", **kwargs: Any @@ -11999,8 +12017,9 @@ async def begin_install_patches( :type resource_group_name: str :param vm_name: The name of the virtual machine. Required. :type vm_name: str - :param body: Input for InstallPatches as directly received by the API. Required. - :type body: JSON + :param install_patches_input: Input for InstallPatches as directly received by the API. + Required. + :type install_patches_input: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -12016,7 +12035,7 @@ async def begin_install_patches( self, resource_group_name: str, vm_name: str, - body: IO[bytes], + install_patches_input: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -12028,8 +12047,9 @@ async def begin_install_patches( :type resource_group_name: str :param vm_name: The name of the virtual machine. Required. :type vm_name: str - :param body: Input for InstallPatches as directly received by the API. Required. - :type body: IO[bytes] + :param install_patches_input: Input for InstallPatches as directly received by the API. + Required. + :type install_patches_input: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str @@ -12045,7 +12065,7 @@ async def begin_install_patches( self, resource_group_name: str, vm_name: str, - body: Union[_models.VirtualMachineInstallPatchesParameters, JSON, IO[bytes]], + install_patches_input: Union[_models.VirtualMachineInstallPatchesParameters, JSON, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[_models.VirtualMachineInstallPatchesResult]: """Installs patches on the VM. @@ -12055,10 +12075,10 @@ async def begin_install_patches( :type resource_group_name: str :param vm_name: The name of the virtual machine. Required. :type vm_name: str - :param body: Input for InstallPatches as directly received by the API. Is one of the following - types: VirtualMachineInstallPatchesParameters, JSON, IO[bytes] Required. - :type body: ~azure.mgmt.compute.models.VirtualMachineInstallPatchesParameters or JSON or - IO[bytes] + :param install_patches_input: Input for InstallPatches as directly received by the API. Is one + of the following types: VirtualMachineInstallPatchesParameters, JSON, IO[bytes] Required. + :type install_patches_input: ~azure.mgmt.compute.models.VirtualMachineInstallPatchesParameters + or JSON or IO[bytes] :return: An instance of AsyncLROPoller that returns VirtualMachineInstallPatchesResult. The VirtualMachineInstallPatchesResult is compatible with MutableMapping :rtype: @@ -12077,7 +12097,7 @@ async def begin_install_patches( raw_result = await self._install_patches_initial( resource_group_name=resource_group_name, vm_name=vm_name, - body=body, + install_patches_input=install_patches_input, content_type=content_type, cls=lambda x, y, z: x, headers=_headers, @@ -13439,7 +13459,7 @@ async def _run_command_initial( self, resource_group_name: str, vm_name: str, - body: Union[_models.RunCommandInput, JSON, IO[bytes]], + parameters: Union[_models.RunCommandInput, JSON, IO[bytes]], **kwargs: Any ) -> AsyncIterator[bytes]: error_map: MutableMapping = { @@ -13458,10 +13478,10 @@ async def _run_command_initial( content_type = content_type or "application/json" _content = None - if isinstance(body, (IOBase, bytes)): - _content = body + if isinstance(parameters, (IOBase, bytes)): + _content = parameters else: - _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore _request = build_virtual_machines_run_command_request( resource_group_name=resource_group_name, @@ -13511,7 +13531,7 @@ async def begin_run_command( self, resource_group_name: str, vm_name: str, - body: _models.RunCommandInput, + parameters: _models.RunCommandInput, *, content_type: str = "application/json", **kwargs: Any @@ -13523,8 +13543,8 @@ async def begin_run_command( :type resource_group_name: str :param vm_name: The name of the virtual machine. Required. :type vm_name: str - :param body: Parameters supplied to the Run command operation. Required. - :type body: ~azure.mgmt.compute.models.RunCommandInput + :param parameters: Parameters supplied to the Run command operation. Required. + :type parameters: ~azure.mgmt.compute.models.RunCommandInput :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -13539,7 +13559,7 @@ async def begin_run_command( self, resource_group_name: str, vm_name: str, - body: JSON, + parameters: JSON, *, content_type: str = "application/json", **kwargs: Any @@ -13551,8 +13571,8 @@ async def begin_run_command( :type resource_group_name: str :param vm_name: The name of the virtual machine. Required. :type vm_name: str - :param body: Parameters supplied to the Run command operation. Required. - :type body: JSON + :param parameters: Parameters supplied to the Run command operation. Required. + :type parameters: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -13567,7 +13587,7 @@ async def begin_run_command( self, resource_group_name: str, vm_name: str, - body: IO[bytes], + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -13579,8 +13599,8 @@ async def begin_run_command( :type resource_group_name: str :param vm_name: The name of the virtual machine. Required. :type vm_name: str - :param body: Parameters supplied to the Run command operation. Required. - :type body: IO[bytes] + :param parameters: Parameters supplied to the Run command operation. Required. + :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str @@ -13595,7 +13615,7 @@ async def begin_run_command( self, resource_group_name: str, vm_name: str, - body: Union[_models.RunCommandInput, JSON, IO[bytes]], + parameters: Union[_models.RunCommandInput, JSON, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[_models.RunCommandResult]: """Run command on the VM. @@ -13605,9 +13625,9 @@ async def begin_run_command( :type resource_group_name: str :param vm_name: The name of the virtual machine. Required. :type vm_name: str - :param body: Parameters supplied to the Run command operation. Is one of the following types: - RunCommandInput, JSON, IO[bytes] Required. - :type body: ~azure.mgmt.compute.models.RunCommandInput or JSON or IO[bytes] + :param parameters: Parameters supplied to the Run command operation. Is one of the following + types: RunCommandInput, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.compute.models.RunCommandInput or JSON or IO[bytes] :return: An instance of AsyncLROPoller that returns RunCommandResult. The RunCommandResult is compatible with MutableMapping :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.RunCommandResult] @@ -13625,7 +13645,7 @@ async def begin_run_command( raw_result = await self._run_command_initial( resource_group_name=resource_group_name, vm_name=vm_name, - body=body, + parameters=parameters, content_type=content_type, cls=lambda x, y, z: x, headers=_headers, @@ -14001,7 +14021,7 @@ async def _create_or_update_initial( resource_group_name: str, vm_name: str, vm_extension_name: str, - resource: Union[_models.VirtualMachineExtension, JSON, IO[bytes]], + extension_parameters: Union[_models.VirtualMachineExtension, JSON, IO[bytes]], **kwargs: Any ) -> AsyncIterator[bytes]: error_map: MutableMapping = { @@ -14020,10 +14040,10 @@ async def _create_or_update_initial( content_type = content_type or "application/json" _content = None - if isinstance(resource, (IOBase, bytes)): - _content = resource + if isinstance(extension_parameters, (IOBase, bytes)): + _content = extension_parameters else: - _content = json.dumps(resource, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(extension_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore _request = build_virtual_machine_extensions_create_or_update_request( resource_group_name=resource_group_name, @@ -14075,7 +14095,7 @@ async def begin_create_or_update( resource_group_name: str, vm_name: str, vm_extension_name: str, - resource: _models.VirtualMachineExtension, + extension_parameters: _models.VirtualMachineExtension, *, content_type: str = "application/json", **kwargs: Any @@ -14089,9 +14109,9 @@ async def begin_create_or_update( :type vm_name: str :param vm_extension_name: The name of the virtual machine extension. Required. :type vm_extension_name: str - :param resource: Parameters supplied to the Create Virtual Machine Extension operation. - Required. - :type resource: ~azure.mgmt.compute.models.VirtualMachineExtension + :param extension_parameters: Parameters supplied to the Create Virtual Machine Extension + operation. Required. + :type extension_parameters: ~azure.mgmt.compute.models.VirtualMachineExtension :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -14106,7 +14126,7 @@ async def begin_create_or_update( resource_group_name: str, vm_name: str, vm_extension_name: str, - resource: JSON, + extension_parameters: JSON, *, content_type: str = "application/json", **kwargs: Any @@ -14120,9 +14140,9 @@ async def begin_create_or_update( :type vm_name: str :param vm_extension_name: The name of the virtual machine extension. Required. :type vm_extension_name: str - :param resource: Parameters supplied to the Create Virtual Machine Extension operation. - Required. - :type resource: JSON + :param extension_parameters: Parameters supplied to the Create Virtual Machine Extension + operation. Required. + :type extension_parameters: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -14137,7 +14157,7 @@ async def begin_create_or_update( resource_group_name: str, vm_name: str, vm_extension_name: str, - resource: IO[bytes], + extension_parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -14151,9 +14171,9 @@ async def begin_create_or_update( :type vm_name: str :param vm_extension_name: The name of the virtual machine extension. Required. :type vm_extension_name: str - :param resource: Parameters supplied to the Create Virtual Machine Extension operation. - Required. - :type resource: IO[bytes] + :param extension_parameters: Parameters supplied to the Create Virtual Machine Extension + operation. Required. + :type extension_parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str @@ -14168,7 +14188,7 @@ async def begin_create_or_update( resource_group_name: str, vm_name: str, vm_extension_name: str, - resource: Union[_models.VirtualMachineExtension, JSON, IO[bytes]], + extension_parameters: Union[_models.VirtualMachineExtension, JSON, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[None]: """The operation to create or update the extension. @@ -14180,9 +14200,10 @@ async def begin_create_or_update( :type vm_name: str :param vm_extension_name: The name of the virtual machine extension. Required. :type vm_extension_name: str - :param resource: Parameters supplied to the Create Virtual Machine Extension operation. Is one - of the following types: VirtualMachineExtension, JSON, IO[bytes] Required. - :type resource: ~azure.mgmt.compute.models.VirtualMachineExtension or JSON or IO[bytes] + :param extension_parameters: Parameters supplied to the Create Virtual Machine Extension + operation. Is one of the following types: VirtualMachineExtension, JSON, IO[bytes] Required. + :type extension_parameters: ~azure.mgmt.compute.models.VirtualMachineExtension or JSON or + IO[bytes] :return: An instance of AsyncLROPoller that returns None :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -14200,7 +14221,7 @@ async def begin_create_or_update( resource_group_name=resource_group_name, vm_name=vm_name, vm_extension_name=vm_extension_name, - resource=resource, + extension_parameters=extension_parameters, content_type=content_type, cls=lambda x, y, z: x, headers=_headers, @@ -14240,7 +14261,7 @@ async def _update_initial( resource_group_name: str, vm_name: str, vm_extension_name: str, - properties: Union[_models.VirtualMachineExtensionUpdate, JSON, IO[bytes]], + extension_parameters: Union[_models.VirtualMachineExtensionUpdate, JSON, IO[bytes]], **kwargs: Any ) -> AsyncIterator[bytes]: error_map: MutableMapping = { @@ -14259,10 +14280,10 @@ async def _update_initial( content_type = content_type or "application/json" _content = None - if isinstance(properties, (IOBase, bytes)): - _content = properties + if isinstance(extension_parameters, (IOBase, bytes)): + _content = extension_parameters else: - _content = json.dumps(properties, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(extension_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore _request = build_virtual_machine_extensions_update_request( resource_group_name=resource_group_name, @@ -14313,7 +14334,7 @@ async def begin_update( resource_group_name: str, vm_name: str, vm_extension_name: str, - properties: _models.VirtualMachineExtensionUpdate, + extension_parameters: _models.VirtualMachineExtensionUpdate, *, content_type: str = "application/json", **kwargs: Any @@ -14327,9 +14348,9 @@ async def begin_update( :type vm_name: str :param vm_extension_name: The name of the virtual machine extension. Required. :type vm_extension_name: str - :param properties: Parameters supplied to the Update Virtual Machine Extension operation. - Required. - :type properties: ~azure.mgmt.compute.models.VirtualMachineExtensionUpdate + :param extension_parameters: Parameters supplied to the Update Virtual Machine Extension + operation. Required. + :type extension_parameters: ~azure.mgmt.compute.models.VirtualMachineExtensionUpdate :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -14344,7 +14365,7 @@ async def begin_update( resource_group_name: str, vm_name: str, vm_extension_name: str, - properties: JSON, + extension_parameters: JSON, *, content_type: str = "application/json", **kwargs: Any @@ -14358,9 +14379,9 @@ async def begin_update( :type vm_name: str :param vm_extension_name: The name of the virtual machine extension. Required. :type vm_extension_name: str - :param properties: Parameters supplied to the Update Virtual Machine Extension operation. - Required. - :type properties: JSON + :param extension_parameters: Parameters supplied to the Update Virtual Machine Extension + operation. Required. + :type extension_parameters: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -14375,7 +14396,7 @@ async def begin_update( resource_group_name: str, vm_name: str, vm_extension_name: str, - properties: IO[bytes], + extension_parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -14389,9 +14410,9 @@ async def begin_update( :type vm_name: str :param vm_extension_name: The name of the virtual machine extension. Required. :type vm_extension_name: str - :param properties: Parameters supplied to the Update Virtual Machine Extension operation. - Required. - :type properties: IO[bytes] + :param extension_parameters: Parameters supplied to the Update Virtual Machine Extension + operation. Required. + :type extension_parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str @@ -14406,7 +14427,7 @@ async def begin_update( resource_group_name: str, vm_name: str, vm_extension_name: str, - properties: Union[_models.VirtualMachineExtensionUpdate, JSON, IO[bytes]], + extension_parameters: Union[_models.VirtualMachineExtensionUpdate, JSON, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[None]: """The operation to update the extension. @@ -14418,9 +14439,11 @@ async def begin_update( :type vm_name: str :param vm_extension_name: The name of the virtual machine extension. Required. :type vm_extension_name: str - :param properties: Parameters supplied to the Update Virtual Machine Extension operation. Is - one of the following types: VirtualMachineExtensionUpdate, JSON, IO[bytes] Required. - :type properties: ~azure.mgmt.compute.models.VirtualMachineExtensionUpdate or JSON or IO[bytes] + :param extension_parameters: Parameters supplied to the Update Virtual Machine Extension + operation. Is one of the following types: VirtualMachineExtensionUpdate, JSON, IO[bytes] + Required. + :type extension_parameters: ~azure.mgmt.compute.models.VirtualMachineExtensionUpdate or JSON or + IO[bytes] :return: An instance of AsyncLROPoller that returns None :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -14438,7 +14461,7 @@ async def begin_update( resource_group_name=resource_group_name, vm_name=vm_name, vm_extension_name=vm_extension_name, - properties=properties, + extension_parameters=extension_parameters, content_type=content_type, cls=lambda x, y, z: x, headers=_headers, @@ -15025,7 +15048,7 @@ async def create_or_update( self, resource_group_name: str, availability_set_name: str, - resource: _models.AvailabilitySet, + parameters: _models.AvailabilitySet, *, content_type: str = "application/json", **kwargs: Any @@ -15037,8 +15060,8 @@ async def create_or_update( :type resource_group_name: str :param availability_set_name: The name of the availability set. Required. :type availability_set_name: str - :param resource: Parameters supplied to the Create Availability Set operation. Required. - :type resource: ~azure.mgmt.compute.models.AvailabilitySet + :param parameters: Parameters supplied to the Create Availability Set operation. Required. + :type parameters: ~azure.mgmt.compute.models.AvailabilitySet :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -15052,7 +15075,7 @@ async def create_or_update( self, resource_group_name: str, availability_set_name: str, - resource: JSON, + parameters: JSON, *, content_type: str = "application/json", **kwargs: Any @@ -15064,8 +15087,8 @@ async def create_or_update( :type resource_group_name: str :param availability_set_name: The name of the availability set. Required. :type availability_set_name: str - :param resource: Parameters supplied to the Create Availability Set operation. Required. - :type resource: JSON + :param parameters: Parameters supplied to the Create Availability Set operation. Required. + :type parameters: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -15079,7 +15102,7 @@ async def create_or_update( self, resource_group_name: str, availability_set_name: str, - resource: IO[bytes], + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -15091,8 +15114,8 @@ async def create_or_update( :type resource_group_name: str :param availability_set_name: The name of the availability set. Required. :type availability_set_name: str - :param resource: Parameters supplied to the Create Availability Set operation. Required. - :type resource: IO[bytes] + :param parameters: Parameters supplied to the Create Availability Set operation. Required. + :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str @@ -15106,7 +15129,7 @@ async def create_or_update( self, resource_group_name: str, availability_set_name: str, - resource: Union[_models.AvailabilitySet, JSON, IO[bytes]], + parameters: Union[_models.AvailabilitySet, JSON, IO[bytes]], **kwargs: Any ) -> _models.AvailabilitySet: """Create or update an availability set. @@ -15116,9 +15139,9 @@ async def create_or_update( :type resource_group_name: str :param availability_set_name: The name of the availability set. Required. :type availability_set_name: str - :param resource: Parameters supplied to the Create Availability Set operation. Is one of the + :param parameters: Parameters supplied to the Create Availability Set operation. Is one of the following types: AvailabilitySet, JSON, IO[bytes] Required. - :type resource: ~azure.mgmt.compute.models.AvailabilitySet or JSON or IO[bytes] + :type parameters: ~azure.mgmt.compute.models.AvailabilitySet or JSON or IO[bytes] :return: AvailabilitySet. The AvailabilitySet is compatible with MutableMapping :rtype: ~azure.mgmt.compute.models.AvailabilitySet :raises ~azure.core.exceptions.HttpResponseError: @@ -15139,10 +15162,10 @@ async def create_or_update( content_type = content_type or "application/json" _content = None - if isinstance(resource, (IOBase, bytes)): - _content = resource + if isinstance(parameters, (IOBase, bytes)): + _content = parameters else: - _content = json.dumps(resource, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore _request = build_availability_sets_create_or_update_request( resource_group_name=resource_group_name, @@ -15191,7 +15214,7 @@ async def update( self, resource_group_name: str, availability_set_name: str, - properties: _models.AvailabilitySetUpdate, + parameters: _models.AvailabilitySetUpdate, *, content_type: str = "application/json", **kwargs: Any @@ -15203,8 +15226,8 @@ async def update( :type resource_group_name: str :param availability_set_name: The name of the availability set. Required. :type availability_set_name: str - :param properties: Parameters supplied to the Update Availability Set operation. Required. - :type properties: ~azure.mgmt.compute.models.AvailabilitySetUpdate + :param parameters: Parameters supplied to the Update Availability Set operation. Required. + :type parameters: ~azure.mgmt.compute.models.AvailabilitySetUpdate :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -15218,7 +15241,7 @@ async def update( self, resource_group_name: str, availability_set_name: str, - properties: JSON, + parameters: JSON, *, content_type: str = "application/json", **kwargs: Any @@ -15230,8 +15253,8 @@ async def update( :type resource_group_name: str :param availability_set_name: The name of the availability set. Required. :type availability_set_name: str - :param properties: Parameters supplied to the Update Availability Set operation. Required. - :type properties: JSON + :param parameters: Parameters supplied to the Update Availability Set operation. Required. + :type parameters: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -15245,7 +15268,7 @@ async def update( self, resource_group_name: str, availability_set_name: str, - properties: IO[bytes], + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -15257,8 +15280,8 @@ async def update( :type resource_group_name: str :param availability_set_name: The name of the availability set. Required. :type availability_set_name: str - :param properties: Parameters supplied to the Update Availability Set operation. Required. - :type properties: IO[bytes] + :param parameters: Parameters supplied to the Update Availability Set operation. Required. + :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str @@ -15272,7 +15295,7 @@ async def update( self, resource_group_name: str, availability_set_name: str, - properties: Union[_models.AvailabilitySetUpdate, JSON, IO[bytes]], + parameters: Union[_models.AvailabilitySetUpdate, JSON, IO[bytes]], **kwargs: Any ) -> _models.AvailabilitySet: """Update an availability set. @@ -15282,9 +15305,9 @@ async def update( :type resource_group_name: str :param availability_set_name: The name of the availability set. Required. :type availability_set_name: str - :param properties: Parameters supplied to the Update Availability Set operation. Is one of the + :param parameters: Parameters supplied to the Update Availability Set operation. Is one of the following types: AvailabilitySetUpdate, JSON, IO[bytes] Required. - :type properties: ~azure.mgmt.compute.models.AvailabilitySetUpdate or JSON or IO[bytes] + :type parameters: ~azure.mgmt.compute.models.AvailabilitySetUpdate or JSON or IO[bytes] :return: AvailabilitySet. The AvailabilitySet is compatible with MutableMapping :rtype: ~azure.mgmt.compute.models.AvailabilitySet :raises ~azure.core.exceptions.HttpResponseError: @@ -15305,10 +15328,10 @@ async def update( content_type = content_type or "application/json" _content = None - if isinstance(properties, (IOBase, bytes)): - _content = properties + if isinstance(parameters, (IOBase, bytes)): + _content = parameters else: - _content = json.dumps(properties, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore _request = build_availability_sets_update_request( resource_group_name=resource_group_name, @@ -15683,7 +15706,7 @@ async def start_migration_to_virtual_machine_scale_set( # pylint: disable=name- self, resource_group_name: str, availability_set_name: str, - body: _models.MigrateToVirtualMachineScaleSetInput, + parameters: _models.MigrateToVirtualMachineScaleSetInput, *, content_type: str = "application/json", **kwargs: Any @@ -15697,8 +15720,9 @@ async def start_migration_to_virtual_machine_scale_set( # pylint: disable=name- :type resource_group_name: str :param availability_set_name: The name of the availability set. Required. :type availability_set_name: str - :param body: Parameters supplied to the migrate operation on the availability set. Required. - :type body: ~azure.mgmt.compute.models.MigrateToVirtualMachineScaleSetInput + :param parameters: Parameters supplied to the migrate operation on the availability set. + Required. + :type parameters: ~azure.mgmt.compute.models.MigrateToVirtualMachineScaleSetInput :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -15712,7 +15736,7 @@ async def start_migration_to_virtual_machine_scale_set( # pylint: disable=name- self, resource_group_name: str, availability_set_name: str, - body: JSON, + parameters: JSON, *, content_type: str = "application/json", **kwargs: Any @@ -15726,8 +15750,9 @@ async def start_migration_to_virtual_machine_scale_set( # pylint: disable=name- :type resource_group_name: str :param availability_set_name: The name of the availability set. Required. :type availability_set_name: str - :param body: Parameters supplied to the migrate operation on the availability set. Required. - :type body: JSON + :param parameters: Parameters supplied to the migrate operation on the availability set. + Required. + :type parameters: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -15741,7 +15766,7 @@ async def start_migration_to_virtual_machine_scale_set( # pylint: disable=name- self, resource_group_name: str, availability_set_name: str, - body: IO[bytes], + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -15755,8 +15780,9 @@ async def start_migration_to_virtual_machine_scale_set( # pylint: disable=name- :type resource_group_name: str :param availability_set_name: The name of the availability set. Required. :type availability_set_name: str - :param body: Parameters supplied to the migrate operation on the availability set. Required. - :type body: IO[bytes] + :param parameters: Parameters supplied to the migrate operation on the availability set. + Required. + :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str @@ -15770,7 +15796,7 @@ async def start_migration_to_virtual_machine_scale_set( # pylint: disable=name- self, resource_group_name: str, availability_set_name: str, - body: Union[_models.MigrateToVirtualMachineScaleSetInput, JSON, IO[bytes]], + parameters: Union[_models.MigrateToVirtualMachineScaleSetInput, JSON, IO[bytes]], **kwargs: Any ) -> None: """Start migration operation on an Availability Set to move its Virtual Machines to a Virtual @@ -15782,9 +15808,9 @@ async def start_migration_to_virtual_machine_scale_set( # pylint: disable=name- :type resource_group_name: str :param availability_set_name: The name of the availability set. Required. :type availability_set_name: str - :param body: Parameters supplied to the migrate operation on the availability set. Is one of - the following types: MigrateToVirtualMachineScaleSetInput, JSON, IO[bytes] Required. - :type body: ~azure.mgmt.compute.models.MigrateToVirtualMachineScaleSetInput or JSON or + :param parameters: Parameters supplied to the migrate operation on the availability set. Is one + of the following types: MigrateToVirtualMachineScaleSetInput, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.compute.models.MigrateToVirtualMachineScaleSetInput or JSON or IO[bytes] :return: None :rtype: None @@ -15806,10 +15832,10 @@ async def start_migration_to_virtual_machine_scale_set( # pylint: disable=name- content_type = content_type or "application/json" _content = None - if isinstance(body, (IOBase, bytes)): - _content = body + if isinstance(parameters, (IOBase, bytes)): + _content = parameters else: - _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore _request = build_availability_sets_start_migration_to_virtual_machine_scale_set_request( resource_group_name=resource_group_name, @@ -15902,7 +15928,7 @@ async def validate_migration_to_virtual_machine_scale_set( # pylint: disable=na self, resource_group_name: str, availability_set_name: str, - body: _models.MigrateToVirtualMachineScaleSetInput, + parameters: _models.MigrateToVirtualMachineScaleSetInput, *, content_type: str = "application/json", **kwargs: Any @@ -15915,8 +15941,9 @@ async def validate_migration_to_virtual_machine_scale_set( # pylint: disable=na :type resource_group_name: str :param availability_set_name: The name of the availability set. Required. :type availability_set_name: str - :param body: Parameters supplied to the migrate operation on the availability set. Required. - :type body: ~azure.mgmt.compute.models.MigrateToVirtualMachineScaleSetInput + :param parameters: Parameters supplied to the migrate operation on the availability set. + Required. + :type parameters: ~azure.mgmt.compute.models.MigrateToVirtualMachineScaleSetInput :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -15930,7 +15957,7 @@ async def validate_migration_to_virtual_machine_scale_set( # pylint: disable=na self, resource_group_name: str, availability_set_name: str, - body: JSON, + parameters: JSON, *, content_type: str = "application/json", **kwargs: Any @@ -15943,8 +15970,9 @@ async def validate_migration_to_virtual_machine_scale_set( # pylint: disable=na :type resource_group_name: str :param availability_set_name: The name of the availability set. Required. :type availability_set_name: str - :param body: Parameters supplied to the migrate operation on the availability set. Required. - :type body: JSON + :param parameters: Parameters supplied to the migrate operation on the availability set. + Required. + :type parameters: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -15958,7 +15986,7 @@ async def validate_migration_to_virtual_machine_scale_set( # pylint: disable=na self, resource_group_name: str, availability_set_name: str, - body: IO[bytes], + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -15971,8 +15999,9 @@ async def validate_migration_to_virtual_machine_scale_set( # pylint: disable=na :type resource_group_name: str :param availability_set_name: The name of the availability set. Required. :type availability_set_name: str - :param body: Parameters supplied to the migrate operation on the availability set. Required. - :type body: IO[bytes] + :param parameters: Parameters supplied to the migrate operation on the availability set. + Required. + :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str @@ -15986,7 +16015,7 @@ async def validate_migration_to_virtual_machine_scale_set( # pylint: disable=na self, resource_group_name: str, availability_set_name: str, - body: Union[_models.MigrateToVirtualMachineScaleSetInput, JSON, IO[bytes]], + parameters: Union[_models.MigrateToVirtualMachineScaleSetInput, JSON, IO[bytes]], **kwargs: Any ) -> None: """Validates that the Virtual Machines in the Availability Set can be migrated to the provided @@ -15997,9 +16026,9 @@ async def validate_migration_to_virtual_machine_scale_set( # pylint: disable=na :type resource_group_name: str :param availability_set_name: The name of the availability set. Required. :type availability_set_name: str - :param body: Parameters supplied to the migrate operation on the availability set. Is one of - the following types: MigrateToVirtualMachineScaleSetInput, JSON, IO[bytes] Required. - :type body: ~azure.mgmt.compute.models.MigrateToVirtualMachineScaleSetInput or JSON or + :param parameters: Parameters supplied to the migrate operation on the availability set. Is one + of the following types: MigrateToVirtualMachineScaleSetInput, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.compute.models.MigrateToVirtualMachineScaleSetInput or JSON or IO[bytes] :return: None :rtype: None @@ -16021,10 +16050,10 @@ async def validate_migration_to_virtual_machine_scale_set( # pylint: disable=na content_type = content_type or "application/json" _content = None - if isinstance(body, (IOBase, bytes)): - _content = body + if isinstance(parameters, (IOBase, bytes)): + _content = parameters else: - _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore _request = build_availability_sets_validate_migration_to_virtual_machine_scale_set_request( resource_group_name=resource_group_name, @@ -16390,7 +16419,7 @@ async def create_or_update( self, resource_group_name: str, proximity_placement_group_name: str, - resource: _models.ProximityPlacementGroup, + parameters: _models.ProximityPlacementGroup, *, content_type: str = "application/json", **kwargs: Any @@ -16402,9 +16431,9 @@ async def create_or_update( :type resource_group_name: str :param proximity_placement_group_name: The name of the proximity placement group. Required. :type proximity_placement_group_name: str - :param resource: Parameters supplied to the Create Proximity Placement Group operation. + :param parameters: Parameters supplied to the Create Proximity Placement Group operation. Required. - :type resource: ~azure.mgmt.compute.models.ProximityPlacementGroup + :type parameters: ~azure.mgmt.compute.models.ProximityPlacementGroup :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -16418,7 +16447,7 @@ async def create_or_update( self, resource_group_name: str, proximity_placement_group_name: str, - resource: JSON, + parameters: JSON, *, content_type: str = "application/json", **kwargs: Any @@ -16430,9 +16459,9 @@ async def create_or_update( :type resource_group_name: str :param proximity_placement_group_name: The name of the proximity placement group. Required. :type proximity_placement_group_name: str - :param resource: Parameters supplied to the Create Proximity Placement Group operation. + :param parameters: Parameters supplied to the Create Proximity Placement Group operation. Required. - :type resource: JSON + :type parameters: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -16446,7 +16475,7 @@ async def create_or_update( self, resource_group_name: str, proximity_placement_group_name: str, - resource: IO[bytes], + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -16458,9 +16487,9 @@ async def create_or_update( :type resource_group_name: str :param proximity_placement_group_name: The name of the proximity placement group. Required. :type proximity_placement_group_name: str - :param resource: Parameters supplied to the Create Proximity Placement Group operation. + :param parameters: Parameters supplied to the Create Proximity Placement Group operation. Required. - :type resource: IO[bytes] + :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str @@ -16474,7 +16503,7 @@ async def create_or_update( self, resource_group_name: str, proximity_placement_group_name: str, - resource: Union[_models.ProximityPlacementGroup, JSON, IO[bytes]], + parameters: Union[_models.ProximityPlacementGroup, JSON, IO[bytes]], **kwargs: Any ) -> _models.ProximityPlacementGroup: """Create or update a proximity placement group. @@ -16484,9 +16513,9 @@ async def create_or_update( :type resource_group_name: str :param proximity_placement_group_name: The name of the proximity placement group. Required. :type proximity_placement_group_name: str - :param resource: Parameters supplied to the Create Proximity Placement Group operation. Is one - of the following types: ProximityPlacementGroup, JSON, IO[bytes] Required. - :type resource: ~azure.mgmt.compute.models.ProximityPlacementGroup or JSON or IO[bytes] + :param parameters: Parameters supplied to the Create Proximity Placement Group operation. Is + one of the following types: ProximityPlacementGroup, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.compute.models.ProximityPlacementGroup or JSON or IO[bytes] :return: ProximityPlacementGroup. The ProximityPlacementGroup is compatible with MutableMapping :rtype: ~azure.mgmt.compute.models.ProximityPlacementGroup :raises ~azure.core.exceptions.HttpResponseError: @@ -16507,10 +16536,10 @@ async def create_or_update( content_type = content_type or "application/json" _content = None - if isinstance(resource, (IOBase, bytes)): - _content = resource + if isinstance(parameters, (IOBase, bytes)): + _content = parameters else: - _content = json.dumps(resource, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore _request = build_proximity_placement_groups_create_or_update_request( resource_group_name=resource_group_name, @@ -16559,7 +16588,7 @@ async def update( self, resource_group_name: str, proximity_placement_group_name: str, - properties: _models.ProximityPlacementGroupUpdate, + parameters: _models.ProximityPlacementGroupUpdate, *, content_type: str = "application/json", **kwargs: Any @@ -16571,9 +16600,9 @@ async def update( :type resource_group_name: str :param proximity_placement_group_name: The name of the proximity placement group. Required. :type proximity_placement_group_name: str - :param properties: Parameters supplied to the Update Proximity Placement Group operation. + :param parameters: Parameters supplied to the Update Proximity Placement Group operation. Required. - :type properties: ~azure.mgmt.compute.models.ProximityPlacementGroupUpdate + :type parameters: ~azure.mgmt.compute.models.ProximityPlacementGroupUpdate :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -16587,7 +16616,7 @@ async def update( self, resource_group_name: str, proximity_placement_group_name: str, - properties: JSON, + parameters: JSON, *, content_type: str = "application/json", **kwargs: Any @@ -16599,9 +16628,9 @@ async def update( :type resource_group_name: str :param proximity_placement_group_name: The name of the proximity placement group. Required. :type proximity_placement_group_name: str - :param properties: Parameters supplied to the Update Proximity Placement Group operation. + :param parameters: Parameters supplied to the Update Proximity Placement Group operation. Required. - :type properties: JSON + :type parameters: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -16615,7 +16644,7 @@ async def update( self, resource_group_name: str, proximity_placement_group_name: str, - properties: IO[bytes], + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -16627,9 +16656,9 @@ async def update( :type resource_group_name: str :param proximity_placement_group_name: The name of the proximity placement group. Required. :type proximity_placement_group_name: str - :param properties: Parameters supplied to the Update Proximity Placement Group operation. + :param parameters: Parameters supplied to the Update Proximity Placement Group operation. Required. - :type properties: IO[bytes] + :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str @@ -16643,7 +16672,7 @@ async def update( self, resource_group_name: str, proximity_placement_group_name: str, - properties: Union[_models.ProximityPlacementGroupUpdate, JSON, IO[bytes]], + parameters: Union[_models.ProximityPlacementGroupUpdate, JSON, IO[bytes]], **kwargs: Any ) -> _models.ProximityPlacementGroup: """Update a proximity placement group. @@ -16653,9 +16682,9 @@ async def update( :type resource_group_name: str :param proximity_placement_group_name: The name of the proximity placement group. Required. :type proximity_placement_group_name: str - :param properties: Parameters supplied to the Update Proximity Placement Group operation. Is + :param parameters: Parameters supplied to the Update Proximity Placement Group operation. Is one of the following types: ProximityPlacementGroupUpdate, JSON, IO[bytes] Required. - :type properties: ~azure.mgmt.compute.models.ProximityPlacementGroupUpdate or JSON or IO[bytes] + :type parameters: ~azure.mgmt.compute.models.ProximityPlacementGroupUpdate or JSON or IO[bytes] :return: ProximityPlacementGroup. The ProximityPlacementGroup is compatible with MutableMapping :rtype: ~azure.mgmt.compute.models.ProximityPlacementGroup :raises ~azure.core.exceptions.HttpResponseError: @@ -16676,10 +16705,10 @@ async def update( content_type = content_type or "application/json" _content = None - if isinstance(properties, (IOBase, bytes)): - _content = properties + if isinstance(parameters, (IOBase, bytes)): + _content = parameters else: - _content = json.dumps(properties, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore _request = build_proximity_placement_groups_update_request( resource_group_name=resource_group_name, @@ -17055,7 +17084,7 @@ async def create_or_update( self, resource_group_name: str, host_group_name: str, - resource: _models.DedicatedHostGroup, + parameters: _models.DedicatedHostGroup, *, content_type: str = "application/json", **kwargs: Any @@ -17070,8 +17099,8 @@ async def create_or_update( :type resource_group_name: str :param host_group_name: The name of the dedicated host group. Required. :type host_group_name: str - :param resource: Parameters supplied to the Create Dedicated Host Group. Required. - :type resource: ~azure.mgmt.compute.models.DedicatedHostGroup + :param parameters: Parameters supplied to the Create Dedicated Host Group. Required. + :type parameters: ~azure.mgmt.compute.models.DedicatedHostGroup :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -17085,7 +17114,7 @@ async def create_or_update( self, resource_group_name: str, host_group_name: str, - resource: JSON, + parameters: JSON, *, content_type: str = "application/json", **kwargs: Any @@ -17100,8 +17129,8 @@ async def create_or_update( :type resource_group_name: str :param host_group_name: The name of the dedicated host group. Required. :type host_group_name: str - :param resource: Parameters supplied to the Create Dedicated Host Group. Required. - :type resource: JSON + :param parameters: Parameters supplied to the Create Dedicated Host Group. Required. + :type parameters: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -17115,7 +17144,7 @@ async def create_or_update( self, resource_group_name: str, host_group_name: str, - resource: IO[bytes], + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -17130,8 +17159,8 @@ async def create_or_update( :type resource_group_name: str :param host_group_name: The name of the dedicated host group. Required. :type host_group_name: str - :param resource: Parameters supplied to the Create Dedicated Host Group. Required. - :type resource: IO[bytes] + :param parameters: Parameters supplied to the Create Dedicated Host Group. Required. + :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str @@ -17145,7 +17174,7 @@ async def create_or_update( self, resource_group_name: str, host_group_name: str, - resource: Union[_models.DedicatedHostGroup, JSON, IO[bytes]], + parameters: Union[_models.DedicatedHostGroup, JSON, IO[bytes]], **kwargs: Any ) -> _models.DedicatedHostGroup: """Create or update a dedicated host group. For details of Dedicated Host and Dedicated Host @@ -17158,9 +17187,9 @@ async def create_or_update( :type resource_group_name: str :param host_group_name: The name of the dedicated host group. Required. :type host_group_name: str - :param resource: Parameters supplied to the Create Dedicated Host Group. Is one of the + :param parameters: Parameters supplied to the Create Dedicated Host Group. Is one of the following types: DedicatedHostGroup, JSON, IO[bytes] Required. - :type resource: ~azure.mgmt.compute.models.DedicatedHostGroup or JSON or IO[bytes] + :type parameters: ~azure.mgmt.compute.models.DedicatedHostGroup or JSON or IO[bytes] :return: DedicatedHostGroup. The DedicatedHostGroup is compatible with MutableMapping :rtype: ~azure.mgmt.compute.models.DedicatedHostGroup :raises ~azure.core.exceptions.HttpResponseError: @@ -17181,10 +17210,10 @@ async def create_or_update( content_type = content_type or "application/json" _content = None - if isinstance(resource, (IOBase, bytes)): - _content = resource + if isinstance(parameters, (IOBase, bytes)): + _content = parameters else: - _content = json.dumps(resource, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore _request = build_dedicated_host_groups_create_or_update_request( resource_group_name=resource_group_name, @@ -17233,7 +17262,7 @@ async def update( self, resource_group_name: str, host_group_name: str, - properties: _models.DedicatedHostGroupUpdate, + parameters: _models.DedicatedHostGroupUpdate, *, content_type: str = "application/json", **kwargs: Any @@ -17245,8 +17274,8 @@ async def update( :type resource_group_name: str :param host_group_name: The name of the dedicated host group. Required. :type host_group_name: str - :param properties: Parameters supplied to the Update Dedicated Host Group operation. Required. - :type properties: ~azure.mgmt.compute.models.DedicatedHostGroupUpdate + :param parameters: Parameters supplied to the Update Dedicated Host Group operation. Required. + :type parameters: ~azure.mgmt.compute.models.DedicatedHostGroupUpdate :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -17260,7 +17289,7 @@ async def update( self, resource_group_name: str, host_group_name: str, - properties: JSON, + parameters: JSON, *, content_type: str = "application/json", **kwargs: Any @@ -17272,8 +17301,8 @@ async def update( :type resource_group_name: str :param host_group_name: The name of the dedicated host group. Required. :type host_group_name: str - :param properties: Parameters supplied to the Update Dedicated Host Group operation. Required. - :type properties: JSON + :param parameters: Parameters supplied to the Update Dedicated Host Group operation. Required. + :type parameters: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -17287,7 +17316,7 @@ async def update( self, resource_group_name: str, host_group_name: str, - properties: IO[bytes], + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -17299,8 +17328,8 @@ async def update( :type resource_group_name: str :param host_group_name: The name of the dedicated host group. Required. :type host_group_name: str - :param properties: Parameters supplied to the Update Dedicated Host Group operation. Required. - :type properties: IO[bytes] + :param parameters: Parameters supplied to the Update Dedicated Host Group operation. Required. + :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str @@ -17314,7 +17343,7 @@ async def update( self, resource_group_name: str, host_group_name: str, - properties: Union[_models.DedicatedHostGroupUpdate, JSON, IO[bytes]], + parameters: Union[_models.DedicatedHostGroupUpdate, JSON, IO[bytes]], **kwargs: Any ) -> _models.DedicatedHostGroup: """Update an dedicated host group. @@ -17324,9 +17353,9 @@ async def update( :type resource_group_name: str :param host_group_name: The name of the dedicated host group. Required. :type host_group_name: str - :param properties: Parameters supplied to the Update Dedicated Host Group operation. Is one of + :param parameters: Parameters supplied to the Update Dedicated Host Group operation. Is one of the following types: DedicatedHostGroupUpdate, JSON, IO[bytes] Required. - :type properties: ~azure.mgmt.compute.models.DedicatedHostGroupUpdate or JSON or IO[bytes] + :type parameters: ~azure.mgmt.compute.models.DedicatedHostGroupUpdate or JSON or IO[bytes] :return: DedicatedHostGroup. The DedicatedHostGroup is compatible with MutableMapping :rtype: ~azure.mgmt.compute.models.DedicatedHostGroup :raises ~azure.core.exceptions.HttpResponseError: @@ -17347,10 +17376,10 @@ async def update( content_type = content_type or "application/json" _content = None - if isinstance(properties, (IOBase, bytes)): - _content = properties + if isinstance(parameters, (IOBase, bytes)): + _content = parameters else: - _content = json.dumps(properties, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore _request = build_dedicated_host_groups_update_request( resource_group_name=resource_group_name, @@ -17730,7 +17759,7 @@ async def _create_or_update_initial( resource_group_name: str, host_group_name: str, host_name: str, - resource: Union[_models.DedicatedHost, JSON, IO[bytes]], + parameters: Union[_models.DedicatedHost, JSON, IO[bytes]], **kwargs: Any ) -> AsyncIterator[bytes]: error_map: MutableMapping = { @@ -17749,10 +17778,10 @@ async def _create_or_update_initial( content_type = content_type or "application/json" _content = None - if isinstance(resource, (IOBase, bytes)): - _content = resource + if isinstance(parameters, (IOBase, bytes)): + _content = parameters else: - _content = json.dumps(resource, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore _request = build_dedicated_hosts_create_or_update_request( resource_group_name=resource_group_name, @@ -17804,7 +17833,7 @@ async def begin_create_or_update( resource_group_name: str, host_group_name: str, host_name: str, - resource: _models.DedicatedHost, + parameters: _models.DedicatedHost, *, content_type: str = "application/json", **kwargs: Any @@ -17818,8 +17847,8 @@ async def begin_create_or_update( :type host_group_name: str :param host_name: The name of the dedicated host. Required. :type host_name: str - :param resource: Parameters supplied to the Create Dedicated Host. Required. - :type resource: ~azure.mgmt.compute.models.DedicatedHost + :param parameters: Parameters supplied to the Create Dedicated Host. Required. + :type parameters: ~azure.mgmt.compute.models.DedicatedHost :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -17834,7 +17863,7 @@ async def begin_create_or_update( resource_group_name: str, host_group_name: str, host_name: str, - resource: JSON, + parameters: JSON, *, content_type: str = "application/json", **kwargs: Any @@ -17848,8 +17877,8 @@ async def begin_create_or_update( :type host_group_name: str :param host_name: The name of the dedicated host. Required. :type host_name: str - :param resource: Parameters supplied to the Create Dedicated Host. Required. - :type resource: JSON + :param parameters: Parameters supplied to the Create Dedicated Host. Required. + :type parameters: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -17864,7 +17893,7 @@ async def begin_create_or_update( resource_group_name: str, host_group_name: str, host_name: str, - resource: IO[bytes], + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -17878,8 +17907,8 @@ async def begin_create_or_update( :type host_group_name: str :param host_name: The name of the dedicated host. Required. :type host_name: str - :param resource: Parameters supplied to the Create Dedicated Host. Required. - :type resource: IO[bytes] + :param parameters: Parameters supplied to the Create Dedicated Host. Required. + :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str @@ -17894,7 +17923,7 @@ async def begin_create_or_update( resource_group_name: str, host_group_name: str, host_name: str, - resource: Union[_models.DedicatedHost, JSON, IO[bytes]], + parameters: Union[_models.DedicatedHost, JSON, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[None]: """Create or update a dedicated host . @@ -17906,9 +17935,9 @@ async def begin_create_or_update( :type host_group_name: str :param host_name: The name of the dedicated host. Required. :type host_name: str - :param resource: Parameters supplied to the Create Dedicated Host. Is one of the following + :param parameters: Parameters supplied to the Create Dedicated Host. Is one of the following types: DedicatedHost, JSON, IO[bytes] Required. - :type resource: ~azure.mgmt.compute.models.DedicatedHost or JSON or IO[bytes] + :type parameters: ~azure.mgmt.compute.models.DedicatedHost or JSON or IO[bytes] :return: An instance of AsyncLROPoller that returns None :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -17926,7 +17955,7 @@ async def begin_create_or_update( resource_group_name=resource_group_name, host_group_name=host_group_name, host_name=host_name, - resource=resource, + parameters=parameters, content_type=content_type, cls=lambda x, y, z: x, headers=_headers, @@ -17966,7 +17995,7 @@ async def _update_initial( resource_group_name: str, host_group_name: str, host_name: str, - properties: Union[_models.DedicatedHostUpdate, JSON, IO[bytes]], + parameters: Union[_models.DedicatedHostUpdate, JSON, IO[bytes]], **kwargs: Any ) -> AsyncIterator[bytes]: error_map: MutableMapping = { @@ -17985,10 +18014,10 @@ async def _update_initial( content_type = content_type or "application/json" _content = None - if isinstance(properties, (IOBase, bytes)): - _content = properties + if isinstance(parameters, (IOBase, bytes)): + _content = parameters else: - _content = json.dumps(properties, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore _request = build_dedicated_hosts_update_request( resource_group_name=resource_group_name, @@ -18039,7 +18068,7 @@ async def begin_update( resource_group_name: str, host_group_name: str, host_name: str, - properties: _models.DedicatedHostUpdate, + parameters: _models.DedicatedHostUpdate, *, content_type: str = "application/json", **kwargs: Any @@ -18053,8 +18082,8 @@ async def begin_update( :type host_group_name: str :param host_name: The name of the dedicated host. Required. :type host_name: str - :param properties: Parameters supplied to the Update Dedicated Host operation. Required. - :type properties: ~azure.mgmt.compute.models.DedicatedHostUpdate + :param parameters: Parameters supplied to the Update Dedicated Host operation. Required. + :type parameters: ~azure.mgmt.compute.models.DedicatedHostUpdate :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -18069,7 +18098,7 @@ async def begin_update( resource_group_name: str, host_group_name: str, host_name: str, - properties: JSON, + parameters: JSON, *, content_type: str = "application/json", **kwargs: Any @@ -18083,8 +18112,8 @@ async def begin_update( :type host_group_name: str :param host_name: The name of the dedicated host. Required. :type host_name: str - :param properties: Parameters supplied to the Update Dedicated Host operation. Required. - :type properties: JSON + :param parameters: Parameters supplied to the Update Dedicated Host operation. Required. + :type parameters: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -18099,7 +18128,7 @@ async def begin_update( resource_group_name: str, host_group_name: str, host_name: str, - properties: IO[bytes], + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -18113,8 +18142,8 @@ async def begin_update( :type host_group_name: str :param host_name: The name of the dedicated host. Required. :type host_name: str - :param properties: Parameters supplied to the Update Dedicated Host operation. Required. - :type properties: IO[bytes] + :param parameters: Parameters supplied to the Update Dedicated Host operation. Required. + :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str @@ -18129,7 +18158,7 @@ async def begin_update( resource_group_name: str, host_group_name: str, host_name: str, - properties: Union[_models.DedicatedHostUpdate, JSON, IO[bytes]], + parameters: Union[_models.DedicatedHostUpdate, JSON, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[None]: """Update a dedicated host . @@ -18141,9 +18170,9 @@ async def begin_update( :type host_group_name: str :param host_name: The name of the dedicated host. Required. :type host_name: str - :param properties: Parameters supplied to the Update Dedicated Host operation. Is one of the + :param parameters: Parameters supplied to the Update Dedicated Host operation. Is one of the following types: DedicatedHostUpdate, JSON, IO[bytes] Required. - :type properties: ~azure.mgmt.compute.models.DedicatedHostUpdate or JSON or IO[bytes] + :type parameters: ~azure.mgmt.compute.models.DedicatedHostUpdate or JSON or IO[bytes] :return: An instance of AsyncLROPoller that returns None :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -18161,7 +18190,7 @@ async def begin_update( resource_group_name=resource_group_name, host_group_name=host_group_name, host_name=host_name, - properties=properties, + parameters=parameters, content_type=content_type, cls=lambda x, y, z: x, headers=_headers, @@ -18845,7 +18874,7 @@ async def create( self, resource_group_name: str, ssh_public_key_name: str, - resource: _models.SshPublicKeyResource, + parameters: _models.SshPublicKeyResource, *, content_type: str = "application/json", **kwargs: Any @@ -18857,8 +18886,8 @@ async def create( :type resource_group_name: str :param ssh_public_key_name: The name of the SSH public key. Required. :type ssh_public_key_name: str - :param resource: Parameters supplied to create the SSH public key. Required. - :type resource: ~azure.mgmt.compute.models.SshPublicKeyResource + :param parameters: Parameters supplied to create the SSH public key. Required. + :type parameters: ~azure.mgmt.compute.models.SshPublicKeyResource :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -18872,7 +18901,7 @@ async def create( self, resource_group_name: str, ssh_public_key_name: str, - resource: JSON, + parameters: JSON, *, content_type: str = "application/json", **kwargs: Any @@ -18884,8 +18913,8 @@ async def create( :type resource_group_name: str :param ssh_public_key_name: The name of the SSH public key. Required. :type ssh_public_key_name: str - :param resource: Parameters supplied to create the SSH public key. Required. - :type resource: JSON + :param parameters: Parameters supplied to create the SSH public key. Required. + :type parameters: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -18899,7 +18928,7 @@ async def create( self, resource_group_name: str, ssh_public_key_name: str, - resource: IO[bytes], + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -18911,8 +18940,8 @@ async def create( :type resource_group_name: str :param ssh_public_key_name: The name of the SSH public key. Required. :type ssh_public_key_name: str - :param resource: Parameters supplied to create the SSH public key. Required. - :type resource: IO[bytes] + :param parameters: Parameters supplied to create the SSH public key. Required. + :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str @@ -18926,7 +18955,7 @@ async def create( self, resource_group_name: str, ssh_public_key_name: str, - resource: Union[_models.SshPublicKeyResource, JSON, IO[bytes]], + parameters: Union[_models.SshPublicKeyResource, JSON, IO[bytes]], **kwargs: Any ) -> _models.SshPublicKeyResource: """Creates a new SSH public key resource. @@ -18936,9 +18965,9 @@ async def create( :type resource_group_name: str :param ssh_public_key_name: The name of the SSH public key. Required. :type ssh_public_key_name: str - :param resource: Parameters supplied to create the SSH public key. Is one of the following + :param parameters: Parameters supplied to create the SSH public key. Is one of the following types: SshPublicKeyResource, JSON, IO[bytes] Required. - :type resource: ~azure.mgmt.compute.models.SshPublicKeyResource or JSON or IO[bytes] + :type parameters: ~azure.mgmt.compute.models.SshPublicKeyResource or JSON or IO[bytes] :return: SshPublicKeyResource. The SshPublicKeyResource is compatible with MutableMapping :rtype: ~azure.mgmt.compute.models.SshPublicKeyResource :raises ~azure.core.exceptions.HttpResponseError: @@ -18959,10 +18988,10 @@ async def create( content_type = content_type or "application/json" _content = None - if isinstance(resource, (IOBase, bytes)): - _content = resource + if isinstance(parameters, (IOBase, bytes)): + _content = parameters else: - _content = json.dumps(resource, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore _request = build_ssh_public_key_resources_create_request( resource_group_name=resource_group_name, @@ -19011,7 +19040,7 @@ async def update( self, resource_group_name: str, ssh_public_key_name: str, - properties: _models.SshPublicKeyUpdateResource, + parameters: _models.SshPublicKeyUpdateResource, *, content_type: str = "application/json", **kwargs: Any @@ -19023,8 +19052,8 @@ async def update( :type resource_group_name: str :param ssh_public_key_name: The name of the SSH public key. Required. :type ssh_public_key_name: str - :param properties: Parameters supplied to update the SSH public key. Required. - :type properties: ~azure.mgmt.compute.models.SshPublicKeyUpdateResource + :param parameters: Parameters supplied to update the SSH public key. Required. + :type parameters: ~azure.mgmt.compute.models.SshPublicKeyUpdateResource :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -19038,7 +19067,7 @@ async def update( self, resource_group_name: str, ssh_public_key_name: str, - properties: JSON, + parameters: JSON, *, content_type: str = "application/json", **kwargs: Any @@ -19050,8 +19079,8 @@ async def update( :type resource_group_name: str :param ssh_public_key_name: The name of the SSH public key. Required. :type ssh_public_key_name: str - :param properties: Parameters supplied to update the SSH public key. Required. - :type properties: JSON + :param parameters: Parameters supplied to update the SSH public key. Required. + :type parameters: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -19065,7 +19094,7 @@ async def update( self, resource_group_name: str, ssh_public_key_name: str, - properties: IO[bytes], + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -19077,8 +19106,8 @@ async def update( :type resource_group_name: str :param ssh_public_key_name: The name of the SSH public key. Required. :type ssh_public_key_name: str - :param properties: Parameters supplied to update the SSH public key. Required. - :type properties: IO[bytes] + :param parameters: Parameters supplied to update the SSH public key. Required. + :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str @@ -19092,7 +19121,7 @@ async def update( self, resource_group_name: str, ssh_public_key_name: str, - properties: Union[_models.SshPublicKeyUpdateResource, JSON, IO[bytes]], + parameters: Union[_models.SshPublicKeyUpdateResource, JSON, IO[bytes]], **kwargs: Any ) -> _models.SshPublicKeyResource: """Updates a new SSH public key resource. @@ -19102,9 +19131,9 @@ async def update( :type resource_group_name: str :param ssh_public_key_name: The name of the SSH public key. Required. :type ssh_public_key_name: str - :param properties: Parameters supplied to update the SSH public key. Is one of the following + :param parameters: Parameters supplied to update the SSH public key. Is one of the following types: SshPublicKeyUpdateResource, JSON, IO[bytes] Required. - :type properties: ~azure.mgmt.compute.models.SshPublicKeyUpdateResource or JSON or IO[bytes] + :type parameters: ~azure.mgmt.compute.models.SshPublicKeyUpdateResource or JSON or IO[bytes] :return: SshPublicKeyResource. The SshPublicKeyResource is compatible with MutableMapping :rtype: ~azure.mgmt.compute.models.SshPublicKeyResource :raises ~azure.core.exceptions.HttpResponseError: @@ -19125,10 +19154,10 @@ async def update( content_type = content_type or "application/json" _content = None - if isinstance(properties, (IOBase, bytes)): - _content = properties + if isinstance(parameters, (IOBase, bytes)): + _content = parameters else: - _content = json.dumps(properties, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore _request = build_ssh_public_key_resources_update_request( resource_group_name=resource_group_name, @@ -19677,7 +19706,11 @@ async def get( return deserialized # type: ignore async def _create_or_update_initial( - self, resource_group_name: str, image_name: str, resource: Union[_models.Image, JSON, IO[bytes]], **kwargs: Any + self, + resource_group_name: str, + image_name: str, + parameters: Union[_models.Image, JSON, IO[bytes]], + **kwargs: Any ) -> AsyncIterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -19695,10 +19728,10 @@ async def _create_or_update_initial( content_type = content_type or "application/json" _content = None - if isinstance(resource, (IOBase, bytes)): - _content = resource + if isinstance(parameters, (IOBase, bytes)): + _content = parameters else: - _content = json.dumps(resource, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore _request = build_images_create_or_update_request( resource_group_name=resource_group_name, @@ -19748,7 +19781,7 @@ async def begin_create_or_update( self, resource_group_name: str, image_name: str, - resource: _models.Image, + parameters: _models.Image, *, content_type: str = "application/json", **kwargs: Any @@ -19760,8 +19793,8 @@ async def begin_create_or_update( :type resource_group_name: str :param image_name: The name of the image. Required. :type image_name: str - :param resource: Parameters supplied to the Create Image operation. Required. - :type resource: ~azure.mgmt.compute.models.Image + :param parameters: Parameters supplied to the Create Image operation. Required. + :type parameters: ~azure.mgmt.compute.models.Image :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -19775,7 +19808,7 @@ async def begin_create_or_update( self, resource_group_name: str, image_name: str, - resource: JSON, + parameters: JSON, *, content_type: str = "application/json", **kwargs: Any @@ -19787,8 +19820,8 @@ async def begin_create_or_update( :type resource_group_name: str :param image_name: The name of the image. Required. :type image_name: str - :param resource: Parameters supplied to the Create Image operation. Required. - :type resource: JSON + :param parameters: Parameters supplied to the Create Image operation. Required. + :type parameters: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -19802,7 +19835,7 @@ async def begin_create_or_update( self, resource_group_name: str, image_name: str, - resource: IO[bytes], + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -19814,8 +19847,8 @@ async def begin_create_or_update( :type resource_group_name: str :param image_name: The name of the image. Required. :type image_name: str - :param resource: Parameters supplied to the Create Image operation. Required. - :type resource: IO[bytes] + :param parameters: Parameters supplied to the Create Image operation. Required. + :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str @@ -19826,7 +19859,11 @@ async def begin_create_or_update( @distributed_trace_async async def begin_create_or_update( - self, resource_group_name: str, image_name: str, resource: Union[_models.Image, JSON, IO[bytes]], **kwargs: Any + self, + resource_group_name: str, + image_name: str, + parameters: Union[_models.Image, JSON, IO[bytes]], + **kwargs: Any ) -> AsyncLROPoller[None]: """Create or update an image. @@ -19835,9 +19872,9 @@ async def begin_create_or_update( :type resource_group_name: str :param image_name: The name of the image. Required. :type image_name: str - :param resource: Parameters supplied to the Create Image operation. Is one of the following + :param parameters: Parameters supplied to the Create Image operation. Is one of the following types: Image, JSON, IO[bytes] Required. - :type resource: ~azure.mgmt.compute.models.Image or JSON or IO[bytes] + :type parameters: ~azure.mgmt.compute.models.Image or JSON or IO[bytes] :return: An instance of AsyncLROPoller that returns None :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -19854,7 +19891,7 @@ async def begin_create_or_update( raw_result = await self._create_or_update_initial( resource_group_name=resource_group_name, image_name=image_name, - resource=resource, + parameters=parameters, content_type=content_type, cls=lambda x, y, z: x, headers=_headers, @@ -19893,7 +19930,7 @@ async def _update_initial( self, resource_group_name: str, image_name: str, - properties: Union[_models.ImageUpdate, JSON, IO[bytes]], + parameters: Union[_models.ImageUpdate, JSON, IO[bytes]], **kwargs: Any ) -> AsyncIterator[bytes]: error_map: MutableMapping = { @@ -19912,10 +19949,10 @@ async def _update_initial( content_type = content_type or "application/json" _content = None - if isinstance(properties, (IOBase, bytes)): - _content = properties + if isinstance(parameters, (IOBase, bytes)): + _content = parameters else: - _content = json.dumps(properties, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore _request = build_images_update_request( resource_group_name=resource_group_name, @@ -19965,7 +20002,7 @@ async def begin_update( self, resource_group_name: str, image_name: str, - properties: _models.ImageUpdate, + parameters: _models.ImageUpdate, *, content_type: str = "application/json", **kwargs: Any @@ -19977,8 +20014,8 @@ async def begin_update( :type resource_group_name: str :param image_name: The name of the image. Required. :type image_name: str - :param properties: Parameters supplied to the Update Image operation. Required. - :type properties: ~azure.mgmt.compute.models.ImageUpdate + :param parameters: Parameters supplied to the Update Image operation. Required. + :type parameters: ~azure.mgmt.compute.models.ImageUpdate :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -19992,7 +20029,7 @@ async def begin_update( self, resource_group_name: str, image_name: str, - properties: JSON, + parameters: JSON, *, content_type: str = "application/json", **kwargs: Any @@ -20004,8 +20041,8 @@ async def begin_update( :type resource_group_name: str :param image_name: The name of the image. Required. :type image_name: str - :param properties: Parameters supplied to the Update Image operation. Required. - :type properties: JSON + :param parameters: Parameters supplied to the Update Image operation. Required. + :type parameters: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -20019,7 +20056,7 @@ async def begin_update( self, resource_group_name: str, image_name: str, - properties: IO[bytes], + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -20031,8 +20068,8 @@ async def begin_update( :type resource_group_name: str :param image_name: The name of the image. Required. :type image_name: str - :param properties: Parameters supplied to the Update Image operation. Required. - :type properties: IO[bytes] + :param parameters: Parameters supplied to the Update Image operation. Required. + :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str @@ -20046,7 +20083,7 @@ async def begin_update( self, resource_group_name: str, image_name: str, - properties: Union[_models.ImageUpdate, JSON, IO[bytes]], + parameters: Union[_models.ImageUpdate, JSON, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[None]: """Update an image. @@ -20056,9 +20093,9 @@ async def begin_update( :type resource_group_name: str :param image_name: The name of the image. Required. :type image_name: str - :param properties: Parameters supplied to the Update Image operation. Is one of the following + :param parameters: Parameters supplied to the Update Image operation. Is one of the following types: ImageUpdate, JSON, IO[bytes] Required. - :type properties: ~azure.mgmt.compute.models.ImageUpdate or JSON or IO[bytes] + :type parameters: ~azure.mgmt.compute.models.ImageUpdate or JSON or IO[bytes] :return: An instance of AsyncLROPoller that returns None :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -20075,7 +20112,7 @@ async def begin_update( raw_result = await self._update_initial( resource_group_name=resource_group_name, image_name=image_name, - properties=properties, + parameters=parameters, content_type=content_type, cls=lambda x, y, z: x, headers=_headers, @@ -20497,7 +20534,7 @@ async def create_or_update( self, resource_group_name: str, restore_point_collection_name: str, - resource: _models.RestorePointCollection, + parameters: _models.RestorePointCollection, *, content_type: str = "application/json", **kwargs: Any @@ -20511,9 +20548,9 @@ async def create_or_update( :type resource_group_name: str :param restore_point_collection_name: The name of the restore point collection. Required. :type restore_point_collection_name: str - :param resource: Parameters supplied to the Create or Update restore point collection + :param parameters: Parameters supplied to the Create or Update restore point collection operation. Required. - :type resource: ~azure.mgmt.compute.models.RestorePointCollection + :type parameters: ~azure.mgmt.compute.models.RestorePointCollection :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -20527,7 +20564,7 @@ async def create_or_update( self, resource_group_name: str, restore_point_collection_name: str, - resource: JSON, + parameters: JSON, *, content_type: str = "application/json", **kwargs: Any @@ -20541,9 +20578,9 @@ async def create_or_update( :type resource_group_name: str :param restore_point_collection_name: The name of the restore point collection. Required. :type restore_point_collection_name: str - :param resource: Parameters supplied to the Create or Update restore point collection + :param parameters: Parameters supplied to the Create or Update restore point collection operation. Required. - :type resource: JSON + :type parameters: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -20557,7 +20594,7 @@ async def create_or_update( self, resource_group_name: str, restore_point_collection_name: str, - resource: IO[bytes], + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -20571,9 +20608,9 @@ async def create_or_update( :type resource_group_name: str :param restore_point_collection_name: The name of the restore point collection. Required. :type restore_point_collection_name: str - :param resource: Parameters supplied to the Create or Update restore point collection + :param parameters: Parameters supplied to the Create or Update restore point collection operation. Required. - :type resource: IO[bytes] + :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str @@ -20587,7 +20624,7 @@ async def create_or_update( self, resource_group_name: str, restore_point_collection_name: str, - resource: Union[_models.RestorePointCollection, JSON, IO[bytes]], + parameters: Union[_models.RestorePointCollection, JSON, IO[bytes]], **kwargs: Any ) -> _models.RestorePointCollection: """The operation to create or update the restore point collection. Please refer to @@ -20599,9 +20636,9 @@ async def create_or_update( :type resource_group_name: str :param restore_point_collection_name: The name of the restore point collection. Required. :type restore_point_collection_name: str - :param resource: Parameters supplied to the Create or Update restore point collection + :param parameters: Parameters supplied to the Create or Update restore point collection operation. Is one of the following types: RestorePointCollection, JSON, IO[bytes] Required. - :type resource: ~azure.mgmt.compute.models.RestorePointCollection or JSON or IO[bytes] + :type parameters: ~azure.mgmt.compute.models.RestorePointCollection or JSON or IO[bytes] :return: RestorePointCollection. The RestorePointCollection is compatible with MutableMapping :rtype: ~azure.mgmt.compute.models.RestorePointCollection :raises ~azure.core.exceptions.HttpResponseError: @@ -20622,10 +20659,10 @@ async def create_or_update( content_type = content_type or "application/json" _content = None - if isinstance(resource, (IOBase, bytes)): - _content = resource + if isinstance(parameters, (IOBase, bytes)): + _content = parameters else: - _content = json.dumps(resource, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore _request = build_restore_point_collections_create_or_update_request( resource_group_name=resource_group_name, @@ -20674,7 +20711,7 @@ async def update( self, resource_group_name: str, restore_point_collection_name: str, - properties: _models.RestorePointCollectionUpdate, + parameters: _models.RestorePointCollectionUpdate, *, content_type: str = "application/json", **kwargs: Any @@ -20686,9 +20723,9 @@ async def update( :type resource_group_name: str :param restore_point_collection_name: The name of the restore point collection. Required. :type restore_point_collection_name: str - :param properties: Parameters supplied to the Update restore point collection operation. + :param parameters: Parameters supplied to the Update restore point collection operation. Required. - :type properties: ~azure.mgmt.compute.models.RestorePointCollectionUpdate + :type parameters: ~azure.mgmt.compute.models.RestorePointCollectionUpdate :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -20702,7 +20739,7 @@ async def update( self, resource_group_name: str, restore_point_collection_name: str, - properties: JSON, + parameters: JSON, *, content_type: str = "application/json", **kwargs: Any @@ -20714,9 +20751,9 @@ async def update( :type resource_group_name: str :param restore_point_collection_name: The name of the restore point collection. Required. :type restore_point_collection_name: str - :param properties: Parameters supplied to the Update restore point collection operation. + :param parameters: Parameters supplied to the Update restore point collection operation. Required. - :type properties: JSON + :type parameters: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -20730,7 +20767,7 @@ async def update( self, resource_group_name: str, restore_point_collection_name: str, - properties: IO[bytes], + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -20742,9 +20779,9 @@ async def update( :type resource_group_name: str :param restore_point_collection_name: The name of the restore point collection. Required. :type restore_point_collection_name: str - :param properties: Parameters supplied to the Update restore point collection operation. + :param parameters: Parameters supplied to the Update restore point collection operation. Required. - :type properties: IO[bytes] + :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str @@ -20758,7 +20795,7 @@ async def update( self, resource_group_name: str, restore_point_collection_name: str, - properties: Union[_models.RestorePointCollectionUpdate, JSON, IO[bytes]], + parameters: Union[_models.RestorePointCollectionUpdate, JSON, IO[bytes]], **kwargs: Any ) -> _models.RestorePointCollection: """The operation to update the restore point collection. @@ -20768,9 +20805,9 @@ async def update( :type resource_group_name: str :param restore_point_collection_name: The name of the restore point collection. Required. :type restore_point_collection_name: str - :param properties: Parameters supplied to the Update restore point collection operation. Is one + :param parameters: Parameters supplied to the Update restore point collection operation. Is one of the following types: RestorePointCollectionUpdate, JSON, IO[bytes] Required. - :type properties: ~azure.mgmt.compute.models.RestorePointCollectionUpdate or JSON or IO[bytes] + :type parameters: ~azure.mgmt.compute.models.RestorePointCollectionUpdate or JSON or IO[bytes] :return: RestorePointCollection. The RestorePointCollection is compatible with MutableMapping :rtype: ~azure.mgmt.compute.models.RestorePointCollection :raises ~azure.core.exceptions.HttpResponseError: @@ -20791,10 +20828,10 @@ async def update( content_type = content_type or "application/json" _content = None - if isinstance(properties, (IOBase, bytes)): - _content = properties + if isinstance(parameters, (IOBase, bytes)): + _content = parameters else: - _content = json.dumps(properties, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore _request = build_restore_point_collections_update_request( resource_group_name=resource_group_name, @@ -21235,7 +21272,7 @@ async def _create_initial( resource_group_name: str, restore_point_collection_name: str, restore_point_name: str, - resource: Union[_models.RestorePoint, JSON, IO[bytes]], + parameters: Union[_models.RestorePoint, JSON, IO[bytes]], **kwargs: Any ) -> AsyncIterator[bytes]: error_map: MutableMapping = { @@ -21254,10 +21291,10 @@ async def _create_initial( content_type = content_type or "application/json" _content = None - if isinstance(resource, (IOBase, bytes)): - _content = resource + if isinstance(parameters, (IOBase, bytes)): + _content = parameters else: - _content = json.dumps(resource, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore _request = build_restore_points_create_request( resource_group_name=resource_group_name, @@ -21308,7 +21345,7 @@ async def begin_create( resource_group_name: str, restore_point_collection_name: str, restore_point_name: str, - resource: _models.RestorePoint, + parameters: _models.RestorePoint, *, content_type: str = "application/json", **kwargs: Any @@ -21323,8 +21360,8 @@ async def begin_create( :type restore_point_collection_name: str :param restore_point_name: The name of the restore point. Required. :type restore_point_name: str - :param resource: Parameters supplied to the Create restore point operation. Required. - :type resource: ~azure.mgmt.compute.models.RestorePoint + :param parameters: Parameters supplied to the Create restore point operation. Required. + :type parameters: ~azure.mgmt.compute.models.RestorePoint :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -21339,7 +21376,7 @@ async def begin_create( resource_group_name: str, restore_point_collection_name: str, restore_point_name: str, - resource: JSON, + parameters: JSON, *, content_type: str = "application/json", **kwargs: Any @@ -21354,8 +21391,8 @@ async def begin_create( :type restore_point_collection_name: str :param restore_point_name: The name of the restore point. Required. :type restore_point_name: str - :param resource: Parameters supplied to the Create restore point operation. Required. - :type resource: JSON + :param parameters: Parameters supplied to the Create restore point operation. Required. + :type parameters: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -21370,7 +21407,7 @@ async def begin_create( resource_group_name: str, restore_point_collection_name: str, restore_point_name: str, - resource: IO[bytes], + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -21385,8 +21422,8 @@ async def begin_create( :type restore_point_collection_name: str :param restore_point_name: The name of the restore point. Required. :type restore_point_name: str - :param resource: Parameters supplied to the Create restore point operation. Required. - :type resource: IO[bytes] + :param parameters: Parameters supplied to the Create restore point operation. Required. + :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str @@ -21401,7 +21438,7 @@ async def begin_create( resource_group_name: str, restore_point_collection_name: str, restore_point_name: str, - resource: Union[_models.RestorePoint, JSON, IO[bytes]], + parameters: Union[_models.RestorePoint, JSON, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[None]: """The operation to create the restore point. Updating properties of an existing restore point is @@ -21414,9 +21451,9 @@ async def begin_create( :type restore_point_collection_name: str :param restore_point_name: The name of the restore point. Required. :type restore_point_name: str - :param resource: Parameters supplied to the Create restore point operation. Is one of the + :param parameters: Parameters supplied to the Create restore point operation. Is one of the following types: RestorePoint, JSON, IO[bytes] Required. - :type resource: ~azure.mgmt.compute.models.RestorePoint or JSON or IO[bytes] + :type parameters: ~azure.mgmt.compute.models.RestorePoint or JSON or IO[bytes] :return: An instance of AsyncLROPoller that returns None :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -21434,7 +21471,7 @@ async def begin_create( resource_group_name=resource_group_name, restore_point_collection_name=restore_point_collection_name, restore_point_name=restore_point_name, - resource=resource, + parameters=parameters, content_type=content_type, cls=lambda x, y, z: x, headers=_headers, @@ -21693,7 +21730,7 @@ async def create_or_update( self, resource_group_name: str, capacity_reservation_group_name: str, - resource: _models.CapacityReservationGroup, + parameters: _models.CapacityReservationGroup, *, content_type: str = "application/json", **kwargs: Any @@ -21707,8 +21744,8 @@ async def create_or_update( :type resource_group_name: str :param capacity_reservation_group_name: The name of the capacity reservation group. Required. :type capacity_reservation_group_name: str - :param resource: Parameters supplied to the Create capacity reservation Group. Required. - :type resource: ~azure.mgmt.compute.models.CapacityReservationGroup + :param parameters: Parameters supplied to the Create capacity reservation Group. Required. + :type parameters: ~azure.mgmt.compute.models.CapacityReservationGroup :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -21723,7 +21760,7 @@ async def create_or_update( self, resource_group_name: str, capacity_reservation_group_name: str, - resource: JSON, + parameters: JSON, *, content_type: str = "application/json", **kwargs: Any @@ -21737,8 +21774,8 @@ async def create_or_update( :type resource_group_name: str :param capacity_reservation_group_name: The name of the capacity reservation group. Required. :type capacity_reservation_group_name: str - :param resource: Parameters supplied to the Create capacity reservation Group. Required. - :type resource: JSON + :param parameters: Parameters supplied to the Create capacity reservation Group. Required. + :type parameters: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -21753,7 +21790,7 @@ async def create_or_update( self, resource_group_name: str, capacity_reservation_group_name: str, - resource: IO[bytes], + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -21767,8 +21804,8 @@ async def create_or_update( :type resource_group_name: str :param capacity_reservation_group_name: The name of the capacity reservation group. Required. :type capacity_reservation_group_name: str - :param resource: Parameters supplied to the Create capacity reservation Group. Required. - :type resource: IO[bytes] + :param parameters: Parameters supplied to the Create capacity reservation Group. Required. + :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str @@ -21783,7 +21820,7 @@ async def create_or_update( self, resource_group_name: str, capacity_reservation_group_name: str, - resource: Union[_models.CapacityReservationGroup, JSON, IO[bytes]], + parameters: Union[_models.CapacityReservationGroup, JSON, IO[bytes]], **kwargs: Any ) -> _models.CapacityReservationGroup: """The operation to create or update a capacity reservation group. When updating a capacity @@ -21795,9 +21832,9 @@ async def create_or_update( :type resource_group_name: str :param capacity_reservation_group_name: The name of the capacity reservation group. Required. :type capacity_reservation_group_name: str - :param resource: Parameters supplied to the Create capacity reservation Group. Is one of the + :param parameters: Parameters supplied to the Create capacity reservation Group. Is one of the following types: CapacityReservationGroup, JSON, IO[bytes] Required. - :type resource: ~azure.mgmt.compute.models.CapacityReservationGroup or JSON or IO[bytes] + :type parameters: ~azure.mgmt.compute.models.CapacityReservationGroup or JSON or IO[bytes] :return: CapacityReservationGroup. The CapacityReservationGroup is compatible with MutableMapping :rtype: ~azure.mgmt.compute.models.CapacityReservationGroup @@ -21819,10 +21856,10 @@ async def create_or_update( content_type = content_type or "application/json" _content = None - if isinstance(resource, (IOBase, bytes)): - _content = resource + if isinstance(parameters, (IOBase, bytes)): + _content = parameters else: - _content = json.dumps(resource, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore _request = build_capacity_reservation_groups_create_or_update_request( resource_group_name=resource_group_name, @@ -21871,7 +21908,7 @@ async def update( self, resource_group_name: str, capacity_reservation_group_name: str, - properties: _models.CapacityReservationGroupUpdate, + parameters: _models.CapacityReservationGroupUpdate, *, content_type: str = "application/json", **kwargs: Any @@ -21884,9 +21921,9 @@ async def update( :type resource_group_name: str :param capacity_reservation_group_name: The name of the capacity reservation group. Required. :type capacity_reservation_group_name: str - :param properties: Parameters supplied to the Update capacity reservation Group operation. + :param parameters: Parameters supplied to the Update capacity reservation Group operation. Required. - :type properties: ~azure.mgmt.compute.models.CapacityReservationGroupUpdate + :type parameters: ~azure.mgmt.compute.models.CapacityReservationGroupUpdate :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -21901,7 +21938,7 @@ async def update( self, resource_group_name: str, capacity_reservation_group_name: str, - properties: JSON, + parameters: JSON, *, content_type: str = "application/json", **kwargs: Any @@ -21914,9 +21951,9 @@ async def update( :type resource_group_name: str :param capacity_reservation_group_name: The name of the capacity reservation group. Required. :type capacity_reservation_group_name: str - :param properties: Parameters supplied to the Update capacity reservation Group operation. + :param parameters: Parameters supplied to the Update capacity reservation Group operation. Required. - :type properties: JSON + :type parameters: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -21931,7 +21968,7 @@ async def update( self, resource_group_name: str, capacity_reservation_group_name: str, - properties: IO[bytes], + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -21944,9 +21981,9 @@ async def update( :type resource_group_name: str :param capacity_reservation_group_name: The name of the capacity reservation group. Required. :type capacity_reservation_group_name: str - :param properties: Parameters supplied to the Update capacity reservation Group operation. + :param parameters: Parameters supplied to the Update capacity reservation Group operation. Required. - :type properties: IO[bytes] + :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str @@ -21961,7 +21998,7 @@ async def update( self, resource_group_name: str, capacity_reservation_group_name: str, - properties: Union[_models.CapacityReservationGroupUpdate, JSON, IO[bytes]], + parameters: Union[_models.CapacityReservationGroupUpdate, JSON, IO[bytes]], **kwargs: Any ) -> _models.CapacityReservationGroup: """The operation to update a capacity reservation group. When updating a capacity reservation @@ -21972,9 +22009,9 @@ async def update( :type resource_group_name: str :param capacity_reservation_group_name: The name of the capacity reservation group. Required. :type capacity_reservation_group_name: str - :param properties: Parameters supplied to the Update capacity reservation Group operation. Is + :param parameters: Parameters supplied to the Update capacity reservation Group operation. Is one of the following types: CapacityReservationGroupUpdate, JSON, IO[bytes] Required. - :type properties: ~azure.mgmt.compute.models.CapacityReservationGroupUpdate or JSON or + :type parameters: ~azure.mgmt.compute.models.CapacityReservationGroupUpdate or JSON or IO[bytes] :return: CapacityReservationGroup. The CapacityReservationGroup is compatible with MutableMapping @@ -21997,10 +22034,10 @@ async def update( content_type = content_type or "application/json" _content = None - if isinstance(properties, (IOBase, bytes)): - _content = properties + if isinstance(parameters, (IOBase, bytes)): + _content = parameters else: - _content = json.dumps(properties, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore _request = build_capacity_reservation_groups_update_request( resource_group_name=resource_group_name, @@ -22416,7 +22453,7 @@ async def _create_or_update_initial( resource_group_name: str, capacity_reservation_group_name: str, capacity_reservation_name: str, - resource: Union[_models.CapacityReservation, JSON, IO[bytes]], + parameters: Union[_models.CapacityReservation, JSON, IO[bytes]], **kwargs: Any ) -> AsyncIterator[bytes]: error_map: MutableMapping = { @@ -22435,10 +22472,10 @@ async def _create_or_update_initial( content_type = content_type or "application/json" _content = None - if isinstance(resource, (IOBase, bytes)): - _content = resource + if isinstance(parameters, (IOBase, bytes)): + _content = parameters else: - _content = json.dumps(resource, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore _request = build_capacity_reservations_create_or_update_request( resource_group_name=resource_group_name, @@ -22490,7 +22527,7 @@ async def begin_create_or_update( resource_group_name: str, capacity_reservation_group_name: str, capacity_reservation_name: str, - resource: _models.CapacityReservation, + parameters: _models.CapacityReservation, *, content_type: str = "application/json", **kwargs: Any @@ -22506,8 +22543,8 @@ async def begin_create_or_update( :type capacity_reservation_group_name: str :param capacity_reservation_name: The name of the capacity reservation. Required. :type capacity_reservation_name: str - :param resource: Parameters supplied to the Create capacity reservation. Required. - :type resource: ~azure.mgmt.compute.models.CapacityReservation + :param parameters: Parameters supplied to the Create capacity reservation. Required. + :type parameters: ~azure.mgmt.compute.models.CapacityReservation :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -22522,7 +22559,7 @@ async def begin_create_or_update( resource_group_name: str, capacity_reservation_group_name: str, capacity_reservation_name: str, - resource: JSON, + parameters: JSON, *, content_type: str = "application/json", **kwargs: Any @@ -22538,8 +22575,8 @@ async def begin_create_or_update( :type capacity_reservation_group_name: str :param capacity_reservation_name: The name of the capacity reservation. Required. :type capacity_reservation_name: str - :param resource: Parameters supplied to the Create capacity reservation. Required. - :type resource: JSON + :param parameters: Parameters supplied to the Create capacity reservation. Required. + :type parameters: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -22554,7 +22591,7 @@ async def begin_create_or_update( resource_group_name: str, capacity_reservation_group_name: str, capacity_reservation_name: str, - resource: IO[bytes], + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -22570,8 +22607,8 @@ async def begin_create_or_update( :type capacity_reservation_group_name: str :param capacity_reservation_name: The name of the capacity reservation. Required. :type capacity_reservation_name: str - :param resource: Parameters supplied to the Create capacity reservation. Required. - :type resource: IO[bytes] + :param parameters: Parameters supplied to the Create capacity reservation. Required. + :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str @@ -22586,7 +22623,7 @@ async def begin_create_or_update( resource_group_name: str, capacity_reservation_group_name: str, capacity_reservation_name: str, - resource: Union[_models.CapacityReservation, JSON, IO[bytes]], + parameters: Union[_models.CapacityReservation, JSON, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[None]: """The operation to create or update a capacity reservation. Please note some properties can be @@ -22600,9 +22637,9 @@ async def begin_create_or_update( :type capacity_reservation_group_name: str :param capacity_reservation_name: The name of the capacity reservation. Required. :type capacity_reservation_name: str - :param resource: Parameters supplied to the Create capacity reservation. Is one of the + :param parameters: Parameters supplied to the Create capacity reservation. Is one of the following types: CapacityReservation, JSON, IO[bytes] Required. - :type resource: ~azure.mgmt.compute.models.CapacityReservation or JSON or IO[bytes] + :type parameters: ~azure.mgmt.compute.models.CapacityReservation or JSON or IO[bytes] :return: An instance of AsyncLROPoller that returns None :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -22620,7 +22657,7 @@ async def begin_create_or_update( resource_group_name=resource_group_name, capacity_reservation_group_name=capacity_reservation_group_name, capacity_reservation_name=capacity_reservation_name, - resource=resource, + parameters=parameters, content_type=content_type, cls=lambda x, y, z: x, headers=_headers, @@ -22660,7 +22697,7 @@ async def _update_initial( resource_group_name: str, capacity_reservation_group_name: str, capacity_reservation_name: str, - properties: Union[_models.CapacityReservationUpdate, JSON, IO[bytes]], + parameters: Union[_models.CapacityReservationUpdate, JSON, IO[bytes]], **kwargs: Any ) -> AsyncIterator[bytes]: error_map: MutableMapping = { @@ -22679,10 +22716,10 @@ async def _update_initial( content_type = content_type or "application/json" _content = None - if isinstance(properties, (IOBase, bytes)): - _content = properties + if isinstance(parameters, (IOBase, bytes)): + _content = parameters else: - _content = json.dumps(properties, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore _request = build_capacity_reservations_update_request( resource_group_name=resource_group_name, @@ -22734,7 +22771,7 @@ async def begin_update( resource_group_name: str, capacity_reservation_group_name: str, capacity_reservation_name: str, - properties: _models.CapacityReservationUpdate, + parameters: _models.CapacityReservationUpdate, *, content_type: str = "application/json", **kwargs: Any @@ -22748,8 +22785,8 @@ async def begin_update( :type capacity_reservation_group_name: str :param capacity_reservation_name: The name of the capacity reservation. Required. :type capacity_reservation_name: str - :param properties: Parameters supplied to the Update capacity reservation operation. Required. - :type properties: ~azure.mgmt.compute.models.CapacityReservationUpdate + :param parameters: Parameters supplied to the Update capacity reservation operation. Required. + :type parameters: ~azure.mgmt.compute.models.CapacityReservationUpdate :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -22764,7 +22801,7 @@ async def begin_update( resource_group_name: str, capacity_reservation_group_name: str, capacity_reservation_name: str, - properties: JSON, + parameters: JSON, *, content_type: str = "application/json", **kwargs: Any @@ -22778,8 +22815,8 @@ async def begin_update( :type capacity_reservation_group_name: str :param capacity_reservation_name: The name of the capacity reservation. Required. :type capacity_reservation_name: str - :param properties: Parameters supplied to the Update capacity reservation operation. Required. - :type properties: JSON + :param parameters: Parameters supplied to the Update capacity reservation operation. Required. + :type parameters: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -22794,7 +22831,7 @@ async def begin_update( resource_group_name: str, capacity_reservation_group_name: str, capacity_reservation_name: str, - properties: IO[bytes], + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -22808,8 +22845,8 @@ async def begin_update( :type capacity_reservation_group_name: str :param capacity_reservation_name: The name of the capacity reservation. Required. :type capacity_reservation_name: str - :param properties: Parameters supplied to the Update capacity reservation operation. Required. - :type properties: IO[bytes] + :param parameters: Parameters supplied to the Update capacity reservation operation. Required. + :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str @@ -22824,7 +22861,7 @@ async def begin_update( resource_group_name: str, capacity_reservation_group_name: str, capacity_reservation_name: str, - properties: Union[_models.CapacityReservationUpdate, JSON, IO[bytes]], + parameters: Union[_models.CapacityReservationUpdate, JSON, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[None]: """The operation to update a capacity reservation. @@ -22836,9 +22873,9 @@ async def begin_update( :type capacity_reservation_group_name: str :param capacity_reservation_name: The name of the capacity reservation. Required. :type capacity_reservation_name: str - :param properties: Parameters supplied to the Update capacity reservation operation. Is one of + :param parameters: Parameters supplied to the Update capacity reservation operation. Is one of the following types: CapacityReservationUpdate, JSON, IO[bytes] Required. - :type properties: ~azure.mgmt.compute.models.CapacityReservationUpdate or JSON or IO[bytes] + :type parameters: ~azure.mgmt.compute.models.CapacityReservationUpdate or JSON or IO[bytes] :return: An instance of AsyncLROPoller that returns None :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -22856,7 +22893,7 @@ async def begin_update( resource_group_name=resource_group_name, capacity_reservation_group_name=capacity_reservation_group_name, capacity_reservation_name=capacity_reservation_name, - properties=properties, + parameters=parameters, content_type=content_type, cls=lambda x, y, z: x, headers=_headers, @@ -23221,7 +23258,7 @@ async def _create_or_update_initial( resource_group_name: str, vm_name: str, run_command_name: str, - body: Union[_models.VirtualMachineRunCommand, JSON, IO[bytes]], + run_command: Union[_models.VirtualMachineRunCommand, JSON, IO[bytes]], **kwargs: Any ) -> AsyncIterator[bytes]: error_map: MutableMapping = { @@ -23240,10 +23277,10 @@ async def _create_or_update_initial( content_type = content_type or "application/json" _content = None - if isinstance(body, (IOBase, bytes)): - _content = body + if isinstance(run_command, (IOBase, bytes)): + _content = run_command else: - _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(run_command, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore _request = build_virtual_machine_run_commands_create_or_update_request( resource_group_name=resource_group_name, @@ -23295,7 +23332,7 @@ async def begin_create_or_update( resource_group_name: str, vm_name: str, run_command_name: str, - body: _models.VirtualMachineRunCommand, + run_command: _models.VirtualMachineRunCommand, *, content_type: str = "application/json", **kwargs: Any @@ -23309,8 +23346,9 @@ async def begin_create_or_update( :type vm_name: str :param run_command_name: The name of the VirtualMachineRunCommand. Required. :type run_command_name: str - :param body: Parameters supplied to the Create Virtual Machine RunCommand operation. Required. - :type body: ~azure.mgmt.compute.models.VirtualMachineRunCommand + :param run_command: Parameters supplied to the Create Virtual Machine RunCommand operation. + Required. + :type run_command: ~azure.mgmt.compute.models.VirtualMachineRunCommand :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -23325,7 +23363,7 @@ async def begin_create_or_update( resource_group_name: str, vm_name: str, run_command_name: str, - body: JSON, + run_command: JSON, *, content_type: str = "application/json", **kwargs: Any @@ -23339,8 +23377,9 @@ async def begin_create_or_update( :type vm_name: str :param run_command_name: The name of the VirtualMachineRunCommand. Required. :type run_command_name: str - :param body: Parameters supplied to the Create Virtual Machine RunCommand operation. Required. - :type body: JSON + :param run_command: Parameters supplied to the Create Virtual Machine RunCommand operation. + Required. + :type run_command: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -23355,7 +23394,7 @@ async def begin_create_or_update( resource_group_name: str, vm_name: str, run_command_name: str, - body: IO[bytes], + run_command: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -23369,8 +23408,9 @@ async def begin_create_or_update( :type vm_name: str :param run_command_name: The name of the VirtualMachineRunCommand. Required. :type run_command_name: str - :param body: Parameters supplied to the Create Virtual Machine RunCommand operation. Required. - :type body: IO[bytes] + :param run_command: Parameters supplied to the Create Virtual Machine RunCommand operation. + Required. + :type run_command: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str @@ -23385,7 +23425,7 @@ async def begin_create_or_update( resource_group_name: str, vm_name: str, run_command_name: str, - body: Union[_models.VirtualMachineRunCommand, JSON, IO[bytes]], + run_command: Union[_models.VirtualMachineRunCommand, JSON, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[None]: """The operation to create or update the run command. @@ -23397,9 +23437,9 @@ async def begin_create_or_update( :type vm_name: str :param run_command_name: The name of the VirtualMachineRunCommand. Required. :type run_command_name: str - :param body: Parameters supplied to the Create Virtual Machine RunCommand operation. Is one of - the following types: VirtualMachineRunCommand, JSON, IO[bytes] Required. - :type body: ~azure.mgmt.compute.models.VirtualMachineRunCommand or JSON or IO[bytes] + :param run_command: Parameters supplied to the Create Virtual Machine RunCommand operation. Is + one of the following types: VirtualMachineRunCommand, JSON, IO[bytes] Required. + :type run_command: ~azure.mgmt.compute.models.VirtualMachineRunCommand or JSON or IO[bytes] :return: An instance of AsyncLROPoller that returns None :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -23417,7 +23457,7 @@ async def begin_create_or_update( resource_group_name=resource_group_name, vm_name=vm_name, run_command_name=run_command_name, - body=body, + run_command=run_command, content_type=content_type, cls=lambda x, y, z: x, headers=_headers, @@ -23457,7 +23497,7 @@ async def _update_initial( resource_group_name: str, vm_name: str, run_command_name: str, - body: Union[_models.VirtualMachineRunCommandUpdate, JSON, IO[bytes]], + run_command: Union[_models.VirtualMachineRunCommandUpdate, JSON, IO[bytes]], **kwargs: Any ) -> AsyncIterator[bytes]: error_map: MutableMapping = { @@ -23476,10 +23516,10 @@ async def _update_initial( content_type = content_type or "application/json" _content = None - if isinstance(body, (IOBase, bytes)): - _content = body + if isinstance(run_command, (IOBase, bytes)): + _content = run_command else: - _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(run_command, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore _request = build_virtual_machine_run_commands_update_request( resource_group_name=resource_group_name, @@ -23530,7 +23570,7 @@ async def begin_update( resource_group_name: str, vm_name: str, run_command_name: str, - body: _models.VirtualMachineRunCommandUpdate, + run_command: _models.VirtualMachineRunCommandUpdate, *, content_type: str = "application/json", **kwargs: Any @@ -23544,8 +23584,9 @@ async def begin_update( :type vm_name: str :param run_command_name: The name of the VirtualMachineRunCommand. Required. :type run_command_name: str - :param body: Parameters supplied to the Update Virtual Machine RunCommand operation. Required. - :type body: ~azure.mgmt.compute.models.VirtualMachineRunCommandUpdate + :param run_command: Parameters supplied to the Update Virtual Machine RunCommand operation. + Required. + :type run_command: ~azure.mgmt.compute.models.VirtualMachineRunCommandUpdate :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -23560,7 +23601,7 @@ async def begin_update( resource_group_name: str, vm_name: str, run_command_name: str, - body: JSON, + run_command: JSON, *, content_type: str = "application/json", **kwargs: Any @@ -23574,8 +23615,9 @@ async def begin_update( :type vm_name: str :param run_command_name: The name of the VirtualMachineRunCommand. Required. :type run_command_name: str - :param body: Parameters supplied to the Update Virtual Machine RunCommand operation. Required. - :type body: JSON + :param run_command: Parameters supplied to the Update Virtual Machine RunCommand operation. + Required. + :type run_command: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -23590,7 +23632,7 @@ async def begin_update( resource_group_name: str, vm_name: str, run_command_name: str, - body: IO[bytes], + run_command: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -23604,8 +23646,9 @@ async def begin_update( :type vm_name: str :param run_command_name: The name of the VirtualMachineRunCommand. Required. :type run_command_name: str - :param body: Parameters supplied to the Update Virtual Machine RunCommand operation. Required. - :type body: IO[bytes] + :param run_command: Parameters supplied to the Update Virtual Machine RunCommand operation. + Required. + :type run_command: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str @@ -23620,7 +23663,7 @@ async def begin_update( resource_group_name: str, vm_name: str, run_command_name: str, - body: Union[_models.VirtualMachineRunCommandUpdate, JSON, IO[bytes]], + run_command: Union[_models.VirtualMachineRunCommandUpdate, JSON, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[None]: """The operation to update the run command. @@ -23632,9 +23675,10 @@ async def begin_update( :type vm_name: str :param run_command_name: The name of the VirtualMachineRunCommand. Required. :type run_command_name: str - :param body: Parameters supplied to the Update Virtual Machine RunCommand operation. Is one of - the following types: VirtualMachineRunCommandUpdate, JSON, IO[bytes] Required. - :type body: ~azure.mgmt.compute.models.VirtualMachineRunCommandUpdate or JSON or IO[bytes] + :param run_command: Parameters supplied to the Update Virtual Machine RunCommand operation. Is + one of the following types: VirtualMachineRunCommandUpdate, JSON, IO[bytes] Required. + :type run_command: ~azure.mgmt.compute.models.VirtualMachineRunCommandUpdate or JSON or + IO[bytes] :return: An instance of AsyncLROPoller that returns None :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -23652,7 +23696,7 @@ async def begin_update( resource_group_name=resource_group_name, vm_name=vm_name, run_command_name=run_command_name, - body=body, + run_command=run_command, content_type=content_type, cls=lambda x, y, z: x, headers=_headers, @@ -24013,7 +24057,7 @@ async def _create_or_update_initial( vm_scale_set_name: str, instance_id: str, run_command_name: str, - body: Union[_models.VirtualMachineRunCommand, JSON, IO[bytes]], + run_command: Union[_models.VirtualMachineRunCommand, JSON, IO[bytes]], **kwargs: Any ) -> AsyncIterator[bytes]: error_map: MutableMapping = { @@ -24032,10 +24076,10 @@ async def _create_or_update_initial( content_type = content_type or "application/json" _content = None - if isinstance(body, (IOBase, bytes)): - _content = body + if isinstance(run_command, (IOBase, bytes)): + _content = run_command else: - _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(run_command, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore _request = build_virtual_machine_scale_set_vm_run_commands_create_or_update_request( resource_group_name=resource_group_name, @@ -24089,7 +24133,7 @@ async def begin_create_or_update( vm_scale_set_name: str, instance_id: str, run_command_name: str, - body: _models.VirtualMachineRunCommand, + run_command: _models.VirtualMachineRunCommand, *, content_type: str = "application/json", **kwargs: Any @@ -24105,8 +24149,9 @@ async def begin_create_or_update( :type instance_id: str :param run_command_name: The name of the VirtualMachineRunCommand. Required. :type run_command_name: str - :param body: Parameters supplied to the Create Virtual Machine RunCommand operation. Required. - :type body: ~azure.mgmt.compute.models.VirtualMachineRunCommand + :param run_command: Parameters supplied to the Create Virtual Machine RunCommand operation. + Required. + :type run_command: ~azure.mgmt.compute.models.VirtualMachineRunCommand :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -24122,7 +24167,7 @@ async def begin_create_or_update( vm_scale_set_name: str, instance_id: str, run_command_name: str, - body: JSON, + run_command: JSON, *, content_type: str = "application/json", **kwargs: Any @@ -24138,8 +24183,9 @@ async def begin_create_or_update( :type instance_id: str :param run_command_name: The name of the VirtualMachineRunCommand. Required. :type run_command_name: str - :param body: Parameters supplied to the Create Virtual Machine RunCommand operation. Required. - :type body: JSON + :param run_command: Parameters supplied to the Create Virtual Machine RunCommand operation. + Required. + :type run_command: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -24155,7 +24201,7 @@ async def begin_create_or_update( vm_scale_set_name: str, instance_id: str, run_command_name: str, - body: IO[bytes], + run_command: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -24171,8 +24217,9 @@ async def begin_create_or_update( :type instance_id: str :param run_command_name: The name of the VirtualMachineRunCommand. Required. :type run_command_name: str - :param body: Parameters supplied to the Create Virtual Machine RunCommand operation. Required. - :type body: IO[bytes] + :param run_command: Parameters supplied to the Create Virtual Machine RunCommand operation. + Required. + :type run_command: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str @@ -24188,7 +24235,7 @@ async def begin_create_or_update( vm_scale_set_name: str, instance_id: str, run_command_name: str, - body: Union[_models.VirtualMachineRunCommand, JSON, IO[bytes]], + run_command: Union[_models.VirtualMachineRunCommand, JSON, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[None]: """The operation to create or update the VMSS VM run command. @@ -24202,9 +24249,9 @@ async def begin_create_or_update( :type instance_id: str :param run_command_name: The name of the VirtualMachineRunCommand. Required. :type run_command_name: str - :param body: Parameters supplied to the Create Virtual Machine RunCommand operation. Is one of - the following types: VirtualMachineRunCommand, JSON, IO[bytes] Required. - :type body: ~azure.mgmt.compute.models.VirtualMachineRunCommand or JSON or IO[bytes] + :param run_command: Parameters supplied to the Create Virtual Machine RunCommand operation. Is + one of the following types: VirtualMachineRunCommand, JSON, IO[bytes] Required. + :type run_command: ~azure.mgmt.compute.models.VirtualMachineRunCommand or JSON or IO[bytes] :return: An instance of AsyncLROPoller that returns None :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -24223,7 +24270,7 @@ async def begin_create_or_update( vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, run_command_name=run_command_name, - body=body, + run_command=run_command, content_type=content_type, cls=lambda x, y, z: x, headers=_headers, @@ -24264,7 +24311,7 @@ async def _update_initial( vm_scale_set_name: str, instance_id: str, run_command_name: str, - body: Union[_models.VirtualMachineRunCommandUpdate, JSON, IO[bytes]], + run_command: Union[_models.VirtualMachineRunCommandUpdate, JSON, IO[bytes]], **kwargs: Any ) -> AsyncIterator[bytes]: error_map: MutableMapping = { @@ -24283,10 +24330,10 @@ async def _update_initial( content_type = content_type or "application/json" _content = None - if isinstance(body, (IOBase, bytes)): - _content = body + if isinstance(run_command, (IOBase, bytes)): + _content = run_command else: - _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(run_command, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore _request = build_virtual_machine_scale_set_vm_run_commands_update_request( resource_group_name=resource_group_name, @@ -24339,7 +24386,7 @@ async def begin_update( vm_scale_set_name: str, instance_id: str, run_command_name: str, - body: _models.VirtualMachineRunCommandUpdate, + run_command: _models.VirtualMachineRunCommandUpdate, *, content_type: str = "application/json", **kwargs: Any @@ -24355,8 +24402,8 @@ async def begin_update( :type instance_id: str :param run_command_name: The name of the VirtualMachineRunCommand. Required. :type run_command_name: str - :param body: Resource create parameters. Required. - :type body: ~azure.mgmt.compute.models.VirtualMachineRunCommandUpdate + :param run_command: Resource create parameters. Required. + :type run_command: ~azure.mgmt.compute.models.VirtualMachineRunCommandUpdate :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -24372,7 +24419,7 @@ async def begin_update( vm_scale_set_name: str, instance_id: str, run_command_name: str, - body: JSON, + run_command: JSON, *, content_type: str = "application/json", **kwargs: Any @@ -24388,8 +24435,8 @@ async def begin_update( :type instance_id: str :param run_command_name: The name of the VirtualMachineRunCommand. Required. :type run_command_name: str - :param body: Resource create parameters. Required. - :type body: JSON + :param run_command: Resource create parameters. Required. + :type run_command: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -24405,7 +24452,7 @@ async def begin_update( vm_scale_set_name: str, instance_id: str, run_command_name: str, - body: IO[bytes], + run_command: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -24421,8 +24468,8 @@ async def begin_update( :type instance_id: str :param run_command_name: The name of the VirtualMachineRunCommand. Required. :type run_command_name: str - :param body: Resource create parameters. Required. - :type body: IO[bytes] + :param run_command: Resource create parameters. Required. + :type run_command: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str @@ -24438,7 +24485,7 @@ async def begin_update( vm_scale_set_name: str, instance_id: str, run_command_name: str, - body: Union[_models.VirtualMachineRunCommandUpdate, JSON, IO[bytes]], + run_command: Union[_models.VirtualMachineRunCommandUpdate, JSON, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[None]: """The operation to update the VMSS VM run command. @@ -24452,9 +24499,10 @@ async def begin_update( :type instance_id: str :param run_command_name: The name of the VirtualMachineRunCommand. Required. :type run_command_name: str - :param body: Resource create parameters. Is one of the following types: + :param run_command: Resource create parameters. Is one of the following types: VirtualMachineRunCommandUpdate, JSON, IO[bytes] Required. - :type body: ~azure.mgmt.compute.models.VirtualMachineRunCommandUpdate or JSON or IO[bytes] + :type run_command: ~azure.mgmt.compute.models.VirtualMachineRunCommandUpdate or JSON or + IO[bytes] :return: An instance of AsyncLROPoller that returns None :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -24473,7 +24521,7 @@ async def begin_update( vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, run_command_name=run_command_name, - body=body, + run_command=run_command, content_type=content_type, cls=lambda x, y, z: x, headers=_headers, @@ -26131,7 +26179,7 @@ def __init__(self, *args, **kwargs) -> None: self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") async def _export_request_rate_by_interval_initial( - self, location: str, body: Union[_models.RequestRateByIntervalInput, JSON, IO[bytes]], **kwargs: Any + self, location: str, parameters: Union[_models.RequestRateByIntervalInput, JSON, IO[bytes]], **kwargs: Any ) -> AsyncIterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -26149,10 +26197,10 @@ async def _export_request_rate_by_interval_initial( content_type = content_type or "application/json" _content = None - if isinstance(body, (IOBase, bytes)): - _content = body + if isinstance(parameters, (IOBase, bytes)): + _content = parameters else: - _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore _request = build_log_analytics_operation_group_export_request_rate_by_interval_request( location=location, @@ -26202,7 +26250,7 @@ async def _export_request_rate_by_interval_initial( async def begin_export_request_rate_by_interval( self, location: str, - body: _models.RequestRateByIntervalInput, + parameters: _models.RequestRateByIntervalInput, *, content_type: str = "application/json", **kwargs: Any @@ -26212,8 +26260,9 @@ async def begin_export_request_rate_by_interval( :param location: The location name. Required. :type location: str - :param body: Parameters supplied to the LogAnalytics getRequestRateByInterval Api. Required. - :type body: ~azure.mgmt.compute.models.RequestRateByIntervalInput + :param parameters: Parameters supplied to the LogAnalytics getRequestRateByInterval Api. + Required. + :type parameters: ~azure.mgmt.compute.models.RequestRateByIntervalInput :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -26224,15 +26273,16 @@ async def begin_export_request_rate_by_interval( @overload async def begin_export_request_rate_by_interval( - self, location: str, body: JSON, *, content_type: str = "application/json", **kwargs: Any + self, location: str, parameters: JSON, *, content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[None]: """Export logs that show Api requests made by this subscription in the given time window to show throttling activities. :param location: The location name. Required. :type location: str - :param body: Parameters supplied to the LogAnalytics getRequestRateByInterval Api. Required. - :type body: JSON + :param parameters: Parameters supplied to the LogAnalytics getRequestRateByInterval Api. + Required. + :type parameters: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -26243,15 +26293,16 @@ async def begin_export_request_rate_by_interval( @overload async def begin_export_request_rate_by_interval( - self, location: str, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any + self, location: str, parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[None]: """Export logs that show Api requests made by this subscription in the given time window to show throttling activities. :param location: The location name. Required. :type location: str - :param body: Parameters supplied to the LogAnalytics getRequestRateByInterval Api. Required. - :type body: IO[bytes] + :param parameters: Parameters supplied to the LogAnalytics getRequestRateByInterval Api. + Required. + :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str @@ -26262,16 +26313,16 @@ async def begin_export_request_rate_by_interval( @distributed_trace_async async def begin_export_request_rate_by_interval( - self, location: str, body: Union[_models.RequestRateByIntervalInput, JSON, IO[bytes]], **kwargs: Any + self, location: str, parameters: Union[_models.RequestRateByIntervalInput, JSON, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[None]: """Export logs that show Api requests made by this subscription in the given time window to show throttling activities. :param location: The location name. Required. :type location: str - :param body: Parameters supplied to the LogAnalytics getRequestRateByInterval Api. Is one of - the following types: RequestRateByIntervalInput, JSON, IO[bytes] Required. - :type body: ~azure.mgmt.compute.models.RequestRateByIntervalInput or JSON or IO[bytes] + :param parameters: Parameters supplied to the LogAnalytics getRequestRateByInterval Api. Is one + of the following types: RequestRateByIntervalInput, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.compute.models.RequestRateByIntervalInput or JSON or IO[bytes] :return: An instance of AsyncLROPoller that returns None :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -26287,7 +26338,7 @@ async def begin_export_request_rate_by_interval( if cont_token is None: raw_result = await self._export_request_rate_by_interval_initial( location=location, - body=body, + parameters=parameters, content_type=content_type, cls=lambda x, y, z: x, headers=_headers, @@ -26323,7 +26374,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore async def _export_throttled_requests_initial( - self, location: str, body: Union[_models.ThrottledRequestsInput, JSON, IO[bytes]], **kwargs: Any + self, location: str, parameters: Union[_models.ThrottledRequestsInput, JSON, IO[bytes]], **kwargs: Any ) -> AsyncIterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -26341,10 +26392,10 @@ async def _export_throttled_requests_initial( content_type = content_type or "application/json" _content = None - if isinstance(body, (IOBase, bytes)): - _content = body + if isinstance(parameters, (IOBase, bytes)): + _content = parameters else: - _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore _request = build_log_analytics_operation_group_export_throttled_requests_request( location=location, @@ -26394,7 +26445,7 @@ async def _export_throttled_requests_initial( async def begin_export_throttled_requests( self, location: str, - body: _models.ThrottledRequestsInput, + parameters: _models.ThrottledRequestsInput, *, content_type: str = "application/json", **kwargs: Any @@ -26404,8 +26455,8 @@ async def begin_export_throttled_requests( :param location: The location name. Required. :type location: str - :param body: The request body. Required. - :type body: ~azure.mgmt.compute.models.ThrottledRequestsInput + :param parameters: The request body. Required. + :type parameters: ~azure.mgmt.compute.models.ThrottledRequestsInput :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -26416,15 +26467,15 @@ async def begin_export_throttled_requests( @overload async def begin_export_throttled_requests( - self, location: str, body: JSON, *, content_type: str = "application/json", **kwargs: Any + self, location: str, parameters: JSON, *, content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[None]: """Export logs that show total throttled Api requests for this subscription in the given time window. :param location: The location name. Required. :type location: str - :param body: The request body. Required. - :type body: JSON + :param parameters: The request body. Required. + :type parameters: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -26435,15 +26486,15 @@ async def begin_export_throttled_requests( @overload async def begin_export_throttled_requests( - self, location: str, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any + self, location: str, parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[None]: """Export logs that show total throttled Api requests for this subscription in the given time window. :param location: The location name. Required. :type location: str - :param body: The request body. Required. - :type body: IO[bytes] + :param parameters: The request body. Required. + :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str @@ -26454,16 +26505,16 @@ async def begin_export_throttled_requests( @distributed_trace_async async def begin_export_throttled_requests( - self, location: str, body: Union[_models.ThrottledRequestsInput, JSON, IO[bytes]], **kwargs: Any + self, location: str, parameters: Union[_models.ThrottledRequestsInput, JSON, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[None]: """Export logs that show total throttled Api requests for this subscription in the given time window. :param location: The location name. Required. :type location: str - :param body: The request body. Is one of the following types: ThrottledRequestsInput, JSON, - IO[bytes] Required. - :type body: ~azure.mgmt.compute.models.ThrottledRequestsInput or JSON or IO[bytes] + :param parameters: The request body. Is one of the following types: ThrottledRequestsInput, + JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.compute.models.ThrottledRequestsInput or JSON or IO[bytes] :return: An instance of AsyncLROPoller that returns None :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -26479,7 +26530,7 @@ async def begin_export_throttled_requests( if cont_token is None: raw_result = await self._export_throttled_requests_initial( location=location, - body=body, + parameters=parameters, content_type=content_type, cls=lambda x, y, z: x, headers=_headers, @@ -26779,7 +26830,7 @@ async def get(self, resource_group_name: str, disk_name: str, **kwargs: Any) -> return deserialized # type: ignore async def _create_or_update_initial( - self, resource_group_name: str, disk_name: str, resource: Union[_models.Disk, JSON, IO[bytes]], **kwargs: Any + self, resource_group_name: str, disk_name: str, disk: Union[_models.Disk, JSON, IO[bytes]], **kwargs: Any ) -> AsyncIterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -26797,10 +26848,10 @@ async def _create_or_update_initial( content_type = content_type or "application/json" _content = None - if isinstance(resource, (IOBase, bytes)): - _content = resource + if isinstance(disk, (IOBase, bytes)): + _content = disk else: - _content = json.dumps(resource, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(disk, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore _request = build_disks_create_or_update_request( resource_group_name=resource_group_name, @@ -26850,7 +26901,7 @@ async def begin_create_or_update( self, resource_group_name: str, disk_name: str, - resource: _models.Disk, + disk: _models.Disk, *, content_type: str = "application/json", **kwargs: Any @@ -26864,8 +26915,8 @@ async def begin_create_or_update( after the disk is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. :type disk_name: str - :param resource: Disk object supplied in the body of the Put disk operation. Required. - :type resource: ~azure.mgmt.compute.models.Disk + :param disk: Disk object supplied in the body of the Put disk operation. Required. + :type disk: ~azure.mgmt.compute.models.Disk :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -26879,7 +26930,7 @@ async def begin_create_or_update( self, resource_group_name: str, disk_name: str, - resource: JSON, + disk: JSON, *, content_type: str = "application/json", **kwargs: Any @@ -26893,8 +26944,8 @@ async def begin_create_or_update( after the disk is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. :type disk_name: str - :param resource: Disk object supplied in the body of the Put disk operation. Required. - :type resource: JSON + :param disk: Disk object supplied in the body of the Put disk operation. Required. + :type disk: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -26908,7 +26959,7 @@ async def begin_create_or_update( self, resource_group_name: str, disk_name: str, - resource: IO[bytes], + disk: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -26922,8 +26973,8 @@ async def begin_create_or_update( after the disk is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. :type disk_name: str - :param resource: Disk object supplied in the body of the Put disk operation. Required. - :type resource: IO[bytes] + :param disk: Disk object supplied in the body of the Put disk operation. Required. + :type disk: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str @@ -26934,7 +26985,7 @@ async def begin_create_or_update( @distributed_trace_async async def begin_create_or_update( - self, resource_group_name: str, disk_name: str, resource: Union[_models.Disk, JSON, IO[bytes]], **kwargs: Any + self, resource_group_name: str, disk_name: str, disk: Union[_models.Disk, JSON, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[None]: """Creates or updates a disk. @@ -26945,9 +26996,9 @@ async def begin_create_or_update( after the disk is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. :type disk_name: str - :param resource: Disk object supplied in the body of the Put disk operation. Is one of the + :param disk: Disk object supplied in the body of the Put disk operation. Is one of the following types: Disk, JSON, IO[bytes] Required. - :type resource: ~azure.mgmt.compute.models.Disk or JSON or IO[bytes] + :type disk: ~azure.mgmt.compute.models.Disk or JSON or IO[bytes] :return: An instance of AsyncLROPoller that returns None :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -26964,7 +27015,7 @@ async def begin_create_or_update( raw_result = await self._create_or_update_initial( resource_group_name=resource_group_name, disk_name=disk_name, - resource=resource, + disk=disk, content_type=content_type, cls=lambda x, y, z: x, headers=_headers, @@ -27000,11 +27051,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore async def _update_initial( - self, - resource_group_name: str, - disk_name: str, - properties: Union[_models.DiskUpdate, JSON, IO[bytes]], - **kwargs: Any + self, resource_group_name: str, disk_name: str, disk: Union[_models.DiskUpdate, JSON, IO[bytes]], **kwargs: Any ) -> AsyncIterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -27022,10 +27069,10 @@ async def _update_initial( content_type = content_type or "application/json" _content = None - if isinstance(properties, (IOBase, bytes)): - _content = properties + if isinstance(disk, (IOBase, bytes)): + _content = disk else: - _content = json.dumps(properties, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(disk, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore _request = build_disks_update_request( resource_group_name=resource_group_name, @@ -27075,7 +27122,7 @@ async def begin_update( self, resource_group_name: str, disk_name: str, - properties: _models.DiskUpdate, + disk: _models.DiskUpdate, *, content_type: str = "application/json", **kwargs: Any @@ -27089,8 +27136,8 @@ async def begin_update( after the disk is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. :type disk_name: str - :param properties: Disk object supplied in the body of the Patch disk operation. Required. - :type properties: ~azure.mgmt.compute.models.DiskUpdate + :param disk: Disk object supplied in the body of the Patch disk operation. Required. + :type disk: ~azure.mgmt.compute.models.DiskUpdate :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -27104,7 +27151,7 @@ async def begin_update( self, resource_group_name: str, disk_name: str, - properties: JSON, + disk: JSON, *, content_type: str = "application/json", **kwargs: Any @@ -27118,8 +27165,8 @@ async def begin_update( after the disk is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. :type disk_name: str - :param properties: Disk object supplied in the body of the Patch disk operation. Required. - :type properties: JSON + :param disk: Disk object supplied in the body of the Patch disk operation. Required. + :type disk: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -27133,7 +27180,7 @@ async def begin_update( self, resource_group_name: str, disk_name: str, - properties: IO[bytes], + disk: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -27147,8 +27194,8 @@ async def begin_update( after the disk is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. :type disk_name: str - :param properties: Disk object supplied in the body of the Patch disk operation. Required. - :type properties: IO[bytes] + :param disk: Disk object supplied in the body of the Patch disk operation. Required. + :type disk: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str @@ -27159,11 +27206,7 @@ async def begin_update( @distributed_trace_async async def begin_update( - self, - resource_group_name: str, - disk_name: str, - properties: Union[_models.DiskUpdate, JSON, IO[bytes]], - **kwargs: Any + self, resource_group_name: str, disk_name: str, disk: Union[_models.DiskUpdate, JSON, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[None]: """Updates (patches) a disk. @@ -27174,9 +27217,9 @@ async def begin_update( after the disk is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. :type disk_name: str - :param properties: Disk object supplied in the body of the Patch disk operation. Is one of the + :param disk: Disk object supplied in the body of the Patch disk operation. Is one of the following types: DiskUpdate, JSON, IO[bytes] Required. - :type properties: ~azure.mgmt.compute.models.DiskUpdate or JSON or IO[bytes] + :type disk: ~azure.mgmt.compute.models.DiskUpdate or JSON or IO[bytes] :return: An instance of AsyncLROPoller that returns None :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -27193,7 +27236,7 @@ async def begin_update( raw_result = await self._update_initial( resource_group_name=resource_group_name, disk_name=disk_name, - properties=properties, + disk=disk, content_type=content_type, cls=lambda x, y, z: x, headers=_headers, @@ -27518,7 +27561,7 @@ async def _grant_access_initial( self, resource_group_name: str, disk_name: str, - body: Union[_models.GrantAccessData, JSON, IO[bytes]], + grant_access_data: Union[_models.GrantAccessData, JSON, IO[bytes]], **kwargs: Any ) -> AsyncIterator[bytes]: error_map: MutableMapping = { @@ -27537,10 +27580,10 @@ async def _grant_access_initial( content_type = content_type or "application/json" _content = None - if isinstance(body, (IOBase, bytes)): - _content = body + if isinstance(grant_access_data, (IOBase, bytes)): + _content = grant_access_data else: - _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(grant_access_data, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore _request = build_disks_grant_access_request( resource_group_name=resource_group_name, @@ -27590,7 +27633,7 @@ async def begin_grant_access( self, resource_group_name: str, disk_name: str, - body: _models.GrantAccessData, + grant_access_data: _models.GrantAccessData, *, content_type: str = "application/json", **kwargs: Any @@ -27604,9 +27647,9 @@ async def begin_grant_access( after the disk is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. :type disk_name: str - :param body: Access data object supplied in the body of the get disk access operation. - Required. - :type body: ~azure.mgmt.compute.models.GrantAccessData + :param grant_access_data: Access data object supplied in the body of the get disk access + operation. Required. + :type grant_access_data: ~azure.mgmt.compute.models.GrantAccessData :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -27621,7 +27664,7 @@ async def begin_grant_access( self, resource_group_name: str, disk_name: str, - body: JSON, + grant_access_data: JSON, *, content_type: str = "application/json", **kwargs: Any @@ -27635,9 +27678,9 @@ async def begin_grant_access( after the disk is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. :type disk_name: str - :param body: Access data object supplied in the body of the get disk access operation. - Required. - :type body: JSON + :param grant_access_data: Access data object supplied in the body of the get disk access + operation. Required. + :type grant_access_data: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -27652,7 +27695,7 @@ async def begin_grant_access( self, resource_group_name: str, disk_name: str, - body: IO[bytes], + grant_access_data: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -27666,9 +27709,9 @@ async def begin_grant_access( after the disk is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. :type disk_name: str - :param body: Access data object supplied in the body of the get disk access operation. - Required. - :type body: IO[bytes] + :param grant_access_data: Access data object supplied in the body of the get disk access + operation. Required. + :type grant_access_data: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str @@ -27683,7 +27726,7 @@ async def begin_grant_access( self, resource_group_name: str, disk_name: str, - body: Union[_models.GrantAccessData, JSON, IO[bytes]], + grant_access_data: Union[_models.GrantAccessData, JSON, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[_models.AccessUri]: """Grants access to a disk. @@ -27695,9 +27738,9 @@ async def begin_grant_access( after the disk is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. :type disk_name: str - :param body: Access data object supplied in the body of the get disk access operation. Is one - of the following types: GrantAccessData, JSON, IO[bytes] Required. - :type body: ~azure.mgmt.compute.models.GrantAccessData or JSON or IO[bytes] + :param grant_access_data: Access data object supplied in the body of the get disk access + operation. Is one of the following types: GrantAccessData, JSON, IO[bytes] Required. + :type grant_access_data: ~azure.mgmt.compute.models.GrantAccessData or JSON or IO[bytes] :return: An instance of AsyncLROPoller that returns AccessUri. The AccessUri is compatible with MutableMapping :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.AccessUri] @@ -27715,7 +27758,7 @@ async def begin_grant_access( raw_result = await self._grant_access_initial( resource_group_name=resource_group_name, disk_name=disk_name, - body=body, + grant_access_data=grant_access_data, content_type=content_type, cls=lambda x, y, z: x, headers=_headers, @@ -27977,7 +28020,7 @@ async def _create_or_update_initial( self, resource_group_name: str, disk_access_name: str, - resource: Union[_models.DiskAccess, JSON, IO[bytes]], + disk_access: Union[_models.DiskAccess, JSON, IO[bytes]], **kwargs: Any ) -> AsyncIterator[bytes]: error_map: MutableMapping = { @@ -27996,10 +28039,10 @@ async def _create_or_update_initial( content_type = content_type or "application/json" _content = None - if isinstance(resource, (IOBase, bytes)): - _content = resource + if isinstance(disk_access, (IOBase, bytes)): + _content = disk_access else: - _content = json.dumps(resource, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(disk_access, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore _request = build_disk_accesses_create_or_update_request( resource_group_name=resource_group_name, @@ -28049,7 +28092,7 @@ async def begin_create_or_update( self, resource_group_name: str, disk_access_name: str, - resource: _models.DiskAccess, + disk_access: _models.DiskAccess, *, content_type: str = "application/json", **kwargs: Any @@ -28063,9 +28106,9 @@ async def begin_create_or_update( can't be changed after the disk encryption set is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. :type disk_access_name: str - :param resource: disk access object supplied in the body of the Put disk access operation. + :param disk_access: disk access object supplied in the body of the Put disk access operation. Required. - :type resource: ~azure.mgmt.compute.models.DiskAccess + :type disk_access: ~azure.mgmt.compute.models.DiskAccess :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -28079,7 +28122,7 @@ async def begin_create_or_update( self, resource_group_name: str, disk_access_name: str, - resource: JSON, + disk_access: JSON, *, content_type: str = "application/json", **kwargs: Any @@ -28093,9 +28136,9 @@ async def begin_create_or_update( can't be changed after the disk encryption set is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. :type disk_access_name: str - :param resource: disk access object supplied in the body of the Put disk access operation. + :param disk_access: disk access object supplied in the body of the Put disk access operation. Required. - :type resource: JSON + :type disk_access: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -28109,7 +28152,7 @@ async def begin_create_or_update( self, resource_group_name: str, disk_access_name: str, - resource: IO[bytes], + disk_access: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -28123,9 +28166,9 @@ async def begin_create_or_update( can't be changed after the disk encryption set is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. :type disk_access_name: str - :param resource: disk access object supplied in the body of the Put disk access operation. + :param disk_access: disk access object supplied in the body of the Put disk access operation. Required. - :type resource: IO[bytes] + :type disk_access: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str @@ -28139,7 +28182,7 @@ async def begin_create_or_update( self, resource_group_name: str, disk_access_name: str, - resource: Union[_models.DiskAccess, JSON, IO[bytes]], + disk_access: Union[_models.DiskAccess, JSON, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[None]: """Creates or updates a disk access resource. @@ -28151,9 +28194,9 @@ async def begin_create_or_update( can't be changed after the disk encryption set is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. :type disk_access_name: str - :param resource: disk access object supplied in the body of the Put disk access operation. Is - one of the following types: DiskAccess, JSON, IO[bytes] Required. - :type resource: ~azure.mgmt.compute.models.DiskAccess or JSON or IO[bytes] + :param disk_access: disk access object supplied in the body of the Put disk access operation. + Is one of the following types: DiskAccess, JSON, IO[bytes] Required. + :type disk_access: ~azure.mgmt.compute.models.DiskAccess or JSON or IO[bytes] :return: An instance of AsyncLROPoller that returns None :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -28170,7 +28213,7 @@ async def begin_create_or_update( raw_result = await self._create_or_update_initial( resource_group_name=resource_group_name, disk_access_name=disk_access_name, - resource=resource, + disk_access=disk_access, content_type=content_type, cls=lambda x, y, z: x, headers=_headers, @@ -28209,7 +28252,7 @@ async def _update_initial( self, resource_group_name: str, disk_access_name: str, - properties: Union[_models.DiskAccessUpdate, JSON, IO[bytes]], + disk_access: Union[_models.DiskAccessUpdate, JSON, IO[bytes]], **kwargs: Any ) -> AsyncIterator[bytes]: error_map: MutableMapping = { @@ -28228,10 +28271,10 @@ async def _update_initial( content_type = content_type or "application/json" _content = None - if isinstance(properties, (IOBase, bytes)): - _content = properties + if isinstance(disk_access, (IOBase, bytes)): + _content = disk_access else: - _content = json.dumps(properties, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(disk_access, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore _request = build_disk_accesses_update_request( resource_group_name=resource_group_name, @@ -28281,7 +28324,7 @@ async def begin_update( self, resource_group_name: str, disk_access_name: str, - properties: _models.DiskAccessUpdate, + disk_access: _models.DiskAccessUpdate, *, content_type: str = "application/json", **kwargs: Any @@ -28295,9 +28338,9 @@ async def begin_update( can't be changed after the disk encryption set is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. :type disk_access_name: str - :param properties: disk access object supplied in the body of the Patch disk access operation. + :param disk_access: disk access object supplied in the body of the Patch disk access operation. Required. - :type properties: ~azure.mgmt.compute.models.DiskAccessUpdate + :type disk_access: ~azure.mgmt.compute.models.DiskAccessUpdate :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -28311,7 +28354,7 @@ async def begin_update( self, resource_group_name: str, disk_access_name: str, - properties: JSON, + disk_access: JSON, *, content_type: str = "application/json", **kwargs: Any @@ -28325,9 +28368,9 @@ async def begin_update( can't be changed after the disk encryption set is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. :type disk_access_name: str - :param properties: disk access object supplied in the body of the Patch disk access operation. + :param disk_access: disk access object supplied in the body of the Patch disk access operation. Required. - :type properties: JSON + :type disk_access: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -28341,7 +28384,7 @@ async def begin_update( self, resource_group_name: str, disk_access_name: str, - properties: IO[bytes], + disk_access: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -28355,9 +28398,9 @@ async def begin_update( can't be changed after the disk encryption set is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. :type disk_access_name: str - :param properties: disk access object supplied in the body of the Patch disk access operation. + :param disk_access: disk access object supplied in the body of the Patch disk access operation. Required. - :type properties: IO[bytes] + :type disk_access: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str @@ -28371,7 +28414,7 @@ async def begin_update( self, resource_group_name: str, disk_access_name: str, - properties: Union[_models.DiskAccessUpdate, JSON, IO[bytes]], + disk_access: Union[_models.DiskAccessUpdate, JSON, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[None]: """Updates (patches) a disk access resource. @@ -28383,9 +28426,9 @@ async def begin_update( can't be changed after the disk encryption set is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. :type disk_access_name: str - :param properties: disk access object supplied in the body of the Patch disk access operation. + :param disk_access: disk access object supplied in the body of the Patch disk access operation. Is one of the following types: DiskAccessUpdate, JSON, IO[bytes] Required. - :type properties: ~azure.mgmt.compute.models.DiskAccessUpdate or JSON or IO[bytes] + :type disk_access: ~azure.mgmt.compute.models.DiskAccessUpdate or JSON or IO[bytes] :return: An instance of AsyncLROPoller that returns None :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -28402,7 +28445,7 @@ async def begin_update( raw_result = await self._update_initial( resource_group_name=resource_group_name, disk_access_name=disk_access_name, - properties=properties, + disk_access=disk_access, content_type=content_type, cls=lambda x, y, z: x, headers=_headers, @@ -28895,7 +28938,7 @@ async def _update_a_private_endpoint_connection_initial( # pylint: disable=name resource_group_name: str, disk_access_name: str, private_endpoint_connection_name: str, - resource: Union[_models.PrivateEndpointConnection, JSON, IO[bytes]], + private_endpoint_connection: Union[_models.PrivateEndpointConnection, JSON, IO[bytes]], **kwargs: Any ) -> AsyncIterator[bytes]: error_map: MutableMapping = { @@ -28914,10 +28957,10 @@ async def _update_a_private_endpoint_connection_initial( # pylint: disable=name content_type = content_type or "application/json" _content = None - if isinstance(resource, (IOBase, bytes)): - _content = resource + if isinstance(private_endpoint_connection, (IOBase, bytes)): + _content = private_endpoint_connection else: - _content = json.dumps(resource, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(private_endpoint_connection, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore _request = build_private_endpoint_connections_update_a_private_endpoint_connection_request( resource_group_name=resource_group_name, @@ -28969,7 +29012,7 @@ async def begin_update_a_private_endpoint_connection( # pylint: disable=name-to resource_group_name: str, disk_access_name: str, private_endpoint_connection_name: str, - resource: _models.PrivateEndpointConnection, + private_endpoint_connection: _models.PrivateEndpointConnection, *, content_type: str = "application/json", **kwargs: Any @@ -28986,9 +29029,9 @@ async def begin_update_a_private_endpoint_connection( # pylint: disable=name-to :type disk_access_name: str :param private_endpoint_connection_name: The name of the private endpoint connection. Required. :type private_endpoint_connection_name: str - :param resource: private endpoint connection object supplied in the body of the Put private - endpoint connection operation. Required. - :type resource: ~azure.mgmt.compute.models.PrivateEndpointConnection + :param private_endpoint_connection: private endpoint connection object supplied in the body of + the Put private endpoint connection operation. Required. + :type private_endpoint_connection: ~azure.mgmt.compute.models.PrivateEndpointConnection :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -29003,7 +29046,7 @@ async def begin_update_a_private_endpoint_connection( # pylint: disable=name-to resource_group_name: str, disk_access_name: str, private_endpoint_connection_name: str, - resource: JSON, + private_endpoint_connection: JSON, *, content_type: str = "application/json", **kwargs: Any @@ -29020,9 +29063,9 @@ async def begin_update_a_private_endpoint_connection( # pylint: disable=name-to :type disk_access_name: str :param private_endpoint_connection_name: The name of the private endpoint connection. Required. :type private_endpoint_connection_name: str - :param resource: private endpoint connection object supplied in the body of the Put private - endpoint connection operation. Required. - :type resource: JSON + :param private_endpoint_connection: private endpoint connection object supplied in the body of + the Put private endpoint connection operation. Required. + :type private_endpoint_connection: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -29037,7 +29080,7 @@ async def begin_update_a_private_endpoint_connection( # pylint: disable=name-to resource_group_name: str, disk_access_name: str, private_endpoint_connection_name: str, - resource: IO[bytes], + private_endpoint_connection: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -29054,9 +29097,9 @@ async def begin_update_a_private_endpoint_connection( # pylint: disable=name-to :type disk_access_name: str :param private_endpoint_connection_name: The name of the private endpoint connection. Required. :type private_endpoint_connection_name: str - :param resource: private endpoint connection object supplied in the body of the Put private - endpoint connection operation. Required. - :type resource: IO[bytes] + :param private_endpoint_connection: private endpoint connection object supplied in the body of + the Put private endpoint connection operation. Required. + :type private_endpoint_connection: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str @@ -29071,7 +29114,7 @@ async def begin_update_a_private_endpoint_connection( # pylint: disable=name-to resource_group_name: str, disk_access_name: str, private_endpoint_connection_name: str, - resource: Union[_models.PrivateEndpointConnection, JSON, IO[bytes]], + private_endpoint_connection: Union[_models.PrivateEndpointConnection, JSON, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[None]: """Approve or reject a private endpoint connection under disk access resource, this can't be used @@ -29086,10 +29129,11 @@ async def begin_update_a_private_endpoint_connection( # pylint: disable=name-to :type disk_access_name: str :param private_endpoint_connection_name: The name of the private endpoint connection. Required. :type private_endpoint_connection_name: str - :param resource: private endpoint connection object supplied in the body of the Put private - endpoint connection operation. Is one of the following types: PrivateEndpointConnection, JSON, - IO[bytes] Required. - :type resource: ~azure.mgmt.compute.models.PrivateEndpointConnection or JSON or IO[bytes] + :param private_endpoint_connection: private endpoint connection object supplied in the body of + the Put private endpoint connection operation. Is one of the following types: + PrivateEndpointConnection, JSON, IO[bytes] Required. + :type private_endpoint_connection: ~azure.mgmt.compute.models.PrivateEndpointConnection or JSON + or IO[bytes] :return: An instance of AsyncLROPoller that returns None :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -29107,7 +29151,7 @@ async def begin_update_a_private_endpoint_connection( # pylint: disable=name-to resource_group_name=resource_group_name, disk_access_name=disk_access_name, private_endpoint_connection_name=private_endpoint_connection_name, - resource=resource, + private_endpoint_connection=private_endpoint_connection, content_type=content_type, cls=lambda x, y, z: x, headers=_headers, @@ -29452,7 +29496,7 @@ async def _create_or_update_initial( self, resource_group_name: str, disk_encryption_set_name: str, - resource: Union[_models.DiskEncryptionSet, JSON, IO[bytes]], + disk_encryption_set: Union[_models.DiskEncryptionSet, JSON, IO[bytes]], **kwargs: Any ) -> AsyncIterator[bytes]: error_map: MutableMapping = { @@ -29471,10 +29515,10 @@ async def _create_or_update_initial( content_type = content_type or "application/json" _content = None - if isinstance(resource, (IOBase, bytes)): - _content = resource + if isinstance(disk_encryption_set, (IOBase, bytes)): + _content = disk_encryption_set else: - _content = json.dumps(resource, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(disk_encryption_set, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore _request = build_disk_encryption_sets_create_or_update_request( resource_group_name=resource_group_name, @@ -29524,7 +29568,7 @@ async def begin_create_or_update( self, resource_group_name: str, disk_encryption_set_name: str, - resource: _models.DiskEncryptionSet, + disk_encryption_set: _models.DiskEncryptionSet, *, content_type: str = "application/json", **kwargs: Any @@ -29538,9 +29582,9 @@ async def begin_create_or_update( name can't be changed after the disk encryption set is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. :type disk_encryption_set_name: str - :param resource: disk encryption set object supplied in the body of the Put disk encryption set - operation. Required. - :type resource: ~azure.mgmt.compute.models.DiskEncryptionSet + :param disk_encryption_set: disk encryption set object supplied in the body of the Put disk + encryption set operation. Required. + :type disk_encryption_set: ~azure.mgmt.compute.models.DiskEncryptionSet :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -29554,7 +29598,7 @@ async def begin_create_or_update( self, resource_group_name: str, disk_encryption_set_name: str, - resource: JSON, + disk_encryption_set: JSON, *, content_type: str = "application/json", **kwargs: Any @@ -29568,9 +29612,9 @@ async def begin_create_or_update( name can't be changed after the disk encryption set is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. :type disk_encryption_set_name: str - :param resource: disk encryption set object supplied in the body of the Put disk encryption set - operation. Required. - :type resource: JSON + :param disk_encryption_set: disk encryption set object supplied in the body of the Put disk + encryption set operation. Required. + :type disk_encryption_set: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -29584,7 +29628,7 @@ async def begin_create_or_update( self, resource_group_name: str, disk_encryption_set_name: str, - resource: IO[bytes], + disk_encryption_set: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -29598,9 +29642,9 @@ async def begin_create_or_update( name can't be changed after the disk encryption set is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. :type disk_encryption_set_name: str - :param resource: disk encryption set object supplied in the body of the Put disk encryption set - operation. Required. - :type resource: IO[bytes] + :param disk_encryption_set: disk encryption set object supplied in the body of the Put disk + encryption set operation. Required. + :type disk_encryption_set: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str @@ -29614,7 +29658,7 @@ async def begin_create_or_update( self, resource_group_name: str, disk_encryption_set_name: str, - resource: Union[_models.DiskEncryptionSet, JSON, IO[bytes]], + disk_encryption_set: Union[_models.DiskEncryptionSet, JSON, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[None]: """Creates or updates a disk encryption set. @@ -29626,9 +29670,10 @@ async def begin_create_or_update( name can't be changed after the disk encryption set is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. :type disk_encryption_set_name: str - :param resource: disk encryption set object supplied in the body of the Put disk encryption set - operation. Is one of the following types: DiskEncryptionSet, JSON, IO[bytes] Required. - :type resource: ~azure.mgmt.compute.models.DiskEncryptionSet or JSON or IO[bytes] + :param disk_encryption_set: disk encryption set object supplied in the body of the Put disk + encryption set operation. Is one of the following types: DiskEncryptionSet, JSON, IO[bytes] + Required. + :type disk_encryption_set: ~azure.mgmt.compute.models.DiskEncryptionSet or JSON or IO[bytes] :return: An instance of AsyncLROPoller that returns None :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -29645,7 +29690,7 @@ async def begin_create_or_update( raw_result = await self._create_or_update_initial( resource_group_name=resource_group_name, disk_encryption_set_name=disk_encryption_set_name, - resource=resource, + disk_encryption_set=disk_encryption_set, content_type=content_type, cls=lambda x, y, z: x, headers=_headers, @@ -29684,7 +29729,7 @@ async def _update_initial( self, resource_group_name: str, disk_encryption_set_name: str, - properties: Union[_models.DiskEncryptionSetUpdate, JSON, IO[bytes]], + disk_encryption_set: Union[_models.DiskEncryptionSetUpdate, JSON, IO[bytes]], **kwargs: Any ) -> AsyncIterator[bytes]: error_map: MutableMapping = { @@ -29703,10 +29748,10 @@ async def _update_initial( content_type = content_type or "application/json" _content = None - if isinstance(properties, (IOBase, bytes)): - _content = properties + if isinstance(disk_encryption_set, (IOBase, bytes)): + _content = disk_encryption_set else: - _content = json.dumps(properties, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(disk_encryption_set, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore _request = build_disk_encryption_sets_update_request( resource_group_name=resource_group_name, @@ -29756,7 +29801,7 @@ async def begin_update( self, resource_group_name: str, disk_encryption_set_name: str, - properties: _models.DiskEncryptionSetUpdate, + disk_encryption_set: _models.DiskEncryptionSetUpdate, *, content_type: str = "application/json", **kwargs: Any @@ -29770,9 +29815,9 @@ async def begin_update( name can't be changed after the disk encryption set is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. :type disk_encryption_set_name: str - :param properties: disk encryption set object supplied in the body of the Patch disk encryption - set operation. Required. - :type properties: ~azure.mgmt.compute.models.DiskEncryptionSetUpdate + :param disk_encryption_set: disk encryption set object supplied in the body of the Patch disk + encryption set operation. Required. + :type disk_encryption_set: ~azure.mgmt.compute.models.DiskEncryptionSetUpdate :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -29786,7 +29831,7 @@ async def begin_update( self, resource_group_name: str, disk_encryption_set_name: str, - properties: JSON, + disk_encryption_set: JSON, *, content_type: str = "application/json", **kwargs: Any @@ -29800,9 +29845,9 @@ async def begin_update( name can't be changed after the disk encryption set is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. :type disk_encryption_set_name: str - :param properties: disk encryption set object supplied in the body of the Patch disk encryption - set operation. Required. - :type properties: JSON + :param disk_encryption_set: disk encryption set object supplied in the body of the Patch disk + encryption set operation. Required. + :type disk_encryption_set: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -29816,7 +29861,7 @@ async def begin_update( self, resource_group_name: str, disk_encryption_set_name: str, - properties: IO[bytes], + disk_encryption_set: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -29830,9 +29875,9 @@ async def begin_update( name can't be changed after the disk encryption set is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. :type disk_encryption_set_name: str - :param properties: disk encryption set object supplied in the body of the Patch disk encryption - set operation. Required. - :type properties: IO[bytes] + :param disk_encryption_set: disk encryption set object supplied in the body of the Patch disk + encryption set operation. Required. + :type disk_encryption_set: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str @@ -29846,7 +29891,7 @@ async def begin_update( self, resource_group_name: str, disk_encryption_set_name: str, - properties: Union[_models.DiskEncryptionSetUpdate, JSON, IO[bytes]], + disk_encryption_set: Union[_models.DiskEncryptionSetUpdate, JSON, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[None]: """Updates (patches) a disk encryption set. @@ -29858,10 +29903,11 @@ async def begin_update( name can't be changed after the disk encryption set is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. :type disk_encryption_set_name: str - :param properties: disk encryption set object supplied in the body of the Patch disk encryption - set operation. Is one of the following types: DiskEncryptionSetUpdate, JSON, IO[bytes] - Required. - :type properties: ~azure.mgmt.compute.models.DiskEncryptionSetUpdate or JSON or IO[bytes] + :param disk_encryption_set: disk encryption set object supplied in the body of the Patch disk + encryption set operation. Is one of the following types: DiskEncryptionSetUpdate, JSON, + IO[bytes] Required. + :type disk_encryption_set: ~azure.mgmt.compute.models.DiskEncryptionSetUpdate or JSON or + IO[bytes] :return: An instance of AsyncLROPoller that returns None :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -29878,7 +29924,7 @@ async def begin_update( raw_result = await self._update_initial( resource_group_name=resource_group_name, disk_encryption_set_name=disk_encryption_set_name, - properties=properties, + disk_encryption_set=disk_encryption_set, content_type=content_type, cls=lambda x, y, z: x, headers=_headers, @@ -30301,14 +30347,14 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) -class DiskRestorePointsOperations: +class SnapshotsOperations: """ .. warning:: **DO NOT** instantiate this class directly. Instead, you should access the following operations through :class:`~azure.mgmt.compute.aio.ComputeClient`'s - :attr:`disk_restore_points` attribute. + :attr:`snapshots` attribute. """ def __init__(self, *args, **kwargs) -> None: @@ -30319,29 +30365,18 @@ def __init__(self, *args, **kwargs) -> None: self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace_async - async def get( - self, - resource_group_name: str, - restore_point_collection_name: str, - vm_restore_point_name: str, - disk_restore_point_name: str, - **kwargs: Any - ) -> _models.DiskRestorePoint: - """Get disk restorePoint resource. + async def get(self, resource_group_name: str, snapshot_name: str, **kwargs: Any) -> _models.Snapshot: + """Gets information about a snapshot. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param restore_point_collection_name: The name of the restore point collection that the disk - restore point belongs. Required. - :type restore_point_collection_name: str - :param vm_restore_point_name: The name of the vm restore point that the disk disk restore point - belongs. Required. - :type vm_restore_point_name: str - :param disk_restore_point_name: The name of the DiskRestorePoint. Required. - :type disk_restore_point_name: str - :return: DiskRestorePoint. The DiskRestorePoint is compatible with MutableMapping - :rtype: ~azure.mgmt.compute.models.DiskRestorePoint + :param snapshot_name: The name of the snapshot that is being created. The name can't be changed + after the snapshot is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. + The max name length is 80 characters. Required. + :type snapshot_name: str + :return: Snapshot. The Snapshot is compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.Snapshot :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -30355,13 +30390,11 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.DiskRestorePoint] = kwargs.pop("cls", None) + cls: ClsType[_models.Snapshot] = kwargs.pop("cls", None) - _request = build_disk_restore_points_get_request( + _request = build_snapshots_get_request( resource_group_name=resource_group_name, - restore_point_collection_name=restore_point_collection_name, - vm_restore_point_name=vm_restore_point_name, - disk_restore_point_name=disk_restore_point_name, + snapshot_name=snapshot_name, subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -30392,118 +30425,18 @@ async def get( if _stream: deserialized = response.iter_bytes() else: - deserialized = _deserialize(_models.DiskRestorePoint, response.json()) + deserialized = _deserialize(_models.Snapshot, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - @distributed_trace - def list_by_restore_point( - self, resource_group_name: str, restore_point_collection_name: str, vm_restore_point_name: str, **kwargs: Any - ) -> AsyncItemPaged["_models.DiskRestorePoint"]: - """Lists diskRestorePoints under a vmRestorePoint. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param restore_point_collection_name: The name of the restore point collection that the disk - restore point belongs. Required. - :type restore_point_collection_name: str - :param vm_restore_point_name: The name of the vm restore point that the disk disk restore point - belongs. Required. - :type vm_restore_point_name: str - :return: An iterator like instance of DiskRestorePoint - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.models.DiskRestorePoint] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[List[_models.DiskRestorePoint]] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_disk_restore_points_list_by_restore_point_request( - resource_group_name=resource_group_name, - restore_point_collection_name=restore_point_collection_name, - vm_restore_point_name=vm_restore_point_name, - subscription_id=self._config.subscription_id, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - return _request - - async def extract_data(pipeline_response): - deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.DiskRestorePoint], deserialized.get("value", [])) - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.get("nextLink") or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.CloudError, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - async def _grant_access_initial( + async def _create_or_update_initial( self, resource_group_name: str, - restore_point_collection_name: str, - vm_restore_point_name: str, - disk_restore_point_name: str, - body: Union[_models.GrantAccessData, JSON, IO[bytes]], + snapshot_name: str, + snapshot: Union[_models.Snapshot, JSON, IO[bytes]], **kwargs: Any ) -> AsyncIterator[bytes]: error_map: MutableMapping = { @@ -30522,16 +30455,14 @@ async def _grant_access_initial( content_type = content_type or "application/json" _content = None - if isinstance(body, (IOBase, bytes)): - _content = body + if isinstance(snapshot, (IOBase, bytes)): + _content = snapshot else: - _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(snapshot, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - _request = build_disk_restore_points_grant_access_request( + _request = build_snapshots_create_or_update_request( resource_group_name=resource_group_name, - restore_point_collection_name=restore_point_collection_name, - vm_restore_point_name=vm_restore_point_name, - disk_restore_point_name=disk_restore_point_name, + snapshot_name=snapshot_name, subscription_id=self._config.subscription_id, content_type=content_type, api_version=self._config.api_version, @@ -30573,162 +30504,129 @@ async def _grant_access_initial( return deserialized # type: ignore @overload - async def begin_grant_access( + async def begin_create_or_update( self, resource_group_name: str, - restore_point_collection_name: str, - vm_restore_point_name: str, - disk_restore_point_name: str, - body: _models.GrantAccessData, + snapshot_name: str, + snapshot: _models.Snapshot, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.AccessUri]: - """Grants access to a diskRestorePoint. + ) -> AsyncLROPoller[None]: + """Creates or updates a snapshot. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param restore_point_collection_name: The name of the restore point collection that the disk - restore point belongs. Required. - :type restore_point_collection_name: str - :param vm_restore_point_name: The name of the vm restore point that the disk disk restore point - belongs. Required. - :type vm_restore_point_name: str - :param disk_restore_point_name: The name of the DiskRestorePoint. Required. - :type disk_restore_point_name: str - :param body: Access data object supplied in the body of the get disk access operation. - Required. - :type body: ~azure.mgmt.compute.models.GrantAccessData + :param snapshot_name: The name of the snapshot that is being created. The name can't be changed + after the snapshot is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. + The max name length is 80 characters. Required. + :type snapshot_name: str + :param snapshot: Snapshot object supplied in the body of the Put disk operation. Required. + :type snapshot: ~azure.mgmt.compute.models.Snapshot :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns AccessUri. The AccessUri is compatible with - MutableMapping - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.AccessUri] + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - async def begin_grant_access( + async def begin_create_or_update( self, resource_group_name: str, - restore_point_collection_name: str, - vm_restore_point_name: str, - disk_restore_point_name: str, - body: JSON, + snapshot_name: str, + snapshot: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.AccessUri]: - """Grants access to a diskRestorePoint. + ) -> AsyncLROPoller[None]: + """Creates or updates a snapshot. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param restore_point_collection_name: The name of the restore point collection that the disk - restore point belongs. Required. - :type restore_point_collection_name: str - :param vm_restore_point_name: The name of the vm restore point that the disk disk restore point - belongs. Required. - :type vm_restore_point_name: str - :param disk_restore_point_name: The name of the DiskRestorePoint. Required. - :type disk_restore_point_name: str - :param body: Access data object supplied in the body of the get disk access operation. - Required. - :type body: JSON + :param snapshot_name: The name of the snapshot that is being created. The name can't be changed + after the snapshot is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. + The max name length is 80 characters. Required. + :type snapshot_name: str + :param snapshot: Snapshot object supplied in the body of the Put disk operation. Required. + :type snapshot: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns AccessUri. The AccessUri is compatible with - MutableMapping - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.AccessUri] + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - async def begin_grant_access( + async def begin_create_or_update( self, resource_group_name: str, - restore_point_collection_name: str, - vm_restore_point_name: str, - disk_restore_point_name: str, - body: IO[bytes], + snapshot_name: str, + snapshot: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.AccessUri]: - """Grants access to a diskRestorePoint. + ) -> AsyncLROPoller[None]: + """Creates or updates a snapshot. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param restore_point_collection_name: The name of the restore point collection that the disk - restore point belongs. Required. - :type restore_point_collection_name: str - :param vm_restore_point_name: The name of the vm restore point that the disk disk restore point - belongs. Required. - :type vm_restore_point_name: str - :param disk_restore_point_name: The name of the DiskRestorePoint. Required. - :type disk_restore_point_name: str - :param body: Access data object supplied in the body of the get disk access operation. - Required. - :type body: IO[bytes] + :param snapshot_name: The name of the snapshot that is being created. The name can't be changed + after the snapshot is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. + The max name length is 80 characters. Required. + :type snapshot_name: str + :param snapshot: Snapshot object supplied in the body of the Put disk operation. Required. + :type snapshot: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns AccessUri. The AccessUri is compatible with - MutableMapping - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.AccessUri] + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace_async - async def begin_grant_access( + async def begin_create_or_update( self, resource_group_name: str, - restore_point_collection_name: str, - vm_restore_point_name: str, - disk_restore_point_name: str, - body: Union[_models.GrantAccessData, JSON, IO[bytes]], + snapshot_name: str, + snapshot: Union[_models.Snapshot, JSON, IO[bytes]], **kwargs: Any - ) -> AsyncLROPoller[_models.AccessUri]: - """Grants access to a diskRestorePoint. + ) -> AsyncLROPoller[None]: + """Creates or updates a snapshot. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param restore_point_collection_name: The name of the restore point collection that the disk - restore point belongs. Required. - :type restore_point_collection_name: str - :param vm_restore_point_name: The name of the vm restore point that the disk disk restore point - belongs. Required. - :type vm_restore_point_name: str - :param disk_restore_point_name: The name of the DiskRestorePoint. Required. - :type disk_restore_point_name: str - :param body: Access data object supplied in the body of the get disk access operation. Is one - of the following types: GrantAccessData, JSON, IO[bytes] Required. - :type body: ~azure.mgmt.compute.models.GrantAccessData or JSON or IO[bytes] - :return: An instance of AsyncLROPoller that returns AccessUri. The AccessUri is compatible with - MutableMapping - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.AccessUri] + :param snapshot_name: The name of the snapshot that is being created. The name can't be changed + after the snapshot is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. + The max name length is 80 characters. Required. + :type snapshot_name: str + :param snapshot: Snapshot object supplied in the body of the Put disk operation. Is one of the + following types: Snapshot, JSON, IO[bytes] Required. + :type snapshot: ~azure.mgmt.compute.models.Snapshot or JSON or IO[bytes] + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AccessUri] = kwargs.pop("cls", None) + cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._grant_access_initial( + raw_result = await self._create_or_update_initial( resource_group_name=resource_group_name, - restore_point_collection_name=restore_point_collection_name, - vm_restore_point_name=vm_restore_point_name, - disk_restore_point_name=disk_restore_point_name, - body=body, + snapshot_name=snapshot_name, + snapshot=snapshot, content_type=content_type, cls=lambda x, y, z: x, headers=_headers, @@ -30738,16 +30636,9 @@ async def begin_grant_access( await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): - response_headers = {} - response = pipeline_response.http_response - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = _deserialize(_models.AccessUri, response.json()) + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized + return cls(pipeline_response, None, {}) # type: ignore path_format_arguments = { "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), @@ -30762,22 +30653,19 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller[_models.AccessUri].from_continuation_token( + return AsyncLROPoller[None].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller[_models.AccessUri]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - async def _revoke_access_initial( + async def _update_initial( self, resource_group_name: str, - restore_point_collection_name: str, - vm_restore_point_name: str, - disk_restore_point_name: str, + snapshot_name: str, + snapshot: Union[_models.SnapshotUpdate, JSON, IO[bytes]], **kwargs: Any ) -> AsyncIterator[bytes]: error_map: MutableMapping = { @@ -30788,486 +30676,26 @@ async def _revoke_access_initial( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - _request = build_disk_restore_points_revoke_access_request( + content_type = content_type or "application/json" + _content = None + if isinstance(snapshot, (IOBase, bytes)): + _content = snapshot + else: + _content = json.dumps(snapshot, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_snapshots_update_request( resource_group_name=resource_group_name, - restore_point_collection_name=restore_point_collection_name, - vm_restore_point_name=vm_restore_point_name, - disk_restore_point_name=disk_restore_point_name, + snapshot_name=snapshot_name, subscription_id=self._config.subscription_id, + content_type=content_type, api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.CloudError, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.iter_bytes() - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_revoke_access( - self, - resource_group_name: str, - restore_point_collection_name: str, - vm_restore_point_name: str, - disk_restore_point_name: str, - **kwargs: Any - ) -> AsyncLROPoller[_models.OkResponse]: - """Revokes access to a diskRestorePoint. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param restore_point_collection_name: The name of the restore point collection that the disk - restore point belongs. Required. - :type restore_point_collection_name: str - :param vm_restore_point_name: The name of the vm restore point that the disk disk restore point - belongs. Required. - :type vm_restore_point_name: str - :param disk_restore_point_name: The name of the DiskRestorePoint. Required. - :type disk_restore_point_name: str - :return: An instance of AsyncLROPoller that returns OkResponse. The OkResponse is compatible - with MutableMapping - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.OkResponse] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[_models.OkResponse] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._revoke_access_initial( - resource_group_name=resource_group_name, - restore_point_collection_name=restore_point_collection_name, - vm_restore_point_name=vm_restore_point_name, - disk_restore_point_name=disk_restore_point_name, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - response_headers = {} - response = pipeline_response.http_response - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = _deserialize(_models.OkResponse, response.json()) - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized - - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.OkResponse].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.OkResponse]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - -class SnapshotsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.compute.aio.ComputeClient`'s - :attr:`snapshots` attribute. - """ - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ComputeClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace_async - async def get(self, resource_group_name: str, snapshot_name: str, **kwargs: Any) -> _models.Snapshot: - """Gets information about a snapshot. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param snapshot_name: The name of the snapshot that is being created. The name can't be changed - after the snapshot is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. - The max name length is 80 characters. Required. - :type snapshot_name: str - :return: Snapshot. The Snapshot is compatible with MutableMapping - :rtype: ~azure.mgmt.compute.models.Snapshot - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[_models.Snapshot] = kwargs.pop("cls", None) - - _request = build_snapshots_get_request( - resource_group_name=resource_group_name, - snapshot_name=snapshot_name, - subscription_id=self._config.subscription_id, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = kwargs.pop("stream", False) - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - if _stream: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.CloudError, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if _stream: - deserialized = response.iter_bytes() - else: - deserialized = _deserialize(_models.Snapshot, response.json()) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - snapshot_name: str, - resource: Union[_models.Snapshot, JSON, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} - - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _content = None - if isinstance(resource, (IOBase, bytes)): - _content = resource - else: - _content = json.dumps(resource, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - - _request = build_snapshots_create_or_update_request( - resource_group_name=resource_group_name, - snapshot_name=snapshot_name, - subscription_id=self._config.subscription_id, - content_type=content_type, - api_version=self._config.api_version, - content=_content, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.CloudError, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.iter_bytes() - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - snapshot_name: str, - resource: _models.Snapshot, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Creates or updates a snapshot. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param snapshot_name: The name of the snapshot that is being created. The name can't be changed - after the snapshot is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. - The max name length is 80 characters. Required. - :type snapshot_name: str - :param resource: Snapshot object supplied in the body of the Put disk operation. Required. - :type resource: ~azure.mgmt.compute.models.Snapshot - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns None - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - snapshot_name: str, - resource: JSON, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Creates or updates a snapshot. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param snapshot_name: The name of the snapshot that is being created. The name can't be changed - after the snapshot is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. - The max name length is 80 characters. Required. - :type snapshot_name: str - :param resource: Snapshot object supplied in the body of the Put disk operation. Required. - :type resource: JSON - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns None - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - snapshot_name: str, - resource: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Creates or updates a snapshot. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param snapshot_name: The name of the snapshot that is being created. The name can't be changed - after the snapshot is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. - The max name length is 80 characters. Required. - :type snapshot_name: str - :param resource: Snapshot object supplied in the body of the Put disk operation. Required. - :type resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns None - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - snapshot_name: str, - resource: Union[_models.Snapshot, JSON, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Creates or updates a snapshot. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param snapshot_name: The name of the snapshot that is being created. The name can't be changed - after the snapshot is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. - The max name length is 80 characters. Required. - :type snapshot_name: str - :param resource: Snapshot object supplied in the body of the Put disk operation. Is one of the - following types: Snapshot, JSON, IO[bytes] Required. - :type resource: ~azure.mgmt.compute.models.Snapshot or JSON or IO[bytes] - :return: An instance of AsyncLROPoller that returns None - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} - - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._create_or_update_initial( - resource_group_name=resource_group_name, - snapshot_name=snapshot_name, - resource=resource, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _update_initial( - self, - resource_group_name: str, - snapshot_name: str, - properties: Union[_models.SnapshotUpdate, JSON, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} - - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _content = None - if isinstance(properties, (IOBase, bytes)): - _content = properties - else: - _content = json.dumps(properties, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - - _request = build_snapshots_update_request( - resource_group_name=resource_group_name, - snapshot_name=snapshot_name, - subscription_id=self._config.subscription_id, - content_type=content_type, - api_version=self._config.api_version, - content=_content, + content=_content, headers=_headers, params=_params, ) @@ -31309,7 +30737,7 @@ async def begin_update( self, resource_group_name: str, snapshot_name: str, - properties: _models.SnapshotUpdate, + snapshot: _models.SnapshotUpdate, *, content_type: str = "application/json", **kwargs: Any @@ -31323,9 +30751,9 @@ async def begin_update( after the snapshot is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The max name length is 80 characters. Required. :type snapshot_name: str - :param properties: Snapshot object supplied in the body of the Patch snapshot operation. + :param snapshot: Snapshot object supplied in the body of the Patch snapshot operation. Required. - :type properties: ~azure.mgmt.compute.models.SnapshotUpdate + :type snapshot: ~azure.mgmt.compute.models.SnapshotUpdate :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -31339,7 +30767,7 @@ async def begin_update( self, resource_group_name: str, snapshot_name: str, - properties: JSON, + snapshot: JSON, *, content_type: str = "application/json", **kwargs: Any @@ -31353,9 +30781,9 @@ async def begin_update( after the snapshot is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The max name length is 80 characters. Required. :type snapshot_name: str - :param properties: Snapshot object supplied in the body of the Patch snapshot operation. + :param snapshot: Snapshot object supplied in the body of the Patch snapshot operation. Required. - :type properties: JSON + :type snapshot: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -31369,7 +30797,7 @@ async def begin_update( self, resource_group_name: str, snapshot_name: str, - properties: IO[bytes], + snapshot: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -31383,9 +30811,9 @@ async def begin_update( after the snapshot is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The max name length is 80 characters. Required. :type snapshot_name: str - :param properties: Snapshot object supplied in the body of the Patch snapshot operation. + :param snapshot: Snapshot object supplied in the body of the Patch snapshot operation. Required. - :type properties: IO[bytes] + :type snapshot: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str @@ -31399,7 +30827,7 @@ async def begin_update( self, resource_group_name: str, snapshot_name: str, - properties: Union[_models.SnapshotUpdate, JSON, IO[bytes]], + snapshot: Union[_models.SnapshotUpdate, JSON, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[None]: """Updates (patches) a snapshot. @@ -31411,9 +30839,9 @@ async def begin_update( after the snapshot is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The max name length is 80 characters. Required. :type snapshot_name: str - :param properties: Snapshot object supplied in the body of the Patch snapshot operation. Is one + :param snapshot: Snapshot object supplied in the body of the Patch snapshot operation. Is one of the following types: SnapshotUpdate, JSON, IO[bytes] Required. - :type properties: ~azure.mgmt.compute.models.SnapshotUpdate or JSON or IO[bytes] + :type snapshot: ~azure.mgmt.compute.models.SnapshotUpdate or JSON or IO[bytes] :return: An instance of AsyncLROPoller that returns None :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -31430,7 +30858,7 @@ async def begin_update( raw_result = await self._update_initial( resource_group_name=resource_group_name, snapshot_name=snapshot_name, - properties=properties, + snapshot=snapshot, content_type=content_type, cls=lambda x, y, z: x, headers=_headers, @@ -31757,7 +31185,7 @@ async def _grant_access_initial( self, resource_group_name: str, snapshot_name: str, - body: Union[_models.GrantAccessData, JSON, IO[bytes]], + grant_access_data: Union[_models.GrantAccessData, JSON, IO[bytes]], **kwargs: Any ) -> AsyncIterator[bytes]: error_map: MutableMapping = { @@ -31776,10 +31204,10 @@ async def _grant_access_initial( content_type = content_type or "application/json" _content = None - if isinstance(body, (IOBase, bytes)): - _content = body + if isinstance(grant_access_data, (IOBase, bytes)): + _content = grant_access_data else: - _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(grant_access_data, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore _request = build_snapshots_grant_access_request( resource_group_name=resource_group_name, @@ -31829,7 +31257,7 @@ async def begin_grant_access( self, resource_group_name: str, snapshot_name: str, - body: _models.GrantAccessData, + grant_access_data: _models.GrantAccessData, *, content_type: str = "application/json", **kwargs: Any @@ -31843,9 +31271,9 @@ async def begin_grant_access( after the snapshot is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The max name length is 80 characters. Required. :type snapshot_name: str - :param body: Access data object supplied in the body of the get snapshot access operation. - Required. - :type body: ~azure.mgmt.compute.models.GrantAccessData + :param grant_access_data: Access data object supplied in the body of the get snapshot access + operation. Required. + :type grant_access_data: ~azure.mgmt.compute.models.GrantAccessData :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -31860,7 +31288,7 @@ async def begin_grant_access( self, resource_group_name: str, snapshot_name: str, - body: JSON, + grant_access_data: JSON, *, content_type: str = "application/json", **kwargs: Any @@ -31874,9 +31302,9 @@ async def begin_grant_access( after the snapshot is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The max name length is 80 characters. Required. :type snapshot_name: str - :param body: Access data object supplied in the body of the get snapshot access operation. - Required. - :type body: JSON + :param grant_access_data: Access data object supplied in the body of the get snapshot access + operation. Required. + :type grant_access_data: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -31891,7 +31319,7 @@ async def begin_grant_access( self, resource_group_name: str, snapshot_name: str, - body: IO[bytes], + grant_access_data: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -31905,9 +31333,9 @@ async def begin_grant_access( after the snapshot is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The max name length is 80 characters. Required. :type snapshot_name: str - :param body: Access data object supplied in the body of the get snapshot access operation. - Required. - :type body: IO[bytes] + :param grant_access_data: Access data object supplied in the body of the get snapshot access + operation. Required. + :type grant_access_data: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str @@ -31922,7 +31350,7 @@ async def begin_grant_access( self, resource_group_name: str, snapshot_name: str, - body: Union[_models.GrantAccessData, JSON, IO[bytes]], + grant_access_data: Union[_models.GrantAccessData, JSON, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[_models.AccessUri]: """Grants access to a snapshot. @@ -31934,9 +31362,9 @@ async def begin_grant_access( after the snapshot is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The max name length is 80 characters. Required. :type snapshot_name: str - :param body: Access data object supplied in the body of the get snapshot access operation. Is - one of the following types: GrantAccessData, JSON, IO[bytes] Required. - :type body: ~azure.mgmt.compute.models.GrantAccessData or JSON or IO[bytes] + :param grant_access_data: Access data object supplied in the body of the get snapshot access + operation. Is one of the following types: GrantAccessData, JSON, IO[bytes] Required. + :type grant_access_data: ~azure.mgmt.compute.models.GrantAccessData or JSON or IO[bytes] :return: An instance of AsyncLROPoller that returns AccessUri. The AccessUri is compatible with MutableMapping :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.AccessUri] @@ -31954,7 +31382,7 @@ async def begin_grant_access( raw_result = await self._grant_access_initial( resource_group_name=resource_group_name, snapshot_name=snapshot_name, - body=body, + grant_access_data=grant_access_data, content_type=content_type, cls=lambda x, y, z: x, headers=_headers, @@ -32230,7 +31658,7 @@ async def _create_or_update_initial( self, resource_group_name: str, gallery_name: str, - resource: Union[_models.Gallery, JSON, IO[bytes]], + gallery: Union[_models.Gallery, JSON, IO[bytes]], **kwargs: Any ) -> AsyncIterator[bytes]: error_map: MutableMapping = { @@ -32249,10 +31677,10 @@ async def _create_or_update_initial( content_type = content_type or "application/json" _content = None - if isinstance(resource, (IOBase, bytes)): - _content = resource + if isinstance(gallery, (IOBase, bytes)): + _content = gallery else: - _content = json.dumps(resource, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(gallery, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore _request = build_galleries_create_or_update_request( resource_group_name=resource_group_name, @@ -32306,7 +31734,7 @@ async def begin_create_or_update( self, resource_group_name: str, gallery_name: str, - resource: _models.Gallery, + gallery: _models.Gallery, *, content_type: str = "application/json", **kwargs: Any @@ -32318,9 +31746,9 @@ async def begin_create_or_update( :type resource_group_name: str :param gallery_name: The name of the Shared Image Gallery. Required. :type gallery_name: str - :param resource: Parameters supplied to the create or update Shared Image Gallery operation. + :param gallery: Parameters supplied to the create or update Shared Image Gallery operation. Required. - :type resource: ~azure.mgmt.compute.models.Gallery + :type gallery: ~azure.mgmt.compute.models.Gallery :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -32334,7 +31762,7 @@ async def begin_create_or_update( self, resource_group_name: str, gallery_name: str, - resource: JSON, + gallery: JSON, *, content_type: str = "application/json", **kwargs: Any @@ -32346,9 +31774,9 @@ async def begin_create_or_update( :type resource_group_name: str :param gallery_name: The name of the Shared Image Gallery. Required. :type gallery_name: str - :param resource: Parameters supplied to the create or update Shared Image Gallery operation. + :param gallery: Parameters supplied to the create or update Shared Image Gallery operation. Required. - :type resource: JSON + :type gallery: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -32362,7 +31790,7 @@ async def begin_create_or_update( self, resource_group_name: str, gallery_name: str, - resource: IO[bytes], + gallery: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -32374,9 +31802,9 @@ async def begin_create_or_update( :type resource_group_name: str :param gallery_name: The name of the Shared Image Gallery. Required. :type gallery_name: str - :param resource: Parameters supplied to the create or update Shared Image Gallery operation. + :param gallery: Parameters supplied to the create or update Shared Image Gallery operation. Required. - :type resource: IO[bytes] + :type gallery: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str @@ -32390,7 +31818,7 @@ async def begin_create_or_update( self, resource_group_name: str, gallery_name: str, - resource: Union[_models.Gallery, JSON, IO[bytes]], + gallery: Union[_models.Gallery, JSON, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[None]: """Create or update a Shared Image Gallery. @@ -32400,9 +31828,9 @@ async def begin_create_or_update( :type resource_group_name: str :param gallery_name: The name of the Shared Image Gallery. Required. :type gallery_name: str - :param resource: Parameters supplied to the create or update Shared Image Gallery operation. Is + :param gallery: Parameters supplied to the create or update Shared Image Gallery operation. Is one of the following types: Gallery, JSON, IO[bytes] Required. - :type resource: ~azure.mgmt.compute.models.Gallery or JSON or IO[bytes] + :type gallery: ~azure.mgmt.compute.models.Gallery or JSON or IO[bytes] :return: An instance of AsyncLROPoller that returns None :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -32419,7 +31847,7 @@ async def begin_create_or_update( raw_result = await self._create_or_update_initial( resource_group_name=resource_group_name, gallery_name=gallery_name, - resource=resource, + gallery=gallery, content_type=content_type, cls=lambda x, y, z: x, headers=_headers, @@ -32458,7 +31886,7 @@ async def _update_initial( self, resource_group_name: str, gallery_name: str, - properties: Union[_models.GalleryUpdate, JSON, IO[bytes]], + gallery: Union[_models.GalleryUpdate, JSON, IO[bytes]], **kwargs: Any ) -> AsyncIterator[bytes]: error_map: MutableMapping = { @@ -32477,10 +31905,10 @@ async def _update_initial( content_type = content_type or "application/json" _content = None - if isinstance(properties, (IOBase, bytes)): - _content = properties + if isinstance(gallery, (IOBase, bytes)): + _content = gallery else: - _content = json.dumps(properties, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(gallery, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore _request = build_galleries_update_request( resource_group_name=resource_group_name, @@ -32529,7 +31957,7 @@ async def begin_update( self, resource_group_name: str, gallery_name: str, - properties: _models.GalleryUpdate, + gallery: _models.GalleryUpdate, *, content_type: str = "application/json", **kwargs: Any @@ -32541,8 +31969,8 @@ async def begin_update( :type resource_group_name: str :param gallery_name: The name of the Shared Image Gallery. Required. :type gallery_name: str - :param properties: Parameters supplied to the update Shared Image Gallery operation. Required. - :type properties: ~azure.mgmt.compute.models.GalleryUpdate + :param gallery: Parameters supplied to the update Shared Image Gallery operation. Required. + :type gallery: ~azure.mgmt.compute.models.GalleryUpdate :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -32556,7 +31984,7 @@ async def begin_update( self, resource_group_name: str, gallery_name: str, - properties: JSON, + gallery: JSON, *, content_type: str = "application/json", **kwargs: Any @@ -32568,8 +31996,8 @@ async def begin_update( :type resource_group_name: str :param gallery_name: The name of the Shared Image Gallery. Required. :type gallery_name: str - :param properties: Parameters supplied to the update Shared Image Gallery operation. Required. - :type properties: JSON + :param gallery: Parameters supplied to the update Shared Image Gallery operation. Required. + :type gallery: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -32583,7 +32011,7 @@ async def begin_update( self, resource_group_name: str, gallery_name: str, - properties: IO[bytes], + gallery: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -32595,8 +32023,8 @@ async def begin_update( :type resource_group_name: str :param gallery_name: The name of the Shared Image Gallery. Required. :type gallery_name: str - :param properties: Parameters supplied to the update Shared Image Gallery operation. Required. - :type properties: IO[bytes] + :param gallery: Parameters supplied to the update Shared Image Gallery operation. Required. + :type gallery: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str @@ -32610,7 +32038,7 @@ async def begin_update( self, resource_group_name: str, gallery_name: str, - properties: Union[_models.GalleryUpdate, JSON, IO[bytes]], + gallery: Union[_models.GalleryUpdate, JSON, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[None]: """Update a Shared Image Gallery. @@ -32620,9 +32048,9 @@ async def begin_update( :type resource_group_name: str :param gallery_name: The name of the Shared Image Gallery. Required. :type gallery_name: str - :param properties: Parameters supplied to the update Shared Image Gallery operation. Is one of - the following types: GalleryUpdate, JSON, IO[bytes] Required. - :type properties: ~azure.mgmt.compute.models.GalleryUpdate or JSON or IO[bytes] + :param gallery: Parameters supplied to the update Shared Image Gallery operation. Is one of the + following types: GalleryUpdate, JSON, IO[bytes] Required. + :type gallery: ~azure.mgmt.compute.models.GalleryUpdate or JSON or IO[bytes] :return: An instance of AsyncLROPoller that returns None :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -32639,7 +32067,7 @@ async def begin_update( raw_result = await self._update_initial( resource_group_name=resource_group_name, gallery_name=gallery_name, - properties=properties, + gallery=gallery, content_type=content_type, cls=lambda x, y, z: x, headers=_headers, @@ -33065,7 +32493,7 @@ async def _gallery_sharing_profile_update_initial( self, resource_group_name: str, gallery_name: str, - body: Union[_models.SharingUpdate, JSON, IO[bytes]], + sharing_update: Union[_models.SharingUpdate, JSON, IO[bytes]], **kwargs: Any ) -> AsyncIterator[bytes]: error_map: MutableMapping = { @@ -33084,10 +32512,10 @@ async def _gallery_sharing_profile_update_initial( content_type = content_type or "application/json" _content = None - if isinstance(body, (IOBase, bytes)): - _content = body + if isinstance(sharing_update, (IOBase, bytes)): + _content = sharing_update else: - _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(sharing_update, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore _request = build_galleries_gallery_sharing_profile_update_request( resource_group_name=resource_group_name, @@ -33137,7 +32565,7 @@ async def begin_gallery_sharing_profile_update( self, resource_group_name: str, gallery_name: str, - body: _models.SharingUpdate, + sharing_update: _models.SharingUpdate, *, content_type: str = "application/json", **kwargs: Any @@ -33149,8 +32577,8 @@ async def begin_gallery_sharing_profile_update( :type resource_group_name: str :param gallery_name: The name of the Shared Image Gallery. Required. :type gallery_name: str - :param body: Parameters supplied to the update gallery sharing profile. Required. - :type body: ~azure.mgmt.compute.models.SharingUpdate + :param sharing_update: Parameters supplied to the update gallery sharing profile. Required. + :type sharing_update: ~azure.mgmt.compute.models.SharingUpdate :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -33164,7 +32592,7 @@ async def begin_gallery_sharing_profile_update( self, resource_group_name: str, gallery_name: str, - body: JSON, + sharing_update: JSON, *, content_type: str = "application/json", **kwargs: Any @@ -33176,8 +32604,8 @@ async def begin_gallery_sharing_profile_update( :type resource_group_name: str :param gallery_name: The name of the Shared Image Gallery. Required. :type gallery_name: str - :param body: Parameters supplied to the update gallery sharing profile. Required. - :type body: JSON + :param sharing_update: Parameters supplied to the update gallery sharing profile. Required. + :type sharing_update: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -33191,7 +32619,7 @@ async def begin_gallery_sharing_profile_update( self, resource_group_name: str, gallery_name: str, - body: IO[bytes], + sharing_update: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -33203,8 +32631,8 @@ async def begin_gallery_sharing_profile_update( :type resource_group_name: str :param gallery_name: The name of the Shared Image Gallery. Required. :type gallery_name: str - :param body: Parameters supplied to the update gallery sharing profile. Required. - :type body: IO[bytes] + :param sharing_update: Parameters supplied to the update gallery sharing profile. Required. + :type sharing_update: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str @@ -33218,7 +32646,7 @@ async def begin_gallery_sharing_profile_update( self, resource_group_name: str, gallery_name: str, - body: Union[_models.SharingUpdate, JSON, IO[bytes]], + sharing_update: Union[_models.SharingUpdate, JSON, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[None]: """Update sharing profile of a gallery. @@ -33228,9 +32656,9 @@ async def begin_gallery_sharing_profile_update( :type resource_group_name: str :param gallery_name: The name of the Shared Image Gallery. Required. :type gallery_name: str - :param body: Parameters supplied to the update gallery sharing profile. Is one of the following - types: SharingUpdate, JSON, IO[bytes] Required. - :type body: ~azure.mgmt.compute.models.SharingUpdate or JSON or IO[bytes] + :param sharing_update: Parameters supplied to the update gallery sharing profile. Is one of the + following types: SharingUpdate, JSON, IO[bytes] Required. + :type sharing_update: ~azure.mgmt.compute.models.SharingUpdate or JSON or IO[bytes] :return: An instance of AsyncLROPoller that returns None :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -33247,7 +32675,7 @@ async def begin_gallery_sharing_profile_update( raw_result = await self._gallery_sharing_profile_update_initial( resource_group_name=resource_group_name, gallery_name=gallery_name, - body=body, + sharing_update=sharing_update, content_type=content_type, cls=lambda x, y, z: x, headers=_headers, @@ -33376,7 +32804,7 @@ async def _create_or_update_initial( resource_group_name: str, gallery_name: str, gallery_image_name: str, - resource: Union[_models.GalleryImage, JSON, IO[bytes]], + gallery_image: Union[_models.GalleryImage, JSON, IO[bytes]], **kwargs: Any ) -> AsyncIterator[bytes]: error_map: MutableMapping = { @@ -33395,10 +32823,10 @@ async def _create_or_update_initial( content_type = content_type or "application/json" _content = None - if isinstance(resource, (IOBase, bytes)): - _content = resource + if isinstance(gallery_image, (IOBase, bytes)): + _content = gallery_image else: - _content = json.dumps(resource, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(gallery_image, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore _request = build_gallery_images_create_or_update_request( resource_group_name=resource_group_name, @@ -33454,7 +32882,7 @@ async def begin_create_or_update( resource_group_name: str, gallery_name: str, gallery_image_name: str, - resource: _models.GalleryImage, + gallery_image: _models.GalleryImage, *, content_type: str = "application/json", **kwargs: Any @@ -33468,8 +32896,9 @@ async def begin_create_or_update( :type gallery_name: str :param gallery_image_name: The name of the gallery image definition to be retrieved. Required. :type gallery_image_name: str - :param resource: Parameters supplied to the create or update gallery image operation. Required. - :type resource: ~azure.mgmt.compute.models.GalleryImage + :param gallery_image: Parameters supplied to the create or update gallery image operation. + Required. + :type gallery_image: ~azure.mgmt.compute.models.GalleryImage :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -33484,7 +32913,7 @@ async def begin_create_or_update( resource_group_name: str, gallery_name: str, gallery_image_name: str, - resource: JSON, + gallery_image: JSON, *, content_type: str = "application/json", **kwargs: Any @@ -33498,8 +32927,9 @@ async def begin_create_or_update( :type gallery_name: str :param gallery_image_name: The name of the gallery image definition to be retrieved. Required. :type gallery_image_name: str - :param resource: Parameters supplied to the create or update gallery image operation. Required. - :type resource: JSON + :param gallery_image: Parameters supplied to the create or update gallery image operation. + Required. + :type gallery_image: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -33514,7 +32944,7 @@ async def begin_create_or_update( resource_group_name: str, gallery_name: str, gallery_image_name: str, - resource: IO[bytes], + gallery_image: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -33528,8 +32958,9 @@ async def begin_create_or_update( :type gallery_name: str :param gallery_image_name: The name of the gallery image definition to be retrieved. Required. :type gallery_image_name: str - :param resource: Parameters supplied to the create or update gallery image operation. Required. - :type resource: IO[bytes] + :param gallery_image: Parameters supplied to the create or update gallery image operation. + Required. + :type gallery_image: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str @@ -33544,7 +32975,7 @@ async def begin_create_or_update( resource_group_name: str, gallery_name: str, gallery_image_name: str, - resource: Union[_models.GalleryImage, JSON, IO[bytes]], + gallery_image: Union[_models.GalleryImage, JSON, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[None]: """Create or update a gallery image definition. @@ -33556,9 +32987,9 @@ async def begin_create_or_update( :type gallery_name: str :param gallery_image_name: The name of the gallery image definition to be retrieved. Required. :type gallery_image_name: str - :param resource: Parameters supplied to the create or update gallery image operation. Is one of - the following types: GalleryImage, JSON, IO[bytes] Required. - :type resource: ~azure.mgmt.compute.models.GalleryImage or JSON or IO[bytes] + :param gallery_image: Parameters supplied to the create or update gallery image operation. Is + one of the following types: GalleryImage, JSON, IO[bytes] Required. + :type gallery_image: ~azure.mgmt.compute.models.GalleryImage or JSON or IO[bytes] :return: An instance of AsyncLROPoller that returns None :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -33576,7 +33007,7 @@ async def begin_create_or_update( resource_group_name=resource_group_name, gallery_name=gallery_name, gallery_image_name=gallery_image_name, - resource=resource, + gallery_image=gallery_image, content_type=content_type, cls=lambda x, y, z: x, headers=_headers, @@ -33616,7 +33047,7 @@ async def _update_initial( resource_group_name: str, gallery_name: str, gallery_image_name: str, - properties: Union[_models.GalleryImageUpdate, JSON, IO[bytes]], + gallery_image: Union[_models.GalleryImageUpdate, JSON, IO[bytes]], **kwargs: Any ) -> AsyncIterator[bytes]: error_map: MutableMapping = { @@ -33635,10 +33066,10 @@ async def _update_initial( content_type = content_type or "application/json" _content = None - if isinstance(properties, (IOBase, bytes)): - _content = properties + if isinstance(gallery_image, (IOBase, bytes)): + _content = gallery_image else: - _content = json.dumps(properties, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(gallery_image, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore _request = build_gallery_images_update_request( resource_group_name=resource_group_name, @@ -33689,7 +33120,7 @@ async def begin_update( resource_group_name: str, gallery_name: str, gallery_image_name: str, - properties: _models.GalleryImageUpdate, + gallery_image: _models.GalleryImageUpdate, *, content_type: str = "application/json", **kwargs: Any @@ -33703,8 +33134,8 @@ async def begin_update( :type gallery_name: str :param gallery_image_name: The name of the gallery image definition to be retrieved. Required. :type gallery_image_name: str - :param properties: Parameters supplied to the update gallery image operation. Required. - :type properties: ~azure.mgmt.compute.models.GalleryImageUpdate + :param gallery_image: Parameters supplied to the update gallery image operation. Required. + :type gallery_image: ~azure.mgmt.compute.models.GalleryImageUpdate :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -33719,7 +33150,7 @@ async def begin_update( resource_group_name: str, gallery_name: str, gallery_image_name: str, - properties: JSON, + gallery_image: JSON, *, content_type: str = "application/json", **kwargs: Any @@ -33733,8 +33164,8 @@ async def begin_update( :type gallery_name: str :param gallery_image_name: The name of the gallery image definition to be retrieved. Required. :type gallery_image_name: str - :param properties: Parameters supplied to the update gallery image operation. Required. - :type properties: JSON + :param gallery_image: Parameters supplied to the update gallery image operation. Required. + :type gallery_image: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -33749,7 +33180,7 @@ async def begin_update( resource_group_name: str, gallery_name: str, gallery_image_name: str, - properties: IO[bytes], + gallery_image: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -33763,8 +33194,8 @@ async def begin_update( :type gallery_name: str :param gallery_image_name: The name of the gallery image definition to be retrieved. Required. :type gallery_image_name: str - :param properties: Parameters supplied to the update gallery image operation. Required. - :type properties: IO[bytes] + :param gallery_image: Parameters supplied to the update gallery image operation. Required. + :type gallery_image: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str @@ -33779,7 +33210,7 @@ async def begin_update( resource_group_name: str, gallery_name: str, gallery_image_name: str, - properties: Union[_models.GalleryImageUpdate, JSON, IO[bytes]], + gallery_image: Union[_models.GalleryImageUpdate, JSON, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[None]: """Update a gallery image definition. @@ -33791,9 +33222,9 @@ async def begin_update( :type gallery_name: str :param gallery_image_name: The name of the gallery image definition to be retrieved. Required. :type gallery_image_name: str - :param properties: Parameters supplied to the update gallery image operation. Is one of the + :param gallery_image: Parameters supplied to the update gallery image operation. Is one of the following types: GalleryImageUpdate, JSON, IO[bytes] Required. - :type properties: ~azure.mgmt.compute.models.GalleryImageUpdate or JSON or IO[bytes] + :type gallery_image: ~azure.mgmt.compute.models.GalleryImageUpdate or JSON or IO[bytes] :return: An instance of AsyncLROPoller that returns None :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -33811,7 +33242,7 @@ async def begin_update( resource_group_name=resource_group_name, gallery_name=gallery_name, gallery_image_name=gallery_image_name, - properties=properties, + gallery_image=gallery_image, content_type=content_type, cls=lambda x, y, z: x, headers=_headers, @@ -34169,7 +33600,7 @@ async def _create_or_update_initial( gallery_name: str, gallery_image_name: str, gallery_image_version_name: str, - resource: Union[_models.GalleryImageVersion, JSON, IO[bytes]], + gallery_image_version: Union[_models.GalleryImageVersion, JSON, IO[bytes]], **kwargs: Any ) -> AsyncIterator[bytes]: error_map: MutableMapping = { @@ -34188,10 +33619,10 @@ async def _create_or_update_initial( content_type = content_type or "application/json" _content = None - if isinstance(resource, (IOBase, bytes)): - _content = resource + if isinstance(gallery_image_version, (IOBase, bytes)): + _content = gallery_image_version else: - _content = json.dumps(resource, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(gallery_image_version, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore _request = build_gallery_image_versions_create_or_update_request( resource_group_name=resource_group_name, @@ -34249,7 +33680,7 @@ async def begin_create_or_update( gallery_name: str, gallery_image_name: str, gallery_image_version_name: str, - resource: _models.GalleryImageVersion, + gallery_image_version: _models.GalleryImageVersion, *, content_type: str = "application/json", **kwargs: Any @@ -34266,9 +33697,9 @@ async def begin_create_or_update( :param gallery_image_version_name: The name of the gallery image version to be retrieved. Required. :type gallery_image_version_name: str - :param resource: Parameters supplied to the create or update gallery image version operation. - Required. - :type resource: ~azure.mgmt.compute.models.GalleryImageVersion + :param gallery_image_version: Parameters supplied to the create or update gallery image version + operation. Required. + :type gallery_image_version: ~azure.mgmt.compute.models.GalleryImageVersion :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -34284,7 +33715,7 @@ async def begin_create_or_update( gallery_name: str, gallery_image_name: str, gallery_image_version_name: str, - resource: JSON, + gallery_image_version: JSON, *, content_type: str = "application/json", **kwargs: Any @@ -34301,9 +33732,9 @@ async def begin_create_or_update( :param gallery_image_version_name: The name of the gallery image version to be retrieved. Required. :type gallery_image_version_name: str - :param resource: Parameters supplied to the create or update gallery image version operation. - Required. - :type resource: JSON + :param gallery_image_version: Parameters supplied to the create or update gallery image version + operation. Required. + :type gallery_image_version: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -34319,7 +33750,7 @@ async def begin_create_or_update( gallery_name: str, gallery_image_name: str, gallery_image_version_name: str, - resource: IO[bytes], + gallery_image_version: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -34336,9 +33767,9 @@ async def begin_create_or_update( :param gallery_image_version_name: The name of the gallery image version to be retrieved. Required. :type gallery_image_version_name: str - :param resource: Parameters supplied to the create or update gallery image version operation. - Required. - :type resource: IO[bytes] + :param gallery_image_version: Parameters supplied to the create or update gallery image version + operation. Required. + :type gallery_image_version: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str @@ -34354,7 +33785,7 @@ async def begin_create_or_update( gallery_name: str, gallery_image_name: str, gallery_image_version_name: str, - resource: Union[_models.GalleryImageVersion, JSON, IO[bytes]], + gallery_image_version: Union[_models.GalleryImageVersion, JSON, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[None]: """Create or update a gallery image version. @@ -34369,9 +33800,10 @@ async def begin_create_or_update( :param gallery_image_version_name: The name of the gallery image version to be retrieved. Required. :type gallery_image_version_name: str - :param resource: Parameters supplied to the create or update gallery image version operation. - Is one of the following types: GalleryImageVersion, JSON, IO[bytes] Required. - :type resource: ~azure.mgmt.compute.models.GalleryImageVersion or JSON or IO[bytes] + :param gallery_image_version: Parameters supplied to the create or update gallery image version + operation. Is one of the following types: GalleryImageVersion, JSON, IO[bytes] Required. + :type gallery_image_version: ~azure.mgmt.compute.models.GalleryImageVersion or JSON or + IO[bytes] :return: An instance of AsyncLROPoller that returns None :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -34390,7 +33822,7 @@ async def begin_create_or_update( gallery_name=gallery_name, gallery_image_name=gallery_image_name, gallery_image_version_name=gallery_image_version_name, - resource=resource, + gallery_image_version=gallery_image_version, content_type=content_type, cls=lambda x, y, z: x, headers=_headers, @@ -34431,7 +33863,7 @@ async def _update_initial( gallery_name: str, gallery_image_name: str, gallery_image_version_name: str, - properties: Union[_models.GalleryImageVersionUpdate, JSON, IO[bytes]], + gallery_image_version: Union[_models.GalleryImageVersionUpdate, JSON, IO[bytes]], **kwargs: Any ) -> AsyncIterator[bytes]: error_map: MutableMapping = { @@ -34450,10 +33882,10 @@ async def _update_initial( content_type = content_type or "application/json" _content = None - if isinstance(properties, (IOBase, bytes)): - _content = properties + if isinstance(gallery_image_version, (IOBase, bytes)): + _content = gallery_image_version else: - _content = json.dumps(properties, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(gallery_image_version, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore _request = build_gallery_image_versions_update_request( resource_group_name=resource_group_name, @@ -34506,7 +33938,7 @@ async def begin_update( gallery_name: str, gallery_image_name: str, gallery_image_version_name: str, - properties: _models.GalleryImageVersionUpdate, + gallery_image_version: _models.GalleryImageVersionUpdate, *, content_type: str = "application/json", **kwargs: Any @@ -34523,8 +33955,9 @@ async def begin_update( :param gallery_image_version_name: The name of the gallery image version to be retrieved. Required. :type gallery_image_version_name: str - :param properties: Parameters supplied to the update gallery image version operation. Required. - :type properties: ~azure.mgmt.compute.models.GalleryImageVersionUpdate + :param gallery_image_version: Parameters supplied to the update gallery image version + operation. Required. + :type gallery_image_version: ~azure.mgmt.compute.models.GalleryImageVersionUpdate :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -34540,7 +33973,7 @@ async def begin_update( gallery_name: str, gallery_image_name: str, gallery_image_version_name: str, - properties: JSON, + gallery_image_version: JSON, *, content_type: str = "application/json", **kwargs: Any @@ -34557,8 +33990,9 @@ async def begin_update( :param gallery_image_version_name: The name of the gallery image version to be retrieved. Required. :type gallery_image_version_name: str - :param properties: Parameters supplied to the update gallery image version operation. Required. - :type properties: JSON + :param gallery_image_version: Parameters supplied to the update gallery image version + operation. Required. + :type gallery_image_version: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -34574,7 +34008,7 @@ async def begin_update( gallery_name: str, gallery_image_name: str, gallery_image_version_name: str, - properties: IO[bytes], + gallery_image_version: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -34591,8 +34025,9 @@ async def begin_update( :param gallery_image_version_name: The name of the gallery image version to be retrieved. Required. :type gallery_image_version_name: str - :param properties: Parameters supplied to the update gallery image version operation. Required. - :type properties: IO[bytes] + :param gallery_image_version: Parameters supplied to the update gallery image version + operation. Required. + :type gallery_image_version: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str @@ -34608,7 +34043,7 @@ async def begin_update( gallery_name: str, gallery_image_name: str, gallery_image_version_name: str, - properties: Union[_models.GalleryImageVersionUpdate, JSON, IO[bytes]], + gallery_image_version: Union[_models.GalleryImageVersionUpdate, JSON, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[None]: """Update a gallery image version. @@ -34623,9 +34058,10 @@ async def begin_update( :param gallery_image_version_name: The name of the gallery image version to be retrieved. Required. :type gallery_image_version_name: str - :param properties: Parameters supplied to the update gallery image version operation. Is one of - the following types: GalleryImageVersionUpdate, JSON, IO[bytes] Required. - :type properties: ~azure.mgmt.compute.models.GalleryImageVersionUpdate or JSON or IO[bytes] + :param gallery_image_version: Parameters supplied to the update gallery image version + operation. Is one of the following types: GalleryImageVersionUpdate, JSON, IO[bytes] Required. + :type gallery_image_version: ~azure.mgmt.compute.models.GalleryImageVersionUpdate or JSON or + IO[bytes] :return: An instance of AsyncLROPoller that returns None :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -34644,7 +34080,7 @@ async def begin_update( gallery_name=gallery_name, gallery_image_name=gallery_image_name, gallery_image_version_name=gallery_image_version_name, - properties=properties, + gallery_image_version=gallery_image_version, content_type=content_type, cls=lambda x, y, z: x, headers=_headers, @@ -35005,7 +34441,7 @@ async def _create_or_update_initial( resource_group_name: str, gallery_name: str, gallery_application_name: str, - resource: Union[_models.GalleryApplication, JSON, IO[bytes]], + gallery_application: Union[_models.GalleryApplication, JSON, IO[bytes]], **kwargs: Any ) -> AsyncIterator[bytes]: error_map: MutableMapping = { @@ -35024,10 +34460,10 @@ async def _create_or_update_initial( content_type = content_type or "application/json" _content = None - if isinstance(resource, (IOBase, bytes)): - _content = resource + if isinstance(gallery_application, (IOBase, bytes)): + _content = gallery_application else: - _content = json.dumps(resource, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(gallery_application, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore _request = build_gallery_applications_create_or_update_request( resource_group_name=resource_group_name, @@ -35083,7 +34519,7 @@ async def begin_create_or_update( resource_group_name: str, gallery_name: str, gallery_application_name: str, - resource: _models.GalleryApplication, + gallery_application: _models.GalleryApplication, *, content_type: str = "application/json", **kwargs: Any @@ -35098,9 +34534,9 @@ async def begin_create_or_update( :param gallery_application_name: The name of the gallery Application Definition to be retrieved. Required. :type gallery_application_name: str - :param resource: Parameters supplied to the create or update gallery Application operation. - Required. - :type resource: ~azure.mgmt.compute.models.GalleryApplication + :param gallery_application: Parameters supplied to the create or update gallery Application + operation. Required. + :type gallery_application: ~azure.mgmt.compute.models.GalleryApplication :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -35115,7 +34551,7 @@ async def begin_create_or_update( resource_group_name: str, gallery_name: str, gallery_application_name: str, - resource: JSON, + gallery_application: JSON, *, content_type: str = "application/json", **kwargs: Any @@ -35130,9 +34566,9 @@ async def begin_create_or_update( :param gallery_application_name: The name of the gallery Application Definition to be retrieved. Required. :type gallery_application_name: str - :param resource: Parameters supplied to the create or update gallery Application operation. - Required. - :type resource: JSON + :param gallery_application: Parameters supplied to the create or update gallery Application + operation. Required. + :type gallery_application: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -35147,7 +34583,7 @@ async def begin_create_or_update( resource_group_name: str, gallery_name: str, gallery_application_name: str, - resource: IO[bytes], + gallery_application: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -35162,9 +34598,9 @@ async def begin_create_or_update( :param gallery_application_name: The name of the gallery Application Definition to be retrieved. Required. :type gallery_application_name: str - :param resource: Parameters supplied to the create or update gallery Application operation. - Required. - :type resource: IO[bytes] + :param gallery_application: Parameters supplied to the create or update gallery Application + operation. Required. + :type gallery_application: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str @@ -35179,7 +34615,7 @@ async def begin_create_or_update( resource_group_name: str, gallery_name: str, gallery_application_name: str, - resource: Union[_models.GalleryApplication, JSON, IO[bytes]], + gallery_application: Union[_models.GalleryApplication, JSON, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[None]: """Create or update a gallery Application Definition. @@ -35192,9 +34628,9 @@ async def begin_create_or_update( :param gallery_application_name: The name of the gallery Application Definition to be retrieved. Required. :type gallery_application_name: str - :param resource: Parameters supplied to the create or update gallery Application operation. Is - one of the following types: GalleryApplication, JSON, IO[bytes] Required. - :type resource: ~azure.mgmt.compute.models.GalleryApplication or JSON or IO[bytes] + :param gallery_application: Parameters supplied to the create or update gallery Application + operation. Is one of the following types: GalleryApplication, JSON, IO[bytes] Required. + :type gallery_application: ~azure.mgmt.compute.models.GalleryApplication or JSON or IO[bytes] :return: An instance of AsyncLROPoller that returns None :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -35212,7 +34648,7 @@ async def begin_create_or_update( resource_group_name=resource_group_name, gallery_name=gallery_name, gallery_application_name=gallery_application_name, - resource=resource, + gallery_application=gallery_application, content_type=content_type, cls=lambda x, y, z: x, headers=_headers, @@ -35252,7 +34688,7 @@ async def _update_initial( resource_group_name: str, gallery_name: str, gallery_application_name: str, - properties: Union[_models.GalleryApplicationUpdate, JSON, IO[bytes]], + gallery_application: Union[_models.GalleryApplicationUpdate, JSON, IO[bytes]], **kwargs: Any ) -> AsyncIterator[bytes]: error_map: MutableMapping = { @@ -35271,10 +34707,10 @@ async def _update_initial( content_type = content_type or "application/json" _content = None - if isinstance(properties, (IOBase, bytes)): - _content = properties + if isinstance(gallery_application, (IOBase, bytes)): + _content = gallery_application else: - _content = json.dumps(properties, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(gallery_application, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore _request = build_gallery_applications_update_request( resource_group_name=resource_group_name, @@ -35325,7 +34761,7 @@ async def begin_update( resource_group_name: str, gallery_name: str, gallery_application_name: str, - properties: _models.GalleryApplicationUpdate, + gallery_application: _models.GalleryApplicationUpdate, *, content_type: str = "application/json", **kwargs: Any @@ -35340,8 +34776,9 @@ async def begin_update( :param gallery_application_name: The name of the gallery Application Definition to be retrieved. Required. :type gallery_application_name: str - :param properties: Parameters supplied to the update gallery Application operation. Required. - :type properties: ~azure.mgmt.compute.models.GalleryApplicationUpdate + :param gallery_application: Parameters supplied to the update gallery Application operation. + Required. + :type gallery_application: ~azure.mgmt.compute.models.GalleryApplicationUpdate :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -35356,7 +34793,7 @@ async def begin_update( resource_group_name: str, gallery_name: str, gallery_application_name: str, - properties: JSON, + gallery_application: JSON, *, content_type: str = "application/json", **kwargs: Any @@ -35371,8 +34808,9 @@ async def begin_update( :param gallery_application_name: The name of the gallery Application Definition to be retrieved. Required. :type gallery_application_name: str - :param properties: Parameters supplied to the update gallery Application operation. Required. - :type properties: JSON + :param gallery_application: Parameters supplied to the update gallery Application operation. + Required. + :type gallery_application: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -35387,7 +34825,7 @@ async def begin_update( resource_group_name: str, gallery_name: str, gallery_application_name: str, - properties: IO[bytes], + gallery_application: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -35402,8 +34840,9 @@ async def begin_update( :param gallery_application_name: The name of the gallery Application Definition to be retrieved. Required. :type gallery_application_name: str - :param properties: Parameters supplied to the update gallery Application operation. Required. - :type properties: IO[bytes] + :param gallery_application: Parameters supplied to the update gallery Application operation. + Required. + :type gallery_application: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str @@ -35418,7 +34857,7 @@ async def begin_update( resource_group_name: str, gallery_name: str, gallery_application_name: str, - properties: Union[_models.GalleryApplicationUpdate, JSON, IO[bytes]], + gallery_application: Union[_models.GalleryApplicationUpdate, JSON, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[None]: """Update a gallery Application Definition. @@ -35431,9 +34870,10 @@ async def begin_update( :param gallery_application_name: The name of the gallery Application Definition to be retrieved. Required. :type gallery_application_name: str - :param properties: Parameters supplied to the update gallery Application operation. Is one of - the following types: GalleryApplicationUpdate, JSON, IO[bytes] Required. - :type properties: ~azure.mgmt.compute.models.GalleryApplicationUpdate or JSON or IO[bytes] + :param gallery_application: Parameters supplied to the update gallery Application operation. Is + one of the following types: GalleryApplicationUpdate, JSON, IO[bytes] Required. + :type gallery_application: ~azure.mgmt.compute.models.GalleryApplicationUpdate or JSON or + IO[bytes] :return: An instance of AsyncLROPoller that returns None :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -35451,7 +34891,7 @@ async def begin_update( resource_group_name=resource_group_name, gallery_name=gallery_name, gallery_application_name=gallery_application_name, - properties=properties, + gallery_application=gallery_application, content_type=content_type, cls=lambda x, y, z: x, headers=_headers, @@ -35812,7 +35252,7 @@ async def _create_or_update_initial( gallery_name: str, gallery_application_name: str, gallery_application_version_name: str, - resource: Union[_models.GalleryApplicationVersion, JSON, IO[bytes]], + gallery_application_version: Union[_models.GalleryApplicationVersion, JSON, IO[bytes]], **kwargs: Any ) -> AsyncIterator[bytes]: error_map: MutableMapping = { @@ -35831,10 +35271,10 @@ async def _create_or_update_initial( content_type = content_type or "application/json" _content = None - if isinstance(resource, (IOBase, bytes)): - _content = resource + if isinstance(gallery_application_version, (IOBase, bytes)): + _content = gallery_application_version else: - _content = json.dumps(resource, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(gallery_application_version, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore _request = build_gallery_application_versions_create_or_update_request( resource_group_name=resource_group_name, @@ -35892,7 +35332,7 @@ async def begin_create_or_update( gallery_name: str, gallery_application_name: str, gallery_application_version_name: str, - resource: _models.GalleryApplicationVersion, + gallery_application_version: _models.GalleryApplicationVersion, *, content_type: str = "application/json", **kwargs: Any @@ -35910,9 +35350,9 @@ async def begin_create_or_update( :param gallery_application_version_name: The name of the gallery Application Version to be retrieved. Required. :type gallery_application_version_name: str - :param resource: Parameters supplied to the create or update gallery Application Version - operation. Required. - :type resource: ~azure.mgmt.compute.models.GalleryApplicationVersion + :param gallery_application_version: Parameters supplied to the create or update gallery + Application Version operation. Required. + :type gallery_application_version: ~azure.mgmt.compute.models.GalleryApplicationVersion :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -35930,7 +35370,7 @@ async def begin_create_or_update( gallery_name: str, gallery_application_name: str, gallery_application_version_name: str, - resource: JSON, + gallery_application_version: JSON, *, content_type: str = "application/json", **kwargs: Any @@ -35948,9 +35388,9 @@ async def begin_create_or_update( :param gallery_application_version_name: The name of the gallery Application Version to be retrieved. Required. :type gallery_application_version_name: str - :param resource: Parameters supplied to the create or update gallery Application Version - operation. Required. - :type resource: JSON + :param gallery_application_version: Parameters supplied to the create or update gallery + Application Version operation. Required. + :type gallery_application_version: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -35968,7 +35408,7 @@ async def begin_create_or_update( gallery_name: str, gallery_application_name: str, gallery_application_version_name: str, - resource: IO[bytes], + gallery_application_version: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -35986,9 +35426,9 @@ async def begin_create_or_update( :param gallery_application_version_name: The name of the gallery Application Version to be retrieved. Required. :type gallery_application_version_name: str - :param resource: Parameters supplied to the create or update gallery Application Version - operation. Required. - :type resource: IO[bytes] + :param gallery_application_version: Parameters supplied to the create or update gallery + Application Version operation. Required. + :type gallery_application_version: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str @@ -36006,7 +35446,7 @@ async def begin_create_or_update( gallery_name: str, gallery_application_name: str, gallery_application_version_name: str, - resource: Union[_models.GalleryApplicationVersion, JSON, IO[bytes]], + gallery_application_version: Union[_models.GalleryApplicationVersion, JSON, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[_models.GalleryApplicationVersion]: """Create or update a gallery Application Version. @@ -36022,9 +35462,11 @@ async def begin_create_or_update( :param gallery_application_version_name: The name of the gallery Application Version to be retrieved. Required. :type gallery_application_version_name: str - :param resource: Parameters supplied to the create or update gallery Application Version - operation. Is one of the following types: GalleryApplicationVersion, JSON, IO[bytes] Required. - :type resource: ~azure.mgmt.compute.models.GalleryApplicationVersion or JSON or IO[bytes] + :param gallery_application_version: Parameters supplied to the create or update gallery + Application Version operation. Is one of the following types: GalleryApplicationVersion, JSON, + IO[bytes] Required. + :type gallery_application_version: ~azure.mgmt.compute.models.GalleryApplicationVersion or JSON + or IO[bytes] :return: An instance of AsyncLROPoller that returns GalleryApplicationVersion. The GalleryApplicationVersion is compatible with MutableMapping :rtype: @@ -36045,7 +35487,7 @@ async def begin_create_or_update( gallery_name=gallery_name, gallery_application_name=gallery_application_name, gallery_application_version_name=gallery_application_version_name, - resource=resource, + gallery_application_version=gallery_application_version, content_type=content_type, cls=lambda x, y, z: x, headers=_headers, @@ -36091,7 +35533,7 @@ async def _update_initial( gallery_name: str, gallery_application_name: str, gallery_application_version_name: str, - properties: Union[_models.GalleryApplicationVersionUpdate, JSON, IO[bytes]], + gallery_application_version: Union[_models.GalleryApplicationVersionUpdate, JSON, IO[bytes]], **kwargs: Any ) -> AsyncIterator[bytes]: error_map: MutableMapping = { @@ -36110,10 +35552,10 @@ async def _update_initial( content_type = content_type or "application/json" _content = None - if isinstance(properties, (IOBase, bytes)): - _content = properties + if isinstance(gallery_application_version, (IOBase, bytes)): + _content = gallery_application_version else: - _content = json.dumps(properties, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(gallery_application_version, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore _request = build_gallery_application_versions_update_request( resource_group_name=resource_group_name, @@ -36166,7 +35608,7 @@ async def begin_update( gallery_name: str, gallery_application_name: str, gallery_application_version_name: str, - properties: _models.GalleryApplicationVersionUpdate, + gallery_application_version: _models.GalleryApplicationVersionUpdate, *, content_type: str = "application/json", **kwargs: Any @@ -36184,9 +35626,9 @@ async def begin_update( :param gallery_application_version_name: The name of the gallery Application Version to be retrieved. Required. :type gallery_application_version_name: str - :param properties: Parameters supplied to the update gallery Application Version operation. - Required. - :type properties: ~azure.mgmt.compute.models.GalleryApplicationVersionUpdate + :param gallery_application_version: Parameters supplied to the update gallery Application + Version operation. Required. + :type gallery_application_version: ~azure.mgmt.compute.models.GalleryApplicationVersionUpdate :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -36202,7 +35644,7 @@ async def begin_update( gallery_name: str, gallery_application_name: str, gallery_application_version_name: str, - properties: JSON, + gallery_application_version: JSON, *, content_type: str = "application/json", **kwargs: Any @@ -36220,9 +35662,9 @@ async def begin_update( :param gallery_application_version_name: The name of the gallery Application Version to be retrieved. Required. :type gallery_application_version_name: str - :param properties: Parameters supplied to the update gallery Application Version operation. - Required. - :type properties: JSON + :param gallery_application_version: Parameters supplied to the update gallery Application + Version operation. Required. + :type gallery_application_version: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -36238,7 +35680,7 @@ async def begin_update( gallery_name: str, gallery_application_name: str, gallery_application_version_name: str, - properties: IO[bytes], + gallery_application_version: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -36256,9 +35698,9 @@ async def begin_update( :param gallery_application_version_name: The name of the gallery Application Version to be retrieved. Required. :type gallery_application_version_name: str - :param properties: Parameters supplied to the update gallery Application Version operation. - Required. - :type properties: IO[bytes] + :param gallery_application_version: Parameters supplied to the update gallery Application + Version operation. Required. + :type gallery_application_version: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str @@ -36274,7 +35716,7 @@ async def begin_update( gallery_name: str, gallery_application_name: str, gallery_application_version_name: str, - properties: Union[_models.GalleryApplicationVersionUpdate, JSON, IO[bytes]], + gallery_application_version: Union[_models.GalleryApplicationVersionUpdate, JSON, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[None]: """Update a gallery Application Version. @@ -36290,10 +35732,11 @@ async def begin_update( :param gallery_application_version_name: The name of the gallery Application Version to be retrieved. Required. :type gallery_application_version_name: str - :param properties: Parameters supplied to the update gallery Application Version operation. Is - one of the following types: GalleryApplicationVersionUpdate, JSON, IO[bytes] Required. - :type properties: ~azure.mgmt.compute.models.GalleryApplicationVersionUpdate or JSON or - IO[bytes] + :param gallery_application_version: Parameters supplied to the update gallery Application + Version operation. Is one of the following types: GalleryApplicationVersionUpdate, JSON, + IO[bytes] Required. + :type gallery_application_version: ~azure.mgmt.compute.models.GalleryApplicationVersionUpdate + or JSON or IO[bytes] :return: An instance of AsyncLROPoller that returns None :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -36312,7 +35755,7 @@ async def begin_update( gallery_name=gallery_name, gallery_application_name=gallery_application_name, gallery_application_version_name=gallery_application_version_name, - properties=properties, + gallery_application_version=gallery_application_version, content_type=content_type, cls=lambda x, y, z: x, headers=_headers, @@ -36677,7 +36120,7 @@ async def _create_or_update_initial( resource_group_name: str, gallery_name: str, in_vm_access_control_profile_name: str, - resource: Union[_models.GalleryInVMAccessControlProfile, JSON, IO[bytes]], + gallery_in_vm_access_control_profile: Union[_models.GalleryInVMAccessControlProfile, JSON, IO[bytes]], **kwargs: Any ) -> AsyncIterator[bytes]: error_map: MutableMapping = { @@ -36696,10 +36139,10 @@ async def _create_or_update_initial( content_type = content_type or "application/json" _content = None - if isinstance(resource, (IOBase, bytes)): - _content = resource + if isinstance(gallery_in_vm_access_control_profile, (IOBase, bytes)): + _content = gallery_in_vm_access_control_profile else: - _content = json.dumps(resource, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(gallery_in_vm_access_control_profile, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore _request = build_gallery_in_vm_access_control_profiles_create_or_update_request( resource_group_name=resource_group_name, @@ -36751,7 +36194,7 @@ async def begin_create_or_update( resource_group_name: str, gallery_name: str, in_vm_access_control_profile_name: str, - resource: _models.GalleryInVMAccessControlProfile, + gallery_in_vm_access_control_profile: _models.GalleryInVMAccessControlProfile, *, content_type: str = "application/json", **kwargs: Any @@ -36766,9 +36209,10 @@ async def begin_create_or_update( :param in_vm_access_control_profile_name: The name of the gallery inVMAccessControlProfile to be retrieved. Required. :type in_vm_access_control_profile_name: str - :param resource: Parameters supplied to the create or update gallery inVMAccessControlProfile - operation. Required. - :type resource: ~azure.mgmt.compute.models.GalleryInVMAccessControlProfile + :param gallery_in_vm_access_control_profile: Parameters supplied to the create or update + gallery inVMAccessControlProfile operation. Required. + :type gallery_in_vm_access_control_profile: + ~azure.mgmt.compute.models.GalleryInVMAccessControlProfile :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -36783,7 +36227,7 @@ async def begin_create_or_update( resource_group_name: str, gallery_name: str, in_vm_access_control_profile_name: str, - resource: JSON, + gallery_in_vm_access_control_profile: JSON, *, content_type: str = "application/json", **kwargs: Any @@ -36798,9 +36242,9 @@ async def begin_create_or_update( :param in_vm_access_control_profile_name: The name of the gallery inVMAccessControlProfile to be retrieved. Required. :type in_vm_access_control_profile_name: str - :param resource: Parameters supplied to the create or update gallery inVMAccessControlProfile - operation. Required. - :type resource: JSON + :param gallery_in_vm_access_control_profile: Parameters supplied to the create or update + gallery inVMAccessControlProfile operation. Required. + :type gallery_in_vm_access_control_profile: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -36815,7 +36259,7 @@ async def begin_create_or_update( resource_group_name: str, gallery_name: str, in_vm_access_control_profile_name: str, - resource: IO[bytes], + gallery_in_vm_access_control_profile: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -36830,9 +36274,9 @@ async def begin_create_or_update( :param in_vm_access_control_profile_name: The name of the gallery inVMAccessControlProfile to be retrieved. Required. :type in_vm_access_control_profile_name: str - :param resource: Parameters supplied to the create or update gallery inVMAccessControlProfile - operation. Required. - :type resource: IO[bytes] + :param gallery_in_vm_access_control_profile: Parameters supplied to the create or update + gallery inVMAccessControlProfile operation. Required. + :type gallery_in_vm_access_control_profile: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str @@ -36847,7 +36291,7 @@ async def begin_create_or_update( resource_group_name: str, gallery_name: str, in_vm_access_control_profile_name: str, - resource: Union[_models.GalleryInVMAccessControlProfile, JSON, IO[bytes]], + gallery_in_vm_access_control_profile: Union[_models.GalleryInVMAccessControlProfile, JSON, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[None]: """Create or update a gallery inVMAccessControlProfile. @@ -36860,10 +36304,11 @@ async def begin_create_or_update( :param in_vm_access_control_profile_name: The name of the gallery inVMAccessControlProfile to be retrieved. Required. :type in_vm_access_control_profile_name: str - :param resource: Parameters supplied to the create or update gallery inVMAccessControlProfile - operation. Is one of the following types: GalleryInVMAccessControlProfile, JSON, IO[bytes] - Required. - :type resource: ~azure.mgmt.compute.models.GalleryInVMAccessControlProfile or JSON or IO[bytes] + :param gallery_in_vm_access_control_profile: Parameters supplied to the create or update + gallery inVMAccessControlProfile operation. Is one of the following types: + GalleryInVMAccessControlProfile, JSON, IO[bytes] Required. + :type gallery_in_vm_access_control_profile: + ~azure.mgmt.compute.models.GalleryInVMAccessControlProfile or JSON or IO[bytes] :return: An instance of AsyncLROPoller that returns None :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -36881,7 +36326,7 @@ async def begin_create_or_update( resource_group_name=resource_group_name, gallery_name=gallery_name, in_vm_access_control_profile_name=in_vm_access_control_profile_name, - resource=resource, + gallery_in_vm_access_control_profile=gallery_in_vm_access_control_profile, content_type=content_type, cls=lambda x, y, z: x, headers=_headers, @@ -36921,7 +36366,7 @@ async def _update_initial( resource_group_name: str, gallery_name: str, in_vm_access_control_profile_name: str, - properties: Union[_models.GalleryInVMAccessControlProfileUpdate, JSON, IO[bytes]], + gallery_in_vm_access_control_profile: Union[_models.GalleryInVMAccessControlProfileUpdate, JSON, IO[bytes]], **kwargs: Any ) -> AsyncIterator[bytes]: error_map: MutableMapping = { @@ -36940,10 +36385,10 @@ async def _update_initial( content_type = content_type or "application/json" _content = None - if isinstance(properties, (IOBase, bytes)): - _content = properties + if isinstance(gallery_in_vm_access_control_profile, (IOBase, bytes)): + _content = gallery_in_vm_access_control_profile else: - _content = json.dumps(properties, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(gallery_in_vm_access_control_profile, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore _request = build_gallery_in_vm_access_control_profiles_update_request( resource_group_name=resource_group_name, @@ -36994,7 +36439,7 @@ async def begin_update( resource_group_name: str, gallery_name: str, in_vm_access_control_profile_name: str, - properties: _models.GalleryInVMAccessControlProfileUpdate, + gallery_in_vm_access_control_profile: _models.GalleryInVMAccessControlProfileUpdate, *, content_type: str = "application/json", **kwargs: Any @@ -37009,9 +36454,10 @@ async def begin_update( :param in_vm_access_control_profile_name: The name of the gallery inVMAccessControlProfile to be retrieved. Required. :type in_vm_access_control_profile_name: str - :param properties: Parameters supplied to the update gallery inVMAccessControlProfile - operation. Required. - :type properties: ~azure.mgmt.compute.models.GalleryInVMAccessControlProfileUpdate + :param gallery_in_vm_access_control_profile: Parameters supplied to the update gallery + inVMAccessControlProfile operation. Required. + :type gallery_in_vm_access_control_profile: + ~azure.mgmt.compute.models.GalleryInVMAccessControlProfileUpdate :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -37026,7 +36472,7 @@ async def begin_update( resource_group_name: str, gallery_name: str, in_vm_access_control_profile_name: str, - properties: JSON, + gallery_in_vm_access_control_profile: JSON, *, content_type: str = "application/json", **kwargs: Any @@ -37041,9 +36487,9 @@ async def begin_update( :param in_vm_access_control_profile_name: The name of the gallery inVMAccessControlProfile to be retrieved. Required. :type in_vm_access_control_profile_name: str - :param properties: Parameters supplied to the update gallery inVMAccessControlProfile - operation. Required. - :type properties: JSON + :param gallery_in_vm_access_control_profile: Parameters supplied to the update gallery + inVMAccessControlProfile operation. Required. + :type gallery_in_vm_access_control_profile: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -37058,7 +36504,7 @@ async def begin_update( resource_group_name: str, gallery_name: str, in_vm_access_control_profile_name: str, - properties: IO[bytes], + gallery_in_vm_access_control_profile: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -37073,9 +36519,9 @@ async def begin_update( :param in_vm_access_control_profile_name: The name of the gallery inVMAccessControlProfile to be retrieved. Required. :type in_vm_access_control_profile_name: str - :param properties: Parameters supplied to the update gallery inVMAccessControlProfile - operation. Required. - :type properties: IO[bytes] + :param gallery_in_vm_access_control_profile: Parameters supplied to the update gallery + inVMAccessControlProfile operation. Required. + :type gallery_in_vm_access_control_profile: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str @@ -37090,7 +36536,7 @@ async def begin_update( resource_group_name: str, gallery_name: str, in_vm_access_control_profile_name: str, - properties: Union[_models.GalleryInVMAccessControlProfileUpdate, JSON, IO[bytes]], + gallery_in_vm_access_control_profile: Union[_models.GalleryInVMAccessControlProfileUpdate, JSON, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[None]: """Update a gallery inVMAccessControlProfile. @@ -37103,11 +36549,11 @@ async def begin_update( :param in_vm_access_control_profile_name: The name of the gallery inVMAccessControlProfile to be retrieved. Required. :type in_vm_access_control_profile_name: str - :param properties: Parameters supplied to the update gallery inVMAccessControlProfile - operation. Is one of the following types: GalleryInVMAccessControlProfileUpdate, JSON, - IO[bytes] Required. - :type properties: ~azure.mgmt.compute.models.GalleryInVMAccessControlProfileUpdate or JSON or - IO[bytes] + :param gallery_in_vm_access_control_profile: Parameters supplied to the update gallery + inVMAccessControlProfile operation. Is one of the following types: + GalleryInVMAccessControlProfileUpdate, JSON, IO[bytes] Required. + :type gallery_in_vm_access_control_profile: + ~azure.mgmt.compute.models.GalleryInVMAccessControlProfileUpdate or JSON or IO[bytes] :return: An instance of AsyncLROPoller that returns None :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -37125,7 +36571,7 @@ async def begin_update( resource_group_name=resource_group_name, gallery_name=gallery_name, in_vm_access_control_profile_name=in_vm_access_control_profile_name, - properties=properties, + gallery_in_vm_access_control_profile=gallery_in_vm_access_control_profile, content_type=content_type, cls=lambda x, y, z: x, headers=_headers, @@ -37483,7 +36929,9 @@ async def _create_or_update_initial( gallery_name: str, in_vm_access_control_profile_name: str, in_vm_access_control_profile_version_name: str, - resource: Union[_models.GalleryInVMAccessControlProfileVersion, JSON, IO[bytes]], + gallery_in_vm_access_control_profile_version: Union[ + _models.GalleryInVMAccessControlProfileVersion, JSON, IO[bytes] + ], **kwargs: Any ) -> AsyncIterator[bytes]: error_map: MutableMapping = { @@ -37502,10 +36950,10 @@ async def _create_or_update_initial( content_type = content_type or "application/json" _content = None - if isinstance(resource, (IOBase, bytes)): - _content = resource + if isinstance(gallery_in_vm_access_control_profile_version, (IOBase, bytes)): + _content = gallery_in_vm_access_control_profile_version else: - _content = json.dumps(resource, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(gallery_in_vm_access_control_profile_version, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore _request = build_gallery_in_vm_access_control_profile_versions_create_or_update_request( resource_group_name=resource_group_name, @@ -37559,7 +37007,7 @@ async def begin_create_or_update( gallery_name: str, in_vm_access_control_profile_name: str, in_vm_access_control_profile_version_name: str, - resource: _models.GalleryInVMAccessControlProfileVersion, + gallery_in_vm_access_control_profile_version: _models.GalleryInVMAccessControlProfileVersion, *, content_type: str = "application/json", **kwargs: Any @@ -37577,9 +37025,10 @@ async def begin_create_or_update( :param in_vm_access_control_profile_version_name: The name of the gallery inVMAccessControlProfile version to be retrieved. Required. :type in_vm_access_control_profile_version_name: str - :param resource: Parameters supplied to the create or update gallery inVMAccessControlProfile - version operation. Required. - :type resource: ~azure.mgmt.compute.models.GalleryInVMAccessControlProfileVersion + :param gallery_in_vm_access_control_profile_version: Parameters supplied to the create or + update gallery inVMAccessControlProfile version operation. Required. + :type gallery_in_vm_access_control_profile_version: + ~azure.mgmt.compute.models.GalleryInVMAccessControlProfileVersion :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -37595,7 +37044,7 @@ async def begin_create_or_update( gallery_name: str, in_vm_access_control_profile_name: str, in_vm_access_control_profile_version_name: str, - resource: JSON, + gallery_in_vm_access_control_profile_version: JSON, *, content_type: str = "application/json", **kwargs: Any @@ -37613,9 +37062,9 @@ async def begin_create_or_update( :param in_vm_access_control_profile_version_name: The name of the gallery inVMAccessControlProfile version to be retrieved. Required. :type in_vm_access_control_profile_version_name: str - :param resource: Parameters supplied to the create or update gallery inVMAccessControlProfile - version operation. Required. - :type resource: JSON + :param gallery_in_vm_access_control_profile_version: Parameters supplied to the create or + update gallery inVMAccessControlProfile version operation. Required. + :type gallery_in_vm_access_control_profile_version: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -37631,7 +37080,7 @@ async def begin_create_or_update( gallery_name: str, in_vm_access_control_profile_name: str, in_vm_access_control_profile_version_name: str, - resource: IO[bytes], + gallery_in_vm_access_control_profile_version: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -37649,9 +37098,9 @@ async def begin_create_or_update( :param in_vm_access_control_profile_version_name: The name of the gallery inVMAccessControlProfile version to be retrieved. Required. :type in_vm_access_control_profile_version_name: str - :param resource: Parameters supplied to the create or update gallery inVMAccessControlProfile - version operation. Required. - :type resource: IO[bytes] + :param gallery_in_vm_access_control_profile_version: Parameters supplied to the create or + update gallery inVMAccessControlProfile version operation. Required. + :type gallery_in_vm_access_control_profile_version: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str @@ -37667,7 +37116,9 @@ async def begin_create_or_update( gallery_name: str, in_vm_access_control_profile_name: str, in_vm_access_control_profile_version_name: str, - resource: Union[_models.GalleryInVMAccessControlProfileVersion, JSON, IO[bytes]], + gallery_in_vm_access_control_profile_version: Union[ + _models.GalleryInVMAccessControlProfileVersion, JSON, IO[bytes] + ], **kwargs: Any ) -> AsyncLROPoller[None]: """Create or update a gallery inVMAccessControlProfile version. @@ -37683,11 +37134,11 @@ async def begin_create_or_update( :param in_vm_access_control_profile_version_name: The name of the gallery inVMAccessControlProfile version to be retrieved. Required. :type in_vm_access_control_profile_version_name: str - :param resource: Parameters supplied to the create or update gallery inVMAccessControlProfile - version operation. Is one of the following types: GalleryInVMAccessControlProfileVersion, JSON, - IO[bytes] Required. - :type resource: ~azure.mgmt.compute.models.GalleryInVMAccessControlProfileVersion or JSON or - IO[bytes] + :param gallery_in_vm_access_control_profile_version: Parameters supplied to the create or + update gallery inVMAccessControlProfile version operation. Is one of the following types: + GalleryInVMAccessControlProfileVersion, JSON, IO[bytes] Required. + :type gallery_in_vm_access_control_profile_version: + ~azure.mgmt.compute.models.GalleryInVMAccessControlProfileVersion or JSON or IO[bytes] :return: An instance of AsyncLROPoller that returns None :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -37706,7 +37157,7 @@ async def begin_create_or_update( gallery_name=gallery_name, in_vm_access_control_profile_name=in_vm_access_control_profile_name, in_vm_access_control_profile_version_name=in_vm_access_control_profile_version_name, - resource=resource, + gallery_in_vm_access_control_profile_version=gallery_in_vm_access_control_profile_version, content_type=content_type, cls=lambda x, y, z: x, headers=_headers, @@ -37747,7 +37198,9 @@ async def _update_initial( gallery_name: str, in_vm_access_control_profile_name: str, in_vm_access_control_profile_version_name: str, - properties: Union[_models.GalleryInVMAccessControlProfileVersionUpdate, JSON, IO[bytes]], + gallery_in_vm_access_control_profile_version: Union[ + _models.GalleryInVMAccessControlProfileVersionUpdate, JSON, IO[bytes] + ], **kwargs: Any ) -> AsyncIterator[bytes]: error_map: MutableMapping = { @@ -37766,10 +37219,10 @@ async def _update_initial( content_type = content_type or "application/json" _content = None - if isinstance(properties, (IOBase, bytes)): - _content = properties + if isinstance(gallery_in_vm_access_control_profile_version, (IOBase, bytes)): + _content = gallery_in_vm_access_control_profile_version else: - _content = json.dumps(properties, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(gallery_in_vm_access_control_profile_version, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore _request = build_gallery_in_vm_access_control_profile_versions_update_request( resource_group_name=resource_group_name, @@ -37822,7 +37275,7 @@ async def begin_update( gallery_name: str, in_vm_access_control_profile_name: str, in_vm_access_control_profile_version_name: str, - properties: _models.GalleryInVMAccessControlProfileVersionUpdate, + gallery_in_vm_access_control_profile_version: _models.GalleryInVMAccessControlProfileVersionUpdate, *, content_type: str = "application/json", **kwargs: Any @@ -37840,9 +37293,10 @@ async def begin_update( :param in_vm_access_control_profile_version_name: The name of the gallery inVMAccessControlProfile version to be retrieved. Required. :type in_vm_access_control_profile_version_name: str - :param properties: Parameters supplied to the update gallery inVMAccessControlProfile version - operation. Required. - :type properties: ~azure.mgmt.compute.models.GalleryInVMAccessControlProfileVersionUpdate + :param gallery_in_vm_access_control_profile_version: Parameters supplied to the update gallery + inVMAccessControlProfile version operation. Required. + :type gallery_in_vm_access_control_profile_version: + ~azure.mgmt.compute.models.GalleryInVMAccessControlProfileVersionUpdate :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -37858,7 +37312,7 @@ async def begin_update( gallery_name: str, in_vm_access_control_profile_name: str, in_vm_access_control_profile_version_name: str, - properties: JSON, + gallery_in_vm_access_control_profile_version: JSON, *, content_type: str = "application/json", **kwargs: Any @@ -37876,9 +37330,9 @@ async def begin_update( :param in_vm_access_control_profile_version_name: The name of the gallery inVMAccessControlProfile version to be retrieved. Required. :type in_vm_access_control_profile_version_name: str - :param properties: Parameters supplied to the update gallery inVMAccessControlProfile version - operation. Required. - :type properties: JSON + :param gallery_in_vm_access_control_profile_version: Parameters supplied to the update gallery + inVMAccessControlProfile version operation. Required. + :type gallery_in_vm_access_control_profile_version: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -37894,7 +37348,7 @@ async def begin_update( gallery_name: str, in_vm_access_control_profile_name: str, in_vm_access_control_profile_version_name: str, - properties: IO[bytes], + gallery_in_vm_access_control_profile_version: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -37912,9 +37366,9 @@ async def begin_update( :param in_vm_access_control_profile_version_name: The name of the gallery inVMAccessControlProfile version to be retrieved. Required. :type in_vm_access_control_profile_version_name: str - :param properties: Parameters supplied to the update gallery inVMAccessControlProfile version - operation. Required. - :type properties: IO[bytes] + :param gallery_in_vm_access_control_profile_version: Parameters supplied to the update gallery + inVMAccessControlProfile version operation. Required. + :type gallery_in_vm_access_control_profile_version: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str @@ -37930,7 +37384,9 @@ async def begin_update( gallery_name: str, in_vm_access_control_profile_name: str, in_vm_access_control_profile_version_name: str, - properties: Union[_models.GalleryInVMAccessControlProfileVersionUpdate, JSON, IO[bytes]], + gallery_in_vm_access_control_profile_version: Union[ + _models.GalleryInVMAccessControlProfileVersionUpdate, JSON, IO[bytes] + ], **kwargs: Any ) -> AsyncLROPoller[None]: """Update a gallery inVMAccessControlProfile version. @@ -37946,11 +37402,11 @@ async def begin_update( :param in_vm_access_control_profile_version_name: The name of the gallery inVMAccessControlProfile version to be retrieved. Required. :type in_vm_access_control_profile_version_name: str - :param properties: Parameters supplied to the update gallery inVMAccessControlProfile version - operation. Is one of the following types: GalleryInVMAccessControlProfileVersionUpdate, JSON, - IO[bytes] Required. - :type properties: ~azure.mgmt.compute.models.GalleryInVMAccessControlProfileVersionUpdate or - JSON or IO[bytes] + :param gallery_in_vm_access_control_profile_version: Parameters supplied to the update gallery + inVMAccessControlProfile version operation. Is one of the following types: + GalleryInVMAccessControlProfileVersionUpdate, JSON, IO[bytes] Required. + :type gallery_in_vm_access_control_profile_version: + ~azure.mgmt.compute.models.GalleryInVMAccessControlProfileVersionUpdate or JSON or IO[bytes] :return: An instance of AsyncLROPoller that returns None :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -37969,7 +37425,7 @@ async def begin_update( gallery_name=gallery_name, in_vm_access_control_profile_name=in_vm_access_control_profile_name, in_vm_access_control_profile_version_name=in_vm_access_control_profile_version_name, - properties=properties, + gallery_in_vm_access_control_profile_version=gallery_in_vm_access_control_profile_version, content_type=content_type, cls=lambda x, y, z: x, headers=_headers, @@ -39387,3 +38843,621 @@ async def get_next(next_link=None): return pipeline_response return AsyncItemPaged(get_next, extract_data) + + +class DiskRestorePointOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.compute.aio.ComputeClient`'s + :attr:`disk_restore_point` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace_async + async def get( + self, + resource_group_name: str, + restore_point_collection_name: str, + vm_restore_point_name: str, + disk_restore_point_name: str, + **kwargs: Any + ) -> _models.DiskRestorePoint: + """Get disk restorePoint resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param restore_point_collection_name: The name of the restore point collection that the disk + restore point belongs. Required. + :type restore_point_collection_name: str + :param vm_restore_point_name: The name of the vm restore point that the disk disk restore point + belongs. Required. + :type vm_restore_point_name: str + :param disk_restore_point_name: The name of the DiskRestorePoint. Required. + :type disk_restore_point_name: str + :return: DiskRestorePoint. The DiskRestorePoint is compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.DiskRestorePoint + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.DiskRestorePoint] = kwargs.pop("cls", None) + + _request = build_disk_restore_point_get_request( + resource_group_name=resource_group_name, + restore_point_collection_name=restore_point_collection_name, + vm_restore_point_name=vm_restore_point_name, + disk_restore_point_name=disk_restore_point_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.DiskRestorePoint, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list_by_restore_point( + self, resource_group_name: str, restore_point_collection_name: str, vm_restore_point_name: str, **kwargs: Any + ) -> AsyncItemPaged["_models.DiskRestorePoint"]: + """Lists diskRestorePoints under a vmRestorePoint. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param restore_point_collection_name: The name of the restore point collection that the disk + restore point belongs. Required. + :type restore_point_collection_name: str + :param vm_restore_point_name: The name of the vm restore point that the disk disk restore point + belongs. Required. + :type vm_restore_point_name: str + :return: An iterator like instance of DiskRestorePoint + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.models.DiskRestorePoint] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.DiskRestorePoint]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_disk_restore_point_list_by_restore_point_request( + resource_group_name=resource_group_name, + restore_point_collection_name=restore_point_collection_name, + vm_restore_point_name=vm_restore_point_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.DiskRestorePoint], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + async def _grant_access_initial( + self, + resource_group_name: str, + restore_point_collection_name: str, + vm_restore_point_name: str, + disk_restore_point_name: str, + grant_access_data: Union[_models.GrantAccessData, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(grant_access_data, (IOBase, bytes)): + _content = grant_access_data + else: + _content = json.dumps(grant_access_data, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_disk_restore_point_grant_access_request( + resource_group_name=resource_group_name, + restore_point_collection_name=restore_point_collection_name, + vm_restore_point_name=vm_restore_point_name, + disk_restore_point_name=disk_restore_point_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_grant_access( + self, + resource_group_name: str, + restore_point_collection_name: str, + vm_restore_point_name: str, + disk_restore_point_name: str, + grant_access_data: _models.GrantAccessData, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.AccessUri]: + """Grants access to a diskRestorePoint. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param restore_point_collection_name: The name of the restore point collection that the disk + restore point belongs. Required. + :type restore_point_collection_name: str + :param vm_restore_point_name: The name of the vm restore point that the disk disk restore point + belongs. Required. + :type vm_restore_point_name: str + :param disk_restore_point_name: The name of the DiskRestorePoint. Required. + :type disk_restore_point_name: str + :param grant_access_data: Access data object supplied in the body of the get disk access + operation. Required. + :type grant_access_data: ~azure.mgmt.compute.models.GrantAccessData + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns AccessUri. The AccessUri is compatible with + MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.AccessUri] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_grant_access( + self, + resource_group_name: str, + restore_point_collection_name: str, + vm_restore_point_name: str, + disk_restore_point_name: str, + grant_access_data: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.AccessUri]: + """Grants access to a diskRestorePoint. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param restore_point_collection_name: The name of the restore point collection that the disk + restore point belongs. Required. + :type restore_point_collection_name: str + :param vm_restore_point_name: The name of the vm restore point that the disk disk restore point + belongs. Required. + :type vm_restore_point_name: str + :param disk_restore_point_name: The name of the DiskRestorePoint. Required. + :type disk_restore_point_name: str + :param grant_access_data: Access data object supplied in the body of the get disk access + operation. Required. + :type grant_access_data: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns AccessUri. The AccessUri is compatible with + MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.AccessUri] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_grant_access( + self, + resource_group_name: str, + restore_point_collection_name: str, + vm_restore_point_name: str, + disk_restore_point_name: str, + grant_access_data: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.AccessUri]: + """Grants access to a diskRestorePoint. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param restore_point_collection_name: The name of the restore point collection that the disk + restore point belongs. Required. + :type restore_point_collection_name: str + :param vm_restore_point_name: The name of the vm restore point that the disk disk restore point + belongs. Required. + :type vm_restore_point_name: str + :param disk_restore_point_name: The name of the DiskRestorePoint. Required. + :type disk_restore_point_name: str + :param grant_access_data: Access data object supplied in the body of the get disk access + operation. Required. + :type grant_access_data: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns AccessUri. The AccessUri is compatible with + MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.AccessUri] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_grant_access( + self, + resource_group_name: str, + restore_point_collection_name: str, + vm_restore_point_name: str, + disk_restore_point_name: str, + grant_access_data: Union[_models.GrantAccessData, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.AccessUri]: + """Grants access to a diskRestorePoint. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param restore_point_collection_name: The name of the restore point collection that the disk + restore point belongs. Required. + :type restore_point_collection_name: str + :param vm_restore_point_name: The name of the vm restore point that the disk disk restore point + belongs. Required. + :type vm_restore_point_name: str + :param disk_restore_point_name: The name of the DiskRestorePoint. Required. + :type disk_restore_point_name: str + :param grant_access_data: Access data object supplied in the body of the get disk access + operation. Is one of the following types: GrantAccessData, JSON, IO[bytes] Required. + :type grant_access_data: ~azure.mgmt.compute.models.GrantAccessData or JSON or IO[bytes] + :return: An instance of AsyncLROPoller that returns AccessUri. The AccessUri is compatible with + MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.AccessUri] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AccessUri] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._grant_access_initial( + resource_group_name=resource_group_name, + restore_point_collection_name=restore_point_collection_name, + vm_restore_point_name=vm_restore_point_name, + disk_restore_point_name=disk_restore_point_name, + grant_access_data=grant_access_data, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = _deserialize(_models.AccessUri, response.json()) + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.AccessUri].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.AccessUri]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _revoke_access_initial( + self, + resource_group_name: str, + restore_point_collection_name: str, + vm_restore_point_name: str, + disk_restore_point_name: str, + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_disk_restore_point_revoke_access_request( + resource_group_name=resource_group_name, + restore_point_collection_name=restore_point_collection_name, + vm_restore_point_name=vm_restore_point_name, + disk_restore_point_name=disk_restore_point_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_revoke_access( + self, + resource_group_name: str, + restore_point_collection_name: str, + vm_restore_point_name: str, + disk_restore_point_name: str, + **kwargs: Any + ) -> AsyncLROPoller[_models.OkResponse]: + """Revokes access to a diskRestorePoint. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param restore_point_collection_name: The name of the restore point collection that the disk + restore point belongs. Required. + :type restore_point_collection_name: str + :param vm_restore_point_name: The name of the vm restore point that the disk disk restore point + belongs. Required. + :type vm_restore_point_name: str + :param disk_restore_point_name: The name of the DiskRestorePoint. Required. + :type disk_restore_point_name: str + :return: An instance of AsyncLROPoller that returns OkResponse. The OkResponse is compatible + with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.OkResponse] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.OkResponse] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._revoke_access_initial( + resource_group_name=resource_group_name, + restore_point_collection_name=restore_point_collection_name, + vm_restore_point_name=vm_restore_point_name, + disk_restore_point_name=disk_restore_point_name, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = _deserialize(_models.OkResponse, response.json()) + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.OkResponse].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.OkResponse]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/models/_models.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/models/_models.py index d456f9284270..344a92d3b45c 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/models/_models.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/models/_models.py @@ -1036,6 +1036,16 @@ class AvailabilitySet(TrackedResource): possible set of values. Use 'Aligned' for virtual machines with managed disks and 'Classic' for virtual machines with unmanaged disks. Default value is 'Classic'.""" + __flattened_items = [ + "platform_update_domain_count", + "platform_fault_domain_count", + "virtual_machines", + "proximity_placement_group", + "statuses", + "scheduled_events_policy", + "virtual_machine_scale_set_migration_info", + ] + @overload def __init__( self, @@ -1054,7 +1064,25 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: """ def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} super().__init__(*args, **kwargs) + for k, v in _flattened_input.items(): + setattr(self, k, v) + + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.properties is None: + return None + return getattr(self.properties, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") + + def __setattr__(self, key: str, value: Any) -> None: + if key in self.__flattened_items: + if self.properties is None: + self.properties = self._attr_to_rest_field["properties"]._class_type() + setattr(self.properties, key, value) + else: + super().__setattr__(key, value) class AvailabilitySetProperties(_Model): @@ -1179,6 +1207,16 @@ class AvailabilitySetUpdate(UpdateResource): sku: Optional["_models.Sku"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) """Sku of the availability set.""" + __flattened_items = [ + "platform_update_domain_count", + "platform_fault_domain_count", + "virtual_machines", + "proximity_placement_group", + "statuses", + "scheduled_events_policy", + "virtual_machine_scale_set_migration_info", + ] + @overload def __init__( self, @@ -1196,7 +1234,25 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: """ def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} super().__init__(*args, **kwargs) + for k, v in _flattened_input.items(): + setattr(self, k, v) + + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.properties is None: + return None + return getattr(self.properties, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") + + def __setattr__(self, key: str, value: Any) -> None: + if key in self.__flattened_items: + if self.properties is None: + self.properties = self._attr_to_rest_field["properties"]._class_type() + setattr(self.properties, key, value) + else: + super().__setattr__(key, value) class AvailablePatchSummary(_Model): @@ -1421,6 +1477,17 @@ class CapacityReservation(TrackedResource): zones: Optional[list[str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) """The availability zones.""" + __flattened_items = [ + "reservation_id", + "platform_fault_domain_count", + "virtual_machines_associated", + "provisioning_time", + "provisioning_state", + "instance_view", + "time_created", + "schedule_profile", + ] + @overload def __init__( self, @@ -1440,7 +1507,25 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: """ def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} super().__init__(*args, **kwargs) + for k, v in _flattened_input.items(): + setattr(self, k, v) + + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.properties is None: + return None + return getattr(self.properties, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") + + def __setattr__(self, key: str, value: Any) -> None: + if key in self.__flattened_items: + if self.properties is None: + self.properties = self._attr_to_rest_field["properties"]._class_type() + setattr(self.properties, key, value) + else: + super().__setattr__(key, value) class CapacityReservationGroup(TrackedResource): @@ -1477,6 +1562,14 @@ class CapacityReservationGroup(TrackedResource): zones: Optional[list[str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) """The availability zones.""" + __flattened_items = [ + "capacity_reservations", + "virtual_machines_associated", + "instance_view", + "sharing_profile", + "reservation_type", + ] + @overload def __init__( self, @@ -1495,7 +1588,25 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: """ def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} super().__init__(*args, **kwargs) + for k, v in _flattened_input.items(): + setattr(self, k, v) + + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.properties is None: + return None + return getattr(self.properties, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") + + def __setattr__(self, key: str, value: Any) -> None: + if key in self.__flattened_items: + if self.properties is None: + self.properties = self._attr_to_rest_field["properties"]._class_type() + setattr(self.properties, key, value) + else: + super().__setattr__(key, value) class CapacityReservationGroupInstanceView(_Model): @@ -1616,6 +1727,14 @@ class CapacityReservationGroupUpdate(UpdateResource): ) """capacity reservation group Properties.""" + __flattened_items = [ + "capacity_reservations", + "virtual_machines_associated", + "instance_view", + "sharing_profile", + "reservation_type", + ] + @overload def __init__( self, @@ -1632,7 +1751,25 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: """ def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} super().__init__(*args, **kwargs) + for k, v in _flattened_input.items(): + setattr(self, k, v) + + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.properties is None: + return None + return getattr(self.properties, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") + + def __setattr__(self, key: str, value: Any) -> None: + if key in self.__flattened_items: + if self.properties is None: + self.properties = self._attr_to_rest_field["properties"]._class_type() + setattr(self.properties, key, value) + else: + super().__setattr__(key, value) class CapacityReservationInstanceView(_Model): @@ -1864,6 +2001,17 @@ class CapacityReservationUpdate(UpdateResource): `_) for supported values. **Note:** The SKU name and capacity cannot be updated for Block capacity reservations.""" + __flattened_items = [ + "reservation_id", + "platform_fault_domain_count", + "virtual_machines_associated", + "provisioning_time", + "provisioning_state", + "instance_view", + "time_created", + "schedule_profile", + ] + @overload def __init__( self, @@ -1881,7 +2029,25 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: """ def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} super().__init__(*args, **kwargs) + for k, v in _flattened_input.items(): + setattr(self, k, v) + + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.properties is None: + return None + return getattr(self.properties, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") + + def __setattr__(self, key: str, value: Any) -> None: + if key in self.__flattened_items: + if self.properties is None: + self.properties = self._attr_to_rest_field["properties"]._class_type() + setattr(self.properties, key, value) + else: + super().__setattr__(key, value) class CapacityReservationUtilization(_Model): @@ -1957,6 +2123,8 @@ class PirCommunityGalleryResource(_Model): ) """The identifier information of community gallery.""" + __flattened_items = ["unique_id"] + @overload def __init__( self, @@ -1972,7 +2140,25 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: """ def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} super().__init__(*args, **kwargs) + for k, v in _flattened_input.items(): + setattr(self, k, v) + + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.identifier is None: + return None + return getattr(self.identifier, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") + + def __setattr__(self, key: str, value: Any) -> None: + if key in self.__flattened_items: + if self.identifier is None: + self.identifier = self._attr_to_rest_field["identifier"]._class_type() + setattr(self.properties, key, value) + else: + super().__setattr__(key, value) class CommunityGallery(PirCommunityGalleryResource): @@ -1995,6 +2181,8 @@ class CommunityGallery(PirCommunityGalleryResource): ) """Describes the properties of a community gallery.""" + __flattened_items = ["unique_id", "disclaimer", "artifact_tags", "community_metadata"] + @overload def __init__( self, @@ -2011,7 +2199,25 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: """ def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} super().__init__(*args, **kwargs) + for k, v in _flattened_input.items(): + setattr(self, k, v) + + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.identifier is None: + return None + return getattr(self.identifier, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") + + def __setattr__(self, key: str, value: Any) -> None: + if key in self.__flattened_items: + if self.identifier is None: + self.identifier = self._attr_to_rest_field["identifier"]._class_type() + setattr(self.properties, key, value) + else: + super().__setattr__(key, value) class CommunityGalleryIdentifier(_Model): @@ -2062,6 +2268,24 @@ class CommunityGalleryImage(PirCommunityGalleryResource): ) """Describes the properties of a gallery image definition.""" + __flattened_items = [ + "unique_id", + "os_type", + "os_state", + "end_of_life_date", + "identifier", + "recommended", + "disallowed", + "hyper_v_generation", + "features", + "purchase_plan", + "architecture", + "privacy_statement_uri", + "eula", + "disclaimer", + "artifact_tags", + ] + @overload def __init__( self, @@ -2078,7 +2302,25 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: """ def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} super().__init__(*args, **kwargs) + for k, v in _flattened_input.items(): + setattr(self, k, v) + + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.identifier is None: + return None + return getattr(self.identifier, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") + + def __setattr__(self, key: str, value: Any) -> None: + if key in self.__flattened_items: + if self.identifier is None: + self.identifier = self._attr_to_rest_field["identifier"]._class_type() + setattr(self.properties, key, value) + else: + super().__setattr__(key, value) class CommunityGalleryImageIdentifier(_Model): @@ -2271,6 +2513,16 @@ class CommunityGalleryImageVersion(PirCommunityGalleryResource): ) """Describes the properties of a gallery image version.""" + __flattened_items = [ + "unique_id", + "published_date", + "end_of_life_date", + "exclude_from_latest", + "storage_profile", + "disclaimer", + "artifact_tags", + ] + @overload def __init__( self, @@ -2287,7 +2539,25 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: """ def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} super().__init__(*args, **kwargs) + for k, v in _flattened_input.items(): + setattr(self, k, v) + + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.identifier is None: + return None + return getattr(self.identifier, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") + + def __setattr__(self, key: str, value: Any) -> None: + if key in self.__flattened_items: + if self.identifier is None: + self.identifier = self._attr_to_rest_field["identifier"]._class_type() + setattr(self.properties, key, value) + else: + super().__setattr__(key, value) class CommunityGalleryImageVersionProperties(_Model): @@ -3212,6 +3482,18 @@ class DedicatedHost(TrackedResource): """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. Required.""" + __flattened_items = [ + "platform_fault_domain", + "auto_replace_on_failure", + "host_id", + "virtual_machines", + "license_type", + "provisioning_time", + "provisioning_state", + "instance_view", + "time_created", + ] + @overload def __init__( self, @@ -3230,7 +3512,25 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: """ def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} super().__init__(*args, **kwargs) + for k, v in _flattened_input.items(): + setattr(self, k, v) + + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.properties is None: + return None + return getattr(self.properties, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") + + def __setattr__(self, key: str, value: Any) -> None: + if key in self.__flattened_items: + if self.properties is None: + self.properties = self._attr_to_rest_field["properties"]._class_type() + setattr(self.properties, key, value) + else: + super().__setattr__(key, value) class DedicatedHostAllocatableVM(_Model): @@ -3332,6 +3632,14 @@ class DedicatedHostGroup(TrackedResource): zones: Optional[list[str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) """The availability zones.""" + __flattened_items = [ + "platform_fault_domain_count", + "hosts", + "instance_view", + "support_automatic_placement", + "additional_capabilities", + ] + @overload def __init__( self, @@ -3350,7 +3658,25 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: """ def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} super().__init__(*args, **kwargs) + for k, v in _flattened_input.items(): + setattr(self, k, v) + + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.properties is None: + return None + return getattr(self.properties, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") + + def __setattr__(self, key: str, value: Any) -> None: + if key in self.__flattened_items: + if self.properties is None: + self.properties = self._attr_to_rest_field["properties"]._class_type() + setattr(self.properties, key, value) + else: + super().__setattr__(key, value) class DedicatedHostGroupInstanceView(_Model): @@ -3515,6 +3841,14 @@ class DedicatedHostGroupUpdate(UpdateResource): 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.""" + __flattened_items = [ + "platform_fault_domain_count", + "hosts", + "instance_view", + "support_automatic_placement", + "additional_capabilities", + ] + @overload def __init__( self, @@ -3532,7 +3866,25 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: """ def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} super().__init__(*args, **kwargs) + for k, v in _flattened_input.items(): + setattr(self, k, v) + + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.properties is None: + return None + return getattr(self.properties, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") + + def __setattr__(self, key: str, value: Any) -> None: + if key in self.__flattened_items: + if self.properties is None: + self.properties = self._attr_to_rest_field["properties"]._class_type() + setattr(self.properties, key, value) + else: + super().__setattr__(key, value) class DedicatedHostInstanceView(_Model): @@ -3723,6 +4075,18 @@ class DedicatedHostUpdate(UpdateResource): `_). Resizing can be only used to scale up DedicatedHost. Only name is required to be set.""" + __flattened_items = [ + "platform_fault_domain", + "auto_replace_on_failure", + "host_id", + "virtual_machines", + "license_type", + "provisioning_time", + "provisioning_state", + "instance_view", + "time_created", + ] + @overload def __init__( self, @@ -3740,7 +4104,25 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: """ def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} super().__init__(*args, **kwargs) + for k, v in _flattened_input.items(): + setattr(self, k, v) + + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.properties is None: + return None + return getattr(self.properties, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") + + def __setattr__(self, key: str, value: Any) -> None: + if key in self.__flattened_items: + if self.properties is None: + self.properties = self._attr_to_rest_field["properties"]._class_type() + setattr(self.properties, key, value) + else: + super().__setattr__(key, value) class DefaultVirtualMachineScaleSetInfo(_Model): @@ -3976,6 +4358,42 @@ class Disk(TrackedResource): ) """The extended location where the disk will be created. Extended location cannot be changed.""" + __flattened_items = [ + "time_created", + "os_type", + "hyper_v_generation", + "purchase_plan", + "supported_capabilities", + "creation_data", + "disk_size_gb", + "disk_size_bytes", + "unique_id", + "encryption_settings_collection", + "provisioning_state", + "disk_iops_read_write", + "disk_m_bps_read_write", + "disk_iops_read_only", + "disk_m_bps_read_only", + "disk_state", + "encryption", + "max_shares", + "share_info", + "network_access_policy", + "disk_access_id", + "bursting_enabled_time", + "tier", + "bursting_enabled", + "property_updates_in_progress", + "supports_hibernation", + "security_profile", + "completion_percent", + "public_network_access", + "data_access_auth_mode", + "optimized_for_frequent_attach", + "last_ownership_update_time", + "availability_policy", + ] + @overload def __init__( self, @@ -3996,7 +4414,25 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: """ def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} super().__init__(*args, **kwargs) + for k, v in _flattened_input.items(): + setattr(self, k, v) + + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.properties is None: + return None + return getattr(self.properties, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") + + def __setattr__(self, key: str, value: Any) -> None: + if key in self.__flattened_items: + if self.properties is None: + self.properties = self._attr_to_rest_field["properties"]._class_type() + setattr(self.properties, key, value) + else: + super().__setattr__(key, value) class DiskAccess(TrackedResource): @@ -4033,6 +4469,8 @@ class DiskAccess(TrackedResource): """The extended location where the disk access will be created. Extended location cannot be changed.""" + __flattened_items = ["private_endpoint_connections", "provisioning_state", "time_created"] + @overload def __init__( self, @@ -4051,7 +4489,25 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: """ def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} super().__init__(*args, **kwargs) + for k, v in _flattened_input.items(): + setattr(self, k, v) + + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.properties is None: + return None + return getattr(self.properties, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") + + def __setattr__(self, key: str, value: Any) -> None: + if key in self.__flattened_items: + if self.properties is None: + self.properties = self._attr_to_rest_field["properties"]._class_type() + setattr(self.properties, key, value) + else: + super().__setattr__(key, value) class DiskAccessProperties(_Model): @@ -4140,6 +4596,17 @@ class DiskEncryptionSet(TrackedResource): """The managed identity for the disk encryption set. It should be given permission on the key vault before it can be used to encrypt disks.""" + __flattened_items = [ + "encryption_type", + "active_key", + "previous_keys", + "provisioning_state", + "rotation_to_latest_key_version_enabled", + "last_key_rotation_timestamp", + "auto_key_rotation_error", + "federated_client_id", + ] + @overload def __init__( self, @@ -4158,7 +4625,25 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: """ def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} super().__init__(*args, **kwargs) + for k, v in _flattened_input.items(): + setattr(self, k, v) + + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.properties is None: + return None + return getattr(self.properties, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") + + def __setattr__(self, key: str, value: Any) -> None: + if key in self.__flattened_items: + if self.properties is None: + self.properties = self._attr_to_rest_field["properties"]._class_type() + setattr(self.properties, key, value) + else: + super().__setattr__(key, value) class SubResource(_Model): @@ -4284,6 +4769,13 @@ class DiskEncryptionSetUpdate(_Model): """The managed identity for the disk encryption set. It should be given permission on the key vault before it can be used to encrypt disks.""" + __flattened_items = [ + "encryption_type", + "active_key", + "rotation_to_latest_key_version_enabled", + "federated_client_id", + ] + @overload def __init__( self, @@ -4301,7 +4793,25 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: """ def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} super().__init__(*args, **kwargs) + for k, v in _flattened_input.items(): + setattr(self, k, v) + + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.properties is None: + return None + return getattr(self.properties, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") + + def __setattr__(self, key: str, value: Any) -> None: + if key in self.__flattened_items: + if self.properties is None: + self.properties = self._attr_to_rest_field["properties"]._class_type() + setattr(self.properties, key, value) + else: + super().__setattr__(key, value) class DiskEncryptionSetUpdateProperties(_Model): @@ -4783,6 +5293,27 @@ class DiskRestorePoint(ProxyResource): ) """Properties of an incremental disk restore point.""" + __flattened_items = [ + "time_created", + "source_resource_id", + "os_type", + "hyper_v_generation", + "purchase_plan", + "supported_capabilities", + "family_id", + "source_unique_id", + "encryption", + "supports_hibernation", + "network_access_policy", + "public_network_access", + "disk_access_id", + "completion_percent", + "replication_state", + "source_resource_location", + "security_profile", + "logical_sector_size", + ] + @overload def __init__( self, @@ -4798,7 +5329,25 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: """ def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} super().__init__(*args, **kwargs) + for k, v in _flattened_input.items(): + setattr(self, k, v) + + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.properties is None: + return None + return getattr(self.properties, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") + + def __setattr__(self, key: str, value: Any) -> None: + if key in self.__flattened_items: + if self.properties is None: + self.properties = self._attr_to_rest_field["properties"]._class_type() + setattr(self.properties, key, value) + else: + super().__setattr__(key, value) class SubResourceReadOnly(_Model): @@ -5167,6 +5716,30 @@ class DiskUpdate(_Model): """The disks sku name. Can be Standard_LRS, Premium_LRS, StandardSSD_LRS, UltraSSD_LRS, Premium_ZRS, StandardSSD_ZRS, or PremiumV2_LRS.""" + __flattened_items = [ + "os_type", + "disk_size_gb", + "encryption_settings_collection", + "disk_iops_read_write", + "disk_m_bps_read_write", + "disk_iops_read_only", + "disk_m_bps_read_only", + "max_shares", + "encryption", + "network_access_policy", + "disk_access_id", + "tier", + "bursting_enabled", + "purchase_plan", + "supported_capabilities", + "property_updates_in_progress", + "supports_hibernation", + "public_network_access", + "data_access_auth_mode", + "optimized_for_frequent_attach", + "availability_policy", + ] + @overload def __init__( self, @@ -5184,7 +5757,25 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: """ def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} super().__init__(*args, **kwargs) + for k, v in _flattened_input.items(): + setattr(self, k, v) + + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.properties is None: + return None + return getattr(self.properties, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") + + def __setattr__(self, key: str, value: Any) -> None: + if key in self.__flattened_items: + if self.properties is None: + self.properties = self._attr_to_rest_field["properties"]._class_type() + setattr(self.properties, key, value) + else: + super().__setattr__(key, value) class DiskUpdateProperties(_Model): @@ -5977,6 +6568,15 @@ class Gallery(TrackedResource): ) """The identity of the gallery, if configured.""" + __flattened_items = [ + "description", + "identifier", + "provisioning_state", + "sharing_profile", + "soft_delete_policy", + "sharing_status", + ] + @overload def __init__( self, @@ -5995,7 +6595,25 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: """ def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} super().__init__(*args, **kwargs) + for k, v in _flattened_input.items(): + setattr(self, k, v) + + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.properties is None: + return None + return getattr(self.properties, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") + + def __setattr__(self, key: str, value: Any) -> None: + if key in self.__flattened_items: + if self.properties is None: + self.properties = self._attr_to_rest_field["properties"]._class_type() + setattr(self.properties, key, value) + else: + super().__setattr__(key, value) class GalleryApplication(TrackedResource): @@ -6026,6 +6644,16 @@ class GalleryApplication(TrackedResource): ) """Describes the properties of a gallery Application Definition.""" + __flattened_items = [ + "description", + "eula", + "privacy_statement_uri", + "release_note_uri", + "end_of_life_date", + "supported_os_type", + "custom_actions", + ] + @overload def __init__( self, @@ -6043,7 +6671,25 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: """ def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} super().__init__(*args, **kwargs) + for k, v in _flattened_input.items(): + setattr(self, k, v) + + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.properties is None: + return None + return getattr(self.properties, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") + + def __setattr__(self, key: str, value: Any) -> None: + if key in self.__flattened_items: + if self.properties is None: + self.properties = self._attr_to_rest_field["properties"]._class_type() + setattr(self.properties, key, value) + else: + super().__setattr__(key, value) class GalleryApplicationCustomAction(_Model): @@ -6289,6 +6935,16 @@ class GalleryApplicationUpdate(UpdateResourceDefinition): ) """Describes the properties of a gallery Application Definition.""" + __flattened_items = [ + "description", + "eula", + "privacy_statement_uri", + "release_note_uri", + "end_of_life_date", + "supported_os_type", + "custom_actions", + ] + @overload def __init__( self, @@ -6305,7 +6961,25 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: """ def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} super().__init__(*args, **kwargs) + for k, v in _flattened_input.items(): + setattr(self, k, v) + + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.properties is None: + return None + return getattr(self.properties, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") + + def __setattr__(self, key: str, value: Any) -> None: + if key in self.__flattened_items: + if self.properties is None: + self.properties = self._attr_to_rest_field["properties"]._class_type() + setattr(self.properties, key, value) + else: + super().__setattr__(key, value) class GalleryApplicationVersion(TrackedResource): @@ -6335,6 +7009,8 @@ class GalleryApplicationVersion(TrackedResource): ) """Describes the properties of a gallery image version.""" + __flattened_items = ["publishing_profile", "safety_profile", "provisioning_state", "replication_status"] + @overload def __init__( self, @@ -6352,7 +7028,25 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: """ def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} super().__init__(*args, **kwargs) + for k, v in _flattened_input.items(): + setattr(self, k, v) + + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.properties is None: + return None + return getattr(self.properties, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") + + def __setattr__(self, key: str, value: Any) -> None: + if key in self.__flattened_items: + if self.properties is None: + self.properties = self._attr_to_rest_field["properties"]._class_type() + setattr(self.properties, key, value) + else: + super().__setattr__(key, value) class GalleryApplicationVersionProperties(_Model): @@ -6681,6 +7375,8 @@ class GalleryApplicationVersionUpdate(UpdateResourceDefinition): ) """Describes the properties of a gallery image version.""" + __flattened_items = ["publishing_profile", "safety_profile", "provisioning_state", "replication_status"] + @overload def __init__( self, @@ -6697,7 +7393,25 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: """ def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} super().__init__(*args, **kwargs) + for k, v in _flattened_input.items(): + setattr(self, k, v) + + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.properties is None: + return None + return getattr(self.properties, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") + + def __setattr__(self, key: str, value: Any) -> None: + if key in self.__flattened_items: + if self.properties is None: + self.properties = self._attr_to_rest_field["properties"]._class_type() + setattr(self.properties, key, value) + else: + super().__setattr__(key, value) class GalleryArtifactVersionSource(_Model): @@ -7030,6 +7744,25 @@ class GalleryImage(TrackedResource): ) """Describes the properties of a gallery image definition.""" + __flattened_items = [ + "description", + "eula", + "privacy_statement_uri", + "release_note_uri", + "os_type", + "os_state", + "hyper_v_generation", + "end_of_life_date", + "identifier", + "recommended", + "disallowed", + "purchase_plan", + "provisioning_state", + "features", + "architecture", + "allow_update_image", + ] + @overload def __init__( self, @@ -7047,7 +7780,25 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: """ def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} super().__init__(*args, **kwargs) + for k, v in _flattened_input.items(): + setattr(self, k, v) + + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.properties is None: + return None + return getattr(self.properties, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") + + def __setattr__(self, key: str, value: Any) -> None: + if key in self.__flattened_items: + if self.properties is None: + self.properties = self._attr_to_rest_field["properties"]._class_type() + setattr(self.properties, key, value) + else: + super().__setattr__(key, value) class GalleryImageFeature(_Model): @@ -7297,6 +8048,25 @@ class GalleryImageUpdate(UpdateResourceDefinition): ) """Describes the properties of a gallery image definition.""" + __flattened_items = [ + "description", + "eula", + "privacy_statement_uri", + "release_note_uri", + "os_type", + "os_state", + "hyper_v_generation", + "end_of_life_date", + "identifier", + "recommended", + "disallowed", + "purchase_plan", + "provisioning_state", + "features", + "architecture", + "allow_update_image", + ] + @overload def __init__( self, @@ -7313,7 +8083,25 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: """ def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} super().__init__(*args, **kwargs) + for k, v in _flattened_input.items(): + setattr(self, k, v) + + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.properties is None: + return None + return getattr(self.properties, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") + + def __setattr__(self, key: str, value: Any) -> None: + if key in self.__flattened_items: + if self.properties is None: + self.properties = self._attr_to_rest_field["properties"]._class_type() + setattr(self.properties, key, value) + else: + super().__setattr__(key, value) class GalleryImageVersion(TrackedResource): @@ -7343,6 +8131,17 @@ class GalleryImageVersion(TrackedResource): ) """Describes the properties of a gallery image version.""" + __flattened_items = [ + "publishing_profile", + "provisioning_state", + "storage_profile", + "safety_profile", + "replication_status", + "security_profile", + "restore", + "validations_profile", + ] + @overload def __init__( self, @@ -7360,7 +8159,25 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: """ def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} super().__init__(*args, **kwargs) + for k, v in _flattened_input.items(): + setattr(self, k, v) + + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.properties is None: + return None + return getattr(self.properties, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") + + def __setattr__(self, key: str, value: Any) -> None: + if key in self.__flattened_items: + if self.properties is None: + self.properties = self._attr_to_rest_field["properties"]._class_type() + setattr(self.properties, key, value) + else: + super().__setattr__(key, value) class GalleryImageVersionProperties(_Model): @@ -7648,6 +8465,17 @@ class GalleryImageVersionUpdate(UpdateResourceDefinition): ) """Describes the properties of a gallery image version.""" + __flattened_items = [ + "publishing_profile", + "provisioning_state", + "storage_profile", + "safety_profile", + "replication_status", + "security_profile", + "restore", + "validations_profile", + ] + @overload def __init__( self, @@ -7664,7 +8492,25 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: """ def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} super().__init__(*args, **kwargs) + for k, v in _flattened_input.items(): + setattr(self, k, v) + + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.properties is None: + return None + return getattr(self.properties, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") + + def __setattr__(self, key: str, value: Any) -> None: + if key in self.__flattened_items: + if self.properties is None: + self.properties = self._attr_to_rest_field["properties"]._class_type() + setattr(self.properties, key, value) + else: + super().__setattr__(key, value) class GalleryInVMAccessControlProfile(TrackedResource): @@ -7852,6 +8698,17 @@ class GalleryInVMAccessControlProfileVersion(TrackedResource): ) """Describes the properties of an inVMAccessControlProfile version.""" + __flattened_items = [ + "target_locations", + "exclude_from_latest", + "published_date", + "provisioning_state", + "replication_status", + "mode", + "default_access", + "rules", + ] + @overload def __init__( self, @@ -7869,7 +8726,25 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: """ def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} super().__init__(*args, **kwargs) + for k, v in _flattened_input.items(): + setattr(self, k, v) + + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.properties is None: + return None + return getattr(self.properties, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") + + def __setattr__(self, key: str, value: Any) -> None: + if key in self.__flattened_items: + if self.properties is None: + self.properties = self._attr_to_rest_field["properties"]._class_type() + setattr(self.properties, key, value) + else: + super().__setattr__(key, value) class GalleryResourceProfileVersionPropertiesBase(_Model): # pylint: disable=name-too-long @@ -8025,6 +8900,17 @@ class GalleryInVMAccessControlProfileVersionUpdate(UpdateResourceDefinition): # ) """Describes the properties of an inVMAccessControlProfile version.""" + __flattened_items = [ + "target_locations", + "exclude_from_latest", + "published_date", + "provisioning_state", + "replication_status", + "mode", + "default_access", + "rules", + ] + @overload def __init__( self, @@ -8041,7 +8927,25 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: """ def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} super().__init__(*args, **kwargs) + for k, v in _flattened_input.items(): + setattr(self, k, v) + + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.properties is None: + return None + return getattr(self.properties, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") + + def __setattr__(self, key: str, value: Any) -> None: + if key in self.__flattened_items: + if self.properties is None: + self.properties = self._attr_to_rest_field["properties"]._class_type() + setattr(self.properties, key, value) + else: + super().__setattr__(key, value) class GalleryOSDiskImage(GalleryDiskImage): @@ -8164,6 +9068,8 @@ class GallerySoftDeletedResource(TrackedResource): ) """Describes the properties of a soft-deleted resource.""" + __flattened_items = ["resource_arm_id", "soft_deleted_artifact_type", "soft_deleted_time"] + @overload def __init__( self, @@ -8181,7 +9087,25 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: """ def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} super().__init__(*args, **kwargs) + for k, v in _flattened_input.items(): + setattr(self, k, v) + + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.properties is None: + return None + return getattr(self.properties, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") + + def __setattr__(self, key: str, value: Any) -> None: + if key in self.__flattened_items: + if self.properties is None: + self.properties = self._attr_to_rest_field["properties"]._class_type() + setattr(self.properties, key, value) + else: + super().__setattr__(key, value) class GallerySoftDeletedResourceProperties(_Model): @@ -8319,6 +9243,15 @@ class GalleryUpdate(UpdateResourceDefinition): ) """The identity of the gallery, if configured.""" + __flattened_items = [ + "description", + "identifier", + "provisioning_state", + "sharing_profile", + "soft_delete_policy", + "sharing_status", + ] + @overload def __init__( self, @@ -8336,7 +9269,25 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: """ def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} super().__init__(*args, **kwargs) + for k, v in _flattened_input.items(): + setattr(self, k, v) + + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.properties is None: + return None + return getattr(self.properties, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") + + def __setattr__(self, key: str, value: Any) -> None: + if key in self.__flattened_items: + if self.properties is None: + self.properties = self._attr_to_rest_field["properties"]._class_type() + setattr(self.properties, key, value) + else: + super().__setattr__(key, value) class GenerateKeyPairParameterBody(_Model): @@ -8640,6 +9591,8 @@ class Image(TrackedResource): ) """The extended location of the Image.""" + __flattened_items = ["source_virtual_machine", "storage_profile", "provisioning_state", "hyper_v_generation"] + @overload def __init__( self, @@ -8658,7 +9611,25 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: """ def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} super().__init__(*args, **kwargs) + for k, v in _flattened_input.items(): + setattr(self, k, v) + + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.properties is None: + return None + return getattr(self.properties, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") + + def __setattr__(self, key: str, value: Any) -> None: + if key in self.__flattened_items: + if self.properties is None: + self.properties = self._attr_to_rest_field["properties"]._class_type() + setattr(self.properties, key, value) + else: + super().__setattr__(key, value) class ImageDisk(_Model): @@ -9234,6 +10205,8 @@ class ImageUpdate(UpdateResource): ) """Describes the properties of an Image.""" + __flattened_items = ["source_virtual_machine", "storage_profile", "provisioning_state", "hyper_v_generation"] + @overload def __init__( self, @@ -9250,7 +10223,25 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: """ def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} super().__init__(*args, **kwargs) + for k, v in _flattened_input.items(): + setattr(self, k, v) + + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.properties is None: + return None + return getattr(self.properties, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") + + def __setattr__(self, key: str, value: Any) -> None: + if key in self.__flattened_items: + if self.properties is None: + self.properties = self._attr_to_rest_field["properties"]._class_type() + setattr(self.properties, key, value) + else: + super().__setattr__(key, value) class ImageVersionSecurityProfile(_Model): @@ -10224,6 +11215,8 @@ class NetworkInterfaceReference(SubResource): ) """Describes a network interface reference properties.""" + __flattened_items = ["primary", "delete_option"] + @overload def __init__( self, @@ -10240,7 +11233,25 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: """ def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} super().__init__(*args, **kwargs) + for k, v in _flattened_input.items(): + setattr(self, k, v) + + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.properties is None: + return None + return getattr(self.properties, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") + + def __setattr__(self, key: str, value: Any) -> None: + if key in self.__flattened_items: + if self.properties is None: + self.properties = self._attr_to_rest_field["properties"]._class_type() + setattr(self.properties, key, value) + else: + super().__setattr__(key, value) class NetworkInterfaceReferenceProperties(_Model): @@ -11218,6 +12229,8 @@ class PirSharedGalleryResource(PirResource): ) """The identifier information of shared gallery.""" + __flattened_items = ["unique_id"] + @overload def __init__( self, @@ -11233,7 +12246,25 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: """ def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} super().__init__(*args, **kwargs) + for k, v in _flattened_input.items(): + setattr(self, k, v) + + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.identifier is None: + return None + return getattr(self.identifier, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") + + def __setattr__(self, key: str, value: Any) -> None: + if key in self.__flattened_items: + if self.identifier is None: + self.identifier = self._attr_to_rest_field["identifier"]._class_type() + setattr(self.properties, key, value) + else: + super().__setattr__(key, value) class Placement(_Model): @@ -11510,6 +12541,8 @@ class PrivateEndpointConnection(ProxyResource): ) """Resource properties.""" + __flattened_items = ["private_endpoint", "private_link_service_connection_state", "provisioning_state"] + @overload def __init__( self, @@ -11525,7 +12558,25 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: """ def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} super().__init__(*args, **kwargs) + for k, v in _flattened_input.items(): + setattr(self, k, v) + + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.properties is None: + return None + return getattr(self.properties, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") + + def __setattr__(self, key: str, value: Any) -> None: + if key in self.__flattened_items: + if self.properties is None: + self.properties = self._attr_to_rest_field["properties"]._class_type() + setattr(self.properties, key, value) + else: + super().__setattr__(key, value) class PrivateEndpointConnectionProperties(_Model): @@ -11598,6 +12649,8 @@ class PrivateLinkResource(_Model): type: Optional[str] = rest_field(visibility=["read"]) """private link resource type.""" + __flattened_items = ["group_id", "required_members", "required_zone_names"] + @overload def __init__( self, @@ -11613,7 +12666,25 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: """ def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} super().__init__(*args, **kwargs) + for k, v in _flattened_input.items(): + setattr(self, k, v) + + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.properties is None: + return None + return getattr(self.properties, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") + + def __setattr__(self, key: str, value: Any) -> None: + if key in self.__flattened_items: + if self.properties is None: + self.properties = self._attr_to_rest_field["properties"]._class_type() + setattr(self.properties, key, value) + else: + super().__setattr__(key, value) class PrivateLinkResourceListResult(_Model): @@ -11792,6 +12863,15 @@ class ProximityPlacementGroup(TrackedResource): zones: Optional[list[str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) """The availability zones.""" + __flattened_items = [ + "proximity_placement_group_type", + "virtual_machines", + "virtual_machine_scale_sets", + "availability_sets", + "colocation_status", + "intent", + ] + @overload def __init__( self, @@ -11810,7 +12890,25 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: """ def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} super().__init__(*args, **kwargs) + for k, v in _flattened_input.items(): + setattr(self, k, v) + + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.properties is None: + return None + return getattr(self.properties, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") + + def __setattr__(self, key: str, value: Any) -> None: + if key in self.__flattened_items: + if self.properties is None: + self.properties = self._attr_to_rest_field["properties"]._class_type() + setattr(self.properties, key, value) + else: + super().__setattr__(key, value) class ProximityPlacementGroupProperties(_Model): @@ -12894,6 +13992,16 @@ class RestorePoint(ProxyResource): ) """The restore point properties.""" + __flattened_items = [ + "exclude_disks", + "source_metadata", + "provisioning_state", + "consistency_mode", + "time_created", + "source_restore_point", + "instance_view", + ] + @overload def __init__( self, @@ -12909,7 +14017,25 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: """ def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} super().__init__(*args, **kwargs) + for k, v in _flattened_input.items(): + setattr(self, k, v) + + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.properties is None: + return None + return getattr(self.properties, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") + + def __setattr__(self, key: str, value: Any) -> None: + if key in self.__flattened_items: + if self.properties is None: + self.properties = self._attr_to_rest_field["properties"]._class_type() + setattr(self.properties, key, value) + else: + super().__setattr__(key, value) class RestorePointCollection(TrackedResource): @@ -12939,6 +14065,8 @@ class RestorePointCollection(TrackedResource): ) """The restore point collection properties.""" + __flattened_items = ["source", "provisioning_state", "restore_point_collection_id", "restore_points"] + @overload def __init__( self, @@ -12956,7 +14084,25 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: """ def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} super().__init__(*args, **kwargs) + for k, v in _flattened_input.items(): + setattr(self, k, v) + + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.properties is None: + return None + return getattr(self.properties, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") + + def __setattr__(self, key: str, value: Any) -> None: + if key in self.__flattened_items: + if self.properties is None: + self.properties = self._attr_to_rest_field["properties"]._class_type() + setattr(self.properties, key, value) + else: + super().__setattr__(key, value) class RestorePointCollectionProperties(_Model): @@ -13049,6 +14195,8 @@ class RestorePointCollectionUpdate(UpdateResource): ) """The restore point collection properties.""" + __flattened_items = ["source", "provisioning_state", "restore_point_collection_id", "restore_points"] + @overload def __init__( self, @@ -13065,7 +14213,25 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: """ def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} super().__init__(*args, **kwargs) + for k, v in _flattened_input.items(): + setattr(self, k, v) + + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.properties is None: + return None + return getattr(self.properties, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") + + def __setattr__(self, key: str, value: Any) -> None: + if key in self.__flattened_items: + if self.properties is None: + self.properties = self._attr_to_rest_field["properties"]._class_type() + setattr(self.properties, key, value) + else: + super().__setattr__(key, value) class RestorePointEncryption(_Model): @@ -13703,6 +14869,8 @@ class RollingUpgradeStatusInfo(TrackedResource): ) """The status of the latest virtual machine scale set rolling upgrade.""" + __flattened_items = ["policy", "running_status", "progress", "error"] + @overload def __init__( self, @@ -13720,7 +14888,25 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: """ def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} super().__init__(*args, **kwargs) + for k, v in _flattened_input.items(): + setattr(self, k, v) + + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.properties is None: + return None + return getattr(self.properties, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") + + def __setattr__(self, key: str, value: Any) -> None: + if key in self.__flattened_items: + if self.properties is None: + self.properties = self._attr_to_rest_field["properties"]._class_type() + setattr(self.properties, key, value) + else: + super().__setattr__(key, value) class RollingUpgradeStatusInfoProperties(_Model): @@ -14521,6 +15707,8 @@ class SharedGallery(PirSharedGalleryResource): ) """Specifies the properties of a shared gallery.""" + __flattened_items = ["unique_id", "artifact_tags"] + @overload def __init__( self, @@ -14537,7 +15725,25 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: """ def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} super().__init__(*args, **kwargs) + for k, v in _flattened_input.items(): + setattr(self, k, v) + + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.identifier is None: + return None + return getattr(self.identifier, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") + + def __setattr__(self, key: str, value: Any) -> None: + if key in self.__flattened_items: + if self.identifier is None: + self.identifier = self._attr_to_rest_field["identifier"]._class_type() + setattr(self.properties, key, value) + else: + super().__setattr__(key, value) class SharedGalleryDiskImage(_Model): @@ -14660,6 +15866,23 @@ class SharedGalleryImage(PirSharedGalleryResource): ) """Describes the properties of a gallery image definition.""" + __flattened_items = [ + "unique_id", + "os_type", + "os_state", + "end_of_life_date", + "identifier", + "recommended", + "disallowed", + "hyper_v_generation", + "features", + "purchase_plan", + "architecture", + "privacy_statement_uri", + "eula", + "artifact_tags", + ] + @overload def __init__( self, @@ -14676,7 +15899,25 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: """ def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} super().__init__(*args, **kwargs) + for k, v in _flattened_input.items(): + setattr(self, k, v) + + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.identifier is None: + return None + return getattr(self.identifier, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") + + def __setattr__(self, key: str, value: Any) -> None: + if key in self.__flattened_items: + if self.identifier is None: + self.identifier = self._attr_to_rest_field["identifier"]._class_type() + setattr(self.properties, key, value) + else: + super().__setattr__(key, value) class SharedGalleryImageProperties(_Model): @@ -14824,6 +16065,15 @@ class SharedGalleryImageVersion(PirSharedGalleryResource): ) """Describes the properties of a gallery image version.""" + __flattened_items = [ + "unique_id", + "published_date", + "end_of_life_date", + "exclude_from_latest", + "storage_profile", + "artifact_tags", + ] + @overload def __init__( self, @@ -14840,7 +16090,25 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: """ def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} super().__init__(*args, **kwargs) + for k, v in _flattened_input.items(): + setattr(self, k, v) + + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.identifier is None: + return None + return getattr(self.identifier, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") + + def __setattr__(self, key: str, value: Any) -> None: + if key in self.__flattened_items: + if self.identifier is None: + self.identifier = self._attr_to_rest_field["identifier"]._class_type() + setattr(self.properties, key, value) + else: + super().__setattr__(key, value) class SharedGalleryImageVersionProperties(_Model): @@ -15318,6 +16586,33 @@ class Snapshot(TrackedResource): ) """The extended location where the snapshot will be created. Extended location cannot be changed.""" + __flattened_items = [ + "time_created", + "os_type", + "hyper_v_generation", + "purchase_plan", + "supported_capabilities", + "creation_data", + "disk_size_gb", + "disk_size_bytes", + "disk_state", + "unique_id", + "encryption_settings_collection", + "provisioning_state", + "incremental", + "incremental_snapshot_family_id", + "encryption", + "network_access_policy", + "disk_access_id", + "security_profile", + "supports_hibernation", + "public_network_access", + "completion_percent", + "copy_completion_error", + "data_access_auth_mode", + "snapshot_access_state", + ] + @overload def __init__( self, @@ -15337,7 +16632,25 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: """ def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} super().__init__(*args, **kwargs) + for k, v in _flattened_input.items(): + setattr(self, k, v) + + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.properties is None: + return None + return getattr(self.properties, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") + + def __setattr__(self, key: str, value: Any) -> None: + if key in self.__flattened_items: + if self.properties is None: + self.properties = self._attr_to_rest_field["properties"]._class_type() + setattr(self.properties, key, value) + else: + super().__setattr__(key, value) class SnapshotProperties(_Model): @@ -15607,6 +16920,20 @@ class SnapshotUpdate(_Model): parameter for incremental snapshot and the default behavior is the SKU will be set to the same sku as the previous snapshot.""" + __flattened_items = [ + "os_type", + "disk_size_gb", + "encryption_settings_collection", + "encryption", + "network_access_policy", + "disk_access_id", + "supports_hibernation", + "public_network_access", + "data_access_auth_mode", + "supported_capabilities", + "snapshot_access_state", + ] + @overload def __init__( self, @@ -15624,7 +16951,25 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: """ def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} super().__init__(*args, **kwargs) + for k, v in _flattened_input.items(): + setattr(self, k, v) + + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.properties is None: + return None + return getattr(self.properties, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") + + def __setattr__(self, key: str, value: Any) -> None: + if key in self.__flattened_items: + if self.properties is None: + self.properties = self._attr_to_rest_field["properties"]._class_type() + setattr(self.properties, key, value) + else: + super().__setattr__(key, value) class SnapshotUpdateProperties(_Model): @@ -16029,6 +17374,8 @@ class SshPublicKeyResource(TrackedResource): ) """Properties of the SSH public key.""" + __flattened_items = ["public_key"] + @overload def __init__( self, @@ -16046,7 +17393,25 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: """ def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} super().__init__(*args, **kwargs) + for k, v in _flattened_input.items(): + setattr(self, k, v) + + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.properties is None: + return None + return getattr(self.properties, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") + + def __setattr__(self, key: str, value: Any) -> None: + if key in self.__flattened_items: + if self.properties is None: + self.properties = self._attr_to_rest_field["properties"]._class_type() + setattr(self.properties, key, value) + else: + super().__setattr__(key, value) class SshPublicKeyResourceProperties(_Model): @@ -16097,6 +17462,8 @@ class SshPublicKeyUpdateResource(UpdateResource): ) """Properties of the SSH public key.""" + __flattened_items = ["public_key"] + @overload def __init__( self, @@ -16113,7 +17480,25 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: """ def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} super().__init__(*args, **kwargs) + for k, v in _flattened_input.items(): + setattr(self, k, v) + + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.properties is None: + return None + return getattr(self.properties, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") + + def __setattr__(self, key: str, value: Any) -> None: + if key in self.__flattened_items: + if self.properties is None: + self.properties = self._attr_to_rest_field["properties"]._class_type() + setattr(self.properties, key, value) + else: + super().__setattr__(key, value) class StartParameterBody(_Model): @@ -17361,6 +18746,36 @@ class VirtualMachine(TrackedResource): placement. This property cannot be changed once VM is provisioned. Minimum api-version: 2024-11-01.""" + __flattened_items = [ + "hardware_profile", + "scheduled_events_policy", + "storage_profile", + "additional_capabilities", + "os_profile", + "network_profile", + "security_profile", + "diagnostics_profile", + "availability_set", + "virtual_machine_scale_set", + "proximity_placement_group", + "priority", + "eviction_policy", + "billing_profile", + "host", + "host_group", + "provisioning_state", + "instance_view", + "license_type", + "vm_id", + "extensions_time_budget", + "platform_fault_domain", + "scheduled_events_profile", + "user_data", + "capacity_reservation", + "application_profile", + "time_created", + ] + @overload def __init__( self, @@ -17383,7 +18798,25 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: """ def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} super().__init__(*args, **kwargs) + for k, v in _flattened_input.items(): + setattr(self, k, v) + + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.properties is None: + return None + return getattr(self.properties, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") + + def __setattr__(self, key: str, value: Any) -> None: + if key in self.__flattened_items: + if self.properties is None: + self.properties = self._attr_to_rest_field["properties"]._class_type() + setattr(self.properties, key, value) + else: + super().__setattr__(key, value) class VirtualMachineAgentInstanceView(_Model): @@ -17604,6 +19037,22 @@ class VirtualMachineExtension(TrackedResource): ) """Describes the properties of a Virtual Machine Extension.""" + __flattened_items = [ + "force_update_tag", + "publisher", + "type", + "type_handler_version", + "auto_upgrade_minor_version", + "enable_automatic_upgrade", + "settings", + "protected_settings", + "provisioning_state", + "instance_view", + "suppress_failures", + "protected_settings_from_key_vault", + "provision_after_extensions", + ] + @overload def __init__( self, @@ -17621,7 +19070,25 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: """ def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} super().__init__(*args, **kwargs) + for k, v in _flattened_input.items(): + setattr(self, k, v) + + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.properties is None: + return None + return getattr(self.properties, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") + + def __setattr__(self, key: str, value: Any) -> None: + if key in self.__flattened_items: + if self.properties is None: + self.properties = self._attr_to_rest_field["properties"]._class_type() + setattr(self.properties, key, value) + else: + super().__setattr__(key, value) class VirtualMachineExtensionHandlerInstanceView(_Model): # pylint: disable=name-too-long @@ -17693,6 +19160,14 @@ class VirtualMachineExtensionImage(TrackedResource): ) """Describes the properties of a Virtual Machine Extension Image.""" + __flattened_items = [ + "operating_system", + "compute_role", + "handler_schema", + "vm_scale_set_enabled", + "supports_multiple_extensions", + ] + @overload def __init__( self, @@ -17710,7 +19185,25 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: """ def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} super().__init__(*args, **kwargs) + for k, v in _flattened_input.items(): + setattr(self, k, v) + + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.properties is None: + return None + return getattr(self.properties, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") + + def __setattr__(self, key: str, value: Any) -> None: + if key in self.__flattened_items: + if self.properties is None: + self.properties = self._attr_to_rest_field["properties"]._class_type() + setattr(self.properties, key, value) + else: + super().__setattr__(key, value) class VirtualMachineExtensionImageProperties(_Model): @@ -17962,6 +19455,19 @@ class VirtualMachineExtensionUpdate(UpdateResource): ) """Describes the properties of a Virtual Machine Extension.""" + __flattened_items = [ + "force_update_tag", + "publisher", + "type", + "type_handler_version", + "auto_upgrade_minor_version", + "enable_automatic_upgrade", + "settings", + "protected_settings", + "suppress_failures", + "protected_settings_from_key_vault", + ] + @overload def __init__( self, @@ -17978,7 +19484,25 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: """ def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} super().__init__(*args, **kwargs) + for k, v in _flattened_input.items(): + setattr(self, k, v) + + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.properties is None: + return None + return getattr(self.properties, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") + + def __setattr__(self, key: str, value: Any) -> None: + if key in self.__flattened_items: + if self.properties is None: + self.properties = self._attr_to_rest_field["properties"]._class_type() + setattr(self.properties, key, value) + else: + super().__setattr__(key, value) class VirtualMachineExtensionUpdateProperties(_Model): @@ -18230,6 +19754,18 @@ class VirtualMachineImage(VirtualMachineImageResource): ) """Describes the properties of a Virtual Machine Image.""" + __flattened_items = [ + "plan", + "os_disk_image", + "data_disk_images", + "automatic_os_upgrade_properties", + "hyper_v_generation", + "disallowed", + "features", + "architecture", + "image_deprecation_status", + ] + @overload def __init__( self, @@ -18250,7 +19786,25 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: """ def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} super().__init__(*args, **kwargs) + for k, v in _flattened_input.items(): + setattr(self, k, v) + + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.properties is None: + return None + return getattr(self.properties, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") + + def __setattr__(self, key: str, value: Any) -> None: + if key in self.__flattened_items: + if self.properties is None: + self.properties = self._attr_to_rest_field["properties"]._class_type() + setattr(self.properties, key, value) + else: + super().__setattr__(key, value) class VirtualMachineImageFeature(_Model): @@ -18706,6 +20260,21 @@ class VirtualMachineNetworkInterfaceConfiguration(_Model): # pylint: disable=na """Resource tags applied to the networkInterface address created by this NetworkInterfaceConfiguration.""" + __flattened_items = [ + "primary", + "delete_option", + "enable_accelerated_networking", + "disable_tcp_state_tracking", + "enable_fpga", + "enable_ip_forwarding", + "network_security_group", + "dns_settings", + "ip_configurations", + "dscp_configuration", + "auxiliary_mode", + "auxiliary_sku", + ] + @overload def __init__( self, @@ -18723,7 +20292,25 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: """ def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} super().__init__(*args, **kwargs) + for k, v in _flattened_input.items(): + setattr(self, k, v) + + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.properties is None: + return None + return getattr(self.properties, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") + + def __setattr__(self, key: str, value: Any) -> None: + if key in self.__flattened_items: + if self.properties is None: + self.properties = self._attr_to_rest_field["properties"]._class_type() + setattr(self.properties, key, value) + else: + super().__setattr__(key, value) class VirtualMachineNetworkInterfaceConfigurationProperties(_Model): # pylint: disable=name-too-long @@ -18889,6 +20476,16 @@ class VirtualMachineNetworkInterfaceIPConfiguration(_Model): # pylint: disable= ) """Describes a virtual machine network interface IP configuration properties.""" + __flattened_items = [ + "subnet", + "primary", + "public_ip_address_configuration", + "private_ip_address_version", + "application_security_groups", + "application_gateway_backend_address_pools", + "load_balancer_backend_address_pools", + ] + @overload def __init__( self, @@ -18905,7 +20502,25 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: """ def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} super().__init__(*args, **kwargs) + for k, v in _flattened_input.items(): + setattr(self, k, v) + + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.properties is None: + return None + return getattr(self.properties, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") + + def __setattr__(self, key: str, value: Any) -> None: + if key in self.__flattened_items: + if self.properties is None: + self.properties = self._attr_to_rest_field["properties"]._class_type() + setattr(self.properties, key, value) + else: + super().__setattr__(key, value) class VirtualMachineNetworkInterfaceIPConfigurationProperties(_Model): # pylint: disable=name-too-long @@ -19363,6 +20978,16 @@ class VirtualMachinePublicIPAddressConfiguration(_Model): # pylint: disable=nam tags: Optional[dict[str, str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) """Resource tags applied to the publicIP address created by this PublicIPAddressConfiguration.""" + __flattened_items = [ + "idle_timeout_in_minutes", + "delete_option", + "dns_settings", + "ip_tags", + "public_ip_prefix", + "public_ip_address_version", + "public_ip_allocation_method", + ] + @overload def __init__( self, @@ -19381,7 +21006,25 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: """ def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} super().__init__(*args, **kwargs) + for k, v in _flattened_input.items(): + setattr(self, k, v) + + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.properties is None: + return None + return getattr(self.properties, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") + + def __setattr__(self, key: str, value: Any) -> None: + if key in self.__flattened_items: + if self.properties is None: + self.properties = self._attr_to_rest_field["properties"]._class_type() + setattr(self.properties, key, value) + else: + super().__setattr__(key, value) class VirtualMachinePublicIPAddressConfigurationProperties(_Model): # pylint: disable=name-too-long @@ -19587,6 +21230,23 @@ class VirtualMachineRunCommand(TrackedResource): ) """Describes the properties of a Virtual Machine run command.""" + __flattened_items = [ + "source", + "parameters", + "protected_parameters", + "async_execution", + "run_as_user", + "run_as_password", + "timeout_in_seconds", + "output_blob_uri", + "error_blob_uri", + "output_blob_managed_identity", + "error_blob_managed_identity", + "provisioning_state", + "instance_view", + "treat_failure_as_deployment_failure", + ] + @overload def __init__( self, @@ -19604,7 +21264,25 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: """ def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} super().__init__(*args, **kwargs) + for k, v in _flattened_input.items(): + setattr(self, k, v) + + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.properties is None: + return None + return getattr(self.properties, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") + + def __setattr__(self, key: str, value: Any) -> None: + if key in self.__flattened_items: + if self.properties is None: + self.properties = self._attr_to_rest_field["properties"]._class_type() + setattr(self.properties, key, value) + else: + super().__setattr__(key, value) class VirtualMachineRunCommandInstanceView(_Model): @@ -19963,6 +21641,23 @@ class VirtualMachineRunCommandUpdate(UpdateResource): ) """Describes the properties of a Virtual Machine run command.""" + __flattened_items = [ + "source", + "parameters", + "protected_parameters", + "async_execution", + "run_as_user", + "run_as_password", + "timeout_in_seconds", + "output_blob_uri", + "error_blob_uri", + "output_blob_managed_identity", + "error_blob_managed_identity", + "provisioning_state", + "instance_view", + "treat_failure_as_deployment_failure", + ] + @overload def __init__( self, @@ -19979,7 +21674,25 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: """ def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} super().__init__(*args, **kwargs) + for k, v in _flattened_input.items(): + setattr(self, k, v) + + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.properties is None: + return None + return getattr(self.properties, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") + + def __setattr__(self, key: str, value: Any) -> None: + if key in self.__flattened_items: + if self.properties is None: + self.properties = self._attr_to_rest_field["properties"]._class_type() + setattr(self.properties, key, value) + else: + super().__setattr__(key, value) class VirtualMachineScaleSet(TrackedResource): @@ -20055,6 +21768,33 @@ class VirtualMachineScaleSet(TrackedResource): placement. This property cannot be changed once VMSS is provisioned. Minimum api-version: 2025-04-01.""" + __flattened_items = [ + "upgrade_policy", + "scheduled_events_policy", + "automatic_repairs_policy", + "virtual_machine_profile", + "provisioning_state", + "overprovision", + "do_not_run_extensions_on_overprovisioned_v_ms", + "unique_id", + "single_placement_group", + "zone_balance", + "platform_fault_domain_count", + "proximity_placement_group", + "host_group", + "additional_capabilities", + "scale_in_policy", + "orchestration_mode", + "spot_restore_policy", + "priority_mix_policy", + "time_created", + "constrained_maximum_capacity", + "resiliency_policy", + "zonal_platform_fault_domain_align_mode", + "sku_profile", + "high_speed_interconnect_placement", + ] + @overload def __init__( self, @@ -20078,7 +21818,25 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: """ def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} super().__init__(*args, **kwargs) + for k, v in _flattened_input.items(): + setattr(self, k, v) + + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.properties is None: + return None + return getattr(self.properties, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") + + def __setattr__(self, key: str, value: Any) -> None: + if key in self.__flattened_items: + if self.properties is None: + self.properties = self._attr_to_rest_field["properties"]._class_type() + setattr(self.properties, key, value) + else: + super().__setattr__(key, value) class VirtualMachineScaleSetDataDisk(_Model): @@ -20208,8 +21966,8 @@ class VirtualMachineScaleSetExtension(SubResourceReadOnly): :vartype id: str :ivar properties: Describes the properties of a Virtual Machine Scale Set Extension. :vartype properties: ~azure.mgmt.compute.models.VirtualMachineScaleSetExtensionProperties - :ivar vm_type: Resource type. - :vartype vm_type: str + :ivar type: Resource type. + :vartype type: str :ivar name: Resource name. :vartype name: str """ @@ -20218,11 +21976,26 @@ class VirtualMachineScaleSetExtension(SubResourceReadOnly): visibility=["read", "create", "update", "delete", "query"] ) """Describes the properties of a Virtual Machine Scale Set Extension.""" - vm_type: Optional[str] = rest_field(name="type", visibility=["read"]) + type: Optional[str] = rest_field(visibility=["read"]) """Resource type.""" name: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) """Resource name.""" + __flattened_items = [ + "force_update_tag", + "publisher", + "type", + "type_handler_version", + "auto_upgrade_minor_version", + "enable_automatic_upgrade", + "settings", + "protected_settings", + "provisioning_state", + "provision_after_extensions", + "suppress_failures", + "protected_settings_from_key_vault", + ] + @overload def __init__( self, @@ -20239,7 +22012,25 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: """ def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} super().__init__(*args, **kwargs) + for k, v in _flattened_input.items(): + setattr(self, k, v) + + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.properties is None: + return None + return getattr(self.properties, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") + + def __setattr__(self, key: str, value: Any) -> None: + if key in self.__flattened_items: + if self.properties is None: + self.properties = self._attr_to_rest_field["properties"]._class_type() + setattr(self.properties, key, value) + else: + super().__setattr__(key, value) class VirtualMachineScaleSetExtensionProfile(_Model): @@ -20419,6 +22210,21 @@ class VirtualMachineScaleSetExtensionUpdate(SubResourceReadOnly): ) """Describes the properties of a Virtual Machine Scale Set Extension.""" + __flattened_items = [ + "force_update_tag", + "publisher", + "type", + "type_handler_version", + "auto_upgrade_minor_version", + "enable_automatic_upgrade", + "settings", + "protected_settings", + "provisioning_state", + "provision_after_extensions", + "suppress_failures", + "protected_settings_from_key_vault", + ] + @overload def __init__( self, @@ -20434,7 +22240,25 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: """ def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} super().__init__(*args, **kwargs) + for k, v in _flattened_input.items(): + setattr(self, k, v) + + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.properties is None: + return None + return getattr(self.properties, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") + + def __setattr__(self, key: str, value: Any) -> None: + if key in self.__flattened_items: + if self.properties is None: + self.properties = self._attr_to_rest_field["properties"]._class_type() + setattr(self.properties, key, value) + else: + super().__setattr__(key, value) class VirtualMachineScaleSetHardwareProfile(_Model): @@ -20610,6 +22434,17 @@ class VirtualMachineScaleSetIPConfiguration(_Model): ) """Describes a virtual machine scale set network profile's IP configuration properties.""" + __flattened_items = [ + "subnet", + "primary", + "public_ip_address_configuration", + "private_ip_address_version", + "application_gateway_backend_address_pools", + "application_security_groups", + "load_balancer_backend_address_pools", + "load_balancer_inbound_nat_pools", + ] + @overload def __init__( self, @@ -20626,7 +22461,25 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: """ def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} super().__init__(*args, **kwargs) + for k, v in _flattened_input.items(): + setattr(self, k, v) + + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.properties is None: + return None + return getattr(self.properties, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") + + def __setattr__(self, key: str, value: Any) -> None: + if key in self.__flattened_items: + if self.properties is None: + self.properties = self._attr_to_rest_field["properties"]._class_type() + setattr(self.properties, key, value) + else: + super().__setattr__(key, value) class VirtualMachineScaleSetIPConfigurationProperties(_Model): # pylint: disable=name-too-long @@ -20861,6 +22714,20 @@ class VirtualMachineScaleSetNetworkConfiguration(_Model): # pylint: disable=nam """Resource tags applied to the networkInterface address created by this NetworkInterfaceConfiguration.""" + __flattened_items = [ + "primary", + "enable_accelerated_networking", + "disable_tcp_state_tracking", + "enable_fpga", + "network_security_group", + "dns_settings", + "ip_configurations", + "enable_ip_forwarding", + "delete_option", + "auxiliary_mode", + "auxiliary_sku", + ] + @overload def __init__( self, @@ -20878,7 +22745,25 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: """ def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} super().__init__(*args, **kwargs) + for k, v in _flattened_input.items(): + setattr(self, k, v) + + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.properties is None: + return None + return getattr(self.properties, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") + + def __setattr__(self, key: str, value: Any) -> None: + if key in self.__flattened_items: + if self.properties is None: + self.properties = self._attr_to_rest_field["properties"]._class_type() + setattr(self.properties, key, value) + else: + super().__setattr__(key, value) class VirtualMachineScaleSetNetworkConfigurationDnsSettings(_Model): # pylint: disable=name-too-long @@ -21608,6 +23493,15 @@ class VirtualMachineScaleSetPublicIPAddressConfiguration(_Model): # pylint: dis tags: Optional[dict[str, str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) """Resource tags applied to the publicIP address created by this PublicIPAddressConfiguration.""" + __flattened_items = [ + "idle_timeout_in_minutes", + "dns_settings", + "ip_tags", + "public_ip_prefix", + "public_ip_address_version", + "delete_option", + ] + @overload def __init__( self, @@ -21626,7 +23520,25 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: """ def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} super().__init__(*args, **kwargs) + for k, v in _flattened_input.items(): + setattr(self, k, v) + + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.properties is None: + return None + return getattr(self.properties, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") + + def __setattr__(self, key: str, value: Any) -> None: + if key in self.__flattened_items: + if self.properties is None: + self.properties = self._attr_to_rest_field["properties"]._class_type() + setattr(self.properties, key, value) + else: + super().__setattr__(key, value) class VirtualMachineScaleSetPublicIPAddressConfigurationDnsSettings(_Model): # pylint: disable=name-too-long @@ -21988,6 +23900,23 @@ class VirtualMachineScaleSetUpdate(UpdateResource): zones: Optional[list[str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) """The virtual machine scale set zones.""" + __flattened_items = [ + "upgrade_policy", + "automatic_repairs_policy", + "virtual_machine_profile", + "overprovision", + "do_not_run_extensions_on_overprovisioned_v_ms", + "single_placement_group", + "additional_capabilities", + "scale_in_policy", + "proximity_placement_group", + "priority_mix_policy", + "spot_restore_policy", + "resiliency_policy", + "zonal_platform_fault_domain_align_mode", + "sku_profile", + ] + @overload def __init__( self, @@ -22008,7 +23937,25 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: """ def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} super().__init__(*args, **kwargs) + for k, v in _flattened_input.items(): + setattr(self, k, v) + + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.properties is None: + return None + return getattr(self.properties, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") + + def __setattr__(self, key: str, value: Any) -> None: + if key in self.__flattened_items: + if self.properties is None: + self.properties = self._attr_to_rest_field["properties"]._class_type() + setattr(self.properties, key, value) + else: + super().__setattr__(key, value) class VirtualMachineScaleSetUpdateIPConfiguration(_Model): # pylint: disable=name-too-long @@ -22031,6 +23978,17 @@ class VirtualMachineScaleSetUpdateIPConfiguration(_Model): # pylint: disable=na ) """Describes a virtual machine scale set network profile's IP configuration properties.""" + __flattened_items = [ + "subnet", + "primary", + "public_ip_address_configuration", + "private_ip_address_version", + "application_gateway_backend_address_pools", + "application_security_groups", + "load_balancer_backend_address_pools", + "load_balancer_inbound_nat_pools", + ] + @overload def __init__( self, @@ -22047,7 +24005,25 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: """ def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} super().__init__(*args, **kwargs) + for k, v in _flattened_input.items(): + setattr(self, k, v) + + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.properties is None: + return None + return getattr(self.properties, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") + + def __setattr__(self, key: str, value: Any) -> None: + if key in self.__flattened_items: + if self.properties is None: + self.properties = self._attr_to_rest_field["properties"]._class_type() + setattr(self.properties, key, value) + else: + super().__setattr__(key, value) class VirtualMachineScaleSetUpdateIPConfigurationProperties(_Model): # pylint: disable=name-too-long @@ -22163,6 +24139,20 @@ class VirtualMachineScaleSetUpdateNetworkConfiguration(_Model): # pylint: disab """Resource tags applied to the networkInterface address created by this NetworkInterfaceConfiguration.""" + __flattened_items = [ + "primary", + "enable_accelerated_networking", + "disable_tcp_state_tracking", + "enable_fpga", + "network_security_group", + "dns_settings", + "ip_configurations", + "enable_ip_forwarding", + "delete_option", + "auxiliary_mode", + "auxiliary_sku", + ] + @overload def __init__( self, @@ -22180,7 +24170,25 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: """ def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} super().__init__(*args, **kwargs) + for k, v in _flattened_input.items(): + setattr(self, k, v) + + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.properties is None: + return None + return getattr(self.properties, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") + + def __setattr__(self, key: str, value: Any) -> None: + if key in self.__flattened_items: + if self.properties is None: + self.properties = self._attr_to_rest_field["properties"]._class_type() + setattr(self.properties, key, value) + else: + super().__setattr__(key, value) class VirtualMachineScaleSetUpdateNetworkConfigurationProperties(_Model): # pylint: disable=name-too-long @@ -22667,6 +24675,8 @@ class VirtualMachineScaleSetUpdatePublicIPAddressConfiguration(_Model): # pylin tags: Optional[dict[str, str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) """Resource tags applied to the publicIP address created by this PublicIPAddressConfiguration.""" + __flattened_items = ["idle_timeout_in_minutes", "dns_settings", "public_ip_prefix", "delete_option"] + @overload def __init__( self, @@ -22684,7 +24694,25 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: """ def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} super().__init__(*args, **kwargs) + for k, v in _flattened_input.items(): + setattr(self, k, v) + + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.properties is None: + return None + return getattr(self.properties, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") + + def __setattr__(self, key: str, value: Any) -> None: + if key in self.__flattened_items: + if self.properties is None: + self.properties = self._attr_to_rest_field["properties"]._class_type() + setattr(self.properties, key, value) + else: + super().__setattr__(key, value) class VirtualMachineScaleSetUpdatePublicIPAddressConfigurationProperties(_Model): # pylint: disable=name-too-long @@ -22974,6 +25002,28 @@ class VirtualMachineScaleSetVM(TrackedResource): """Etag is property returned in Update/Get response of the VMSS VM, so that customer can supply it in the header to ensure optimistic updates.""" + __flattened_items = [ + "latest_model_applied", + "vm_id", + "instance_view", + "hardware_profile", + "resilient_vm_deletion_status", + "storage_profile", + "additional_capabilities", + "os_profile", + "security_profile", + "network_profile", + "network_profile_configuration", + "diagnostics_profile", + "availability_set", + "provisioning_state", + "license_type", + "model_definition_applied", + "protection_policy", + "user_data", + "time_created", + ] + @overload def __init__( self, @@ -22993,7 +25043,25 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: """ def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} super().__init__(*args, **kwargs) + for k, v in _flattened_input.items(): + setattr(self, k, v) + + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.properties is None: + return None + return getattr(self.properties, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") + + def __setattr__(self, key: str, value: Any) -> None: + if key in self.__flattened_items: + if self.properties is None: + self.properties = self._attr_to_rest_field["properties"]._class_type() + setattr(self.properties, key, value) + else: + super().__setattr__(key, value) class VirtualMachineScaleSetVMExtension(SubResourceReadOnly): @@ -23005,8 +25073,8 @@ class VirtualMachineScaleSetVMExtension(SubResourceReadOnly): :vartype properties: ~azure.mgmt.compute.models.VirtualMachineExtensionProperties :ivar location: The location of the extension. :vartype location: str - :ivar vm_type: Resource type. - :vartype vm_type: str + :ivar type: Resource type. + :vartype type: str :ivar name: Resource name. :vartype name: str """ @@ -23017,11 +25085,27 @@ class VirtualMachineScaleSetVMExtension(SubResourceReadOnly): """Describes the properties of a Virtual Machine Extension.""" location: Optional[str] = rest_field(visibility=["read", "create"]) """The location of the extension.""" - vm_type: Optional[str] = rest_field(name="type", visibility=["read"]) + type: Optional[str] = rest_field(visibility=["read"]) """Resource type.""" name: Optional[str] = rest_field(visibility=["read"]) """Resource name.""" + __flattened_items = [ + "force_update_tag", + "publisher", + "type", + "type_handler_version", + "auto_upgrade_minor_version", + "enable_automatic_upgrade", + "settings", + "protected_settings", + "provisioning_state", + "instance_view", + "suppress_failures", + "protected_settings_from_key_vault", + "provision_after_extensions", + ] + @overload def __init__( self, @@ -23038,7 +25122,25 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: """ def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} super().__init__(*args, **kwargs) + for k, v in _flattened_input.items(): + setattr(self, k, v) + + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.properties is None: + return None + return getattr(self.properties, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") + + def __setattr__(self, key: str, value: Any) -> None: + if key in self.__flattened_items: + if self.properties is None: + self.properties = self._attr_to_rest_field["properties"]._class_type() + setattr(self.properties, key, value) + else: + super().__setattr__(key, value) class VirtualMachineScaleSetVMExtensionsSummary(_Model): # pylint: disable=name-too-long @@ -23080,6 +25182,19 @@ class VirtualMachineScaleSetVMExtensionUpdate(SubResourceReadOnly): ) """Describes the properties of a Virtual Machine Extension.""" + __flattened_items = [ + "force_update_tag", + "publisher", + "type", + "type_handler_version", + "auto_upgrade_minor_version", + "enable_automatic_upgrade", + "settings", + "protected_settings", + "suppress_failures", + "protected_settings_from_key_vault", + ] + @overload def __init__( self, @@ -23095,7 +25210,25 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: """ def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} super().__init__(*args, **kwargs) + for k, v in _flattened_input.items(): + setattr(self, k, v) + + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.properties is None: + return None + return getattr(self.properties, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") + + def __setattr__(self, key: str, value: Any) -> None: + if key in self.__flattened_items: + if self.properties is None: + self.properties = self._attr_to_rest_field["properties"]._class_type() + setattr(self.properties, key, value) + else: + super().__setattr__(key, value) class VirtualMachineScaleSetVMInstanceIDs(_Model): @@ -23943,6 +26076,36 @@ class VirtualMachineUpdate(UpdateResource): zones: Optional[list[str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) """The virtual machine zones.""" + __flattened_items = [ + "hardware_profile", + "scheduled_events_policy", + "storage_profile", + "additional_capabilities", + "os_profile", + "network_profile", + "security_profile", + "diagnostics_profile", + "availability_set", + "virtual_machine_scale_set", + "proximity_placement_group", + "priority", + "eviction_policy", + "billing_profile", + "host", + "host_group", + "provisioning_state", + "instance_view", + "license_type", + "vm_id", + "extensions_time_budget", + "platform_fault_domain", + "scheduled_events_profile", + "user_data", + "capacity_reservation", + "application_profile", + "time_created", + ] + @overload def __init__( self, @@ -23962,7 +26125,25 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: """ def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} super().__init__(*args, **kwargs) + for k, v in _flattened_input.items(): + setattr(self, k, v) + + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.properties is None: + return None + return getattr(self.properties, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") + + def __setattr__(self, key: str, value: Any) -> None: + if key in self.__flattened_items: + if self.properties is None: + self.properties = self._attr_to_rest_field["properties"]._class_type() + setattr(self.properties, key, value) + else: + super().__setattr__(key, value) class VMDiskSecurityProfile(_Model): diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/operations/__init__.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/operations/__init__.py index e7c7e55a0228..1480dc504db2 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/operations/__init__.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/operations/__init__.py @@ -45,7 +45,6 @@ from ._operations import DiskAccessesOperations # type: ignore from ._operations import PrivateEndpointConnectionsOperations # type: ignore from ._operations import DiskEncryptionSetsOperations # type: ignore -from ._operations import DiskRestorePointsOperations # type: ignore from ._operations import SnapshotsOperations # type: ignore from ._operations import GalleriesOperations # type: ignore from ._operations import GalleryImagesOperations # type: ignore @@ -61,6 +60,7 @@ from ._operations import CommunityGalleryImagesOperations # type: ignore from ._operations import CommunityGalleryImageVersionsOperations # type: ignore from ._operations import ResourceSkusOperations # type: ignore +from ._operations import DiskRestorePointOperations # type: ignore from ._patch import __all__ as _patch_all from ._patch import * @@ -100,7 +100,6 @@ "DiskAccessesOperations", "PrivateEndpointConnectionsOperations", "DiskEncryptionSetsOperations", - "DiskRestorePointsOperations", "SnapshotsOperations", "GalleriesOperations", "GalleryImagesOperations", @@ -116,6 +115,7 @@ "CommunityGalleryImagesOperations", "CommunityGalleryImageVersionsOperations", "ResourceSkusOperations", + "DiskRestorePointOperations", ] __all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/operations/_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/operations/_operations.py index 90e75b211298..171d3f1def5b 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/operations/_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/operations/_operations.py @@ -6384,149 +6384,6 @@ def build_disk_encryption_sets_list_associated_resources_request( # pylint: dis return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_disk_restore_points_get_request( - resource_group_name: str, - restore_point_collection_name: str, - vm_restore_point_name: str, - disk_restore_point_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{vmRestorePointName}/diskRestorePoints/{diskRestorePointName}" - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "restorePointCollectionName": _SERIALIZER.url( - "restore_point_collection_name", restore_point_collection_name, "str" - ), - "vmRestorePointName": _SERIALIZER.url("vm_restore_point_name", vm_restore_point_name, "str"), - "diskRestorePointName": _SERIALIZER.url("disk_restore_point_name", disk_restore_point_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_disk_restore_points_list_by_restore_point_request( # pylint: disable=name-too-long - resource_group_name: str, - restore_point_collection_name: str, - vm_restore_point_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{vmRestorePointName}/diskRestorePoints" - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "restorePointCollectionName": _SERIALIZER.url( - "restore_point_collection_name", restore_point_collection_name, "str" - ), - "vmRestorePointName": _SERIALIZER.url("vm_restore_point_name", vm_restore_point_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_disk_restore_points_grant_access_request( # pylint: disable=name-too-long - resource_group_name: str, - restore_point_collection_name: str, - vm_restore_point_name: str, - disk_restore_point_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{vmRestorePointName}/diskRestorePoints/{diskRestorePointName}/beginGetAccess" - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "restorePointCollectionName": _SERIALIZER.url( - "restore_point_collection_name", restore_point_collection_name, "str" - ), - "vmRestorePointName": _SERIALIZER.url("vm_restore_point_name", vm_restore_point_name, "str"), - "diskRestorePointName": _SERIALIZER.url("disk_restore_point_name", disk_restore_point_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_disk_restore_points_revoke_access_request( # pylint: disable=name-too-long - resource_group_name: str, - restore_point_collection_name: str, - vm_restore_point_name: str, - disk_restore_point_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{vmRestorePointName}/diskRestorePoints/{diskRestorePointName}/endGetAccess" - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "restorePointCollectionName": _SERIALIZER.url( - "restore_point_collection_name", restore_point_collection_name, "str" - ), - "vmRestorePointName": _SERIALIZER.url("vm_restore_point_name", vm_restore_point_name, "str"), - "diskRestorePointName": _SERIALIZER.url("disk_restore_point_name", disk_restore_point_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - return HttpRequest(method="POST", url=_url, params=_params, **kwargs) - - def build_snapshots_get_request( resource_group_name: str, snapshot_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: @@ -8365,6 +8222,149 @@ def build_resource_skus_list_request( return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) +def build_disk_restore_point_get_request( + resource_group_name: str, + restore_point_collection_name: str, + vm_restore_point_name: str, + disk_restore_point_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{vmRestorePointName}/diskRestorePoints/{diskRestorePointName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "restorePointCollectionName": _SERIALIZER.url( + "restore_point_collection_name", restore_point_collection_name, "str" + ), + "vmRestorePointName": _SERIALIZER.url("vm_restore_point_name", vm_restore_point_name, "str"), + "diskRestorePointName": _SERIALIZER.url("disk_restore_point_name", disk_restore_point_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_disk_restore_point_list_by_restore_point_request( # pylint: disable=name-too-long + resource_group_name: str, + restore_point_collection_name: str, + vm_restore_point_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{vmRestorePointName}/diskRestorePoints" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "restorePointCollectionName": _SERIALIZER.url( + "restore_point_collection_name", restore_point_collection_name, "str" + ), + "vmRestorePointName": _SERIALIZER.url("vm_restore_point_name", vm_restore_point_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_disk_restore_point_grant_access_request( # pylint: disable=name-too-long + resource_group_name: str, + restore_point_collection_name: str, + vm_restore_point_name: str, + disk_restore_point_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{vmRestorePointName}/diskRestorePoints/{diskRestorePointName}/beginGetAccess" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "restorePointCollectionName": _SERIALIZER.url( + "restore_point_collection_name", restore_point_collection_name, "str" + ), + "vmRestorePointName": _SERIALIZER.url("vm_restore_point_name", vm_restore_point_name, "str"), + "diskRestorePointName": _SERIALIZER.url("disk_restore_point_name", disk_restore_point_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_disk_restore_point_revoke_access_request( # pylint: disable=name-too-long + resource_group_name: str, + restore_point_collection_name: str, + vm_restore_point_name: str, + disk_restore_point_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{vmRestorePointName}/diskRestorePoints/{diskRestorePointName}/endGetAccess" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "restorePointCollectionName": _SERIALIZER.url( + "restore_point_collection_name", restore_point_collection_name, "str" + ), + "vmRestorePointName": _SERIALIZER.url("vm_restore_point_name", vm_restore_point_name, "str"), + "diskRestorePointName": _SERIALIZER.url("disk_restore_point_name", disk_restore_point_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + return HttpRequest(method="POST", url=_url, params=_params, **kwargs) + + class Operations: """ .. warning:: @@ -8565,7 +8565,7 @@ def _create_or_update_initial( self, resource_group_name: str, vm_scale_set_name: str, - resource: Union[_models.VirtualMachineScaleSet, JSON, IO[bytes]], + parameters: Union[_models.VirtualMachineScaleSet, JSON, IO[bytes]], *, etag: Optional[str] = None, match_condition: Optional[MatchConditions] = None, @@ -8593,10 +8593,10 @@ def _create_or_update_initial( content_type = content_type or "application/json" _content = None - if isinstance(resource, (IOBase, bytes)): - _content = resource + if isinstance(parameters, (IOBase, bytes)): + _content = parameters else: - _content = json.dumps(resource, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore _request = build_virtual_machine_scale_sets_create_or_update_request( resource_group_name=resource_group_name, @@ -8648,7 +8648,7 @@ def begin_create_or_update( self, resource_group_name: str, vm_scale_set_name: str, - resource: _models.VirtualMachineScaleSet, + parameters: _models.VirtualMachineScaleSet, *, content_type: str = "application/json", etag: Optional[str] = None, @@ -8662,8 +8662,8 @@ def begin_create_or_update( :type resource_group_name: str :param vm_scale_set_name: The name of the VM scale set. Required. :type vm_scale_set_name: str - :param resource: The scale set object. Required. - :type resource: ~azure.mgmt.compute.models.VirtualMachineScaleSet + :param parameters: The scale set object. Required. + :type parameters: ~azure.mgmt.compute.models.VirtualMachineScaleSet :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -8682,7 +8682,7 @@ def begin_create_or_update( self, resource_group_name: str, vm_scale_set_name: str, - resource: JSON, + parameters: JSON, *, content_type: str = "application/json", etag: Optional[str] = None, @@ -8696,8 +8696,8 @@ def begin_create_or_update( :type resource_group_name: str :param vm_scale_set_name: The name of the VM scale set. Required. :type vm_scale_set_name: str - :param resource: The scale set object. Required. - :type resource: JSON + :param parameters: The scale set object. Required. + :type parameters: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -8716,7 +8716,7 @@ def begin_create_or_update( self, resource_group_name: str, vm_scale_set_name: str, - resource: IO[bytes], + parameters: IO[bytes], *, content_type: str = "application/json", etag: Optional[str] = None, @@ -8730,8 +8730,8 @@ def begin_create_or_update( :type resource_group_name: str :param vm_scale_set_name: The name of the VM scale set. Required. :type vm_scale_set_name: str - :param resource: The scale set object. Required. - :type resource: IO[bytes] + :param parameters: The scale set object. Required. + :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str @@ -8750,7 +8750,7 @@ def begin_create_or_update( self, resource_group_name: str, vm_scale_set_name: str, - resource: Union[_models.VirtualMachineScaleSet, JSON, IO[bytes]], + parameters: Union[_models.VirtualMachineScaleSet, JSON, IO[bytes]], *, etag: Optional[str] = None, match_condition: Optional[MatchConditions] = None, @@ -8763,9 +8763,9 @@ def begin_create_or_update( :type resource_group_name: str :param vm_scale_set_name: The name of the VM scale set. Required. :type vm_scale_set_name: str - :param resource: The scale set object. Is one of the following types: VirtualMachineScaleSet, + :param parameters: The scale set object. Is one of the following types: VirtualMachineScaleSet, JSON, IO[bytes] Required. - :type resource: ~azure.mgmt.compute.models.VirtualMachineScaleSet or JSON or IO[bytes] + :type parameters: ~azure.mgmt.compute.models.VirtualMachineScaleSet or JSON or IO[bytes] :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is None. :paramtype etag: str @@ -8787,7 +8787,7 @@ def begin_create_or_update( raw_result = self._create_or_update_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, - resource=resource, + parameters=parameters, etag=etag, match_condition=match_condition, content_type=content_type, @@ -8828,7 +8828,7 @@ def _update_initial( self, resource_group_name: str, vm_scale_set_name: str, - properties: Union[_models.VirtualMachineScaleSetUpdate, JSON, IO[bytes]], + parameters: Union[_models.VirtualMachineScaleSetUpdate, JSON, IO[bytes]], *, etag: Optional[str] = None, match_condition: Optional[MatchConditions] = None, @@ -8856,10 +8856,10 @@ def _update_initial( content_type = content_type or "application/json" _content = None - if isinstance(properties, (IOBase, bytes)): - _content = properties + if isinstance(parameters, (IOBase, bytes)): + _content = parameters else: - _content = json.dumps(properties, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore _request = build_virtual_machine_scale_sets_update_request( resource_group_name=resource_group_name, @@ -8910,7 +8910,7 @@ def begin_update( self, resource_group_name: str, vm_scale_set_name: str, - properties: _models.VirtualMachineScaleSetUpdate, + parameters: _models.VirtualMachineScaleSetUpdate, *, content_type: str = "application/json", etag: Optional[str] = None, @@ -8924,8 +8924,8 @@ def begin_update( :type resource_group_name: str :param vm_scale_set_name: The name of the VM scale set. Required. :type vm_scale_set_name: str - :param properties: The scale set object. Required. - :type properties: ~azure.mgmt.compute.models.VirtualMachineScaleSetUpdate + :param parameters: The scale set object. Required. + :type parameters: ~azure.mgmt.compute.models.VirtualMachineScaleSetUpdate :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -8944,7 +8944,7 @@ def begin_update( self, resource_group_name: str, vm_scale_set_name: str, - properties: JSON, + parameters: JSON, *, content_type: str = "application/json", etag: Optional[str] = None, @@ -8958,8 +8958,8 @@ def begin_update( :type resource_group_name: str :param vm_scale_set_name: The name of the VM scale set. Required. :type vm_scale_set_name: str - :param properties: The scale set object. Required. - :type properties: JSON + :param parameters: The scale set object. Required. + :type parameters: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -8978,7 +8978,7 @@ def begin_update( self, resource_group_name: str, vm_scale_set_name: str, - properties: IO[bytes], + parameters: IO[bytes], *, content_type: str = "application/json", etag: Optional[str] = None, @@ -8992,8 +8992,8 @@ def begin_update( :type resource_group_name: str :param vm_scale_set_name: The name of the VM scale set. Required. :type vm_scale_set_name: str - :param properties: The scale set object. Required. - :type properties: IO[bytes] + :param parameters: The scale set object. Required. + :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str @@ -9012,7 +9012,7 @@ def begin_update( self, resource_group_name: str, vm_scale_set_name: str, - properties: Union[_models.VirtualMachineScaleSetUpdate, JSON, IO[bytes]], + parameters: Union[_models.VirtualMachineScaleSetUpdate, JSON, IO[bytes]], *, etag: Optional[str] = None, match_condition: Optional[MatchConditions] = None, @@ -9025,9 +9025,9 @@ def begin_update( :type resource_group_name: str :param vm_scale_set_name: The name of the VM scale set. Required. :type vm_scale_set_name: str - :param properties: The scale set object. Is one of the following types: + :param parameters: The scale set object. Is one of the following types: VirtualMachineScaleSetUpdate, JSON, IO[bytes] Required. - :type properties: ~azure.mgmt.compute.models.VirtualMachineScaleSetUpdate or JSON or IO[bytes] + :type parameters: ~azure.mgmt.compute.models.VirtualMachineScaleSetUpdate or JSON or IO[bytes] :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is None. :paramtype etag: str @@ -9049,7 +9049,7 @@ def begin_update( raw_result = self._update_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, - properties=properties, + parameters=parameters, etag=etag, match_condition=match_condition, content_type=content_type, @@ -9620,7 +9620,7 @@ def convert_to_single_placement_group( self, resource_group_name: str, vm_scale_set_name: str, - body: _models.VMScaleSetConvertToSinglePlacementGroupInput, + parameters: _models.VMScaleSetConvertToSinglePlacementGroupInput, *, content_type: str = "application/json", **kwargs: Any @@ -9632,8 +9632,8 @@ def convert_to_single_placement_group( :type resource_group_name: str :param vm_scale_set_name: The name of the VM scale set. Required. :type vm_scale_set_name: str - :param body: The input object for ConvertToSinglePlacementGroup API. Required. - :type body: ~azure.mgmt.compute.models.VMScaleSetConvertToSinglePlacementGroupInput + :param parameters: The input object for ConvertToSinglePlacementGroup API. Required. + :type parameters: ~azure.mgmt.compute.models.VMScaleSetConvertToSinglePlacementGroupInput :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -9647,7 +9647,7 @@ def convert_to_single_placement_group( self, resource_group_name: str, vm_scale_set_name: str, - body: JSON, + parameters: JSON, *, content_type: str = "application/json", **kwargs: Any @@ -9659,8 +9659,8 @@ def convert_to_single_placement_group( :type resource_group_name: str :param vm_scale_set_name: The name of the VM scale set. Required. :type vm_scale_set_name: str - :param body: The input object for ConvertToSinglePlacementGroup API. Required. - :type body: JSON + :param parameters: The input object for ConvertToSinglePlacementGroup API. Required. + :type parameters: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -9674,7 +9674,7 @@ def convert_to_single_placement_group( self, resource_group_name: str, vm_scale_set_name: str, - body: IO[bytes], + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -9686,8 +9686,8 @@ def convert_to_single_placement_group( :type resource_group_name: str :param vm_scale_set_name: The name of the VM scale set. Required. :type vm_scale_set_name: str - :param body: The input object for ConvertToSinglePlacementGroup API. Required. - :type body: IO[bytes] + :param parameters: The input object for ConvertToSinglePlacementGroup API. Required. + :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str @@ -9701,7 +9701,7 @@ def convert_to_single_placement_group( # pylint: disable=inconsistent-return-st self, resource_group_name: str, vm_scale_set_name: str, - body: Union[_models.VMScaleSetConvertToSinglePlacementGroupInput, JSON, IO[bytes]], + parameters: Union[_models.VMScaleSetConvertToSinglePlacementGroupInput, JSON, IO[bytes]], **kwargs: Any ) -> None: """Converts SinglePlacementGroup property to false for a existing virtual machine scale set. @@ -9711,10 +9711,10 @@ def convert_to_single_placement_group( # pylint: disable=inconsistent-return-st :type resource_group_name: str :param vm_scale_set_name: The name of the VM scale set. Required. :type vm_scale_set_name: str - :param body: The input object for ConvertToSinglePlacementGroup API. Is one of the following - types: VMScaleSetConvertToSinglePlacementGroupInput, JSON, IO[bytes] Required. - :type body: ~azure.mgmt.compute.models.VMScaleSetConvertToSinglePlacementGroupInput or JSON or - IO[bytes] + :param parameters: The input object for ConvertToSinglePlacementGroup API. Is one of the + following types: VMScaleSetConvertToSinglePlacementGroupInput, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.compute.models.VMScaleSetConvertToSinglePlacementGroupInput or + JSON or IO[bytes] :return: None :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -9735,10 +9735,10 @@ def convert_to_single_placement_group( # pylint: disable=inconsistent-return-st content_type = content_type or "application/json" _content = None - if isinstance(body, (IOBase, bytes)): - _content = body + if isinstance(parameters, (IOBase, bytes)): + _content = parameters else: - _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore _request = build_virtual_machine_scale_sets_convert_to_single_placement_group_request( resource_group_name=resource_group_name, @@ -10051,7 +10051,7 @@ def _delete_instances_initial( self, resource_group_name: str, vm_scale_set_name: str, - body: Union[_models.VirtualMachineScaleSetVMInstanceRequiredIDs, JSON, IO[bytes]], + vm_instance_i_ds: Union[_models.VirtualMachineScaleSetVMInstanceRequiredIDs, JSON, IO[bytes]], *, force_deletion: Optional[bool] = None, **kwargs: Any @@ -10072,10 +10072,10 @@ def _delete_instances_initial( content_type = content_type or "application/json" _content = None - if isinstance(body, (IOBase, bytes)): - _content = body + if isinstance(vm_instance_i_ds, (IOBase, bytes)): + _content = vm_instance_i_ds else: - _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(vm_instance_i_ds, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore _request = build_virtual_machine_scale_sets_delete_instances_request( resource_group_name=resource_group_name, @@ -10126,7 +10126,7 @@ def begin_delete_instances( self, resource_group_name: str, vm_scale_set_name: str, - body: _models.VirtualMachineScaleSetVMInstanceRequiredIDs, + vm_instance_i_ds: _models.VirtualMachineScaleSetVMInstanceRequiredIDs, *, force_deletion: Optional[bool] = None, content_type: str = "application/json", @@ -10139,8 +10139,9 @@ def begin_delete_instances( :type resource_group_name: str :param vm_scale_set_name: The name of the VM scale set. Required. :type vm_scale_set_name: str - :param body: A list of virtual machine instance IDs from the VM scale set. Required. - :type body: ~azure.mgmt.compute.models.VirtualMachineScaleSetVMInstanceRequiredIDs + :param vm_instance_i_ds: A list of virtual machine instance IDs from the VM scale set. + Required. + :type vm_instance_i_ds: ~azure.mgmt.compute.models.VirtualMachineScaleSetVMInstanceRequiredIDs :keyword force_deletion: Optional parameter to force delete virtual machines from the VM scale set. (Feature in Preview). Default value is None. :paramtype force_deletion: bool @@ -10158,7 +10159,7 @@ def begin_delete_instances( self, resource_group_name: str, vm_scale_set_name: str, - body: JSON, + vm_instance_i_ds: JSON, *, force_deletion: Optional[bool] = None, content_type: str = "application/json", @@ -10171,8 +10172,9 @@ def begin_delete_instances( :type resource_group_name: str :param vm_scale_set_name: The name of the VM scale set. Required. :type vm_scale_set_name: str - :param body: A list of virtual machine instance IDs from the VM scale set. Required. - :type body: JSON + :param vm_instance_i_ds: A list of virtual machine instance IDs from the VM scale set. + Required. + :type vm_instance_i_ds: JSON :keyword force_deletion: Optional parameter to force delete virtual machines from the VM scale set. (Feature in Preview). Default value is None. :paramtype force_deletion: bool @@ -10190,7 +10192,7 @@ def begin_delete_instances( self, resource_group_name: str, vm_scale_set_name: str, - body: IO[bytes], + vm_instance_i_ds: IO[bytes], *, force_deletion: Optional[bool] = None, content_type: str = "application/json", @@ -10203,8 +10205,9 @@ def begin_delete_instances( :type resource_group_name: str :param vm_scale_set_name: The name of the VM scale set. Required. :type vm_scale_set_name: str - :param body: A list of virtual machine instance IDs from the VM scale set. Required. - :type body: IO[bytes] + :param vm_instance_i_ds: A list of virtual machine instance IDs from the VM scale set. + Required. + :type vm_instance_i_ds: IO[bytes] :keyword force_deletion: Optional parameter to force delete virtual machines from the VM scale set. (Feature in Preview). Default value is None. :paramtype force_deletion: bool @@ -10222,7 +10225,7 @@ def begin_delete_instances( self, resource_group_name: str, vm_scale_set_name: str, - body: Union[_models.VirtualMachineScaleSetVMInstanceRequiredIDs, JSON, IO[bytes]], + vm_instance_i_ds: Union[_models.VirtualMachineScaleSetVMInstanceRequiredIDs, JSON, IO[bytes]], *, force_deletion: Optional[bool] = None, **kwargs: Any @@ -10234,10 +10237,10 @@ def begin_delete_instances( :type resource_group_name: str :param vm_scale_set_name: The name of the VM scale set. Required. :type vm_scale_set_name: str - :param body: A list of virtual machine instance IDs from the VM scale set. Is one of the - following types: VirtualMachineScaleSetVMInstanceRequiredIDs, JSON, IO[bytes] Required. - :type body: ~azure.mgmt.compute.models.VirtualMachineScaleSetVMInstanceRequiredIDs or JSON or - IO[bytes] + :param vm_instance_i_ds: A list of virtual machine instance IDs from the VM scale set. Is one + of the following types: VirtualMachineScaleSetVMInstanceRequiredIDs, JSON, IO[bytes] Required. + :type vm_instance_i_ds: ~azure.mgmt.compute.models.VirtualMachineScaleSetVMInstanceRequiredIDs + or JSON or IO[bytes] :keyword force_deletion: Optional parameter to force delete virtual machines from the VM scale set. (Feature in Preview). Default value is None. :paramtype force_deletion: bool @@ -10258,7 +10261,7 @@ def begin_delete_instances( raw_result = self._delete_instances_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, - body=body, + vm_instance_i_ds=vm_instance_i_ds, force_deletion=force_deletion, content_type=content_type, cls=lambda x, y, z: x, @@ -10464,7 +10467,7 @@ def _update_instances_initial( self, resource_group_name: str, vm_scale_set_name: str, - body: Union[_models.VirtualMachineScaleSetVMInstanceRequiredIDs, JSON, IO[bytes]], + vm_instance_i_ds: Union[_models.VirtualMachineScaleSetVMInstanceRequiredIDs, JSON, IO[bytes]], **kwargs: Any ) -> Iterator[bytes]: error_map: MutableMapping = { @@ -10483,10 +10486,10 @@ def _update_instances_initial( content_type = content_type or "application/json" _content = None - if isinstance(body, (IOBase, bytes)): - _content = body + if isinstance(vm_instance_i_ds, (IOBase, bytes)): + _content = vm_instance_i_ds else: - _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(vm_instance_i_ds, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore _request = build_virtual_machine_scale_sets_update_instances_request( resource_group_name=resource_group_name, @@ -10536,7 +10539,7 @@ def begin_update_instances( self, resource_group_name: str, vm_scale_set_name: str, - body: _models.VirtualMachineScaleSetVMInstanceRequiredIDs, + vm_instance_i_ds: _models.VirtualMachineScaleSetVMInstanceRequiredIDs, *, content_type: str = "application/json", **kwargs: Any @@ -10548,8 +10551,9 @@ def begin_update_instances( :type resource_group_name: str :param vm_scale_set_name: The name of the VM scale set. Required. :type vm_scale_set_name: str - :param body: A list of virtual machine instance IDs from the VM scale set. Required. - :type body: ~azure.mgmt.compute.models.VirtualMachineScaleSetVMInstanceRequiredIDs + :param vm_instance_i_ds: A list of virtual machine instance IDs from the VM scale set. + Required. + :type vm_instance_i_ds: ~azure.mgmt.compute.models.VirtualMachineScaleSetVMInstanceRequiredIDs :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -10564,7 +10568,7 @@ def begin_update_instances( self, resource_group_name: str, vm_scale_set_name: str, - body: JSON, + vm_instance_i_ds: JSON, *, content_type: str = "application/json", **kwargs: Any @@ -10576,8 +10580,9 @@ def begin_update_instances( :type resource_group_name: str :param vm_scale_set_name: The name of the VM scale set. Required. :type vm_scale_set_name: str - :param body: A list of virtual machine instance IDs from the VM scale set. Required. - :type body: JSON + :param vm_instance_i_ds: A list of virtual machine instance IDs from the VM scale set. + Required. + :type vm_instance_i_ds: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -10592,7 +10597,7 @@ def begin_update_instances( self, resource_group_name: str, vm_scale_set_name: str, - body: IO[bytes], + vm_instance_i_ds: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -10604,8 +10609,9 @@ def begin_update_instances( :type resource_group_name: str :param vm_scale_set_name: The name of the VM scale set. Required. :type vm_scale_set_name: str - :param body: A list of virtual machine instance IDs from the VM scale set. Required. - :type body: IO[bytes] + :param vm_instance_i_ds: A list of virtual machine instance IDs from the VM scale set. + Required. + :type vm_instance_i_ds: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str @@ -10620,7 +10626,7 @@ def begin_update_instances( self, resource_group_name: str, vm_scale_set_name: str, - body: Union[_models.VirtualMachineScaleSetVMInstanceRequiredIDs, JSON, IO[bytes]], + vm_instance_i_ds: Union[_models.VirtualMachineScaleSetVMInstanceRequiredIDs, JSON, IO[bytes]], **kwargs: Any ) -> LROPoller[_models.OkResponse]: """Upgrades one or more virtual machines to the latest SKU set in the VM scale set model. @@ -10630,10 +10636,10 @@ def begin_update_instances( :type resource_group_name: str :param vm_scale_set_name: The name of the VM scale set. Required. :type vm_scale_set_name: str - :param body: A list of virtual machine instance IDs from the VM scale set. Is one of the - following types: VirtualMachineScaleSetVMInstanceRequiredIDs, JSON, IO[bytes] Required. - :type body: ~azure.mgmt.compute.models.VirtualMachineScaleSetVMInstanceRequiredIDs or JSON or - IO[bytes] + :param vm_instance_i_ds: A list of virtual machine instance IDs from the VM scale set. Is one + of the following types: VirtualMachineScaleSetVMInstanceRequiredIDs, JSON, IO[bytes] Required. + :type vm_instance_i_ds: ~azure.mgmt.compute.models.VirtualMachineScaleSetVMInstanceRequiredIDs + or JSON or IO[bytes] :return: An instance of LROPoller that returns OkResponse. The OkResponse is compatible with MutableMapping :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.OkResponse] @@ -10651,7 +10657,7 @@ def begin_update_instances( raw_result = self._update_instances_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, - body=body, + vm_instance_i_ds=vm_instance_i_ds, content_type=content_type, cls=lambda x, y, z: x, headers=_headers, @@ -12451,7 +12457,7 @@ def _set_orchestration_service_state_initial( self, resource_group_name: str, vm_scale_set_name: str, - body: Union[_models.OrchestrationServiceStateInput, JSON, IO[bytes]], + parameters: Union[_models.OrchestrationServiceStateInput, JSON, IO[bytes]], **kwargs: Any ) -> Iterator[bytes]: error_map: MutableMapping = { @@ -12470,10 +12476,10 @@ def _set_orchestration_service_state_initial( content_type = content_type or "application/json" _content = None - if isinstance(body, (IOBase, bytes)): - _content = body + if isinstance(parameters, (IOBase, bytes)): + _content = parameters else: - _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore _request = build_virtual_machine_scale_sets_set_orchestration_service_state_request( resource_group_name=resource_group_name, @@ -12523,7 +12529,7 @@ def begin_set_orchestration_service_state( self, resource_group_name: str, vm_scale_set_name: str, - body: _models.OrchestrationServiceStateInput, + parameters: _models.OrchestrationServiceStateInput, *, content_type: str = "application/json", **kwargs: Any @@ -12535,8 +12541,8 @@ def begin_set_orchestration_service_state( :type resource_group_name: str :param vm_scale_set_name: The name of the VM scale set. Required. :type vm_scale_set_name: str - :param body: The input object for SetOrchestrationServiceState API. Required. - :type body: ~azure.mgmt.compute.models.OrchestrationServiceStateInput + :param parameters: The input object for SetOrchestrationServiceState API. Required. + :type parameters: ~azure.mgmt.compute.models.OrchestrationServiceStateInput :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -12551,7 +12557,7 @@ def begin_set_orchestration_service_state( self, resource_group_name: str, vm_scale_set_name: str, - body: JSON, + parameters: JSON, *, content_type: str = "application/json", **kwargs: Any @@ -12563,8 +12569,8 @@ def begin_set_orchestration_service_state( :type resource_group_name: str :param vm_scale_set_name: The name of the VM scale set. Required. :type vm_scale_set_name: str - :param body: The input object for SetOrchestrationServiceState API. Required. - :type body: JSON + :param parameters: The input object for SetOrchestrationServiceState API. Required. + :type parameters: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -12579,7 +12585,7 @@ def begin_set_orchestration_service_state( self, resource_group_name: str, vm_scale_set_name: str, - body: IO[bytes], + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -12591,8 +12597,8 @@ def begin_set_orchestration_service_state( :type resource_group_name: str :param vm_scale_set_name: The name of the VM scale set. Required. :type vm_scale_set_name: str - :param body: The input object for SetOrchestrationServiceState API. Required. - :type body: IO[bytes] + :param parameters: The input object for SetOrchestrationServiceState API. Required. + :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str @@ -12607,7 +12613,7 @@ def begin_set_orchestration_service_state( self, resource_group_name: str, vm_scale_set_name: str, - body: Union[_models.OrchestrationServiceStateInput, JSON, IO[bytes]], + parameters: Union[_models.OrchestrationServiceStateInput, JSON, IO[bytes]], **kwargs: Any ) -> LROPoller[_models.OkResponse]: """Changes ServiceState property for a given service. @@ -12617,9 +12623,10 @@ def begin_set_orchestration_service_state( :type resource_group_name: str :param vm_scale_set_name: The name of the VM scale set. Required. :type vm_scale_set_name: str - :param body: The input object for SetOrchestrationServiceState API. Is one of the following - types: OrchestrationServiceStateInput, JSON, IO[bytes] Required. - :type body: ~azure.mgmt.compute.models.OrchestrationServiceStateInput or JSON or IO[bytes] + :param parameters: The input object for SetOrchestrationServiceState API. Is one of the + following types: OrchestrationServiceStateInput, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.compute.models.OrchestrationServiceStateInput or JSON or + IO[bytes] :return: An instance of LROPoller that returns OkResponse. The OkResponse is compatible with MutableMapping :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.OkResponse] @@ -12637,7 +12644,7 @@ def begin_set_orchestration_service_state( raw_result = self._set_orchestration_service_state_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, - body=body, + parameters=parameters, content_type=content_type, cls=lambda x, y, z: x, headers=_headers, @@ -13410,7 +13417,7 @@ def _scale_out_initial( self, resource_group_name: str, vm_scale_set_name: str, - body: Union[_models.VMScaleSetScaleOutInput, JSON, IO[bytes]], + parameters: Union[_models.VMScaleSetScaleOutInput, JSON, IO[bytes]], **kwargs: Any ) -> Iterator[bytes]: error_map: MutableMapping = { @@ -13429,10 +13436,10 @@ def _scale_out_initial( content_type = content_type or "application/json" _content = None - if isinstance(body, (IOBase, bytes)): - _content = body + if isinstance(parameters, (IOBase, bytes)): + _content = parameters else: - _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore _request = build_virtual_machine_scale_sets_scale_out_request( resource_group_name=resource_group_name, @@ -13482,7 +13489,7 @@ def begin_scale_out( self, resource_group_name: str, vm_scale_set_name: str, - body: _models.VMScaleSetScaleOutInput, + parameters: _models.VMScaleSetScaleOutInput, *, content_type: str = "application/json", **kwargs: Any @@ -13494,8 +13501,8 @@ def begin_scale_out( :type resource_group_name: str :param vm_scale_set_name: The name of the VM scale set. Required. :type vm_scale_set_name: str - :param body: The input object for ScaleOut API. Required. - :type body: ~azure.mgmt.compute.models.VMScaleSetScaleOutInput + :param parameters: The input object for ScaleOut API. Required. + :type parameters: ~azure.mgmt.compute.models.VMScaleSetScaleOutInput :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -13510,7 +13517,7 @@ def begin_scale_out( self, resource_group_name: str, vm_scale_set_name: str, - body: JSON, + parameters: JSON, *, content_type: str = "application/json", **kwargs: Any @@ -13522,8 +13529,8 @@ def begin_scale_out( :type resource_group_name: str :param vm_scale_set_name: The name of the VM scale set. Required. :type vm_scale_set_name: str - :param body: The input object for ScaleOut API. Required. - :type body: JSON + :param parameters: The input object for ScaleOut API. Required. + :type parameters: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -13538,7 +13545,7 @@ def begin_scale_out( self, resource_group_name: str, vm_scale_set_name: str, - body: IO[bytes], + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -13550,8 +13557,8 @@ def begin_scale_out( :type resource_group_name: str :param vm_scale_set_name: The name of the VM scale set. Required. :type vm_scale_set_name: str - :param body: The input object for ScaleOut API. Required. - :type body: IO[bytes] + :param parameters: The input object for ScaleOut API. Required. + :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str @@ -13573,7 +13580,7 @@ def begin_scale_out( self, resource_group_name: str, vm_scale_set_name: str, - body: Union[_models.VMScaleSetScaleOutInput, JSON, IO[bytes]], + parameters: Union[_models.VMScaleSetScaleOutInput, JSON, IO[bytes]], **kwargs: Any ) -> LROPoller[_models.OkResponse]: """Scales out one or more virtual machines in a VM scale set. @@ -13583,9 +13590,9 @@ def begin_scale_out( :type resource_group_name: str :param vm_scale_set_name: The name of the VM scale set. Required. :type vm_scale_set_name: str - :param body: The input object for ScaleOut API. Is one of the following types: + :param parameters: The input object for ScaleOut API. Is one of the following types: VMScaleSetScaleOutInput, JSON, IO[bytes] Required. - :type body: ~azure.mgmt.compute.models.VMScaleSetScaleOutInput or JSON or IO[bytes] + :type parameters: ~azure.mgmt.compute.models.VMScaleSetScaleOutInput or JSON or IO[bytes] :return: An instance of LROPoller that returns OkResponse. The OkResponse is compatible with MutableMapping :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.OkResponse] @@ -13603,7 +13610,7 @@ def begin_scale_out( raw_result = self._scale_out_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, - body=body, + parameters=parameters, content_type=content_type, cls=lambda x, y, z: x, headers=_headers, @@ -13838,7 +13845,7 @@ def _create_or_update_initial( resource_group_name: str, vm_scale_set_name: str, vmss_extension_name: str, - resource: Union[_models.VirtualMachineScaleSetExtension, JSON, IO[bytes]], + extension_parameters: Union[_models.VirtualMachineScaleSetExtension, JSON, IO[bytes]], **kwargs: Any ) -> Iterator[bytes]: error_map: MutableMapping = { @@ -13857,10 +13864,10 @@ def _create_or_update_initial( content_type = content_type or "application/json" _content = None - if isinstance(resource, (IOBase, bytes)): - _content = resource + if isinstance(extension_parameters, (IOBase, bytes)): + _content = extension_parameters else: - _content = json.dumps(resource, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(extension_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore _request = build_virtual_machine_scale_set_extensions_create_or_update_request( resource_group_name=resource_group_name, @@ -13912,7 +13919,7 @@ def begin_create_or_update( resource_group_name: str, vm_scale_set_name: str, vmss_extension_name: str, - resource: _models.VirtualMachineScaleSetExtension, + extension_parameters: _models.VirtualMachineScaleSetExtension, *, content_type: str = "application/json", **kwargs: Any @@ -13926,8 +13933,9 @@ def begin_create_or_update( :type vm_scale_set_name: str :param vmss_extension_name: The name of the VM scale set extension. Required. :type vmss_extension_name: str - :param resource: Parameters supplied to the Create VM scale set Extension operation. Required. - :type resource: ~azure.mgmt.compute.models.VirtualMachineScaleSetExtension + :param extension_parameters: Parameters supplied to the Create VM scale set Extension + operation. Required. + :type extension_parameters: ~azure.mgmt.compute.models.VirtualMachineScaleSetExtension :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -13942,7 +13950,7 @@ def begin_create_or_update( resource_group_name: str, vm_scale_set_name: str, vmss_extension_name: str, - resource: JSON, + extension_parameters: JSON, *, content_type: str = "application/json", **kwargs: Any @@ -13956,8 +13964,9 @@ def begin_create_or_update( :type vm_scale_set_name: str :param vmss_extension_name: The name of the VM scale set extension. Required. :type vmss_extension_name: str - :param resource: Parameters supplied to the Create VM scale set Extension operation. Required. - :type resource: JSON + :param extension_parameters: Parameters supplied to the Create VM scale set Extension + operation. Required. + :type extension_parameters: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -13972,7 +13981,7 @@ def begin_create_or_update( resource_group_name: str, vm_scale_set_name: str, vmss_extension_name: str, - resource: IO[bytes], + extension_parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -13986,8 +13995,9 @@ def begin_create_or_update( :type vm_scale_set_name: str :param vmss_extension_name: The name of the VM scale set extension. Required. :type vmss_extension_name: str - :param resource: Parameters supplied to the Create VM scale set Extension operation. Required. - :type resource: IO[bytes] + :param extension_parameters: Parameters supplied to the Create VM scale set Extension + operation. Required. + :type extension_parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str @@ -14002,7 +14012,7 @@ def begin_create_or_update( resource_group_name: str, vm_scale_set_name: str, vmss_extension_name: str, - resource: Union[_models.VirtualMachineScaleSetExtension, JSON, IO[bytes]], + extension_parameters: Union[_models.VirtualMachineScaleSetExtension, JSON, IO[bytes]], **kwargs: Any ) -> LROPoller[None]: """The operation to create or update an extension. @@ -14014,9 +14024,11 @@ def begin_create_or_update( :type vm_scale_set_name: str :param vmss_extension_name: The name of the VM scale set extension. Required. :type vmss_extension_name: str - :param resource: Parameters supplied to the Create VM scale set Extension operation. Is one of - the following types: VirtualMachineScaleSetExtension, JSON, IO[bytes] Required. - :type resource: ~azure.mgmt.compute.models.VirtualMachineScaleSetExtension or JSON or IO[bytes] + :param extension_parameters: Parameters supplied to the Create VM scale set Extension + operation. Is one of the following types: VirtualMachineScaleSetExtension, JSON, IO[bytes] + Required. + :type extension_parameters: ~azure.mgmt.compute.models.VirtualMachineScaleSetExtension or JSON + or IO[bytes] :return: An instance of LROPoller that returns None :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -14034,7 +14046,7 @@ def begin_create_or_update( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vmss_extension_name=vmss_extension_name, - resource=resource, + extension_parameters=extension_parameters, content_type=content_type, cls=lambda x, y, z: x, headers=_headers, @@ -14074,7 +14086,7 @@ def _update_initial( resource_group_name: str, vm_scale_set_name: str, vmss_extension_name: str, - properties: Union[_models.VirtualMachineScaleSetExtensionUpdate, JSON, IO[bytes]], + extension_parameters: Union[_models.VirtualMachineScaleSetExtensionUpdate, JSON, IO[bytes]], **kwargs: Any ) -> Iterator[bytes]: error_map: MutableMapping = { @@ -14093,10 +14105,10 @@ def _update_initial( content_type = content_type or "application/json" _content = None - if isinstance(properties, (IOBase, bytes)): - _content = properties + if isinstance(extension_parameters, (IOBase, bytes)): + _content = extension_parameters else: - _content = json.dumps(properties, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(extension_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore _request = build_virtual_machine_scale_set_extensions_update_request( resource_group_name=resource_group_name, @@ -14148,7 +14160,7 @@ def begin_update( resource_group_name: str, vm_scale_set_name: str, vmss_extension_name: str, - properties: _models.VirtualMachineScaleSetExtensionUpdate, + extension_parameters: _models.VirtualMachineScaleSetExtensionUpdate, *, content_type: str = "application/json", **kwargs: Any @@ -14162,9 +14174,9 @@ def begin_update( :type vm_scale_set_name: str :param vmss_extension_name: The name of the VM scale set extension. Required. :type vmss_extension_name: str - :param properties: Parameters supplied to the Update VM scale set Extension operation. - Required. - :type properties: ~azure.mgmt.compute.models.VirtualMachineScaleSetExtensionUpdate + :param extension_parameters: Parameters supplied to the Update VM scale set Extension + operation. Required. + :type extension_parameters: ~azure.mgmt.compute.models.VirtualMachineScaleSetExtensionUpdate :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -14179,7 +14191,7 @@ def begin_update( resource_group_name: str, vm_scale_set_name: str, vmss_extension_name: str, - properties: JSON, + extension_parameters: JSON, *, content_type: str = "application/json", **kwargs: Any @@ -14193,9 +14205,9 @@ def begin_update( :type vm_scale_set_name: str :param vmss_extension_name: The name of the VM scale set extension. Required. :type vmss_extension_name: str - :param properties: Parameters supplied to the Update VM scale set Extension operation. - Required. - :type properties: JSON + :param extension_parameters: Parameters supplied to the Update VM scale set Extension + operation. Required. + :type extension_parameters: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -14210,7 +14222,7 @@ def begin_update( resource_group_name: str, vm_scale_set_name: str, vmss_extension_name: str, - properties: IO[bytes], + extension_parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -14224,9 +14236,9 @@ def begin_update( :type vm_scale_set_name: str :param vmss_extension_name: The name of the VM scale set extension. Required. :type vmss_extension_name: str - :param properties: Parameters supplied to the Update VM scale set Extension operation. - Required. - :type properties: IO[bytes] + :param extension_parameters: Parameters supplied to the Update VM scale set Extension + operation. Required. + :type extension_parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str @@ -14241,7 +14253,7 @@ def begin_update( resource_group_name: str, vm_scale_set_name: str, vmss_extension_name: str, - properties: Union[_models.VirtualMachineScaleSetExtensionUpdate, JSON, IO[bytes]], + extension_parameters: Union[_models.VirtualMachineScaleSetExtensionUpdate, JSON, IO[bytes]], **kwargs: Any ) -> LROPoller[None]: """The operation to update an extension. @@ -14253,10 +14265,11 @@ def begin_update( :type vm_scale_set_name: str :param vmss_extension_name: The name of the VM scale set extension. Required. :type vmss_extension_name: str - :param properties: Parameters supplied to the Update VM scale set Extension operation. Is one - of the following types: VirtualMachineScaleSetExtensionUpdate, JSON, IO[bytes] Required. - :type properties: ~azure.mgmt.compute.models.VirtualMachineScaleSetExtensionUpdate or JSON or - IO[bytes] + :param extension_parameters: Parameters supplied to the Update VM scale set Extension + operation. Is one of the following types: VirtualMachineScaleSetExtensionUpdate, JSON, + IO[bytes] Required. + :type extension_parameters: ~azure.mgmt.compute.models.VirtualMachineScaleSetExtensionUpdate or + JSON or IO[bytes] :return: An instance of LROPoller that returns None :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -14274,7 +14287,7 @@ def begin_update( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vmss_extension_name=vmss_extension_name, - properties=properties, + extension_parameters=extension_parameters, content_type=content_type, cls=lambda x, y, z: x, headers=_headers, @@ -14630,7 +14643,7 @@ def _update_initial( resource_group_name: str, vm_scale_set_name: str, instance_id: str, - resource: Union[_models.VirtualMachineScaleSetVM, JSON, IO[bytes]], + parameters: Union[_models.VirtualMachineScaleSetVM, JSON, IO[bytes]], *, etag: Optional[str] = None, match_condition: Optional[MatchConditions] = None, @@ -14658,10 +14671,10 @@ def _update_initial( content_type = content_type or "application/json" _content = None - if isinstance(resource, (IOBase, bytes)): - _content = resource + if isinstance(parameters, (IOBase, bytes)): + _content = parameters else: - _content = json.dumps(resource, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore _request = build_virtual_machine_scale_set_vms_update_request( resource_group_name=resource_group_name, @@ -14715,7 +14728,7 @@ def begin_update( resource_group_name: str, vm_scale_set_name: str, instance_id: str, - resource: _models.VirtualMachineScaleSetVM, + parameters: _models.VirtualMachineScaleSetVM, *, content_type: str = "application/json", etag: Optional[str] = None, @@ -14731,9 +14744,9 @@ def begin_update( :type vm_scale_set_name: str :param instance_id: The instance ID of the virtual machine. Required. :type instance_id: str - :param resource: Parameters supplied to the Update Virtual Machine Scale Sets VM operation. + :param parameters: Parameters supplied to the Update Virtual Machine Scale Sets VM operation. Required. - :type resource: ~azure.mgmt.compute.models.VirtualMachineScaleSetVM + :type parameters: ~azure.mgmt.compute.models.VirtualMachineScaleSetVM :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -14753,7 +14766,7 @@ def begin_update( resource_group_name: str, vm_scale_set_name: str, instance_id: str, - resource: JSON, + parameters: JSON, *, content_type: str = "application/json", etag: Optional[str] = None, @@ -14769,9 +14782,9 @@ def begin_update( :type vm_scale_set_name: str :param instance_id: The instance ID of the virtual machine. Required. :type instance_id: str - :param resource: Parameters supplied to the Update Virtual Machine Scale Sets VM operation. + :param parameters: Parameters supplied to the Update Virtual Machine Scale Sets VM operation. Required. - :type resource: JSON + :type parameters: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -14791,7 +14804,7 @@ def begin_update( resource_group_name: str, vm_scale_set_name: str, instance_id: str, - resource: IO[bytes], + parameters: IO[bytes], *, content_type: str = "application/json", etag: Optional[str] = None, @@ -14807,9 +14820,9 @@ def begin_update( :type vm_scale_set_name: str :param instance_id: The instance ID of the virtual machine. Required. :type instance_id: str - :param resource: Parameters supplied to the Update Virtual Machine Scale Sets VM operation. + :param parameters: Parameters supplied to the Update Virtual Machine Scale Sets VM operation. Required. - :type resource: IO[bytes] + :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str @@ -14829,7 +14842,7 @@ def begin_update( resource_group_name: str, vm_scale_set_name: str, instance_id: str, - resource: Union[_models.VirtualMachineScaleSetVM, JSON, IO[bytes]], + parameters: Union[_models.VirtualMachineScaleSetVM, JSON, IO[bytes]], *, etag: Optional[str] = None, match_condition: Optional[MatchConditions] = None, @@ -14844,9 +14857,9 @@ def begin_update( :type vm_scale_set_name: str :param instance_id: The instance ID of the virtual machine. Required. :type instance_id: str - :param resource: Parameters supplied to the Update Virtual Machine Scale Sets VM operation. Is - one of the following types: VirtualMachineScaleSetVM, JSON, IO[bytes] Required. - :type resource: ~azure.mgmt.compute.models.VirtualMachineScaleSetVM or JSON or IO[bytes] + :param parameters: Parameters supplied to the Update Virtual Machine Scale Sets VM operation. + Is one of the following types: VirtualMachineScaleSetVM, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.compute.models.VirtualMachineScaleSetVM or JSON or IO[bytes] :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is None. :paramtype etag: str @@ -14869,7 +14882,7 @@ def begin_update( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, - resource=resource, + parameters=parameters, etag=etag, match_condition=match_condition, content_type=content_type, @@ -15938,7 +15951,7 @@ def _attach_detach_data_disks_initial( resource_group_name: str, vm_scale_set_name: str, instance_id: str, - body: Union[_models.AttachDetachDataDisksRequest, JSON, IO[bytes]], + parameters: Union[_models.AttachDetachDataDisksRequest, JSON, IO[bytes]], **kwargs: Any ) -> Iterator[bytes]: error_map: MutableMapping = { @@ -15957,10 +15970,10 @@ def _attach_detach_data_disks_initial( content_type = content_type or "application/json" _content = None - if isinstance(body, (IOBase, bytes)): - _content = body + if isinstance(parameters, (IOBase, bytes)): + _content = parameters else: - _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore _request = build_virtual_machine_scale_set_vms_attach_detach_data_disks_request( resource_group_name=resource_group_name, @@ -16012,7 +16025,7 @@ def begin_attach_detach_data_disks( resource_group_name: str, vm_scale_set_name: str, instance_id: str, - body: _models.AttachDetachDataDisksRequest, + parameters: _models.AttachDetachDataDisksRequest, *, content_type: str = "application/json", **kwargs: Any @@ -16026,9 +16039,9 @@ def begin_attach_detach_data_disks( :type vm_scale_set_name: str :param instance_id: The instance ID of the virtual machine. Required. :type instance_id: str - :param body: Parameters supplied to the attach and detach data disks operation on a Virtual - Machine Scale Sets VM. Required. - :type body: ~azure.mgmt.compute.models.AttachDetachDataDisksRequest + :param parameters: Parameters supplied to the attach and detach data disks operation on a + Virtual Machine Scale Sets VM. Required. + :type parameters: ~azure.mgmt.compute.models.AttachDetachDataDisksRequest :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -16044,7 +16057,7 @@ def begin_attach_detach_data_disks( resource_group_name: str, vm_scale_set_name: str, instance_id: str, - body: JSON, + parameters: JSON, *, content_type: str = "application/json", **kwargs: Any @@ -16058,9 +16071,9 @@ def begin_attach_detach_data_disks( :type vm_scale_set_name: str :param instance_id: The instance ID of the virtual machine. Required. :type instance_id: str - :param body: Parameters supplied to the attach and detach data disks operation on a Virtual - Machine Scale Sets VM. Required. - :type body: JSON + :param parameters: Parameters supplied to the attach and detach data disks operation on a + Virtual Machine Scale Sets VM. Required. + :type parameters: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -16076,7 +16089,7 @@ def begin_attach_detach_data_disks( resource_group_name: str, vm_scale_set_name: str, instance_id: str, - body: IO[bytes], + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -16090,9 +16103,9 @@ def begin_attach_detach_data_disks( :type vm_scale_set_name: str :param instance_id: The instance ID of the virtual machine. Required. :type instance_id: str - :param body: Parameters supplied to the attach and detach data disks operation on a Virtual - Machine Scale Sets VM. Required. - :type body: IO[bytes] + :param parameters: Parameters supplied to the attach and detach data disks operation on a + Virtual Machine Scale Sets VM. Required. + :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str @@ -16108,7 +16121,7 @@ def begin_attach_detach_data_disks( resource_group_name: str, vm_scale_set_name: str, instance_id: str, - body: Union[_models.AttachDetachDataDisksRequest, JSON, IO[bytes]], + parameters: Union[_models.AttachDetachDataDisksRequest, JSON, IO[bytes]], **kwargs: Any ) -> LROPoller[_models.StorageProfile]: """Attach and detach data disks to/from a virtual machine in a VM scale set. @@ -16120,10 +16133,10 @@ def begin_attach_detach_data_disks( :type vm_scale_set_name: str :param instance_id: The instance ID of the virtual machine. Required. :type instance_id: str - :param body: Parameters supplied to the attach and detach data disks operation on a Virtual - Machine Scale Sets VM. Is one of the following types: AttachDetachDataDisksRequest, JSON, - IO[bytes] Required. - :type body: ~azure.mgmt.compute.models.AttachDetachDataDisksRequest or JSON or IO[bytes] + :param parameters: Parameters supplied to the attach and detach data disks operation on a + Virtual Machine Scale Sets VM. Is one of the following types: AttachDetachDataDisksRequest, + JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.compute.models.AttachDetachDataDisksRequest or JSON or IO[bytes] :return: An instance of LROPoller that returns StorageProfile. The StorageProfile is compatible with MutableMapping :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.StorageProfile] @@ -16142,7 +16155,7 @@ def begin_attach_detach_data_disks( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, - body=body, + parameters=parameters, content_type=content_type, cls=lambda x, y, z: x, headers=_headers, @@ -16946,7 +16959,7 @@ def _run_command_initial( resource_group_name: str, vm_scale_set_name: str, instance_id: str, - body: Union[_models.RunCommandInput, JSON, IO[bytes]], + parameters: Union[_models.RunCommandInput, JSON, IO[bytes]], **kwargs: Any ) -> Iterator[bytes]: error_map: MutableMapping = { @@ -16965,10 +16978,10 @@ def _run_command_initial( content_type = content_type or "application/json" _content = None - if isinstance(body, (IOBase, bytes)): - _content = body + if isinstance(parameters, (IOBase, bytes)): + _content = parameters else: - _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore _request = build_virtual_machine_scale_set_vms_run_command_request( resource_group_name=resource_group_name, @@ -17020,7 +17033,7 @@ def begin_run_command( resource_group_name: str, vm_scale_set_name: str, instance_id: str, - body: _models.RunCommandInput, + parameters: _models.RunCommandInput, *, content_type: str = "application/json", **kwargs: Any @@ -17034,8 +17047,8 @@ def begin_run_command( :type vm_scale_set_name: str :param instance_id: The instance ID of the virtual machine. Required. :type instance_id: str - :param body: Parameters supplied to the Run command operation. Required. - :type body: ~azure.mgmt.compute.models.RunCommandInput + :param parameters: Parameters supplied to the Run command operation. Required. + :type parameters: ~azure.mgmt.compute.models.RunCommandInput :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -17051,7 +17064,7 @@ def begin_run_command( resource_group_name: str, vm_scale_set_name: str, instance_id: str, - body: JSON, + parameters: JSON, *, content_type: str = "application/json", **kwargs: Any @@ -17065,8 +17078,8 @@ def begin_run_command( :type vm_scale_set_name: str :param instance_id: The instance ID of the virtual machine. Required. :type instance_id: str - :param body: Parameters supplied to the Run command operation. Required. - :type body: JSON + :param parameters: Parameters supplied to the Run command operation. Required. + :type parameters: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -17082,7 +17095,7 @@ def begin_run_command( resource_group_name: str, vm_scale_set_name: str, instance_id: str, - body: IO[bytes], + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -17096,8 +17109,8 @@ def begin_run_command( :type vm_scale_set_name: str :param instance_id: The instance ID of the virtual machine. Required. :type instance_id: str - :param body: Parameters supplied to the Run command operation. Required. - :type body: IO[bytes] + :param parameters: Parameters supplied to the Run command operation. Required. + :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str @@ -17113,7 +17126,7 @@ def begin_run_command( resource_group_name: str, vm_scale_set_name: str, instance_id: str, - body: Union[_models.RunCommandInput, JSON, IO[bytes]], + parameters: Union[_models.RunCommandInput, JSON, IO[bytes]], **kwargs: Any ) -> LROPoller[_models.RunCommandResult]: """Run command on a virtual machine in a VM scale set. @@ -17125,9 +17138,9 @@ def begin_run_command( :type vm_scale_set_name: str :param instance_id: The instance ID of the virtual machine. Required. :type instance_id: str - :param body: Parameters supplied to the Run command operation. Is one of the following types: - RunCommandInput, JSON, IO[bytes] Required. - :type body: ~azure.mgmt.compute.models.RunCommandInput or JSON or IO[bytes] + :param parameters: Parameters supplied to the Run command operation. Is one of the following + types: RunCommandInput, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.compute.models.RunCommandInput or JSON or IO[bytes] :return: An instance of LROPoller that returns RunCommandResult. The RunCommandResult is compatible with MutableMapping :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.RunCommandResult] @@ -17146,7 +17159,7 @@ def begin_run_command( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, - body=body, + parameters=parameters, content_type=content_type, cls=lambda x, y, z: x, headers=_headers, @@ -17299,7 +17312,7 @@ def _create_or_update_initial( vm_scale_set_name: str, instance_id: str, vm_extension_name: str, - resource: Union[_models.VirtualMachineScaleSetVMExtension, JSON, IO[bytes]], + extension_parameters: Union[_models.VirtualMachineScaleSetVMExtension, JSON, IO[bytes]], **kwargs: Any ) -> Iterator[bytes]: error_map: MutableMapping = { @@ -17318,10 +17331,10 @@ def _create_or_update_initial( content_type = content_type or "application/json" _content = None - if isinstance(resource, (IOBase, bytes)): - _content = resource + if isinstance(extension_parameters, (IOBase, bytes)): + _content = extension_parameters else: - _content = json.dumps(resource, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(extension_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore _request = build_virtual_machine_scale_set_vm_extensions_create_or_update_request( resource_group_name=resource_group_name, @@ -17375,7 +17388,7 @@ def begin_create_or_update( vm_scale_set_name: str, instance_id: str, vm_extension_name: str, - resource: _models.VirtualMachineScaleSetVMExtension, + extension_parameters: _models.VirtualMachineScaleSetVMExtension, *, content_type: str = "application/json", **kwargs: Any @@ -17391,9 +17404,9 @@ def begin_create_or_update( :type instance_id: str :param vm_extension_name: The name of the virtual machine extension. Required. :type vm_extension_name: str - :param resource: Parameters supplied to the Create Virtual Machine Extension operation. - Required. - :type resource: ~azure.mgmt.compute.models.VirtualMachineScaleSetVMExtension + :param extension_parameters: Parameters supplied to the Create Virtual Machine Extension + operation. Required. + :type extension_parameters: ~azure.mgmt.compute.models.VirtualMachineScaleSetVMExtension :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -17409,7 +17422,7 @@ def begin_create_or_update( vm_scale_set_name: str, instance_id: str, vm_extension_name: str, - resource: JSON, + extension_parameters: JSON, *, content_type: str = "application/json", **kwargs: Any @@ -17425,9 +17438,9 @@ def begin_create_or_update( :type instance_id: str :param vm_extension_name: The name of the virtual machine extension. Required. :type vm_extension_name: str - :param resource: Parameters supplied to the Create Virtual Machine Extension operation. - Required. - :type resource: JSON + :param extension_parameters: Parameters supplied to the Create Virtual Machine Extension + operation. Required. + :type extension_parameters: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -17443,7 +17456,7 @@ def begin_create_or_update( vm_scale_set_name: str, instance_id: str, vm_extension_name: str, - resource: IO[bytes], + extension_parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -17459,9 +17472,9 @@ def begin_create_or_update( :type instance_id: str :param vm_extension_name: The name of the virtual machine extension. Required. :type vm_extension_name: str - :param resource: Parameters supplied to the Create Virtual Machine Extension operation. - Required. - :type resource: IO[bytes] + :param extension_parameters: Parameters supplied to the Create Virtual Machine Extension + operation. Required. + :type extension_parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str @@ -17477,7 +17490,7 @@ def begin_create_or_update( vm_scale_set_name: str, instance_id: str, vm_extension_name: str, - resource: Union[_models.VirtualMachineScaleSetVMExtension, JSON, IO[bytes]], + extension_parameters: Union[_models.VirtualMachineScaleSetVMExtension, JSON, IO[bytes]], **kwargs: Any ) -> LROPoller[None]: """The operation to create or update the VMSS VM extension. @@ -17491,10 +17504,11 @@ def begin_create_or_update( :type instance_id: str :param vm_extension_name: The name of the virtual machine extension. Required. :type vm_extension_name: str - :param resource: Parameters supplied to the Create Virtual Machine Extension operation. Is one - of the following types: VirtualMachineScaleSetVMExtension, JSON, IO[bytes] Required. - :type resource: ~azure.mgmt.compute.models.VirtualMachineScaleSetVMExtension or JSON or - IO[bytes] + :param extension_parameters: Parameters supplied to the Create Virtual Machine Extension + operation. Is one of the following types: VirtualMachineScaleSetVMExtension, JSON, IO[bytes] + Required. + :type extension_parameters: ~azure.mgmt.compute.models.VirtualMachineScaleSetVMExtension or + JSON or IO[bytes] :return: An instance of LROPoller that returns None :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -17513,7 +17527,7 @@ def begin_create_or_update( vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, vm_extension_name=vm_extension_name, - resource=resource, + extension_parameters=extension_parameters, content_type=content_type, cls=lambda x, y, z: x, headers=_headers, @@ -17554,7 +17568,7 @@ def _update_initial( vm_scale_set_name: str, instance_id: str, vm_extension_name: str, - properties: Union[_models.VirtualMachineScaleSetVMExtensionUpdate, JSON, IO[bytes]], + extension_parameters: Union[_models.VirtualMachineScaleSetVMExtensionUpdate, JSON, IO[bytes]], **kwargs: Any ) -> Iterator[bytes]: error_map: MutableMapping = { @@ -17573,10 +17587,10 @@ def _update_initial( content_type = content_type or "application/json" _content = None - if isinstance(properties, (IOBase, bytes)): - _content = properties + if isinstance(extension_parameters, (IOBase, bytes)): + _content = extension_parameters else: - _content = json.dumps(properties, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(extension_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore _request = build_virtual_machine_scale_set_vm_extensions_update_request( resource_group_name=resource_group_name, @@ -17629,7 +17643,7 @@ def begin_update( vm_scale_set_name: str, instance_id: str, vm_extension_name: str, - properties: _models.VirtualMachineScaleSetVMExtensionUpdate, + extension_parameters: _models.VirtualMachineScaleSetVMExtensionUpdate, *, content_type: str = "application/json", **kwargs: Any @@ -17645,9 +17659,9 @@ def begin_update( :type instance_id: str :param vm_extension_name: The name of the virtual machine extension. Required. :type vm_extension_name: str - :param properties: Parameters supplied to the Update Virtual Machine Extension operation. - Required. - :type properties: ~azure.mgmt.compute.models.VirtualMachineScaleSetVMExtensionUpdate + :param extension_parameters: Parameters supplied to the Update Virtual Machine Extension + operation. Required. + :type extension_parameters: ~azure.mgmt.compute.models.VirtualMachineScaleSetVMExtensionUpdate :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -17663,7 +17677,7 @@ def begin_update( vm_scale_set_name: str, instance_id: str, vm_extension_name: str, - properties: JSON, + extension_parameters: JSON, *, content_type: str = "application/json", **kwargs: Any @@ -17679,9 +17693,9 @@ def begin_update( :type instance_id: str :param vm_extension_name: The name of the virtual machine extension. Required. :type vm_extension_name: str - :param properties: Parameters supplied to the Update Virtual Machine Extension operation. - Required. - :type properties: JSON + :param extension_parameters: Parameters supplied to the Update Virtual Machine Extension + operation. Required. + :type extension_parameters: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -17697,7 +17711,7 @@ def begin_update( vm_scale_set_name: str, instance_id: str, vm_extension_name: str, - properties: IO[bytes], + extension_parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -17713,9 +17727,9 @@ def begin_update( :type instance_id: str :param vm_extension_name: The name of the virtual machine extension. Required. :type vm_extension_name: str - :param properties: Parameters supplied to the Update Virtual Machine Extension operation. - Required. - :type properties: IO[bytes] + :param extension_parameters: Parameters supplied to the Update Virtual Machine Extension + operation. Required. + :type extension_parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str @@ -17731,7 +17745,7 @@ def begin_update( vm_scale_set_name: str, instance_id: str, vm_extension_name: str, - properties: Union[_models.VirtualMachineScaleSetVMExtensionUpdate, JSON, IO[bytes]], + extension_parameters: Union[_models.VirtualMachineScaleSetVMExtensionUpdate, JSON, IO[bytes]], **kwargs: Any ) -> LROPoller[None]: """The operation to update the VMSS VM extension. @@ -17745,10 +17759,11 @@ def begin_update( :type instance_id: str :param vm_extension_name: The name of the virtual machine extension. Required. :type vm_extension_name: str - :param properties: Parameters supplied to the Update Virtual Machine Extension operation. Is - one of the following types: VirtualMachineScaleSetVMExtensionUpdate, JSON, IO[bytes] Required. - :type properties: ~azure.mgmt.compute.models.VirtualMachineScaleSetVMExtensionUpdate or JSON or - IO[bytes] + :param extension_parameters: Parameters supplied to the Update Virtual Machine Extension + operation. Is one of the following types: VirtualMachineScaleSetVMExtensionUpdate, JSON, + IO[bytes] Required. + :type extension_parameters: ~azure.mgmt.compute.models.VirtualMachineScaleSetVMExtensionUpdate + or JSON or IO[bytes] :return: An instance of LROPoller that returns None :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -17767,7 +17782,7 @@ def begin_update( vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, vm_extension_name=vm_extension_name, - properties=properties, + extension_parameters=extension_parameters, content_type=content_type, cls=lambda x, y, z: x, headers=_headers, @@ -18134,7 +18149,7 @@ def _create_or_update_initial( self, resource_group_name: str, vm_name: str, - resource: Union[_models.VirtualMachine, JSON, IO[bytes]], + parameters: Union[_models.VirtualMachine, JSON, IO[bytes]], *, etag: Optional[str] = None, match_condition: Optional[MatchConditions] = None, @@ -18162,10 +18177,10 @@ def _create_or_update_initial( content_type = content_type or "application/json" _content = None - if isinstance(resource, (IOBase, bytes)): - _content = resource + if isinstance(parameters, (IOBase, bytes)): + _content = parameters else: - _content = json.dumps(resource, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore _request = build_virtual_machines_create_or_update_request( resource_group_name=resource_group_name, @@ -18217,7 +18232,7 @@ def begin_create_or_update( self, resource_group_name: str, vm_name: str, - resource: _models.VirtualMachine, + parameters: _models.VirtualMachine, *, content_type: str = "application/json", etag: Optional[str] = None, @@ -18232,8 +18247,8 @@ def begin_create_or_update( :type resource_group_name: str :param vm_name: The name of the virtual machine. Required. :type vm_name: str - :param resource: Parameters supplied to the Create Virtual Machine operation. Required. - :type resource: ~azure.mgmt.compute.models.VirtualMachine + :param parameters: Parameters supplied to the Create Virtual Machine operation. Required. + :type parameters: ~azure.mgmt.compute.models.VirtualMachine :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -18252,7 +18267,7 @@ def begin_create_or_update( self, resource_group_name: str, vm_name: str, - resource: JSON, + parameters: JSON, *, content_type: str = "application/json", etag: Optional[str] = None, @@ -18267,8 +18282,8 @@ def begin_create_or_update( :type resource_group_name: str :param vm_name: The name of the virtual machine. Required. :type vm_name: str - :param resource: Parameters supplied to the Create Virtual Machine operation. Required. - :type resource: JSON + :param parameters: Parameters supplied to the Create Virtual Machine operation. Required. + :type parameters: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -18287,7 +18302,7 @@ def begin_create_or_update( self, resource_group_name: str, vm_name: str, - resource: IO[bytes], + parameters: IO[bytes], *, content_type: str = "application/json", etag: Optional[str] = None, @@ -18302,8 +18317,8 @@ def begin_create_or_update( :type resource_group_name: str :param vm_name: The name of the virtual machine. Required. :type vm_name: str - :param resource: Parameters supplied to the Create Virtual Machine operation. Required. - :type resource: IO[bytes] + :param parameters: Parameters supplied to the Create Virtual Machine operation. Required. + :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str @@ -18322,7 +18337,7 @@ def begin_create_or_update( self, resource_group_name: str, vm_name: str, - resource: Union[_models.VirtualMachine, JSON, IO[bytes]], + parameters: Union[_models.VirtualMachine, JSON, IO[bytes]], *, etag: Optional[str] = None, match_condition: Optional[MatchConditions] = None, @@ -18336,9 +18351,9 @@ def begin_create_or_update( :type resource_group_name: str :param vm_name: The name of the virtual machine. Required. :type vm_name: str - :param resource: Parameters supplied to the Create Virtual Machine operation. Is one of the + :param parameters: Parameters supplied to the Create Virtual Machine operation. Is one of the following types: VirtualMachine, JSON, IO[bytes] Required. - :type resource: ~azure.mgmt.compute.models.VirtualMachine or JSON or IO[bytes] + :type parameters: ~azure.mgmt.compute.models.VirtualMachine or JSON or IO[bytes] :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is None. :paramtype etag: str @@ -18360,7 +18375,7 @@ def begin_create_or_update( raw_result = self._create_or_update_initial( resource_group_name=resource_group_name, vm_name=vm_name, - resource=resource, + parameters=parameters, etag=etag, match_condition=match_condition, content_type=content_type, @@ -18401,7 +18416,7 @@ def _update_initial( self, resource_group_name: str, vm_name: str, - properties: Union[_models.VirtualMachineUpdate, JSON, IO[bytes]], + parameters: Union[_models.VirtualMachineUpdate, JSON, IO[bytes]], *, etag: Optional[str] = None, match_condition: Optional[MatchConditions] = None, @@ -18429,10 +18444,10 @@ def _update_initial( content_type = content_type or "application/json" _content = None - if isinstance(properties, (IOBase, bytes)): - _content = properties + if isinstance(parameters, (IOBase, bytes)): + _content = parameters else: - _content = json.dumps(properties, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore _request = build_virtual_machines_update_request( resource_group_name=resource_group_name, @@ -18483,7 +18498,7 @@ def begin_update( self, resource_group_name: str, vm_name: str, - properties: _models.VirtualMachineUpdate, + parameters: _models.VirtualMachineUpdate, *, content_type: str = "application/json", etag: Optional[str] = None, @@ -18497,8 +18512,8 @@ def begin_update( :type resource_group_name: str :param vm_name: The name of the virtual machine. Required. :type vm_name: str - :param properties: Parameters supplied to the Update Virtual Machine operation. Required. - :type properties: ~azure.mgmt.compute.models.VirtualMachineUpdate + :param parameters: Parameters supplied to the Update Virtual Machine operation. Required. + :type parameters: ~azure.mgmt.compute.models.VirtualMachineUpdate :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -18517,7 +18532,7 @@ def begin_update( self, resource_group_name: str, vm_name: str, - properties: JSON, + parameters: JSON, *, content_type: str = "application/json", etag: Optional[str] = None, @@ -18531,8 +18546,8 @@ def begin_update( :type resource_group_name: str :param vm_name: The name of the virtual machine. Required. :type vm_name: str - :param properties: Parameters supplied to the Update Virtual Machine operation. Required. - :type properties: JSON + :param parameters: Parameters supplied to the Update Virtual Machine operation. Required. + :type parameters: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -18551,7 +18566,7 @@ def begin_update( self, resource_group_name: str, vm_name: str, - properties: IO[bytes], + parameters: IO[bytes], *, content_type: str = "application/json", etag: Optional[str] = None, @@ -18565,8 +18580,8 @@ def begin_update( :type resource_group_name: str :param vm_name: The name of the virtual machine. Required. :type vm_name: str - :param properties: Parameters supplied to the Update Virtual Machine operation. Required. - :type properties: IO[bytes] + :param parameters: Parameters supplied to the Update Virtual Machine operation. Required. + :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str @@ -18585,7 +18600,7 @@ def begin_update( self, resource_group_name: str, vm_name: str, - properties: Union[_models.VirtualMachineUpdate, JSON, IO[bytes]], + parameters: Union[_models.VirtualMachineUpdate, JSON, IO[bytes]], *, etag: Optional[str] = None, match_condition: Optional[MatchConditions] = None, @@ -18598,9 +18613,9 @@ def begin_update( :type resource_group_name: str :param vm_name: The name of the virtual machine. Required. :type vm_name: str - :param properties: Parameters supplied to the Update Virtual Machine operation. Is one of the + :param parameters: Parameters supplied to the Update Virtual Machine operation. Is one of the following types: VirtualMachineUpdate, JSON, IO[bytes] Required. - :type properties: ~azure.mgmt.compute.models.VirtualMachineUpdate or JSON or IO[bytes] + :type parameters: ~azure.mgmt.compute.models.VirtualMachineUpdate or JSON or IO[bytes] :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is None. :paramtype etag: str @@ -18622,7 +18637,7 @@ def begin_update( raw_result = self._update_initial( resource_group_name=resource_group_name, vm_name=vm_name, - properties=properties, + parameters=parameters, etag=etag, match_condition=match_condition, content_type=content_type, @@ -19123,7 +19138,7 @@ def _attach_detach_data_disks_initial( self, resource_group_name: str, vm_name: str, - body: Union[_models.AttachDetachDataDisksRequest, JSON, IO[bytes]], + parameters: Union[_models.AttachDetachDataDisksRequest, JSON, IO[bytes]], **kwargs: Any ) -> Iterator[bytes]: error_map: MutableMapping = { @@ -19142,10 +19157,10 @@ def _attach_detach_data_disks_initial( content_type = content_type or "application/json" _content = None - if isinstance(body, (IOBase, bytes)): - _content = body + if isinstance(parameters, (IOBase, bytes)): + _content = parameters else: - _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore _request = build_virtual_machines_attach_detach_data_disks_request( resource_group_name=resource_group_name, @@ -19195,7 +19210,7 @@ def begin_attach_detach_data_disks( self, resource_group_name: str, vm_name: str, - body: _models.AttachDetachDataDisksRequest, + parameters: _models.AttachDetachDataDisksRequest, *, content_type: str = "application/json", **kwargs: Any @@ -19207,9 +19222,9 @@ def begin_attach_detach_data_disks( :type resource_group_name: str :param vm_name: The name of the virtual machine. Required. :type vm_name: str - :param body: Parameters supplied to the attach and detach data disks operation on the virtual - machine. Required. - :type body: ~azure.mgmt.compute.models.AttachDetachDataDisksRequest + :param parameters: Parameters supplied to the attach and detach data disks operation on the + virtual machine. Required. + :type parameters: ~azure.mgmt.compute.models.AttachDetachDataDisksRequest :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -19224,7 +19239,7 @@ def begin_attach_detach_data_disks( self, resource_group_name: str, vm_name: str, - body: JSON, + parameters: JSON, *, content_type: str = "application/json", **kwargs: Any @@ -19236,9 +19251,9 @@ def begin_attach_detach_data_disks( :type resource_group_name: str :param vm_name: The name of the virtual machine. Required. :type vm_name: str - :param body: Parameters supplied to the attach and detach data disks operation on the virtual - machine. Required. - :type body: JSON + :param parameters: Parameters supplied to the attach and detach data disks operation on the + virtual machine. Required. + :type parameters: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -19253,7 +19268,7 @@ def begin_attach_detach_data_disks( self, resource_group_name: str, vm_name: str, - body: IO[bytes], + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -19265,9 +19280,9 @@ def begin_attach_detach_data_disks( :type resource_group_name: str :param vm_name: The name of the virtual machine. Required. :type vm_name: str - :param body: Parameters supplied to the attach and detach data disks operation on the virtual - machine. Required. - :type body: IO[bytes] + :param parameters: Parameters supplied to the attach and detach data disks operation on the + virtual machine. Required. + :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str @@ -19282,7 +19297,7 @@ def begin_attach_detach_data_disks( self, resource_group_name: str, vm_name: str, - body: Union[_models.AttachDetachDataDisksRequest, JSON, IO[bytes]], + parameters: Union[_models.AttachDetachDataDisksRequest, JSON, IO[bytes]], **kwargs: Any ) -> LROPoller[_models.StorageProfile]: """Attach and detach data disks to/from the virtual machine. @@ -19292,9 +19307,10 @@ def begin_attach_detach_data_disks( :type resource_group_name: str :param vm_name: The name of the virtual machine. Required. :type vm_name: str - :param body: Parameters supplied to the attach and detach data disks operation on the virtual - machine. Is one of the following types: AttachDetachDataDisksRequest, JSON, IO[bytes] Required. - :type body: ~azure.mgmt.compute.models.AttachDetachDataDisksRequest or JSON or IO[bytes] + :param parameters: Parameters supplied to the attach and detach data disks operation on the + virtual machine. Is one of the following types: AttachDetachDataDisksRequest, JSON, IO[bytes] + Required. + :type parameters: ~azure.mgmt.compute.models.AttachDetachDataDisksRequest or JSON or IO[bytes] :return: An instance of LROPoller that returns StorageProfile. The StorageProfile is compatible with MutableMapping :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.StorageProfile] @@ -19312,7 +19328,7 @@ def begin_attach_detach_data_disks( raw_result = self._attach_detach_data_disks_initial( resource_group_name=resource_group_name, vm_name=vm_name, - body=body, + parameters=parameters, content_type=content_type, cls=lambda x, y, z: x, headers=_headers, @@ -19360,7 +19376,7 @@ def _capture_initial( self, resource_group_name: str, vm_name: str, - body: Union[_models.VirtualMachineCaptureParameters, JSON, IO[bytes]], + parameters: Union[_models.VirtualMachineCaptureParameters, JSON, IO[bytes]], **kwargs: Any ) -> Iterator[bytes]: error_map: MutableMapping = { @@ -19379,10 +19395,10 @@ def _capture_initial( content_type = content_type or "application/json" _content = None - if isinstance(body, (IOBase, bytes)): - _content = body + if isinstance(parameters, (IOBase, bytes)): + _content = parameters else: - _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore _request = build_virtual_machines_capture_request( resource_group_name=resource_group_name, @@ -19432,7 +19448,7 @@ def begin_capture( self, resource_group_name: str, vm_name: str, - body: _models.VirtualMachineCaptureParameters, + parameters: _models.VirtualMachineCaptureParameters, *, content_type: str = "application/json", **kwargs: Any @@ -19445,8 +19461,8 @@ def begin_capture( :type resource_group_name: str :param vm_name: The name of the virtual machine. Required. :type vm_name: str - :param body: Parameters supplied to the Capture Virtual Machine operation. Required. - :type body: ~azure.mgmt.compute.models.VirtualMachineCaptureParameters + :param parameters: Parameters supplied to the Capture Virtual Machine operation. Required. + :type parameters: ~azure.mgmt.compute.models.VirtualMachineCaptureParameters :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -19461,7 +19477,7 @@ def begin_capture( self, resource_group_name: str, vm_name: str, - body: JSON, + parameters: JSON, *, content_type: str = "application/json", **kwargs: Any @@ -19474,8 +19490,8 @@ def begin_capture( :type resource_group_name: str :param vm_name: The name of the virtual machine. Required. :type vm_name: str - :param body: Parameters supplied to the Capture Virtual Machine operation. Required. - :type body: JSON + :param parameters: Parameters supplied to the Capture Virtual Machine operation. Required. + :type parameters: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -19490,7 +19506,7 @@ def begin_capture( self, resource_group_name: str, vm_name: str, - body: IO[bytes], + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -19503,8 +19519,8 @@ def begin_capture( :type resource_group_name: str :param vm_name: The name of the virtual machine. Required. :type vm_name: str - :param body: Parameters supplied to the Capture Virtual Machine operation. Required. - :type body: IO[bytes] + :param parameters: Parameters supplied to the Capture Virtual Machine operation. Required. + :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str @@ -19519,7 +19535,7 @@ def begin_capture( self, resource_group_name: str, vm_name: str, - body: Union[_models.VirtualMachineCaptureParameters, JSON, IO[bytes]], + parameters: Union[_models.VirtualMachineCaptureParameters, JSON, IO[bytes]], **kwargs: Any ) -> LROPoller[_models.VirtualMachineCaptureResult]: """Captures the VM by copying virtual hard disks of the VM and outputs a template that can be used @@ -19530,9 +19546,10 @@ def begin_capture( :type resource_group_name: str :param vm_name: The name of the virtual machine. Required. :type vm_name: str - :param body: Parameters supplied to the Capture Virtual Machine operation. Is one of the + :param parameters: Parameters supplied to the Capture Virtual Machine operation. Is one of the following types: VirtualMachineCaptureParameters, JSON, IO[bytes] Required. - :type body: ~azure.mgmt.compute.models.VirtualMachineCaptureParameters or JSON or IO[bytes] + :type parameters: ~azure.mgmt.compute.models.VirtualMachineCaptureParameters or JSON or + IO[bytes] :return: An instance of LROPoller that returns VirtualMachineCaptureResult. The VirtualMachineCaptureResult is compatible with MutableMapping :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.VirtualMachineCaptureResult] @@ -19550,7 +19567,7 @@ def begin_capture( raw_result = self._capture_initial( resource_group_name=resource_group_name, vm_name=vm_name, - body=body, + parameters=parameters, content_type=content_type, cls=lambda x, y, z: x, headers=_headers, @@ -19917,7 +19934,7 @@ def _install_patches_initial( self, resource_group_name: str, vm_name: str, - body: Union[_models.VirtualMachineInstallPatchesParameters, JSON, IO[bytes]], + install_patches_input: Union[_models.VirtualMachineInstallPatchesParameters, JSON, IO[bytes]], **kwargs: Any ) -> Iterator[bytes]: error_map: MutableMapping = { @@ -19936,10 +19953,10 @@ def _install_patches_initial( content_type = content_type or "application/json" _content = None - if isinstance(body, (IOBase, bytes)): - _content = body + if isinstance(install_patches_input, (IOBase, bytes)): + _content = install_patches_input else: - _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(install_patches_input, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore _request = build_virtual_machines_install_patches_request( resource_group_name=resource_group_name, @@ -19989,7 +20006,7 @@ def begin_install_patches( self, resource_group_name: str, vm_name: str, - body: _models.VirtualMachineInstallPatchesParameters, + install_patches_input: _models.VirtualMachineInstallPatchesParameters, *, content_type: str = "application/json", **kwargs: Any @@ -20001,8 +20018,9 @@ def begin_install_patches( :type resource_group_name: str :param vm_name: The name of the virtual machine. Required. :type vm_name: str - :param body: Input for InstallPatches as directly received by the API. Required. - :type body: ~azure.mgmt.compute.models.VirtualMachineInstallPatchesParameters + :param install_patches_input: Input for InstallPatches as directly received by the API. + Required. + :type install_patches_input: ~azure.mgmt.compute.models.VirtualMachineInstallPatchesParameters :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -20018,7 +20036,7 @@ def begin_install_patches( self, resource_group_name: str, vm_name: str, - body: JSON, + install_patches_input: JSON, *, content_type: str = "application/json", **kwargs: Any @@ -20030,8 +20048,9 @@ def begin_install_patches( :type resource_group_name: str :param vm_name: The name of the virtual machine. Required. :type vm_name: str - :param body: Input for InstallPatches as directly received by the API. Required. - :type body: JSON + :param install_patches_input: Input for InstallPatches as directly received by the API. + Required. + :type install_patches_input: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -20047,7 +20066,7 @@ def begin_install_patches( self, resource_group_name: str, vm_name: str, - body: IO[bytes], + install_patches_input: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -20059,8 +20078,9 @@ def begin_install_patches( :type resource_group_name: str :param vm_name: The name of the virtual machine. Required. :type vm_name: str - :param body: Input for InstallPatches as directly received by the API. Required. - :type body: IO[bytes] + :param install_patches_input: Input for InstallPatches as directly received by the API. + Required. + :type install_patches_input: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str @@ -20076,7 +20096,7 @@ def begin_install_patches( self, resource_group_name: str, vm_name: str, - body: Union[_models.VirtualMachineInstallPatchesParameters, JSON, IO[bytes]], + install_patches_input: Union[_models.VirtualMachineInstallPatchesParameters, JSON, IO[bytes]], **kwargs: Any ) -> LROPoller[_models.VirtualMachineInstallPatchesResult]: """Installs patches on the VM. @@ -20086,10 +20106,10 @@ def begin_install_patches( :type resource_group_name: str :param vm_name: The name of the virtual machine. Required. :type vm_name: str - :param body: Input for InstallPatches as directly received by the API. Is one of the following - types: VirtualMachineInstallPatchesParameters, JSON, IO[bytes] Required. - :type body: ~azure.mgmt.compute.models.VirtualMachineInstallPatchesParameters or JSON or - IO[bytes] + :param install_patches_input: Input for InstallPatches as directly received by the API. Is one + of the following types: VirtualMachineInstallPatchesParameters, JSON, IO[bytes] Required. + :type install_patches_input: ~azure.mgmt.compute.models.VirtualMachineInstallPatchesParameters + or JSON or IO[bytes] :return: An instance of LROPoller that returns VirtualMachineInstallPatchesResult. The VirtualMachineInstallPatchesResult is compatible with MutableMapping :rtype: @@ -20108,7 +20128,7 @@ def begin_install_patches( raw_result = self._install_patches_initial( resource_group_name=resource_group_name, vm_name=vm_name, - body=body, + install_patches_input=install_patches_input, content_type=content_type, cls=lambda x, y, z: x, headers=_headers, @@ -21462,7 +21482,7 @@ def _run_command_initial( self, resource_group_name: str, vm_name: str, - body: Union[_models.RunCommandInput, JSON, IO[bytes]], + parameters: Union[_models.RunCommandInput, JSON, IO[bytes]], **kwargs: Any ) -> Iterator[bytes]: error_map: MutableMapping = { @@ -21481,10 +21501,10 @@ def _run_command_initial( content_type = content_type or "application/json" _content = None - if isinstance(body, (IOBase, bytes)): - _content = body + if isinstance(parameters, (IOBase, bytes)): + _content = parameters else: - _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore _request = build_virtual_machines_run_command_request( resource_group_name=resource_group_name, @@ -21534,7 +21554,7 @@ def begin_run_command( self, resource_group_name: str, vm_name: str, - body: _models.RunCommandInput, + parameters: _models.RunCommandInput, *, content_type: str = "application/json", **kwargs: Any @@ -21546,8 +21566,8 @@ def begin_run_command( :type resource_group_name: str :param vm_name: The name of the virtual machine. Required. :type vm_name: str - :param body: Parameters supplied to the Run command operation. Required. - :type body: ~azure.mgmt.compute.models.RunCommandInput + :param parameters: Parameters supplied to the Run command operation. Required. + :type parameters: ~azure.mgmt.compute.models.RunCommandInput :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -21562,7 +21582,7 @@ def begin_run_command( self, resource_group_name: str, vm_name: str, - body: JSON, + parameters: JSON, *, content_type: str = "application/json", **kwargs: Any @@ -21574,8 +21594,8 @@ def begin_run_command( :type resource_group_name: str :param vm_name: The name of the virtual machine. Required. :type vm_name: str - :param body: Parameters supplied to the Run command operation. Required. - :type body: JSON + :param parameters: Parameters supplied to the Run command operation. Required. + :type parameters: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -21590,7 +21610,7 @@ def begin_run_command( self, resource_group_name: str, vm_name: str, - body: IO[bytes], + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -21602,8 +21622,8 @@ def begin_run_command( :type resource_group_name: str :param vm_name: The name of the virtual machine. Required. :type vm_name: str - :param body: Parameters supplied to the Run command operation. Required. - :type body: IO[bytes] + :param parameters: Parameters supplied to the Run command operation. Required. + :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str @@ -21618,7 +21638,7 @@ def begin_run_command( self, resource_group_name: str, vm_name: str, - body: Union[_models.RunCommandInput, JSON, IO[bytes]], + parameters: Union[_models.RunCommandInput, JSON, IO[bytes]], **kwargs: Any ) -> LROPoller[_models.RunCommandResult]: """Run command on the VM. @@ -21628,9 +21648,9 @@ def begin_run_command( :type resource_group_name: str :param vm_name: The name of the virtual machine. Required. :type vm_name: str - :param body: Parameters supplied to the Run command operation. Is one of the following types: - RunCommandInput, JSON, IO[bytes] Required. - :type body: ~azure.mgmt.compute.models.RunCommandInput or JSON or IO[bytes] + :param parameters: Parameters supplied to the Run command operation. Is one of the following + types: RunCommandInput, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.compute.models.RunCommandInput or JSON or IO[bytes] :return: An instance of LROPoller that returns RunCommandResult. The RunCommandResult is compatible with MutableMapping :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.RunCommandResult] @@ -21648,7 +21668,7 @@ def begin_run_command( raw_result = self._run_command_initial( resource_group_name=resource_group_name, vm_name=vm_name, - body=body, + parameters=parameters, content_type=content_type, cls=lambda x, y, z: x, headers=_headers, @@ -22024,7 +22044,7 @@ def _create_or_update_initial( resource_group_name: str, vm_name: str, vm_extension_name: str, - resource: Union[_models.VirtualMachineExtension, JSON, IO[bytes]], + extension_parameters: Union[_models.VirtualMachineExtension, JSON, IO[bytes]], **kwargs: Any ) -> Iterator[bytes]: error_map: MutableMapping = { @@ -22043,10 +22063,10 @@ def _create_or_update_initial( content_type = content_type or "application/json" _content = None - if isinstance(resource, (IOBase, bytes)): - _content = resource + if isinstance(extension_parameters, (IOBase, bytes)): + _content = extension_parameters else: - _content = json.dumps(resource, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(extension_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore _request = build_virtual_machine_extensions_create_or_update_request( resource_group_name=resource_group_name, @@ -22098,7 +22118,7 @@ def begin_create_or_update( resource_group_name: str, vm_name: str, vm_extension_name: str, - resource: _models.VirtualMachineExtension, + extension_parameters: _models.VirtualMachineExtension, *, content_type: str = "application/json", **kwargs: Any @@ -22112,9 +22132,9 @@ def begin_create_or_update( :type vm_name: str :param vm_extension_name: The name of the virtual machine extension. Required. :type vm_extension_name: str - :param resource: Parameters supplied to the Create Virtual Machine Extension operation. - Required. - :type resource: ~azure.mgmt.compute.models.VirtualMachineExtension + :param extension_parameters: Parameters supplied to the Create Virtual Machine Extension + operation. Required. + :type extension_parameters: ~azure.mgmt.compute.models.VirtualMachineExtension :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -22129,7 +22149,7 @@ def begin_create_or_update( resource_group_name: str, vm_name: str, vm_extension_name: str, - resource: JSON, + extension_parameters: JSON, *, content_type: str = "application/json", **kwargs: Any @@ -22143,9 +22163,9 @@ def begin_create_or_update( :type vm_name: str :param vm_extension_name: The name of the virtual machine extension. Required. :type vm_extension_name: str - :param resource: Parameters supplied to the Create Virtual Machine Extension operation. - Required. - :type resource: JSON + :param extension_parameters: Parameters supplied to the Create Virtual Machine Extension + operation. Required. + :type extension_parameters: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -22160,7 +22180,7 @@ def begin_create_or_update( resource_group_name: str, vm_name: str, vm_extension_name: str, - resource: IO[bytes], + extension_parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -22174,9 +22194,9 @@ def begin_create_or_update( :type vm_name: str :param vm_extension_name: The name of the virtual machine extension. Required. :type vm_extension_name: str - :param resource: Parameters supplied to the Create Virtual Machine Extension operation. - Required. - :type resource: IO[bytes] + :param extension_parameters: Parameters supplied to the Create Virtual Machine Extension + operation. Required. + :type extension_parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str @@ -22191,7 +22211,7 @@ def begin_create_or_update( resource_group_name: str, vm_name: str, vm_extension_name: str, - resource: Union[_models.VirtualMachineExtension, JSON, IO[bytes]], + extension_parameters: Union[_models.VirtualMachineExtension, JSON, IO[bytes]], **kwargs: Any ) -> LROPoller[None]: """The operation to create or update the extension. @@ -22203,9 +22223,10 @@ def begin_create_or_update( :type vm_name: str :param vm_extension_name: The name of the virtual machine extension. Required. :type vm_extension_name: str - :param resource: Parameters supplied to the Create Virtual Machine Extension operation. Is one - of the following types: VirtualMachineExtension, JSON, IO[bytes] Required. - :type resource: ~azure.mgmt.compute.models.VirtualMachineExtension or JSON or IO[bytes] + :param extension_parameters: Parameters supplied to the Create Virtual Machine Extension + operation. Is one of the following types: VirtualMachineExtension, JSON, IO[bytes] Required. + :type extension_parameters: ~azure.mgmt.compute.models.VirtualMachineExtension or JSON or + IO[bytes] :return: An instance of LROPoller that returns None :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -22223,7 +22244,7 @@ def begin_create_or_update( resource_group_name=resource_group_name, vm_name=vm_name, vm_extension_name=vm_extension_name, - resource=resource, + extension_parameters=extension_parameters, content_type=content_type, cls=lambda x, y, z: x, headers=_headers, @@ -22263,7 +22284,7 @@ def _update_initial( resource_group_name: str, vm_name: str, vm_extension_name: str, - properties: Union[_models.VirtualMachineExtensionUpdate, JSON, IO[bytes]], + extension_parameters: Union[_models.VirtualMachineExtensionUpdate, JSON, IO[bytes]], **kwargs: Any ) -> Iterator[bytes]: error_map: MutableMapping = { @@ -22282,10 +22303,10 @@ def _update_initial( content_type = content_type or "application/json" _content = None - if isinstance(properties, (IOBase, bytes)): - _content = properties + if isinstance(extension_parameters, (IOBase, bytes)): + _content = extension_parameters else: - _content = json.dumps(properties, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(extension_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore _request = build_virtual_machine_extensions_update_request( resource_group_name=resource_group_name, @@ -22336,7 +22357,7 @@ def begin_update( resource_group_name: str, vm_name: str, vm_extension_name: str, - properties: _models.VirtualMachineExtensionUpdate, + extension_parameters: _models.VirtualMachineExtensionUpdate, *, content_type: str = "application/json", **kwargs: Any @@ -22350,9 +22371,9 @@ def begin_update( :type vm_name: str :param vm_extension_name: The name of the virtual machine extension. Required. :type vm_extension_name: str - :param properties: Parameters supplied to the Update Virtual Machine Extension operation. - Required. - :type properties: ~azure.mgmt.compute.models.VirtualMachineExtensionUpdate + :param extension_parameters: Parameters supplied to the Update Virtual Machine Extension + operation. Required. + :type extension_parameters: ~azure.mgmt.compute.models.VirtualMachineExtensionUpdate :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -22367,7 +22388,7 @@ def begin_update( resource_group_name: str, vm_name: str, vm_extension_name: str, - properties: JSON, + extension_parameters: JSON, *, content_type: str = "application/json", **kwargs: Any @@ -22381,9 +22402,9 @@ def begin_update( :type vm_name: str :param vm_extension_name: The name of the virtual machine extension. Required. :type vm_extension_name: str - :param properties: Parameters supplied to the Update Virtual Machine Extension operation. - Required. - :type properties: JSON + :param extension_parameters: Parameters supplied to the Update Virtual Machine Extension + operation. Required. + :type extension_parameters: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -22398,7 +22419,7 @@ def begin_update( resource_group_name: str, vm_name: str, vm_extension_name: str, - properties: IO[bytes], + extension_parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -22412,9 +22433,9 @@ def begin_update( :type vm_name: str :param vm_extension_name: The name of the virtual machine extension. Required. :type vm_extension_name: str - :param properties: Parameters supplied to the Update Virtual Machine Extension operation. - Required. - :type properties: IO[bytes] + :param extension_parameters: Parameters supplied to the Update Virtual Machine Extension + operation. Required. + :type extension_parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str @@ -22429,7 +22450,7 @@ def begin_update( resource_group_name: str, vm_name: str, vm_extension_name: str, - properties: Union[_models.VirtualMachineExtensionUpdate, JSON, IO[bytes]], + extension_parameters: Union[_models.VirtualMachineExtensionUpdate, JSON, IO[bytes]], **kwargs: Any ) -> LROPoller[None]: """The operation to update the extension. @@ -22441,9 +22462,11 @@ def begin_update( :type vm_name: str :param vm_extension_name: The name of the virtual machine extension. Required. :type vm_extension_name: str - :param properties: Parameters supplied to the Update Virtual Machine Extension operation. Is - one of the following types: VirtualMachineExtensionUpdate, JSON, IO[bytes] Required. - :type properties: ~azure.mgmt.compute.models.VirtualMachineExtensionUpdate or JSON or IO[bytes] + :param extension_parameters: Parameters supplied to the Update Virtual Machine Extension + operation. Is one of the following types: VirtualMachineExtensionUpdate, JSON, IO[bytes] + Required. + :type extension_parameters: ~azure.mgmt.compute.models.VirtualMachineExtensionUpdate or JSON or + IO[bytes] :return: An instance of LROPoller that returns None :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -22461,7 +22484,7 @@ def begin_update( resource_group_name=resource_group_name, vm_name=vm_name, vm_extension_name=vm_extension_name, - properties=properties, + extension_parameters=extension_parameters, content_type=content_type, cls=lambda x, y, z: x, headers=_headers, @@ -23047,7 +23070,7 @@ def create_or_update( self, resource_group_name: str, availability_set_name: str, - resource: _models.AvailabilitySet, + parameters: _models.AvailabilitySet, *, content_type: str = "application/json", **kwargs: Any @@ -23059,8 +23082,8 @@ def create_or_update( :type resource_group_name: str :param availability_set_name: The name of the availability set. Required. :type availability_set_name: str - :param resource: Parameters supplied to the Create Availability Set operation. Required. - :type resource: ~azure.mgmt.compute.models.AvailabilitySet + :param parameters: Parameters supplied to the Create Availability Set operation. Required. + :type parameters: ~azure.mgmt.compute.models.AvailabilitySet :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -23074,7 +23097,7 @@ def create_or_update( self, resource_group_name: str, availability_set_name: str, - resource: JSON, + parameters: JSON, *, content_type: str = "application/json", **kwargs: Any @@ -23086,8 +23109,8 @@ def create_or_update( :type resource_group_name: str :param availability_set_name: The name of the availability set. Required. :type availability_set_name: str - :param resource: Parameters supplied to the Create Availability Set operation. Required. - :type resource: JSON + :param parameters: Parameters supplied to the Create Availability Set operation. Required. + :type parameters: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -23101,7 +23124,7 @@ def create_or_update( self, resource_group_name: str, availability_set_name: str, - resource: IO[bytes], + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -23113,8 +23136,8 @@ def create_or_update( :type resource_group_name: str :param availability_set_name: The name of the availability set. Required. :type availability_set_name: str - :param resource: Parameters supplied to the Create Availability Set operation. Required. - :type resource: IO[bytes] + :param parameters: Parameters supplied to the Create Availability Set operation. Required. + :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str @@ -23128,7 +23151,7 @@ def create_or_update( self, resource_group_name: str, availability_set_name: str, - resource: Union[_models.AvailabilitySet, JSON, IO[bytes]], + parameters: Union[_models.AvailabilitySet, JSON, IO[bytes]], **kwargs: Any ) -> _models.AvailabilitySet: """Create or update an availability set. @@ -23138,9 +23161,9 @@ def create_or_update( :type resource_group_name: str :param availability_set_name: The name of the availability set. Required. :type availability_set_name: str - :param resource: Parameters supplied to the Create Availability Set operation. Is one of the + :param parameters: Parameters supplied to the Create Availability Set operation. Is one of the following types: AvailabilitySet, JSON, IO[bytes] Required. - :type resource: ~azure.mgmt.compute.models.AvailabilitySet or JSON or IO[bytes] + :type parameters: ~azure.mgmt.compute.models.AvailabilitySet or JSON or IO[bytes] :return: AvailabilitySet. The AvailabilitySet is compatible with MutableMapping :rtype: ~azure.mgmt.compute.models.AvailabilitySet :raises ~azure.core.exceptions.HttpResponseError: @@ -23161,10 +23184,10 @@ def create_or_update( content_type = content_type or "application/json" _content = None - if isinstance(resource, (IOBase, bytes)): - _content = resource + if isinstance(parameters, (IOBase, bytes)): + _content = parameters else: - _content = json.dumps(resource, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore _request = build_availability_sets_create_or_update_request( resource_group_name=resource_group_name, @@ -23213,7 +23236,7 @@ def update( self, resource_group_name: str, availability_set_name: str, - properties: _models.AvailabilitySetUpdate, + parameters: _models.AvailabilitySetUpdate, *, content_type: str = "application/json", **kwargs: Any @@ -23225,8 +23248,8 @@ def update( :type resource_group_name: str :param availability_set_name: The name of the availability set. Required. :type availability_set_name: str - :param properties: Parameters supplied to the Update Availability Set operation. Required. - :type properties: ~azure.mgmt.compute.models.AvailabilitySetUpdate + :param parameters: Parameters supplied to the Update Availability Set operation. Required. + :type parameters: ~azure.mgmt.compute.models.AvailabilitySetUpdate :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -23240,7 +23263,7 @@ def update( self, resource_group_name: str, availability_set_name: str, - properties: JSON, + parameters: JSON, *, content_type: str = "application/json", **kwargs: Any @@ -23252,8 +23275,8 @@ def update( :type resource_group_name: str :param availability_set_name: The name of the availability set. Required. :type availability_set_name: str - :param properties: Parameters supplied to the Update Availability Set operation. Required. - :type properties: JSON + :param parameters: Parameters supplied to the Update Availability Set operation. Required. + :type parameters: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -23267,7 +23290,7 @@ def update( self, resource_group_name: str, availability_set_name: str, - properties: IO[bytes], + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -23279,8 +23302,8 @@ def update( :type resource_group_name: str :param availability_set_name: The name of the availability set. Required. :type availability_set_name: str - :param properties: Parameters supplied to the Update Availability Set operation. Required. - :type properties: IO[bytes] + :param parameters: Parameters supplied to the Update Availability Set operation. Required. + :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str @@ -23294,7 +23317,7 @@ def update( self, resource_group_name: str, availability_set_name: str, - properties: Union[_models.AvailabilitySetUpdate, JSON, IO[bytes]], + parameters: Union[_models.AvailabilitySetUpdate, JSON, IO[bytes]], **kwargs: Any ) -> _models.AvailabilitySet: """Update an availability set. @@ -23304,9 +23327,9 @@ def update( :type resource_group_name: str :param availability_set_name: The name of the availability set. Required. :type availability_set_name: str - :param properties: Parameters supplied to the Update Availability Set operation. Is one of the + :param parameters: Parameters supplied to the Update Availability Set operation. Is one of the following types: AvailabilitySetUpdate, JSON, IO[bytes] Required. - :type properties: ~azure.mgmt.compute.models.AvailabilitySetUpdate or JSON or IO[bytes] + :type parameters: ~azure.mgmt.compute.models.AvailabilitySetUpdate or JSON or IO[bytes] :return: AvailabilitySet. The AvailabilitySet is compatible with MutableMapping :rtype: ~azure.mgmt.compute.models.AvailabilitySet :raises ~azure.core.exceptions.HttpResponseError: @@ -23327,10 +23350,10 @@ def update( content_type = content_type or "application/json" _content = None - if isinstance(properties, (IOBase, bytes)): - _content = properties + if isinstance(parameters, (IOBase, bytes)): + _content = parameters else: - _content = json.dumps(properties, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore _request = build_availability_sets_update_request( resource_group_name=resource_group_name, @@ -23707,7 +23730,7 @@ def start_migration_to_virtual_machine_scale_set( # pylint: disable=name-too-lo self, resource_group_name: str, availability_set_name: str, - body: _models.MigrateToVirtualMachineScaleSetInput, + parameters: _models.MigrateToVirtualMachineScaleSetInput, *, content_type: str = "application/json", **kwargs: Any @@ -23721,8 +23744,9 @@ def start_migration_to_virtual_machine_scale_set( # pylint: disable=name-too-lo :type resource_group_name: str :param availability_set_name: The name of the availability set. Required. :type availability_set_name: str - :param body: Parameters supplied to the migrate operation on the availability set. Required. - :type body: ~azure.mgmt.compute.models.MigrateToVirtualMachineScaleSetInput + :param parameters: Parameters supplied to the migrate operation on the availability set. + Required. + :type parameters: ~azure.mgmt.compute.models.MigrateToVirtualMachineScaleSetInput :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -23736,7 +23760,7 @@ def start_migration_to_virtual_machine_scale_set( # pylint: disable=name-too-lo self, resource_group_name: str, availability_set_name: str, - body: JSON, + parameters: JSON, *, content_type: str = "application/json", **kwargs: Any @@ -23750,8 +23774,9 @@ def start_migration_to_virtual_machine_scale_set( # pylint: disable=name-too-lo :type resource_group_name: str :param availability_set_name: The name of the availability set. Required. :type availability_set_name: str - :param body: Parameters supplied to the migrate operation on the availability set. Required. - :type body: JSON + :param parameters: Parameters supplied to the migrate operation on the availability set. + Required. + :type parameters: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -23765,7 +23790,7 @@ def start_migration_to_virtual_machine_scale_set( # pylint: disable=name-too-lo self, resource_group_name: str, availability_set_name: str, - body: IO[bytes], + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -23779,8 +23804,9 @@ def start_migration_to_virtual_machine_scale_set( # pylint: disable=name-too-lo :type resource_group_name: str :param availability_set_name: The name of the availability set. Required. :type availability_set_name: str - :param body: Parameters supplied to the migrate operation on the availability set. Required. - :type body: IO[bytes] + :param parameters: Parameters supplied to the migrate operation on the availability set. + Required. + :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str @@ -23794,7 +23820,7 @@ def start_migration_to_virtual_machine_scale_set( # pylint: disable=inconsisten self, resource_group_name: str, availability_set_name: str, - body: Union[_models.MigrateToVirtualMachineScaleSetInput, JSON, IO[bytes]], + parameters: Union[_models.MigrateToVirtualMachineScaleSetInput, JSON, IO[bytes]], **kwargs: Any ) -> None: """Start migration operation on an Availability Set to move its Virtual Machines to a Virtual @@ -23806,9 +23832,9 @@ def start_migration_to_virtual_machine_scale_set( # pylint: disable=inconsisten :type resource_group_name: str :param availability_set_name: The name of the availability set. Required. :type availability_set_name: str - :param body: Parameters supplied to the migrate operation on the availability set. Is one of - the following types: MigrateToVirtualMachineScaleSetInput, JSON, IO[bytes] Required. - :type body: ~azure.mgmt.compute.models.MigrateToVirtualMachineScaleSetInput or JSON or + :param parameters: Parameters supplied to the migrate operation on the availability set. Is one + of the following types: MigrateToVirtualMachineScaleSetInput, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.compute.models.MigrateToVirtualMachineScaleSetInput or JSON or IO[bytes] :return: None :rtype: None @@ -23830,10 +23856,10 @@ def start_migration_to_virtual_machine_scale_set( # pylint: disable=inconsisten content_type = content_type or "application/json" _content = None - if isinstance(body, (IOBase, bytes)): - _content = body + if isinstance(parameters, (IOBase, bytes)): + _content = parameters else: - _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore _request = build_availability_sets_start_migration_to_virtual_machine_scale_set_request( resource_group_name=resource_group_name, @@ -23926,7 +23952,7 @@ def validate_migration_to_virtual_machine_scale_set( # pylint: disable=name-too self, resource_group_name: str, availability_set_name: str, - body: _models.MigrateToVirtualMachineScaleSetInput, + parameters: _models.MigrateToVirtualMachineScaleSetInput, *, content_type: str = "application/json", **kwargs: Any @@ -23939,8 +23965,9 @@ def validate_migration_to_virtual_machine_scale_set( # pylint: disable=name-too :type resource_group_name: str :param availability_set_name: The name of the availability set. Required. :type availability_set_name: str - :param body: Parameters supplied to the migrate operation on the availability set. Required. - :type body: ~azure.mgmt.compute.models.MigrateToVirtualMachineScaleSetInput + :param parameters: Parameters supplied to the migrate operation on the availability set. + Required. + :type parameters: ~azure.mgmt.compute.models.MigrateToVirtualMachineScaleSetInput :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -23954,7 +23981,7 @@ def validate_migration_to_virtual_machine_scale_set( # pylint: disable=name-too self, resource_group_name: str, availability_set_name: str, - body: JSON, + parameters: JSON, *, content_type: str = "application/json", **kwargs: Any @@ -23967,8 +23994,9 @@ def validate_migration_to_virtual_machine_scale_set( # pylint: disable=name-too :type resource_group_name: str :param availability_set_name: The name of the availability set. Required. :type availability_set_name: str - :param body: Parameters supplied to the migrate operation on the availability set. Required. - :type body: JSON + :param parameters: Parameters supplied to the migrate operation on the availability set. + Required. + :type parameters: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -23982,7 +24010,7 @@ def validate_migration_to_virtual_machine_scale_set( # pylint: disable=name-too self, resource_group_name: str, availability_set_name: str, - body: IO[bytes], + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -23995,8 +24023,9 @@ def validate_migration_to_virtual_machine_scale_set( # pylint: disable=name-too :type resource_group_name: str :param availability_set_name: The name of the availability set. Required. :type availability_set_name: str - :param body: Parameters supplied to the migrate operation on the availability set. Required. - :type body: IO[bytes] + :param parameters: Parameters supplied to the migrate operation on the availability set. + Required. + :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str @@ -24010,7 +24039,7 @@ def validate_migration_to_virtual_machine_scale_set( # pylint: disable=inconsis self, resource_group_name: str, availability_set_name: str, - body: Union[_models.MigrateToVirtualMachineScaleSetInput, JSON, IO[bytes]], + parameters: Union[_models.MigrateToVirtualMachineScaleSetInput, JSON, IO[bytes]], **kwargs: Any ) -> None: """Validates that the Virtual Machines in the Availability Set can be migrated to the provided @@ -24021,9 +24050,9 @@ def validate_migration_to_virtual_machine_scale_set( # pylint: disable=inconsis :type resource_group_name: str :param availability_set_name: The name of the availability set. Required. :type availability_set_name: str - :param body: Parameters supplied to the migrate operation on the availability set. Is one of - the following types: MigrateToVirtualMachineScaleSetInput, JSON, IO[bytes] Required. - :type body: ~azure.mgmt.compute.models.MigrateToVirtualMachineScaleSetInput or JSON or + :param parameters: Parameters supplied to the migrate operation on the availability set. Is one + of the following types: MigrateToVirtualMachineScaleSetInput, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.compute.models.MigrateToVirtualMachineScaleSetInput or JSON or IO[bytes] :return: None :rtype: None @@ -24045,10 +24074,10 @@ def validate_migration_to_virtual_machine_scale_set( # pylint: disable=inconsis content_type = content_type or "application/json" _content = None - if isinstance(body, (IOBase, bytes)): - _content = body + if isinstance(parameters, (IOBase, bytes)): + _content = parameters else: - _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore _request = build_availability_sets_validate_migration_to_virtual_machine_scale_set_request( resource_group_name=resource_group_name, @@ -24414,7 +24443,7 @@ def create_or_update( self, resource_group_name: str, proximity_placement_group_name: str, - resource: _models.ProximityPlacementGroup, + parameters: _models.ProximityPlacementGroup, *, content_type: str = "application/json", **kwargs: Any @@ -24426,9 +24455,9 @@ def create_or_update( :type resource_group_name: str :param proximity_placement_group_name: The name of the proximity placement group. Required. :type proximity_placement_group_name: str - :param resource: Parameters supplied to the Create Proximity Placement Group operation. + :param parameters: Parameters supplied to the Create Proximity Placement Group operation. Required. - :type resource: ~azure.mgmt.compute.models.ProximityPlacementGroup + :type parameters: ~azure.mgmt.compute.models.ProximityPlacementGroup :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -24442,7 +24471,7 @@ def create_or_update( self, resource_group_name: str, proximity_placement_group_name: str, - resource: JSON, + parameters: JSON, *, content_type: str = "application/json", **kwargs: Any @@ -24454,9 +24483,9 @@ def create_or_update( :type resource_group_name: str :param proximity_placement_group_name: The name of the proximity placement group. Required. :type proximity_placement_group_name: str - :param resource: Parameters supplied to the Create Proximity Placement Group operation. + :param parameters: Parameters supplied to the Create Proximity Placement Group operation. Required. - :type resource: JSON + :type parameters: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -24470,7 +24499,7 @@ def create_or_update( self, resource_group_name: str, proximity_placement_group_name: str, - resource: IO[bytes], + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -24482,9 +24511,9 @@ def create_or_update( :type resource_group_name: str :param proximity_placement_group_name: The name of the proximity placement group. Required. :type proximity_placement_group_name: str - :param resource: Parameters supplied to the Create Proximity Placement Group operation. + :param parameters: Parameters supplied to the Create Proximity Placement Group operation. Required. - :type resource: IO[bytes] + :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str @@ -24498,7 +24527,7 @@ def create_or_update( self, resource_group_name: str, proximity_placement_group_name: str, - resource: Union[_models.ProximityPlacementGroup, JSON, IO[bytes]], + parameters: Union[_models.ProximityPlacementGroup, JSON, IO[bytes]], **kwargs: Any ) -> _models.ProximityPlacementGroup: """Create or update a proximity placement group. @@ -24508,9 +24537,9 @@ def create_or_update( :type resource_group_name: str :param proximity_placement_group_name: The name of the proximity placement group. Required. :type proximity_placement_group_name: str - :param resource: Parameters supplied to the Create Proximity Placement Group operation. Is one - of the following types: ProximityPlacementGroup, JSON, IO[bytes] Required. - :type resource: ~azure.mgmt.compute.models.ProximityPlacementGroup or JSON or IO[bytes] + :param parameters: Parameters supplied to the Create Proximity Placement Group operation. Is + one of the following types: ProximityPlacementGroup, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.compute.models.ProximityPlacementGroup or JSON or IO[bytes] :return: ProximityPlacementGroup. The ProximityPlacementGroup is compatible with MutableMapping :rtype: ~azure.mgmt.compute.models.ProximityPlacementGroup :raises ~azure.core.exceptions.HttpResponseError: @@ -24531,10 +24560,10 @@ def create_or_update( content_type = content_type or "application/json" _content = None - if isinstance(resource, (IOBase, bytes)): - _content = resource + if isinstance(parameters, (IOBase, bytes)): + _content = parameters else: - _content = json.dumps(resource, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore _request = build_proximity_placement_groups_create_or_update_request( resource_group_name=resource_group_name, @@ -24583,7 +24612,7 @@ def update( self, resource_group_name: str, proximity_placement_group_name: str, - properties: _models.ProximityPlacementGroupUpdate, + parameters: _models.ProximityPlacementGroupUpdate, *, content_type: str = "application/json", **kwargs: Any @@ -24595,9 +24624,9 @@ def update( :type resource_group_name: str :param proximity_placement_group_name: The name of the proximity placement group. Required. :type proximity_placement_group_name: str - :param properties: Parameters supplied to the Update Proximity Placement Group operation. + :param parameters: Parameters supplied to the Update Proximity Placement Group operation. Required. - :type properties: ~azure.mgmt.compute.models.ProximityPlacementGroupUpdate + :type parameters: ~azure.mgmt.compute.models.ProximityPlacementGroupUpdate :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -24611,7 +24640,7 @@ def update( self, resource_group_name: str, proximity_placement_group_name: str, - properties: JSON, + parameters: JSON, *, content_type: str = "application/json", **kwargs: Any @@ -24623,9 +24652,9 @@ def update( :type resource_group_name: str :param proximity_placement_group_name: The name of the proximity placement group. Required. :type proximity_placement_group_name: str - :param properties: Parameters supplied to the Update Proximity Placement Group operation. + :param parameters: Parameters supplied to the Update Proximity Placement Group operation. Required. - :type properties: JSON + :type parameters: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -24639,7 +24668,7 @@ def update( self, resource_group_name: str, proximity_placement_group_name: str, - properties: IO[bytes], + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -24651,9 +24680,9 @@ def update( :type resource_group_name: str :param proximity_placement_group_name: The name of the proximity placement group. Required. :type proximity_placement_group_name: str - :param properties: Parameters supplied to the Update Proximity Placement Group operation. + :param parameters: Parameters supplied to the Update Proximity Placement Group operation. Required. - :type properties: IO[bytes] + :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str @@ -24667,7 +24696,7 @@ def update( self, resource_group_name: str, proximity_placement_group_name: str, - properties: Union[_models.ProximityPlacementGroupUpdate, JSON, IO[bytes]], + parameters: Union[_models.ProximityPlacementGroupUpdate, JSON, IO[bytes]], **kwargs: Any ) -> _models.ProximityPlacementGroup: """Update a proximity placement group. @@ -24677,9 +24706,9 @@ def update( :type resource_group_name: str :param proximity_placement_group_name: The name of the proximity placement group. Required. :type proximity_placement_group_name: str - :param properties: Parameters supplied to the Update Proximity Placement Group operation. Is + :param parameters: Parameters supplied to the Update Proximity Placement Group operation. Is one of the following types: ProximityPlacementGroupUpdate, JSON, IO[bytes] Required. - :type properties: ~azure.mgmt.compute.models.ProximityPlacementGroupUpdate or JSON or IO[bytes] + :type parameters: ~azure.mgmt.compute.models.ProximityPlacementGroupUpdate or JSON or IO[bytes] :return: ProximityPlacementGroup. The ProximityPlacementGroup is compatible with MutableMapping :rtype: ~azure.mgmt.compute.models.ProximityPlacementGroup :raises ~azure.core.exceptions.HttpResponseError: @@ -24700,10 +24729,10 @@ def update( content_type = content_type or "application/json" _content = None - if isinstance(properties, (IOBase, bytes)): - _content = properties + if isinstance(parameters, (IOBase, bytes)): + _content = parameters else: - _content = json.dumps(properties, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore _request = build_proximity_placement_groups_update_request( resource_group_name=resource_group_name, @@ -25079,7 +25108,7 @@ def create_or_update( self, resource_group_name: str, host_group_name: str, - resource: _models.DedicatedHostGroup, + parameters: _models.DedicatedHostGroup, *, content_type: str = "application/json", **kwargs: Any @@ -25094,8 +25123,8 @@ def create_or_update( :type resource_group_name: str :param host_group_name: The name of the dedicated host group. Required. :type host_group_name: str - :param resource: Parameters supplied to the Create Dedicated Host Group. Required. - :type resource: ~azure.mgmt.compute.models.DedicatedHostGroup + :param parameters: Parameters supplied to the Create Dedicated Host Group. Required. + :type parameters: ~azure.mgmt.compute.models.DedicatedHostGroup :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -25109,7 +25138,7 @@ def create_or_update( self, resource_group_name: str, host_group_name: str, - resource: JSON, + parameters: JSON, *, content_type: str = "application/json", **kwargs: Any @@ -25124,8 +25153,8 @@ def create_or_update( :type resource_group_name: str :param host_group_name: The name of the dedicated host group. Required. :type host_group_name: str - :param resource: Parameters supplied to the Create Dedicated Host Group. Required. - :type resource: JSON + :param parameters: Parameters supplied to the Create Dedicated Host Group. Required. + :type parameters: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -25139,7 +25168,7 @@ def create_or_update( self, resource_group_name: str, host_group_name: str, - resource: IO[bytes], + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -25154,8 +25183,8 @@ def create_or_update( :type resource_group_name: str :param host_group_name: The name of the dedicated host group. Required. :type host_group_name: str - :param resource: Parameters supplied to the Create Dedicated Host Group. Required. - :type resource: IO[bytes] + :param parameters: Parameters supplied to the Create Dedicated Host Group. Required. + :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str @@ -25169,7 +25198,7 @@ def create_or_update( self, resource_group_name: str, host_group_name: str, - resource: Union[_models.DedicatedHostGroup, JSON, IO[bytes]], + parameters: Union[_models.DedicatedHostGroup, JSON, IO[bytes]], **kwargs: Any ) -> _models.DedicatedHostGroup: """Create or update a dedicated host group. For details of Dedicated Host and Dedicated Host @@ -25182,9 +25211,9 @@ def create_or_update( :type resource_group_name: str :param host_group_name: The name of the dedicated host group. Required. :type host_group_name: str - :param resource: Parameters supplied to the Create Dedicated Host Group. Is one of the + :param parameters: Parameters supplied to the Create Dedicated Host Group. Is one of the following types: DedicatedHostGroup, JSON, IO[bytes] Required. - :type resource: ~azure.mgmt.compute.models.DedicatedHostGroup or JSON or IO[bytes] + :type parameters: ~azure.mgmt.compute.models.DedicatedHostGroup or JSON or IO[bytes] :return: DedicatedHostGroup. The DedicatedHostGroup is compatible with MutableMapping :rtype: ~azure.mgmt.compute.models.DedicatedHostGroup :raises ~azure.core.exceptions.HttpResponseError: @@ -25205,10 +25234,10 @@ def create_or_update( content_type = content_type or "application/json" _content = None - if isinstance(resource, (IOBase, bytes)): - _content = resource + if isinstance(parameters, (IOBase, bytes)): + _content = parameters else: - _content = json.dumps(resource, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore _request = build_dedicated_host_groups_create_or_update_request( resource_group_name=resource_group_name, @@ -25257,7 +25286,7 @@ def update( self, resource_group_name: str, host_group_name: str, - properties: _models.DedicatedHostGroupUpdate, + parameters: _models.DedicatedHostGroupUpdate, *, content_type: str = "application/json", **kwargs: Any @@ -25269,8 +25298,8 @@ def update( :type resource_group_name: str :param host_group_name: The name of the dedicated host group. Required. :type host_group_name: str - :param properties: Parameters supplied to the Update Dedicated Host Group operation. Required. - :type properties: ~azure.mgmt.compute.models.DedicatedHostGroupUpdate + :param parameters: Parameters supplied to the Update Dedicated Host Group operation. Required. + :type parameters: ~azure.mgmt.compute.models.DedicatedHostGroupUpdate :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -25284,7 +25313,7 @@ def update( self, resource_group_name: str, host_group_name: str, - properties: JSON, + parameters: JSON, *, content_type: str = "application/json", **kwargs: Any @@ -25296,8 +25325,8 @@ def update( :type resource_group_name: str :param host_group_name: The name of the dedicated host group. Required. :type host_group_name: str - :param properties: Parameters supplied to the Update Dedicated Host Group operation. Required. - :type properties: JSON + :param parameters: Parameters supplied to the Update Dedicated Host Group operation. Required. + :type parameters: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -25311,7 +25340,7 @@ def update( self, resource_group_name: str, host_group_name: str, - properties: IO[bytes], + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -25323,8 +25352,8 @@ def update( :type resource_group_name: str :param host_group_name: The name of the dedicated host group. Required. :type host_group_name: str - :param properties: Parameters supplied to the Update Dedicated Host Group operation. Required. - :type properties: IO[bytes] + :param parameters: Parameters supplied to the Update Dedicated Host Group operation. Required. + :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str @@ -25338,7 +25367,7 @@ def update( self, resource_group_name: str, host_group_name: str, - properties: Union[_models.DedicatedHostGroupUpdate, JSON, IO[bytes]], + parameters: Union[_models.DedicatedHostGroupUpdate, JSON, IO[bytes]], **kwargs: Any ) -> _models.DedicatedHostGroup: """Update an dedicated host group. @@ -25348,9 +25377,9 @@ def update( :type resource_group_name: str :param host_group_name: The name of the dedicated host group. Required. :type host_group_name: str - :param properties: Parameters supplied to the Update Dedicated Host Group operation. Is one of + :param parameters: Parameters supplied to the Update Dedicated Host Group operation. Is one of the following types: DedicatedHostGroupUpdate, JSON, IO[bytes] Required. - :type properties: ~azure.mgmt.compute.models.DedicatedHostGroupUpdate or JSON or IO[bytes] + :type parameters: ~azure.mgmt.compute.models.DedicatedHostGroupUpdate or JSON or IO[bytes] :return: DedicatedHostGroup. The DedicatedHostGroup is compatible with MutableMapping :rtype: ~azure.mgmt.compute.models.DedicatedHostGroup :raises ~azure.core.exceptions.HttpResponseError: @@ -25371,10 +25400,10 @@ def update( content_type = content_type or "application/json" _content = None - if isinstance(properties, (IOBase, bytes)): - _content = properties + if isinstance(parameters, (IOBase, bytes)): + _content = parameters else: - _content = json.dumps(properties, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore _request = build_dedicated_host_groups_update_request( resource_group_name=resource_group_name, @@ -25756,7 +25785,7 @@ def _create_or_update_initial( resource_group_name: str, host_group_name: str, host_name: str, - resource: Union[_models.DedicatedHost, JSON, IO[bytes]], + parameters: Union[_models.DedicatedHost, JSON, IO[bytes]], **kwargs: Any ) -> Iterator[bytes]: error_map: MutableMapping = { @@ -25775,10 +25804,10 @@ def _create_or_update_initial( content_type = content_type or "application/json" _content = None - if isinstance(resource, (IOBase, bytes)): - _content = resource + if isinstance(parameters, (IOBase, bytes)): + _content = parameters else: - _content = json.dumps(resource, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore _request = build_dedicated_hosts_create_or_update_request( resource_group_name=resource_group_name, @@ -25830,7 +25859,7 @@ def begin_create_or_update( resource_group_name: str, host_group_name: str, host_name: str, - resource: _models.DedicatedHost, + parameters: _models.DedicatedHost, *, content_type: str = "application/json", **kwargs: Any @@ -25844,8 +25873,8 @@ def begin_create_or_update( :type host_group_name: str :param host_name: The name of the dedicated host. Required. :type host_name: str - :param resource: Parameters supplied to the Create Dedicated Host. Required. - :type resource: ~azure.mgmt.compute.models.DedicatedHost + :param parameters: Parameters supplied to the Create Dedicated Host. Required. + :type parameters: ~azure.mgmt.compute.models.DedicatedHost :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -25860,7 +25889,7 @@ def begin_create_or_update( resource_group_name: str, host_group_name: str, host_name: str, - resource: JSON, + parameters: JSON, *, content_type: str = "application/json", **kwargs: Any @@ -25874,8 +25903,8 @@ def begin_create_or_update( :type host_group_name: str :param host_name: The name of the dedicated host. Required. :type host_name: str - :param resource: Parameters supplied to the Create Dedicated Host. Required. - :type resource: JSON + :param parameters: Parameters supplied to the Create Dedicated Host. Required. + :type parameters: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -25890,7 +25919,7 @@ def begin_create_or_update( resource_group_name: str, host_group_name: str, host_name: str, - resource: IO[bytes], + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -25904,8 +25933,8 @@ def begin_create_or_update( :type host_group_name: str :param host_name: The name of the dedicated host. Required. :type host_name: str - :param resource: Parameters supplied to the Create Dedicated Host. Required. - :type resource: IO[bytes] + :param parameters: Parameters supplied to the Create Dedicated Host. Required. + :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str @@ -25920,7 +25949,7 @@ def begin_create_or_update( resource_group_name: str, host_group_name: str, host_name: str, - resource: Union[_models.DedicatedHost, JSON, IO[bytes]], + parameters: Union[_models.DedicatedHost, JSON, IO[bytes]], **kwargs: Any ) -> LROPoller[None]: """Create or update a dedicated host . @@ -25932,9 +25961,9 @@ def begin_create_or_update( :type host_group_name: str :param host_name: The name of the dedicated host. Required. :type host_name: str - :param resource: Parameters supplied to the Create Dedicated Host. Is one of the following + :param parameters: Parameters supplied to the Create Dedicated Host. Is one of the following types: DedicatedHost, JSON, IO[bytes] Required. - :type resource: ~azure.mgmt.compute.models.DedicatedHost or JSON or IO[bytes] + :type parameters: ~azure.mgmt.compute.models.DedicatedHost or JSON or IO[bytes] :return: An instance of LROPoller that returns None :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -25952,7 +25981,7 @@ def begin_create_or_update( resource_group_name=resource_group_name, host_group_name=host_group_name, host_name=host_name, - resource=resource, + parameters=parameters, content_type=content_type, cls=lambda x, y, z: x, headers=_headers, @@ -25992,7 +26021,7 @@ def _update_initial( resource_group_name: str, host_group_name: str, host_name: str, - properties: Union[_models.DedicatedHostUpdate, JSON, IO[bytes]], + parameters: Union[_models.DedicatedHostUpdate, JSON, IO[bytes]], **kwargs: Any ) -> Iterator[bytes]: error_map: MutableMapping = { @@ -26011,10 +26040,10 @@ def _update_initial( content_type = content_type or "application/json" _content = None - if isinstance(properties, (IOBase, bytes)): - _content = properties + if isinstance(parameters, (IOBase, bytes)): + _content = parameters else: - _content = json.dumps(properties, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore _request = build_dedicated_hosts_update_request( resource_group_name=resource_group_name, @@ -26065,7 +26094,7 @@ def begin_update( resource_group_name: str, host_group_name: str, host_name: str, - properties: _models.DedicatedHostUpdate, + parameters: _models.DedicatedHostUpdate, *, content_type: str = "application/json", **kwargs: Any @@ -26079,8 +26108,8 @@ def begin_update( :type host_group_name: str :param host_name: The name of the dedicated host. Required. :type host_name: str - :param properties: Parameters supplied to the Update Dedicated Host operation. Required. - :type properties: ~azure.mgmt.compute.models.DedicatedHostUpdate + :param parameters: Parameters supplied to the Update Dedicated Host operation. Required. + :type parameters: ~azure.mgmt.compute.models.DedicatedHostUpdate :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -26095,7 +26124,7 @@ def begin_update( resource_group_name: str, host_group_name: str, host_name: str, - properties: JSON, + parameters: JSON, *, content_type: str = "application/json", **kwargs: Any @@ -26109,8 +26138,8 @@ def begin_update( :type host_group_name: str :param host_name: The name of the dedicated host. Required. :type host_name: str - :param properties: Parameters supplied to the Update Dedicated Host operation. Required. - :type properties: JSON + :param parameters: Parameters supplied to the Update Dedicated Host operation. Required. + :type parameters: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -26125,7 +26154,7 @@ def begin_update( resource_group_name: str, host_group_name: str, host_name: str, - properties: IO[bytes], + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -26139,8 +26168,8 @@ def begin_update( :type host_group_name: str :param host_name: The name of the dedicated host. Required. :type host_name: str - :param properties: Parameters supplied to the Update Dedicated Host operation. Required. - :type properties: IO[bytes] + :param parameters: Parameters supplied to the Update Dedicated Host operation. Required. + :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str @@ -26155,7 +26184,7 @@ def begin_update( resource_group_name: str, host_group_name: str, host_name: str, - properties: Union[_models.DedicatedHostUpdate, JSON, IO[bytes]], + parameters: Union[_models.DedicatedHostUpdate, JSON, IO[bytes]], **kwargs: Any ) -> LROPoller[None]: """Update a dedicated host . @@ -26167,9 +26196,9 @@ def begin_update( :type host_group_name: str :param host_name: The name of the dedicated host. Required. :type host_name: str - :param properties: Parameters supplied to the Update Dedicated Host operation. Is one of the + :param parameters: Parameters supplied to the Update Dedicated Host operation. Is one of the following types: DedicatedHostUpdate, JSON, IO[bytes] Required. - :type properties: ~azure.mgmt.compute.models.DedicatedHostUpdate or JSON or IO[bytes] + :type parameters: ~azure.mgmt.compute.models.DedicatedHostUpdate or JSON or IO[bytes] :return: An instance of LROPoller that returns None :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -26187,7 +26216,7 @@ def begin_update( resource_group_name=resource_group_name, host_group_name=host_group_name, host_name=host_name, - properties=properties, + parameters=parameters, content_type=content_type, cls=lambda x, y, z: x, headers=_headers, @@ -26869,7 +26898,7 @@ def create( self, resource_group_name: str, ssh_public_key_name: str, - resource: _models.SshPublicKeyResource, + parameters: _models.SshPublicKeyResource, *, content_type: str = "application/json", **kwargs: Any @@ -26881,8 +26910,8 @@ def create( :type resource_group_name: str :param ssh_public_key_name: The name of the SSH public key. Required. :type ssh_public_key_name: str - :param resource: Parameters supplied to create the SSH public key. Required. - :type resource: ~azure.mgmt.compute.models.SshPublicKeyResource + :param parameters: Parameters supplied to create the SSH public key. Required. + :type parameters: ~azure.mgmt.compute.models.SshPublicKeyResource :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -26896,7 +26925,7 @@ def create( self, resource_group_name: str, ssh_public_key_name: str, - resource: JSON, + parameters: JSON, *, content_type: str = "application/json", **kwargs: Any @@ -26908,8 +26937,8 @@ def create( :type resource_group_name: str :param ssh_public_key_name: The name of the SSH public key. Required. :type ssh_public_key_name: str - :param resource: Parameters supplied to create the SSH public key. Required. - :type resource: JSON + :param parameters: Parameters supplied to create the SSH public key. Required. + :type parameters: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -26923,7 +26952,7 @@ def create( self, resource_group_name: str, ssh_public_key_name: str, - resource: IO[bytes], + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -26935,8 +26964,8 @@ def create( :type resource_group_name: str :param ssh_public_key_name: The name of the SSH public key. Required. :type ssh_public_key_name: str - :param resource: Parameters supplied to create the SSH public key. Required. - :type resource: IO[bytes] + :param parameters: Parameters supplied to create the SSH public key. Required. + :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str @@ -26950,7 +26979,7 @@ def create( self, resource_group_name: str, ssh_public_key_name: str, - resource: Union[_models.SshPublicKeyResource, JSON, IO[bytes]], + parameters: Union[_models.SshPublicKeyResource, JSON, IO[bytes]], **kwargs: Any ) -> _models.SshPublicKeyResource: """Creates a new SSH public key resource. @@ -26960,9 +26989,9 @@ def create( :type resource_group_name: str :param ssh_public_key_name: The name of the SSH public key. Required. :type ssh_public_key_name: str - :param resource: Parameters supplied to create the SSH public key. Is one of the following + :param parameters: Parameters supplied to create the SSH public key. Is one of the following types: SshPublicKeyResource, JSON, IO[bytes] Required. - :type resource: ~azure.mgmt.compute.models.SshPublicKeyResource or JSON or IO[bytes] + :type parameters: ~azure.mgmt.compute.models.SshPublicKeyResource or JSON or IO[bytes] :return: SshPublicKeyResource. The SshPublicKeyResource is compatible with MutableMapping :rtype: ~azure.mgmt.compute.models.SshPublicKeyResource :raises ~azure.core.exceptions.HttpResponseError: @@ -26983,10 +27012,10 @@ def create( content_type = content_type or "application/json" _content = None - if isinstance(resource, (IOBase, bytes)): - _content = resource + if isinstance(parameters, (IOBase, bytes)): + _content = parameters else: - _content = json.dumps(resource, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore _request = build_ssh_public_key_resources_create_request( resource_group_name=resource_group_name, @@ -27035,7 +27064,7 @@ def update( self, resource_group_name: str, ssh_public_key_name: str, - properties: _models.SshPublicKeyUpdateResource, + parameters: _models.SshPublicKeyUpdateResource, *, content_type: str = "application/json", **kwargs: Any @@ -27047,8 +27076,8 @@ def update( :type resource_group_name: str :param ssh_public_key_name: The name of the SSH public key. Required. :type ssh_public_key_name: str - :param properties: Parameters supplied to update the SSH public key. Required. - :type properties: ~azure.mgmt.compute.models.SshPublicKeyUpdateResource + :param parameters: Parameters supplied to update the SSH public key. Required. + :type parameters: ~azure.mgmt.compute.models.SshPublicKeyUpdateResource :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -27062,7 +27091,7 @@ def update( self, resource_group_name: str, ssh_public_key_name: str, - properties: JSON, + parameters: JSON, *, content_type: str = "application/json", **kwargs: Any @@ -27074,8 +27103,8 @@ def update( :type resource_group_name: str :param ssh_public_key_name: The name of the SSH public key. Required. :type ssh_public_key_name: str - :param properties: Parameters supplied to update the SSH public key. Required. - :type properties: JSON + :param parameters: Parameters supplied to update the SSH public key. Required. + :type parameters: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -27089,7 +27118,7 @@ def update( self, resource_group_name: str, ssh_public_key_name: str, - properties: IO[bytes], + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -27101,8 +27130,8 @@ def update( :type resource_group_name: str :param ssh_public_key_name: The name of the SSH public key. Required. :type ssh_public_key_name: str - :param properties: Parameters supplied to update the SSH public key. Required. - :type properties: IO[bytes] + :param parameters: Parameters supplied to update the SSH public key. Required. + :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str @@ -27116,7 +27145,7 @@ def update( self, resource_group_name: str, ssh_public_key_name: str, - properties: Union[_models.SshPublicKeyUpdateResource, JSON, IO[bytes]], + parameters: Union[_models.SshPublicKeyUpdateResource, JSON, IO[bytes]], **kwargs: Any ) -> _models.SshPublicKeyResource: """Updates a new SSH public key resource. @@ -27126,9 +27155,9 @@ def update( :type resource_group_name: str :param ssh_public_key_name: The name of the SSH public key. Required. :type ssh_public_key_name: str - :param properties: Parameters supplied to update the SSH public key. Is one of the following + :param parameters: Parameters supplied to update the SSH public key. Is one of the following types: SshPublicKeyUpdateResource, JSON, IO[bytes] Required. - :type properties: ~azure.mgmt.compute.models.SshPublicKeyUpdateResource or JSON or IO[bytes] + :type parameters: ~azure.mgmt.compute.models.SshPublicKeyUpdateResource or JSON or IO[bytes] :return: SshPublicKeyResource. The SshPublicKeyResource is compatible with MutableMapping :rtype: ~azure.mgmt.compute.models.SshPublicKeyResource :raises ~azure.core.exceptions.HttpResponseError: @@ -27149,10 +27178,10 @@ def update( content_type = content_type or "application/json" _content = None - if isinstance(properties, (IOBase, bytes)): - _content = properties + if isinstance(parameters, (IOBase, bytes)): + _content = parameters else: - _content = json.dumps(properties, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore _request = build_ssh_public_key_resources_update_request( resource_group_name=resource_group_name, @@ -27701,7 +27730,11 @@ def get( return deserialized # type: ignore def _create_or_update_initial( - self, resource_group_name: str, image_name: str, resource: Union[_models.Image, JSON, IO[bytes]], **kwargs: Any + self, + resource_group_name: str, + image_name: str, + parameters: Union[_models.Image, JSON, IO[bytes]], + **kwargs: Any ) -> Iterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -27719,10 +27752,10 @@ def _create_or_update_initial( content_type = content_type or "application/json" _content = None - if isinstance(resource, (IOBase, bytes)): - _content = resource + if isinstance(parameters, (IOBase, bytes)): + _content = parameters else: - _content = json.dumps(resource, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore _request = build_images_create_or_update_request( resource_group_name=resource_group_name, @@ -27772,7 +27805,7 @@ def begin_create_or_update( self, resource_group_name: str, image_name: str, - resource: _models.Image, + parameters: _models.Image, *, content_type: str = "application/json", **kwargs: Any @@ -27784,8 +27817,8 @@ def begin_create_or_update( :type resource_group_name: str :param image_name: The name of the image. Required. :type image_name: str - :param resource: Parameters supplied to the Create Image operation. Required. - :type resource: ~azure.mgmt.compute.models.Image + :param parameters: Parameters supplied to the Create Image operation. Required. + :type parameters: ~azure.mgmt.compute.models.Image :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -27799,7 +27832,7 @@ def begin_create_or_update( self, resource_group_name: str, image_name: str, - resource: JSON, + parameters: JSON, *, content_type: str = "application/json", **kwargs: Any @@ -27811,8 +27844,8 @@ def begin_create_or_update( :type resource_group_name: str :param image_name: The name of the image. Required. :type image_name: str - :param resource: Parameters supplied to the Create Image operation. Required. - :type resource: JSON + :param parameters: Parameters supplied to the Create Image operation. Required. + :type parameters: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -27826,7 +27859,7 @@ def begin_create_or_update( self, resource_group_name: str, image_name: str, - resource: IO[bytes], + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -27838,8 +27871,8 @@ def begin_create_or_update( :type resource_group_name: str :param image_name: The name of the image. Required. :type image_name: str - :param resource: Parameters supplied to the Create Image operation. Required. - :type resource: IO[bytes] + :param parameters: Parameters supplied to the Create Image operation. Required. + :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str @@ -27850,7 +27883,11 @@ def begin_create_or_update( @distributed_trace def begin_create_or_update( - self, resource_group_name: str, image_name: str, resource: Union[_models.Image, JSON, IO[bytes]], **kwargs: Any + self, + resource_group_name: str, + image_name: str, + parameters: Union[_models.Image, JSON, IO[bytes]], + **kwargs: Any ) -> LROPoller[None]: """Create or update an image. @@ -27859,9 +27896,9 @@ def begin_create_or_update( :type resource_group_name: str :param image_name: The name of the image. Required. :type image_name: str - :param resource: Parameters supplied to the Create Image operation. Is one of the following + :param parameters: Parameters supplied to the Create Image operation. Is one of the following types: Image, JSON, IO[bytes] Required. - :type resource: ~azure.mgmt.compute.models.Image or JSON or IO[bytes] + :type parameters: ~azure.mgmt.compute.models.Image or JSON or IO[bytes] :return: An instance of LROPoller that returns None :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -27878,7 +27915,7 @@ def begin_create_or_update( raw_result = self._create_or_update_initial( resource_group_name=resource_group_name, image_name=image_name, - resource=resource, + parameters=parameters, content_type=content_type, cls=lambda x, y, z: x, headers=_headers, @@ -27917,7 +27954,7 @@ def _update_initial( self, resource_group_name: str, image_name: str, - properties: Union[_models.ImageUpdate, JSON, IO[bytes]], + parameters: Union[_models.ImageUpdate, JSON, IO[bytes]], **kwargs: Any ) -> Iterator[bytes]: error_map: MutableMapping = { @@ -27936,10 +27973,10 @@ def _update_initial( content_type = content_type or "application/json" _content = None - if isinstance(properties, (IOBase, bytes)): - _content = properties + if isinstance(parameters, (IOBase, bytes)): + _content = parameters else: - _content = json.dumps(properties, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore _request = build_images_update_request( resource_group_name=resource_group_name, @@ -27989,7 +28026,7 @@ def begin_update( self, resource_group_name: str, image_name: str, - properties: _models.ImageUpdate, + parameters: _models.ImageUpdate, *, content_type: str = "application/json", **kwargs: Any @@ -28001,8 +28038,8 @@ def begin_update( :type resource_group_name: str :param image_name: The name of the image. Required. :type image_name: str - :param properties: Parameters supplied to the Update Image operation. Required. - :type properties: ~azure.mgmt.compute.models.ImageUpdate + :param parameters: Parameters supplied to the Update Image operation. Required. + :type parameters: ~azure.mgmt.compute.models.ImageUpdate :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -28016,7 +28053,7 @@ def begin_update( self, resource_group_name: str, image_name: str, - properties: JSON, + parameters: JSON, *, content_type: str = "application/json", **kwargs: Any @@ -28028,8 +28065,8 @@ def begin_update( :type resource_group_name: str :param image_name: The name of the image. Required. :type image_name: str - :param properties: Parameters supplied to the Update Image operation. Required. - :type properties: JSON + :param parameters: Parameters supplied to the Update Image operation. Required. + :type parameters: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -28043,7 +28080,7 @@ def begin_update( self, resource_group_name: str, image_name: str, - properties: IO[bytes], + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -28055,8 +28092,8 @@ def begin_update( :type resource_group_name: str :param image_name: The name of the image. Required. :type image_name: str - :param properties: Parameters supplied to the Update Image operation. Required. - :type properties: IO[bytes] + :param parameters: Parameters supplied to the Update Image operation. Required. + :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str @@ -28070,7 +28107,7 @@ def begin_update( self, resource_group_name: str, image_name: str, - properties: Union[_models.ImageUpdate, JSON, IO[bytes]], + parameters: Union[_models.ImageUpdate, JSON, IO[bytes]], **kwargs: Any ) -> LROPoller[None]: """Update an image. @@ -28080,9 +28117,9 @@ def begin_update( :type resource_group_name: str :param image_name: The name of the image. Required. :type image_name: str - :param properties: Parameters supplied to the Update Image operation. Is one of the following + :param parameters: Parameters supplied to the Update Image operation. Is one of the following types: ImageUpdate, JSON, IO[bytes] Required. - :type properties: ~azure.mgmt.compute.models.ImageUpdate or JSON or IO[bytes] + :type parameters: ~azure.mgmt.compute.models.ImageUpdate or JSON or IO[bytes] :return: An instance of LROPoller that returns None :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -28099,7 +28136,7 @@ def begin_update( raw_result = self._update_initial( resource_group_name=resource_group_name, image_name=image_name, - properties=properties, + parameters=parameters, content_type=content_type, cls=lambda x, y, z: x, headers=_headers, @@ -28521,7 +28558,7 @@ def create_or_update( self, resource_group_name: str, restore_point_collection_name: str, - resource: _models.RestorePointCollection, + parameters: _models.RestorePointCollection, *, content_type: str = "application/json", **kwargs: Any @@ -28535,9 +28572,9 @@ def create_or_update( :type resource_group_name: str :param restore_point_collection_name: The name of the restore point collection. Required. :type restore_point_collection_name: str - :param resource: Parameters supplied to the Create or Update restore point collection + :param parameters: Parameters supplied to the Create or Update restore point collection operation. Required. - :type resource: ~azure.mgmt.compute.models.RestorePointCollection + :type parameters: ~azure.mgmt.compute.models.RestorePointCollection :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -28551,7 +28588,7 @@ def create_or_update( self, resource_group_name: str, restore_point_collection_name: str, - resource: JSON, + parameters: JSON, *, content_type: str = "application/json", **kwargs: Any @@ -28565,9 +28602,9 @@ def create_or_update( :type resource_group_name: str :param restore_point_collection_name: The name of the restore point collection. Required. :type restore_point_collection_name: str - :param resource: Parameters supplied to the Create or Update restore point collection + :param parameters: Parameters supplied to the Create or Update restore point collection operation. Required. - :type resource: JSON + :type parameters: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -28581,7 +28618,7 @@ def create_or_update( self, resource_group_name: str, restore_point_collection_name: str, - resource: IO[bytes], + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -28595,9 +28632,9 @@ def create_or_update( :type resource_group_name: str :param restore_point_collection_name: The name of the restore point collection. Required. :type restore_point_collection_name: str - :param resource: Parameters supplied to the Create or Update restore point collection + :param parameters: Parameters supplied to the Create or Update restore point collection operation. Required. - :type resource: IO[bytes] + :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str @@ -28611,7 +28648,7 @@ def create_or_update( self, resource_group_name: str, restore_point_collection_name: str, - resource: Union[_models.RestorePointCollection, JSON, IO[bytes]], + parameters: Union[_models.RestorePointCollection, JSON, IO[bytes]], **kwargs: Any ) -> _models.RestorePointCollection: """The operation to create or update the restore point collection. Please refer to @@ -28623,9 +28660,9 @@ def create_or_update( :type resource_group_name: str :param restore_point_collection_name: The name of the restore point collection. Required. :type restore_point_collection_name: str - :param resource: Parameters supplied to the Create or Update restore point collection + :param parameters: Parameters supplied to the Create or Update restore point collection operation. Is one of the following types: RestorePointCollection, JSON, IO[bytes] Required. - :type resource: ~azure.mgmt.compute.models.RestorePointCollection or JSON or IO[bytes] + :type parameters: ~azure.mgmt.compute.models.RestorePointCollection or JSON or IO[bytes] :return: RestorePointCollection. The RestorePointCollection is compatible with MutableMapping :rtype: ~azure.mgmt.compute.models.RestorePointCollection :raises ~azure.core.exceptions.HttpResponseError: @@ -28646,10 +28683,10 @@ def create_or_update( content_type = content_type or "application/json" _content = None - if isinstance(resource, (IOBase, bytes)): - _content = resource + if isinstance(parameters, (IOBase, bytes)): + _content = parameters else: - _content = json.dumps(resource, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore _request = build_restore_point_collections_create_or_update_request( resource_group_name=resource_group_name, @@ -28698,7 +28735,7 @@ def update( self, resource_group_name: str, restore_point_collection_name: str, - properties: _models.RestorePointCollectionUpdate, + parameters: _models.RestorePointCollectionUpdate, *, content_type: str = "application/json", **kwargs: Any @@ -28710,9 +28747,9 @@ def update( :type resource_group_name: str :param restore_point_collection_name: The name of the restore point collection. Required. :type restore_point_collection_name: str - :param properties: Parameters supplied to the Update restore point collection operation. + :param parameters: Parameters supplied to the Update restore point collection operation. Required. - :type properties: ~azure.mgmt.compute.models.RestorePointCollectionUpdate + :type parameters: ~azure.mgmt.compute.models.RestorePointCollectionUpdate :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -28726,7 +28763,7 @@ def update( self, resource_group_name: str, restore_point_collection_name: str, - properties: JSON, + parameters: JSON, *, content_type: str = "application/json", **kwargs: Any @@ -28738,9 +28775,9 @@ def update( :type resource_group_name: str :param restore_point_collection_name: The name of the restore point collection. Required. :type restore_point_collection_name: str - :param properties: Parameters supplied to the Update restore point collection operation. + :param parameters: Parameters supplied to the Update restore point collection operation. Required. - :type properties: JSON + :type parameters: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -28754,7 +28791,7 @@ def update( self, resource_group_name: str, restore_point_collection_name: str, - properties: IO[bytes], + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -28766,9 +28803,9 @@ def update( :type resource_group_name: str :param restore_point_collection_name: The name of the restore point collection. Required. :type restore_point_collection_name: str - :param properties: Parameters supplied to the Update restore point collection operation. + :param parameters: Parameters supplied to the Update restore point collection operation. Required. - :type properties: IO[bytes] + :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str @@ -28782,7 +28819,7 @@ def update( self, resource_group_name: str, restore_point_collection_name: str, - properties: Union[_models.RestorePointCollectionUpdate, JSON, IO[bytes]], + parameters: Union[_models.RestorePointCollectionUpdate, JSON, IO[bytes]], **kwargs: Any ) -> _models.RestorePointCollection: """The operation to update the restore point collection. @@ -28792,9 +28829,9 @@ def update( :type resource_group_name: str :param restore_point_collection_name: The name of the restore point collection. Required. :type restore_point_collection_name: str - :param properties: Parameters supplied to the Update restore point collection operation. Is one + :param parameters: Parameters supplied to the Update restore point collection operation. Is one of the following types: RestorePointCollectionUpdate, JSON, IO[bytes] Required. - :type properties: ~azure.mgmt.compute.models.RestorePointCollectionUpdate or JSON or IO[bytes] + :type parameters: ~azure.mgmt.compute.models.RestorePointCollectionUpdate or JSON or IO[bytes] :return: RestorePointCollection. The RestorePointCollection is compatible with MutableMapping :rtype: ~azure.mgmt.compute.models.RestorePointCollection :raises ~azure.core.exceptions.HttpResponseError: @@ -28815,10 +28852,10 @@ def update( content_type = content_type or "application/json" _content = None - if isinstance(properties, (IOBase, bytes)): - _content = properties + if isinstance(parameters, (IOBase, bytes)): + _content = parameters else: - _content = json.dumps(properties, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore _request = build_restore_point_collections_update_request( resource_group_name=resource_group_name, @@ -29257,7 +29294,7 @@ def _create_initial( resource_group_name: str, restore_point_collection_name: str, restore_point_name: str, - resource: Union[_models.RestorePoint, JSON, IO[bytes]], + parameters: Union[_models.RestorePoint, JSON, IO[bytes]], **kwargs: Any ) -> Iterator[bytes]: error_map: MutableMapping = { @@ -29276,10 +29313,10 @@ def _create_initial( content_type = content_type or "application/json" _content = None - if isinstance(resource, (IOBase, bytes)): - _content = resource + if isinstance(parameters, (IOBase, bytes)): + _content = parameters else: - _content = json.dumps(resource, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore _request = build_restore_points_create_request( resource_group_name=resource_group_name, @@ -29330,7 +29367,7 @@ def begin_create( resource_group_name: str, restore_point_collection_name: str, restore_point_name: str, - resource: _models.RestorePoint, + parameters: _models.RestorePoint, *, content_type: str = "application/json", **kwargs: Any @@ -29345,8 +29382,8 @@ def begin_create( :type restore_point_collection_name: str :param restore_point_name: The name of the restore point. Required. :type restore_point_name: str - :param resource: Parameters supplied to the Create restore point operation. Required. - :type resource: ~azure.mgmt.compute.models.RestorePoint + :param parameters: Parameters supplied to the Create restore point operation. Required. + :type parameters: ~azure.mgmt.compute.models.RestorePoint :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -29361,7 +29398,7 @@ def begin_create( resource_group_name: str, restore_point_collection_name: str, restore_point_name: str, - resource: JSON, + parameters: JSON, *, content_type: str = "application/json", **kwargs: Any @@ -29376,8 +29413,8 @@ def begin_create( :type restore_point_collection_name: str :param restore_point_name: The name of the restore point. Required. :type restore_point_name: str - :param resource: Parameters supplied to the Create restore point operation. Required. - :type resource: JSON + :param parameters: Parameters supplied to the Create restore point operation. Required. + :type parameters: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -29392,7 +29429,7 @@ def begin_create( resource_group_name: str, restore_point_collection_name: str, restore_point_name: str, - resource: IO[bytes], + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -29407,8 +29444,8 @@ def begin_create( :type restore_point_collection_name: str :param restore_point_name: The name of the restore point. Required. :type restore_point_name: str - :param resource: Parameters supplied to the Create restore point operation. Required. - :type resource: IO[bytes] + :param parameters: Parameters supplied to the Create restore point operation. Required. + :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str @@ -29423,7 +29460,7 @@ def begin_create( resource_group_name: str, restore_point_collection_name: str, restore_point_name: str, - resource: Union[_models.RestorePoint, JSON, IO[bytes]], + parameters: Union[_models.RestorePoint, JSON, IO[bytes]], **kwargs: Any ) -> LROPoller[None]: """The operation to create the restore point. Updating properties of an existing restore point is @@ -29436,9 +29473,9 @@ def begin_create( :type restore_point_collection_name: str :param restore_point_name: The name of the restore point. Required. :type restore_point_name: str - :param resource: Parameters supplied to the Create restore point operation. Is one of the + :param parameters: Parameters supplied to the Create restore point operation. Is one of the following types: RestorePoint, JSON, IO[bytes] Required. - :type resource: ~azure.mgmt.compute.models.RestorePoint or JSON or IO[bytes] + :type parameters: ~azure.mgmt.compute.models.RestorePoint or JSON or IO[bytes] :return: An instance of LROPoller that returns None :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -29456,7 +29493,7 @@ def begin_create( resource_group_name=resource_group_name, restore_point_collection_name=restore_point_collection_name, restore_point_name=restore_point_name, - resource=resource, + parameters=parameters, content_type=content_type, cls=lambda x, y, z: x, headers=_headers, @@ -29715,7 +29752,7 @@ def create_or_update( self, resource_group_name: str, capacity_reservation_group_name: str, - resource: _models.CapacityReservationGroup, + parameters: _models.CapacityReservationGroup, *, content_type: str = "application/json", **kwargs: Any @@ -29729,8 +29766,8 @@ def create_or_update( :type resource_group_name: str :param capacity_reservation_group_name: The name of the capacity reservation group. Required. :type capacity_reservation_group_name: str - :param resource: Parameters supplied to the Create capacity reservation Group. Required. - :type resource: ~azure.mgmt.compute.models.CapacityReservationGroup + :param parameters: Parameters supplied to the Create capacity reservation Group. Required. + :type parameters: ~azure.mgmt.compute.models.CapacityReservationGroup :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -29745,7 +29782,7 @@ def create_or_update( self, resource_group_name: str, capacity_reservation_group_name: str, - resource: JSON, + parameters: JSON, *, content_type: str = "application/json", **kwargs: Any @@ -29759,8 +29796,8 @@ def create_or_update( :type resource_group_name: str :param capacity_reservation_group_name: The name of the capacity reservation group. Required. :type capacity_reservation_group_name: str - :param resource: Parameters supplied to the Create capacity reservation Group. Required. - :type resource: JSON + :param parameters: Parameters supplied to the Create capacity reservation Group. Required. + :type parameters: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -29775,7 +29812,7 @@ def create_or_update( self, resource_group_name: str, capacity_reservation_group_name: str, - resource: IO[bytes], + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -29789,8 +29826,8 @@ def create_or_update( :type resource_group_name: str :param capacity_reservation_group_name: The name of the capacity reservation group. Required. :type capacity_reservation_group_name: str - :param resource: Parameters supplied to the Create capacity reservation Group. Required. - :type resource: IO[bytes] + :param parameters: Parameters supplied to the Create capacity reservation Group. Required. + :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str @@ -29805,7 +29842,7 @@ def create_or_update( self, resource_group_name: str, capacity_reservation_group_name: str, - resource: Union[_models.CapacityReservationGroup, JSON, IO[bytes]], + parameters: Union[_models.CapacityReservationGroup, JSON, IO[bytes]], **kwargs: Any ) -> _models.CapacityReservationGroup: """The operation to create or update a capacity reservation group. When updating a capacity @@ -29817,9 +29854,9 @@ def create_or_update( :type resource_group_name: str :param capacity_reservation_group_name: The name of the capacity reservation group. Required. :type capacity_reservation_group_name: str - :param resource: Parameters supplied to the Create capacity reservation Group. Is one of the + :param parameters: Parameters supplied to the Create capacity reservation Group. Is one of the following types: CapacityReservationGroup, JSON, IO[bytes] Required. - :type resource: ~azure.mgmt.compute.models.CapacityReservationGroup or JSON or IO[bytes] + :type parameters: ~azure.mgmt.compute.models.CapacityReservationGroup or JSON or IO[bytes] :return: CapacityReservationGroup. The CapacityReservationGroup is compatible with MutableMapping :rtype: ~azure.mgmt.compute.models.CapacityReservationGroup @@ -29841,10 +29878,10 @@ def create_or_update( content_type = content_type or "application/json" _content = None - if isinstance(resource, (IOBase, bytes)): - _content = resource + if isinstance(parameters, (IOBase, bytes)): + _content = parameters else: - _content = json.dumps(resource, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore _request = build_capacity_reservation_groups_create_or_update_request( resource_group_name=resource_group_name, @@ -29893,7 +29930,7 @@ def update( self, resource_group_name: str, capacity_reservation_group_name: str, - properties: _models.CapacityReservationGroupUpdate, + parameters: _models.CapacityReservationGroupUpdate, *, content_type: str = "application/json", **kwargs: Any @@ -29906,9 +29943,9 @@ def update( :type resource_group_name: str :param capacity_reservation_group_name: The name of the capacity reservation group. Required. :type capacity_reservation_group_name: str - :param properties: Parameters supplied to the Update capacity reservation Group operation. + :param parameters: Parameters supplied to the Update capacity reservation Group operation. Required. - :type properties: ~azure.mgmt.compute.models.CapacityReservationGroupUpdate + :type parameters: ~azure.mgmt.compute.models.CapacityReservationGroupUpdate :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -29923,7 +29960,7 @@ def update( self, resource_group_name: str, capacity_reservation_group_name: str, - properties: JSON, + parameters: JSON, *, content_type: str = "application/json", **kwargs: Any @@ -29936,9 +29973,9 @@ def update( :type resource_group_name: str :param capacity_reservation_group_name: The name of the capacity reservation group. Required. :type capacity_reservation_group_name: str - :param properties: Parameters supplied to the Update capacity reservation Group operation. + :param parameters: Parameters supplied to the Update capacity reservation Group operation. Required. - :type properties: JSON + :type parameters: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -29953,7 +29990,7 @@ def update( self, resource_group_name: str, capacity_reservation_group_name: str, - properties: IO[bytes], + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -29966,9 +30003,9 @@ def update( :type resource_group_name: str :param capacity_reservation_group_name: The name of the capacity reservation group. Required. :type capacity_reservation_group_name: str - :param properties: Parameters supplied to the Update capacity reservation Group operation. + :param parameters: Parameters supplied to the Update capacity reservation Group operation. Required. - :type properties: IO[bytes] + :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str @@ -29983,7 +30020,7 @@ def update( self, resource_group_name: str, capacity_reservation_group_name: str, - properties: Union[_models.CapacityReservationGroupUpdate, JSON, IO[bytes]], + parameters: Union[_models.CapacityReservationGroupUpdate, JSON, IO[bytes]], **kwargs: Any ) -> _models.CapacityReservationGroup: """The operation to update a capacity reservation group. When updating a capacity reservation @@ -29994,9 +30031,9 @@ def update( :type resource_group_name: str :param capacity_reservation_group_name: The name of the capacity reservation group. Required. :type capacity_reservation_group_name: str - :param properties: Parameters supplied to the Update capacity reservation Group operation. Is + :param parameters: Parameters supplied to the Update capacity reservation Group operation. Is one of the following types: CapacityReservationGroupUpdate, JSON, IO[bytes] Required. - :type properties: ~azure.mgmt.compute.models.CapacityReservationGroupUpdate or JSON or + :type parameters: ~azure.mgmt.compute.models.CapacityReservationGroupUpdate or JSON or IO[bytes] :return: CapacityReservationGroup. The CapacityReservationGroup is compatible with MutableMapping @@ -30019,10 +30056,10 @@ def update( content_type = content_type or "application/json" _content = None - if isinstance(properties, (IOBase, bytes)): - _content = properties + if isinstance(parameters, (IOBase, bytes)): + _content = parameters else: - _content = json.dumps(properties, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore _request = build_capacity_reservation_groups_update_request( resource_group_name=resource_group_name, @@ -30438,7 +30475,7 @@ def _create_or_update_initial( resource_group_name: str, capacity_reservation_group_name: str, capacity_reservation_name: str, - resource: Union[_models.CapacityReservation, JSON, IO[bytes]], + parameters: Union[_models.CapacityReservation, JSON, IO[bytes]], **kwargs: Any ) -> Iterator[bytes]: error_map: MutableMapping = { @@ -30457,10 +30494,10 @@ def _create_or_update_initial( content_type = content_type or "application/json" _content = None - if isinstance(resource, (IOBase, bytes)): - _content = resource + if isinstance(parameters, (IOBase, bytes)): + _content = parameters else: - _content = json.dumps(resource, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore _request = build_capacity_reservations_create_or_update_request( resource_group_name=resource_group_name, @@ -30512,7 +30549,7 @@ def begin_create_or_update( resource_group_name: str, capacity_reservation_group_name: str, capacity_reservation_name: str, - resource: _models.CapacityReservation, + parameters: _models.CapacityReservation, *, content_type: str = "application/json", **kwargs: Any @@ -30528,8 +30565,8 @@ def begin_create_or_update( :type capacity_reservation_group_name: str :param capacity_reservation_name: The name of the capacity reservation. Required. :type capacity_reservation_name: str - :param resource: Parameters supplied to the Create capacity reservation. Required. - :type resource: ~azure.mgmt.compute.models.CapacityReservation + :param parameters: Parameters supplied to the Create capacity reservation. Required. + :type parameters: ~azure.mgmt.compute.models.CapacityReservation :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -30544,7 +30581,7 @@ def begin_create_or_update( resource_group_name: str, capacity_reservation_group_name: str, capacity_reservation_name: str, - resource: JSON, + parameters: JSON, *, content_type: str = "application/json", **kwargs: Any @@ -30560,8 +30597,8 @@ def begin_create_or_update( :type capacity_reservation_group_name: str :param capacity_reservation_name: The name of the capacity reservation. Required. :type capacity_reservation_name: str - :param resource: Parameters supplied to the Create capacity reservation. Required. - :type resource: JSON + :param parameters: Parameters supplied to the Create capacity reservation. Required. + :type parameters: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -30576,7 +30613,7 @@ def begin_create_or_update( resource_group_name: str, capacity_reservation_group_name: str, capacity_reservation_name: str, - resource: IO[bytes], + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -30592,8 +30629,8 @@ def begin_create_or_update( :type capacity_reservation_group_name: str :param capacity_reservation_name: The name of the capacity reservation. Required. :type capacity_reservation_name: str - :param resource: Parameters supplied to the Create capacity reservation. Required. - :type resource: IO[bytes] + :param parameters: Parameters supplied to the Create capacity reservation. Required. + :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str @@ -30608,7 +30645,7 @@ def begin_create_or_update( resource_group_name: str, capacity_reservation_group_name: str, capacity_reservation_name: str, - resource: Union[_models.CapacityReservation, JSON, IO[bytes]], + parameters: Union[_models.CapacityReservation, JSON, IO[bytes]], **kwargs: Any ) -> LROPoller[None]: """The operation to create or update a capacity reservation. Please note some properties can be @@ -30622,9 +30659,9 @@ def begin_create_or_update( :type capacity_reservation_group_name: str :param capacity_reservation_name: The name of the capacity reservation. Required. :type capacity_reservation_name: str - :param resource: Parameters supplied to the Create capacity reservation. Is one of the + :param parameters: Parameters supplied to the Create capacity reservation. Is one of the following types: CapacityReservation, JSON, IO[bytes] Required. - :type resource: ~azure.mgmt.compute.models.CapacityReservation or JSON or IO[bytes] + :type parameters: ~azure.mgmt.compute.models.CapacityReservation or JSON or IO[bytes] :return: An instance of LROPoller that returns None :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -30642,7 +30679,7 @@ def begin_create_or_update( resource_group_name=resource_group_name, capacity_reservation_group_name=capacity_reservation_group_name, capacity_reservation_name=capacity_reservation_name, - resource=resource, + parameters=parameters, content_type=content_type, cls=lambda x, y, z: x, headers=_headers, @@ -30682,7 +30719,7 @@ def _update_initial( resource_group_name: str, capacity_reservation_group_name: str, capacity_reservation_name: str, - properties: Union[_models.CapacityReservationUpdate, JSON, IO[bytes]], + parameters: Union[_models.CapacityReservationUpdate, JSON, IO[bytes]], **kwargs: Any ) -> Iterator[bytes]: error_map: MutableMapping = { @@ -30701,10 +30738,10 @@ def _update_initial( content_type = content_type or "application/json" _content = None - if isinstance(properties, (IOBase, bytes)): - _content = properties + if isinstance(parameters, (IOBase, bytes)): + _content = parameters else: - _content = json.dumps(properties, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore _request = build_capacity_reservations_update_request( resource_group_name=resource_group_name, @@ -30756,7 +30793,7 @@ def begin_update( resource_group_name: str, capacity_reservation_group_name: str, capacity_reservation_name: str, - properties: _models.CapacityReservationUpdate, + parameters: _models.CapacityReservationUpdate, *, content_type: str = "application/json", **kwargs: Any @@ -30770,8 +30807,8 @@ def begin_update( :type capacity_reservation_group_name: str :param capacity_reservation_name: The name of the capacity reservation. Required. :type capacity_reservation_name: str - :param properties: Parameters supplied to the Update capacity reservation operation. Required. - :type properties: ~azure.mgmt.compute.models.CapacityReservationUpdate + :param parameters: Parameters supplied to the Update capacity reservation operation. Required. + :type parameters: ~azure.mgmt.compute.models.CapacityReservationUpdate :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -30786,7 +30823,7 @@ def begin_update( resource_group_name: str, capacity_reservation_group_name: str, capacity_reservation_name: str, - properties: JSON, + parameters: JSON, *, content_type: str = "application/json", **kwargs: Any @@ -30800,8 +30837,8 @@ def begin_update( :type capacity_reservation_group_name: str :param capacity_reservation_name: The name of the capacity reservation. Required. :type capacity_reservation_name: str - :param properties: Parameters supplied to the Update capacity reservation operation. Required. - :type properties: JSON + :param parameters: Parameters supplied to the Update capacity reservation operation. Required. + :type parameters: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -30816,7 +30853,7 @@ def begin_update( resource_group_name: str, capacity_reservation_group_name: str, capacity_reservation_name: str, - properties: IO[bytes], + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -30830,8 +30867,8 @@ def begin_update( :type capacity_reservation_group_name: str :param capacity_reservation_name: The name of the capacity reservation. Required. :type capacity_reservation_name: str - :param properties: Parameters supplied to the Update capacity reservation operation. Required. - :type properties: IO[bytes] + :param parameters: Parameters supplied to the Update capacity reservation operation. Required. + :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str @@ -30846,7 +30883,7 @@ def begin_update( resource_group_name: str, capacity_reservation_group_name: str, capacity_reservation_name: str, - properties: Union[_models.CapacityReservationUpdate, JSON, IO[bytes]], + parameters: Union[_models.CapacityReservationUpdate, JSON, IO[bytes]], **kwargs: Any ) -> LROPoller[None]: """The operation to update a capacity reservation. @@ -30858,9 +30895,9 @@ def begin_update( :type capacity_reservation_group_name: str :param capacity_reservation_name: The name of the capacity reservation. Required. :type capacity_reservation_name: str - :param properties: Parameters supplied to the Update capacity reservation operation. Is one of + :param parameters: Parameters supplied to the Update capacity reservation operation. Is one of the following types: CapacityReservationUpdate, JSON, IO[bytes] Required. - :type properties: ~azure.mgmt.compute.models.CapacityReservationUpdate or JSON or IO[bytes] + :type parameters: ~azure.mgmt.compute.models.CapacityReservationUpdate or JSON or IO[bytes] :return: An instance of LROPoller that returns None :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -30878,7 +30915,7 @@ def begin_update( resource_group_name=resource_group_name, capacity_reservation_group_name=capacity_reservation_group_name, capacity_reservation_name=capacity_reservation_name, - properties=properties, + parameters=parameters, content_type=content_type, cls=lambda x, y, z: x, headers=_headers, @@ -31243,7 +31280,7 @@ def _create_or_update_initial( resource_group_name: str, vm_name: str, run_command_name: str, - body: Union[_models.VirtualMachineRunCommand, JSON, IO[bytes]], + run_command: Union[_models.VirtualMachineRunCommand, JSON, IO[bytes]], **kwargs: Any ) -> Iterator[bytes]: error_map: MutableMapping = { @@ -31262,10 +31299,10 @@ def _create_or_update_initial( content_type = content_type or "application/json" _content = None - if isinstance(body, (IOBase, bytes)): - _content = body + if isinstance(run_command, (IOBase, bytes)): + _content = run_command else: - _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(run_command, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore _request = build_virtual_machine_run_commands_create_or_update_request( resource_group_name=resource_group_name, @@ -31317,7 +31354,7 @@ def begin_create_or_update( resource_group_name: str, vm_name: str, run_command_name: str, - body: _models.VirtualMachineRunCommand, + run_command: _models.VirtualMachineRunCommand, *, content_type: str = "application/json", **kwargs: Any @@ -31331,8 +31368,9 @@ def begin_create_or_update( :type vm_name: str :param run_command_name: The name of the VirtualMachineRunCommand. Required. :type run_command_name: str - :param body: Parameters supplied to the Create Virtual Machine RunCommand operation. Required. - :type body: ~azure.mgmt.compute.models.VirtualMachineRunCommand + :param run_command: Parameters supplied to the Create Virtual Machine RunCommand operation. + Required. + :type run_command: ~azure.mgmt.compute.models.VirtualMachineRunCommand :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -31347,7 +31385,7 @@ def begin_create_or_update( resource_group_name: str, vm_name: str, run_command_name: str, - body: JSON, + run_command: JSON, *, content_type: str = "application/json", **kwargs: Any @@ -31361,8 +31399,9 @@ def begin_create_or_update( :type vm_name: str :param run_command_name: The name of the VirtualMachineRunCommand. Required. :type run_command_name: str - :param body: Parameters supplied to the Create Virtual Machine RunCommand operation. Required. - :type body: JSON + :param run_command: Parameters supplied to the Create Virtual Machine RunCommand operation. + Required. + :type run_command: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -31377,7 +31416,7 @@ def begin_create_or_update( resource_group_name: str, vm_name: str, run_command_name: str, - body: IO[bytes], + run_command: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -31391,8 +31430,9 @@ def begin_create_or_update( :type vm_name: str :param run_command_name: The name of the VirtualMachineRunCommand. Required. :type run_command_name: str - :param body: Parameters supplied to the Create Virtual Machine RunCommand operation. Required. - :type body: IO[bytes] + :param run_command: Parameters supplied to the Create Virtual Machine RunCommand operation. + Required. + :type run_command: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str @@ -31407,7 +31447,7 @@ def begin_create_or_update( resource_group_name: str, vm_name: str, run_command_name: str, - body: Union[_models.VirtualMachineRunCommand, JSON, IO[bytes]], + run_command: Union[_models.VirtualMachineRunCommand, JSON, IO[bytes]], **kwargs: Any ) -> LROPoller[None]: """The operation to create or update the run command. @@ -31419,9 +31459,9 @@ def begin_create_or_update( :type vm_name: str :param run_command_name: The name of the VirtualMachineRunCommand. Required. :type run_command_name: str - :param body: Parameters supplied to the Create Virtual Machine RunCommand operation. Is one of - the following types: VirtualMachineRunCommand, JSON, IO[bytes] Required. - :type body: ~azure.mgmt.compute.models.VirtualMachineRunCommand or JSON or IO[bytes] + :param run_command: Parameters supplied to the Create Virtual Machine RunCommand operation. Is + one of the following types: VirtualMachineRunCommand, JSON, IO[bytes] Required. + :type run_command: ~azure.mgmt.compute.models.VirtualMachineRunCommand or JSON or IO[bytes] :return: An instance of LROPoller that returns None :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -31439,7 +31479,7 @@ def begin_create_or_update( resource_group_name=resource_group_name, vm_name=vm_name, run_command_name=run_command_name, - body=body, + run_command=run_command, content_type=content_type, cls=lambda x, y, z: x, headers=_headers, @@ -31479,7 +31519,7 @@ def _update_initial( resource_group_name: str, vm_name: str, run_command_name: str, - body: Union[_models.VirtualMachineRunCommandUpdate, JSON, IO[bytes]], + run_command: Union[_models.VirtualMachineRunCommandUpdate, JSON, IO[bytes]], **kwargs: Any ) -> Iterator[bytes]: error_map: MutableMapping = { @@ -31498,10 +31538,10 @@ def _update_initial( content_type = content_type or "application/json" _content = None - if isinstance(body, (IOBase, bytes)): - _content = body + if isinstance(run_command, (IOBase, bytes)): + _content = run_command else: - _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(run_command, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore _request = build_virtual_machine_run_commands_update_request( resource_group_name=resource_group_name, @@ -31552,7 +31592,7 @@ def begin_update( resource_group_name: str, vm_name: str, run_command_name: str, - body: _models.VirtualMachineRunCommandUpdate, + run_command: _models.VirtualMachineRunCommandUpdate, *, content_type: str = "application/json", **kwargs: Any @@ -31566,8 +31606,9 @@ def begin_update( :type vm_name: str :param run_command_name: The name of the VirtualMachineRunCommand. Required. :type run_command_name: str - :param body: Parameters supplied to the Update Virtual Machine RunCommand operation. Required. - :type body: ~azure.mgmt.compute.models.VirtualMachineRunCommandUpdate + :param run_command: Parameters supplied to the Update Virtual Machine RunCommand operation. + Required. + :type run_command: ~azure.mgmt.compute.models.VirtualMachineRunCommandUpdate :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -31582,7 +31623,7 @@ def begin_update( resource_group_name: str, vm_name: str, run_command_name: str, - body: JSON, + run_command: JSON, *, content_type: str = "application/json", **kwargs: Any @@ -31596,8 +31637,9 @@ def begin_update( :type vm_name: str :param run_command_name: The name of the VirtualMachineRunCommand. Required. :type run_command_name: str - :param body: Parameters supplied to the Update Virtual Machine RunCommand operation. Required. - :type body: JSON + :param run_command: Parameters supplied to the Update Virtual Machine RunCommand operation. + Required. + :type run_command: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -31612,7 +31654,7 @@ def begin_update( resource_group_name: str, vm_name: str, run_command_name: str, - body: IO[bytes], + run_command: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -31626,8 +31668,9 @@ def begin_update( :type vm_name: str :param run_command_name: The name of the VirtualMachineRunCommand. Required. :type run_command_name: str - :param body: Parameters supplied to the Update Virtual Machine RunCommand operation. Required. - :type body: IO[bytes] + :param run_command: Parameters supplied to the Update Virtual Machine RunCommand operation. + Required. + :type run_command: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str @@ -31642,7 +31685,7 @@ def begin_update( resource_group_name: str, vm_name: str, run_command_name: str, - body: Union[_models.VirtualMachineRunCommandUpdate, JSON, IO[bytes]], + run_command: Union[_models.VirtualMachineRunCommandUpdate, JSON, IO[bytes]], **kwargs: Any ) -> LROPoller[None]: """The operation to update the run command. @@ -31654,9 +31697,10 @@ def begin_update( :type vm_name: str :param run_command_name: The name of the VirtualMachineRunCommand. Required. :type run_command_name: str - :param body: Parameters supplied to the Update Virtual Machine RunCommand operation. Is one of - the following types: VirtualMachineRunCommandUpdate, JSON, IO[bytes] Required. - :type body: ~azure.mgmt.compute.models.VirtualMachineRunCommandUpdate or JSON or IO[bytes] + :param run_command: Parameters supplied to the Update Virtual Machine RunCommand operation. Is + one of the following types: VirtualMachineRunCommandUpdate, JSON, IO[bytes] Required. + :type run_command: ~azure.mgmt.compute.models.VirtualMachineRunCommandUpdate or JSON or + IO[bytes] :return: An instance of LROPoller that returns None :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -31674,7 +31718,7 @@ def begin_update( resource_group_name=resource_group_name, vm_name=vm_name, run_command_name=run_command_name, - body=body, + run_command=run_command, content_type=content_type, cls=lambda x, y, z: x, headers=_headers, @@ -32034,7 +32078,7 @@ def _create_or_update_initial( vm_scale_set_name: str, instance_id: str, run_command_name: str, - body: Union[_models.VirtualMachineRunCommand, JSON, IO[bytes]], + run_command: Union[_models.VirtualMachineRunCommand, JSON, IO[bytes]], **kwargs: Any ) -> Iterator[bytes]: error_map: MutableMapping = { @@ -32053,10 +32097,10 @@ def _create_or_update_initial( content_type = content_type or "application/json" _content = None - if isinstance(body, (IOBase, bytes)): - _content = body + if isinstance(run_command, (IOBase, bytes)): + _content = run_command else: - _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(run_command, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore _request = build_virtual_machine_scale_set_vm_run_commands_create_or_update_request( resource_group_name=resource_group_name, @@ -32110,7 +32154,7 @@ def begin_create_or_update( vm_scale_set_name: str, instance_id: str, run_command_name: str, - body: _models.VirtualMachineRunCommand, + run_command: _models.VirtualMachineRunCommand, *, content_type: str = "application/json", **kwargs: Any @@ -32126,8 +32170,9 @@ def begin_create_or_update( :type instance_id: str :param run_command_name: The name of the VirtualMachineRunCommand. Required. :type run_command_name: str - :param body: Parameters supplied to the Create Virtual Machine RunCommand operation. Required. - :type body: ~azure.mgmt.compute.models.VirtualMachineRunCommand + :param run_command: Parameters supplied to the Create Virtual Machine RunCommand operation. + Required. + :type run_command: ~azure.mgmt.compute.models.VirtualMachineRunCommand :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -32143,7 +32188,7 @@ def begin_create_or_update( vm_scale_set_name: str, instance_id: str, run_command_name: str, - body: JSON, + run_command: JSON, *, content_type: str = "application/json", **kwargs: Any @@ -32159,8 +32204,9 @@ def begin_create_or_update( :type instance_id: str :param run_command_name: The name of the VirtualMachineRunCommand. Required. :type run_command_name: str - :param body: Parameters supplied to the Create Virtual Machine RunCommand operation. Required. - :type body: JSON + :param run_command: Parameters supplied to the Create Virtual Machine RunCommand operation. + Required. + :type run_command: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -32176,7 +32222,7 @@ def begin_create_or_update( vm_scale_set_name: str, instance_id: str, run_command_name: str, - body: IO[bytes], + run_command: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -32192,8 +32238,9 @@ def begin_create_or_update( :type instance_id: str :param run_command_name: The name of the VirtualMachineRunCommand. Required. :type run_command_name: str - :param body: Parameters supplied to the Create Virtual Machine RunCommand operation. Required. - :type body: IO[bytes] + :param run_command: Parameters supplied to the Create Virtual Machine RunCommand operation. + Required. + :type run_command: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str @@ -32209,7 +32256,7 @@ def begin_create_or_update( vm_scale_set_name: str, instance_id: str, run_command_name: str, - body: Union[_models.VirtualMachineRunCommand, JSON, IO[bytes]], + run_command: Union[_models.VirtualMachineRunCommand, JSON, IO[bytes]], **kwargs: Any ) -> LROPoller[None]: """The operation to create or update the VMSS VM run command. @@ -32223,9 +32270,9 @@ def begin_create_or_update( :type instance_id: str :param run_command_name: The name of the VirtualMachineRunCommand. Required. :type run_command_name: str - :param body: Parameters supplied to the Create Virtual Machine RunCommand operation. Is one of - the following types: VirtualMachineRunCommand, JSON, IO[bytes] Required. - :type body: ~azure.mgmt.compute.models.VirtualMachineRunCommand or JSON or IO[bytes] + :param run_command: Parameters supplied to the Create Virtual Machine RunCommand operation. Is + one of the following types: VirtualMachineRunCommand, JSON, IO[bytes] Required. + :type run_command: ~azure.mgmt.compute.models.VirtualMachineRunCommand or JSON or IO[bytes] :return: An instance of LROPoller that returns None :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -32244,7 +32291,7 @@ def begin_create_or_update( vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, run_command_name=run_command_name, - body=body, + run_command=run_command, content_type=content_type, cls=lambda x, y, z: x, headers=_headers, @@ -32285,7 +32332,7 @@ def _update_initial( vm_scale_set_name: str, instance_id: str, run_command_name: str, - body: Union[_models.VirtualMachineRunCommandUpdate, JSON, IO[bytes]], + run_command: Union[_models.VirtualMachineRunCommandUpdate, JSON, IO[bytes]], **kwargs: Any ) -> Iterator[bytes]: error_map: MutableMapping = { @@ -32304,10 +32351,10 @@ def _update_initial( content_type = content_type or "application/json" _content = None - if isinstance(body, (IOBase, bytes)): - _content = body + if isinstance(run_command, (IOBase, bytes)): + _content = run_command else: - _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(run_command, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore _request = build_virtual_machine_scale_set_vm_run_commands_update_request( resource_group_name=resource_group_name, @@ -32360,7 +32407,7 @@ def begin_update( vm_scale_set_name: str, instance_id: str, run_command_name: str, - body: _models.VirtualMachineRunCommandUpdate, + run_command: _models.VirtualMachineRunCommandUpdate, *, content_type: str = "application/json", **kwargs: Any @@ -32376,8 +32423,8 @@ def begin_update( :type instance_id: str :param run_command_name: The name of the VirtualMachineRunCommand. Required. :type run_command_name: str - :param body: Resource create parameters. Required. - :type body: ~azure.mgmt.compute.models.VirtualMachineRunCommandUpdate + :param run_command: Resource create parameters. Required. + :type run_command: ~azure.mgmt.compute.models.VirtualMachineRunCommandUpdate :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -32393,7 +32440,7 @@ def begin_update( vm_scale_set_name: str, instance_id: str, run_command_name: str, - body: JSON, + run_command: JSON, *, content_type: str = "application/json", **kwargs: Any @@ -32409,8 +32456,8 @@ def begin_update( :type instance_id: str :param run_command_name: The name of the VirtualMachineRunCommand. Required. :type run_command_name: str - :param body: Resource create parameters. Required. - :type body: JSON + :param run_command: Resource create parameters. Required. + :type run_command: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -32426,7 +32473,7 @@ def begin_update( vm_scale_set_name: str, instance_id: str, run_command_name: str, - body: IO[bytes], + run_command: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -32442,8 +32489,8 @@ def begin_update( :type instance_id: str :param run_command_name: The name of the VirtualMachineRunCommand. Required. :type run_command_name: str - :param body: Resource create parameters. Required. - :type body: IO[bytes] + :param run_command: Resource create parameters. Required. + :type run_command: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str @@ -32459,7 +32506,7 @@ def begin_update( vm_scale_set_name: str, instance_id: str, run_command_name: str, - body: Union[_models.VirtualMachineRunCommandUpdate, JSON, IO[bytes]], + run_command: Union[_models.VirtualMachineRunCommandUpdate, JSON, IO[bytes]], **kwargs: Any ) -> LROPoller[None]: """The operation to update the VMSS VM run command. @@ -32473,9 +32520,10 @@ def begin_update( :type instance_id: str :param run_command_name: The name of the VirtualMachineRunCommand. Required. :type run_command_name: str - :param body: Resource create parameters. Is one of the following types: + :param run_command: Resource create parameters. Is one of the following types: VirtualMachineRunCommandUpdate, JSON, IO[bytes] Required. - :type body: ~azure.mgmt.compute.models.VirtualMachineRunCommandUpdate or JSON or IO[bytes] + :type run_command: ~azure.mgmt.compute.models.VirtualMachineRunCommandUpdate or JSON or + IO[bytes] :return: An instance of LROPoller that returns None :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -32494,7 +32542,7 @@ def begin_update( vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, run_command_name=run_command_name, - body=body, + run_command=run_command, content_type=content_type, cls=lambda x, y, z: x, headers=_headers, @@ -34148,7 +34196,7 @@ def __init__(self, *args, **kwargs) -> None: self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") def _export_request_rate_by_interval_initial( - self, location: str, body: Union[_models.RequestRateByIntervalInput, JSON, IO[bytes]], **kwargs: Any + self, location: str, parameters: Union[_models.RequestRateByIntervalInput, JSON, IO[bytes]], **kwargs: Any ) -> Iterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -34166,10 +34214,10 @@ def _export_request_rate_by_interval_initial( content_type = content_type or "application/json" _content = None - if isinstance(body, (IOBase, bytes)): - _content = body + if isinstance(parameters, (IOBase, bytes)): + _content = parameters else: - _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore _request = build_log_analytics_operation_group_export_request_rate_by_interval_request( location=location, @@ -34219,7 +34267,7 @@ def _export_request_rate_by_interval_initial( def begin_export_request_rate_by_interval( self, location: str, - body: _models.RequestRateByIntervalInput, + parameters: _models.RequestRateByIntervalInput, *, content_type: str = "application/json", **kwargs: Any @@ -34229,8 +34277,9 @@ def begin_export_request_rate_by_interval( :param location: The location name. Required. :type location: str - :param body: Parameters supplied to the LogAnalytics getRequestRateByInterval Api. Required. - :type body: ~azure.mgmt.compute.models.RequestRateByIntervalInput + :param parameters: Parameters supplied to the LogAnalytics getRequestRateByInterval Api. + Required. + :type parameters: ~azure.mgmt.compute.models.RequestRateByIntervalInput :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -34241,15 +34290,16 @@ def begin_export_request_rate_by_interval( @overload def begin_export_request_rate_by_interval( - self, location: str, body: JSON, *, content_type: str = "application/json", **kwargs: Any + self, location: str, parameters: JSON, *, content_type: str = "application/json", **kwargs: Any ) -> LROPoller[None]: """Export logs that show Api requests made by this subscription in the given time window to show throttling activities. :param location: The location name. Required. :type location: str - :param body: Parameters supplied to the LogAnalytics getRequestRateByInterval Api. Required. - :type body: JSON + :param parameters: Parameters supplied to the LogAnalytics getRequestRateByInterval Api. + Required. + :type parameters: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -34260,15 +34310,16 @@ def begin_export_request_rate_by_interval( @overload def begin_export_request_rate_by_interval( - self, location: str, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any + self, location: str, parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any ) -> LROPoller[None]: """Export logs that show Api requests made by this subscription in the given time window to show throttling activities. :param location: The location name. Required. :type location: str - :param body: Parameters supplied to the LogAnalytics getRequestRateByInterval Api. Required. - :type body: IO[bytes] + :param parameters: Parameters supplied to the LogAnalytics getRequestRateByInterval Api. + Required. + :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str @@ -34279,16 +34330,16 @@ def begin_export_request_rate_by_interval( @distributed_trace def begin_export_request_rate_by_interval( - self, location: str, body: Union[_models.RequestRateByIntervalInput, JSON, IO[bytes]], **kwargs: Any + self, location: str, parameters: Union[_models.RequestRateByIntervalInput, JSON, IO[bytes]], **kwargs: Any ) -> LROPoller[None]: """Export logs that show Api requests made by this subscription in the given time window to show throttling activities. :param location: The location name. Required. :type location: str - :param body: Parameters supplied to the LogAnalytics getRequestRateByInterval Api. Is one of - the following types: RequestRateByIntervalInput, JSON, IO[bytes] Required. - :type body: ~azure.mgmt.compute.models.RequestRateByIntervalInput or JSON or IO[bytes] + :param parameters: Parameters supplied to the LogAnalytics getRequestRateByInterval Api. Is one + of the following types: RequestRateByIntervalInput, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.compute.models.RequestRateByIntervalInput or JSON or IO[bytes] :return: An instance of LROPoller that returns None :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -34304,7 +34355,7 @@ def begin_export_request_rate_by_interval( if cont_token is None: raw_result = self._export_request_rate_by_interval_initial( location=location, - body=body, + parameters=parameters, content_type=content_type, cls=lambda x, y, z: x, headers=_headers, @@ -34340,7 +34391,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore def _export_throttled_requests_initial( - self, location: str, body: Union[_models.ThrottledRequestsInput, JSON, IO[bytes]], **kwargs: Any + self, location: str, parameters: Union[_models.ThrottledRequestsInput, JSON, IO[bytes]], **kwargs: Any ) -> Iterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -34358,10 +34409,10 @@ def _export_throttled_requests_initial( content_type = content_type or "application/json" _content = None - if isinstance(body, (IOBase, bytes)): - _content = body + if isinstance(parameters, (IOBase, bytes)): + _content = parameters else: - _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore _request = build_log_analytics_operation_group_export_throttled_requests_request( location=location, @@ -34411,7 +34462,7 @@ def _export_throttled_requests_initial( def begin_export_throttled_requests( self, location: str, - body: _models.ThrottledRequestsInput, + parameters: _models.ThrottledRequestsInput, *, content_type: str = "application/json", **kwargs: Any @@ -34421,8 +34472,8 @@ def begin_export_throttled_requests( :param location: The location name. Required. :type location: str - :param body: The request body. Required. - :type body: ~azure.mgmt.compute.models.ThrottledRequestsInput + :param parameters: The request body. Required. + :type parameters: ~azure.mgmt.compute.models.ThrottledRequestsInput :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -34433,15 +34484,15 @@ def begin_export_throttled_requests( @overload def begin_export_throttled_requests( - self, location: str, body: JSON, *, content_type: str = "application/json", **kwargs: Any + self, location: str, parameters: JSON, *, content_type: str = "application/json", **kwargs: Any ) -> LROPoller[None]: """Export logs that show total throttled Api requests for this subscription in the given time window. :param location: The location name. Required. :type location: str - :param body: The request body. Required. - :type body: JSON + :param parameters: The request body. Required. + :type parameters: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -34452,15 +34503,15 @@ def begin_export_throttled_requests( @overload def begin_export_throttled_requests( - self, location: str, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any + self, location: str, parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any ) -> LROPoller[None]: """Export logs that show total throttled Api requests for this subscription in the given time window. :param location: The location name. Required. :type location: str - :param body: The request body. Required. - :type body: IO[bytes] + :param parameters: The request body. Required. + :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str @@ -34471,16 +34522,16 @@ def begin_export_throttled_requests( @distributed_trace def begin_export_throttled_requests( - self, location: str, body: Union[_models.ThrottledRequestsInput, JSON, IO[bytes]], **kwargs: Any + self, location: str, parameters: Union[_models.ThrottledRequestsInput, JSON, IO[bytes]], **kwargs: Any ) -> LROPoller[None]: """Export logs that show total throttled Api requests for this subscription in the given time window. :param location: The location name. Required. :type location: str - :param body: The request body. Is one of the following types: ThrottledRequestsInput, JSON, - IO[bytes] Required. - :type body: ~azure.mgmt.compute.models.ThrottledRequestsInput or JSON or IO[bytes] + :param parameters: The request body. Is one of the following types: ThrottledRequestsInput, + JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.compute.models.ThrottledRequestsInput or JSON or IO[bytes] :return: An instance of LROPoller that returns None :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -34496,7 +34547,7 @@ def begin_export_throttled_requests( if cont_token is None: raw_result = self._export_throttled_requests_initial( location=location, - body=body, + parameters=parameters, content_type=content_type, cls=lambda x, y, z: x, headers=_headers, @@ -34795,7 +34846,7 @@ def get(self, resource_group_name: str, disk_name: str, **kwargs: Any) -> _model return deserialized # type: ignore def _create_or_update_initial( - self, resource_group_name: str, disk_name: str, resource: Union[_models.Disk, JSON, IO[bytes]], **kwargs: Any + self, resource_group_name: str, disk_name: str, disk: Union[_models.Disk, JSON, IO[bytes]], **kwargs: Any ) -> Iterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -34813,10 +34864,10 @@ def _create_or_update_initial( content_type = content_type or "application/json" _content = None - if isinstance(resource, (IOBase, bytes)): - _content = resource + if isinstance(disk, (IOBase, bytes)): + _content = disk else: - _content = json.dumps(resource, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(disk, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore _request = build_disks_create_or_update_request( resource_group_name=resource_group_name, @@ -34866,7 +34917,7 @@ def begin_create_or_update( self, resource_group_name: str, disk_name: str, - resource: _models.Disk, + disk: _models.Disk, *, content_type: str = "application/json", **kwargs: Any @@ -34880,8 +34931,8 @@ def begin_create_or_update( after the disk is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. :type disk_name: str - :param resource: Disk object supplied in the body of the Put disk operation. Required. - :type resource: ~azure.mgmt.compute.models.Disk + :param disk: Disk object supplied in the body of the Put disk operation. Required. + :type disk: ~azure.mgmt.compute.models.Disk :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -34895,7 +34946,7 @@ def begin_create_or_update( self, resource_group_name: str, disk_name: str, - resource: JSON, + disk: JSON, *, content_type: str = "application/json", **kwargs: Any @@ -34909,8 +34960,8 @@ def begin_create_or_update( after the disk is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. :type disk_name: str - :param resource: Disk object supplied in the body of the Put disk operation. Required. - :type resource: JSON + :param disk: Disk object supplied in the body of the Put disk operation. Required. + :type disk: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -34924,7 +34975,7 @@ def begin_create_or_update( self, resource_group_name: str, disk_name: str, - resource: IO[bytes], + disk: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -34938,8 +34989,8 @@ def begin_create_or_update( after the disk is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. :type disk_name: str - :param resource: Disk object supplied in the body of the Put disk operation. Required. - :type resource: IO[bytes] + :param disk: Disk object supplied in the body of the Put disk operation. Required. + :type disk: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str @@ -34950,7 +35001,7 @@ def begin_create_or_update( @distributed_trace def begin_create_or_update( - self, resource_group_name: str, disk_name: str, resource: Union[_models.Disk, JSON, IO[bytes]], **kwargs: Any + self, resource_group_name: str, disk_name: str, disk: Union[_models.Disk, JSON, IO[bytes]], **kwargs: Any ) -> LROPoller[None]: """Creates or updates a disk. @@ -34961,9 +35012,9 @@ def begin_create_or_update( after the disk is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. :type disk_name: str - :param resource: Disk object supplied in the body of the Put disk operation. Is one of the + :param disk: Disk object supplied in the body of the Put disk operation. Is one of the following types: Disk, JSON, IO[bytes] Required. - :type resource: ~azure.mgmt.compute.models.Disk or JSON or IO[bytes] + :type disk: ~azure.mgmt.compute.models.Disk or JSON or IO[bytes] :return: An instance of LROPoller that returns None :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -34980,7 +35031,7 @@ def begin_create_or_update( raw_result = self._create_or_update_initial( resource_group_name=resource_group_name, disk_name=disk_name, - resource=resource, + disk=disk, content_type=content_type, cls=lambda x, y, z: x, headers=_headers, @@ -35016,11 +35067,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore def _update_initial( - self, - resource_group_name: str, - disk_name: str, - properties: Union[_models.DiskUpdate, JSON, IO[bytes]], - **kwargs: Any + self, resource_group_name: str, disk_name: str, disk: Union[_models.DiskUpdate, JSON, IO[bytes]], **kwargs: Any ) -> Iterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -35038,10 +35085,10 @@ def _update_initial( content_type = content_type or "application/json" _content = None - if isinstance(properties, (IOBase, bytes)): - _content = properties + if isinstance(disk, (IOBase, bytes)): + _content = disk else: - _content = json.dumps(properties, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(disk, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore _request = build_disks_update_request( resource_group_name=resource_group_name, @@ -35091,7 +35138,7 @@ def begin_update( self, resource_group_name: str, disk_name: str, - properties: _models.DiskUpdate, + disk: _models.DiskUpdate, *, content_type: str = "application/json", **kwargs: Any @@ -35105,8 +35152,8 @@ def begin_update( after the disk is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. :type disk_name: str - :param properties: Disk object supplied in the body of the Patch disk operation. Required. - :type properties: ~azure.mgmt.compute.models.DiskUpdate + :param disk: Disk object supplied in the body of the Patch disk operation. Required. + :type disk: ~azure.mgmt.compute.models.DiskUpdate :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -35120,7 +35167,7 @@ def begin_update( self, resource_group_name: str, disk_name: str, - properties: JSON, + disk: JSON, *, content_type: str = "application/json", **kwargs: Any @@ -35134,8 +35181,8 @@ def begin_update( after the disk is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. :type disk_name: str - :param properties: Disk object supplied in the body of the Patch disk operation. Required. - :type properties: JSON + :param disk: Disk object supplied in the body of the Patch disk operation. Required. + :type disk: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -35149,7 +35196,7 @@ def begin_update( self, resource_group_name: str, disk_name: str, - properties: IO[bytes], + disk: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -35163,8 +35210,8 @@ def begin_update( after the disk is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. :type disk_name: str - :param properties: Disk object supplied in the body of the Patch disk operation. Required. - :type properties: IO[bytes] + :param disk: Disk object supplied in the body of the Patch disk operation. Required. + :type disk: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str @@ -35175,11 +35222,7 @@ def begin_update( @distributed_trace def begin_update( - self, - resource_group_name: str, - disk_name: str, - properties: Union[_models.DiskUpdate, JSON, IO[bytes]], - **kwargs: Any + self, resource_group_name: str, disk_name: str, disk: Union[_models.DiskUpdate, JSON, IO[bytes]], **kwargs: Any ) -> LROPoller[None]: """Updates (patches) a disk. @@ -35190,9 +35233,9 @@ def begin_update( after the disk is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. :type disk_name: str - :param properties: Disk object supplied in the body of the Patch disk operation. Is one of the + :param disk: Disk object supplied in the body of the Patch disk operation. Is one of the following types: DiskUpdate, JSON, IO[bytes] Required. - :type properties: ~azure.mgmt.compute.models.DiskUpdate or JSON or IO[bytes] + :type disk: ~azure.mgmt.compute.models.DiskUpdate or JSON or IO[bytes] :return: An instance of LROPoller that returns None :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -35209,7 +35252,7 @@ def begin_update( raw_result = self._update_initial( resource_group_name=resource_group_name, disk_name=disk_name, - properties=properties, + disk=disk, content_type=content_type, cls=lambda x, y, z: x, headers=_headers, @@ -35534,7 +35577,7 @@ def _grant_access_initial( self, resource_group_name: str, disk_name: str, - body: Union[_models.GrantAccessData, JSON, IO[bytes]], + grant_access_data: Union[_models.GrantAccessData, JSON, IO[bytes]], **kwargs: Any ) -> Iterator[bytes]: error_map: MutableMapping = { @@ -35553,10 +35596,10 @@ def _grant_access_initial( content_type = content_type or "application/json" _content = None - if isinstance(body, (IOBase, bytes)): - _content = body + if isinstance(grant_access_data, (IOBase, bytes)): + _content = grant_access_data else: - _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(grant_access_data, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore _request = build_disks_grant_access_request( resource_group_name=resource_group_name, @@ -35606,7 +35649,7 @@ def begin_grant_access( self, resource_group_name: str, disk_name: str, - body: _models.GrantAccessData, + grant_access_data: _models.GrantAccessData, *, content_type: str = "application/json", **kwargs: Any @@ -35620,9 +35663,9 @@ def begin_grant_access( after the disk is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. :type disk_name: str - :param body: Access data object supplied in the body of the get disk access operation. - Required. - :type body: ~azure.mgmt.compute.models.GrantAccessData + :param grant_access_data: Access data object supplied in the body of the get disk access + operation. Required. + :type grant_access_data: ~azure.mgmt.compute.models.GrantAccessData :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -35637,7 +35680,7 @@ def begin_grant_access( self, resource_group_name: str, disk_name: str, - body: JSON, + grant_access_data: JSON, *, content_type: str = "application/json", **kwargs: Any @@ -35651,9 +35694,9 @@ def begin_grant_access( after the disk is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. :type disk_name: str - :param body: Access data object supplied in the body of the get disk access operation. - Required. - :type body: JSON + :param grant_access_data: Access data object supplied in the body of the get disk access + operation. Required. + :type grant_access_data: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -35668,7 +35711,7 @@ def begin_grant_access( self, resource_group_name: str, disk_name: str, - body: IO[bytes], + grant_access_data: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -35682,9 +35725,9 @@ def begin_grant_access( after the disk is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. :type disk_name: str - :param body: Access data object supplied in the body of the get disk access operation. - Required. - :type body: IO[bytes] + :param grant_access_data: Access data object supplied in the body of the get disk access + operation. Required. + :type grant_access_data: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str @@ -35699,7 +35742,7 @@ def begin_grant_access( self, resource_group_name: str, disk_name: str, - body: Union[_models.GrantAccessData, JSON, IO[bytes]], + grant_access_data: Union[_models.GrantAccessData, JSON, IO[bytes]], **kwargs: Any ) -> LROPoller[_models.AccessUri]: """Grants access to a disk. @@ -35711,9 +35754,9 @@ def begin_grant_access( after the disk is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. :type disk_name: str - :param body: Access data object supplied in the body of the get disk access operation. Is one - of the following types: GrantAccessData, JSON, IO[bytes] Required. - :type body: ~azure.mgmt.compute.models.GrantAccessData or JSON or IO[bytes] + :param grant_access_data: Access data object supplied in the body of the get disk access + operation. Is one of the following types: GrantAccessData, JSON, IO[bytes] Required. + :type grant_access_data: ~azure.mgmt.compute.models.GrantAccessData or JSON or IO[bytes] :return: An instance of LROPoller that returns AccessUri. The AccessUri is compatible with MutableMapping :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.AccessUri] @@ -35731,7 +35774,7 @@ def begin_grant_access( raw_result = self._grant_access_initial( resource_group_name=resource_group_name, disk_name=disk_name, - body=body, + grant_access_data=grant_access_data, content_type=content_type, cls=lambda x, y, z: x, headers=_headers, @@ -35991,7 +36034,7 @@ def _create_or_update_initial( self, resource_group_name: str, disk_access_name: str, - resource: Union[_models.DiskAccess, JSON, IO[bytes]], + disk_access: Union[_models.DiskAccess, JSON, IO[bytes]], **kwargs: Any ) -> Iterator[bytes]: error_map: MutableMapping = { @@ -36010,10 +36053,10 @@ def _create_or_update_initial( content_type = content_type or "application/json" _content = None - if isinstance(resource, (IOBase, bytes)): - _content = resource + if isinstance(disk_access, (IOBase, bytes)): + _content = disk_access else: - _content = json.dumps(resource, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(disk_access, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore _request = build_disk_accesses_create_or_update_request( resource_group_name=resource_group_name, @@ -36063,7 +36106,7 @@ def begin_create_or_update( self, resource_group_name: str, disk_access_name: str, - resource: _models.DiskAccess, + disk_access: _models.DiskAccess, *, content_type: str = "application/json", **kwargs: Any @@ -36077,9 +36120,9 @@ def begin_create_or_update( can't be changed after the disk encryption set is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. :type disk_access_name: str - :param resource: disk access object supplied in the body of the Put disk access operation. + :param disk_access: disk access object supplied in the body of the Put disk access operation. Required. - :type resource: ~azure.mgmt.compute.models.DiskAccess + :type disk_access: ~azure.mgmt.compute.models.DiskAccess :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -36093,7 +36136,7 @@ def begin_create_or_update( self, resource_group_name: str, disk_access_name: str, - resource: JSON, + disk_access: JSON, *, content_type: str = "application/json", **kwargs: Any @@ -36107,9 +36150,9 @@ def begin_create_or_update( can't be changed after the disk encryption set is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. :type disk_access_name: str - :param resource: disk access object supplied in the body of the Put disk access operation. + :param disk_access: disk access object supplied in the body of the Put disk access operation. Required. - :type resource: JSON + :type disk_access: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -36123,7 +36166,7 @@ def begin_create_or_update( self, resource_group_name: str, disk_access_name: str, - resource: IO[bytes], + disk_access: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -36137,9 +36180,9 @@ def begin_create_or_update( can't be changed after the disk encryption set is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. :type disk_access_name: str - :param resource: disk access object supplied in the body of the Put disk access operation. + :param disk_access: disk access object supplied in the body of the Put disk access operation. Required. - :type resource: IO[bytes] + :type disk_access: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str @@ -36153,7 +36196,7 @@ def begin_create_or_update( self, resource_group_name: str, disk_access_name: str, - resource: Union[_models.DiskAccess, JSON, IO[bytes]], + disk_access: Union[_models.DiskAccess, JSON, IO[bytes]], **kwargs: Any ) -> LROPoller[None]: """Creates or updates a disk access resource. @@ -36165,9 +36208,9 @@ def begin_create_or_update( can't be changed after the disk encryption set is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. :type disk_access_name: str - :param resource: disk access object supplied in the body of the Put disk access operation. Is - one of the following types: DiskAccess, JSON, IO[bytes] Required. - :type resource: ~azure.mgmt.compute.models.DiskAccess or JSON or IO[bytes] + :param disk_access: disk access object supplied in the body of the Put disk access operation. + Is one of the following types: DiskAccess, JSON, IO[bytes] Required. + :type disk_access: ~azure.mgmt.compute.models.DiskAccess or JSON or IO[bytes] :return: An instance of LROPoller that returns None :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -36184,7 +36227,7 @@ def begin_create_or_update( raw_result = self._create_or_update_initial( resource_group_name=resource_group_name, disk_access_name=disk_access_name, - resource=resource, + disk_access=disk_access, content_type=content_type, cls=lambda x, y, z: x, headers=_headers, @@ -36223,7 +36266,7 @@ def _update_initial( self, resource_group_name: str, disk_access_name: str, - properties: Union[_models.DiskAccessUpdate, JSON, IO[bytes]], + disk_access: Union[_models.DiskAccessUpdate, JSON, IO[bytes]], **kwargs: Any ) -> Iterator[bytes]: error_map: MutableMapping = { @@ -36242,10 +36285,10 @@ def _update_initial( content_type = content_type or "application/json" _content = None - if isinstance(properties, (IOBase, bytes)): - _content = properties + if isinstance(disk_access, (IOBase, bytes)): + _content = disk_access else: - _content = json.dumps(properties, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(disk_access, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore _request = build_disk_accesses_update_request( resource_group_name=resource_group_name, @@ -36295,7 +36338,7 @@ def begin_update( self, resource_group_name: str, disk_access_name: str, - properties: _models.DiskAccessUpdate, + disk_access: _models.DiskAccessUpdate, *, content_type: str = "application/json", **kwargs: Any @@ -36309,9 +36352,9 @@ def begin_update( can't be changed after the disk encryption set is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. :type disk_access_name: str - :param properties: disk access object supplied in the body of the Patch disk access operation. + :param disk_access: disk access object supplied in the body of the Patch disk access operation. Required. - :type properties: ~azure.mgmt.compute.models.DiskAccessUpdate + :type disk_access: ~azure.mgmt.compute.models.DiskAccessUpdate :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -36325,7 +36368,7 @@ def begin_update( self, resource_group_name: str, disk_access_name: str, - properties: JSON, + disk_access: JSON, *, content_type: str = "application/json", **kwargs: Any @@ -36339,9 +36382,9 @@ def begin_update( can't be changed after the disk encryption set is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. :type disk_access_name: str - :param properties: disk access object supplied in the body of the Patch disk access operation. + :param disk_access: disk access object supplied in the body of the Patch disk access operation. Required. - :type properties: JSON + :type disk_access: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -36355,7 +36398,7 @@ def begin_update( self, resource_group_name: str, disk_access_name: str, - properties: IO[bytes], + disk_access: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -36369,9 +36412,9 @@ def begin_update( can't be changed after the disk encryption set is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. :type disk_access_name: str - :param properties: disk access object supplied in the body of the Patch disk access operation. + :param disk_access: disk access object supplied in the body of the Patch disk access operation. Required. - :type properties: IO[bytes] + :type disk_access: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str @@ -36385,7 +36428,7 @@ def begin_update( self, resource_group_name: str, disk_access_name: str, - properties: Union[_models.DiskAccessUpdate, JSON, IO[bytes]], + disk_access: Union[_models.DiskAccessUpdate, JSON, IO[bytes]], **kwargs: Any ) -> LROPoller[None]: """Updates (patches) a disk access resource. @@ -36397,9 +36440,9 @@ def begin_update( can't be changed after the disk encryption set is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. :type disk_access_name: str - :param properties: disk access object supplied in the body of the Patch disk access operation. + :param disk_access: disk access object supplied in the body of the Patch disk access operation. Is one of the following types: DiskAccessUpdate, JSON, IO[bytes] Required. - :type properties: ~azure.mgmt.compute.models.DiskAccessUpdate or JSON or IO[bytes] + :type disk_access: ~azure.mgmt.compute.models.DiskAccessUpdate or JSON or IO[bytes] :return: An instance of LROPoller that returns None :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -36416,7 +36459,7 @@ def begin_update( raw_result = self._update_initial( resource_group_name=resource_group_name, disk_access_name=disk_access_name, - properties=properties, + disk_access=disk_access, content_type=content_type, cls=lambda x, y, z: x, headers=_headers, @@ -36905,7 +36948,7 @@ def _update_a_private_endpoint_connection_initial( # pylint: disable=name-too-l resource_group_name: str, disk_access_name: str, private_endpoint_connection_name: str, - resource: Union[_models.PrivateEndpointConnection, JSON, IO[bytes]], + private_endpoint_connection: Union[_models.PrivateEndpointConnection, JSON, IO[bytes]], **kwargs: Any ) -> Iterator[bytes]: error_map: MutableMapping = { @@ -36924,10 +36967,10 @@ def _update_a_private_endpoint_connection_initial( # pylint: disable=name-too-l content_type = content_type or "application/json" _content = None - if isinstance(resource, (IOBase, bytes)): - _content = resource + if isinstance(private_endpoint_connection, (IOBase, bytes)): + _content = private_endpoint_connection else: - _content = json.dumps(resource, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(private_endpoint_connection, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore _request = build_private_endpoint_connections_update_a_private_endpoint_connection_request( resource_group_name=resource_group_name, @@ -36979,7 +37022,7 @@ def begin_update_a_private_endpoint_connection( # pylint: disable=name-too-long resource_group_name: str, disk_access_name: str, private_endpoint_connection_name: str, - resource: _models.PrivateEndpointConnection, + private_endpoint_connection: _models.PrivateEndpointConnection, *, content_type: str = "application/json", **kwargs: Any @@ -36996,9 +37039,9 @@ def begin_update_a_private_endpoint_connection( # pylint: disable=name-too-long :type disk_access_name: str :param private_endpoint_connection_name: The name of the private endpoint connection. Required. :type private_endpoint_connection_name: str - :param resource: private endpoint connection object supplied in the body of the Put private - endpoint connection operation. Required. - :type resource: ~azure.mgmt.compute.models.PrivateEndpointConnection + :param private_endpoint_connection: private endpoint connection object supplied in the body of + the Put private endpoint connection operation. Required. + :type private_endpoint_connection: ~azure.mgmt.compute.models.PrivateEndpointConnection :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -37013,7 +37056,7 @@ def begin_update_a_private_endpoint_connection( # pylint: disable=name-too-long resource_group_name: str, disk_access_name: str, private_endpoint_connection_name: str, - resource: JSON, + private_endpoint_connection: JSON, *, content_type: str = "application/json", **kwargs: Any @@ -37030,9 +37073,9 @@ def begin_update_a_private_endpoint_connection( # pylint: disable=name-too-long :type disk_access_name: str :param private_endpoint_connection_name: The name of the private endpoint connection. Required. :type private_endpoint_connection_name: str - :param resource: private endpoint connection object supplied in the body of the Put private - endpoint connection operation. Required. - :type resource: JSON + :param private_endpoint_connection: private endpoint connection object supplied in the body of + the Put private endpoint connection operation. Required. + :type private_endpoint_connection: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -37047,7 +37090,7 @@ def begin_update_a_private_endpoint_connection( # pylint: disable=name-too-long resource_group_name: str, disk_access_name: str, private_endpoint_connection_name: str, - resource: IO[bytes], + private_endpoint_connection: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -37064,9 +37107,9 @@ def begin_update_a_private_endpoint_connection( # pylint: disable=name-too-long :type disk_access_name: str :param private_endpoint_connection_name: The name of the private endpoint connection. Required. :type private_endpoint_connection_name: str - :param resource: private endpoint connection object supplied in the body of the Put private - endpoint connection operation. Required. - :type resource: IO[bytes] + :param private_endpoint_connection: private endpoint connection object supplied in the body of + the Put private endpoint connection operation. Required. + :type private_endpoint_connection: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str @@ -37081,7 +37124,7 @@ def begin_update_a_private_endpoint_connection( # pylint: disable=name-too-long resource_group_name: str, disk_access_name: str, private_endpoint_connection_name: str, - resource: Union[_models.PrivateEndpointConnection, JSON, IO[bytes]], + private_endpoint_connection: Union[_models.PrivateEndpointConnection, JSON, IO[bytes]], **kwargs: Any ) -> LROPoller[None]: """Approve or reject a private endpoint connection under disk access resource, this can't be used @@ -37096,10 +37139,11 @@ def begin_update_a_private_endpoint_connection( # pylint: disable=name-too-long :type disk_access_name: str :param private_endpoint_connection_name: The name of the private endpoint connection. Required. :type private_endpoint_connection_name: str - :param resource: private endpoint connection object supplied in the body of the Put private - endpoint connection operation. Is one of the following types: PrivateEndpointConnection, JSON, - IO[bytes] Required. - :type resource: ~azure.mgmt.compute.models.PrivateEndpointConnection or JSON or IO[bytes] + :param private_endpoint_connection: private endpoint connection object supplied in the body of + the Put private endpoint connection operation. Is one of the following types: + PrivateEndpointConnection, JSON, IO[bytes] Required. + :type private_endpoint_connection: ~azure.mgmt.compute.models.PrivateEndpointConnection or JSON + or IO[bytes] :return: An instance of LROPoller that returns None :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -37117,7 +37161,7 @@ def begin_update_a_private_endpoint_connection( # pylint: disable=name-too-long resource_group_name=resource_group_name, disk_access_name=disk_access_name, private_endpoint_connection_name=private_endpoint_connection_name, - resource=resource, + private_endpoint_connection=private_endpoint_connection, content_type=content_type, cls=lambda x, y, z: x, headers=_headers, @@ -37459,7 +37503,7 @@ def _create_or_update_initial( self, resource_group_name: str, disk_encryption_set_name: str, - resource: Union[_models.DiskEncryptionSet, JSON, IO[bytes]], + disk_encryption_set: Union[_models.DiskEncryptionSet, JSON, IO[bytes]], **kwargs: Any ) -> Iterator[bytes]: error_map: MutableMapping = { @@ -37478,10 +37522,10 @@ def _create_or_update_initial( content_type = content_type or "application/json" _content = None - if isinstance(resource, (IOBase, bytes)): - _content = resource + if isinstance(disk_encryption_set, (IOBase, bytes)): + _content = disk_encryption_set else: - _content = json.dumps(resource, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(disk_encryption_set, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore _request = build_disk_encryption_sets_create_or_update_request( resource_group_name=resource_group_name, @@ -37531,7 +37575,7 @@ def begin_create_or_update( self, resource_group_name: str, disk_encryption_set_name: str, - resource: _models.DiskEncryptionSet, + disk_encryption_set: _models.DiskEncryptionSet, *, content_type: str = "application/json", **kwargs: Any @@ -37545,9 +37589,9 @@ def begin_create_or_update( name can't be changed after the disk encryption set is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. :type disk_encryption_set_name: str - :param resource: disk encryption set object supplied in the body of the Put disk encryption set - operation. Required. - :type resource: ~azure.mgmt.compute.models.DiskEncryptionSet + :param disk_encryption_set: disk encryption set object supplied in the body of the Put disk + encryption set operation. Required. + :type disk_encryption_set: ~azure.mgmt.compute.models.DiskEncryptionSet :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -37561,7 +37605,7 @@ def begin_create_or_update( self, resource_group_name: str, disk_encryption_set_name: str, - resource: JSON, + disk_encryption_set: JSON, *, content_type: str = "application/json", **kwargs: Any @@ -37575,9 +37619,9 @@ def begin_create_or_update( name can't be changed after the disk encryption set is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. :type disk_encryption_set_name: str - :param resource: disk encryption set object supplied in the body of the Put disk encryption set - operation. Required. - :type resource: JSON + :param disk_encryption_set: disk encryption set object supplied in the body of the Put disk + encryption set operation. Required. + :type disk_encryption_set: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -37591,7 +37635,7 @@ def begin_create_or_update( self, resource_group_name: str, disk_encryption_set_name: str, - resource: IO[bytes], + disk_encryption_set: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -37605,9 +37649,9 @@ def begin_create_or_update( name can't be changed after the disk encryption set is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. :type disk_encryption_set_name: str - :param resource: disk encryption set object supplied in the body of the Put disk encryption set - operation. Required. - :type resource: IO[bytes] + :param disk_encryption_set: disk encryption set object supplied in the body of the Put disk + encryption set operation. Required. + :type disk_encryption_set: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str @@ -37621,7 +37665,7 @@ def begin_create_or_update( self, resource_group_name: str, disk_encryption_set_name: str, - resource: Union[_models.DiskEncryptionSet, JSON, IO[bytes]], + disk_encryption_set: Union[_models.DiskEncryptionSet, JSON, IO[bytes]], **kwargs: Any ) -> LROPoller[None]: """Creates or updates a disk encryption set. @@ -37633,9 +37677,10 @@ def begin_create_or_update( name can't be changed after the disk encryption set is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. :type disk_encryption_set_name: str - :param resource: disk encryption set object supplied in the body of the Put disk encryption set - operation. Is one of the following types: DiskEncryptionSet, JSON, IO[bytes] Required. - :type resource: ~azure.mgmt.compute.models.DiskEncryptionSet or JSON or IO[bytes] + :param disk_encryption_set: disk encryption set object supplied in the body of the Put disk + encryption set operation. Is one of the following types: DiskEncryptionSet, JSON, IO[bytes] + Required. + :type disk_encryption_set: ~azure.mgmt.compute.models.DiskEncryptionSet or JSON or IO[bytes] :return: An instance of LROPoller that returns None :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -37652,7 +37697,7 @@ def begin_create_or_update( raw_result = self._create_or_update_initial( resource_group_name=resource_group_name, disk_encryption_set_name=disk_encryption_set_name, - resource=resource, + disk_encryption_set=disk_encryption_set, content_type=content_type, cls=lambda x, y, z: x, headers=_headers, @@ -37691,7 +37736,7 @@ def _update_initial( self, resource_group_name: str, disk_encryption_set_name: str, - properties: Union[_models.DiskEncryptionSetUpdate, JSON, IO[bytes]], + disk_encryption_set: Union[_models.DiskEncryptionSetUpdate, JSON, IO[bytes]], **kwargs: Any ) -> Iterator[bytes]: error_map: MutableMapping = { @@ -37710,10 +37755,10 @@ def _update_initial( content_type = content_type or "application/json" _content = None - if isinstance(properties, (IOBase, bytes)): - _content = properties + if isinstance(disk_encryption_set, (IOBase, bytes)): + _content = disk_encryption_set else: - _content = json.dumps(properties, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(disk_encryption_set, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore _request = build_disk_encryption_sets_update_request( resource_group_name=resource_group_name, @@ -37763,7 +37808,7 @@ def begin_update( self, resource_group_name: str, disk_encryption_set_name: str, - properties: _models.DiskEncryptionSetUpdate, + disk_encryption_set: _models.DiskEncryptionSetUpdate, *, content_type: str = "application/json", **kwargs: Any @@ -37777,9 +37822,9 @@ def begin_update( name can't be changed after the disk encryption set is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. :type disk_encryption_set_name: str - :param properties: disk encryption set object supplied in the body of the Patch disk encryption - set operation. Required. - :type properties: ~azure.mgmt.compute.models.DiskEncryptionSetUpdate + :param disk_encryption_set: disk encryption set object supplied in the body of the Patch disk + encryption set operation. Required. + :type disk_encryption_set: ~azure.mgmt.compute.models.DiskEncryptionSetUpdate :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -37793,7 +37838,7 @@ def begin_update( self, resource_group_name: str, disk_encryption_set_name: str, - properties: JSON, + disk_encryption_set: JSON, *, content_type: str = "application/json", **kwargs: Any @@ -37807,9 +37852,9 @@ def begin_update( name can't be changed after the disk encryption set is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. :type disk_encryption_set_name: str - :param properties: disk encryption set object supplied in the body of the Patch disk encryption - set operation. Required. - :type properties: JSON + :param disk_encryption_set: disk encryption set object supplied in the body of the Patch disk + encryption set operation. Required. + :type disk_encryption_set: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -37823,7 +37868,7 @@ def begin_update( self, resource_group_name: str, disk_encryption_set_name: str, - properties: IO[bytes], + disk_encryption_set: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -37837,9 +37882,9 @@ def begin_update( name can't be changed after the disk encryption set is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. :type disk_encryption_set_name: str - :param properties: disk encryption set object supplied in the body of the Patch disk encryption - set operation. Required. - :type properties: IO[bytes] + :param disk_encryption_set: disk encryption set object supplied in the body of the Patch disk + encryption set operation. Required. + :type disk_encryption_set: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str @@ -37853,7 +37898,7 @@ def begin_update( self, resource_group_name: str, disk_encryption_set_name: str, - properties: Union[_models.DiskEncryptionSetUpdate, JSON, IO[bytes]], + disk_encryption_set: Union[_models.DiskEncryptionSetUpdate, JSON, IO[bytes]], **kwargs: Any ) -> LROPoller[None]: """Updates (patches) a disk encryption set. @@ -37865,10 +37910,11 @@ def begin_update( name can't be changed after the disk encryption set is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. :type disk_encryption_set_name: str - :param properties: disk encryption set object supplied in the body of the Patch disk encryption - set operation. Is one of the following types: DiskEncryptionSetUpdate, JSON, IO[bytes] - Required. - :type properties: ~azure.mgmt.compute.models.DiskEncryptionSetUpdate or JSON or IO[bytes] + :param disk_encryption_set: disk encryption set object supplied in the body of the Patch disk + encryption set operation. Is one of the following types: DiskEncryptionSetUpdate, JSON, + IO[bytes] Required. + :type disk_encryption_set: ~azure.mgmt.compute.models.DiskEncryptionSetUpdate or JSON or + IO[bytes] :return: An instance of LROPoller that returns None :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -37885,7 +37931,7 @@ def begin_update( raw_result = self._update_initial( resource_group_name=resource_group_name, disk_encryption_set_name=disk_encryption_set_name, - properties=properties, + disk_encryption_set=disk_encryption_set, content_type=content_type, cls=lambda x, y, z: x, headers=_headers, @@ -38304,14 +38350,14 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) -class DiskRestorePointsOperations: +class SnapshotsOperations: """ .. warning:: **DO NOT** instantiate this class directly. Instead, you should access the following operations through :class:`~azure.mgmt.compute.ComputeClient`'s - :attr:`disk_restore_points` attribute. + :attr:`snapshots` attribute. """ def __init__(self, *args, **kwargs) -> None: @@ -38322,29 +38368,18 @@ def __init__(self, *args, **kwargs) -> None: self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace - def get( - self, - resource_group_name: str, - restore_point_collection_name: str, - vm_restore_point_name: str, - disk_restore_point_name: str, - **kwargs: Any - ) -> _models.DiskRestorePoint: - """Get disk restorePoint resource. + def get(self, resource_group_name: str, snapshot_name: str, **kwargs: Any) -> _models.Snapshot: + """Gets information about a snapshot. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param restore_point_collection_name: The name of the restore point collection that the disk - restore point belongs. Required. - :type restore_point_collection_name: str - :param vm_restore_point_name: The name of the vm restore point that the disk disk restore point - belongs. Required. - :type vm_restore_point_name: str - :param disk_restore_point_name: The name of the DiskRestorePoint. Required. - :type disk_restore_point_name: str - :return: DiskRestorePoint. The DiskRestorePoint is compatible with MutableMapping - :rtype: ~azure.mgmt.compute.models.DiskRestorePoint + :param snapshot_name: The name of the snapshot that is being created. The name can't be changed + after the snapshot is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. + The max name length is 80 characters. Required. + :type snapshot_name: str + :return: Snapshot. The Snapshot is compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.Snapshot :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -38358,13 +38393,11 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.DiskRestorePoint] = kwargs.pop("cls", None) + cls: ClsType[_models.Snapshot] = kwargs.pop("cls", None) - _request = build_disk_restore_points_get_request( + _request = build_snapshots_get_request( resource_group_name=resource_group_name, - restore_point_collection_name=restore_point_collection_name, - vm_restore_point_name=vm_restore_point_name, - disk_restore_point_name=disk_restore_point_name, + snapshot_name=snapshot_name, subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -38395,118 +38428,18 @@ def get( if _stream: deserialized = response.iter_bytes() else: - deserialized = _deserialize(_models.DiskRestorePoint, response.json()) + deserialized = _deserialize(_models.Snapshot, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - @distributed_trace - def list_by_restore_point( - self, resource_group_name: str, restore_point_collection_name: str, vm_restore_point_name: str, **kwargs: Any - ) -> ItemPaged["_models.DiskRestorePoint"]: - """Lists diskRestorePoints under a vmRestorePoint. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param restore_point_collection_name: The name of the restore point collection that the disk - restore point belongs. Required. - :type restore_point_collection_name: str - :param vm_restore_point_name: The name of the vm restore point that the disk disk restore point - belongs. Required. - :type vm_restore_point_name: str - :return: An iterator like instance of DiskRestorePoint - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.models.DiskRestorePoint] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[List[_models.DiskRestorePoint]] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_disk_restore_points_list_by_restore_point_request( - resource_group_name=resource_group_name, - restore_point_collection_name=restore_point_collection_name, - vm_restore_point_name=vm_restore_point_name, - subscription_id=self._config.subscription_id, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - return _request - - def extract_data(pipeline_response): - deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.DiskRestorePoint], deserialized.get("value", [])) - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.get("nextLink") or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.CloudError, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - def _grant_access_initial( + def _create_or_update_initial( self, resource_group_name: str, - restore_point_collection_name: str, - vm_restore_point_name: str, - disk_restore_point_name: str, - body: Union[_models.GrantAccessData, JSON, IO[bytes]], + snapshot_name: str, + snapshot: Union[_models.Snapshot, JSON, IO[bytes]], **kwargs: Any ) -> Iterator[bytes]: error_map: MutableMapping = { @@ -38525,16 +38458,14 @@ def _grant_access_initial( content_type = content_type or "application/json" _content = None - if isinstance(body, (IOBase, bytes)): - _content = body + if isinstance(snapshot, (IOBase, bytes)): + _content = snapshot else: - _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(snapshot, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - _request = build_disk_restore_points_grant_access_request( + _request = build_snapshots_create_or_update_request( resource_group_name=resource_group_name, - restore_point_collection_name=restore_point_collection_name, - vm_restore_point_name=vm_restore_point_name, - disk_restore_point_name=disk_restore_point_name, + snapshot_name=snapshot_name, subscription_id=self._config.subscription_id, content_type=content_type, api_version=self._config.api_version, @@ -38576,162 +38507,129 @@ def _grant_access_initial( return deserialized # type: ignore @overload - def begin_grant_access( + def begin_create_or_update( self, resource_group_name: str, - restore_point_collection_name: str, - vm_restore_point_name: str, - disk_restore_point_name: str, - body: _models.GrantAccessData, + snapshot_name: str, + snapshot: _models.Snapshot, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.AccessUri]: - """Grants access to a diskRestorePoint. + ) -> LROPoller[None]: + """Creates or updates a snapshot. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param restore_point_collection_name: The name of the restore point collection that the disk - restore point belongs. Required. - :type restore_point_collection_name: str - :param vm_restore_point_name: The name of the vm restore point that the disk disk restore point - belongs. Required. - :type vm_restore_point_name: str - :param disk_restore_point_name: The name of the DiskRestorePoint. Required. - :type disk_restore_point_name: str - :param body: Access data object supplied in the body of the get disk access operation. - Required. - :type body: ~azure.mgmt.compute.models.GrantAccessData + :param snapshot_name: The name of the snapshot that is being created. The name can't be changed + after the snapshot is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. + The max name length is 80 characters. Required. + :type snapshot_name: str + :param snapshot: Snapshot object supplied in the body of the Put disk operation. Required. + :type snapshot: ~azure.mgmt.compute.models.Snapshot :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns AccessUri. The AccessUri is compatible with - MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.AccessUri] + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def begin_grant_access( + def begin_create_or_update( self, resource_group_name: str, - restore_point_collection_name: str, - vm_restore_point_name: str, - disk_restore_point_name: str, - body: JSON, + snapshot_name: str, + snapshot: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.AccessUri]: - """Grants access to a diskRestorePoint. + ) -> LROPoller[None]: + """Creates or updates a snapshot. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param restore_point_collection_name: The name of the restore point collection that the disk - restore point belongs. Required. - :type restore_point_collection_name: str - :param vm_restore_point_name: The name of the vm restore point that the disk disk restore point - belongs. Required. - :type vm_restore_point_name: str - :param disk_restore_point_name: The name of the DiskRestorePoint. Required. - :type disk_restore_point_name: str - :param body: Access data object supplied in the body of the get disk access operation. - Required. - :type body: JSON + :param snapshot_name: The name of the snapshot that is being created. The name can't be changed + after the snapshot is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. + The max name length is 80 characters. Required. + :type snapshot_name: str + :param snapshot: Snapshot object supplied in the body of the Put disk operation. Required. + :type snapshot: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns AccessUri. The AccessUri is compatible with - MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.AccessUri] + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def begin_grant_access( + def begin_create_or_update( self, resource_group_name: str, - restore_point_collection_name: str, - vm_restore_point_name: str, - disk_restore_point_name: str, - body: IO[bytes], + snapshot_name: str, + snapshot: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.AccessUri]: - """Grants access to a diskRestorePoint. + ) -> LROPoller[None]: + """Creates or updates a snapshot. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param restore_point_collection_name: The name of the restore point collection that the disk - restore point belongs. Required. - :type restore_point_collection_name: str - :param vm_restore_point_name: The name of the vm restore point that the disk disk restore point - belongs. Required. - :type vm_restore_point_name: str - :param disk_restore_point_name: The name of the DiskRestorePoint. Required. - :type disk_restore_point_name: str - :param body: Access data object supplied in the body of the get disk access operation. - Required. - :type body: IO[bytes] + :param snapshot_name: The name of the snapshot that is being created. The name can't be changed + after the snapshot is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. + The max name length is 80 characters. Required. + :type snapshot_name: str + :param snapshot: Snapshot object supplied in the body of the Put disk operation. Required. + :type snapshot: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns AccessUri. The AccessUri is compatible with - MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.AccessUri] + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace - def begin_grant_access( + def begin_create_or_update( self, resource_group_name: str, - restore_point_collection_name: str, - vm_restore_point_name: str, - disk_restore_point_name: str, - body: Union[_models.GrantAccessData, JSON, IO[bytes]], + snapshot_name: str, + snapshot: Union[_models.Snapshot, JSON, IO[bytes]], **kwargs: Any - ) -> LROPoller[_models.AccessUri]: - """Grants access to a diskRestorePoint. + ) -> LROPoller[None]: + """Creates or updates a snapshot. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param restore_point_collection_name: The name of the restore point collection that the disk - restore point belongs. Required. - :type restore_point_collection_name: str - :param vm_restore_point_name: The name of the vm restore point that the disk disk restore point - belongs. Required. - :type vm_restore_point_name: str - :param disk_restore_point_name: The name of the DiskRestorePoint. Required. - :type disk_restore_point_name: str - :param body: Access data object supplied in the body of the get disk access operation. Is one - of the following types: GrantAccessData, JSON, IO[bytes] Required. - :type body: ~azure.mgmt.compute.models.GrantAccessData or JSON or IO[bytes] - :return: An instance of LROPoller that returns AccessUri. The AccessUri is compatible with - MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.AccessUri] + :param snapshot_name: The name of the snapshot that is being created. The name can't be changed + after the snapshot is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. + The max name length is 80 characters. Required. + :type snapshot_name: str + :param snapshot: Snapshot object supplied in the body of the Put disk operation. Is one of the + following types: Snapshot, JSON, IO[bytes] Required. + :type snapshot: ~azure.mgmt.compute.models.Snapshot or JSON or IO[bytes] + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AccessUri] = kwargs.pop("cls", None) + cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._grant_access_initial( + raw_result = self._create_or_update_initial( resource_group_name=resource_group_name, - restore_point_collection_name=restore_point_collection_name, - vm_restore_point_name=vm_restore_point_name, - disk_restore_point_name=disk_restore_point_name, - body=body, + snapshot_name=snapshot_name, + snapshot=snapshot, content_type=content_type, cls=lambda x, y, z: x, headers=_headers, @@ -38741,16 +38639,9 @@ def begin_grant_access( raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): - response_headers = {} - response = pipeline_response.http_response - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = _deserialize(_models.AccessUri, response.json()) + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized + return cls(pipeline_response, None, {}) # type: ignore path_format_arguments = { "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), @@ -38765,22 +38656,19 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller[_models.AccessUri].from_continuation_token( + return LROPoller[None].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller[_models.AccessUri]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - def _revoke_access_initial( + def _update_initial( self, resource_group_name: str, - restore_point_collection_name: str, - vm_restore_point_name: str, - disk_restore_point_name: str, + snapshot_name: str, + snapshot: Union[_models.SnapshotUpdate, JSON, IO[bytes]], **kwargs: Any ) -> Iterator[bytes]: error_map: MutableMapping = { @@ -38791,486 +38679,26 @@ def _revoke_access_initial( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - _request = build_disk_restore_points_revoke_access_request( + content_type = content_type or "application/json" + _content = None + if isinstance(snapshot, (IOBase, bytes)): + _content = snapshot + else: + _content = json.dumps(snapshot, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_snapshots_update_request( resource_group_name=resource_group_name, - restore_point_collection_name=restore_point_collection_name, - vm_restore_point_name=vm_restore_point_name, - disk_restore_point_name=disk_restore_point_name, + snapshot_name=snapshot_name, subscription_id=self._config.subscription_id, + content_type=content_type, api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.CloudError, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.iter_bytes() - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_revoke_access( - self, - resource_group_name: str, - restore_point_collection_name: str, - vm_restore_point_name: str, - disk_restore_point_name: str, - **kwargs: Any - ) -> LROPoller[_models.OkResponse]: - """Revokes access to a diskRestorePoint. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param restore_point_collection_name: The name of the restore point collection that the disk - restore point belongs. Required. - :type restore_point_collection_name: str - :param vm_restore_point_name: The name of the vm restore point that the disk disk restore point - belongs. Required. - :type vm_restore_point_name: str - :param disk_restore_point_name: The name of the DiskRestorePoint. Required. - :type disk_restore_point_name: str - :return: An instance of LROPoller that returns OkResponse. The OkResponse is compatible with - MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.OkResponse] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[_models.OkResponse] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._revoke_access_initial( - resource_group_name=resource_group_name, - restore_point_collection_name=restore_point_collection_name, - vm_restore_point_name=vm_restore_point_name, - disk_restore_point_name=disk_restore_point_name, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - response_headers = {} - response = pipeline_response.http_response - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = _deserialize(_models.OkResponse, response.json()) - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized - - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.OkResponse].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.OkResponse]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - -class SnapshotsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.compute.ComputeClient`'s - :attr:`snapshots` attribute. - """ - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ComputeClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def get(self, resource_group_name: str, snapshot_name: str, **kwargs: Any) -> _models.Snapshot: - """Gets information about a snapshot. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param snapshot_name: The name of the snapshot that is being created. The name can't be changed - after the snapshot is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. - The max name length is 80 characters. Required. - :type snapshot_name: str - :return: Snapshot. The Snapshot is compatible with MutableMapping - :rtype: ~azure.mgmt.compute.models.Snapshot - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[_models.Snapshot] = kwargs.pop("cls", None) - - _request = build_snapshots_get_request( - resource_group_name=resource_group_name, - snapshot_name=snapshot_name, - subscription_id=self._config.subscription_id, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = kwargs.pop("stream", False) - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - if _stream: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.CloudError, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if _stream: - deserialized = response.iter_bytes() - else: - deserialized = _deserialize(_models.Snapshot, response.json()) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - snapshot_name: str, - resource: Union[_models.Snapshot, JSON, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} - - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _content = None - if isinstance(resource, (IOBase, bytes)): - _content = resource - else: - _content = json.dumps(resource, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - - _request = build_snapshots_create_or_update_request( - resource_group_name=resource_group_name, - snapshot_name=snapshot_name, - subscription_id=self._config.subscription_id, - content_type=content_type, - api_version=self._config.api_version, - content=_content, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.CloudError, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.iter_bytes() - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - snapshot_name: str, - resource: _models.Snapshot, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[None]: - """Creates or updates a snapshot. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param snapshot_name: The name of the snapshot that is being created. The name can't be changed - after the snapshot is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. - The max name length is 80 characters. Required. - :type snapshot_name: str - :param resource: Snapshot object supplied in the body of the Put disk operation. Required. - :type resource: ~azure.mgmt.compute.models.Snapshot - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns None - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - snapshot_name: str, - resource: JSON, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[None]: - """Creates or updates a snapshot. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param snapshot_name: The name of the snapshot that is being created. The name can't be changed - after the snapshot is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. - The max name length is 80 characters. Required. - :type snapshot_name: str - :param resource: Snapshot object supplied in the body of the Put disk operation. Required. - :type resource: JSON - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns None - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - snapshot_name: str, - resource: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[None]: - """Creates or updates a snapshot. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param snapshot_name: The name of the snapshot that is being created. The name can't be changed - after the snapshot is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. - The max name length is 80 characters. Required. - :type snapshot_name: str - :param resource: Snapshot object supplied in the body of the Put disk operation. Required. - :type resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns None - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - snapshot_name: str, - resource: Union[_models.Snapshot, JSON, IO[bytes]], - **kwargs: Any - ) -> LROPoller[None]: - """Creates or updates a snapshot. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param snapshot_name: The name of the snapshot that is being created. The name can't be changed - after the snapshot is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. - The max name length is 80 characters. Required. - :type snapshot_name: str - :param resource: Snapshot object supplied in the body of the Put disk operation. Is one of the - following types: Snapshot, JSON, IO[bytes] Required. - :type resource: ~azure.mgmt.compute.models.Snapshot or JSON or IO[bytes] - :return: An instance of LROPoller that returns None - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} - - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._create_or_update_initial( - resource_group_name=resource_group_name, - snapshot_name=snapshot_name, - resource=resource, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _update_initial( - self, - resource_group_name: str, - snapshot_name: str, - properties: Union[_models.SnapshotUpdate, JSON, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} - - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _content = None - if isinstance(properties, (IOBase, bytes)): - _content = properties - else: - _content = json.dumps(properties, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - - _request = build_snapshots_update_request( - resource_group_name=resource_group_name, - snapshot_name=snapshot_name, - subscription_id=self._config.subscription_id, - content_type=content_type, - api_version=self._config.api_version, - content=_content, + content=_content, headers=_headers, params=_params, ) @@ -39312,7 +38740,7 @@ def begin_update( self, resource_group_name: str, snapshot_name: str, - properties: _models.SnapshotUpdate, + snapshot: _models.SnapshotUpdate, *, content_type: str = "application/json", **kwargs: Any @@ -39326,9 +38754,9 @@ def begin_update( after the snapshot is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The max name length is 80 characters. Required. :type snapshot_name: str - :param properties: Snapshot object supplied in the body of the Patch snapshot operation. + :param snapshot: Snapshot object supplied in the body of the Patch snapshot operation. Required. - :type properties: ~azure.mgmt.compute.models.SnapshotUpdate + :type snapshot: ~azure.mgmt.compute.models.SnapshotUpdate :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -39342,7 +38770,7 @@ def begin_update( self, resource_group_name: str, snapshot_name: str, - properties: JSON, + snapshot: JSON, *, content_type: str = "application/json", **kwargs: Any @@ -39356,9 +38784,9 @@ def begin_update( after the snapshot is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The max name length is 80 characters. Required. :type snapshot_name: str - :param properties: Snapshot object supplied in the body of the Patch snapshot operation. + :param snapshot: Snapshot object supplied in the body of the Patch snapshot operation. Required. - :type properties: JSON + :type snapshot: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -39372,7 +38800,7 @@ def begin_update( self, resource_group_name: str, snapshot_name: str, - properties: IO[bytes], + snapshot: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -39386,9 +38814,9 @@ def begin_update( after the snapshot is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The max name length is 80 characters. Required. :type snapshot_name: str - :param properties: Snapshot object supplied in the body of the Patch snapshot operation. + :param snapshot: Snapshot object supplied in the body of the Patch snapshot operation. Required. - :type properties: IO[bytes] + :type snapshot: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str @@ -39402,7 +38830,7 @@ def begin_update( self, resource_group_name: str, snapshot_name: str, - properties: Union[_models.SnapshotUpdate, JSON, IO[bytes]], + snapshot: Union[_models.SnapshotUpdate, JSON, IO[bytes]], **kwargs: Any ) -> LROPoller[None]: """Updates (patches) a snapshot. @@ -39414,9 +38842,9 @@ def begin_update( after the snapshot is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The max name length is 80 characters. Required. :type snapshot_name: str - :param properties: Snapshot object supplied in the body of the Patch snapshot operation. Is one + :param snapshot: Snapshot object supplied in the body of the Patch snapshot operation. Is one of the following types: SnapshotUpdate, JSON, IO[bytes] Required. - :type properties: ~azure.mgmt.compute.models.SnapshotUpdate or JSON or IO[bytes] + :type snapshot: ~azure.mgmt.compute.models.SnapshotUpdate or JSON or IO[bytes] :return: An instance of LROPoller that returns None :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -39433,7 +38861,7 @@ def begin_update( raw_result = self._update_initial( resource_group_name=resource_group_name, snapshot_name=snapshot_name, - properties=properties, + snapshot=snapshot, content_type=content_type, cls=lambda x, y, z: x, headers=_headers, @@ -39758,7 +39186,7 @@ def _grant_access_initial( self, resource_group_name: str, snapshot_name: str, - body: Union[_models.GrantAccessData, JSON, IO[bytes]], + grant_access_data: Union[_models.GrantAccessData, JSON, IO[bytes]], **kwargs: Any ) -> Iterator[bytes]: error_map: MutableMapping = { @@ -39777,10 +39205,10 @@ def _grant_access_initial( content_type = content_type or "application/json" _content = None - if isinstance(body, (IOBase, bytes)): - _content = body + if isinstance(grant_access_data, (IOBase, bytes)): + _content = grant_access_data else: - _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(grant_access_data, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore _request = build_snapshots_grant_access_request( resource_group_name=resource_group_name, @@ -39830,7 +39258,7 @@ def begin_grant_access( self, resource_group_name: str, snapshot_name: str, - body: _models.GrantAccessData, + grant_access_data: _models.GrantAccessData, *, content_type: str = "application/json", **kwargs: Any @@ -39844,9 +39272,9 @@ def begin_grant_access( after the snapshot is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The max name length is 80 characters. Required. :type snapshot_name: str - :param body: Access data object supplied in the body of the get snapshot access operation. - Required. - :type body: ~azure.mgmt.compute.models.GrantAccessData + :param grant_access_data: Access data object supplied in the body of the get snapshot access + operation. Required. + :type grant_access_data: ~azure.mgmt.compute.models.GrantAccessData :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -39861,7 +39289,7 @@ def begin_grant_access( self, resource_group_name: str, snapshot_name: str, - body: JSON, + grant_access_data: JSON, *, content_type: str = "application/json", **kwargs: Any @@ -39875,9 +39303,9 @@ def begin_grant_access( after the snapshot is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The max name length is 80 characters. Required. :type snapshot_name: str - :param body: Access data object supplied in the body of the get snapshot access operation. - Required. - :type body: JSON + :param grant_access_data: Access data object supplied in the body of the get snapshot access + operation. Required. + :type grant_access_data: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -39892,7 +39320,7 @@ def begin_grant_access( self, resource_group_name: str, snapshot_name: str, - body: IO[bytes], + grant_access_data: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -39906,9 +39334,9 @@ def begin_grant_access( after the snapshot is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The max name length is 80 characters. Required. :type snapshot_name: str - :param body: Access data object supplied in the body of the get snapshot access operation. - Required. - :type body: IO[bytes] + :param grant_access_data: Access data object supplied in the body of the get snapshot access + operation. Required. + :type grant_access_data: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str @@ -39923,7 +39351,7 @@ def begin_grant_access( self, resource_group_name: str, snapshot_name: str, - body: Union[_models.GrantAccessData, JSON, IO[bytes]], + grant_access_data: Union[_models.GrantAccessData, JSON, IO[bytes]], **kwargs: Any ) -> LROPoller[_models.AccessUri]: """Grants access to a snapshot. @@ -39935,9 +39363,9 @@ def begin_grant_access( after the snapshot is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The max name length is 80 characters. Required. :type snapshot_name: str - :param body: Access data object supplied in the body of the get snapshot access operation. Is - one of the following types: GrantAccessData, JSON, IO[bytes] Required. - :type body: ~azure.mgmt.compute.models.GrantAccessData or JSON or IO[bytes] + :param grant_access_data: Access data object supplied in the body of the get snapshot access + operation. Is one of the following types: GrantAccessData, JSON, IO[bytes] Required. + :type grant_access_data: ~azure.mgmt.compute.models.GrantAccessData or JSON or IO[bytes] :return: An instance of LROPoller that returns AccessUri. The AccessUri is compatible with MutableMapping :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.AccessUri] @@ -39955,7 +39383,7 @@ def begin_grant_access( raw_result = self._grant_access_initial( resource_group_name=resource_group_name, snapshot_name=snapshot_name, - body=body, + grant_access_data=grant_access_data, content_type=content_type, cls=lambda x, y, z: x, headers=_headers, @@ -40229,7 +39657,7 @@ def _create_or_update_initial( self, resource_group_name: str, gallery_name: str, - resource: Union[_models.Gallery, JSON, IO[bytes]], + gallery: Union[_models.Gallery, JSON, IO[bytes]], **kwargs: Any ) -> Iterator[bytes]: error_map: MutableMapping = { @@ -40248,10 +39676,10 @@ def _create_or_update_initial( content_type = content_type or "application/json" _content = None - if isinstance(resource, (IOBase, bytes)): - _content = resource + if isinstance(gallery, (IOBase, bytes)): + _content = gallery else: - _content = json.dumps(resource, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(gallery, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore _request = build_galleries_create_or_update_request( resource_group_name=resource_group_name, @@ -40305,7 +39733,7 @@ def begin_create_or_update( self, resource_group_name: str, gallery_name: str, - resource: _models.Gallery, + gallery: _models.Gallery, *, content_type: str = "application/json", **kwargs: Any @@ -40317,9 +39745,9 @@ def begin_create_or_update( :type resource_group_name: str :param gallery_name: The name of the Shared Image Gallery. Required. :type gallery_name: str - :param resource: Parameters supplied to the create or update Shared Image Gallery operation. + :param gallery: Parameters supplied to the create or update Shared Image Gallery operation. Required. - :type resource: ~azure.mgmt.compute.models.Gallery + :type gallery: ~azure.mgmt.compute.models.Gallery :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -40333,7 +39761,7 @@ def begin_create_or_update( self, resource_group_name: str, gallery_name: str, - resource: JSON, + gallery: JSON, *, content_type: str = "application/json", **kwargs: Any @@ -40345,9 +39773,9 @@ def begin_create_or_update( :type resource_group_name: str :param gallery_name: The name of the Shared Image Gallery. Required. :type gallery_name: str - :param resource: Parameters supplied to the create or update Shared Image Gallery operation. + :param gallery: Parameters supplied to the create or update Shared Image Gallery operation. Required. - :type resource: JSON + :type gallery: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -40361,7 +39789,7 @@ def begin_create_or_update( self, resource_group_name: str, gallery_name: str, - resource: IO[bytes], + gallery: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -40373,9 +39801,9 @@ def begin_create_or_update( :type resource_group_name: str :param gallery_name: The name of the Shared Image Gallery. Required. :type gallery_name: str - :param resource: Parameters supplied to the create or update Shared Image Gallery operation. + :param gallery: Parameters supplied to the create or update Shared Image Gallery operation. Required. - :type resource: IO[bytes] + :type gallery: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str @@ -40389,7 +39817,7 @@ def begin_create_or_update( self, resource_group_name: str, gallery_name: str, - resource: Union[_models.Gallery, JSON, IO[bytes]], + gallery: Union[_models.Gallery, JSON, IO[bytes]], **kwargs: Any ) -> LROPoller[None]: """Create or update a Shared Image Gallery. @@ -40399,9 +39827,9 @@ def begin_create_or_update( :type resource_group_name: str :param gallery_name: The name of the Shared Image Gallery. Required. :type gallery_name: str - :param resource: Parameters supplied to the create or update Shared Image Gallery operation. Is + :param gallery: Parameters supplied to the create or update Shared Image Gallery operation. Is one of the following types: Gallery, JSON, IO[bytes] Required. - :type resource: ~azure.mgmt.compute.models.Gallery or JSON or IO[bytes] + :type gallery: ~azure.mgmt.compute.models.Gallery or JSON or IO[bytes] :return: An instance of LROPoller that returns None :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -40418,7 +39846,7 @@ def begin_create_or_update( raw_result = self._create_or_update_initial( resource_group_name=resource_group_name, gallery_name=gallery_name, - resource=resource, + gallery=gallery, content_type=content_type, cls=lambda x, y, z: x, headers=_headers, @@ -40457,7 +39885,7 @@ def _update_initial( self, resource_group_name: str, gallery_name: str, - properties: Union[_models.GalleryUpdate, JSON, IO[bytes]], + gallery: Union[_models.GalleryUpdate, JSON, IO[bytes]], **kwargs: Any ) -> Iterator[bytes]: error_map: MutableMapping = { @@ -40476,10 +39904,10 @@ def _update_initial( content_type = content_type or "application/json" _content = None - if isinstance(properties, (IOBase, bytes)): - _content = properties + if isinstance(gallery, (IOBase, bytes)): + _content = gallery else: - _content = json.dumps(properties, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(gallery, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore _request = build_galleries_update_request( resource_group_name=resource_group_name, @@ -40528,7 +39956,7 @@ def begin_update( self, resource_group_name: str, gallery_name: str, - properties: _models.GalleryUpdate, + gallery: _models.GalleryUpdate, *, content_type: str = "application/json", **kwargs: Any @@ -40540,8 +39968,8 @@ def begin_update( :type resource_group_name: str :param gallery_name: The name of the Shared Image Gallery. Required. :type gallery_name: str - :param properties: Parameters supplied to the update Shared Image Gallery operation. Required. - :type properties: ~azure.mgmt.compute.models.GalleryUpdate + :param gallery: Parameters supplied to the update Shared Image Gallery operation. Required. + :type gallery: ~azure.mgmt.compute.models.GalleryUpdate :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -40555,7 +39983,7 @@ def begin_update( self, resource_group_name: str, gallery_name: str, - properties: JSON, + gallery: JSON, *, content_type: str = "application/json", **kwargs: Any @@ -40567,8 +39995,8 @@ def begin_update( :type resource_group_name: str :param gallery_name: The name of the Shared Image Gallery. Required. :type gallery_name: str - :param properties: Parameters supplied to the update Shared Image Gallery operation. Required. - :type properties: JSON + :param gallery: Parameters supplied to the update Shared Image Gallery operation. Required. + :type gallery: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -40582,7 +40010,7 @@ def begin_update( self, resource_group_name: str, gallery_name: str, - properties: IO[bytes], + gallery: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -40594,8 +40022,8 @@ def begin_update( :type resource_group_name: str :param gallery_name: The name of the Shared Image Gallery. Required. :type gallery_name: str - :param properties: Parameters supplied to the update Shared Image Gallery operation. Required. - :type properties: IO[bytes] + :param gallery: Parameters supplied to the update Shared Image Gallery operation. Required. + :type gallery: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str @@ -40609,7 +40037,7 @@ def begin_update( self, resource_group_name: str, gallery_name: str, - properties: Union[_models.GalleryUpdate, JSON, IO[bytes]], + gallery: Union[_models.GalleryUpdate, JSON, IO[bytes]], **kwargs: Any ) -> LROPoller[None]: """Update a Shared Image Gallery. @@ -40619,9 +40047,9 @@ def begin_update( :type resource_group_name: str :param gallery_name: The name of the Shared Image Gallery. Required. :type gallery_name: str - :param properties: Parameters supplied to the update Shared Image Gallery operation. Is one of - the following types: GalleryUpdate, JSON, IO[bytes] Required. - :type properties: ~azure.mgmt.compute.models.GalleryUpdate or JSON or IO[bytes] + :param gallery: Parameters supplied to the update Shared Image Gallery operation. Is one of the + following types: GalleryUpdate, JSON, IO[bytes] Required. + :type gallery: ~azure.mgmt.compute.models.GalleryUpdate or JSON or IO[bytes] :return: An instance of LROPoller that returns None :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -40638,7 +40066,7 @@ def begin_update( raw_result = self._update_initial( resource_group_name=resource_group_name, gallery_name=gallery_name, - properties=properties, + gallery=gallery, content_type=content_type, cls=lambda x, y, z: x, headers=_headers, @@ -41063,7 +40491,7 @@ def _gallery_sharing_profile_update_initial( self, resource_group_name: str, gallery_name: str, - body: Union[_models.SharingUpdate, JSON, IO[bytes]], + sharing_update: Union[_models.SharingUpdate, JSON, IO[bytes]], **kwargs: Any ) -> Iterator[bytes]: error_map: MutableMapping = { @@ -41082,10 +40510,10 @@ def _gallery_sharing_profile_update_initial( content_type = content_type or "application/json" _content = None - if isinstance(body, (IOBase, bytes)): - _content = body + if isinstance(sharing_update, (IOBase, bytes)): + _content = sharing_update else: - _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(sharing_update, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore _request = build_galleries_gallery_sharing_profile_update_request( resource_group_name=resource_group_name, @@ -41135,7 +40563,7 @@ def begin_gallery_sharing_profile_update( self, resource_group_name: str, gallery_name: str, - body: _models.SharingUpdate, + sharing_update: _models.SharingUpdate, *, content_type: str = "application/json", **kwargs: Any @@ -41147,8 +40575,8 @@ def begin_gallery_sharing_profile_update( :type resource_group_name: str :param gallery_name: The name of the Shared Image Gallery. Required. :type gallery_name: str - :param body: Parameters supplied to the update gallery sharing profile. Required. - :type body: ~azure.mgmt.compute.models.SharingUpdate + :param sharing_update: Parameters supplied to the update gallery sharing profile. Required. + :type sharing_update: ~azure.mgmt.compute.models.SharingUpdate :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -41162,7 +40590,7 @@ def begin_gallery_sharing_profile_update( self, resource_group_name: str, gallery_name: str, - body: JSON, + sharing_update: JSON, *, content_type: str = "application/json", **kwargs: Any @@ -41174,8 +40602,8 @@ def begin_gallery_sharing_profile_update( :type resource_group_name: str :param gallery_name: The name of the Shared Image Gallery. Required. :type gallery_name: str - :param body: Parameters supplied to the update gallery sharing profile. Required. - :type body: JSON + :param sharing_update: Parameters supplied to the update gallery sharing profile. Required. + :type sharing_update: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -41189,7 +40617,7 @@ def begin_gallery_sharing_profile_update( self, resource_group_name: str, gallery_name: str, - body: IO[bytes], + sharing_update: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -41201,8 +40629,8 @@ def begin_gallery_sharing_profile_update( :type resource_group_name: str :param gallery_name: The name of the Shared Image Gallery. Required. :type gallery_name: str - :param body: Parameters supplied to the update gallery sharing profile. Required. - :type body: IO[bytes] + :param sharing_update: Parameters supplied to the update gallery sharing profile. Required. + :type sharing_update: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str @@ -41216,7 +40644,7 @@ def begin_gallery_sharing_profile_update( self, resource_group_name: str, gallery_name: str, - body: Union[_models.SharingUpdate, JSON, IO[bytes]], + sharing_update: Union[_models.SharingUpdate, JSON, IO[bytes]], **kwargs: Any ) -> LROPoller[None]: """Update sharing profile of a gallery. @@ -41226,9 +40654,9 @@ def begin_gallery_sharing_profile_update( :type resource_group_name: str :param gallery_name: The name of the Shared Image Gallery. Required. :type gallery_name: str - :param body: Parameters supplied to the update gallery sharing profile. Is one of the following - types: SharingUpdate, JSON, IO[bytes] Required. - :type body: ~azure.mgmt.compute.models.SharingUpdate or JSON or IO[bytes] + :param sharing_update: Parameters supplied to the update gallery sharing profile. Is one of the + following types: SharingUpdate, JSON, IO[bytes] Required. + :type sharing_update: ~azure.mgmt.compute.models.SharingUpdate or JSON or IO[bytes] :return: An instance of LROPoller that returns None :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -41245,7 +40673,7 @@ def begin_gallery_sharing_profile_update( raw_result = self._gallery_sharing_profile_update_initial( resource_group_name=resource_group_name, gallery_name=gallery_name, - body=body, + sharing_update=sharing_update, content_type=content_type, cls=lambda x, y, z: x, headers=_headers, @@ -41374,7 +40802,7 @@ def _create_or_update_initial( resource_group_name: str, gallery_name: str, gallery_image_name: str, - resource: Union[_models.GalleryImage, JSON, IO[bytes]], + gallery_image: Union[_models.GalleryImage, JSON, IO[bytes]], **kwargs: Any ) -> Iterator[bytes]: error_map: MutableMapping = { @@ -41393,10 +40821,10 @@ def _create_or_update_initial( content_type = content_type or "application/json" _content = None - if isinstance(resource, (IOBase, bytes)): - _content = resource + if isinstance(gallery_image, (IOBase, bytes)): + _content = gallery_image else: - _content = json.dumps(resource, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(gallery_image, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore _request = build_gallery_images_create_or_update_request( resource_group_name=resource_group_name, @@ -41452,7 +40880,7 @@ def begin_create_or_update( resource_group_name: str, gallery_name: str, gallery_image_name: str, - resource: _models.GalleryImage, + gallery_image: _models.GalleryImage, *, content_type: str = "application/json", **kwargs: Any @@ -41466,8 +40894,9 @@ def begin_create_or_update( :type gallery_name: str :param gallery_image_name: The name of the gallery image definition to be retrieved. Required. :type gallery_image_name: str - :param resource: Parameters supplied to the create or update gallery image operation. Required. - :type resource: ~azure.mgmt.compute.models.GalleryImage + :param gallery_image: Parameters supplied to the create or update gallery image operation. + Required. + :type gallery_image: ~azure.mgmt.compute.models.GalleryImage :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -41482,7 +40911,7 @@ def begin_create_or_update( resource_group_name: str, gallery_name: str, gallery_image_name: str, - resource: JSON, + gallery_image: JSON, *, content_type: str = "application/json", **kwargs: Any @@ -41496,8 +40925,9 @@ def begin_create_or_update( :type gallery_name: str :param gallery_image_name: The name of the gallery image definition to be retrieved. Required. :type gallery_image_name: str - :param resource: Parameters supplied to the create or update gallery image operation. Required. - :type resource: JSON + :param gallery_image: Parameters supplied to the create or update gallery image operation. + Required. + :type gallery_image: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -41512,7 +40942,7 @@ def begin_create_or_update( resource_group_name: str, gallery_name: str, gallery_image_name: str, - resource: IO[bytes], + gallery_image: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -41526,8 +40956,9 @@ def begin_create_or_update( :type gallery_name: str :param gallery_image_name: The name of the gallery image definition to be retrieved. Required. :type gallery_image_name: str - :param resource: Parameters supplied to the create or update gallery image operation. Required. - :type resource: IO[bytes] + :param gallery_image: Parameters supplied to the create or update gallery image operation. + Required. + :type gallery_image: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str @@ -41542,7 +40973,7 @@ def begin_create_or_update( resource_group_name: str, gallery_name: str, gallery_image_name: str, - resource: Union[_models.GalleryImage, JSON, IO[bytes]], + gallery_image: Union[_models.GalleryImage, JSON, IO[bytes]], **kwargs: Any ) -> LROPoller[None]: """Create or update a gallery image definition. @@ -41554,9 +40985,9 @@ def begin_create_or_update( :type gallery_name: str :param gallery_image_name: The name of the gallery image definition to be retrieved. Required. :type gallery_image_name: str - :param resource: Parameters supplied to the create or update gallery image operation. Is one of - the following types: GalleryImage, JSON, IO[bytes] Required. - :type resource: ~azure.mgmt.compute.models.GalleryImage or JSON or IO[bytes] + :param gallery_image: Parameters supplied to the create or update gallery image operation. Is + one of the following types: GalleryImage, JSON, IO[bytes] Required. + :type gallery_image: ~azure.mgmt.compute.models.GalleryImage or JSON or IO[bytes] :return: An instance of LROPoller that returns None :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -41574,7 +41005,7 @@ def begin_create_or_update( resource_group_name=resource_group_name, gallery_name=gallery_name, gallery_image_name=gallery_image_name, - resource=resource, + gallery_image=gallery_image, content_type=content_type, cls=lambda x, y, z: x, headers=_headers, @@ -41614,7 +41045,7 @@ def _update_initial( resource_group_name: str, gallery_name: str, gallery_image_name: str, - properties: Union[_models.GalleryImageUpdate, JSON, IO[bytes]], + gallery_image: Union[_models.GalleryImageUpdate, JSON, IO[bytes]], **kwargs: Any ) -> Iterator[bytes]: error_map: MutableMapping = { @@ -41633,10 +41064,10 @@ def _update_initial( content_type = content_type or "application/json" _content = None - if isinstance(properties, (IOBase, bytes)): - _content = properties + if isinstance(gallery_image, (IOBase, bytes)): + _content = gallery_image else: - _content = json.dumps(properties, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(gallery_image, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore _request = build_gallery_images_update_request( resource_group_name=resource_group_name, @@ -41687,7 +41118,7 @@ def begin_update( resource_group_name: str, gallery_name: str, gallery_image_name: str, - properties: _models.GalleryImageUpdate, + gallery_image: _models.GalleryImageUpdate, *, content_type: str = "application/json", **kwargs: Any @@ -41701,8 +41132,8 @@ def begin_update( :type gallery_name: str :param gallery_image_name: The name of the gallery image definition to be retrieved. Required. :type gallery_image_name: str - :param properties: Parameters supplied to the update gallery image operation. Required. - :type properties: ~azure.mgmt.compute.models.GalleryImageUpdate + :param gallery_image: Parameters supplied to the update gallery image operation. Required. + :type gallery_image: ~azure.mgmt.compute.models.GalleryImageUpdate :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -41717,7 +41148,7 @@ def begin_update( resource_group_name: str, gallery_name: str, gallery_image_name: str, - properties: JSON, + gallery_image: JSON, *, content_type: str = "application/json", **kwargs: Any @@ -41731,8 +41162,8 @@ def begin_update( :type gallery_name: str :param gallery_image_name: The name of the gallery image definition to be retrieved. Required. :type gallery_image_name: str - :param properties: Parameters supplied to the update gallery image operation. Required. - :type properties: JSON + :param gallery_image: Parameters supplied to the update gallery image operation. Required. + :type gallery_image: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -41747,7 +41178,7 @@ def begin_update( resource_group_name: str, gallery_name: str, gallery_image_name: str, - properties: IO[bytes], + gallery_image: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -41761,8 +41192,8 @@ def begin_update( :type gallery_name: str :param gallery_image_name: The name of the gallery image definition to be retrieved. Required. :type gallery_image_name: str - :param properties: Parameters supplied to the update gallery image operation. Required. - :type properties: IO[bytes] + :param gallery_image: Parameters supplied to the update gallery image operation. Required. + :type gallery_image: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str @@ -41777,7 +41208,7 @@ def begin_update( resource_group_name: str, gallery_name: str, gallery_image_name: str, - properties: Union[_models.GalleryImageUpdate, JSON, IO[bytes]], + gallery_image: Union[_models.GalleryImageUpdate, JSON, IO[bytes]], **kwargs: Any ) -> LROPoller[None]: """Update a gallery image definition. @@ -41789,9 +41220,9 @@ def begin_update( :type gallery_name: str :param gallery_image_name: The name of the gallery image definition to be retrieved. Required. :type gallery_image_name: str - :param properties: Parameters supplied to the update gallery image operation. Is one of the + :param gallery_image: Parameters supplied to the update gallery image operation. Is one of the following types: GalleryImageUpdate, JSON, IO[bytes] Required. - :type properties: ~azure.mgmt.compute.models.GalleryImageUpdate or JSON or IO[bytes] + :type gallery_image: ~azure.mgmt.compute.models.GalleryImageUpdate or JSON or IO[bytes] :return: An instance of LROPoller that returns None :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -41809,7 +41240,7 @@ def begin_update( resource_group_name=resource_group_name, gallery_name=gallery_name, gallery_image_name=gallery_image_name, - properties=properties, + gallery_image=gallery_image, content_type=content_type, cls=lambda x, y, z: x, headers=_headers, @@ -42167,7 +41598,7 @@ def _create_or_update_initial( gallery_name: str, gallery_image_name: str, gallery_image_version_name: str, - resource: Union[_models.GalleryImageVersion, JSON, IO[bytes]], + gallery_image_version: Union[_models.GalleryImageVersion, JSON, IO[bytes]], **kwargs: Any ) -> Iterator[bytes]: error_map: MutableMapping = { @@ -42186,10 +41617,10 @@ def _create_or_update_initial( content_type = content_type or "application/json" _content = None - if isinstance(resource, (IOBase, bytes)): - _content = resource + if isinstance(gallery_image_version, (IOBase, bytes)): + _content = gallery_image_version else: - _content = json.dumps(resource, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(gallery_image_version, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore _request = build_gallery_image_versions_create_or_update_request( resource_group_name=resource_group_name, @@ -42247,7 +41678,7 @@ def begin_create_or_update( gallery_name: str, gallery_image_name: str, gallery_image_version_name: str, - resource: _models.GalleryImageVersion, + gallery_image_version: _models.GalleryImageVersion, *, content_type: str = "application/json", **kwargs: Any @@ -42264,9 +41695,9 @@ def begin_create_or_update( :param gallery_image_version_name: The name of the gallery image version to be retrieved. Required. :type gallery_image_version_name: str - :param resource: Parameters supplied to the create or update gallery image version operation. - Required. - :type resource: ~azure.mgmt.compute.models.GalleryImageVersion + :param gallery_image_version: Parameters supplied to the create or update gallery image version + operation. Required. + :type gallery_image_version: ~azure.mgmt.compute.models.GalleryImageVersion :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -42282,7 +41713,7 @@ def begin_create_or_update( gallery_name: str, gallery_image_name: str, gallery_image_version_name: str, - resource: JSON, + gallery_image_version: JSON, *, content_type: str = "application/json", **kwargs: Any @@ -42299,9 +41730,9 @@ def begin_create_or_update( :param gallery_image_version_name: The name of the gallery image version to be retrieved. Required. :type gallery_image_version_name: str - :param resource: Parameters supplied to the create or update gallery image version operation. - Required. - :type resource: JSON + :param gallery_image_version: Parameters supplied to the create or update gallery image version + operation. Required. + :type gallery_image_version: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -42317,7 +41748,7 @@ def begin_create_or_update( gallery_name: str, gallery_image_name: str, gallery_image_version_name: str, - resource: IO[bytes], + gallery_image_version: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -42334,9 +41765,9 @@ def begin_create_or_update( :param gallery_image_version_name: The name of the gallery image version to be retrieved. Required. :type gallery_image_version_name: str - :param resource: Parameters supplied to the create or update gallery image version operation. - Required. - :type resource: IO[bytes] + :param gallery_image_version: Parameters supplied to the create or update gallery image version + operation. Required. + :type gallery_image_version: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str @@ -42352,7 +41783,7 @@ def begin_create_or_update( gallery_name: str, gallery_image_name: str, gallery_image_version_name: str, - resource: Union[_models.GalleryImageVersion, JSON, IO[bytes]], + gallery_image_version: Union[_models.GalleryImageVersion, JSON, IO[bytes]], **kwargs: Any ) -> LROPoller[None]: """Create or update a gallery image version. @@ -42367,9 +41798,10 @@ def begin_create_or_update( :param gallery_image_version_name: The name of the gallery image version to be retrieved. Required. :type gallery_image_version_name: str - :param resource: Parameters supplied to the create or update gallery image version operation. - Is one of the following types: GalleryImageVersion, JSON, IO[bytes] Required. - :type resource: ~azure.mgmt.compute.models.GalleryImageVersion or JSON or IO[bytes] + :param gallery_image_version: Parameters supplied to the create or update gallery image version + operation. Is one of the following types: GalleryImageVersion, JSON, IO[bytes] Required. + :type gallery_image_version: ~azure.mgmt.compute.models.GalleryImageVersion or JSON or + IO[bytes] :return: An instance of LROPoller that returns None :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -42388,7 +41820,7 @@ def begin_create_or_update( gallery_name=gallery_name, gallery_image_name=gallery_image_name, gallery_image_version_name=gallery_image_version_name, - resource=resource, + gallery_image_version=gallery_image_version, content_type=content_type, cls=lambda x, y, z: x, headers=_headers, @@ -42429,7 +41861,7 @@ def _update_initial( gallery_name: str, gallery_image_name: str, gallery_image_version_name: str, - properties: Union[_models.GalleryImageVersionUpdate, JSON, IO[bytes]], + gallery_image_version: Union[_models.GalleryImageVersionUpdate, JSON, IO[bytes]], **kwargs: Any ) -> Iterator[bytes]: error_map: MutableMapping = { @@ -42448,10 +41880,10 @@ def _update_initial( content_type = content_type or "application/json" _content = None - if isinstance(properties, (IOBase, bytes)): - _content = properties + if isinstance(gallery_image_version, (IOBase, bytes)): + _content = gallery_image_version else: - _content = json.dumps(properties, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(gallery_image_version, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore _request = build_gallery_image_versions_update_request( resource_group_name=resource_group_name, @@ -42504,7 +41936,7 @@ def begin_update( gallery_name: str, gallery_image_name: str, gallery_image_version_name: str, - properties: _models.GalleryImageVersionUpdate, + gallery_image_version: _models.GalleryImageVersionUpdate, *, content_type: str = "application/json", **kwargs: Any @@ -42521,8 +41953,9 @@ def begin_update( :param gallery_image_version_name: The name of the gallery image version to be retrieved. Required. :type gallery_image_version_name: str - :param properties: Parameters supplied to the update gallery image version operation. Required. - :type properties: ~azure.mgmt.compute.models.GalleryImageVersionUpdate + :param gallery_image_version: Parameters supplied to the update gallery image version + operation. Required. + :type gallery_image_version: ~azure.mgmt.compute.models.GalleryImageVersionUpdate :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -42538,7 +41971,7 @@ def begin_update( gallery_name: str, gallery_image_name: str, gallery_image_version_name: str, - properties: JSON, + gallery_image_version: JSON, *, content_type: str = "application/json", **kwargs: Any @@ -42555,8 +41988,9 @@ def begin_update( :param gallery_image_version_name: The name of the gallery image version to be retrieved. Required. :type gallery_image_version_name: str - :param properties: Parameters supplied to the update gallery image version operation. Required. - :type properties: JSON + :param gallery_image_version: Parameters supplied to the update gallery image version + operation. Required. + :type gallery_image_version: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -42572,7 +42006,7 @@ def begin_update( gallery_name: str, gallery_image_name: str, gallery_image_version_name: str, - properties: IO[bytes], + gallery_image_version: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -42589,8 +42023,9 @@ def begin_update( :param gallery_image_version_name: The name of the gallery image version to be retrieved. Required. :type gallery_image_version_name: str - :param properties: Parameters supplied to the update gallery image version operation. Required. - :type properties: IO[bytes] + :param gallery_image_version: Parameters supplied to the update gallery image version + operation. Required. + :type gallery_image_version: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str @@ -42606,7 +42041,7 @@ def begin_update( gallery_name: str, gallery_image_name: str, gallery_image_version_name: str, - properties: Union[_models.GalleryImageVersionUpdate, JSON, IO[bytes]], + gallery_image_version: Union[_models.GalleryImageVersionUpdate, JSON, IO[bytes]], **kwargs: Any ) -> LROPoller[None]: """Update a gallery image version. @@ -42621,9 +42056,10 @@ def begin_update( :param gallery_image_version_name: The name of the gallery image version to be retrieved. Required. :type gallery_image_version_name: str - :param properties: Parameters supplied to the update gallery image version operation. Is one of - the following types: GalleryImageVersionUpdate, JSON, IO[bytes] Required. - :type properties: ~azure.mgmt.compute.models.GalleryImageVersionUpdate or JSON or IO[bytes] + :param gallery_image_version: Parameters supplied to the update gallery image version + operation. Is one of the following types: GalleryImageVersionUpdate, JSON, IO[bytes] Required. + :type gallery_image_version: ~azure.mgmt.compute.models.GalleryImageVersionUpdate or JSON or + IO[bytes] :return: An instance of LROPoller that returns None :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -42642,7 +42078,7 @@ def begin_update( gallery_name=gallery_name, gallery_image_name=gallery_image_name, gallery_image_version_name=gallery_image_version_name, - properties=properties, + gallery_image_version=gallery_image_version, content_type=content_type, cls=lambda x, y, z: x, headers=_headers, @@ -43003,7 +42439,7 @@ def _create_or_update_initial( resource_group_name: str, gallery_name: str, gallery_application_name: str, - resource: Union[_models.GalleryApplication, JSON, IO[bytes]], + gallery_application: Union[_models.GalleryApplication, JSON, IO[bytes]], **kwargs: Any ) -> Iterator[bytes]: error_map: MutableMapping = { @@ -43022,10 +42458,10 @@ def _create_or_update_initial( content_type = content_type or "application/json" _content = None - if isinstance(resource, (IOBase, bytes)): - _content = resource + if isinstance(gallery_application, (IOBase, bytes)): + _content = gallery_application else: - _content = json.dumps(resource, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(gallery_application, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore _request = build_gallery_applications_create_or_update_request( resource_group_name=resource_group_name, @@ -43081,7 +42517,7 @@ def begin_create_or_update( resource_group_name: str, gallery_name: str, gallery_application_name: str, - resource: _models.GalleryApplication, + gallery_application: _models.GalleryApplication, *, content_type: str = "application/json", **kwargs: Any @@ -43096,9 +42532,9 @@ def begin_create_or_update( :param gallery_application_name: The name of the gallery Application Definition to be retrieved. Required. :type gallery_application_name: str - :param resource: Parameters supplied to the create or update gallery Application operation. - Required. - :type resource: ~azure.mgmt.compute.models.GalleryApplication + :param gallery_application: Parameters supplied to the create or update gallery Application + operation. Required. + :type gallery_application: ~azure.mgmt.compute.models.GalleryApplication :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -43113,7 +42549,7 @@ def begin_create_or_update( resource_group_name: str, gallery_name: str, gallery_application_name: str, - resource: JSON, + gallery_application: JSON, *, content_type: str = "application/json", **kwargs: Any @@ -43128,9 +42564,9 @@ def begin_create_or_update( :param gallery_application_name: The name of the gallery Application Definition to be retrieved. Required. :type gallery_application_name: str - :param resource: Parameters supplied to the create or update gallery Application operation. - Required. - :type resource: JSON + :param gallery_application: Parameters supplied to the create or update gallery Application + operation. Required. + :type gallery_application: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -43145,7 +42581,7 @@ def begin_create_or_update( resource_group_name: str, gallery_name: str, gallery_application_name: str, - resource: IO[bytes], + gallery_application: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -43160,9 +42596,9 @@ def begin_create_or_update( :param gallery_application_name: The name of the gallery Application Definition to be retrieved. Required. :type gallery_application_name: str - :param resource: Parameters supplied to the create or update gallery Application operation. - Required. - :type resource: IO[bytes] + :param gallery_application: Parameters supplied to the create or update gallery Application + operation. Required. + :type gallery_application: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str @@ -43177,7 +42613,7 @@ def begin_create_or_update( resource_group_name: str, gallery_name: str, gallery_application_name: str, - resource: Union[_models.GalleryApplication, JSON, IO[bytes]], + gallery_application: Union[_models.GalleryApplication, JSON, IO[bytes]], **kwargs: Any ) -> LROPoller[None]: """Create or update a gallery Application Definition. @@ -43190,9 +42626,9 @@ def begin_create_or_update( :param gallery_application_name: The name of the gallery Application Definition to be retrieved. Required. :type gallery_application_name: str - :param resource: Parameters supplied to the create or update gallery Application operation. Is - one of the following types: GalleryApplication, JSON, IO[bytes] Required. - :type resource: ~azure.mgmt.compute.models.GalleryApplication or JSON or IO[bytes] + :param gallery_application: Parameters supplied to the create or update gallery Application + operation. Is one of the following types: GalleryApplication, JSON, IO[bytes] Required. + :type gallery_application: ~azure.mgmt.compute.models.GalleryApplication or JSON or IO[bytes] :return: An instance of LROPoller that returns None :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -43210,7 +42646,7 @@ def begin_create_or_update( resource_group_name=resource_group_name, gallery_name=gallery_name, gallery_application_name=gallery_application_name, - resource=resource, + gallery_application=gallery_application, content_type=content_type, cls=lambda x, y, z: x, headers=_headers, @@ -43250,7 +42686,7 @@ def _update_initial( resource_group_name: str, gallery_name: str, gallery_application_name: str, - properties: Union[_models.GalleryApplicationUpdate, JSON, IO[bytes]], + gallery_application: Union[_models.GalleryApplicationUpdate, JSON, IO[bytes]], **kwargs: Any ) -> Iterator[bytes]: error_map: MutableMapping = { @@ -43269,10 +42705,10 @@ def _update_initial( content_type = content_type or "application/json" _content = None - if isinstance(properties, (IOBase, bytes)): - _content = properties + if isinstance(gallery_application, (IOBase, bytes)): + _content = gallery_application else: - _content = json.dumps(properties, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(gallery_application, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore _request = build_gallery_applications_update_request( resource_group_name=resource_group_name, @@ -43323,7 +42759,7 @@ def begin_update( resource_group_name: str, gallery_name: str, gallery_application_name: str, - properties: _models.GalleryApplicationUpdate, + gallery_application: _models.GalleryApplicationUpdate, *, content_type: str = "application/json", **kwargs: Any @@ -43338,8 +42774,9 @@ def begin_update( :param gallery_application_name: The name of the gallery Application Definition to be retrieved. Required. :type gallery_application_name: str - :param properties: Parameters supplied to the update gallery Application operation. Required. - :type properties: ~azure.mgmt.compute.models.GalleryApplicationUpdate + :param gallery_application: Parameters supplied to the update gallery Application operation. + Required. + :type gallery_application: ~azure.mgmt.compute.models.GalleryApplicationUpdate :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -43354,7 +42791,7 @@ def begin_update( resource_group_name: str, gallery_name: str, gallery_application_name: str, - properties: JSON, + gallery_application: JSON, *, content_type: str = "application/json", **kwargs: Any @@ -43369,8 +42806,9 @@ def begin_update( :param gallery_application_name: The name of the gallery Application Definition to be retrieved. Required. :type gallery_application_name: str - :param properties: Parameters supplied to the update gallery Application operation. Required. - :type properties: JSON + :param gallery_application: Parameters supplied to the update gallery Application operation. + Required. + :type gallery_application: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -43385,7 +42823,7 @@ def begin_update( resource_group_name: str, gallery_name: str, gallery_application_name: str, - properties: IO[bytes], + gallery_application: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -43400,8 +42838,9 @@ def begin_update( :param gallery_application_name: The name of the gallery Application Definition to be retrieved. Required. :type gallery_application_name: str - :param properties: Parameters supplied to the update gallery Application operation. Required. - :type properties: IO[bytes] + :param gallery_application: Parameters supplied to the update gallery Application operation. + Required. + :type gallery_application: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str @@ -43416,7 +42855,7 @@ def begin_update( resource_group_name: str, gallery_name: str, gallery_application_name: str, - properties: Union[_models.GalleryApplicationUpdate, JSON, IO[bytes]], + gallery_application: Union[_models.GalleryApplicationUpdate, JSON, IO[bytes]], **kwargs: Any ) -> LROPoller[None]: """Update a gallery Application Definition. @@ -43429,9 +42868,10 @@ def begin_update( :param gallery_application_name: The name of the gallery Application Definition to be retrieved. Required. :type gallery_application_name: str - :param properties: Parameters supplied to the update gallery Application operation. Is one of - the following types: GalleryApplicationUpdate, JSON, IO[bytes] Required. - :type properties: ~azure.mgmt.compute.models.GalleryApplicationUpdate or JSON or IO[bytes] + :param gallery_application: Parameters supplied to the update gallery Application operation. Is + one of the following types: GalleryApplicationUpdate, JSON, IO[bytes] Required. + :type gallery_application: ~azure.mgmt.compute.models.GalleryApplicationUpdate or JSON or + IO[bytes] :return: An instance of LROPoller that returns None :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -43449,7 +42889,7 @@ def begin_update( resource_group_name=resource_group_name, gallery_name=gallery_name, gallery_application_name=gallery_application_name, - properties=properties, + gallery_application=gallery_application, content_type=content_type, cls=lambda x, y, z: x, headers=_headers, @@ -43810,7 +43250,7 @@ def _create_or_update_initial( gallery_name: str, gallery_application_name: str, gallery_application_version_name: str, - resource: Union[_models.GalleryApplicationVersion, JSON, IO[bytes]], + gallery_application_version: Union[_models.GalleryApplicationVersion, JSON, IO[bytes]], **kwargs: Any ) -> Iterator[bytes]: error_map: MutableMapping = { @@ -43829,10 +43269,10 @@ def _create_or_update_initial( content_type = content_type or "application/json" _content = None - if isinstance(resource, (IOBase, bytes)): - _content = resource + if isinstance(gallery_application_version, (IOBase, bytes)): + _content = gallery_application_version else: - _content = json.dumps(resource, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(gallery_application_version, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore _request = build_gallery_application_versions_create_or_update_request( resource_group_name=resource_group_name, @@ -43890,7 +43330,7 @@ def begin_create_or_update( gallery_name: str, gallery_application_name: str, gallery_application_version_name: str, - resource: _models.GalleryApplicationVersion, + gallery_application_version: _models.GalleryApplicationVersion, *, content_type: str = "application/json", **kwargs: Any @@ -43908,9 +43348,9 @@ def begin_create_or_update( :param gallery_application_version_name: The name of the gallery Application Version to be retrieved. Required. :type gallery_application_version_name: str - :param resource: Parameters supplied to the create or update gallery Application Version - operation. Required. - :type resource: ~azure.mgmt.compute.models.GalleryApplicationVersion + :param gallery_application_version: Parameters supplied to the create or update gallery + Application Version operation. Required. + :type gallery_application_version: ~azure.mgmt.compute.models.GalleryApplicationVersion :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -43927,7 +43367,7 @@ def begin_create_or_update( gallery_name: str, gallery_application_name: str, gallery_application_version_name: str, - resource: JSON, + gallery_application_version: JSON, *, content_type: str = "application/json", **kwargs: Any @@ -43945,9 +43385,9 @@ def begin_create_or_update( :param gallery_application_version_name: The name of the gallery Application Version to be retrieved. Required. :type gallery_application_version_name: str - :param resource: Parameters supplied to the create or update gallery Application Version - operation. Required. - :type resource: JSON + :param gallery_application_version: Parameters supplied to the create or update gallery + Application Version operation. Required. + :type gallery_application_version: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -43964,7 +43404,7 @@ def begin_create_or_update( gallery_name: str, gallery_application_name: str, gallery_application_version_name: str, - resource: IO[bytes], + gallery_application_version: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -43982,9 +43422,9 @@ def begin_create_or_update( :param gallery_application_version_name: The name of the gallery Application Version to be retrieved. Required. :type gallery_application_version_name: str - :param resource: Parameters supplied to the create or update gallery Application Version - operation. Required. - :type resource: IO[bytes] + :param gallery_application_version: Parameters supplied to the create or update gallery + Application Version operation. Required. + :type gallery_application_version: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str @@ -44001,7 +43441,7 @@ def begin_create_or_update( gallery_name: str, gallery_application_name: str, gallery_application_version_name: str, - resource: Union[_models.GalleryApplicationVersion, JSON, IO[bytes]], + gallery_application_version: Union[_models.GalleryApplicationVersion, JSON, IO[bytes]], **kwargs: Any ) -> LROPoller[_models.GalleryApplicationVersion]: """Create or update a gallery Application Version. @@ -44017,9 +43457,11 @@ def begin_create_or_update( :param gallery_application_version_name: The name of the gallery Application Version to be retrieved. Required. :type gallery_application_version_name: str - :param resource: Parameters supplied to the create or update gallery Application Version - operation. Is one of the following types: GalleryApplicationVersion, JSON, IO[bytes] Required. - :type resource: ~azure.mgmt.compute.models.GalleryApplicationVersion or JSON or IO[bytes] + :param gallery_application_version: Parameters supplied to the create or update gallery + Application Version operation. Is one of the following types: GalleryApplicationVersion, JSON, + IO[bytes] Required. + :type gallery_application_version: ~azure.mgmt.compute.models.GalleryApplicationVersion or JSON + or IO[bytes] :return: An instance of LROPoller that returns GalleryApplicationVersion. The GalleryApplicationVersion is compatible with MutableMapping :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.GalleryApplicationVersion] @@ -44039,7 +43481,7 @@ def begin_create_or_update( gallery_name=gallery_name, gallery_application_name=gallery_application_name, gallery_application_version_name=gallery_application_version_name, - resource=resource, + gallery_application_version=gallery_application_version, content_type=content_type, cls=lambda x, y, z: x, headers=_headers, @@ -44085,7 +43527,7 @@ def _update_initial( gallery_name: str, gallery_application_name: str, gallery_application_version_name: str, - properties: Union[_models.GalleryApplicationVersionUpdate, JSON, IO[bytes]], + gallery_application_version: Union[_models.GalleryApplicationVersionUpdate, JSON, IO[bytes]], **kwargs: Any ) -> Iterator[bytes]: error_map: MutableMapping = { @@ -44104,10 +43546,10 @@ def _update_initial( content_type = content_type or "application/json" _content = None - if isinstance(properties, (IOBase, bytes)): - _content = properties + if isinstance(gallery_application_version, (IOBase, bytes)): + _content = gallery_application_version else: - _content = json.dumps(properties, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(gallery_application_version, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore _request = build_gallery_application_versions_update_request( resource_group_name=resource_group_name, @@ -44160,7 +43602,7 @@ def begin_update( gallery_name: str, gallery_application_name: str, gallery_application_version_name: str, - properties: _models.GalleryApplicationVersionUpdate, + gallery_application_version: _models.GalleryApplicationVersionUpdate, *, content_type: str = "application/json", **kwargs: Any @@ -44178,9 +43620,9 @@ def begin_update( :param gallery_application_version_name: The name of the gallery Application Version to be retrieved. Required. :type gallery_application_version_name: str - :param properties: Parameters supplied to the update gallery Application Version operation. - Required. - :type properties: ~azure.mgmt.compute.models.GalleryApplicationVersionUpdate + :param gallery_application_version: Parameters supplied to the update gallery Application + Version operation. Required. + :type gallery_application_version: ~azure.mgmt.compute.models.GalleryApplicationVersionUpdate :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -44196,7 +43638,7 @@ def begin_update( gallery_name: str, gallery_application_name: str, gallery_application_version_name: str, - properties: JSON, + gallery_application_version: JSON, *, content_type: str = "application/json", **kwargs: Any @@ -44214,9 +43656,9 @@ def begin_update( :param gallery_application_version_name: The name of the gallery Application Version to be retrieved. Required. :type gallery_application_version_name: str - :param properties: Parameters supplied to the update gallery Application Version operation. - Required. - :type properties: JSON + :param gallery_application_version: Parameters supplied to the update gallery Application + Version operation. Required. + :type gallery_application_version: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -44232,7 +43674,7 @@ def begin_update( gallery_name: str, gallery_application_name: str, gallery_application_version_name: str, - properties: IO[bytes], + gallery_application_version: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -44250,9 +43692,9 @@ def begin_update( :param gallery_application_version_name: The name of the gallery Application Version to be retrieved. Required. :type gallery_application_version_name: str - :param properties: Parameters supplied to the update gallery Application Version operation. - Required. - :type properties: IO[bytes] + :param gallery_application_version: Parameters supplied to the update gallery Application + Version operation. Required. + :type gallery_application_version: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str @@ -44268,7 +43710,7 @@ def begin_update( gallery_name: str, gallery_application_name: str, gallery_application_version_name: str, - properties: Union[_models.GalleryApplicationVersionUpdate, JSON, IO[bytes]], + gallery_application_version: Union[_models.GalleryApplicationVersionUpdate, JSON, IO[bytes]], **kwargs: Any ) -> LROPoller[None]: """Update a gallery Application Version. @@ -44284,10 +43726,11 @@ def begin_update( :param gallery_application_version_name: The name of the gallery Application Version to be retrieved. Required. :type gallery_application_version_name: str - :param properties: Parameters supplied to the update gallery Application Version operation. Is - one of the following types: GalleryApplicationVersionUpdate, JSON, IO[bytes] Required. - :type properties: ~azure.mgmt.compute.models.GalleryApplicationVersionUpdate or JSON or - IO[bytes] + :param gallery_application_version: Parameters supplied to the update gallery Application + Version operation. Is one of the following types: GalleryApplicationVersionUpdate, JSON, + IO[bytes] Required. + :type gallery_application_version: ~azure.mgmt.compute.models.GalleryApplicationVersionUpdate + or JSON or IO[bytes] :return: An instance of LROPoller that returns None :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -44306,7 +43749,7 @@ def begin_update( gallery_name=gallery_name, gallery_application_name=gallery_application_name, gallery_application_version_name=gallery_application_version_name, - properties=properties, + gallery_application_version=gallery_application_version, content_type=content_type, cls=lambda x, y, z: x, headers=_headers, @@ -44670,7 +44113,7 @@ def _create_or_update_initial( resource_group_name: str, gallery_name: str, in_vm_access_control_profile_name: str, - resource: Union[_models.GalleryInVMAccessControlProfile, JSON, IO[bytes]], + gallery_in_vm_access_control_profile: Union[_models.GalleryInVMAccessControlProfile, JSON, IO[bytes]], **kwargs: Any ) -> Iterator[bytes]: error_map: MutableMapping = { @@ -44689,10 +44132,10 @@ def _create_or_update_initial( content_type = content_type or "application/json" _content = None - if isinstance(resource, (IOBase, bytes)): - _content = resource + if isinstance(gallery_in_vm_access_control_profile, (IOBase, bytes)): + _content = gallery_in_vm_access_control_profile else: - _content = json.dumps(resource, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(gallery_in_vm_access_control_profile, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore _request = build_gallery_in_vm_access_control_profiles_create_or_update_request( resource_group_name=resource_group_name, @@ -44744,7 +44187,7 @@ def begin_create_or_update( resource_group_name: str, gallery_name: str, in_vm_access_control_profile_name: str, - resource: _models.GalleryInVMAccessControlProfile, + gallery_in_vm_access_control_profile: _models.GalleryInVMAccessControlProfile, *, content_type: str = "application/json", **kwargs: Any @@ -44759,9 +44202,10 @@ def begin_create_or_update( :param in_vm_access_control_profile_name: The name of the gallery inVMAccessControlProfile to be retrieved. Required. :type in_vm_access_control_profile_name: str - :param resource: Parameters supplied to the create or update gallery inVMAccessControlProfile - operation. Required. - :type resource: ~azure.mgmt.compute.models.GalleryInVMAccessControlProfile + :param gallery_in_vm_access_control_profile: Parameters supplied to the create or update + gallery inVMAccessControlProfile operation. Required. + :type gallery_in_vm_access_control_profile: + ~azure.mgmt.compute.models.GalleryInVMAccessControlProfile :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -44776,7 +44220,7 @@ def begin_create_or_update( resource_group_name: str, gallery_name: str, in_vm_access_control_profile_name: str, - resource: JSON, + gallery_in_vm_access_control_profile: JSON, *, content_type: str = "application/json", **kwargs: Any @@ -44791,9 +44235,9 @@ def begin_create_or_update( :param in_vm_access_control_profile_name: The name of the gallery inVMAccessControlProfile to be retrieved. Required. :type in_vm_access_control_profile_name: str - :param resource: Parameters supplied to the create or update gallery inVMAccessControlProfile - operation. Required. - :type resource: JSON + :param gallery_in_vm_access_control_profile: Parameters supplied to the create or update + gallery inVMAccessControlProfile operation. Required. + :type gallery_in_vm_access_control_profile: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -44808,7 +44252,7 @@ def begin_create_or_update( resource_group_name: str, gallery_name: str, in_vm_access_control_profile_name: str, - resource: IO[bytes], + gallery_in_vm_access_control_profile: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -44823,9 +44267,9 @@ def begin_create_or_update( :param in_vm_access_control_profile_name: The name of the gallery inVMAccessControlProfile to be retrieved. Required. :type in_vm_access_control_profile_name: str - :param resource: Parameters supplied to the create or update gallery inVMAccessControlProfile - operation. Required. - :type resource: IO[bytes] + :param gallery_in_vm_access_control_profile: Parameters supplied to the create or update + gallery inVMAccessControlProfile operation. Required. + :type gallery_in_vm_access_control_profile: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str @@ -44840,7 +44284,7 @@ def begin_create_or_update( resource_group_name: str, gallery_name: str, in_vm_access_control_profile_name: str, - resource: Union[_models.GalleryInVMAccessControlProfile, JSON, IO[bytes]], + gallery_in_vm_access_control_profile: Union[_models.GalleryInVMAccessControlProfile, JSON, IO[bytes]], **kwargs: Any ) -> LROPoller[None]: """Create or update a gallery inVMAccessControlProfile. @@ -44853,10 +44297,11 @@ def begin_create_or_update( :param in_vm_access_control_profile_name: The name of the gallery inVMAccessControlProfile to be retrieved. Required. :type in_vm_access_control_profile_name: str - :param resource: Parameters supplied to the create or update gallery inVMAccessControlProfile - operation. Is one of the following types: GalleryInVMAccessControlProfile, JSON, IO[bytes] - Required. - :type resource: ~azure.mgmt.compute.models.GalleryInVMAccessControlProfile or JSON or IO[bytes] + :param gallery_in_vm_access_control_profile: Parameters supplied to the create or update + gallery inVMAccessControlProfile operation. Is one of the following types: + GalleryInVMAccessControlProfile, JSON, IO[bytes] Required. + :type gallery_in_vm_access_control_profile: + ~azure.mgmt.compute.models.GalleryInVMAccessControlProfile or JSON or IO[bytes] :return: An instance of LROPoller that returns None :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -44874,7 +44319,7 @@ def begin_create_or_update( resource_group_name=resource_group_name, gallery_name=gallery_name, in_vm_access_control_profile_name=in_vm_access_control_profile_name, - resource=resource, + gallery_in_vm_access_control_profile=gallery_in_vm_access_control_profile, content_type=content_type, cls=lambda x, y, z: x, headers=_headers, @@ -44914,7 +44359,7 @@ def _update_initial( resource_group_name: str, gallery_name: str, in_vm_access_control_profile_name: str, - properties: Union[_models.GalleryInVMAccessControlProfileUpdate, JSON, IO[bytes]], + gallery_in_vm_access_control_profile: Union[_models.GalleryInVMAccessControlProfileUpdate, JSON, IO[bytes]], **kwargs: Any ) -> Iterator[bytes]: error_map: MutableMapping = { @@ -44933,10 +44378,10 @@ def _update_initial( content_type = content_type or "application/json" _content = None - if isinstance(properties, (IOBase, bytes)): - _content = properties + if isinstance(gallery_in_vm_access_control_profile, (IOBase, bytes)): + _content = gallery_in_vm_access_control_profile else: - _content = json.dumps(properties, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(gallery_in_vm_access_control_profile, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore _request = build_gallery_in_vm_access_control_profiles_update_request( resource_group_name=resource_group_name, @@ -44987,7 +44432,7 @@ def begin_update( resource_group_name: str, gallery_name: str, in_vm_access_control_profile_name: str, - properties: _models.GalleryInVMAccessControlProfileUpdate, + gallery_in_vm_access_control_profile: _models.GalleryInVMAccessControlProfileUpdate, *, content_type: str = "application/json", **kwargs: Any @@ -45002,9 +44447,10 @@ def begin_update( :param in_vm_access_control_profile_name: The name of the gallery inVMAccessControlProfile to be retrieved. Required. :type in_vm_access_control_profile_name: str - :param properties: Parameters supplied to the update gallery inVMAccessControlProfile - operation. Required. - :type properties: ~azure.mgmt.compute.models.GalleryInVMAccessControlProfileUpdate + :param gallery_in_vm_access_control_profile: Parameters supplied to the update gallery + inVMAccessControlProfile operation. Required. + :type gallery_in_vm_access_control_profile: + ~azure.mgmt.compute.models.GalleryInVMAccessControlProfileUpdate :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -45019,7 +44465,7 @@ def begin_update( resource_group_name: str, gallery_name: str, in_vm_access_control_profile_name: str, - properties: JSON, + gallery_in_vm_access_control_profile: JSON, *, content_type: str = "application/json", **kwargs: Any @@ -45034,9 +44480,9 @@ def begin_update( :param in_vm_access_control_profile_name: The name of the gallery inVMAccessControlProfile to be retrieved. Required. :type in_vm_access_control_profile_name: str - :param properties: Parameters supplied to the update gallery inVMAccessControlProfile - operation. Required. - :type properties: JSON + :param gallery_in_vm_access_control_profile: Parameters supplied to the update gallery + inVMAccessControlProfile operation. Required. + :type gallery_in_vm_access_control_profile: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -45051,7 +44497,7 @@ def begin_update( resource_group_name: str, gallery_name: str, in_vm_access_control_profile_name: str, - properties: IO[bytes], + gallery_in_vm_access_control_profile: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -45066,9 +44512,9 @@ def begin_update( :param in_vm_access_control_profile_name: The name of the gallery inVMAccessControlProfile to be retrieved. Required. :type in_vm_access_control_profile_name: str - :param properties: Parameters supplied to the update gallery inVMAccessControlProfile - operation. Required. - :type properties: IO[bytes] + :param gallery_in_vm_access_control_profile: Parameters supplied to the update gallery + inVMAccessControlProfile operation. Required. + :type gallery_in_vm_access_control_profile: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str @@ -45083,7 +44529,7 @@ def begin_update( resource_group_name: str, gallery_name: str, in_vm_access_control_profile_name: str, - properties: Union[_models.GalleryInVMAccessControlProfileUpdate, JSON, IO[bytes]], + gallery_in_vm_access_control_profile: Union[_models.GalleryInVMAccessControlProfileUpdate, JSON, IO[bytes]], **kwargs: Any ) -> LROPoller[None]: """Update a gallery inVMAccessControlProfile. @@ -45096,11 +44542,11 @@ def begin_update( :param in_vm_access_control_profile_name: The name of the gallery inVMAccessControlProfile to be retrieved. Required. :type in_vm_access_control_profile_name: str - :param properties: Parameters supplied to the update gallery inVMAccessControlProfile - operation. Is one of the following types: GalleryInVMAccessControlProfileUpdate, JSON, - IO[bytes] Required. - :type properties: ~azure.mgmt.compute.models.GalleryInVMAccessControlProfileUpdate or JSON or - IO[bytes] + :param gallery_in_vm_access_control_profile: Parameters supplied to the update gallery + inVMAccessControlProfile operation. Is one of the following types: + GalleryInVMAccessControlProfileUpdate, JSON, IO[bytes] Required. + :type gallery_in_vm_access_control_profile: + ~azure.mgmt.compute.models.GalleryInVMAccessControlProfileUpdate or JSON or IO[bytes] :return: An instance of LROPoller that returns None :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -45118,7 +44564,7 @@ def begin_update( resource_group_name=resource_group_name, gallery_name=gallery_name, in_vm_access_control_profile_name=in_vm_access_control_profile_name, - properties=properties, + gallery_in_vm_access_control_profile=gallery_in_vm_access_control_profile, content_type=content_type, cls=lambda x, y, z: x, headers=_headers, @@ -45476,7 +44922,9 @@ def _create_or_update_initial( gallery_name: str, in_vm_access_control_profile_name: str, in_vm_access_control_profile_version_name: str, - resource: Union[_models.GalleryInVMAccessControlProfileVersion, JSON, IO[bytes]], + gallery_in_vm_access_control_profile_version: Union[ + _models.GalleryInVMAccessControlProfileVersion, JSON, IO[bytes] + ], **kwargs: Any ) -> Iterator[bytes]: error_map: MutableMapping = { @@ -45495,10 +44943,10 @@ def _create_or_update_initial( content_type = content_type or "application/json" _content = None - if isinstance(resource, (IOBase, bytes)): - _content = resource + if isinstance(gallery_in_vm_access_control_profile_version, (IOBase, bytes)): + _content = gallery_in_vm_access_control_profile_version else: - _content = json.dumps(resource, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(gallery_in_vm_access_control_profile_version, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore _request = build_gallery_in_vm_access_control_profile_versions_create_or_update_request( resource_group_name=resource_group_name, @@ -45552,7 +45000,7 @@ def begin_create_or_update( gallery_name: str, in_vm_access_control_profile_name: str, in_vm_access_control_profile_version_name: str, - resource: _models.GalleryInVMAccessControlProfileVersion, + gallery_in_vm_access_control_profile_version: _models.GalleryInVMAccessControlProfileVersion, *, content_type: str = "application/json", **kwargs: Any @@ -45570,9 +45018,10 @@ def begin_create_or_update( :param in_vm_access_control_profile_version_name: The name of the gallery inVMAccessControlProfile version to be retrieved. Required. :type in_vm_access_control_profile_version_name: str - :param resource: Parameters supplied to the create or update gallery inVMAccessControlProfile - version operation. Required. - :type resource: ~azure.mgmt.compute.models.GalleryInVMAccessControlProfileVersion + :param gallery_in_vm_access_control_profile_version: Parameters supplied to the create or + update gallery inVMAccessControlProfile version operation. Required. + :type gallery_in_vm_access_control_profile_version: + ~azure.mgmt.compute.models.GalleryInVMAccessControlProfileVersion :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -45588,7 +45037,7 @@ def begin_create_or_update( gallery_name: str, in_vm_access_control_profile_name: str, in_vm_access_control_profile_version_name: str, - resource: JSON, + gallery_in_vm_access_control_profile_version: JSON, *, content_type: str = "application/json", **kwargs: Any @@ -45606,9 +45055,9 @@ def begin_create_or_update( :param in_vm_access_control_profile_version_name: The name of the gallery inVMAccessControlProfile version to be retrieved. Required. :type in_vm_access_control_profile_version_name: str - :param resource: Parameters supplied to the create or update gallery inVMAccessControlProfile - version operation. Required. - :type resource: JSON + :param gallery_in_vm_access_control_profile_version: Parameters supplied to the create or + update gallery inVMAccessControlProfile version operation. Required. + :type gallery_in_vm_access_control_profile_version: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -45624,7 +45073,7 @@ def begin_create_or_update( gallery_name: str, in_vm_access_control_profile_name: str, in_vm_access_control_profile_version_name: str, - resource: IO[bytes], + gallery_in_vm_access_control_profile_version: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -45642,9 +45091,9 @@ def begin_create_or_update( :param in_vm_access_control_profile_version_name: The name of the gallery inVMAccessControlProfile version to be retrieved. Required. :type in_vm_access_control_profile_version_name: str - :param resource: Parameters supplied to the create or update gallery inVMAccessControlProfile - version operation. Required. - :type resource: IO[bytes] + :param gallery_in_vm_access_control_profile_version: Parameters supplied to the create or + update gallery inVMAccessControlProfile version operation. Required. + :type gallery_in_vm_access_control_profile_version: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str @@ -45660,7 +45109,9 @@ def begin_create_or_update( gallery_name: str, in_vm_access_control_profile_name: str, in_vm_access_control_profile_version_name: str, - resource: Union[_models.GalleryInVMAccessControlProfileVersion, JSON, IO[bytes]], + gallery_in_vm_access_control_profile_version: Union[ + _models.GalleryInVMAccessControlProfileVersion, JSON, IO[bytes] + ], **kwargs: Any ) -> LROPoller[None]: """Create or update a gallery inVMAccessControlProfile version. @@ -45676,11 +45127,11 @@ def begin_create_or_update( :param in_vm_access_control_profile_version_name: The name of the gallery inVMAccessControlProfile version to be retrieved. Required. :type in_vm_access_control_profile_version_name: str - :param resource: Parameters supplied to the create or update gallery inVMAccessControlProfile - version operation. Is one of the following types: GalleryInVMAccessControlProfileVersion, JSON, - IO[bytes] Required. - :type resource: ~azure.mgmt.compute.models.GalleryInVMAccessControlProfileVersion or JSON or - IO[bytes] + :param gallery_in_vm_access_control_profile_version: Parameters supplied to the create or + update gallery inVMAccessControlProfile version operation. Is one of the following types: + GalleryInVMAccessControlProfileVersion, JSON, IO[bytes] Required. + :type gallery_in_vm_access_control_profile_version: + ~azure.mgmt.compute.models.GalleryInVMAccessControlProfileVersion or JSON or IO[bytes] :return: An instance of LROPoller that returns None :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -45699,7 +45150,7 @@ def begin_create_or_update( gallery_name=gallery_name, in_vm_access_control_profile_name=in_vm_access_control_profile_name, in_vm_access_control_profile_version_name=in_vm_access_control_profile_version_name, - resource=resource, + gallery_in_vm_access_control_profile_version=gallery_in_vm_access_control_profile_version, content_type=content_type, cls=lambda x, y, z: x, headers=_headers, @@ -45740,7 +45191,9 @@ def _update_initial( gallery_name: str, in_vm_access_control_profile_name: str, in_vm_access_control_profile_version_name: str, - properties: Union[_models.GalleryInVMAccessControlProfileVersionUpdate, JSON, IO[bytes]], + gallery_in_vm_access_control_profile_version: Union[ + _models.GalleryInVMAccessControlProfileVersionUpdate, JSON, IO[bytes] + ], **kwargs: Any ) -> Iterator[bytes]: error_map: MutableMapping = { @@ -45759,10 +45212,10 @@ def _update_initial( content_type = content_type or "application/json" _content = None - if isinstance(properties, (IOBase, bytes)): - _content = properties + if isinstance(gallery_in_vm_access_control_profile_version, (IOBase, bytes)): + _content = gallery_in_vm_access_control_profile_version else: - _content = json.dumps(properties, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(gallery_in_vm_access_control_profile_version, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore _request = build_gallery_in_vm_access_control_profile_versions_update_request( resource_group_name=resource_group_name, @@ -45815,7 +45268,7 @@ def begin_update( gallery_name: str, in_vm_access_control_profile_name: str, in_vm_access_control_profile_version_name: str, - properties: _models.GalleryInVMAccessControlProfileVersionUpdate, + gallery_in_vm_access_control_profile_version: _models.GalleryInVMAccessControlProfileVersionUpdate, *, content_type: str = "application/json", **kwargs: Any @@ -45833,9 +45286,10 @@ def begin_update( :param in_vm_access_control_profile_version_name: The name of the gallery inVMAccessControlProfile version to be retrieved. Required. :type in_vm_access_control_profile_version_name: str - :param properties: Parameters supplied to the update gallery inVMAccessControlProfile version - operation. Required. - :type properties: ~azure.mgmt.compute.models.GalleryInVMAccessControlProfileVersionUpdate + :param gallery_in_vm_access_control_profile_version: Parameters supplied to the update gallery + inVMAccessControlProfile version operation. Required. + :type gallery_in_vm_access_control_profile_version: + ~azure.mgmt.compute.models.GalleryInVMAccessControlProfileVersionUpdate :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -45851,7 +45305,7 @@ def begin_update( gallery_name: str, in_vm_access_control_profile_name: str, in_vm_access_control_profile_version_name: str, - properties: JSON, + gallery_in_vm_access_control_profile_version: JSON, *, content_type: str = "application/json", **kwargs: Any @@ -45869,9 +45323,9 @@ def begin_update( :param in_vm_access_control_profile_version_name: The name of the gallery inVMAccessControlProfile version to be retrieved. Required. :type in_vm_access_control_profile_version_name: str - :param properties: Parameters supplied to the update gallery inVMAccessControlProfile version - operation. Required. - :type properties: JSON + :param gallery_in_vm_access_control_profile_version: Parameters supplied to the update gallery + inVMAccessControlProfile version operation. Required. + :type gallery_in_vm_access_control_profile_version: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -45887,7 +45341,7 @@ def begin_update( gallery_name: str, in_vm_access_control_profile_name: str, in_vm_access_control_profile_version_name: str, - properties: IO[bytes], + gallery_in_vm_access_control_profile_version: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -45905,9 +45359,9 @@ def begin_update( :param in_vm_access_control_profile_version_name: The name of the gallery inVMAccessControlProfile version to be retrieved. Required. :type in_vm_access_control_profile_version_name: str - :param properties: Parameters supplied to the update gallery inVMAccessControlProfile version - operation. Required. - :type properties: IO[bytes] + :param gallery_in_vm_access_control_profile_version: Parameters supplied to the update gallery + inVMAccessControlProfile version operation. Required. + :type gallery_in_vm_access_control_profile_version: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str @@ -45923,7 +45377,9 @@ def begin_update( gallery_name: str, in_vm_access_control_profile_name: str, in_vm_access_control_profile_version_name: str, - properties: Union[_models.GalleryInVMAccessControlProfileVersionUpdate, JSON, IO[bytes]], + gallery_in_vm_access_control_profile_version: Union[ + _models.GalleryInVMAccessControlProfileVersionUpdate, JSON, IO[bytes] + ], **kwargs: Any ) -> LROPoller[None]: """Update a gallery inVMAccessControlProfile version. @@ -45939,11 +45395,11 @@ def begin_update( :param in_vm_access_control_profile_version_name: The name of the gallery inVMAccessControlProfile version to be retrieved. Required. :type in_vm_access_control_profile_version_name: str - :param properties: Parameters supplied to the update gallery inVMAccessControlProfile version - operation. Is one of the following types: GalleryInVMAccessControlProfileVersionUpdate, JSON, - IO[bytes] Required. - :type properties: ~azure.mgmt.compute.models.GalleryInVMAccessControlProfileVersionUpdate or - JSON or IO[bytes] + :param gallery_in_vm_access_control_profile_version: Parameters supplied to the update gallery + inVMAccessControlProfile version operation. Is one of the following types: + GalleryInVMAccessControlProfileVersionUpdate, JSON, IO[bytes] Required. + :type gallery_in_vm_access_control_profile_version: + ~azure.mgmt.compute.models.GalleryInVMAccessControlProfileVersionUpdate or JSON or IO[bytes] :return: An instance of LROPoller that returns None :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -45962,7 +45418,7 @@ def begin_update( gallery_name=gallery_name, in_vm_access_control_profile_name=in_vm_access_control_profile_name, in_vm_access_control_profile_version_name=in_vm_access_control_profile_version_name, - properties=properties, + gallery_in_vm_access_control_profile_version=gallery_in_vm_access_control_profile_version, content_type=content_type, cls=lambda x, y, z: x, headers=_headers, @@ -47377,3 +46833,621 @@ def get_next(next_link=None): return pipeline_response return ItemPaged(get_next, extract_data) + + +class DiskRestorePointOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.compute.ComputeClient`'s + :attr:`disk_restore_point` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def get( + self, + resource_group_name: str, + restore_point_collection_name: str, + vm_restore_point_name: str, + disk_restore_point_name: str, + **kwargs: Any + ) -> _models.DiskRestorePoint: + """Get disk restorePoint resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param restore_point_collection_name: The name of the restore point collection that the disk + restore point belongs. Required. + :type restore_point_collection_name: str + :param vm_restore_point_name: The name of the vm restore point that the disk disk restore point + belongs. Required. + :type vm_restore_point_name: str + :param disk_restore_point_name: The name of the DiskRestorePoint. Required. + :type disk_restore_point_name: str + :return: DiskRestorePoint. The DiskRestorePoint is compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.DiskRestorePoint + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.DiskRestorePoint] = kwargs.pop("cls", None) + + _request = build_disk_restore_point_get_request( + resource_group_name=resource_group_name, + restore_point_collection_name=restore_point_collection_name, + vm_restore_point_name=vm_restore_point_name, + disk_restore_point_name=disk_restore_point_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.DiskRestorePoint, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list_by_restore_point( + self, resource_group_name: str, restore_point_collection_name: str, vm_restore_point_name: str, **kwargs: Any + ) -> ItemPaged["_models.DiskRestorePoint"]: + """Lists diskRestorePoints under a vmRestorePoint. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param restore_point_collection_name: The name of the restore point collection that the disk + restore point belongs. Required. + :type restore_point_collection_name: str + :param vm_restore_point_name: The name of the vm restore point that the disk disk restore point + belongs. Required. + :type vm_restore_point_name: str + :return: An iterator like instance of DiskRestorePoint + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.models.DiskRestorePoint] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.DiskRestorePoint]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_disk_restore_point_list_by_restore_point_request( + resource_group_name=resource_group_name, + restore_point_collection_name=restore_point_collection_name, + vm_restore_point_name=vm_restore_point_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.DiskRestorePoint], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + def _grant_access_initial( + self, + resource_group_name: str, + restore_point_collection_name: str, + vm_restore_point_name: str, + disk_restore_point_name: str, + grant_access_data: Union[_models.GrantAccessData, JSON, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(grant_access_data, (IOBase, bytes)): + _content = grant_access_data + else: + _content = json.dumps(grant_access_data, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_disk_restore_point_grant_access_request( + resource_group_name=resource_group_name, + restore_point_collection_name=restore_point_collection_name, + vm_restore_point_name=vm_restore_point_name, + disk_restore_point_name=disk_restore_point_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_grant_access( + self, + resource_group_name: str, + restore_point_collection_name: str, + vm_restore_point_name: str, + disk_restore_point_name: str, + grant_access_data: _models.GrantAccessData, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.AccessUri]: + """Grants access to a diskRestorePoint. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param restore_point_collection_name: The name of the restore point collection that the disk + restore point belongs. Required. + :type restore_point_collection_name: str + :param vm_restore_point_name: The name of the vm restore point that the disk disk restore point + belongs. Required. + :type vm_restore_point_name: str + :param disk_restore_point_name: The name of the DiskRestorePoint. Required. + :type disk_restore_point_name: str + :param grant_access_data: Access data object supplied in the body of the get disk access + operation. Required. + :type grant_access_data: ~azure.mgmt.compute.models.GrantAccessData + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns AccessUri. The AccessUri is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.AccessUri] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_grant_access( + self, + resource_group_name: str, + restore_point_collection_name: str, + vm_restore_point_name: str, + disk_restore_point_name: str, + grant_access_data: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.AccessUri]: + """Grants access to a diskRestorePoint. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param restore_point_collection_name: The name of the restore point collection that the disk + restore point belongs. Required. + :type restore_point_collection_name: str + :param vm_restore_point_name: The name of the vm restore point that the disk disk restore point + belongs. Required. + :type vm_restore_point_name: str + :param disk_restore_point_name: The name of the DiskRestorePoint. Required. + :type disk_restore_point_name: str + :param grant_access_data: Access data object supplied in the body of the get disk access + operation. Required. + :type grant_access_data: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns AccessUri. The AccessUri is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.AccessUri] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_grant_access( + self, + resource_group_name: str, + restore_point_collection_name: str, + vm_restore_point_name: str, + disk_restore_point_name: str, + grant_access_data: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.AccessUri]: + """Grants access to a diskRestorePoint. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param restore_point_collection_name: The name of the restore point collection that the disk + restore point belongs. Required. + :type restore_point_collection_name: str + :param vm_restore_point_name: The name of the vm restore point that the disk disk restore point + belongs. Required. + :type vm_restore_point_name: str + :param disk_restore_point_name: The name of the DiskRestorePoint. Required. + :type disk_restore_point_name: str + :param grant_access_data: Access data object supplied in the body of the get disk access + operation. Required. + :type grant_access_data: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns AccessUri. The AccessUri is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.AccessUri] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_grant_access( + self, + resource_group_name: str, + restore_point_collection_name: str, + vm_restore_point_name: str, + disk_restore_point_name: str, + grant_access_data: Union[_models.GrantAccessData, JSON, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.AccessUri]: + """Grants access to a diskRestorePoint. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param restore_point_collection_name: The name of the restore point collection that the disk + restore point belongs. Required. + :type restore_point_collection_name: str + :param vm_restore_point_name: The name of the vm restore point that the disk disk restore point + belongs. Required. + :type vm_restore_point_name: str + :param disk_restore_point_name: The name of the DiskRestorePoint. Required. + :type disk_restore_point_name: str + :param grant_access_data: Access data object supplied in the body of the get disk access + operation. Is one of the following types: GrantAccessData, JSON, IO[bytes] Required. + :type grant_access_data: ~azure.mgmt.compute.models.GrantAccessData or JSON or IO[bytes] + :return: An instance of LROPoller that returns AccessUri. The AccessUri is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.AccessUri] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AccessUri] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._grant_access_initial( + resource_group_name=resource_group_name, + restore_point_collection_name=restore_point_collection_name, + vm_restore_point_name=vm_restore_point_name, + disk_restore_point_name=disk_restore_point_name, + grant_access_data=grant_access_data, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = _deserialize(_models.AccessUri, response.json()) + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.AccessUri].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.AccessUri]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _revoke_access_initial( + self, + resource_group_name: str, + restore_point_collection_name: str, + vm_restore_point_name: str, + disk_restore_point_name: str, + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_disk_restore_point_revoke_access_request( + resource_group_name=resource_group_name, + restore_point_collection_name=restore_point_collection_name, + vm_restore_point_name=vm_restore_point_name, + disk_restore_point_name=disk_restore_point_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_revoke_access( + self, + resource_group_name: str, + restore_point_collection_name: str, + vm_restore_point_name: str, + disk_restore_point_name: str, + **kwargs: Any + ) -> LROPoller[_models.OkResponse]: + """Revokes access to a diskRestorePoint. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param restore_point_collection_name: The name of the restore point collection that the disk + restore point belongs. Required. + :type restore_point_collection_name: str + :param vm_restore_point_name: The name of the vm restore point that the disk disk restore point + belongs. Required. + :type vm_restore_point_name: str + :param disk_restore_point_name: The name of the DiskRestorePoint. Required. + :type disk_restore_point_name: str + :return: An instance of LROPoller that returns OkResponse. The OkResponse is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.OkResponse] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.OkResponse] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._revoke_access_initial( + resource_group_name=resource_group_name, + restore_point_collection_name=restore_point_collection_name, + vm_restore_point_name=vm_restore_point_name, + disk_restore_point_name=disk_restore_point_name, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = _deserialize(_models.OkResponse, response.json()) + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.OkResponse].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.OkResponse]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_availability_sets_operations.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_availability_sets_operations.py index 3f804efa0e68..1b0774684359 100644 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_availability_sets_operations.py +++ b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_availability_sets_operations.py @@ -35,7 +35,7 @@ def test_availability_sets_create_or_update(self, resource_group): response = self.client.availability_sets.create_or_update( resource_group_name=resource_group.name, availability_set_name="str", - resource={ + parameters={ "location": "str", "id": "str", "name": "str", @@ -92,7 +92,7 @@ def test_availability_sets_update(self, resource_group): response = self.client.availability_sets.update( resource_group_name=resource_group.name, availability_set_name="str", - properties={ + parameters={ "properties": { "platformFaultDomainCount": 0, "platformUpdateDomainCount": 0, @@ -177,7 +177,7 @@ def test_availability_sets_start_migration_to_virtual_machine_scale_set(self, re response = self.client.availability_sets.start_migration_to_virtual_machine_scale_set( resource_group_name=resource_group.name, availability_set_name="str", - body={"virtualMachineScaleSetFlexible": {"id": "str"}}, + parameters={"virtualMachineScaleSetFlexible": {"id": "str"}}, ) # please add some check logic here by yourself @@ -200,7 +200,7 @@ def test_availability_sets_validate_migration_to_virtual_machine_scale_set(self, response = self.client.availability_sets.validate_migration_to_virtual_machine_scale_set( resource_group_name=resource_group.name, availability_set_name="str", - body={"virtualMachineScaleSetFlexible": {"id": "str"}}, + parameters={"virtualMachineScaleSetFlexible": {"id": "str"}}, ) # please add some check logic here by yourself diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_availability_sets_operations_async.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_availability_sets_operations_async.py index 02396d05af70..1073b51512f5 100644 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_availability_sets_operations_async.py +++ b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_availability_sets_operations_async.py @@ -36,7 +36,7 @@ async def test_availability_sets_create_or_update(self, resource_group): response = await self.client.availability_sets.create_or_update( resource_group_name=resource_group.name, availability_set_name="str", - resource={ + parameters={ "location": "str", "id": "str", "name": "str", @@ -93,7 +93,7 @@ async def test_availability_sets_update(self, resource_group): response = await self.client.availability_sets.update( resource_group_name=resource_group.name, availability_set_name="str", - properties={ + parameters={ "properties": { "platformFaultDomainCount": 0, "platformUpdateDomainCount": 0, @@ -178,7 +178,7 @@ async def test_availability_sets_start_migration_to_virtual_machine_scale_set(se response = await self.client.availability_sets.start_migration_to_virtual_machine_scale_set( resource_group_name=resource_group.name, availability_set_name="str", - body={"virtualMachineScaleSetFlexible": {"id": "str"}}, + parameters={"virtualMachineScaleSetFlexible": {"id": "str"}}, ) # please add some check logic here by yourself @@ -201,7 +201,7 @@ async def test_availability_sets_validate_migration_to_virtual_machine_scale_set response = await self.client.availability_sets.validate_migration_to_virtual_machine_scale_set( resource_group_name=resource_group.name, availability_set_name="str", - body={"virtualMachineScaleSetFlexible": {"id": "str"}}, + parameters={"virtualMachineScaleSetFlexible": {"id": "str"}}, ) # please add some check logic here by yourself diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_capacity_reservation_groups_operations.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_capacity_reservation_groups_operations.py index d290397704aa..f063e842a75a 100644 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_capacity_reservation_groups_operations.py +++ b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_capacity_reservation_groups_operations.py @@ -35,7 +35,7 @@ def test_capacity_reservation_groups_create_or_update(self, resource_group): response = self.client.capacity_reservation_groups.create_or_update( resource_group_name=resource_group.name, capacity_reservation_group_name="str", - resource={ + parameters={ "location": "str", "id": "str", "name": "str", @@ -86,7 +86,7 @@ def test_capacity_reservation_groups_update(self, resource_group): response = self.client.capacity_reservation_groups.update( resource_group_name=resource_group.name, capacity_reservation_group_name="str", - properties={ + parameters={ "properties": { "capacityReservations": [{"id": "str"}], "instanceView": { diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_capacity_reservation_groups_operations_async.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_capacity_reservation_groups_operations_async.py index 5fd3fed74465..5031d50675b3 100644 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_capacity_reservation_groups_operations_async.py +++ b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_capacity_reservation_groups_operations_async.py @@ -36,7 +36,7 @@ async def test_capacity_reservation_groups_create_or_update(self, resource_group response = await self.client.capacity_reservation_groups.create_or_update( resource_group_name=resource_group.name, capacity_reservation_group_name="str", - resource={ + parameters={ "location": "str", "id": "str", "name": "str", @@ -87,7 +87,7 @@ async def test_capacity_reservation_groups_update(self, resource_group): response = await self.client.capacity_reservation_groups.update( resource_group_name=resource_group.name, capacity_reservation_group_name="str", - properties={ + parameters={ "properties": { "capacityReservations": [{"id": "str"}], "instanceView": { diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_capacity_reservations_operations.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_capacity_reservations_operations.py index 48b5dbb524b4..49cde46e5fbe 100644 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_capacity_reservations_operations.py +++ b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_capacity_reservations_operations.py @@ -37,7 +37,7 @@ def test_capacity_reservations_begin_create_or_update(self, resource_group): resource_group_name=resource_group.name, capacity_reservation_group_name="str", capacity_reservation_name="str", - resource={ + parameters={ "location": "str", "sku": {"capacity": 0, "name": "str", "tier": "str"}, "id": "str", @@ -87,7 +87,7 @@ def test_capacity_reservations_begin_update(self, resource_group): resource_group_name=resource_group.name, capacity_reservation_group_name="str", capacity_reservation_name="str", - properties={ + parameters={ "properties": { "instanceView": { "statuses": [ diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_capacity_reservations_operations_async.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_capacity_reservations_operations_async.py index 8698fca2281a..7b9d67743957 100644 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_capacity_reservations_operations_async.py +++ b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_capacity_reservations_operations_async.py @@ -39,7 +39,7 @@ async def test_capacity_reservations_begin_create_or_update(self, resource_group resource_group_name=resource_group.name, capacity_reservation_group_name="str", capacity_reservation_name="str", - resource={ + parameters={ "location": "str", "sku": {"capacity": 0, "name": "str", "tier": "str"}, "id": "str", @@ -91,7 +91,7 @@ async def test_capacity_reservations_begin_update(self, resource_group): resource_group_name=resource_group.name, capacity_reservation_group_name="str", capacity_reservation_name="str", - properties={ + parameters={ "properties": { "instanceView": { "statuses": [ diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_dedicated_host_groups_operations.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_dedicated_host_groups_operations.py index ea23f5683fc5..e7257c04616d 100644 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_dedicated_host_groups_operations.py +++ b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_dedicated_host_groups_operations.py @@ -35,7 +35,7 @@ def test_dedicated_host_groups_create_or_update(self, resource_group): response = self.client.dedicated_host_groups.create_or_update( resource_group_name=resource_group.name, host_group_name="str", - resource={ + parameters={ "location": "str", "id": "str", "name": "str", @@ -86,7 +86,7 @@ def test_dedicated_host_groups_update(self, resource_group): response = self.client.dedicated_host_groups.update( resource_group_name=resource_group.name, host_group_name="str", - properties={ + parameters={ "properties": { "platformFaultDomainCount": 0, "additionalCapabilities": {"ultraSSDEnabled": bool}, diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_dedicated_host_groups_operations_async.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_dedicated_host_groups_operations_async.py index 225c412e1f4e..ce8299409f0d 100644 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_dedicated_host_groups_operations_async.py +++ b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_dedicated_host_groups_operations_async.py @@ -36,7 +36,7 @@ async def test_dedicated_host_groups_create_or_update(self, resource_group): response = await self.client.dedicated_host_groups.create_or_update( resource_group_name=resource_group.name, host_group_name="str", - resource={ + parameters={ "location": "str", "id": "str", "name": "str", @@ -87,7 +87,7 @@ async def test_dedicated_host_groups_update(self, resource_group): response = await self.client.dedicated_host_groups.update( resource_group_name=resource_group.name, host_group_name="str", - properties={ + parameters={ "properties": { "platformFaultDomainCount": 0, "additionalCapabilities": {"ultraSSDEnabled": bool}, diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_dedicated_hosts_operations.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_dedicated_hosts_operations.py index 40e786b15592..aa890e1f7480 100644 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_dedicated_hosts_operations.py +++ b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_dedicated_hosts_operations.py @@ -37,7 +37,7 @@ def test_dedicated_hosts_begin_create_or_update(self, resource_group): resource_group_name=resource_group.name, host_group_name="str", host_name="str", - resource={ + parameters={ "location": "str", "sku": {"capacity": 0, "name": "str", "tier": "str"}, "id": "str", @@ -88,7 +88,7 @@ def test_dedicated_hosts_begin_update(self, resource_group): resource_group_name=resource_group.name, host_group_name="str", host_name="str", - properties={ + parameters={ "properties": { "autoReplaceOnFailure": bool, "hostId": "str", diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_dedicated_hosts_operations_async.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_dedicated_hosts_operations_async.py index daaae60d724f..f833698a1076 100644 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_dedicated_hosts_operations_async.py +++ b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_dedicated_hosts_operations_async.py @@ -39,7 +39,7 @@ async def test_dedicated_hosts_begin_create_or_update(self, resource_group): resource_group_name=resource_group.name, host_group_name="str", host_name="str", - resource={ + parameters={ "location": "str", "sku": {"capacity": 0, "name": "str", "tier": "str"}, "id": "str", @@ -92,7 +92,7 @@ async def test_dedicated_hosts_begin_update(self, resource_group): resource_group_name=resource_group.name, host_group_name="str", host_name="str", - properties={ + parameters={ "properties": { "autoReplaceOnFailure": bool, "hostId": "str", diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_disk_accesses_operations.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_disk_accesses_operations.py index af4e07b037e3..03a2237818ac 100644 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_disk_accesses_operations.py +++ b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_disk_accesses_operations.py @@ -35,7 +35,7 @@ def test_disk_accesses_begin_create_or_update(self, resource_group): response = self.client.disk_accesses.begin_create_or_update( resource_group_name=resource_group.name, disk_access_name="str", - resource={ + disk_access={ "location": "str", "extendedLocation": {"name": "str", "type": "str"}, "id": "str", @@ -90,7 +90,7 @@ def test_disk_accesses_begin_update(self, resource_group): response = self.client.disk_accesses.begin_update( resource_group_name=resource_group.name, disk_access_name="str", - properties={"tags": {"str": "str"}}, + disk_access={"tags": {"str": "str"}}, ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_disk_accesses_operations_async.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_disk_accesses_operations_async.py index 0e6e90a20314..9877f632d46b 100644 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_disk_accesses_operations_async.py +++ b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_disk_accesses_operations_async.py @@ -37,7 +37,7 @@ async def test_disk_accesses_begin_create_or_update(self, resource_group): await self.client.disk_accesses.begin_create_or_update( resource_group_name=resource_group.name, disk_access_name="str", - resource={ + disk_access={ "location": "str", "extendedLocation": {"name": "str", "type": "str"}, "id": "str", @@ -94,7 +94,7 @@ async def test_disk_accesses_begin_update(self, resource_group): await self.client.disk_accesses.begin_update( resource_group_name=resource_group.name, disk_access_name="str", - properties={"tags": {"str": "str"}}, + disk_access={"tags": {"str": "str"}}, ) ).result() # call '.result()' to poll until service return final result diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_disk_encryption_sets_operations.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_disk_encryption_sets_operations.py index 9f5b7438a27e..20be10d2c417 100644 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_disk_encryption_sets_operations.py +++ b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_disk_encryption_sets_operations.py @@ -35,7 +35,7 @@ def test_disk_encryption_sets_begin_create_or_update(self, resource_group): response = self.client.disk_encryption_sets.begin_create_or_update( resource_group_name=resource_group.name, disk_encryption_set_name="str", - resource={ + disk_encryption_set={ "location": "str", "id": "str", "identity": { @@ -83,7 +83,7 @@ def test_disk_encryption_sets_begin_update(self, resource_group): response = self.client.disk_encryption_sets.begin_update( resource_group_name=resource_group.name, disk_encryption_set_name="str", - properties={ + disk_encryption_set={ "identity": { "principalId": "str", "tenantId": "str", diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_disk_encryption_sets_operations_async.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_disk_encryption_sets_operations_async.py index c73dd9faadbb..80ccfd321603 100644 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_disk_encryption_sets_operations_async.py +++ b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_disk_encryption_sets_operations_async.py @@ -37,7 +37,7 @@ async def test_disk_encryption_sets_begin_create_or_update(self, resource_group) await self.client.disk_encryption_sets.begin_create_or_update( resource_group_name=resource_group.name, disk_encryption_set_name="str", - resource={ + disk_encryption_set={ "location": "str", "id": "str", "identity": { @@ -87,7 +87,7 @@ async def test_disk_encryption_sets_begin_update(self, resource_group): await self.client.disk_encryption_sets.begin_update( resource_group_name=resource_group.name, disk_encryption_set_name="str", - properties={ + disk_encryption_set={ "identity": { "principalId": "str", "tenantId": "str", diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_disk_restore_points_operations.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_disk_restore_point_operations.py similarity index 74% rename from sdk/compute/azure-mgmt-compute/generated_tests/test_compute_disk_restore_points_operations.py rename to sdk/compute/azure-mgmt-compute/generated_tests/test_compute_disk_restore_point_operations.py index 507c1afb2a1d..a9b721cfe604 100644 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_disk_restore_points_operations.py +++ b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_disk_restore_point_operations.py @@ -14,14 +14,14 @@ @pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestComputeDiskRestorePointsOperations(AzureMgmtRecordedTestCase): +class TestComputeDiskRestorePointOperations(AzureMgmtRecordedTestCase): def setup_method(self, method): self.client = self.create_mgmt_client(ComputeClient) @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_disk_restore_points_get(self, resource_group): - response = self.client.disk_restore_points.get( + def test_disk_restore_point_get(self, resource_group): + response = self.client.disk_restore_point.get( resource_group_name=resource_group.name, restore_point_collection_name="str", vm_restore_point_name="str", @@ -33,8 +33,8 @@ def test_disk_restore_points_get(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_disk_restore_points_list_by_restore_point(self, resource_group): - response = self.client.disk_restore_points.list_by_restore_point( + def test_disk_restore_point_list_by_restore_point(self, resource_group): + response = self.client.disk_restore_point.list_by_restore_point( resource_group_name=resource_group.name, restore_point_collection_name="str", vm_restore_point_name="str", @@ -45,13 +45,18 @@ def test_disk_restore_points_list_by_restore_point(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_disk_restore_points_begin_grant_access(self, resource_group): - response = self.client.disk_restore_points.begin_grant_access( + def test_disk_restore_point_begin_grant_access(self, resource_group): + response = self.client.disk_restore_point.begin_grant_access( resource_group_name=resource_group.name, restore_point_collection_name="str", vm_restore_point_name="str", disk_restore_point_name="str", - body={"access": "str", "durationInSeconds": 0, "fileFormat": "str", "getSecureVMGuestStateSAS": bool}, + grant_access_data={ + "access": "str", + "durationInSeconds": 0, + "fileFormat": "str", + "getSecureVMGuestStateSAS": bool, + }, ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -59,8 +64,8 @@ def test_disk_restore_points_begin_grant_access(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_disk_restore_points_begin_revoke_access(self, resource_group): - response = self.client.disk_restore_points.begin_revoke_access( + def test_disk_restore_point_begin_revoke_access(self, resource_group): + response = self.client.disk_restore_point.begin_revoke_access( resource_group_name=resource_group.name, restore_point_collection_name="str", vm_restore_point_name="str", diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_disk_restore_points_operations_async.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_disk_restore_point_operations_async.py similarity index 75% rename from sdk/compute/azure-mgmt-compute/generated_tests/test_compute_disk_restore_points_operations_async.py rename to sdk/compute/azure-mgmt-compute/generated_tests/test_compute_disk_restore_point_operations_async.py index 665880703605..7a3d8f98de03 100644 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_disk_restore_points_operations_async.py +++ b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_disk_restore_point_operations_async.py @@ -15,14 +15,14 @@ @pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestComputeDiskRestorePointsOperationsAsync(AzureMgmtRecordedTestCase): +class TestComputeDiskRestorePointOperationsAsync(AzureMgmtRecordedTestCase): def setup_method(self, method): self.client = self.create_mgmt_client(ComputeClient, is_async=True) @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_disk_restore_points_get(self, resource_group): - response = await self.client.disk_restore_points.get( + async def test_disk_restore_point_get(self, resource_group): + response = await self.client.disk_restore_point.get( resource_group_name=resource_group.name, restore_point_collection_name="str", vm_restore_point_name="str", @@ -34,8 +34,8 @@ async def test_disk_restore_points_get(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_disk_restore_points_list_by_restore_point(self, resource_group): - response = self.client.disk_restore_points.list_by_restore_point( + async def test_disk_restore_point_list_by_restore_point(self, resource_group): + response = self.client.disk_restore_point.list_by_restore_point( resource_group_name=resource_group.name, restore_point_collection_name="str", vm_restore_point_name="str", @@ -46,14 +46,19 @@ async def test_disk_restore_points_list_by_restore_point(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_disk_restore_points_begin_grant_access(self, resource_group): + async def test_disk_restore_point_begin_grant_access(self, resource_group): response = await ( - await self.client.disk_restore_points.begin_grant_access( + await self.client.disk_restore_point.begin_grant_access( resource_group_name=resource_group.name, restore_point_collection_name="str", vm_restore_point_name="str", disk_restore_point_name="str", - body={"access": "str", "durationInSeconds": 0, "fileFormat": "str", "getSecureVMGuestStateSAS": bool}, + grant_access_data={ + "access": "str", + "durationInSeconds": 0, + "fileFormat": "str", + "getSecureVMGuestStateSAS": bool, + }, ) ).result() # call '.result()' to poll until service return final result @@ -62,9 +67,9 @@ async def test_disk_restore_points_begin_grant_access(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_disk_restore_points_begin_revoke_access(self, resource_group): + async def test_disk_restore_point_begin_revoke_access(self, resource_group): response = await ( - await self.client.disk_restore_points.begin_revoke_access( + await self.client.disk_restore_point.begin_revoke_access( resource_group_name=resource_group.name, restore_point_collection_name="str", vm_restore_point_name="str", diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_disks_operations.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_disks_operations.py index d72931fb619a..10c1a2bc5f16 100644 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_disks_operations.py +++ b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_disks_operations.py @@ -35,7 +35,7 @@ def test_disks_begin_create_or_update(self, resource_group): response = self.client.disks.begin_create_or_update( resource_group_name=resource_group.name, disk_name="str", - resource={ + disk={ "location": "str", "extendedLocation": {"name": "str", "type": "str"}, "id": "str", @@ -141,7 +141,7 @@ def test_disks_begin_update(self, resource_group): response = self.client.disks.begin_update( resource_group_name=resource_group.name, disk_name="str", - properties={ + disk={ "properties": { "availabilityPolicy": {"actionOnDiskDelay": "str"}, "burstingEnabled": bool, @@ -222,7 +222,12 @@ def test_disks_begin_grant_access(self, resource_group): response = self.client.disks.begin_grant_access( resource_group_name=resource_group.name, disk_name="str", - body={"access": "str", "durationInSeconds": 0, "fileFormat": "str", "getSecureVMGuestStateSAS": bool}, + grant_access_data={ + "access": "str", + "durationInSeconds": 0, + "fileFormat": "str", + "getSecureVMGuestStateSAS": bool, + }, ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_disks_operations_async.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_disks_operations_async.py index 18659051a461..b5e8c35a5f33 100644 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_disks_operations_async.py +++ b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_disks_operations_async.py @@ -37,7 +37,7 @@ async def test_disks_begin_create_or_update(self, resource_group): await self.client.disks.begin_create_or_update( resource_group_name=resource_group.name, disk_name="str", - resource={ + disk={ "location": "str", "extendedLocation": {"name": "str", "type": "str"}, "id": "str", @@ -145,7 +145,7 @@ async def test_disks_begin_update(self, resource_group): await self.client.disks.begin_update( resource_group_name=resource_group.name, disk_name="str", - properties={ + disk={ "properties": { "availabilityPolicy": {"actionOnDiskDelay": "str"}, "burstingEnabled": bool, @@ -230,7 +230,12 @@ async def test_disks_begin_grant_access(self, resource_group): await self.client.disks.begin_grant_access( resource_group_name=resource_group.name, disk_name="str", - body={"access": "str", "durationInSeconds": 0, "fileFormat": "str", "getSecureVMGuestStateSAS": bool}, + grant_access_data={ + "access": "str", + "durationInSeconds": 0, + "fileFormat": "str", + "getSecureVMGuestStateSAS": bool, + }, ) ).result() # call '.result()' to poll until service return final result diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_galleries_operations.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_galleries_operations.py index 397af067dc36..47e32d8f9482 100644 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_galleries_operations.py +++ b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_galleries_operations.py @@ -35,7 +35,7 @@ def test_galleries_begin_create_or_update(self, resource_group): response = self.client.galleries.begin_create_or_update( resource_group_name=resource_group.name, gallery_name="str", - resource={ + gallery={ "location": "str", "id": "str", "identity": { @@ -89,7 +89,7 @@ def test_galleries_begin_update(self, resource_group): response = self.client.galleries.begin_update( resource_group_name=resource_group.name, gallery_name="str", - properties={ + gallery={ "id": "str", "identity": { "principalId": "str", @@ -176,7 +176,7 @@ def test_galleries_begin_gallery_sharing_profile_update(self, resource_group): response = self.client.galleries.begin_gallery_sharing_profile_update( resource_group_name=resource_group.name, gallery_name="str", - body={"operationType": "str", "groups": [{"ids": ["str"], "type": "str"}]}, + sharing_update={"operationType": "str", "groups": [{"ids": ["str"], "type": "str"}]}, ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_galleries_operations_async.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_galleries_operations_async.py index 672d77bf92a8..d2c3b8954e17 100644 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_galleries_operations_async.py +++ b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_galleries_operations_async.py @@ -37,7 +37,7 @@ async def test_galleries_begin_create_or_update(self, resource_group): await self.client.galleries.begin_create_or_update( resource_group_name=resource_group.name, gallery_name="str", - resource={ + gallery={ "location": "str", "id": "str", "identity": { @@ -93,7 +93,7 @@ async def test_galleries_begin_update(self, resource_group): await self.client.galleries.begin_update( resource_group_name=resource_group.name, gallery_name="str", - properties={ + gallery={ "id": "str", "identity": { "principalId": "str", @@ -184,7 +184,7 @@ async def test_galleries_begin_gallery_sharing_profile_update(self, resource_gro await self.client.galleries.begin_gallery_sharing_profile_update( resource_group_name=resource_group.name, gallery_name="str", - body={"operationType": "str", "groups": [{"ids": ["str"], "type": "str"}]}, + sharing_update={"operationType": "str", "groups": [{"ids": ["str"], "type": "str"}]}, ) ).result() # call '.result()' to poll until service return final result diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_gallery_application_versions_operations.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_gallery_application_versions_operations.py index a12438aaf394..dfa5d46174b2 100644 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_gallery_application_versions_operations.py +++ b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_gallery_application_versions_operations.py @@ -39,7 +39,7 @@ def test_gallery_application_versions_begin_create_or_update(self, resource_grou gallery_name="str", gallery_application_name="str", gallery_application_version_name="str", - resource={ + gallery_application_version={ "location": "str", "id": "str", "name": "str", @@ -145,7 +145,7 @@ def test_gallery_application_versions_begin_update(self, resource_group): gallery_name="str", gallery_application_name="str", gallery_application_version_name="str", - properties={ + gallery_application_version={ "id": "str", "name": "str", "properties": { diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_gallery_application_versions_operations_async.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_gallery_application_versions_operations_async.py index 6cacc6041fa9..56a2346d2d8c 100644 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_gallery_application_versions_operations_async.py +++ b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_gallery_application_versions_operations_async.py @@ -41,7 +41,7 @@ async def test_gallery_application_versions_begin_create_or_update(self, resourc gallery_name="str", gallery_application_name="str", gallery_application_version_name="str", - resource={ + gallery_application_version={ "location": "str", "id": "str", "name": "str", @@ -149,7 +149,7 @@ async def test_gallery_application_versions_begin_update(self, resource_group): gallery_name="str", gallery_application_name="str", gallery_application_version_name="str", - properties={ + gallery_application_version={ "id": "str", "name": "str", "properties": { diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_gallery_applications_operations.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_gallery_applications_operations.py index c4c9c9a482b5..b206912e8cfd 100644 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_gallery_applications_operations.py +++ b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_gallery_applications_operations.py @@ -37,7 +37,7 @@ def test_gallery_applications_begin_create_or_update(self, resource_group): resource_group_name=resource_group.name, gallery_name="str", gallery_application_name="str", - resource={ + gallery_application={ "location": "str", "id": "str", "name": "str", @@ -88,7 +88,7 @@ def test_gallery_applications_begin_update(self, resource_group): resource_group_name=resource_group.name, gallery_name="str", gallery_application_name="str", - properties={ + gallery_application={ "id": "str", "name": "str", "properties": { diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_gallery_applications_operations_async.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_gallery_applications_operations_async.py index 5ee58a607f24..9aed42aafda8 100644 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_gallery_applications_operations_async.py +++ b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_gallery_applications_operations_async.py @@ -39,7 +39,7 @@ async def test_gallery_applications_begin_create_or_update(self, resource_group) resource_group_name=resource_group.name, gallery_name="str", gallery_application_name="str", - resource={ + gallery_application={ "location": "str", "id": "str", "name": "str", @@ -92,7 +92,7 @@ async def test_gallery_applications_begin_update(self, resource_group): resource_group_name=resource_group.name, gallery_name="str", gallery_application_name="str", - properties={ + gallery_application={ "id": "str", "name": "str", "properties": { diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_gallery_image_versions_operations.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_gallery_image_versions_operations.py index b326a465f5ab..602cecd0ce77 100644 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_gallery_image_versions_operations.py +++ b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_gallery_image_versions_operations.py @@ -39,7 +39,7 @@ def test_gallery_image_versions_begin_create_or_update(self, resource_group): gallery_name="str", gallery_image_name="str", gallery_image_version_name="str", - resource={ + gallery_image_version={ "location": "str", "id": "str", "name": "str", @@ -160,7 +160,7 @@ def test_gallery_image_versions_begin_update(self, resource_group): gallery_name="str", gallery_image_name="str", gallery_image_version_name="str", - properties={ + gallery_image_version={ "id": "str", "name": "str", "properties": { diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_gallery_image_versions_operations_async.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_gallery_image_versions_operations_async.py index 4cbbee94d79a..1755f9d9a9fb 100644 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_gallery_image_versions_operations_async.py +++ b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_gallery_image_versions_operations_async.py @@ -41,7 +41,7 @@ async def test_gallery_image_versions_begin_create_or_update(self, resource_grou gallery_name="str", gallery_image_name="str", gallery_image_version_name="str", - resource={ + gallery_image_version={ "location": "str", "id": "str", "name": "str", @@ -169,7 +169,7 @@ async def test_gallery_image_versions_begin_update(self, resource_group): gallery_name="str", gallery_image_name="str", gallery_image_version_name="str", - properties={ + gallery_image_version={ "id": "str", "name": "str", "properties": { diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_gallery_images_operations.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_gallery_images_operations.py index 75015b05988a..ad370be86e60 100644 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_gallery_images_operations.py +++ b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_gallery_images_operations.py @@ -37,7 +37,7 @@ def test_gallery_images_begin_create_or_update(self, resource_group): resource_group_name=resource_group.name, gallery_name="str", gallery_image_name="str", - resource={ + gallery_image={ "location": "str", "id": "str", "name": "str", @@ -82,7 +82,7 @@ def test_gallery_images_begin_update(self, resource_group): resource_group_name=resource_group.name, gallery_name="str", gallery_image_name="str", - properties={ + gallery_image={ "id": "str", "name": "str", "properties": { diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_gallery_images_operations_async.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_gallery_images_operations_async.py index 90919ae7e3e4..1add68e7e628 100644 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_gallery_images_operations_async.py +++ b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_gallery_images_operations_async.py @@ -39,7 +39,7 @@ async def test_gallery_images_begin_create_or_update(self, resource_group): resource_group_name=resource_group.name, gallery_name="str", gallery_image_name="str", - resource={ + gallery_image={ "location": "str", "id": "str", "name": "str", @@ -86,7 +86,7 @@ async def test_gallery_images_begin_update(self, resource_group): resource_group_name=resource_group.name, gallery_name="str", gallery_image_name="str", - properties={ + gallery_image={ "id": "str", "name": "str", "properties": { diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_gallery_in_vm_access_control_profile_versions_operations.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_gallery_in_vm_access_control_profile_versions_operations.py index dc34a185dfb6..44917619573b 100644 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_gallery_in_vm_access_control_profile_versions_operations.py +++ b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_gallery_in_vm_access_control_profile_versions_operations.py @@ -39,7 +39,7 @@ def test_gallery_in_vm_access_control_profile_versions_begin_create_or_update(se gallery_name="str", in_vm_access_control_profile_name="str", in_vm_access_control_profile_version_name="str", - resource={ + gallery_in_vm_access_control_profile_version={ "location": "str", "id": "str", "name": "str", @@ -111,7 +111,7 @@ def test_gallery_in_vm_access_control_profile_versions_begin_update(self, resour gallery_name="str", in_vm_access_control_profile_name="str", in_vm_access_control_profile_version_name="str", - properties={ + gallery_in_vm_access_control_profile_version={ "id": "str", "name": "str", "properties": { diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_gallery_in_vm_access_control_profile_versions_operations_async.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_gallery_in_vm_access_control_profile_versions_operations_async.py index d262c41a37ea..4cb26190f640 100644 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_gallery_in_vm_access_control_profile_versions_operations_async.py +++ b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_gallery_in_vm_access_control_profile_versions_operations_async.py @@ -41,7 +41,7 @@ async def test_gallery_in_vm_access_control_profile_versions_begin_create_or_upd gallery_name="str", in_vm_access_control_profile_name="str", in_vm_access_control_profile_version_name="str", - resource={ + gallery_in_vm_access_control_profile_version={ "location": "str", "id": "str", "name": "str", @@ -115,7 +115,7 @@ async def test_gallery_in_vm_access_control_profile_versions_begin_update(self, gallery_name="str", in_vm_access_control_profile_name="str", in_vm_access_control_profile_version_name="str", - properties={ + gallery_in_vm_access_control_profile_version={ "id": "str", "name": "str", "properties": { diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_gallery_in_vm_access_control_profiles_operations.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_gallery_in_vm_access_control_profiles_operations.py index 298f4a94febc..b9fed8f7dec2 100644 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_gallery_in_vm_access_control_profiles_operations.py +++ b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_gallery_in_vm_access_control_profiles_operations.py @@ -37,7 +37,7 @@ def test_gallery_in_vm_access_control_profiles_begin_create_or_update(self, reso resource_group_name=resource_group.name, gallery_name="str", in_vm_access_control_profile_name="str", - resource={ + gallery_in_vm_access_control_profile={ "location": "str", "id": "str", "name": "str", @@ -70,7 +70,7 @@ def test_gallery_in_vm_access_control_profiles_begin_update(self, resource_group resource_group_name=resource_group.name, gallery_name="str", in_vm_access_control_profile_name="str", - properties={ + gallery_in_vm_access_control_profile={ "id": "str", "name": "str", "properties": { diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_gallery_in_vm_access_control_profiles_operations_async.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_gallery_in_vm_access_control_profiles_operations_async.py index 6a0050302124..a10b640965f4 100644 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_gallery_in_vm_access_control_profiles_operations_async.py +++ b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_gallery_in_vm_access_control_profiles_operations_async.py @@ -39,7 +39,7 @@ async def test_gallery_in_vm_access_control_profiles_begin_create_or_update(self resource_group_name=resource_group.name, gallery_name="str", in_vm_access_control_profile_name="str", - resource={ + gallery_in_vm_access_control_profile={ "location": "str", "id": "str", "name": "str", @@ -74,7 +74,7 @@ async def test_gallery_in_vm_access_control_profiles_begin_update(self, resource resource_group_name=resource_group.name, gallery_name="str", in_vm_access_control_profile_name="str", - properties={ + gallery_in_vm_access_control_profile={ "id": "str", "name": "str", "properties": { diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_images_operations.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_images_operations.py index c65629d2dc95..b188fea714a4 100644 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_images_operations.py +++ b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_images_operations.py @@ -35,7 +35,7 @@ def test_images_begin_create_or_update(self, resource_group): response = self.client.images.begin_create_or_update( resource_group_name=resource_group.name, image_name="str", - resource={ + parameters={ "location": "str", "extendedLocation": {"name": "str", "type": "str"}, "id": "str", @@ -93,7 +93,7 @@ def test_images_begin_update(self, resource_group): response = self.client.images.begin_update( resource_group_name=resource_group.name, image_name="str", - properties={ + parameters={ "properties": { "hyperVGeneration": "str", "provisioningState": "str", diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_images_operations_async.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_images_operations_async.py index d770d41df980..e4492161517b 100644 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_images_operations_async.py +++ b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_images_operations_async.py @@ -37,7 +37,7 @@ async def test_images_begin_create_or_update(self, resource_group): await self.client.images.begin_create_or_update( resource_group_name=resource_group.name, image_name="str", - resource={ + parameters={ "location": "str", "extendedLocation": {"name": "str", "type": "str"}, "id": "str", @@ -97,7 +97,7 @@ async def test_images_begin_update(self, resource_group): await self.client.images.begin_update( resource_group_name=resource_group.name, image_name="str", - properties={ + parameters={ "properties": { "hyperVGeneration": "str", "provisioningState": "str", diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_log_analytics_operation_group_operations.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_log_analytics_operation_group_operations.py index 7bd56e2f23be..3858422d3c5b 100644 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_log_analytics_operation_group_operations.py +++ b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_log_analytics_operation_group_operations.py @@ -23,7 +23,7 @@ def setup_method(self, method): def test_log_analytics_operation_group_begin_export_request_rate_by_interval(self, resource_group): response = self.client.log_analytics_operation_group.begin_export_request_rate_by_interval( location="str", - body={ + parameters={ "blobContainerSasUri": "str", "fromTime": "2020-02-20 00:00:00", "intervalLength": "str", @@ -44,7 +44,7 @@ def test_log_analytics_operation_group_begin_export_request_rate_by_interval(sel def test_log_analytics_operation_group_begin_export_throttled_requests(self, resource_group): response = self.client.log_analytics_operation_group.begin_export_throttled_requests( location="str", - body={ + parameters={ "blobContainerSasUri": "str", "fromTime": "2020-02-20 00:00:00", "toTime": "2020-02-20 00:00:00", diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_log_analytics_operation_group_operations_async.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_log_analytics_operation_group_operations_async.py index 578fee737f46..16b6307e078b 100644 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_log_analytics_operation_group_operations_async.py +++ b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_log_analytics_operation_group_operations_async.py @@ -25,7 +25,7 @@ async def test_log_analytics_operation_group_begin_export_request_rate_by_interv response = await ( await self.client.log_analytics_operation_group.begin_export_request_rate_by_interval( location="str", - body={ + parameters={ "blobContainerSasUri": "str", "fromTime": "2020-02-20 00:00:00", "intervalLength": "str", @@ -48,7 +48,7 @@ async def test_log_analytics_operation_group_begin_export_throttled_requests(sel response = await ( await self.client.log_analytics_operation_group.begin_export_throttled_requests( location="str", - body={ + parameters={ "blobContainerSasUri": "str", "fromTime": "2020-02-20 00:00:00", "toTime": "2020-02-20 00:00:00", diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_private_endpoint_connections_operations.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_private_endpoint_connections_operations.py index c8b6447825c2..b092ad4d3b3b 100644 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_private_endpoint_connections_operations.py +++ b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_private_endpoint_connections_operations.py @@ -37,7 +37,7 @@ def test_private_endpoint_connections_begin_update_a_private_endpoint_connection resource_group_name=resource_group.name, disk_access_name="str", private_endpoint_connection_name="str", - resource={ + private_endpoint_connection={ "id": "str", "name": "str", "properties": { diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_private_endpoint_connections_operations_async.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_private_endpoint_connections_operations_async.py index 4ef527b65ce8..9496bbe6f061 100644 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_private_endpoint_connections_operations_async.py +++ b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_private_endpoint_connections_operations_async.py @@ -39,7 +39,7 @@ async def test_private_endpoint_connections_begin_update_a_private_endpoint_conn resource_group_name=resource_group.name, disk_access_name="str", private_endpoint_connection_name="str", - resource={ + private_endpoint_connection={ "id": "str", "name": "str", "properties": { diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_proximity_placement_groups_operations.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_proximity_placement_groups_operations.py index e3c6ae06a589..3aa7ece3ee4c 100644 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_proximity_placement_groups_operations.py +++ b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_proximity_placement_groups_operations.py @@ -35,7 +35,7 @@ def test_proximity_placement_groups_create_or_update(self, resource_group): response = self.client.proximity_placement_groups.create_or_update( resource_group_name=resource_group.name, proximity_placement_group_name="str", - resource={ + parameters={ "location": "str", "id": "str", "name": "str", @@ -109,7 +109,7 @@ def test_proximity_placement_groups_update(self, resource_group): response = self.client.proximity_placement_groups.update( resource_group_name=resource_group.name, proximity_placement_group_name="str", - properties={"tags": {"str": "str"}}, + parameters={"tags": {"str": "str"}}, ) # please add some check logic here by yourself diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_proximity_placement_groups_operations_async.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_proximity_placement_groups_operations_async.py index eb80cff4c044..dd26579bf388 100644 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_proximity_placement_groups_operations_async.py +++ b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_proximity_placement_groups_operations_async.py @@ -36,7 +36,7 @@ async def test_proximity_placement_groups_create_or_update(self, resource_group) response = await self.client.proximity_placement_groups.create_or_update( resource_group_name=resource_group.name, proximity_placement_group_name="str", - resource={ + parameters={ "location": "str", "id": "str", "name": "str", @@ -110,7 +110,7 @@ async def test_proximity_placement_groups_update(self, resource_group): response = await self.client.proximity_placement_groups.update( resource_group_name=resource_group.name, proximity_placement_group_name="str", - properties={"tags": {"str": "str"}}, + parameters={"tags": {"str": "str"}}, ) # please add some check logic here by yourself diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_restore_point_collections_operations.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_restore_point_collections_operations.py index bea58cc661a6..96b0159ccdc8 100644 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_restore_point_collections_operations.py +++ b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_restore_point_collections_operations.py @@ -35,7 +35,7 @@ def test_restore_point_collections_create_or_update(self, resource_group): response = self.client.restore_point_collections.create_or_update( resource_group_name=resource_group.name, restore_point_collection_name="str", - resource={ + parameters={ "location": "str", "id": "str", "name": "str", @@ -246,7 +246,7 @@ def test_restore_point_collections_update(self, resource_group): response = self.client.restore_point_collections.update( resource_group_name=resource_group.name, restore_point_collection_name="str", - properties={ + parameters={ "properties": { "provisioningState": "str", "restorePointCollectionId": "str", diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_restore_point_collections_operations_async.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_restore_point_collections_operations_async.py index 2ceaf524771d..f1631dc4c732 100644 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_restore_point_collections_operations_async.py +++ b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_restore_point_collections_operations_async.py @@ -36,7 +36,7 @@ async def test_restore_point_collections_create_or_update(self, resource_group): response = await self.client.restore_point_collections.create_or_update( resource_group_name=resource_group.name, restore_point_collection_name="str", - resource={ + parameters={ "location": "str", "id": "str", "name": "str", @@ -247,7 +247,7 @@ async def test_restore_point_collections_update(self, resource_group): response = await self.client.restore_point_collections.update( resource_group_name=resource_group.name, restore_point_collection_name="str", - properties={ + parameters={ "properties": { "provisioningState": "str", "restorePointCollectionId": "str", diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_restore_points_operations.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_restore_points_operations.py index c5b69bb08630..6c2982973fbe 100644 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_restore_points_operations.py +++ b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_restore_points_operations.py @@ -37,7 +37,7 @@ def test_restore_points_begin_create(self, resource_group): resource_group_name=resource_group.name, restore_point_collection_name="str", restore_point_name="str", - resource={ + parameters={ "id": "str", "name": "str", "properties": { diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_restore_points_operations_async.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_restore_points_operations_async.py index 80b7cdcc7323..a634c6865f86 100644 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_restore_points_operations_async.py +++ b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_restore_points_operations_async.py @@ -39,7 +39,7 @@ async def test_restore_points_begin_create(self, resource_group): resource_group_name=resource_group.name, restore_point_collection_name="str", restore_point_name="str", - resource={ + parameters={ "id": "str", "name": "str", "properties": { diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_snapshots_operations.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_snapshots_operations.py index 01093212a8f9..2c0fb96e6aa8 100644 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_snapshots_operations.py +++ b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_snapshots_operations.py @@ -35,7 +35,7 @@ def test_snapshots_begin_create_or_update(self, resource_group): response = self.client.snapshots.begin_create_or_update( resource_group_name=resource_group.name, snapshot_name="str", - resource={ + snapshot={ "location": "str", "extendedLocation": {"name": "str", "type": "str"}, "id": "str", @@ -130,7 +130,7 @@ def test_snapshots_begin_update(self, resource_group): response = self.client.snapshots.begin_update( resource_group_name=resource_group.name, snapshot_name="str", - properties={ + snapshot={ "properties": { "dataAccessAuthMode": "str", "diskAccessId": "str", @@ -201,7 +201,12 @@ def test_snapshots_begin_grant_access(self, resource_group): response = self.client.snapshots.begin_grant_access( resource_group_name=resource_group.name, snapshot_name="str", - body={"access": "str", "durationInSeconds": 0, "fileFormat": "str", "getSecureVMGuestStateSAS": bool}, + grant_access_data={ + "access": "str", + "durationInSeconds": 0, + "fileFormat": "str", + "getSecureVMGuestStateSAS": bool, + }, ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_snapshots_operations_async.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_snapshots_operations_async.py index 55938680d583..8b54eefc5e66 100644 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_snapshots_operations_async.py +++ b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_snapshots_operations_async.py @@ -37,7 +37,7 @@ async def test_snapshots_begin_create_or_update(self, resource_group): await self.client.snapshots.begin_create_or_update( resource_group_name=resource_group.name, snapshot_name="str", - resource={ + snapshot={ "location": "str", "extendedLocation": {"name": "str", "type": "str"}, "id": "str", @@ -134,7 +134,7 @@ async def test_snapshots_begin_update(self, resource_group): await self.client.snapshots.begin_update( resource_group_name=resource_group.name, snapshot_name="str", - properties={ + snapshot={ "properties": { "dataAccessAuthMode": "str", "diskAccessId": "str", @@ -209,7 +209,12 @@ async def test_snapshots_begin_grant_access(self, resource_group): await self.client.snapshots.begin_grant_access( resource_group_name=resource_group.name, snapshot_name="str", - body={"access": "str", "durationInSeconds": 0, "fileFormat": "str", "getSecureVMGuestStateSAS": bool}, + grant_access_data={ + "access": "str", + "durationInSeconds": 0, + "fileFormat": "str", + "getSecureVMGuestStateSAS": bool, + }, ) ).result() # call '.result()' to poll until service return final result diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_ssh_public_key_resources_operations.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_ssh_public_key_resources_operations.py index 59552e788990..4a988250eb4c 100644 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_ssh_public_key_resources_operations.py +++ b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_ssh_public_key_resources_operations.py @@ -35,7 +35,7 @@ def test_ssh_public_key_resources_create(self, resource_group): response = self.client.ssh_public_key_resources.create( resource_group_name=resource_group.name, ssh_public_key_name="str", - resource={ + parameters={ "location": "str", "id": "str", "name": "str", @@ -62,7 +62,7 @@ def test_ssh_public_key_resources_update(self, resource_group): response = self.client.ssh_public_key_resources.update( resource_group_name=resource_group.name, ssh_public_key_name="str", - properties={"properties": {"publicKey": "str"}, "tags": {"str": "str"}}, + parameters={"properties": {"publicKey": "str"}, "tags": {"str": "str"}}, ) # please add some check logic here by yourself diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_ssh_public_key_resources_operations_async.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_ssh_public_key_resources_operations_async.py index 81de981dd74c..7b2f92af4e7a 100644 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_ssh_public_key_resources_operations_async.py +++ b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_ssh_public_key_resources_operations_async.py @@ -36,7 +36,7 @@ async def test_ssh_public_key_resources_create(self, resource_group): response = await self.client.ssh_public_key_resources.create( resource_group_name=resource_group.name, ssh_public_key_name="str", - resource={ + parameters={ "location": "str", "id": "str", "name": "str", @@ -63,7 +63,7 @@ async def test_ssh_public_key_resources_update(self, resource_group): response = await self.client.ssh_public_key_resources.update( resource_group_name=resource_group.name, ssh_public_key_name="str", - properties={"properties": {"publicKey": "str"}, "tags": {"str": "str"}}, + parameters={"properties": {"publicKey": "str"}, "tags": {"str": "str"}}, ) # please add some check logic here by yourself diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machine_extensions_operations.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machine_extensions_operations.py index f64175b55a22..70434023f515 100644 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machine_extensions_operations.py +++ b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machine_extensions_operations.py @@ -37,7 +37,7 @@ def test_virtual_machine_extensions_begin_create_or_update(self, resource_group) resource_group_name=resource_group.name, vm_name="str", vm_extension_name="str", - resource={ + extension_parameters={ "location": "str", "id": "str", "name": "str", @@ -101,7 +101,7 @@ def test_virtual_machine_extensions_begin_update(self, resource_group): resource_group_name=resource_group.name, vm_name="str", vm_extension_name="str", - properties={ + extension_parameters={ "properties": { "autoUpgradeMinorVersion": bool, "enableAutomaticUpgrade": bool, diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machine_extensions_operations_async.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machine_extensions_operations_async.py index db9db66a58e7..77065474532a 100644 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machine_extensions_operations_async.py +++ b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machine_extensions_operations_async.py @@ -39,7 +39,7 @@ async def test_virtual_machine_extensions_begin_create_or_update(self, resource_ resource_group_name=resource_group.name, vm_name="str", vm_extension_name="str", - resource={ + extension_parameters={ "location": "str", "id": "str", "name": "str", @@ -105,7 +105,7 @@ async def test_virtual_machine_extensions_begin_update(self, resource_group): resource_group_name=resource_group.name, vm_name="str", vm_extension_name="str", - properties={ + extension_parameters={ "properties": { "autoUpgradeMinorVersion": bool, "enableAutomaticUpgrade": bool, diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machine_run_commands_operations.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machine_run_commands_operations.py index edb043f7356d..9c16d9025664 100644 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machine_run_commands_operations.py +++ b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machine_run_commands_operations.py @@ -37,7 +37,7 @@ def test_virtual_machine_run_commands_begin_create_or_update(self, resource_grou resource_group_name=resource_group.name, vm_name="str", run_command_name="str", - body={ + run_command={ "location": "str", "id": "str", "name": "str", @@ -104,7 +104,7 @@ def test_virtual_machine_run_commands_begin_update(self, resource_group): resource_group_name=resource_group.name, vm_name="str", run_command_name="str", - body={ + run_command={ "properties": { "asyncExecution": bool, "errorBlobManagedIdentity": {"clientId": "str", "objectId": "str"}, diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machine_run_commands_operations_async.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machine_run_commands_operations_async.py index 1e79ef9db4c8..9209dc67938e 100644 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machine_run_commands_operations_async.py +++ b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machine_run_commands_operations_async.py @@ -39,7 +39,7 @@ async def test_virtual_machine_run_commands_begin_create_or_update(self, resourc resource_group_name=resource_group.name, vm_name="str", run_command_name="str", - body={ + run_command={ "location": "str", "id": "str", "name": "str", @@ -108,7 +108,7 @@ async def test_virtual_machine_run_commands_begin_update(self, resource_group): resource_group_name=resource_group.name, vm_name="str", run_command_name="str", - body={ + run_command={ "properties": { "asyncExecution": bool, "errorBlobManagedIdentity": {"clientId": "str", "objectId": "str"}, diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machine_scale_set_extensions_operations.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machine_scale_set_extensions_operations.py index ddb85a53d40b..995bbf602bc9 100644 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machine_scale_set_extensions_operations.py +++ b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machine_scale_set_extensions_operations.py @@ -37,7 +37,7 @@ def test_virtual_machine_scale_set_extensions_begin_create_or_update(self, resou resource_group_name=resource_group.name, vm_scale_set_name="str", vmss_extension_name="str", - resource={ + extension_parameters={ "id": "str", "name": "str", "properties": { @@ -68,7 +68,7 @@ def test_virtual_machine_scale_set_extensions_begin_update(self, resource_group) resource_group_name=resource_group.name, vm_scale_set_name="str", vmss_extension_name="str", - properties={ + extension_parameters={ "id": "str", "name": "str", "properties": { diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machine_scale_set_extensions_operations_async.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machine_scale_set_extensions_operations_async.py index fe1be863374f..8bed62298f41 100644 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machine_scale_set_extensions_operations_async.py +++ b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machine_scale_set_extensions_operations_async.py @@ -39,7 +39,7 @@ async def test_virtual_machine_scale_set_extensions_begin_create_or_update(self, resource_group_name=resource_group.name, vm_scale_set_name="str", vmss_extension_name="str", - resource={ + extension_parameters={ "id": "str", "name": "str", "properties": { @@ -72,7 +72,7 @@ async def test_virtual_machine_scale_set_extensions_begin_update(self, resource_ resource_group_name=resource_group.name, vm_scale_set_name="str", vmss_extension_name="str", - properties={ + extension_parameters={ "id": "str", "name": "str", "properties": { diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machine_scale_set_vm_extensions_operations.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machine_scale_set_vm_extensions_operations.py index a29712b498c1..db5fc313a170 100644 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machine_scale_set_vm_extensions_operations.py +++ b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machine_scale_set_vm_extensions_operations.py @@ -39,7 +39,7 @@ def test_virtual_machine_scale_set_vm_extensions_begin_create_or_update(self, re vm_scale_set_name="str", instance_id="str", vm_extension_name="str", - resource={ + extension_parameters={ "id": "str", "location": "str", "name": "str", @@ -95,7 +95,7 @@ def test_virtual_machine_scale_set_vm_extensions_begin_update(self, resource_gro vm_scale_set_name="str", instance_id="str", vm_extension_name="str", - properties={ + extension_parameters={ "id": "str", "name": "str", "properties": { diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machine_scale_set_vm_extensions_operations_async.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machine_scale_set_vm_extensions_operations_async.py index d54c11e93736..258b17cda4f4 100644 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machine_scale_set_vm_extensions_operations_async.py +++ b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machine_scale_set_vm_extensions_operations_async.py @@ -41,7 +41,7 @@ async def test_virtual_machine_scale_set_vm_extensions_begin_create_or_update(se vm_scale_set_name="str", instance_id="str", vm_extension_name="str", - resource={ + extension_parameters={ "id": "str", "location": "str", "name": "str", @@ -99,7 +99,7 @@ async def test_virtual_machine_scale_set_vm_extensions_begin_update(self, resour vm_scale_set_name="str", instance_id="str", vm_extension_name="str", - properties={ + extension_parameters={ "id": "str", "name": "str", "properties": { diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machine_scale_set_vm_run_commands_operations.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machine_scale_set_vm_run_commands_operations.py index 26638a4bc711..f736ad360d1e 100644 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machine_scale_set_vm_run_commands_operations.py +++ b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machine_scale_set_vm_run_commands_operations.py @@ -39,7 +39,7 @@ def test_virtual_machine_scale_set_vm_run_commands_begin_create_or_update(self, vm_scale_set_name="str", instance_id="str", run_command_name="str", - body={ + run_command={ "location": "str", "id": "str", "name": "str", @@ -107,7 +107,7 @@ def test_virtual_machine_scale_set_vm_run_commands_begin_update(self, resource_g vm_scale_set_name="str", instance_id="str", run_command_name="str", - body={ + run_command={ "properties": { "asyncExecution": bool, "errorBlobManagedIdentity": {"clientId": "str", "objectId": "str"}, diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machine_scale_set_vm_run_commands_operations_async.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machine_scale_set_vm_run_commands_operations_async.py index 37655fa7a6b1..cfed1214a50d 100644 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machine_scale_set_vm_run_commands_operations_async.py +++ b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machine_scale_set_vm_run_commands_operations_async.py @@ -41,7 +41,7 @@ async def test_virtual_machine_scale_set_vm_run_commands_begin_create_or_update( vm_scale_set_name="str", instance_id="str", run_command_name="str", - body={ + run_command={ "location": "str", "id": "str", "name": "str", @@ -111,7 +111,7 @@ async def test_virtual_machine_scale_set_vm_run_commands_begin_update(self, reso vm_scale_set_name="str", instance_id="str", run_command_name="str", - body={ + run_command={ "properties": { "asyncExecution": bool, "errorBlobManagedIdentity": {"clientId": "str", "objectId": "str"}, diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machine_scale_set_vms_operations.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machine_scale_set_vms_operations.py index 986812639db4..189edacfc795 100644 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machine_scale_set_vms_operations.py +++ b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machine_scale_set_vms_operations.py @@ -37,7 +37,7 @@ def test_virtual_machine_scale_set_vms_begin_update(self, resource_group): resource_group_name=resource_group.name, vm_scale_set_name="str", instance_id="str", - resource={ + parameters={ "location": "str", "etag": "str", "id": "str", @@ -595,7 +595,7 @@ def test_virtual_machine_scale_set_vms_begin_attach_detach_data_disks(self, reso resource_group_name=resource_group.name, vm_scale_set_name="str", instance_id="str", - body={ + parameters={ "dataDisksToAttach": [ { "diskId": "str", @@ -692,7 +692,7 @@ def test_virtual_machine_scale_set_vms_begin_run_command(self, resource_group): resource_group_name=resource_group.name, vm_scale_set_name="str", instance_id="str", - body={"commandId": "str", "parameters": [{"name": "str", "value": "str"}], "script": ["str"]}, + parameters={"commandId": "str", "parameters": [{"name": "str", "value": "str"}], "script": ["str"]}, ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machine_scale_set_vms_operations_async.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machine_scale_set_vms_operations_async.py index eb1ea6bb0c73..e39b1023ea13 100644 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machine_scale_set_vms_operations_async.py +++ b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machine_scale_set_vms_operations_async.py @@ -39,7 +39,7 @@ async def test_virtual_machine_scale_set_vms_begin_update(self, resource_group): resource_group_name=resource_group.name, vm_scale_set_name="str", instance_id="str", - resource={ + parameters={ "location": "str", "etag": "str", "id": "str", @@ -614,7 +614,7 @@ async def test_virtual_machine_scale_set_vms_begin_attach_detach_data_disks(self resource_group_name=resource_group.name, vm_scale_set_name="str", instance_id="str", - body={ + parameters={ "dataDisksToAttach": [ { "diskId": "str", @@ -723,7 +723,7 @@ async def test_virtual_machine_scale_set_vms_begin_run_command(self, resource_gr resource_group_name=resource_group.name, vm_scale_set_name="str", instance_id="str", - body={"commandId": "str", "parameters": [{"name": "str", "value": "str"}], "script": ["str"]}, + parameters={"commandId": "str", "parameters": [{"name": "str", "value": "str"}], "script": ["str"]}, ) ).result() # call '.result()' to poll until service return final result diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machine_scale_sets_operations.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machine_scale_sets_operations.py index c1a551c31a9f..2d0779747902 100644 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machine_scale_sets_operations.py +++ b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machine_scale_sets_operations.py @@ -35,7 +35,7 @@ def test_virtual_machine_scale_sets_begin_create_or_update(self, resource_group) response = self.client.virtual_machine_scale_sets.begin_create_or_update( resource_group_name=resource_group.name, vm_scale_set_name="str", - resource={ + parameters={ "location": "str", "etag": "str", "extendedLocation": {"name": "str", "type": "str"}, @@ -363,7 +363,7 @@ def test_virtual_machine_scale_sets_begin_update(self, resource_group): response = self.client.virtual_machine_scale_sets.begin_update( resource_group_name=resource_group.name, vm_scale_set_name="str", - properties={ + parameters={ "identity": { "principalId": "str", "tenantId": "str", @@ -671,7 +671,7 @@ def test_virtual_machine_scale_sets_convert_to_single_placement_group(self, reso response = self.client.virtual_machine_scale_sets.convert_to_single_placement_group( resource_group_name=resource_group.name, vm_scale_set_name="str", - body={"activePlacementGroupId": "str"}, + parameters={"activePlacementGroupId": "str"}, ) # please add some check logic here by yourself @@ -694,7 +694,7 @@ def test_virtual_machine_scale_sets_begin_delete_instances(self, resource_group) response = self.client.virtual_machine_scale_sets.begin_delete_instances( resource_group_name=resource_group.name, vm_scale_set_name="str", - body={"instanceIds": ["str"]}, + vm_instance_i_ds={"instanceIds": ["str"]}, ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -729,7 +729,7 @@ def test_virtual_machine_scale_sets_begin_update_instances(self, resource_group) response = self.client.virtual_machine_scale_sets.begin_update_instances( resource_group_name=resource_group.name, vm_scale_set_name="str", - body={"instanceIds": ["str"]}, + vm_instance_i_ds={"instanceIds": ["str"]}, ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -829,7 +829,7 @@ def test_virtual_machine_scale_sets_begin_set_orchestration_service_state(self, response = self.client.virtual_machine_scale_sets.begin_set_orchestration_service_state( resource_group_name=resource_group.name, vm_scale_set_name="str", - body={"action": "str", "serviceName": "str"}, + parameters={"action": "str", "serviceName": "str"}, ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -896,7 +896,7 @@ def test_virtual_machine_scale_sets_begin_scale_out(self, resource_group): response = self.client.virtual_machine_scale_sets.begin_scale_out( resource_group_name=resource_group.name, vm_scale_set_name="str", - body={"capacity": 0, "properties": {"zone": "str"}}, + parameters={"capacity": 0, "properties": {"zone": "str"}}, ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machine_scale_sets_operations_async.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machine_scale_sets_operations_async.py index fab13dde8c52..c6064be7f30a 100644 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machine_scale_sets_operations_async.py +++ b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machine_scale_sets_operations_async.py @@ -37,7 +37,7 @@ async def test_virtual_machine_scale_sets_begin_create_or_update(self, resource_ await self.client.virtual_machine_scale_sets.begin_create_or_update( resource_group_name=resource_group.name, vm_scale_set_name="str", - resource={ + parameters={ "location": "str", "etag": "str", "extendedLocation": {"name": "str", "type": "str"}, @@ -371,7 +371,7 @@ async def test_virtual_machine_scale_sets_begin_update(self, resource_group): await self.client.virtual_machine_scale_sets.begin_update( resource_group_name=resource_group.name, vm_scale_set_name="str", - properties={ + parameters={ "identity": { "principalId": "str", "tenantId": "str", @@ -688,7 +688,7 @@ async def test_virtual_machine_scale_sets_convert_to_single_placement_group(self response = await self.client.virtual_machine_scale_sets.convert_to_single_placement_group( resource_group_name=resource_group.name, vm_scale_set_name="str", - body={"activePlacementGroupId": "str"}, + parameters={"activePlacementGroupId": "str"}, ) # please add some check logic here by yourself @@ -714,7 +714,7 @@ async def test_virtual_machine_scale_sets_begin_delete_instances(self, resource_ await self.client.virtual_machine_scale_sets.begin_delete_instances( resource_group_name=resource_group.name, vm_scale_set_name="str", - body={"instanceIds": ["str"]}, + vm_instance_i_ds={"instanceIds": ["str"]}, ) ).result() # call '.result()' to poll until service return final result @@ -755,7 +755,7 @@ async def test_virtual_machine_scale_sets_begin_update_instances(self, resource_ await self.client.virtual_machine_scale_sets.begin_update_instances( resource_group_name=resource_group.name, vm_scale_set_name="str", - body={"instanceIds": ["str"]}, + vm_instance_i_ds={"instanceIds": ["str"]}, ) ).result() # call '.result()' to poll until service return final result @@ -871,7 +871,7 @@ async def test_virtual_machine_scale_sets_begin_set_orchestration_service_state( await self.client.virtual_machine_scale_sets.begin_set_orchestration_service_state( resource_group_name=resource_group.name, vm_scale_set_name="str", - body={"action": "str", "serviceName": "str"}, + parameters={"action": "str", "serviceName": "str"}, ) ).result() # call '.result()' to poll until service return final result @@ -948,7 +948,7 @@ async def test_virtual_machine_scale_sets_begin_scale_out(self, resource_group): await self.client.virtual_machine_scale_sets.begin_scale_out( resource_group_name=resource_group.name, vm_scale_set_name="str", - body={"capacity": 0, "properties": {"zone": "str"}}, + parameters={"capacity": 0, "properties": {"zone": "str"}}, ) ).result() # call '.result()' to poll until service return final result diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machines_operations.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machines_operations.py index 19b601fb8827..faab5e5e4e1c 100644 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machines_operations.py +++ b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machines_operations.py @@ -36,7 +36,7 @@ def test_virtual_machines_begin_create_or_update(self, resource_group): response = self.client.virtual_machines.begin_create_or_update( resource_group_name=resource_group.name, vm_name="str", - resource={ + parameters={ "location": "str", "etag": "str", "extendedLocation": {"name": "str", "type": "str"}, @@ -525,7 +525,7 @@ def test_virtual_machines_begin_update(self, resource_group): response = self.client.virtual_machines.begin_update( resource_group_name=resource_group.name, vm_name="str", - properties={ + parameters={ "identity": { "principalId": "str", "tenantId": "str", @@ -984,7 +984,7 @@ def test_virtual_machines_begin_attach_detach_data_disks(self, resource_group): response = self.client.virtual_machines.begin_attach_detach_data_disks( resource_group_name=resource_group.name, vm_name="str", - body={ + parameters={ "dataDisksToAttach": [ { "diskId": "str", @@ -1008,7 +1008,7 @@ def test_virtual_machines_begin_capture(self, resource_group): response = self.client.virtual_machines.begin_capture( resource_group_name=resource_group.name, vm_name="str", - body={"destinationContainerName": "str", "overwriteVhds": bool, "vhdPrefix": "str"}, + parameters={"destinationContainerName": "str", "overwriteVhds": bool, "vhdPrefix": "str"}, ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -1053,7 +1053,7 @@ def test_virtual_machines_begin_install_patches(self, resource_group): response = self.client.virtual_machines.begin_install_patches( resource_group_name=resource_group.name, vm_name="str", - body={ + install_patches_input={ "rebootSetting": "str", "linuxParameters": { "classificationsToInclude": ["str"], @@ -1204,7 +1204,7 @@ def test_virtual_machines_begin_run_command(self, resource_group): response = self.client.virtual_machines.begin_run_command( resource_group_name=resource_group.name, vm_name="str", - body={"commandId": "str", "parameters": [{"name": "str", "value": "str"}], "script": ["str"]}, + parameters={"commandId": "str", "parameters": [{"name": "str", "value": "str"}], "script": ["str"]}, ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machines_operations_async.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machines_operations_async.py index f0e8cf219a09..5a362c13afab 100644 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machines_operations_async.py +++ b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machines_operations_async.py @@ -38,7 +38,7 @@ async def test_virtual_machines_begin_create_or_update(self, resource_group): await self.client.virtual_machines.begin_create_or_update( resource_group_name=resource_group.name, vm_name="str", - resource={ + parameters={ "location": "str", "etag": "str", "extendedLocation": {"name": "str", "type": "str"}, @@ -534,7 +534,7 @@ async def test_virtual_machines_begin_update(self, resource_group): await self.client.virtual_machines.begin_update( resource_group_name=resource_group.name, vm_name="str", - properties={ + parameters={ "identity": { "principalId": "str", "tenantId": "str", @@ -1004,7 +1004,7 @@ async def test_virtual_machines_begin_attach_detach_data_disks(self, resource_gr await self.client.virtual_machines.begin_attach_detach_data_disks( resource_group_name=resource_group.name, vm_name="str", - body={ + parameters={ "dataDisksToAttach": [ { "diskId": "str", @@ -1030,7 +1030,7 @@ async def test_virtual_machines_begin_capture(self, resource_group): await self.client.virtual_machines.begin_capture( resource_group_name=resource_group.name, vm_name="str", - body={"destinationContainerName": "str", "overwriteVhds": bool, "vhdPrefix": "str"}, + parameters={"destinationContainerName": "str", "overwriteVhds": bool, "vhdPrefix": "str"}, ) ).result() # call '.result()' to poll until service return final result @@ -1081,7 +1081,7 @@ async def test_virtual_machines_begin_install_patches(self, resource_group): await self.client.virtual_machines.begin_install_patches( resource_group_name=resource_group.name, vm_name="str", - body={ + install_patches_input={ "rebootSetting": "str", "linuxParameters": { "classificationsToInclude": ["str"], @@ -1248,7 +1248,7 @@ async def test_virtual_machines_begin_run_command(self, resource_group): await self.client.virtual_machines.begin_run_command( resource_group_name=resource_group.name, vm_name="str", - body={"commandId": "str", "parameters": [{"name": "str", "value": "str"}], "script": ["str"]}, + parameters={"commandId": "str", "parameters": [{"name": "str", "value": "str"}], "script": ["str"]}, ) ).result() # call '.result()' to poll until service return final result From ddc8d5f7b4b98c12f1ceb31b9cb4b1295bdb959e Mon Sep 17 00:00:00 2001 From: Yuchao Yan Date: Thu, 16 Oct 2025 15:05:12 +0800 Subject: [PATCH 3/4] generate from typespec --- sdk/compute/azure-mgmt-compute/CHANGELOG.md | 66 +- .../apiview-properties.json | 256 +- .../azure/mgmt/compute/_client.py | 146 +- .../azure/mgmt/compute/aio/_client.py | 148 +- .../mgmt/compute/aio/operations/__init__.py | 44 +- .../compute/aio/operations/_operations.py | 32494 +++++++------- .../azure/mgmt/compute/models/__init__.py | 12 +- .../azure/mgmt/compute/models/_enums.py | 6 - .../azure/mgmt/compute/models/_models.py | 124 +- .../azure/mgmt/compute/operations/__init__.py | 44 +- .../mgmt/compute/operations/_operations.py | 37305 ++++++++-------- .../test_compute_disk_accesses_operations.py | 69 + ..._compute_disk_accesses_operations_async.py | 73 + .../test_compute_galleries_operations.py | 25 - ...test_compute_galleries_operations_async.py | 27 - ...ute_gallery_sharing_profile_operations.py} | 14 +- ...llery_sharing_profile_operations_async.py} | 16 +- ... test_compute_log_analytics_operations.py} | 10 +- ...compute_log_analytics_operations_async.py} | 10 +- ...private_endpoint_connections_operations.py | 88 - ...e_endpoint_connections_operations_async.py | 93 - ...te_restore_point_collections_operations.py | 4 +- ...tore_point_collections_operations_async.py | 4 +- .../test_compute_restore_points_operations.py | 2 +- ...compute_restore_points_operations_async.py | 2 +- ...mpute_soft_deleted_resource_operations.py} | 12 +- ...soft_deleted_resource_operations_async.py} | 12 +- ...est_compute_ssh_public_keys_operations.py} | 30 +- ...mpute_ssh_public_keys_operations_async.py} | 30 +- ...ns.py => test_compute_usage_operations.py} | 6 +- ...=> test_compute_usage_operations_async.py} | 6 +- ...e_virtual_machine_extensions_operations.py | 2 +- ...ual_machine_extensions_operations_async.py | 4 +- ...al_machine_images_edge_zone_operations.py} | 22 +- ...hine_images_edge_zone_operations_async.py} | 22 +- ...pute_virtual_machine_images_operations.py} | 30 +- ...irtual_machine_images_operations_async.py} | 30 +- ...run_commands_operation_group_operations.py | 40 - ...mmands_operation_group_operations_async.py | 41 - ...virtual_machine_run_commands_operations.py | 21 + ...l_machine_run_commands_operations_async.py | 21 + ...e_scale_set_rolling_upgrades_operations.py | 63 + ...e_set_rolling_upgrades_operations_async.py | 70 + ...hine_scale_set_vm_extensions_operations.py | 2 +- ...cale_set_vm_extensions_operations_async.py | 4 +- ...irtual_machine_scale_set_vms_operations.py | 4 +- ..._machine_scale_set_vms_operations_async.py | 4 +- ...e_virtual_machine_scale_sets_operations.py | 43 +- ...ual_machine_scale_sets_operations_async.py | 49 +- ...mpute_virtual_machine_sizes_operations.py} | 6 +- ...virtual_machine_sizes_operations_async.py} | 6 +- ...ual_machines_operation_group_operations.py | 29 - ...chines_operation_group_operations_async.py | 30 - ...est_compute_virtual_machines_operations.py | 14 +- ...mpute_virtual_machines_operations_async.py | 14 +- 55 files changed, 35859 insertions(+), 35890 deletions(-) rename sdk/compute/azure-mgmt-compute/generated_tests/{test_compute_virtual_machine_scale_sets_operation_group_operations.py => test_compute_gallery_sharing_profile_operations.py} (67%) rename sdk/compute/azure-mgmt-compute/generated_tests/{test_compute_virtual_machine_scale_sets_operation_group_operations_async.py => test_compute_gallery_sharing_profile_operations_async.py} (66%) rename sdk/compute/azure-mgmt-compute/generated_tests/{test_compute_log_analytics_operation_group_operations.py => test_compute_log_analytics_operations.py} (82%) rename sdk/compute/azure-mgmt-compute/generated_tests/{test_compute_log_analytics_operation_group_operations_async.py => test_compute_log_analytics_operations_async.py} (83%) delete mode 100644 sdk/compute/azure-mgmt-compute/generated_tests/test_compute_private_endpoint_connections_operations.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_tests/test_compute_private_endpoint_connections_operations_async.py rename sdk/compute/azure-mgmt-compute/generated_tests/{test_compute_rolling_upgrade_status_infos_operations.py => test_compute_soft_deleted_resource_operations.py} (74%) rename sdk/compute/azure-mgmt-compute/generated_tests/{test_compute_rolling_upgrade_status_infos_operations_async.py => test_compute_soft_deleted_resource_operations_async.py} (74%) rename sdk/compute/azure-mgmt-compute/generated_tests/{test_compute_ssh_public_key_resources_operations.py => test_compute_ssh_public_keys_operations.py} (75%) rename sdk/compute/azure-mgmt-compute/generated_tests/{test_compute_ssh_public_key_resources_operations_async.py => test_compute_ssh_public_keys_operations_async.py} (74%) rename sdk/compute/azure-mgmt-compute/generated_tests/{test_compute_virtual_machine_sizes_operation_group_operations.py => test_compute_usage_operations.py} (81%) rename sdk/compute/azure-mgmt-compute/generated_tests/{test_compute_virtual_machine_sizes_operation_group_operations_async.py => test_compute_usage_operations_async.py} (81%) rename sdk/compute/azure-mgmt-compute/generated_tests/{test_compute_virtual_machine_images_edge_zone_operation_group_operations.py => test_compute_virtual_machine_images_edge_zone_operations.py} (68%) rename sdk/compute/azure-mgmt-compute/generated_tests/{test_compute_virtual_machine_images_edge_zone_operation_group_operations_async.py => test_compute_virtual_machine_images_edge_zone_operations_async.py} (77%) rename sdk/compute/azure-mgmt-compute/generated_tests/{test_compute_virtual_machine_images_operation_group_operations.py => test_compute_virtual_machine_images_operations.py} (67%) rename sdk/compute/azure-mgmt-compute/generated_tests/{test_compute_virtual_machine_images_operation_group_operations_async.py => test_compute_virtual_machine_images_operations_async.py} (67%) delete mode 100644 sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machine_run_commands_operation_group_operations.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machine_run_commands_operation_group_operations_async.py create mode 100644 sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machine_scale_set_rolling_upgrades_operations.py create mode 100644 sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machine_scale_set_rolling_upgrades_operations_async.py rename sdk/compute/azure-mgmt-compute/generated_tests/{test_compute_usage_operation_group_operations.py => test_compute_virtual_machine_sizes_operations.py} (85%) rename sdk/compute/azure-mgmt-compute/generated_tests/{test_compute_usage_operation_group_operations_async.py => test_compute_virtual_machine_sizes_operations_async.py} (86%) delete mode 100644 sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machines_operation_group_operations.py delete mode 100644 sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machines_operation_group_operations_async.py diff --git a/sdk/compute/azure-mgmt-compute/CHANGELOG.md b/sdk/compute/azure-mgmt-compute/CHANGELOG.md index e7dc8eef44c8..47e6260ea0ff 100644 --- a/sdk/compute/azure-mgmt-compute/CHANGELOG.md +++ b/sdk/compute/azure-mgmt-compute/CHANGELOG.md @@ -1,6 +1,6 @@ # Release History -## 38.0.0 (2025-10-11) +## 38.0.0 (2025-10-16) ### Features Added @@ -44,8 +44,6 @@ - Added model `EncryptionSetProperties` - Added model `GenerateKeyPairParameterBody` - Added model `MigrateToVmScaleSetParameterBody` - - Added model `OkResponse` - - Added enum `PassNames` - Added model `PerformMaintenanceParameterBody` - Added model `PowerOffParameterBody` - Added model `RedeployParameterBody` @@ -56,37 +54,20 @@ - Added model `RestartParameterBody` - Added model `SharedGalleryIdentifier` - Added model `StartParameterBody` - - Model `GalleriesOperations` added method `begin_gallery_sharing_profile_update` - - Model `GalleriesOperations` added method `list_by_artifact_name` + - Model `VirtualMachineScaleSetVMsOperations` added parameter `etag` in method `begin_update` + - Model `VirtualMachineScaleSetVMsOperations` added parameter `match_condition` in method `begin_update` - Model `VirtualMachineScaleSetsOperations` added parameter `etag` in method `begin_create_or_update` - Model `VirtualMachineScaleSetsOperations` added parameter `match_condition` in method `begin_create_or_update` - Model `VirtualMachineScaleSetsOperations` added parameter `etag` in method `begin_update` - Model `VirtualMachineScaleSetsOperations` added parameter `match_condition` in method `begin_update` - - Model `VirtualMachineScaleSetsOperations` added method `begin_cancel` - - Model `VirtualMachineScaleSetsOperations` added method `begin_start_extension_upgrade` - - Model `VirtualMachineScaleSetsOperations` added method `begin_start_os_upgrade` - Model `VirtualMachinesOperations` added parameter `etag` in method `begin_create_or_update` - Model `VirtualMachinesOperations` added parameter `match_condition` in method `begin_create_or_update` - Model `VirtualMachinesOperations` added parameter `etag` in method `begin_update` - Model `VirtualMachinesOperations` added parameter `match_condition` in method `begin_update` - - Added model `LogAnalyticsOperationGroupOperations` - - Added model `PrivateEndpointConnectionsOperations` - - Added model `RollingUpgradeStatusInfosOperations` - - Added model `SshPublicKeyResourcesOperations` - - Added model `UsageOperationGroupOperations` - - Added model `VirtualMachineImagesEdgeZoneOperationGroupOperations` - - Added model `VirtualMachineImagesOperationGroupOperations` - - Added model `VirtualMachineRunCommandsOperationGroupOperations` - - Added model `VirtualMachineScaleSetVMSOperations` - - Added model `VirtualMachineScaleSetsOperationGroupOperations` - - Added model `VirtualMachineSizesOperationGroupOperations` - - Added model `VirtualMachinesOperationGroupOperations` ### Breaking Changes - Deleted or renamed client `ComputeManagementClient` - - Method `VirtualMachineExtensionsOperations.list` changed from `asynchronous` to `synchronous` - - Method `VirtualMachineScaleSetVMExtensionsOperations.list` changed from `asynchronous` to `synchronous` - Model `AvailabilitySetUpdate` deleted or renamed its instance variable `platform_update_domain_count` - Model `AvailabilitySetUpdate` deleted or renamed its instance variable `platform_fault_domain_count` - Model `AvailabilitySetUpdate` deleted or renamed its instance variable `virtual_machines` @@ -318,8 +299,6 @@ - Deleted or renamed model `LoadBalancerConfigurationProperties` - Deleted or renamed model `LoadBalancerFrontendIpConfiguration` - Deleted or renamed model `LoadBalancerFrontendIpConfigurationProperties` - - Deleted or renamed model `LogAnalyticsOperationResult` - - Deleted or renamed model `LogAnalyticsOutput` - Deleted or renamed model `OSFamily` - Deleted or renamed model `OSFamilyProperties` - Deleted or renamed model `OSVersion` @@ -351,10 +330,6 @@ - Method `CapacityReservationsOperations.get` changed its parameter `expand` from `positional_or_keyword` to `keyword_only` - Method `DedicatedHostGroupsOperations.get` changed its parameter `expand` from `positional_or_keyword` to `keyword_only` - Method `DedicatedHostsOperations.get` changed its parameter `expand` from `positional_or_keyword` to `keyword_only` - - Deleted or renamed method `DiskAccessesOperations.begin_delete_a_private_endpoint_connection` - - Deleted or renamed method `DiskAccessesOperations.begin_update_a_private_endpoint_connection` - - Deleted or renamed method `DiskAccessesOperations.get_a_private_endpoint_connection` - - Deleted or renamed method `DiskAccessesOperations.list_private_endpoint_connections` - Method `GalleriesOperations.get` changed its parameter `select` from `positional_or_keyword` to `keyword_only` - Method `GalleriesOperations.get` changed its parameter `expand` from `positional_or_keyword` to `keyword_only` - Method `GalleryApplicationVersionsOperations.get` changed its parameter `expand` from `positional_or_keyword` to `keyword_only` @@ -370,15 +345,27 @@ - Method `VirtualMachineExtensionImagesOperations.list_versions` changed its parameter `orderby` from `positional_or_keyword` to `keyword_only` - Method `VirtualMachineExtensionsOperations.get` changed its parameter `expand` from `positional_or_keyword` to `keyword_only` - Method `VirtualMachineExtensionsOperations.list` changed its parameter `expand` from `positional_or_keyword` to `keyword_only` + - Method `VirtualMachineImagesEdgeZoneOperations.list` changed its parameter `expand` from `positional_or_keyword` to `keyword_only` + - Method `VirtualMachineImagesEdgeZoneOperations.list` changed its parameter `orderby` from `positional_or_keyword` to `keyword_only` + - Method `VirtualMachineImagesOperations.list` changed its parameter `expand` from `positional_or_keyword` to `keyword_only` + - Method `VirtualMachineImagesOperations.list` changed its parameter `orderby` from `positional_or_keyword` to `keyword_only` + - Method `VirtualMachineImagesOperations.list_with_properties` changed its parameter `expand` from `positional_or_keyword` to `keyword_only` + - Method `VirtualMachineImagesOperations.list_with_properties` changed its parameter `orderby` from `positional_or_keyword` to `keyword_only` - Method `VirtualMachineRunCommandsOperations.get_by_virtual_machine` changed its parameter `expand` from `positional_or_keyword` to `keyword_only` - Method `VirtualMachineRunCommandsOperations.list_by_virtual_machine` changed its parameter `expand` from `positional_or_keyword` to `keyword_only` - - Deleted or renamed method `VirtualMachineRunCommandsOperations.get` - - Deleted or renamed method `VirtualMachineRunCommandsOperations.list` - Method `VirtualMachineScaleSetExtensionsOperations.get` changed its parameter `expand` from `positional_or_keyword` to `keyword_only` - Method `VirtualMachineScaleSetVMExtensionsOperations.get` changed its parameter `expand` from `positional_or_keyword` to `keyword_only` - Method `VirtualMachineScaleSetVMExtensionsOperations.list` changed its parameter `expand` from `positional_or_keyword` to `keyword_only` - Method `VirtualMachineScaleSetVMRunCommandsOperations.get` changed its parameter `expand` from `positional_or_keyword` to `keyword_only` - Method `VirtualMachineScaleSetVMRunCommandsOperations.list` changed its parameter `expand` from `positional_or_keyword` to `keyword_only` + - Method `VirtualMachineScaleSetVMsOperations.begin_delete` changed its parameter `force_deletion` from `positional_or_keyword` to `keyword_only` + - Method `VirtualMachineScaleSetVMsOperations.begin_power_off` changed its parameter `skip_shutdown` from `positional_or_keyword` to `keyword_only` + - Method `VirtualMachineScaleSetVMsOperations.begin_update` deleted or renamed its parameter `if_match` of kind `positional_or_keyword` + - Method `VirtualMachineScaleSetVMsOperations.begin_update` deleted or renamed its parameter `if_none_match` of kind `positional_or_keyword` + - Method `VirtualMachineScaleSetVMsOperations.get` changed its parameter `expand` from `positional_or_keyword` to `keyword_only` + - Method `VirtualMachineScaleSetVMsOperations.list` changed its parameter `select` from `positional_or_keyword` to `keyword_only` + - Method `VirtualMachineScaleSetVMsOperations.list` changed its parameter `expand` from `positional_or_keyword` to `keyword_only` + - Method `VirtualMachineScaleSetVMsOperations.retrieve_boot_diagnostics_data` changed its parameter `sas_uri_expiration_time_in_minutes` from `positional_or_keyword` to `keyword_only` - Method `VirtualMachineScaleSetsOperations.begin_create_or_update` deleted or renamed its parameter `if_match` of kind `positional_or_keyword` - Method `VirtualMachineScaleSetsOperations.begin_create_or_update` deleted or renamed its parameter `if_none_match` of kind `positional_or_keyword` - Method `VirtualMachineScaleSetsOperations.begin_deallocate` changed its parameter `hibernate` from `positional_or_keyword` to `keyword_only` @@ -391,7 +378,6 @@ - Method `VirtualMachineScaleSetsOperations.force_recovery_service_fabric_platform_update_domain_walk` changed its parameter `zone` from `positional_or_keyword` to `keyword_only` - Method `VirtualMachineScaleSetsOperations.force_recovery_service_fabric_platform_update_domain_walk` changed its parameter `placement_group_id` from `positional_or_keyword` to `keyword_only` - Method `VirtualMachineScaleSetsOperations.get` changed its parameter `expand` from `positional_or_keyword` to `keyword_only` - - Deleted or renamed method `VirtualMachineScaleSetsOperations.list_by_location` - Method `VirtualMachinesOperations.begin_create_or_update` deleted or renamed its parameter `if_match` of kind `positional_or_keyword` - Method `VirtualMachinesOperations.begin_create_or_update` deleted or renamed its parameter `if_none_match` of kind `positional_or_keyword` - Method `VirtualMachinesOperations.begin_deallocate` changed its parameter `hibernate` from `positional_or_keyword` to `keyword_only` @@ -404,28 +390,18 @@ - Method `VirtualMachinesOperations.list_all` changed its parameter `status_only` from `positional_or_keyword` to `keyword_only` - Method `VirtualMachinesOperations.list_all` changed its parameter `expand` from `positional_or_keyword` to `keyword_only` - Method `VirtualMachinesOperations.retrieve_boot_diagnostics_data` changed its parameter `sas_uri_expiration_time_in_minutes` from `positional_or_keyword` to `keyword_only` - - Deleted or renamed method `VirtualMachinesOperations.list_by_location` - Deleted or renamed model `CloudServiceOperatingSystemsOperations` - Deleted or renamed model `CloudServiceRoleInstancesOperations` - Deleted or renamed model `CloudServiceRolesOperations` - Deleted or renamed model `CloudServicesOperations` - Deleted or renamed model `CloudServicesUpdateDomainOperations` - - Deleted or renamed model `GallerySharingProfileOperations` - - Deleted or renamed model `LogAnalyticsOperations` - - Deleted or renamed model `SoftDeletedResourceOperations` - - Deleted or renamed model `SshPublicKeysOperations` - - Deleted or renamed model `UsageOperations` - - Deleted or renamed model `VirtualMachineImagesEdgeZoneOperations` - - Deleted or renamed model `VirtualMachineImagesOperations` - - Deleted or renamed model `VirtualMachineScaleSetRollingUpgradesOperations` - - Deleted or renamed model `VirtualMachineScaleSetVMsOperations` - - Deleted or renamed model `VirtualMachineSizesOperations` + - Method `VirtualMachinesOperations.begin_create_or_update` re-ordered its parameters from `['self', 'resource_group_name', 'vm_name', 'parameters', 'if_match', 'if_none_match', 'kwargs']` to `['self', 'resource_group_name', 'vm_name', 'parameters', 'etag', 'match_condition', 'kwargs']` + - Method `VirtualMachinesOperations.begin_update` re-ordered its parameters from `['self', 'resource_group_name', 'vm_name', 'parameters', 'if_match', 'if_none_match', 'kwargs']` to `['self', 'resource_group_name', 'vm_name', 'parameters', 'etag', 'match_condition', 'kwargs']` + - Method `VirtualMachineScaleSetVMsOperations.begin_update` re-ordered its parameters from `['self', 'resource_group_name', 'vm_scale_set_name', 'instance_id', 'parameters', 'if_match', 'if_none_match', 'kwargs']` to `['self', 'resource_group_name', 'vm_scale_set_name', 'instance_id', 'parameters', 'etag', 'match_condition', 'kwargs']` - Method `VirtualMachineScaleSetsOperations.begin_deallocate` re-ordered its parameters from `['self', 'resource_group_name', 'vm_scale_set_name', 'hibernate', 'vm_instance_i_ds', 'kwargs']` to `['self', 'resource_group_name', 'vm_scale_set_name', 'vm_instance_i_ds', 'hibernate', 'kwargs']` - - Method `VirtualMachineScaleSetsOperations.begin_update` re-ordered its parameters from `['self', 'resource_group_name', 'vm_scale_set_name', 'parameters', 'if_match', 'if_none_match', 'kwargs']` to `['self', 'resource_group_name', 'vm_scale_set_name', 'parameters', 'etag', 'match_condition', 'kwargs']` - Method `VirtualMachineScaleSetsOperations.begin_create_or_update` re-ordered its parameters from `['self', 'resource_group_name', 'vm_scale_set_name', 'parameters', 'if_match', 'if_none_match', 'kwargs']` to `['self', 'resource_group_name', 'vm_scale_set_name', 'parameters', 'etag', 'match_condition', 'kwargs']` + - Method `VirtualMachineScaleSetsOperations.begin_update` re-ordered its parameters from `['self', 'resource_group_name', 'vm_scale_set_name', 'parameters', 'if_match', 'if_none_match', 'kwargs']` to `['self', 'resource_group_name', 'vm_scale_set_name', 'parameters', 'etag', 'match_condition', 'kwargs']` - Method `VirtualMachineScaleSetsOperations.begin_power_off` re-ordered its parameters from `['self', 'resource_group_name', 'vm_scale_set_name', 'skip_shutdown', 'vm_instance_i_ds', 'kwargs']` to `['self', 'resource_group_name', 'vm_scale_set_name', 'vm_instance_i_ds', 'skip_shutdown', 'kwargs']` - - Method `VirtualMachinesOperations.begin_update` re-ordered its parameters from `['self', 'resource_group_name', 'vm_name', 'parameters', 'if_match', 'if_none_match', 'kwargs']` to `['self', 'resource_group_name', 'vm_name', 'parameters', 'etag', 'match_condition', 'kwargs']` - - Method `VirtualMachinesOperations.begin_create_or_update` re-ordered its parameters from `['self', 'resource_group_name', 'vm_name', 'parameters', 'if_match', 'if_none_match', 'kwargs']` to `['self', 'resource_group_name', 'vm_name', 'parameters', 'etag', 'match_condition', 'kwargs']` ## 37.0.1 (2025-10-09) diff --git a/sdk/compute/azure-mgmt-compute/apiview-properties.json b/sdk/compute/azure-mgmt-compute/apiview-properties.json index d48b9292fc4e..92abce86d3bd 100644 --- a/sdk/compute/azure-mgmt-compute/apiview-properties.json +++ b/sdk/compute/azure-mgmt-compute/apiview-properties.json @@ -198,6 +198,8 @@ "azure.mgmt.compute.models.LinuxPatchSettings": "Microsoft.Compute.LinuxPatchSettings", "azure.mgmt.compute.models.LinuxVMGuestPatchAutomaticByPlatformSettings": "Microsoft.Compute.LinuxVMGuestPatchAutomaticByPlatformSettings", "azure.mgmt.compute.models.LogAnalyticsInputBase": "Microsoft.Compute.LogAnalyticsInputBase", + "azure.mgmt.compute.models.LogAnalyticsOperationResult": "Microsoft.Compute.LogAnalyticsOperationResult", + "azure.mgmt.compute.models.LogAnalyticsOutput": "Microsoft.Compute.LogAnalyticsOutput", "azure.mgmt.compute.models.MaintenanceRedeployStatus": "Microsoft.Compute.MaintenanceRedeployStatus", "azure.mgmt.compute.models.ManagedDiskParameters": "Microsoft.Compute.ManagedDiskParameters", "azure.mgmt.compute.models.MaxInstancePercentPerZonePolicy": "Microsoft.Compute.MaxInstancePercentPerZonePolicy", @@ -207,7 +209,6 @@ "azure.mgmt.compute.models.NetworkInterfaceReference": "Microsoft.Compute.NetworkInterfaceReference", "azure.mgmt.compute.models.NetworkInterfaceReferenceProperties": "Microsoft.Compute.NetworkInterfaceReferenceProperties", "azure.mgmt.compute.models.NetworkProfile": "Microsoft.Compute.NetworkProfile", - "azure.mgmt.compute.models.OkResponse": "TypeSpec.Http.OkResponse", "azure.mgmt.compute.models.Operation": "Azure.ResourceManager.CommonTypes.Operation", "azure.mgmt.compute.models.OperationDisplay": "Azure.ResourceManager.CommonTypes.OperationDisplay", "azure.mgmt.compute.models.OrchestrationServiceStateInput": "Microsoft.Compute.OrchestrationServiceStateInput", @@ -377,6 +378,7 @@ "azure.mgmt.compute.models.VirtualMachineExtensionImageProperties": "Microsoft.Compute.VirtualMachineExtensionImageProperties", "azure.mgmt.compute.models.VirtualMachineExtensionInstanceView": "Microsoft.Compute.VirtualMachineExtensionInstanceView", "azure.mgmt.compute.models.VirtualMachineExtensionProperties": "Microsoft.Compute.VirtualMachineExtensionProperties", + "azure.mgmt.compute.models.VirtualMachineExtensionsListResult": "Microsoft.Compute.VirtualMachineExtensionsListResult", "azure.mgmt.compute.models.VirtualMachineExtensionUpdate": "Microsoft.Compute.VirtualMachineExtensionUpdate", "azure.mgmt.compute.models.VirtualMachineExtensionUpdateProperties": "Microsoft.Compute.VirtualMachineExtensionUpdateProperties", "azure.mgmt.compute.models.VirtualMachineHealthStatus": "Microsoft.Compute.VirtualMachineHealthStatus", @@ -450,6 +452,7 @@ "azure.mgmt.compute.models.VirtualMachineScaleSetUpdateVMProfile": "Microsoft.Compute.VirtualMachineScaleSetUpdateVMProfile", "azure.mgmt.compute.models.VirtualMachineScaleSetVM": "Microsoft.Compute.VirtualMachineScaleSetVM", "azure.mgmt.compute.models.VirtualMachineScaleSetVMExtension": "Microsoft.Compute.VirtualMachineScaleSetVMExtension", + "azure.mgmt.compute.models.VirtualMachineScaleSetVMExtensionsListResult": "Microsoft.Compute.VirtualMachineScaleSetVMExtensionsListResult", "azure.mgmt.compute.models.VirtualMachineScaleSetVMExtensionsSummary": "Microsoft.Compute.VirtualMachineScaleSetVMExtensionsSummary", "azure.mgmt.compute.models.VirtualMachineScaleSetVMExtensionUpdate": "Microsoft.Compute.VirtualMachineScaleSetVMExtensionUpdate", "azure.mgmt.compute.models.VirtualMachineScaleSetVMInstanceIDs": "Microsoft.Compute.VirtualMachineScaleSetVMInstanceIDs", @@ -481,7 +484,6 @@ "azure.mgmt.compute.models.CreatedByType": "Azure.ResourceManager.CommonTypes.createdByType", "azure.mgmt.compute.models.UpgradeMode": "Microsoft.Compute.UpgradeMode", "azure.mgmt.compute.models.RepairAction": "Microsoft.Compute.RepairAction", - "azure.mgmt.compute.models.PassNames": "Microsoft.Compute.PassNames", "azure.mgmt.compute.models.SettingNames": "Microsoft.Compute.SettingNames", "azure.mgmt.compute.models.WindowsVMGuestPatchMode": "Microsoft.Compute.WindowsVMGuestPatchMode", "azure.mgmt.compute.models.WindowsPatchAssessmentMode": "Microsoft.Compute.WindowsPatchAssessmentMode", @@ -531,18 +533,14 @@ "azure.mgmt.compute.models.UpgradeOperationInvoker": "Microsoft.Compute.UpgradeOperationInvoker", "azure.mgmt.compute.models.OrchestrationServiceStateAction": "Microsoft.Compute.OrchestrationServiceStateAction", "azure.mgmt.compute.models.VirtualMachineScaleSetSkuScaleType": "Microsoft.Compute.VirtualMachineScaleSetSkuScaleType", - "azure.mgmt.compute.models.RollingUpgradeStatusCode": "Microsoft.Compute.RollingUpgradeStatusCode", - "azure.mgmt.compute.models.RollingUpgradeActionType": "Microsoft.Compute.RollingUpgradeActionType", - "azure.mgmt.compute.models.MaintenanceOperationResultCodeTypes": "Microsoft.Compute.MaintenanceOperationResultCodeTypes", - "azure.mgmt.compute.models.HyperVGeneration": "Microsoft.Compute.HyperVGeneration", "azure.mgmt.compute.models.VirtualMachineSizeTypes": "Microsoft.Compute.VirtualMachineSizeTypes", - "azure.mgmt.compute.models.ResilientVMDeletionStatus": "Microsoft.Compute.ResilientVMDeletionStatus", "azure.mgmt.compute.models.DiskDetachOptionTypes": "Microsoft.Compute.DiskDetachOptionTypes", "azure.mgmt.compute.models.IPVersions": "Microsoft.Compute.IPVersions", "azure.mgmt.compute.models.PublicIPAllocationMethod": "Microsoft.Compute.PublicIPAllocationMethod", - "azure.mgmt.compute.models.InstanceViewTypes": "Microsoft.Compute.InstanceViewTypes", "azure.mgmt.compute.models.HyperVGenerationType": "Microsoft.Compute.HyperVGenerationType", + "azure.mgmt.compute.models.MaintenanceOperationResultCodeTypes": "Microsoft.Compute.MaintenanceOperationResultCodeTypes", "azure.mgmt.compute.models.PatchOperationStatus": "Microsoft.Compute.PatchOperationStatus", + "azure.mgmt.compute.models.InstanceViewTypes": "Microsoft.Compute.InstanceViewTypes", "azure.mgmt.compute.models.ExpandTypeForListVMs": "Microsoft.Compute.ExpandTypeForListVMs", "azure.mgmt.compute.models.ExpandTypesForListVMs": "Microsoft.Compute.ExpandTypesForListVMs", "azure.mgmt.compute.models.VMGuestPatchRebootBehavior": "Microsoft.Compute.VMGuestPatchRebootBehavior", @@ -554,7 +552,6 @@ "azure.mgmt.compute.models.VMGuestPatchClassificationLinux": "Microsoft.Compute.VMGuestPatchClassificationLinux", "azure.mgmt.compute.models.ProximityPlacementGroupType": "Microsoft.Compute.ProximityPlacementGroupType", "azure.mgmt.compute.models.DedicatedHostLicenseTypes": "Microsoft.Compute.DedicatedHostLicenseTypes", - "azure.mgmt.compute.models.SshEncryptionTypes": "Microsoft.Compute.SshEncryptionTypes", "azure.mgmt.compute.models.OperatingSystemStateTypes": "Microsoft.Compute.OperatingSystemStateTypes", "azure.mgmt.compute.models.HyperVGenerationTypes": "Microsoft.Compute.HyperVGenerationTypes", "azure.mgmt.compute.models.OperatingSystemType": "Microsoft.Compute.OperatingSystemType", @@ -569,11 +566,7 @@ "azure.mgmt.compute.models.CapacityReservationInstanceViewTypes": "Microsoft.Compute.CapacityReservationInstanceViewTypes", "azure.mgmt.compute.models.ScriptShellTypes": "Microsoft.Compute.ScriptShellTypes", "azure.mgmt.compute.models.ExecutionState": "Microsoft.Compute.ExecutionState", - "azure.mgmt.compute.models.VmDiskTypes": "Microsoft.Compute.VmDiskTypes", - "azure.mgmt.compute.models.ArchitectureTypes": "Microsoft.Compute.ArchitectureTypes", - "azure.mgmt.compute.models.ImageState": "Microsoft.Compute.ImageState", - "azure.mgmt.compute.models.AlternativeType": "Microsoft.Compute.AlternativeType", - "azure.mgmt.compute.models.IntervalInMins": "Microsoft.Compute.IntervalInMins", + "azure.mgmt.compute.models.HyperVGeneration": "Microsoft.Compute.HyperVGeneration", "azure.mgmt.compute.models.Architecture": "Microsoft.Compute.Architecture", "azure.mgmt.compute.models.SupportedSecurityOption": "Microsoft.Compute.SupportedSecurityOption", "azure.mgmt.compute.models.DiskCreateOption": "Microsoft.Compute.DiskCreateOption", @@ -603,8 +596,6 @@ "azure.mgmt.compute.models.GalleryExpandParams": "Microsoft.Compute.GalleryExpandParams", "azure.mgmt.compute.models.UefiSignatureTemplateName": "Microsoft.Compute.UefiSignatureTemplateName", "azure.mgmt.compute.models.UefiKeyType": "Microsoft.Compute.UefiKeyType", - "azure.mgmt.compute.models.SoftDeletedArtifactTypes": "Microsoft.Compute.SoftDeletedArtifactTypes", - "azure.mgmt.compute.models.SharingUpdateOperationTypes": "Microsoft.Compute.SharingUpdateOperationTypes", "azure.mgmt.compute.models.StorageAccountType": "Microsoft.Compute.StorageAccountType", "azure.mgmt.compute.models.ConfidentialVMEncryptionType": "Microsoft.Compute.ConfidentialVMEncryptionType", "azure.mgmt.compute.models.ReplicationMode": "Microsoft.Compute.ReplicationMode", @@ -627,6 +618,17 @@ "azure.mgmt.compute.models.ExtendedLocationType": "Microsoft.Compute.ExtendedLocationType", "azure.mgmt.compute.models.ResourceSkuRestrictionsType": "Microsoft.Compute.ResourceSkuRestrictionsType", "azure.mgmt.compute.models.ResourceSkuRestrictionsReasonCode": "Microsoft.Compute.ResourceSkuRestrictionsReasonCode", + "azure.mgmt.compute.models.RollingUpgradeStatusCode": "Microsoft.Compute.RollingUpgradeStatusCode", + "azure.mgmt.compute.models.RollingUpgradeActionType": "Microsoft.Compute.RollingUpgradeActionType", + "azure.mgmt.compute.models.ResilientVMDeletionStatus": "Microsoft.Compute.ResilientVMDeletionStatus", + "azure.mgmt.compute.models.SshEncryptionTypes": "Microsoft.Compute.SshEncryptionTypes", + "azure.mgmt.compute.models.VmDiskTypes": "Microsoft.Compute.VmDiskTypes", + "azure.mgmt.compute.models.ArchitectureTypes": "Microsoft.Compute.ArchitectureTypes", + "azure.mgmt.compute.models.ImageState": "Microsoft.Compute.ImageState", + "azure.mgmt.compute.models.AlternativeType": "Microsoft.Compute.AlternativeType", + "azure.mgmt.compute.models.IntervalInMins": "Microsoft.Compute.IntervalInMins", + "azure.mgmt.compute.models.SoftDeletedArtifactTypes": "Microsoft.Compute.SoftDeletedArtifactTypes", + "azure.mgmt.compute.models.SharingUpdateOperationTypes": "Microsoft.Compute.SharingUpdateOperationTypes", "azure.mgmt.compute.operations.Operations.list": "Azure.ResourceManager.Legacy.Operations.list", "azure.mgmt.compute.aio.operations.Operations.list": "Azure.ResourceManager.Legacy.Operations.list", "azure.mgmt.compute.operations.VirtualMachineScaleSetsOperations.get": "Microsoft.Compute.VirtualMachineScaleSets.get", @@ -677,16 +679,10 @@ "azure.mgmt.compute.aio.operations.VirtualMachineScaleSetsOperations.list_skus": "Microsoft.Compute.VirtualMachineScaleSets.listSkus", "azure.mgmt.compute.operations.VirtualMachineScaleSetsOperations.begin_start": "Microsoft.Compute.VirtualMachineScaleSets.start", "azure.mgmt.compute.aio.operations.VirtualMachineScaleSetsOperations.begin_start": "Microsoft.Compute.VirtualMachineScaleSets.start", - "azure.mgmt.compute.operations.VirtualMachineScaleSetsOperations.begin_start_extension_upgrade": "Microsoft.Compute.VirtualMachineScaleSets.startExtensionUpgrade", - "azure.mgmt.compute.aio.operations.VirtualMachineScaleSetsOperations.begin_start_extension_upgrade": "Microsoft.Compute.VirtualMachineScaleSets.startExtensionUpgrade", - "azure.mgmt.compute.operations.VirtualMachineScaleSetsOperations.begin_start_os_upgrade": "Microsoft.Compute.VirtualMachineScaleSets.startOSUpgrade", - "azure.mgmt.compute.aio.operations.VirtualMachineScaleSetsOperations.begin_start_os_upgrade": "Microsoft.Compute.VirtualMachineScaleSets.startOSUpgrade", - "azure.mgmt.compute.operations.VirtualMachineScaleSetsOperations.begin_cancel": "Microsoft.Compute.VirtualMachineScaleSets.cancel", - "azure.mgmt.compute.aio.operations.VirtualMachineScaleSetsOperations.begin_cancel": "Microsoft.Compute.VirtualMachineScaleSets.cancel", "azure.mgmt.compute.operations.VirtualMachineScaleSetsOperations.begin_scale_out": "Microsoft.Compute.VirtualMachineScaleSets.scaleOut", "azure.mgmt.compute.aio.operations.VirtualMachineScaleSetsOperations.begin_scale_out": "Microsoft.Compute.VirtualMachineScaleSets.scaleOut", - "azure.mgmt.compute.operations.RollingUpgradeStatusInfosOperations.get_latest": "Microsoft.Compute.RollingUpgradeStatusInfos.getLatest", - "azure.mgmt.compute.aio.operations.RollingUpgradeStatusInfosOperations.get_latest": "Microsoft.Compute.RollingUpgradeStatusInfos.getLatest", + "azure.mgmt.compute.operations.VirtualMachineScaleSetsOperations.list_by_location": "Microsoft.Compute.VirtualMachineScaleSetsOperationGroup.listByLocation", + "azure.mgmt.compute.aio.operations.VirtualMachineScaleSetsOperations.list_by_location": "Microsoft.Compute.VirtualMachineScaleSetsOperationGroup.listByLocation", "azure.mgmt.compute.operations.VirtualMachineScaleSetExtensionsOperations.get": "Microsoft.Compute.VirtualMachineScaleSetExtensions.get", "azure.mgmt.compute.aio.operations.VirtualMachineScaleSetExtensionsOperations.get": "Microsoft.Compute.VirtualMachineScaleSetExtensions.get", "azure.mgmt.compute.operations.VirtualMachineScaleSetExtensionsOperations.begin_create_or_update": "Microsoft.Compute.VirtualMachineScaleSetExtensions.createOrUpdate", @@ -697,42 +693,6 @@ "azure.mgmt.compute.aio.operations.VirtualMachineScaleSetExtensionsOperations.begin_delete": "Microsoft.Compute.VirtualMachineScaleSetExtensions.delete", "azure.mgmt.compute.operations.VirtualMachineScaleSetExtensionsOperations.list": "Microsoft.Compute.VirtualMachineScaleSetExtensions.list", "azure.mgmt.compute.aio.operations.VirtualMachineScaleSetExtensionsOperations.list": "Microsoft.Compute.VirtualMachineScaleSetExtensions.list", - "azure.mgmt.compute.operations.VirtualMachineScaleSetVMSOperations.get": "Microsoft.Compute.VirtualMachineScaleSetVMS.get", - "azure.mgmt.compute.aio.operations.VirtualMachineScaleSetVMSOperations.get": "Microsoft.Compute.VirtualMachineScaleSetVMS.get", - "azure.mgmt.compute.operations.VirtualMachineScaleSetVMSOperations.begin_update": "Microsoft.Compute.VirtualMachineScaleSetVMS.update", - "azure.mgmt.compute.aio.operations.VirtualMachineScaleSetVMSOperations.begin_update": "Microsoft.Compute.VirtualMachineScaleSetVMS.update", - "azure.mgmt.compute.operations.VirtualMachineScaleSetVMSOperations.begin_delete": "Microsoft.Compute.VirtualMachineScaleSetVMS.delete", - "azure.mgmt.compute.aio.operations.VirtualMachineScaleSetVMSOperations.begin_delete": "Microsoft.Compute.VirtualMachineScaleSetVMS.delete", - "azure.mgmt.compute.operations.VirtualMachineScaleSetVMSOperations.list": "Microsoft.Compute.VirtualMachineScaleSetVMS.list", - "azure.mgmt.compute.aio.operations.VirtualMachineScaleSetVMSOperations.list": "Microsoft.Compute.VirtualMachineScaleSetVMS.list", - "azure.mgmt.compute.operations.VirtualMachineScaleSetVMSOperations.begin_approve_rolling_upgrade": "Microsoft.Compute.VirtualMachineScaleSetVMS.approveRollingUpgrade", - "azure.mgmt.compute.aio.operations.VirtualMachineScaleSetVMSOperations.begin_approve_rolling_upgrade": "Microsoft.Compute.VirtualMachineScaleSetVMS.approveRollingUpgrade", - "azure.mgmt.compute.operations.VirtualMachineScaleSetVMSOperations.begin_deallocate": "Microsoft.Compute.VirtualMachineScaleSetVMS.deallocate", - "azure.mgmt.compute.aio.operations.VirtualMachineScaleSetVMSOperations.begin_deallocate": "Microsoft.Compute.VirtualMachineScaleSetVMS.deallocate", - "azure.mgmt.compute.operations.VirtualMachineScaleSetVMSOperations.get_instance_view": "Microsoft.Compute.VirtualMachineScaleSetVMS.getInstanceView", - "azure.mgmt.compute.aio.operations.VirtualMachineScaleSetVMSOperations.get_instance_view": "Microsoft.Compute.VirtualMachineScaleSetVMS.getInstanceView", - "azure.mgmt.compute.operations.VirtualMachineScaleSetVMSOperations.begin_reimage": "Microsoft.Compute.VirtualMachineScaleSetVMS.reimage", - "azure.mgmt.compute.aio.operations.VirtualMachineScaleSetVMSOperations.begin_reimage": "Microsoft.Compute.VirtualMachineScaleSetVMS.reimage", - "azure.mgmt.compute.operations.VirtualMachineScaleSetVMSOperations.begin_reimage_all": "Microsoft.Compute.VirtualMachineScaleSetVMS.reimageAll", - "azure.mgmt.compute.aio.operations.VirtualMachineScaleSetVMSOperations.begin_reimage_all": "Microsoft.Compute.VirtualMachineScaleSetVMS.reimageAll", - "azure.mgmt.compute.operations.VirtualMachineScaleSetVMSOperations.simulate_eviction": "Microsoft.Compute.VirtualMachineScaleSetVMS.simulateEviction", - "azure.mgmt.compute.aio.operations.VirtualMachineScaleSetVMSOperations.simulate_eviction": "Microsoft.Compute.VirtualMachineScaleSetVMS.simulateEviction", - "azure.mgmt.compute.operations.VirtualMachineScaleSetVMSOperations.begin_attach_detach_data_disks": "Microsoft.Compute.VirtualMachineScaleSetVMS.attachDetachDataDisks", - "azure.mgmt.compute.aio.operations.VirtualMachineScaleSetVMSOperations.begin_attach_detach_data_disks": "Microsoft.Compute.VirtualMachineScaleSetVMS.attachDetachDataDisks", - "azure.mgmt.compute.operations.VirtualMachineScaleSetVMSOperations.begin_perform_maintenance": "Microsoft.Compute.VirtualMachineScaleSetVMS.performMaintenance", - "azure.mgmt.compute.aio.operations.VirtualMachineScaleSetVMSOperations.begin_perform_maintenance": "Microsoft.Compute.VirtualMachineScaleSetVMS.performMaintenance", - "azure.mgmt.compute.operations.VirtualMachineScaleSetVMSOperations.begin_power_off": "Microsoft.Compute.VirtualMachineScaleSetVMS.powerOff", - "azure.mgmt.compute.aio.operations.VirtualMachineScaleSetVMSOperations.begin_power_off": "Microsoft.Compute.VirtualMachineScaleSetVMS.powerOff", - "azure.mgmt.compute.operations.VirtualMachineScaleSetVMSOperations.begin_redeploy": "Microsoft.Compute.VirtualMachineScaleSetVMS.redeploy", - "azure.mgmt.compute.aio.operations.VirtualMachineScaleSetVMSOperations.begin_redeploy": "Microsoft.Compute.VirtualMachineScaleSetVMS.redeploy", - "azure.mgmt.compute.operations.VirtualMachineScaleSetVMSOperations.begin_restart": "Microsoft.Compute.VirtualMachineScaleSetVMS.restart", - "azure.mgmt.compute.aio.operations.VirtualMachineScaleSetVMSOperations.begin_restart": "Microsoft.Compute.VirtualMachineScaleSetVMS.restart", - "azure.mgmt.compute.operations.VirtualMachineScaleSetVMSOperations.retrieve_boot_diagnostics_data": "Microsoft.Compute.VirtualMachineScaleSetVMS.retrieveBootDiagnosticsData", - "azure.mgmt.compute.aio.operations.VirtualMachineScaleSetVMSOperations.retrieve_boot_diagnostics_data": "Microsoft.Compute.VirtualMachineScaleSetVMS.retrieveBootDiagnosticsData", - "azure.mgmt.compute.operations.VirtualMachineScaleSetVMSOperations.begin_start": "Microsoft.Compute.VirtualMachineScaleSetVMS.start", - "azure.mgmt.compute.aio.operations.VirtualMachineScaleSetVMSOperations.begin_start": "Microsoft.Compute.VirtualMachineScaleSetVMS.start", - "azure.mgmt.compute.operations.VirtualMachineScaleSetVMSOperations.begin_run_command": "Microsoft.Compute.VirtualMachineScaleSetVMS.runCommand", - "azure.mgmt.compute.aio.operations.VirtualMachineScaleSetVMSOperations.begin_run_command": "Microsoft.Compute.VirtualMachineScaleSetVMS.runCommand", "azure.mgmt.compute.operations.VirtualMachineScaleSetVMExtensionsOperations.get": "Microsoft.Compute.VirtualMachineScaleSetVMExtensions.get", "azure.mgmt.compute.aio.operations.VirtualMachineScaleSetVMExtensionsOperations.get": "Microsoft.Compute.VirtualMachineScaleSetVMExtensions.get", "azure.mgmt.compute.operations.VirtualMachineScaleSetVMExtensionsOperations.begin_create_or_update": "Microsoft.Compute.VirtualMachineScaleSetVMExtensions.createOrUpdate", @@ -795,6 +755,8 @@ "azure.mgmt.compute.aio.operations.VirtualMachinesOperations.begin_run_command": "Microsoft.Compute.VirtualMachines.runCommand", "azure.mgmt.compute.operations.VirtualMachinesOperations.begin_migrate_to_vm_scale_set": "Microsoft.Compute.VirtualMachines.migrateToVMScaleSet", "azure.mgmt.compute.aio.operations.VirtualMachinesOperations.begin_migrate_to_vm_scale_set": "Microsoft.Compute.VirtualMachines.migrateToVMScaleSet", + "azure.mgmt.compute.operations.VirtualMachinesOperations.list_by_location": "Microsoft.Compute.VirtualMachinesOperationGroup.listByLocation", + "azure.mgmt.compute.aio.operations.VirtualMachinesOperations.list_by_location": "Microsoft.Compute.VirtualMachinesOperationGroup.listByLocation", "azure.mgmt.compute.operations.VirtualMachineExtensionsOperations.get": "Microsoft.Compute.VirtualMachineExtensions.get", "azure.mgmt.compute.aio.operations.VirtualMachineExtensionsOperations.get": "Microsoft.Compute.VirtualMachineExtensions.get", "azure.mgmt.compute.operations.VirtualMachineExtensionsOperations.begin_create_or_update": "Microsoft.Compute.VirtualMachineExtensions.createOrUpdate", @@ -873,20 +835,6 @@ "azure.mgmt.compute.aio.operations.DedicatedHostsOperations.begin_redeploy": "Microsoft.Compute.DedicatedHosts.redeploy", "azure.mgmt.compute.operations.DedicatedHostsOperations.begin_restart": "Microsoft.Compute.DedicatedHosts.restart", "azure.mgmt.compute.aio.operations.DedicatedHostsOperations.begin_restart": "Microsoft.Compute.DedicatedHosts.restart", - "azure.mgmt.compute.operations.SshPublicKeyResourcesOperations.get": "Microsoft.Compute.SshPublicKeyResources.get", - "azure.mgmt.compute.aio.operations.SshPublicKeyResourcesOperations.get": "Microsoft.Compute.SshPublicKeyResources.get", - "azure.mgmt.compute.operations.SshPublicKeyResourcesOperations.create": "Microsoft.Compute.SshPublicKeyResources.create", - "azure.mgmt.compute.aio.operations.SshPublicKeyResourcesOperations.create": "Microsoft.Compute.SshPublicKeyResources.create", - "azure.mgmt.compute.operations.SshPublicKeyResourcesOperations.update": "Microsoft.Compute.SshPublicKeyResources.update", - "azure.mgmt.compute.aio.operations.SshPublicKeyResourcesOperations.update": "Microsoft.Compute.SshPublicKeyResources.update", - "azure.mgmt.compute.operations.SshPublicKeyResourcesOperations.delete": "Microsoft.Compute.SshPublicKeyResources.delete", - "azure.mgmt.compute.aio.operations.SshPublicKeyResourcesOperations.delete": "Microsoft.Compute.SshPublicKeyResources.delete", - "azure.mgmt.compute.operations.SshPublicKeyResourcesOperations.list_by_resource_group": "Microsoft.Compute.SshPublicKeyResources.listByResourceGroup", - "azure.mgmt.compute.aio.operations.SshPublicKeyResourcesOperations.list_by_resource_group": "Microsoft.Compute.SshPublicKeyResources.listByResourceGroup", - "azure.mgmt.compute.operations.SshPublicKeyResourcesOperations.list_by_subscription": "Microsoft.Compute.SshPublicKeyResources.listBySubscription", - "azure.mgmt.compute.aio.operations.SshPublicKeyResourcesOperations.list_by_subscription": "Microsoft.Compute.SshPublicKeyResources.listBySubscription", - "azure.mgmt.compute.operations.SshPublicKeyResourcesOperations.generate_key_pair": "Microsoft.Compute.SshPublicKeyResources.generateKeyPair", - "azure.mgmt.compute.aio.operations.SshPublicKeyResourcesOperations.generate_key_pair": "Microsoft.Compute.SshPublicKeyResources.generateKeyPair", "azure.mgmt.compute.operations.ImagesOperations.get": "Microsoft.Compute.Images.get", "azure.mgmt.compute.aio.operations.ImagesOperations.get": "Microsoft.Compute.Images.get", "azure.mgmt.compute.operations.ImagesOperations.begin_create_or_update": "Microsoft.Compute.Images.createOrUpdate", @@ -949,6 +897,10 @@ "azure.mgmt.compute.aio.operations.VirtualMachineRunCommandsOperations.begin_delete": "Microsoft.Compute.VirtualMachineRunCommands.delete", "azure.mgmt.compute.operations.VirtualMachineRunCommandsOperations.list_by_virtual_machine": "Microsoft.Compute.VirtualMachineRunCommands.listByVirtualMachine", "azure.mgmt.compute.aio.operations.VirtualMachineRunCommandsOperations.list_by_virtual_machine": "Microsoft.Compute.VirtualMachineRunCommands.listByVirtualMachine", + "azure.mgmt.compute.operations.VirtualMachineRunCommandsOperations.list": "Microsoft.Compute.VirtualMachineRunCommandsOperationGroup.list", + "azure.mgmt.compute.aio.operations.VirtualMachineRunCommandsOperations.list": "Microsoft.Compute.VirtualMachineRunCommandsOperationGroup.list", + "azure.mgmt.compute.operations.VirtualMachineRunCommandsOperations.get": "Microsoft.Compute.VirtualMachineRunCommandsOperationGroup.get", + "azure.mgmt.compute.aio.operations.VirtualMachineRunCommandsOperations.get": "Microsoft.Compute.VirtualMachineRunCommandsOperationGroup.get", "azure.mgmt.compute.operations.VirtualMachineScaleSetVMRunCommandsOperations.get": "Microsoft.Compute.VirtualMachineScaleSetVMRunCommands.get", "azure.mgmt.compute.aio.operations.VirtualMachineScaleSetVMRunCommandsOperations.get": "Microsoft.Compute.VirtualMachineScaleSetVMRunCommands.get", "azure.mgmt.compute.operations.VirtualMachineScaleSetVMRunCommandsOperations.begin_create_or_update": "Microsoft.Compute.VirtualMachineScaleSetVMRunCommands.createOrUpdate", @@ -959,46 +911,6 @@ "azure.mgmt.compute.aio.operations.VirtualMachineScaleSetVMRunCommandsOperations.begin_delete": "Microsoft.Compute.VirtualMachineScaleSetVMRunCommands.delete", "azure.mgmt.compute.operations.VirtualMachineScaleSetVMRunCommandsOperations.list": "Microsoft.Compute.VirtualMachineScaleSetVMRunCommands.list", "azure.mgmt.compute.aio.operations.VirtualMachineScaleSetVMRunCommandsOperations.list": "Microsoft.Compute.VirtualMachineScaleSetVMRunCommands.list", - "azure.mgmt.compute.operations.UsageOperationGroupOperations.list": "Microsoft.Compute.UsageOperationGroup.list", - "azure.mgmt.compute.aio.operations.UsageOperationGroupOperations.list": "Microsoft.Compute.UsageOperationGroup.list", - "azure.mgmt.compute.operations.VirtualMachineSizesOperationGroupOperations.list": "Microsoft.Compute.VirtualMachineSizesOperationGroup.list", - "azure.mgmt.compute.aio.operations.VirtualMachineSizesOperationGroupOperations.list": "Microsoft.Compute.VirtualMachineSizesOperationGroup.list", - "azure.mgmt.compute.operations.VirtualMachineScaleSetsOperationGroupOperations.list_by_location": "Microsoft.Compute.VirtualMachineScaleSetsOperationGroup.listByLocation", - "azure.mgmt.compute.aio.operations.VirtualMachineScaleSetsOperationGroupOperations.list_by_location": "Microsoft.Compute.VirtualMachineScaleSetsOperationGroup.listByLocation", - "azure.mgmt.compute.operations.VirtualMachinesOperationGroupOperations.list_by_location": "Microsoft.Compute.VirtualMachinesOperationGroup.listByLocation", - "azure.mgmt.compute.aio.operations.VirtualMachinesOperationGroupOperations.list_by_location": "Microsoft.Compute.VirtualMachinesOperationGroup.listByLocation", - "azure.mgmt.compute.operations.VirtualMachineImagesEdgeZoneOperationGroupOperations.list_publishers": "Microsoft.Compute.VirtualMachineImagesEdgeZoneOperationGroup.listPublishers", - "azure.mgmt.compute.aio.operations.VirtualMachineImagesEdgeZoneOperationGroupOperations.list_publishers": "Microsoft.Compute.VirtualMachineImagesEdgeZoneOperationGroup.listPublishers", - "azure.mgmt.compute.operations.VirtualMachineImagesEdgeZoneOperationGroupOperations.list_offers": "Microsoft.Compute.VirtualMachineImagesEdgeZoneOperationGroup.listOffers", - "azure.mgmt.compute.aio.operations.VirtualMachineImagesEdgeZoneOperationGroupOperations.list_offers": "Microsoft.Compute.VirtualMachineImagesEdgeZoneOperationGroup.listOffers", - "azure.mgmt.compute.operations.VirtualMachineImagesEdgeZoneOperationGroupOperations.list_skus": "Microsoft.Compute.VirtualMachineImagesEdgeZoneOperationGroup.listSkus", - "azure.mgmt.compute.aio.operations.VirtualMachineImagesEdgeZoneOperationGroupOperations.list_skus": "Microsoft.Compute.VirtualMachineImagesEdgeZoneOperationGroup.listSkus", - "azure.mgmt.compute.operations.VirtualMachineImagesEdgeZoneOperationGroupOperations.list": "Microsoft.Compute.VirtualMachineImagesEdgeZoneOperationGroup.list", - "azure.mgmt.compute.aio.operations.VirtualMachineImagesEdgeZoneOperationGroupOperations.list": "Microsoft.Compute.VirtualMachineImagesEdgeZoneOperationGroup.list", - "azure.mgmt.compute.operations.VirtualMachineImagesEdgeZoneOperationGroupOperations.get": "Microsoft.Compute.VirtualMachineImagesEdgeZoneOperationGroup.get", - "azure.mgmt.compute.aio.operations.VirtualMachineImagesEdgeZoneOperationGroupOperations.get": "Microsoft.Compute.VirtualMachineImagesEdgeZoneOperationGroup.get", - "azure.mgmt.compute.operations.VirtualMachineImagesOperationGroupOperations.list_by_edge_zone": "Microsoft.Compute.VirtualMachineImagesOperationGroup.listByEdgeZone", - "azure.mgmt.compute.aio.operations.VirtualMachineImagesOperationGroupOperations.list_by_edge_zone": "Microsoft.Compute.VirtualMachineImagesOperationGroup.listByEdgeZone", - "azure.mgmt.compute.operations.VirtualMachineImagesOperationGroupOperations.list_publishers": "Microsoft.Compute.VirtualMachineImagesOperationGroup.listPublishers", - "azure.mgmt.compute.aio.operations.VirtualMachineImagesOperationGroupOperations.list_publishers": "Microsoft.Compute.VirtualMachineImagesOperationGroup.listPublishers", - "azure.mgmt.compute.operations.VirtualMachineImagesOperationGroupOperations.list_offers": "Microsoft.Compute.VirtualMachineImagesOperationGroup.listOffers", - "azure.mgmt.compute.aio.operations.VirtualMachineImagesOperationGroupOperations.list_offers": "Microsoft.Compute.VirtualMachineImagesOperationGroup.listOffers", - "azure.mgmt.compute.operations.VirtualMachineImagesOperationGroupOperations.list_skus": "Microsoft.Compute.VirtualMachineImagesOperationGroup.listSkus", - "azure.mgmt.compute.aio.operations.VirtualMachineImagesOperationGroupOperations.list_skus": "Microsoft.Compute.VirtualMachineImagesOperationGroup.listSkus", - "azure.mgmt.compute.operations.VirtualMachineImagesOperationGroupOperations.list": "Microsoft.Compute.VirtualMachineImagesOperationGroup.list", - "azure.mgmt.compute.aio.operations.VirtualMachineImagesOperationGroupOperations.list": "Microsoft.Compute.VirtualMachineImagesOperationGroup.list", - "azure.mgmt.compute.operations.VirtualMachineImagesOperationGroupOperations.list_with_properties": "Microsoft.Compute.VirtualMachineImagesOperationGroup.listWithProperties", - "azure.mgmt.compute.aio.operations.VirtualMachineImagesOperationGroupOperations.list_with_properties": "Microsoft.Compute.VirtualMachineImagesOperationGroup.listWithProperties", - "azure.mgmt.compute.operations.VirtualMachineImagesOperationGroupOperations.get": "Microsoft.Compute.VirtualMachineImagesOperationGroup.get", - "azure.mgmt.compute.aio.operations.VirtualMachineImagesOperationGroupOperations.get": "Microsoft.Compute.VirtualMachineImagesOperationGroup.get", - "azure.mgmt.compute.operations.LogAnalyticsOperationGroupOperations.begin_export_request_rate_by_interval": "Microsoft.Compute.LogAnalyticsOperationGroup.exportRequestRateByInterval", - "azure.mgmt.compute.aio.operations.LogAnalyticsOperationGroupOperations.begin_export_request_rate_by_interval": "Microsoft.Compute.LogAnalyticsOperationGroup.exportRequestRateByInterval", - "azure.mgmt.compute.operations.LogAnalyticsOperationGroupOperations.begin_export_throttled_requests": "Microsoft.Compute.LogAnalyticsOperationGroup.exportThrottledRequests", - "azure.mgmt.compute.aio.operations.LogAnalyticsOperationGroupOperations.begin_export_throttled_requests": "Microsoft.Compute.LogAnalyticsOperationGroup.exportThrottledRequests", - "azure.mgmt.compute.operations.VirtualMachineRunCommandsOperationGroupOperations.list": "Microsoft.Compute.VirtualMachineRunCommandsOperationGroup.list", - "azure.mgmt.compute.aio.operations.VirtualMachineRunCommandsOperationGroupOperations.list": "Microsoft.Compute.VirtualMachineRunCommandsOperationGroup.list", - "azure.mgmt.compute.operations.VirtualMachineRunCommandsOperationGroupOperations.get": "Microsoft.Compute.VirtualMachineRunCommandsOperationGroup.get", - "azure.mgmt.compute.aio.operations.VirtualMachineRunCommandsOperationGroupOperations.get": "Microsoft.Compute.VirtualMachineRunCommandsOperationGroup.get", "azure.mgmt.compute.operations.DisksOperations.get": "Microsoft.Compute.Disks.get", "azure.mgmt.compute.aio.operations.DisksOperations.get": "Microsoft.Compute.Disks.get", "azure.mgmt.compute.operations.DisksOperations.begin_create_or_update": "Microsoft.Compute.Disks.createOrUpdate", @@ -1029,14 +941,14 @@ "azure.mgmt.compute.aio.operations.DiskAccessesOperations.list": "Microsoft.Compute.DiskAccesses.list", "azure.mgmt.compute.operations.DiskAccessesOperations.get_private_link_resources": "Microsoft.Compute.DiskAccesses.getPrivateLinkResources", "azure.mgmt.compute.aio.operations.DiskAccessesOperations.get_private_link_resources": "Microsoft.Compute.DiskAccesses.getPrivateLinkResources", - "azure.mgmt.compute.operations.PrivateEndpointConnectionsOperations.get_a_private_endpoint_connection": "Microsoft.Compute.PrivateEndpointConnections.getAPrivateEndpointConnection", - "azure.mgmt.compute.aio.operations.PrivateEndpointConnectionsOperations.get_a_private_endpoint_connection": "Microsoft.Compute.PrivateEndpointConnections.getAPrivateEndpointConnection", - "azure.mgmt.compute.operations.PrivateEndpointConnectionsOperations.begin_update_a_private_endpoint_connection": "Microsoft.Compute.PrivateEndpointConnections.updateAPrivateEndpointConnection", - "azure.mgmt.compute.aio.operations.PrivateEndpointConnectionsOperations.begin_update_a_private_endpoint_connection": "Microsoft.Compute.PrivateEndpointConnections.updateAPrivateEndpointConnection", - "azure.mgmt.compute.operations.PrivateEndpointConnectionsOperations.begin_delete_a_private_endpoint_connection": "Microsoft.Compute.PrivateEndpointConnections.deleteAPrivateEndpointConnection", - "azure.mgmt.compute.aio.operations.PrivateEndpointConnectionsOperations.begin_delete_a_private_endpoint_connection": "Microsoft.Compute.PrivateEndpointConnections.deleteAPrivateEndpointConnection", - "azure.mgmt.compute.operations.PrivateEndpointConnectionsOperations.list_private_endpoint_connections": "Microsoft.Compute.PrivateEndpointConnections.listPrivateEndpointConnections", - "azure.mgmt.compute.aio.operations.PrivateEndpointConnectionsOperations.list_private_endpoint_connections": "Microsoft.Compute.PrivateEndpointConnections.listPrivateEndpointConnections", + "azure.mgmt.compute.operations.DiskAccessesOperations.get_a_private_endpoint_connection": "Microsoft.Compute.PrivateEndpointConnections.getAPrivateEndpointConnection", + "azure.mgmt.compute.aio.operations.DiskAccessesOperations.get_a_private_endpoint_connection": "Microsoft.Compute.PrivateEndpointConnections.getAPrivateEndpointConnection", + "azure.mgmt.compute.operations.DiskAccessesOperations.begin_update_a_private_endpoint_connection": "Microsoft.Compute.PrivateEndpointConnections.updateAPrivateEndpointConnection", + "azure.mgmt.compute.aio.operations.DiskAccessesOperations.begin_update_a_private_endpoint_connection": "Microsoft.Compute.PrivateEndpointConnections.updateAPrivateEndpointConnection", + "azure.mgmt.compute.operations.DiskAccessesOperations.begin_delete_a_private_endpoint_connection": "Microsoft.Compute.PrivateEndpointConnections.deleteAPrivateEndpointConnection", + "azure.mgmt.compute.aio.operations.DiskAccessesOperations.begin_delete_a_private_endpoint_connection": "Microsoft.Compute.PrivateEndpointConnections.deleteAPrivateEndpointConnection", + "azure.mgmt.compute.operations.DiskAccessesOperations.list_private_endpoint_connections": "Microsoft.Compute.PrivateEndpointConnections.listPrivateEndpointConnections", + "azure.mgmt.compute.aio.operations.DiskAccessesOperations.list_private_endpoint_connections": "Microsoft.Compute.PrivateEndpointConnections.listPrivateEndpointConnections", "azure.mgmt.compute.operations.DiskEncryptionSetsOperations.get": "Microsoft.Compute.DiskEncryptionSets.get", "azure.mgmt.compute.aio.operations.DiskEncryptionSetsOperations.get": "Microsoft.Compute.DiskEncryptionSets.get", "azure.mgmt.compute.operations.DiskEncryptionSetsOperations.begin_create_or_update": "Microsoft.Compute.DiskEncryptionSets.createOrUpdate", @@ -1079,10 +991,6 @@ "azure.mgmt.compute.aio.operations.GalleriesOperations.list_by_resource_group": "Microsoft.Compute.Galleries.listByResourceGroup", "azure.mgmt.compute.operations.GalleriesOperations.list": "Microsoft.Compute.Galleries.list", "azure.mgmt.compute.aio.operations.GalleriesOperations.list": "Microsoft.Compute.Galleries.list", - "azure.mgmt.compute.operations.GalleriesOperations.list_by_artifact_name": "Microsoft.Compute.Galleries.listByArtifactName", - "azure.mgmt.compute.aio.operations.GalleriesOperations.list_by_artifact_name": "Microsoft.Compute.Galleries.listByArtifactName", - "azure.mgmt.compute.operations.GalleriesOperations.begin_gallery_sharing_profile_update": "Microsoft.Compute.Galleries.gallerySharingProfileUpdate", - "azure.mgmt.compute.aio.operations.GalleriesOperations.begin_gallery_sharing_profile_update": "Microsoft.Compute.Galleries.gallerySharingProfileUpdate", "azure.mgmt.compute.operations.GalleryImagesOperations.get": "Microsoft.Compute.GalleryImages.get", "azure.mgmt.compute.aio.operations.GalleryImagesOperations.get": "Microsoft.Compute.GalleryImages.get", "azure.mgmt.compute.operations.GalleryImagesOperations.begin_create_or_update": "Microsoft.Compute.GalleryImages.createOrUpdate", @@ -1167,6 +1075,96 @@ "azure.mgmt.compute.aio.operations.CommunityGalleryImageVersionsOperations.list": "Microsoft.Compute.CommunityGalleryImageVersions.list", "azure.mgmt.compute.operations.ResourceSkusOperations.list": "Microsoft.Compute.ResourceSkus.list", "azure.mgmt.compute.aio.operations.ResourceSkusOperations.list": "Microsoft.Compute.ResourceSkus.list", + "azure.mgmt.compute.operations.VirtualMachineScaleSetRollingUpgradesOperations.begin_start_extension_upgrade": "Microsoft.Compute.VirtualMachineScaleSets.startExtensionUpgrade", + "azure.mgmt.compute.aio.operations.VirtualMachineScaleSetRollingUpgradesOperations.begin_start_extension_upgrade": "Microsoft.Compute.VirtualMachineScaleSets.startExtensionUpgrade", + "azure.mgmt.compute.operations.VirtualMachineScaleSetRollingUpgradesOperations.begin_start_os_upgrade": "Microsoft.Compute.VirtualMachineScaleSets.startOSUpgrade", + "azure.mgmt.compute.aio.operations.VirtualMachineScaleSetRollingUpgradesOperations.begin_start_os_upgrade": "Microsoft.Compute.VirtualMachineScaleSets.startOSUpgrade", + "azure.mgmt.compute.operations.VirtualMachineScaleSetRollingUpgradesOperations.begin_cancel": "Microsoft.Compute.VirtualMachineScaleSets.cancel", + "azure.mgmt.compute.aio.operations.VirtualMachineScaleSetRollingUpgradesOperations.begin_cancel": "Microsoft.Compute.VirtualMachineScaleSets.cancel", + "azure.mgmt.compute.operations.VirtualMachineScaleSetRollingUpgradesOperations.get_latest": "Microsoft.Compute.RollingUpgradeStatusInfos.getLatest", + "azure.mgmt.compute.aio.operations.VirtualMachineScaleSetRollingUpgradesOperations.get_latest": "Microsoft.Compute.RollingUpgradeStatusInfos.getLatest", + "azure.mgmt.compute.operations.VirtualMachineScaleSetVMsOperations.get": "Microsoft.Compute.VirtualMachineScaleSetVMS.get", + "azure.mgmt.compute.aio.operations.VirtualMachineScaleSetVMsOperations.get": "Microsoft.Compute.VirtualMachineScaleSetVMS.get", + "azure.mgmt.compute.operations.VirtualMachineScaleSetVMsOperations.begin_update": "Microsoft.Compute.VirtualMachineScaleSetVMS.update", + "azure.mgmt.compute.aio.operations.VirtualMachineScaleSetVMsOperations.begin_update": "Microsoft.Compute.VirtualMachineScaleSetVMS.update", + "azure.mgmt.compute.operations.VirtualMachineScaleSetVMsOperations.begin_delete": "Microsoft.Compute.VirtualMachineScaleSetVMS.delete", + "azure.mgmt.compute.aio.operations.VirtualMachineScaleSetVMsOperations.begin_delete": "Microsoft.Compute.VirtualMachineScaleSetVMS.delete", + "azure.mgmt.compute.operations.VirtualMachineScaleSetVMsOperations.list": "Microsoft.Compute.VirtualMachineScaleSetVMS.list", + "azure.mgmt.compute.aio.operations.VirtualMachineScaleSetVMsOperations.list": "Microsoft.Compute.VirtualMachineScaleSetVMS.list", + "azure.mgmt.compute.operations.VirtualMachineScaleSetVMsOperations.begin_approve_rolling_upgrade": "Microsoft.Compute.VirtualMachineScaleSetVMS.approveRollingUpgrade", + "azure.mgmt.compute.aio.operations.VirtualMachineScaleSetVMsOperations.begin_approve_rolling_upgrade": "Microsoft.Compute.VirtualMachineScaleSetVMS.approveRollingUpgrade", + "azure.mgmt.compute.operations.VirtualMachineScaleSetVMsOperations.begin_deallocate": "Microsoft.Compute.VirtualMachineScaleSetVMS.deallocate", + "azure.mgmt.compute.aio.operations.VirtualMachineScaleSetVMsOperations.begin_deallocate": "Microsoft.Compute.VirtualMachineScaleSetVMS.deallocate", + "azure.mgmt.compute.operations.VirtualMachineScaleSetVMsOperations.get_instance_view": "Microsoft.Compute.VirtualMachineScaleSetVMS.getInstanceView", + "azure.mgmt.compute.aio.operations.VirtualMachineScaleSetVMsOperations.get_instance_view": "Microsoft.Compute.VirtualMachineScaleSetVMS.getInstanceView", + "azure.mgmt.compute.operations.VirtualMachineScaleSetVMsOperations.begin_reimage": "Microsoft.Compute.VirtualMachineScaleSetVMS.reimage", + "azure.mgmt.compute.aio.operations.VirtualMachineScaleSetVMsOperations.begin_reimage": "Microsoft.Compute.VirtualMachineScaleSetVMS.reimage", + "azure.mgmt.compute.operations.VirtualMachineScaleSetVMsOperations.begin_reimage_all": "Microsoft.Compute.VirtualMachineScaleSetVMS.reimageAll", + "azure.mgmt.compute.aio.operations.VirtualMachineScaleSetVMsOperations.begin_reimage_all": "Microsoft.Compute.VirtualMachineScaleSetVMS.reimageAll", + "azure.mgmt.compute.operations.VirtualMachineScaleSetVMsOperations.simulate_eviction": "Microsoft.Compute.VirtualMachineScaleSetVMS.simulateEviction", + "azure.mgmt.compute.aio.operations.VirtualMachineScaleSetVMsOperations.simulate_eviction": "Microsoft.Compute.VirtualMachineScaleSetVMS.simulateEviction", + "azure.mgmt.compute.operations.VirtualMachineScaleSetVMsOperations.begin_attach_detach_data_disks": "Microsoft.Compute.VirtualMachineScaleSetVMS.attachDetachDataDisks", + "azure.mgmt.compute.aio.operations.VirtualMachineScaleSetVMsOperations.begin_attach_detach_data_disks": "Microsoft.Compute.VirtualMachineScaleSetVMS.attachDetachDataDisks", + "azure.mgmt.compute.operations.VirtualMachineScaleSetVMsOperations.begin_perform_maintenance": "Microsoft.Compute.VirtualMachineScaleSetVMS.performMaintenance", + "azure.mgmt.compute.aio.operations.VirtualMachineScaleSetVMsOperations.begin_perform_maintenance": "Microsoft.Compute.VirtualMachineScaleSetVMS.performMaintenance", + "azure.mgmt.compute.operations.VirtualMachineScaleSetVMsOperations.begin_power_off": "Microsoft.Compute.VirtualMachineScaleSetVMS.powerOff", + "azure.mgmt.compute.aio.operations.VirtualMachineScaleSetVMsOperations.begin_power_off": "Microsoft.Compute.VirtualMachineScaleSetVMS.powerOff", + "azure.mgmt.compute.operations.VirtualMachineScaleSetVMsOperations.begin_redeploy": "Microsoft.Compute.VirtualMachineScaleSetVMS.redeploy", + "azure.mgmt.compute.aio.operations.VirtualMachineScaleSetVMsOperations.begin_redeploy": "Microsoft.Compute.VirtualMachineScaleSetVMS.redeploy", + "azure.mgmt.compute.operations.VirtualMachineScaleSetVMsOperations.begin_restart": "Microsoft.Compute.VirtualMachineScaleSetVMS.restart", + "azure.mgmt.compute.aio.operations.VirtualMachineScaleSetVMsOperations.begin_restart": "Microsoft.Compute.VirtualMachineScaleSetVMS.restart", + "azure.mgmt.compute.operations.VirtualMachineScaleSetVMsOperations.retrieve_boot_diagnostics_data": "Microsoft.Compute.VirtualMachineScaleSetVMS.retrieveBootDiagnosticsData", + "azure.mgmt.compute.aio.operations.VirtualMachineScaleSetVMsOperations.retrieve_boot_diagnostics_data": "Microsoft.Compute.VirtualMachineScaleSetVMS.retrieveBootDiagnosticsData", + "azure.mgmt.compute.operations.VirtualMachineScaleSetVMsOperations.begin_start": "Microsoft.Compute.VirtualMachineScaleSetVMS.start", + "azure.mgmt.compute.aio.operations.VirtualMachineScaleSetVMsOperations.begin_start": "Microsoft.Compute.VirtualMachineScaleSetVMS.start", + "azure.mgmt.compute.operations.VirtualMachineScaleSetVMsOperations.begin_run_command": "Microsoft.Compute.VirtualMachineScaleSetVMS.runCommand", + "azure.mgmt.compute.aio.operations.VirtualMachineScaleSetVMsOperations.begin_run_command": "Microsoft.Compute.VirtualMachineScaleSetVMS.runCommand", + "azure.mgmt.compute.operations.SshPublicKeysOperations.get": "Microsoft.Compute.SshPublicKeyResources.get", + "azure.mgmt.compute.aio.operations.SshPublicKeysOperations.get": "Microsoft.Compute.SshPublicKeyResources.get", + "azure.mgmt.compute.operations.SshPublicKeysOperations.create": "Microsoft.Compute.SshPublicKeyResources.create", + "azure.mgmt.compute.aio.operations.SshPublicKeysOperations.create": "Microsoft.Compute.SshPublicKeyResources.create", + "azure.mgmt.compute.operations.SshPublicKeysOperations.update": "Microsoft.Compute.SshPublicKeyResources.update", + "azure.mgmt.compute.aio.operations.SshPublicKeysOperations.update": "Microsoft.Compute.SshPublicKeyResources.update", + "azure.mgmt.compute.operations.SshPublicKeysOperations.delete": "Microsoft.Compute.SshPublicKeyResources.delete", + "azure.mgmt.compute.aio.operations.SshPublicKeysOperations.delete": "Microsoft.Compute.SshPublicKeyResources.delete", + "azure.mgmt.compute.operations.SshPublicKeysOperations.list_by_resource_group": "Microsoft.Compute.SshPublicKeyResources.listByResourceGroup", + "azure.mgmt.compute.aio.operations.SshPublicKeysOperations.list_by_resource_group": "Microsoft.Compute.SshPublicKeyResources.listByResourceGroup", + "azure.mgmt.compute.operations.SshPublicKeysOperations.list_by_subscription": "Microsoft.Compute.SshPublicKeyResources.listBySubscription", + "azure.mgmt.compute.aio.operations.SshPublicKeysOperations.list_by_subscription": "Microsoft.Compute.SshPublicKeyResources.listBySubscription", + "azure.mgmt.compute.operations.SshPublicKeysOperations.generate_key_pair": "Microsoft.Compute.SshPublicKeyResources.generateKeyPair", + "azure.mgmt.compute.aio.operations.SshPublicKeysOperations.generate_key_pair": "Microsoft.Compute.SshPublicKeyResources.generateKeyPair", + "azure.mgmt.compute.operations.UsageOperations.list": "Microsoft.Compute.UsageOperationGroup.list", + "azure.mgmt.compute.aio.operations.UsageOperations.list": "Microsoft.Compute.UsageOperationGroup.list", + "azure.mgmt.compute.operations.VirtualMachineSizesOperations.list": "Microsoft.Compute.VirtualMachineSizesOperationGroup.list", + "azure.mgmt.compute.aio.operations.VirtualMachineSizesOperations.list": "Microsoft.Compute.VirtualMachineSizesOperationGroup.list", + "azure.mgmt.compute.operations.VirtualMachineImagesEdgeZoneOperations.list_publishers": "Microsoft.Compute.VirtualMachineImagesEdgeZoneOperationGroup.listPublishers", + "azure.mgmt.compute.aio.operations.VirtualMachineImagesEdgeZoneOperations.list_publishers": "Microsoft.Compute.VirtualMachineImagesEdgeZoneOperationGroup.listPublishers", + "azure.mgmt.compute.operations.VirtualMachineImagesEdgeZoneOperations.list_offers": "Microsoft.Compute.VirtualMachineImagesEdgeZoneOperationGroup.listOffers", + "azure.mgmt.compute.aio.operations.VirtualMachineImagesEdgeZoneOperations.list_offers": "Microsoft.Compute.VirtualMachineImagesEdgeZoneOperationGroup.listOffers", + "azure.mgmt.compute.operations.VirtualMachineImagesEdgeZoneOperations.list_skus": "Microsoft.Compute.VirtualMachineImagesEdgeZoneOperationGroup.listSkus", + "azure.mgmt.compute.aio.operations.VirtualMachineImagesEdgeZoneOperations.list_skus": "Microsoft.Compute.VirtualMachineImagesEdgeZoneOperationGroup.listSkus", + "azure.mgmt.compute.operations.VirtualMachineImagesEdgeZoneOperations.list": "Microsoft.Compute.VirtualMachineImagesEdgeZoneOperationGroup.list", + "azure.mgmt.compute.aio.operations.VirtualMachineImagesEdgeZoneOperations.list": "Microsoft.Compute.VirtualMachineImagesEdgeZoneOperationGroup.list", + "azure.mgmt.compute.operations.VirtualMachineImagesEdgeZoneOperations.get": "Microsoft.Compute.VirtualMachineImagesEdgeZoneOperationGroup.get", + "azure.mgmt.compute.aio.operations.VirtualMachineImagesEdgeZoneOperations.get": "Microsoft.Compute.VirtualMachineImagesEdgeZoneOperationGroup.get", + "azure.mgmt.compute.operations.VirtualMachineImagesOperations.list_by_edge_zone": "Microsoft.Compute.VirtualMachineImagesOperationGroup.listByEdgeZone", + "azure.mgmt.compute.aio.operations.VirtualMachineImagesOperations.list_by_edge_zone": "Microsoft.Compute.VirtualMachineImagesOperationGroup.listByEdgeZone", + "azure.mgmt.compute.operations.VirtualMachineImagesOperations.list_publishers": "Microsoft.Compute.VirtualMachineImagesOperationGroup.listPublishers", + "azure.mgmt.compute.aio.operations.VirtualMachineImagesOperations.list_publishers": "Microsoft.Compute.VirtualMachineImagesOperationGroup.listPublishers", + "azure.mgmt.compute.operations.VirtualMachineImagesOperations.list_offers": "Microsoft.Compute.VirtualMachineImagesOperationGroup.listOffers", + "azure.mgmt.compute.aio.operations.VirtualMachineImagesOperations.list_offers": "Microsoft.Compute.VirtualMachineImagesOperationGroup.listOffers", + "azure.mgmt.compute.operations.VirtualMachineImagesOperations.list_skus": "Microsoft.Compute.VirtualMachineImagesOperationGroup.listSkus", + "azure.mgmt.compute.aio.operations.VirtualMachineImagesOperations.list_skus": "Microsoft.Compute.VirtualMachineImagesOperationGroup.listSkus", + "azure.mgmt.compute.operations.VirtualMachineImagesOperations.list": "Microsoft.Compute.VirtualMachineImagesOperationGroup.list", + "azure.mgmt.compute.aio.operations.VirtualMachineImagesOperations.list": "Microsoft.Compute.VirtualMachineImagesOperationGroup.list", + "azure.mgmt.compute.operations.VirtualMachineImagesOperations.list_with_properties": "Microsoft.Compute.VirtualMachineImagesOperationGroup.listWithProperties", + "azure.mgmt.compute.aio.operations.VirtualMachineImagesOperations.list_with_properties": "Microsoft.Compute.VirtualMachineImagesOperationGroup.listWithProperties", + "azure.mgmt.compute.operations.VirtualMachineImagesOperations.get": "Microsoft.Compute.VirtualMachineImagesOperationGroup.get", + "azure.mgmt.compute.aio.operations.VirtualMachineImagesOperations.get": "Microsoft.Compute.VirtualMachineImagesOperationGroup.get", + "azure.mgmt.compute.operations.LogAnalyticsOperations.begin_export_request_rate_by_interval": "Microsoft.Compute.LogAnalyticsOperationGroup.exportRequestRateByInterval", + "azure.mgmt.compute.aio.operations.LogAnalyticsOperations.begin_export_request_rate_by_interval": "Microsoft.Compute.LogAnalyticsOperationGroup.exportRequestRateByInterval", + "azure.mgmt.compute.operations.LogAnalyticsOperations.begin_export_throttled_requests": "Microsoft.Compute.LogAnalyticsOperationGroup.exportThrottledRequests", + "azure.mgmt.compute.aio.operations.LogAnalyticsOperations.begin_export_throttled_requests": "Microsoft.Compute.LogAnalyticsOperationGroup.exportThrottledRequests", "azure.mgmt.compute.operations.DiskRestorePointOperations.get": "Microsoft.Compute.DiskRestorePoints.get", "azure.mgmt.compute.aio.operations.DiskRestorePointOperations.get": "Microsoft.Compute.DiskRestorePoints.get", "azure.mgmt.compute.operations.DiskRestorePointOperations.list_by_restore_point": "Microsoft.Compute.DiskRestorePoints.listByRestorePoint", @@ -1174,6 +1172,10 @@ "azure.mgmt.compute.operations.DiskRestorePointOperations.begin_grant_access": "Microsoft.Compute.DiskRestorePoints.grantAccess", "azure.mgmt.compute.aio.operations.DiskRestorePointOperations.begin_grant_access": "Microsoft.Compute.DiskRestorePoints.grantAccess", "azure.mgmt.compute.operations.DiskRestorePointOperations.begin_revoke_access": "Microsoft.Compute.DiskRestorePoints.revokeAccess", - "azure.mgmt.compute.aio.operations.DiskRestorePointOperations.begin_revoke_access": "Microsoft.Compute.DiskRestorePoints.revokeAccess" + "azure.mgmt.compute.aio.operations.DiskRestorePointOperations.begin_revoke_access": "Microsoft.Compute.DiskRestorePoints.revokeAccess", + "azure.mgmt.compute.operations.SoftDeletedResourceOperations.list_by_artifact_name": "Microsoft.Compute.Galleries.listByArtifactName", + "azure.mgmt.compute.aio.operations.SoftDeletedResourceOperations.list_by_artifact_name": "Microsoft.Compute.Galleries.listByArtifactName", + "azure.mgmt.compute.operations.GallerySharingProfileOperations.begin_update": "Microsoft.Compute.Galleries.gallerySharingProfileUpdate", + "azure.mgmt.compute.aio.operations.GallerySharingProfileOperations.begin_update": "Microsoft.Compute.Galleries.gallerySharingProfileUpdate" } } \ No newline at end of file diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/_client.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/_client.py index d9f61ea9c980..c3d5ca5fbec0 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/_client.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/_client.py @@ -39,35 +39,33 @@ GalleryImagesOperations, GalleryInVMAccessControlProfileVersionsOperations, GalleryInVMAccessControlProfilesOperations, + GallerySharingProfileOperations, ImagesOperations, - LogAnalyticsOperationGroupOperations, + LogAnalyticsOperations, Operations, - PrivateEndpointConnectionsOperations, ProximityPlacementGroupsOperations, ResourceSkusOperations, RestorePointCollectionsOperations, RestorePointsOperations, - RollingUpgradeStatusInfosOperations, SharedGalleriesOperations, SharedGalleryImageVersionsOperations, SharedGalleryImagesOperations, SnapshotsOperations, - SshPublicKeyResourcesOperations, - UsageOperationGroupOperations, + SoftDeletedResourceOperations, + SshPublicKeysOperations, + UsageOperations, VirtualMachineExtensionImagesOperations, VirtualMachineExtensionsOperations, - VirtualMachineImagesEdgeZoneOperationGroupOperations, - VirtualMachineImagesOperationGroupOperations, - VirtualMachineRunCommandsOperationGroupOperations, + VirtualMachineImagesEdgeZoneOperations, + VirtualMachineImagesOperations, VirtualMachineRunCommandsOperations, VirtualMachineScaleSetExtensionsOperations, + VirtualMachineScaleSetRollingUpgradesOperations, VirtualMachineScaleSetVMExtensionsOperations, VirtualMachineScaleSetVMRunCommandsOperations, - VirtualMachineScaleSetVMSOperations, - VirtualMachineScaleSetsOperationGroupOperations, + VirtualMachineScaleSetVMsOperations, VirtualMachineScaleSetsOperations, - VirtualMachineSizesOperationGroupOperations, - VirtualMachinesOperationGroupOperations, + VirtualMachineSizesOperations, VirtualMachinesOperations, ) @@ -84,16 +82,10 @@ class ComputeClient: # pylint: disable=too-many-instance-attributes :ivar virtual_machine_scale_sets: VirtualMachineScaleSetsOperations operations :vartype virtual_machine_scale_sets: azure.mgmt.compute.operations.VirtualMachineScaleSetsOperations - :ivar rolling_upgrade_status_infos: RollingUpgradeStatusInfosOperations operations - :vartype rolling_upgrade_status_infos: - azure.mgmt.compute.operations.RollingUpgradeStatusInfosOperations :ivar virtual_machine_scale_set_extensions: VirtualMachineScaleSetExtensionsOperations operations :vartype virtual_machine_scale_set_extensions: azure.mgmt.compute.operations.VirtualMachineScaleSetExtensionsOperations - :ivar virtual_machine_scale_set_vms: VirtualMachineScaleSetVMSOperations operations - :vartype virtual_machine_scale_set_vms: - azure.mgmt.compute.operations.VirtualMachineScaleSetVMSOperations :ivar virtual_machine_scale_set_vm_extensions: VirtualMachineScaleSetVMExtensionsOperations operations :vartype virtual_machine_scale_set_vm_extensions: @@ -115,9 +107,6 @@ class ComputeClient: # pylint: disable=too-many-instance-attributes :vartype dedicated_host_groups: azure.mgmt.compute.operations.DedicatedHostGroupsOperations :ivar dedicated_hosts: DedicatedHostsOperations operations :vartype dedicated_hosts: azure.mgmt.compute.operations.DedicatedHostsOperations - :ivar ssh_public_key_resources: SshPublicKeyResourcesOperations operations - :vartype ssh_public_key_resources: - azure.mgmt.compute.operations.SshPublicKeyResourcesOperations :ivar images: ImagesOperations operations :vartype images: azure.mgmt.compute.operations.ImagesOperations :ivar restore_point_collections: RestorePointCollectionsOperations operations @@ -137,41 +126,10 @@ class ComputeClient: # pylint: disable=too-many-instance-attributes operations :vartype virtual_machine_scale_set_vm_run_commands: azure.mgmt.compute.operations.VirtualMachineScaleSetVMRunCommandsOperations - :ivar usage_operation_group: UsageOperationGroupOperations operations - :vartype usage_operation_group: azure.mgmt.compute.operations.UsageOperationGroupOperations - :ivar virtual_machine_sizes_operation_group: VirtualMachineSizesOperationGroupOperations - operations - :vartype virtual_machine_sizes_operation_group: - azure.mgmt.compute.operations.VirtualMachineSizesOperationGroupOperations - :ivar virtual_machine_scale_sets_operation_group: - VirtualMachineScaleSetsOperationGroupOperations operations - :vartype virtual_machine_scale_sets_operation_group: - azure.mgmt.compute.operations.VirtualMachineScaleSetsOperationGroupOperations - :ivar virtual_machines_operation_group: VirtualMachinesOperationGroupOperations operations - :vartype virtual_machines_operation_group: - azure.mgmt.compute.operations.VirtualMachinesOperationGroupOperations - :ivar virtual_machine_images_edge_zone_operation_group: - VirtualMachineImagesEdgeZoneOperationGroupOperations operations - :vartype virtual_machine_images_edge_zone_operation_group: - azure.mgmt.compute.operations.VirtualMachineImagesEdgeZoneOperationGroupOperations - :ivar virtual_machine_images_operation_group: VirtualMachineImagesOperationGroupOperations - operations - :vartype virtual_machine_images_operation_group: - azure.mgmt.compute.operations.VirtualMachineImagesOperationGroupOperations - :ivar log_analytics_operation_group: LogAnalyticsOperationGroupOperations operations - :vartype log_analytics_operation_group: - azure.mgmt.compute.operations.LogAnalyticsOperationGroupOperations - :ivar virtual_machine_run_commands_operation_group: - VirtualMachineRunCommandsOperationGroupOperations operations - :vartype virtual_machine_run_commands_operation_group: - azure.mgmt.compute.operations.VirtualMachineRunCommandsOperationGroupOperations :ivar disks: DisksOperations operations :vartype disks: azure.mgmt.compute.operations.DisksOperations :ivar disk_accesses: DiskAccessesOperations operations :vartype disk_accesses: azure.mgmt.compute.operations.DiskAccessesOperations - :ivar private_endpoint_connections: PrivateEndpointConnectionsOperations operations - :vartype private_endpoint_connections: - azure.mgmt.compute.operations.PrivateEndpointConnectionsOperations :ivar disk_encryption_sets: DiskEncryptionSetsOperations operations :vartype disk_encryption_sets: azure.mgmt.compute.operations.DiskEncryptionSetsOperations :ivar snapshots: SnapshotsOperations operations @@ -212,8 +170,32 @@ class ComputeClient: # pylint: disable=too-many-instance-attributes azure.mgmt.compute.operations.CommunityGalleryImageVersionsOperations :ivar resource_skus: ResourceSkusOperations operations :vartype resource_skus: azure.mgmt.compute.operations.ResourceSkusOperations + :ivar virtual_machine_scale_set_rolling_upgrades: + VirtualMachineScaleSetRollingUpgradesOperations operations + :vartype virtual_machine_scale_set_rolling_upgrades: + azure.mgmt.compute.operations.VirtualMachineScaleSetRollingUpgradesOperations + :ivar virtual_machine_scale_set_vms: VirtualMachineScaleSetVMsOperations operations + :vartype virtual_machine_scale_set_vms: + azure.mgmt.compute.operations.VirtualMachineScaleSetVMsOperations + :ivar ssh_public_keys: SshPublicKeysOperations operations + :vartype ssh_public_keys: azure.mgmt.compute.operations.SshPublicKeysOperations + :ivar usage: UsageOperations operations + :vartype usage: azure.mgmt.compute.operations.UsageOperations + :ivar virtual_machine_sizes: VirtualMachineSizesOperations operations + :vartype virtual_machine_sizes: azure.mgmt.compute.operations.VirtualMachineSizesOperations + :ivar virtual_machine_images_edge_zone: VirtualMachineImagesEdgeZoneOperations operations + :vartype virtual_machine_images_edge_zone: + azure.mgmt.compute.operations.VirtualMachineImagesEdgeZoneOperations + :ivar virtual_machine_images: VirtualMachineImagesOperations operations + :vartype virtual_machine_images: azure.mgmt.compute.operations.VirtualMachineImagesOperations + :ivar log_analytics: LogAnalyticsOperations operations + :vartype log_analytics: azure.mgmt.compute.operations.LogAnalyticsOperations :ivar disk_restore_point: DiskRestorePointOperations operations :vartype disk_restore_point: azure.mgmt.compute.operations.DiskRestorePointOperations + :ivar soft_deleted_resource: SoftDeletedResourceOperations operations + :vartype soft_deleted_resource: azure.mgmt.compute.operations.SoftDeletedResourceOperations + :ivar gallery_sharing_profile: GallerySharingProfileOperations operations + :vartype gallery_sharing_profile: azure.mgmt.compute.operations.GallerySharingProfileOperations :param credential: Credential used to authenticate requests to the service. Required. :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: The ID of the target subscription. The value must be an UUID. Required. @@ -281,15 +263,9 @@ def __init__( self.virtual_machine_scale_sets = VirtualMachineScaleSetsOperations( self._client, self._config, self._serialize, self._deserialize ) - self.rolling_upgrade_status_infos = RollingUpgradeStatusInfosOperations( - 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_vms = VirtualMachineScaleSetVMSOperations( - self._client, self._config, self._serialize, self._deserialize - ) self.virtual_machine_scale_set_vm_extensions = VirtualMachineScaleSetVMExtensionsOperations( self._client, self._config, self._serialize, self._deserialize ) @@ -312,9 +288,6 @@ def __init__( self._client, self._config, self._serialize, self._deserialize ) self.dedicated_hosts = DedicatedHostsOperations(self._client, self._config, self._serialize, self._deserialize) - self.ssh_public_key_resources = SshPublicKeyResourcesOperations( - 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 @@ -332,35 +305,8 @@ def __init__( self.virtual_machine_scale_set_vm_run_commands = VirtualMachineScaleSetVMRunCommandsOperations( self._client, self._config, self._serialize, self._deserialize ) - self.usage_operation_group = UsageOperationGroupOperations( - self._client, self._config, self._serialize, self._deserialize - ) - self.virtual_machine_sizes_operation_group = VirtualMachineSizesOperationGroupOperations( - self._client, self._config, self._serialize, self._deserialize - ) - self.virtual_machine_scale_sets_operation_group = VirtualMachineScaleSetsOperationGroupOperations( - self._client, self._config, self._serialize, self._deserialize - ) - self.virtual_machines_operation_group = VirtualMachinesOperationGroupOperations( - self._client, self._config, self._serialize, self._deserialize - ) - self.virtual_machine_images_edge_zone_operation_group = VirtualMachineImagesEdgeZoneOperationGroupOperations( - self._client, self._config, self._serialize, self._deserialize - ) - self.virtual_machine_images_operation_group = VirtualMachineImagesOperationGroupOperations( - self._client, self._config, self._serialize, self._deserialize - ) - self.log_analytics_operation_group = LogAnalyticsOperationGroupOperations( - self._client, self._config, self._serialize, self._deserialize - ) - self.virtual_machine_run_commands_operation_group = VirtualMachineRunCommandsOperationGroupOperations( - self._client, self._config, self._serialize, self._deserialize - ) self.disks = DisksOperations(self._client, self._config, self._serialize, self._deserialize) self.disk_accesses = DiskAccessesOperations(self._client, self._config, self._serialize, self._deserialize) - self.private_endpoint_connections = PrivateEndpointConnectionsOperations( - self._client, self._config, self._serialize, self._deserialize - ) self.disk_encryption_sets = DiskEncryptionSetsOperations( self._client, self._config, self._serialize, self._deserialize ) @@ -401,9 +347,33 @@ def __init__( self._client, self._config, self._serialize, self._deserialize ) self.resource_skus = ResourceSkusOperations(self._client, self._config, self._serialize, self._deserialize) + self.virtual_machine_scale_set_rolling_upgrades = VirtualMachineScaleSetRollingUpgradesOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.virtual_machine_scale_set_vms = VirtualMachineScaleSetVMsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.ssh_public_keys = SshPublicKeysOperations(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_images_edge_zone = VirtualMachineImagesEdgeZoneOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.virtual_machine_images = VirtualMachineImagesOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.log_analytics = LogAnalyticsOperations(self._client, self._config, self._serialize, self._deserialize) self.disk_restore_point = DiskRestorePointOperations( self._client, self._config, self._serialize, self._deserialize ) + self.soft_deleted_resource = SoftDeletedResourceOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.gallery_sharing_profile = GallerySharingProfileOperations( + self._client, self._config, self._serialize, self._deserialize + ) def send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: Any) -> HttpResponse: """Runs the network request through the client's chained policies. diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/_client.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/_client.py index 9842feedeb17..70b7fd8069fa 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/_client.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/_client.py @@ -39,35 +39,33 @@ GalleryImagesOperations, GalleryInVMAccessControlProfileVersionsOperations, GalleryInVMAccessControlProfilesOperations, + GallerySharingProfileOperations, ImagesOperations, - LogAnalyticsOperationGroupOperations, + LogAnalyticsOperations, Operations, - PrivateEndpointConnectionsOperations, ProximityPlacementGroupsOperations, ResourceSkusOperations, RestorePointCollectionsOperations, RestorePointsOperations, - RollingUpgradeStatusInfosOperations, SharedGalleriesOperations, SharedGalleryImageVersionsOperations, SharedGalleryImagesOperations, SnapshotsOperations, - SshPublicKeyResourcesOperations, - UsageOperationGroupOperations, + SoftDeletedResourceOperations, + SshPublicKeysOperations, + UsageOperations, VirtualMachineExtensionImagesOperations, VirtualMachineExtensionsOperations, - VirtualMachineImagesEdgeZoneOperationGroupOperations, - VirtualMachineImagesOperationGroupOperations, - VirtualMachineRunCommandsOperationGroupOperations, + VirtualMachineImagesEdgeZoneOperations, + VirtualMachineImagesOperations, VirtualMachineRunCommandsOperations, VirtualMachineScaleSetExtensionsOperations, + VirtualMachineScaleSetRollingUpgradesOperations, VirtualMachineScaleSetVMExtensionsOperations, VirtualMachineScaleSetVMRunCommandsOperations, - VirtualMachineScaleSetVMSOperations, - VirtualMachineScaleSetsOperationGroupOperations, + VirtualMachineScaleSetVMsOperations, VirtualMachineScaleSetsOperations, - VirtualMachineSizesOperationGroupOperations, - VirtualMachinesOperationGroupOperations, + VirtualMachineSizesOperations, VirtualMachinesOperations, ) @@ -84,16 +82,10 @@ class ComputeClient: # pylint: disable=too-many-instance-attributes :ivar virtual_machine_scale_sets: VirtualMachineScaleSetsOperations operations :vartype virtual_machine_scale_sets: azure.mgmt.compute.aio.operations.VirtualMachineScaleSetsOperations - :ivar rolling_upgrade_status_infos: RollingUpgradeStatusInfosOperations operations - :vartype rolling_upgrade_status_infos: - azure.mgmt.compute.aio.operations.RollingUpgradeStatusInfosOperations :ivar virtual_machine_scale_set_extensions: VirtualMachineScaleSetExtensionsOperations operations :vartype virtual_machine_scale_set_extensions: azure.mgmt.compute.aio.operations.VirtualMachineScaleSetExtensionsOperations - :ivar virtual_machine_scale_set_vms: VirtualMachineScaleSetVMSOperations operations - :vartype virtual_machine_scale_set_vms: - azure.mgmt.compute.aio.operations.VirtualMachineScaleSetVMSOperations :ivar virtual_machine_scale_set_vm_extensions: VirtualMachineScaleSetVMExtensionsOperations operations :vartype virtual_machine_scale_set_vm_extensions: @@ -115,9 +107,6 @@ class ComputeClient: # pylint: disable=too-many-instance-attributes :vartype dedicated_host_groups: azure.mgmt.compute.aio.operations.DedicatedHostGroupsOperations :ivar dedicated_hosts: DedicatedHostsOperations operations :vartype dedicated_hosts: azure.mgmt.compute.aio.operations.DedicatedHostsOperations - :ivar ssh_public_key_resources: SshPublicKeyResourcesOperations operations - :vartype ssh_public_key_resources: - azure.mgmt.compute.aio.operations.SshPublicKeyResourcesOperations :ivar images: ImagesOperations operations :vartype images: azure.mgmt.compute.aio.operations.ImagesOperations :ivar restore_point_collections: RestorePointCollectionsOperations operations @@ -138,41 +127,10 @@ class ComputeClient: # pylint: disable=too-many-instance-attributes operations :vartype virtual_machine_scale_set_vm_run_commands: azure.mgmt.compute.aio.operations.VirtualMachineScaleSetVMRunCommandsOperations - :ivar usage_operation_group: UsageOperationGroupOperations operations - :vartype usage_operation_group: azure.mgmt.compute.aio.operations.UsageOperationGroupOperations - :ivar virtual_machine_sizes_operation_group: VirtualMachineSizesOperationGroupOperations - operations - :vartype virtual_machine_sizes_operation_group: - azure.mgmt.compute.aio.operations.VirtualMachineSizesOperationGroupOperations - :ivar virtual_machine_scale_sets_operation_group: - VirtualMachineScaleSetsOperationGroupOperations operations - :vartype virtual_machine_scale_sets_operation_group: - azure.mgmt.compute.aio.operations.VirtualMachineScaleSetsOperationGroupOperations - :ivar virtual_machines_operation_group: VirtualMachinesOperationGroupOperations operations - :vartype virtual_machines_operation_group: - azure.mgmt.compute.aio.operations.VirtualMachinesOperationGroupOperations - :ivar virtual_machine_images_edge_zone_operation_group: - VirtualMachineImagesEdgeZoneOperationGroupOperations operations - :vartype virtual_machine_images_edge_zone_operation_group: - azure.mgmt.compute.aio.operations.VirtualMachineImagesEdgeZoneOperationGroupOperations - :ivar virtual_machine_images_operation_group: VirtualMachineImagesOperationGroupOperations - operations - :vartype virtual_machine_images_operation_group: - azure.mgmt.compute.aio.operations.VirtualMachineImagesOperationGroupOperations - :ivar log_analytics_operation_group: LogAnalyticsOperationGroupOperations operations - :vartype log_analytics_operation_group: - azure.mgmt.compute.aio.operations.LogAnalyticsOperationGroupOperations - :ivar virtual_machine_run_commands_operation_group: - VirtualMachineRunCommandsOperationGroupOperations operations - :vartype virtual_machine_run_commands_operation_group: - azure.mgmt.compute.aio.operations.VirtualMachineRunCommandsOperationGroupOperations :ivar disks: DisksOperations operations :vartype disks: azure.mgmt.compute.aio.operations.DisksOperations :ivar disk_accesses: DiskAccessesOperations operations :vartype disk_accesses: azure.mgmt.compute.aio.operations.DiskAccessesOperations - :ivar private_endpoint_connections: PrivateEndpointConnectionsOperations operations - :vartype private_endpoint_connections: - azure.mgmt.compute.aio.operations.PrivateEndpointConnectionsOperations :ivar disk_encryption_sets: DiskEncryptionSetsOperations operations :vartype disk_encryption_sets: azure.mgmt.compute.aio.operations.DiskEncryptionSetsOperations :ivar snapshots: SnapshotsOperations operations @@ -214,8 +172,34 @@ class ComputeClient: # pylint: disable=too-many-instance-attributes azure.mgmt.compute.aio.operations.CommunityGalleryImageVersionsOperations :ivar resource_skus: ResourceSkusOperations operations :vartype resource_skus: azure.mgmt.compute.aio.operations.ResourceSkusOperations + :ivar virtual_machine_scale_set_rolling_upgrades: + VirtualMachineScaleSetRollingUpgradesOperations operations + :vartype virtual_machine_scale_set_rolling_upgrades: + azure.mgmt.compute.aio.operations.VirtualMachineScaleSetRollingUpgradesOperations + :ivar virtual_machine_scale_set_vms: VirtualMachineScaleSetVMsOperations operations + :vartype virtual_machine_scale_set_vms: + azure.mgmt.compute.aio.operations.VirtualMachineScaleSetVMsOperations + :ivar ssh_public_keys: SshPublicKeysOperations operations + :vartype ssh_public_keys: azure.mgmt.compute.aio.operations.SshPublicKeysOperations + :ivar usage: UsageOperations operations + :vartype usage: azure.mgmt.compute.aio.operations.UsageOperations + :ivar virtual_machine_sizes: VirtualMachineSizesOperations operations + :vartype virtual_machine_sizes: azure.mgmt.compute.aio.operations.VirtualMachineSizesOperations + :ivar virtual_machine_images_edge_zone: VirtualMachineImagesEdgeZoneOperations operations + :vartype virtual_machine_images_edge_zone: + azure.mgmt.compute.aio.operations.VirtualMachineImagesEdgeZoneOperations + :ivar virtual_machine_images: VirtualMachineImagesOperations operations + :vartype virtual_machine_images: + azure.mgmt.compute.aio.operations.VirtualMachineImagesOperations + :ivar log_analytics: LogAnalyticsOperations operations + :vartype log_analytics: azure.mgmt.compute.aio.operations.LogAnalyticsOperations :ivar disk_restore_point: DiskRestorePointOperations operations :vartype disk_restore_point: azure.mgmt.compute.aio.operations.DiskRestorePointOperations + :ivar soft_deleted_resource: SoftDeletedResourceOperations operations + :vartype soft_deleted_resource: azure.mgmt.compute.aio.operations.SoftDeletedResourceOperations + :ivar gallery_sharing_profile: GallerySharingProfileOperations operations + :vartype gallery_sharing_profile: + azure.mgmt.compute.aio.operations.GallerySharingProfileOperations :param credential: Credential used to authenticate requests to the service. Required. :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: The ID of the target subscription. The value must be an UUID. Required. @@ -285,15 +269,9 @@ def __init__( self.virtual_machine_scale_sets = VirtualMachineScaleSetsOperations( self._client, self._config, self._serialize, self._deserialize ) - self.rolling_upgrade_status_infos = RollingUpgradeStatusInfosOperations( - 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_vms = VirtualMachineScaleSetVMSOperations( - self._client, self._config, self._serialize, self._deserialize - ) self.virtual_machine_scale_set_vm_extensions = VirtualMachineScaleSetVMExtensionsOperations( self._client, self._config, self._serialize, self._deserialize ) @@ -316,9 +294,6 @@ def __init__( self._client, self._config, self._serialize, self._deserialize ) self.dedicated_hosts = DedicatedHostsOperations(self._client, self._config, self._serialize, self._deserialize) - self.ssh_public_key_resources = SshPublicKeyResourcesOperations( - 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 @@ -336,35 +311,8 @@ def __init__( self.virtual_machine_scale_set_vm_run_commands = VirtualMachineScaleSetVMRunCommandsOperations( self._client, self._config, self._serialize, self._deserialize ) - self.usage_operation_group = UsageOperationGroupOperations( - self._client, self._config, self._serialize, self._deserialize - ) - self.virtual_machine_sizes_operation_group = VirtualMachineSizesOperationGroupOperations( - self._client, self._config, self._serialize, self._deserialize - ) - self.virtual_machine_scale_sets_operation_group = VirtualMachineScaleSetsOperationGroupOperations( - self._client, self._config, self._serialize, self._deserialize - ) - self.virtual_machines_operation_group = VirtualMachinesOperationGroupOperations( - self._client, self._config, self._serialize, self._deserialize - ) - self.virtual_machine_images_edge_zone_operation_group = VirtualMachineImagesEdgeZoneOperationGroupOperations( - self._client, self._config, self._serialize, self._deserialize - ) - self.virtual_machine_images_operation_group = VirtualMachineImagesOperationGroupOperations( - self._client, self._config, self._serialize, self._deserialize - ) - self.log_analytics_operation_group = LogAnalyticsOperationGroupOperations( - self._client, self._config, self._serialize, self._deserialize - ) - self.virtual_machine_run_commands_operation_group = VirtualMachineRunCommandsOperationGroupOperations( - self._client, self._config, self._serialize, self._deserialize - ) self.disks = DisksOperations(self._client, self._config, self._serialize, self._deserialize) self.disk_accesses = DiskAccessesOperations(self._client, self._config, self._serialize, self._deserialize) - self.private_endpoint_connections = PrivateEndpointConnectionsOperations( - self._client, self._config, self._serialize, self._deserialize - ) self.disk_encryption_sets = DiskEncryptionSetsOperations( self._client, self._config, self._serialize, self._deserialize ) @@ -405,9 +353,33 @@ def __init__( self._client, self._config, self._serialize, self._deserialize ) self.resource_skus = ResourceSkusOperations(self._client, self._config, self._serialize, self._deserialize) + self.virtual_machine_scale_set_rolling_upgrades = VirtualMachineScaleSetRollingUpgradesOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.virtual_machine_scale_set_vms = VirtualMachineScaleSetVMsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.ssh_public_keys = SshPublicKeysOperations(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_images_edge_zone = VirtualMachineImagesEdgeZoneOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.virtual_machine_images = VirtualMachineImagesOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.log_analytics = LogAnalyticsOperations(self._client, self._config, self._serialize, self._deserialize) self.disk_restore_point = DiskRestorePointOperations( self._client, self._config, self._serialize, self._deserialize ) + self.soft_deleted_resource = SoftDeletedResourceOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.gallery_sharing_profile = GallerySharingProfileOperations( + self._client, self._config, self._serialize, self._deserialize + ) def send_request( self, request: HttpRequest, *, stream: bool = False, **kwargs: Any diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/operations/__init__.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/operations/__init__.py index 1480dc504db2..21db92def68b 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/operations/__init__.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/operations/__init__.py @@ -14,9 +14,7 @@ from ._operations import Operations # type: ignore from ._operations import VirtualMachineScaleSetsOperations # type: ignore -from ._operations import RollingUpgradeStatusInfosOperations # type: ignore from ._operations import VirtualMachineScaleSetExtensionsOperations # type: ignore -from ._operations import VirtualMachineScaleSetVMSOperations # type: ignore from ._operations import VirtualMachineScaleSetVMExtensionsOperations # type: ignore from ._operations import VirtualMachinesOperations # type: ignore from ._operations import VirtualMachineExtensionsOperations # type: ignore @@ -25,7 +23,6 @@ from ._operations import ProximityPlacementGroupsOperations # type: ignore from ._operations import DedicatedHostGroupsOperations # type: ignore from ._operations import DedicatedHostsOperations # type: ignore -from ._operations import SshPublicKeyResourcesOperations # type: ignore from ._operations import ImagesOperations # type: ignore from ._operations import RestorePointCollectionsOperations # type: ignore from ._operations import RestorePointsOperations # type: ignore @@ -33,17 +30,8 @@ from ._operations import CapacityReservationsOperations # type: ignore from ._operations import VirtualMachineRunCommandsOperations # type: ignore from ._operations import VirtualMachineScaleSetVMRunCommandsOperations # type: ignore -from ._operations import UsageOperationGroupOperations # type: ignore -from ._operations import VirtualMachineSizesOperationGroupOperations # type: ignore -from ._operations import VirtualMachineScaleSetsOperationGroupOperations # type: ignore -from ._operations import VirtualMachinesOperationGroupOperations # type: ignore -from ._operations import VirtualMachineImagesEdgeZoneOperationGroupOperations # type: ignore -from ._operations import VirtualMachineImagesOperationGroupOperations # type: ignore -from ._operations import LogAnalyticsOperationGroupOperations # type: ignore -from ._operations import VirtualMachineRunCommandsOperationGroupOperations # type: ignore from ._operations import DisksOperations # type: ignore from ._operations import DiskAccessesOperations # type: ignore -from ._operations import PrivateEndpointConnectionsOperations # type: ignore from ._operations import DiskEncryptionSetsOperations # type: ignore from ._operations import SnapshotsOperations # type: ignore from ._operations import GalleriesOperations # type: ignore @@ -60,7 +48,17 @@ from ._operations import CommunityGalleryImagesOperations # type: ignore from ._operations import CommunityGalleryImageVersionsOperations # type: ignore from ._operations import ResourceSkusOperations # type: ignore +from ._operations import VirtualMachineScaleSetRollingUpgradesOperations # type: ignore +from ._operations import VirtualMachineScaleSetVMsOperations # type: ignore +from ._operations import SshPublicKeysOperations # type: ignore +from ._operations import UsageOperations # type: ignore +from ._operations import VirtualMachineSizesOperations # type: ignore +from ._operations import VirtualMachineImagesEdgeZoneOperations # type: ignore +from ._operations import VirtualMachineImagesOperations # type: ignore +from ._operations import LogAnalyticsOperations # type: ignore from ._operations import DiskRestorePointOperations # type: ignore +from ._operations import SoftDeletedResourceOperations # type: ignore +from ._operations import GallerySharingProfileOperations # type: ignore from ._patch import __all__ as _patch_all from ._patch import * @@ -69,9 +67,7 @@ __all__ = [ "Operations", "VirtualMachineScaleSetsOperations", - "RollingUpgradeStatusInfosOperations", "VirtualMachineScaleSetExtensionsOperations", - "VirtualMachineScaleSetVMSOperations", "VirtualMachineScaleSetVMExtensionsOperations", "VirtualMachinesOperations", "VirtualMachineExtensionsOperations", @@ -80,7 +76,6 @@ "ProximityPlacementGroupsOperations", "DedicatedHostGroupsOperations", "DedicatedHostsOperations", - "SshPublicKeyResourcesOperations", "ImagesOperations", "RestorePointCollectionsOperations", "RestorePointsOperations", @@ -88,17 +83,8 @@ "CapacityReservationsOperations", "VirtualMachineRunCommandsOperations", "VirtualMachineScaleSetVMRunCommandsOperations", - "UsageOperationGroupOperations", - "VirtualMachineSizesOperationGroupOperations", - "VirtualMachineScaleSetsOperationGroupOperations", - "VirtualMachinesOperationGroupOperations", - "VirtualMachineImagesEdgeZoneOperationGroupOperations", - "VirtualMachineImagesOperationGroupOperations", - "LogAnalyticsOperationGroupOperations", - "VirtualMachineRunCommandsOperationGroupOperations", "DisksOperations", "DiskAccessesOperations", - "PrivateEndpointConnectionsOperations", "DiskEncryptionSetsOperations", "SnapshotsOperations", "GalleriesOperations", @@ -115,7 +101,17 @@ "CommunityGalleryImagesOperations", "CommunityGalleryImageVersionsOperations", "ResourceSkusOperations", + "VirtualMachineScaleSetRollingUpgradesOperations", + "VirtualMachineScaleSetVMsOperations", + "SshPublicKeysOperations", + "UsageOperations", + "VirtualMachineSizesOperations", + "VirtualMachineImagesEdgeZoneOperations", + "VirtualMachineImagesOperations", + "LogAnalyticsOperations", "DiskRestorePointOperations", + "SoftDeletedResourceOperations", + "GallerySharingProfileOperations", ] __all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/operations/_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/operations/_operations.py index 7518c90ba8f9..04fe38decdbe 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/operations/_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/operations/_operations.py @@ -81,11 +81,15 @@ build_dedicated_hosts_restart_request, build_dedicated_hosts_update_request, build_disk_accesses_create_or_update_request, + build_disk_accesses_delete_a_private_endpoint_connection_request, build_disk_accesses_delete_request, + build_disk_accesses_get_a_private_endpoint_connection_request, build_disk_accesses_get_private_link_resources_request, build_disk_accesses_get_request, build_disk_accesses_list_by_resource_group_request, + build_disk_accesses_list_private_endpoint_connections_request, build_disk_accesses_list_request, + build_disk_accesses_update_a_private_endpoint_connection_request, build_disk_accesses_update_request, build_disk_encryption_sets_create_or_update_request, build_disk_encryption_sets_delete_request, @@ -108,9 +112,7 @@ build_disks_update_request, build_galleries_create_or_update_request, build_galleries_delete_request, - build_galleries_gallery_sharing_profile_update_request, build_galleries_get_request, - build_galleries_list_by_artifact_name_request, build_galleries_list_by_resource_group_request, build_galleries_list_request, build_galleries_update_request, @@ -144,19 +146,16 @@ build_gallery_in_vm_access_control_profiles_get_request, build_gallery_in_vm_access_control_profiles_list_by_gallery_request, build_gallery_in_vm_access_control_profiles_update_request, + build_gallery_sharing_profile_update_request, build_images_create_or_update_request, build_images_delete_request, build_images_get_request, build_images_list_by_resource_group_request, build_images_list_request, build_images_update_request, - build_log_analytics_operation_group_export_request_rate_by_interval_request, - build_log_analytics_operation_group_export_throttled_requests_request, + build_log_analytics_export_request_rate_by_interval_request, + build_log_analytics_export_throttled_requests_request, build_operations_list_request, - build_private_endpoint_connections_delete_a_private_endpoint_connection_request, - build_private_endpoint_connections_get_a_private_endpoint_connection_request, - build_private_endpoint_connections_list_private_endpoint_connections_request, - build_private_endpoint_connections_update_a_private_endpoint_connection_request, build_proximity_placement_groups_create_or_update_request, build_proximity_placement_groups_delete_request, build_proximity_placement_groups_get_request, @@ -173,7 +172,6 @@ build_restore_points_create_request, build_restore_points_delete_request, build_restore_points_get_request, - build_rolling_upgrade_status_infos_get_latest_request, build_shared_galleries_get_request, build_shared_galleries_list_request, build_shared_gallery_image_versions_get_request, @@ -188,14 +186,15 @@ build_snapshots_list_request, build_snapshots_revoke_access_request, build_snapshots_update_request, - build_ssh_public_key_resources_create_request, - build_ssh_public_key_resources_delete_request, - build_ssh_public_key_resources_generate_key_pair_request, - build_ssh_public_key_resources_get_request, - build_ssh_public_key_resources_list_by_resource_group_request, - build_ssh_public_key_resources_list_by_subscription_request, - build_ssh_public_key_resources_update_request, - build_usage_operation_group_list_request, + build_soft_deleted_resource_list_by_artifact_name_request, + build_ssh_public_keys_create_request, + build_ssh_public_keys_delete_request, + build_ssh_public_keys_generate_key_pair_request, + build_ssh_public_keys_get_request, + build_ssh_public_keys_list_by_resource_group_request, + build_ssh_public_keys_list_by_subscription_request, + build_ssh_public_keys_update_request, + build_usage_list_request, build_virtual_machine_extension_images_get_request, build_virtual_machine_extension_images_list_types_request, build_virtual_machine_extension_images_list_versions_request, @@ -204,30 +203,34 @@ build_virtual_machine_extensions_get_request, build_virtual_machine_extensions_list_request, build_virtual_machine_extensions_update_request, - build_virtual_machine_images_edge_zone_operation_group_get_request, - build_virtual_machine_images_edge_zone_operation_group_list_offers_request, - build_virtual_machine_images_edge_zone_operation_group_list_publishers_request, - build_virtual_machine_images_edge_zone_operation_group_list_request, - build_virtual_machine_images_edge_zone_operation_group_list_skus_request, - build_virtual_machine_images_operation_group_get_request, - build_virtual_machine_images_operation_group_list_by_edge_zone_request, - build_virtual_machine_images_operation_group_list_offers_request, - build_virtual_machine_images_operation_group_list_publishers_request, - build_virtual_machine_images_operation_group_list_request, - build_virtual_machine_images_operation_group_list_skus_request, - build_virtual_machine_images_operation_group_list_with_properties_request, + build_virtual_machine_images_edge_zone_get_request, + build_virtual_machine_images_edge_zone_list_offers_request, + build_virtual_machine_images_edge_zone_list_publishers_request, + build_virtual_machine_images_edge_zone_list_request, + build_virtual_machine_images_edge_zone_list_skus_request, + build_virtual_machine_images_get_request, + build_virtual_machine_images_list_by_edge_zone_request, + build_virtual_machine_images_list_offers_request, + build_virtual_machine_images_list_publishers_request, + build_virtual_machine_images_list_request, + build_virtual_machine_images_list_skus_request, + build_virtual_machine_images_list_with_properties_request, build_virtual_machine_run_commands_create_or_update_request, build_virtual_machine_run_commands_delete_request, build_virtual_machine_run_commands_get_by_virtual_machine_request, + build_virtual_machine_run_commands_get_request, build_virtual_machine_run_commands_list_by_virtual_machine_request, - build_virtual_machine_run_commands_operation_group_get_request, - build_virtual_machine_run_commands_operation_group_list_request, + build_virtual_machine_run_commands_list_request, build_virtual_machine_run_commands_update_request, build_virtual_machine_scale_set_extensions_create_or_update_request, build_virtual_machine_scale_set_extensions_delete_request, build_virtual_machine_scale_set_extensions_get_request, build_virtual_machine_scale_set_extensions_list_request, build_virtual_machine_scale_set_extensions_update_request, + build_virtual_machine_scale_set_rolling_upgrades_cancel_request, + build_virtual_machine_scale_set_rolling_upgrades_get_latest_request, + build_virtual_machine_scale_set_rolling_upgrades_start_extension_upgrade_request, + build_virtual_machine_scale_set_rolling_upgrades_start_os_upgrade_request, build_virtual_machine_scale_set_vm_extensions_create_or_update_request, build_virtual_machine_scale_set_vm_extensions_delete_request, build_virtual_machine_scale_set_vm_extensions_get_request, @@ -257,7 +260,6 @@ build_virtual_machine_scale_set_vms_start_request, build_virtual_machine_scale_set_vms_update_request, build_virtual_machine_scale_sets_approve_rolling_upgrade_request, - build_virtual_machine_scale_sets_cancel_request, build_virtual_machine_scale_sets_convert_to_single_placement_group_request, build_virtual_machine_scale_sets_create_or_update_request, build_virtual_machine_scale_sets_deallocate_request, @@ -268,9 +270,9 @@ build_virtual_machine_scale_sets_get_os_upgrade_history_request, build_virtual_machine_scale_sets_get_request, build_virtual_machine_scale_sets_list_all_request, + build_virtual_machine_scale_sets_list_by_location_request, build_virtual_machine_scale_sets_list_request, build_virtual_machine_scale_sets_list_skus_request, - build_virtual_machine_scale_sets_operation_group_list_by_location_request, build_virtual_machine_scale_sets_perform_maintenance_request, build_virtual_machine_scale_sets_power_off_request, build_virtual_machine_scale_sets_reapply_request, @@ -280,12 +282,10 @@ build_virtual_machine_scale_sets_restart_request, build_virtual_machine_scale_sets_scale_out_request, build_virtual_machine_scale_sets_set_orchestration_service_state_request, - build_virtual_machine_scale_sets_start_extension_upgrade_request, - build_virtual_machine_scale_sets_start_os_upgrade_request, build_virtual_machine_scale_sets_start_request, build_virtual_machine_scale_sets_update_instances_request, build_virtual_machine_scale_sets_update_request, - build_virtual_machine_sizes_operation_group_list_request, + build_virtual_machine_sizes_list_request, build_virtual_machines_assess_patches_request, build_virtual_machines_attach_detach_data_disks_request, build_virtual_machines_capture_request, @@ -299,9 +299,9 @@ build_virtual_machines_instance_view_request, build_virtual_machines_list_all_request, build_virtual_machines_list_available_sizes_request, + build_virtual_machines_list_by_location_request, build_virtual_machines_list_request, build_virtual_machines_migrate_to_vm_scale_set_request, - build_virtual_machines_operation_group_list_by_location_request, build_virtual_machines_perform_maintenance_request, build_virtual_machines_power_off_request, build_virtual_machines_reapply_request, @@ -611,7 +611,7 @@ async def begin_create_or_update( etag: Optional[str] = None, match_condition: Optional[MatchConditions] = None, **kwargs: Any - ) -> AsyncLROPoller[None]: + ) -> AsyncLROPoller[_models.VirtualMachineScaleSet]: """Create or update a VM scale set. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -629,8 +629,9 @@ async def begin_create_or_update( :paramtype etag: str :keyword match_condition: The match condition to use upon the etag. Default value is None. :paramtype match_condition: ~azure.core.MatchConditions - :return: An instance of AsyncLROPoller that returns None - :rtype: ~azure.core.polling.AsyncLROPoller[None] + :return: An instance of AsyncLROPoller that returns VirtualMachineScaleSet. The + VirtualMachineScaleSet is compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.VirtualMachineScaleSet] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -645,7 +646,7 @@ async def begin_create_or_update( etag: Optional[str] = None, match_condition: Optional[MatchConditions] = None, **kwargs: Any - ) -> AsyncLROPoller[None]: + ) -> AsyncLROPoller[_models.VirtualMachineScaleSet]: """Create or update a VM scale set. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -663,8 +664,9 @@ async def begin_create_or_update( :paramtype etag: str :keyword match_condition: The match condition to use upon the etag. Default value is None. :paramtype match_condition: ~azure.core.MatchConditions - :return: An instance of AsyncLROPoller that returns None - :rtype: ~azure.core.polling.AsyncLROPoller[None] + :return: An instance of AsyncLROPoller that returns VirtualMachineScaleSet. The + VirtualMachineScaleSet is compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.VirtualMachineScaleSet] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -679,7 +681,7 @@ async def begin_create_or_update( etag: Optional[str] = None, match_condition: Optional[MatchConditions] = None, **kwargs: Any - ) -> AsyncLROPoller[None]: + ) -> AsyncLROPoller[_models.VirtualMachineScaleSet]: """Create or update a VM scale set. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -697,8 +699,9 @@ async def begin_create_or_update( :paramtype etag: str :keyword match_condition: The match condition to use upon the etag. Default value is None. :paramtype match_condition: ~azure.core.MatchConditions - :return: An instance of AsyncLROPoller that returns None - :rtype: ~azure.core.polling.AsyncLROPoller[None] + :return: An instance of AsyncLROPoller that returns VirtualMachineScaleSet. The + VirtualMachineScaleSet is compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.VirtualMachineScaleSet] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -712,7 +715,7 @@ async def begin_create_or_update( etag: Optional[str] = None, match_condition: Optional[MatchConditions] = None, **kwargs: Any - ) -> AsyncLROPoller[None]: + ) -> AsyncLROPoller[_models.VirtualMachineScaleSet]: """Create or update a VM scale set. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -728,15 +731,16 @@ async def begin_create_or_update( :paramtype etag: str :keyword match_condition: The match condition to use upon the etag. Default value is None. :paramtype match_condition: ~azure.core.MatchConditions - :return: An instance of AsyncLROPoller that returns None - :rtype: ~azure.core.polling.AsyncLROPoller[None] + :return: An instance of AsyncLROPoller that returns VirtualMachineScaleSet. The + VirtualMachineScaleSet is compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.VirtualMachineScaleSet] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[_models.VirtualMachineScaleSet] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) @@ -756,9 +760,12 @@ async def begin_create_or_update( await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.VirtualMachineScaleSet, response.json()) if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized path_format_arguments = { "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), @@ -773,13 +780,15 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return AsyncLROPoller[None].from_continuation_token( + return AsyncLROPoller[_models.VirtualMachineScaleSet].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + return AsyncLROPoller[_models.VirtualMachineScaleSet]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) async def _update_initial( self, @@ -873,7 +882,7 @@ async def begin_update( etag: Optional[str] = None, match_condition: Optional[MatchConditions] = None, **kwargs: Any - ) -> AsyncLROPoller[None]: + ) -> AsyncLROPoller[_models.VirtualMachineScaleSet]: """Update a VM scale set. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -891,8 +900,9 @@ async def begin_update( :paramtype etag: str :keyword match_condition: The match condition to use upon the etag. Default value is None. :paramtype match_condition: ~azure.core.MatchConditions - :return: An instance of AsyncLROPoller that returns None - :rtype: ~azure.core.polling.AsyncLROPoller[None] + :return: An instance of AsyncLROPoller that returns VirtualMachineScaleSet. The + VirtualMachineScaleSet is compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.VirtualMachineScaleSet] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -907,7 +917,7 @@ async def begin_update( etag: Optional[str] = None, match_condition: Optional[MatchConditions] = None, **kwargs: Any - ) -> AsyncLROPoller[None]: + ) -> AsyncLROPoller[_models.VirtualMachineScaleSet]: """Update a VM scale set. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -925,8 +935,9 @@ async def begin_update( :paramtype etag: str :keyword match_condition: The match condition to use upon the etag. Default value is None. :paramtype match_condition: ~azure.core.MatchConditions - :return: An instance of AsyncLROPoller that returns None - :rtype: ~azure.core.polling.AsyncLROPoller[None] + :return: An instance of AsyncLROPoller that returns VirtualMachineScaleSet. The + VirtualMachineScaleSet is compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.VirtualMachineScaleSet] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -941,7 +952,7 @@ async def begin_update( etag: Optional[str] = None, match_condition: Optional[MatchConditions] = None, **kwargs: Any - ) -> AsyncLROPoller[None]: + ) -> AsyncLROPoller[_models.VirtualMachineScaleSet]: """Update a VM scale set. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -959,8 +970,9 @@ async def begin_update( :paramtype etag: str :keyword match_condition: The match condition to use upon the etag. Default value is None. :paramtype match_condition: ~azure.core.MatchConditions - :return: An instance of AsyncLROPoller that returns None - :rtype: ~azure.core.polling.AsyncLROPoller[None] + :return: An instance of AsyncLROPoller that returns VirtualMachineScaleSet. The + VirtualMachineScaleSet is compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.VirtualMachineScaleSet] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -974,7 +986,7 @@ async def begin_update( etag: Optional[str] = None, match_condition: Optional[MatchConditions] = None, **kwargs: Any - ) -> AsyncLROPoller[None]: + ) -> AsyncLROPoller[_models.VirtualMachineScaleSet]: """Update a VM scale set. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -990,15 +1002,16 @@ async def begin_update( :paramtype etag: str :keyword match_condition: The match condition to use upon the etag. Default value is None. :paramtype match_condition: ~azure.core.MatchConditions - :return: An instance of AsyncLROPoller that returns None - :rtype: ~azure.core.polling.AsyncLROPoller[None] + :return: An instance of AsyncLROPoller that returns VirtualMachineScaleSet. The + VirtualMachineScaleSet is compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.VirtualMachineScaleSet] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[_models.VirtualMachineScaleSet] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) @@ -1018,9 +1031,16 @@ async def begin_update( await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = _deserialize(_models.VirtualMachineScaleSet, response.json()) if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore + return deserialized path_format_arguments = { "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), @@ -1035,13 +1055,15 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return AsyncLROPoller[None].from_continuation_token( + return AsyncLROPoller[_models.VirtualMachineScaleSet].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + return AsyncLROPoller[_models.VirtualMachineScaleSet]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) async def _delete_initial( self, resource_group_name: str, vm_scale_set_name: str, *, force_deletion: Optional[bool] = None, **kwargs: Any @@ -1817,7 +1839,7 @@ async def begin_deallocate( hibernate: Optional[bool] = None, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.OkResponse]: + ) -> 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. @@ -1837,9 +1859,8 @@ async def begin_deallocate( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns OkResponse. The OkResponse is compatible - with MutableMapping - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.OkResponse] + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -1853,7 +1874,7 @@ async def begin_deallocate( hibernate: Optional[bool] = None, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.OkResponse]: + ) -> 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. @@ -1873,9 +1894,8 @@ async def begin_deallocate( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns OkResponse. The OkResponse is compatible - with MutableMapping - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.OkResponse] + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -1889,7 +1909,7 @@ async def begin_deallocate( hibernate: Optional[bool] = None, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.OkResponse]: + ) -> 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. @@ -1909,9 +1929,8 @@ async def begin_deallocate( :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns OkResponse. The OkResponse is compatible - with MutableMapping - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.OkResponse] + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -1924,7 +1943,7 @@ async def begin_deallocate( *, hibernate: Optional[bool] = None, **kwargs: Any - ) -> AsyncLROPoller[_models.OkResponse]: + ) -> 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. @@ -1943,9 +1962,8 @@ async def begin_deallocate( (This feature is available for VMSS with Flexible OrchestrationMode only). Default value is None. :paramtype hibernate: bool - :return: An instance of AsyncLROPoller that returns OkResponse. The OkResponse is compatible - with MutableMapping - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.OkResponse] + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -1953,7 +1971,7 @@ async def begin_deallocate( content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) content_type = content_type if vm_instance_i_ds else None - cls: ClsType[_models.OkResponse] = kwargs.pop("cls", None) + cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) @@ -1972,16 +1990,9 @@ async def begin_deallocate( await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): - response_headers = {} - response = pipeline_response.http_response - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = _deserialize(_models.OkResponse, response.json()) + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized + return cls(pipeline_response, None, {}) # type: ignore path_format_arguments = { "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), @@ -1996,15 +2007,13 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller[_models.OkResponse].from_continuation_token( + return AsyncLROPoller[None].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller[_models.OkResponse]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore async def _delete_instances_initial( self, @@ -2090,7 +2099,7 @@ async def begin_delete_instances( force_deletion: Optional[bool] = None, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.OkResponse]: + ) -> AsyncLROPoller[None]: """Deletes virtual machines in a VM scale set. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -2107,9 +2116,8 @@ async def begin_delete_instances( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns OkResponse. The OkResponse is compatible - with MutableMapping - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.OkResponse] + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -2123,7 +2131,7 @@ async def begin_delete_instances( force_deletion: Optional[bool] = None, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.OkResponse]: + ) -> AsyncLROPoller[None]: """Deletes virtual machines in a VM scale set. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -2140,9 +2148,8 @@ async def begin_delete_instances( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns OkResponse. The OkResponse is compatible - with MutableMapping - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.OkResponse] + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -2156,7 +2163,7 @@ async def begin_delete_instances( force_deletion: Optional[bool] = None, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.OkResponse]: + ) -> AsyncLROPoller[None]: """Deletes virtual machines in a VM scale set. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -2173,9 +2180,8 @@ async def begin_delete_instances( :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns OkResponse. The OkResponse is compatible - with MutableMapping - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.OkResponse] + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -2188,7 +2194,7 @@ async def begin_delete_instances( *, force_deletion: Optional[bool] = None, **kwargs: Any - ) -> AsyncLROPoller[_models.OkResponse]: + ) -> AsyncLROPoller[None]: """Deletes virtual machines in a VM scale set. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -2203,16 +2209,15 @@ async def begin_delete_instances( :keyword force_deletion: Optional parameter to force delete virtual machines from the VM scale set. (Feature in Preview). Default value is None. :paramtype force_deletion: bool - :return: An instance of AsyncLROPoller that returns OkResponse. The OkResponse is compatible - with MutableMapping - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.OkResponse] + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.OkResponse] = kwargs.pop("cls", None) + cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) @@ -2231,16 +2236,9 @@ async def begin_delete_instances( await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): - response_headers = {} - response = pipeline_response.http_response - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = _deserialize(_models.OkResponse, response.json()) + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized + return cls(pipeline_response, None, {}) # type: ignore path_format_arguments = { "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), @@ -2255,15 +2253,13 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller[_models.OkResponse].from_continuation_token( + return AsyncLROPoller[None].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller[_models.OkResponse]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore @distributed_trace_async async def force_recovery_service_fabric_platform_update_domain_walk( # pylint: disable=name-too-long @@ -2502,7 +2498,7 @@ async def begin_update_instances( *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.OkResponse]: + ) -> 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. The name is case insensitive. @@ -2516,9 +2512,8 @@ async def begin_update_instances( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns OkResponse. The OkResponse is compatible - with MutableMapping - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.OkResponse] + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -2531,7 +2526,7 @@ async def begin_update_instances( *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.OkResponse]: + ) -> 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. The name is case insensitive. @@ -2545,9 +2540,8 @@ async def begin_update_instances( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns OkResponse. The OkResponse is compatible - with MutableMapping - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.OkResponse] + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -2560,7 +2554,7 @@ async def begin_update_instances( *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.OkResponse]: + ) -> 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. The name is case insensitive. @@ -2574,9 +2568,8 @@ async def begin_update_instances( :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns OkResponse. The OkResponse is compatible - with MutableMapping - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.OkResponse] + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -2587,7 +2580,7 @@ async def begin_update_instances( vm_scale_set_name: str, vm_instance_i_ds: Union[_models.VirtualMachineScaleSetVMInstanceRequiredIDs, JSON, IO[bytes]], **kwargs: Any - ) -> AsyncLROPoller[_models.OkResponse]: + ) -> 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. The name is case insensitive. @@ -2599,16 +2592,15 @@ async def begin_update_instances( of the following types: VirtualMachineScaleSetVMInstanceRequiredIDs, JSON, IO[bytes] Required. :type vm_instance_i_ds: ~azure.mgmt.compute.models.VirtualMachineScaleSetVMInstanceRequiredIDs or JSON or IO[bytes] - :return: An instance of AsyncLROPoller that returns OkResponse. The OkResponse is compatible - with MutableMapping - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.OkResponse] + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.OkResponse] = kwargs.pop("cls", None) + cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) @@ -2626,16 +2618,9 @@ async def begin_update_instances( await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): - response_headers = {} - response = pipeline_response.http_response - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = _deserialize(_models.OkResponse, response.json()) + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized + return cls(pipeline_response, None, {}) # type: ignore path_format_arguments = { "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), @@ -2650,15 +2635,13 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller[_models.OkResponse].from_continuation_token( + return AsyncLROPoller[None].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller[_models.OkResponse]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore @distributed_trace def get_os_upgrade_history( @@ -2840,7 +2823,7 @@ async def begin_perform_maintenance( *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.OkResponse]: + ) -> 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: @@ -2858,9 +2841,8 @@ async def begin_perform_maintenance( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns OkResponse. The OkResponse is compatible - with MutableMapping - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.OkResponse] + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -2873,7 +2855,7 @@ async def begin_perform_maintenance( *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.OkResponse]: + ) -> 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: @@ -2891,9 +2873,8 @@ async def begin_perform_maintenance( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns OkResponse. The OkResponse is compatible - with MutableMapping - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.OkResponse] + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -2906,7 +2887,7 @@ async def begin_perform_maintenance( *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.OkResponse]: + ) -> 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: @@ -2924,9 +2905,8 @@ async def begin_perform_maintenance( :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns OkResponse. The OkResponse is compatible - with MutableMapping - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.OkResponse] + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -2937,7 +2917,7 @@ async def begin_perform_maintenance( vm_scale_set_name: str, vm_instance_i_ds: Optional[Union[_models.VirtualMachineScaleSetVMInstanceIDs, JSON, IO[bytes]]] = None, **kwargs: Any - ) -> AsyncLROPoller[_models.OkResponse]: + ) -> 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: @@ -2954,9 +2934,8 @@ async def begin_perform_maintenance( None. :type vm_instance_i_ds: ~azure.mgmt.compute.models.VirtualMachineScaleSetVMInstanceIDs or JSON or IO[bytes] - :return: An instance of AsyncLROPoller that returns OkResponse. The OkResponse is compatible - with MutableMapping - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.OkResponse] + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -2964,7 +2943,7 @@ async def begin_perform_maintenance( content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) content_type = content_type if vm_instance_i_ds else None - cls: ClsType[_models.OkResponse] = kwargs.pop("cls", None) + cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) @@ -2982,16 +2961,9 @@ async def begin_perform_maintenance( await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): - response_headers = {} - response = pipeline_response.http_response - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = _deserialize(_models.OkResponse, response.json()) + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized + return cls(pipeline_response, None, {}) # type: ignore path_format_arguments = { "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), @@ -3006,15 +2978,13 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller[_models.OkResponse].from_continuation_token( + return AsyncLROPoller[None].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller[_models.OkResponse]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore async def _power_off_initial( self, @@ -3104,7 +3074,7 @@ async def begin_power_off( skip_shutdown: Optional[bool] = None, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.OkResponse]: + ) -> 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. @@ -3124,9 +3094,8 @@ async def begin_power_off( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns OkResponse. The OkResponse is compatible - with MutableMapping - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.OkResponse] + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -3140,7 +3109,7 @@ async def begin_power_off( skip_shutdown: Optional[bool] = None, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.OkResponse]: + ) -> 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. @@ -3160,9 +3129,8 @@ async def begin_power_off( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns OkResponse. The OkResponse is compatible - with MutableMapping - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.OkResponse] + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -3176,7 +3144,7 @@ async def begin_power_off( skip_shutdown: Optional[bool] = None, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.OkResponse]: + ) -> 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. @@ -3196,9 +3164,8 @@ async def begin_power_off( :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns OkResponse. The OkResponse is compatible - with MutableMapping - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.OkResponse] + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -3211,7 +3178,7 @@ async def begin_power_off( *, skip_shutdown: Optional[bool] = None, **kwargs: Any - ) -> AsyncLROPoller[_models.OkResponse]: + ) -> 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. @@ -3230,9 +3197,8 @@ async def begin_power_off( flag indicates non-graceful shutdown whereas false indicates otherwise. Default value for this flag is false if not specified. Default value is None. :paramtype skip_shutdown: bool - :return: An instance of AsyncLROPoller that returns OkResponse. The OkResponse is compatible - with MutableMapping - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.OkResponse] + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -3240,7 +3206,7 @@ async def begin_power_off( content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) content_type = content_type if vm_instance_i_ds else None - cls: ClsType[_models.OkResponse] = kwargs.pop("cls", None) + cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) @@ -3259,16 +3225,9 @@ async def begin_power_off( await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): - response_headers = {} - response = pipeline_response.http_response - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = _deserialize(_models.OkResponse, response.json()) + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized + return cls(pipeline_response, None, {}) # type: ignore path_format_arguments = { "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), @@ -3283,15 +3242,13 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller[_models.OkResponse].from_continuation_token( + return AsyncLROPoller[None].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller[_models.OkResponse]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore async def _reapply_initial( self, resource_group_name: str, vm_scale_set_name: str, **kwargs: Any @@ -3353,7 +3310,7 @@ async def _reapply_initial( @distributed_trace_async async def begin_reapply( self, resource_group_name: str, vm_scale_set_name: str, **kwargs: Any - ) -> AsyncLROPoller[_models.OkResponse]: + ) -> AsyncLROPoller[None]: """Reapplies the Virtual Machine Scale Set Virtual Machine Profile to the Virtual Machine Instances. @@ -3362,15 +3319,14 @@ async def begin_reapply( :type resource_group_name: str :param vm_scale_set_name: The name of the VM scale set. Required. :type vm_scale_set_name: str - :return: An instance of AsyncLROPoller that returns OkResponse. The OkResponse is compatible - with MutableMapping - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.OkResponse] + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.OkResponse] = kwargs.pop("cls", None) + cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) @@ -3386,16 +3342,9 @@ async def begin_reapply( await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): - response_headers = {} - response = pipeline_response.http_response - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = _deserialize(_models.OkResponse, response.json()) + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized + return cls(pipeline_response, None, {}) # type: ignore path_format_arguments = { "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), @@ -3410,15 +3359,13 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller[_models.OkResponse].from_continuation_token( + return AsyncLROPoller[None].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller[_models.OkResponse]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore async def _redeploy_initial( self, @@ -3504,7 +3451,7 @@ async def begin_redeploy( *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.OkResponse]: + ) -> 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. @@ -3519,9 +3466,8 @@ async def begin_redeploy( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns OkResponse. The OkResponse is compatible - with MutableMapping - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.OkResponse] + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -3534,7 +3480,7 @@ async def begin_redeploy( *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.OkResponse]: + ) -> 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. @@ -3549,9 +3495,8 @@ async def begin_redeploy( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns OkResponse. The OkResponse is compatible - with MutableMapping - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.OkResponse] + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -3564,7 +3509,7 @@ async def begin_redeploy( *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.OkResponse]: + ) -> 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. @@ -3579,9 +3524,8 @@ async def begin_redeploy( :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns OkResponse. The OkResponse is compatible - with MutableMapping - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.OkResponse] + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -3592,7 +3536,7 @@ async def begin_redeploy( vm_scale_set_name: str, vm_instance_i_ds: Optional[Union[_models.VirtualMachineScaleSetVMInstanceIDs, JSON, IO[bytes]]] = None, **kwargs: Any - ) -> AsyncLROPoller[_models.OkResponse]: + ) -> 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. @@ -3606,9 +3550,8 @@ async def begin_redeploy( None. :type vm_instance_i_ds: ~azure.mgmt.compute.models.VirtualMachineScaleSetVMInstanceIDs or JSON or IO[bytes] - :return: An instance of AsyncLROPoller that returns OkResponse. The OkResponse is compatible - with MutableMapping - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.OkResponse] + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -3616,7 +3559,7 @@ async def begin_redeploy( content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) content_type = content_type if vm_instance_i_ds else None - cls: ClsType[_models.OkResponse] = kwargs.pop("cls", None) + cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) @@ -3634,16 +3577,9 @@ async def begin_redeploy( await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): - response_headers = {} - response = pipeline_response.http_response - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = _deserialize(_models.OkResponse, response.json()) + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized + return cls(pipeline_response, None, {}) # type: ignore path_format_arguments = { "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), @@ -3658,15 +3594,13 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller[_models.OkResponse].from_continuation_token( + return AsyncLROPoller[None].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller[_models.OkResponse]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore async def _reimage_initial( self, @@ -3754,7 +3688,7 @@ async def begin_reimage( *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.OkResponse]: + ) -> 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. @@ -3770,9 +3704,8 @@ async def begin_reimage( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns OkResponse. The OkResponse is compatible - with MutableMapping - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.OkResponse] + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -3785,7 +3718,7 @@ async def begin_reimage( *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.OkResponse]: + ) -> 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. @@ -3800,9 +3733,8 @@ async def begin_reimage( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns OkResponse. The OkResponse is compatible - with MutableMapping - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.OkResponse] + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -3815,7 +3747,7 @@ async def begin_reimage( *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.OkResponse]: + ) -> 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. @@ -3830,9 +3762,8 @@ async def begin_reimage( :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns OkResponse. The OkResponse is compatible - with MutableMapping - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.OkResponse] + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -3845,7 +3776,7 @@ async def begin_reimage( Union[_models.VirtualMachineScaleSetReimageParameters, JSON, IO[bytes]] ] = None, **kwargs: Any - ) -> AsyncLROPoller[_models.OkResponse]: + ) -> 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. @@ -3860,9 +3791,8 @@ async def begin_reimage( None. :type vm_scale_set_reimage_input: ~azure.mgmt.compute.models.VirtualMachineScaleSetReimageParameters or JSON or IO[bytes] - :return: An instance of AsyncLROPoller that returns OkResponse. The OkResponse is compatible - with MutableMapping - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.OkResponse] + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -3870,7 +3800,7 @@ async def begin_reimage( content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) content_type = content_type if vm_scale_set_reimage_input else None - cls: ClsType[_models.OkResponse] = kwargs.pop("cls", None) + cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) @@ -3888,16 +3818,9 @@ async def begin_reimage( await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): - response_headers = {} - response = pipeline_response.http_response - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = _deserialize(_models.OkResponse, response.json()) + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized + return cls(pipeline_response, None, {}) # type: ignore path_format_arguments = { "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), @@ -3912,15 +3835,13 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller[_models.OkResponse].from_continuation_token( + return AsyncLROPoller[None].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller[_models.OkResponse]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore async def _reimage_all_initial( self, @@ -4006,7 +3927,7 @@ async def begin_reimage_all( *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.OkResponse]: + ) -> 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. @@ -4021,9 +3942,8 @@ async def begin_reimage_all( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns OkResponse. The OkResponse is compatible - with MutableMapping - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.OkResponse] + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -4036,7 +3956,7 @@ async def begin_reimage_all( *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.OkResponse]: + ) -> 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. @@ -4051,9 +3971,8 @@ async def begin_reimage_all( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns OkResponse. The OkResponse is compatible - with MutableMapping - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.OkResponse] + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -4066,7 +3985,7 @@ async def begin_reimage_all( *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.OkResponse]: + ) -> 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. @@ -4081,9 +4000,8 @@ async def begin_reimage_all( :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns OkResponse. The OkResponse is compatible - with MutableMapping - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.OkResponse] + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -4094,7 +4012,7 @@ async def begin_reimage_all( vm_scale_set_name: str, vm_instance_i_ds: Optional[Union[_models.VirtualMachineScaleSetVMInstanceIDs, JSON, IO[bytes]]] = None, **kwargs: Any - ) -> AsyncLROPoller[_models.OkResponse]: + ) -> 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. @@ -4108,9 +4026,8 @@ async def begin_reimage_all( None. :type vm_instance_i_ds: ~azure.mgmt.compute.models.VirtualMachineScaleSetVMInstanceIDs or JSON or IO[bytes] - :return: An instance of AsyncLROPoller that returns OkResponse. The OkResponse is compatible - with MutableMapping - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.OkResponse] + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -4118,7 +4035,7 @@ async def begin_reimage_all( content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) content_type = content_type if vm_instance_i_ds else None - cls: ClsType[_models.OkResponse] = kwargs.pop("cls", None) + cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) @@ -4136,16 +4053,9 @@ async def begin_reimage_all( await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): - response_headers = {} - response = pipeline_response.http_response - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = _deserialize(_models.OkResponse, response.json()) + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized + return cls(pipeline_response, None, {}) # type: ignore path_format_arguments = { "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), @@ -4160,15 +4070,13 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller[_models.OkResponse].from_continuation_token( + return AsyncLROPoller[None].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller[_models.OkResponse]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore async def _restart_initial( self, @@ -4254,7 +4162,7 @@ async def begin_restart( *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.OkResponse]: + ) -> AsyncLROPoller[None]: """Restarts one or more virtual machines in a VM scale set. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -4268,9 +4176,8 @@ async def begin_restart( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns OkResponse. The OkResponse is compatible - with MutableMapping - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.OkResponse] + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -4283,7 +4190,7 @@ async def begin_restart( *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.OkResponse]: + ) -> AsyncLROPoller[None]: """Restarts one or more virtual machines in a VM scale set. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -4297,9 +4204,8 @@ async def begin_restart( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns OkResponse. The OkResponse is compatible - with MutableMapping - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.OkResponse] + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -4312,7 +4218,7 @@ async def begin_restart( *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.OkResponse]: + ) -> AsyncLROPoller[None]: """Restarts one or more virtual machines in a VM scale set. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -4326,9 +4232,8 @@ async def begin_restart( :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns OkResponse. The OkResponse is compatible - with MutableMapping - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.OkResponse] + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -4339,7 +4244,7 @@ async def begin_restart( vm_scale_set_name: str, vm_instance_i_ds: Optional[Union[_models.VirtualMachineScaleSetVMInstanceIDs, JSON, IO[bytes]]] = None, **kwargs: Any - ) -> AsyncLROPoller[_models.OkResponse]: + ) -> AsyncLROPoller[None]: """Restarts one or more virtual machines in a VM scale set. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -4352,9 +4257,8 @@ async def begin_restart( None. :type vm_instance_i_ds: ~azure.mgmt.compute.models.VirtualMachineScaleSetVMInstanceIDs or JSON or IO[bytes] - :return: An instance of AsyncLROPoller that returns OkResponse. The OkResponse is compatible - with MutableMapping - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.OkResponse] + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -4362,7 +4266,7 @@ async def begin_restart( content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) content_type = content_type if vm_instance_i_ds else None - cls: ClsType[_models.OkResponse] = kwargs.pop("cls", None) + cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) @@ -4380,16 +4284,9 @@ async def begin_restart( await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): - response_headers = {} - response = pipeline_response.http_response - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = _deserialize(_models.OkResponse, response.json()) + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized + return cls(pipeline_response, None, {}) # type: ignore path_format_arguments = { "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), @@ -4404,15 +4301,13 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller[_models.OkResponse].from_continuation_token( + return AsyncLROPoller[None].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller[_models.OkResponse]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore async def _set_orchestration_service_state_initial( self, @@ -4494,7 +4389,7 @@ async def begin_set_orchestration_service_state( *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.OkResponse]: + ) -> AsyncLROPoller[None]: """Changes ServiceState property for a given service. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -4507,9 +4402,8 @@ async def begin_set_orchestration_service_state( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns OkResponse. The OkResponse is compatible - with MutableMapping - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.OkResponse] + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -4522,7 +4416,7 @@ async def begin_set_orchestration_service_state( *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.OkResponse]: + ) -> AsyncLROPoller[None]: """Changes ServiceState property for a given service. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -4535,9 +4429,8 @@ async def begin_set_orchestration_service_state( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns OkResponse. The OkResponse is compatible - with MutableMapping - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.OkResponse] + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -4550,7 +4443,7 @@ async def begin_set_orchestration_service_state( *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.OkResponse]: + ) -> AsyncLROPoller[None]: """Changes ServiceState property for a given service. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -4563,9 +4456,8 @@ async def begin_set_orchestration_service_state( :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns OkResponse. The OkResponse is compatible - with MutableMapping - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.OkResponse] + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -4576,7 +4468,7 @@ async def begin_set_orchestration_service_state( vm_scale_set_name: str, parameters: Union[_models.OrchestrationServiceStateInput, JSON, IO[bytes]], **kwargs: Any - ) -> AsyncLROPoller[_models.OkResponse]: + ) -> AsyncLROPoller[None]: """Changes ServiceState property for a given service. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -4588,16 +4480,15 @@ async def begin_set_orchestration_service_state( following types: OrchestrationServiceStateInput, JSON, IO[bytes] Required. :type parameters: ~azure.mgmt.compute.models.OrchestrationServiceStateInput or JSON or IO[bytes] - :return: An instance of AsyncLROPoller that returns OkResponse. The OkResponse is compatible - with MutableMapping - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.OkResponse] + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.OkResponse] = kwargs.pop("cls", None) + cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) @@ -4615,16 +4506,9 @@ async def begin_set_orchestration_service_state( await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): - response_headers = {} - response = pipeline_response.http_response - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = _deserialize(_models.OkResponse, response.json()) + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized + return cls(pipeline_response, None, {}) # type: ignore path_format_arguments = { "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), @@ -4639,15 +4523,13 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller[_models.OkResponse].from_continuation_token( + return AsyncLROPoller[None].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller[_models.OkResponse]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore @distributed_trace def list_skus( @@ -4828,7 +4710,7 @@ async def begin_start( *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.OkResponse]: + ) -> AsyncLROPoller[None]: """Starts one or more virtual machines in a VM scale set. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -4842,9 +4724,8 @@ async def begin_start( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns OkResponse. The OkResponse is compatible - with MutableMapping - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.OkResponse] + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -4857,7 +4738,7 @@ async def begin_start( *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.OkResponse]: + ) -> AsyncLROPoller[None]: """Starts one or more virtual machines in a VM scale set. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -4871,9 +4752,8 @@ async def begin_start( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns OkResponse. The OkResponse is compatible - with MutableMapping - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.OkResponse] + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -4886,7 +4766,7 @@ async def begin_start( *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.OkResponse]: + ) -> AsyncLROPoller[None]: """Starts one or more virtual machines in a VM scale set. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -4900,9 +4780,8 @@ async def begin_start( :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns OkResponse. The OkResponse is compatible - with MutableMapping - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.OkResponse] + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -4913,7 +4792,7 @@ async def begin_start( vm_scale_set_name: str, vm_instance_i_ds: Optional[Union[_models.VirtualMachineScaleSetVMInstanceIDs, JSON, IO[bytes]]] = None, **kwargs: Any - ) -> AsyncLROPoller[_models.OkResponse]: + ) -> AsyncLROPoller[None]: """Starts one or more virtual machines in a VM scale set. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -4926,9 +4805,8 @@ async def begin_start( None. :type vm_instance_i_ds: ~azure.mgmt.compute.models.VirtualMachineScaleSetVMInstanceIDs or JSON or IO[bytes] - :return: An instance of AsyncLROPoller that returns OkResponse. The OkResponse is compatible - with MutableMapping - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.OkResponse] + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -4936,7 +4814,7 @@ async def begin_start( content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) content_type = content_type if vm_instance_i_ds else None - cls: ClsType[_models.OkResponse] = kwargs.pop("cls", None) + cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) @@ -4954,16 +4832,9 @@ async def begin_start( await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): - response_headers = {} - response = pipeline_response.http_response - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = _deserialize(_models.OkResponse, response.json()) + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized + return cls(pipeline_response, None, {}) # type: ignore path_format_arguments = { "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), @@ -4978,18 +4849,27 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller[_models.OkResponse].from_continuation_token( + return AsyncLROPoller[None].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller[_models.OkResponse]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - async def _start_extension_upgrade_initial( - self, resource_group_name: str, vm_scale_set_name: str, **kwargs: Any + @api_version_validation( + method_added_on="2025-04-01", + params_added_on={ + "2025-04-01": ["api_version", "subscription_id", "resource_group_name", "vm_scale_set_name", "content_type"] + }, + api_versions_list=["2025-04-01"], + ) + async def _scale_out_initial( + self, + resource_group_name: str, + vm_scale_set_name: str, + parameters: Union[_models.VMScaleSetScaleOutInput, JSON, IO[bytes]], + **kwargs: Any ) -> AsyncIterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -4999,419 +4879,26 @@ async def _start_extension_upgrade_initial( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - _request = build_virtual_machine_scale_sets_start_extension_upgrade_request( - resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, - subscription_id=self._config.subscription_id, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.CloudError, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.iter_bytes() - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_start_extension_upgrade( - self, resource_group_name: str, vm_scale_set_name: str, **kwargs: Any - ) -> AsyncLROPoller[_models.OkResponse]: - """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. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :return: An instance of AsyncLROPoller that returns OkResponse. The OkResponse is compatible - with MutableMapping - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.OkResponse] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[_models.OkResponse] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._start_extension_upgrade_initial( - resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - response_headers = {} - response = pipeline_response.http_response - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = _deserialize(_models.OkResponse, response.json()) - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized - - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + content_type = content_type or "application/json" + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.OkResponse].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.OkResponse]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _start_os_upgrade_initial( - self, resource_group_name: str, vm_scale_set_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - _request = build_virtual_machine_scale_sets_start_os_upgrade_request( + _request = build_virtual_machine_scale_sets_scale_out_request( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, subscription_id=self._config.subscription_id, + content_type=content_type, api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.CloudError, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.iter_bytes() - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_start_os_upgrade( - self, resource_group_name: str, vm_scale_set_name: str, **kwargs: Any - ) -> AsyncLROPoller[_models.OkResponse]: - """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. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :return: An instance of AsyncLROPoller that returns OkResponse. The OkResponse is compatible - with MutableMapping - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.OkResponse] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[_models.OkResponse] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._start_os_upgrade_initial( - resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - response_headers = {} - response = pipeline_response.http_response - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = _deserialize(_models.OkResponse, response.json()) - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized - - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.OkResponse].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.OkResponse]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _cancel_initial( - self, resource_group_name: str, vm_scale_set_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_virtual_machine_scale_sets_cancel_request( - resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, - subscription_id=self._config.subscription_id, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.CloudError, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.iter_bytes() - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_cancel( - self, resource_group_name: str, vm_scale_set_name: str, **kwargs: Any - ) -> AsyncLROPoller[_models.OkResponse]: - """Cancels the current virtual machine scale set rolling upgrade. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :return: An instance of AsyncLROPoller that returns OkResponse. The OkResponse is compatible - with MutableMapping - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.OkResponse] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[_models.OkResponse] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._cancel_initial( - resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - response_headers = {} - response = pipeline_response.http_response - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = _deserialize(_models.OkResponse, response.json()) - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized - - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.OkResponse].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.OkResponse]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @api_version_validation( - method_added_on="2025-04-01", - params_added_on={ - "2025-04-01": ["api_version", "subscription_id", "resource_group_name", "vm_scale_set_name", "content_type"] - }, - api_versions_list=["2025-04-01"], - ) - async def _scale_out_initial( - self, - resource_group_name: str, - vm_scale_set_name: str, - parameters: Union[_models.VMScaleSetScaleOutInput, JSON, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} - - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - - _request = build_virtual_machine_scale_sets_scale_out_request( - resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, - subscription_id=self._config.subscription_id, - content_type=content_type, - api_version=self._config.api_version, - content=_content, + content=_content, headers=_headers, params=_params, ) @@ -5457,7 +4944,7 @@ async def begin_scale_out( *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.OkResponse]: + ) -> AsyncLROPoller[None]: """Scales out one or more virtual machines in a VM scale set. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -5470,9 +4957,8 @@ async def begin_scale_out( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns OkResponse. The OkResponse is compatible - with MutableMapping - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.OkResponse] + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -5485,7 +4971,7 @@ async def begin_scale_out( *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.OkResponse]: + ) -> AsyncLROPoller[None]: """Scales out one or more virtual machines in a VM scale set. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -5498,9 +4984,8 @@ async def begin_scale_out( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns OkResponse. The OkResponse is compatible - with MutableMapping - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.OkResponse] + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -5513,7 +4998,7 @@ async def begin_scale_out( *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.OkResponse]: + ) -> AsyncLROPoller[None]: """Scales out one or more virtual machines in a VM scale set. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -5526,9 +5011,8 @@ async def begin_scale_out( :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns OkResponse. The OkResponse is compatible - with MutableMapping - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.OkResponse] + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -5546,7 +5030,7 @@ async def begin_scale_out( vm_scale_set_name: str, parameters: Union[_models.VMScaleSetScaleOutInput, JSON, IO[bytes]], **kwargs: Any - ) -> AsyncLROPoller[_models.OkResponse]: + ) -> AsyncLROPoller[None]: """Scales out one or more virtual machines in a VM scale set. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -5557,16 +5041,15 @@ async def begin_scale_out( :param parameters: The input object for ScaleOut API. Is one of the following types: VMScaleSetScaleOutInput, JSON, IO[bytes] Required. :type parameters: ~azure.mgmt.compute.models.VMScaleSetScaleOutInput or JSON or IO[bytes] - :return: An instance of AsyncLROPoller that returns OkResponse. The OkResponse is compatible - with MutableMapping - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.OkResponse] + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.OkResponse] = kwargs.pop("cls", None) + cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) @@ -5584,16 +5067,9 @@ async def begin_scale_out( await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): - response_headers = {} - response = pipeline_response.http_response - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = _deserialize(_models.OkResponse, response.json()) + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized + return cls(pipeline_response, None, {}) # type: ignore path_format_arguments = { "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), @@ -5608,50 +5084,30 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller[_models.OkResponse].from_continuation_token( + return AsyncLROPoller[None].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller[_models.OkResponse]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - -class RollingUpgradeStatusInfosOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.compute.aio.ComputeClient`'s - :attr:`rolling_upgrade_status_infos` attribute. - """ - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ComputeClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # 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. + @distributed_trace + def list_by_location(self, location: str, **kwargs: Any) -> AsyncItemPaged["_models.VirtualMachineScaleSet"]: + """Gets all the VM scale sets under the specified subscription for the specified location. - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :return: RollingUpgradeStatusInfo. The RollingUpgradeStatusInfo is compatible with - MutableMapping - :rtype: ~azure.mgmt.compute.models.RollingUpgradeStatusInfo + :param location: The location name. Required. + :type location: str + :return: An iterator like instance of VirtualMachineScaleSet + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.models.VirtualMachineScaleSet] :raises ~azure.core.exceptions.HttpResponseError: """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.VirtualMachineScaleSet]] = kwargs.pop("cls", None) + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -5660,50 +5116,69 @@ async def get_latest( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} + def prepare_request(next_link=None): + if not next_link: - cls: ClsType[_models.RollingUpgradeStatusInfo] = kwargs.pop("cls", None) + _request = build_virtual_machine_scale_sets_list_by_location_request( + location=location, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) - _request = build_rolling_upgrade_status_infos_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=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) - _stream = kwargs.pop("stream", False) - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) + return _request - response = pipeline_response.http_response + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.VirtualMachineScaleSet], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) - if response.status_code not in [200]: - if _stream: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.CloudError, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + async def get_next(next_link=None): + _request = prepare_request(next_link) - if _stream: - deserialized = response.iter_bytes() - else: - deserialized = _deserialize(_models.RollingUpgradeStatusInfo, response.json()) + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - return deserialized # type: ignore + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) class VirtualMachineScaleSetExtensionsOperations: # pylint: disable=name-too-long @@ -5887,7 +5362,7 @@ async def begin_create_or_update( *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[None]: + ) -> AsyncLROPoller[_models.VirtualMachineScaleSetExtension]: """The operation to create or update an extension. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -5903,8 +5378,10 @@ async def begin_create_or_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns None - :rtype: ~azure.core.polling.AsyncLROPoller[None] + :return: An instance of AsyncLROPoller that returns VirtualMachineScaleSetExtension. The + VirtualMachineScaleSetExtension is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.VirtualMachineScaleSetExtension] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -5918,7 +5395,7 @@ async def begin_create_or_update( *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[None]: + ) -> AsyncLROPoller[_models.VirtualMachineScaleSetExtension]: """The operation to create or update an extension. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -5934,8 +5411,10 @@ async def begin_create_or_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns None - :rtype: ~azure.core.polling.AsyncLROPoller[None] + :return: An instance of AsyncLROPoller that returns VirtualMachineScaleSetExtension. The + VirtualMachineScaleSetExtension is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.VirtualMachineScaleSetExtension] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -5949,7 +5428,7 @@ async def begin_create_or_update( *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[None]: + ) -> AsyncLROPoller[_models.VirtualMachineScaleSetExtension]: """The operation to create or update an extension. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -5965,8 +5444,10 @@ async def begin_create_or_update( :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns None - :rtype: ~azure.core.polling.AsyncLROPoller[None] + :return: An instance of AsyncLROPoller that returns VirtualMachineScaleSetExtension. The + VirtualMachineScaleSetExtension is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.VirtualMachineScaleSetExtension] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -5978,7 +5459,7 @@ async def begin_create_or_update( vmss_extension_name: str, extension_parameters: Union[_models.VirtualMachineScaleSetExtension, JSON, IO[bytes]], **kwargs: Any - ) -> AsyncLROPoller[None]: + ) -> AsyncLROPoller[_models.VirtualMachineScaleSetExtension]: """The operation to create or update an extension. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -5993,15 +5474,17 @@ async def begin_create_or_update( Required. :type extension_parameters: ~azure.mgmt.compute.models.VirtualMachineScaleSetExtension or JSON or IO[bytes] - :return: An instance of AsyncLROPoller that returns None - :rtype: ~azure.core.polling.AsyncLROPoller[None] + :return: An instance of AsyncLROPoller that returns VirtualMachineScaleSetExtension. The + VirtualMachineScaleSetExtension is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.VirtualMachineScaleSetExtension] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[_models.VirtualMachineScaleSetExtension] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) @@ -6020,9 +5503,12 @@ async def begin_create_or_update( await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.VirtualMachineScaleSetExtension, response.json()) if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized path_format_arguments = { "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), @@ -6037,13 +5523,15 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return AsyncLROPoller[None].from_continuation_token( + return AsyncLROPoller[_models.VirtualMachineScaleSetExtension].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + return AsyncLROPoller[_models.VirtualMachineScaleSetExtension]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) async def _update_initial( self, @@ -6128,7 +5616,7 @@ async def begin_update( *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[None]: + ) -> AsyncLROPoller[_models.VirtualMachineScaleSetExtension]: """The operation to update an extension. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -6144,8 +5632,10 @@ async def begin_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns None - :rtype: ~azure.core.polling.AsyncLROPoller[None] + :return: An instance of AsyncLROPoller that returns VirtualMachineScaleSetExtension. The + VirtualMachineScaleSetExtension is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.VirtualMachineScaleSetExtension] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -6159,7 +5649,7 @@ async def begin_update( *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[None]: + ) -> AsyncLROPoller[_models.VirtualMachineScaleSetExtension]: """The operation to update an extension. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -6175,8 +5665,10 @@ async def begin_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns None - :rtype: ~azure.core.polling.AsyncLROPoller[None] + :return: An instance of AsyncLROPoller that returns VirtualMachineScaleSetExtension. The + VirtualMachineScaleSetExtension is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.VirtualMachineScaleSetExtension] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -6190,7 +5682,7 @@ async def begin_update( *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[None]: + ) -> AsyncLROPoller[_models.VirtualMachineScaleSetExtension]: """The operation to update an extension. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -6206,8 +5698,10 @@ async def begin_update( :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns None - :rtype: ~azure.core.polling.AsyncLROPoller[None] + :return: An instance of AsyncLROPoller that returns VirtualMachineScaleSetExtension. The + VirtualMachineScaleSetExtension is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.VirtualMachineScaleSetExtension] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -6219,7 +5713,7 @@ async def begin_update( vmss_extension_name: str, extension_parameters: Union[_models.VirtualMachineScaleSetExtensionUpdate, JSON, IO[bytes]], **kwargs: Any - ) -> AsyncLROPoller[None]: + ) -> AsyncLROPoller[_models.VirtualMachineScaleSetExtension]: """The operation to update an extension. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -6234,15 +5728,17 @@ async def begin_update( IO[bytes] Required. :type extension_parameters: ~azure.mgmt.compute.models.VirtualMachineScaleSetExtensionUpdate or JSON or IO[bytes] - :return: An instance of AsyncLROPoller that returns None - :rtype: ~azure.core.polling.AsyncLROPoller[None] + :return: An instance of AsyncLROPoller that returns VirtualMachineScaleSetExtension. The + VirtualMachineScaleSetExtension is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.VirtualMachineScaleSetExtension] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[_models.VirtualMachineScaleSetExtension] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) @@ -6261,9 +5757,12 @@ async def begin_update( await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.VirtualMachineScaleSetExtension, response.json()) if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized path_format_arguments = { "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), @@ -6278,13 +5777,15 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return AsyncLROPoller[None].from_continuation_token( + return AsyncLROPoller[_models.VirtualMachineScaleSetExtension].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + return AsyncLROPoller[_models.VirtualMachineScaleSetExtension]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) async def _delete_initial( self, resource_group_name: str, vm_scale_set_name: str, vmss_extension_name: str, **kwargs: Any @@ -6501,14 +6002,14 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) -class VirtualMachineScaleSetVMSOperations: # pylint: disable=too-many-public-methods +class VirtualMachineScaleSetVMExtensionsOperations: # pylint: disable=name-too-long """ .. warning:: **DO NOT** instantiate this class directly. Instead, you should access the following operations through :class:`~azure.mgmt.compute.aio.ComputeClient`'s - :attr:`virtual_machine_scale_set_vms` attribute. + :attr:`virtual_machine_scale_set_vm_extensions` attribute. """ def __init__(self, *args, **kwargs) -> None: @@ -6524,11 +6025,12 @@ async def get( resource_group_name: str, vm_scale_set_name: str, instance_id: str, + vm_extension_name: str, *, - expand: Optional[Union[str, _models.InstanceViewTypes]] = None, + expand: Optional[str] = None, **kwargs: Any - ) -> _models.VirtualMachineScaleSetVM: - """Gets a virtual machine from a VM scale set. + ) -> _models.VirtualMachineScaleSetVMExtension: + """The operation to get the VMSS VM extension. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -6537,14 +6039,13 @@ async def get( :type vm_scale_set_name: str :param instance_id: The instance ID of the virtual machine. Required. :type instance_id: str - :keyword 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. Known values are: "instanceView", "userData", and "resiliencyView". Default value is - None. - :paramtype expand: str or ~azure.mgmt.compute.models.InstanceViewTypes - :return: VirtualMachineScaleSetVM. The VirtualMachineScaleSetVM is compatible with - MutableMapping - :rtype: ~azure.mgmt.compute.models.VirtualMachineScaleSetVM + :param vm_extension_name: The name of the virtual machine extension. Required. + :type vm_extension_name: str + :keyword expand: The expand expression to apply on the operation. Default value is None. + :paramtype expand: str + :return: VirtualMachineScaleSetVMExtension. The VirtualMachineScaleSetVMExtension is compatible + with MutableMapping + :rtype: ~azure.mgmt.compute.models.VirtualMachineScaleSetVMExtension :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -6558,12 +6059,13 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.VirtualMachineScaleSetVM] = kwargs.pop("cls", None) + cls: ClsType[_models.VirtualMachineScaleSetVMExtension] = kwargs.pop("cls", None) - _request = build_virtual_machine_scale_set_vms_get_request( + _request = build_virtual_machine_scale_set_vm_extensions_get_request( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, + vm_extension_name=vm_extension_name, subscription_id=self._config.subscription_id, expand=expand, api_version=self._config.api_version, @@ -6595,22 +6097,20 @@ async def get( if _stream: deserialized = response.iter_bytes() else: - deserialized = _deserialize(_models.VirtualMachineScaleSetVM, response.json()) + deserialized = _deserialize(_models.VirtualMachineScaleSetVMExtension, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - async def _update_initial( + async def _create_or_update_initial( self, resource_group_name: str, vm_scale_set_name: str, instance_id: str, - parameters: Union[_models.VirtualMachineScaleSetVM, JSON, IO[bytes]], - *, - etag: Optional[str] = None, - match_condition: Optional[MatchConditions] = None, + vm_extension_name: str, + extension_parameters: Union[_models.VirtualMachineScaleSetVMExtension, JSON, IO[bytes]], **kwargs: Any ) -> AsyncIterator[bytes]: error_map: MutableMapping = { @@ -6619,12 +6119,6 @@ async def _update_initial( 409: ResourceExistsError, 304: ResourceNotModifiedError, } - if match_condition == MatchConditions.IfNotModified: - error_map[412] = ResourceModifiedError - elif match_condition == MatchConditions.IfPresent: - error_map[412] = ResourceNotFoundError - elif match_condition == MatchConditions.IfMissing: - error_map[412] = ResourceExistsError error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -6635,18 +6129,17 @@ async def _update_initial( content_type = content_type or "application/json" _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters + if isinstance(extension_parameters, (IOBase, bytes)): + _content = extension_parameters else: - _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(extension_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - _request = build_virtual_machine_scale_set_vms_update_request( + _request = build_virtual_machine_scale_set_vm_extensions_create_or_update_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, - etag=etag, - match_condition=match_condition, content_type=content_type, api_version=self._config.api_version, content=_content, @@ -6665,7 +6158,7 @@ async def _update_initial( response = pipeline_response.http_response - if response.status_code not in [200, 202]: + if response.status_code not in [200, 201]: try: await response.read() # Load the body in memory and close the socket except (StreamConsumedError, StreamClosedError): @@ -6675,7 +6168,7 @@ async def _update_initial( raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} - if response.status_code == 202: + if response.status_code == 201: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) @@ -6687,19 +6180,18 @@ async def _update_initial( return deserialized # type: ignore @overload - async def begin_update( + async def begin_create_or_update( self, resource_group_name: str, vm_scale_set_name: str, instance_id: str, - parameters: _models.VirtualMachineScaleSetVM, + vm_extension_name: str, + extension_parameters: _models.VirtualMachineScaleSetVMExtension, *, content_type: str = "application/json", - etag: Optional[str] = None, - match_condition: Optional[MatchConditions] = None, **kwargs: Any - ) -> AsyncLROPoller[None]: - """Updates a virtual machine of a VM scale set. + ) -> AsyncLROPoller[_models.VirtualMachineScaleSetVMExtension]: + """The operation to create or update the VMSS VM extension. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -6708,36 +6200,34 @@ async def begin_update( :type vm_scale_set_name: str :param instance_id: The instance ID of the virtual machine. Required. :type instance_id: str - :param parameters: Parameters supplied to the Update Virtual Machine Scale Sets VM operation. - Required. - :type parameters: ~azure.mgmt.compute.models.VirtualMachineScaleSetVM + :param vm_extension_name: The name of the virtual machine extension. Required. + :type vm_extension_name: str + :param extension_parameters: Parameters supplied to the Create Virtual Machine Extension + operation. Required. + :type extension_parameters: ~azure.mgmt.compute.models.VirtualMachineScaleSetVMExtension :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is - None. - :paramtype etag: str - :keyword match_condition: The match condition to use upon the etag. Default value is None. - :paramtype match_condition: ~azure.core.MatchConditions - :return: An instance of AsyncLROPoller that returns None - :rtype: ~azure.core.polling.AsyncLROPoller[None] + :return: An instance of AsyncLROPoller that returns VirtualMachineScaleSetVMExtension. The + VirtualMachineScaleSetVMExtension is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.VirtualMachineScaleSetVMExtension] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - async def begin_update( + async def begin_create_or_update( self, resource_group_name: str, vm_scale_set_name: str, instance_id: str, - parameters: JSON, + vm_extension_name: str, + extension_parameters: JSON, *, content_type: str = "application/json", - etag: Optional[str] = None, - match_condition: Optional[MatchConditions] = None, **kwargs: Any - ) -> AsyncLROPoller[None]: - """Updates a virtual machine of a VM scale set. + ) -> AsyncLROPoller[_models.VirtualMachineScaleSetVMExtension]: + """The operation to create or update the VMSS VM extension. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -6746,36 +6236,34 @@ async def begin_update( :type vm_scale_set_name: str :param instance_id: The instance ID of the virtual machine. Required. :type instance_id: str - :param parameters: Parameters supplied to the Update Virtual Machine Scale Sets VM operation. - Required. - :type parameters: JSON + :param vm_extension_name: The name of the virtual machine extension. Required. + :type vm_extension_name: str + :param extension_parameters: Parameters supplied to the Create Virtual Machine Extension + operation. Required. + :type extension_parameters: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is - None. - :paramtype etag: str - :keyword match_condition: The match condition to use upon the etag. Default value is None. - :paramtype match_condition: ~azure.core.MatchConditions - :return: An instance of AsyncLROPoller that returns None - :rtype: ~azure.core.polling.AsyncLROPoller[None] + :return: An instance of AsyncLROPoller that returns VirtualMachineScaleSetVMExtension. The + VirtualMachineScaleSetVMExtension is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.VirtualMachineScaleSetVMExtension] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - async def begin_update( + async def begin_create_or_update( self, resource_group_name: str, vm_scale_set_name: str, instance_id: str, - parameters: IO[bytes], + vm_extension_name: str, + extension_parameters: IO[bytes], *, content_type: str = "application/json", - etag: Optional[str] = None, - match_condition: Optional[MatchConditions] = None, **kwargs: Any - ) -> AsyncLROPoller[None]: - """Updates a virtual machine of a VM scale set. + ) -> AsyncLROPoller[_models.VirtualMachineScaleSetVMExtension]: + """The operation to create or update the VMSS VM extension. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -6784,35 +6272,32 @@ async def begin_update( :type vm_scale_set_name: str :param instance_id: The instance ID of the virtual machine. Required. :type instance_id: str - :param parameters: Parameters supplied to the Update Virtual Machine Scale Sets VM operation. - Required. - :type parameters: IO[bytes] + :param vm_extension_name: The name of the virtual machine extension. Required. + :type vm_extension_name: str + :param extension_parameters: Parameters supplied to the Create Virtual Machine Extension + operation. Required. + :type extension_parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is - None. - :paramtype etag: str - :keyword match_condition: The match condition to use upon the etag. Default value is None. - :paramtype match_condition: ~azure.core.MatchConditions - :return: An instance of AsyncLROPoller that returns None - :rtype: ~azure.core.polling.AsyncLROPoller[None] + :return: An instance of AsyncLROPoller that returns VirtualMachineScaleSetVMExtension. The + VirtualMachineScaleSetVMExtension is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.VirtualMachineScaleSetVMExtension] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace_async - async def begin_update( + async def begin_create_or_update( self, resource_group_name: str, vm_scale_set_name: str, instance_id: str, - parameters: Union[_models.VirtualMachineScaleSetVM, JSON, IO[bytes]], - *, - etag: Optional[str] = None, - match_condition: Optional[MatchConditions] = None, + vm_extension_name: str, + extension_parameters: Union[_models.VirtualMachineScaleSetVMExtension, JSON, IO[bytes]], **kwargs: Any - ) -> AsyncLROPoller[None]: - """Updates a virtual machine of a VM scale set. + ) -> AsyncLROPoller[_models.VirtualMachineScaleSetVMExtension]: + """The operation to create or update the VMSS VM extension. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -6821,34 +6306,34 @@ async def begin_update( :type vm_scale_set_name: str :param instance_id: The instance ID of the virtual machine. Required. :type instance_id: str - :param parameters: Parameters supplied to the Update Virtual Machine Scale Sets VM operation. - Is one of the following types: VirtualMachineScaleSetVM, JSON, IO[bytes] Required. - :type parameters: ~azure.mgmt.compute.models.VirtualMachineScaleSetVM or JSON or IO[bytes] - :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is - None. - :paramtype etag: str - :keyword match_condition: The match condition to use upon the etag. Default value is None. - :paramtype match_condition: ~azure.core.MatchConditions - :return: An instance of AsyncLROPoller that returns None - :rtype: ~azure.core.polling.AsyncLROPoller[None] + :param vm_extension_name: The name of the virtual machine extension. Required. + :type vm_extension_name: str + :param extension_parameters: Parameters supplied to the Create Virtual Machine Extension + operation. Is one of the following types: VirtualMachineScaleSetVMExtension, JSON, IO[bytes] + Required. + :type extension_parameters: ~azure.mgmt.compute.models.VirtualMachineScaleSetVMExtension or + JSON or IO[bytes] + :return: An instance of AsyncLROPoller that returns VirtualMachineScaleSetVMExtension. The + VirtualMachineScaleSetVMExtension is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.VirtualMachineScaleSetVMExtension] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[_models.VirtualMachineScaleSetVMExtension] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._update_initial( + 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, - parameters=parameters, - etag=etag, - match_condition=match_condition, + vm_extension_name=vm_extension_name, + extension_parameters=extension_parameters, content_type=content_type, cls=lambda x, y, z: x, headers=_headers, @@ -6858,9 +6343,12 @@ async def begin_update( await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.VirtualMachineScaleSetVMExtension, response.json()) if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized path_format_arguments = { "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), @@ -6875,21 +6363,23 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return AsyncLROPoller[None].from_continuation_token( + return AsyncLROPoller[_models.VirtualMachineScaleSetVMExtension].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + return AsyncLROPoller[_models.VirtualMachineScaleSetVMExtension]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) - async def _delete_initial( + async def _update_initial( self, resource_group_name: str, vm_scale_set_name: str, instance_id: str, - *, - force_deletion: Optional[bool] = None, + vm_extension_name: str, + extension_parameters: Union[_models.VirtualMachineScaleSetVMExtensionUpdate, JSON, IO[bytes]], **kwargs: Any ) -> AsyncIterator[bytes]: error_map: MutableMapping = { @@ -6900,18 +6390,28 @@ async def _delete_initial( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - _request = build_virtual_machine_scale_set_vms_delete_request( + content_type = content_type or "application/json" + _content = None + if isinstance(extension_parameters, (IOBase, bytes)): + _content = extension_parameters + else: + _content = json.dumps(extension_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_virtual_machine_scale_set_vm_extensions_update_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, - force_deletion=force_deletion, + content_type=content_type, api_version=self._config.api_version, + content=_content, headers=_headers, params=_params, ) @@ -6927,7 +6427,7 @@ async def _delete_initial( response = pipeline_response.http_response - if response.status_code not in [200, 202, 204]: + if response.status_code not in [200]: try: await response.read() # Load the body in memory and close the socket except (StreamConsumedError, StreamClosedError): @@ -6937,9 +6437,8 @@ async def _delete_initial( raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) deserialized = response.iter_bytes() @@ -6948,17 +6447,19 @@ async def _delete_initial( return deserialized # type: ignore - @distributed_trace_async - async def begin_delete( + @overload + 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, *, - force_deletion: Optional[bool] = None, + content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[None]: - """Deletes a virtual machine from a VM scale set. + ) -> AsyncLROPoller[_models.VirtualMachineScaleSetVMExtension]: + """The operation to update the VMSS VM extension. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -6967,26 +6468,141 @@ async def begin_delete( :type vm_scale_set_name: str :param instance_id: The instance ID of the virtual machine. Required. :type instance_id: str - :keyword force_deletion: Optional parameter to force delete a virtual machine from a VM scale - set. (Feature in Preview). Default value is None. - :paramtype force_deletion: bool - :return: An instance of AsyncLROPoller that returns None - :rtype: ~azure.core.polling.AsyncLROPoller[None] + :param vm_extension_name: The name of the virtual machine extension. Required. + :type vm_extension_name: str + :param extension_parameters: Parameters supplied to the Update Virtual Machine Extension + operation. Required. + :type extension_parameters: ~azure.mgmt.compute.models.VirtualMachineScaleSetVMExtensionUpdate + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns VirtualMachineScaleSetVMExtension. The + VirtualMachineScaleSetVMExtension is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.VirtualMachineScaleSetVMExtension] :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = kwargs.pop("headers", {}) or {} + + @overload + async def begin_update( + self, + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + vm_extension_name: str, + extension_parameters: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.VirtualMachineScaleSetVMExtension]: + """The operation to update the VMSS VM extension. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. Required. + :type instance_id: str + :param vm_extension_name: The name of the virtual machine extension. Required. + :type vm_extension_name: str + :param extension_parameters: Parameters supplied to the Update Virtual Machine Extension + operation. Required. + :type extension_parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns VirtualMachineScaleSetVMExtension. The + VirtualMachineScaleSetVMExtension is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.VirtualMachineScaleSetVMExtension] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update( + self, + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + vm_extension_name: str, + extension_parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.VirtualMachineScaleSetVMExtension]: + """The operation to update the VMSS VM extension. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. Required. + :type instance_id: str + :param vm_extension_name: The name of the virtual machine extension. Required. + :type vm_extension_name: str + :param extension_parameters: Parameters supplied to the Update Virtual Machine Extension + operation. Required. + :type extension_parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns VirtualMachineScaleSetVMExtension. The + VirtualMachineScaleSetVMExtension is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.VirtualMachineScaleSetVMExtension] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @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: Union[_models.VirtualMachineScaleSetVMExtensionUpdate, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.VirtualMachineScaleSetVMExtension]: + """The operation to update the VMSS VM extension. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. Required. + :type instance_id: str + :param vm_extension_name: The name of the virtual machine extension. Required. + :type vm_extension_name: str + :param extension_parameters: Parameters supplied to the Update Virtual Machine Extension + operation. Is one of the following types: VirtualMachineScaleSetVMExtensionUpdate, JSON, + IO[bytes] Required. + :type extension_parameters: ~azure.mgmt.compute.models.VirtualMachineScaleSetVMExtensionUpdate + or JSON or IO[bytes] + :return: An instance of AsyncLROPoller that returns VirtualMachineScaleSetVMExtension. The + VirtualMachineScaleSetVMExtension is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.VirtualMachineScaleSetVMExtension] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - cls: ClsType[None] = kwargs.pop("cls", None) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.VirtualMachineScaleSetVMExtension] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._delete_initial( + raw_result = await self._update_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, - force_deletion=force_deletion, + vm_extension_name=vm_extension_name, + extension_parameters=extension_parameters, + content_type=content_type, cls=lambda x, y, z: x, headers=_headers, params=_params, @@ -6995,9 +6611,16 @@ async def begin_delete( await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = _deserialize(_models.VirtualMachineScaleSetVMExtension, response.json()) if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore + return deserialized path_format_arguments = { "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), @@ -7012,130 +6635,18 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return AsyncLROPoller[None].from_continuation_token( + return AsyncLROPoller[_models.VirtualMachineScaleSetVMExtension].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # 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 - ) -> AsyncItemPaged["_models.VirtualMachineScaleSetVM"]: - """Gets a list of all virtual machines in a VM scale sets. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param virtual_machine_scale_set_name: The name of the VirtualMachineScaleSet. Required. - :type virtual_machine_scale_set_name: str - :keyword 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. - :paramtype filter: str - :keyword select: The list parameters. Allowed values are 'instanceView', - 'instanceView/statuses'. Default value is None. - :paramtype select: str - :keyword expand: The expand expression to apply to the operation. Allowed values are - 'instanceView'. Default value is None. - :paramtype expand: str - :return: An iterator like instance of VirtualMachineScaleSetVM - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.models.VirtualMachineScaleSetVM] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[List[_models.VirtualMachineScaleSetVM]] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_virtual_machine_scale_set_vms_list_request( - resource_group_name=resource_group_name, - virtual_machine_scale_set_name=virtual_machine_scale_set_name, - subscription_id=self._config.subscription_id, - filter=filter, - select=select, - expand=expand, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - return _request - - async def extract_data(pipeline_response): - deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.VirtualMachineScaleSetVM], deserialized.get("value", [])) - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.get("nextLink") or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.CloudError, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) + return AsyncLROPoller[_models.VirtualMachineScaleSetVMExtension]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) - async def _approve_rolling_upgrade_initial( - self, resource_group_name: str, vm_scale_set_name: str, instance_id: str, **kwargs: Any + async def _delete_initial( + self, resource_group_name: str, vm_scale_set_name: str, instance_id: str, vm_extension_name: str, **kwargs: Any ) -> AsyncIterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -7150,10 +6661,11 @@ async def _approve_rolling_upgrade_initial( cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - _request = build_virtual_machine_scale_set_vms_approve_rolling_upgrade_request( + _request = build_virtual_machine_scale_set_vm_extensions_delete_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=self._config.api_version, headers=_headers, @@ -7171,7 +6683,7 @@ async def _approve_rolling_upgrade_initial( response = pipeline_response.http_response - if response.status_code not in [202]: + if response.status_code not in [200, 202, 204]: try: await response.read() # Load the body in memory and close the socket except (StreamConsumedError, StreamClosedError): @@ -7181,8 +6693,9 @@ async def _approve_rolling_upgrade_initial( raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) deserialized = response.iter_bytes() @@ -7192,10 +6705,10 @@ async def _approve_rolling_upgrade_initial( return deserialized # type: ignore @distributed_trace_async - async def begin_approve_rolling_upgrade( - self, resource_group_name: str, vm_scale_set_name: str, instance_id: str, **kwargs: Any + async def begin_delete( + self, resource_group_name: str, vm_scale_set_name: str, instance_id: str, vm_extension_name: str, **kwargs: Any ) -> AsyncLROPoller[None]: - """Approve upgrade on deferred rolling upgrade for OS disk on a VM scale set instance. + """The operation to delete the VMSS VM extension. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -7204,6 +6717,8 @@ async def begin_approve_rolling_upgrade( :type vm_scale_set_name: str :param instance_id: The instance ID of the virtual machine. Required. :type instance_id: str + :param vm_extension_name: The name of the virtual machine extension. Required. + :type vm_extension_name: str :return: An instance of AsyncLROPoller that returns None :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -7216,10 +6731,11 @@ async def begin_approve_rolling_upgrade( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._approve_rolling_upgrade_initial( + raw_result = await self._delete_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, + vm_extension_name=vm_extension_name, cls=lambda x, y, z: x, headers=_headers, params=_params, @@ -7253,27 +6769,51 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - async def _deallocate_initial( - self, resource_group_name: str, vm_scale_set_name: str, instance_id: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} + @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. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. Required. + :type instance_id: str + :keyword expand: The expand expression to apply on the operation. Default value is None. + :paramtype expand: str + :return: VirtualMachineScaleSetVMExtensionsListResult. The + VirtualMachineScaleSetVMExtensionsListResult is compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.VirtualMachineScaleSetVMExtensionsListResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + cls: ClsType[_models.VirtualMachineScaleSetVMExtensionsListResult] = kwargs.pop("cls", None) - _request = build_virtual_machine_scale_set_vms_deallocate_request( + _request = build_virtual_machine_scale_set_vm_extensions_list_request( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, subscription_id=self._config.subscription_id, + expand=expand, api_version=self._config.api_version, headers=_headers, params=_params, @@ -7283,124 +6823,75 @@ async def _deallocate_initial( } _request.url = self._client.format_url(_request.url, **path_format_arguments) - _stream = True + _stream = kwargs.pop("stream", False) pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200, 202]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = _failsafe_deserialize(_models.CloudError, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.iter_bytes() + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.VirtualMachineScaleSetVMExtensionsListResult, response.json()) if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - @distributed_trace_async - async def begin_deallocate( - self, resource_group_name: str, vm_scale_set_name: str, instance_id: str, **kwargs: Any - ) -> AsyncLROPoller[_models.OkResponse]: - """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. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param instance_id: The instance ID of the virtual machine. Required. - :type instance_id: str - :return: An instance of AsyncLROPoller that returns OkResponse. The OkResponse is compatible - with MutableMapping - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.OkResponse] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[_models.OkResponse] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._deallocate_initial( - resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, - instance_id=instance_id, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - response_headers = {} - response = pipeline_response.http_response - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - deserialized = _deserialize(_models.OkResponse, response.json()) - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized +class VirtualMachinesOperations: # pylint: disable=too-many-public-methods + """ + .. warning:: + **DO NOT** instantiate this class directly. - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } + Instead, you should access the following operations through + :class:`~azure.mgmt.compute.aio.ComputeClient`'s + :attr:`virtual_machines` attribute. + """ - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.OkResponse].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.OkResponse]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @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. + 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. The name is case insensitive. Required. :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param instance_id: The instance ID of the virtual machine. Required. - :type instance_id: str - :return: VirtualMachineScaleSetVMInstanceView. The VirtualMachineScaleSetVMInstanceView is - compatible with MutableMapping - :rtype: ~azure.mgmt.compute.models.VirtualMachineScaleSetVMInstanceView + :param vm_name: The name of the virtual machine. Required. + :type vm_name: str + :keyword 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. + Known values are: "instanceView", "userData", and "resiliencyView". Default value is None. + :paramtype expand: str or ~azure.mgmt.compute.models.InstanceViewTypes + :return: VirtualMachine. The VirtualMachine is compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.VirtualMachine :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -7414,13 +6905,13 @@ async def get_instance_view( _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.VirtualMachineScaleSetVMInstanceView] = kwargs.pop("cls", None) + cls: ClsType[_models.VirtualMachine] = kwargs.pop("cls", None) - _request = build_virtual_machine_scale_set_vms_get_instance_view_request( + _request = build_virtual_machines_get_request( resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, - instance_id=instance_id, + vm_name=vm_name, subscription_id=self._config.subscription_id, + expand=expand, api_version=self._config.api_version, headers=_headers, params=_params, @@ -7450,21 +6941,21 @@ async def get_instance_view( if _stream: deserialized = response.iter_bytes() else: - deserialized = _deserialize(_models.VirtualMachineScaleSetVMInstanceView, response.json()) + deserialized = _deserialize(_models.VirtualMachine, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - async def _reimage_initial( + async def _create_or_update_initial( self, resource_group_name: str, - vm_scale_set_name: str, - instance_id: str, - vm_scale_set_vm_reimage_input: Optional[ - Union[_models.VirtualMachineScaleSetVMReimageParameters, JSON, IO[bytes]] - ] = None, + vm_name: str, + parameters: Union[_models.VirtualMachine, JSON, IO[bytes]], + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, **kwargs: Any ) -> AsyncIterator[bytes]: error_map: MutableMapping = { @@ -7473,30 +6964,33 @@ async def _reimage_initial( 409: ResourceExistsError, 304: ResourceNotModifiedError, } + if match_condition == MatchConditions.IfNotModified: + error_map[412] = ResourceModifiedError + elif match_condition == MatchConditions.IfPresent: + error_map[412] = ResourceNotFoundError + elif match_condition == MatchConditions.IfMissing: + error_map[412] = ResourceExistsError error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - content_type = content_type if vm_scale_set_vm_reimage_input else None cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - content_type = content_type or "application/json" if vm_scale_set_vm_reimage_input else None + content_type = content_type or "application/json" _content = None - if isinstance(vm_scale_set_vm_reimage_input, (IOBase, bytes)): - _content = vm_scale_set_vm_reimage_input + if isinstance(parameters, (IOBase, bytes)): + _content = parameters else: - if vm_scale_set_vm_reimage_input is not None: - _content = json.dumps(vm_scale_set_vm_reimage_input, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - else: - _content = None + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - _request = build_virtual_machine_scale_set_vms_reimage_request( + _request = build_virtual_machines_create_or_update_request( resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, - instance_id=instance_id, + vm_name=vm_name, subscription_id=self._config.subscription_id, + etag=etag, + match_condition=match_condition, content_type=content_type, api_version=self._config.api_version, content=_content, @@ -7515,7 +7009,7 @@ async def _reimage_initial( response = pipeline_response.http_response - if response.status_code not in [200, 202]: + if response.status_code not in [200, 201]: try: await response.read() # Load the body in memory and close the socket except (StreamConsumedError, StreamClosedError): @@ -7525,7 +7019,7 @@ async def _reimage_initial( raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} - if response.status_code == 202: + if response.status_code == 201: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) @@ -7537,147 +7031,160 @@ async def _reimage_initial( return deserialized # type: ignore @overload - async def begin_reimage( + async def begin_create_or_update( self, resource_group_name: str, - vm_scale_set_name: str, - instance_id: str, - vm_scale_set_vm_reimage_input: Optional[_models.VirtualMachineScaleSetVMReimageParameters] = None, + vm_name: str, + parameters: _models.VirtualMachine, *, content_type: str = "application/json", + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, **kwargs: Any - ) -> AsyncLROPoller[_models.OkResponse]: - """Reimages (upgrade the operating system) a specific virtual machine in a VM scale set. + ) -> 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. The name is case insensitive. Required. :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param instance_id: The instance ID of the virtual machine. Required. - :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.models.VirtualMachineScaleSetVMReimageParameters + :param vm_name: The name of the virtual machine. Required. + :type vm_name: str + :param parameters: Parameters supplied to the Create Virtual Machine operation. Required. + :type parameters: ~azure.mgmt.compute.models.VirtualMachine :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns OkResponse. The OkResponse is compatible - with MutableMapping - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.OkResponse] + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of AsyncLROPoller that returns VirtualMachine. The VirtualMachine is + compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.VirtualMachine] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - async def begin_reimage( + async def begin_create_or_update( self, resource_group_name: str, - vm_scale_set_name: str, - instance_id: str, - vm_scale_set_vm_reimage_input: Optional[JSON] = None, + vm_name: str, + parameters: JSON, *, content_type: str = "application/json", + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, **kwargs: Any - ) -> AsyncLROPoller[_models.OkResponse]: - """Reimages (upgrade the operating system) a specific virtual machine in a VM scale set. + ) -> 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. The name is case insensitive. Required. :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param instance_id: The instance ID of the virtual machine. Required. - :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: JSON + :param vm_name: The name of the virtual machine. Required. + :type vm_name: str + :param parameters: Parameters supplied to the Create Virtual Machine operation. Required. + :type parameters: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns OkResponse. The OkResponse is compatible - with MutableMapping - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.OkResponse] + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of AsyncLROPoller that returns VirtualMachine. The VirtualMachine is + compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.VirtualMachine] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - async def begin_reimage( + async def begin_create_or_update( self, resource_group_name: str, - vm_scale_set_name: str, - instance_id: str, - vm_scale_set_vm_reimage_input: Optional[IO[bytes]] = None, + vm_name: str, + parameters: IO[bytes], *, content_type: str = "application/json", + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, **kwargs: Any - ) -> AsyncLROPoller[_models.OkResponse]: - """Reimages (upgrade the operating system) a specific virtual machine in a VM scale set. + ) -> 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. The name is case insensitive. Required. :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param instance_id: The instance ID of the virtual machine. Required. - :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: IO[bytes] + :param vm_name: The name of the virtual machine. Required. + :type vm_name: str + :param parameters: Parameters supplied to the Create Virtual Machine operation. Required. + :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns OkResponse. The OkResponse is compatible - with MutableMapping - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.OkResponse] + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of AsyncLROPoller that returns VirtualMachine. The VirtualMachine is + compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.VirtualMachine] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace_async - async def begin_reimage( + async def begin_create_or_update( self, resource_group_name: str, - vm_scale_set_name: str, - instance_id: str, - vm_scale_set_vm_reimage_input: Optional[ - Union[_models.VirtualMachineScaleSetVMReimageParameters, JSON, IO[bytes]] - ] = None, + vm_name: str, + parameters: Union[_models.VirtualMachine, JSON, IO[bytes]], + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, **kwargs: Any - ) -> AsyncLROPoller[_models.OkResponse]: - """Reimages (upgrade the operating system) a specific virtual machine in a VM scale set. + ) -> 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. The name is case insensitive. Required. :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param instance_id: The instance ID of the virtual machine. Required. - :type instance_id: str - :param vm_scale_set_vm_reimage_input: Parameters for the Reimaging Virtual machine in ScaleSet. - Is one of the following types: VirtualMachineScaleSetVMReimageParameters, JSON, IO[bytes] - Default value is None. - :type vm_scale_set_vm_reimage_input: - ~azure.mgmt.compute.models.VirtualMachineScaleSetVMReimageParameters or JSON or IO[bytes] - :return: An instance of AsyncLROPoller that returns OkResponse. The OkResponse is compatible - with MutableMapping - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.OkResponse] + :param vm_name: The name of the virtual machine. Required. + :type vm_name: str + :param parameters: Parameters supplied to the Create Virtual Machine operation. Is one of the + following types: VirtualMachine, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.compute.models.VirtualMachine or JSON or IO[bytes] + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of AsyncLROPoller that returns VirtualMachine. The VirtualMachine is + compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.VirtualMachine] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - content_type = content_type if vm_scale_set_vm_reimage_input else None - cls: ClsType[_models.OkResponse] = kwargs.pop("cls", None) + cls: ClsType[_models.VirtualMachine] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._reimage_initial( + 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_scale_set_vm_reimage_input=vm_scale_set_vm_reimage_input, + vm_name=vm_name, + parameters=parameters, + etag=etag, + match_condition=match_condition, content_type=content_type, cls=lambda x, y, z: x, headers=_headers, @@ -7688,14 +7195,10 @@ async def begin_reimage( kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - response_headers = {} response = pipeline_response.http_response - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = _deserialize(_models.OkResponse, response.json()) + deserialized = _deserialize(_models.VirtualMachine, response.json()) if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized path_format_arguments = { @@ -7711,18 +7214,25 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller[_models.OkResponse].from_continuation_token( + return AsyncLROPoller[_models.VirtualMachine].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller[_models.OkResponse]( + return AsyncLROPoller[_models.VirtualMachine]( self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - async def _reimage_all_initial( - self, resource_group_name: str, vm_scale_set_name: str, instance_id: str, **kwargs: Any + async def _update_initial( + self, + resource_group_name: str, + vm_name: str, + parameters: Union[_models.VirtualMachineUpdate, JSON, IO[bytes]], + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any ) -> AsyncIterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -7730,19 +7240,36 @@ async def _reimage_all_initial( 409: ResourceExistsError, 304: ResourceNotModifiedError, } + if match_condition == MatchConditions.IfNotModified: + error_map[412] = ResourceModifiedError + elif match_condition == MatchConditions.IfPresent: + error_map[412] = ResourceNotFoundError + elif match_condition == MatchConditions.IfMissing: + error_map[412] = ResourceExistsError error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - _request = build_virtual_machine_scale_set_vms_reimage_all_request( + content_type = content_type or "application/json" + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_virtual_machines_update_request( resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, - instance_id=instance_id, + vm_name=vm_name, subscription_id=self._config.subscription_id, + etag=etag, + match_condition=match_condition, + content_type=content_type, api_version=self._config.api_version, + content=_content, headers=_headers, params=_params, ) @@ -7758,7 +7285,7 @@ async def _reimage_all_initial( response = pipeline_response.http_response - if response.status_code not in [200, 202]: + if response.status_code not in [200]: try: await response.read() # Load the body in memory and close the socket except (StreamConsumedError, StreamClosedError): @@ -7768,9 +7295,8 @@ async def _reimage_all_initial( raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) deserialized = response.iter_bytes() @@ -7779,348 +7305,157 @@ async def _reimage_all_initial( return deserialized # type: ignore - @distributed_trace_async - async def begin_reimage_all( - self, resource_group_name: str, vm_scale_set_name: str, instance_id: str, **kwargs: Any - ) -> AsyncLROPoller[_models.OkResponse]: - """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. + @overload + async def begin_update( + self, + resource_group_name: str, + vm_name: str, + parameters: _models.VirtualMachineUpdate, + *, + content_type: str = "application/json", + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.VirtualMachine]: + """The operation to update a virtual machine. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param instance_id: The instance ID of the virtual machine. Required. - :type instance_id: str - :return: An instance of AsyncLROPoller that returns OkResponse. The OkResponse is compatible - with MutableMapping - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.OkResponse] + :param vm_name: The name of the virtual machine. Required. + :type vm_name: str + :param parameters: Parameters supplied to the Update Virtual Machine operation. Required. + :type parameters: ~azure.mgmt.compute.models.VirtualMachineUpdate + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of AsyncLROPoller that returns VirtualMachine. The VirtualMachine is + compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.VirtualMachine] :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[_models.OkResponse] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._reimage_all_initial( - resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, - instance_id=instance_id, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - response_headers = {} - response = pipeline_response.http_response - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = _deserialize(_models.OkResponse, response.json()) - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized - - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.OkResponse].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.OkResponse]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - @distributed_trace_async - async def simulate_eviction( - 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. + @overload + async def begin_update( + self, + resource_group_name: str, + vm_name: str, + parameters: JSON, + *, + content_type: str = "application/json", + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.VirtualMachine]: + """The operation to update a virtual machine. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param instance_id: The instance ID of the virtual machine. Required. - :type instance_id: str - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_virtual_machine_scale_set_vms_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=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.CloudError, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - async def _attach_detach_data_disks_initial( - self, - resource_group_name: str, - vm_scale_set_name: str, - instance_id: str, - parameters: Union[_models.AttachDetachDataDisksRequest, JSON, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} - - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - - _request = build_virtual_machine_scale_set_vms_attach_detach_data_disks_request( - resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, - instance_id=instance_id, - subscription_id=self._config.subscription_id, - content_type=content_type, - api_version=self._config.api_version, - content=_content, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.CloudError, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.iter_bytes() - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_attach_detach_data_disks( - self, - resource_group_name: str, - vm_scale_set_name: str, - instance_id: str, - parameters: _models.AttachDetachDataDisksRequest, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.StorageProfile]: - """Attach and detach data disks to/from a virtual machine in a VM scale set. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param instance_id: The instance ID of the virtual machine. Required. - :type instance_id: str - :param parameters: Parameters supplied to the attach and detach data disks operation on a - Virtual Machine Scale Sets VM. Required. - :type parameters: ~azure.mgmt.compute.models.AttachDetachDataDisksRequest - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns StorageProfile. The StorageProfile is - compatible with MutableMapping - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.StorageProfile] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_attach_detach_data_disks( - self, - resource_group_name: str, - vm_scale_set_name: str, - instance_id: str, - parameters: JSON, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.StorageProfile]: - """Attach and detach data disks to/from a virtual machine in a VM scale set. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param instance_id: The instance ID of the virtual machine. Required. - :type instance_id: str - :param parameters: Parameters supplied to the attach and detach data disks operation on a - Virtual Machine Scale Sets VM. Required. + :param vm_name: The name of the virtual machine. Required. + :type vm_name: str + :param parameters: Parameters supplied to the Update Virtual Machine operation. Required. :type parameters: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns StorageProfile. The StorageProfile is + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of AsyncLROPoller that returns VirtualMachine. The VirtualMachine is compatible with MutableMapping - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.StorageProfile] + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.VirtualMachine] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - async def begin_attach_detach_data_disks( + async def begin_update( self, resource_group_name: str, - vm_scale_set_name: str, - instance_id: str, + vm_name: str, parameters: IO[bytes], *, content_type: str = "application/json", + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, **kwargs: Any - ) -> AsyncLROPoller[_models.StorageProfile]: - """Attach and detach data disks to/from a virtual machine in a VM scale set. + ) -> AsyncLROPoller[_models.VirtualMachine]: + """The operation to update a virtual machine. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param instance_id: The instance ID of the virtual machine. Required. - :type instance_id: str - :param parameters: Parameters supplied to the attach and detach data disks operation on a - Virtual Machine Scale Sets VM. Required. + :param vm_name: The name of the virtual machine. Required. + :type vm_name: str + :param parameters: Parameters supplied to the Update Virtual Machine operation. Required. :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns StorageProfile. The StorageProfile is + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of AsyncLROPoller that returns VirtualMachine. The VirtualMachine is compatible with MutableMapping - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.StorageProfile] + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.VirtualMachine] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace_async - async def begin_attach_detach_data_disks( + async def begin_update( self, resource_group_name: str, - vm_scale_set_name: str, - instance_id: str, - parameters: Union[_models.AttachDetachDataDisksRequest, JSON, IO[bytes]], + vm_name: str, + parameters: Union[_models.VirtualMachineUpdate, JSON, IO[bytes]], + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, **kwargs: Any - ) -> AsyncLROPoller[_models.StorageProfile]: - """Attach and detach data disks to/from a virtual machine in a VM scale set. + ) -> AsyncLROPoller[_models.VirtualMachine]: + """The operation to update a virtual machine. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param instance_id: The instance ID of the virtual machine. Required. - :type instance_id: str - :param parameters: Parameters supplied to the attach and detach data disks operation on a - Virtual Machine Scale Sets VM. Is one of the following types: AttachDetachDataDisksRequest, - JSON, IO[bytes] Required. - :type parameters: ~azure.mgmt.compute.models.AttachDetachDataDisksRequest or JSON or IO[bytes] - :return: An instance of AsyncLROPoller that returns StorageProfile. The StorageProfile is + :param vm_name: The name of the virtual machine. Required. + :type vm_name: str + :param parameters: Parameters supplied to the Update Virtual Machine operation. Is one of the + following types: VirtualMachineUpdate, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.compute.models.VirtualMachineUpdate or JSON or IO[bytes] + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of AsyncLROPoller that returns VirtualMachine. The VirtualMachine is compatible with MutableMapping - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.StorageProfile] + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.VirtualMachine] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.StorageProfile] = kwargs.pop("cls", None) + cls: ClsType[_models.VirtualMachine] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._attach_detach_data_disks_initial( + 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_name=vm_name, parameters=parameters, + etag=etag, + match_condition=match_condition, content_type=content_type, cls=lambda x, y, z: x, headers=_headers, @@ -8136,7 +7471,7 @@ def get_long_running_output(pipeline_response): response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - deserialized = _deserialize(_models.StorageProfile, response.json()) + deserialized = _deserialize(_models.VirtualMachine, response.json()) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized @@ -8154,18 +7489,18 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller[_models.StorageProfile].from_continuation_token( + return AsyncLROPoller[_models.VirtualMachine].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller[_models.StorageProfile]( + return AsyncLROPoller[_models.VirtualMachine]( self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - async def _perform_maintenance_initial( - self, resource_group_name: str, vm_scale_set_name: str, instance_id: str, **kwargs: Any + async def _delete_initial( + self, resource_group_name: str, vm_name: str, *, force_deletion: Optional[bool] = None, **kwargs: Any ) -> AsyncIterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -8180,11 +7515,11 @@ async def _perform_maintenance_initial( cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - _request = build_virtual_machine_scale_set_vms_perform_maintenance_request( + _request = build_virtual_machines_delete_request( resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, - instance_id=instance_id, + vm_name=vm_name, subscription_id=self._config.subscription_id, + force_deletion=force_deletion, api_version=self._config.api_version, headers=_headers, params=_params, @@ -8201,7 +7536,7 @@ async def _perform_maintenance_initial( response = pipeline_response.http_response - if response.status_code not in [200, 202]: + if response.status_code not in [200, 202, 204]: try: await response.read() # Load the body in memory and close the socket except (StreamConsumedError, StreamClosedError): @@ -8223,35 +7558,35 @@ async def _perform_maintenance_initial( return deserialized # type: ignore @distributed_trace_async - async def begin_perform_maintenance( - self, resource_group_name: str, vm_scale_set_name: str, instance_id: str, **kwargs: Any - ) -> AsyncLROPoller[_models.OkResponse]: - """Performs maintenance on a virtual machine in a VM scale set. + async def begin_delete( + 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. The name is case insensitive. Required. :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param instance_id: The instance ID of the virtual machine. Required. - :type instance_id: str - :return: An instance of AsyncLROPoller that returns OkResponse. The OkResponse is compatible - with MutableMapping - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.OkResponse] + :param vm_name: The name of the virtual machine. Required. + :type vm_name: str + :keyword force_deletion: Optional parameter to force delete virtual machines. Default value is + None. + :paramtype force_deletion: bool + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.OkResponse] = kwargs.pop("cls", None) + cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._perform_maintenance_initial( + 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_name=vm_name, + force_deletion=force_deletion, cls=lambda x, y, z: x, headers=_headers, params=_params, @@ -8260,16 +7595,9 @@ async def begin_perform_maintenance( await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): - response_headers = {} - response = pipeline_response.http_response - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = _deserialize(_models.OkResponse, response.json()) + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized + return cls(pipeline_response, None, {}) # type: ignore path_format_arguments = { "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), @@ -8284,25 +7612,47 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller[_models.OkResponse].from_continuation_token( + return AsyncLROPoller[None].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller[_models.OkResponse]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - async def _power_off_initial( + @distributed_trace + def list( self, resource_group_name: str, - vm_scale_set_name: str, - instance_id: str, *, - skip_shutdown: Optional[bool] = None, + filter: Optional[str] = None, + expand: Optional[Union[str, _models.ExpandTypeForListVMs]] = None, **kwargs: Any - ) -> AsyncIterator[bytes]: + ) -> AsyncItemPaged["_models.VirtualMachine"]: + """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. The name is case insensitive. + Required. + :type resource_group_name: str + :keyword 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. + :paramtype filter: str + :keyword expand: The expand expression to apply on operation. 'instanceView' enables fetching + run time status of all Virtual Machines, this can only be specified if a valid $filter option + is specified. "instanceView" Default value is None. + :paramtype expand: str or ~azure.mgmt.compute.models.ExpandTypeForListVMs + :return: An iterator like instance of VirtualMachine + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.models.VirtualMachine] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.VirtualMachine]] = kwargs.pop("cls", None) + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -8311,141 +7661,181 @@ async def _power_off_initial( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} + def prepare_request(next_link=None): + if not next_link: - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + _request = build_virtual_machines_list_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + filter=filter, + expand=expand, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) - _request = build_virtual_machine_scale_set_vms_power_off_request( - resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, - instance_id=instance_id, - subscription_id=self._config.subscription_id, - skip_shutdown=skip_shutdown, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) + return _request - response = pipeline_response.http_response + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.VirtualMachine], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) - if response.status_code not in [200, 202]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.CloudError, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + async def get_next(next_link=None): + _request = prepare_request(next_link) - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response - deserialized = response.iter_bytes() + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore + return pipeline_response - return deserialized # type: ignore + return AsyncItemPaged(get_next, extract_data) - @distributed_trace_async - async def begin_power_off( + @distributed_trace + def list_all( self, - resource_group_name: str, - vm_scale_set_name: str, - instance_id: str, *, - skip_shutdown: Optional[bool] = None, + status_only: Optional[str] = None, + filter: Optional[str] = None, + expand: Optional[Union[str, _models.ExpandTypesForListVMs]] = None, **kwargs: Any - ) -> AsyncLROPoller[_models.OkResponse]: - """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. + ) -> AsyncItemPaged["_models.VirtualMachine"]: + """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 resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param instance_id: The instance ID of the virtual machine. Required. - :type instance_id: str - :keyword 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 None. - :paramtype skip_shutdown: bool - :return: An instance of AsyncLROPoller that returns OkResponse. The OkResponse is compatible - with MutableMapping - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.OkResponse] + :keyword status_only: statusOnly=true enables fetching run time status of all Virtual Machines + in the subscription. Default value is None. + :paramtype status_only: str + :keyword 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. + :paramtype filter: str + :keyword expand: The expand expression to apply on operation. 'instanceView' enables fetching + run time status of all Virtual Machines, this can only be specified if a valid $filter option + is specified. "instanceView" Default value is None. + :paramtype expand: str or ~azure.mgmt.compute.models.ExpandTypesForListVMs + :return: An iterator like instance of VirtualMachine + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.models.VirtualMachine] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.OkResponse] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._power_off_initial( - resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, - instance_id=instance_id, - skip_shutdown=skip_shutdown, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - response_headers = {} - response = pipeline_response.http_response - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = _deserialize(_models.OkResponse, response.json()) - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized + cls: ClsType[List[_models.VirtualMachine]] = kwargs.pop("cls", None) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } + error_map.update(kwargs.pop("error_map", {}) or {}) - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.OkResponse].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, + def prepare_request(next_link=None): + if not next_link: + + _request = build_virtual_machines_list_all_request( + subscription_id=self._config.subscription_id, + status_only=status_only, + filter=filter, + expand=expand, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.VirtualMachine], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs ) - return AsyncLROPoller[_models.OkResponse]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) + response = pipeline_response.http_response - async def _redeploy_initial( - self, resource_group_name: str, vm_scale_set_name: str, instance_id: str, **kwargs: Any + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + async def _assess_patches_initial( + self, resource_group_name: str, vm_name: str, **kwargs: Any ) -> AsyncIterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -8460,10 +7850,9 @@ async def _redeploy_initial( cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - _request = build_virtual_machine_scale_set_vms_redeploy_request( + _request = build_virtual_machines_assess_patches_request( resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, - instance_id=instance_id, + vm_name=vm_name, subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -8503,36 +7892,33 @@ async def _redeploy_initial( return deserialized # type: ignore @distributed_trace_async - async def begin_redeploy( - self, resource_group_name: str, vm_scale_set_name: str, instance_id: str, **kwargs: Any - ) -> AsyncLROPoller[_models.OkResponse]: - """Shuts down the virtual machine in the virtual machine scale set, moves it to a new node, and - powers it back on. + 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. The name is case insensitive. Required. :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param instance_id: The instance ID of the virtual machine. Required. - :type instance_id: str - :return: An instance of AsyncLROPoller that returns OkResponse. The OkResponse is compatible - with MutableMapping - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.OkResponse] + :param vm_name: The name of the virtual machine. Required. + :type vm_name: str + :return: An instance of AsyncLROPoller that returns VirtualMachineAssessPatchesResult. The + VirtualMachineAssessPatchesResult is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.VirtualMachineAssessPatchesResult] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.OkResponse] = kwargs.pop("cls", None) + cls: ClsType[_models.VirtualMachineAssessPatchesResult] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._redeploy_initial( + raw_result = await self._assess_patches_initial( resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, - instance_id=instance_id, + vm_name=vm_name, cls=lambda x, y, z: x, headers=_headers, params=_params, @@ -8547,7 +7933,7 @@ def get_long_running_output(pipeline_response): response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - deserialized = _deserialize(_models.OkResponse, response.json()) + deserialized = _deserialize(_models.VirtualMachineAssessPatchesResult, response.json()) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized @@ -8565,18 +7951,22 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller[_models.OkResponse].from_continuation_token( + return AsyncLROPoller[_models.VirtualMachineAssessPatchesResult].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller[_models.OkResponse]( + return AsyncLROPoller[_models.VirtualMachineAssessPatchesResult]( self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - async def _restart_initial( - self, resource_group_name: str, vm_scale_set_name: str, instance_id: str, **kwargs: Any + async def _attach_detach_data_disks_initial( + self, + resource_group_name: str, + vm_name: str, + parameters: Union[_models.AttachDetachDataDisksRequest, JSON, IO[bytes]], + **kwargs: Any ) -> AsyncIterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -8586,17 +7976,26 @@ async def _restart_initial( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - _request = build_virtual_machine_scale_set_vms_restart_request( + content_type = content_type or "application/json" + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_virtual_machines_attach_detach_data_disks_request( resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, - instance_id=instance_id, + vm_name=vm_name, subscription_id=self._config.subscription_id, + content_type=content_type, api_version=self._config.api_version, + content=_content, headers=_headers, params=_params, ) @@ -8633,250 +8032,131 @@ async def _restart_initial( return deserialized # type: ignore - @distributed_trace_async - async def begin_restart( - self, resource_group_name: str, vm_scale_set_name: str, instance_id: str, **kwargs: Any - ) -> AsyncLROPoller[_models.OkResponse]: - """Restarts a virtual machine in a VM scale set. + @overload + async def begin_attach_detach_data_disks( + self, + resource_group_name: str, + vm_name: str, + parameters: _models.AttachDetachDataDisksRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.StorageProfile]: + """Attach and detach data disks to/from the virtual machine. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param instance_id: The instance ID of the virtual machine. Required. - :type instance_id: str - :return: An instance of AsyncLROPoller that returns OkResponse. The OkResponse is compatible - with MutableMapping - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.OkResponse] + :param vm_name: The name of the virtual machine. Required. + :type vm_name: str + :param parameters: Parameters supplied to the attach and detach data disks operation on the + virtual machine. Required. + :type parameters: ~azure.mgmt.compute.models.AttachDetachDataDisksRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns StorageProfile. The StorageProfile is + compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.StorageProfile] :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[_models.OkResponse] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._restart_initial( - resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, - instance_id=instance_id, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - response_headers = {} - response = pipeline_response.http_response - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = _deserialize(_models.OkResponse, response.json()) - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized - - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.OkResponse].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.OkResponse]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - @distributed_trace_async - async def retrieve_boot_diagnostics_data( + @overload + async def begin_attach_detach_data_disks( self, resource_group_name: str, - vm_scale_set_name: str, - instance_id: str, + vm_name: str, + parameters: JSON, *, - sas_uri_expiration_time_in_minutes: Optional[int] = None, + content_type: str = "application/json", **kwargs: Any - ) -> _models.RetrieveBootDiagnosticsDataResult: - """The operation to retrieve SAS URIs of boot diagnostic logs for a virtual machine in a VM scale - set. + ) -> AsyncLROPoller[_models.StorageProfile]: + """Attach and detach data disks to/from the virtual machine. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param instance_id: The instance ID of the virtual machine. Required. - :type instance_id: str - :keyword sas_uri_expiration_time_in_minutes: Expiration duration in minutes for the SAS URIs - with a value between 1 to 1440 minutes. **Note:** If not specified, SAS URIs will be generated - with a default expiration duration of 120 minutes. Default value is None. - :paramtype sas_uri_expiration_time_in_minutes: int - :return: RetrieveBootDiagnosticsDataResult. The RetrieveBootDiagnosticsDataResult is compatible - with MutableMapping - :rtype: ~azure.mgmt.compute.models.RetrieveBootDiagnosticsDataResult + :param vm_name: The name of the virtual machine. Required. + :type vm_name: str + :param parameters: Parameters supplied to the attach and detach data disks operation on the + virtual machine. Required. + :type parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns StorageProfile. The StorageProfile is + compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.StorageProfile] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[_models.RetrieveBootDiagnosticsDataResult] = kwargs.pop("cls", None) - - _request = build_virtual_machine_scale_set_vms_retrieve_boot_diagnostics_data_request( - resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, - instance_id=instance_id, - subscription_id=self._config.subscription_id, - sas_uri_expiration_time_in_minutes=sas_uri_expiration_time_in_minutes, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = kwargs.pop("stream", False) - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - if _stream: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.CloudError, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if _stream: - deserialized = response.iter_bytes() - else: - deserialized = _deserialize(_models.RetrieveBootDiagnosticsDataResult, response.json()) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _start_initial( - self, resource_group_name: str, vm_scale_set_name: str, instance_id: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_virtual_machine_scale_set_vms_start_request( - resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, - instance_id=instance_id, - subscription_id=self._config.subscription_id, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.CloudError, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.iter_bytes() - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore + @overload + async def begin_attach_detach_data_disks( + self, + resource_group_name: str, + vm_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.StorageProfile]: + """Attach and detach data disks to/from the virtual machine. - return deserialized # type: ignore + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_name: The name of the virtual machine. Required. + :type vm_name: str + :param parameters: Parameters supplied to the attach and detach data disks operation on the + virtual machine. Required. + :type parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns StorageProfile. The StorageProfile is + compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.StorageProfile] + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace_async - async def begin_start( - self, resource_group_name: str, vm_scale_set_name: str, instance_id: str, **kwargs: Any - ) -> AsyncLROPoller[_models.OkResponse]: - """Starts a virtual machine in a VM scale set. + async def begin_attach_detach_data_disks( + self, + resource_group_name: str, + vm_name: str, + parameters: Union[_models.AttachDetachDataDisksRequest, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.StorageProfile]: + """Attach and detach data disks to/from the virtual machine. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param instance_id: The instance ID of the virtual machine. Required. - :type instance_id: str - :return: An instance of AsyncLROPoller that returns OkResponse. The OkResponse is compatible - with MutableMapping - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.OkResponse] + :param vm_name: The name of the virtual machine. Required. + :type vm_name: str + :param parameters: Parameters supplied to the attach and detach data disks operation on the + virtual machine. Is one of the following types: AttachDetachDataDisksRequest, JSON, IO[bytes] + Required. + :type parameters: ~azure.mgmt.compute.models.AttachDetachDataDisksRequest or JSON or IO[bytes] + :return: An instance of AsyncLROPoller that returns StorageProfile. The StorageProfile is + compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.StorageProfile] :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = kwargs.pop("headers", {}) or {} + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.OkResponse] = kwargs.pop("cls", None) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.StorageProfile] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._start_initial( + raw_result = await self._attach_detach_data_disks_initial( resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, - instance_id=instance_id, + vm_name=vm_name, + parameters=parameters, + content_type=content_type, cls=lambda x, y, z: x, headers=_headers, params=_params, @@ -8891,7 +8171,7 @@ def get_long_running_output(pipeline_response): response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - deserialized = _deserialize(_models.OkResponse, response.json()) + deserialized = _deserialize(_models.StorageProfile, response.json()) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized @@ -8909,22 +8189,21 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller[_models.OkResponse].from_continuation_token( + return AsyncLROPoller[_models.StorageProfile].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller[_models.OkResponse]( + return AsyncLROPoller[_models.StorageProfile]( self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - async def _run_command_initial( + async def _capture_initial( self, resource_group_name: str, - vm_scale_set_name: str, - instance_id: str, - parameters: Union[_models.RunCommandInput, JSON, IO[bytes]], + vm_name: str, + parameters: Union[_models.VirtualMachineCaptureParameters, JSON, IO[bytes]], **kwargs: Any ) -> AsyncIterator[bytes]: error_map: MutableMapping = { @@ -8948,10 +8227,9 @@ async def _run_command_initial( else: _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - _request = build_virtual_machine_scale_set_vms_run_command_request( + _request = build_virtual_machines_capture_request( resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, - instance_id=instance_id, + vm_name=vm_name, subscription_id=self._config.subscription_id, content_type=content_type, api_version=self._config.api_version, @@ -8993,137 +8271,133 @@ async def _run_command_initial( return deserialized # type: ignore @overload - async def begin_run_command( + async def begin_capture( self, resource_group_name: str, - vm_scale_set_name: str, - instance_id: str, - parameters: _models.RunCommandInput, + vm_name: str, + parameters: _models.VirtualMachineCaptureParameters, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.RunCommandResult]: - """Run command on a virtual machine in a VM scale set. + ) -> 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. The name is case insensitive. Required. :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param instance_id: The instance ID of the virtual machine. Required. - :type instance_id: str - :param parameters: Parameters supplied to the Run command operation. Required. - :type parameters: ~azure.mgmt.compute.models.RunCommandInput + :param vm_name: The name of the virtual machine. Required. + :type vm_name: str + :param parameters: Parameters supplied to the Capture Virtual Machine operation. Required. + :type parameters: ~azure.mgmt.compute.models.VirtualMachineCaptureParameters :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns RunCommandResult. The RunCommandResult is - compatible with MutableMapping - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.RunCommandResult] + :return: An instance of AsyncLROPoller that returns VirtualMachineCaptureResult. The + VirtualMachineCaptureResult is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.VirtualMachineCaptureResult] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - async def begin_run_command( + async def begin_capture( self, resource_group_name: str, - vm_scale_set_name: str, - instance_id: str, + vm_name: str, parameters: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.RunCommandResult]: - """Run command on a virtual machine in a VM scale set. + ) -> 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. The name is case insensitive. Required. :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param instance_id: The instance ID of the virtual machine. Required. - :type instance_id: str - :param parameters: Parameters supplied to the Run command operation. Required. + :param vm_name: The name of the virtual machine. Required. + :type vm_name: str + :param parameters: Parameters supplied to the Capture Virtual Machine operation. Required. :type parameters: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns RunCommandResult. The RunCommandResult is - compatible with MutableMapping - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.RunCommandResult] + :return: An instance of AsyncLROPoller that returns VirtualMachineCaptureResult. The + VirtualMachineCaptureResult is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.VirtualMachineCaptureResult] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - async def begin_run_command( + async def begin_capture( self, resource_group_name: str, - vm_scale_set_name: str, - instance_id: str, + vm_name: str, parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.RunCommandResult]: - """Run command on a virtual machine in a VM scale set. + ) -> 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. The name is case insensitive. Required. :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param instance_id: The instance ID of the virtual machine. Required. - :type instance_id: str - :param parameters: Parameters supplied to the Run command operation. Required. + :param vm_name: The name of the virtual machine. Required. + :type vm_name: str + :param parameters: Parameters supplied to the Capture Virtual Machine operation. Required. :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns RunCommandResult. The RunCommandResult is - compatible with MutableMapping - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.RunCommandResult] + :return: An instance of AsyncLROPoller that returns VirtualMachineCaptureResult. The + VirtualMachineCaptureResult is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.VirtualMachineCaptureResult] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace_async - async def begin_run_command( + async def begin_capture( self, resource_group_name: str, - vm_scale_set_name: str, - instance_id: str, - parameters: Union[_models.RunCommandInput, JSON, IO[bytes]], + vm_name: str, + parameters: Union[_models.VirtualMachineCaptureParameters, JSON, IO[bytes]], **kwargs: Any - ) -> AsyncLROPoller[_models.RunCommandResult]: - """Run command on a virtual machine in a VM scale set. + ) -> 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. The name is case insensitive. Required. :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param instance_id: The instance ID of the virtual machine. Required. - :type instance_id: str - :param parameters: Parameters supplied to the Run command operation. Is one of the following - types: RunCommandInput, JSON, IO[bytes] Required. - :type parameters: ~azure.mgmt.compute.models.RunCommandInput or JSON or IO[bytes] - :return: An instance of AsyncLROPoller that returns RunCommandResult. The RunCommandResult is - compatible with MutableMapping - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.RunCommandResult] + :param vm_name: The name of the virtual machine. Required. + :type vm_name: str + :param parameters: Parameters supplied to the Capture Virtual Machine operation. Is one of the + following types: VirtualMachineCaptureParameters, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.compute.models.VirtualMachineCaptureParameters or JSON or + IO[bytes] + :return: An instance of AsyncLROPoller that returns VirtualMachineCaptureResult. The + VirtualMachineCaptureResult is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.VirtualMachineCaptureResult] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.RunCommandResult] = kwargs.pop("cls", None) + cls: ClsType[_models.VirtualMachineCaptureResult] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._run_command_initial( + raw_result = await self._capture_initial( resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, - instance_id=instance_id, + vm_name=vm_name, parameters=parameters, content_type=content_type, cls=lambda x, y, z: x, @@ -9140,7 +8414,7 @@ def get_long_running_output(pipeline_response): response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - deserialized = _deserialize(_models.RunCommandResult, response.json()) + deserialized = _deserialize(_models.VirtualMachineCaptureResult, response.json()) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized @@ -9158,63 +8432,19 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller[_models.RunCommandResult].from_continuation_token( + return AsyncLROPoller[_models.VirtualMachineCaptureResult].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller[_models.RunCommandResult]( + return AsyncLROPoller[_models.VirtualMachineCaptureResult]( self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - -class VirtualMachineScaleSetVMExtensionsOperations: # pylint: disable=name-too-long - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.compute.aio.ComputeClient`'s - :attr:`virtual_machine_scale_set_vm_extensions` attribute. - """ - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ComputeClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @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. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param instance_id: The instance ID of the virtual machine. Required. - :type instance_id: str - :param vm_extension_name: The name of the virtual machine extension. Required. - :type vm_extension_name: str - :keyword expand: The expand expression to apply on the operation. Default value is None. - :paramtype expand: str - :return: VirtualMachineScaleSetVMExtension. The VirtualMachineScaleSetVMExtension is compatible - with MutableMapping - :rtype: ~azure.mgmt.compute.models.VirtualMachineScaleSetVMExtension - :raises ~azure.core.exceptions.HttpResponseError: - """ + async def _convert_to_managed_disks_initial( + self, resource_group_name: str, vm_name: str, **kwargs: Any + ) -> AsyncIterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -9226,15 +8456,12 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.VirtualMachineScaleSetVMExtension] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - _request = build_virtual_machine_scale_set_vm_extensions_get_request( + _request = build_virtual_machines_convert_to_managed_disks_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, + vm_name=vm_name, subscription_id=self._config.subscription_id, - expand=expand, api_version=self._config.api_version, headers=_headers, params=_params, @@ -9244,41 +8471,96 @@ async def get( } _request.url = self._client.format_url(_request.url, **path_format_arguments) - _stream = kwargs.pop("stream", False) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200]: - if _stream: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass + if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = _failsafe_deserialize(_models.CloudError, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if _stream: - deserialized = response.iter_bytes() - else: - deserialized = _deserialize(_models.VirtualMachineScaleSetVMExtension, response.json()) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore - 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: Union[_models.VirtualMachineScaleSetVMExtension, JSON, IO[bytes]], - **kwargs: Any + @distributed_trace_async + async def begin_convert_to_managed_disks( + 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. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_name: The name of the virtual machine. Required. + :type vm_name: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._convert_to_managed_disks_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + async def _deallocate_initial( + self, resource_group_name: str, vm_name: str, *, hibernate: Optional[bool] = None, **kwargs: Any ) -> AsyncIterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -9288,28 +8570,17 @@ async def _create_or_update_initial( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - content_type = content_type or "application/json" - _content = None - if isinstance(extension_parameters, (IOBase, bytes)): - _content = extension_parameters - else: - _content = json.dumps(extension_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - - _request = build_virtual_machine_scale_set_vm_extensions_create_or_update_request( + _request = build_virtual_machines_deallocate_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, + vm_name=vm_name, subscription_id=self._config.subscription_id, - content_type=content_type, + hibernate=hibernate, api_version=self._config.api_version, - content=_content, headers=_headers, params=_params, ) @@ -9325,7 +8596,7 @@ async def _create_or_update_initial( response = pipeline_response.http_response - if response.status_code not in [200, 201]: + if response.status_code not in [200, 202]: try: await response.read() # Load the body in memory and close the socket except (StreamConsumedError, StreamClosedError): @@ -9335,7 +8606,7 @@ async def _create_or_update_initial( raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} - if response.status_code == 201: + if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) @@ -9346,154 +8617,36 @@ async def _create_or_update_initial( return deserialized # type: ignore - @overload - 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, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[None]: - """The operation to create or update the VMSS VM extension. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param instance_id: The instance ID of the virtual machine. Required. - :type instance_id: str - :param vm_extension_name: The name of the virtual machine extension. Required. - :type vm_extension_name: str - :param extension_parameters: Parameters supplied to the Create Virtual Machine Extension - operation. Required. - :type extension_parameters: ~azure.mgmt.compute.models.VirtualMachineScaleSetVMExtension - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns None - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - 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: JSON, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[None]: - """The operation to create or update the VMSS VM extension. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param instance_id: The instance ID of the virtual machine. Required. - :type instance_id: str - :param vm_extension_name: The name of the virtual machine extension. Required. - :type vm_extension_name: str - :param extension_parameters: Parameters supplied to the Create Virtual Machine Extension - operation. Required. - :type extension_parameters: JSON - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns None - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - 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: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[None]: - """The operation to create or update the VMSS VM extension. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param instance_id: The instance ID of the virtual machine. Required. - :type instance_id: str - :param vm_extension_name: The name of the virtual machine extension. Required. - :type vm_extension_name: str - :param extension_parameters: Parameters supplied to the Create Virtual Machine Extension - operation. Required. - :type extension_parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns None - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - @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: Union[_models.VirtualMachineScaleSetVMExtension, JSON, IO[bytes]], - **kwargs: Any + async def begin_deallocate( + self, resource_group_name: str, vm_name: str, *, hibernate: Optional[bool] = None, **kwargs: Any ) -> AsyncLROPoller[None]: - """The operation to create or update the VMSS VM extension. + """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. The name is case insensitive. Required. :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param instance_id: The instance ID of the virtual machine. Required. - :type instance_id: str - :param vm_extension_name: The name of the virtual machine extension. Required. - :type vm_extension_name: str - :param extension_parameters: Parameters supplied to the Create Virtual Machine Extension - operation. Is one of the following types: VirtualMachineScaleSetVMExtension, JSON, IO[bytes] - Required. - :type extension_parameters: ~azure.mgmt.compute.models.VirtualMachineScaleSetVMExtension or - JSON or IO[bytes] + :param vm_name: The name of the virtual machine. Required. + :type vm_name: str + :keyword hibernate: Optional parameter to hibernate a virtual machine. Default value is None. + :paramtype hibernate: bool :return: An instance of AsyncLROPoller that returns None :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._create_or_update_initial( + raw_result = await self._deallocate_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, - content_type=content_type, + vm_name=vm_name, + hibernate=hibernate, cls=lambda x, y, z: x, headers=_headers, params=_params, @@ -9527,13 +8680,70 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - async def _update_initial( + @distributed_trace_async + async def generalize(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. For Windows, please refer to `Create a + managed image of a generalized VM in Azure + `_. 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. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_name: The name of the virtual machine. Required. + :type vm_name: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_virtual_machines_generalize_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + async def _install_patches_initial( self, resource_group_name: str, - vm_scale_set_name: str, - instance_id: str, - vm_extension_name: str, - extension_parameters: Union[_models.VirtualMachineScaleSetVMExtensionUpdate, JSON, IO[bytes]], + vm_name: str, + install_patches_input: Union[_models.VirtualMachineInstallPatchesParameters, JSON, IO[bytes]], **kwargs: Any ) -> AsyncIterator[bytes]: error_map: MutableMapping = { @@ -9552,16 +8762,14 @@ async def _update_initial( content_type = content_type or "application/json" _content = None - if isinstance(extension_parameters, (IOBase, bytes)): - _content = extension_parameters + if isinstance(install_patches_input, (IOBase, bytes)): + _content = install_patches_input else: - _content = json.dumps(extension_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(install_patches_input, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - _request = build_virtual_machine_scale_set_vm_extensions_update_request( + _request = build_virtual_machines_install_patches_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, + vm_name=vm_name, subscription_id=self._config.subscription_id, content_type=content_type, api_version=self._config.api_version, @@ -9581,7 +8789,7 @@ async def _update_initial( response = pipeline_response.http_response - if response.status_code not in [200]: + if response.status_code not in [200, 202]: try: await response.read() # Load the body in memory and close the socket except (StreamConsumedError, StreamClosedError): @@ -9591,8 +8799,9 @@ async def _update_initial( raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) deserialized = response.iter_bytes() @@ -9602,152 +8811,133 @@ async def _update_initial( return deserialized # type: ignore @overload - async def begin_update( + async def begin_install_patches( self, resource_group_name: str, - vm_scale_set_name: str, - instance_id: str, - vm_extension_name: str, - extension_parameters: _models.VirtualMachineScaleSetVMExtensionUpdate, + vm_name: str, + install_patches_input: _models.VirtualMachineInstallPatchesParameters, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[None]: - """The operation to update the VMSS VM extension. + ) -> AsyncLROPoller[_models.VirtualMachineInstallPatchesResult]: + """Installs patches on the VM. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param instance_id: The instance ID of the virtual machine. Required. - :type instance_id: str - :param vm_extension_name: The name of the virtual machine extension. Required. - :type vm_extension_name: str - :param extension_parameters: Parameters supplied to the Update Virtual Machine Extension - operation. Required. - :type extension_parameters: ~azure.mgmt.compute.models.VirtualMachineScaleSetVMExtensionUpdate + :param vm_name: The name of the virtual machine. Required. + :type vm_name: str + :param install_patches_input: Input for InstallPatches as directly received by the API. + Required. + :type install_patches_input: ~azure.mgmt.compute.models.VirtualMachineInstallPatchesParameters :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns None - :rtype: ~azure.core.polling.AsyncLROPoller[None] + :return: An instance of AsyncLROPoller that returns VirtualMachineInstallPatchesResult. The + VirtualMachineInstallPatchesResult is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.VirtualMachineInstallPatchesResult] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - async def begin_update( + async def begin_install_patches( self, resource_group_name: str, - vm_scale_set_name: str, - instance_id: str, - vm_extension_name: str, - extension_parameters: JSON, + vm_name: str, + install_patches_input: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[None]: - """The operation to update the VMSS VM extension. + ) -> AsyncLROPoller[_models.VirtualMachineInstallPatchesResult]: + """Installs patches on the VM. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param instance_id: The instance ID of the virtual machine. Required. - :type instance_id: str - :param vm_extension_name: The name of the virtual machine extension. Required. - :type vm_extension_name: str - :param extension_parameters: Parameters supplied to the Update Virtual Machine Extension - operation. Required. - :type extension_parameters: JSON + :param vm_name: The name of the virtual machine. Required. + :type vm_name: str + :param install_patches_input: Input for InstallPatches as directly received by the API. + Required. + :type install_patches_input: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns None - :rtype: ~azure.core.polling.AsyncLROPoller[None] + :return: An instance of AsyncLROPoller that returns VirtualMachineInstallPatchesResult. The + VirtualMachineInstallPatchesResult is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.VirtualMachineInstallPatchesResult] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - async def begin_update( + async def begin_install_patches( self, resource_group_name: str, - vm_scale_set_name: str, - instance_id: str, - vm_extension_name: str, - extension_parameters: IO[bytes], + vm_name: str, + install_patches_input: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[None]: - """The operation to update the VMSS VM extension. + ) -> AsyncLROPoller[_models.VirtualMachineInstallPatchesResult]: + """Installs patches on the VM. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param instance_id: The instance ID of the virtual machine. Required. - :type instance_id: str - :param vm_extension_name: The name of the virtual machine extension. Required. - :type vm_extension_name: str - :param extension_parameters: Parameters supplied to the Update Virtual Machine Extension - operation. Required. - :type extension_parameters: IO[bytes] + :param vm_name: The name of the virtual machine. Required. + :type vm_name: str + :param install_patches_input: Input for InstallPatches as directly received by the API. + Required. + :type install_patches_input: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns None - :rtype: ~azure.core.polling.AsyncLROPoller[None] + :return: An instance of AsyncLROPoller that returns VirtualMachineInstallPatchesResult. The + VirtualMachineInstallPatchesResult is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.VirtualMachineInstallPatchesResult] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace_async - async def begin_update( + async def begin_install_patches( self, resource_group_name: str, - vm_scale_set_name: str, - instance_id: str, - vm_extension_name: str, - extension_parameters: Union[_models.VirtualMachineScaleSetVMExtensionUpdate, JSON, IO[bytes]], + vm_name: str, + install_patches_input: Union[_models.VirtualMachineInstallPatchesParameters, JSON, IO[bytes]], **kwargs: Any - ) -> AsyncLROPoller[None]: - """The operation to update the VMSS VM extension. + ) -> AsyncLROPoller[_models.VirtualMachineInstallPatchesResult]: + """Installs patches on the VM. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param instance_id: The instance ID of the virtual machine. Required. - :type instance_id: str - :param vm_extension_name: The name of the virtual machine extension. Required. - :type vm_extension_name: str - :param extension_parameters: Parameters supplied to the Update Virtual Machine Extension - operation. Is one of the following types: VirtualMachineScaleSetVMExtensionUpdate, JSON, - IO[bytes] Required. - :type extension_parameters: ~azure.mgmt.compute.models.VirtualMachineScaleSetVMExtensionUpdate + :param vm_name: The name of the virtual machine. Required. + :type vm_name: str + :param install_patches_input: Input for InstallPatches as directly received by the API. Is one + of the following types: VirtualMachineInstallPatchesParameters, JSON, IO[bytes] Required. + :type install_patches_input: ~azure.mgmt.compute.models.VirtualMachineInstallPatchesParameters or JSON or IO[bytes] - :return: An instance of AsyncLROPoller that returns None - :rtype: ~azure.core.polling.AsyncLROPoller[None] + :return: An instance of AsyncLROPoller that returns VirtualMachineInstallPatchesResult. The + VirtualMachineInstallPatchesResult is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.VirtualMachineInstallPatchesResult] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[_models.VirtualMachineInstallPatchesResult] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._update_initial( + raw_result = await self._install_patches_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, + vm_name=vm_name, + install_patches_input=install_patches_input, content_type=content_type, cls=lambda x, y, z: x, headers=_headers, @@ -9757,9 +8947,16 @@ async def begin_update( await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = _deserialize(_models.VirtualMachineInstallPatchesResult, response.json()) if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore + return deserialized path_format_arguments = { "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), @@ -9774,16 +8971,87 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return AsyncLROPoller[None].from_continuation_token( + return AsyncLROPoller[_models.VirtualMachineInstallPatchesResult].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + return AsyncLROPoller[_models.VirtualMachineInstallPatchesResult]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) - async def _delete_initial( - self, resource_group_name: str, vm_scale_set_name: str, instance_id: str, vm_extension_name: str, **kwargs: Any + @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. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_name: The name of the virtual machine. Required. + :type vm_name: str + :return: VirtualMachineInstanceView. The VirtualMachineInstanceView is compatible with + MutableMapping + :rtype: ~azure.mgmt.compute.models.VirtualMachineInstanceView + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.VirtualMachineInstanceView] = kwargs.pop("cls", None) + + _request = build_virtual_machines_instance_view_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.VirtualMachineInstanceView, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _perform_maintenance_initial( + self, resource_group_name: str, vm_name: str, **kwargs: Any ) -> AsyncIterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -9798,11 +9066,9 @@ async def _delete_initial( cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - _request = build_virtual_machine_scale_set_vm_extensions_delete_request( + _request = build_virtual_machines_perform_maintenance_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, + vm_name=vm_name, subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -9820,7 +9086,7 @@ async def _delete_initial( response = pipeline_response.http_response - if response.status_code not in [200, 202, 204]: + if response.status_code not in [200, 202]: try: await response.read() # Load the body in memory and close the socket except (StreamConsumedError, StreamClosedError): @@ -9842,20 +9108,16 @@ async def _delete_initial( return deserialized # type: ignore @distributed_trace_async - async def begin_delete( - self, resource_group_name: str, vm_scale_set_name: str, instance_id: str, vm_extension_name: str, **kwargs: Any + async def begin_perform_maintenance( + self, resource_group_name: str, vm_name: str, **kwargs: Any ) -> AsyncLROPoller[None]: - """The operation to delete the VMSS VM extension. + """The operation to perform maintenance on a virtual machine. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param instance_id: The instance ID of the virtual machine. Required. - :type instance_id: str - :param vm_extension_name: The name of the virtual machine extension. Required. - :type vm_extension_name: str + :param vm_name: The name of the virtual machine. Required. + :type vm_name: str :return: An instance of AsyncLROPoller that returns None :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -9868,11 +9130,9 @@ async def begin_delete( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._delete_initial( + 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, - vm_extension_name=vm_extension_name, + vm_name=vm_name, cls=lambda x, y, z: x, headers=_headers, params=_params, @@ -9906,156 +9166,9 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # 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 - ) -> AsyncItemPaged["_models.VirtualMachineScaleSetVMExtension"]: - """The operation to get all extensions of an instance in Virtual Machine Scaleset. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param instance_id: The instance ID of the virtual machine. Required. - :type instance_id: str - :keyword expand: The expand expression to apply on the operation. Default value is None. - :paramtype expand: str - :return: An iterator like instance of VirtualMachineScaleSetVMExtension - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.models.VirtualMachineScaleSetVMExtension] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[List[_models.VirtualMachineScaleSetVMExtension]] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_virtual_machine_scale_set_vm_extensions_list_request( - resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, - instance_id=instance_id, - subscription_id=self._config.subscription_id, - expand=expand, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - return _request - - async def extract_data(pipeline_response): - deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.VirtualMachineScaleSetVMExtension], deserialized.get("value", [])) - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.CloudError, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - -class VirtualMachinesOperations: # pylint: disable=too-many-public-methods - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.compute.aio.ComputeClient`'s - :attr:`virtual_machines` attribute. - """ - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ComputeClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @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. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_name: The name of the virtual machine. Required. - :type vm_name: str - :keyword 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. - Known values are: "instanceView", "userData", and "resiliencyView". Default value is None. - :paramtype expand: str or ~azure.mgmt.compute.models.InstanceViewTypes - :return: VirtualMachine. The VirtualMachine is compatible with MutableMapping - :rtype: ~azure.mgmt.compute.models.VirtualMachine - :raises ~azure.core.exceptions.HttpResponseError: - """ + async def _power_off_initial( + self, resource_group_name: str, vm_name: str, *, skip_shutdown: Optional[bool] = None, **kwargs: Any + ) -> AsyncIterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -10067,13 +9180,13 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.VirtualMachine] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - _request = build_virtual_machines_get_request( + _request = build_virtual_machines_power_off_request( resource_group_name=resource_group_name, vm_name=vm_name, subscription_id=self._config.subscription_id, - expand=expand, + skip_shutdown=skip_shutdown, api_version=self._config.api_version, headers=_headers, params=_params, @@ -10083,79 +9196,118 @@ async def get( } _request.url = self._client.format_url(_request.url, **path_format_arguments) - _stream = kwargs.pop("stream", False) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200]: - if _stream: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass + if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = _failsafe_deserialize(_models.CloudError, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if _stream: - deserialized = response.iter_bytes() - else: - deserialized = _deserialize(_models.VirtualMachine, response.json()) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore - async def _create_or_update_initial( - self, - resource_group_name: str, - vm_name: str, - parameters: Union[_models.VirtualMachine, JSON, IO[bytes]], - *, - etag: Optional[str] = None, - match_condition: Optional[MatchConditions] = None, - **kwargs: Any - ) -> AsyncIterator[bytes]: + @distributed_trace_async + async def begin_power_off( + self, resource_group_name: str, vm_name: str, *, skip_shutdown: Optional[bool] = None, **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. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_name: The name of the virtual machine. Required. + :type vm_name: str + :keyword 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 None. + :paramtype skip_shutdown: bool + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._power_off_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + skip_shutdown=skip_shutdown, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + async def _reapply_initial(self, resource_group_name: str, vm_name: str, **kwargs: Any) -> AsyncIterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, 304: ResourceNotModifiedError, } - if match_condition == MatchConditions.IfNotModified: - error_map[412] = ResourceModifiedError - elif match_condition == MatchConditions.IfPresent: - error_map[412] = ResourceNotFoundError - elif match_condition == MatchConditions.IfMissing: - error_map[412] = ResourceExistsError error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - content_type = content_type or "application/json" - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - - _request = build_virtual_machines_create_or_update_request( + _request = build_virtual_machines_reapply_request( resource_group_name=resource_group_name, vm_name=vm_name, subscription_id=self._config.subscription_id, - etag=etag, - match_condition=match_condition, - content_type=content_type, api_version=self._config.api_version, - content=_content, headers=_headers, params=_params, ) @@ -10171,7 +9323,7 @@ async def _create_or_update_initial( response = pipeline_response.http_response - if response.status_code not in [200, 201]: + if response.status_code not in [200, 202]: try: await response.read() # Load the body in memory and close the socket except (StreamConsumedError, StreamClosedError): @@ -10181,7 +9333,7 @@ async def _create_or_update_initial( raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} - if response.status_code == 201: + if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) @@ -10192,158 +9344,142 @@ async def _create_or_update_initial( return deserialized # type: ignore - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - vm_name: str, - parameters: _models.VirtualMachine, - *, - content_type: str = "application/json", - etag: Optional[str] = None, - match_condition: Optional[MatchConditions] = None, - **kwargs: Any - ) -> AsyncLROPoller[None]: - """The operation to create or update a virtual machine. Please note some properties can be set - only during virtual machine creation. + @distributed_trace_async + async def begin_reapply(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. The name is case insensitive. Required. :type resource_group_name: str :param vm_name: The name of the virtual machine. Required. :type vm_name: str - :param parameters: Parameters supplied to the Create Virtual Machine operation. Required. - :type parameters: ~azure.mgmt.compute.models.VirtualMachine - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is - None. - :paramtype etag: str - :keyword match_condition: The match condition to use upon the etag. Default value is None. - :paramtype match_condition: ~azure.core.MatchConditions :return: An instance of AsyncLROPoller that returns None :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - vm_name: str, - parameters: JSON, - *, - content_type: str = "application/json", - etag: Optional[str] = None, - match_condition: Optional[MatchConditions] = None, - **kwargs: Any - ) -> AsyncLROPoller[None]: - """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. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_name: The name of the virtual machine. Required. - :type vm_name: str - :param parameters: Parameters supplied to the Create Virtual Machine operation. Required. - :type parameters: JSON - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is - None. - :paramtype etag: str - :keyword match_condition: The match condition to use upon the etag. Default value is None. - :paramtype match_condition: ~azure.core.MatchConditions - :return: An instance of AsyncLROPoller that returns None - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._reapply_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - vm_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - etag: Optional[str] = None, - match_condition: Optional[MatchConditions] = None, - **kwargs: Any - ) -> AsyncLROPoller[None]: - """The operation to create or update a virtual machine. Please note some properties can be set - only during virtual machine creation. + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_name: The name of the virtual machine. Required. - :type vm_name: str - :param parameters: Parameters supplied to the Create Virtual Machine operation. Required. - :type parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is - None. - :paramtype etag: str - :keyword match_condition: The match condition to use upon the etag. Default value is None. - :paramtype match_condition: ~azure.core.MatchConditions - :return: An instance of AsyncLROPoller that returns None - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + async def _redeploy_initial(self, resource_group_name: str, vm_name: str, **kwargs: Any) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_virtual_machines_redeploy_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - vm_name: str, - parameters: Union[_models.VirtualMachine, JSON, IO[bytes]], - *, - etag: Optional[str] = None, - match_condition: Optional[MatchConditions] = None, - **kwargs: Any - ) -> AsyncLROPoller[None]: - """The operation to create or update a virtual machine. Please note some properties can be set - only during virtual machine creation. + async def begin_redeploy(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. The name is case insensitive. Required. :type resource_group_name: str :param vm_name: The name of the virtual machine. Required. :type vm_name: str - :param parameters: Parameters supplied to the Create Virtual Machine operation. Is one of the - following types: VirtualMachine, JSON, IO[bytes] Required. - :type parameters: ~azure.mgmt.compute.models.VirtualMachine or JSON or IO[bytes] - :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is - None. - :paramtype etag: str - :keyword match_condition: The match condition to use upon the etag. Default value is None. - :paramtype match_condition: ~azure.core.MatchConditions :return: An instance of AsyncLROPoller that returns None :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._create_or_update_initial( + raw_result = await self._redeploy_initial( resource_group_name=resource_group_name, vm_name=vm_name, - parameters=parameters, - etag=etag, - match_condition=match_condition, - content_type=content_type, cls=lambda x, y, z: x, headers=_headers, params=_params, @@ -10377,14 +9513,11 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - async def _update_initial( + async def _reimage_initial( self, resource_group_name: str, vm_name: str, - parameters: Union[_models.VirtualMachineUpdate, JSON, IO[bytes]], - *, - etag: Optional[str] = None, - match_condition: Optional[MatchConditions] = None, + parameters: Optional[Union[_models.VirtualMachineReimageParameters, JSON, IO[bytes]]] = None, **kwargs: Any ) -> AsyncIterator[bytes]: error_map: MutableMapping = { @@ -10393,33 +9526,29 @@ async def _update_initial( 409: ResourceExistsError, 304: ResourceNotModifiedError, } - if match_condition == MatchConditions.IfNotModified: - error_map[412] = ResourceModifiedError - elif match_condition == MatchConditions.IfPresent: - error_map[412] = ResourceNotFoundError - elif match_condition == MatchConditions.IfMissing: - error_map[412] = ResourceExistsError error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + content_type = content_type if parameters else None cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - content_type = content_type or "application/json" + content_type = content_type or "application/json" if parameters else None _content = None if isinstance(parameters, (IOBase, bytes)): _content = parameters else: - _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + if parameters is not None: + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + else: + _content = None - _request = build_virtual_machines_update_request( + _request = build_virtual_machines_reimage_request( resource_group_name=resource_group_name, vm_name=vm_name, subscription_id=self._config.subscription_id, - etag=etag, - match_condition=match_condition, content_type=content_type, api_version=self._config.api_version, content=_content, @@ -10438,7 +9567,7 @@ async def _update_initial( response = pipeline_response.http_response - if response.status_code not in [200]: + if response.status_code not in [200, 202]: try: await response.read() # Load the body in memory and close the socket except (StreamConsumedError, StreamClosedError): @@ -10448,8 +9577,9 @@ async def _update_initial( raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) deserialized = response.iter_bytes() @@ -10459,133 +9589,128 @@ async def _update_initial( return deserialized # type: ignore @overload - async def begin_update( + async def begin_reimage( self, resource_group_name: str, vm_name: str, - parameters: _models.VirtualMachineUpdate, + parameters: Optional[_models.VirtualMachineReimageParameters] = None, *, content_type: str = "application/json", - etag: Optional[str] = None, - match_condition: Optional[MatchConditions] = None, **kwargs: Any ) -> AsyncLROPoller[None]: - """The operation to update a virtual machine. + """Reimages (upgrade the operating system) a virtual machine 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. NOTE: The retaining of old OS disk depends on the value of deleteOption of OS disk. If + deleteOption is detach, the old OS disk will be preserved after reimage. If deleteOption is + delete, the old OS disk will be deleted after reimage. The deleteOption of the OS disk should + be updated accordingly before performing the reimage. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param vm_name: The name of the virtual machine. Required. :type vm_name: str - :param parameters: Parameters supplied to the Update Virtual Machine operation. Required. - :type parameters: ~azure.mgmt.compute.models.VirtualMachineUpdate + :param parameters: Parameters supplied to the Reimage Virtual Machine operation. Default value + is None. + :type parameters: ~azure.mgmt.compute.models.VirtualMachineReimageParameters :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is - None. - :paramtype etag: str - :keyword match_condition: The match condition to use upon the etag. Default value is None. - :paramtype match_condition: ~azure.core.MatchConditions :return: An instance of AsyncLROPoller that returns None :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - async def begin_update( + async def begin_reimage( self, resource_group_name: str, vm_name: str, - parameters: JSON, + parameters: Optional[JSON] = None, *, content_type: str = "application/json", - etag: Optional[str] = None, - match_condition: Optional[MatchConditions] = None, **kwargs: Any ) -> AsyncLROPoller[None]: - """The operation to update a virtual machine. + """Reimages (upgrade the operating system) a virtual machine 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. NOTE: The retaining of old OS disk depends on the value of deleteOption of OS disk. If + deleteOption is detach, the old OS disk will be preserved after reimage. If deleteOption is + delete, the old OS disk will be deleted after reimage. The deleteOption of the OS disk should + be updated accordingly before performing the reimage. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param vm_name: The name of the virtual machine. Required. :type vm_name: str - :param parameters: Parameters supplied to the Update Virtual Machine operation. Required. + :param parameters: Parameters supplied to the Reimage Virtual Machine operation. Default value + is None. :type parameters: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is - None. - :paramtype etag: str - :keyword match_condition: The match condition to use upon the etag. Default value is None. - :paramtype match_condition: ~azure.core.MatchConditions :return: An instance of AsyncLROPoller that returns None :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - async def begin_update( + async def begin_reimage( self, resource_group_name: str, vm_name: str, - parameters: IO[bytes], + parameters: Optional[IO[bytes]] = None, *, content_type: str = "application/json", - etag: Optional[str] = None, - match_condition: Optional[MatchConditions] = None, **kwargs: Any ) -> AsyncLROPoller[None]: - """The operation to update a virtual machine. + """Reimages (upgrade the operating system) a virtual machine 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. NOTE: The retaining of old OS disk depends on the value of deleteOption of OS disk. If + deleteOption is detach, the old OS disk will be preserved after reimage. If deleteOption is + delete, the old OS disk will be deleted after reimage. The deleteOption of the OS disk should + be updated accordingly before performing the reimage. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param vm_name: The name of the virtual machine. Required. :type vm_name: str - :param parameters: Parameters supplied to the Update Virtual Machine operation. Required. + :param parameters: Parameters supplied to the Reimage Virtual Machine operation. Default value + is None. :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is - None. - :paramtype etag: str - :keyword match_condition: The match condition to use upon the etag. Default value is None. - :paramtype match_condition: ~azure.core.MatchConditions :return: An instance of AsyncLROPoller that returns None :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace_async - async def begin_update( + async def begin_reimage( self, resource_group_name: str, vm_name: str, - parameters: Union[_models.VirtualMachineUpdate, JSON, IO[bytes]], - *, - etag: Optional[str] = None, - match_condition: Optional[MatchConditions] = None, + parameters: Optional[Union[_models.VirtualMachineReimageParameters, JSON, IO[bytes]]] = None, **kwargs: Any ) -> AsyncLROPoller[None]: - """The operation to update a virtual machine. + """Reimages (upgrade the operating system) a virtual machine 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. NOTE: The retaining of old OS disk depends on the value of deleteOption of OS disk. If + deleteOption is detach, the old OS disk will be preserved after reimage. If deleteOption is + delete, the old OS disk will be deleted after reimage. The deleteOption of the OS disk should + be updated accordingly before performing the reimage. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param vm_name: The name of the virtual machine. Required. :type vm_name: str - :param parameters: Parameters supplied to the Update Virtual Machine operation. Is one of the - following types: VirtualMachineUpdate, JSON, IO[bytes] Required. - :type parameters: ~azure.mgmt.compute.models.VirtualMachineUpdate or JSON or IO[bytes] - :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is - None. - :paramtype etag: str - :keyword match_condition: The match condition to use upon the etag. Default value is None. - :paramtype match_condition: ~azure.core.MatchConditions + :param parameters: Parameters supplied to the Reimage Virtual Machine operation. Is one of the + following types: VirtualMachineReimageParameters, JSON, IO[bytes] Default value is None. + :type parameters: ~azure.mgmt.compute.models.VirtualMachineReimageParameters or JSON or + IO[bytes] :return: An instance of AsyncLROPoller that returns None :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -10594,17 +9719,16 @@ async def begin_update( _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + content_type = content_type if parameters else None cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._update_initial( + raw_result = await self._reimage_initial( resource_group_name=resource_group_name, vm_name=vm_name, parameters=parameters, - etag=etag, - match_condition=match_condition, content_type=content_type, cls=lambda x, y, z: x, headers=_headers, @@ -10639,9 +9763,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - async def _delete_initial( - self, resource_group_name: str, vm_name: str, *, force_deletion: Optional[bool] = None, **kwargs: Any - ) -> AsyncIterator[bytes]: + async def _restart_initial(self, resource_group_name: str, vm_name: str, **kwargs: Any) -> AsyncIterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -10655,11 +9777,10 @@ async def _delete_initial( cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - _request = build_virtual_machines_delete_request( + _request = build_virtual_machines_restart_request( resource_group_name=resource_group_name, vm_name=vm_name, subscription_id=self._config.subscription_id, - force_deletion=force_deletion, api_version=self._config.api_version, headers=_headers, params=_params, @@ -10676,7 +9797,7 @@ async def _delete_initial( response = pipeline_response.http_response - if response.status_code not in [200, 202, 204]: + if response.status_code not in [200, 202]: try: await response.read() # Load the body in memory and close the socket except (StreamConsumedError, StreamClosedError): @@ -10698,19 +9819,14 @@ async def _delete_initial( return deserialized # type: ignore @distributed_trace_async - async def begin_delete( - self, resource_group_name: str, vm_name: str, *, force_deletion: Optional[bool] = None, **kwargs: Any - ) -> AsyncLROPoller[None]: - """The operation to delete a virtual machine. + async def begin_restart(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. The name is case insensitive. Required. :type resource_group_name: str :param vm_name: The name of the virtual machine. Required. :type vm_name: str - :keyword force_deletion: Optional parameter to force delete virtual machines. Default value is - None. - :paramtype force_deletion: bool :return: An instance of AsyncLROPoller that returns None :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -10723,10 +9839,9 @@ async def begin_delete( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._delete_initial( + raw_result = await self._restart_initial( resource_group_name=resource_group_name, vm_name=vm_name, - force_deletion=force_deletion, cls=lambda x, y, z: x, headers=_headers, params=_params, @@ -10760,39 +9875,31 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - @distributed_trace - def list( + @distributed_trace_async + async def retrieve_boot_diagnostics_data( self, resource_group_name: str, + vm_name: str, *, - filter: Optional[str] = None, - expand: Optional[Union[str, _models.ExpandTypeForListVMs]] = None, + sas_uri_expiration_time_in_minutes: Optional[int] = None, **kwargs: Any - ) -> AsyncItemPaged["_models.VirtualMachine"]: - """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. + ) -> _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. The name is case insensitive. Required. :type resource_group_name: str - :keyword 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. - :paramtype filter: str - :keyword expand: The expand expression to apply on operation. 'instanceView' enables fetching - run time status of all Virtual Machines, this can only be specified if a valid $filter option - is specified. "instanceView" Default value is None. - :paramtype expand: str or ~azure.mgmt.compute.models.ExpandTypeForListVMs - :return: An iterator like instance of VirtualMachine - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.models.VirtualMachine] + :param vm_name: The name of the virtual machine. Required. + :type vm_name: str + :keyword sas_uri_expiration_time_in_minutes: Expiration duration in minutes for the SAS URIs + with a value between 1 to 1440 minutes. **Note:** If not specified, SAS URIs will be generated + with a default expiration duration of 120 minutes. Default value is None. + :paramtype sas_uri_expiration_time_in_minutes: int + :return: RetrieveBootDiagnosticsDataResult. The RetrieveBootDiagnosticsDataResult is compatible + with MutableMapping + :rtype: ~azure.mgmt.compute.models.RetrieveBootDiagnosticsDataResult :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[List[_models.VirtualMachine]] = kwargs.pop("cls", None) - error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -10801,105 +9908,65 @@ def list( } error_map.update(kwargs.pop("error_map", {}) or {}) - def prepare_request(next_link=None): - if not next_link: - - _request = build_virtual_machines_list_request( - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - filter=filter, - expand=expand, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) + cls: ClsType[_models.RetrieveBootDiagnosticsDataResult] = kwargs.pop("cls", None) - return _request + _request = build_virtual_machines_retrieve_boot_diagnostics_data_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + sas_uri_expiration_time_in_minutes=sas_uri_expiration_time_in_minutes, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) - async def extract_data(pipeline_response): - deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.VirtualMachine], deserialized.get("value", [])) - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) - async def get_next(next_link=None): - _request = prepare_request(next_link) + response = pipeline_response.http_response - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.CloudError, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.RetrieveBootDiagnosticsDataResult, response.json()) - return pipeline_response + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore - return AsyncItemPaged(get_next, extract_data) + return deserialized # type: ignore - @distributed_trace - def list_all( - self, - *, - status_only: Optional[str] = None, - filter: Optional[str] = None, - expand: Optional[Union[str, _models.ExpandTypesForListVMs]] = None, - **kwargs: Any - ) -> AsyncItemPaged["_models.VirtualMachine"]: - """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. + @distributed_trace_async + async def simulate_eviction(self, resource_group_name: str, vm_name: str, **kwargs: Any) -> None: + """The operation to simulate the eviction of spot virtual machine. - :keyword status_only: statusOnly=true enables fetching run time status of all Virtual Machines - in the subscription. Default value is None. - :paramtype status_only: str - :keyword 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. - :paramtype filter: str - :keyword expand: The expand expression to apply on operation. 'instanceView' enables fetching - run time status of all Virtual Machines, this can only be specified if a valid $filter option - is specified. "instanceView" Default value is None. - :paramtype expand: str or ~azure.mgmt.compute.models.ExpandTypesForListVMs - :return: An iterator like instance of VirtualMachine - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.models.VirtualMachine] + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_name: The name of the virtual machine. Required. + :type vm_name: str + :return: None + :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[List[_models.VirtualMachine]] = kwargs.pop("cls", None) - error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -10908,75 +9975,40 @@ def list_all( } error_map.update(kwargs.pop("error_map", {}) or {}) - def prepare_request(next_link=None): - if not next_link: - - _request = build_virtual_machines_list_all_request( - subscription_id=self._config.subscription_id, - status_only=status_only, - filter=filter, - expand=expand, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - return _request + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} - async def extract_data(pipeline_response): - deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.VirtualMachine], deserialized.get("value", [])) - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + cls: ClsType[None] = kwargs.pop("cls", None) - async def get_next(next_link=None): - _request = prepare_request(next_link) + _request = build_virtual_machines_simulate_eviction_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.CloudError, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response = pipeline_response.http_response - return pipeline_response + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - return AsyncItemPaged(get_next, extract_data) + if cls: + return cls(pipeline_response, None, {}) # type: ignore - async def _assess_patches_initial( - self, resource_group_name: str, vm_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: + async def _start_initial(self, resource_group_name: str, vm_name: str, **kwargs: Any) -> AsyncIterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -10990,7 +10022,7 @@ async def _assess_patches_initial( cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - _request = build_virtual_machines_assess_patches_request( + _request = build_virtual_machines_start_request( resource_group_name=resource_group_name, vm_name=vm_name, subscription_id=self._config.subscription_id, @@ -11032,31 +10064,27 @@ async def _assess_patches_initial( return deserialized # 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. + async def begin_start(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. The name is case insensitive. Required. :type resource_group_name: str :param vm_name: The name of the virtual machine. Required. :type vm_name: str - :return: An instance of AsyncLROPoller that returns VirtualMachineAssessPatchesResult. The - VirtualMachineAssessPatchesResult is compatible with MutableMapping - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.VirtualMachineAssessPatchesResult] + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.VirtualMachineAssessPatchesResult] = kwargs.pop("cls", None) + cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._assess_patches_initial( + raw_result = await self._start_initial( resource_group_name=resource_group_name, vm_name=vm_name, cls=lambda x, y, z: x, @@ -11067,16 +10095,9 @@ async def begin_assess_patches( await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): - response_headers = {} - response = pipeline_response.http_response - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = _deserialize(_models.VirtualMachineAssessPatchesResult, response.json()) + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized + return cls(pipeline_response, None, {}) # type: ignore path_format_arguments = { "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), @@ -11091,21 +10112,113 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller[_models.VirtualMachineAssessPatchesResult].from_continuation_token( + return AsyncLROPoller[None].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller[_models.VirtualMachineAssessPatchesResult]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - async def _attach_detach_data_disks_initial( + @distributed_trace + def list_available_sizes( + self, resource_group_name: str, vm_name: str, **kwargs: Any + ) -> AsyncItemPaged["_models.VirtualMachineSize"]: + """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. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_name: The name of the virtual machine. Required. + :type vm_name: str + :return: An iterator like instance of VirtualMachineSize + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.models.VirtualMachineSize] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.VirtualMachineSize]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_virtual_machines_list_available_sizes_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.VirtualMachineSize], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + async def _run_command_initial( self, resource_group_name: str, vm_name: str, - parameters: Union[_models.AttachDetachDataDisksRequest, JSON, IO[bytes]], + parameters: Union[_models.RunCommandInput, JSON, IO[bytes]], **kwargs: Any ) -> AsyncIterator[bytes]: error_map: MutableMapping = { @@ -11129,7 +10242,7 @@ async def _attach_detach_data_disks_initial( else: _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - _request = build_virtual_machines_attach_detach_data_disks_request( + _request = build_virtual_machines_run_command_request( resource_group_name=resource_group_name, vm_name=vm_name, subscription_id=self._config.subscription_id, @@ -11173,36 +10286,35 @@ async def _attach_detach_data_disks_initial( return deserialized # type: ignore @overload - async def begin_attach_detach_data_disks( + async def begin_run_command( self, resource_group_name: str, vm_name: str, - parameters: _models.AttachDetachDataDisksRequest, + parameters: _models.RunCommandInput, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.StorageProfile]: - """Attach and detach data disks to/from the virtual machine. + ) -> AsyncLROPoller[_models.RunCommandResult]: + """Run command on the VM. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param vm_name: The name of the virtual machine. Required. :type vm_name: str - :param parameters: Parameters supplied to the attach and detach data disks operation on the - virtual machine. Required. - :type parameters: ~azure.mgmt.compute.models.AttachDetachDataDisksRequest + :param parameters: Parameters supplied to the Run command operation. Required. + :type parameters: ~azure.mgmt.compute.models.RunCommandInput :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns StorageProfile. The StorageProfile is + :return: An instance of AsyncLROPoller that returns RunCommandResult. The RunCommandResult is compatible with MutableMapping - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.StorageProfile] + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.RunCommandResult] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - async def begin_attach_detach_data_disks( + async def begin_run_command( self, resource_group_name: str, vm_name: str, @@ -11210,28 +10322,27 @@ async def begin_attach_detach_data_disks( *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.StorageProfile]: - """Attach and detach data disks to/from the virtual machine. + ) -> AsyncLROPoller[_models.RunCommandResult]: + """Run command on the VM. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param vm_name: The name of the virtual machine. Required. :type vm_name: str - :param parameters: Parameters supplied to the attach and detach data disks operation on the - virtual machine. Required. + :param parameters: Parameters supplied to the Run command operation. Required. :type parameters: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns StorageProfile. The StorageProfile is + :return: An instance of AsyncLROPoller that returns RunCommandResult. The RunCommandResult is compatible with MutableMapping - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.StorageProfile] + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.RunCommandResult] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - async def begin_attach_detach_data_disks( + async def begin_run_command( self, resource_group_name: str, vm_name: str, @@ -11239,60 +10350,58 @@ async def begin_attach_detach_data_disks( *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.StorageProfile]: - """Attach and detach data disks to/from the virtual machine. + ) -> AsyncLROPoller[_models.RunCommandResult]: + """Run command on the VM. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param vm_name: The name of the virtual machine. Required. :type vm_name: str - :param parameters: Parameters supplied to the attach and detach data disks operation on the - virtual machine. Required. + :param parameters: Parameters supplied to the Run command operation. Required. :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns StorageProfile. The StorageProfile is + :return: An instance of AsyncLROPoller that returns RunCommandResult. The RunCommandResult is compatible with MutableMapping - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.StorageProfile] + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.RunCommandResult] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace_async - async def begin_attach_detach_data_disks( + async def begin_run_command( self, resource_group_name: str, vm_name: str, - parameters: Union[_models.AttachDetachDataDisksRequest, JSON, IO[bytes]], + parameters: Union[_models.RunCommandInput, JSON, IO[bytes]], **kwargs: Any - ) -> AsyncLROPoller[_models.StorageProfile]: - """Attach and detach data disks to/from the virtual machine. + ) -> AsyncLROPoller[_models.RunCommandResult]: + """Run command on the VM. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param vm_name: The name of the virtual machine. Required. :type vm_name: str - :param parameters: Parameters supplied to the attach and detach data disks operation on the - virtual machine. Is one of the following types: AttachDetachDataDisksRequest, JSON, IO[bytes] - Required. - :type parameters: ~azure.mgmt.compute.models.AttachDetachDataDisksRequest or JSON or IO[bytes] - :return: An instance of AsyncLROPoller that returns StorageProfile. The StorageProfile is + :param parameters: Parameters supplied to the Run command operation. Is one of the following + types: RunCommandInput, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.compute.models.RunCommandInput or JSON or IO[bytes] + :return: An instance of AsyncLROPoller that returns RunCommandResult. The RunCommandResult is compatible with MutableMapping - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.StorageProfile] + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.RunCommandResult] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.StorageProfile] = kwargs.pop("cls", None) + cls: ClsType[_models.RunCommandResult] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._attach_detach_data_disks_initial( + raw_result = await self._run_command_initial( resource_group_name=resource_group_name, vm_name=vm_name, parameters=parameters, @@ -11311,7 +10420,7 @@ def get_long_running_output(pipeline_response): response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - deserialized = _deserialize(_models.StorageProfile, response.json()) + deserialized = _deserialize(_models.RunCommandResult, response.json()) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized @@ -11329,21 +10438,21 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller[_models.StorageProfile].from_continuation_token( + return AsyncLROPoller[_models.RunCommandResult].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller[_models.StorageProfile]( + return AsyncLROPoller[_models.RunCommandResult]( self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - async def _capture_initial( + async def _migrate_to_vm_scale_set_initial( self, resource_group_name: str, vm_name: str, - parameters: Union[_models.VirtualMachineCaptureParameters, JSON, IO[bytes]], + parameters: Optional[Union[_models.MigrateVMToVirtualMachineScaleSetInput, JSON, IO[bytes]]] = None, **kwargs: Any ) -> AsyncIterator[bytes]: error_map: MutableMapping = { @@ -11358,16 +10467,20 @@ async def _capture_initial( _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + content_type = content_type if parameters else None cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - content_type = content_type or "application/json" + content_type = content_type or "application/json" if parameters else None _content = None if isinstance(parameters, (IOBase, bytes)): _content = parameters else: - _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + if parameters is not None: + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + else: + _content = None - _request = build_virtual_machines_capture_request( + _request = build_virtual_machines_migrate_to_vm_scale_set_request( resource_group_name=resource_group_name, vm_name=vm_name, subscription_id=self._config.subscription_id, @@ -11389,7 +10502,7 @@ async def _capture_initial( response = pipeline_response.http_response - if response.status_code not in [200, 202]: + if response.status_code not in [202]: try: await response.read() # Load the body in memory and close the socket except (StreamConsumedError, StreamClosedError): @@ -11399,9 +10512,8 @@ async def _capture_initial( raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) deserialized = response.iter_bytes() @@ -11411,131 +10523,123 @@ async def _capture_initial( return deserialized # type: ignore @overload - async def begin_capture( + async def begin_migrate_to_vm_scale_set( self, resource_group_name: str, vm_name: str, - parameters: _models.VirtualMachineCaptureParameters, + parameters: Optional[_models.MigrateVMToVirtualMachineScaleSetInput] = None, *, content_type: str = "application/json", **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. + ) -> AsyncLROPoller[None]: + """Migrate a virtual machine from availability set to Flexible Virtual Machine Scale Set. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param vm_name: The name of the virtual machine. Required. :type vm_name: str - :param parameters: Parameters supplied to the Capture Virtual Machine operation. Required. - :type parameters: ~azure.mgmt.compute.models.VirtualMachineCaptureParameters + :param parameters: Parameters supplied to the Migrate Virtual Machine operation. Default value + is None. + :type parameters: ~azure.mgmt.compute.models.MigrateVMToVirtualMachineScaleSetInput :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns VirtualMachineCaptureResult. The - VirtualMachineCaptureResult is compatible with MutableMapping - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.VirtualMachineCaptureResult] + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - async def begin_capture( + async def begin_migrate_to_vm_scale_set( self, resource_group_name: str, vm_name: str, - parameters: JSON, + parameters: Optional[JSON] = None, *, content_type: str = "application/json", **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. + ) -> AsyncLROPoller[None]: + """Migrate a virtual machine from availability set to Flexible Virtual Machine Scale Set. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param vm_name: The name of the virtual machine. Required. :type vm_name: str - :param parameters: Parameters supplied to the Capture Virtual Machine operation. Required. + :param parameters: Parameters supplied to the Migrate Virtual Machine operation. Default value + is None. :type parameters: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns VirtualMachineCaptureResult. The - VirtualMachineCaptureResult is compatible with MutableMapping - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.VirtualMachineCaptureResult] + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - async def begin_capture( + async def begin_migrate_to_vm_scale_set( self, resource_group_name: str, vm_name: str, - parameters: IO[bytes], + parameters: Optional[IO[bytes]] = None, *, content_type: str = "application/json", **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. + ) -> AsyncLROPoller[None]: + """Migrate a virtual machine from availability set to Flexible Virtual Machine Scale Set. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param vm_name: The name of the virtual machine. Required. :type vm_name: str - :param parameters: Parameters supplied to the Capture Virtual Machine operation. Required. + :param parameters: Parameters supplied to the Migrate Virtual Machine operation. Default value + is None. :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns VirtualMachineCaptureResult. The - VirtualMachineCaptureResult is compatible with MutableMapping - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.VirtualMachineCaptureResult] + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace_async - async def begin_capture( + async def begin_migrate_to_vm_scale_set( self, resource_group_name: str, vm_name: str, - parameters: Union[_models.VirtualMachineCaptureParameters, JSON, IO[bytes]], + parameters: Optional[Union[_models.MigrateVMToVirtualMachineScaleSetInput, JSON, IO[bytes]]] = None, **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. + ) -> AsyncLROPoller[None]: + """Migrate a virtual machine from availability set to Flexible Virtual Machine Scale Set. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param vm_name: The name of the virtual machine. Required. :type vm_name: str - :param parameters: Parameters supplied to the Capture Virtual Machine operation. Is one of the - following types: VirtualMachineCaptureParameters, JSON, IO[bytes] Required. - :type parameters: ~azure.mgmt.compute.models.VirtualMachineCaptureParameters or JSON or + :param parameters: Parameters supplied to the Migrate Virtual Machine operation. Is one of the + following types: MigrateVMToVirtualMachineScaleSetInput, JSON, IO[bytes] Default value is None. + :type parameters: ~azure.mgmt.compute.models.MigrateVMToVirtualMachineScaleSetInput or JSON or IO[bytes] - :return: An instance of AsyncLROPoller that returns VirtualMachineCaptureResult. The - VirtualMachineCaptureResult is compatible with MutableMapping - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.VirtualMachineCaptureResult] + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.VirtualMachineCaptureResult] = kwargs.pop("cls", None) + content_type = content_type if parameters else None + cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._capture_initial( + raw_result = await self._migrate_to_vm_scale_set_initial( resource_group_name=resource_group_name, vm_name=vm_name, parameters=parameters, @@ -11548,16 +10652,9 @@ async def begin_capture( await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): - response_headers = {} - response = pipeline_response.http_response - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = _deserialize(_models.VirtualMachineCaptureResult, response.json()) + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized + return cls(pipeline_response, None, {}) # type: ignore path_format_arguments = { "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), @@ -11572,19 +10669,29 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller[_models.VirtualMachineCaptureResult].from_continuation_token( + return AsyncLROPoller[None].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller[_models.VirtualMachineCaptureResult]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace + def list_by_location(self, location: str, **kwargs: Any) -> AsyncItemPaged["_models.VirtualMachine"]: + """Gets all the virtual machines under the specified subscription for the specified location. + + :param location: The location name. Required. + :type location: str + :return: An iterator like instance of VirtualMachine + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.models.VirtualMachine] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.VirtualMachine]] = kwargs.pop("cls", None) - async def _convert_to_managed_disks_initial( - self, resource_group_name: str, vm_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -11593,124 +10700,175 @@ async def _convert_to_managed_disks_initial( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} + def prepare_request(next_link=None): + if not next_link: - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + _request = build_virtual_machines_list_by_location_request( + location=location, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) - _request = build_virtual_machines_convert_to_managed_disks_request( - resource_group_name=resource_group_name, - vm_name=vm_name, - subscription_id=self._config.subscription_id, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) + return _request - response = pipeline_response.http_response + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.VirtualMachine], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) - if response.status_code not in [200, 202]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.CloudError, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + async def get_next(next_link=None): + _request = prepare_request(next_link) - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response - deserialized = response.iter_bytes() + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore + return pipeline_response - return deserialized # type: ignore + return AsyncItemPaged(get_next, extract_data) + + +class VirtualMachineExtensionsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.compute.aio.ComputeClient`'s + :attr:`virtual_machine_extensions` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace_async - async def begin_convert_to_managed_disks( - self, resource_group_name: str, vm_name: str, **kwargs: Any - ) -> AsyncLROPoller[_models.OkResponse]: - """Converts virtual machine disks from blob-based to managed disks. Virtual machine must be - stop-deallocated before invoking this operation. + 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. The name is case insensitive. Required. :type resource_group_name: str :param vm_name: The name of the virtual machine. Required. :type vm_name: str - :return: An instance of AsyncLROPoller that returns OkResponse. The OkResponse is compatible - with MutableMapping - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.OkResponse] + :param vm_extension_name: The name of the virtual machine extension. Required. + :type vm_extension_name: str + :keyword expand: The expand expression to apply on the operation. Default value is None. + :paramtype expand: str + :return: VirtualMachineExtension. The VirtualMachineExtension is compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.VirtualMachineExtension :raises ~azure.core.exceptions.HttpResponseError: """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.OkResponse] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._convert_to_managed_disks_initial( - resource_group_name=resource_group_name, - vm_name=vm_name, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - response_headers = {} - response = pipeline_response.http_response - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = _deserialize(_models.OkResponse, response.json()) - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized + cls: ClsType[_models.VirtualMachineExtension] = kwargs.pop("cls", None) + _request = build_virtual_machine_extensions_get_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + vm_extension_name=vm_extension_name, + subscription_id=self._config.subscription_id, + expand=expand, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) path_format_arguments = { "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), } + _request.url = self._client.format_url(_request.url, **path_format_arguments) - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.OkResponse].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.OkResponse]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs ) - async def _deallocate_initial( - self, resource_group_name: str, vm_name: str, *, hibernate: Optional[bool] = None, **kwargs: Any + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.VirtualMachineExtension, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _create_or_update_initial( + self, + resource_group_name: str, + vm_name: str, + vm_extension_name: str, + extension_parameters: Union[_models.VirtualMachineExtension, JSON, IO[bytes]], + **kwargs: Any ) -> AsyncIterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -11720,17 +10878,27 @@ async def _deallocate_initial( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - _request = build_virtual_machines_deallocate_request( + content_type = content_type or "application/json" + _content = None + if isinstance(extension_parameters, (IOBase, bytes)): + _content = extension_parameters + else: + _content = json.dumps(extension_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_virtual_machine_extensions_create_or_update_request( resource_group_name=resource_group_name, vm_name=vm_name, + vm_extension_name=vm_extension_name, subscription_id=self._config.subscription_id, - hibernate=hibernate, + content_type=content_type, api_version=self._config.api_version, + content=_content, headers=_headers, params=_params, ) @@ -11746,7 +10914,7 @@ async def _deallocate_initial( response = pipeline_response.http_response - if response.status_code not in [200, 202]: + if response.status_code not in [200, 201]: try: await response.read() # Load the body in memory and close the socket except (StreamConsumedError, StreamClosedError): @@ -11756,7 +10924,7 @@ async def _deallocate_initial( raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} - if response.status_code == 202: + if response.status_code == 201: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) @@ -11767,37 +10935,144 @@ async def _deallocate_initial( return deserialized # type: ignore + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + vm_name: str, + vm_extension_name: str, + extension_parameters: _models.VirtualMachineExtension, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.VirtualMachineExtension]: + """The operation to create or update the extension. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_name: The name of the virtual machine. Required. + :type vm_name: str + :param vm_extension_name: The name of the virtual machine extension. Required. + :type vm_extension_name: str + :param extension_parameters: Parameters supplied to the Create Virtual Machine Extension + operation. Required. + :type extension_parameters: ~azure.mgmt.compute.models.VirtualMachineExtension + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns VirtualMachineExtension. The + VirtualMachineExtension is compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.VirtualMachineExtension] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + vm_name: str, + vm_extension_name: str, + extension_parameters: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.VirtualMachineExtension]: + """The operation to create or update the extension. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_name: The name of the virtual machine. Required. + :type vm_name: str + :param vm_extension_name: The name of the virtual machine extension. Required. + :type vm_extension_name: str + :param extension_parameters: Parameters supplied to the Create Virtual Machine Extension + operation. Required. + :type extension_parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns VirtualMachineExtension. The + VirtualMachineExtension is compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.VirtualMachineExtension] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + vm_name: str, + vm_extension_name: str, + extension_parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.VirtualMachineExtension]: + """The operation to create or update the extension. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_name: The name of the virtual machine. Required. + :type vm_name: str + :param vm_extension_name: The name of the virtual machine extension. Required. + :type vm_extension_name: str + :param extension_parameters: Parameters supplied to the Create Virtual Machine Extension + operation. Required. + :type extension_parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns VirtualMachineExtension. The + VirtualMachineExtension is compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.VirtualMachineExtension] + :raises ~azure.core.exceptions.HttpResponseError: + """ + @distributed_trace_async - async def begin_deallocate( - self, resource_group_name: str, vm_name: str, *, hibernate: Optional[bool] = None, **kwargs: Any - ) -> AsyncLROPoller[_models.OkResponse]: - """Shuts down the virtual machine and releases the compute resources. You are not billed for the - compute resources that this virtual machine uses. + async def begin_create_or_update( + self, + resource_group_name: str, + vm_name: str, + vm_extension_name: str, + extension_parameters: Union[_models.VirtualMachineExtension, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.VirtualMachineExtension]: + """The operation to create or update the extension. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param vm_name: The name of the virtual machine. Required. :type vm_name: str - :keyword hibernate: Optional parameter to hibernate a virtual machine. Default value is None. - :paramtype hibernate: bool - :return: An instance of AsyncLROPoller that returns OkResponse. The OkResponse is compatible - with MutableMapping - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.OkResponse] + :param vm_extension_name: The name of the virtual machine extension. Required. + :type vm_extension_name: str + :param extension_parameters: Parameters supplied to the Create Virtual Machine Extension + operation. Is one of the following types: VirtualMachineExtension, JSON, IO[bytes] Required. + :type extension_parameters: ~azure.mgmt.compute.models.VirtualMachineExtension or JSON or + IO[bytes] + :return: An instance of AsyncLROPoller that returns VirtualMachineExtension. The + VirtualMachineExtension is compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.VirtualMachineExtension] :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = kwargs.pop("headers", {}) or {} + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.OkResponse] = kwargs.pop("cls", None) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.VirtualMachineExtension] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._deallocate_initial( + raw_result = await self._create_or_update_initial( resource_group_name=resource_group_name, vm_name=vm_name, - hibernate=hibernate, + vm_extension_name=vm_extension_name, + extension_parameters=extension_parameters, + content_type=content_type, cls=lambda x, y, z: x, headers=_headers, params=_params, @@ -11807,14 +11082,10 @@ async def begin_deallocate( kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - response_headers = {} response = pipeline_response.http_response - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = _deserialize(_models.OkResponse, response.json()) + deserialized = _deserialize(_models.VirtualMachineExtension, response.json()) if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized path_format_arguments = { @@ -11830,80 +11101,22 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller[_models.OkResponse].from_continuation_token( + return AsyncLROPoller[_models.VirtualMachineExtension].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller[_models.OkResponse]( + return AsyncLROPoller[_models.VirtualMachineExtension]( self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - @distributed_trace_async - async def generalize(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. For Windows, please refer to `Create a - managed image of a generalized VM in Azure - `_. 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. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_name: The name of the virtual machine. Required. - :type vm_name: str - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_virtual_machines_generalize_request( - resource_group_name=resource_group_name, - vm_name=vm_name, - subscription_id=self._config.subscription_id, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.CloudError, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - async def _install_patches_initial( + async def _update_initial( self, resource_group_name: str, vm_name: str, - install_patches_input: Union[_models.VirtualMachineInstallPatchesParameters, JSON, IO[bytes]], + vm_extension_name: str, + extension_parameters: Union[_models.VirtualMachineExtensionUpdate, JSON, IO[bytes]], **kwargs: Any ) -> AsyncIterator[bytes]: error_map: MutableMapping = { @@ -11922,14 +11135,15 @@ async def _install_patches_initial( content_type = content_type or "application/json" _content = None - if isinstance(install_patches_input, (IOBase, bytes)): - _content = install_patches_input + if isinstance(extension_parameters, (IOBase, bytes)): + _content = extension_parameters else: - _content = json.dumps(install_patches_input, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(extension_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - _request = build_virtual_machines_install_patches_request( + _request = build_virtual_machine_extensions_update_request( resource_group_name=resource_group_name, vm_name=vm_name, + vm_extension_name=vm_extension_name, subscription_id=self._config.subscription_id, content_type=content_type, api_version=self._config.api_version, @@ -11949,7 +11163,7 @@ async def _install_patches_initial( response = pipeline_response.http_response - if response.status_code not in [200, 202]: + if response.status_code not in [200]: try: await response.read() # Load the body in memory and close the socket except (StreamConsumedError, StreamClosedError): @@ -11959,9 +11173,8 @@ async def _install_patches_initial( raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) deserialized = response.iter_bytes() @@ -11971,133 +11184,143 @@ async def _install_patches_initial( return deserialized # type: ignore @overload - async def begin_install_patches( + async def begin_update( self, resource_group_name: str, vm_name: str, - install_patches_input: _models.VirtualMachineInstallPatchesParameters, + vm_extension_name: str, + extension_parameters: _models.VirtualMachineExtensionUpdate, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.VirtualMachineInstallPatchesResult]: - """Installs patches on the VM. + ) -> AsyncLROPoller[_models.VirtualMachineExtension]: + """The operation to update the extension. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param vm_name: The name of the virtual machine. Required. :type vm_name: str - :param install_patches_input: Input for InstallPatches as directly received by the API. - Required. - :type install_patches_input: ~azure.mgmt.compute.models.VirtualMachineInstallPatchesParameters + :param vm_extension_name: The name of the virtual machine extension. Required. + :type vm_extension_name: str + :param extension_parameters: Parameters supplied to the Update Virtual Machine Extension + operation. Required. + :type extension_parameters: ~azure.mgmt.compute.models.VirtualMachineExtensionUpdate :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns VirtualMachineInstallPatchesResult. The - VirtualMachineInstallPatchesResult is compatible with MutableMapping - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.VirtualMachineInstallPatchesResult] + :return: An instance of AsyncLROPoller that returns VirtualMachineExtension. The + VirtualMachineExtension is compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.VirtualMachineExtension] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - async def begin_install_patches( + async def begin_update( self, resource_group_name: str, vm_name: str, - install_patches_input: JSON, + vm_extension_name: str, + extension_parameters: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.VirtualMachineInstallPatchesResult]: - """Installs patches on the VM. + ) -> AsyncLROPoller[_models.VirtualMachineExtension]: + """The operation to update the extension. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param vm_name: The name of the virtual machine. Required. :type vm_name: str - :param install_patches_input: Input for InstallPatches as directly received by the API. - Required. - :type install_patches_input: JSON + :param vm_extension_name: The name of the virtual machine extension. Required. + :type vm_extension_name: str + :param extension_parameters: Parameters supplied to the Update Virtual Machine Extension + operation. Required. + :type extension_parameters: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns VirtualMachineInstallPatchesResult. The - VirtualMachineInstallPatchesResult is compatible with MutableMapping - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.VirtualMachineInstallPatchesResult] + :return: An instance of AsyncLROPoller that returns VirtualMachineExtension. The + VirtualMachineExtension is compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.VirtualMachineExtension] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - async def begin_install_patches( + async def begin_update( self, resource_group_name: str, vm_name: str, - install_patches_input: IO[bytes], + vm_extension_name: str, + extension_parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.VirtualMachineInstallPatchesResult]: - """Installs patches on the VM. + ) -> AsyncLROPoller[_models.VirtualMachineExtension]: + """The operation to update the extension. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param vm_name: The name of the virtual machine. Required. :type vm_name: str - :param install_patches_input: Input for InstallPatches as directly received by the API. - Required. - :type install_patches_input: IO[bytes] + :param vm_extension_name: The name of the virtual machine extension. Required. + :type vm_extension_name: str + :param extension_parameters: Parameters supplied to the Update Virtual Machine Extension + operation. Required. + :type extension_parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns VirtualMachineInstallPatchesResult. The - VirtualMachineInstallPatchesResult is compatible with MutableMapping - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.VirtualMachineInstallPatchesResult] + :return: An instance of AsyncLROPoller that returns VirtualMachineExtension. The + VirtualMachineExtension is compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.VirtualMachineExtension] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace_async - async def begin_install_patches( + async def begin_update( self, resource_group_name: str, vm_name: str, - install_patches_input: Union[_models.VirtualMachineInstallPatchesParameters, JSON, IO[bytes]], + vm_extension_name: str, + extension_parameters: Union[_models.VirtualMachineExtensionUpdate, JSON, IO[bytes]], **kwargs: Any - ) -> AsyncLROPoller[_models.VirtualMachineInstallPatchesResult]: - """Installs patches on the VM. + ) -> AsyncLROPoller[_models.VirtualMachineExtension]: + """The operation to update the extension. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param vm_name: The name of the virtual machine. Required. :type vm_name: str - :param install_patches_input: Input for InstallPatches as directly received by the API. Is one - of the following types: VirtualMachineInstallPatchesParameters, JSON, IO[bytes] Required. - :type install_patches_input: ~azure.mgmt.compute.models.VirtualMachineInstallPatchesParameters - or JSON or IO[bytes] - :return: An instance of AsyncLROPoller that returns VirtualMachineInstallPatchesResult. The - VirtualMachineInstallPatchesResult is compatible with MutableMapping - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.VirtualMachineInstallPatchesResult] + :param vm_extension_name: The name of the virtual machine extension. Required. + :type vm_extension_name: str + :param extension_parameters: Parameters supplied to the Update Virtual Machine Extension + operation. Is one of the following types: VirtualMachineExtensionUpdate, JSON, IO[bytes] + Required. + :type extension_parameters: ~azure.mgmt.compute.models.VirtualMachineExtensionUpdate or JSON or + IO[bytes] + :return: An instance of AsyncLROPoller that returns VirtualMachineExtension. The + VirtualMachineExtension is compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.VirtualMachineExtension] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.VirtualMachineInstallPatchesResult] = kwargs.pop("cls", None) + cls: ClsType[_models.VirtualMachineExtension] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._install_patches_initial( + raw_result = await self._update_initial( resource_group_name=resource_group_name, vm_name=vm_name, - install_patches_input=install_patches_input, + vm_extension_name=vm_extension_name, + extension_parameters=extension_parameters, content_type=content_type, cls=lambda x, y, z: x, headers=_headers, @@ -12113,7 +11336,7 @@ def get_long_running_output(pipeline_response): response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - deserialized = _deserialize(_models.VirtualMachineInstallPatchesResult, response.json()) + deserialized = _deserialize(_models.VirtualMachineExtension, response.json()) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized @@ -12131,32 +11354,19 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller[_models.VirtualMachineInstallPatchesResult].from_continuation_token( + return AsyncLROPoller[_models.VirtualMachineExtension].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller[_models.VirtualMachineInstallPatchesResult]( + return AsyncLROPoller[_models.VirtualMachineExtension]( self._client, raw_result, get_long_running_output, polling_method # 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. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_name: The name of the virtual machine. Required. - :type vm_name: str - :return: VirtualMachineInstanceView. The VirtualMachineInstanceView is compatible with - MutableMapping - :rtype: ~azure.mgmt.compute.models.VirtualMachineInstanceView - :raises ~azure.core.exceptions.HttpResponseError: - """ + async def _delete_initial( + self, resource_group_name: str, vm_name: str, vm_extension_name: str, **kwargs: Any + ) -> AsyncIterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -12168,11 +11378,12 @@ async def instance_view( _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.VirtualMachineInstanceView] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - _request = build_virtual_machines_instance_view_request( + _request = build_virtual_machine_extensions_delete_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=self._config.api_version, headers=_headers, @@ -12183,117 +11394,63 @@ async def instance_view( } _request.url = self._client.format_url(_request.url, **path_format_arguments) - _stream = kwargs.pop("stream", False) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200]: - if _stream: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass + if response.status_code not in [200, 202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = _failsafe_deserialize(_models.CloudError, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if _stream: - deserialized = response.iter_bytes() - else: - deserialized = _deserialize(_models.VirtualMachineInstanceView, response.json()) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _perform_maintenance_initial( - self, resource_group_name: str, vm_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_virtual_machines_perform_maintenance_request( - resource_group_name=resource_group_name, - vm_name=vm_name, - subscription_id=self._config.subscription_id, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.CloudError, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.iter_bytes() - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore @distributed_trace_async - async def begin_perform_maintenance( - self, resource_group_name: str, vm_name: str, **kwargs: Any - ) -> AsyncLROPoller[_models.OkResponse]: - """The operation to perform maintenance on a virtual machine. + async def begin_delete( + 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. The name is case insensitive. Required. :type resource_group_name: str :param vm_name: The name of the virtual machine. Required. :type vm_name: str - :return: An instance of AsyncLROPoller that returns OkResponse. The OkResponse is compatible - with MutableMapping - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.OkResponse] + :param vm_extension_name: The name of the virtual machine extension. Required. + :type vm_extension_name: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.OkResponse] = kwargs.pop("cls", None) + cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._perform_maintenance_initial( + raw_result = await self._delete_initial( resource_group_name=resource_group_name, vm_name=vm_name, + vm_extension_name=vm_extension_name, cls=lambda x, y, z: x, headers=_headers, params=_params, @@ -12302,16 +11459,9 @@ async def begin_perform_maintenance( await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): - response_headers = {} - response = pipeline_response.http_response - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = _deserialize(_models.OkResponse, response.json()) + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized + return cls(pipeline_response, None, {}) # type: ignore path_format_arguments = { "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), @@ -12326,19 +11476,32 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller[_models.OkResponse].from_continuation_token( + return AsyncLROPoller[None].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller[_models.OkResponse]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - async def _power_off_initial( - self, resource_group_name: str, vm_name: str, *, skip_shutdown: Optional[bool] = None, **kwargs: Any - ) -> AsyncIterator[bytes]: + @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. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_name: The name of the virtual machine. Required. + :type vm_name: str + :keyword expand: The expand expression to apply on the operation. Default value is None. + :paramtype expand: str + :return: VirtualMachineExtensionsListResult. The VirtualMachineExtensionsListResult is + compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.VirtualMachineExtensionsListResult + :raises ~azure.core.exceptions.HttpResponseError: + """ error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -12350,13 +11513,13 @@ async def _power_off_initial( _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + cls: ClsType[_models.VirtualMachineExtensionsListResult] = kwargs.pop("cls", None) - _request = build_virtual_machines_power_off_request( + _request = build_virtual_machine_extensions_list_request( resource_group_name=resource_group_name, vm_name=vm_name, subscription_id=self._config.subscription_id, - skip_shutdown=skip_shutdown, + expand=expand, api_version=self._config.api_version, headers=_headers, params=_params, @@ -12366,110 +11529,70 @@ async def _power_off_initial( } _request.url = self._client.format_url(_request.url, **path_format_arguments) - _stream = True + _stream = kwargs.pop("stream", False) pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200, 202]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = _failsafe_deserialize(_models.CloudError, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.iter_bytes() + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.VirtualMachineExtensionsListResult, response.json()) if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - @distributed_trace_async - async def begin_power_off( - self, resource_group_name: str, vm_name: str, *, skip_shutdown: Optional[bool] = None, **kwargs: Any - ) -> AsyncLROPoller[_models.OkResponse]: - """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. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_name: The name of the virtual machine. Required. - :type vm_name: str - :keyword 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 None. - :paramtype skip_shutdown: bool - :return: An instance of AsyncLROPoller that returns OkResponse. The OkResponse is compatible - with MutableMapping - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.OkResponse] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[_models.OkResponse] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._power_off_initial( - resource_group_name=resource_group_name, - vm_name=vm_name, - skip_shutdown=skip_shutdown, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): - response_headers = {} - response = pipeline_response.http_response - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) +class VirtualMachineExtensionImagesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - deserialized = _deserialize(_models.OkResponse, response.json()) - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized + Instead, you should access the following operations through + :class:`~azure.mgmt.compute.aio.ComputeClient`'s + :attr:`virtual_machine_extension_images` attribute. + """ - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.OkResponse].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.OkResponse]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) + @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. - async def _reapply_initial(self, resource_group_name: str, vm_name: str, **kwargs: Any) -> AsyncIterator[bytes]: + :param location: The location name. Required. + :type location: str + :param publisher_name: Required. + :type publisher_name: str + :param type: Required. + :type type: str + :param version: Required. + :type version: str + :return: VirtualMachineExtensionImage. The VirtualMachineExtensionImage is compatible with + MutableMapping + :rtype: ~azure.mgmt.compute.models.VirtualMachineExtensionImage + :raises ~azure.core.exceptions.HttpResponseError: + """ error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -12481,11 +11604,13 @@ async def _reapply_initial(self, resource_group_name: str, vm_name: str, **kwarg _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + cls: ClsType[_models.VirtualMachineExtensionImage] = kwargs.pop("cls", None) - _request = build_virtual_machines_reapply_request( - resource_group_name=resource_group_name, - vm_name=vm_name, + _request = build_virtual_machine_extension_images_get_request( + location=location, + publisher_name=publisher_name, + type=type, + version=version, subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -12496,104 +11621,47 @@ async def _reapply_initial(self, resource_group_name: str, vm_name: str, **kwarg } _request.url = self._client.format_url(_request.url, **path_format_arguments) - _stream = True + _stream = kwargs.pop("stream", False) pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200, 202]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = _failsafe_deserialize(_models.CloudError, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.iter_bytes() + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.VirtualMachineExtensionImage, response.json()) if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore @distributed_trace_async - async def begin_reapply( - self, resource_group_name: str, vm_name: str, **kwargs: Any - ) -> AsyncLROPoller[_models.OkResponse]: - """The operation to reapply a virtual machine's state. + 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 resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_name: The name of the virtual machine. Required. - :type vm_name: str - :return: An instance of AsyncLROPoller that returns OkResponse. The OkResponse is compatible - with MutableMapping - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.OkResponse] + :param location: The location name. Required. + :type location: str + :param publisher_name: Required. + :type publisher_name: str + :return: list of VirtualMachineExtensionImage + :rtype: list[~azure.mgmt.compute.models.VirtualMachineExtensionImage] :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[_models.OkResponse] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._reapply_initial( - resource_group_name=resource_group_name, - vm_name=vm_name, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - response_headers = {} - response = pipeline_response.http_response - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = _deserialize(_models.OkResponse, response.json()) - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized - - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.OkResponse].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.OkResponse]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _redeploy_initial(self, resource_group_name: str, vm_name: str, **kwargs: Any) -> AsyncIterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -12605,11 +11673,11 @@ async def _redeploy_initial(self, resource_group_name: str, vm_name: str, **kwar _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + cls: ClsType[List[_models.VirtualMachineExtensionImage]] = kwargs.pop("cls", None) - _request = build_virtual_machines_redeploy_request( - resource_group_name=resource_group_name, - vm_name=vm_name, + _request = build_virtual_machine_extension_images_list_types_request( + location=location, + publisher_name=publisher_name, subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -12620,110 +11688,63 @@ async def _redeploy_initial(self, resource_group_name: str, vm_name: str, **kwar } _request.url = self._client.format_url(_request.url, **path_format_arguments) - _stream = True + _stream = kwargs.pop("stream", False) pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200, 202]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = _failsafe_deserialize(_models.CloudError, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.iter_bytes() + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(List[_models.VirtualMachineExtensionImage], response.json()) if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore @distributed_trace_async - async def begin_redeploy( - self, resource_group_name: str, vm_name: str, **kwargs: Any - ) -> AsyncLROPoller[_models.OkResponse]: - """Shuts down the virtual machine, moves it to a new node, and powers it back on. + 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 resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_name: The name of the virtual machine. Required. - :type vm_name: str - :return: An instance of AsyncLROPoller that returns OkResponse. The OkResponse is compatible - with MutableMapping - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.OkResponse] + :param location: The location name. Required. + :type location: str + :param publisher_name: Required. + :type publisher_name: str + :param type: Required. + :type type: str + :keyword filter: The filter to apply on the operation. Default value is None. + :paramtype filter: str + :keyword top: Default value is None. + :paramtype top: int + :keyword orderby: Default value is None. + :paramtype orderby: str + :return: list of VirtualMachineExtensionImage + :rtype: list[~azure.mgmt.compute.models.VirtualMachineExtensionImage] :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[_models.OkResponse] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._redeploy_initial( - resource_group_name=resource_group_name, - vm_name=vm_name, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - response_headers = {} - response = pipeline_response.http_response - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = _deserialize(_models.OkResponse, response.json()) - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized - - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.OkResponse].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.OkResponse]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _reimage_initial( - self, - resource_group_name: str, - vm_name: str, - parameters: Optional[Union[_models.VirtualMachineReimageParameters, JSON, IO[bytes]]] = None, - **kwargs: Any - ) -> AsyncIterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -12732,30 +11753,20 @@ async def _reimage_initial( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - content_type = content_type if parameters else None - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" if parameters else None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - if parameters is not None: - _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - else: - _content = None + cls: ClsType[List[_models.VirtualMachineExtensionImage]] = kwargs.pop("cls", None) - _request = build_virtual_machines_reimage_request( - resource_group_name=resource_group_name, - vm_name=vm_name, + _request = build_virtual_machine_extension_images_list_versions_request( + location=location, + publisher_name=publisher_name, + type=type, subscription_id=self._config.subscription_id, - content_type=content_type, + filter=filter, + top=top, + orderby=orderby, api_version=self._config.api_version, - content=_content, headers=_headers, params=_params, ) @@ -12764,223 +11775,220 @@ async def _reimage_initial( } _request.url = self._client.format_url(_request.url, **path_format_arguments) - _stream = True + _stream = kwargs.pop("stream", False) pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200, 202]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = _failsafe_deserialize(_models.CloudError, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.iter_bytes() + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(List[_models.VirtualMachineExtensionImage], response.json()) if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - @overload - async def begin_reimage( - self, - resource_group_name: str, - vm_name: str, - parameters: Optional[_models.VirtualMachineReimageParameters] = None, - *, - content_type: str = "application/json", + +class AvailabilitySetsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.compute.aio.ComputeClient`'s + :attr:`availability_sets` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @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. The name is case insensitive. + Required. + :type resource_group_name: str + :param availability_set_name: The name of the availability set. Required. + :type availability_set_name: str + :return: AvailabilitySet. The AvailabilitySet is compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.AvailabilitySet + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.AvailabilitySet] = kwargs.pop("cls", None) + + _request = build_availability_sets_get_request( + resource_group_name=resource_group_name, + availability_set_name=availability_set_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.AvailabilitySet, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + async def create_or_update( + self, + resource_group_name: str, + availability_set_name: str, + parameters: _models.AvailabilitySet, + *, + content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.OkResponse]: - """Reimages (upgrade the operating system) a virtual machine 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. NOTE: The retaining of old OS disk depends on the value of deleteOption of OS disk. If - deleteOption is detach, the old OS disk will be preserved after reimage. If deleteOption is - delete, the old OS disk will be deleted after reimage. The deleteOption of the OS disk should - be updated accordingly before performing the reimage. + ) -> _models.AvailabilitySet: + """Create or update an availability set. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param vm_name: The name of the virtual machine. Required. - :type vm_name: str - :param parameters: Parameters supplied to the Reimage Virtual Machine operation. Default value - is None. - :type parameters: ~azure.mgmt.compute.models.VirtualMachineReimageParameters + :param availability_set_name: The name of the availability set. Required. + :type availability_set_name: str + :param parameters: Parameters supplied to the Create Availability Set operation. Required. + :type parameters: ~azure.mgmt.compute.models.AvailabilitySet :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns OkResponse. The OkResponse is compatible - with MutableMapping - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.OkResponse] + :return: AvailabilitySet. The AvailabilitySet is compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.AvailabilitySet :raises ~azure.core.exceptions.HttpResponseError: """ @overload - async def begin_reimage( + async def create_or_update( self, resource_group_name: str, - vm_name: str, - parameters: Optional[JSON] = None, + availability_set_name: str, + parameters: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.OkResponse]: - """Reimages (upgrade the operating system) a virtual machine 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. NOTE: The retaining of old OS disk depends on the value of deleteOption of OS disk. If - deleteOption is detach, the old OS disk will be preserved after reimage. If deleteOption is - delete, the old OS disk will be deleted after reimage. The deleteOption of the OS disk should - be updated accordingly before performing the reimage. + ) -> _models.AvailabilitySet: + """Create or update an availability set. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param vm_name: The name of the virtual machine. Required. - :type vm_name: str - :param parameters: Parameters supplied to the Reimage Virtual Machine operation. Default value - is None. + :param availability_set_name: The name of the availability set. Required. + :type availability_set_name: str + :param parameters: Parameters supplied to the Create Availability Set operation. Required. :type parameters: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns OkResponse. The OkResponse is compatible - with MutableMapping - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.OkResponse] + :return: AvailabilitySet. The AvailabilitySet is compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.AvailabilitySet :raises ~azure.core.exceptions.HttpResponseError: """ @overload - async def begin_reimage( + async def create_or_update( self, resource_group_name: str, - vm_name: str, - parameters: Optional[IO[bytes]] = None, + availability_set_name: str, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.OkResponse]: - """Reimages (upgrade the operating system) a virtual machine 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. NOTE: The retaining of old OS disk depends on the value of deleteOption of OS disk. If - deleteOption is detach, the old OS disk will be preserved after reimage. If deleteOption is - delete, the old OS disk will be deleted after reimage. The deleteOption of the OS disk should - be updated accordingly before performing the reimage. + ) -> _models.AvailabilitySet: + """Create or update an availability set. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param vm_name: The name of the virtual machine. Required. - :type vm_name: str - :param parameters: Parameters supplied to the Reimage Virtual Machine operation. Default value - is None. + :param availability_set_name: The name of the availability set. Required. + :type availability_set_name: str + :param parameters: Parameters supplied to the Create Availability Set operation. Required. :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns OkResponse. The OkResponse is compatible - with MutableMapping - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.OkResponse] + :return: AvailabilitySet. The AvailabilitySet is compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.AvailabilitySet :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace_async - async def begin_reimage( + async def create_or_update( self, resource_group_name: str, - vm_name: str, - parameters: Optional[Union[_models.VirtualMachineReimageParameters, JSON, IO[bytes]]] = None, + availability_set_name: str, + parameters: Union[_models.AvailabilitySet, JSON, IO[bytes]], **kwargs: Any - ) -> AsyncLROPoller[_models.OkResponse]: - """Reimages (upgrade the operating system) a virtual machine 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. NOTE: The retaining of old OS disk depends on the value of deleteOption of OS disk. If - deleteOption is detach, the old OS disk will be preserved after reimage. If deleteOption is - delete, the old OS disk will be deleted after reimage. The deleteOption of the OS disk should - be updated accordingly before performing the reimage. + ) -> _models.AvailabilitySet: + """Create or update an availability set. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param vm_name: The name of the virtual machine. Required. - :type vm_name: str - :param parameters: Parameters supplied to the Reimage Virtual Machine operation. Is one of the - following types: VirtualMachineReimageParameters, JSON, IO[bytes] Default value is None. - :type parameters: ~azure.mgmt.compute.models.VirtualMachineReimageParameters or JSON or - IO[bytes] - :return: An instance of AsyncLROPoller that returns OkResponse. The OkResponse is compatible - with MutableMapping - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.OkResponse] + :param availability_set_name: The name of the availability set. Required. + :type availability_set_name: str + :param parameters: Parameters supplied to the Create Availability Set operation. Is one of the + following types: AvailabilitySet, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.compute.models.AvailabilitySet or JSON or IO[bytes] + :return: AvailabilitySet. The AvailabilitySet is compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.AvailabilitySet :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} - - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - content_type = content_type if parameters else None - cls: ClsType[_models.OkResponse] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._reimage_initial( - resource_group_name=resource_group_name, - vm_name=vm_name, - parameters=parameters, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - response_headers = {} - response = pipeline_response.http_response - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = _deserialize(_models.OkResponse, response.json()) - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized - - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.OkResponse].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.OkResponse]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _restart_initial(self, resource_group_name: str, vm_name: str, **kwargs: Any) -> AsyncIterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -12989,16 +11997,26 @@ async def _restart_initial(self, resource_group_name: str, vm_name: str, **kwarg } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AvailabilitySet] = kwargs.pop("cls", None) - _request = build_virtual_machines_restart_request( + content_type = content_type or "application/json" + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_availability_sets_create_or_update_request( resource_group_name=resource_group_name, - vm_name=vm_name, + availability_set_name=availability_set_name, subscription_id=self._config.subscription_id, + content_type=content_type, api_version=self._config.api_version, + content=_content, headers=_headers, params=_params, ) @@ -13007,126 +12025,134 @@ async def _restart_initial(self, resource_group_name: str, vm_name: str, **kwarg } _request.url = self._client.format_url(_request.url, **path_format_arguments) - _stream = True + _stream = kwargs.pop("stream", False) pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200, 202]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = _failsafe_deserialize(_models.CloudError, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.iter_bytes() + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.AvailabilitySet, response.json()) if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - @distributed_trace_async - async def begin_restart( - self, resource_group_name: str, vm_name: str, **kwargs: Any - ) -> AsyncLROPoller[_models.OkResponse]: - """The operation to restart a virtual machine. + @overload + async def update( + self, + resource_group_name: str, + availability_set_name: str, + parameters: _models.AvailabilitySetUpdate, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.AvailabilitySet: + """Update an availability set. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param vm_name: The name of the virtual machine. Required. - :type vm_name: str - :return: An instance of AsyncLROPoller that returns OkResponse. The OkResponse is compatible - with MutableMapping - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.OkResponse] + :param availability_set_name: The name of the availability set. Required. + :type availability_set_name: str + :param parameters: Parameters supplied to the Update Availability Set operation. Required. + :type parameters: ~azure.mgmt.compute.models.AvailabilitySetUpdate + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: AvailabilitySet. The AvailabilitySet is compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.AvailabilitySet :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[_models.OkResponse] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._restart_initial( - resource_group_name=resource_group_name, - vm_name=vm_name, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): - response_headers = {} - response = pipeline_response.http_response - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + @overload + async def update( + self, + resource_group_name: str, + availability_set_name: str, + parameters: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.AvailabilitySet: + """Update an availability set. - deserialized = _deserialize(_models.OkResponse, response.json()) - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param availability_set_name: The name of the availability set. Required. + :type availability_set_name: str + :param parameters: Parameters supplied to the Update Availability Set operation. Required. + :type parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: AvailabilitySet. The AvailabilitySet is compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.AvailabilitySet + :raises ~azure.core.exceptions.HttpResponseError: + """ - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } + @overload + async def update( + self, + resource_group_name: str, + availability_set_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.AvailabilitySet: + """Update an availability set. - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.OkResponse].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.OkResponse]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param availability_set_name: The name of the availability set. Required. + :type availability_set_name: str + :param parameters: Parameters supplied to the Update Availability Set operation. Required. + :type parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: AvailabilitySet. The AvailabilitySet is compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.AvailabilitySet + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace_async - async def retrieve_boot_diagnostics_data( + async def update( self, resource_group_name: str, - vm_name: str, - *, - sas_uri_expiration_time_in_minutes: Optional[int] = None, + availability_set_name: str, + parameters: Union[_models.AvailabilitySetUpdate, JSON, IO[bytes]], **kwargs: Any - ) -> _models.RetrieveBootDiagnosticsDataResult: - """The operation to retrieve SAS URIs for a virtual machine's boot diagnostic logs. + ) -> _models.AvailabilitySet: + """Update an availability set. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param vm_name: The name of the virtual machine. Required. - :type vm_name: str - :keyword sas_uri_expiration_time_in_minutes: Expiration duration in minutes for the SAS URIs - with a value between 1 to 1440 minutes. **Note:** If not specified, SAS URIs will be generated - with a default expiration duration of 120 minutes. Default value is None. - :paramtype sas_uri_expiration_time_in_minutes: int - :return: RetrieveBootDiagnosticsDataResult. The RetrieveBootDiagnosticsDataResult is compatible - with MutableMapping - :rtype: ~azure.mgmt.compute.models.RetrieveBootDiagnosticsDataResult + :param availability_set_name: The name of the availability set. Required. + :type availability_set_name: str + :param parameters: Parameters supplied to the Update Availability Set operation. Is one of the + following types: AvailabilitySetUpdate, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.compute.models.AvailabilitySetUpdate or JSON or IO[bytes] + :return: AvailabilitySet. The AvailabilitySet is compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.AvailabilitySet :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -13137,17 +12163,26 @@ async def retrieve_boot_diagnostics_data( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.RetrieveBootDiagnosticsDataResult] = kwargs.pop("cls", None) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AvailabilitySet] = kwargs.pop("cls", None) - _request = build_virtual_machines_retrieve_boot_diagnostics_data_request( + content_type = content_type or "application/json" + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_availability_sets_update_request( resource_group_name=resource_group_name, - vm_name=vm_name, + availability_set_name=availability_set_name, subscription_id=self._config.subscription_id, - sas_uri_expiration_time_in_minutes=sas_uri_expiration_time_in_minutes, + content_type=content_type, api_version=self._config.api_version, + content=_content, headers=_headers, params=_params, ) @@ -13176,7 +12211,7 @@ async def retrieve_boot_diagnostics_data( if _stream: deserialized = response.iter_bytes() else: - deserialized = _deserialize(_models.RetrieveBootDiagnosticsDataResult, response.json()) + deserialized = _deserialize(_models.AvailabilitySet, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -13184,14 +12219,14 @@ async def retrieve_boot_diagnostics_data( return deserialized # type: ignore @distributed_trace_async - async def simulate_eviction(self, resource_group_name: str, vm_name: str, **kwargs: Any) -> None: - """The operation to simulate the eviction of spot virtual machine. + async def delete(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. The name is case insensitive. Required. :type resource_group_name: str - :param vm_name: The name of the virtual machine. Required. - :type vm_name: str + :param availability_set_name: The name of the availability set. Required. + :type availability_set_name: str :return: None :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -13209,9 +12244,9 @@ async def simulate_eviction(self, resource_group_name: str, vm_name: str, **kwar cls: ClsType[None] = kwargs.pop("cls", None) - _request = build_virtual_machines_simulate_eviction_request( + _request = build_availability_sets_delete_request( resource_group_name=resource_group_name, - vm_name=vm_name, + availability_set_name=availability_set_name, subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -13229,7 +12264,7 @@ async def simulate_eviction(self, resource_group_name: str, vm_name: str, **kwar response = pipeline_response.http_response - if response.status_code not in [204]: + if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) error = _failsafe_deserialize(_models.CloudError, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -13237,7 +12272,22 @@ async def simulate_eviction(self, resource_group_name: str, vm_name: str, **kwar if cls: return cls(pipeline_response, None, {}) # type: ignore - async def _start_initial(self, resource_group_name: str, vm_name: str, **kwargs: Any) -> AsyncIterator[bytes]: + @distributed_trace + def list(self, resource_group_name: str, **kwargs: Any) -> AsyncItemPaged["_models.AvailabilitySet"]: + """Lists all availability sets in a resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :return: An iterator like instance of AvailabilitySet + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.models.AvailabilitySet] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.AvailabilitySet]] = kwargs.pop("cls", None) + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -13246,133 +12296,172 @@ async def _start_initial(self, resource_group_name: str, vm_name: str, **kwargs: } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} + def prepare_request(next_link=None): + if not next_link: - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + _request = build_availability_sets_list_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) - _request = build_virtual_machines_start_request( - resource_group_name=resource_group_name, - vm_name=vm_name, - subscription_id=self._config.subscription_id, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) + return _request - response = pipeline_response.http_response + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.AvailabilitySet], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) - if response.status_code not in [200, 202]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.CloudError, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + async def get_next(next_link=None): + _request = prepare_request(next_link) - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response - deserialized = response.iter_bytes() + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore + return pipeline_response - return deserialized # type: ignore + return AsyncItemPaged(get_next, extract_data) - @distributed_trace_async - async def begin_start( - self, resource_group_name: str, vm_name: str, **kwargs: Any - ) -> AsyncLROPoller[_models.OkResponse]: - """The operation to start a virtual machine. + @distributed_trace + def list_by_subscription( + self, *, expand: Optional[str] = None, **kwargs: Any + ) -> AsyncItemPaged["_models.AvailabilitySet"]: + """Lists all availability sets in a subscription. - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_name: The name of the virtual machine. Required. - :type vm_name: str - :return: An instance of AsyncLROPoller that returns OkResponse. The OkResponse is compatible - with MutableMapping - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.OkResponse] + :keyword expand: The expand expression to apply to the operation. Allowed values are + 'instanceView'. Default value is None. + :paramtype expand: str + :return: An iterator like instance of AvailabilitySet + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.models.AvailabilitySet] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.OkResponse] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._start_initial( - resource_group_name=resource_group_name, - vm_name=vm_name, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) + cls: ClsType[List[_models.AvailabilitySet]] = kwargs.pop("cls", None) - def get_long_running_output(pipeline_response): - response_headers = {} - response = pipeline_response.http_response - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_availability_sets_list_by_subscription_request( + subscription_id=self._config.subscription_id, + expand=expand, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request - deserialized = _deserialize(_models.OkResponse, response.json()) + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.AvailabilitySet], deserialized.get("value", [])) if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } + async def get_next(next_link=None): + _request = prepare_request(next_link) - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.OkResponse].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs ) - return AsyncLROPoller[_models.OkResponse]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) @distributed_trace def list_available_sizes( - self, resource_group_name: str, vm_name: str, **kwargs: Any + self, resource_group_name: str, availability_set_name: str, **kwargs: Any ) -> AsyncItemPaged["_models.VirtualMachineSize"]: - """Lists all available virtual machine sizes to which the specified virtual machine can be - resized. + """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. The name is case insensitive. Required. :type resource_group_name: str - :param vm_name: The name of the virtual machine. Required. - :type vm_name: str + :param availability_set_name: The name of the availability set. Required. + :type availability_set_name: str :return: An iterator like instance of VirtualMachineSize :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.models.VirtualMachineSize] :raises ~azure.core.exceptions.HttpResponseError: @@ -13393,9 +12482,9 @@ def list_available_sizes( def prepare_request(next_link=None): if not next_link: - _request = build_virtual_machines_list_available_sizes_request( + _request = build_availability_sets_list_available_sizes_request( resource_group_name=resource_group_name, - vm_name=vm_name, + availability_set_name=availability_set_name, subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -13455,13 +12544,121 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - async def _run_command_initial( + @overload + async def start_migration_to_virtual_machine_scale_set( # pylint: disable=name-too-long self, resource_group_name: str, - vm_name: str, - parameters: Union[_models.RunCommandInput, JSON, IO[bytes]], + availability_set_name: str, + parameters: _models.MigrateToVirtualMachineScaleSetInput, + *, + content_type: str = "application/json", **kwargs: Any - ) -> AsyncIterator[bytes]: + ) -> None: + """Start migration operation on an Availability Set to move its Virtual Machines to a Virtual + Machine Scale Set. This should be followed by a migrate operation on each Virtual Machine that + triggers a downtime on the Virtual Machine. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param availability_set_name: The name of the availability set. Required. + :type availability_set_name: str + :param parameters: Parameters supplied to the migrate operation on the availability set. + Required. + :type parameters: ~azure.mgmt.compute.models.MigrateToVirtualMachineScaleSetInput + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def start_migration_to_virtual_machine_scale_set( # pylint: disable=name-too-long + self, + resource_group_name: str, + availability_set_name: str, + parameters: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> None: + """Start migration operation on an Availability Set to move its Virtual Machines to a Virtual + Machine Scale Set. This should be followed by a migrate operation on each Virtual Machine that + triggers a downtime on the Virtual Machine. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param availability_set_name: The name of the availability set. Required. + :type availability_set_name: str + :param parameters: Parameters supplied to the migrate operation on the availability set. + Required. + :type parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def start_migration_to_virtual_machine_scale_set( # pylint: disable=name-too-long + self, + resource_group_name: str, + availability_set_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> None: + """Start migration operation on an Availability Set to move its Virtual Machines to a Virtual + Machine Scale Set. This should be followed by a migrate operation on each Virtual Machine that + triggers a downtime on the Virtual Machine. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param availability_set_name: The name of the availability set. Required. + :type availability_set_name: str + :param parameters: Parameters supplied to the migrate operation on the availability set. + Required. + :type parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def start_migration_to_virtual_machine_scale_set( # pylint: disable=name-too-long + self, + resource_group_name: str, + availability_set_name: str, + parameters: Union[_models.MigrateToVirtualMachineScaleSetInput, JSON, IO[bytes]], + **kwargs: Any + ) -> None: + """Start migration operation on an Availability Set to move its Virtual Machines to a Virtual + Machine Scale Set. This should be followed by a migrate operation on each Virtual Machine that + triggers a downtime on the Virtual Machine. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param availability_set_name: The name of the availability set. Required. + :type availability_set_name: str + :param parameters: Parameters supplied to the migrate operation on the availability set. Is one + of the following types: MigrateToVirtualMachineScaleSetInput, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.compute.models.MigrateToVirtualMachineScaleSetInput or JSON or + IO[bytes] + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -13474,7 +12671,7 @@ async def _run_command_initial( _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + cls: ClsType[None] = kwargs.pop("cls", None) content_type = content_type or "application/json" _content = None @@ -13483,9 +12680,9 @@ async def _run_command_initial( else: _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - _request = build_virtual_machines_run_command_request( + _request = build_availability_sets_start_migration_to_virtual_machine_scale_set_request( resource_group_name=resource_group_name, - vm_name=vm_name, + availability_set_name=availability_set_name, subscription_id=self._config.subscription_id, content_type=content_type, api_version=self._config.api_version, @@ -13498,202 +12695,244 @@ async def _run_command_initial( } _request.url = self._client.format_url(_request.url, **path_format_arguments) - _stream = True + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200, 202]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass + if response.status_code not in [204]: map_error(status_code=response.status_code, response=response, error_map=error_map) error = _failsafe_deserialize(_models.CloudError, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + if cls: + return cls(pipeline_response, None, {}) # type: ignore - deserialized = response.iter_bytes() + @distributed_trace_async + async def cancel_migration_to_virtual_machine_scale_set( # pylint: disable=name-too-long + self, resource_group_name: str, availability_set_name: str, **kwargs: Any + ) -> None: + """Cancel the migration operation on an Availability Set. - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param availability_set_name: The name of the availability set. Required. + :type availability_set_name: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) - return deserialized # type: ignore + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_availability_sets_cancel_migration_to_virtual_machine_scale_set_request( + resource_group_name=resource_group_name, + availability_set_name=availability_set_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore @overload - async def begin_run_command( + async def validate_migration_to_virtual_machine_scale_set( # pylint: disable=name-too-long self, resource_group_name: str, - vm_name: str, - parameters: _models.RunCommandInput, + availability_set_name: str, + parameters: _models.MigrateToVirtualMachineScaleSetInput, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.RunCommandResult]: - """Run command on the VM. + ) -> None: + """Validates that the Virtual Machines in the Availability Set can be migrated to the provided + Virtual Machine Scale Set. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param vm_name: The name of the virtual machine. Required. - :type vm_name: str - :param parameters: Parameters supplied to the Run command operation. Required. - :type parameters: ~azure.mgmt.compute.models.RunCommandInput + :param availability_set_name: The name of the availability set. Required. + :type availability_set_name: str + :param parameters: Parameters supplied to the migrate operation on the availability set. + Required. + :type parameters: ~azure.mgmt.compute.models.MigrateToVirtualMachineScaleSetInput :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns RunCommandResult. The RunCommandResult is - compatible with MutableMapping - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.RunCommandResult] + :return: None + :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ @overload - async def begin_run_command( + async def validate_migration_to_virtual_machine_scale_set( # pylint: disable=name-too-long self, resource_group_name: str, - vm_name: str, + availability_set_name: str, parameters: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.RunCommandResult]: - """Run command on the VM. + ) -> None: + """Validates that the Virtual Machines in the Availability Set can be migrated to the provided + Virtual Machine Scale Set. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param vm_name: The name of the virtual machine. Required. - :type vm_name: str - :param parameters: Parameters supplied to the Run command operation. Required. + :param availability_set_name: The name of the availability set. Required. + :type availability_set_name: str + :param parameters: Parameters supplied to the migrate operation on the availability set. + Required. :type parameters: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns RunCommandResult. The RunCommandResult is - compatible with MutableMapping - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.RunCommandResult] + :return: None + :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ @overload - async def begin_run_command( + async def validate_migration_to_virtual_machine_scale_set( # pylint: disable=name-too-long self, resource_group_name: str, - vm_name: str, + availability_set_name: str, parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.RunCommandResult]: - """Run command on the VM. + ) -> None: + """Validates that the Virtual Machines in the Availability Set can be migrated to the provided + Virtual Machine Scale Set. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param vm_name: The name of the virtual machine. Required. - :type vm_name: str - :param parameters: Parameters supplied to the Run command operation. Required. + :param availability_set_name: The name of the availability set. Required. + :type availability_set_name: str + :param parameters: Parameters supplied to the migrate operation on the availability set. + Required. :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns RunCommandResult. The RunCommandResult is - compatible with MutableMapping - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.RunCommandResult] + :return: None + :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace_async - async def begin_run_command( + async def validate_migration_to_virtual_machine_scale_set( # pylint: disable=name-too-long self, resource_group_name: str, - vm_name: str, - parameters: Union[_models.RunCommandInput, JSON, IO[bytes]], + availability_set_name: str, + parameters: Union[_models.MigrateToVirtualMachineScaleSetInput, JSON, IO[bytes]], **kwargs: Any - ) -> AsyncLROPoller[_models.RunCommandResult]: - """Run command on the VM. + ) -> None: + """Validates that the Virtual Machines in the Availability Set can be migrated to the provided + Virtual Machine Scale Set. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param vm_name: The name of the virtual machine. Required. - :type vm_name: str - :param parameters: Parameters supplied to the Run command operation. Is one of the following - types: RunCommandInput, JSON, IO[bytes] Required. - :type parameters: ~azure.mgmt.compute.models.RunCommandInput or JSON or IO[bytes] - :return: An instance of AsyncLROPoller that returns RunCommandResult. The RunCommandResult is - compatible with MutableMapping - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.RunCommandResult] + :param availability_set_name: The name of the availability set. Required. + :type availability_set_name: str + :param parameters: Parameters supplied to the migrate operation on the availability set. Is one + of the following types: MigrateToVirtualMachineScaleSetInput, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.compute.models.MigrateToVirtualMachineScaleSetInput or JSON or + IO[bytes] + :return: None + :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.RunCommandResult] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._run_command_initial( - resource_group_name=resource_group_name, - vm_name=vm_name, - parameters=parameters, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - response_headers = {} - response = pipeline_response.http_response - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + cls: ClsType[None] = kwargs.pop("cls", None) - deserialized = _deserialize(_models.RunCommandResult, response.json()) - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized + content_type = content_type or "application/json" + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _request = build_availability_sets_validate_migration_to_virtual_machine_scale_set_request( + resource_group_name=resource_group_name, + availability_set_name=availability_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) path_format_arguments = { "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), } + _request.url = self._client.format_url(_request.url, **path_format_arguments) - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.RunCommandResult].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.RunCommandResult]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs ) - async def _migrate_to_vm_scale_set_initial( + 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) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + async def _convert_to_virtual_machine_scale_set_initial( # pylint: disable=name-too-long self, resource_group_name: str, - vm_name: str, - parameters: Optional[Union[_models.MigrateVMToVirtualMachineScaleSetInput, JSON, IO[bytes]]] = None, + availability_set_name: str, + parameters: Optional[Union[_models.ConvertToVirtualMachineScaleSetInput, JSON, IO[bytes]]] = None, **kwargs: Any ) -> AsyncIterator[bytes]: error_map: MutableMapping = { @@ -13721,9 +12960,9 @@ async def _migrate_to_vm_scale_set_initial( else: _content = None - _request = build_virtual_machines_migrate_to_vm_scale_set_request( + _request = build_availability_sets_convert_to_virtual_machine_scale_set_request( resource_group_name=resource_group_name, - vm_name=vm_name, + availability_set_name=availability_set_name, subscription_id=self._config.subscription_id, content_type=content_type, api_version=self._config.api_version, @@ -13764,25 +13003,26 @@ async def _migrate_to_vm_scale_set_initial( return deserialized # type: ignore @overload - async def begin_migrate_to_vm_scale_set( + async def begin_convert_to_virtual_machine_scale_set( # pylint: disable=name-too-long self, resource_group_name: str, - vm_name: str, - parameters: Optional[_models.MigrateVMToVirtualMachineScaleSetInput] = None, + availability_set_name: str, + parameters: Optional[_models.ConvertToVirtualMachineScaleSetInput] = None, *, content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[None]: - """Migrate a virtual machine from availability set to Flexible Virtual Machine Scale Set. + """Create a new Flexible Virtual Machine Scale Set and migrate all the Virtual Machines in the + Availability Set. This does not trigger a downtime on the Virtual Machines. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param vm_name: The name of the virtual machine. Required. - :type vm_name: str - :param parameters: Parameters supplied to the Migrate Virtual Machine operation. Default value - is None. - :type parameters: ~azure.mgmt.compute.models.MigrateVMToVirtualMachineScaleSetInput + :param availability_set_name: The name of the availability set. Required. + :type availability_set_name: str + :param parameters: Parameters supplied to the migrate operation on the availability set. + Default value is None. + :type parameters: ~azure.mgmt.compute.models.ConvertToVirtualMachineScaleSetInput :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -13792,24 +13032,25 @@ async def begin_migrate_to_vm_scale_set( """ @overload - async def begin_migrate_to_vm_scale_set( + async def begin_convert_to_virtual_machine_scale_set( # pylint: disable=name-too-long self, resource_group_name: str, - vm_name: str, + availability_set_name: str, parameters: Optional[JSON] = None, *, content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[None]: - """Migrate a virtual machine from availability set to Flexible Virtual Machine Scale Set. + """Create a new Flexible Virtual Machine Scale Set and migrate all the Virtual Machines in the + Availability Set. This does not trigger a downtime on the Virtual Machines. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param vm_name: The name of the virtual machine. Required. - :type vm_name: str - :param parameters: Parameters supplied to the Migrate Virtual Machine operation. Default value - is None. + :param availability_set_name: The name of the availability set. Required. + :type availability_set_name: str + :param parameters: Parameters supplied to the migrate operation on the availability set. + Default value is None. :type parameters: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". @@ -13820,24 +13061,25 @@ async def begin_migrate_to_vm_scale_set( """ @overload - async def begin_migrate_to_vm_scale_set( + async def begin_convert_to_virtual_machine_scale_set( # pylint: disable=name-too-long self, resource_group_name: str, - vm_name: str, + availability_set_name: str, parameters: Optional[IO[bytes]] = None, *, content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[None]: - """Migrate a virtual machine from availability set to Flexible Virtual Machine Scale Set. + """Create a new Flexible Virtual Machine Scale Set and migrate all the Virtual Machines in the + Availability Set. This does not trigger a downtime on the Virtual Machines. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param vm_name: The name of the virtual machine. Required. - :type vm_name: str - :param parameters: Parameters supplied to the Migrate Virtual Machine operation. Default value - is None. + :param availability_set_name: The name of the availability set. Required. + :type availability_set_name: str + :param parameters: Parameters supplied to the migrate operation on the availability set. + Default value is None. :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". @@ -13848,23 +13090,25 @@ async def begin_migrate_to_vm_scale_set( """ @distributed_trace_async - async def begin_migrate_to_vm_scale_set( + async def begin_convert_to_virtual_machine_scale_set( # pylint: disable=name-too-long self, resource_group_name: str, - vm_name: str, - parameters: Optional[Union[_models.MigrateVMToVirtualMachineScaleSetInput, JSON, IO[bytes]]] = None, + availability_set_name: str, + parameters: Optional[Union[_models.ConvertToVirtualMachineScaleSetInput, JSON, IO[bytes]]] = None, **kwargs: Any ) -> AsyncLROPoller[None]: - """Migrate a virtual machine from availability set to Flexible Virtual Machine Scale Set. + """Create a new Flexible Virtual Machine Scale Set and migrate all the Virtual Machines in the + Availability Set. This does not trigger a downtime on the Virtual Machines. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param vm_name: The name of the virtual machine. Required. - :type vm_name: str - :param parameters: Parameters supplied to the Migrate Virtual Machine operation. Is one of the - following types: MigrateVMToVirtualMachineScaleSetInput, JSON, IO[bytes] Default value is None. - :type parameters: ~azure.mgmt.compute.models.MigrateVMToVirtualMachineScaleSetInput or JSON or + :param availability_set_name: The name of the availability set. Required. + :type availability_set_name: str + :param parameters: Parameters supplied to the migrate operation on the availability set. Is one + of the following types: ConvertToVirtualMachineScaleSetInput, JSON, IO[bytes] Default value is + None. + :type parameters: ~azure.mgmt.compute.models.ConvertToVirtualMachineScaleSetInput or JSON or IO[bytes] :return: An instance of AsyncLROPoller that returns None :rtype: ~azure.core.polling.AsyncLROPoller[None] @@ -13880,9 +13124,9 @@ async def begin_migrate_to_vm_scale_set( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._migrate_to_vm_scale_set_initial( + raw_result = await self._convert_to_virtual_machine_scale_set_initial( resource_group_name=resource_group_name, - vm_name=vm_name, + availability_set_name=availability_set_name, parameters=parameters, content_type=content_type, cls=lambda x, y, z: x, @@ -13919,14 +13163,14 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore -class VirtualMachineExtensionsOperations: +class ProximityPlacementGroupsOperations: """ .. warning:: **DO NOT** instantiate this class directly. Instead, you should access the following operations through :class:`~azure.mgmt.compute.aio.ComputeClient`'s - :attr:`virtual_machine_extensions` attribute. + :attr:`proximity_placement_groups` attribute. """ def __init__(self, *args, **kwargs) -> None: @@ -13940,25 +13184,23 @@ def __init__(self, *args, **kwargs) -> None: async def get( self, resource_group_name: str, - vm_name: str, - vm_extension_name: str, + proximity_placement_group_name: str, *, - expand: Optional[str] = None, + include_colocation_status: Optional[str] = None, **kwargs: Any - ) -> _models.VirtualMachineExtension: - """The operation to get the extension. + ) -> _models.ProximityPlacementGroup: + """Retrieves information about a proximity placement group . :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param vm_name: The name of the virtual machine. Required. - :type vm_name: str - :param vm_extension_name: The name of the virtual machine extension. Required. - :type vm_extension_name: str - :keyword expand: The expand expression to apply on the operation. Default value is None. - :paramtype expand: str - :return: VirtualMachineExtension. The VirtualMachineExtension is compatible with MutableMapping - :rtype: ~azure.mgmt.compute.models.VirtualMachineExtension + :param proximity_placement_group_name: The name of the proximity placement group. Required. + :type proximity_placement_group_name: str + :keyword include_colocation_status: includeColocationStatus=true enables fetching the + colocation status of all the resources in the proximity placement group. Default value is None. + :paramtype include_colocation_status: str + :return: ProximityPlacementGroup. The ProximityPlacementGroup is compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.ProximityPlacementGroup :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -13972,14 +13214,13 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.VirtualMachineExtension] = kwargs.pop("cls", None) + cls: ClsType[_models.ProximityPlacementGroup] = kwargs.pop("cls", None) - _request = build_virtual_machine_extensions_get_request( + _request = build_proximity_placement_groups_get_request( resource_group_name=resource_group_name, - vm_name=vm_name, - vm_extension_name=vm_extension_name, + proximity_placement_group_name=proximity_placement_group_name, subscription_id=self._config.subscription_id, - expand=expand, + include_colocation_status=include_colocation_status, api_version=self._config.api_version, headers=_headers, params=_params, @@ -14009,21 +13250,119 @@ async def get( if _stream: deserialized = response.iter_bytes() else: - deserialized = _deserialize(_models.VirtualMachineExtension, response.json()) + deserialized = _deserialize(_models.ProximityPlacementGroup, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - async def _create_or_update_initial( + @overload + async def create_or_update( self, resource_group_name: str, - vm_name: str, - vm_extension_name: str, - extension_parameters: Union[_models.VirtualMachineExtension, JSON, IO[bytes]], + proximity_placement_group_name: str, + parameters: _models.ProximityPlacementGroup, + *, + content_type: str = "application/json", **kwargs: Any - ) -> AsyncIterator[bytes]: + ) -> _models.ProximityPlacementGroup: + """Create or update a proximity placement group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param proximity_placement_group_name: The name of the proximity placement group. Required. + :type proximity_placement_group_name: str + :param parameters: Parameters supplied to the Create Proximity Placement Group operation. + Required. + :type parameters: ~azure.mgmt.compute.models.ProximityPlacementGroup + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: ProximityPlacementGroup. The ProximityPlacementGroup is compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.ProximityPlacementGroup + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update( + self, + resource_group_name: str, + proximity_placement_group_name: str, + parameters: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ProximityPlacementGroup: + """Create or update a proximity placement group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param proximity_placement_group_name: The name of the proximity placement group. Required. + :type proximity_placement_group_name: str + :param parameters: Parameters supplied to the Create Proximity Placement Group operation. + Required. + :type parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: ProximityPlacementGroup. The ProximityPlacementGroup is compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.ProximityPlacementGroup + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update( + self, + resource_group_name: str, + proximity_placement_group_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ProximityPlacementGroup: + """Create or update a proximity placement group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param proximity_placement_group_name: The name of the proximity placement group. Required. + :type proximity_placement_group_name: str + :param parameters: Parameters supplied to the Create Proximity Placement Group operation. + Required. + :type parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: ProximityPlacementGroup. The ProximityPlacementGroup is compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.ProximityPlacementGroup + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create_or_update( + self, + resource_group_name: str, + proximity_placement_group_name: str, + parameters: Union[_models.ProximityPlacementGroup, JSON, IO[bytes]], + **kwargs: Any + ) -> _models.ProximityPlacementGroup: + """Create or update a proximity placement group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param proximity_placement_group_name: The name of the proximity placement group. Required. + :type proximity_placement_group_name: str + :param parameters: Parameters supplied to the Create Proximity Placement Group operation. Is + one of the following types: ProximityPlacementGroup, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.compute.models.ProximityPlacementGroup or JSON or IO[bytes] + :return: ProximityPlacementGroup. The ProximityPlacementGroup is compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.ProximityPlacementGroup + :raises ~azure.core.exceptions.HttpResponseError: + """ error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -14036,19 +13375,18 @@ async def _create_or_update_initial( _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + cls: ClsType[_models.ProximityPlacementGroup] = kwargs.pop("cls", None) content_type = content_type or "application/json" _content = None - if isinstance(extension_parameters, (IOBase, bytes)): - _content = extension_parameters + if isinstance(parameters, (IOBase, bytes)): + _content = parameters else: - _content = json.dumps(extension_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - _request = build_virtual_machine_extensions_create_or_update_request( + _request = build_proximity_placement_groups_create_or_update_request( resource_group_name=resource_group_name, - vm_name=vm_name, - vm_extension_name=vm_extension_name, + proximity_placement_group_name=proximity_placement_group_name, subscription_id=self._config.subscription_id, content_type=content_type, api_version=self._config.api_version, @@ -14061,7 +13399,7 @@ async def _create_or_update_initial( } _request.url = self._client.format_url(_request.url, **path_format_arguments) - _stream = True + _stream = kwargs.pop("stream", False) pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -14069,201 +13407,131 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = _failsafe_deserialize(_models.CloudError, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - response_headers = {} - if response.status_code == 201: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.iter_bytes() + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.ProximityPlacementGroup, response.json()) if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore @overload - async def begin_create_or_update( + async def update( self, resource_group_name: str, - vm_name: str, - vm_extension_name: str, - extension_parameters: _models.VirtualMachineExtension, + proximity_placement_group_name: str, + parameters: _models.ProximityPlacementGroupUpdate, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[None]: - """The operation to create or update the extension. + ) -> _models.ProximityPlacementGroup: + """Update a proximity placement group. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param vm_name: The name of the virtual machine. Required. - :type vm_name: str - :param vm_extension_name: The name of the virtual machine extension. Required. - :type vm_extension_name: str - :param extension_parameters: Parameters supplied to the Create Virtual Machine Extension - operation. Required. - :type extension_parameters: ~azure.mgmt.compute.models.VirtualMachineExtension + :param proximity_placement_group_name: The name of the proximity placement group. Required. + :type proximity_placement_group_name: str + :param parameters: Parameters supplied to the Update Proximity Placement Group operation. + Required. + :type parameters: ~azure.mgmt.compute.models.ProximityPlacementGroupUpdate :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns None - :rtype: ~azure.core.polling.AsyncLROPoller[None] + :return: ProximityPlacementGroup. The ProximityPlacementGroup is compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.ProximityPlacementGroup :raises ~azure.core.exceptions.HttpResponseError: """ @overload - async def begin_create_or_update( + async def update( self, resource_group_name: str, - vm_name: str, - vm_extension_name: str, - extension_parameters: JSON, + proximity_placement_group_name: str, + parameters: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[None]: - """The operation to create or update the extension. + ) -> _models.ProximityPlacementGroup: + """Update a proximity placement group. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param vm_name: The name of the virtual machine. Required. - :type vm_name: str - :param vm_extension_name: The name of the virtual machine extension. Required. - :type vm_extension_name: str - :param extension_parameters: Parameters supplied to the Create Virtual Machine Extension - operation. Required. - :type extension_parameters: JSON + :param proximity_placement_group_name: The name of the proximity placement group. Required. + :type proximity_placement_group_name: str + :param parameters: Parameters supplied to the Update Proximity Placement Group operation. + Required. + :type parameters: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns None - :rtype: ~azure.core.polling.AsyncLROPoller[None] + :return: ProximityPlacementGroup. The ProximityPlacementGroup is compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.ProximityPlacementGroup :raises ~azure.core.exceptions.HttpResponseError: """ @overload - async def begin_create_or_update( + async def update( self, resource_group_name: str, - vm_name: str, - vm_extension_name: str, - extension_parameters: IO[bytes], + proximity_placement_group_name: str, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[None]: - """The operation to create or update the extension. + ) -> _models.ProximityPlacementGroup: + """Update a proximity placement group. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param vm_name: The name of the virtual machine. Required. - :type vm_name: str - :param vm_extension_name: The name of the virtual machine extension. Required. - :type vm_extension_name: str - :param extension_parameters: Parameters supplied to the Create Virtual Machine Extension - operation. Required. - :type extension_parameters: IO[bytes] + :param proximity_placement_group_name: The name of the proximity placement group. Required. + :type proximity_placement_group_name: str + :param parameters: Parameters supplied to the Update Proximity Placement Group operation. + Required. + :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns None - :rtype: ~azure.core.polling.AsyncLROPoller[None] + :return: ProximityPlacementGroup. The ProximityPlacementGroup is compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.ProximityPlacementGroup :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace_async - async def begin_create_or_update( + async def update( self, resource_group_name: str, - vm_name: str, - vm_extension_name: str, - extension_parameters: Union[_models.VirtualMachineExtension, JSON, IO[bytes]], + proximity_placement_group_name: str, + parameters: Union[_models.ProximityPlacementGroupUpdate, JSON, IO[bytes]], **kwargs: Any - ) -> AsyncLROPoller[None]: - """The operation to create or update the extension. + ) -> _models.ProximityPlacementGroup: + """Update a proximity placement group. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param vm_name: The name of the virtual machine. Required. - :type vm_name: str - :param vm_extension_name: The name of the virtual machine extension. Required. - :type vm_extension_name: str - :param extension_parameters: Parameters supplied to the Create Virtual Machine Extension - operation. Is one of the following types: VirtualMachineExtension, JSON, IO[bytes] Required. - :type extension_parameters: ~azure.mgmt.compute.models.VirtualMachineExtension or JSON or - IO[bytes] - :return: An instance of AsyncLROPoller that returns None - :rtype: ~azure.core.polling.AsyncLROPoller[None] + :param proximity_placement_group_name: The name of the proximity placement group. Required. + :type proximity_placement_group_name: str + :param parameters: Parameters supplied to the Update Proximity Placement Group operation. Is + one of the following types: ProximityPlacementGroupUpdate, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.compute.models.ProximityPlacementGroupUpdate or JSON or IO[bytes] + :return: ProximityPlacementGroup. The ProximityPlacementGroup is compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.ProximityPlacementGroup :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} - - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._create_or_update_initial( - resource_group_name=resource_group_name, - vm_name=vm_name, - vm_extension_name=vm_extension_name, - extension_parameters=extension_parameters, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _update_initial( - self, - resource_group_name: str, - vm_name: str, - vm_extension_name: str, - extension_parameters: Union[_models.VirtualMachineExtensionUpdate, JSON, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -14276,19 +13544,18 @@ async def _update_initial( _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + cls: ClsType[_models.ProximityPlacementGroup] = kwargs.pop("cls", None) content_type = content_type or "application/json" _content = None - if isinstance(extension_parameters, (IOBase, bytes)): - _content = extension_parameters + if isinstance(parameters, (IOBase, bytes)): + _content = parameters else: - _content = json.dumps(extension_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - _request = build_virtual_machine_extensions_update_request( + _request = build_proximity_placement_groups_update_request( resource_group_name=resource_group_name, - vm_name=vm_name, - vm_extension_name=vm_extension_name, + proximity_placement_group_name=proximity_placement_group_name, subscription_id=self._config.subscription_id, content_type=content_type, api_version=self._config.api_version, @@ -14301,7 +13568,7 @@ async def _update_initial( } _request.url = self._client.format_url(_request.url, **path_format_arguments) - _stream = True + _stream = kwargs.pop("stream", False) pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -14309,196 +13576,38 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) error = _failsafe_deserialize(_models.CloudError, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - response_headers = {} - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.iter_bytes() + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.ProximityPlacementGroup, response.json()) if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - @overload - async def begin_update( - self, - resource_group_name: str, - vm_name: str, - vm_extension_name: str, - extension_parameters: _models.VirtualMachineExtensionUpdate, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[None]: - """The operation to update the extension. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_name: The name of the virtual machine. Required. - :type vm_name: str - :param vm_extension_name: The name of the virtual machine extension. Required. - :type vm_extension_name: str - :param extension_parameters: Parameters supplied to the Update Virtual Machine Extension - operation. Required. - :type extension_parameters: ~azure.mgmt.compute.models.VirtualMachineExtensionUpdate - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns None - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update( - self, - resource_group_name: str, - vm_name: str, - vm_extension_name: str, - extension_parameters: JSON, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[None]: - """The operation to update the extension. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_name: The name of the virtual machine. Required. - :type vm_name: str - :param vm_extension_name: The name of the virtual machine extension. Required. - :type vm_extension_name: str - :param extension_parameters: Parameters supplied to the Update Virtual Machine Extension - operation. Required. - :type extension_parameters: JSON - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns None - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update( - self, - resource_group_name: str, - vm_name: str, - vm_extension_name: str, - extension_parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[None]: - """The operation to update the extension. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_name: The name of the virtual machine. Required. - :type vm_name: str - :param vm_extension_name: The name of the virtual machine extension. Required. - :type vm_extension_name: str - :param extension_parameters: Parameters supplied to the Update Virtual Machine Extension - operation. Required. - :type extension_parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns None - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - @distributed_trace_async - async def begin_update( - self, - resource_group_name: str, - vm_name: str, - vm_extension_name: str, - extension_parameters: Union[_models.VirtualMachineExtensionUpdate, JSON, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[None]: - """The operation to update the extension. + async def delete(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. The name is case insensitive. Required. :type resource_group_name: str - :param vm_name: The name of the virtual machine. Required. - :type vm_name: str - :param vm_extension_name: The name of the virtual machine extension. Required. - :type vm_extension_name: str - :param extension_parameters: Parameters supplied to the Update Virtual Machine Extension - operation. Is one of the following types: VirtualMachineExtensionUpdate, JSON, IO[bytes] - Required. - :type extension_parameters: ~azure.mgmt.compute.models.VirtualMachineExtensionUpdate or JSON or - IO[bytes] - :return: An instance of AsyncLROPoller that returns None - :rtype: ~azure.core.polling.AsyncLROPoller[None] + :param proximity_placement_group_name: The name of the proximity placement group. Required. + :type proximity_placement_group_name: str + :return: None + :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} - - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._update_initial( - resource_group_name=resource_group_name, - vm_name=vm_name, - vm_extension_name=vm_extension_name, - extension_parameters=extension_parameters, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _delete_initial( - self, resource_group_name: str, vm_name: str, vm_extension_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -14510,12 +13619,11 @@ async def _delete_initial( _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + cls: ClsType[None] = kwargs.pop("cls", None) - _request = build_virtual_machine_extensions_delete_request( + _request = build_proximity_placement_groups_delete_request( resource_group_name=resource_group_name, - vm_name=vm_name, - vm_extension_name=vm_extension_name, + proximity_placement_group_name=proximity_placement_group_name, subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -14526,118 +13634,125 @@ async def _delete_initial( } _request.url = self._client.format_url(_request.url, **path_format_arguments) - _stream = True + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200, 202, 204]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass + if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) error = _failsafe_deserialize(_models.CloudError, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.iter_bytes() - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore + return cls(pipeline_response, None, {}) # type: ignore - @distributed_trace_async - async def begin_delete( - self, resource_group_name: str, vm_name: str, vm_extension_name: str, **kwargs: Any - ) -> AsyncLROPoller[None]: - """The operation to delete the extension. + @distributed_trace + def list_by_resource_group( + self, resource_group_name: str, **kwargs: Any + ) -> AsyncItemPaged["_models.ProximityPlacementGroup"]: + """Lists all proximity placement groups in a resource group. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param vm_name: The name of the virtual machine. Required. - :type vm_name: str - :param vm_extension_name: The name of the virtual machine extension. Required. - :type vm_extension_name: str - :return: An instance of AsyncLROPoller that returns None - :rtype: ~azure.core.polling.AsyncLROPoller[None] + :return: An iterator like instance of ProximityPlacementGroup + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.models.ProximityPlacementGroup] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._delete_initial( - resource_group_name=resource_group_name, - vm_name=vm_name, - vm_extension_name=vm_extension_name, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) + cls: ClsType[List[_models.ProximityPlacementGroup]] = kwargs.pop("cls", None) - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_proximity_placement_groups_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.ProximityPlacementGroup], deserialized.get("value", [])) if cls: - return cls(pipeline_response, None, {}) # type: ignore + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } + async def get_next(next_link=None): + _request = prepare_request(next_link) - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) @distributed_trace - def list( - self, resource_group_name: str, vm_name: str, *, expand: Optional[str] = None, **kwargs: Any - ) -> AsyncItemPaged["_models.VirtualMachineExtension"]: - """The operation to get all extensions of a Virtual Machine. + def list_by_subscription(self, **kwargs: Any) -> AsyncItemPaged["_models.ProximityPlacementGroup"]: + """Lists all proximity placement groups in a subscription. - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_name: The name of the virtual machine. Required. - :type vm_name: str - :keyword expand: The expand expression to apply on the operation. Default value is None. - :paramtype expand: str - :return: An iterator like instance of VirtualMachineExtension + :return: An iterator like instance of ProximityPlacementGroup :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.models.VirtualMachineExtension] + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.models.ProximityPlacementGroup] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.VirtualMachineExtension]] = kwargs.pop("cls", None) + cls: ClsType[List[_models.ProximityPlacementGroup]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -14650,11 +13765,8 @@ def list( def prepare_request(next_link=None): if not next_link: - _request = build_virtual_machine_extensions_list_request( - resource_group_name=resource_group_name, - vm_name=vm_name, + _request = build_proximity_placement_groups_list_by_subscription_request( subscription_id=self._config.subscription_id, - expand=expand, api_version=self._config.api_version, headers=_headers, params=_params, @@ -14690,10 +13802,10 @@ def prepare_request(next_link=None): async def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.VirtualMachineExtension], deserialized.get("value", [])) + list_of_elem = _deserialize(List[_models.ProximityPlacementGroup], deserialized.get("value", [])) if cls: list_of_elem = cls(list_of_elem) # type: ignore - return None, AsyncList(list_of_elem) + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) async def get_next(next_link=None): _request = prepare_request(next_link) @@ -14714,14 +13826,14 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) -class VirtualMachineExtensionImagesOperations: +class DedicatedHostGroupsOperations: """ .. warning:: **DO NOT** instantiate this class directly. Instead, you should access the following operations through :class:`~azure.mgmt.compute.aio.ComputeClient`'s - :attr:`virtual_machine_extension_images` attribute. + :attr:`dedicated_host_groups` attribute. """ def __init__(self, *args, **kwargs) -> None: @@ -14733,21 +13845,27 @@ def __init__(self, *args, **kwargs) -> None: @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. + 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 location: The location name. Required. - :type location: str - :param publisher_name: Required. - :type publisher_name: str - :param type: Required. - :type type: str - :param version: Required. - :type version: str - :return: VirtualMachineExtensionImage. The VirtualMachineExtensionImage is compatible with - MutableMapping - :rtype: ~azure.mgmt.compute.models.VirtualMachineExtensionImage + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param host_group_name: The name of the dedicated host group. Required. + :type host_group_name: str + :keyword 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. Known values are: "instanceView", "userData", and + "resiliencyView". Default value is None. + :paramtype expand: str or ~azure.mgmt.compute.models.InstanceViewTypes + :return: DedicatedHostGroup. The DedicatedHostGroup is compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.DedicatedHostGroup :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -14761,14 +13879,13 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.VirtualMachineExtensionImage] = kwargs.pop("cls", None) + cls: ClsType[_models.DedicatedHostGroup] = kwargs.pop("cls", None) - _request = build_virtual_machine_extension_images_get_request( - location=location, - publisher_name=publisher_name, - type=type, - version=version, + _request = build_dedicated_host_groups_get_request( + resource_group_name=resource_group_name, + host_group_name=host_group_name, subscription_id=self._config.subscription_id, + expand=expand, api_version=self._config.api_version, headers=_headers, params=_params, @@ -14798,302 +13915,70 @@ async def get( if _stream: deserialized = response.iter_bytes() else: - deserialized = _deserialize(_models.VirtualMachineExtensionImage, response.json()) + deserialized = _deserialize(_models.DedicatedHostGroup, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # 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. + @overload + async def create_or_update( + self, + resource_group_name: str, + host_group_name: str, + parameters: _models.DedicatedHostGroup, + *, + content_type: str = "application/json", + **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 location: The location name. Required. - :type location: str - :param publisher_name: Required. - :type publisher_name: str - :return: list of VirtualMachineExtensionImage - :rtype: list[~azure.mgmt.compute.models.VirtualMachineExtensionImage] + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param host_group_name: The name of the dedicated host group. Required. + :type host_group_name: str + :param parameters: Parameters supplied to the Create Dedicated Host Group. Required. + :type parameters: ~azure.mgmt.compute.models.DedicatedHostGroup + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: DedicatedHostGroup. The DedicatedHostGroup is compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.DedicatedHostGroup :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[List[_models.VirtualMachineExtensionImage]] = kwargs.pop("cls", None) - - _request = build_virtual_machine_extension_images_list_types_request( - location=location, - publisher_name=publisher_name, - subscription_id=self._config.subscription_id, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = kwargs.pop("stream", False) - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - if _stream: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.CloudError, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if _stream: - deserialized = response.iter_bytes() - else: - deserialized = _deserialize(List[_models.VirtualMachineExtensionImage], response.json()) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - @distributed_trace_async - async def list_versions( + @overload + async def create_or_update( self, - location: str, - publisher_name: str, - type: str, + resource_group_name: str, + host_group_name: str, + parameters: JSON, *, - filter: Optional[str] = None, - top: Optional[int] = None, - orderby: Optional[str] = None, + content_type: str = "application/json", **kwargs: Any - ) -> List[_models.VirtualMachineExtensionImage]: - """Gets a list of virtual machine extension image versions. - - :param location: The location name. Required. - :type location: str - :param publisher_name: Required. - :type publisher_name: str - :param type: Required. - :type type: str - :keyword filter: The filter to apply on the operation. Default value is None. - :paramtype filter: str - :keyword top: Default value is None. - :paramtype top: int - :keyword orderby: Default value is None. - :paramtype orderby: str - :return: list of VirtualMachineExtensionImage - :rtype: list[~azure.mgmt.compute.models.VirtualMachineExtensionImage] - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[List[_models.VirtualMachineExtensionImage]] = kwargs.pop("cls", None) - - _request = build_virtual_machine_extension_images_list_versions_request( - location=location, - publisher_name=publisher_name, - type=type, - subscription_id=self._config.subscription_id, - filter=filter, - top=top, - orderby=orderby, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = kwargs.pop("stream", False) - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - if _stream: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.CloudError, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if _stream: - deserialized = response.iter_bytes() - else: - deserialized = _deserialize(List[_models.VirtualMachineExtensionImage], response.json()) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - -class AvailabilitySetsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.compute.aio.ComputeClient`'s - :attr:`availability_sets` attribute. - """ - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ComputeClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @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. The name is case insensitive. - Required. - :type resource_group_name: str - :param availability_set_name: The name of the availability set. Required. - :type availability_set_name: str - :return: AvailabilitySet. The AvailabilitySet is compatible with MutableMapping - :rtype: ~azure.mgmt.compute.models.AvailabilitySet - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[_models.AvailabilitySet] = kwargs.pop("cls", None) - - _request = build_availability_sets_get_request( - resource_group_name=resource_group_name, - availability_set_name=availability_set_name, - subscription_id=self._config.subscription_id, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = kwargs.pop("stream", False) - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - if _stream: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.CloudError, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if _stream: - deserialized = response.iter_bytes() - else: - deserialized = _deserialize(_models.AvailabilitySet, response.json()) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def create_or_update( - self, - resource_group_name: str, - availability_set_name: str, - parameters: _models.AvailabilitySet, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.AvailabilitySet: - """Create or update an availability set. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param availability_set_name: The name of the availability set. Required. - :type availability_set_name: str - :param parameters: Parameters supplied to the Create Availability Set operation. Required. - :type parameters: ~azure.mgmt.compute.models.AvailabilitySet - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: AvailabilitySet. The AvailabilitySet is compatible with MutableMapping - :rtype: ~azure.mgmt.compute.models.AvailabilitySet - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def create_or_update( - self, - resource_group_name: str, - availability_set_name: str, - parameters: JSON, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.AvailabilitySet: - """Create or update an availability set. + ) -> _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. The name is case insensitive. Required. :type resource_group_name: str - :param availability_set_name: The name of the availability set. Required. - :type availability_set_name: str - :param parameters: Parameters supplied to the Create Availability Set operation. Required. + :param host_group_name: The name of the dedicated host group. Required. + :type host_group_name: str + :param parameters: Parameters supplied to the Create Dedicated Host Group. Required. :type parameters: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: AvailabilitySet. The AvailabilitySet is compatible with MutableMapping - :rtype: ~azure.mgmt.compute.models.AvailabilitySet + :return: DedicatedHostGroup. The DedicatedHostGroup is compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.DedicatedHostGroup :raises ~azure.core.exceptions.HttpResponseError: """ @@ -15101,26 +13986,29 @@ async def create_or_update( async def create_or_update( self, resource_group_name: str, - availability_set_name: str, + host_group_name: str, parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> _models.AvailabilitySet: - """Create or update an availability set. + ) -> _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. The name is case insensitive. Required. :type resource_group_name: str - :param availability_set_name: The name of the availability set. Required. - :type availability_set_name: str - :param parameters: Parameters supplied to the Create Availability Set operation. Required. + :param host_group_name: The name of the dedicated host group. Required. + :type host_group_name: str + :param parameters: Parameters supplied to the Create Dedicated Host Group. Required. :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: AvailabilitySet. The AvailabilitySet is compatible with MutableMapping - :rtype: ~azure.mgmt.compute.models.AvailabilitySet + :return: DedicatedHostGroup. The DedicatedHostGroup is compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.DedicatedHostGroup :raises ~azure.core.exceptions.HttpResponseError: """ @@ -15128,22 +14016,25 @@ async def create_or_update( async def create_or_update( self, resource_group_name: str, - availability_set_name: str, - parameters: Union[_models.AvailabilitySet, JSON, IO[bytes]], + host_group_name: str, + parameters: Union[_models.DedicatedHostGroup, JSON, IO[bytes]], **kwargs: Any - ) -> _models.AvailabilitySet: - """Create or update an availability set. + ) -> _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. The name is case insensitive. Required. :type resource_group_name: str - :param availability_set_name: The name of the availability set. Required. - :type availability_set_name: str - :param parameters: Parameters supplied to the Create Availability Set operation. Is one of the - following types: AvailabilitySet, JSON, IO[bytes] Required. - :type parameters: ~azure.mgmt.compute.models.AvailabilitySet or JSON or IO[bytes] - :return: AvailabilitySet. The AvailabilitySet is compatible with MutableMapping - :rtype: ~azure.mgmt.compute.models.AvailabilitySet + :param host_group_name: The name of the dedicated host group. Required. + :type host_group_name: str + :param parameters: Parameters supplied to the Create Dedicated Host Group. Is one of the + following types: DedicatedHostGroup, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.compute.models.DedicatedHostGroup or JSON or IO[bytes] + :return: DedicatedHostGroup. The DedicatedHostGroup is compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.DedicatedHostGroup :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -15158,7 +14049,7 @@ async def create_or_update( _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AvailabilitySet] = kwargs.pop("cls", None) + cls: ClsType[_models.DedicatedHostGroup] = kwargs.pop("cls", None) content_type = content_type or "application/json" _content = None @@ -15167,9 +14058,9 @@ async def create_or_update( else: _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - _request = build_availability_sets_create_or_update_request( + _request = build_dedicated_host_groups_create_or_update_request( resource_group_name=resource_group_name, - availability_set_name=availability_set_name, + host_group_name=host_group_name, subscription_id=self._config.subscription_id, content_type=content_type, api_version=self._config.api_version, @@ -15189,7 +14080,7 @@ async def create_or_update( response = pipeline_response.http_response - if response.status_code not in [200]: + if response.status_code not in [200, 201]: if _stream: try: await response.read() # Load the body in memory and close the socket @@ -15202,7 +14093,7 @@ async def create_or_update( if _stream: deserialized = response.iter_bytes() else: - deserialized = _deserialize(_models.AvailabilitySet, response.json()) + deserialized = _deserialize(_models.DedicatedHostGroup, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -15213,26 +14104,26 @@ async def create_or_update( async def update( self, resource_group_name: str, - availability_set_name: str, - parameters: _models.AvailabilitySetUpdate, + host_group_name: str, + parameters: _models.DedicatedHostGroupUpdate, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.AvailabilitySet: - """Update an availability set. + ) -> _models.DedicatedHostGroup: + """Update an dedicated host group. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param availability_set_name: The name of the availability set. Required. - :type availability_set_name: str - :param parameters: Parameters supplied to the Update Availability Set operation. Required. - :type parameters: ~azure.mgmt.compute.models.AvailabilitySetUpdate + :param host_group_name: The name of the dedicated host group. Required. + :type host_group_name: str + :param parameters: Parameters supplied to the Update Dedicated Host Group operation. Required. + :type parameters: ~azure.mgmt.compute.models.DedicatedHostGroupUpdate :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: AvailabilitySet. The AvailabilitySet is compatible with MutableMapping - :rtype: ~azure.mgmt.compute.models.AvailabilitySet + :return: DedicatedHostGroup. The DedicatedHostGroup is compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.DedicatedHostGroup :raises ~azure.core.exceptions.HttpResponseError: """ @@ -15240,26 +14131,26 @@ async def update( async def update( self, resource_group_name: str, - availability_set_name: str, + host_group_name: str, parameters: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.AvailabilitySet: - """Update an availability set. + ) -> _models.DedicatedHostGroup: + """Update an dedicated host group. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param availability_set_name: The name of the availability set. Required. - :type availability_set_name: str - :param parameters: Parameters supplied to the Update Availability Set operation. Required. + :param host_group_name: The name of the dedicated host group. Required. + :type host_group_name: str + :param parameters: Parameters supplied to the Update Dedicated Host Group operation. Required. :type parameters: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: AvailabilitySet. The AvailabilitySet is compatible with MutableMapping - :rtype: ~azure.mgmt.compute.models.AvailabilitySet + :return: DedicatedHostGroup. The DedicatedHostGroup is compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.DedicatedHostGroup :raises ~azure.core.exceptions.HttpResponseError: """ @@ -15267,26 +14158,26 @@ async def update( async def update( self, resource_group_name: str, - availability_set_name: str, + host_group_name: str, parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> _models.AvailabilitySet: - """Update an availability set. + ) -> _models.DedicatedHostGroup: + """Update an dedicated host group. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param availability_set_name: The name of the availability set. Required. - :type availability_set_name: str - :param parameters: Parameters supplied to the Update Availability Set operation. Required. + :param host_group_name: The name of the dedicated host group. Required. + :type host_group_name: str + :param parameters: Parameters supplied to the Update Dedicated Host Group operation. Required. :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: AvailabilitySet. The AvailabilitySet is compatible with MutableMapping - :rtype: ~azure.mgmt.compute.models.AvailabilitySet + :return: DedicatedHostGroup. The DedicatedHostGroup is compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.DedicatedHostGroup :raises ~azure.core.exceptions.HttpResponseError: """ @@ -15294,22 +14185,22 @@ async def update( async def update( self, resource_group_name: str, - availability_set_name: str, - parameters: Union[_models.AvailabilitySetUpdate, JSON, IO[bytes]], + host_group_name: str, + parameters: Union[_models.DedicatedHostGroupUpdate, JSON, IO[bytes]], **kwargs: Any - ) -> _models.AvailabilitySet: - """Update an availability set. + ) -> _models.DedicatedHostGroup: + """Update an dedicated host group. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param availability_set_name: The name of the availability set. Required. - :type availability_set_name: str - :param parameters: Parameters supplied to the Update Availability Set operation. Is one of the - following types: AvailabilitySetUpdate, JSON, IO[bytes] Required. - :type parameters: ~azure.mgmt.compute.models.AvailabilitySetUpdate or JSON or IO[bytes] - :return: AvailabilitySet. The AvailabilitySet is compatible with MutableMapping - :rtype: ~azure.mgmt.compute.models.AvailabilitySet + :param host_group_name: The name of the dedicated host group. Required. + :type host_group_name: str + :param parameters: Parameters supplied to the Update Dedicated Host Group operation. Is one of + the following types: DedicatedHostGroupUpdate, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.compute.models.DedicatedHostGroupUpdate or JSON or IO[bytes] + :return: DedicatedHostGroup. The DedicatedHostGroup is compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.DedicatedHostGroup :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -15324,7 +14215,7 @@ async def update( _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AvailabilitySet] = kwargs.pop("cls", None) + cls: ClsType[_models.DedicatedHostGroup] = kwargs.pop("cls", None) content_type = content_type or "application/json" _content = None @@ -15333,9 +14224,9 @@ async def update( else: _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - _request = build_availability_sets_update_request( + _request = build_dedicated_host_groups_update_request( resource_group_name=resource_group_name, - availability_set_name=availability_set_name, + host_group_name=host_group_name, subscription_id=self._config.subscription_id, content_type=content_type, api_version=self._config.api_version, @@ -15368,7 +14259,7 @@ async def update( if _stream: deserialized = response.iter_bytes() else: - deserialized = _deserialize(_models.AvailabilitySet, response.json()) + deserialized = _deserialize(_models.DedicatedHostGroup, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -15376,14 +14267,14 @@ async def update( return deserialized # type: ignore @distributed_trace_async - async def delete(self, resource_group_name: str, availability_set_name: str, **kwargs: Any) -> None: - """Delete an availability set. + async def delete(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. The name is case insensitive. Required. :type resource_group_name: str - :param availability_set_name: The name of the availability set. Required. - :type availability_set_name: str + :param host_group_name: The name of the dedicated host group. Required. + :type host_group_name: str :return: None :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -15401,9 +14292,9 @@ async def delete(self, resource_group_name: str, availability_set_name: str, **k cls: ClsType[None] = kwargs.pop("cls", None) - _request = build_availability_sets_delete_request( + _request = build_dedicated_host_groups_delete_request( resource_group_name=resource_group_name, - availability_set_name=availability_set_name, + host_group_name=host_group_name, subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -15430,20 +14321,23 @@ async def delete(self, resource_group_name: str, availability_set_name: str, **k return cls(pipeline_response, None, {}) # type: ignore @distributed_trace - def list(self, resource_group_name: str, **kwargs: Any) -> AsyncItemPaged["_models.AvailabilitySet"]: - """Lists all availability sets in a resource group. + def list_by_resource_group( + self, resource_group_name: str, **kwargs: Any + ) -> AsyncItemPaged["_models.DedicatedHostGroup"]: + """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. The name is case insensitive. Required. :type resource_group_name: str - :return: An iterator like instance of AvailabilitySet - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.models.AvailabilitySet] + :return: An iterator like instance of DedicatedHostGroup + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.models.DedicatedHostGroup] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.AvailabilitySet]] = kwargs.pop("cls", None) + cls: ClsType[List[_models.DedicatedHostGroup]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -15456,7 +14350,7 @@ def list(self, resource_group_name: str, **kwargs: Any) -> AsyncItemPaged["_mode def prepare_request(next_link=None): if not next_link: - _request = build_availability_sets_list_request( + _request = build_dedicated_host_groups_list_by_resource_group_request( resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, api_version=self._config.api_version, @@ -15494,7 +14388,7 @@ def prepare_request(next_link=None): async def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.AvailabilitySet], deserialized.get("value", [])) + list_of_elem = _deserialize(List[_models.DedicatedHostGroup], deserialized.get("value", [])) if cls: list_of_elem = cls(list_of_elem) # type: ignore return deserialized.get("nextLink") or None, AsyncList(list_of_elem) @@ -15518,22 +14412,18 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) @distributed_trace - def list_by_subscription( - self, *, expand: Optional[str] = None, **kwargs: Any - ) -> AsyncItemPaged["_models.AvailabilitySet"]: - """Lists all availability sets in a subscription. + def list_by_subscription(self, **kwargs: Any) -> AsyncItemPaged["_models.DedicatedHostGroup"]: + """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 expand: The expand expression to apply to the operation. Allowed values are - 'instanceView'. Default value is None. - :paramtype expand: str - :return: An iterator like instance of AvailabilitySet - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.models.AvailabilitySet] + :return: An iterator like instance of DedicatedHostGroup + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.models.DedicatedHostGroup] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.AvailabilitySet]] = kwargs.pop("cls", None) + cls: ClsType[List[_models.DedicatedHostGroup]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -15546,9 +14436,8 @@ def list_by_subscription( def prepare_request(next_link=None): if not next_link: - _request = build_availability_sets_list_by_subscription_request( + _request = build_dedicated_host_groups_list_by_subscription_request( subscription_id=self._config.subscription_id, - expand=expand, api_version=self._config.api_version, headers=_headers, params=_params, @@ -15584,7 +14473,7 @@ def prepare_request(next_link=None): async def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.AvailabilitySet], deserialized.get("value", [])) + list_of_elem = _deserialize(List[_models.DedicatedHostGroup], deserialized.get("value", [])) if cls: list_of_elem = cls(list_of_elem) # type: ignore return deserialized.get("nextLink") or None, AsyncList(list_of_elem) @@ -15607,27 +14496,115 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - @distributed_trace - def list_available_sizes( - self, resource_group_name: str, availability_set_name: str, **kwargs: Any - ) -> AsyncItemPaged["_models.VirtualMachineSize"]: - """Lists all available virtual machine sizes that can be used to create a new virtual machine in - an existing availability set. + +class DedicatedHostsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.compute.aio.ComputeClient`'s + :attr:`dedicated_hosts` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @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. The name is case insensitive. Required. :type resource_group_name: str - :param availability_set_name: The name of the availability set. Required. - :type availability_set_name: str - :return: An iterator like instance of VirtualMachineSize - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.models.VirtualMachineSize] + :param host_group_name: The name of the dedicated host group. Required. + :type host_group_name: str + :param host_name: The name of the dedicated host. Required. + :type host_name: str + :keyword 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. Known values are: "instanceView", "userData", and "resiliencyView". Default value is + None. + :paramtype expand: str or ~azure.mgmt.compute.models.InstanceViewTypes + :return: DedicatedHost. The DedicatedHost is compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.DedicatedHost :raises ~azure.core.exceptions.HttpResponseError: """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.VirtualMachineSize]] = kwargs.pop("cls", None) + cls: ClsType[_models.DedicatedHost] = kwargs.pop("cls", None) + + _request = build_dedicated_hosts_get_request( + resource_group_name=resource_group_name, + host_group_name=host_group_name, + host_name=host_name, + subscription_id=self._config.subscription_id, + expand=expand, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.DedicatedHost, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _create_or_update_initial( + self, + resource_group_name: str, + host_group_name: str, + host_name: str, + parameters: Union[_models.DedicatedHost, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -15636,186 +14613,243 @@ def list_available_sizes( } error_map.update(kwargs.pop("error_map", {}) or {}) - def prepare_request(next_link=None): - if not next_link: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} - _request = build_availability_sets_list_available_sizes_request( - resource_group_name=resource_group_name, - availability_set_name=availability_set_name, - subscription_id=self._config.subscription_id, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) + content_type = content_type or "application/json" + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - return _request + _request = build_dedicated_hosts_create_or_update_request( + resource_group_name=resource_group_name, + host_group_name=host_group_name, + host_name=host_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) - async def extract_data(pipeline_response): - deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.VirtualMachineSize], deserialized.get("value", [])) - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) - async def get_next(next_link=None): - _request = prepare_request(next_link) + response = pipeline_response.http_response - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response + if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.CloudError, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 201: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - return pipeline_response + deserialized = response.iter_bytes() - return AsyncItemPaged(get_next, extract_data) + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore @overload - async def start_migration_to_virtual_machine_scale_set( # pylint: disable=name-too-long + async def begin_create_or_update( self, resource_group_name: str, - availability_set_name: str, - parameters: _models.MigrateToVirtualMachineScaleSetInput, + host_group_name: str, + host_name: str, + parameters: _models.DedicatedHost, *, content_type: str = "application/json", **kwargs: Any - ) -> None: - """Start migration operation on an Availability Set to move its Virtual Machines to a Virtual - Machine Scale Set. This should be followed by a migrate operation on each Virtual Machine that - triggers a downtime on the Virtual Machine. + ) -> AsyncLROPoller[_models.DedicatedHost]: + """Create or update a dedicated host . :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param availability_set_name: The name of the availability set. Required. - :type availability_set_name: str - :param parameters: Parameters supplied to the migrate operation on the availability set. - Required. - :type parameters: ~azure.mgmt.compute.models.MigrateToVirtualMachineScaleSetInput + :param host_group_name: The name of the dedicated host group. Required. + :type host_group_name: str + :param host_name: The name of the dedicated host. Required. + :type host_name: str + :param parameters: Parameters supplied to the Create Dedicated Host. Required. + :type parameters: ~azure.mgmt.compute.models.DedicatedHost :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: None - :rtype: None + :return: An instance of AsyncLROPoller that returns DedicatedHost. The DedicatedHost is + compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.DedicatedHost] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - async def start_migration_to_virtual_machine_scale_set( # pylint: disable=name-too-long + async def begin_create_or_update( self, resource_group_name: str, - availability_set_name: str, + host_group_name: str, + host_name: str, parameters: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> None: - """Start migration operation on an Availability Set to move its Virtual Machines to a Virtual - Machine Scale Set. This should be followed by a migrate operation on each Virtual Machine that - triggers a downtime on the Virtual Machine. + ) -> AsyncLROPoller[_models.DedicatedHost]: + """Create or update a dedicated host . :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param availability_set_name: The name of the availability set. Required. - :type availability_set_name: str - :param parameters: Parameters supplied to the migrate operation on the availability set. - Required. + :param host_group_name: The name of the dedicated host group. Required. + :type host_group_name: str + :param host_name: The name of the dedicated host. Required. + :type host_name: str + :param parameters: Parameters supplied to the Create Dedicated Host. Required. :type parameters: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: None - :rtype: None + :return: An instance of AsyncLROPoller that returns DedicatedHost. The DedicatedHost is + compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.DedicatedHost] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - async def start_migration_to_virtual_machine_scale_set( # pylint: disable=name-too-long + async def begin_create_or_update( self, resource_group_name: str, - availability_set_name: str, + host_group_name: str, + host_name: str, parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> None: - """Start migration operation on an Availability Set to move its Virtual Machines to a Virtual - Machine Scale Set. This should be followed by a migrate operation on each Virtual Machine that - triggers a downtime on the Virtual Machine. + ) -> AsyncLROPoller[_models.DedicatedHost]: + """Create or update a dedicated host . :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param availability_set_name: The name of the availability set. Required. - :type availability_set_name: str - :param parameters: Parameters supplied to the migrate operation on the availability set. - Required. + :param host_group_name: The name of the dedicated host group. Required. + :type host_group_name: str + :param host_name: The name of the dedicated host. Required. + :type host_name: str + :param parameters: Parameters supplied to the Create Dedicated Host. Required. :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: None - :rtype: None + :return: An instance of AsyncLROPoller that returns DedicatedHost. The DedicatedHost is + compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.DedicatedHost] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace_async - async def start_migration_to_virtual_machine_scale_set( # pylint: disable=name-too-long + async def begin_create_or_update( self, resource_group_name: str, - availability_set_name: str, - parameters: Union[_models.MigrateToVirtualMachineScaleSetInput, JSON, IO[bytes]], + host_group_name: str, + host_name: str, + parameters: Union[_models.DedicatedHost, JSON, IO[bytes]], **kwargs: Any - ) -> None: - """Start migration operation on an Availability Set to move its Virtual Machines to a Virtual - Machine Scale Set. This should be followed by a migrate operation on each Virtual Machine that - triggers a downtime on the Virtual Machine. + ) -> AsyncLROPoller[_models.DedicatedHost]: + """Create or update a dedicated host . :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param availability_set_name: The name of the availability set. Required. - :type availability_set_name: str - :param parameters: Parameters supplied to the migrate operation on the availability set. Is one - of the following types: MigrateToVirtualMachineScaleSetInput, JSON, IO[bytes] Required. - :type parameters: ~azure.mgmt.compute.models.MigrateToVirtualMachineScaleSetInput or JSON or - IO[bytes] - :return: None - :rtype: None + :param host_group_name: The name of the dedicated host group. Required. + :type host_group_name: str + :param host_name: The name of the dedicated host. Required. + :type host_name: str + :param parameters: Parameters supplied to the Create Dedicated Host. Is one of the following + types: DedicatedHost, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.compute.models.DedicatedHost or JSON or IO[bytes] + :return: An instance of AsyncLROPoller that returns DedicatedHost. The DedicatedHost is + compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.DedicatedHost] :raises ~azure.core.exceptions.HttpResponseError: """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.DedicatedHost] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._create_or_update_initial( + resource_group_name=resource_group_name, + host_group_name=host_group_name, + host_name=host_name, + parameters=parameters, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.DedicatedHost, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.DedicatedHost].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.DedicatedHost]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _update_initial( + self, + resource_group_name: str, + host_group_name: str, + host_name: str, + parameters: Union[_models.DedicatedHostUpdate, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -15828,7 +14862,7 @@ async def start_migration_to_virtual_machine_scale_set( # pylint: disable=name- _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _content = None @@ -15837,9 +14871,10 @@ async def start_migration_to_virtual_machine_scale_set( # pylint: disable=name- else: _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - _request = build_availability_sets_start_migration_to_virtual_machine_scale_set_request( + _request = build_dedicated_hosts_update_request( resource_group_name=resource_group_name, - availability_set_name=availability_set_name, + host_group_name=host_group_name, + host_name=host_name, subscription_id=self._config.subscription_id, content_type=content_type, api_version=self._config.api_version, @@ -15852,188 +14887,212 @@ async def start_migration_to_virtual_machine_scale_set( # pylint: disable=name- } _request.url = self._client.format_url(_request.url, **path_format_arguments) - _stream = False + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [204]: + if response.status_code not in [200]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = _failsafe_deserialize(_models.CloudError, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @distributed_trace_async - async def cancel_migration_to_virtual_machine_scale_set( # pylint: disable=name-too-long - self, resource_group_name: str, availability_set_name: str, **kwargs: Any - ) -> None: - """Cancel the migration operation on an Availability Set. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param availability_set_name: The name of the availability set. Required. - :type availability_set_name: str - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_availability_sets_cancel_migration_to_virtual_machine_scale_set_request( - resource_group_name=resource_group_name, - availability_set_name=availability_set_name, - subscription_id=self._config.subscription_id, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.CloudError, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.iter_bytes() if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore @overload - async def validate_migration_to_virtual_machine_scale_set( # pylint: disable=name-too-long + async def begin_update( self, resource_group_name: str, - availability_set_name: str, - parameters: _models.MigrateToVirtualMachineScaleSetInput, + host_group_name: str, + host_name: str, + parameters: _models.DedicatedHostUpdate, *, content_type: str = "application/json", **kwargs: Any - ) -> None: - """Validates that the Virtual Machines in the Availability Set can be migrated to the provided - Virtual Machine Scale Set. + ) -> AsyncLROPoller[_models.DedicatedHost]: + """Update a dedicated host . :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param availability_set_name: The name of the availability set. Required. - :type availability_set_name: str - :param parameters: Parameters supplied to the migrate operation on the availability set. - Required. - :type parameters: ~azure.mgmt.compute.models.MigrateToVirtualMachineScaleSetInput + :param host_group_name: The name of the dedicated host group. Required. + :type host_group_name: str + :param host_name: The name of the dedicated host. Required. + :type host_name: str + :param parameters: Parameters supplied to the Update Dedicated Host operation. Required. + :type parameters: ~azure.mgmt.compute.models.DedicatedHostUpdate :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: None - :rtype: None + :return: An instance of AsyncLROPoller that returns DedicatedHost. The DedicatedHost is + compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.DedicatedHost] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - async def validate_migration_to_virtual_machine_scale_set( # pylint: disable=name-too-long + async def begin_update( self, resource_group_name: str, - availability_set_name: str, + host_group_name: str, + host_name: str, parameters: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> None: - """Validates that the Virtual Machines in the Availability Set can be migrated to the provided - Virtual Machine Scale Set. + ) -> AsyncLROPoller[_models.DedicatedHost]: + """Update a dedicated host . :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param availability_set_name: The name of the availability set. Required. - :type availability_set_name: str - :param parameters: Parameters supplied to the migrate operation on the availability set. - Required. + :param host_group_name: The name of the dedicated host group. Required. + :type host_group_name: str + :param host_name: The name of the dedicated host. Required. + :type host_name: str + :param parameters: Parameters supplied to the Update Dedicated Host operation. Required. :type parameters: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: None - :rtype: None + :return: An instance of AsyncLROPoller that returns DedicatedHost. The DedicatedHost is + compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.DedicatedHost] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - async def validate_migration_to_virtual_machine_scale_set( # pylint: disable=name-too-long + async def begin_update( self, resource_group_name: str, - availability_set_name: str, + host_group_name: str, + host_name: str, parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> None: - """Validates that the Virtual Machines in the Availability Set can be migrated to the provided - Virtual Machine Scale Set. + ) -> AsyncLROPoller[_models.DedicatedHost]: + """Update a dedicated host . :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param availability_set_name: The name of the availability set. Required. - :type availability_set_name: str - :param parameters: Parameters supplied to the migrate operation on the availability set. - Required. + :param host_group_name: The name of the dedicated host group. Required. + :type host_group_name: str + :param host_name: The name of the dedicated host. Required. + :type host_name: str + :param parameters: Parameters supplied to the Update Dedicated Host operation. Required. :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: None - :rtype: None + :return: An instance of AsyncLROPoller that returns DedicatedHost. The DedicatedHost is + compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.DedicatedHost] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace_async - async def validate_migration_to_virtual_machine_scale_set( # pylint: disable=name-too-long + async def begin_update( self, resource_group_name: str, - availability_set_name: str, - parameters: Union[_models.MigrateToVirtualMachineScaleSetInput, JSON, IO[bytes]], + host_group_name: str, + host_name: str, + parameters: Union[_models.DedicatedHostUpdate, JSON, IO[bytes]], **kwargs: Any - ) -> None: - """Validates that the Virtual Machines in the Availability Set can be migrated to the provided - Virtual Machine Scale Set. + ) -> AsyncLROPoller[_models.DedicatedHost]: + """Update a dedicated host . :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param availability_set_name: The name of the availability set. Required. - :type availability_set_name: str - :param parameters: Parameters supplied to the migrate operation on the availability set. Is one - of the following types: MigrateToVirtualMachineScaleSetInput, JSON, IO[bytes] Required. - :type parameters: ~azure.mgmt.compute.models.MigrateToVirtualMachineScaleSetInput or JSON or - IO[bytes] - :return: None - :rtype: None + :param host_group_name: The name of the dedicated host group. Required. + :type host_group_name: str + :param host_name: The name of the dedicated host. Required. + :type host_name: str + :param parameters: Parameters supplied to the Update Dedicated Host operation. Is one of the + following types: DedicatedHostUpdate, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.compute.models.DedicatedHostUpdate or JSON or IO[bytes] + :return: An instance of AsyncLROPoller that returns DedicatedHost. The DedicatedHost is + compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.DedicatedHost] :raises ~azure.core.exceptions.HttpResponseError: """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.DedicatedHost] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._update_initial( + resource_group_name=resource_group_name, + host_group_name=host_group_name, + host_name=host_name, + parameters=parameters, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = _deserialize(_models.DedicatedHost, response.json()) + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.DedicatedHost].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.DedicatedHost]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _delete_initial( + self, resource_group_name: str, host_group_name: str, host_name: str, **kwargs: Any + ) -> AsyncIterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -16042,26 +15101,17 @@ async def validate_migration_to_virtual_machine_scale_set( # pylint: disable=na } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - _request = build_availability_sets_validate_migration_to_virtual_machine_scale_set_request( + _request = build_dedicated_hosts_delete_request( resource_group_name=resource_group_name, - availability_set_name=availability_set_name, + host_group_name=host_group_name, + host_name=host_name, subscription_id=self._config.subscription_id, - content_type=content_type, api_version=self._config.api_version, - content=_content, headers=_headers, params=_params, ) @@ -16070,28 +15120,117 @@ async def validate_migration_to_virtual_machine_scale_set( # pylint: disable=na } _request.url = self._client.format_url(_request.url, **path_format_arguments) - _stream = False + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [204]: + if response.status_code not in [200, 202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = _failsafe_deserialize(_models.CloudError, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if cls: - return cls(pipeline_response, None, {}) # type: ignore + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_delete( + 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. The name is case insensitive. + Required. + :type resource_group_name: str + :param host_group_name: The name of the dedicated host group. Required. + :type host_group_name: str + :param host_name: The name of the dedicated host. Required. + :type host_name: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + host_group_name=host_group_name, + host_name=host_name, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace + def list_by_host_group( + self, resource_group_name: str, host_group_name: str, **kwargs: Any + ) -> AsyncItemPaged["_models.DedicatedHost"]: + """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. The name is case insensitive. + Required. + :type resource_group_name: str + :param host_group_name: The name of the dedicated host group. Required. + :type host_group_name: str + :return: An iterator like instance of DedicatedHost + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.models.DedicatedHost] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.DedicatedHost]] = kwargs.pop("cls", None) - async def _convert_to_virtual_machine_scale_set_initial( # pylint: disable=name-too-long - self, - resource_group_name: str, - availability_set_name: str, - parameters: Optional[Union[_models.ConvertToVirtualMachineScaleSetInput, JSON, IO[bytes]]] = None, - **kwargs: Any - ) -> AsyncIterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -16100,30 +15239,191 @@ async def _convert_to_virtual_machine_scale_set_initial( # pylint: disable=name } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + def prepare_request(next_link=None): + if not next_link: + + _request = build_dedicated_hosts_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=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.DedicatedHost], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + @distributed_trace + def list_available_sizes( + self, resource_group_name: str, host_group_name: str, host_name: str, **kwargs: Any + ) -> AsyncItemPaged[str]: + """Lists all available dedicated host sizes to which the specified dedicated host can be resized. + NOTE: The dedicated host sizes provided can be used to only scale up the existing dedicated + host. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param host_group_name: The name of the dedicated host group. Required. + :type host_group_name: str + :param host_name: The name of the dedicated host. Required. + :type host_name: str + :return: An iterator like instance of str + :rtype: ~azure.core.async_paging.AsyncItemPaged[str] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - content_type = content_type if parameters else None - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + cls: ClsType[List[str]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_dedicated_hosts_list_available_sizes_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=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) - content_type = content_type or "application/json" if parameters else None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - if parameters is not None: - _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore else: - _content = None + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) - _request = build_availability_sets_convert_to_virtual_machine_scale_set_request( + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[str], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + async def _redeploy_initial( + self, resource_group_name: str, host_group_name: str, host_name: str, **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_dedicated_hosts_redeploy_request( resource_group_name=resource_group_name, - availability_set_name=availability_set_name, + host_group_name=host_group_name, + host_name=host_name, subscription_id=self._config.subscription_id, - content_type=content_type, api_version=self._config.api_version, - content=_content, headers=_headers, params=_params, ) @@ -16159,133 +15459,39 @@ async def _convert_to_virtual_machine_scale_set_initial( # pylint: disable=name return deserialized # type: ignore - @overload - async def begin_convert_to_virtual_machine_scale_set( # pylint: disable=name-too-long - self, - resource_group_name: str, - availability_set_name: str, - parameters: Optional[_models.ConvertToVirtualMachineScaleSetInput] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Create a new Flexible Virtual Machine Scale Set and migrate all the Virtual Machines in the - Availability Set. This does not trigger a downtime on the Virtual Machines. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param availability_set_name: The name of the availability set. Required. - :type availability_set_name: str - :param parameters: Parameters supplied to the migrate operation on the availability set. - Default value is None. - :type parameters: ~azure.mgmt.compute.models.ConvertToVirtualMachineScaleSetInput - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns None - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_convert_to_virtual_machine_scale_set( # pylint: disable=name-too-long - self, - resource_group_name: str, - availability_set_name: str, - parameters: Optional[JSON] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Create a new Flexible Virtual Machine Scale Set and migrate all the Virtual Machines in the - Availability Set. This does not trigger a downtime on the Virtual Machines. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param availability_set_name: The name of the availability set. Required. - :type availability_set_name: str - :param parameters: Parameters supplied to the migrate operation on the availability set. - Default value is None. - :type parameters: JSON - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns None - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_convert_to_virtual_machine_scale_set( # pylint: disable=name-too-long - self, - resource_group_name: str, - availability_set_name: str, - parameters: Optional[IO[bytes]] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Create a new Flexible Virtual Machine Scale Set and migrate all the Virtual Machines in the - Availability Set. This does not trigger a downtime on the Virtual Machines. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param availability_set_name: The name of the availability set. Required. - :type availability_set_name: str - :param parameters: Parameters supplied to the migrate operation on the availability set. - Default value is None. - :type parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns None - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - @distributed_trace_async - async def begin_convert_to_virtual_machine_scale_set( # pylint: disable=name-too-long - self, - resource_group_name: str, - availability_set_name: str, - parameters: Optional[Union[_models.ConvertToVirtualMachineScaleSetInput, JSON, IO[bytes]]] = None, - **kwargs: Any + async def begin_redeploy( + self, resource_group_name: str, host_group_name: str, host_name: str, **kwargs: Any ) -> AsyncLROPoller[None]: - """Create a new Flexible Virtual Machine Scale Set and migrate all the Virtual Machines in the - Availability Set. This does not trigger a downtime on the Virtual Machines. + """Redeploy the dedicated host. The operation will complete successfully once the dedicated host + has migrated to a new node and is running. To determine the health of VMs deployed on the + dedicated host after the redeploy check the Resource Health Center in the Azure Portal. Please + refer to `https://docs.microsoft.com/azure/service-health/resource-health-overview + `_ for more details. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param availability_set_name: The name of the availability set. Required. - :type availability_set_name: str - :param parameters: Parameters supplied to the migrate operation on the availability set. Is one - of the following types: ConvertToVirtualMachineScaleSetInput, JSON, IO[bytes] Default value is - None. - :type parameters: ~azure.mgmt.compute.models.ConvertToVirtualMachineScaleSetInput or JSON or - IO[bytes] + :param host_group_name: The name of the dedicated host group. Required. + :type host_group_name: str + :param host_name: The name of the dedicated host. Required. + :type host_name: str :return: An instance of AsyncLROPoller that returns None :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - content_type = content_type if parameters else None cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._convert_to_virtual_machine_scale_set_initial( + raw_result = await self._redeploy_initial( resource_group_name=resource_group_name, - availability_set_name=availability_set_name, - parameters=parameters, - content_type=content_type, + host_group_name=host_group_name, + host_name=host_name, cls=lambda x, y, z: x, headers=_headers, params=_params, @@ -16319,47 +15525,9 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - -class ProximityPlacementGroupsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.compute.aio.ComputeClient`'s - :attr:`proximity_placement_groups` attribute. - """ - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ComputeClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @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. The name is case insensitive. - Required. - :type resource_group_name: str - :param proximity_placement_group_name: The name of the proximity placement group. Required. - :type proximity_placement_group_name: str - :keyword include_colocation_status: includeColocationStatus=true enables fetching the - colocation status of all the resources in the proximity placement group. Default value is None. - :paramtype include_colocation_status: str - :return: ProximityPlacementGroup. The ProximityPlacementGroup is compatible with MutableMapping - :rtype: ~azure.mgmt.compute.models.ProximityPlacementGroup - :raises ~azure.core.exceptions.HttpResponseError: - """ + async def _restart_initial( + self, resource_group_name: str, host_group_name: str, host_name: str, **kwargs: Any + ) -> AsyncIterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -16371,13 +15539,13 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.ProximityPlacementGroup] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - _request = build_proximity_placement_groups_get_request( + _request = build_dedicated_hosts_restart_request( resource_group_name=resource_group_name, - proximity_placement_group_name=proximity_placement_group_name, + host_group_name=host_group_name, + host_name=host_name, subscription_id=self._config.subscription_id, - include_colocation_status=include_colocation_status, api_version=self._config.api_version, headers=_headers, params=_params, @@ -16387,7 +15555,7 @@ async def get( } _request.url = self._client.format_url(_request.url, **path_format_arguments) - _stream = kwargs.pop("stream", False) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -16395,131 +15563,187 @@ async def get( response = pipeline_response.http_response if response.status_code not in [200]: - if _stream: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = _failsafe_deserialize(_models.CloudError, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if _stream: - deserialized = response.iter_bytes() - else: - deserialized = _deserialize(_models.ProximityPlacementGroup, response.json()) + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore - @overload - async def create_or_update( - self, - resource_group_name: str, - proximity_placement_group_name: str, - parameters: _models.ProximityPlacementGroup, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.ProximityPlacementGroup: - """Create or update a proximity placement group. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param proximity_placement_group_name: The name of the proximity placement group. Required. - :type proximity_placement_group_name: str - :param parameters: Parameters supplied to the Create Proximity Placement Group operation. - Required. - :type parameters: ~azure.mgmt.compute.models.ProximityPlacementGroup - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: ProximityPlacementGroup. The ProximityPlacementGroup is compatible with MutableMapping - :rtype: ~azure.mgmt.compute.models.ProximityPlacementGroup - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def create_or_update( - self, - resource_group_name: str, - proximity_placement_group_name: str, - parameters: JSON, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.ProximityPlacementGroup: - """Create or update a proximity placement group. + @distributed_trace_async + async def begin_restart( + 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/azure/service-health/resource-health-overview + `_ for more details. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param proximity_placement_group_name: The name of the proximity placement group. Required. - :type proximity_placement_group_name: str - :param parameters: Parameters supplied to the Create Proximity Placement Group operation. - Required. - :type parameters: JSON - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: ProximityPlacementGroup. The ProximityPlacementGroup is compatible with MutableMapping - :rtype: ~azure.mgmt.compute.models.ProximityPlacementGroup + :param host_group_name: The name of the dedicated host group. Required. + :type host_group_name: str + :param host_name: The name of the dedicated host. Required. + :type host_name: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} - @overload - async def create_or_update( - self, - resource_group_name: str, - proximity_placement_group_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.ProximityPlacementGroup: - """Create or update a proximity placement group. + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._restart_initial( + resource_group_name=resource_group_name, + host_group_name=host_group_name, + host_name=host_name, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + +class ImagesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.compute.aio.ComputeClient`'s + :attr:`images` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @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. The name is case insensitive. Required. :type resource_group_name: str - :param proximity_placement_group_name: The name of the proximity placement group. Required. - :type proximity_placement_group_name: str - :param parameters: Parameters supplied to the Create Proximity Placement Group operation. - Required. - :type parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: ProximityPlacementGroup. The ProximityPlacementGroup is compatible with MutableMapping - :rtype: ~azure.mgmt.compute.models.ProximityPlacementGroup + :param image_name: The name of the image. Required. + :type image_name: str + :keyword expand: The expand expression to apply on the operation. Default value is None. + :paramtype expand: str + :return: Image. The Image is compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.Image :raises ~azure.core.exceptions.HttpResponseError: """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) - @distributed_trace_async - async def create_or_update( + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.Image] = kwargs.pop("cls", None) + + _request = build_images_get_request( + resource_group_name=resource_group_name, + image_name=image_name, + subscription_id=self._config.subscription_id, + expand=expand, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.Image, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _create_or_update_initial( self, resource_group_name: str, - proximity_placement_group_name: str, - parameters: Union[_models.ProximityPlacementGroup, JSON, IO[bytes]], + image_name: str, + parameters: Union[_models.Image, JSON, IO[bytes]], **kwargs: Any - ) -> _models.ProximityPlacementGroup: - """Create or update a proximity placement group. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param proximity_placement_group_name: The name of the proximity placement group. Required. - :type proximity_placement_group_name: str - :param parameters: Parameters supplied to the Create Proximity Placement Group operation. Is - one of the following types: ProximityPlacementGroup, JSON, IO[bytes] Required. - :type parameters: ~azure.mgmt.compute.models.ProximityPlacementGroup or JSON or IO[bytes] - :return: ProximityPlacementGroup. The ProximityPlacementGroup is compatible with MutableMapping - :rtype: ~azure.mgmt.compute.models.ProximityPlacementGroup - :raises ~azure.core.exceptions.HttpResponseError: - """ + ) -> AsyncIterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -16532,7 +15756,7 @@ async def create_or_update( _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ProximityPlacementGroup] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _content = None @@ -16541,9 +15765,9 @@ async def create_or_update( else: _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - _request = build_proximity_placement_groups_create_or_update_request( + _request = build_images_create_or_update_request( resource_group_name=resource_group_name, - proximity_placement_group_name=proximity_placement_group_name, + image_name=image_name, subscription_id=self._config.subscription_id, content_type=content_type, api_version=self._config.api_version, @@ -16556,7 +15780,7 @@ async def create_or_update( } _request.url = self._client.format_url(_request.url, **path_format_arguments) - _stream = kwargs.pop("stream", False) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -16564,131 +15788,192 @@ async def create_or_update( response = pipeline_response.http_response if response.status_code not in [200, 201]: - if _stream: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = _failsafe_deserialize(_models.CloudError, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if _stream: - deserialized = response.iter_bytes() - else: - deserialized = _deserialize(_models.ProximityPlacementGroup, response.json()) + response_headers = {} + if response.status_code == 201: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore @overload - async def update( + async def begin_create_or_update( self, resource_group_name: str, - proximity_placement_group_name: str, - parameters: _models.ProximityPlacementGroupUpdate, + image_name: str, + parameters: _models.Image, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.ProximityPlacementGroup: - """Update a proximity placement group. + ) -> AsyncLROPoller[_models.Image]: + """Create or update an image. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param proximity_placement_group_name: The name of the proximity placement group. Required. - :type proximity_placement_group_name: str - :param parameters: Parameters supplied to the Update Proximity Placement Group operation. - Required. - :type parameters: ~azure.mgmt.compute.models.ProximityPlacementGroupUpdate + :param image_name: The name of the image. Required. + :type image_name: str + :param parameters: Parameters supplied to the Create Image operation. Required. + :type parameters: ~azure.mgmt.compute.models.Image :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: ProximityPlacementGroup. The ProximityPlacementGroup is compatible with MutableMapping - :rtype: ~azure.mgmt.compute.models.ProximityPlacementGroup + :return: An instance of AsyncLROPoller that returns Image. The Image is compatible with + MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.Image] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - async def update( + async def begin_create_or_update( self, resource_group_name: str, - proximity_placement_group_name: str, + image_name: str, parameters: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.ProximityPlacementGroup: - """Update a proximity placement group. + ) -> AsyncLROPoller[_models.Image]: + """Create or update an image. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param proximity_placement_group_name: The name of the proximity placement group. Required. - :type proximity_placement_group_name: str - :param parameters: Parameters supplied to the Update Proximity Placement Group operation. - Required. + :param image_name: The name of the image. Required. + :type image_name: str + :param parameters: Parameters supplied to the Create Image operation. Required. :type parameters: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: ProximityPlacementGroup. The ProximityPlacementGroup is compatible with MutableMapping - :rtype: ~azure.mgmt.compute.models.ProximityPlacementGroup + :return: An instance of AsyncLROPoller that returns Image. The Image is compatible with + MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.Image] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - async def update( + async def begin_create_or_update( self, resource_group_name: str, - proximity_placement_group_name: str, + image_name: str, parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> _models.ProximityPlacementGroup: - """Update a proximity placement group. + ) -> AsyncLROPoller[_models.Image]: + """Create or update an image. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param proximity_placement_group_name: The name of the proximity placement group. Required. - :type proximity_placement_group_name: str - :param parameters: Parameters supplied to the Update Proximity Placement Group operation. - Required. + :param image_name: The name of the image. Required. + :type image_name: str + :param parameters: Parameters supplied to the Create Image operation. Required. :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: ProximityPlacementGroup. The ProximityPlacementGroup is compatible with MutableMapping - :rtype: ~azure.mgmt.compute.models.ProximityPlacementGroup + :return: An instance of AsyncLROPoller that returns Image. The Image is compatible with + MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.Image] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace_async - async def update( + async def begin_create_or_update( self, resource_group_name: str, - proximity_placement_group_name: str, - parameters: Union[_models.ProximityPlacementGroupUpdate, JSON, IO[bytes]], + image_name: str, + parameters: Union[_models.Image, JSON, IO[bytes]], **kwargs: Any - ) -> _models.ProximityPlacementGroup: - """Update a proximity placement group. + ) -> AsyncLROPoller[_models.Image]: + """Create or update an image. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param proximity_placement_group_name: The name of the proximity placement group. Required. - :type proximity_placement_group_name: str - :param parameters: Parameters supplied to the Update Proximity Placement Group operation. Is - one of the following types: ProximityPlacementGroupUpdate, JSON, IO[bytes] Required. - :type parameters: ~azure.mgmt.compute.models.ProximityPlacementGroupUpdate or JSON or IO[bytes] - :return: ProximityPlacementGroup. The ProximityPlacementGroup is compatible with MutableMapping - :rtype: ~azure.mgmt.compute.models.ProximityPlacementGroup + :param image_name: The name of the image. Required. + :type image_name: str + :param parameters: Parameters supplied to the Create Image operation. Is one of the following + types: Image, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.compute.models.Image or JSON or IO[bytes] + :return: An instance of AsyncLROPoller that returns Image. The Image is compatible with + MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.Image] :raises ~azure.core.exceptions.HttpResponseError: """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Image] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._create_or_update_initial( + resource_group_name=resource_group_name, + image_name=image_name, + parameters=parameters, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.Image, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.Image].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.Image]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _update_initial( + self, + resource_group_name: str, + image_name: str, + parameters: Union[_models.ImageUpdate, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -16701,7 +15986,7 @@ async def update( _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ProximityPlacementGroup] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _content = None @@ -16710,9 +15995,9 @@ async def update( else: _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - _request = build_proximity_placement_groups_update_request( + _request = build_images_update_request( resource_group_name=resource_group_name, - proximity_placement_group_name=proximity_placement_group_name, + image_name=image_name, subscription_id=self._config.subscription_id, content_type=content_type, api_version=self._config.api_version, @@ -16725,118 +16010,334 @@ async def update( } _request.url = self._client.format_url(_request.url, **path_format_arguments) - _stream = kwargs.pop("stream", False) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200]: - if _stream: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass + if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = _failsafe_deserialize(_models.CloudError, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if _stream: - deserialized = response.iter_bytes() - else: - deserialized = _deserialize(_models.ProximityPlacementGroup, response.json()) + response_headers = {} + if response.status_code == 201: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore - @distributed_trace_async - async def delete(self, resource_group_name: str, proximity_placement_group_name: str, **kwargs: Any) -> None: - """Delete a proximity placement group. + @overload + async def begin_update( + self, + resource_group_name: str, + image_name: str, + parameters: _models.ImageUpdate, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.Image]: + """Update an image. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param proximity_placement_group_name: The name of the proximity placement group. Required. - :type proximity_placement_group_name: str - :return: None - :rtype: None + :param image_name: The name of the image. Required. + :type image_name: str + :param parameters: Parameters supplied to the Update Image operation. Required. + :type parameters: ~azure.mgmt.compute.models.ImageUpdate + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns Image. The Image is compatible with + MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.Image] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_proximity_placement_groups_delete_request( - resource_group_name=resource_group_name, - proximity_placement_group_name=proximity_placement_group_name, - subscription_id=self._config.subscription_id, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.CloudError, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @distributed_trace - def list_by_resource_group( - self, resource_group_name: str, **kwargs: Any - ) -> AsyncItemPaged["_models.ProximityPlacementGroup"]: - """Lists all proximity placement groups in a resource group. + @overload + async def begin_update( + self, + resource_group_name: str, + image_name: str, + parameters: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.Image]: + """Update an image. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :return: An iterator like instance of ProximityPlacementGroup - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.models.ProximityPlacementGroup] + :param image_name: The name of the image. Required. + :type image_name: str + :param parameters: Parameters supplied to the Update Image operation. Required. + :type parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns Image. The Image is compatible with + MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.Image] :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[List[_models.ProximityPlacementGroup]] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) + + @overload + async def begin_update( + self, + resource_group_name: str, + image_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.Image]: + """Update an image. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param image_name: The name of the image. Required. + :type image_name: str + :param parameters: Parameters supplied to the Update Image operation. Required. + :type parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns Image. The Image is compatible with + MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.Image] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_update( + self, + resource_group_name: str, + image_name: str, + parameters: Union[_models.ImageUpdate, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.Image]: + """Update an image. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param image_name: The name of the image. Required. + :type image_name: str + :param parameters: Parameters supplied to the Update Image operation. Is one of the following + types: ImageUpdate, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.compute.models.ImageUpdate or JSON or IO[bytes] + :return: An instance of AsyncLROPoller that returns Image. The Image is compatible with + MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.Image] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Image] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._update_initial( + resource_group_name=resource_group_name, + image_name=image_name, + parameters=parameters, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.Image, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.Image].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.Image]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _delete_initial(self, resource_group_name: str, image_name: str, **kwargs: Any) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_images_delete_request( + resource_group_name=resource_group_name, + image_name=image_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_delete(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. The name is case insensitive. + Required. + :type resource_group_name: str + :param image_name: The name of the image. Required. + :type image_name: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + image_name=image_name, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace + def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> AsyncItemPaged["_models.Image"]: + """Gets the list of images under a resource group. Use nextLink property in the response to get + the next page of Images. Do this till nextLink is null to fetch all the Images. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :return: An iterator like instance of Image + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.models.Image] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.Image]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): if not next_link: - _request = build_proximity_placement_groups_list_by_resource_group_request( + _request = build_images_list_by_resource_group_request( resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, api_version=self._config.api_version, @@ -16874,7 +16375,7 @@ def prepare_request(next_link=None): async def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.ProximityPlacementGroup], deserialized.get("value", [])) + list_of_elem = _deserialize(List[_models.Image], deserialized.get("value", [])) if cls: list_of_elem = cls(list_of_elem) # type: ignore return deserialized.get("nextLink") or None, AsyncList(list_of_elem) @@ -16898,18 +16399,18 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) @distributed_trace - def list_by_subscription(self, **kwargs: Any) -> AsyncItemPaged["_models.ProximityPlacementGroup"]: - """Lists all proximity placement groups in a subscription. + def list(self, **kwargs: Any) -> AsyncItemPaged["_models.Image"]: + """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. - :return: An iterator like instance of ProximityPlacementGroup - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.models.ProximityPlacementGroup] + :return: An iterator like instance of Image + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.models.Image] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.ProximityPlacementGroup]] = kwargs.pop("cls", None) + cls: ClsType[List[_models.Image]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -16922,7 +16423,7 @@ def list_by_subscription(self, **kwargs: Any) -> AsyncItemPaged["_models.Proximi def prepare_request(next_link=None): if not next_link: - _request = build_proximity_placement_groups_list_by_subscription_request( + _request = build_images_list_request( subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -16959,7 +16460,7 @@ def prepare_request(next_link=None): async def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.ProximityPlacementGroup], deserialized.get("value", [])) + list_of_elem = _deserialize(List[_models.Image], deserialized.get("value", [])) if cls: list_of_elem = cls(list_of_elem) # type: ignore return deserialized.get("nextLink") or None, AsyncList(list_of_elem) @@ -16983,14 +16484,14 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) -class DedicatedHostGroupsOperations: +class RestorePointCollectionsOperations: """ .. warning:: **DO NOT** instantiate this class directly. Instead, you should access the following operations through :class:`~azure.mgmt.compute.aio.ComputeClient`'s - :attr:`dedicated_host_groups` attribute. + :attr:`restore_point_collections` attribute. """ def __init__(self, *args, **kwargs) -> None: @@ -17004,25 +16505,24 @@ def __init__(self, *args, **kwargs) -> None: async def get( self, resource_group_name: str, - host_group_name: str, + restore_point_collection_name: str, *, - expand: Optional[Union[str, _models.InstanceViewTypes]] = None, + expand: Optional[Union[str, _models.RestorePointCollectionExpandOptions]] = None, **kwargs: Any - ) -> _models.DedicatedHostGroup: - """Retrieves information about a dedicated host group. + ) -> _models.RestorePointCollection: + """The operation to get the restore point collection. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param host_group_name: The name of the dedicated host group. Required. - :type host_group_name: str - :keyword 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. Known values are: "instanceView", "userData", and - "resiliencyView". Default value is None. - :paramtype expand: str or ~azure.mgmt.compute.models.InstanceViewTypes - :return: DedicatedHostGroup. The DedicatedHostGroup is compatible with MutableMapping - :rtype: ~azure.mgmt.compute.models.DedicatedHostGroup + :param restore_point_collection_name: The name of the restore point collection. Required. + :type restore_point_collection_name: str + :keyword expand: The expand expression to apply on the operation. If expand=restorePoints, + server will return all contained restore points in the restorePointCollection. "restorePoints" + Default value is None. + :paramtype expand: str or ~azure.mgmt.compute.models.RestorePointCollectionExpandOptions + :return: RestorePointCollection. The RestorePointCollection is compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.RestorePointCollection :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -17036,11 +16536,11 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.DedicatedHostGroup] = kwargs.pop("cls", None) + cls: ClsType[_models.RestorePointCollection] = kwargs.pop("cls", None) - _request = build_dedicated_host_groups_get_request( + _request = build_restore_point_collections_get_request( resource_group_name=resource_group_name, - host_group_name=host_group_name, + restore_point_collection_name=restore_point_collection_name, subscription_id=self._config.subscription_id, expand=expand, api_version=self._config.api_version, @@ -17072,7 +16572,7 @@ async def get( if _stream: deserialized = response.iter_bytes() else: - deserialized = _deserialize(_models.DedicatedHostGroup, response.json()) + deserialized = _deserialize(_models.RestorePointCollection, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -17083,29 +16583,29 @@ async def get( async def create_or_update( self, resource_group_name: str, - host_group_name: str, - parameters: _models.DedicatedHostGroup, + restore_point_collection_name: str, + parameters: _models.RestorePointCollection, *, content_type: str = "application/json", **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 - `_). + ) -> _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. The name is case insensitive. Required. :type resource_group_name: str - :param host_group_name: The name of the dedicated host group. Required. - :type host_group_name: str - :param parameters: Parameters supplied to the Create Dedicated Host Group. Required. - :type parameters: ~azure.mgmt.compute.models.DedicatedHostGroup + :param restore_point_collection_name: The name of the restore point collection. Required. + :type restore_point_collection_name: str + :param parameters: Parameters supplied to the Create or Update restore point collection + operation. Required. + :type parameters: ~azure.mgmt.compute.models.RestorePointCollection :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: DedicatedHostGroup. The DedicatedHostGroup is compatible with MutableMapping - :rtype: ~azure.mgmt.compute.models.DedicatedHostGroup + :return: RestorePointCollection. The RestorePointCollection is compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.RestorePointCollection :raises ~azure.core.exceptions.HttpResponseError: """ @@ -17113,29 +16613,29 @@ async def create_or_update( async def create_or_update( self, resource_group_name: str, - host_group_name: str, + restore_point_collection_name: str, parameters: JSON, *, content_type: str = "application/json", **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 - `_). + ) -> _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. The name is case insensitive. Required. :type resource_group_name: str - :param host_group_name: The name of the dedicated host group. Required. - :type host_group_name: str - :param parameters: Parameters supplied to the Create Dedicated Host Group. Required. + :param restore_point_collection_name: The name of the restore point collection. Required. + :type restore_point_collection_name: str + :param parameters: Parameters supplied to the Create or Update restore point collection + operation. Required. :type parameters: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: DedicatedHostGroup. The DedicatedHostGroup is compatible with MutableMapping - :rtype: ~azure.mgmt.compute.models.DedicatedHostGroup + :return: RestorePointCollection. The RestorePointCollection is compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.RestorePointCollection :raises ~azure.core.exceptions.HttpResponseError: """ @@ -17143,29 +16643,29 @@ async def create_or_update( async def create_or_update( self, resource_group_name: str, - host_group_name: str, + restore_point_collection_name: str, parameters: IO[bytes], *, content_type: str = "application/json", **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 - `_). + ) -> _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. The name is case insensitive. Required. :type resource_group_name: str - :param host_group_name: The name of the dedicated host group. Required. - :type host_group_name: str - :param parameters: Parameters supplied to the Create Dedicated Host Group. Required. + :param restore_point_collection_name: The name of the restore point collection. Required. + :type restore_point_collection_name: str + :param parameters: Parameters supplied to the Create or Update restore point collection + operation. Required. :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: DedicatedHostGroup. The DedicatedHostGroup is compatible with MutableMapping - :rtype: ~azure.mgmt.compute.models.DedicatedHostGroup + :return: RestorePointCollection. The RestorePointCollection is compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.RestorePointCollection :raises ~azure.core.exceptions.HttpResponseError: """ @@ -17173,25 +16673,24 @@ async def create_or_update( async def create_or_update( self, resource_group_name: str, - host_group_name: str, - parameters: Union[_models.DedicatedHostGroup, JSON, IO[bytes]], + restore_point_collection_name: str, + parameters: Union[_models.RestorePointCollection, JSON, IO[bytes]], **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 - `_). + ) -> _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. The name is case insensitive. Required. :type resource_group_name: str - :param host_group_name: The name of the dedicated host group. Required. - :type host_group_name: str - :param parameters: Parameters supplied to the Create Dedicated Host Group. Is one of the - following types: DedicatedHostGroup, JSON, IO[bytes] Required. - :type parameters: ~azure.mgmt.compute.models.DedicatedHostGroup or JSON or IO[bytes] - :return: DedicatedHostGroup. The DedicatedHostGroup is compatible with MutableMapping - :rtype: ~azure.mgmt.compute.models.DedicatedHostGroup + :param restore_point_collection_name: The name of the restore point collection. Required. + :type restore_point_collection_name: str + :param parameters: Parameters supplied to the Create or Update restore point collection + operation. Is one of the following types: RestorePointCollection, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.compute.models.RestorePointCollection or JSON or IO[bytes] + :return: RestorePointCollection. The RestorePointCollection is compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.RestorePointCollection :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -17206,7 +16705,7 @@ async def create_or_update( _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.DedicatedHostGroup] = kwargs.pop("cls", None) + cls: ClsType[_models.RestorePointCollection] = kwargs.pop("cls", None) content_type = content_type or "application/json" _content = None @@ -17215,9 +16714,9 @@ async def create_or_update( else: _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - _request = build_dedicated_host_groups_create_or_update_request( + _request = build_restore_point_collections_create_or_update_request( resource_group_name=resource_group_name, - host_group_name=host_group_name, + restore_point_collection_name=restore_point_collection_name, subscription_id=self._config.subscription_id, content_type=content_type, api_version=self._config.api_version, @@ -17250,7 +16749,7 @@ async def create_or_update( if _stream: deserialized = response.iter_bytes() else: - deserialized = _deserialize(_models.DedicatedHostGroup, response.json()) + deserialized = _deserialize(_models.RestorePointCollection, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -17261,26 +16760,27 @@ async def create_or_update( async def update( self, resource_group_name: str, - host_group_name: str, - parameters: _models.DedicatedHostGroupUpdate, + restore_point_collection_name: str, + parameters: _models.RestorePointCollectionUpdate, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.DedicatedHostGroup: - """Update an dedicated host group. + ) -> _models.RestorePointCollection: + """The operation to update the restore point collection. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param host_group_name: The name of the dedicated host group. Required. - :type host_group_name: str - :param parameters: Parameters supplied to the Update Dedicated Host Group operation. Required. - :type parameters: ~azure.mgmt.compute.models.DedicatedHostGroupUpdate + :param restore_point_collection_name: The name of the restore point collection. Required. + :type restore_point_collection_name: str + :param parameters: Parameters supplied to the Update restore point collection operation. + Required. + :type parameters: ~azure.mgmt.compute.models.RestorePointCollectionUpdate :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: DedicatedHostGroup. The DedicatedHostGroup is compatible with MutableMapping - :rtype: ~azure.mgmt.compute.models.DedicatedHostGroup + :return: RestorePointCollection. The RestorePointCollection is compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.RestorePointCollection :raises ~azure.core.exceptions.HttpResponseError: """ @@ -17288,26 +16788,27 @@ async def update( async def update( self, resource_group_name: str, - host_group_name: str, + restore_point_collection_name: str, parameters: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.DedicatedHostGroup: - """Update an dedicated host group. + ) -> _models.RestorePointCollection: + """The operation to update the restore point collection. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param host_group_name: The name of the dedicated host group. Required. - :type host_group_name: str - :param parameters: Parameters supplied to the Update Dedicated Host Group operation. Required. + :param restore_point_collection_name: The name of the restore point collection. Required. + :type restore_point_collection_name: str + :param parameters: Parameters supplied to the Update restore point collection operation. + Required. :type parameters: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: DedicatedHostGroup. The DedicatedHostGroup is compatible with MutableMapping - :rtype: ~azure.mgmt.compute.models.DedicatedHostGroup + :return: RestorePointCollection. The RestorePointCollection is compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.RestorePointCollection :raises ~azure.core.exceptions.HttpResponseError: """ @@ -17315,26 +16816,27 @@ async def update( async def update( self, resource_group_name: str, - host_group_name: str, + restore_point_collection_name: str, parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> _models.DedicatedHostGroup: - """Update an dedicated host group. + ) -> _models.RestorePointCollection: + """The operation to update the restore point collection. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param host_group_name: The name of the dedicated host group. Required. - :type host_group_name: str - :param parameters: Parameters supplied to the Update Dedicated Host Group operation. Required. + :param restore_point_collection_name: The name of the restore point collection. Required. + :type restore_point_collection_name: str + :param parameters: Parameters supplied to the Update restore point collection operation. + Required. :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: DedicatedHostGroup. The DedicatedHostGroup is compatible with MutableMapping - :rtype: ~azure.mgmt.compute.models.DedicatedHostGroup + :return: RestorePointCollection. The RestorePointCollection is compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.RestorePointCollection :raises ~azure.core.exceptions.HttpResponseError: """ @@ -17342,22 +16844,22 @@ async def update( async def update( self, resource_group_name: str, - host_group_name: str, - parameters: Union[_models.DedicatedHostGroupUpdate, JSON, IO[bytes]], + restore_point_collection_name: str, + parameters: Union[_models.RestorePointCollectionUpdate, JSON, IO[bytes]], **kwargs: Any - ) -> _models.DedicatedHostGroup: - """Update an dedicated host group. + ) -> _models.RestorePointCollection: + """The operation to update the restore point collection. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param host_group_name: The name of the dedicated host group. Required. - :type host_group_name: str - :param parameters: Parameters supplied to the Update Dedicated Host Group operation. Is one of - the following types: DedicatedHostGroupUpdate, JSON, IO[bytes] Required. - :type parameters: ~azure.mgmt.compute.models.DedicatedHostGroupUpdate or JSON or IO[bytes] - :return: DedicatedHostGroup. The DedicatedHostGroup is compatible with MutableMapping - :rtype: ~azure.mgmt.compute.models.DedicatedHostGroup + :param restore_point_collection_name: The name of the restore point collection. Required. + :type restore_point_collection_name: str + :param parameters: Parameters supplied to the Update restore point collection operation. Is one + of the following types: RestorePointCollectionUpdate, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.compute.models.RestorePointCollectionUpdate or JSON or IO[bytes] + :return: RestorePointCollection. The RestorePointCollection is compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.RestorePointCollection :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -17372,7 +16874,7 @@ async def update( _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.DedicatedHostGroup] = kwargs.pop("cls", None) + cls: ClsType[_models.RestorePointCollection] = kwargs.pop("cls", None) content_type = content_type or "application/json" _content = None @@ -17381,9 +16883,9 @@ async def update( else: _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - _request = build_dedicated_host_groups_update_request( + _request = build_restore_point_collections_update_request( resource_group_name=resource_group_name, - host_group_name=host_group_name, + restore_point_collection_name=restore_point_collection_name, subscription_id=self._config.subscription_id, content_type=content_type, api_version=self._config.api_version, @@ -17416,26 +16918,16 @@ async def update( if _stream: deserialized = response.iter_bytes() else: - deserialized = _deserialize(_models.DedicatedHostGroup, response.json()) + deserialized = _deserialize(_models.RestorePointCollection, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - @distributed_trace_async - async def delete(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. The name is case insensitive. - Required. - :type resource_group_name: str - :param host_group_name: The name of the dedicated host group. Required. - :type host_group_name: str - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ + async def _delete_initial( + self, resource_group_name: str, restore_point_collection_name: str, **kwargs: Any + ) -> AsyncIterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -17447,11 +16939,11 @@ async def delete(self, resource_group_name: str, host_group_name: str, **kwargs: _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - _request = build_dedicated_host_groups_delete_request( + _request = build_restore_point_collections_delete_request( resource_group_name=resource_group_name, - host_group_name=host_group_name, + restore_point_collection_name=restore_point_collection_name, subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -17462,39 +16954,110 @@ async def delete(self, resource_group_name: str, host_group_name: str, **kwargs: } _request.url = self._client.format_url(_request.url, **path_format_arguments) - _stream = False + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200, 204]: + if response.status_code not in [200, 202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = _failsafe_deserialize(_models.CloudError, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if cls: - return cls(pipeline_response, None, {}) # type: ignore - + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_delete( + 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. The name is case insensitive. + Required. + :type resource_group_name: str + :param restore_point_collection_name: The name of the restore point collection. Required. + :type restore_point_collection_name: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + restore_point_collection_name=restore_point_collection_name, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + @distributed_trace - def list_by_resource_group( - self, resource_group_name: str, **kwargs: Any - ) -> AsyncItemPaged["_models.DedicatedHostGroup"]: - """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. + def list(self, resource_group_name: str, **kwargs: Any) -> AsyncItemPaged["_models.RestorePointCollection"]: + """Gets the list of restore point collections in a resource group. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :return: An iterator like instance of DedicatedHostGroup - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.models.DedicatedHostGroup] + :return: An iterator like instance of RestorePointCollection + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.models.RestorePointCollection] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.DedicatedHostGroup]] = kwargs.pop("cls", None) + cls: ClsType[List[_models.RestorePointCollection]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -17507,7 +17070,7 @@ def list_by_resource_group( def prepare_request(next_link=None): if not next_link: - _request = build_dedicated_host_groups_list_by_resource_group_request( + _request = build_restore_point_collections_list_request( resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, api_version=self._config.api_version, @@ -17545,7 +17108,7 @@ def prepare_request(next_link=None): async def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.DedicatedHostGroup], deserialized.get("value", [])) + list_of_elem = _deserialize(List[_models.RestorePointCollection], deserialized.get("value", [])) if cls: list_of_elem = cls(list_of_elem) # type: ignore return deserialized.get("nextLink") or None, AsyncList(list_of_elem) @@ -17569,18 +17132,20 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) @distributed_trace - def list_by_subscription(self, **kwargs: Any) -> AsyncItemPaged["_models.DedicatedHostGroup"]: - """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. + def list_all(self, **kwargs: Any) -> AsyncItemPaged["_models.RestorePointCollection"]: + """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. - :return: An iterator like instance of DedicatedHostGroup - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.models.DedicatedHostGroup] + :return: An iterator like instance of RestorePointCollection + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.models.RestorePointCollection] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.DedicatedHostGroup]] = kwargs.pop("cls", None) + cls: ClsType[List[_models.RestorePointCollection]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -17593,7 +17158,7 @@ def list_by_subscription(self, **kwargs: Any) -> AsyncItemPaged["_models.Dedicat def prepare_request(next_link=None): if not next_link: - _request = build_dedicated_host_groups_list_by_subscription_request( + _request = build_restore_point_collections_list_all_request( subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -17630,7 +17195,7 @@ def prepare_request(next_link=None): async def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.DedicatedHostGroup], deserialized.get("value", [])) + list_of_elem = _deserialize(List[_models.RestorePointCollection], deserialized.get("value", [])) if cls: list_of_elem = cls(list_of_elem) # type: ignore return deserialized.get("nextLink") or None, AsyncList(list_of_elem) @@ -17654,14 +17219,14 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) -class DedicatedHostsOperations: +class RestorePointsOperations: """ .. warning:: **DO NOT** instantiate this class directly. Instead, you should access the following operations through :class:`~azure.mgmt.compute.aio.ComputeClient`'s - :attr:`dedicated_hosts` attribute. + :attr:`restore_points` attribute. """ def __init__(self, *args, **kwargs) -> None: @@ -17675,28 +17240,26 @@ def __init__(self, *args, **kwargs) -> None: async def get( self, resource_group_name: str, - host_group_name: str, - host_name: str, + restore_point_collection_name: str, + restore_point_name: str, *, - expand: Optional[Union[str, _models.InstanceViewTypes]] = None, + expand: Optional[Union[str, _models.RestorePointExpandOptions]] = None, **kwargs: Any - ) -> _models.DedicatedHost: - """Retrieves information about a dedicated host. + ) -> _models.RestorePoint: + """The operation to get the restore point. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param host_group_name: The name of the dedicated host group. Required. - :type host_group_name: str - :param host_name: The name of the dedicated host. Required. - :type host_name: str - :keyword 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. Known values are: "instanceView", "userData", and "resiliencyView". Default value is - None. - :paramtype expand: str or ~azure.mgmt.compute.models.InstanceViewTypes - :return: DedicatedHost. The DedicatedHost is compatible with MutableMapping - :rtype: ~azure.mgmt.compute.models.DedicatedHost + :param restore_point_collection_name: The name of the restore point collection. Required. + :type restore_point_collection_name: str + :param restore_point_name: The name of the restore point. Required. + :type restore_point_name: str + :keyword expand: The expand expression to apply on the operation. 'InstanceView' retrieves + information about the run-time state of a restore point. "instanceView" Default value is None. + :paramtype expand: str or ~azure.mgmt.compute.models.RestorePointExpandOptions + :return: RestorePoint. The RestorePoint is compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.RestorePoint :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -17710,12 +17273,12 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.DedicatedHost] = kwargs.pop("cls", None) + cls: ClsType[_models.RestorePoint] = kwargs.pop("cls", None) - _request = build_dedicated_hosts_get_request( + _request = build_restore_points_get_request( resource_group_name=resource_group_name, - host_group_name=host_group_name, - host_name=host_name, + restore_point_collection_name=restore_point_collection_name, + restore_point_name=restore_point_name, subscription_id=self._config.subscription_id, expand=expand, api_version=self._config.api_version, @@ -17747,19 +17310,19 @@ async def get( if _stream: deserialized = response.iter_bytes() else: - deserialized = _deserialize(_models.DedicatedHost, response.json()) + deserialized = _deserialize(_models.RestorePoint, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - async def _create_or_update_initial( + async def _create_initial( self, resource_group_name: str, - host_group_name: str, - host_name: str, - parameters: Union[_models.DedicatedHost, JSON, IO[bytes]], + restore_point_collection_name: str, + restore_point_name: str, + parameters: Union[_models.RestorePoint, JSON, IO[bytes]], **kwargs: Any ) -> AsyncIterator[bytes]: error_map: MutableMapping = { @@ -17783,10 +17346,10 @@ async def _create_or_update_initial( else: _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - _request = build_dedicated_hosts_create_or_update_request( + _request = build_restore_points_create_request( resource_group_name=resource_group_name, - host_group_name=host_group_name, - host_name=host_name, + restore_point_collection_name=restore_point_collection_name, + restore_point_name=restore_point_name, subscription_id=self._config.subscription_id, content_type=content_type, api_version=self._config.api_version, @@ -17806,7 +17369,7 @@ async def _create_or_update_initial( response = pipeline_response.http_response - if response.status_code not in [200, 201]: + if response.status_code not in [201]: try: await response.read() # Load the body in memory and close the socket except (StreamConsumedError, StreamClosedError): @@ -17816,9 +17379,8 @@ async def _create_or_update_initial( raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} - if response.status_code == 201: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) deserialized = response.iter_bytes() @@ -17828,133 +17390,141 @@ async def _create_or_update_initial( return deserialized # type: ignore @overload - async def begin_create_or_update( + async def begin_create( self, resource_group_name: str, - host_group_name: str, - host_name: str, - parameters: _models.DedicatedHost, + restore_point_collection_name: str, + restore_point_name: str, + parameters: _models.RestorePoint, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[None]: - """Create or update a dedicated host . + ) -> 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. The name is case insensitive. Required. :type resource_group_name: str - :param host_group_name: The name of the dedicated host group. Required. - :type host_group_name: str - :param host_name: The name of the dedicated host. Required. - :type host_name: str - :param parameters: Parameters supplied to the Create Dedicated Host. Required. - :type parameters: ~azure.mgmt.compute.models.DedicatedHost + :param restore_point_collection_name: The name of the restore point collection. Required. + :type restore_point_collection_name: str + :param restore_point_name: The name of the restore point. Required. + :type restore_point_name: str + :param parameters: Parameters supplied to the Create restore point operation. Required. + :type parameters: ~azure.mgmt.compute.models.RestorePoint :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns None - :rtype: ~azure.core.polling.AsyncLROPoller[None] + :return: An instance of AsyncLROPoller that returns RestorePoint. The RestorePoint is + compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.RestorePoint] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - async def begin_create_or_update( + async def begin_create( self, resource_group_name: str, - host_group_name: str, - host_name: str, + restore_point_collection_name: str, + restore_point_name: str, parameters: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[None]: - """Create or update a dedicated host . + ) -> 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. The name is case insensitive. Required. :type resource_group_name: str - :param host_group_name: The name of the dedicated host group. Required. - :type host_group_name: str - :param host_name: The name of the dedicated host. Required. - :type host_name: str - :param parameters: Parameters supplied to the Create Dedicated Host. Required. + :param restore_point_collection_name: The name of the restore point collection. Required. + :type restore_point_collection_name: str + :param restore_point_name: The name of the restore point. Required. + :type restore_point_name: str + :param parameters: Parameters supplied to the Create restore point operation. Required. :type parameters: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns None - :rtype: ~azure.core.polling.AsyncLROPoller[None] + :return: An instance of AsyncLROPoller that returns RestorePoint. The RestorePoint is + compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.RestorePoint] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - async def begin_create_or_update( + async def begin_create( self, resource_group_name: str, - host_group_name: str, - host_name: str, + restore_point_collection_name: str, + restore_point_name: str, parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[None]: - """Create or update a dedicated host . + ) -> 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. The name is case insensitive. Required. :type resource_group_name: str - :param host_group_name: The name of the dedicated host group. Required. - :type host_group_name: str - :param host_name: The name of the dedicated host. Required. - :type host_name: str - :param parameters: Parameters supplied to the Create Dedicated Host. Required. + :param restore_point_collection_name: The name of the restore point collection. Required. + :type restore_point_collection_name: str + :param restore_point_name: The name of the restore point. Required. + :type restore_point_name: str + :param parameters: Parameters supplied to the Create restore point operation. Required. :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns None - :rtype: ~azure.core.polling.AsyncLROPoller[None] + :return: An instance of AsyncLROPoller that returns RestorePoint. The RestorePoint is + compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.RestorePoint] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace_async - async def begin_create_or_update( + async def begin_create( self, resource_group_name: str, - host_group_name: str, - host_name: str, - parameters: Union[_models.DedicatedHost, JSON, IO[bytes]], + restore_point_collection_name: str, + restore_point_name: str, + parameters: Union[_models.RestorePoint, JSON, IO[bytes]], **kwargs: Any - ) -> AsyncLROPoller[None]: - """Create or update a dedicated host . + ) -> 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. The name is case insensitive. Required. :type resource_group_name: str - :param host_group_name: The name of the dedicated host group. Required. - :type host_group_name: str - :param host_name: The name of the dedicated host. Required. - :type host_name: str - :param parameters: Parameters supplied to the Create Dedicated Host. Is one of the following - types: DedicatedHost, JSON, IO[bytes] Required. - :type parameters: ~azure.mgmt.compute.models.DedicatedHost or JSON or IO[bytes] - :return: An instance of AsyncLROPoller that returns None - :rtype: ~azure.core.polling.AsyncLROPoller[None] + :param restore_point_collection_name: The name of the restore point collection. Required. + :type restore_point_collection_name: str + :param restore_point_name: The name of the restore point. Required. + :type restore_point_name: str + :param parameters: Parameters supplied to the Create restore point operation. Is one of the + following types: RestorePoint, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.compute.models.RestorePoint or JSON or IO[bytes] + :return: An instance of AsyncLROPoller that returns RestorePoint. The RestorePoint is + compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.RestorePoint] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[_models.RestorePoint] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._create_or_update_initial( + raw_result = await self._create_initial( resource_group_name=resource_group_name, - host_group_name=host_group_name, - host_name=host_name, + restore_point_collection_name=restore_point_collection_name, + restore_point_name=restore_point_name, parameters=parameters, content_type=content_type, cls=lambda x, y, z: x, @@ -17965,9 +17535,16 @@ async def begin_create_or_update( await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = _deserialize(_models.RestorePoint, response.json()) if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore + return deserialized path_format_arguments = { "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), @@ -17982,21 +17559,18 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return AsyncLROPoller[None].from_continuation_token( + return AsyncLROPoller[_models.RestorePoint].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + return AsyncLROPoller[_models.RestorePoint]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) - async def _update_initial( - self, - resource_group_name: str, - host_group_name: str, - host_name: str, - parameters: Union[_models.DedicatedHostUpdate, JSON, IO[bytes]], - **kwargs: Any + async def _delete_initial( + self, resource_group_name: str, restore_point_collection_name: str, restore_point_name: str, **kwargs: Any ) -> AsyncIterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -18006,27 +17580,17 @@ async def _update_initial( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - content_type = content_type or "application/json" - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - - _request = build_dedicated_hosts_update_request( + _request = build_restore_points_delete_request( resource_group_name=resource_group_name, - host_group_name=host_group_name, - host_name=host_name, + restore_point_collection_name=restore_point_collection_name, + restore_point_name=restore_point_name, subscription_id=self._config.subscription_id, - content_type=content_type, api_version=self._config.api_version, - content=_content, headers=_headers, params=_params, ) @@ -18042,7 +17606,7 @@ async def _update_initial( response = pipeline_response.http_response - if response.status_code not in [200]: + if response.status_code not in [200, 202, 204]: try: await response.read() # Load the body in memory and close the socket except (StreamConsumedError, StreamClosedError): @@ -18052,8 +17616,9 @@ async def _update_initial( raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) deserialized = response.iter_bytes() @@ -18062,136 +17627,35 @@ async def _update_initial( return deserialized # type: ignore - @overload - async def begin_update( - self, - resource_group_name: str, - host_group_name: str, - host_name: str, - parameters: _models.DedicatedHostUpdate, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Update a dedicated host . - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param host_group_name: The name of the dedicated host group. Required. - :type host_group_name: str - :param host_name: The name of the dedicated host. Required. - :type host_name: str - :param parameters: Parameters supplied to the Update Dedicated Host operation. Required. - :type parameters: ~azure.mgmt.compute.models.DedicatedHostUpdate - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns None - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update( - self, - resource_group_name: str, - host_group_name: str, - host_name: str, - parameters: JSON, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Update a dedicated host . - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param host_group_name: The name of the dedicated host group. Required. - :type host_group_name: str - :param host_name: The name of the dedicated host. Required. - :type host_name: str - :param parameters: Parameters supplied to the Update Dedicated Host operation. Required. - :type parameters: JSON - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns None - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update( - self, - resource_group_name: str, - host_group_name: str, - host_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Update a dedicated host . - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param host_group_name: The name of the dedicated host group. Required. - :type host_group_name: str - :param host_name: The name of the dedicated host. Required. - :type host_name: str - :param parameters: Parameters supplied to the Update Dedicated Host operation. Required. - :type parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns None - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - @distributed_trace_async - async def begin_update( - self, - resource_group_name: str, - host_group_name: str, - host_name: str, - parameters: Union[_models.DedicatedHostUpdate, JSON, IO[bytes]], - **kwargs: Any + async def begin_delete( + self, resource_group_name: str, restore_point_collection_name: str, restore_point_name: str, **kwargs: Any ) -> AsyncLROPoller[None]: - """Update a dedicated host . + """The operation to delete the restore point. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param host_group_name: The name of the dedicated host group. Required. - :type host_group_name: str - :param host_name: The name of the dedicated host. Required. - :type host_name: str - :param parameters: Parameters supplied to the Update Dedicated Host operation. Is one of the - following types: DedicatedHostUpdate, JSON, IO[bytes] Required. - :type parameters: ~azure.mgmt.compute.models.DedicatedHostUpdate or JSON or IO[bytes] + :param restore_point_collection_name: The name of the restore point collection. Required. + :type restore_point_collection_name: str + :param restore_point_name: The name of the restore point. Required. + :type restore_point_name: str :return: An instance of AsyncLROPoller that returns None :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._update_initial( + raw_result = await self._delete_initial( resource_group_name=resource_group_name, - host_group_name=host_group_name, - host_name=host_name, - parameters=parameters, - content_type=content_type, + restore_point_collection_name=restore_point_collection_name, + restore_point_name=restore_point_name, cls=lambda x, y, z: x, headers=_headers, params=_params, @@ -18225,9 +17689,51 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - async def _delete_initial( - self, resource_group_name: str, host_group_name: str, host_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: + +class CapacityReservationGroupsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.compute.aio.ComputeClient`'s + :attr:`capacity_reservation_groups` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @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. The name is case insensitive. + Required. + :type resource_group_name: str + :param capacity_reservation_group_name: The name of the capacity reservation group. Required. + :type capacity_reservation_group_name: str + :keyword 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. "instanceView" Default value is + None. + :paramtype expand: str or ~azure.mgmt.compute.models.CapacityReservationGroupInstanceViewTypes + :return: CapacityReservationGroup. The CapacityReservationGroup is compatible with + MutableMapping + :rtype: ~azure.mgmt.compute.models.CapacityReservationGroup + :raises ~azure.core.exceptions.HttpResponseError: + """ error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -18239,13 +17745,13 @@ async def _delete_initial( _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + cls: ClsType[_models.CapacityReservationGroup] = kwargs.pop("cls", None) - _request = build_dedicated_hosts_delete_request( + _request = build_capacity_reservation_groups_get_request( resource_group_name=resource_group_name, - host_group_name=host_group_name, - host_name=host_name, + capacity_reservation_group_name=capacity_reservation_group_name, subscription_id=self._config.subscription_id, + expand=expand, api_version=self._config.api_version, headers=_headers, params=_params, @@ -18255,116 +17761,474 @@ async def _delete_initial( } _request.url = self._client.format_url(_request.url, **path_format_arguments) - _stream = True + _stream = kwargs.pop("stream", False) pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200, 202, 204]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = _failsafe_deserialize(_models.CloudError, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.CapacityReservationGroup, response.json()) - deserialized = response.iter_bytes() + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + async def create_or_update( + self, + resource_group_name: str, + capacity_reservation_group_name: str, + parameters: _models.CapacityReservationGroup, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.CapacityReservationGroup: + """The operation to create or update a capacity reservation group. When updating a capacity + reservation group, only tags and sharing profile may be modified. Please refer to + `https://aka.ms/CapacityReservation `_ for more details. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param capacity_reservation_group_name: The name of the capacity reservation group. Required. + :type capacity_reservation_group_name: str + :param parameters: Parameters supplied to the Create capacity reservation Group. Required. + :type parameters: ~azure.mgmt.compute.models.CapacityReservationGroup + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: CapacityReservationGroup. The CapacityReservationGroup is compatible with + MutableMapping + :rtype: ~azure.mgmt.compute.models.CapacityReservationGroup + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update( + self, + resource_group_name: str, + capacity_reservation_group_name: str, + parameters: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.CapacityReservationGroup: + """The operation to create or update a capacity reservation group. When updating a capacity + reservation group, only tags and sharing profile may be modified. Please refer to + `https://aka.ms/CapacityReservation `_ for more details. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param capacity_reservation_group_name: The name of the capacity reservation group. Required. + :type capacity_reservation_group_name: str + :param parameters: Parameters supplied to the Create capacity reservation Group. Required. + :type parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: CapacityReservationGroup. The CapacityReservationGroup is compatible with + MutableMapping + :rtype: ~azure.mgmt.compute.models.CapacityReservationGroup + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update( + self, + resource_group_name: str, + capacity_reservation_group_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.CapacityReservationGroup: + """The operation to create or update a capacity reservation group. When updating a capacity + reservation group, only tags and sharing profile may be modified. Please refer to + `https://aka.ms/CapacityReservation `_ for more details. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param capacity_reservation_group_name: The name of the capacity reservation group. Required. + :type capacity_reservation_group_name: str + :param parameters: Parameters supplied to the Create capacity reservation Group. Required. + :type parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: CapacityReservationGroup. The CapacityReservationGroup is compatible with + MutableMapping + :rtype: ~azure.mgmt.compute.models.CapacityReservationGroup + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create_or_update( + self, + resource_group_name: str, + capacity_reservation_group_name: str, + parameters: Union[_models.CapacityReservationGroup, JSON, IO[bytes]], + **kwargs: Any + ) -> _models.CapacityReservationGroup: + """The operation to create or update a capacity reservation group. When updating a capacity + reservation group, only tags and sharing profile may be modified. Please refer to + `https://aka.ms/CapacityReservation `_ for more details. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param capacity_reservation_group_name: The name of the capacity reservation group. Required. + :type capacity_reservation_group_name: str + :param parameters: Parameters supplied to the Create capacity reservation Group. Is one of the + following types: CapacityReservationGroup, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.compute.models.CapacityReservationGroup or JSON or IO[bytes] + :return: CapacityReservationGroup. The CapacityReservationGroup is compatible with + MutableMapping + :rtype: ~azure.mgmt.compute.models.CapacityReservationGroup + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CapacityReservationGroup] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_capacity_reservation_groups_create_or_update_request( + resource_group_name=resource_group_name, + capacity_reservation_group_name=capacity_reservation_group_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.CapacityReservationGroup, response.json()) if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + async def update( + self, + resource_group_name: str, + capacity_reservation_group_name: str, + parameters: _models.CapacityReservationGroupUpdate, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.CapacityReservationGroup: + """The operation to update a capacity reservation group. When updating a capacity reservation + group, only tags and sharing profile may be modified. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param capacity_reservation_group_name: The name of the capacity reservation group. Required. + :type capacity_reservation_group_name: str + :param parameters: Parameters supplied to the Update capacity reservation Group operation. + Required. + :type parameters: ~azure.mgmt.compute.models.CapacityReservationGroupUpdate + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: CapacityReservationGroup. The CapacityReservationGroup is compatible with + MutableMapping + :rtype: ~azure.mgmt.compute.models.CapacityReservationGroup + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update( + self, + resource_group_name: str, + capacity_reservation_group_name: str, + parameters: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.CapacityReservationGroup: + """The operation to update a capacity reservation group. When updating a capacity reservation + group, only tags and sharing profile may be modified. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param capacity_reservation_group_name: The name of the capacity reservation group. Required. + :type capacity_reservation_group_name: str + :param parameters: Parameters supplied to the Update capacity reservation Group operation. + Required. + :type parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: CapacityReservationGroup. The CapacityReservationGroup is compatible with + MutableMapping + :rtype: ~azure.mgmt.compute.models.CapacityReservationGroup + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update( + self, + resource_group_name: str, + capacity_reservation_group_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.CapacityReservationGroup: + """The operation to update a capacity reservation group. When updating a capacity reservation + group, only tags and sharing profile may be modified. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param capacity_reservation_group_name: The name of the capacity reservation group. Required. + :type capacity_reservation_group_name: str + :param parameters: Parameters supplied to the Update capacity reservation Group operation. + Required. + :type parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: CapacityReservationGroup. The CapacityReservationGroup is compatible with + MutableMapping + :rtype: ~azure.mgmt.compute.models.CapacityReservationGroup + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def update( + self, + resource_group_name: str, + capacity_reservation_group_name: str, + parameters: Union[_models.CapacityReservationGroupUpdate, JSON, IO[bytes]], + **kwargs: Any + ) -> _models.CapacityReservationGroup: + """The operation to update a capacity reservation group. When updating a capacity reservation + group, only tags and sharing profile may be modified. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param capacity_reservation_group_name: The name of the capacity reservation group. Required. + :type capacity_reservation_group_name: str + :param parameters: Parameters supplied to the Update capacity reservation Group operation. Is + one of the following types: CapacityReservationGroupUpdate, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.compute.models.CapacityReservationGroupUpdate or JSON or + IO[bytes] + :return: CapacityReservationGroup. The CapacityReservationGroup is compatible with + MutableMapping + :rtype: ~azure.mgmt.compute.models.CapacityReservationGroup + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CapacityReservationGroup] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_capacity_reservation_groups_update_request( + resource_group_name=resource_group_name, + capacity_reservation_group_name=capacity_reservation_group_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.CapacityReservationGroup, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore @distributed_trace_async - async def begin_delete( - self, resource_group_name: str, host_group_name: str, host_name: str, **kwargs: Any - ) -> AsyncLROPoller[None]: - """Delete a dedicated host. + async def delete(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. The name is case insensitive. Required. :type resource_group_name: str - :param host_group_name: The name of the dedicated host group. Required. - :type host_group_name: str - :param host_name: The name of the dedicated host. Required. - :type host_name: str - :return: An instance of AsyncLROPoller that returns None - :rtype: ~azure.core.polling.AsyncLROPoller[None] + :param capacity_reservation_group_name: The name of the capacity reservation group. Required. + :type capacity_reservation_group_name: str + :return: None + :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._delete_initial( - resource_group_name=resource_group_name, - host_group_name=host_group_name, - host_name=host_name, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore + _request = build_capacity_reservation_groups_delete_request( + resource_group_name=resource_group_name, + capacity_reservation_group_name=capacity_reservation_group_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) path_format_arguments = { "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), } + _request.url = self._client.format_url(_request.url, **path_format_arguments) - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore @distributed_trace - def list_by_host_group( - self, resource_group_name: str, host_group_name: str, **kwargs: Any - ) -> AsyncItemPaged["_models.DedicatedHost"]: - """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. + def list_by_resource_group( + self, + resource_group_name: str, + *, + expand: Optional[Union[str, _models.ExpandTypesForGetCapacityReservationGroups]] = None, + **kwargs: Any + ) -> AsyncItemPaged["_models.CapacityReservationGroup"]: + """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. The name is case insensitive. Required. :type resource_group_name: str - :param host_group_name: The name of the dedicated host group. Required. - :type host_group_name: str - :return: An iterator like instance of DedicatedHost - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.models.DedicatedHost] + :keyword 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. Known values are: + "virtualMachineScaleSetVMs/$ref" and "virtualMachines/$ref". Default value is None. + :paramtype expand: str or ~azure.mgmt.compute.models.ExpandTypesForGetCapacityReservationGroups + :return: An iterator like instance of CapacityReservationGroup + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.models.CapacityReservationGroup] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.DedicatedHost]] = kwargs.pop("cls", None) + cls: ClsType[List[_models.CapacityReservationGroup]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -18377,10 +18241,10 @@ def list_by_host_group( def prepare_request(next_link=None): if not next_link: - _request = build_dedicated_hosts_list_by_host_group_request( + _request = build_capacity_reservation_groups_list_by_resource_group_request( resource_group_name=resource_group_name, - host_group_name=host_group_name, subscription_id=self._config.subscription_id, + expand=expand, api_version=self._config.api_version, headers=_headers, params=_params, @@ -18416,7 +18280,7 @@ def prepare_request(next_link=None): async def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.DedicatedHost], deserialized.get("value", [])) + list_of_elem = _deserialize(List[_models.CapacityReservationGroup], deserialized.get("value", [])) if cls: list_of_elem = cls(list_of_elem) # type: ignore return deserialized.get("nextLink") or None, AsyncList(list_of_elem) @@ -18440,28 +18304,39 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) @distributed_trace - def list_available_sizes( - self, resource_group_name: str, host_group_name: str, host_name: str, **kwargs: Any - ) -> AsyncItemPaged[str]: - """Lists all available dedicated host sizes to which the specified dedicated host can be resized. - NOTE: The dedicated host sizes provided can be used to only scale up the existing dedicated - host. + def list_by_subscription( + self, + *, + expand: Optional[Union[str, _models.ExpandTypesForGetCapacityReservationGroups]] = None, + resource_ids_only: Optional[Union[str, _models.ResourceIdOptionsForGetCapacityReservationGroups]] = None, + **kwargs: Any + ) -> AsyncItemPaged["_models.CapacityReservationGroup"]: + """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 resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param host_group_name: The name of the dedicated host group. Required. - :type host_group_name: str - :param host_name: The name of the dedicated host. Required. - :type host_name: str - :return: An iterator like instance of str - :rtype: ~azure.core.async_paging.AsyncItemPaged[str] + :keyword 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. Known values are: + "virtualMachineScaleSetVMs/$ref" and "virtualMachines/$ref". Default value is None. + :paramtype expand: str or ~azure.mgmt.compute.models.ExpandTypesForGetCapacityReservationGroups + :keyword resource_ids_only: The query option to fetch Capacity Reservation Group Resource Ids. +
'CreatedInSubscription' enables fetching Resource Ids for all capacity reservation group + resources created in the subscription.
'SharedWithSubscription' enables fetching Resource + Ids for all capacity reservation group resources shared with the subscription.
'All' + enables fetching Resource Ids for all capacity reservation group resources shared with the + subscription and created in the subscription. Known values are: "CreatedInSubscription", + "SharedWithSubscription", and "All". Default value is None. + :paramtype resource_ids_only: str or + ~azure.mgmt.compute.models.ResourceIdOptionsForGetCapacityReservationGroups + :return: An iterator like instance of CapacityReservationGroup + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.models.CapacityReservationGroup] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[str]] = kwargs.pop("cls", None) + cls: ClsType[List[_models.CapacityReservationGroup]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -18474,11 +18349,10 @@ def list_available_sizes( def prepare_request(next_link=None): if not next_link: - _request = build_dedicated_hosts_list_available_sizes_request( - resource_group_name=resource_group_name, - host_group_name=host_group_name, - host_name=host_name, + _request = build_capacity_reservation_groups_list_by_subscription_request( subscription_id=self._config.subscription_id, + expand=expand, + resource_ids_only=resource_ids_only, api_version=self._config.api_version, headers=_headers, params=_params, @@ -18514,7 +18388,7 @@ def prepare_request(next_link=None): async def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[str], deserialized.get("value", [])) + list_of_elem = _deserialize(List[_models.CapacityReservationGroup], deserialized.get("value", [])) if cls: list_of_elem = cls(list_of_elem) # type: ignore return deserialized.get("nextLink") or None, AsyncList(list_of_elem) @@ -18537,9 +18411,51 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - async def _redeploy_initial( - self, resource_group_name: str, host_group_name: str, host_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: + +class CapacityReservationsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.compute.aio.ComputeClient`'s + :attr:`capacity_reservations` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @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. The name is case insensitive. + Required. + :type resource_group_name: str + :param capacity_reservation_group_name: The name of the capacity reservation group. Required. + :type capacity_reservation_group_name: str + :param capacity_reservation_name: The name of the capacity reservation. Required. + :type capacity_reservation_name: str + :keyword 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. "instanceView" Default value is None. + :paramtype expand: str or ~azure.mgmt.compute.models.CapacityReservationInstanceViewTypes + :return: CapacityReservation. The CapacityReservation is compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.CapacityReservation + :raises ~azure.core.exceptions.HttpResponseError: + """ error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -18551,13 +18467,14 @@ async def _redeploy_initial( _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + cls: ClsType[_models.CapacityReservation] = kwargs.pop("cls", None) - _request = build_dedicated_hosts_redeploy_request( + _request = build_capacity_reservations_get_request( resource_group_name=resource_group_name, - host_group_name=host_group_name, - host_name=host_name, + capacity_reservation_group_name=capacity_reservation_group_name, + capacity_reservation_name=capacity_reservation_name, subscription_id=self._config.subscription_id, + expand=expand, api_version=self._config.api_version, headers=_headers, params=_params, @@ -18567,101 +18484,40 @@ async def _redeploy_initial( } _request.url = self._client.format_url(_request.url, **path_format_arguments) - _stream = True + _stream = kwargs.pop("stream", False) pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [202]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = _failsafe_deserialize(_models.CloudError, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - response_headers = {} - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.iter_bytes() + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.CapacityReservation, response.json()) if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - @distributed_trace_async - async def begin_redeploy( - self, resource_group_name: str, host_group_name: str, host_name: str, **kwargs: Any - ) -> AsyncLROPoller[None]: - """Redeploy the dedicated host. The operation will complete successfully once the dedicated host - has migrated to a new node and is running. To determine the health of VMs deployed on the - dedicated host after the redeploy check the Resource Health Center in the Azure Portal. Please - refer to `https://docs.microsoft.com/azure/service-health/resource-health-overview - `_ for more details. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param host_group_name: The name of the dedicated host group. Required. - :type host_group_name: str - :param host_name: The name of the dedicated host. Required. - :type host_name: str - :return: An instance of AsyncLROPoller that returns None - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._redeploy_initial( - resource_group_name=resource_group_name, - host_group_name=host_group_name, - host_name=host_name, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _restart_initial( - self, resource_group_name: str, host_group_name: str, host_name: str, **kwargs: Any + async def _create_or_update_initial( + self, + resource_group_name: str, + capacity_reservation_group_name: str, + capacity_reservation_name: str, + parameters: Union[_models.CapacityReservation, JSON, IO[bytes]], + **kwargs: Any ) -> AsyncIterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -18671,17 +18527,27 @@ async def _restart_initial( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - _request = build_dedicated_hosts_restart_request( + content_type = content_type or "application/json" + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_capacity_reservations_create_or_update_request( resource_group_name=resource_group_name, - host_group_name=host_group_name, - host_name=host_name, + capacity_reservation_group_name=capacity_reservation_group_name, + capacity_reservation_name=capacity_reservation_name, subscription_id=self._config.subscription_id, + content_type=content_type, api_version=self._config.api_version, + content=_content, headers=_headers, params=_params, ) @@ -18697,7 +18563,7 @@ async def _restart_initial( response = pipeline_response.http_response - if response.status_code not in [200]: + if response.status_code not in [200, 201]: try: await response.read() # Load the body in memory and close the socket except (StreamConsumedError, StreamClosedError): @@ -18707,8 +18573,9 @@ async def _restart_initial( raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + if response.status_code == 201: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) deserialized = response.iter_bytes() @@ -18717,39 +18584,148 @@ async def _restart_initial( return deserialized # type: ignore + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + capacity_reservation_group_name: str, + capacity_reservation_name: str, + parameters: _models.CapacityReservation, + *, + content_type: str = "application/json", + **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. The name is case insensitive. + Required. + :type resource_group_name: str + :param capacity_reservation_group_name: The name of the capacity reservation group. Required. + :type capacity_reservation_group_name: str + :param capacity_reservation_name: The name of the capacity reservation. Required. + :type capacity_reservation_name: str + :param parameters: Parameters supplied to the Create capacity reservation. Required. + :type parameters: ~azure.mgmt.compute.models.CapacityReservation + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns CapacityReservation. The + CapacityReservation is compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.CapacityReservation] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + capacity_reservation_group_name: str, + capacity_reservation_name: str, + parameters: JSON, + *, + content_type: str = "application/json", + **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. The name is case insensitive. + Required. + :type resource_group_name: str + :param capacity_reservation_group_name: The name of the capacity reservation group. Required. + :type capacity_reservation_group_name: str + :param capacity_reservation_name: The name of the capacity reservation. Required. + :type capacity_reservation_name: str + :param parameters: Parameters supplied to the Create capacity reservation. Required. + :type parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns CapacityReservation. The + CapacityReservation is compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.CapacityReservation] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + capacity_reservation_group_name: str, + capacity_reservation_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **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. The name is case insensitive. + Required. + :type resource_group_name: str + :param capacity_reservation_group_name: The name of the capacity reservation group. Required. + :type capacity_reservation_group_name: str + :param capacity_reservation_name: The name of the capacity reservation. Required. + :type capacity_reservation_name: str + :param parameters: Parameters supplied to the Create capacity reservation. Required. + :type parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns CapacityReservation. The + CapacityReservation is compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.CapacityReservation] + :raises ~azure.core.exceptions.HttpResponseError: + """ + @distributed_trace_async - async def begin_restart( - 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/azure/service-health/resource-health-overview - `_ for more details. + async def begin_create_or_update( + self, + resource_group_name: str, + capacity_reservation_group_name: str, + capacity_reservation_name: str, + parameters: Union[_models.CapacityReservation, JSON, IO[bytes]], + **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. The name is case insensitive. Required. :type resource_group_name: str - :param host_group_name: The name of the dedicated host group. Required. - :type host_group_name: str - :param host_name: The name of the dedicated host. Required. - :type host_name: str - :return: An instance of AsyncLROPoller that returns None - :rtype: ~azure.core.polling.AsyncLROPoller[None] + :param capacity_reservation_group_name: The name of the capacity reservation group. Required. + :type capacity_reservation_group_name: str + :param capacity_reservation_name: The name of the capacity reservation. Required. + :type capacity_reservation_name: str + :param parameters: Parameters supplied to the Create capacity reservation. Is one of the + following types: CapacityReservation, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.compute.models.CapacityReservation or JSON or IO[bytes] + :return: An instance of AsyncLROPoller that returns CapacityReservation. The + CapacityReservation is compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.CapacityReservation] :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = kwargs.pop("headers", {}) or {} + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - cls: ClsType[None] = kwargs.pop("cls", None) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CapacityReservation] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._restart_initial( + raw_result = await self._create_or_update_initial( resource_group_name=resource_group_name, - host_group_name=host_group_name, - host_name=host_name, + capacity_reservation_group_name=capacity_reservation_group_name, + capacity_reservation_name=capacity_reservation_name, + parameters=parameters, + content_type=content_type, cls=lambda x, y, z: x, headers=_headers, params=_params, @@ -18758,9 +18734,12 @@ async def begin_restart( await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.CapacityReservation, response.json()) if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized path_format_arguments = { "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), @@ -18775,47 +18754,24 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return AsyncLROPoller[None].from_continuation_token( + return AsyncLROPoller[_models.CapacityReservation].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - -class SshPublicKeyResourcesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.compute.aio.ComputeClient`'s - :attr:`ssh_public_key_resources` attribute. - """ - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ComputeClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @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. + return AsyncLROPoller[_models.CapacityReservation]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param ssh_public_key_name: The name of the SSH public key. Required. - :type ssh_public_key_name: str - :return: SshPublicKeyResource. The SshPublicKeyResource is compatible with MutableMapping - :rtype: ~azure.mgmt.compute.models.SshPublicKeyResource - :raises ~azure.core.exceptions.HttpResponseError: - """ + async def _update_initial( + self, + resource_group_name: str, + capacity_reservation_group_name: str, + capacity_reservation_name: str, + parameters: Union[_models.CapacityReservationUpdate, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -18824,16 +18780,27 @@ async def get( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.SshPublicKeyResource] = kwargs.pop("cls", None) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - _request = build_ssh_public_key_resources_get_request( + _request = build_capacity_reservations_update_request( resource_group_name=resource_group_name, - ssh_public_key_name=ssh_public_key_name, + capacity_reservation_group_name=capacity_reservation_group_name, + capacity_reservation_name=capacity_reservation_name, subscription_id=self._config.subscription_id, + content_type=content_type, api_version=self._config.api_version, + content=_content, headers=_headers, params=_params, ) @@ -18842,302 +18809,213 @@ async def get( } _request.url = self._client.format_url(_request.url, **path_format_arguments) - _stream = kwargs.pop("stream", False) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200]: - if _stream: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass + if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = _failsafe_deserialize(_models.CloudError, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if _stream: - deserialized = response.iter_bytes() - else: - deserialized = _deserialize(_models.SshPublicKeyResource, response.json()) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore @overload - async def create( + async def begin_update( self, resource_group_name: str, - ssh_public_key_name: str, - parameters: _models.SshPublicKeyResource, + capacity_reservation_group_name: str, + capacity_reservation_name: str, + parameters: _models.CapacityReservationUpdate, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.SshPublicKeyResource: - """Creates a new SSH public key resource. + ) -> AsyncLROPoller[_models.CapacityReservation]: + """The operation to update a capacity reservation. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param ssh_public_key_name: The name of the SSH public key. Required. - :type ssh_public_key_name: str - :param parameters: Parameters supplied to create the SSH public key. Required. - :type parameters: ~azure.mgmt.compute.models.SshPublicKeyResource + :param capacity_reservation_group_name: The name of the capacity reservation group. Required. + :type capacity_reservation_group_name: str + :param capacity_reservation_name: The name of the capacity reservation. Required. + :type capacity_reservation_name: str + :param parameters: Parameters supplied to the Update capacity reservation operation. Required. + :type parameters: ~azure.mgmt.compute.models.CapacityReservationUpdate :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: SshPublicKeyResource. The SshPublicKeyResource is compatible with MutableMapping - :rtype: ~azure.mgmt.compute.models.SshPublicKeyResource + :return: An instance of AsyncLROPoller that returns CapacityReservation. The + CapacityReservation is compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.CapacityReservation] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - async def create( + async def begin_update( self, resource_group_name: str, - ssh_public_key_name: str, + capacity_reservation_group_name: str, + capacity_reservation_name: str, parameters: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.SshPublicKeyResource: - """Creates a new SSH public key resource. + ) -> AsyncLROPoller[_models.CapacityReservation]: + """The operation to update a capacity reservation. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param ssh_public_key_name: The name of the SSH public key. Required. - :type ssh_public_key_name: str - :param parameters: Parameters supplied to create the SSH public key. Required. + :param capacity_reservation_group_name: The name of the capacity reservation group. Required. + :type capacity_reservation_group_name: str + :param capacity_reservation_name: The name of the capacity reservation. Required. + :type capacity_reservation_name: str + :param parameters: Parameters supplied to the Update capacity reservation operation. Required. :type parameters: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: SshPublicKeyResource. The SshPublicKeyResource is compatible with MutableMapping - :rtype: ~azure.mgmt.compute.models.SshPublicKeyResource + :return: An instance of AsyncLROPoller that returns CapacityReservation. The + CapacityReservation is compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.CapacityReservation] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - async def create( + async def begin_update( self, resource_group_name: str, - ssh_public_key_name: str, + capacity_reservation_group_name: str, + capacity_reservation_name: str, parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> _models.SshPublicKeyResource: - """Creates a new SSH public key resource. + ) -> AsyncLROPoller[_models.CapacityReservation]: + """The operation to update a capacity reservation. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param ssh_public_key_name: The name of the SSH public key. Required. - :type ssh_public_key_name: str - :param parameters: Parameters supplied to create the SSH public key. Required. + :param capacity_reservation_group_name: The name of the capacity reservation group. Required. + :type capacity_reservation_group_name: str + :param capacity_reservation_name: The name of the capacity reservation. Required. + :type capacity_reservation_name: str + :param parameters: Parameters supplied to the Update capacity reservation operation. Required. :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: SshPublicKeyResource. The SshPublicKeyResource is compatible with MutableMapping - :rtype: ~azure.mgmt.compute.models.SshPublicKeyResource + :return: An instance of AsyncLROPoller that returns CapacityReservation. The + CapacityReservation is compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.CapacityReservation] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace_async - async def create( + async def begin_update( self, resource_group_name: str, - ssh_public_key_name: str, - parameters: Union[_models.SshPublicKeyResource, JSON, IO[bytes]], + capacity_reservation_group_name: str, + capacity_reservation_name: str, + parameters: Union[_models.CapacityReservationUpdate, JSON, IO[bytes]], **kwargs: Any - ) -> _models.SshPublicKeyResource: - """Creates a new SSH public key resource. + ) -> AsyncLROPoller[_models.CapacityReservation]: + """The operation to update a capacity reservation. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param ssh_public_key_name: The name of the SSH public key. Required. - :type ssh_public_key_name: str - :param parameters: Parameters supplied to create the SSH public key. Is one of the following - types: SshPublicKeyResource, JSON, IO[bytes] Required. - :type parameters: ~azure.mgmt.compute.models.SshPublicKeyResource or JSON or IO[bytes] - :return: SshPublicKeyResource. The SshPublicKeyResource is compatible with MutableMapping - :rtype: ~azure.mgmt.compute.models.SshPublicKeyResource + :param capacity_reservation_group_name: The name of the capacity reservation group. Required. + :type capacity_reservation_group_name: str + :param capacity_reservation_name: The name of the capacity reservation. Required. + :type capacity_reservation_name: str + :param parameters: Parameters supplied to the Update capacity reservation operation. Is one of + the following types: CapacityReservationUpdate, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.compute.models.CapacityReservationUpdate or JSON or IO[bytes] + :return: An instance of AsyncLROPoller that returns CapacityReservation. The + CapacityReservation is compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.CapacityReservation] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.SshPublicKeyResource] = kwargs.pop("cls", None) + cls: ClsType[_models.CapacityReservation] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._update_initial( + resource_group_name=resource_group_name, + capacity_reservation_group_name=capacity_reservation_group_name, + capacity_reservation_name=capacity_reservation_name, + parameters=parameters, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) - content_type = content_type or "application/json" - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.CapacityReservation, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized - _request = build_ssh_public_key_resources_create_request( - resource_group_name=resource_group_name, - ssh_public_key_name=ssh_public_key_name, - subscription_id=self._config.subscription_id, - content_type=content_type, - api_version=self._config.api_version, - content=_content, - headers=_headers, - params=_params, - ) path_format_arguments = { "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = kwargs.pop("stream", False) - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - if _stream: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.CloudError, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if _stream: - deserialized = response.iter_bytes() + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: - deserialized = _deserialize(_models.SshPublicKeyResource, response.json()) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def update( - self, - resource_group_name: str, - ssh_public_key_name: str, - parameters: _models.SshPublicKeyUpdateResource, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.SshPublicKeyResource: - """Updates a new SSH public key resource. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param ssh_public_key_name: The name of the SSH public key. Required. - :type ssh_public_key_name: str - :param parameters: Parameters supplied to update the SSH public key. Required. - :type parameters: ~azure.mgmt.compute.models.SshPublicKeyUpdateResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: SshPublicKeyResource. The SshPublicKeyResource is compatible with MutableMapping - :rtype: ~azure.mgmt.compute.models.SshPublicKeyResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def update( - self, - resource_group_name: str, - ssh_public_key_name: str, - parameters: JSON, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.SshPublicKeyResource: - """Updates a new SSH public key resource. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param ssh_public_key_name: The name of the SSH public key. Required. - :type ssh_public_key_name: str - :param parameters: Parameters supplied to update the SSH public key. Required. - :type parameters: JSON - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: SshPublicKeyResource. The SshPublicKeyResource is compatible with MutableMapping - :rtype: ~azure.mgmt.compute.models.SshPublicKeyResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def update( - self, - resource_group_name: str, - ssh_public_key_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.SshPublicKeyResource: - """Updates a new SSH public key resource. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param ssh_public_key_name: The name of the SSH public key. Required. - :type ssh_public_key_name: str - :param parameters: Parameters supplied to update the SSH public key. Required. - :type parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: SshPublicKeyResource. The SshPublicKeyResource is compatible with MutableMapping - :rtype: ~azure.mgmt.compute.models.SshPublicKeyResource - :raises ~azure.core.exceptions.HttpResponseError: - """ + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.CapacityReservation].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.CapacityReservation]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) - @distributed_trace_async - async def update( + async def _delete_initial( self, resource_group_name: str, - ssh_public_key_name: str, - parameters: Union[_models.SshPublicKeyUpdateResource, JSON, IO[bytes]], + capacity_reservation_group_name: str, + capacity_reservation_name: str, **kwargs: Any - ) -> _models.SshPublicKeyResource: - """Updates a new SSH public key resource. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param ssh_public_key_name: The name of the SSH public key. Required. - :type ssh_public_key_name: str - :param parameters: Parameters supplied to update the SSH public key. Is one of the following - types: SshPublicKeyUpdateResource, JSON, IO[bytes] Required. - :type parameters: ~azure.mgmt.compute.models.SshPublicKeyUpdateResource or JSON or IO[bytes] - :return: SshPublicKeyResource. The SshPublicKeyResource is compatible with MutableMapping - :rtype: ~azure.mgmt.compute.models.SshPublicKeyResource - :raises ~azure.core.exceptions.HttpResponseError: - """ + ) -> AsyncIterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -19146,26 +19024,17 @@ async def update( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.SshPublicKeyResource] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - _request = build_ssh_public_key_resources_update_request( + _request = build_capacity_reservations_delete_request( resource_group_name=resource_group_name, - ssh_public_key_name=ssh_public_key_name, + capacity_reservation_group_name=capacity_reservation_group_name, + capacity_reservation_name=capacity_reservation_name, subscription_id=self._config.subscription_id, - content_type=content_type, api_version=self._config.api_version, - content=_content, headers=_headers, params=_params, ) @@ -19174,106 +19043,124 @@ async def update( } _request.url = self._client.format_url(_request.url, **path_format_arguments) - _stream = kwargs.pop("stream", False) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200]: - if _stream: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass + if response.status_code not in [200, 202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = _failsafe_deserialize(_models.CloudError, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if _stream: - deserialized = response.iter_bytes() - else: - deserialized = _deserialize(_models.SshPublicKeyResource, response.json()) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore @distributed_trace_async - async def delete(self, resource_group_name: str, ssh_public_key_name: str, **kwargs: Any) -> None: - """Delete an SSH public key. + async def begin_delete( + 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. + Note: Block capacity reservations cannot be deleted after it has been successfully allocated + until the schedule end time. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param ssh_public_key_name: The name of the SSH public key. Required. - :type ssh_public_key_name: str - :return: None - :rtype: None + :param capacity_reservation_group_name: The name of the capacity reservation group. Required. + :type capacity_reservation_group_name: str + :param capacity_reservation_name: The name of the capacity reservation. Required. + :type capacity_reservation_name: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + capacity_reservation_group_name=capacity_reservation_group_name, + capacity_reservation_name=capacity_reservation_name, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore - _request = build_ssh_public_key_resources_delete_request( - resource_group_name=resource_group_name, - ssh_public_key_name=ssh_public_key_name, - subscription_id=self._config.subscription_id, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) path_format_arguments = { "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.CloudError, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore @distributed_trace - def list_by_resource_group( - self, resource_group_name: str, **kwargs: Any - ) -> AsyncItemPaged["_models.SshPublicKeyResource"]: - """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. + def list_by_capacity_reservation_group( + self, resource_group_name: str, capacity_reservation_group_name: str, **kwargs: Any + ) -> AsyncItemPaged["_models.CapacityReservation"]: + """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. The name is case insensitive. Required. :type resource_group_name: str - :return: An iterator like instance of SshPublicKeyResource - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.models.SshPublicKeyResource] + :param capacity_reservation_group_name: The name of the capacity reservation group. Required. + :type capacity_reservation_group_name: str + :return: An iterator like instance of CapacityReservation + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.models.CapacityReservation] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.SshPublicKeyResource]] = kwargs.pop("cls", None) + cls: ClsType[List[_models.CapacityReservation]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -19286,8 +19173,9 @@ def list_by_resource_group( def prepare_request(next_link=None): if not next_link: - _request = build_ssh_public_key_resources_list_by_resource_group_request( + _request = build_capacity_reservations_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=self._config.api_version, headers=_headers, @@ -19324,7 +19212,7 @@ def prepare_request(next_link=None): async def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.SshPublicKeyResource], deserialized.get("value", [])) + list_of_elem = _deserialize(List[_models.CapacityReservation], deserialized.get("value", [])) if cls: list_of_elem = cls(list_of_elem) # type: ignore return deserialized.get("nextLink") or None, AsyncList(list_of_elem) @@ -19347,21 +19235,50 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - @distributed_trace - def list_by_subscription(self, **kwargs: Any) -> AsyncItemPaged["_models.SshPublicKeyResource"]: - """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. - :return: An iterator like instance of SshPublicKeyResource - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.models.SshPublicKeyResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} +class VirtualMachineRunCommandsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - cls: ClsType[List[_models.SshPublicKeyResource]] = kwargs.pop("cls", None) + Instead, you should access the following operations through + :class:`~azure.mgmt.compute.aio.ComputeClient`'s + :attr:`virtual_machine_run_commands` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @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. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_name: The name of the VirtualMachine. Required. + :type vm_name: str + :param run_command_name: The name of the VirtualMachineRunCommand. Required. + :type run_command_name: str + :keyword expand: The expand expression to apply on the operation. Default value is None. + :paramtype expand: str + :return: VirtualMachineRunCommand. The VirtualMachineRunCommand is compatible with + MutableMapping + :rtype: ~azure.mgmt.compute.models.VirtualMachineRunCommand + :raises ~azure.core.exceptions.HttpResponseError: + """ error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -19370,346 +19287,59 @@ def list_by_subscription(self, **kwargs: Any) -> AsyncItemPaged["_models.SshPubl } error_map.update(kwargs.pop("error_map", {}) or {}) - def prepare_request(next_link=None): - if not next_link: - - _request = build_ssh_public_key_resources_list_by_subscription_request( - subscription_id=self._config.subscription_id, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) + cls: ClsType[_models.VirtualMachineRunCommand] = kwargs.pop("cls", None) - return _request + _request = build_virtual_machine_run_commands_get_by_virtual_machine_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + run_command_name=run_command_name, + subscription_id=self._config.subscription_id, + expand=expand, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) - async def extract_data(pipeline_response): - deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.SshPublicKeyResource], deserialized.get("value", [])) - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) - async def get_next(next_link=None): - _request = prepare_request(next_link) + response = pipeline_response.http_response - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.CloudError, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.VirtualMachineRunCommand, response.json()) - return pipeline_response + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore - return AsyncItemPaged(get_next, extract_data) + return deserialized # type: ignore - @overload - async def generate_key_pair( + async def _create_or_update_initial( self, resource_group_name: str, - ssh_public_key_name: str, - parameters: Optional[_models.SshGenerateKeyPairInputParameters] = None, - *, - content_type: str = "application/json", - **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. The name is case insensitive. - Required. - :type resource_group_name: str - :param ssh_public_key_name: The name of the SSH public key. Required. - :type ssh_public_key_name: str - :param parameters: Parameters supplied to generate the SSH public key. Default value is None. - :type parameters: ~azure.mgmt.compute.models.SshGenerateKeyPairInputParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: SshPublicKeyGenerateKeyPairResult. The SshPublicKeyGenerateKeyPairResult is compatible - with MutableMapping - :rtype: ~azure.mgmt.compute.models.SshPublicKeyGenerateKeyPairResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def generate_key_pair( - self, - resource_group_name: str, - ssh_public_key_name: str, - parameters: Optional[JSON] = None, - *, - content_type: str = "application/json", - **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. The name is case insensitive. - Required. - :type resource_group_name: str - :param ssh_public_key_name: The name of the SSH public key. Required. - :type ssh_public_key_name: str - :param parameters: Parameters supplied to generate the SSH public key. Default value is None. - :type parameters: JSON - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: SshPublicKeyGenerateKeyPairResult. The SshPublicKeyGenerateKeyPairResult is compatible - with MutableMapping - :rtype: ~azure.mgmt.compute.models.SshPublicKeyGenerateKeyPairResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def generate_key_pair( - self, - resource_group_name: str, - ssh_public_key_name: str, - parameters: Optional[IO[bytes]] = None, - *, - content_type: str = "application/json", - **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. The name is case insensitive. - Required. - :type resource_group_name: str - :param ssh_public_key_name: The name of the SSH public key. Required. - :type ssh_public_key_name: str - :param parameters: Parameters supplied to generate the SSH public key. Default value is None. - :type parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: SshPublicKeyGenerateKeyPairResult. The SshPublicKeyGenerateKeyPairResult is compatible - with MutableMapping - :rtype: ~azure.mgmt.compute.models.SshPublicKeyGenerateKeyPairResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def generate_key_pair( - self, - resource_group_name: str, - ssh_public_key_name: str, - parameters: Optional[Union[_models.SshGenerateKeyPairInputParameters, JSON, IO[bytes]]] = None, - **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. The name is case insensitive. - Required. - :type resource_group_name: str - :param ssh_public_key_name: The name of the SSH public key. Required. - :type ssh_public_key_name: str - :param parameters: Parameters supplied to generate the SSH public key. Is one of the following - types: SshGenerateKeyPairInputParameters, JSON, IO[bytes] Default value is None. - :type parameters: ~azure.mgmt.compute.models.SshGenerateKeyPairInputParameters or JSON or - IO[bytes] - :return: SshPublicKeyGenerateKeyPairResult. The SshPublicKeyGenerateKeyPairResult is compatible - with MutableMapping - :rtype: ~azure.mgmt.compute.models.SshPublicKeyGenerateKeyPairResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} - - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - content_type = content_type if parameters else None - cls: ClsType[_models.SshPublicKeyGenerateKeyPairResult] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" if parameters else None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - if parameters is not None: - _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - else: - _content = None - - _request = build_ssh_public_key_resources_generate_key_pair_request( - resource_group_name=resource_group_name, - ssh_public_key_name=ssh_public_key_name, - subscription_id=self._config.subscription_id, - content_type=content_type, - api_version=self._config.api_version, - content=_content, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = kwargs.pop("stream", False) - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - if _stream: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.CloudError, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if _stream: - deserialized = response.iter_bytes() - else: - deserialized = _deserialize(_models.SshPublicKeyGenerateKeyPairResult, response.json()) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - -class ImagesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.compute.aio.ComputeClient`'s - :attr:`images` attribute. - """ - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ComputeClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @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. The name is case insensitive. - Required. - :type resource_group_name: str - :param image_name: The name of the image. Required. - :type image_name: str - :keyword expand: The expand expression to apply on the operation. Default value is None. - :paramtype expand: str - :return: Image. The Image is compatible with MutableMapping - :rtype: ~azure.mgmt.compute.models.Image - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[_models.Image] = kwargs.pop("cls", None) - - _request = build_images_get_request( - resource_group_name=resource_group_name, - image_name=image_name, - subscription_id=self._config.subscription_id, - expand=expand, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = kwargs.pop("stream", False) - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - if _stream: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.CloudError, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if _stream: - deserialized = response.iter_bytes() - else: - deserialized = _deserialize(_models.Image, response.json()) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - image_name: str, - parameters: Union[_models.Image, JSON, IO[bytes]], + vm_name: str, + run_command_name: str, + run_command: Union[_models.VirtualMachineRunCommand, JSON, IO[bytes]], **kwargs: Any ) -> AsyncIterator[bytes]: error_map: MutableMapping = { @@ -19728,14 +19358,15 @@ async def _create_or_update_initial( content_type = content_type or "application/json" _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters + if isinstance(run_command, (IOBase, bytes)): + _content = run_command else: - _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(run_command, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - _request = build_images_create_or_update_request( + _request = build_virtual_machine_run_commands_create_or_update_request( resource_group_name=resource_group_name, - image_name=image_name, + vm_name=vm_name, + run_command_name=run_command_name, subscription_id=self._config.subscription_id, content_type=content_type, api_version=self._config.api_version, @@ -19780,26 +19411,31 @@ async def _create_or_update_initial( async def begin_create_or_update( self, resource_group_name: str, - image_name: str, - parameters: _models.Image, + vm_name: str, + run_command_name: str, + run_command: _models.VirtualMachineRunCommand, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[None]: - """Create or update an image. + ) -> AsyncLROPoller[_models.VirtualMachineRunCommand]: + """The operation to create or update the run command. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param image_name: The name of the image. Required. - :type image_name: str - :param parameters: Parameters supplied to the Create Image operation. Required. - :type parameters: ~azure.mgmt.compute.models.Image + :param vm_name: The name of the VirtualMachine. Required. + :type vm_name: str + :param run_command_name: The name of the VirtualMachineRunCommand. Required. + :type run_command_name: str + :param run_command: Parameters supplied to the Create Virtual Machine RunCommand operation. + Required. + :type run_command: ~azure.mgmt.compute.models.VirtualMachineRunCommand :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns None - :rtype: ~azure.core.polling.AsyncLROPoller[None] + :return: An instance of AsyncLROPoller that returns VirtualMachineRunCommand. The + VirtualMachineRunCommand is compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.VirtualMachineRunCommand] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -19807,26 +19443,31 @@ async def begin_create_or_update( async def begin_create_or_update( self, resource_group_name: str, - image_name: str, - parameters: JSON, + vm_name: str, + run_command_name: str, + run_command: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[None]: - """Create or update an image. + ) -> AsyncLROPoller[_models.VirtualMachineRunCommand]: + """The operation to create or update the run command. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param image_name: The name of the image. Required. - :type image_name: str - :param parameters: Parameters supplied to the Create Image operation. Required. - :type parameters: JSON + :param vm_name: The name of the VirtualMachine. Required. + :type vm_name: str + :param run_command_name: The name of the VirtualMachineRunCommand. Required. + :type run_command_name: str + :param run_command: Parameters supplied to the Create Virtual Machine RunCommand operation. + Required. + :type run_command: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns None - :rtype: ~azure.core.polling.AsyncLROPoller[None] + :return: An instance of AsyncLROPoller that returns VirtualMachineRunCommand. The + VirtualMachineRunCommand is compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.VirtualMachineRunCommand] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -19834,26 +19475,31 @@ async def begin_create_or_update( async def begin_create_or_update( self, resource_group_name: str, - image_name: str, - parameters: IO[bytes], + vm_name: str, + run_command_name: str, + run_command: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[None]: - """Create or update an image. + ) -> AsyncLROPoller[_models.VirtualMachineRunCommand]: + """The operation to create or update the run command. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param image_name: The name of the image. Required. - :type image_name: str - :param parameters: Parameters supplied to the Create Image operation. Required. - :type parameters: IO[bytes] + :param vm_name: The name of the VirtualMachine. Required. + :type vm_name: str + :param run_command_name: The name of the VirtualMachineRunCommand. Required. + :type run_command_name: str + :param run_command: Parameters supplied to the Create Virtual Machine RunCommand operation. + Required. + :type run_command: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns None - :rtype: ~azure.core.polling.AsyncLROPoller[None] + :return: An instance of AsyncLROPoller that returns VirtualMachineRunCommand. The + VirtualMachineRunCommand is compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.VirtualMachineRunCommand] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -19861,37 +19507,42 @@ async def begin_create_or_update( async def begin_create_or_update( self, resource_group_name: str, - image_name: str, - parameters: Union[_models.Image, JSON, IO[bytes]], + vm_name: str, + run_command_name: str, + run_command: Union[_models.VirtualMachineRunCommand, JSON, IO[bytes]], **kwargs: Any - ) -> AsyncLROPoller[None]: - """Create or update an image. + ) -> AsyncLROPoller[_models.VirtualMachineRunCommand]: + """The operation to create or update the run command. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param image_name: The name of the image. Required. - :type image_name: str - :param parameters: Parameters supplied to the Create Image operation. Is one of the following - types: Image, JSON, IO[bytes] Required. - :type parameters: ~azure.mgmt.compute.models.Image or JSON or IO[bytes] - :return: An instance of AsyncLROPoller that returns None - :rtype: ~azure.core.polling.AsyncLROPoller[None] + :param vm_name: The name of the VirtualMachine. Required. + :type vm_name: str + :param run_command_name: The name of the VirtualMachineRunCommand. Required. + :type run_command_name: str + :param run_command: Parameters supplied to the Create Virtual Machine RunCommand operation. Is + one of the following types: VirtualMachineRunCommand, JSON, IO[bytes] Required. + :type run_command: ~azure.mgmt.compute.models.VirtualMachineRunCommand or JSON or IO[bytes] + :return: An instance of AsyncLROPoller that returns VirtualMachineRunCommand. The + VirtualMachineRunCommand is compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.VirtualMachineRunCommand] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[_models.VirtualMachineRunCommand] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = await self._create_or_update_initial( resource_group_name=resource_group_name, - image_name=image_name, - parameters=parameters, + vm_name=vm_name, + run_command_name=run_command_name, + run_command=run_command, content_type=content_type, cls=lambda x, y, z: x, headers=_headers, @@ -19901,9 +19552,12 @@ async def begin_create_or_update( await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.VirtualMachineRunCommand, response.json()) if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized path_format_arguments = { "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), @@ -19918,19 +19572,22 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return AsyncLROPoller[None].from_continuation_token( + return AsyncLROPoller[_models.VirtualMachineRunCommand].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + return AsyncLROPoller[_models.VirtualMachineRunCommand]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) async def _update_initial( self, resource_group_name: str, - image_name: str, - parameters: Union[_models.ImageUpdate, JSON, IO[bytes]], + vm_name: str, + run_command_name: str, + run_command: Union[_models.VirtualMachineRunCommandUpdate, JSON, IO[bytes]], **kwargs: Any ) -> AsyncIterator[bytes]: error_map: MutableMapping = { @@ -19949,14 +19606,15 @@ async def _update_initial( content_type = content_type or "application/json" _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters + if isinstance(run_command, (IOBase, bytes)): + _content = run_command else: - _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(run_command, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - _request = build_images_update_request( + _request = build_virtual_machine_run_commands_update_request( resource_group_name=resource_group_name, - image_name=image_name, + vm_name=vm_name, + run_command_name=run_command_name, subscription_id=self._config.subscription_id, content_type=content_type, api_version=self._config.api_version, @@ -19976,7 +19634,7 @@ async def _update_initial( response = pipeline_response.http_response - if response.status_code not in [200, 201]: + if response.status_code not in [200]: try: await response.read() # Load the body in memory and close the socket except (StreamConsumedError, StreamClosedError): @@ -19986,9 +19644,8 @@ async def _update_initial( raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} - if response.status_code == 201: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) deserialized = response.iter_bytes() @@ -20001,26 +19658,31 @@ async def _update_initial( async def begin_update( self, resource_group_name: str, - image_name: str, - parameters: _models.ImageUpdate, + vm_name: str, + run_command_name: str, + run_command: _models.VirtualMachineRunCommandUpdate, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[None]: - """Update an image. + ) -> AsyncLROPoller[_models.VirtualMachineRunCommand]: + """The operation to update the run command. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param image_name: The name of the image. Required. - :type image_name: str - :param parameters: Parameters supplied to the Update Image operation. Required. - :type parameters: ~azure.mgmt.compute.models.ImageUpdate + :param vm_name: The name of the VirtualMachine. Required. + :type vm_name: str + :param run_command_name: The name of the VirtualMachineRunCommand. Required. + :type run_command_name: str + :param run_command: Parameters supplied to the Update Virtual Machine RunCommand operation. + Required. + :type run_command: ~azure.mgmt.compute.models.VirtualMachineRunCommandUpdate :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns None - :rtype: ~azure.core.polling.AsyncLROPoller[None] + :return: An instance of AsyncLROPoller that returns VirtualMachineRunCommand. The + VirtualMachineRunCommand is compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.VirtualMachineRunCommand] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -20028,26 +19690,31 @@ async def begin_update( async def begin_update( self, resource_group_name: str, - image_name: str, - parameters: JSON, + vm_name: str, + run_command_name: str, + run_command: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[None]: - """Update an image. + ) -> AsyncLROPoller[_models.VirtualMachineRunCommand]: + """The operation to update the run command. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param image_name: The name of the image. Required. - :type image_name: str - :param parameters: Parameters supplied to the Update Image operation. Required. - :type parameters: JSON + :param vm_name: The name of the VirtualMachine. Required. + :type vm_name: str + :param run_command_name: The name of the VirtualMachineRunCommand. Required. + :type run_command_name: str + :param run_command: Parameters supplied to the Update Virtual Machine RunCommand operation. + Required. + :type run_command: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns None - :rtype: ~azure.core.polling.AsyncLROPoller[None] + :return: An instance of AsyncLROPoller that returns VirtualMachineRunCommand. The + VirtualMachineRunCommand is compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.VirtualMachineRunCommand] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -20055,26 +19722,31 @@ async def begin_update( async def begin_update( self, resource_group_name: str, - image_name: str, - parameters: IO[bytes], + vm_name: str, + run_command_name: str, + run_command: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[None]: - """Update an image. + ) -> AsyncLROPoller[_models.VirtualMachineRunCommand]: + """The operation to update the run command. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param image_name: The name of the image. Required. - :type image_name: str - :param parameters: Parameters supplied to the Update Image operation. Required. - :type parameters: IO[bytes] + :param vm_name: The name of the VirtualMachine. Required. + :type vm_name: str + :param run_command_name: The name of the VirtualMachineRunCommand. Required. + :type run_command_name: str + :param run_command: Parameters supplied to the Update Virtual Machine RunCommand operation. + Required. + :type run_command: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns None - :rtype: ~azure.core.polling.AsyncLROPoller[None] + :return: An instance of AsyncLROPoller that returns VirtualMachineRunCommand. The + VirtualMachineRunCommand is compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.VirtualMachineRunCommand] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -20082,37 +19754,43 @@ async def begin_update( async def begin_update( self, resource_group_name: str, - image_name: str, - parameters: Union[_models.ImageUpdate, JSON, IO[bytes]], + vm_name: str, + run_command_name: str, + run_command: Union[_models.VirtualMachineRunCommandUpdate, JSON, IO[bytes]], **kwargs: Any - ) -> AsyncLROPoller[None]: - """Update an image. + ) -> AsyncLROPoller[_models.VirtualMachineRunCommand]: + """The operation to update the run command. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param image_name: The name of the image. Required. - :type image_name: str - :param parameters: Parameters supplied to the Update Image operation. Is one of the following - types: ImageUpdate, JSON, IO[bytes] Required. - :type parameters: ~azure.mgmt.compute.models.ImageUpdate or JSON or IO[bytes] - :return: An instance of AsyncLROPoller that returns None - :rtype: ~azure.core.polling.AsyncLROPoller[None] + :param vm_name: The name of the VirtualMachine. Required. + :type vm_name: str + :param run_command_name: The name of the VirtualMachineRunCommand. Required. + :type run_command_name: str + :param run_command: Parameters supplied to the Update Virtual Machine RunCommand operation. Is + one of the following types: VirtualMachineRunCommandUpdate, JSON, IO[bytes] Required. + :type run_command: ~azure.mgmt.compute.models.VirtualMachineRunCommandUpdate or JSON or + IO[bytes] + :return: An instance of AsyncLROPoller that returns VirtualMachineRunCommand. The + VirtualMachineRunCommand is compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.VirtualMachineRunCommand] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[_models.VirtualMachineRunCommand] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = await self._update_initial( resource_group_name=resource_group_name, - image_name=image_name, - parameters=parameters, + vm_name=vm_name, + run_command_name=run_command_name, + run_command=run_command, content_type=content_type, cls=lambda x, y, z: x, headers=_headers, @@ -20122,9 +19800,16 @@ async def begin_update( await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = _deserialize(_models.VirtualMachineRunCommand, response.json()) if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore + return deserialized path_format_arguments = { "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), @@ -20139,15 +19824,19 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return AsyncLROPoller[None].from_continuation_token( + return AsyncLROPoller[_models.VirtualMachineRunCommand].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + return AsyncLROPoller[_models.VirtualMachineRunCommand]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) - async def _delete_initial(self, resource_group_name: str, image_name: str, **kwargs: Any) -> AsyncIterator[bytes]: + async def _delete_initial( + self, resource_group_name: str, vm_name: str, run_command_name: str, **kwargs: Any + ) -> AsyncIterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -20161,9 +19850,10 @@ async def _delete_initial(self, resource_group_name: str, image_name: str, **kwa cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - _request = build_images_delete_request( + _request = build_virtual_machine_run_commands_delete_request( resource_group_name=resource_group_name, - image_name=image_name, + vm_name=vm_name, + run_command_name=run_command_name, subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -20203,14 +19893,18 @@ async def _delete_initial(self, resource_group_name: str, image_name: str, **kwa return deserialized # type: ignore @distributed_trace_async - async def begin_delete(self, resource_group_name: str, image_name: str, **kwargs: Any) -> AsyncLROPoller[None]: - """Deletes an Image. + async def begin_delete( + 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. The name is case insensitive. Required. :type resource_group_name: str - :param image_name: The name of the image. Required. - :type image_name: str + :param vm_name: The name of the VirtualMachine. Required. + :type vm_name: str + :param run_command_name: The name of the VirtualMachineRunCommand. Required. + :type run_command_name: str :return: An instance of AsyncLROPoller that returns None :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -20225,7 +19919,8 @@ async def begin_delete(self, resource_group_name: str, image_name: str, **kwargs if cont_token is None: raw_result = await self._delete_initial( resource_group_name=resource_group_name, - image_name=image_name, + vm_name=vm_name, + run_command_name=run_command_name, cls=lambda x, y, z: x, headers=_headers, params=_params, @@ -20260,21 +19955,27 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore @distributed_trace - def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> AsyncItemPaged["_models.Image"]: - """Gets the list of images under a resource group. Use nextLink property in the response to get - the next page of Images. Do this till nextLink is null to fetch all the Images. + def list_by_virtual_machine( + self, resource_group_name: str, vm_name: str, *, expand: Optional[str] = None, **kwargs: Any + ) -> AsyncItemPaged["_models.VirtualMachineRunCommand"]: + """The operation to get all run commands of a Virtual Machine. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :return: An iterator like instance of Image - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.models.Image] + :param vm_name: The name of the VirtualMachine. Required. + :type vm_name: str + :keyword expand: The expand expression to apply on the operation. Default value is None. + :paramtype expand: str + :return: An iterator like instance of VirtualMachineRunCommand + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.models.VirtualMachineRunCommand] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.Image]] = kwargs.pop("cls", None) + cls: ClsType[List[_models.VirtualMachineRunCommand]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -20287,9 +19988,11 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Asy def prepare_request(next_link=None): if not next_link: - _request = build_images_list_by_resource_group_request( + _request = build_virtual_machine_run_commands_list_by_virtual_machine_request( resource_group_name=resource_group_name, + vm_name=vm_name, subscription_id=self._config.subscription_id, + expand=expand, api_version=self._config.api_version, headers=_headers, params=_params, @@ -20325,7 +20028,7 @@ def prepare_request(next_link=None): async def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.Image], deserialized.get("value", [])) + list_of_elem = _deserialize(List[_models.VirtualMachineRunCommand], deserialized.get("value", [])) if cls: list_of_elem = cls(list_of_elem) # type: ignore return deserialized.get("nextLink") or None, AsyncList(list_of_elem) @@ -20349,18 +20052,20 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) @distributed_trace - def list(self, **kwargs: Any) -> AsyncItemPaged["_models.Image"]: - """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. + def list(self, location: str, **kwargs: Any) -> AsyncItemPaged["_models.RunCommandDocumentBase"]: + """Lists all available run commands for a subscription in a location. - :return: An iterator like instance of Image - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.models.Image] + :param location: The location name. Required. + :type location: str + :return: An iterator like instance of RunCommandDocumentBase + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.models.RunCommandDocumentBase] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.Image]] = kwargs.pop("cls", None) + cls: ClsType[List[_models.RunCommandDocumentBase]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -20373,7 +20078,8 @@ def list(self, **kwargs: Any) -> AsyncItemPaged["_models.Image"]: def prepare_request(next_link=None): if not next_link: - _request = build_images_list_request( + _request = build_virtual_machine_run_commands_list_request( + location=location, subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -20410,7 +20116,7 @@ def prepare_request(next_link=None): async def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.Image], deserialized.get("value", [])) + list_of_elem = _deserialize(List[_models.RunCommandDocumentBase], deserialized.get("value", [])) if cls: list_of_elem = cls(list_of_elem) # type: ignore return deserialized.get("nextLink") or None, AsyncList(list_of_elem) @@ -20433,15 +20139,84 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) + @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. -class RestorePointCollectionsOperations: + :param location: The name of the Azure region. Required. + :type location: str + :param command_id: Specifies a commandId of predefined built-in script. Command IDs available + for Linux are listed at `https://aka.ms/RunCommandManagedLinux#available-commands + `_, Windows at + `https://aka.ms/RunCommandManagedWindows#available-commands + `_. Required. + :type command_id: str + :return: RunCommandDocument. The RunCommandDocument is compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.RunCommandDocument + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.RunCommandDocument] = kwargs.pop("cls", None) + + _request = build_virtual_machine_run_commands_get_request( + location=location, + command_id=command_id, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.RunCommandDocument, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + +class VirtualMachineScaleSetVMRunCommandsOperations: # pylint: disable=name-too-long """ .. warning:: **DO NOT** instantiate this class directly. Instead, you should access the following operations through :class:`~azure.mgmt.compute.aio.ComputeClient`'s - :attr:`restore_point_collections` attribute. + :attr:`virtual_machine_scale_set_vm_run_commands` attribute. """ def __init__(self, *args, **kwargs) -> None: @@ -20455,24 +20230,29 @@ def __init__(self, *args, **kwargs) -> None: async def get( self, resource_group_name: str, - restore_point_collection_name: str, + vm_scale_set_name: str, + instance_id: str, + run_command_name: str, *, - expand: Optional[Union[str, _models.RestorePointCollectionExpandOptions]] = None, + expand: Optional[str] = None, **kwargs: Any - ) -> _models.RestorePointCollection: - """The operation to get the restore point collection. + ) -> _models.VirtualMachineRunCommand: + """The operation to get the VMSS VM run command. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param restore_point_collection_name: The name of the restore point collection. Required. - :type restore_point_collection_name: str - :keyword expand: The expand expression to apply on the operation. If expand=restorePoints, - server will return all contained restore points in the restorePointCollection. "restorePoints" - Default value is None. - :paramtype expand: str or ~azure.mgmt.compute.models.RestorePointCollectionExpandOptions - :return: RestorePointCollection. The RestorePointCollection is compatible with MutableMapping - :rtype: ~azure.mgmt.compute.models.RestorePointCollection + :param vm_scale_set_name: The name of the VirtualMachineScaleSet. Required. + :type vm_scale_set_name: str + :param instance_id: The name of the VirtualMachineScaleSetVM. Required. + :type instance_id: str + :param run_command_name: The name of the VirtualMachineRunCommand. Required. + :type run_command_name: str + :keyword expand: The expand expression to apply on the operation. Default value is None. + :paramtype expand: str + :return: VirtualMachineRunCommand. The VirtualMachineRunCommand is compatible with + MutableMapping + :rtype: ~azure.mgmt.compute.models.VirtualMachineRunCommand :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -20486,11 +20266,13 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.RestorePointCollection] = kwargs.pop("cls", None) + cls: ClsType[_models.VirtualMachineRunCommand] = kwargs.pop("cls", None) - _request = build_restore_point_collections_get_request( + _request = build_virtual_machine_scale_set_vm_run_commands_get_request( resource_group_name=resource_group_name, - restore_point_collection_name=restore_point_collection_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + run_command_name=run_command_name, subscription_id=self._config.subscription_id, expand=expand, api_version=self._config.api_version, @@ -20522,127 +20304,22 @@ async def get( if _stream: deserialized = response.iter_bytes() else: - deserialized = _deserialize(_models.RestorePointCollection, response.json()) + deserialized = _deserialize(_models.VirtualMachineRunCommand, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - @overload - async def create_or_update( - self, - resource_group_name: str, - restore_point_collection_name: str, - parameters: _models.RestorePointCollection, - *, - content_type: str = "application/json", - **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. The name is case insensitive. - Required. - :type resource_group_name: str - :param restore_point_collection_name: The name of the restore point collection. Required. - :type restore_point_collection_name: str - :param parameters: Parameters supplied to the Create or Update restore point collection - operation. Required. - :type parameters: ~azure.mgmt.compute.models.RestorePointCollection - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: RestorePointCollection. The RestorePointCollection is compatible with MutableMapping - :rtype: ~azure.mgmt.compute.models.RestorePointCollection - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def create_or_update( - self, - resource_group_name: str, - restore_point_collection_name: str, - parameters: JSON, - *, - content_type: str = "application/json", - **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. The name is case insensitive. - Required. - :type resource_group_name: str - :param restore_point_collection_name: The name of the restore point collection. Required. - :type restore_point_collection_name: str - :param parameters: Parameters supplied to the Create or Update restore point collection - operation. Required. - :type parameters: JSON - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: RestorePointCollection. The RestorePointCollection is compatible with MutableMapping - :rtype: ~azure.mgmt.compute.models.RestorePointCollection - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def create_or_update( - self, - resource_group_name: str, - restore_point_collection_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **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. The name is case insensitive. - Required. - :type resource_group_name: str - :param restore_point_collection_name: The name of the restore point collection. Required. - :type restore_point_collection_name: str - :param parameters: Parameters supplied to the Create or Update restore point collection - operation. Required. - :type parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: RestorePointCollection. The RestorePointCollection is compatible with MutableMapping - :rtype: ~azure.mgmt.compute.models.RestorePointCollection - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def create_or_update( + async def _create_or_update_initial( self, resource_group_name: str, - restore_point_collection_name: str, - parameters: Union[_models.RestorePointCollection, JSON, IO[bytes]], + vm_scale_set_name: str, + instance_id: str, + run_command_name: str, + run_command: Union[_models.VirtualMachineRunCommand, JSON, IO[bytes]], **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. The name is case insensitive. - Required. - :type resource_group_name: str - :param restore_point_collection_name: The name of the restore point collection. Required. - :type restore_point_collection_name: str - :param parameters: Parameters supplied to the Create or Update restore point collection - operation. Is one of the following types: RestorePointCollection, JSON, IO[bytes] Required. - :type parameters: ~azure.mgmt.compute.models.RestorePointCollection or JSON or IO[bytes] - :return: RestorePointCollection. The RestorePointCollection is compatible with MutableMapping - :rtype: ~azure.mgmt.compute.models.RestorePointCollection - :raises ~azure.core.exceptions.HttpResponseError: - """ + ) -> AsyncIterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -20655,18 +20332,20 @@ async def create_or_update( _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.RestorePointCollection] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters + if isinstance(run_command, (IOBase, bytes)): + _content = run_command else: - _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(run_command, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - _request = build_restore_point_collections_create_or_update_request( + _request = build_virtual_machine_scale_set_vm_run_commands_create_or_update_request( resource_group_name=resource_group_name, - restore_point_collection_name=restore_point_collection_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + run_command_name=run_command_name, subscription_id=self._config.subscription_id, content_type=content_type, api_version=self._config.api_version, @@ -20679,7 +20358,7 @@ async def create_or_update( } _request.url = self._client.format_url(_request.url, **path_format_arguments) - _stream = kwargs.pop("stream", False) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -20687,131 +20366,223 @@ async def create_or_update( response = pipeline_response.http_response if response.status_code not in [200, 201]: - if _stream: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = _failsafe_deserialize(_models.CloudError, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if _stream: - deserialized = response.iter_bytes() - else: - deserialized = _deserialize(_models.RestorePointCollection, response.json()) + response_headers = {} + if response.status_code == 201: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore @overload - async def update( + async def begin_create_or_update( self, resource_group_name: str, - restore_point_collection_name: str, - parameters: _models.RestorePointCollectionUpdate, + vm_scale_set_name: str, + instance_id: str, + run_command_name: str, + run_command: _models.VirtualMachineRunCommand, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.RestorePointCollection: - """The operation to update the restore point collection. + ) -> AsyncLROPoller[_models.VirtualMachineRunCommand]: + """The operation to create or update the VMSS VM run command. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param restore_point_collection_name: The name of the restore point collection. Required. - :type restore_point_collection_name: str - :param parameters: Parameters supplied to the Update restore point collection operation. + :param vm_scale_set_name: The name of the VirtualMachineScaleSet. Required. + :type vm_scale_set_name: str + :param instance_id: The name of the VirtualMachineScaleSetVM. Required. + :type instance_id: str + :param run_command_name: The name of the VirtualMachineRunCommand. Required. + :type run_command_name: str + :param run_command: Parameters supplied to the Create Virtual Machine RunCommand operation. Required. - :type parameters: ~azure.mgmt.compute.models.RestorePointCollectionUpdate + :type run_command: ~azure.mgmt.compute.models.VirtualMachineRunCommand :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: RestorePointCollection. The RestorePointCollection is compatible with MutableMapping - :rtype: ~azure.mgmt.compute.models.RestorePointCollection + :return: An instance of AsyncLROPoller that returns VirtualMachineRunCommand. The + VirtualMachineRunCommand is compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.VirtualMachineRunCommand] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - async def update( + async def begin_create_or_update( self, resource_group_name: str, - restore_point_collection_name: str, - parameters: JSON, + vm_scale_set_name: str, + instance_id: str, + run_command_name: str, + run_command: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.RestorePointCollection: - """The operation to update the restore point collection. + ) -> AsyncLROPoller[_models.VirtualMachineRunCommand]: + """The operation to create or update the VMSS VM run command. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param restore_point_collection_name: The name of the restore point collection. Required. - :type restore_point_collection_name: str - :param parameters: Parameters supplied to the Update restore point collection operation. + :param vm_scale_set_name: The name of the VirtualMachineScaleSet. Required. + :type vm_scale_set_name: str + :param instance_id: The name of the VirtualMachineScaleSetVM. Required. + :type instance_id: str + :param run_command_name: The name of the VirtualMachineRunCommand. Required. + :type run_command_name: str + :param run_command: Parameters supplied to the Create Virtual Machine RunCommand operation. Required. - :type parameters: JSON + :type run_command: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: RestorePointCollection. The RestorePointCollection is compatible with MutableMapping - :rtype: ~azure.mgmt.compute.models.RestorePointCollection + :return: An instance of AsyncLROPoller that returns VirtualMachineRunCommand. The + VirtualMachineRunCommand is compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.VirtualMachineRunCommand] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - async def update( + async def begin_create_or_update( self, resource_group_name: str, - restore_point_collection_name: str, - parameters: IO[bytes], + vm_scale_set_name: str, + instance_id: str, + run_command_name: str, + run_command: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> _models.RestorePointCollection: - """The operation to update the restore point collection. + ) -> AsyncLROPoller[_models.VirtualMachineRunCommand]: + """The operation to create or update the VMSS VM run command. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param restore_point_collection_name: The name of the restore point collection. Required. - :type restore_point_collection_name: str - :param parameters: Parameters supplied to the Update restore point collection operation. + :param vm_scale_set_name: The name of the VirtualMachineScaleSet. Required. + :type vm_scale_set_name: str + :param instance_id: The name of the VirtualMachineScaleSetVM. Required. + :type instance_id: str + :param run_command_name: The name of the VirtualMachineRunCommand. Required. + :type run_command_name: str + :param run_command: Parameters supplied to the Create Virtual Machine RunCommand operation. Required. - :type parameters: IO[bytes] + :type run_command: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: RestorePointCollection. The RestorePointCollection is compatible with MutableMapping - :rtype: ~azure.mgmt.compute.models.RestorePointCollection + :return: An instance of AsyncLROPoller that returns VirtualMachineRunCommand. The + VirtualMachineRunCommand is compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.VirtualMachineRunCommand] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace_async - async def update( + async def begin_create_or_update( self, resource_group_name: str, - restore_point_collection_name: str, - parameters: Union[_models.RestorePointCollectionUpdate, JSON, IO[bytes]], + vm_scale_set_name: str, + instance_id: str, + run_command_name: str, + run_command: Union[_models.VirtualMachineRunCommand, JSON, IO[bytes]], **kwargs: Any - ) -> _models.RestorePointCollection: - """The operation to update the restore point collection. + ) -> AsyncLROPoller[_models.VirtualMachineRunCommand]: + """The operation to create or update the VMSS VM run command. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param restore_point_collection_name: The name of the restore point collection. Required. - :type restore_point_collection_name: str - :param parameters: Parameters supplied to the Update restore point collection operation. Is one - of the following types: RestorePointCollectionUpdate, JSON, IO[bytes] Required. - :type parameters: ~azure.mgmt.compute.models.RestorePointCollectionUpdate or JSON or IO[bytes] - :return: RestorePointCollection. The RestorePointCollection is compatible with MutableMapping - :rtype: ~azure.mgmt.compute.models.RestorePointCollection + :param vm_scale_set_name: The name of the VirtualMachineScaleSet. Required. + :type vm_scale_set_name: str + :param instance_id: The name of the VirtualMachineScaleSetVM. Required. + :type instance_id: str + :param run_command_name: The name of the VirtualMachineRunCommand. Required. + :type run_command_name: str + :param run_command: Parameters supplied to the Create Virtual Machine RunCommand operation. Is + one of the following types: VirtualMachineRunCommand, JSON, IO[bytes] Required. + :type run_command: ~azure.mgmt.compute.models.VirtualMachineRunCommand or JSON or IO[bytes] + :return: An instance of AsyncLROPoller that returns VirtualMachineRunCommand. The + VirtualMachineRunCommand is compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.VirtualMachineRunCommand] :raises ~azure.core.exceptions.HttpResponseError: """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.VirtualMachineRunCommand] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._create_or_update_initial( + resource_group_name=resource_group_name, + 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, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.VirtualMachineRunCommand, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.VirtualMachineRunCommand].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.VirtualMachineRunCommand]( + self._client, raw_result, get_long_running_output, polling_method # 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: Union[_models.VirtualMachineRunCommandUpdate, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -20824,18 +20595,20 @@ async def update( _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.RestorePointCollection] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters + if isinstance(run_command, (IOBase, bytes)): + _content = run_command else: - _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(run_command, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - _request = build_restore_point_collections_update_request( + _request = build_virtual_machine_scale_set_vm_run_commands_update_request( resource_group_name=resource_group_name, - restore_point_collection_name=restore_point_collection_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + run_command_name=run_command_name, subscription_id=self._config.subscription_id, content_type=content_type, api_version=self._config.api_version, @@ -20848,7 +20621,7 @@ async def update( } _request.url = self._client.format_url(_request.url, **path_format_arguments) - _stream = kwargs.pop("stream", False) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -20856,27 +20629,217 @@ async def update( response = pipeline_response.http_response if response.status_code not in [200]: - if _stream: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = _failsafe_deserialize(_models.CloudError, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if _stream: - deserialized = response.iter_bytes() - else: - deserialized = _deserialize(_models.RestorePointCollection, response.json()) + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore + @overload + 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: 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. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VirtualMachineScaleSet. Required. + :type vm_scale_set_name: str + :param instance_id: The name of the VirtualMachineScaleSetVM. Required. + :type instance_id: str + :param run_command_name: The name of the VirtualMachineRunCommand. Required. + :type run_command_name: str + :param run_command: Resource create parameters. Required. + :type run_command: ~azure.mgmt.compute.models.VirtualMachineRunCommandUpdate + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns VirtualMachineRunCommand. The + VirtualMachineRunCommand is compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.VirtualMachineRunCommand] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update( + self, + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + run_command_name: str, + run_command: JSON, + *, + content_type: 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. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VirtualMachineScaleSet. Required. + :type vm_scale_set_name: str + :param instance_id: The name of the VirtualMachineScaleSetVM. Required. + :type instance_id: str + :param run_command_name: The name of the VirtualMachineRunCommand. Required. + :type run_command_name: str + :param run_command: Resource create parameters. Required. + :type run_command: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns VirtualMachineRunCommand. The + VirtualMachineRunCommand is compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.VirtualMachineRunCommand] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update( + self, + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + run_command_name: str, + run_command: IO[bytes], + *, + content_type: 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. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VirtualMachineScaleSet. Required. + :type vm_scale_set_name: str + :param instance_id: The name of the VirtualMachineScaleSetVM. Required. + :type instance_id: str + :param run_command_name: The name of the VirtualMachineRunCommand. Required. + :type run_command_name: str + :param run_command: Resource create parameters. Required. + :type run_command: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns VirtualMachineRunCommand. The + VirtualMachineRunCommand is compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.VirtualMachineRunCommand] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @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: Union[_models.VirtualMachineRunCommandUpdate, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.VirtualMachineRunCommand]: + """The operation to update the VMSS VM run command. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VirtualMachineScaleSet. Required. + :type vm_scale_set_name: str + :param instance_id: The name of the VirtualMachineScaleSetVM. Required. + :type instance_id: str + :param run_command_name: The name of the VirtualMachineRunCommand. Required. + :type run_command_name: str + :param run_command: Resource create parameters. Is one of the following types: + VirtualMachineRunCommandUpdate, JSON, IO[bytes] Required. + :type run_command: ~azure.mgmt.compute.models.VirtualMachineRunCommandUpdate or JSON or + IO[bytes] + :return: An instance of AsyncLROPoller that returns VirtualMachineRunCommand. The + VirtualMachineRunCommand is compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.VirtualMachineRunCommand] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.VirtualMachineRunCommand] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._update_initial( + resource_group_name=resource_group_name, + 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, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = _deserialize(_models.VirtualMachineRunCommand, response.json()) + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.VirtualMachineRunCommand].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.VirtualMachineRunCommand]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + async def _delete_initial( - self, resource_group_name: str, restore_point_collection_name: str, **kwargs: Any + self, resource_group_name: str, vm_scale_set_name: str, instance_id: str, run_command_name: str, **kwargs: Any ) -> AsyncIterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -20891,9 +20854,11 @@ async def _delete_initial( cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - _request = build_restore_point_collections_delete_request( + _request = build_virtual_machine_scale_set_vm_run_commands_delete_request( resource_group_name=resource_group_name, - restore_point_collection_name=restore_point_collection_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=self._config.api_version, headers=_headers, @@ -20934,16 +20899,19 @@ async def _delete_initial( @distributed_trace_async async def begin_delete( - self, resource_group_name: str, restore_point_collection_name: str, **kwargs: Any + 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 restore point collection. This operation will also delete all the - contained restore points. + """The operation to delete the VMSS VM run command. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param restore_point_collection_name: The name of the restore point collection. Required. - :type restore_point_collection_name: str + :param vm_scale_set_name: The name of the VirtualMachineScaleSet. Required. + :type vm_scale_set_name: str + :param instance_id: The name of the VirtualMachineScaleSetVM. Required. + :type instance_id: str + :param run_command_name: The name of the VirtualMachineRunCommand. Required. + :type run_command_name: str :return: An instance of AsyncLROPoller that returns None :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -20958,7 +20926,9 @@ async def begin_delete( 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, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + run_command_name=run_command_name, cls=lambda x, y, z: x, headers=_headers, params=_params, @@ -20993,21 +20963,35 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore @distributed_trace - def list(self, resource_group_name: str, **kwargs: Any) -> AsyncItemPaged["_models.RestorePointCollection"]: - """Gets the list of restore point collections in a resource group. + def list( + self, + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + *, + expand: Optional[str] = None, + **kwargs: Any + ) -> AsyncItemPaged["_models.VirtualMachineRunCommand"]: + """The operation to get all run commands of an instance in Virtual Machine Scaleset. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :return: An iterator like instance of RestorePointCollection + :param vm_scale_set_name: The name of the VirtualMachineScaleSet. Required. + :type vm_scale_set_name: str + :param instance_id: The name of the VirtualMachineScaleSetVM. Required. + :type instance_id: str + :keyword expand: The expand expression to apply on the operation. Default value is None. + :paramtype expand: str + :return: An iterator like instance of VirtualMachineRunCommand :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.models.RestorePointCollection] + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.models.VirtualMachineRunCommand] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.RestorePointCollection]] = kwargs.pop("cls", None) + cls: ClsType[List[_models.VirtualMachineRunCommand]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -21020,9 +21004,12 @@ def list(self, resource_group_name: str, **kwargs: Any) -> AsyncItemPaged["_mode def prepare_request(next_link=None): if not next_link: - _request = build_restore_point_collections_list_request( + _request = build_virtual_machine_scale_set_vm_run_commands_list_request( resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, subscription_id=self._config.subscription_id, + expand=expand, api_version=self._config.api_version, headers=_headers, params=_params, @@ -21058,94 +21045,7 @@ def prepare_request(next_link=None): async def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.RestorePointCollection], deserialized.get("value", [])) - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.get("nextLink") or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.CloudError, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @distributed_trace - def list_all(self, **kwargs: Any) -> AsyncItemPaged["_models.RestorePointCollection"]: - """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. - - :return: An iterator like instance of RestorePointCollection - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.models.RestorePointCollection] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[List[_models.RestorePointCollection]] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_restore_point_collections_list_all_request( - subscription_id=self._config.subscription_id, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - return _request - - async def extract_data(pipeline_response): - deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.RestorePointCollection], deserialized.get("value", [])) + list_of_elem = _deserialize(List[_models.VirtualMachineRunCommand], deserialized.get("value", [])) if cls: list_of_elem = cls(list_of_elem) # type: ignore return deserialized.get("nextLink") or None, AsyncList(list_of_elem) @@ -21169,14 +21069,14 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) -class RestorePointsOperations: +class DisksOperations: """ .. warning:: **DO NOT** instantiate this class directly. Instead, you should access the following operations through :class:`~azure.mgmt.compute.aio.ComputeClient`'s - :attr:`restore_points` attribute. + :attr:`disks` attribute. """ def __init__(self, *args, **kwargs) -> None: @@ -21187,29 +21087,18 @@ def __init__(self, *args, **kwargs) -> None: self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @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. + async def get(self, resource_group_name: str, disk_name: str, **kwargs: Any) -> _models.Disk: + """Gets information about a disk. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param restore_point_collection_name: The name of the restore point collection. Required. - :type restore_point_collection_name: str - :param restore_point_name: The name of the restore point. Required. - :type restore_point_name: str - :keyword expand: The expand expression to apply on the operation. 'InstanceView' retrieves - information about the run-time state of a restore point. "instanceView" Default value is None. - :paramtype expand: str or ~azure.mgmt.compute.models.RestorePointExpandOptions - :return: RestorePoint. The RestorePoint is compatible with MutableMapping - :rtype: ~azure.mgmt.compute.models.RestorePoint + :param disk_name: The name of the managed disk that is being created. The name can't be changed + after the disk is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The + maximum name length is 80 characters. Required. + :type disk_name: str + :return: Disk. The Disk is compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.Disk :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -21223,14 +21112,12 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.RestorePoint] = kwargs.pop("cls", None) + cls: ClsType[_models.Disk] = kwargs.pop("cls", None) - _request = build_restore_points_get_request( + _request = build_disks_get_request( resource_group_name=resource_group_name, - restore_point_collection_name=restore_point_collection_name, - restore_point_name=restore_point_name, + disk_name=disk_name, subscription_id=self._config.subscription_id, - expand=expand, api_version=self._config.api_version, headers=_headers, params=_params, @@ -21260,20 +21147,15 @@ async def get( if _stream: deserialized = response.iter_bytes() else: - deserialized = _deserialize(_models.RestorePoint, response.json()) + deserialized = _deserialize(_models.Disk, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - async def _create_initial( - self, - resource_group_name: str, - restore_point_collection_name: str, - restore_point_name: str, - parameters: Union[_models.RestorePoint, JSON, IO[bytes]], - **kwargs: Any + async def _create_or_update_initial( + self, resource_group_name: str, disk_name: str, disk: Union[_models.Disk, JSON, IO[bytes]], **kwargs: Any ) -> AsyncIterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -21291,15 +21173,14 @@ async def _create_initial( content_type = content_type or "application/json" _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters + if isinstance(disk, (IOBase, bytes)): + _content = disk else: - _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(disk, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - _request = build_restore_points_create_request( + _request = build_disks_create_or_update_request( resource_group_name=resource_group_name, - restore_point_collection_name=restore_point_collection_name, - restore_point_name=restore_point_name, + disk_name=disk_name, subscription_id=self._config.subscription_id, content_type=content_type, api_version=self._config.api_version, @@ -21319,7 +21200,7 @@ async def _create_initial( response = pipeline_response.http_response - if response.status_code not in [201]: + if response.status_code not in [200, 202]: try: await response.read() # Load the body in memory and close the socket except (StreamConsumedError, StreamClosedError): @@ -21329,8 +21210,9 @@ async def _create_initial( raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) deserialized = response.iter_bytes() @@ -21340,138 +21222,129 @@ async def _create_initial( return deserialized # type: ignore @overload - async def begin_create( + async def begin_create_or_update( self, resource_group_name: str, - restore_point_collection_name: str, - restore_point_name: str, - parameters: _models.RestorePoint, + disk_name: str, + disk: _models.Disk, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[None]: - """The operation to create the restore point. Updating properties of an existing restore point is - not allowed. + ) -> AsyncLROPoller[_models.Disk]: + """Creates or updates a disk. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param restore_point_collection_name: The name of the restore point collection. Required. - :type restore_point_collection_name: str - :param restore_point_name: The name of the restore point. Required. - :type restore_point_name: str - :param parameters: Parameters supplied to the Create restore point operation. Required. - :type parameters: ~azure.mgmt.compute.models.RestorePoint + :param disk_name: The name of the managed disk that is being created. The name can't be changed + after the disk is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The + maximum name length is 80 characters. Required. + :type disk_name: str + :param disk: Disk object supplied in the body of the Put disk operation. Required. + :type disk: ~azure.mgmt.compute.models.Disk :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns None - :rtype: ~azure.core.polling.AsyncLROPoller[None] + :return: An instance of AsyncLROPoller that returns Disk. The Disk is compatible with + MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.Disk] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - async def begin_create( + async def begin_create_or_update( self, resource_group_name: str, - restore_point_collection_name: str, - restore_point_name: str, - parameters: JSON, + disk_name: str, + disk: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[None]: - """The operation to create the restore point. Updating properties of an existing restore point is - not allowed. + ) -> AsyncLROPoller[_models.Disk]: + """Creates or updates a disk. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param restore_point_collection_name: The name of the restore point collection. Required. - :type restore_point_collection_name: str - :param restore_point_name: The name of the restore point. Required. - :type restore_point_name: str - :param parameters: Parameters supplied to the Create restore point operation. Required. - :type parameters: JSON + :param disk_name: The name of the managed disk that is being created. The name can't be changed + after the disk is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The + maximum name length is 80 characters. Required. + :type disk_name: str + :param disk: Disk object supplied in the body of the Put disk operation. Required. + :type disk: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns None - :rtype: ~azure.core.polling.AsyncLROPoller[None] + :return: An instance of AsyncLROPoller that returns Disk. The Disk is compatible with + MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.Disk] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - async def begin_create( + async def begin_create_or_update( self, resource_group_name: str, - restore_point_collection_name: str, - restore_point_name: str, - parameters: IO[bytes], + disk_name: str, + disk: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[None]: - """The operation to create the restore point. Updating properties of an existing restore point is - not allowed. + ) -> AsyncLROPoller[_models.Disk]: + """Creates or updates a disk. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param restore_point_collection_name: The name of the restore point collection. Required. - :type restore_point_collection_name: str - :param restore_point_name: The name of the restore point. Required. - :type restore_point_name: str - :param parameters: Parameters supplied to the Create restore point operation. Required. - :type parameters: IO[bytes] + :param disk_name: The name of the managed disk that is being created. The name can't be changed + after the disk is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The + maximum name length is 80 characters. Required. + :type disk_name: str + :param disk: Disk object supplied in the body of the Put disk operation. Required. + :type disk: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns None - :rtype: ~azure.core.polling.AsyncLROPoller[None] + :return: An instance of AsyncLROPoller that returns Disk. The Disk is compatible with + MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.Disk] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace_async - async def begin_create( - self, - resource_group_name: str, - restore_point_collection_name: str, - restore_point_name: str, - parameters: Union[_models.RestorePoint, JSON, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[None]: - """The operation to create the restore point. Updating properties of an existing restore point is - not allowed. + async def begin_create_or_update( + self, resource_group_name: str, disk_name: str, disk: Union[_models.Disk, JSON, IO[bytes]], **kwargs: Any + ) -> AsyncLROPoller[_models.Disk]: + """Creates or updates a disk. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param restore_point_collection_name: The name of the restore point collection. Required. - :type restore_point_collection_name: str - :param restore_point_name: The name of the restore point. Required. - :type restore_point_name: str - :param parameters: Parameters supplied to the Create restore point operation. Is one of the - following types: RestorePoint, JSON, IO[bytes] Required. - :type parameters: ~azure.mgmt.compute.models.RestorePoint or JSON or IO[bytes] - :return: An instance of AsyncLROPoller that returns None - :rtype: ~azure.core.polling.AsyncLROPoller[None] + :param disk_name: The name of the managed disk that is being created. The name can't be changed + after the disk is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The + maximum name length is 80 characters. Required. + :type disk_name: str + :param disk: Disk object supplied in the body of the Put disk operation. Is one of the + following types: Disk, JSON, IO[bytes] Required. + :type disk: ~azure.mgmt.compute.models.Disk or JSON or IO[bytes] + :return: An instance of AsyncLROPoller that returns Disk. The Disk is compatible with + MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.Disk] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[_models.Disk] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._create_initial( + raw_result = await self._create_or_update_initial( resource_group_name=resource_group_name, - restore_point_collection_name=restore_point_collection_name, - restore_point_name=restore_point_name, - parameters=parameters, + disk_name=disk_name, + disk=disk, content_type=content_type, cls=lambda x, y, z: x, headers=_headers, @@ -21481,9 +21354,12 @@ async def begin_create( await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.Disk, response.json()) if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized path_format_arguments = { "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), @@ -21498,16 +21374,18 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return AsyncLROPoller[None].from_continuation_token( + return AsyncLROPoller[_models.Disk].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + return AsyncLROPoller[_models.Disk]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) - async def _delete_initial( - self, resource_group_name: str, restore_point_collection_name: str, restore_point_name: str, **kwargs: Any + async def _update_initial( + self, resource_group_name: str, disk_name: str, disk: Union[_models.DiskUpdate, JSON, IO[bytes]], **kwargs: Any ) -> AsyncIterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -21517,17 +21395,26 @@ async def _delete_initial( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - _request = build_restore_points_delete_request( + content_type = content_type or "application/json" + _content = None + if isinstance(disk, (IOBase, bytes)): + _content = disk + else: + _content = json.dumps(disk, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_disks_update_request( resource_group_name=resource_group_name, - restore_point_collection_name=restore_point_collection_name, - restore_point_name=restore_point_name, + disk_name=disk_name, subscription_id=self._config.subscription_id, + content_type=content_type, api_version=self._config.api_version, + content=_content, headers=_headers, params=_params, ) @@ -21543,7 +21430,7 @@ async def _delete_initial( response = pipeline_response.http_response - if response.status_code not in [200, 202, 204]: + if response.status_code not in [200, 202]: try: await response.read() # Load the body in memory and close the socket except (StreamConsumedError, StreamClosedError): @@ -21564,35 +21451,131 @@ async def _delete_initial( return deserialized # type: ignore + @overload + async def begin_update( + self, + resource_group_name: str, + disk_name: str, + disk: _models.DiskUpdate, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.Disk]: + """Updates (patches) a disk. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param disk_name: The name of the managed disk that is being created. The name can't be changed + after the disk is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The + maximum name length is 80 characters. Required. + :type disk_name: str + :param disk: Disk object supplied in the body of the Patch disk operation. Required. + :type disk: ~azure.mgmt.compute.models.DiskUpdate + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns Disk. The Disk is compatible with + MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.Disk] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update( + self, + resource_group_name: str, + disk_name: str, + disk: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.Disk]: + """Updates (patches) a disk. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param disk_name: The name of the managed disk that is being created. The name can't be changed + after the disk is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The + maximum name length is 80 characters. Required. + :type disk_name: str + :param disk: Disk object supplied in the body of the Patch disk operation. Required. + :type disk: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns Disk. The Disk is compatible with + MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.Disk] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update( + self, + resource_group_name: str, + disk_name: str, + disk: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.Disk]: + """Updates (patches) a disk. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param disk_name: The name of the managed disk that is being created. The name can't be changed + after the disk is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The + maximum name length is 80 characters. Required. + :type disk_name: str + :param disk: Disk object supplied in the body of the Patch disk operation. Required. + :type disk: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns Disk. The Disk is compatible with + MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.Disk] + :raises ~azure.core.exceptions.HttpResponseError: + """ + @distributed_trace_async - async def begin_delete( - 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. + async def begin_update( + self, resource_group_name: str, disk_name: str, disk: Union[_models.DiskUpdate, JSON, IO[bytes]], **kwargs: Any + ) -> AsyncLROPoller[_models.Disk]: + """Updates (patches) a disk. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param restore_point_collection_name: The name of the restore point collection. Required. - :type restore_point_collection_name: str - :param restore_point_name: The name of the restore point. Required. - :type restore_point_name: str - :return: An instance of AsyncLROPoller that returns None - :rtype: ~azure.core.polling.AsyncLROPoller[None] + :param disk_name: The name of the managed disk that is being created. The name can't be changed + after the disk is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The + maximum name length is 80 characters. Required. + :type disk_name: str + :param disk: Disk object supplied in the body of the Patch disk operation. Is one of the + following types: DiskUpdate, JSON, IO[bytes] Required. + :type disk: ~azure.mgmt.compute.models.DiskUpdate or JSON or IO[bytes] + :return: An instance of AsyncLROPoller that returns Disk. The Disk is compatible with + MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.Disk] :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = kwargs.pop("headers", {}) or {} + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - cls: ClsType[None] = kwargs.pop("cls", None) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Disk] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._delete_initial( + raw_result = await self._update_initial( resource_group_name=resource_group_name, - restore_point_collection_name=restore_point_collection_name, - restore_point_name=restore_point_name, + disk_name=disk_name, + disk=disk, + content_type=content_type, cls=lambda x, y, z: x, headers=_headers, params=_params, @@ -21601,9 +21584,12 @@ async def begin_delete( await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.Disk, response.json()) if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized path_format_arguments = { "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), @@ -21618,59 +21604,17 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return AsyncLROPoller[None].from_continuation_token( + return AsyncLROPoller[_models.Disk].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - -class CapacityReservationGroupsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.compute.aio.ComputeClient`'s - :attr:`capacity_reservation_groups` attribute. - """ - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ComputeClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @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. + return AsyncLROPoller[_models.Disk]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param capacity_reservation_group_name: The name of the capacity reservation group. Required. - :type capacity_reservation_group_name: str - :keyword 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. "instanceView" Default value is - None. - :paramtype expand: str or ~azure.mgmt.compute.models.CapacityReservationGroupInstanceViewTypes - :return: CapacityReservationGroup. The CapacityReservationGroup is compatible with - MutableMapping - :rtype: ~azure.mgmt.compute.models.CapacityReservationGroup - :raises ~azure.core.exceptions.HttpResponseError: - """ + async def _delete_initial(self, resource_group_name: str, disk_name: str, **kwargs: Any) -> AsyncIterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -21682,13 +21626,12 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.CapacityReservationGroup] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - _request = build_capacity_reservation_groups_get_request( + _request = build_disks_delete_request( resource_group_name=resource_group_name, - capacity_reservation_group_name=capacity_reservation_group_name, + disk_name=disk_name, subscription_id=self._config.subscription_id, - expand=expand, api_version=self._config.api_version, headers=_headers, params=_params, @@ -21698,148 +21641,109 @@ async def get( } _request.url = self._client.format_url(_request.url, **path_format_arguments) - _stream = kwargs.pop("stream", False) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200]: - if _stream: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass + if response.status_code not in [200, 202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = _failsafe_deserialize(_models.CloudError, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if _stream: - deserialized = response.iter_bytes() - else: - deserialized = _deserialize(_models.CapacityReservationGroup, response.json()) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore - @overload - async def create_or_update( - self, - resource_group_name: str, - capacity_reservation_group_name: str, - parameters: _models.CapacityReservationGroup, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.CapacityReservationGroup: - """The operation to create or update a capacity reservation group. When updating a capacity - reservation group, only tags and sharing profile may be modified. Please refer to - `https://aka.ms/CapacityReservation `_ for more details. + @distributed_trace_async + async def begin_delete(self, resource_group_name: str, disk_name: str, **kwargs: Any) -> AsyncLROPoller[None]: + """Deletes a disk. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param capacity_reservation_group_name: The name of the capacity reservation group. Required. - :type capacity_reservation_group_name: str - :param parameters: Parameters supplied to the Create capacity reservation Group. Required. - :type parameters: ~azure.mgmt.compute.models.CapacityReservationGroup - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: CapacityReservationGroup. The CapacityReservationGroup is compatible with - MutableMapping - :rtype: ~azure.mgmt.compute.models.CapacityReservationGroup + :param disk_name: The name of the managed disk that is being created. The name can't be changed + after the disk is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The + maximum name length is 80 characters. Required. + :type disk_name: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} - @overload - async def create_or_update( - self, - resource_group_name: str, - capacity_reservation_group_name: str, - parameters: JSON, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.CapacityReservationGroup: - """The operation to create or update a capacity reservation group. When updating a capacity - reservation group, only tags and sharing profile may be modified. Please refer to - `https://aka.ms/CapacityReservation `_ for more details. + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + disk_name=disk_name, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param capacity_reservation_group_name: The name of the capacity reservation group. Required. - :type capacity_reservation_group_name: str - :param parameters: Parameters supplied to the Create capacity reservation Group. Required. - :type parameters: JSON - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: CapacityReservationGroup. The CapacityReservationGroup is compatible with - MutableMapping - :rtype: ~azure.mgmt.compute.models.CapacityReservationGroup - :raises ~azure.core.exceptions.HttpResponseError: - """ + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore - @overload - async def create_or_update( - self, - resource_group_name: str, - capacity_reservation_group_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.CapacityReservationGroup: - """The operation to create or update a capacity reservation group. When updating a capacity - reservation group, only tags and sharing profile may be modified. Please refer to - `https://aka.ms/CapacityReservation `_ for more details. + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param capacity_reservation_group_name: The name of the capacity reservation group. Required. - :type capacity_reservation_group_name: str - :param parameters: Parameters supplied to the Create capacity reservation Group. Required. - :type parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: CapacityReservationGroup. The CapacityReservationGroup is compatible with - MutableMapping - :rtype: ~azure.mgmt.compute.models.CapacityReservationGroup - :raises ~azure.core.exceptions.HttpResponseError: - """ + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - @distributed_trace_async - async def create_or_update( - self, - resource_group_name: str, - capacity_reservation_group_name: str, - parameters: Union[_models.CapacityReservationGroup, JSON, IO[bytes]], - **kwargs: Any - ) -> _models.CapacityReservationGroup: - """The operation to create or update a capacity reservation group. When updating a capacity - reservation group, only tags and sharing profile may be modified. Please refer to - `https://aka.ms/CapacityReservation `_ for more details. + @distributed_trace + def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> AsyncItemPaged["_models.Disk"]: + """Lists all the disks under a resource group. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param capacity_reservation_group_name: The name of the capacity reservation group. Required. - :type capacity_reservation_group_name: str - :param parameters: Parameters supplied to the Create capacity reservation Group. Is one of the - following types: CapacityReservationGroup, JSON, IO[bytes] Required. - :type parameters: ~azure.mgmt.compute.models.CapacityReservationGroup or JSON or IO[bytes] - :return: CapacityReservationGroup. The CapacityReservationGroup is compatible with - MutableMapping - :rtype: ~azure.mgmt.compute.models.CapacityReservationGroup + :return: An iterator like instance of Disk + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.models.Disk] :raises ~azure.core.exceptions.HttpResponseError: """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.Disk]] = kwargs.pop("cls", None) + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -21848,432 +21752,82 @@ async def create_or_update( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} + def prepare_request(next_link=None): + if not next_link: - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CapacityReservationGroup] = kwargs.pop("cls", None) + _request = build_disks_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) - content_type = content_type or "application/json" - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) - _request = build_capacity_reservation_groups_create_or_update_request( - resource_group_name=resource_group_name, - capacity_reservation_group_name=capacity_reservation_group_name, - subscription_id=self._config.subscription_id, - content_type=content_type, - api_version=self._config.api_version, - content=_content, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) + return _request - _stream = kwargs.pop("stream", False) - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.Disk], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) - response = pipeline_response.http_response + async def get_next(next_link=None): + _request = prepare_request(next_link) - if response.status_code not in [200, 201]: - if _stream: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.CloudError, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response - if _stream: - deserialized = response.iter_bytes() - else: - deserialized = _deserialize(_models.CapacityReservationGroup, response.json()) + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return pipeline_response - return deserialized # type: ignore - - @overload - async def update( - self, - resource_group_name: str, - capacity_reservation_group_name: str, - parameters: _models.CapacityReservationGroupUpdate, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.CapacityReservationGroup: - """The operation to update a capacity reservation group. When updating a capacity reservation - group, only tags and sharing profile may be modified. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param capacity_reservation_group_name: The name of the capacity reservation group. Required. - :type capacity_reservation_group_name: str - :param parameters: Parameters supplied to the Update capacity reservation Group operation. - Required. - :type parameters: ~azure.mgmt.compute.models.CapacityReservationGroupUpdate - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: CapacityReservationGroup. The CapacityReservationGroup is compatible with - MutableMapping - :rtype: ~azure.mgmt.compute.models.CapacityReservationGroup - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def update( - self, - resource_group_name: str, - capacity_reservation_group_name: str, - parameters: JSON, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.CapacityReservationGroup: - """The operation to update a capacity reservation group. When updating a capacity reservation - group, only tags and sharing profile may be modified. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param capacity_reservation_group_name: The name of the capacity reservation group. Required. - :type capacity_reservation_group_name: str - :param parameters: Parameters supplied to the Update capacity reservation Group operation. - Required. - :type parameters: JSON - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: CapacityReservationGroup. The CapacityReservationGroup is compatible with - MutableMapping - :rtype: ~azure.mgmt.compute.models.CapacityReservationGroup - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def update( - self, - resource_group_name: str, - capacity_reservation_group_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.CapacityReservationGroup: - """The operation to update a capacity reservation group. When updating a capacity reservation - group, only tags and sharing profile may be modified. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param capacity_reservation_group_name: The name of the capacity reservation group. Required. - :type capacity_reservation_group_name: str - :param parameters: Parameters supplied to the Update capacity reservation Group operation. - Required. - :type parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: CapacityReservationGroup. The CapacityReservationGroup is compatible with - MutableMapping - :rtype: ~azure.mgmt.compute.models.CapacityReservationGroup - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def update( - self, - resource_group_name: str, - capacity_reservation_group_name: str, - parameters: Union[_models.CapacityReservationGroupUpdate, JSON, IO[bytes]], - **kwargs: Any - ) -> _models.CapacityReservationGroup: - """The operation to update a capacity reservation group. When updating a capacity reservation - group, only tags and sharing profile may be modified. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param capacity_reservation_group_name: The name of the capacity reservation group. Required. - :type capacity_reservation_group_name: str - :param parameters: Parameters supplied to the Update capacity reservation Group operation. Is - one of the following types: CapacityReservationGroupUpdate, JSON, IO[bytes] Required. - :type parameters: ~azure.mgmt.compute.models.CapacityReservationGroupUpdate or JSON or - IO[bytes] - :return: CapacityReservationGroup. The CapacityReservationGroup is compatible with - MutableMapping - :rtype: ~azure.mgmt.compute.models.CapacityReservationGroup - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} - - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CapacityReservationGroup] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - - _request = build_capacity_reservation_groups_update_request( - resource_group_name=resource_group_name, - capacity_reservation_group_name=capacity_reservation_group_name, - subscription_id=self._config.subscription_id, - content_type=content_type, - api_version=self._config.api_version, - content=_content, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = kwargs.pop("stream", False) - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - if _stream: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.CloudError, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if _stream: - deserialized = response.iter_bytes() - else: - deserialized = _deserialize(_models.CapacityReservationGroup, response.json()) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def delete(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. The name is case insensitive. - Required. - :type resource_group_name: str - :param capacity_reservation_group_name: The name of the capacity reservation group. Required. - :type capacity_reservation_group_name: str - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_capacity_reservation_groups_delete_request( - resource_group_name=resource_group_name, - capacity_reservation_group_name=capacity_reservation_group_name, - subscription_id=self._config.subscription_id, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.CloudError, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @distributed_trace - def list_by_resource_group( - self, - resource_group_name: str, - *, - expand: Optional[Union[str, _models.ExpandTypesForGetCapacityReservationGroups]] = None, - **kwargs: Any - ) -> AsyncItemPaged["_models.CapacityReservationGroup"]: - """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. The name is case insensitive. - Required. - :type resource_group_name: str - :keyword 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. Known values are: - "virtualMachineScaleSetVMs/$ref" and "virtualMachines/$ref". Default value is None. - :paramtype expand: str or ~azure.mgmt.compute.models.ExpandTypesForGetCapacityReservationGroups - :return: An iterator like instance of CapacityReservationGroup - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.models.CapacityReservationGroup] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[List[_models.CapacityReservationGroup]] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_capacity_reservation_groups_list_by_resource_group_request( - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - expand=expand, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - return _request - - async def extract_data(pipeline_response): - deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.CapacityReservationGroup], deserialized.get("value", [])) - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.get("nextLink") or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.CloudError, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) + return AsyncItemPaged(get_next, extract_data) @distributed_trace - def list_by_subscription( - self, - *, - expand: Optional[Union[str, _models.ExpandTypesForGetCapacityReservationGroups]] = None, - resource_ids_only: Optional[Union[str, _models.ResourceIdOptionsForGetCapacityReservationGroups]] = None, - **kwargs: Any - ) -> AsyncItemPaged["_models.CapacityReservationGroup"]: - """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. + def list(self, **kwargs: Any) -> AsyncItemPaged["_models.Disk"]: + """Lists all the disks under a subscription. - :keyword 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. Known values are: - "virtualMachineScaleSetVMs/$ref" and "virtualMachines/$ref". Default value is None. - :paramtype expand: str or ~azure.mgmt.compute.models.ExpandTypesForGetCapacityReservationGroups - :keyword resource_ids_only: The query option to fetch Capacity Reservation Group Resource Ids. -
'CreatedInSubscription' enables fetching Resource Ids for all capacity reservation group - resources created in the subscription.
'SharedWithSubscription' enables fetching Resource - Ids for all capacity reservation group resources shared with the subscription.
'All' - enables fetching Resource Ids for all capacity reservation group resources shared with the - subscription and created in the subscription. Known values are: "CreatedInSubscription", - "SharedWithSubscription", and "All". Default value is None. - :paramtype resource_ids_only: str or - ~azure.mgmt.compute.models.ResourceIdOptionsForGetCapacityReservationGroups - :return: An iterator like instance of CapacityReservationGroup - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.models.CapacityReservationGroup] + :return: An iterator like instance of Disk + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.models.Disk] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.CapacityReservationGroup]] = kwargs.pop("cls", None) + cls: ClsType[List[_models.Disk]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -22286,10 +21840,8 @@ def list_by_subscription( def prepare_request(next_link=None): if not next_link: - _request = build_capacity_reservation_groups_list_by_subscription_request( + _request = build_disks_list_request( subscription_id=self._config.subscription_id, - expand=expand, - resource_ids_only=resource_ids_only, api_version=self._config.api_version, headers=_headers, params=_params, @@ -22325,7 +21877,7 @@ def prepare_request(next_link=None): async def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.CapacityReservationGroup], deserialized.get("value", [])) + list_of_elem = _deserialize(List[_models.Disk], deserialized.get("value", [])) if cls: list_of_elem = cls(list_of_elem) # type: ignore return deserialized.get("nextLink") or None, AsyncList(list_of_elem) @@ -22348,112 +21900,11 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - -class CapacityReservationsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.compute.aio.ComputeClient`'s - :attr:`capacity_reservations` attribute. - """ - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ComputeClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @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. The name is case insensitive. - Required. - :type resource_group_name: str - :param capacity_reservation_group_name: The name of the capacity reservation group. Required. - :type capacity_reservation_group_name: str - :param capacity_reservation_name: The name of the capacity reservation. Required. - :type capacity_reservation_name: str - :keyword 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. "instanceView" Default value is None. - :paramtype expand: str or ~azure.mgmt.compute.models.CapacityReservationInstanceViewTypes - :return: CapacityReservation. The CapacityReservation is compatible with MutableMapping - :rtype: ~azure.mgmt.compute.models.CapacityReservation - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[_models.CapacityReservation] = kwargs.pop("cls", None) - - _request = build_capacity_reservations_get_request( - resource_group_name=resource_group_name, - capacity_reservation_group_name=capacity_reservation_group_name, - capacity_reservation_name=capacity_reservation_name, - subscription_id=self._config.subscription_id, - expand=expand, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = kwargs.pop("stream", False) - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - if _stream: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.CloudError, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if _stream: - deserialized = response.iter_bytes() - else: - deserialized = _deserialize(_models.CapacityReservation, response.json()) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( + async def _grant_access_initial( self, resource_group_name: str, - capacity_reservation_group_name: str, - capacity_reservation_name: str, - parameters: Union[_models.CapacityReservation, JSON, IO[bytes]], + disk_name: str, + grant_access_data: Union[_models.GrantAccessData, JSON, IO[bytes]], **kwargs: Any ) -> AsyncIterator[bytes]: error_map: MutableMapping = { @@ -22472,15 +21923,14 @@ async def _create_or_update_initial( content_type = content_type or "application/json" _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters + if isinstance(grant_access_data, (IOBase, bytes)): + _content = grant_access_data else: - _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(grant_access_data, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - _request = build_capacity_reservations_create_or_update_request( + _request = build_disks_grant_access_request( resource_group_name=resource_group_name, - capacity_reservation_group_name=capacity_reservation_group_name, - capacity_reservation_name=capacity_reservation_name, + disk_name=disk_name, subscription_id=self._config.subscription_id, content_type=content_type, api_version=self._config.api_version, @@ -22500,7 +21950,7 @@ async def _create_or_update_initial( response = pipeline_response.http_response - if response.status_code not in [200, 201]: + if response.status_code not in [200, 202]: try: await response.read() # Load the body in memory and close the socket except (StreamConsumedError, StreamClosedError): @@ -22510,7 +21960,7 @@ async def _create_or_update_initial( raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} - if response.status_code == 201: + if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) @@ -22522,143 +21972,264 @@ async def _create_or_update_initial( return deserialized # type: ignore @overload - async def begin_create_or_update( + async def begin_grant_access( self, resource_group_name: str, - capacity_reservation_group_name: str, - capacity_reservation_name: str, - parameters: _models.CapacityReservation, + disk_name: str, + grant_access_data: _models.GrantAccessData, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[None]: - """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. + ) -> AsyncLROPoller[_models.AccessUri]: + """Grants access to a disk. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param capacity_reservation_group_name: The name of the capacity reservation group. Required. - :type capacity_reservation_group_name: str - :param capacity_reservation_name: The name of the capacity reservation. Required. - :type capacity_reservation_name: str - :param parameters: Parameters supplied to the Create capacity reservation. Required. - :type parameters: ~azure.mgmt.compute.models.CapacityReservation + :param disk_name: The name of the managed disk that is being created. The name can't be changed + after the disk is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The + maximum name length is 80 characters. Required. + :type disk_name: str + :param grant_access_data: Access data object supplied in the body of the get disk access + operation. Required. + :type grant_access_data: ~azure.mgmt.compute.models.GrantAccessData :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns None - :rtype: ~azure.core.polling.AsyncLROPoller[None] + :return: An instance of AsyncLROPoller that returns AccessUri. The AccessUri is compatible with + MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.AccessUri] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - async def begin_create_or_update( + async def begin_grant_access( self, resource_group_name: str, - capacity_reservation_group_name: str, - capacity_reservation_name: str, - parameters: JSON, + disk_name: str, + grant_access_data: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[None]: - """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. + ) -> AsyncLROPoller[_models.AccessUri]: + """Grants access to a disk. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param capacity_reservation_group_name: The name of the capacity reservation group. Required. - :type capacity_reservation_group_name: str - :param capacity_reservation_name: The name of the capacity reservation. Required. - :type capacity_reservation_name: str - :param parameters: Parameters supplied to the Create capacity reservation. Required. - :type parameters: JSON + :param disk_name: The name of the managed disk that is being created. The name can't be changed + after the disk is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The + maximum name length is 80 characters. Required. + :type disk_name: str + :param grant_access_data: Access data object supplied in the body of the get disk access + operation. Required. + :type grant_access_data: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns None - :rtype: ~azure.core.polling.AsyncLROPoller[None] + :return: An instance of AsyncLROPoller that returns AccessUri. The AccessUri is compatible with + MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.AccessUri] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - async def begin_create_or_update( + async def begin_grant_access( self, resource_group_name: str, - capacity_reservation_group_name: str, - capacity_reservation_name: str, - parameters: IO[bytes], + disk_name: str, + grant_access_data: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[None]: - """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. + ) -> AsyncLROPoller[_models.AccessUri]: + """Grants access to a disk. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param capacity_reservation_group_name: The name of the capacity reservation group. Required. - :type capacity_reservation_group_name: str - :param capacity_reservation_name: The name of the capacity reservation. Required. - :type capacity_reservation_name: str - :param parameters: Parameters supplied to the Create capacity reservation. Required. - :type parameters: IO[bytes] + :param disk_name: The name of the managed disk that is being created. The name can't be changed + after the disk is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The + maximum name length is 80 characters. Required. + :type disk_name: str + :param grant_access_data: Access data object supplied in the body of the get disk access + operation. Required. + :type grant_access_data: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns None - :rtype: ~azure.core.polling.AsyncLROPoller[None] + :return: An instance of AsyncLROPoller that returns AccessUri. The AccessUri is compatible with + MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.AccessUri] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace_async - async def begin_create_or_update( + async def begin_grant_access( self, resource_group_name: str, - capacity_reservation_group_name: str, - capacity_reservation_name: str, - parameters: Union[_models.CapacityReservation, JSON, IO[bytes]], + disk_name: str, + grant_access_data: Union[_models.GrantAccessData, JSON, IO[bytes]], **kwargs: Any + ) -> AsyncLROPoller[_models.AccessUri]: + """Grants access to a disk. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param disk_name: The name of the managed disk that is being created. The name can't be changed + after the disk is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The + maximum name length is 80 characters. Required. + :type disk_name: str + :param grant_access_data: Access data object supplied in the body of the get disk access + operation. Is one of the following types: GrantAccessData, JSON, IO[bytes] Required. + :type grant_access_data: ~azure.mgmt.compute.models.GrantAccessData or JSON or IO[bytes] + :return: An instance of AsyncLROPoller that returns AccessUri. The AccessUri is compatible with + MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.AccessUri] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AccessUri] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._grant_access_initial( + resource_group_name=resource_group_name, + disk_name=disk_name, + grant_access_data=grant_access_data, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = _deserialize(_models.AccessUri, response.json()) + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.AccessUri].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.AccessUri]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _revoke_access_initial( + self, resource_group_name: str, disk_name: str, **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_disks_revoke_access_request( + resource_group_name=resource_group_name, + disk_name=disk_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_revoke_access( + self, resource_group_name: str, disk_name: str, **kwargs: Any ) -> AsyncLROPoller[None]: - """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. + """Revokes access to a disk. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param capacity_reservation_group_name: The name of the capacity reservation group. Required. - :type capacity_reservation_group_name: str - :param capacity_reservation_name: The name of the capacity reservation. Required. - :type capacity_reservation_name: str - :param parameters: Parameters supplied to the Create capacity reservation. Is one of the - following types: CapacityReservation, JSON, IO[bytes] Required. - :type parameters: ~azure.mgmt.compute.models.CapacityReservation or JSON or IO[bytes] + :param disk_name: The name of the managed disk that is being created. The name can't be changed + after the disk is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The + maximum name length is 80 characters. Required. + :type disk_name: str :return: An instance of AsyncLROPoller that returns None :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._create_or_update_initial( + raw_result = await self._revoke_access_initial( resource_group_name=resource_group_name, - capacity_reservation_group_name=capacity_reservation_group_name, - capacity_reservation_name=capacity_reservation_name, - parameters=parameters, - content_type=content_type, + disk_name=disk_name, cls=lambda x, y, z: x, headers=_headers, params=_params, @@ -22692,12 +22263,97 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - async def _update_initial( + +class DiskAccessesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.compute.aio.ComputeClient`'s + :attr:`disk_accesses` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace_async + async def get(self, resource_group_name: str, disk_access_name: str, **kwargs: Any) -> _models.DiskAccess: + """Gets information about a disk access resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param disk_access_name: The name of the disk access resource that is being created. The name + can't be changed after the disk encryption set is created. Supported characters for the name + are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. + :type disk_access_name: str + :return: DiskAccess. The DiskAccess is compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.DiskAccess + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.DiskAccess] = kwargs.pop("cls", None) + + _request = build_disk_accesses_get_request( + resource_group_name=resource_group_name, + disk_access_name=disk_access_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.DiskAccess, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _create_or_update_initial( self, resource_group_name: str, - capacity_reservation_group_name: str, - capacity_reservation_name: str, - parameters: Union[_models.CapacityReservationUpdate, JSON, IO[bytes]], + disk_access_name: str, + disk_access: Union[_models.DiskAccess, JSON, IO[bytes]], **kwargs: Any ) -> AsyncIterator[bytes]: error_map: MutableMapping = { @@ -22716,15 +22372,14 @@ async def _update_initial( content_type = content_type or "application/json" _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters + if isinstance(disk_access, (IOBase, bytes)): + _content = disk_access else: - _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(disk_access, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - _request = build_capacity_reservations_update_request( + _request = build_disk_accesses_create_or_update_request( resource_group_name=resource_group_name, - capacity_reservation_group_name=capacity_reservation_group_name, - capacity_reservation_name=capacity_reservation_name, + disk_access_name=disk_access_name, subscription_id=self._config.subscription_id, content_type=content_type, api_version=self._config.api_version, @@ -22766,134 +22421,136 @@ async def _update_initial( return deserialized # type: ignore @overload - async def begin_update( + async def begin_create_or_update( self, resource_group_name: str, - capacity_reservation_group_name: str, - capacity_reservation_name: str, - parameters: _models.CapacityReservationUpdate, + disk_access_name: str, + disk_access: _models.DiskAccess, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[None]: - """The operation to update a capacity reservation. + ) -> AsyncLROPoller[_models.DiskAccess]: + """Creates or updates a disk access resource. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param capacity_reservation_group_name: The name of the capacity reservation group. Required. - :type capacity_reservation_group_name: str - :param capacity_reservation_name: The name of the capacity reservation. Required. - :type capacity_reservation_name: str - :param parameters: Parameters supplied to the Update capacity reservation operation. Required. - :type parameters: ~azure.mgmt.compute.models.CapacityReservationUpdate + :param disk_access_name: The name of the disk access resource that is being created. The name + can't be changed after the disk encryption set is created. Supported characters for the name + are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. + :type disk_access_name: str + :param disk_access: disk access object supplied in the body of the Put disk access operation. + Required. + :type disk_access: ~azure.mgmt.compute.models.DiskAccess :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns None - :rtype: ~azure.core.polling.AsyncLROPoller[None] + :return: An instance of AsyncLROPoller that returns DiskAccess. The DiskAccess is compatible + with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.DiskAccess] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - async def begin_update( + async def begin_create_or_update( self, resource_group_name: str, - capacity_reservation_group_name: str, - capacity_reservation_name: str, - parameters: JSON, + disk_access_name: str, + disk_access: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[None]: - """The operation to update a capacity reservation. + ) -> AsyncLROPoller[_models.DiskAccess]: + """Creates or updates a disk access resource. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param capacity_reservation_group_name: The name of the capacity reservation group. Required. - :type capacity_reservation_group_name: str - :param capacity_reservation_name: The name of the capacity reservation. Required. - :type capacity_reservation_name: str - :param parameters: Parameters supplied to the Update capacity reservation operation. Required. - :type parameters: JSON + :param disk_access_name: The name of the disk access resource that is being created. The name + can't be changed after the disk encryption set is created. Supported characters for the name + are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. + :type disk_access_name: str + :param disk_access: disk access object supplied in the body of the Put disk access operation. + Required. + :type disk_access: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns None - :rtype: ~azure.core.polling.AsyncLROPoller[None] + :return: An instance of AsyncLROPoller that returns DiskAccess. The DiskAccess is compatible + with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.DiskAccess] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - async def begin_update( + async def begin_create_or_update( self, resource_group_name: str, - capacity_reservation_group_name: str, - capacity_reservation_name: str, - parameters: IO[bytes], + disk_access_name: str, + disk_access: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[None]: - """The operation to update a capacity reservation. + ) -> AsyncLROPoller[_models.DiskAccess]: + """Creates or updates a disk access resource. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param capacity_reservation_group_name: The name of the capacity reservation group. Required. - :type capacity_reservation_group_name: str - :param capacity_reservation_name: The name of the capacity reservation. Required. - :type capacity_reservation_name: str - :param parameters: Parameters supplied to the Update capacity reservation operation. Required. - :type parameters: IO[bytes] + :param disk_access_name: The name of the disk access resource that is being created. The name + can't be changed after the disk encryption set is created. Supported characters for the name + are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. + :type disk_access_name: str + :param disk_access: disk access object supplied in the body of the Put disk access operation. + Required. + :type disk_access: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns None - :rtype: ~azure.core.polling.AsyncLROPoller[None] + :return: An instance of AsyncLROPoller that returns DiskAccess. The DiskAccess is compatible + with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.DiskAccess] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace_async - async def begin_update( + async def begin_create_or_update( self, resource_group_name: str, - capacity_reservation_group_name: str, - capacity_reservation_name: str, - parameters: Union[_models.CapacityReservationUpdate, JSON, IO[bytes]], + disk_access_name: str, + disk_access: Union[_models.DiskAccess, JSON, IO[bytes]], **kwargs: Any - ) -> AsyncLROPoller[None]: - """The operation to update a capacity reservation. + ) -> AsyncLROPoller[_models.DiskAccess]: + """Creates or updates a disk access resource. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param capacity_reservation_group_name: The name of the capacity reservation group. Required. - :type capacity_reservation_group_name: str - :param capacity_reservation_name: The name of the capacity reservation. Required. - :type capacity_reservation_name: str - :param parameters: Parameters supplied to the Update capacity reservation operation. Is one of - the following types: CapacityReservationUpdate, JSON, IO[bytes] Required. - :type parameters: ~azure.mgmt.compute.models.CapacityReservationUpdate or JSON or IO[bytes] - :return: An instance of AsyncLROPoller that returns None - :rtype: ~azure.core.polling.AsyncLROPoller[None] + :param disk_access_name: The name of the disk access resource that is being created. The name + can't be changed after the disk encryption set is created. Supported characters for the name + are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. + :type disk_access_name: str + :param disk_access: disk access object supplied in the body of the Put disk access operation. + Is one of the following types: DiskAccess, JSON, IO[bytes] Required. + :type disk_access: ~azure.mgmt.compute.models.DiskAccess or JSON or IO[bytes] + :return: An instance of AsyncLROPoller that returns DiskAccess. The DiskAccess is compatible + with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.DiskAccess] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[_models.DiskAccess] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._update_initial( + 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, + disk_access_name=disk_access_name, + disk_access=disk_access, content_type=content_type, cls=lambda x, y, z: x, headers=_headers, @@ -22903,9 +22560,12 @@ async def begin_update( await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.DiskAccess, response.json()) if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized path_format_arguments = { "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), @@ -22920,19 +22580,21 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return AsyncLROPoller[None].from_continuation_token( + return AsyncLROPoller[_models.DiskAccess].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + return AsyncLROPoller[_models.DiskAccess]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) - async def _delete_initial( + async def _update_initial( self, resource_group_name: str, - capacity_reservation_group_name: str, - capacity_reservation_name: str, + disk_access_name: str, + disk_access: Union[_models.DiskAccessUpdate, JSON, IO[bytes]], **kwargs: Any ) -> AsyncIterator[bytes]: error_map: MutableMapping = { @@ -22943,17 +22605,26 @@ async def _delete_initial( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - _request = build_capacity_reservations_delete_request( + content_type = content_type or "application/json" + _content = None + if isinstance(disk_access, (IOBase, bytes)): + _content = disk_access + else: + _content = json.dumps(disk_access, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_disk_accesses_update_request( resource_group_name=resource_group_name, - capacity_reservation_group_name=capacity_reservation_group_name, - capacity_reservation_name=capacity_reservation_name, + disk_access_name=disk_access_name, subscription_id=self._config.subscription_id, + content_type=content_type, api_version=self._config.api_version, + content=_content, headers=_headers, params=_params, ) @@ -22969,7 +22640,7 @@ async def _delete_initial( response = pipeline_response.http_response - if response.status_code not in [200, 202, 204]: + if response.status_code not in [200, 202]: try: await response.read() # Load the body in memory and close the socket except (StreamConsumedError, StreamClosedError): @@ -22990,31 +22661,250 @@ async def _delete_initial( return deserialized # type: ignore - @distributed_trace_async - async def begin_delete( + @overload + async def begin_update( self, resource_group_name: str, - capacity_reservation_group_name: str, - capacity_reservation_name: str, + disk_access_name: str, + disk_access: _models.DiskAccessUpdate, + *, + content_type: str = "application/json", **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. - Note: Block capacity reservations cannot be deleted after it has been successfully allocated - until the schedule end time. + ) -> AsyncLROPoller[_models.DiskAccess]: + """Updates (patches) a disk access resource. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param capacity_reservation_group_name: The name of the capacity reservation group. Required. - :type capacity_reservation_group_name: str - :param capacity_reservation_name: The name of the capacity reservation. Required. - :type capacity_reservation_name: str - :return: An instance of AsyncLROPoller that returns None - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ + :param disk_access_name: The name of the disk access resource that is being created. The name + can't be changed after the disk encryption set is created. Supported characters for the name + are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. + :type disk_access_name: str + :param disk_access: disk access object supplied in the body of the Patch disk access operation. + Required. + :type disk_access: ~azure.mgmt.compute.models.DiskAccessUpdate + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns DiskAccess. The DiskAccess is compatible + with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.DiskAccess] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update( + self, + resource_group_name: str, + disk_access_name: str, + disk_access: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.DiskAccess]: + """Updates (patches) a disk access resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param disk_access_name: The name of the disk access resource that is being created. The name + can't be changed after the disk encryption set is created. Supported characters for the name + are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. + :type disk_access_name: str + :param disk_access: disk access object supplied in the body of the Patch disk access operation. + Required. + :type disk_access: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns DiskAccess. The DiskAccess is compatible + with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.DiskAccess] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update( + self, + resource_group_name: str, + disk_access_name: str, + disk_access: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.DiskAccess]: + """Updates (patches) a disk access resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param disk_access_name: The name of the disk access resource that is being created. The name + can't be changed after the disk encryption set is created. Supported characters for the name + are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. + :type disk_access_name: str + :param disk_access: disk access object supplied in the body of the Patch disk access operation. + Required. + :type disk_access: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns DiskAccess. The DiskAccess is compatible + with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.DiskAccess] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_update( + self, + resource_group_name: str, + disk_access_name: str, + disk_access: Union[_models.DiskAccessUpdate, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.DiskAccess]: + """Updates (patches) a disk access resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param disk_access_name: The name of the disk access resource that is being created. The name + can't be changed after the disk encryption set is created. Supported characters for the name + are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. + :type disk_access_name: str + :param disk_access: disk access object supplied in the body of the Patch disk access operation. + Is one of the following types: DiskAccessUpdate, JSON, IO[bytes] Required. + :type disk_access: ~azure.mgmt.compute.models.DiskAccessUpdate or JSON or IO[bytes] + :return: An instance of AsyncLROPoller that returns DiskAccess. The DiskAccess is compatible + with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.DiskAccess] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.DiskAccess] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._update_initial( + resource_group_name=resource_group_name, + disk_access_name=disk_access_name, + disk_access=disk_access, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.DiskAccess, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.DiskAccess].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.DiskAccess]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _delete_initial( + self, resource_group_name: str, disk_access_name: str, **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_disk_accesses_delete_request( + resource_group_name=resource_group_name, + disk_access_name=disk_access_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_delete( + self, resource_group_name: str, disk_access_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes a disk access resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param disk_access_name: The name of the disk access resource that is being created. The name + can't be changed after the disk encryption set is created. Supported characters for the name + are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. + :type disk_access_name: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} @@ -23025,8 +22915,7 @@ async def begin_delete( 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, + disk_access_name=disk_access_name, cls=lambda x, y, z: x, headers=_headers, params=_params, @@ -23061,25 +22950,20 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore @distributed_trace - def list_by_capacity_reservation_group( - self, resource_group_name: str, capacity_reservation_group_name: str, **kwargs: Any - ) -> AsyncItemPaged["_models.CapacityReservation"]: - """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. + def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> AsyncItemPaged["_models.DiskAccess"]: + """Lists all the disk access resources under a resource group. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param capacity_reservation_group_name: The name of the capacity reservation group. Required. - :type capacity_reservation_group_name: str - :return: An iterator like instance of CapacityReservation - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.models.CapacityReservation] + :return: An iterator like instance of DiskAccess + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.models.DiskAccess] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.CapacityReservation]] = kwargs.pop("cls", None) + cls: ClsType[List[_models.DiskAccess]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -23092,9 +22976,8 @@ def list_by_capacity_reservation_group( def prepare_request(next_link=None): if not next_link: - _request = build_capacity_reservations_list_by_capacity_reservation_group_request( + _request = build_disk_accesses_list_by_resource_group_request( resource_group_name=resource_group_name, - capacity_reservation_group_name=capacity_reservation_group_name, subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -23131,7 +23014,7 @@ def prepare_request(next_link=None): async def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.CapacityReservation], deserialized.get("value", [])) + list_of_elem = _deserialize(List[_models.DiskAccess], deserialized.get("value", [])) if cls: list_of_elem = cls(list_of_elem) # type: ignore return deserialized.get("nextLink") or None, AsyncList(list_of_elem) @@ -23154,48 +23037,106 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) + @distributed_trace + def list(self, **kwargs: Any) -> AsyncItemPaged["_models.DiskAccess"]: + """Lists all the disk access resources under a subscription. -class VirtualMachineRunCommandsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. + :return: An iterator like instance of DiskAccess + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.models.DiskAccess] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} - Instead, you should access the following operations through - :class:`~azure.mgmt.compute.aio.ComputeClient`'s - :attr:`virtual_machine_run_commands` attribute. - """ + cls: ClsType[List[_models.DiskAccess]] = kwargs.pop("cls", None) - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ComputeClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_disk_accesses_list_request( + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.DiskAccess], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) @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. + async def get_private_link_resources( + self, resource_group_name: str, disk_access_name: str, **kwargs: Any + ) -> _models.PrivateLinkResourceListResult: + """Gets the private link resources possible under disk access resource. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param vm_name: The name of the VirtualMachine. Required. - :type vm_name: str - :param run_command_name: The name of the VirtualMachineRunCommand. Required. - :type run_command_name: str - :keyword expand: The expand expression to apply on the operation. Default value is None. - :paramtype expand: str - :return: VirtualMachineRunCommand. The VirtualMachineRunCommand is compatible with + :param disk_access_name: The name of the disk access resource that is being created. The name + can't be changed after the disk encryption set is created. Supported characters for the name + are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. + :type disk_access_name: str + :return: PrivateLinkResourceListResult. The PrivateLinkResourceListResult is compatible with MutableMapping - :rtype: ~azure.mgmt.compute.models.VirtualMachineRunCommand + :rtype: ~azure.mgmt.compute.models.PrivateLinkResourceListResult :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -23209,14 +23150,12 @@ async def get_by_virtual_machine( _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.VirtualMachineRunCommand] = kwargs.pop("cls", None) + cls: ClsType[_models.PrivateLinkResourceListResult] = kwargs.pop("cls", None) - _request = build_virtual_machine_run_commands_get_by_virtual_machine_request( + _request = build_disk_accesses_get_private_link_resources_request( resource_group_name=resource_group_name, - vm_name=vm_name, - run_command_name=run_command_name, + disk_access_name=disk_access_name, subscription_id=self._config.subscription_id, - expand=expand, api_version=self._config.api_version, headers=_headers, params=_params, @@ -23246,19 +23185,93 @@ async def get_by_virtual_machine( if _stream: deserialized = response.iter_bytes() else: - deserialized = _deserialize(_models.VirtualMachineRunCommand, response.json()) + deserialized = _deserialize(_models.PrivateLinkResourceListResult, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - async def _create_or_update_initial( + @distributed_trace_async + async def get_a_private_endpoint_connection( + self, resource_group_name: str, disk_access_name: str, private_endpoint_connection_name: str, **kwargs: Any + ) -> _models.PrivateEndpointConnection: + """Gets information about a private endpoint connection under a disk access resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param disk_access_name: The name of the disk access resource that is being created. The name + can't be changed after the disk encryption set is created. Supported characters for the name + are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. + :type disk_access_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. + :type private_endpoint_connection_name: str + :return: PrivateEndpointConnection. The PrivateEndpointConnection is compatible with + MutableMapping + :rtype: ~azure.mgmt.compute.models.PrivateEndpointConnection + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) + + _request = build_disk_accesses_get_a_private_endpoint_connection_request( + resource_group_name=resource_group_name, + disk_access_name=disk_access_name, + private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.PrivateEndpointConnection, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _update_a_private_endpoint_connection_initial( # pylint: disable=name-too-long self, resource_group_name: str, - vm_name: str, - run_command_name: str, - run_command: Union[_models.VirtualMachineRunCommand, JSON, IO[bytes]], + disk_access_name: str, + private_endpoint_connection_name: str, + private_endpoint_connection: Union[_models.PrivateEndpointConnection, JSON, IO[bytes]], **kwargs: Any ) -> AsyncIterator[bytes]: error_map: MutableMapping = { @@ -23277,15 +23290,15 @@ async def _create_or_update_initial( content_type = content_type or "application/json" _content = None - if isinstance(run_command, (IOBase, bytes)): - _content = run_command + if isinstance(private_endpoint_connection, (IOBase, bytes)): + _content = private_endpoint_connection else: - _content = json.dumps(run_command, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(private_endpoint_connection, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - _request = build_virtual_machine_run_commands_create_or_update_request( + _request = build_disk_accesses_update_a_private_endpoint_connection_request( resource_group_name=resource_group_name, - vm_name=vm_name, - run_command_name=run_command_name, + disk_access_name=disk_access_name, + private_endpoint_connection_name=private_endpoint_connection_name, subscription_id=self._config.subscription_id, content_type=content_type, api_version=self._config.api_version, @@ -23305,7 +23318,7 @@ async def _create_or_update_initial( response = pipeline_response.http_response - if response.status_code not in [200, 201]: + if response.status_code not in [200, 202]: try: await response.read() # Load the body in memory and close the socket except (StreamConsumedError, StreamClosedError): @@ -23315,7 +23328,7 @@ async def _create_or_update_initial( raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} - if response.status_code == 201: + if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) @@ -23327,137 +23340,159 @@ async def _create_or_update_initial( return deserialized # type: ignore @overload - async def begin_create_or_update( + async def begin_update_a_private_endpoint_connection( # pylint: disable=name-too-long self, resource_group_name: str, - vm_name: str, - run_command_name: str, - run_command: _models.VirtualMachineRunCommand, + disk_access_name: str, + private_endpoint_connection_name: str, + private_endpoint_connection: _models.PrivateEndpointConnection, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[None]: - """The operation to create or update the run command. + ) -> AsyncLROPoller[_models.PrivateEndpointConnection]: + """Approve or reject a private endpoint connection under disk access resource, this can't be used + to create a new private endpoint connection. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param vm_name: The name of the VirtualMachine. Required. - :type vm_name: str - :param run_command_name: The name of the VirtualMachineRunCommand. Required. - :type run_command_name: str - :param run_command: Parameters supplied to the Create Virtual Machine RunCommand operation. - Required. - :type run_command: ~azure.mgmt.compute.models.VirtualMachineRunCommand + :param disk_access_name: The name of the disk access resource that is being created. The name + can't be changed after the disk encryption set is created. Supported characters for the name + are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. + :type disk_access_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. + :type private_endpoint_connection_name: str + :param private_endpoint_connection: private endpoint connection object supplied in the body of + the Put private endpoint connection operation. Required. + :type private_endpoint_connection: ~azure.mgmt.compute.models.PrivateEndpointConnection :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns None - :rtype: ~azure.core.polling.AsyncLROPoller[None] + :return: An instance of AsyncLROPoller that returns PrivateEndpointConnection. The + PrivateEndpointConnection is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.PrivateEndpointConnection] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - async def begin_create_or_update( + async def begin_update_a_private_endpoint_connection( # pylint: disable=name-too-long self, resource_group_name: str, - vm_name: str, - run_command_name: str, - run_command: JSON, + disk_access_name: str, + private_endpoint_connection_name: str, + private_endpoint_connection: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[None]: - """The operation to create or update the run command. + ) -> AsyncLROPoller[_models.PrivateEndpointConnection]: + """Approve or reject a private endpoint connection under disk access resource, this can't be used + to create a new private endpoint connection. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param vm_name: The name of the VirtualMachine. Required. - :type vm_name: str - :param run_command_name: The name of the VirtualMachineRunCommand. Required. - :type run_command_name: str - :param run_command: Parameters supplied to the Create Virtual Machine RunCommand operation. - Required. - :type run_command: JSON + :param disk_access_name: The name of the disk access resource that is being created. The name + can't be changed after the disk encryption set is created. Supported characters for the name + are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. + :type disk_access_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. + :type private_endpoint_connection_name: str + :param private_endpoint_connection: private endpoint connection object supplied in the body of + the Put private endpoint connection operation. Required. + :type private_endpoint_connection: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns None - :rtype: ~azure.core.polling.AsyncLROPoller[None] + :return: An instance of AsyncLROPoller that returns PrivateEndpointConnection. The + PrivateEndpointConnection is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.PrivateEndpointConnection] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - async def begin_create_or_update( + async def begin_update_a_private_endpoint_connection( # pylint: disable=name-too-long self, resource_group_name: str, - vm_name: str, - run_command_name: str, - run_command: IO[bytes], + disk_access_name: str, + private_endpoint_connection_name: str, + private_endpoint_connection: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[None]: - """The operation to create or update the run command. + ) -> AsyncLROPoller[_models.PrivateEndpointConnection]: + """Approve or reject a private endpoint connection under disk access resource, this can't be used + to create a new private endpoint connection. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param vm_name: The name of the VirtualMachine. Required. - :type vm_name: str - :param run_command_name: The name of the VirtualMachineRunCommand. Required. - :type run_command_name: str - :param run_command: Parameters supplied to the Create Virtual Machine RunCommand operation. - Required. - :type run_command: IO[bytes] + :param disk_access_name: The name of the disk access resource that is being created. The name + can't be changed after the disk encryption set is created. Supported characters for the name + are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. + :type disk_access_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. + :type private_endpoint_connection_name: str + :param private_endpoint_connection: private endpoint connection object supplied in the body of + the Put private endpoint connection operation. Required. + :type private_endpoint_connection: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns None - :rtype: ~azure.core.polling.AsyncLROPoller[None] + :return: An instance of AsyncLROPoller that returns PrivateEndpointConnection. The + PrivateEndpointConnection is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.PrivateEndpointConnection] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace_async - async def begin_create_or_update( + async def begin_update_a_private_endpoint_connection( # pylint: disable=name-too-long self, resource_group_name: str, - vm_name: str, - run_command_name: str, - run_command: Union[_models.VirtualMachineRunCommand, JSON, IO[bytes]], + disk_access_name: str, + private_endpoint_connection_name: str, + private_endpoint_connection: Union[_models.PrivateEndpointConnection, JSON, IO[bytes]], **kwargs: Any - ) -> AsyncLROPoller[None]: - """The operation to create or update the run command. + ) -> AsyncLROPoller[_models.PrivateEndpointConnection]: + """Approve or reject a private endpoint connection under disk access resource, this can't be used + to create a new private endpoint connection. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param vm_name: The name of the VirtualMachine. Required. - :type vm_name: str - :param run_command_name: The name of the VirtualMachineRunCommand. Required. - :type run_command_name: str - :param run_command: Parameters supplied to the Create Virtual Machine RunCommand operation. Is - one of the following types: VirtualMachineRunCommand, JSON, IO[bytes] Required. - :type run_command: ~azure.mgmt.compute.models.VirtualMachineRunCommand or JSON or IO[bytes] - :return: An instance of AsyncLROPoller that returns None - :rtype: ~azure.core.polling.AsyncLROPoller[None] + :param disk_access_name: The name of the disk access resource that is being created. The name + can't be changed after the disk encryption set is created. Supported characters for the name + are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. + :type disk_access_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. + :type private_endpoint_connection_name: str + :param private_endpoint_connection: private endpoint connection object supplied in the body of + the Put private endpoint connection operation. Is one of the following types: + PrivateEndpointConnection, JSON, IO[bytes] Required. + :type private_endpoint_connection: ~azure.mgmt.compute.models.PrivateEndpointConnection or JSON + or IO[bytes] + :return: An instance of AsyncLROPoller that returns PrivateEndpointConnection. The + PrivateEndpointConnection is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.PrivateEndpointConnection] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._create_or_update_initial( + raw_result = await self._update_a_private_endpoint_connection_initial( resource_group_name=resource_group_name, - vm_name=vm_name, - run_command_name=run_command_name, - run_command=run_command, + disk_access_name=disk_access_name, + private_endpoint_connection_name=private_endpoint_connection_name, + private_endpoint_connection=private_endpoint_connection, content_type=content_type, cls=lambda x, y, z: x, headers=_headers, @@ -23467,9 +23502,12 @@ async def begin_create_or_update( await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.PrivateEndpointConnection, response.json()) if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized path_format_arguments = { "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), @@ -23484,255 +23522,18 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return AsyncLROPoller[None].from_continuation_token( + return AsyncLROPoller[_models.PrivateEndpointConnection].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _update_initial( - self, - resource_group_name: str, - vm_name: str, - run_command_name: str, - run_command: Union[_models.VirtualMachineRunCommandUpdate, JSON, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} - - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _content = None - if isinstance(run_command, (IOBase, bytes)): - _content = run_command - else: - _content = json.dumps(run_command, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - - _request = build_virtual_machine_run_commands_update_request( - resource_group_name=resource_group_name, - vm_name=vm_name, - run_command_name=run_command_name, - subscription_id=self._config.subscription_id, - content_type=content_type, - api_version=self._config.api_version, - content=_content, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs + return AsyncLROPoller[_models.PrivateEndpointConnection]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.CloudError, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.iter_bytes() - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_update( - self, - resource_group_name: str, - vm_name: str, - run_command_name: str, - run_command: _models.VirtualMachineRunCommandUpdate, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[None]: - """The operation to update the run command. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_name: The name of the VirtualMachine. Required. - :type vm_name: str - :param run_command_name: The name of the VirtualMachineRunCommand. Required. - :type run_command_name: str - :param run_command: Parameters supplied to the Update Virtual Machine RunCommand operation. - Required. - :type run_command: ~azure.mgmt.compute.models.VirtualMachineRunCommandUpdate - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns None - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update( - self, - resource_group_name: str, - vm_name: str, - run_command_name: str, - run_command: JSON, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[None]: - """The operation to update the run command. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_name: The name of the VirtualMachine. Required. - :type vm_name: str - :param run_command_name: The name of the VirtualMachineRunCommand. Required. - :type run_command_name: str - :param run_command: Parameters supplied to the Update Virtual Machine RunCommand operation. - Required. - :type run_command: JSON - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns None - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update( - self, - resource_group_name: str, - vm_name: str, - run_command_name: str, - run_command: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[None]: - """The operation to update the run command. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_name: The name of the VirtualMachine. Required. - :type vm_name: str - :param run_command_name: The name of the VirtualMachineRunCommand. Required. - :type run_command_name: str - :param run_command: Parameters supplied to the Update Virtual Machine RunCommand operation. - Required. - :type run_command: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns None - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_update( - self, - resource_group_name: str, - vm_name: str, - run_command_name: str, - run_command: Union[_models.VirtualMachineRunCommandUpdate, JSON, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[None]: - """The operation to update the run command. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_name: The name of the VirtualMachine. Required. - :type vm_name: str - :param run_command_name: The name of the VirtualMachineRunCommand. Required. - :type run_command_name: str - :param run_command: Parameters supplied to the Update Virtual Machine RunCommand operation. Is - one of the following types: VirtualMachineRunCommandUpdate, JSON, IO[bytes] Required. - :type run_command: ~azure.mgmt.compute.models.VirtualMachineRunCommandUpdate or JSON or - IO[bytes] - :return: An instance of AsyncLROPoller that returns None - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} - - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._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, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _delete_initial( - self, resource_group_name: str, vm_name: str, run_command_name: str, **kwargs: Any + async def _delete_a_private_endpoint_connection_initial( # pylint: disable=name-too-long + self, resource_group_name: str, disk_access_name: str, private_endpoint_connection_name: str, **kwargs: Any ) -> AsyncIterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -23747,10 +23548,10 @@ async def _delete_initial( cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - _request = build_virtual_machine_run_commands_delete_request( + _request = build_disk_accesses_delete_a_private_endpoint_connection_request( resource_group_name=resource_group_name, - vm_name=vm_name, - run_command_name=run_command_name, + disk_access_name=disk_access_name, + private_endpoint_connection_name=private_endpoint_connection_name, subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -23790,18 +23591,20 @@ async def _delete_initial( return deserialized # type: ignore @distributed_trace_async - async def begin_delete( - self, resource_group_name: str, vm_name: str, run_command_name: str, **kwargs: Any + async def begin_delete_a_private_endpoint_connection( # pylint: disable=name-too-long + self, resource_group_name: str, disk_access_name: str, private_endpoint_connection_name: str, **kwargs: Any ) -> AsyncLROPoller[None]: - """The operation to delete the run command. + """Deletes a private endpoint connection under a disk access resource. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param vm_name: The name of the VirtualMachine. Required. - :type vm_name: str - :param run_command_name: The name of the VirtualMachineRunCommand. Required. - :type run_command_name: str + :param disk_access_name: The name of the disk access resource that is being created. The name + can't be changed after the disk encryption set is created. Supported characters for the name + are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. + :type disk_access_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. + :type private_endpoint_connection_name: str :return: An instance of AsyncLROPoller that returns None :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -23814,10 +23617,10 @@ async def begin_delete( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._delete_initial( + raw_result = await self._delete_a_private_endpoint_connection_initial( resource_group_name=resource_group_name, - vm_name=vm_name, - run_command_name=run_command_name, + disk_access_name=disk_access_name, + private_endpoint_connection_name=private_endpoint_connection_name, cls=lambda x, y, z: x, headers=_headers, params=_params, @@ -23852,27 +23655,27 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore @distributed_trace - def list_by_virtual_machine( - self, resource_group_name: str, vm_name: str, *, expand: Optional[str] = None, **kwargs: Any - ) -> AsyncItemPaged["_models.VirtualMachineRunCommand"]: - """The operation to get all run commands of a Virtual Machine. + def list_private_endpoint_connections( + self, resource_group_name: str, disk_access_name: str, **kwargs: Any + ) -> AsyncItemPaged["_models.PrivateEndpointConnection"]: + """List information about private endpoint connections under a disk access resource. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param vm_name: The name of the VirtualMachine. Required. - :type vm_name: str - :keyword expand: The expand expression to apply on the operation. Default value is None. - :paramtype expand: str - :return: An iterator like instance of VirtualMachineRunCommand + :param disk_access_name: The name of the disk access resource that is being created. The name + can't be changed after the disk encryption set is created. Supported characters for the name + are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. + :type disk_access_name: str + :return: An iterator like instance of PrivateEndpointConnection :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.models.VirtualMachineRunCommand] + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.models.PrivateEndpointConnection] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.VirtualMachineRunCommand]] = kwargs.pop("cls", None) + cls: ClsType[List[_models.PrivateEndpointConnection]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -23885,11 +23688,10 @@ def list_by_virtual_machine( def prepare_request(next_link=None): if not next_link: - _request = build_virtual_machine_run_commands_list_by_virtual_machine_request( + _request = build_disk_accesses_list_private_endpoint_connections_request( resource_group_name=resource_group_name, - vm_name=vm_name, + disk_access_name=disk_access_name, subscription_id=self._config.subscription_id, - expand=expand, api_version=self._config.api_version, headers=_headers, params=_params, @@ -23925,7 +23727,7 @@ def prepare_request(next_link=None): async def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.VirtualMachineRunCommand], deserialized.get("value", [])) + list_of_elem = _deserialize(List[_models.PrivateEndpointConnection], deserialized.get("value", [])) if cls: list_of_elem = cls(list_of_elem) # type: ignore return deserialized.get("nextLink") or None, AsyncList(list_of_elem) @@ -23949,14 +23751,14 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) -class VirtualMachineScaleSetVMRunCommandsOperations: # pylint: disable=name-too-long +class DiskEncryptionSetsOperations: """ .. warning:: **DO NOT** instantiate this class directly. Instead, you should access the following operations through :class:`~azure.mgmt.compute.aio.ComputeClient`'s - :attr:`virtual_machine_scale_set_vm_run_commands` attribute. + :attr:`disk_encryption_sets` attribute. """ def __init__(self, *args, **kwargs) -> None: @@ -23968,31 +23770,19 @@ def __init__(self, *args, **kwargs) -> None: @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. + self, resource_group_name: str, disk_encryption_set_name: str, **kwargs: Any + ) -> _models.DiskEncryptionSet: + """Gets information about a disk encryption set. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param vm_scale_set_name: The name of the VirtualMachineScaleSet. Required. - :type vm_scale_set_name: str - :param instance_id: The name of the VirtualMachineScaleSetVM. Required. - :type instance_id: str - :param run_command_name: The name of the VirtualMachineRunCommand. Required. - :type run_command_name: str - :keyword expand: The expand expression to apply on the operation. Default value is None. - :paramtype expand: str - :return: VirtualMachineRunCommand. The VirtualMachineRunCommand is compatible with - MutableMapping - :rtype: ~azure.mgmt.compute.models.VirtualMachineRunCommand + :param disk_encryption_set_name: The name of the disk encryption set that is being created. The + name can't be changed after the disk encryption set is created. Supported characters for the + name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. + :type disk_encryption_set_name: str + :return: DiskEncryptionSet. The DiskEncryptionSet is compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.DiskEncryptionSet :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -24006,15 +23796,12 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.VirtualMachineRunCommand] = kwargs.pop("cls", None) + cls: ClsType[_models.DiskEncryptionSet] = kwargs.pop("cls", None) - _request = build_virtual_machine_scale_set_vm_run_commands_get_request( + _request = build_disk_encryption_sets_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, + disk_encryption_set_name=disk_encryption_set_name, subscription_id=self._config.subscription_id, - expand=expand, api_version=self._config.api_version, headers=_headers, params=_params, @@ -24044,7 +23831,7 @@ async def get( if _stream: deserialized = response.iter_bytes() else: - deserialized = _deserialize(_models.VirtualMachineRunCommand, response.json()) + deserialized = _deserialize(_models.DiskEncryptionSet, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -24054,10 +23841,8 @@ async def get( 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: Union[_models.VirtualMachineRunCommand, JSON, IO[bytes]], + disk_encryption_set_name: str, + disk_encryption_set: Union[_models.DiskEncryptionSet, JSON, IO[bytes]], **kwargs: Any ) -> AsyncIterator[bytes]: error_map: MutableMapping = { @@ -24076,16 +23861,14 @@ async def _create_or_update_initial( content_type = content_type or "application/json" _content = None - if isinstance(run_command, (IOBase, bytes)): - _content = run_command + if isinstance(disk_encryption_set, (IOBase, bytes)): + _content = disk_encryption_set else: - _content = json.dumps(run_command, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(disk_encryption_set, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - _request = build_virtual_machine_scale_set_vm_run_commands_create_or_update_request( + _request = build_disk_encryption_sets_create_or_update_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, + disk_encryption_set_name=disk_encryption_set_name, subscription_id=self._config.subscription_id, content_type=content_type, api_version=self._config.api_version, @@ -24105,7 +23888,7 @@ async def _create_or_update_initial( response = pipeline_response.http_response - if response.status_code not in [200, 201]: + if response.status_code not in [200, 202]: try: await response.read() # Load the body in memory and close the socket except (StreamConsumedError, StreamClosedError): @@ -24115,7 +23898,7 @@ async def _create_or_update_initial( raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} - if response.status_code == 201: + if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) @@ -24130,33 +23913,30 @@ async def _create_or_update_initial( 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, + disk_encryption_set_name: str, + disk_encryption_set: _models.DiskEncryptionSet, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[None]: - """The operation to create or update the VMSS VM run command. + ) -> AsyncLROPoller[_models.DiskEncryptionSet]: + """Creates or updates a disk encryption set. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param vm_scale_set_name: The name of the VirtualMachineScaleSet. Required. - :type vm_scale_set_name: str - :param instance_id: The name of the VirtualMachineScaleSetVM. Required. - :type instance_id: str - :param run_command_name: The name of the VirtualMachineRunCommand. Required. - :type run_command_name: str - :param run_command: Parameters supplied to the Create Virtual Machine RunCommand operation. - Required. - :type run_command: ~azure.mgmt.compute.models.VirtualMachineRunCommand + :param disk_encryption_set_name: The name of the disk encryption set that is being created. The + name can't be changed after the disk encryption set is created. Supported characters for the + name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. + :type disk_encryption_set_name: str + :param disk_encryption_set: disk encryption set object supplied in the body of the Put disk + encryption set operation. Required. + :type disk_encryption_set: ~azure.mgmt.compute.models.DiskEncryptionSet :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns None - :rtype: ~azure.core.polling.AsyncLROPoller[None] + :return: An instance of AsyncLROPoller that returns DiskEncryptionSet. The DiskEncryptionSet is + compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.DiskEncryptionSet] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -24164,33 +23944,30 @@ async def begin_create_or_update( 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: JSON, + disk_encryption_set_name: str, + disk_encryption_set: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[None]: - """The operation to create or update the VMSS VM run command. + ) -> AsyncLROPoller[_models.DiskEncryptionSet]: + """Creates or updates a disk encryption set. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param vm_scale_set_name: The name of the VirtualMachineScaleSet. Required. - :type vm_scale_set_name: str - :param instance_id: The name of the VirtualMachineScaleSetVM. Required. - :type instance_id: str - :param run_command_name: The name of the VirtualMachineRunCommand. Required. - :type run_command_name: str - :param run_command: Parameters supplied to the Create Virtual Machine RunCommand operation. - Required. - :type run_command: JSON - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + :param disk_encryption_set_name: The name of the disk encryption set that is being created. The + name can't be changed after the disk encryption set is created. Supported characters for the + name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. + :type disk_encryption_set_name: str + :param disk_encryption_set: disk encryption set object supplied in the body of the Put disk + encryption set operation. Required. + :type disk_encryption_set: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns None - :rtype: ~azure.core.polling.AsyncLROPoller[None] + :return: An instance of AsyncLROPoller that returns DiskEncryptionSet. The DiskEncryptionSet is + compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.DiskEncryptionSet] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -24198,33 +23975,30 @@ async def begin_create_or_update( 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: IO[bytes], + disk_encryption_set_name: str, + disk_encryption_set: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[None]: - """The operation to create or update the VMSS VM run command. + ) -> AsyncLROPoller[_models.DiskEncryptionSet]: + """Creates or updates a disk encryption set. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param vm_scale_set_name: The name of the VirtualMachineScaleSet. Required. - :type vm_scale_set_name: str - :param instance_id: The name of the VirtualMachineScaleSetVM. Required. - :type instance_id: str - :param run_command_name: The name of the VirtualMachineRunCommand. Required. - :type run_command_name: str - :param run_command: Parameters supplied to the Create Virtual Machine RunCommand operation. - Required. - :type run_command: IO[bytes] + :param disk_encryption_set_name: The name of the disk encryption set that is being created. The + name can't be changed after the disk encryption set is created. Supported characters for the + name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. + :type disk_encryption_set_name: str + :param disk_encryption_set: disk encryption set object supplied in the body of the Put disk + encryption set operation. Required. + :type disk_encryption_set: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns None - :rtype: ~azure.core.polling.AsyncLROPoller[None] + :return: An instance of AsyncLROPoller that returns DiskEncryptionSet. The DiskEncryptionSet is + compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.DiskEncryptionSet] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -24232,45 +24006,41 @@ async def begin_create_or_update( 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: Union[_models.VirtualMachineRunCommand, JSON, IO[bytes]], + disk_encryption_set_name: str, + disk_encryption_set: Union[_models.DiskEncryptionSet, JSON, IO[bytes]], **kwargs: Any - ) -> AsyncLROPoller[None]: - """The operation to create or update the VMSS VM run command. + ) -> AsyncLROPoller[_models.DiskEncryptionSet]: + """Creates or updates a disk encryption set. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param vm_scale_set_name: The name of the VirtualMachineScaleSet. Required. - :type vm_scale_set_name: str - :param instance_id: The name of the VirtualMachineScaleSetVM. Required. - :type instance_id: str - :param run_command_name: The name of the VirtualMachineRunCommand. Required. - :type run_command_name: str - :param run_command: Parameters supplied to the Create Virtual Machine RunCommand operation. Is - one of the following types: VirtualMachineRunCommand, JSON, IO[bytes] Required. - :type run_command: ~azure.mgmt.compute.models.VirtualMachineRunCommand or JSON or IO[bytes] - :return: An instance of AsyncLROPoller that returns None - :rtype: ~azure.core.polling.AsyncLROPoller[None] + :param disk_encryption_set_name: The name of the disk encryption set that is being created. The + name can't be changed after the disk encryption set is created. Supported characters for the + name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. + :type disk_encryption_set_name: str + :param disk_encryption_set: disk encryption set object supplied in the body of the Put disk + encryption set operation. Is one of the following types: DiskEncryptionSet, JSON, IO[bytes] + Required. + :type disk_encryption_set: ~azure.mgmt.compute.models.DiskEncryptionSet or JSON or IO[bytes] + :return: An instance of AsyncLROPoller that returns DiskEncryptionSet. The DiskEncryptionSet is + compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.DiskEncryptionSet] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[_models.DiskEncryptionSet] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = await self._create_or_update_initial( resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, - instance_id=instance_id, - run_command_name=run_command_name, - run_command=run_command, + disk_encryption_set_name=disk_encryption_set_name, + disk_encryption_set=disk_encryption_set, content_type=content_type, cls=lambda x, y, z: x, headers=_headers, @@ -24280,9 +24050,12 @@ async def begin_create_or_update( await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.DiskEncryptionSet, response.json()) if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized path_format_arguments = { "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), @@ -24297,21 +24070,21 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return AsyncLROPoller[None].from_continuation_token( + return AsyncLROPoller[_models.DiskEncryptionSet].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + return AsyncLROPoller[_models.DiskEncryptionSet]( + self._client, raw_result, get_long_running_output, polling_method # 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: Union[_models.VirtualMachineRunCommandUpdate, JSON, IO[bytes]], + disk_encryption_set_name: str, + disk_encryption_set: Union[_models.DiskEncryptionSetUpdate, JSON, IO[bytes]], **kwargs: Any ) -> AsyncIterator[bytes]: error_map: MutableMapping = { @@ -24330,16 +24103,14 @@ async def _update_initial( content_type = content_type or "application/json" _content = None - if isinstance(run_command, (IOBase, bytes)): - _content = run_command + if isinstance(disk_encryption_set, (IOBase, bytes)): + _content = disk_encryption_set else: - _content = json.dumps(run_command, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(disk_encryption_set, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - _request = build_virtual_machine_scale_set_vm_run_commands_update_request( + _request = build_disk_encryption_sets_update_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, + disk_encryption_set_name=disk_encryption_set_name, subscription_id=self._config.subscription_id, content_type=content_type, api_version=self._config.api_version, @@ -24359,7 +24130,7 @@ async def _update_initial( response = pipeline_response.http_response - if response.status_code not in [200]: + if response.status_code not in [200, 202]: try: await response.read() # Load the body in memory and close the socket except (StreamConsumedError, StreamClosedError): @@ -24369,8 +24140,9 @@ async def _update_initial( raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) deserialized = response.iter_bytes() @@ -24383,32 +24155,30 @@ async def _update_initial( 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, + disk_encryption_set_name: str, + disk_encryption_set: _models.DiskEncryptionSetUpdate, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[None]: - """The operation to update the VMSS VM run command. + ) -> AsyncLROPoller[_models.DiskEncryptionSet]: + """Updates (patches) a disk encryption set. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param vm_scale_set_name: The name of the VirtualMachineScaleSet. Required. - :type vm_scale_set_name: str - :param instance_id: The name of the VirtualMachineScaleSetVM. Required. - :type instance_id: str - :param run_command_name: The name of the VirtualMachineRunCommand. Required. - :type run_command_name: str - :param run_command: Resource create parameters. Required. - :type run_command: ~azure.mgmt.compute.models.VirtualMachineRunCommandUpdate + :param disk_encryption_set_name: The name of the disk encryption set that is being created. The + name can't be changed after the disk encryption set is created. Supported characters for the + name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. + :type disk_encryption_set_name: str + :param disk_encryption_set: disk encryption set object supplied in the body of the Patch disk + encryption set operation. Required. + :type disk_encryption_set: ~azure.mgmt.compute.models.DiskEncryptionSetUpdate :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns None - :rtype: ~azure.core.polling.AsyncLROPoller[None] + :return: An instance of AsyncLROPoller that returns DiskEncryptionSet. The DiskEncryptionSet is + compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.DiskEncryptionSet] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -24416,32 +24186,30 @@ async def begin_update( async def begin_update( self, resource_group_name: str, - vm_scale_set_name: str, - instance_id: str, - run_command_name: str, - run_command: JSON, + disk_encryption_set_name: str, + disk_encryption_set: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[None]: - """The operation to update the VMSS VM run command. + ) -> AsyncLROPoller[_models.DiskEncryptionSet]: + """Updates (patches) a disk encryption set. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param vm_scale_set_name: The name of the VirtualMachineScaleSet. Required. - :type vm_scale_set_name: str - :param instance_id: The name of the VirtualMachineScaleSetVM. Required. - :type instance_id: str - :param run_command_name: The name of the VirtualMachineRunCommand. Required. - :type run_command_name: str - :param run_command: Resource create parameters. Required. - :type run_command: JSON + :param disk_encryption_set_name: The name of the disk encryption set that is being created. The + name can't be changed after the disk encryption set is created. Supported characters for the + name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. + :type disk_encryption_set_name: str + :param disk_encryption_set: disk encryption set object supplied in the body of the Patch disk + encryption set operation. Required. + :type disk_encryption_set: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns None - :rtype: ~azure.core.polling.AsyncLROPoller[None] + :return: An instance of AsyncLROPoller that returns DiskEncryptionSet. The DiskEncryptionSet is + compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.DiskEncryptionSet] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -24449,32 +24217,30 @@ async def begin_update( async def begin_update( self, resource_group_name: str, - vm_scale_set_name: str, - instance_id: str, - run_command_name: str, - run_command: IO[bytes], + disk_encryption_set_name: str, + disk_encryption_set: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[None]: - """The operation to update the VMSS VM run command. + ) -> AsyncLROPoller[_models.DiskEncryptionSet]: + """Updates (patches) a disk encryption set. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param vm_scale_set_name: The name of the VirtualMachineScaleSet. Required. - :type vm_scale_set_name: str - :param instance_id: The name of the VirtualMachineScaleSetVM. Required. - :type instance_id: str - :param run_command_name: The name of the VirtualMachineRunCommand. Required. - :type run_command_name: str - :param run_command: Resource create parameters. Required. - :type run_command: IO[bytes] + :param disk_encryption_set_name: The name of the disk encryption set that is being created. The + name can't be changed after the disk encryption set is created. Supported characters for the + name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. + :type disk_encryption_set_name: str + :param disk_encryption_set: disk encryption set object supplied in the body of the Patch disk + encryption set operation. Required. + :type disk_encryption_set: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns None - :rtype: ~azure.core.polling.AsyncLROPoller[None] + :return: An instance of AsyncLROPoller that returns DiskEncryptionSet. The DiskEncryptionSet is + compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.DiskEncryptionSet] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -24482,46 +24248,42 @@ async def begin_update( async def begin_update( self, resource_group_name: str, - vm_scale_set_name: str, - instance_id: str, - run_command_name: str, - run_command: Union[_models.VirtualMachineRunCommandUpdate, JSON, IO[bytes]], + disk_encryption_set_name: str, + disk_encryption_set: Union[_models.DiskEncryptionSetUpdate, JSON, IO[bytes]], **kwargs: Any - ) -> AsyncLROPoller[None]: - """The operation to update the VMSS VM run command. + ) -> AsyncLROPoller[_models.DiskEncryptionSet]: + """Updates (patches) a disk encryption set. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param vm_scale_set_name: The name of the VirtualMachineScaleSet. Required. - :type vm_scale_set_name: str - :param instance_id: The name of the VirtualMachineScaleSetVM. Required. - :type instance_id: str - :param run_command_name: The name of the VirtualMachineRunCommand. Required. - :type run_command_name: str - :param run_command: Resource create parameters. Is one of the following types: - VirtualMachineRunCommandUpdate, JSON, IO[bytes] Required. - :type run_command: ~azure.mgmt.compute.models.VirtualMachineRunCommandUpdate or JSON or + :param disk_encryption_set_name: The name of the disk encryption set that is being created. The + name can't be changed after the disk encryption set is created. Supported characters for the + name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. + :type disk_encryption_set_name: str + :param disk_encryption_set: disk encryption set object supplied in the body of the Patch disk + encryption set operation. Is one of the following types: DiskEncryptionSetUpdate, JSON, + IO[bytes] Required. + :type disk_encryption_set: ~azure.mgmt.compute.models.DiskEncryptionSetUpdate or JSON or IO[bytes] - :return: An instance of AsyncLROPoller that returns None - :rtype: ~azure.core.polling.AsyncLROPoller[None] + :return: An instance of AsyncLROPoller that returns DiskEncryptionSet. The DiskEncryptionSet is + compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.DiskEncryptionSet] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[_models.DiskEncryptionSet] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = await self._update_initial( resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, - instance_id=instance_id, - run_command_name=run_command_name, - run_command=run_command, + disk_encryption_set_name=disk_encryption_set_name, + disk_encryption_set=disk_encryption_set, content_type=content_type, cls=lambda x, y, z: x, headers=_headers, @@ -24531,9 +24293,12 @@ async def begin_update( await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.DiskEncryptionSet, response.json()) if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized path_format_arguments = { "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), @@ -24548,16 +24313,18 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return AsyncLROPoller[None].from_continuation_token( + return AsyncLROPoller[_models.DiskEncryptionSet].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + return AsyncLROPoller[_models.DiskEncryptionSet]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) async def _delete_initial( - self, resource_group_name: str, vm_scale_set_name: str, instance_id: str, run_command_name: str, **kwargs: Any + self, resource_group_name: str, disk_encryption_set_name: str, **kwargs: Any ) -> AsyncIterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -24572,11 +24339,9 @@ async def _delete_initial( cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - _request = build_virtual_machine_scale_set_vm_run_commands_delete_request( + _request = build_disk_encryption_sets_delete_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, + disk_encryption_set_name=disk_encryption_set_name, subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -24617,19 +24382,17 @@ async def _delete_initial( @distributed_trace_async async def begin_delete( - self, resource_group_name: str, vm_scale_set_name: str, instance_id: str, run_command_name: str, **kwargs: Any + self, resource_group_name: str, disk_encryption_set_name: str, **kwargs: Any ) -> AsyncLROPoller[None]: - """The operation to delete the VMSS VM run command. + """Deletes a disk encryption set. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param vm_scale_set_name: The name of the VirtualMachineScaleSet. Required. - :type vm_scale_set_name: str - :param instance_id: The name of the VirtualMachineScaleSetVM. Required. - :type instance_id: str - :param run_command_name: The name of the VirtualMachineRunCommand. Required. - :type run_command_name: str + :param disk_encryption_set_name: The name of the disk encryption set that is being created. The + name can't be changed after the disk encryption set is created. Supported characters for the + name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. + :type disk_encryption_set_name: str :return: An instance of AsyncLROPoller that returns None :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -24644,9 +24407,7 @@ async def begin_delete( 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, + disk_encryption_set_name=disk_encryption_set_name, cls=lambda x, y, z: x, headers=_headers, params=_params, @@ -24681,35 +24442,22 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # 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 - ) -> AsyncItemPaged["_models.VirtualMachineRunCommand"]: - """The operation to get all run commands of an instance in Virtual Machine Scaleset. + def list_by_resource_group( + self, resource_group_name: str, **kwargs: Any + ) -> AsyncItemPaged["_models.DiskEncryptionSet"]: + """Lists all the disk encryption sets under a resource group. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param vm_scale_set_name: The name of the VirtualMachineScaleSet. Required. - :type vm_scale_set_name: str - :param instance_id: The name of the VirtualMachineScaleSetVM. Required. - :type instance_id: str - :keyword expand: The expand expression to apply on the operation. Default value is None. - :paramtype expand: str - :return: An iterator like instance of VirtualMachineRunCommand - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.models.VirtualMachineRunCommand] + :return: An iterator like instance of DiskEncryptionSet + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.models.DiskEncryptionSet] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.VirtualMachineRunCommand]] = kwargs.pop("cls", None) + cls: ClsType[List[_models.DiskEncryptionSet]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -24722,12 +24470,9 @@ def list( def prepare_request(next_link=None): if not next_link: - _request = build_virtual_machine_scale_set_vm_run_commands_list_request( + _request = build_disk_encryption_sets_list_by_resource_group_request( resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, - instance_id=instance_id, subscription_id=self._config.subscription_id, - expand=expand, api_version=self._config.api_version, headers=_headers, params=_params, @@ -24763,7 +24508,7 @@ def prepare_request(next_link=None): async def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.VirtualMachineRunCommand], deserialized.get("value", [])) + list_of_elem = _deserialize(List[_models.DiskEncryptionSet], deserialized.get("value", [])) if cls: list_of_elem = cls(list_of_elem) # type: ignore return deserialized.get("nextLink") or None, AsyncList(list_of_elem) @@ -24786,39 +24531,18 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - -class UsageOperationGroupOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.compute.aio.ComputeClient`'s - :attr:`usage_operation_group` attribute. - """ - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ComputeClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list(self, location: str, **kwargs: Any) -> AsyncItemPaged["_models.Usage"]: - """Gets, for the specified location, the current compute resource usage information as well as the - limits for compute resources under the subscription. + def list(self, **kwargs: Any) -> AsyncItemPaged["_models.DiskEncryptionSet"]: + """Lists all the disk encryption sets under a subscription. - :param location: The location name. Required. - :type location: str - :return: An iterator like instance of Usage - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.models.Usage] + :return: An iterator like instance of DiskEncryptionSet + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.models.DiskEncryptionSet] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.Usage]] = kwargs.pop("cls", None) + cls: ClsType[List[_models.DiskEncryptionSet]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -24831,8 +24555,7 @@ def list(self, location: str, **kwargs: Any) -> AsyncItemPaged["_models.Usage"]: def prepare_request(next_link=None): if not next_link: - _request = build_usage_operation_group_list_request( - location=location, + _request = build_disk_encryption_sets_list_request( subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -24869,7 +24592,7 @@ def prepare_request(next_link=None): async def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.Usage], deserialized.get("value", [])) + list_of_elem = _deserialize(List[_models.DiskEncryptionSet], deserialized.get("value", [])) if cls: list_of_elem = cls(list_of_elem) # type: ignore return deserialized.get("nextLink") or None, AsyncList(list_of_elem) @@ -24892,39 +24615,27 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - -class VirtualMachineSizesOperationGroupOperations: # pylint: disable=name-too-long - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.compute.aio.ComputeClient`'s - :attr:`virtual_machine_sizes_operation_group` attribute. - """ - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ComputeClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list(self, location: str, **kwargs: Any) -> AsyncItemPaged["_models.VirtualMachineSize"]: - """This API is deprecated. Use `Resources Skus - `_. + def list_associated_resources( + self, resource_group_name: str, disk_encryption_set_name: str, **kwargs: Any + ) -> AsyncItemPaged[str]: + """Lists all resources that are encrypted with this disk encryption set. - :param location: The location name. Required. - :type location: str - :return: An iterator like instance of VirtualMachineSize - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.models.VirtualMachineSize] + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param disk_encryption_set_name: The name of the disk encryption set that is being created. The + name can't be changed after the disk encryption set is created. Supported characters for the + name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. + :type disk_encryption_set_name: str + :return: An iterator like instance of str + :rtype: ~azure.core.async_paging.AsyncItemPaged[str] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.VirtualMachineSize]] = kwargs.pop("cls", None) + cls: ClsType[List[str]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -24937,8 +24648,9 @@ def list(self, location: str, **kwargs: Any) -> AsyncItemPaged["_models.VirtualM def prepare_request(next_link=None): if not next_link: - _request = build_virtual_machine_sizes_operation_group_list_request( - location=location, + _request = build_disk_encryption_sets_list_associated_resources_request( + resource_group_name=resource_group_name, + disk_encryption_set_name=disk_encryption_set_name, subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -24975,7 +24687,7 @@ def prepare_request(next_link=None): async def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.VirtualMachineSize], deserialized.get("value", [])) + list_of_elem = _deserialize(List[str], deserialized.get("value", [])) if cls: list_of_elem = cls(list_of_elem) # type: ignore return deserialized.get("nextLink") or None, AsyncList(list_of_elem) @@ -24999,14 +24711,14 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) -class VirtualMachineScaleSetsOperationGroupOperations: # pylint: disable=name-too-long +class SnapshotsOperations: """ .. warning:: **DO NOT** instantiate this class directly. Instead, you should access the following operations through :class:`~azure.mgmt.compute.aio.ComputeClient`'s - :attr:`virtual_machine_scale_sets_operation_group` attribute. + :attr:`snapshots` attribute. """ def __init__(self, *args, **kwargs) -> None: @@ -25016,22 +24728,21 @@ def __init__(self, *args, **kwargs) -> None: self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list_by_location(self, location: str, **kwargs: Any) -> AsyncItemPaged["_models.VirtualMachineScaleSet"]: - """Gets all the VM scale sets under the specified subscription for the specified location. + @distributed_trace_async + async def get(self, resource_group_name: str, snapshot_name: str, **kwargs: Any) -> _models.Snapshot: + """Gets information about a snapshot. - :param location: The location name. Required. - :type location: str - :return: An iterator like instance of VirtualMachineScaleSet - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.models.VirtualMachineScaleSet] + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param snapshot_name: The name of the snapshot that is being created. The name can't be changed + after the snapshot is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. + The max name length is 80 characters. Required. + :type snapshot_name: str + :return: Snapshot. The Snapshot is compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.Snapshot :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[List[_models.VirtualMachineScaleSet]] = kwargs.pop("cls", None) - error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -25040,225 +24751,86 @@ def list_by_location(self, location: str, **kwargs: Any) -> AsyncItemPaged["_mod } error_map.update(kwargs.pop("error_map", {}) or {}) - def prepare_request(next_link=None): - if not next_link: + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} - _request = build_virtual_machine_scale_sets_operation_group_list_by_location_request( - location=location, - subscription_id=self._config.subscription_id, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) + cls: ClsType[_models.Snapshot] = kwargs.pop("cls", None) - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) + _request = build_snapshots_get_request( + resource_group_name=resource_group_name, + snapshot_name=snapshot_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) - return _request + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) - async def extract_data(pipeline_response): - deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.VirtualMachineScaleSet], deserialized.get("value", [])) - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + response = pipeline_response.http_response - async def get_next(next_link=None): - _request = prepare_request(next_link) + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.Snapshot, response.json()) - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.CloudError, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore - return pipeline_response + return deserialized # type: ignore - return AsyncItemPaged(get_next, extract_data) + async def _create_or_update_initial( + self, + resource_group_name: str, + snapshot_name: str, + snapshot: Union[_models.Snapshot, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} -class VirtualMachinesOperationGroupOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.compute.aio.ComputeClient`'s - :attr:`virtual_machines_operation_group` attribute. - """ - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ComputeClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list_by_location(self, location: str, **kwargs: Any) -> AsyncItemPaged["_models.VirtualMachine"]: - """Gets all the virtual machines under the specified subscription for the specified location. - - :param location: The location name. Required. - :type location: str - :return: An iterator like instance of VirtualMachine - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.models.VirtualMachine] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[List[_models.VirtualMachine]] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_virtual_machines_operation_group_list_by_location_request( - location=location, - subscription_id=self._config.subscription_id, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - return _request - - async def extract_data(pipeline_response): - deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.VirtualMachine], deserialized.get("value", [])) - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.get("nextLink") or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.CloudError, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - -class VirtualMachineImagesEdgeZoneOperationGroupOperations: # pylint: disable=name-too-long - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.compute.aio.ComputeClient`'s - :attr:`virtual_machine_images_edge_zone_operation_group` attribute. - """ - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ComputeClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @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 location name. Required. - :type location: str - :param edge_zone: The name of the edge zone. Required. - :type edge_zone: str - :return: list of VirtualMachineImageResource - :rtype: list[~azure.mgmt.compute.models.VirtualMachineImageResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - cls: ClsType[List[_models.VirtualMachineImageResource]] = kwargs.pop("cls", None) + content_type = content_type or "application/json" + _content = None + if isinstance(snapshot, (IOBase, bytes)): + _content = snapshot + else: + _content = json.dumps(snapshot, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - _request = build_virtual_machine_images_edge_zone_operation_group_list_publishers_request( - location=location, - edge_zone=edge_zone, + _request = build_snapshots_create_or_update_request( + resource_group_name=resource_group_name, + snapshot_name=snapshot_name, subscription_id=self._config.subscription_id, + content_type=content_type, api_version=self._config.api_version, + content=_content, headers=_headers, params=_params, ) @@ -25267,123 +24839,208 @@ async def list_publishers( } _request.url = self._client.format_url(_request.url, **path_format_arguments) - _stream = kwargs.pop("stream", False) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200]: - if _stream: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass + if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = _failsafe_deserialize(_models.CloudError, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if _stream: - deserialized = response.iter_bytes() - else: - deserialized = _deserialize(List[_models.VirtualMachineImageResource], response.json()) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # 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. + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + snapshot_name: str, + snapshot: _models.Snapshot, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.Snapshot]: + """Creates or updates a snapshot. - :param location: The location name. Required. - :type location: str - :param edge_zone: The name of the edge zone. Required. - :type edge_zone: str - :param publisher_name: A valid image publisher. Required. - :type publisher_name: str - :return: list of VirtualMachineImageResource - :rtype: list[~azure.mgmt.compute.models.VirtualMachineImageResource] + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param snapshot_name: The name of the snapshot that is being created. The name can't be changed + after the snapshot is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. + The max name length is 80 characters. Required. + :type snapshot_name: str + :param snapshot: Snapshot object supplied in the body of the Put disk operation. Required. + :type snapshot: ~azure.mgmt.compute.models.Snapshot + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns Snapshot. The Snapshot is compatible with + MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.Snapshot] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + snapshot_name: str, + snapshot: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.Snapshot]: + """Creates or updates a snapshot. - cls: ClsType[List[_models.VirtualMachineImageResource]] = kwargs.pop("cls", None) + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param snapshot_name: The name of the snapshot that is being created. The name can't be changed + after the snapshot is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. + The max name length is 80 characters. Required. + :type snapshot_name: str + :param snapshot: Snapshot object supplied in the body of the Put disk operation. Required. + :type snapshot: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns Snapshot. The Snapshot is compatible with + MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.Snapshot] + :raises ~azure.core.exceptions.HttpResponseError: + """ - _request = build_virtual_machine_images_edge_zone_operation_group_list_offers_request( - location=location, - edge_zone=edge_zone, - publisher_name=publisher_name, - subscription_id=self._config.subscription_id, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + snapshot_name: str, + snapshot: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.Snapshot]: + """Creates or updates a snapshot. - _stream = kwargs.pop("stream", False) - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param snapshot_name: The name of the snapshot that is being created. The name can't be changed + after the snapshot is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. + The max name length is 80 characters. Required. + :type snapshot_name: str + :param snapshot: Snapshot object supplied in the body of the Put disk operation. Required. + :type snapshot: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns Snapshot. The Snapshot is compatible with + MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.Snapshot] + :raises ~azure.core.exceptions.HttpResponseError: + """ - response = pipeline_response.http_response + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + snapshot_name: str, + snapshot: Union[_models.Snapshot, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.Snapshot]: + """Creates or updates a snapshot. - if response.status_code not in [200]: - if _stream: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.CloudError, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param snapshot_name: The name of the snapshot that is being created. The name can't be changed + after the snapshot is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. + The max name length is 80 characters. Required. + :type snapshot_name: str + :param snapshot: Snapshot object supplied in the body of the Put disk operation. Is one of the + following types: Snapshot, JSON, IO[bytes] Required. + :type snapshot: ~azure.mgmt.compute.models.Snapshot or JSON or IO[bytes] + :return: An instance of AsyncLROPoller that returns Snapshot. The Snapshot is compatible with + MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.Snapshot] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} - if _stream: - deserialized = response.iter_bytes() - else: - deserialized = _deserialize(List[_models.VirtualMachineImageResource], response.json()) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Snapshot] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._create_or_update_initial( + resource_group_name=resource_group_name, + snapshot_name=snapshot_name, + snapshot=snapshot, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.Snapshot, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized - return deserialized # type: ignore + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } - @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. + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.Snapshot].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.Snapshot]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) - :param location: The location name. Required. - :type location: str - :param edge_zone: The name of the edge zone. Required. - :type edge_zone: str - :param publisher_name: A valid image publisher. Required. - :type publisher_name: str - :param offer: A valid image publisher offer. Required. - :type offer: str - :return: list of VirtualMachineImageResource - :rtype: list[~azure.mgmt.compute.models.VirtualMachineImageResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ + async def _update_initial( + self, + resource_group_name: str, + snapshot_name: str, + snapshot: Union[_models.SnapshotUpdate, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -25392,18 +25049,26 @@ async def list_skus( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.VirtualMachineImageResource]] = kwargs.pop("cls", None) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - _request = build_virtual_machine_images_edge_zone_operation_group_list_skus_request( - location=location, - edge_zone=edge_zone, - publisher_name=publisher_name, - offer=offer, + content_type = content_type or "application/json" + _content = None + if isinstance(snapshot, (IOBase, bytes)): + _content = snapshot + else: + _content = json.dumps(snapshot, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_snapshots_update_request( + resource_group_name=resource_group_name, + snapshot_name=snapshot_name, subscription_id=self._config.subscription_id, + content_type=content_type, api_version=self._config.api_version, + content=_content, headers=_headers, params=_params, ) @@ -25412,153 +25077,207 @@ async def list_skus( } _request.url = self._client.format_url(_request.url, **path_format_arguments) - _stream = kwargs.pop("stream", False) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200]: - if _stream: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass + if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = _failsafe_deserialize(_models.CloudError, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if _stream: - deserialized = response.iter_bytes() - else: - deserialized = _deserialize(List[_models.VirtualMachineImageResource], response.json()) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore - @distributed_trace_async - async def list( + @overload + async def begin_update( self, - location: str, - edge_zone: str, - publisher_name: str, - offer: str, - skus: str, + resource_group_name: str, + snapshot_name: str, + snapshot: _models.SnapshotUpdate, *, - expand: Optional[str] = None, - top: Optional[int] = None, - orderby: Optional[str] = None, + content_type: str = "application/json", **kwargs: Any - ) -> List[_models.VirtualMachineImageResource]: - """Gets a list of all virtual machine image versions for the specified location, edge zone, - publisher, offer, and SKU. + ) -> AsyncLROPoller[_models.Snapshot]: + """Updates (patches) a snapshot. - :param location: The location name. Required. - :type location: str - :param edge_zone: The name of the edge zone. Required. - :type edge_zone: str - :param publisher_name: A valid image publisher. Required. - :type publisher_name: str - :param offer: A valid image publisher offer. Required. - :type offer: str - :param skus: A valid image SKU. Required. - :type skus: str - :keyword expand: The expand expression to apply on the operation. Default value is None. - :paramtype expand: str - :keyword top: An integer value specifying the number of images to return that matches supplied - values. Default value is None. - :paramtype top: int - :keyword orderby: Specifies the order of the results returned. Formatted as an OData query. - Default value is None. - :paramtype orderby: str - :return: list of VirtualMachineImageResource - :rtype: list[~azure.mgmt.compute.models.VirtualMachineImageResource] + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param snapshot_name: The name of the snapshot that is being created. The name can't be changed + after the snapshot is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. + The max name length is 80 characters. Required. + :type snapshot_name: str + :param snapshot: Snapshot object supplied in the body of the Patch snapshot operation. + Required. + :type snapshot: ~azure.mgmt.compute.models.SnapshotUpdate + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns Snapshot. The Snapshot is compatible with + MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.Snapshot] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[List[_models.VirtualMachineImageResource]] = kwargs.pop("cls", None) + @overload + async def begin_update( + self, + resource_group_name: str, + snapshot_name: str, + snapshot: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.Snapshot]: + """Updates (patches) a snapshot. - _request = build_virtual_machine_images_edge_zone_operation_group_list_request( - location=location, - edge_zone=edge_zone, - publisher_name=publisher_name, - offer=offer, - skus=skus, - subscription_id=self._config.subscription_id, - expand=expand, - top=top, - orderby=orderby, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param snapshot_name: The name of the snapshot that is being created. The name can't be changed + after the snapshot is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. + The max name length is 80 characters. Required. + :type snapshot_name: str + :param snapshot: Snapshot object supplied in the body of the Patch snapshot operation. + Required. + :type snapshot: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns Snapshot. The Snapshot is compatible with + MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.Snapshot] + :raises ~azure.core.exceptions.HttpResponseError: + """ - _stream = kwargs.pop("stream", False) - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) + @overload + async def begin_update( + self, + resource_group_name: str, + snapshot_name: str, + snapshot: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.Snapshot]: + """Updates (patches) a snapshot. - response = pipeline_response.http_response + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param snapshot_name: The name of the snapshot that is being created. The name can't be changed + after the snapshot is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. + The max name length is 80 characters. Required. + :type snapshot_name: str + :param snapshot: Snapshot object supplied in the body of the Patch snapshot operation. + Required. + :type snapshot: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns Snapshot. The Snapshot is compatible with + MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.Snapshot] + :raises ~azure.core.exceptions.HttpResponseError: + """ - if response.status_code not in [200]: - if _stream: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.CloudError, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + @distributed_trace_async + async def begin_update( + self, + resource_group_name: str, + snapshot_name: str, + snapshot: Union[_models.SnapshotUpdate, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.Snapshot]: + """Updates (patches) a snapshot. - if _stream: - deserialized = response.iter_bytes() - else: - deserialized = _deserialize(List[_models.VirtualMachineImageResource], response.json()) + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param snapshot_name: The name of the snapshot that is being created. The name can't be changed + after the snapshot is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. + The max name length is 80 characters. Required. + :type snapshot_name: str + :param snapshot: Snapshot object supplied in the body of the Patch snapshot operation. Is one + of the following types: SnapshotUpdate, JSON, IO[bytes] Required. + :type snapshot: ~azure.mgmt.compute.models.SnapshotUpdate or JSON or IO[bytes] + :return: An instance of AsyncLROPoller that returns Snapshot. The Snapshot is compatible with + MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.Snapshot] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Snapshot] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._update_initial( + resource_group_name=resource_group_name, + snapshot_name=snapshot_name, + snapshot=snapshot, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) - return deserialized # type: ignore + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.Snapshot, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized - @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. + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } - :param location: The name of the Azure region. Required. - :type location: str - :param edge_zone: The name of the edge zone. Required. - :type edge_zone: str - :param publisher_name: A valid image publisher. Required. - :type publisher_name: str - :param offer: A valid image publisher offer. Required. - :type offer: str - :param skus: A valid image SKU. Required. - :type skus: str - :param version: A valid image SKU version. Required. - :type version: str - :return: VirtualMachineImage. The VirtualMachineImage is compatible with MutableMapping - :rtype: ~azure.mgmt.compute.models.VirtualMachineImage - :raises ~azure.core.exceptions.HttpResponseError: - """ + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.Snapshot].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.Snapshot]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _delete_initial( + self, resource_group_name: str, snapshot_name: str, **kwargs: Any + ) -> AsyncIterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -25570,15 +25289,11 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.VirtualMachineImage] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - _request = build_virtual_machine_images_edge_zone_operation_group_get_request( - location=location, - edge_zone=edge_zone, - publisher_name=publisher_name, - offer=offer, - skus=skus, - version=version, + _request = build_snapshots_delete_request( + resource_group_name=resource_group_name, + snapshot_name=snapshot_name, subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -25589,66 +25304,109 @@ async def get( } _request.url = self._client.format_url(_request.url, **path_format_arguments) - _stream = kwargs.pop("stream", False) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200]: - if _stream: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass + if response.status_code not in [200, 202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = _failsafe_deserialize(_models.CloudError, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if _stream: - deserialized = response.iter_bytes() - else: - deserialized = _deserialize(_models.VirtualMachineImage, response.json()) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore + @distributed_trace_async + async def begin_delete(self, resource_group_name: str, snapshot_name: str, **kwargs: Any) -> AsyncLROPoller[None]: + """Deletes a snapshot. -class VirtualMachineImagesOperationGroupOperations: # pylint: disable=name-too-long - """ - .. warning:: - **DO NOT** instantiate this class directly. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param snapshot_name: The name of the snapshot that is being created. The name can't be changed + after the snapshot is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. + The max name length is 80 characters. Required. + :type snapshot_name: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} - Instead, you should access the following operations through - :class:`~azure.mgmt.compute.aio.ComputeClient`'s - :attr:`virtual_machine_images_operation_group` attribute. - """ + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + snapshot_name=snapshot_name, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ComputeClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore - @distributed_trace_async - async def list_by_edge_zone( - self, location: str, edge_zone: str, **kwargs: Any - ) -> _models.VmImagesInEdgeZoneListResult: - """Gets a list of all virtual machine image versions for the specified edge zone. + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } - :param location: The location name. Required. - :type location: str - :param edge_zone: The name of the edge zone. Required. - :type edge_zone: str - :return: VmImagesInEdgeZoneListResult. The VmImagesInEdgeZoneListResult is compatible with - MutableMapping - :rtype: ~azure.mgmt.compute.models.VmImagesInEdgeZoneListResult + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace + def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> AsyncItemPaged["_models.Snapshot"]: + """Lists snapshots under a resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :return: An iterator like instance of Snapshot + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.models.Snapshot] :raises ~azure.core.exceptions.HttpResponseError: """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.Snapshot]] = kwargs.pop("cls", None) + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -25657,61 +25415,161 @@ async def list_by_edge_zone( } error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): + if not next_link: + + _request = build_snapshots_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.Snapshot], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + @distributed_trace + def list(self, **kwargs: Any) -> AsyncItemPaged["_models.Snapshot"]: + """Lists snapshots under a subscription. + + :return: An iterator like instance of Snapshot + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.models.Snapshot] + :raises ~azure.core.exceptions.HttpResponseError: + """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.VmImagesInEdgeZoneListResult] = kwargs.pop("cls", None) + cls: ClsType[List[_models.Snapshot]] = kwargs.pop("cls", None) - _request = build_virtual_machine_images_operation_group_list_by_edge_zone_request( - location=location, - edge_zone=edge_zone, - subscription_id=self._config.subscription_id, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - _request.url = self._client.format_url(_request.url, **path_format_arguments) + error_map.update(kwargs.pop("error_map", {}) or {}) - _stream = kwargs.pop("stream", False) - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) + def prepare_request(next_link=None): + if not next_link: - response = pipeline_response.http_response + _request = build_snapshots_list_request( + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) - if response.status_code not in [200]: - if _stream: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.CloudError, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) - if _stream: - deserialized = response.iter_bytes() - else: - deserialized = _deserialize(_models.VmImagesInEdgeZoneListResult, response.json()) + return _request - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.Snapshot], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) - return deserialized # type: ignore + async def get_next(next_link=None): + _request = prepare_request(next_link) - @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. + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response - :param location: The location name. Required. - :type location: str - :return: list of VirtualMachineImageResource - :rtype: list[~azure.mgmt.compute.models.VirtualMachineImageResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + async def _grant_access_initial( + self, + resource_group_name: str, + snapshot_name: str, + grant_access_data: Union[_models.GrantAccessData, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -25720,15 +25578,26 @@ async def list_publishers(self, location: str, **kwargs: Any) -> List[_models.Vi } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.VirtualMachineImageResource]] = kwargs.pop("cls", None) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - _request = build_virtual_machine_images_operation_group_list_publishers_request( - location=location, + content_type = content_type or "application/json" + _content = None + if isinstance(grant_access_data, (IOBase, bytes)): + _content = grant_access_data + else: + _content = json.dumps(grant_access_data, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_snapshots_grant_access_request( + resource_group_name=resource_group_name, + snapshot_name=snapshot_name, subscription_id=self._config.subscription_id, + content_type=content_type, api_version=self._config.api_version, + content=_content, headers=_headers, params=_params, ) @@ -25737,47 +25606,211 @@ async def list_publishers(self, location: str, **kwargs: Any) -> List[_models.Vi } _request.url = self._client.format_url(_request.url, **path_format_arguments) - _stream = kwargs.pop("stream", False) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200]: - if _stream: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass + if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = _failsafe_deserialize(_models.CloudError, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if _stream: - deserialized = response.iter_bytes() - else: - deserialized = _deserialize(List[_models.VirtualMachineImageResource], response.json()) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore + @overload + async def begin_grant_access( + self, + resource_group_name: str, + snapshot_name: str, + grant_access_data: _models.GrantAccessData, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.AccessUri]: + """Grants access to a snapshot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param snapshot_name: The name of the snapshot that is being created. The name can't be changed + after the snapshot is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. + The max name length is 80 characters. Required. + :type snapshot_name: str + :param grant_access_data: Access data object supplied in the body of the get snapshot access + operation. Required. + :type grant_access_data: ~azure.mgmt.compute.models.GrantAccessData + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns AccessUri. The AccessUri is compatible with + MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.AccessUri] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_grant_access( + self, + resource_group_name: str, + snapshot_name: str, + grant_access_data: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.AccessUri]: + """Grants access to a snapshot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param snapshot_name: The name of the snapshot that is being created. The name can't be changed + after the snapshot is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. + The max name length is 80 characters. Required. + :type snapshot_name: str + :param grant_access_data: Access data object supplied in the body of the get snapshot access + operation. Required. + :type grant_access_data: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns AccessUri. The AccessUri is compatible with + MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.AccessUri] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_grant_access( + self, + resource_group_name: str, + snapshot_name: str, + grant_access_data: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.AccessUri]: + """Grants access to a snapshot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param snapshot_name: The name of the snapshot that is being created. The name can't be changed + after the snapshot is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. + The max name length is 80 characters. Required. + :type snapshot_name: str + :param grant_access_data: Access data object supplied in the body of the get snapshot access + operation. Required. + :type grant_access_data: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns AccessUri. The AccessUri is compatible with + MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.AccessUri] + :raises ~azure.core.exceptions.HttpResponseError: + """ + @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. + async def begin_grant_access( + self, + resource_group_name: str, + snapshot_name: str, + grant_access_data: Union[_models.GrantAccessData, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.AccessUri]: + """Grants access to a snapshot. - :param location: The location name. Required. - :type location: str - :param publisher_name: A valid image publisher. Required. - :type publisher_name: str - :return: list of VirtualMachineImageResource - :rtype: list[~azure.mgmt.compute.models.VirtualMachineImageResource] + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param snapshot_name: The name of the snapshot that is being created. The name can't be changed + after the snapshot is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. + The max name length is 80 characters. Required. + :type snapshot_name: str + :param grant_access_data: Access data object supplied in the body of the get snapshot access + operation. Is one of the following types: GrantAccessData, JSON, IO[bytes] Required. + :type grant_access_data: ~azure.mgmt.compute.models.GrantAccessData or JSON or IO[bytes] + :return: An instance of AsyncLROPoller that returns AccessUri. The AccessUri is compatible with + MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.AccessUri] :raises ~azure.core.exceptions.HttpResponseError: """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AccessUri] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._grant_access_initial( + resource_group_name=resource_group_name, + snapshot_name=snapshot_name, + grant_access_data=grant_access_data, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = _deserialize(_models.AccessUri, response.json()) + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.AccessUri].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.AccessUri]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _revoke_access_initial( + self, resource_group_name: str, snapshot_name: str, **kwargs: Any + ) -> AsyncIterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -25789,11 +25822,11 @@ async def list_offers( _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.VirtualMachineImageResource]] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - _request = build_virtual_machine_images_operation_group_list_offers_request( - location=location, - publisher_name=publisher_name, + _request = build_snapshots_revoke_access_request( + resource_group_name=resource_group_name, + snapshot_name=snapshot_name, subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -25804,135 +25837,138 @@ async def list_offers( } _request.url = self._client.format_url(_request.url, **path_format_arguments) - _stream = kwargs.pop("stream", False) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200]: - if _stream: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass + if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = _failsafe_deserialize(_models.CloudError, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if _stream: - deserialized = response.iter_bytes() - else: - deserialized = _deserialize(List[_models.VirtualMachineImageResource], response.json()) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # 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. + async def begin_revoke_access( + self, resource_group_name: str, snapshot_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Revokes access to a snapshot. - :param location: The location name. Required. - :type location: str - :param publisher_name: A valid image publisher. Required. - :type publisher_name: str - :param offer: A valid image publisher offer. Required. - :type offer: str - :return: list of VirtualMachineImageResource - :rtype: list[~azure.mgmt.compute.models.VirtualMachineImageResource] + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param snapshot_name: The name of the snapshot that is being created. The name can't be changed + after the snapshot is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. + The max name length is 80 characters. Required. + :type snapshot_name: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.VirtualMachineImageResource]] = kwargs.pop("cls", None) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._revoke_access_initial( + resource_group_name=resource_group_name, + snapshot_name=snapshot_name, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore - _request = build_virtual_machine_images_operation_group_list_skus_request( - location=location, - publisher_name=publisher_name, - offer=offer, - subscription_id=self._config.subscription_id, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) path_format_arguments = { "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = kwargs.pop("stream", False) - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - if response.status_code not in [200]: - if _stream: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.CloudError, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if _stream: - deserialized = response.iter_bytes() - else: - deserialized = _deserialize(List[_models.VirtualMachineImageResource], response.json()) +class GalleriesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + Instead, you should access the following operations through + :class:`~azure.mgmt.compute.aio.ComputeClient`'s + :attr:`galleries` attribute. + """ - return deserialized # type: ignore + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace_async - async def list( + async def get( self, - location: str, - publisher_name: str, - offer: str, - skus: str, + resource_group_name: str, + gallery_name: str, *, - expand: Optional[str] = None, - top: Optional[int] = None, - orderby: Optional[str] = None, + select: Optional[Union[str, _models.SelectPermissions]] = None, + expand: Optional[Union[str, _models.GalleryExpandParams]] = None, **kwargs: Any - ) -> List[_models.VirtualMachineImageResource]: - """Gets a list of all virtual machine image versions for the specified location, publisher, offer, - and SKU. + ) -> _models.Gallery: + """Retrieves information about a Shared Image Gallery. - :param location: The location name. Required. - :type location: str - :param publisher_name: A valid image publisher. Required. - :type publisher_name: str - :param offer: A valid image publisher offer. Required. - :type offer: str - :param skus: A valid image SKU. Required. - :type skus: str - :keyword expand: The expand expression to apply on the operation. Default value is None. - :paramtype expand: str - :keyword top: Default value is None. - :paramtype top: int - :keyword orderby: Default value is None. - :paramtype orderby: str - :return: list of VirtualMachineImageResource - :rtype: list[~azure.mgmt.compute.models.VirtualMachineImageResource] + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :keyword select: The select expression to apply on the operation. "Permissions" Default value + is None. + :paramtype select: str or ~azure.mgmt.compute.models.SelectPermissions + :keyword expand: The expand query option to apply on the operation. "SharingProfile/Groups" + Default value is None. + :paramtype expand: str or ~azure.mgmt.compute.models.GalleryExpandParams + :return: Gallery. The Gallery is compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.Gallery :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -25946,17 +25982,14 @@ async def list( _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.VirtualMachineImageResource]] = kwargs.pop("cls", None) + cls: ClsType[_models.Gallery] = kwargs.pop("cls", None) - _request = build_virtual_machine_images_operation_group_list_request( - location=location, - publisher_name=publisher_name, - offer=offer, - skus=skus, + _request = build_galleries_get_request( + resource_group_name=resource_group_name, + gallery_name=gallery_name, subscription_id=self._config.subscription_id, + select=select, expand=expand, - top=top, - orderby=orderby, api_version=self._config.api_version, headers=_headers, params=_params, @@ -25986,46 +26019,20 @@ async def list( if _stream: deserialized = response.iter_bytes() else: - deserialized = _deserialize(List[_models.VirtualMachineImageResource], response.json()) + deserialized = _deserialize(_models.Gallery, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - @distributed_trace_async - async def list_with_properties( + async def _create_or_update_initial( self, - location: str, - publisher_name: str, - offer: str, - skus: str, - *, - expand: str, - top: Optional[int] = None, - orderby: Optional[str] = None, + resource_group_name: str, + gallery_name: str, + gallery: Union[_models.Gallery, JSON, IO[bytes]], **kwargs: Any - ) -> List[_models.VirtualMachineImage]: - """list_with_properties. - - :param location: The location name. Required. - :type location: str - :param publisher_name: A valid image publisher. Required. - :type publisher_name: str - :param offer: A valid image publisher offer. Required. - :type offer: str - :param skus: A valid image SKU. Required. - :type skus: str - :keyword expand: The expand expression to apply on the operation. Required. - :paramtype expand: str - :keyword top: Default value is None. - :paramtype top: int - :keyword orderby: Default value is None. - :paramtype orderby: str - :return: list of VirtualMachineImage - :rtype: list[~azure.mgmt.compute.models.VirtualMachineImage] - :raises ~azure.core.exceptions.HttpResponseError: - """ + ) -> AsyncIterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -26034,21 +26041,26 @@ async def list_with_properties( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.VirtualMachineImage]] = kwargs.pop("cls", None) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - _request = build_virtual_machine_images_operation_group_list_with_properties_request( - location=location, - publisher_name=publisher_name, - offer=offer, - skus=skus, + content_type = content_type or "application/json" + _content = None + if isinstance(gallery, (IOBase, bytes)): + _content = gallery + else: + _content = json.dumps(gallery, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_galleries_create_or_update_request( + resource_group_name=resource_group_name, + gallery_name=gallery_name, subscription_id=self._config.subscription_id, - expand=expand, - top=top, - orderby=orderby, + content_type=content_type, api_version=self._config.api_version, + content=_content, headers=_headers, params=_params, ) @@ -26057,129 +26069,206 @@ async def list_with_properties( } _request.url = self._client.format_url(_request.url, **path_format_arguments) - _stream = kwargs.pop("stream", False) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200]: - if _stream: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass + if response.status_code not in [200, 201, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = _failsafe_deserialize(_models.CloudError, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if _stream: - deserialized = response.iter_bytes() - else: - deserialized = _deserialize(List[_models.VirtualMachineImage], response.json()) + response_headers = {} + if response.status_code == 201: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore - @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 the Azure region. Required. - :type location: str - :param publisher_name: A valid image publisher. Required. - :type publisher_name: str - :param offer: A valid image publisher offer. Required. - :type offer: str - :param skus: A valid image SKU. Required. - :type skus: str - :param version: A valid image SKU version. Required. - :type version: str - :return: VirtualMachineImage. The VirtualMachineImage is compatible with MutableMapping - :rtype: ~azure.mgmt.compute.models.VirtualMachineImage + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + gallery_name: str, + gallery: _models.Gallery, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.Gallery]: + """Create or update a Shared Image Gallery. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param gallery: Parameters supplied to the create or update Shared Image Gallery operation. + Required. + :type gallery: ~azure.mgmt.compute.models.Gallery + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns Gallery. The Gallery is compatible with + MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.Gallery] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[_models.VirtualMachineImage] = kwargs.pop("cls", None) - - _request = build_virtual_machine_images_operation_group_get_request( - location=location, - publisher_name=publisher_name, - offer=offer, - skus=skus, - version=version, - subscription_id=self._config.subscription_id, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - _stream = kwargs.pop("stream", False) - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + gallery_name: str, + gallery: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.Gallery]: + """Create or update a Shared Image Gallery. - response = pipeline_response.http_response + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param gallery: Parameters supplied to the create or update Shared Image Gallery operation. + Required. + :type gallery: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns Gallery. The Gallery is compatible with + MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.Gallery] + :raises ~azure.core.exceptions.HttpResponseError: + """ - if response.status_code not in [200]: - if _stream: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.CloudError, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + gallery_name: str, + gallery: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.Gallery]: + """Create or update a Shared Image Gallery. - if _stream: - deserialized = response.iter_bytes() - else: - deserialized = _deserialize(_models.VirtualMachineImage, response.json()) + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param gallery: Parameters supplied to the create or update Shared Image Gallery operation. + Required. + :type gallery: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns Gallery. The Gallery is compatible with + MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.Gallery] + :raises ~azure.core.exceptions.HttpResponseError: + """ - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + gallery_name: str, + gallery: Union[_models.Gallery, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.Gallery]: + """Create or update a Shared Image Gallery. - return deserialized # type: ignore + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param gallery: Parameters supplied to the create or update Shared Image Gallery operation. Is + one of the following types: Gallery, JSON, IO[bytes] Required. + :type gallery: ~azure.mgmt.compute.models.Gallery or JSON or IO[bytes] + :return: An instance of AsyncLROPoller that returns Gallery. The Gallery is compatible with + MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.Gallery] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Gallery] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._create_or_update_initial( + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery=gallery, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) -class LogAnalyticsOperationGroupOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.Gallery, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized - Instead, you should access the following operations through - :class:`~azure.mgmt.compute.aio.ComputeClient`'s - :attr:`log_analytics_operation_group` attribute. - """ + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ComputeClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.Gallery].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.Gallery]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) - async def _export_request_rate_by_interval_initial( - self, location: str, parameters: Union[_models.RequestRateByIntervalInput, JSON, IO[bytes]], **kwargs: Any + async def _update_initial( + self, + resource_group_name: str, + gallery_name: str, + gallery: Union[_models.GalleryUpdate, JSON, IO[bytes]], + **kwargs: Any ) -> AsyncIterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -26197,13 +26286,14 @@ async def _export_request_rate_by_interval_initial( content_type = content_type or "application/json" _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters + if isinstance(gallery, (IOBase, bytes)): + _content = gallery else: - _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(gallery, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - _request = build_log_analytics_operation_group_export_request_rate_by_interval_request( - location=location, + _request = build_galleries_update_request( + resource_group_name=resource_group_name, + gallery_name=gallery_name, subscription_id=self._config.subscription_id, content_type=content_type, api_version=self._config.api_version, @@ -26223,7 +26313,7 @@ async def _export_request_rate_by_interval_initial( response = pipeline_response.http_response - if response.status_code not in [200, 202]: + if response.status_code not in [200]: try: await response.read() # Load the body in memory and close the socket except (StreamConsumedError, StreamClosedError): @@ -26233,11 +26323,8 @@ async def _export_request_rate_by_interval_initial( raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} - if response.status_code == 202: - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) deserialized = response.iter_bytes() @@ -26247,98 +26334,125 @@ async def _export_request_rate_by_interval_initial( return deserialized # type: ignore @overload - async def begin_export_request_rate_by_interval( + async def begin_update( self, - location: str, - parameters: _models.RequestRateByIntervalInput, + resource_group_name: str, + gallery_name: str, + gallery: _models.GalleryUpdate, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[None]: - """Export logs that show Api requests made by this subscription in the given time window to show - throttling activities. + ) -> AsyncLROPoller[_models.Gallery]: + """Update a Shared Image Gallery. - :param location: The location name. Required. - :type location: str - :param parameters: Parameters supplied to the LogAnalytics getRequestRateByInterval Api. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. - :type parameters: ~azure.mgmt.compute.models.RequestRateByIntervalInput + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param gallery: Parameters supplied to the update Shared Image Gallery operation. Required. + :type gallery: ~azure.mgmt.compute.models.GalleryUpdate :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns None - :rtype: ~azure.core.polling.AsyncLROPoller[None] + :return: An instance of AsyncLROPoller that returns Gallery. The Gallery is compatible with + MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.Gallery] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - async def begin_export_request_rate_by_interval( - self, location: str, parameters: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[None]: - """Export logs that show Api requests made by this subscription in the given time window to show - throttling activities. + async def begin_update( + self, + resource_group_name: str, + gallery_name: str, + gallery: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.Gallery]: + """Update a Shared Image Gallery. - :param location: The location name. Required. - :type location: str - :param parameters: Parameters supplied to the LogAnalytics getRequestRateByInterval Api. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. - :type parameters: JSON + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param gallery: Parameters supplied to the update Shared Image Gallery operation. Required. + :type gallery: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns None - :rtype: ~azure.core.polling.AsyncLROPoller[None] + :return: An instance of AsyncLROPoller that returns Gallery. The Gallery is compatible with + MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.Gallery] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - async def begin_export_request_rate_by_interval( - self, location: str, parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[None]: - """Export logs that show Api requests made by this subscription in the given time window to show - throttling activities. + async def begin_update( + self, + resource_group_name: str, + gallery_name: str, + gallery: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.Gallery]: + """Update a Shared Image Gallery. - :param location: The location name. Required. - :type location: str - :param parameters: Parameters supplied to the LogAnalytics getRequestRateByInterval Api. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. - :type parameters: IO[bytes] + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param gallery: Parameters supplied to the update Shared Image Gallery operation. Required. + :type gallery: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns None - :rtype: ~azure.core.polling.AsyncLROPoller[None] + :return: An instance of AsyncLROPoller that returns Gallery. The Gallery is compatible with + MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.Gallery] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace_async - async def begin_export_request_rate_by_interval( - self, location: str, parameters: Union[_models.RequestRateByIntervalInput, JSON, IO[bytes]], **kwargs: Any - ) -> AsyncLROPoller[None]: - """Export logs that show Api requests made by this subscription in the given time window to show - throttling activities. + async def begin_update( + self, + resource_group_name: str, + gallery_name: str, + gallery: Union[_models.GalleryUpdate, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.Gallery]: + """Update a Shared Image Gallery. - :param location: The location name. Required. - :type location: str - :param parameters: Parameters supplied to the LogAnalytics getRequestRateByInterval Api. Is one - of the following types: RequestRateByIntervalInput, JSON, IO[bytes] Required. - :type parameters: ~azure.mgmt.compute.models.RequestRateByIntervalInput or JSON or IO[bytes] - :return: An instance of AsyncLROPoller that returns None - :rtype: ~azure.core.polling.AsyncLROPoller[None] + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param gallery: Parameters supplied to the update Shared Image Gallery operation. Is one of the + following types: GalleryUpdate, JSON, IO[bytes] Required. + :type gallery: ~azure.mgmt.compute.models.GalleryUpdate or JSON or IO[bytes] + :return: An instance of AsyncLROPoller that returns Gallery. The Gallery is compatible with + MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.Gallery] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[_models.Gallery] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._export_request_rate_by_interval_initial( - location=location, - parameters=parameters, + raw_result = await self._update_initial( + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery=gallery, content_type=content_type, cls=lambda x, y, z: x, headers=_headers, @@ -26348,9 +26462,16 @@ async def begin_export_request_rate_by_interval( await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = _deserialize(_models.Gallery, response.json()) if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore + return deserialized path_format_arguments = { "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), @@ -26365,17 +26486,17 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return AsyncLROPoller[None].from_continuation_token( + return AsyncLROPoller[_models.Gallery].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + return AsyncLROPoller[_models.Gallery]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) - async def _export_throttled_requests_initial( - self, location: str, parameters: Union[_models.ThrottledRequestsInput, JSON, IO[bytes]], **kwargs: Any - ) -> AsyncIterator[bytes]: + async def _delete_initial(self, resource_group_name: str, gallery_name: str, **kwargs: Any) -> AsyncIterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -26384,25 +26505,16 @@ async def _export_throttled_requests_initial( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - content_type = content_type or "application/json" - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - - _request = build_log_analytics_operation_group_export_throttled_requests_request( - location=location, + _request = build_galleries_delete_request( + resource_group_name=resource_group_name, + gallery_name=gallery_name, subscription_id=self._config.subscription_id, - content_type=content_type, api_version=self._config.api_version, - content=_content, headers=_headers, params=_params, ) @@ -26418,7 +26530,7 @@ async def _export_throttled_requests_initial( response = pipeline_response.http_response - if response.status_code not in [200, 202]: + if response.status_code not in [200, 202, 204]: try: await response.read() # Load the body in memory and close the socket except (StreamConsumedError, StreamClosedError): @@ -26429,9 +26541,7 @@ async def _export_throttled_requests_initial( response_headers = {} if response.status_code == 202: - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) deserialized = response.iter_bytes() @@ -26441,97 +26551,30 @@ async def _export_throttled_requests_initial( return deserialized # type: ignore - @overload - async def begin_export_throttled_requests( - self, - location: str, - parameters: _models.ThrottledRequestsInput, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Export logs that show total throttled Api requests for this subscription in the given time - window. - - :param location: The location name. Required. - :type location: str - :param parameters: The request body. Required. - :type parameters: ~azure.mgmt.compute.models.ThrottledRequestsInput - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns None - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_export_throttled_requests( - self, location: str, parameters: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[None]: - """Export logs that show total throttled Api requests for this subscription in the given time - window. - - :param location: The location name. Required. - :type location: str - :param parameters: The request body. Required. - :type parameters: JSON - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns None - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_export_throttled_requests( - self, location: str, parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[None]: - """Export logs that show total throttled Api requests for this subscription in the given time - window. - - :param location: The location name. Required. - :type location: str - :param parameters: The request body. Required. - :type parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns None - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - @distributed_trace_async - async def begin_export_throttled_requests( - self, location: str, parameters: Union[_models.ThrottledRequestsInput, JSON, IO[bytes]], **kwargs: Any - ) -> AsyncLROPoller[None]: - """Export logs that show total throttled Api requests for this subscription in the given time - window. + async def begin_delete(self, resource_group_name: str, gallery_name: str, **kwargs: Any) -> AsyncLROPoller[None]: + """Delete a Shared Image Gallery. - :param location: The location name. Required. - :type location: str - :param parameters: The request body. Is one of the following types: ThrottledRequestsInput, - JSON, IO[bytes] Required. - :type parameters: ~azure.mgmt.compute.models.ThrottledRequestsInput or JSON or IO[bytes] + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str :return: An instance of AsyncLROPoller that returns None :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._export_throttled_requests_initial( - location=location, - parameters=parameters, - content_type=content_type, + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + gallery_name=gallery_name, cls=lambda x, y, z: x, headers=_headers, params=_params, @@ -26565,39 +26608,21 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - -class VirtualMachineRunCommandsOperationGroupOperations: # pylint: disable=name-too-long - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.compute.aio.ComputeClient`'s - :attr:`virtual_machine_run_commands_operation_group` attribute. - """ - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ComputeClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list(self, location: str, **kwargs: Any) -> AsyncItemPaged["_models.RunCommandDocumentBase"]: - """Lists all available run commands for a subscription in a location. + def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> AsyncItemPaged["_models.Gallery"]: + """List galleries under a resource group. - :param location: The location name. Required. - :type location: str - :return: An iterator like instance of RunCommandDocumentBase - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.models.RunCommandDocumentBase] + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :return: An iterator like instance of Gallery + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.models.Gallery] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.RunCommandDocumentBase]] = kwargs.pop("cls", None) + cls: ClsType[List[_models.Gallery]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -26610,8 +26635,8 @@ def list(self, location: str, **kwargs: Any) -> AsyncItemPaged["_models.RunComma def prepare_request(next_link=None): if not next_link: - _request = build_virtual_machine_run_commands_operation_group_list_request( - location=location, + _request = build_galleries_list_by_resource_group_request( + resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -26648,7 +26673,7 @@ def prepare_request(next_link=None): async def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.RunCommandDocumentBase], deserialized.get("value", [])) + list_of_elem = _deserialize(List[_models.Gallery], deserialized.get("value", [])) if cls: list_of_elem = cls(list_of_elem) # type: ignore return deserialized.get("nextLink") or None, AsyncList(list_of_elem) @@ -26671,22 +26696,19 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - @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. + @distributed_trace + def list(self, **kwargs: Any) -> AsyncItemPaged["_models.Gallery"]: + """List galleries under a subscription. - :param location: The name of the Azure region. Required. - :type location: str - :param command_id: Specifies a commandId of predefined built-in script. Command IDs available - for Linux are listed at `https://aka.ms/RunCommandManagedLinux#available-commands - `_, Windows at - `https://aka.ms/RunCommandManagedWindows#available-commands - `_. Required. - :type command_id: str - :return: RunCommandDocument. The RunCommandDocument is compatible with MutableMapping - :rtype: ~azure.mgmt.compute.models.RunCommandDocument + :return: An iterator like instance of Gallery + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.models.Gallery] :raises ~azure.core.exceptions.HttpResponseError: """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.Gallery]] = kwargs.pop("cls", None) + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -26695,63 +26717,78 @@ async def get(self, location: str, command_id: str, **kwargs: Any) -> _models.Ru } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} + def prepare_request(next_link=None): + if not next_link: - cls: ClsType[_models.RunCommandDocument] = kwargs.pop("cls", None) + _request = build_galleries_list_request( + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) - _request = build_virtual_machine_run_commands_operation_group_get_request( - location=location, - command_id=command_id, - subscription_id=self._config.subscription_id, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) - _stream = kwargs.pop("stream", False) - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) + return _request - response = pipeline_response.http_response + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.Gallery], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) - if response.status_code not in [200]: - if _stream: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.CloudError, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + async def get_next(next_link=None): + _request = prepare_request(next_link) - response_headers = {} - response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response - if _stream: - deserialized = response.iter_bytes() - else: - deserialized = _deserialize(_models.RunCommandDocument, response.json()) + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore + return pipeline_response - return deserialized # type: ignore + return AsyncItemPaged(get_next, extract_data) -class DisksOperations: +class GalleryImagesOperations: """ .. warning:: **DO NOT** instantiate this class directly. Instead, you should access the following operations through :class:`~azure.mgmt.compute.aio.ComputeClient`'s - :attr:`disks` attribute. + :attr:`gallery_images` attribute. """ def __init__(self, *args, **kwargs) -> None: @@ -26762,18 +26799,20 @@ def __init__(self, *args, **kwargs) -> None: self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace_async - async def get(self, resource_group_name: str, disk_name: str, **kwargs: Any) -> _models.Disk: - """Gets information about a disk. + async def get( + self, resource_group_name: str, gallery_name: str, gallery_image_name: str, **kwargs: Any + ) -> _models.GalleryImage: + """Retrieves information about a gallery image definition. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param disk_name: The name of the managed disk that is being created. The name can't be changed - after the disk is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The - maximum name length is 80 characters. Required. - :type disk_name: str - :return: Disk. The Disk is compatible with MutableMapping - :rtype: ~azure.mgmt.compute.models.Disk + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param gallery_image_name: The name of the gallery image definition to be retrieved. Required. + :type gallery_image_name: str + :return: GalleryImage. The GalleryImage is compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.GalleryImage :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -26787,11 +26826,12 @@ async def get(self, resource_group_name: str, disk_name: str, **kwargs: Any) -> _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.Disk] = kwargs.pop("cls", None) + cls: ClsType[_models.GalleryImage] = kwargs.pop("cls", None) - _request = build_disks_get_request( + _request = build_gallery_images_get_request( resource_group_name=resource_group_name, - disk_name=disk_name, + gallery_name=gallery_name, + gallery_image_name=gallery_image_name, subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -26822,7 +26862,7 @@ async def get(self, resource_group_name: str, disk_name: str, **kwargs: Any) -> if _stream: deserialized = response.iter_bytes() else: - deserialized = _deserialize(_models.Disk, response.json()) + deserialized = _deserialize(_models.GalleryImage, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -26830,7 +26870,12 @@ async def get(self, resource_group_name: str, disk_name: str, **kwargs: Any) -> return deserialized # type: ignore async def _create_or_update_initial( - self, resource_group_name: str, disk_name: str, disk: Union[_models.Disk, JSON, IO[bytes]], **kwargs: Any + self, + resource_group_name: str, + gallery_name: str, + gallery_image_name: str, + gallery_image: Union[_models.GalleryImage, JSON, IO[bytes]], + **kwargs: Any ) -> AsyncIterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -26848,14 +26893,15 @@ async def _create_or_update_initial( content_type = content_type or "application/json" _content = None - if isinstance(disk, (IOBase, bytes)): - _content = disk + if isinstance(gallery_image, (IOBase, bytes)): + _content = gallery_image else: - _content = json.dumps(disk, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(gallery_image, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - _request = build_disks_create_or_update_request( + _request = build_gallery_images_create_or_update_request( resource_group_name=resource_group_name, - disk_name=disk_name, + gallery_name=gallery_name, + gallery_image_name=gallery_image_name, subscription_id=self._config.subscription_id, content_type=content_type, api_version=self._config.api_version, @@ -26875,7 +26921,7 @@ async def _create_or_update_initial( response = pipeline_response.http_response - if response.status_code not in [200, 202]: + if response.status_code not in [200, 201, 202]: try: await response.read() # Load the body in memory and close the socket except (StreamConsumedError, StreamClosedError): @@ -26885,6 +26931,10 @@ async def _create_or_update_initial( raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} + if response.status_code == 201: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) @@ -26900,28 +26950,31 @@ async def _create_or_update_initial( async def begin_create_or_update( self, resource_group_name: str, - disk_name: str, - disk: _models.Disk, + gallery_name: str, + gallery_image_name: str, + gallery_image: _models.GalleryImage, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[None]: - """Creates or updates a disk. + ) -> AsyncLROPoller[_models.GalleryImage]: + """Create or update a gallery image definition. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param disk_name: The name of the managed disk that is being created. The name can't be changed - after the disk is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The - maximum name length is 80 characters. Required. - :type disk_name: str - :param disk: Disk object supplied in the body of the Put disk operation. Required. - :type disk: ~azure.mgmt.compute.models.Disk + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param gallery_image_name: The name of the gallery image definition to be retrieved. Required. + :type gallery_image_name: str + :param gallery_image: Parameters supplied to the create or update gallery image operation. + Required. + :type gallery_image: ~azure.mgmt.compute.models.GalleryImage :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns None - :rtype: ~azure.core.polling.AsyncLROPoller[None] + :return: An instance of AsyncLROPoller that returns GalleryImage. The GalleryImage is + compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.GalleryImage] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -26929,28 +26982,31 @@ async def begin_create_or_update( async def begin_create_or_update( self, resource_group_name: str, - disk_name: str, - disk: JSON, + gallery_name: str, + gallery_image_name: str, + gallery_image: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[None]: - """Creates or updates a disk. + ) -> AsyncLROPoller[_models.GalleryImage]: + """Create or update a gallery image definition. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param disk_name: The name of the managed disk that is being created. The name can't be changed - after the disk is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The - maximum name length is 80 characters. Required. - :type disk_name: str - :param disk: Disk object supplied in the body of the Put disk operation. Required. - :type disk: JSON + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param gallery_image_name: The name of the gallery image definition to be retrieved. Required. + :type gallery_image_name: str + :param gallery_image: Parameters supplied to the create or update gallery image operation. + Required. + :type gallery_image: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns None - :rtype: ~azure.core.polling.AsyncLROPoller[None] + :return: An instance of AsyncLROPoller that returns GalleryImage. The GalleryImage is + compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.GalleryImage] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -26958,64 +27014,74 @@ async def begin_create_or_update( async def begin_create_or_update( self, resource_group_name: str, - disk_name: str, - disk: IO[bytes], + gallery_name: str, + gallery_image_name: str, + gallery_image: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[None]: - """Creates or updates a disk. + ) -> AsyncLROPoller[_models.GalleryImage]: + """Create or update a gallery image definition. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param disk_name: The name of the managed disk that is being created. The name can't be changed - after the disk is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The - maximum name length is 80 characters. Required. - :type disk_name: str - :param disk: Disk object supplied in the body of the Put disk operation. Required. - :type disk: IO[bytes] + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param gallery_image_name: The name of the gallery image definition to be retrieved. Required. + :type gallery_image_name: str + :param gallery_image: Parameters supplied to the create or update gallery image operation. + Required. + :type gallery_image: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns None - :rtype: ~azure.core.polling.AsyncLROPoller[None] + :return: An instance of AsyncLROPoller that returns GalleryImage. The GalleryImage is + compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.GalleryImage] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace_async async def begin_create_or_update( - self, resource_group_name: str, disk_name: str, disk: Union[_models.Disk, JSON, IO[bytes]], **kwargs: Any - ) -> AsyncLROPoller[None]: - """Creates or updates a disk. + self, + resource_group_name: str, + gallery_name: str, + gallery_image_name: str, + gallery_image: Union[_models.GalleryImage, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.GalleryImage]: + """Create or update a gallery image definition. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param disk_name: The name of the managed disk that is being created. The name can't be changed - after the disk is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The - maximum name length is 80 characters. Required. - :type disk_name: str - :param disk: Disk object supplied in the body of the Put disk operation. Is one of the - following types: Disk, JSON, IO[bytes] Required. - :type disk: ~azure.mgmt.compute.models.Disk or JSON or IO[bytes] - :return: An instance of AsyncLROPoller that returns None - :rtype: ~azure.core.polling.AsyncLROPoller[None] + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param gallery_image_name: The name of the gallery image definition to be retrieved. Required. + :type gallery_image_name: str + :param gallery_image: Parameters supplied to the create or update gallery image operation. Is + one of the following types: GalleryImage, JSON, IO[bytes] Required. + :type gallery_image: ~azure.mgmt.compute.models.GalleryImage or JSON or IO[bytes] + :return: An instance of AsyncLROPoller that returns GalleryImage. The GalleryImage is + compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.GalleryImage] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[_models.GalleryImage] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = await self._create_or_update_initial( resource_group_name=resource_group_name, - disk_name=disk_name, - disk=disk, + gallery_name=gallery_name, + gallery_image_name=gallery_image_name, + gallery_image=gallery_image, content_type=content_type, cls=lambda x, y, z: x, headers=_headers, @@ -27025,9 +27091,12 @@ async def begin_create_or_update( await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.GalleryImage, response.json()) if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized path_format_arguments = { "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), @@ -27042,16 +27111,23 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return AsyncLROPoller[None].from_continuation_token( + return AsyncLROPoller[_models.GalleryImage].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + return AsyncLROPoller[_models.GalleryImage]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) async def _update_initial( - self, resource_group_name: str, disk_name: str, disk: Union[_models.DiskUpdate, JSON, IO[bytes]], **kwargs: Any + self, + resource_group_name: str, + gallery_name: str, + gallery_image_name: str, + gallery_image: Union[_models.GalleryImageUpdate, JSON, IO[bytes]], + **kwargs: Any ) -> AsyncIterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -27069,14 +27145,15 @@ async def _update_initial( content_type = content_type or "application/json" _content = None - if isinstance(disk, (IOBase, bytes)): - _content = disk + if isinstance(gallery_image, (IOBase, bytes)): + _content = gallery_image else: - _content = json.dumps(disk, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(gallery_image, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - _request = build_disks_update_request( + _request = build_gallery_images_update_request( resource_group_name=resource_group_name, - disk_name=disk_name, + gallery_name=gallery_name, + gallery_image_name=gallery_image_name, subscription_id=self._config.subscription_id, content_type=content_type, api_version=self._config.api_version, @@ -27096,7 +27173,7 @@ async def _update_initial( response = pipeline_response.http_response - if response.status_code not in [200, 202]: + if response.status_code not in [200]: try: await response.read() # Load the body in memory and close the socket except (StreamConsumedError, StreamClosedError): @@ -27106,9 +27183,8 @@ async def _update_initial( raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) deserialized = response.iter_bytes() @@ -27121,28 +27197,30 @@ async def _update_initial( async def begin_update( self, resource_group_name: str, - disk_name: str, - disk: _models.DiskUpdate, + gallery_name: str, + gallery_image_name: str, + gallery_image: _models.GalleryImageUpdate, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[None]: - """Updates (patches) a disk. + ) -> AsyncLROPoller[_models.GalleryImage]: + """Update a gallery image definition. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param disk_name: The name of the managed disk that is being created. The name can't be changed - after the disk is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The - maximum name length is 80 characters. Required. - :type disk_name: str - :param disk: Disk object supplied in the body of the Patch disk operation. Required. - :type disk: ~azure.mgmt.compute.models.DiskUpdate + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param gallery_image_name: The name of the gallery image definition to be retrieved. Required. + :type gallery_image_name: str + :param gallery_image: Parameters supplied to the update gallery image operation. Required. + :type gallery_image: ~azure.mgmt.compute.models.GalleryImageUpdate :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns None - :rtype: ~azure.core.polling.AsyncLROPoller[None] + :return: An instance of AsyncLROPoller that returns GalleryImage. The GalleryImage is + compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.GalleryImage] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -27150,28 +27228,30 @@ async def begin_update( async def begin_update( self, resource_group_name: str, - disk_name: str, - disk: JSON, + gallery_name: str, + gallery_image_name: str, + gallery_image: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[None]: - """Updates (patches) a disk. + ) -> AsyncLROPoller[_models.GalleryImage]: + """Update a gallery image definition. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param disk_name: The name of the managed disk that is being created. The name can't be changed - after the disk is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The - maximum name length is 80 characters. Required. - :type disk_name: str - :param disk: Disk object supplied in the body of the Patch disk operation. Required. - :type disk: JSON + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param gallery_image_name: The name of the gallery image definition to be retrieved. Required. + :type gallery_image_name: str + :param gallery_image: Parameters supplied to the update gallery image operation. Required. + :type gallery_image: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns None - :rtype: ~azure.core.polling.AsyncLROPoller[None] + :return: An instance of AsyncLROPoller that returns GalleryImage. The GalleryImage is + compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.GalleryImage] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -27179,64 +27259,73 @@ async def begin_update( async def begin_update( self, resource_group_name: str, - disk_name: str, - disk: IO[bytes], + gallery_name: str, + gallery_image_name: str, + gallery_image: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[None]: - """Updates (patches) a disk. + ) -> AsyncLROPoller[_models.GalleryImage]: + """Update a gallery image definition. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param disk_name: The name of the managed disk that is being created. The name can't be changed - after the disk is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The - maximum name length is 80 characters. Required. - :type disk_name: str - :param disk: Disk object supplied in the body of the Patch disk operation. Required. - :type disk: IO[bytes] + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param gallery_image_name: The name of the gallery image definition to be retrieved. Required. + :type gallery_image_name: str + :param gallery_image: Parameters supplied to the update gallery image operation. Required. + :type gallery_image: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns None - :rtype: ~azure.core.polling.AsyncLROPoller[None] + :return: An instance of AsyncLROPoller that returns GalleryImage. The GalleryImage is + compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.GalleryImage] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace_async async def begin_update( - self, resource_group_name: str, disk_name: str, disk: Union[_models.DiskUpdate, JSON, IO[bytes]], **kwargs: Any - ) -> AsyncLROPoller[None]: - """Updates (patches) a disk. + self, + resource_group_name: str, + gallery_name: str, + gallery_image_name: str, + gallery_image: Union[_models.GalleryImageUpdate, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.GalleryImage]: + """Update a gallery image definition. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param disk_name: The name of the managed disk that is being created. The name can't be changed - after the disk is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The - maximum name length is 80 characters. Required. - :type disk_name: str - :param disk: Disk object supplied in the body of the Patch disk operation. Is one of the - following types: DiskUpdate, JSON, IO[bytes] Required. - :type disk: ~azure.mgmt.compute.models.DiskUpdate or JSON or IO[bytes] - :return: An instance of AsyncLROPoller that returns None - :rtype: ~azure.core.polling.AsyncLROPoller[None] + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param gallery_image_name: The name of the gallery image definition to be retrieved. Required. + :type gallery_image_name: str + :param gallery_image: Parameters supplied to the update gallery image operation. Is one of the + following types: GalleryImageUpdate, JSON, IO[bytes] Required. + :type gallery_image: ~azure.mgmt.compute.models.GalleryImageUpdate or JSON or IO[bytes] + :return: An instance of AsyncLROPoller that returns GalleryImage. The GalleryImage is + compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.GalleryImage] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[_models.GalleryImage] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = await self._update_initial( resource_group_name=resource_group_name, - disk_name=disk_name, - disk=disk, + gallery_name=gallery_name, + gallery_image_name=gallery_image_name, + gallery_image=gallery_image, content_type=content_type, cls=lambda x, y, z: x, headers=_headers, @@ -27246,9 +27335,16 @@ async def begin_update( await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = _deserialize(_models.GalleryImage, response.json()) if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore + return deserialized path_format_arguments = { "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), @@ -27263,15 +27359,19 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return AsyncLROPoller[None].from_continuation_token( + return AsyncLROPoller[_models.GalleryImage].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + return AsyncLROPoller[_models.GalleryImage]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) - async def _delete_initial(self, resource_group_name: str, disk_name: str, **kwargs: Any) -> AsyncIterator[bytes]: + async def _delete_initial( + self, resource_group_name: str, gallery_name: str, gallery_image_name: str, **kwargs: Any + ) -> AsyncIterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -27285,9 +27385,10 @@ async def _delete_initial(self, resource_group_name: str, disk_name: str, **kwar cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - _request = build_disks_delete_request( + _request = build_gallery_images_delete_request( resource_group_name=resource_group_name, - disk_name=disk_name, + gallery_name=gallery_name, + gallery_image_name=gallery_image_name, subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -27327,16 +27428,18 @@ async def _delete_initial(self, resource_group_name: str, disk_name: str, **kwar return deserialized # type: ignore @distributed_trace_async - async def begin_delete(self, resource_group_name: str, disk_name: str, **kwargs: Any) -> AsyncLROPoller[None]: - """Deletes a disk. + async def begin_delete( + self, resource_group_name: str, gallery_name: str, gallery_image_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Delete a gallery image. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param disk_name: The name of the managed disk that is being created. The name can't be changed - after the disk is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The - maximum name length is 80 characters. Required. - :type disk_name: str + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param gallery_image_name: The name of the gallery image definition to be retrieved. Required. + :type gallery_image_name: str :return: An instance of AsyncLROPoller that returns None :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -27351,7 +27454,8 @@ async def begin_delete(self, resource_group_name: str, disk_name: str, **kwargs: if cont_token is None: raw_result = await self._delete_initial( resource_group_name=resource_group_name, - disk_name=disk_name, + gallery_name=gallery_name, + gallery_image_name=gallery_image_name, cls=lambda x, y, z: x, headers=_headers, params=_params, @@ -27386,20 +27490,24 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore @distributed_trace - def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> AsyncItemPaged["_models.Disk"]: - """Lists all the disks under a resource group. + def list_by_gallery( + self, resource_group_name: str, gallery_name: str, **kwargs: Any + ) -> AsyncItemPaged["_models.GalleryImage"]: + """List gallery image definitions in a gallery. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :return: An iterator like instance of Disk - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.models.Disk] + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :return: An iterator like instance of GalleryImage + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.models.GalleryImage] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.Disk]] = kwargs.pop("cls", None) + cls: ClsType[List[_models.GalleryImage]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -27412,8 +27520,9 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Asy def prepare_request(next_link=None): if not next_link: - _request = build_disks_list_by_resource_group_request( + _request = build_gallery_images_list_by_gallery_request( resource_group_name=resource_group_name, + gallery_name=gallery_name, subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -27450,7 +27559,7 @@ def prepare_request(next_link=None): async def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.Disk], deserialized.get("value", [])) + list_of_elem = _deserialize(List[_models.GalleryImage], deserialized.get("value", [])) if cls: list_of_elem = cls(list_of_elem) # type: ignore return deserialized.get("nextLink") or None, AsyncList(list_of_elem) @@ -27473,95 +27582,117 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - @distributed_trace - def list(self, **kwargs: Any) -> AsyncItemPaged["_models.Disk"]: - """Lists all the disks under a subscription. - - :return: An iterator like instance of Disk - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.models.Disk] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.Disk]] = kwargs.pop("cls", None) +class GalleryImageVersionsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) + Instead, you should access the following operations through + :class:`~azure.mgmt.compute.aio.ComputeClient`'s + :attr:`gallery_image_versions` attribute. + """ - def prepare_request(next_link=None): - if not next_link: + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - _request = build_disks_list_request( - subscription_id=self._config.subscription_id, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) + @distributed_trace_async + async def get( + self, + resource_group_name: str, + gallery_name: str, + gallery_image_name: str, + gallery_image_version_name: str, + *, + expand: Optional[Union[str, _models.ReplicationStatusTypes]] = None, + **kwargs: Any + ) -> _models.GalleryImageVersion: + """Retrieves information about a gallery image version. - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param gallery_image_name: The name of the gallery image definition to be retrieved. Required. + :type gallery_image_name: str + :param gallery_image_version_name: The name of the gallery image version to be retrieved. + Required. + :type gallery_image_version_name: str + :keyword expand: The expand expression to apply on the operation. Known values are: + "ReplicationStatus" and "UefiSettings". Default value is None. + :paramtype expand: str or ~azure.mgmt.compute.models.ReplicationStatusTypes + :return: GalleryImageVersion. The GalleryImageVersion is compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.GalleryImageVersion + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) - return _request + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} - async def extract_data(pipeline_response): - deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.Disk], deserialized.get("value", [])) - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + cls: ClsType[_models.GalleryImageVersion] = kwargs.pop("cls", None) - async def get_next(next_link=None): - _request = prepare_request(next_link) + _request = build_gallery_image_versions_get_request( + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_image_name=gallery_image_name, + gallery_image_version_name=gallery_image_version_name, + subscription_id=self._config.subscription_id, + expand=expand, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.CloudError, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response = pipeline_response.http_response - return pipeline_response + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - return AsyncItemPaged(get_next, extract_data) + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.GalleryImageVersion, response.json()) - async def _grant_access_initial( + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _create_or_update_initial( self, resource_group_name: str, - disk_name: str, - grant_access_data: Union[_models.GrantAccessData, JSON, IO[bytes]], + gallery_name: str, + gallery_image_name: str, + gallery_image_version_name: str, + gallery_image_version: Union[_models.GalleryImageVersion, JSON, IO[bytes]], **kwargs: Any ) -> AsyncIterator[bytes]: error_map: MutableMapping = { @@ -27580,14 +27711,16 @@ async def _grant_access_initial( content_type = content_type or "application/json" _content = None - if isinstance(grant_access_data, (IOBase, bytes)): - _content = grant_access_data + if isinstance(gallery_image_version, (IOBase, bytes)): + _content = gallery_image_version else: - _content = json.dumps(grant_access_data, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(gallery_image_version, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - _request = build_disks_grant_access_request( + _request = build_gallery_image_versions_create_or_update_request( resource_group_name=resource_group_name, - disk_name=disk_name, + gallery_name=gallery_name, + gallery_image_name=gallery_image_name, + gallery_image_version_name=gallery_image_version_name, subscription_id=self._config.subscription_id, content_type=content_type, api_version=self._config.api_version, @@ -27607,7 +27740,7 @@ async def _grant_access_initial( response = pipeline_response.http_response - if response.status_code not in [200, 202]: + if response.status_code not in [200, 201, 202]: try: await response.read() # Load the body in memory and close the socket except (StreamConsumedError, StreamClosedError): @@ -27617,6 +27750,10 @@ async def _grant_access_initial( raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} + if response.status_code == 201: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) @@ -27629,136 +27766,159 @@ async def _grant_access_initial( return deserialized # type: ignore @overload - async def begin_grant_access( + async def begin_create_or_update( self, resource_group_name: str, - disk_name: str, - grant_access_data: _models.GrantAccessData, + gallery_name: str, + gallery_image_name: str, + gallery_image_version_name: str, + gallery_image_version: _models.GalleryImageVersion, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.AccessUri]: - """Grants access to a disk. + ) -> AsyncLROPoller[_models.GalleryImageVersion]: + """Create or update a gallery image version. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param disk_name: The name of the managed disk that is being created. The name can't be changed - after the disk is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The - maximum name length is 80 characters. Required. - :type disk_name: str - :param grant_access_data: Access data object supplied in the body of the get disk access + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param gallery_image_name: The name of the gallery image definition to be retrieved. Required. + :type gallery_image_name: str + :param gallery_image_version_name: The name of the gallery image version to be retrieved. + Required. + :type gallery_image_version_name: str + :param gallery_image_version: Parameters supplied to the create or update gallery image version operation. Required. - :type grant_access_data: ~azure.mgmt.compute.models.GrantAccessData + :type gallery_image_version: ~azure.mgmt.compute.models.GalleryImageVersion :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns AccessUri. The AccessUri is compatible with - MutableMapping - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.AccessUri] + :return: An instance of AsyncLROPoller that returns GalleryImageVersion. The + GalleryImageVersion is compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.GalleryImageVersion] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - async def begin_grant_access( + async def begin_create_or_update( self, resource_group_name: str, - disk_name: str, - grant_access_data: JSON, + gallery_name: str, + gallery_image_name: str, + gallery_image_version_name: str, + gallery_image_version: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.AccessUri]: - """Grants access to a disk. + ) -> AsyncLROPoller[_models.GalleryImageVersion]: + """Create or update a gallery image version. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param disk_name: The name of the managed disk that is being created. The name can't be changed - after the disk is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The - maximum name length is 80 characters. Required. - :type disk_name: str - :param grant_access_data: Access data object supplied in the body of the get disk access + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param gallery_image_name: The name of the gallery image definition to be retrieved. Required. + :type gallery_image_name: str + :param gallery_image_version_name: The name of the gallery image version to be retrieved. + Required. + :type gallery_image_version_name: str + :param gallery_image_version: Parameters supplied to the create or update gallery image version operation. Required. - :type grant_access_data: JSON + :type gallery_image_version: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns AccessUri. The AccessUri is compatible with - MutableMapping - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.AccessUri] + :return: An instance of AsyncLROPoller that returns GalleryImageVersion. The + GalleryImageVersion is compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.GalleryImageVersion] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - async def begin_grant_access( + async def begin_create_or_update( self, resource_group_name: str, - disk_name: str, - grant_access_data: IO[bytes], + gallery_name: str, + gallery_image_name: str, + gallery_image_version_name: str, + gallery_image_version: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.AccessUri]: - """Grants access to a disk. + ) -> AsyncLROPoller[_models.GalleryImageVersion]: + """Create or update a gallery image version. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param disk_name: The name of the managed disk that is being created. The name can't be changed - after the disk is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The - maximum name length is 80 characters. Required. - :type disk_name: str - :param grant_access_data: Access data object supplied in the body of the get disk access + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param gallery_image_name: The name of the gallery image definition to be retrieved. Required. + :type gallery_image_name: str + :param gallery_image_version_name: The name of the gallery image version to be retrieved. + Required. + :type gallery_image_version_name: str + :param gallery_image_version: Parameters supplied to the create or update gallery image version operation. Required. - :type grant_access_data: IO[bytes] + :type gallery_image_version: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns AccessUri. The AccessUri is compatible with - MutableMapping - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.AccessUri] + :return: An instance of AsyncLROPoller that returns GalleryImageVersion. The + GalleryImageVersion is compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.GalleryImageVersion] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace_async - async def begin_grant_access( + async def begin_create_or_update( self, resource_group_name: str, - disk_name: str, - grant_access_data: Union[_models.GrantAccessData, JSON, IO[bytes]], + gallery_name: str, + gallery_image_name: str, + gallery_image_version_name: str, + gallery_image_version: Union[_models.GalleryImageVersion, JSON, IO[bytes]], **kwargs: Any - ) -> AsyncLROPoller[_models.AccessUri]: - """Grants access to a disk. + ) -> AsyncLROPoller[_models.GalleryImageVersion]: + """Create or update a gallery image version. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param disk_name: The name of the managed disk that is being created. The name can't be changed - after the disk is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The - maximum name length is 80 characters. Required. - :type disk_name: str - :param grant_access_data: Access data object supplied in the body of the get disk access - operation. Is one of the following types: GrantAccessData, JSON, IO[bytes] Required. - :type grant_access_data: ~azure.mgmt.compute.models.GrantAccessData or JSON or IO[bytes] - :return: An instance of AsyncLROPoller that returns AccessUri. The AccessUri is compatible with - MutableMapping - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.AccessUri] + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param gallery_image_name: The name of the gallery image definition to be retrieved. Required. + :type gallery_image_name: str + :param gallery_image_version_name: The name of the gallery image version to be retrieved. + Required. + :type gallery_image_version_name: str + :param gallery_image_version: Parameters supplied to the create or update gallery image version + operation. Is one of the following types: GalleryImageVersion, JSON, IO[bytes] Required. + :type gallery_image_version: ~azure.mgmt.compute.models.GalleryImageVersion or JSON or + IO[bytes] + :return: An instance of AsyncLROPoller that returns GalleryImageVersion. The + GalleryImageVersion is compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.GalleryImageVersion] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AccessUri] = kwargs.pop("cls", None) + cls: ClsType[_models.GalleryImageVersion] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._grant_access_initial( + raw_result = await self._create_or_update_initial( resource_group_name=resource_group_name, - disk_name=disk_name, - grant_access_data=grant_access_data, + gallery_name=gallery_name, + gallery_image_name=gallery_image_name, + gallery_image_version_name=gallery_image_version_name, + gallery_image_version=gallery_image_version, content_type=content_type, cls=lambda x, y, z: x, headers=_headers, @@ -27769,14 +27929,10 @@ async def begin_grant_access( kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - response_headers = {} response = pipeline_response.http_response - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = _deserialize(_models.AccessUri, response.json()) + deserialized = _deserialize(_models.GalleryImageVersion, response.json()) if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized path_format_arguments = { @@ -27792,18 +27948,24 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller[_models.AccessUri].from_continuation_token( + return AsyncLROPoller[_models.GalleryImageVersion].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller[_models.AccessUri]( + return AsyncLROPoller[_models.GalleryImageVersion]( self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - async def _revoke_access_initial( - self, resource_group_name: str, disk_name: str, **kwargs: Any + async def _update_initial( + self, + resource_group_name: str, + gallery_name: str, + gallery_image_name: str, + gallery_image_version_name: str, + gallery_image_version: Union[_models.GalleryImageVersionUpdate, JSON, IO[bytes]], + **kwargs: Any ) -> AsyncIterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -27813,16 +27975,28 @@ async def _revoke_access_initial( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - _request = build_disks_revoke_access_request( + content_type = content_type or "application/json" + _content = None + if isinstance(gallery_image_version, (IOBase, bytes)): + _content = gallery_image_version + else: + _content = json.dumps(gallery_image_version, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_gallery_image_versions_update_request( resource_group_name=resource_group_name, - disk_name=disk_name, + gallery_name=gallery_name, + gallery_image_name=gallery_image_name, + gallery_image_version_name=gallery_image_version_name, subscription_id=self._config.subscription_id, + content_type=content_type, api_version=self._config.api_version, + content=_content, headers=_headers, params=_params, ) @@ -27838,7 +28012,7 @@ async def _revoke_access_initial( response = pipeline_response.http_response - if response.status_code not in [200, 202]: + if response.status_code not in [200]: try: await response.read() # Load the body in memory and close the socket except (StreamConsumedError, StreamClosedError): @@ -27848,9 +28022,8 @@ async def _revoke_access_initial( raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) deserialized = response.iter_bytes() @@ -27859,35 +28032,161 @@ async def _revoke_access_initial( return deserialized # type: ignore + @overload + async def begin_update( + self, + resource_group_name: str, + gallery_name: str, + gallery_image_name: str, + gallery_image_version_name: str, + gallery_image_version: _models.GalleryImageVersionUpdate, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.GalleryImageVersion]: + """Update a gallery image version. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param gallery_image_name: The name of the gallery image definition to be retrieved. Required. + :type gallery_image_name: str + :param gallery_image_version_name: The name of the gallery image version to be retrieved. + Required. + :type gallery_image_version_name: str + :param gallery_image_version: Parameters supplied to the update gallery image version + operation. Required. + :type gallery_image_version: ~azure.mgmt.compute.models.GalleryImageVersionUpdate + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns GalleryImageVersion. The + GalleryImageVersion is compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.GalleryImageVersion] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update( + self, + resource_group_name: str, + gallery_name: str, + gallery_image_name: str, + gallery_image_version_name: str, + gallery_image_version: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.GalleryImageVersion]: + """Update a gallery image version. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param gallery_image_name: The name of the gallery image definition to be retrieved. Required. + :type gallery_image_name: str + :param gallery_image_version_name: The name of the gallery image version to be retrieved. + Required. + :type gallery_image_version_name: str + :param gallery_image_version: Parameters supplied to the update gallery image version + operation. Required. + :type gallery_image_version: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns GalleryImageVersion. The + GalleryImageVersion is compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.GalleryImageVersion] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update( + self, + resource_group_name: str, + gallery_name: str, + gallery_image_name: str, + gallery_image_version_name: str, + gallery_image_version: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.GalleryImageVersion]: + """Update a gallery image version. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param gallery_image_name: The name of the gallery image definition to be retrieved. Required. + :type gallery_image_name: str + :param gallery_image_version_name: The name of the gallery image version to be retrieved. + Required. + :type gallery_image_version_name: str + :param gallery_image_version: Parameters supplied to the update gallery image version + operation. Required. + :type gallery_image_version: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns GalleryImageVersion. The + GalleryImageVersion is compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.GalleryImageVersion] + :raises ~azure.core.exceptions.HttpResponseError: + """ + @distributed_trace_async - async def begin_revoke_access( - self, resource_group_name: str, disk_name: str, **kwargs: Any - ) -> AsyncLROPoller[_models.OkResponse]: - """Revokes access to a disk. + async def begin_update( + self, + resource_group_name: str, + gallery_name: str, + gallery_image_name: str, + gallery_image_version_name: str, + gallery_image_version: Union[_models.GalleryImageVersionUpdate, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.GalleryImageVersion]: + """Update a gallery image version. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param disk_name: The name of the managed disk that is being created. The name can't be changed - after the disk is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The - maximum name length is 80 characters. Required. - :type disk_name: str - :return: An instance of AsyncLROPoller that returns OkResponse. The OkResponse is compatible - with MutableMapping - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.OkResponse] + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param gallery_image_name: The name of the gallery image definition to be retrieved. Required. + :type gallery_image_name: str + :param gallery_image_version_name: The name of the gallery image version to be retrieved. + Required. + :type gallery_image_version_name: str + :param gallery_image_version: Parameters supplied to the update gallery image version + operation. Is one of the following types: GalleryImageVersionUpdate, JSON, IO[bytes] Required. + :type gallery_image_version: ~azure.mgmt.compute.models.GalleryImageVersionUpdate or JSON or + IO[bytes] + :return: An instance of AsyncLROPoller that returns GalleryImageVersion. The + GalleryImageVersion is compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.GalleryImageVersion] :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = kwargs.pop("headers", {}) or {} + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.OkResponse] = kwargs.pop("cls", None) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.GalleryImageVersion] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._revoke_access_initial( + raw_result = await self._update_initial( resource_group_name=resource_group_name, - disk_name=disk_name, + gallery_name=gallery_name, + gallery_image_name=gallery_image_name, + gallery_image_version_name=gallery_image_version_name, + gallery_image_version=gallery_image_version, + content_type=content_type, cls=lambda x, y, z: x, headers=_headers, params=_params, @@ -27902,7 +28201,7 @@ def get_long_running_output(pipeline_response): response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - deserialized = _deserialize(_models.OkResponse, response.json()) + deserialized = _deserialize(_models.GalleryImageVersion, response.json()) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized @@ -27920,49 +28219,24 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller[_models.OkResponse].from_continuation_token( + return AsyncLROPoller[_models.GalleryImageVersion].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller[_models.OkResponse]( + return AsyncLROPoller[_models.GalleryImageVersion]( self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - -class DiskAccessesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.compute.aio.ComputeClient`'s - :attr:`disk_accesses` attribute. - """ - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ComputeClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace_async - async def get(self, resource_group_name: str, disk_access_name: str, **kwargs: Any) -> _models.DiskAccess: - """Gets information about a disk access resource. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param disk_access_name: The name of the disk access resource that is being created. The name - can't be changed after the disk encryption set is created. Supported characters for the name - are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. - :type disk_access_name: str - :return: DiskAccess. The DiskAccess is compatible with MutableMapping - :rtype: ~azure.mgmt.compute.models.DiskAccess - :raises ~azure.core.exceptions.HttpResponseError: - """ + async def _delete_initial( + self, + resource_group_name: str, + gallery_name: str, + gallery_image_name: str, + gallery_image_version_name: str, + **kwargs: Any + ) -> AsyncIterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -27974,11 +28248,13 @@ async def get(self, resource_group_name: str, disk_access_name: str, **kwargs: A _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.DiskAccess] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - _request = build_disk_accesses_get_request( + _request = build_gallery_image_versions_delete_request( resource_group_name=resource_group_name, - disk_access_name=disk_access_name, + gallery_name=gallery_name, + gallery_image_name=gallery_image_name, + gallery_image_version_name=gallery_image_version_name, subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -27989,15 +28265,273 @@ async def get(self, resource_group_name: str, disk_access_name: str, **kwargs: A } _request.url = self._client.format_url(_request.url, **path_format_arguments) - _stream = kwargs.pop("stream", False) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200]: - if _stream: + if response.status_code not in [200, 202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_delete( + self, + resource_group_name: str, + gallery_name: str, + gallery_image_name: str, + gallery_image_version_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Delete a gallery image version. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param gallery_image_name: The name of the gallery image definition to be retrieved. Required. + :type gallery_image_name: str + :param gallery_image_version_name: The name of the gallery image version to be retrieved. + Required. + :type gallery_image_version_name: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_image_name=gallery_image_name, + gallery_image_version_name=gallery_image_version_name, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace + def list_by_gallery_image( + self, resource_group_name: str, gallery_name: str, gallery_image_name: str, **kwargs: Any + ) -> AsyncItemPaged["_models.GalleryImageVersion"]: + """List gallery image versions in a gallery image definition. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param gallery_image_name: The name of the gallery image definition to be retrieved. Required. + :type gallery_image_name: str + :return: An iterator like instance of GalleryImageVersion + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.models.GalleryImageVersion] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.GalleryImageVersion]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_gallery_image_versions_list_by_gallery_image_request( + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_image_name=gallery_image_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.GalleryImageVersion], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + +class GalleryApplicationsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.compute.aio.ComputeClient`'s + :attr:`gallery_applications` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace_async + async def get( + self, resource_group_name: str, gallery_name: str, gallery_application_name: str, **kwargs: Any + ) -> _models.GalleryApplication: + """Retrieves information about a gallery Application Definition. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param gallery_application_name: The name of the gallery Application Definition to be + retrieved. Required. + :type gallery_application_name: str + :return: GalleryApplication. The GalleryApplication is compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.GalleryApplication + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.GalleryApplication] = kwargs.pop("cls", None) + + _request = build_gallery_applications_get_request( + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_application_name=gallery_application_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: try: await response.read() # Load the body in memory and close the socket except (StreamConsumedError, StreamClosedError): @@ -28009,7 +28543,7 @@ async def get(self, resource_group_name: str, disk_access_name: str, **kwargs: A if _stream: deserialized = response.iter_bytes() else: - deserialized = _deserialize(_models.DiskAccess, response.json()) + deserialized = _deserialize(_models.GalleryApplication, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -28019,8 +28553,9 @@ async def get(self, resource_group_name: str, disk_access_name: str, **kwargs: A async def _create_or_update_initial( self, resource_group_name: str, - disk_access_name: str, - disk_access: Union[_models.DiskAccess, JSON, IO[bytes]], + gallery_name: str, + gallery_application_name: str, + gallery_application: Union[_models.GalleryApplication, JSON, IO[bytes]], **kwargs: Any ) -> AsyncIterator[bytes]: error_map: MutableMapping = { @@ -28039,14 +28574,15 @@ async def _create_or_update_initial( content_type = content_type or "application/json" _content = None - if isinstance(disk_access, (IOBase, bytes)): - _content = disk_access + if isinstance(gallery_application, (IOBase, bytes)): + _content = gallery_application else: - _content = json.dumps(disk_access, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(gallery_application, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - _request = build_disk_accesses_create_or_update_request( + _request = build_gallery_applications_create_or_update_request( resource_group_name=resource_group_name, - disk_access_name=disk_access_name, + gallery_name=gallery_name, + gallery_application_name=gallery_application_name, subscription_id=self._config.subscription_id, content_type=content_type, api_version=self._config.api_version, @@ -28066,7 +28602,7 @@ async def _create_or_update_initial( response = pipeline_response.http_response - if response.status_code not in [200, 202]: + if response.status_code not in [200, 201, 202]: try: await response.read() # Load the body in memory and close the socket except (StreamConsumedError, StreamClosedError): @@ -28076,6 +28612,10 @@ async def _create_or_update_initial( raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} + if response.status_code == 201: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) @@ -28091,29 +28631,32 @@ async def _create_or_update_initial( async def begin_create_or_update( self, resource_group_name: str, - disk_access_name: str, - disk_access: _models.DiskAccess, + gallery_name: str, + gallery_application_name: str, + gallery_application: _models.GalleryApplication, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[None]: - """Creates or updates a disk access resource. + ) -> AsyncLROPoller[_models.GalleryApplication]: + """Create or update a gallery Application Definition. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param disk_access_name: The name of the disk access resource that is being created. The name - can't be changed after the disk encryption set is created. Supported characters for the name - are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. - :type disk_access_name: str - :param disk_access: disk access object supplied in the body of the Put disk access operation. - Required. - :type disk_access: ~azure.mgmt.compute.models.DiskAccess + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param gallery_application_name: The name of the gallery Application Definition to be + retrieved. Required. + :type gallery_application_name: str + :param gallery_application: Parameters supplied to the create or update gallery Application + operation. Required. + :type gallery_application: ~azure.mgmt.compute.models.GalleryApplication :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns None - :rtype: ~azure.core.polling.AsyncLROPoller[None] + :return: An instance of AsyncLROPoller that returns GalleryApplication. The GalleryApplication + is compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.GalleryApplication] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -28121,29 +28664,32 @@ async def begin_create_or_update( async def begin_create_or_update( self, resource_group_name: str, - disk_access_name: str, - disk_access: JSON, + gallery_name: str, + gallery_application_name: str, + gallery_application: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[None]: - """Creates or updates a disk access resource. + ) -> AsyncLROPoller[_models.GalleryApplication]: + """Create or update a gallery Application Definition. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param disk_access_name: The name of the disk access resource that is being created. The name - can't be changed after the disk encryption set is created. Supported characters for the name - are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. - :type disk_access_name: str - :param disk_access: disk access object supplied in the body of the Put disk access operation. - Required. - :type disk_access: JSON + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param gallery_application_name: The name of the gallery Application Definition to be + retrieved. Required. + :type gallery_application_name: str + :param gallery_application: Parameters supplied to the create or update gallery Application + operation. Required. + :type gallery_application: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns None - :rtype: ~azure.core.polling.AsyncLROPoller[None] + :return: An instance of AsyncLROPoller that returns GalleryApplication. The GalleryApplication + is compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.GalleryApplication] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -28151,29 +28697,32 @@ async def begin_create_or_update( async def begin_create_or_update( self, resource_group_name: str, - disk_access_name: str, - disk_access: IO[bytes], + gallery_name: str, + gallery_application_name: str, + gallery_application: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[None]: - """Creates or updates a disk access resource. + ) -> AsyncLROPoller[_models.GalleryApplication]: + """Create or update a gallery Application Definition. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param disk_access_name: The name of the disk access resource that is being created. The name - can't be changed after the disk encryption set is created. Supported characters for the name - are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. - :type disk_access_name: str - :param disk_access: disk access object supplied in the body of the Put disk access operation. - Required. - :type disk_access: IO[bytes] + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param gallery_application_name: The name of the gallery Application Definition to be + retrieved. Required. + :type gallery_application_name: str + :param gallery_application: Parameters supplied to the create or update gallery Application + operation. Required. + :type gallery_application: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns None - :rtype: ~azure.core.polling.AsyncLROPoller[None] + :return: An instance of AsyncLROPoller that returns GalleryApplication. The GalleryApplication + is compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.GalleryApplication] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -28181,39 +28730,43 @@ async def begin_create_or_update( async def begin_create_or_update( self, resource_group_name: str, - disk_access_name: str, - disk_access: Union[_models.DiskAccess, JSON, IO[bytes]], + gallery_name: str, + gallery_application_name: str, + gallery_application: Union[_models.GalleryApplication, JSON, IO[bytes]], **kwargs: Any - ) -> AsyncLROPoller[None]: - """Creates or updates a disk access resource. + ) -> AsyncLROPoller[_models.GalleryApplication]: + """Create or update a gallery Application Definition. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param disk_access_name: The name of the disk access resource that is being created. The name - can't be changed after the disk encryption set is created. Supported characters for the name - are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. - :type disk_access_name: str - :param disk_access: disk access object supplied in the body of the Put disk access operation. - Is one of the following types: DiskAccess, JSON, IO[bytes] Required. - :type disk_access: ~azure.mgmt.compute.models.DiskAccess or JSON or IO[bytes] - :return: An instance of AsyncLROPoller that returns None - :rtype: ~azure.core.polling.AsyncLROPoller[None] + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param gallery_application_name: The name of the gallery Application Definition to be + retrieved. Required. + :type gallery_application_name: str + :param gallery_application: Parameters supplied to the create or update gallery Application + operation. Is one of the following types: GalleryApplication, JSON, IO[bytes] Required. + :type gallery_application: ~azure.mgmt.compute.models.GalleryApplication or JSON or IO[bytes] + :return: An instance of AsyncLROPoller that returns GalleryApplication. The GalleryApplication + is compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.GalleryApplication] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[_models.GalleryApplication] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = await self._create_or_update_initial( resource_group_name=resource_group_name, - disk_access_name=disk_access_name, - disk_access=disk_access, + gallery_name=gallery_name, + gallery_application_name=gallery_application_name, + gallery_application=gallery_application, content_type=content_type, cls=lambda x, y, z: x, headers=_headers, @@ -28223,9 +28776,12 @@ async def begin_create_or_update( await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.GalleryApplication, response.json()) if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized path_format_arguments = { "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), @@ -28240,19 +28796,22 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return AsyncLROPoller[None].from_continuation_token( + return AsyncLROPoller[_models.GalleryApplication].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + return AsyncLROPoller[_models.GalleryApplication]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) async def _update_initial( self, resource_group_name: str, - disk_access_name: str, - disk_access: Union[_models.DiskAccessUpdate, JSON, IO[bytes]], + gallery_name: str, + gallery_application_name: str, + gallery_application: Union[_models.GalleryApplicationUpdate, JSON, IO[bytes]], **kwargs: Any ) -> AsyncIterator[bytes]: error_map: MutableMapping = { @@ -28271,14 +28830,15 @@ async def _update_initial( content_type = content_type or "application/json" _content = None - if isinstance(disk_access, (IOBase, bytes)): - _content = disk_access + if isinstance(gallery_application, (IOBase, bytes)): + _content = gallery_application else: - _content = json.dumps(disk_access, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(gallery_application, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - _request = build_disk_accesses_update_request( + _request = build_gallery_applications_update_request( resource_group_name=resource_group_name, - disk_access_name=disk_access_name, + gallery_name=gallery_name, + gallery_application_name=gallery_application_name, subscription_id=self._config.subscription_id, content_type=content_type, api_version=self._config.api_version, @@ -28298,7 +28858,7 @@ async def _update_initial( response = pipeline_response.http_response - if response.status_code not in [200, 202]: + if response.status_code not in [200]: try: await response.read() # Load the body in memory and close the socket except (StreamConsumedError, StreamClosedError): @@ -28308,9 +28868,8 @@ async def _update_initial( raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) deserialized = response.iter_bytes() @@ -28323,29 +28882,32 @@ async def _update_initial( async def begin_update( self, resource_group_name: str, - disk_access_name: str, - disk_access: _models.DiskAccessUpdate, + gallery_name: str, + gallery_application_name: str, + gallery_application: _models.GalleryApplicationUpdate, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[None]: - """Updates (patches) a disk access resource. + ) -> AsyncLROPoller[_models.GalleryApplication]: + """Update a gallery Application Definition. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param disk_access_name: The name of the disk access resource that is being created. The name - can't be changed after the disk encryption set is created. Supported characters for the name - are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. - :type disk_access_name: str - :param disk_access: disk access object supplied in the body of the Patch disk access operation. + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param gallery_application_name: The name of the gallery Application Definition to be + retrieved. Required. + :type gallery_application_name: str + :param gallery_application: Parameters supplied to the update gallery Application operation. Required. - :type disk_access: ~azure.mgmt.compute.models.DiskAccessUpdate + :type gallery_application: ~azure.mgmt.compute.models.GalleryApplicationUpdate :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns None - :rtype: ~azure.core.polling.AsyncLROPoller[None] + :return: An instance of AsyncLROPoller that returns GalleryApplication. The GalleryApplication + is compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.GalleryApplication] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -28353,29 +28915,32 @@ async def begin_update( async def begin_update( self, resource_group_name: str, - disk_access_name: str, - disk_access: JSON, + gallery_name: str, + gallery_application_name: str, + gallery_application: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[None]: - """Updates (patches) a disk access resource. + ) -> AsyncLROPoller[_models.GalleryApplication]: + """Update a gallery Application Definition. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param disk_access_name: The name of the disk access resource that is being created. The name - can't be changed after the disk encryption set is created. Supported characters for the name - are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. - :type disk_access_name: str - :param disk_access: disk access object supplied in the body of the Patch disk access operation. + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param gallery_application_name: The name of the gallery Application Definition to be + retrieved. Required. + :type gallery_application_name: str + :param gallery_application: Parameters supplied to the update gallery Application operation. Required. - :type disk_access: JSON + :type gallery_application: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns None - :rtype: ~azure.core.polling.AsyncLROPoller[None] + :return: An instance of AsyncLROPoller that returns GalleryApplication. The GalleryApplication + is compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.GalleryApplication] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -28383,29 +28948,32 @@ async def begin_update( async def begin_update( self, resource_group_name: str, - disk_access_name: str, - disk_access: IO[bytes], + gallery_name: str, + gallery_application_name: str, + gallery_application: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[None]: - """Updates (patches) a disk access resource. + ) -> AsyncLROPoller[_models.GalleryApplication]: + """Update a gallery Application Definition. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param disk_access_name: The name of the disk access resource that is being created. The name - can't be changed after the disk encryption set is created. Supported characters for the name - are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. - :type disk_access_name: str - :param disk_access: disk access object supplied in the body of the Patch disk access operation. + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param gallery_application_name: The name of the gallery Application Definition to be + retrieved. Required. + :type gallery_application_name: str + :param gallery_application: Parameters supplied to the update gallery Application operation. Required. - :type disk_access: IO[bytes] + :type gallery_application: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns None - :rtype: ~azure.core.polling.AsyncLROPoller[None] + :return: An instance of AsyncLROPoller that returns GalleryApplication. The GalleryApplication + is compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.GalleryApplication] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -28413,39 +28981,44 @@ async def begin_update( async def begin_update( self, resource_group_name: str, - disk_access_name: str, - disk_access: Union[_models.DiskAccessUpdate, JSON, IO[bytes]], + gallery_name: str, + gallery_application_name: str, + gallery_application: Union[_models.GalleryApplicationUpdate, JSON, IO[bytes]], **kwargs: Any - ) -> AsyncLROPoller[None]: - """Updates (patches) a disk access resource. + ) -> AsyncLROPoller[_models.GalleryApplication]: + """Update a gallery Application Definition. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param disk_access_name: The name of the disk access resource that is being created. The name - can't be changed after the disk encryption set is created. Supported characters for the name - are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. - :type disk_access_name: str - :param disk_access: disk access object supplied in the body of the Patch disk access operation. - Is one of the following types: DiskAccessUpdate, JSON, IO[bytes] Required. - :type disk_access: ~azure.mgmt.compute.models.DiskAccessUpdate or JSON or IO[bytes] - :return: An instance of AsyncLROPoller that returns None - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param gallery_application_name: The name of the gallery Application Definition to be + retrieved. Required. + :type gallery_application_name: str + :param gallery_application: Parameters supplied to the update gallery Application operation. Is + one of the following types: GalleryApplicationUpdate, JSON, IO[bytes] Required. + :type gallery_application: ~azure.mgmt.compute.models.GalleryApplicationUpdate or JSON or + IO[bytes] + :return: An instance of AsyncLROPoller that returns GalleryApplication. The GalleryApplication + is compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.GalleryApplication] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[_models.GalleryApplication] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = await self._update_initial( resource_group_name=resource_group_name, - disk_access_name=disk_access_name, - disk_access=disk_access, + gallery_name=gallery_name, + gallery_application_name=gallery_application_name, + gallery_application=gallery_application, content_type=content_type, cls=lambda x, y, z: x, headers=_headers, @@ -28455,9 +29028,16 @@ async def begin_update( await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = _deserialize(_models.GalleryApplication, response.json()) if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore + return deserialized path_format_arguments = { "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), @@ -28472,16 +29052,18 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return AsyncLROPoller[None].from_continuation_token( + return AsyncLROPoller[_models.GalleryApplication].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + return AsyncLROPoller[_models.GalleryApplication]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) async def _delete_initial( - self, resource_group_name: str, disk_access_name: str, **kwargs: Any + self, resource_group_name: str, gallery_name: str, gallery_application_name: str, **kwargs: Any ) -> AsyncIterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -28496,9 +29078,10 @@ async def _delete_initial( cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - _request = build_disk_accesses_delete_request( + _request = build_gallery_applications_delete_request( resource_group_name=resource_group_name, - disk_access_name=disk_access_name, + gallery_name=gallery_name, + gallery_application_name=gallery_application_name, subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -28539,17 +29122,18 @@ async def _delete_initial( @distributed_trace_async async def begin_delete( - self, resource_group_name: str, disk_access_name: str, **kwargs: Any + self, resource_group_name: str, gallery_name: str, gallery_application_name: str, **kwargs: Any ) -> AsyncLROPoller[None]: - """Deletes a disk access resource. + """Delete a gallery Application. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param disk_access_name: The name of the disk access resource that is being created. The name - can't be changed after the disk encryption set is created. Supported characters for the name - are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. - :type disk_access_name: str + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param gallery_application_name: The name of the gallery Application Definition to be + retrieved. Required. + :type gallery_application_name: str :return: An instance of AsyncLROPoller that returns None :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -28564,7 +29148,8 @@ async def begin_delete( if cont_token is None: raw_result = await self._delete_initial( resource_group_name=resource_group_name, - disk_access_name=disk_access_name, + gallery_name=gallery_name, + gallery_application_name=gallery_application_name, cls=lambda x, y, z: x, headers=_headers, params=_params, @@ -28599,20 +29184,24 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore @distributed_trace - def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> AsyncItemPaged["_models.DiskAccess"]: - """Lists all the disk access resources under a resource group. + def list_by_gallery( + self, resource_group_name: str, gallery_name: str, **kwargs: Any + ) -> AsyncItemPaged["_models.GalleryApplication"]: + """List gallery Application Definitions in a gallery. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :return: An iterator like instance of DiskAccess - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.models.DiskAccess] + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :return: An iterator like instance of GalleryApplication + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.models.GalleryApplication] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.DiskAccess]] = kwargs.pop("cls", None) + cls: ClsType[List[_models.GalleryApplication]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -28625,8 +29214,9 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Asy def prepare_request(next_link=None): if not next_link: - _request = build_disk_accesses_list_by_resource_group_request( + _request = build_gallery_applications_list_by_gallery_request( resource_group_name=resource_group_name, + gallery_name=gallery_name, subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -28663,91 +29253,7 @@ def prepare_request(next_link=None): async def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.DiskAccess], deserialized.get("value", [])) - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.get("nextLink") or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.CloudError, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @distributed_trace - def list(self, **kwargs: Any) -> AsyncItemPaged["_models.DiskAccess"]: - """Lists all the disk access resources under a subscription. - - :return: An iterator like instance of DiskAccess - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.models.DiskAccess] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[List[_models.DiskAccess]] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_disk_accesses_list_request( - subscription_id=self._config.subscription_id, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - return _request - - async def extract_data(pipeline_response): - deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.DiskAccess], deserialized.get("value", [])) + list_of_elem = _deserialize(List[_models.GalleryApplication], deserialized.get("value", [])) if cls: list_of_elem = cls(list_of_elem) # type: ignore return deserialized.get("nextLink") or None, AsyncList(list_of_elem) @@ -28770,86 +29276,15 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - @distributed_trace_async - async def get_private_link_resources( - self, resource_group_name: str, disk_access_name: str, **kwargs: Any - ) -> _models.PrivateLinkResourceListResult: - """Gets the private link resources possible under disk access resource. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param disk_access_name: The name of the disk access resource that is being created. The name - can't be changed after the disk encryption set is created. Supported characters for the name - are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. - :type disk_access_name: str - :return: PrivateLinkResourceListResult. The PrivateLinkResourceListResult is compatible with - MutableMapping - :rtype: ~azure.mgmt.compute.models.PrivateLinkResourceListResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[_models.PrivateLinkResourceListResult] = kwargs.pop("cls", None) - - _request = build_disk_accesses_get_private_link_resources_request( - resource_group_name=resource_group_name, - disk_access_name=disk_access_name, - subscription_id=self._config.subscription_id, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = kwargs.pop("stream", False) - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - if _stream: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.CloudError, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if _stream: - deserialized = response.iter_bytes() - else: - deserialized = _deserialize(_models.PrivateLinkResourceListResult, response.json()) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - -class PrivateEndpointConnectionsOperations: +class GalleryApplicationVersionsOperations: """ .. warning:: **DO NOT** instantiate this class directly. Instead, you should access the following operations through :class:`~azure.mgmt.compute.aio.ComputeClient`'s - :attr:`private_endpoint_connections` attribute. + :attr:`gallery_application_versions` attribute. """ def __init__(self, *args, **kwargs) -> None: @@ -28860,23 +29295,35 @@ def __init__(self, *args, **kwargs) -> None: self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace_async - async def get_a_private_endpoint_connection( - self, resource_group_name: str, disk_access_name: str, private_endpoint_connection_name: str, **kwargs: Any - ) -> _models.PrivateEndpointConnection: - """Gets information about a private endpoint connection under a disk access resource. + async def get( + self, + resource_group_name: str, + gallery_name: str, + gallery_application_name: str, + gallery_application_version_name: str, + *, + expand: Optional[Union[str, _models.ReplicationStatusTypes]] = None, + **kwargs: Any + ) -> _models.GalleryApplicationVersion: + """Retrieves information about a gallery Application Version. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param disk_access_name: The name of the disk access resource that is being created. The name - can't be changed after the disk encryption set is created. Supported characters for the name - are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. - :type disk_access_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection. Required. - :type private_endpoint_connection_name: str - :return: PrivateEndpointConnection. The PrivateEndpointConnection is compatible with + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param gallery_application_name: The name of the gallery Application Definition to be + retrieved. Required. + :type gallery_application_name: str + :param gallery_application_version_name: The name of the gallery Application Version to be + retrieved. Required. + :type gallery_application_version_name: str + :keyword expand: The expand expression to apply on the operation. Known values are: + "ReplicationStatus" and "UefiSettings". Default value is None. + :paramtype expand: str or ~azure.mgmt.compute.models.ReplicationStatusTypes + :return: GalleryApplicationVersion. The GalleryApplicationVersion is compatible with MutableMapping - :rtype: ~azure.mgmt.compute.models.PrivateEndpointConnection + :rtype: ~azure.mgmt.compute.models.GalleryApplicationVersion :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -28890,13 +29337,15 @@ async def get_a_private_endpoint_connection( _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) + cls: ClsType[_models.GalleryApplicationVersion] = kwargs.pop("cls", None) - _request = build_private_endpoint_connections_get_a_private_endpoint_connection_request( + _request = build_gallery_application_versions_get_request( resource_group_name=resource_group_name, - disk_access_name=disk_access_name, - private_endpoint_connection_name=private_endpoint_connection_name, + gallery_name=gallery_name, + gallery_application_name=gallery_application_name, + gallery_application_version_name=gallery_application_version_name, subscription_id=self._config.subscription_id, + expand=expand, api_version=self._config.api_version, headers=_headers, params=_params, @@ -28926,19 +29375,20 @@ async def get_a_private_endpoint_connection( if _stream: deserialized = response.iter_bytes() else: - deserialized = _deserialize(_models.PrivateEndpointConnection, response.json()) + deserialized = _deserialize(_models.GalleryApplicationVersion, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - async def _update_a_private_endpoint_connection_initial( # pylint: disable=name-too-long + async def _create_or_update_initial( self, resource_group_name: str, - disk_access_name: str, - private_endpoint_connection_name: str, - private_endpoint_connection: Union[_models.PrivateEndpointConnection, JSON, IO[bytes]], + gallery_name: str, + gallery_application_name: str, + gallery_application_version_name: str, + gallery_application_version: Union[_models.GalleryApplicationVersion, JSON, IO[bytes]], **kwargs: Any ) -> AsyncIterator[bytes]: error_map: MutableMapping = { @@ -28957,15 +29407,16 @@ async def _update_a_private_endpoint_connection_initial( # pylint: disable=name content_type = content_type or "application/json" _content = None - if isinstance(private_endpoint_connection, (IOBase, bytes)): - _content = private_endpoint_connection + if isinstance(gallery_application_version, (IOBase, bytes)): + _content = gallery_application_version else: - _content = json.dumps(private_endpoint_connection, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(gallery_application_version, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - _request = build_private_endpoint_connections_update_a_private_endpoint_connection_request( + _request = build_gallery_application_versions_create_or_update_request( resource_group_name=resource_group_name, - disk_access_name=disk_access_name, - private_endpoint_connection_name=private_endpoint_connection_name, + gallery_name=gallery_name, + gallery_application_name=gallery_application_name, + gallery_application_version_name=gallery_application_version_name, subscription_id=self._config.subscription_id, content_type=content_type, api_version=self._config.api_version, @@ -28985,7 +29436,7 @@ async def _update_a_private_endpoint_connection_initial( # pylint: disable=name response = pipeline_response.http_response - if response.status_code not in [200, 202]: + if response.status_code not in [200, 201, 202]: try: await response.read() # Load the body in memory and close the socket except (StreamConsumedError, StreamClosedError): @@ -28995,6 +29446,10 @@ async def _update_a_private_endpoint_connection_initial( # pylint: disable=name raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} + if response.status_code == 201: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) @@ -29007,151 +29462,168 @@ async def _update_a_private_endpoint_connection_initial( # pylint: disable=name return deserialized # type: ignore @overload - async def begin_update_a_private_endpoint_connection( # pylint: disable=name-too-long + async def begin_create_or_update( self, resource_group_name: str, - disk_access_name: str, - private_endpoint_connection_name: str, - private_endpoint_connection: _models.PrivateEndpointConnection, + gallery_name: str, + gallery_application_name: str, + gallery_application_version_name: str, + gallery_application_version: _models.GalleryApplicationVersion, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[None]: - """Approve or reject a private endpoint connection under disk access resource, this can't be used - to create a new private endpoint connection. + ) -> AsyncLROPoller[_models.GalleryApplicationVersion]: + """Create or update a gallery Application Version. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param disk_access_name: The name of the disk access resource that is being created. The name - can't be changed after the disk encryption set is created. Supported characters for the name - are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. - :type disk_access_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection. Required. - :type private_endpoint_connection_name: str - :param private_endpoint_connection: private endpoint connection object supplied in the body of - the Put private endpoint connection operation. Required. - :type private_endpoint_connection: ~azure.mgmt.compute.models.PrivateEndpointConnection + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param gallery_application_name: The name of the gallery Application Definition to be + retrieved. Required. + :type gallery_application_name: str + :param gallery_application_version_name: The name of the gallery Application Version to be + retrieved. Required. + :type gallery_application_version_name: str + :param gallery_application_version: Parameters supplied to the create or update gallery + Application Version operation. Required. + :type gallery_application_version: ~azure.mgmt.compute.models.GalleryApplicationVersion :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns None - :rtype: ~azure.core.polling.AsyncLROPoller[None] + :return: An instance of AsyncLROPoller that returns GalleryApplicationVersion. The + GalleryApplicationVersion is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.GalleryApplicationVersion] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - async def begin_update_a_private_endpoint_connection( # pylint: disable=name-too-long + async def begin_create_or_update( self, resource_group_name: str, - disk_access_name: str, - private_endpoint_connection_name: str, - private_endpoint_connection: JSON, + gallery_name: str, + gallery_application_name: str, + gallery_application_version_name: str, + gallery_application_version: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[None]: - """Approve or reject a private endpoint connection under disk access resource, this can't be used - to create a new private endpoint connection. + ) -> AsyncLROPoller[_models.GalleryApplicationVersion]: + """Create or update a gallery Application Version. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param disk_access_name: The name of the disk access resource that is being created. The name - can't be changed after the disk encryption set is created. Supported characters for the name - are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. - :type disk_access_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection. Required. - :type private_endpoint_connection_name: str - :param private_endpoint_connection: private endpoint connection object supplied in the body of - the Put private endpoint connection operation. Required. - :type private_endpoint_connection: JSON + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param gallery_application_name: The name of the gallery Application Definition to be + retrieved. Required. + :type gallery_application_name: str + :param gallery_application_version_name: The name of the gallery Application Version to be + retrieved. Required. + :type gallery_application_version_name: str + :param gallery_application_version: Parameters supplied to the create or update gallery + Application Version operation. Required. + :type gallery_application_version: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns None - :rtype: ~azure.core.polling.AsyncLROPoller[None] + :return: An instance of AsyncLROPoller that returns GalleryApplicationVersion. The + GalleryApplicationVersion is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.GalleryApplicationVersion] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - async def begin_update_a_private_endpoint_connection( # pylint: disable=name-too-long + async def begin_create_or_update( self, resource_group_name: str, - disk_access_name: str, - private_endpoint_connection_name: str, - private_endpoint_connection: IO[bytes], + gallery_name: str, + gallery_application_name: str, + gallery_application_version_name: str, + gallery_application_version: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[None]: - """Approve or reject a private endpoint connection under disk access resource, this can't be used - to create a new private endpoint connection. + ) -> AsyncLROPoller[_models.GalleryApplicationVersion]: + """Create or update a gallery Application Version. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param disk_access_name: The name of the disk access resource that is being created. The name - can't be changed after the disk encryption set is created. Supported characters for the name - are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. - :type disk_access_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection. Required. - :type private_endpoint_connection_name: str - :param private_endpoint_connection: private endpoint connection object supplied in the body of - the Put private endpoint connection operation. Required. - :type private_endpoint_connection: IO[bytes] + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param gallery_application_name: The name of the gallery Application Definition to be + retrieved. Required. + :type gallery_application_name: str + :param gallery_application_version_name: The name of the gallery Application Version to be + retrieved. Required. + :type gallery_application_version_name: str + :param gallery_application_version: Parameters supplied to the create or update gallery + Application Version operation. Required. + :type gallery_application_version: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns None - :rtype: ~azure.core.polling.AsyncLROPoller[None] + :return: An instance of AsyncLROPoller that returns GalleryApplicationVersion. The + GalleryApplicationVersion is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.GalleryApplicationVersion] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace_async - async def begin_update_a_private_endpoint_connection( # pylint: disable=name-too-long + async def begin_create_or_update( self, resource_group_name: str, - disk_access_name: str, - private_endpoint_connection_name: str, - private_endpoint_connection: Union[_models.PrivateEndpointConnection, JSON, IO[bytes]], + gallery_name: str, + gallery_application_name: str, + gallery_application_version_name: str, + gallery_application_version: Union[_models.GalleryApplicationVersion, JSON, IO[bytes]], **kwargs: Any - ) -> AsyncLROPoller[None]: - """Approve or reject a private endpoint connection under disk access resource, this can't be used - to create a new private endpoint connection. + ) -> AsyncLROPoller[_models.GalleryApplicationVersion]: + """Create or update a gallery Application Version. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param disk_access_name: The name of the disk access resource that is being created. The name - can't be changed after the disk encryption set is created. Supported characters for the name - are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. - :type disk_access_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection. Required. - :type private_endpoint_connection_name: str - :param private_endpoint_connection: private endpoint connection object supplied in the body of - the Put private endpoint connection operation. Is one of the following types: - PrivateEndpointConnection, JSON, IO[bytes] Required. - :type private_endpoint_connection: ~azure.mgmt.compute.models.PrivateEndpointConnection or JSON + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param gallery_application_name: The name of the gallery Application Definition to be + retrieved. Required. + :type gallery_application_name: str + :param gallery_application_version_name: The name of the gallery Application Version to be + retrieved. Required. + :type gallery_application_version_name: str + :param gallery_application_version: Parameters supplied to the create or update gallery + Application Version operation. Is one of the following types: GalleryApplicationVersion, JSON, + IO[bytes] Required. + :type gallery_application_version: ~azure.mgmt.compute.models.GalleryApplicationVersion or JSON or IO[bytes] - :return: An instance of AsyncLROPoller that returns None - :rtype: ~azure.core.polling.AsyncLROPoller[None] + :return: An instance of AsyncLROPoller that returns GalleryApplicationVersion. The + GalleryApplicationVersion is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.GalleryApplicationVersion] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[_models.GalleryApplicationVersion] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._update_a_private_endpoint_connection_initial( + raw_result = await self._create_or_update_initial( resource_group_name=resource_group_name, - disk_access_name=disk_access_name, - private_endpoint_connection_name=private_endpoint_connection_name, - private_endpoint_connection=private_endpoint_connection, + gallery_name=gallery_name, + gallery_application_name=gallery_application_name, + gallery_application_version_name=gallery_application_version_name, + gallery_application_version=gallery_application_version, content_type=content_type, cls=lambda x, y, z: x, headers=_headers, @@ -29161,9 +29633,12 @@ async def begin_update_a_private_endpoint_connection( # pylint: disable=name-to await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.GalleryApplicationVersion, response.json()) if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized path_format_arguments = { "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), @@ -29178,16 +29653,24 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return AsyncLROPoller[None].from_continuation_token( + return AsyncLROPoller[_models.GalleryApplicationVersion].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + return AsyncLROPoller[_models.GalleryApplicationVersion]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) - async def _delete_a_private_endpoint_connection_initial( # pylint: disable=name-too-long - self, resource_group_name: str, disk_access_name: str, private_endpoint_connection_name: str, **kwargs: Any + async def _update_initial( + self, + resource_group_name: str, + gallery_name: str, + gallery_application_name: str, + gallery_application_version_name: str, + gallery_application_version: Union[_models.GalleryApplicationVersionUpdate, JSON, IO[bytes]], + **kwargs: Any ) -> AsyncIterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -29197,15 +29680,295 @@ async def _delete_a_private_endpoint_connection_initial( # pylint: disable=name } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - _request = build_private_endpoint_connections_delete_a_private_endpoint_connection_request( + content_type = content_type or "application/json" + _content = None + if isinstance(gallery_application_version, (IOBase, bytes)): + _content = gallery_application_version + else: + _content = json.dumps(gallery_application_version, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_gallery_application_versions_update_request( resource_group_name=resource_group_name, - disk_access_name=disk_access_name, - private_endpoint_connection_name=private_endpoint_connection_name, + gallery_name=gallery_name, + gallery_application_name=gallery_application_name, + gallery_application_version_name=gallery_application_version_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_update( + self, + resource_group_name: str, + gallery_name: str, + gallery_application_name: str, + gallery_application_version_name: str, + gallery_application_version: _models.GalleryApplicationVersionUpdate, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.GalleryApplicationVersion]: + """Update a gallery Application Version. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param gallery_application_name: The name of the gallery Application Definition to be + retrieved. Required. + :type gallery_application_name: str + :param gallery_application_version_name: The name of the gallery Application Version to be + retrieved. Required. + :type gallery_application_version_name: str + :param gallery_application_version: Parameters supplied to the update gallery Application + Version operation. Required. + :type gallery_application_version: ~azure.mgmt.compute.models.GalleryApplicationVersionUpdate + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns GalleryApplicationVersion. The + GalleryApplicationVersion is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.GalleryApplicationVersion] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update( + self, + resource_group_name: str, + gallery_name: str, + gallery_application_name: str, + gallery_application_version_name: str, + gallery_application_version: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.GalleryApplicationVersion]: + """Update a gallery Application Version. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param gallery_application_name: The name of the gallery Application Definition to be + retrieved. Required. + :type gallery_application_name: str + :param gallery_application_version_name: The name of the gallery Application Version to be + retrieved. Required. + :type gallery_application_version_name: str + :param gallery_application_version: Parameters supplied to the update gallery Application + Version operation. Required. + :type gallery_application_version: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns GalleryApplicationVersion. The + GalleryApplicationVersion is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.GalleryApplicationVersion] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update( + self, + resource_group_name: str, + gallery_name: str, + gallery_application_name: str, + gallery_application_version_name: str, + gallery_application_version: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.GalleryApplicationVersion]: + """Update a gallery Application Version. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param gallery_application_name: The name of the gallery Application Definition to be + retrieved. Required. + :type gallery_application_name: str + :param gallery_application_version_name: The name of the gallery Application Version to be + retrieved. Required. + :type gallery_application_version_name: str + :param gallery_application_version: Parameters supplied to the update gallery Application + Version operation. Required. + :type gallery_application_version: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns GalleryApplicationVersion. The + GalleryApplicationVersion is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.GalleryApplicationVersion] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_update( + self, + resource_group_name: str, + gallery_name: str, + gallery_application_name: str, + gallery_application_version_name: str, + gallery_application_version: Union[_models.GalleryApplicationVersionUpdate, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.GalleryApplicationVersion]: + """Update a gallery Application Version. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param gallery_application_name: The name of the gallery Application Definition to be + retrieved. Required. + :type gallery_application_name: str + :param gallery_application_version_name: The name of the gallery Application Version to be + retrieved. Required. + :type gallery_application_version_name: str + :param gallery_application_version: Parameters supplied to the update gallery Application + Version operation. Is one of the following types: GalleryApplicationVersionUpdate, JSON, + IO[bytes] Required. + :type gallery_application_version: ~azure.mgmt.compute.models.GalleryApplicationVersionUpdate + or JSON or IO[bytes] + :return: An instance of AsyncLROPoller that returns GalleryApplicationVersion. The + GalleryApplicationVersion is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.GalleryApplicationVersion] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.GalleryApplicationVersion] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._update_initial( + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_application_name=gallery_application_name, + gallery_application_version_name=gallery_application_version_name, + gallery_application_version=gallery_application_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = _deserialize(_models.GalleryApplicationVersion, response.json()) + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.GalleryApplicationVersion].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.GalleryApplicationVersion]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _delete_initial( + self, + resource_group_name: str, + gallery_name: str, + gallery_application_name: str, + gallery_application_version_name: str, + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_gallery_application_versions_delete_request( + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_application_name=gallery_application_name, + gallery_application_version_name=gallery_application_version_name, subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -29245,20 +30008,27 @@ async def _delete_a_private_endpoint_connection_initial( # pylint: disable=name return deserialized # type: ignore @distributed_trace_async - async def begin_delete_a_private_endpoint_connection( # pylint: disable=name-too-long - self, resource_group_name: str, disk_access_name: str, private_endpoint_connection_name: str, **kwargs: Any + async def begin_delete( + self, + resource_group_name: str, + gallery_name: str, + gallery_application_name: str, + gallery_application_version_name: str, + **kwargs: Any ) -> AsyncLROPoller[None]: - """Deletes a private endpoint connection under a disk access resource. + """Delete a gallery Application Version. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param disk_access_name: The name of the disk access resource that is being created. The name - can't be changed after the disk encryption set is created. Supported characters for the name - are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. - :type disk_access_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection. Required. - :type private_endpoint_connection_name: str + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param gallery_application_name: The name of the gallery Application Definition to be + retrieved. Required. + :type gallery_application_name: str + :param gallery_application_version_name: The name of the gallery Application Version to be + retrieved. Required. + :type gallery_application_version_name: str :return: An instance of AsyncLROPoller that returns None :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -29271,10 +30041,11 @@ async def begin_delete_a_private_endpoint_connection( # pylint: disable=name-to lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._delete_a_private_endpoint_connection_initial( + raw_result = await self._delete_initial( resource_group_name=resource_group_name, - disk_access_name=disk_access_name, - private_endpoint_connection_name=private_endpoint_connection_name, + gallery_name=gallery_name, + gallery_application_name=gallery_application_name, + gallery_application_version_name=gallery_application_version_name, cls=lambda x, y, z: x, headers=_headers, params=_params, @@ -29309,27 +30080,28 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore @distributed_trace - def list_private_endpoint_connections( - self, resource_group_name: str, disk_access_name: str, **kwargs: Any - ) -> AsyncItemPaged["_models.PrivateEndpointConnection"]: - """List information about private endpoint connections under a disk access resource. + def list_by_gallery_application( + self, resource_group_name: str, gallery_name: str, gallery_application_name: str, **kwargs: Any + ) -> AsyncItemPaged["_models.GalleryApplicationVersion"]: + """List gallery Application Versions in a gallery Application Definition. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param disk_access_name: The name of the disk access resource that is being created. The name - can't be changed after the disk encryption set is created. Supported characters for the name - are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. - :type disk_access_name: str - :return: An iterator like instance of PrivateEndpointConnection + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param gallery_application_name: The name of the gallery Application Definition to be + retrieved. Required. + :type gallery_application_name: str + :return: An iterator like instance of GalleryApplicationVersion :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.models.PrivateEndpointConnection] + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.models.GalleryApplicationVersion] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.PrivateEndpointConnection]] = kwargs.pop("cls", None) + cls: ClsType[List[_models.GalleryApplicationVersion]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -29342,9 +30114,10 @@ def list_private_endpoint_connections( def prepare_request(next_link=None): if not next_link: - _request = build_private_endpoint_connections_list_private_endpoint_connections_request( + _request = build_gallery_application_versions_list_by_gallery_application_request( resource_group_name=resource_group_name, - disk_access_name=disk_access_name, + gallery_name=gallery_name, + gallery_application_name=gallery_application_name, subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -29381,7 +30154,7 @@ def prepare_request(next_link=None): async def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.PrivateEndpointConnection], deserialized.get("value", [])) + list_of_elem = _deserialize(List[_models.GalleryApplicationVersion], deserialized.get("value", [])) if cls: list_of_elem = cls(list_of_elem) # type: ignore return deserialized.get("nextLink") or None, AsyncList(list_of_elem) @@ -29405,14 +30178,14 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) -class DiskEncryptionSetsOperations: +class GalleryInVMAccessControlProfilesOperations: # pylint: disable=name-too-long """ .. warning:: **DO NOT** instantiate this class directly. Instead, you should access the following operations through :class:`~azure.mgmt.compute.aio.ComputeClient`'s - :attr:`disk_encryption_sets` attribute. + :attr:`gallery_in_vm_access_control_profiles` attribute. """ def __init__(self, *args, **kwargs) -> None: @@ -29424,19 +30197,21 @@ def __init__(self, *args, **kwargs) -> None: @distributed_trace_async async def get( - self, resource_group_name: str, disk_encryption_set_name: str, **kwargs: Any - ) -> _models.DiskEncryptionSet: - """Gets information about a disk encryption set. + self, resource_group_name: str, gallery_name: str, in_vm_access_control_profile_name: str, **kwargs: Any + ) -> _models.GalleryInVMAccessControlProfile: + """Retrieves information about a gallery inVMAccessControlProfile. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param disk_encryption_set_name: The name of the disk encryption set that is being created. The - name can't be changed after the disk encryption set is created. Supported characters for the - name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. - :type disk_encryption_set_name: str - :return: DiskEncryptionSet. The DiskEncryptionSet is compatible with MutableMapping - :rtype: ~azure.mgmt.compute.models.DiskEncryptionSet + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param in_vm_access_control_profile_name: The name of the gallery inVMAccessControlProfile to + be retrieved. Required. + :type in_vm_access_control_profile_name: str + :return: GalleryInVMAccessControlProfile. The GalleryInVMAccessControlProfile is compatible + with MutableMapping + :rtype: ~azure.mgmt.compute.models.GalleryInVMAccessControlProfile :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -29450,11 +30225,12 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.DiskEncryptionSet] = kwargs.pop("cls", None) + cls: ClsType[_models.GalleryInVMAccessControlProfile] = kwargs.pop("cls", None) - _request = build_disk_encryption_sets_get_request( + _request = build_gallery_in_vm_access_control_profiles_get_request( resource_group_name=resource_group_name, - disk_encryption_set_name=disk_encryption_set_name, + gallery_name=gallery_name, + in_vm_access_control_profile_name=in_vm_access_control_profile_name, subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -29485,7 +30261,7 @@ async def get( if _stream: deserialized = response.iter_bytes() else: - deserialized = _deserialize(_models.DiskEncryptionSet, response.json()) + deserialized = _deserialize(_models.GalleryInVMAccessControlProfile, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -29495,8 +30271,9 @@ async def get( async def _create_or_update_initial( self, resource_group_name: str, - disk_encryption_set_name: str, - disk_encryption_set: Union[_models.DiskEncryptionSet, JSON, IO[bytes]], + gallery_name: str, + in_vm_access_control_profile_name: str, + gallery_in_vm_access_control_profile: Union[_models.GalleryInVMAccessControlProfile, JSON, IO[bytes]], **kwargs: Any ) -> AsyncIterator[bytes]: error_map: MutableMapping = { @@ -29515,14 +30292,15 @@ async def _create_or_update_initial( content_type = content_type or "application/json" _content = None - if isinstance(disk_encryption_set, (IOBase, bytes)): - _content = disk_encryption_set + if isinstance(gallery_in_vm_access_control_profile, (IOBase, bytes)): + _content = gallery_in_vm_access_control_profile else: - _content = json.dumps(disk_encryption_set, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(gallery_in_vm_access_control_profile, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - _request = build_disk_encryption_sets_create_or_update_request( + _request = build_gallery_in_vm_access_control_profiles_create_or_update_request( resource_group_name=resource_group_name, - disk_encryption_set_name=disk_encryption_set_name, + gallery_name=gallery_name, + in_vm_access_control_profile_name=in_vm_access_control_profile_name, subscription_id=self._config.subscription_id, content_type=content_type, api_version=self._config.api_version, @@ -29542,7 +30320,7 @@ async def _create_or_update_initial( response = pipeline_response.http_response - if response.status_code not in [200, 202]: + if response.status_code not in [200, 201]: try: await response.read() # Load the body in memory and close the socket except (StreamConsumedError, StreamClosedError): @@ -29552,7 +30330,7 @@ async def _create_or_update_initial( raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} - if response.status_code == 202: + if response.status_code == 201: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) @@ -29567,29 +30345,34 @@ async def _create_or_update_initial( async def begin_create_or_update( self, resource_group_name: str, - disk_encryption_set_name: str, - disk_encryption_set: _models.DiskEncryptionSet, + gallery_name: str, + in_vm_access_control_profile_name: str, + gallery_in_vm_access_control_profile: _models.GalleryInVMAccessControlProfile, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[None]: - """Creates or updates a disk encryption set. + ) -> AsyncLROPoller[_models.GalleryInVMAccessControlProfile]: + """Create or update a gallery inVMAccessControlProfile. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param disk_encryption_set_name: The name of the disk encryption set that is being created. The - name can't be changed after the disk encryption set is created. Supported characters for the - name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. - :type disk_encryption_set_name: str - :param disk_encryption_set: disk encryption set object supplied in the body of the Put disk - encryption set operation. Required. - :type disk_encryption_set: ~azure.mgmt.compute.models.DiskEncryptionSet + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param in_vm_access_control_profile_name: The name of the gallery inVMAccessControlProfile to + be retrieved. Required. + :type in_vm_access_control_profile_name: str + :param gallery_in_vm_access_control_profile: Parameters supplied to the create or update + gallery inVMAccessControlProfile operation. Required. + :type gallery_in_vm_access_control_profile: + ~azure.mgmt.compute.models.GalleryInVMAccessControlProfile :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns None - :rtype: ~azure.core.polling.AsyncLROPoller[None] + :return: An instance of AsyncLROPoller that returns GalleryInVMAccessControlProfile. The + GalleryInVMAccessControlProfile is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.GalleryInVMAccessControlProfile] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -29597,29 +30380,33 @@ async def begin_create_or_update( async def begin_create_or_update( self, resource_group_name: str, - disk_encryption_set_name: str, - disk_encryption_set: JSON, + gallery_name: str, + in_vm_access_control_profile_name: str, + gallery_in_vm_access_control_profile: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[None]: - """Creates or updates a disk encryption set. + ) -> AsyncLROPoller[_models.GalleryInVMAccessControlProfile]: + """Create or update a gallery inVMAccessControlProfile. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param disk_encryption_set_name: The name of the disk encryption set that is being created. The - name can't be changed after the disk encryption set is created. Supported characters for the - name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. - :type disk_encryption_set_name: str - :param disk_encryption_set: disk encryption set object supplied in the body of the Put disk - encryption set operation. Required. - :type disk_encryption_set: JSON + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param in_vm_access_control_profile_name: The name of the gallery inVMAccessControlProfile to + be retrieved. Required. + :type in_vm_access_control_profile_name: str + :param gallery_in_vm_access_control_profile: Parameters supplied to the create or update + gallery inVMAccessControlProfile operation. Required. + :type gallery_in_vm_access_control_profile: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns None - :rtype: ~azure.core.polling.AsyncLROPoller[None] + :return: An instance of AsyncLROPoller that returns GalleryInVMAccessControlProfile. The + GalleryInVMAccessControlProfile is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.GalleryInVMAccessControlProfile] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -29627,29 +30414,33 @@ async def begin_create_or_update( async def begin_create_or_update( self, resource_group_name: str, - disk_encryption_set_name: str, - disk_encryption_set: IO[bytes], + gallery_name: str, + in_vm_access_control_profile_name: str, + gallery_in_vm_access_control_profile: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[None]: - """Creates or updates a disk encryption set. + ) -> AsyncLROPoller[_models.GalleryInVMAccessControlProfile]: + """Create or update a gallery inVMAccessControlProfile. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param disk_encryption_set_name: The name of the disk encryption set that is being created. The - name can't be changed after the disk encryption set is created. Supported characters for the - name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. - :type disk_encryption_set_name: str - :param disk_encryption_set: disk encryption set object supplied in the body of the Put disk - encryption set operation. Required. - :type disk_encryption_set: IO[bytes] + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param in_vm_access_control_profile_name: The name of the gallery inVMAccessControlProfile to + be retrieved. Required. + :type in_vm_access_control_profile_name: str + :param gallery_in_vm_access_control_profile: Parameters supplied to the create or update + gallery inVMAccessControlProfile operation. Required. + :type gallery_in_vm_access_control_profile: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns None - :rtype: ~azure.core.polling.AsyncLROPoller[None] + :return: An instance of AsyncLROPoller that returns GalleryInVMAccessControlProfile. The + GalleryInVMAccessControlProfile is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.GalleryInVMAccessControlProfile] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -29657,40 +30448,46 @@ async def begin_create_or_update( async def begin_create_or_update( self, resource_group_name: str, - disk_encryption_set_name: str, - disk_encryption_set: Union[_models.DiskEncryptionSet, JSON, IO[bytes]], + gallery_name: str, + in_vm_access_control_profile_name: str, + gallery_in_vm_access_control_profile: Union[_models.GalleryInVMAccessControlProfile, JSON, IO[bytes]], **kwargs: Any - ) -> AsyncLROPoller[None]: - """Creates or updates a disk encryption set. + ) -> AsyncLROPoller[_models.GalleryInVMAccessControlProfile]: + """Create or update a gallery inVMAccessControlProfile. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param disk_encryption_set_name: The name of the disk encryption set that is being created. The - name can't be changed after the disk encryption set is created. Supported characters for the - name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. - :type disk_encryption_set_name: str - :param disk_encryption_set: disk encryption set object supplied in the body of the Put disk - encryption set operation. Is one of the following types: DiskEncryptionSet, JSON, IO[bytes] - Required. - :type disk_encryption_set: ~azure.mgmt.compute.models.DiskEncryptionSet or JSON or IO[bytes] - :return: An instance of AsyncLROPoller that returns None - :rtype: ~azure.core.polling.AsyncLROPoller[None] + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param in_vm_access_control_profile_name: The name of the gallery inVMAccessControlProfile to + be retrieved. Required. + :type in_vm_access_control_profile_name: str + :param gallery_in_vm_access_control_profile: Parameters supplied to the create or update + gallery inVMAccessControlProfile operation. Is one of the following types: + GalleryInVMAccessControlProfile, JSON, IO[bytes] Required. + :type gallery_in_vm_access_control_profile: + ~azure.mgmt.compute.models.GalleryInVMAccessControlProfile or JSON or IO[bytes] + :return: An instance of AsyncLROPoller that returns GalleryInVMAccessControlProfile. The + GalleryInVMAccessControlProfile is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.GalleryInVMAccessControlProfile] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[_models.GalleryInVMAccessControlProfile] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = await self._create_or_update_initial( resource_group_name=resource_group_name, - disk_encryption_set_name=disk_encryption_set_name, - disk_encryption_set=disk_encryption_set, + gallery_name=gallery_name, + in_vm_access_control_profile_name=in_vm_access_control_profile_name, + gallery_in_vm_access_control_profile=gallery_in_vm_access_control_profile, content_type=content_type, cls=lambda x, y, z: x, headers=_headers, @@ -29700,9 +30497,12 @@ async def begin_create_or_update( await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.GalleryInVMAccessControlProfile, response.json()) if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized path_format_arguments = { "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), @@ -29717,19 +30517,22 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return AsyncLROPoller[None].from_continuation_token( + return AsyncLROPoller[_models.GalleryInVMAccessControlProfile].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + return AsyncLROPoller[_models.GalleryInVMAccessControlProfile]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) async def _update_initial( self, resource_group_name: str, - disk_encryption_set_name: str, - disk_encryption_set: Union[_models.DiskEncryptionSetUpdate, JSON, IO[bytes]], + gallery_name: str, + in_vm_access_control_profile_name: str, + gallery_in_vm_access_control_profile: Union[_models.GalleryInVMAccessControlProfileUpdate, JSON, IO[bytes]], **kwargs: Any ) -> AsyncIterator[bytes]: error_map: MutableMapping = { @@ -29748,14 +30551,15 @@ async def _update_initial( content_type = content_type or "application/json" _content = None - if isinstance(disk_encryption_set, (IOBase, bytes)): - _content = disk_encryption_set + if isinstance(gallery_in_vm_access_control_profile, (IOBase, bytes)): + _content = gallery_in_vm_access_control_profile else: - _content = json.dumps(disk_encryption_set, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(gallery_in_vm_access_control_profile, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - _request = build_disk_encryption_sets_update_request( + _request = build_gallery_in_vm_access_control_profiles_update_request( resource_group_name=resource_group_name, - disk_encryption_set_name=disk_encryption_set_name, + gallery_name=gallery_name, + in_vm_access_control_profile_name=in_vm_access_control_profile_name, subscription_id=self._config.subscription_id, content_type=content_type, api_version=self._config.api_version, @@ -29775,7 +30579,7 @@ async def _update_initial( response = pipeline_response.http_response - if response.status_code not in [200, 202]: + if response.status_code not in [200]: try: await response.read() # Load the body in memory and close the socket except (StreamConsumedError, StreamClosedError): @@ -29785,9 +30589,8 @@ async def _update_initial( raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) deserialized = response.iter_bytes() @@ -29800,29 +30603,34 @@ async def _update_initial( async def begin_update( self, resource_group_name: str, - disk_encryption_set_name: str, - disk_encryption_set: _models.DiskEncryptionSetUpdate, + gallery_name: str, + in_vm_access_control_profile_name: str, + gallery_in_vm_access_control_profile: _models.GalleryInVMAccessControlProfileUpdate, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[None]: - """Updates (patches) a disk encryption set. + ) -> AsyncLROPoller[_models.GalleryInVMAccessControlProfile]: + """Update a gallery inVMAccessControlProfile. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param disk_encryption_set_name: The name of the disk encryption set that is being created. The - name can't be changed after the disk encryption set is created. Supported characters for the - name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. - :type disk_encryption_set_name: str - :param disk_encryption_set: disk encryption set object supplied in the body of the Patch disk - encryption set operation. Required. - :type disk_encryption_set: ~azure.mgmt.compute.models.DiskEncryptionSetUpdate + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param in_vm_access_control_profile_name: The name of the gallery inVMAccessControlProfile to + be retrieved. Required. + :type in_vm_access_control_profile_name: str + :param gallery_in_vm_access_control_profile: Parameters supplied to the update gallery + inVMAccessControlProfile operation. Required. + :type gallery_in_vm_access_control_profile: + ~azure.mgmt.compute.models.GalleryInVMAccessControlProfileUpdate :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns None - :rtype: ~azure.core.polling.AsyncLROPoller[None] + :return: An instance of AsyncLROPoller that returns GalleryInVMAccessControlProfile. The + GalleryInVMAccessControlProfile is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.GalleryInVMAccessControlProfile] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -29830,29 +30638,33 @@ async def begin_update( async def begin_update( self, resource_group_name: str, - disk_encryption_set_name: str, - disk_encryption_set: JSON, + gallery_name: str, + in_vm_access_control_profile_name: str, + gallery_in_vm_access_control_profile: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[None]: - """Updates (patches) a disk encryption set. + ) -> AsyncLROPoller[_models.GalleryInVMAccessControlProfile]: + """Update a gallery inVMAccessControlProfile. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param disk_encryption_set_name: The name of the disk encryption set that is being created. The - name can't be changed after the disk encryption set is created. Supported characters for the - name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. - :type disk_encryption_set_name: str - :param disk_encryption_set: disk encryption set object supplied in the body of the Patch disk - encryption set operation. Required. - :type disk_encryption_set: JSON + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param in_vm_access_control_profile_name: The name of the gallery inVMAccessControlProfile to + be retrieved. Required. + :type in_vm_access_control_profile_name: str + :param gallery_in_vm_access_control_profile: Parameters supplied to the update gallery + inVMAccessControlProfile operation. Required. + :type gallery_in_vm_access_control_profile: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns None - :rtype: ~azure.core.polling.AsyncLROPoller[None] + :return: An instance of AsyncLROPoller that returns GalleryInVMAccessControlProfile. The + GalleryInVMAccessControlProfile is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.GalleryInVMAccessControlProfile] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -29860,29 +30672,33 @@ async def begin_update( async def begin_update( self, resource_group_name: str, - disk_encryption_set_name: str, - disk_encryption_set: IO[bytes], + gallery_name: str, + in_vm_access_control_profile_name: str, + gallery_in_vm_access_control_profile: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[None]: - """Updates (patches) a disk encryption set. + ) -> AsyncLROPoller[_models.GalleryInVMAccessControlProfile]: + """Update a gallery inVMAccessControlProfile. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param disk_encryption_set_name: The name of the disk encryption set that is being created. The - name can't be changed after the disk encryption set is created. Supported characters for the - name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. - :type disk_encryption_set_name: str - :param disk_encryption_set: disk encryption set object supplied in the body of the Patch disk - encryption set operation. Required. - :type disk_encryption_set: IO[bytes] + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param in_vm_access_control_profile_name: The name of the gallery inVMAccessControlProfile to + be retrieved. Required. + :type in_vm_access_control_profile_name: str + :param gallery_in_vm_access_control_profile: Parameters supplied to the update gallery + inVMAccessControlProfile operation. Required. + :type gallery_in_vm_access_control_profile: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns None - :rtype: ~azure.core.polling.AsyncLROPoller[None] + :return: An instance of AsyncLROPoller that returns GalleryInVMAccessControlProfile. The + GalleryInVMAccessControlProfile is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.GalleryInVMAccessControlProfile] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -29890,41 +30706,46 @@ async def begin_update( async def begin_update( self, resource_group_name: str, - disk_encryption_set_name: str, - disk_encryption_set: Union[_models.DiskEncryptionSetUpdate, JSON, IO[bytes]], + gallery_name: str, + in_vm_access_control_profile_name: str, + gallery_in_vm_access_control_profile: Union[_models.GalleryInVMAccessControlProfileUpdate, JSON, IO[bytes]], **kwargs: Any - ) -> AsyncLROPoller[None]: - """Updates (patches) a disk encryption set. + ) -> AsyncLROPoller[_models.GalleryInVMAccessControlProfile]: + """Update a gallery inVMAccessControlProfile. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param disk_encryption_set_name: The name of the disk encryption set that is being created. The - name can't be changed after the disk encryption set is created. Supported characters for the - name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. - :type disk_encryption_set_name: str - :param disk_encryption_set: disk encryption set object supplied in the body of the Patch disk - encryption set operation. Is one of the following types: DiskEncryptionSetUpdate, JSON, - IO[bytes] Required. - :type disk_encryption_set: ~azure.mgmt.compute.models.DiskEncryptionSetUpdate or JSON or - IO[bytes] - :return: An instance of AsyncLROPoller that returns None - :rtype: ~azure.core.polling.AsyncLROPoller[None] + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param in_vm_access_control_profile_name: The name of the gallery inVMAccessControlProfile to + be retrieved. Required. + :type in_vm_access_control_profile_name: str + :param gallery_in_vm_access_control_profile: Parameters supplied to the update gallery + inVMAccessControlProfile operation. Is one of the following types: + GalleryInVMAccessControlProfileUpdate, JSON, IO[bytes] Required. + :type gallery_in_vm_access_control_profile: + ~azure.mgmt.compute.models.GalleryInVMAccessControlProfileUpdate or JSON or IO[bytes] + :return: An instance of AsyncLROPoller that returns GalleryInVMAccessControlProfile. The + GalleryInVMAccessControlProfile is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.GalleryInVMAccessControlProfile] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[_models.GalleryInVMAccessControlProfile] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = await self._update_initial( resource_group_name=resource_group_name, - disk_encryption_set_name=disk_encryption_set_name, - disk_encryption_set=disk_encryption_set, + gallery_name=gallery_name, + in_vm_access_control_profile_name=in_vm_access_control_profile_name, + gallery_in_vm_access_control_profile=gallery_in_vm_access_control_profile, content_type=content_type, cls=lambda x, y, z: x, headers=_headers, @@ -29934,9 +30755,16 @@ async def begin_update( await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = _deserialize(_models.GalleryInVMAccessControlProfile, response.json()) if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore + return deserialized path_format_arguments = { "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), @@ -29951,16 +30779,18 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return AsyncLROPoller[None].from_continuation_token( + return AsyncLROPoller[_models.GalleryInVMAccessControlProfile].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + return AsyncLROPoller[_models.GalleryInVMAccessControlProfile]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) async def _delete_initial( - self, resource_group_name: str, disk_encryption_set_name: str, **kwargs: Any + self, resource_group_name: str, gallery_name: str, in_vm_access_control_profile_name: str, **kwargs: Any ) -> AsyncIterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -29975,9 +30805,10 @@ async def _delete_initial( cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - _request = build_disk_encryption_sets_delete_request( + _request = build_gallery_in_vm_access_control_profiles_delete_request( resource_group_name=resource_group_name, - disk_encryption_set_name=disk_encryption_set_name, + gallery_name=gallery_name, + in_vm_access_control_profile_name=in_vm_access_control_profile_name, subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -29995,7 +30826,7 @@ async def _delete_initial( response = pipeline_response.http_response - if response.status_code not in [200, 202, 204]: + if response.status_code not in [202, 204]: try: await response.read() # Load the body in memory and close the socket except (StreamConsumedError, StreamClosedError): @@ -30007,7 +30838,9 @@ async def _delete_initial( response_headers = {} if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) deserialized = response.iter_bytes() @@ -30018,17 +30851,18 @@ async def _delete_initial( @distributed_trace_async async def begin_delete( - self, resource_group_name: str, disk_encryption_set_name: str, **kwargs: Any + self, resource_group_name: str, gallery_name: str, in_vm_access_control_profile_name: str, **kwargs: Any ) -> AsyncLROPoller[None]: - """Deletes a disk encryption set. + """Delete a gallery inVMAccessControlProfile. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param disk_encryption_set_name: The name of the disk encryption set that is being created. The - name can't be changed after the disk encryption set is created. Supported characters for the - name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. - :type disk_encryption_set_name: str + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param in_vm_access_control_profile_name: The name of the gallery inVMAccessControlProfile to + be retrieved. Required. + :type in_vm_access_control_profile_name: str :return: An instance of AsyncLROPoller that returns None :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -30043,7 +30877,8 @@ async def begin_delete( if cont_token is None: raw_result = await self._delete_initial( resource_group_name=resource_group_name, - disk_encryption_set_name=disk_encryption_set_name, + gallery_name=gallery_name, + in_vm_access_control_profile_name=in_vm_access_control_profile_name, cls=lambda x, y, z: x, headers=_headers, params=_params, @@ -30078,200 +30913,25 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore @distributed_trace - def list_by_resource_group( - self, resource_group_name: str, **kwargs: Any - ) -> AsyncItemPaged["_models.DiskEncryptionSet"]: - """Lists all the disk encryption sets under a resource group. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :return: An iterator like instance of DiskEncryptionSet - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.models.DiskEncryptionSet] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[List[_models.DiskEncryptionSet]] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_disk_encryption_sets_list_by_resource_group_request( - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - return _request - - async def extract_data(pipeline_response): - deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.DiskEncryptionSet], deserialized.get("value", [])) - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.get("nextLink") or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.CloudError, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @distributed_trace - def list(self, **kwargs: Any) -> AsyncItemPaged["_models.DiskEncryptionSet"]: - """Lists all the disk encryption sets under a subscription. - - :return: An iterator like instance of DiskEncryptionSet - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.models.DiskEncryptionSet] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[List[_models.DiskEncryptionSet]] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_disk_encryption_sets_list_request( - subscription_id=self._config.subscription_id, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - return _request - - async def extract_data(pipeline_response): - deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.DiskEncryptionSet], deserialized.get("value", [])) - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.get("nextLink") or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.CloudError, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @distributed_trace - def list_associated_resources( - self, resource_group_name: str, disk_encryption_set_name: str, **kwargs: Any - ) -> AsyncItemPaged[str]: - """Lists all resources that are encrypted with this disk encryption set. + def list_by_gallery( + self, resource_group_name: str, gallery_name: str, **kwargs: Any + ) -> AsyncItemPaged["_models.GalleryInVMAccessControlProfile"]: + """List gallery inVMAccessControlProfiles in a gallery. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param disk_encryption_set_name: The name of the disk encryption set that is being created. The - name can't be changed after the disk encryption set is created. Supported characters for the - name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. - :type disk_encryption_set_name: str - :return: An iterator like instance of str - :rtype: ~azure.core.async_paging.AsyncItemPaged[str] + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :return: An iterator like instance of GalleryInVMAccessControlProfile + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.models.GalleryInVMAccessControlProfile] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[str]] = kwargs.pop("cls", None) + cls: ClsType[List[_models.GalleryInVMAccessControlProfile]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -30284,9 +30944,9 @@ def list_associated_resources( def prepare_request(next_link=None): if not next_link: - _request = build_disk_encryption_sets_list_associated_resources_request( + _request = build_gallery_in_vm_access_control_profiles_list_by_gallery_request( resource_group_name=resource_group_name, - disk_encryption_set_name=disk_encryption_set_name, + gallery_name=gallery_name, subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -30323,7 +30983,7 @@ def prepare_request(next_link=None): async def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[str], deserialized.get("value", [])) + list_of_elem = _deserialize(List[_models.GalleryInVMAccessControlProfile], deserialized.get("value", [])) if cls: list_of_elem = cls(list_of_elem) # type: ignore return deserialized.get("nextLink") or None, AsyncList(list_of_elem) @@ -30347,14 +31007,14 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) -class SnapshotsOperations: +class GalleryInVMAccessControlProfileVersionsOperations: # pylint: disable=name-too-long """ .. warning:: **DO NOT** instantiate this class directly. Instead, you should access the following operations through :class:`~azure.mgmt.compute.aio.ComputeClient`'s - :attr:`snapshots` attribute. + :attr:`gallery_in_vm_access_control_profile_versions` attribute. """ def __init__(self, *args, **kwargs) -> None: @@ -30365,18 +31025,30 @@ def __init__(self, *args, **kwargs) -> None: self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace_async - async def get(self, resource_group_name: str, snapshot_name: str, **kwargs: Any) -> _models.Snapshot: - """Gets information about a snapshot. + async def get( + self, + resource_group_name: str, + gallery_name: str, + in_vm_access_control_profile_name: str, + in_vm_access_control_profile_version_name: str, + **kwargs: Any + ) -> _models.GalleryInVMAccessControlProfileVersion: + """Retrieves information about a gallery inVMAccessControlProfile version. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param snapshot_name: The name of the snapshot that is being created. The name can't be changed - after the snapshot is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. - The max name length is 80 characters. Required. - :type snapshot_name: str - :return: Snapshot. The Snapshot is compatible with MutableMapping - :rtype: ~azure.mgmt.compute.models.Snapshot + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param in_vm_access_control_profile_name: The name of the gallery inVMAccessControlProfile to + be retrieved. Required. + :type in_vm_access_control_profile_name: str + :param in_vm_access_control_profile_version_name: The name of the gallery + inVMAccessControlProfile version to be retrieved. Required. + :type in_vm_access_control_profile_version_name: str + :return: GalleryInVMAccessControlProfileVersion. The GalleryInVMAccessControlProfileVersion is + compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.GalleryInVMAccessControlProfileVersion :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -30390,11 +31062,13 @@ async def get(self, resource_group_name: str, snapshot_name: str, **kwargs: Any) _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.Snapshot] = kwargs.pop("cls", None) + cls: ClsType[_models.GalleryInVMAccessControlProfileVersion] = kwargs.pop("cls", None) - _request = build_snapshots_get_request( + _request = build_gallery_in_vm_access_control_profile_versions_get_request( resource_group_name=resource_group_name, - snapshot_name=snapshot_name, + gallery_name=gallery_name, + in_vm_access_control_profile_name=in_vm_access_control_profile_name, + in_vm_access_control_profile_version_name=in_vm_access_control_profile_version_name, subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -30425,7 +31099,7 @@ async def get(self, resource_group_name: str, snapshot_name: str, **kwargs: Any) if _stream: deserialized = response.iter_bytes() else: - deserialized = _deserialize(_models.Snapshot, response.json()) + deserialized = _deserialize(_models.GalleryInVMAccessControlProfileVersion, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -30435,8 +31109,12 @@ async def get(self, resource_group_name: str, snapshot_name: str, **kwargs: Any) async def _create_or_update_initial( self, resource_group_name: str, - snapshot_name: str, - snapshot: Union[_models.Snapshot, JSON, IO[bytes]], + gallery_name: str, + in_vm_access_control_profile_name: str, + in_vm_access_control_profile_version_name: str, + gallery_in_vm_access_control_profile_version: Union[ + _models.GalleryInVMAccessControlProfileVersion, JSON, IO[bytes] + ], **kwargs: Any ) -> AsyncIterator[bytes]: error_map: MutableMapping = { @@ -30455,14 +31133,16 @@ async def _create_or_update_initial( content_type = content_type or "application/json" _content = None - if isinstance(snapshot, (IOBase, bytes)): - _content = snapshot + if isinstance(gallery_in_vm_access_control_profile_version, (IOBase, bytes)): + _content = gallery_in_vm_access_control_profile_version else: - _content = json.dumps(snapshot, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(gallery_in_vm_access_control_profile_version, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - _request = build_snapshots_create_or_update_request( + _request = build_gallery_in_vm_access_control_profile_versions_create_or_update_request( resource_group_name=resource_group_name, - snapshot_name=snapshot_name, + gallery_name=gallery_name, + in_vm_access_control_profile_name=in_vm_access_control_profile_name, + in_vm_access_control_profile_version_name=in_vm_access_control_profile_version_name, subscription_id=self._config.subscription_id, content_type=content_type, api_version=self._config.api_version, @@ -30482,7 +31162,7 @@ async def _create_or_update_initial( response = pipeline_response.http_response - if response.status_code not in [200, 202]: + if response.status_code not in [200, 201]: try: await response.read() # Load the body in memory and close the socket except (StreamConsumedError, StreamClosedError): @@ -30492,7 +31172,7 @@ async def _create_or_update_initial( raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} - if response.status_code == 202: + if response.status_code == 201: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) @@ -30507,28 +31187,38 @@ async def _create_or_update_initial( async def begin_create_or_update( self, resource_group_name: str, - snapshot_name: str, - snapshot: _models.Snapshot, + gallery_name: str, + in_vm_access_control_profile_name: str, + in_vm_access_control_profile_version_name: str, + gallery_in_vm_access_control_profile_version: _models.GalleryInVMAccessControlProfileVersion, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[None]: - """Creates or updates a snapshot. + ) -> AsyncLROPoller[_models.GalleryInVMAccessControlProfileVersion]: + """Create or update a gallery inVMAccessControlProfile version. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param snapshot_name: The name of the snapshot that is being created. The name can't be changed - after the snapshot is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. - The max name length is 80 characters. Required. - :type snapshot_name: str - :param snapshot: Snapshot object supplied in the body of the Put disk operation. Required. - :type snapshot: ~azure.mgmt.compute.models.Snapshot + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param in_vm_access_control_profile_name: The name of the gallery inVMAccessControlProfile to + be retrieved. Required. + :type in_vm_access_control_profile_name: str + :param in_vm_access_control_profile_version_name: The name of the gallery + inVMAccessControlProfile version to be retrieved. Required. + :type in_vm_access_control_profile_version_name: str + :param gallery_in_vm_access_control_profile_version: Parameters supplied to the create or + update gallery inVMAccessControlProfile version operation. Required. + :type gallery_in_vm_access_control_profile_version: + ~azure.mgmt.compute.models.GalleryInVMAccessControlProfileVersion :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns None - :rtype: ~azure.core.polling.AsyncLROPoller[None] + :return: An instance of AsyncLROPoller that returns GalleryInVMAccessControlProfileVersion. The + GalleryInVMAccessControlProfileVersion is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.GalleryInVMAccessControlProfileVersion] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -30536,28 +31226,37 @@ async def begin_create_or_update( async def begin_create_or_update( self, resource_group_name: str, - snapshot_name: str, - snapshot: JSON, + gallery_name: str, + in_vm_access_control_profile_name: str, + in_vm_access_control_profile_version_name: str, + gallery_in_vm_access_control_profile_version: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[None]: - """Creates or updates a snapshot. + ) -> AsyncLROPoller[_models.GalleryInVMAccessControlProfileVersion]: + """Create or update a gallery inVMAccessControlProfile version. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param snapshot_name: The name of the snapshot that is being created. The name can't be changed - after the snapshot is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. - The max name length is 80 characters. Required. - :type snapshot_name: str - :param snapshot: Snapshot object supplied in the body of the Put disk operation. Required. - :type snapshot: JSON + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param in_vm_access_control_profile_name: The name of the gallery inVMAccessControlProfile to + be retrieved. Required. + :type in_vm_access_control_profile_name: str + :param in_vm_access_control_profile_version_name: The name of the gallery + inVMAccessControlProfile version to be retrieved. Required. + :type in_vm_access_control_profile_version_name: str + :param gallery_in_vm_access_control_profile_version: Parameters supplied to the create or + update gallery inVMAccessControlProfile version operation. Required. + :type gallery_in_vm_access_control_profile_version: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns None - :rtype: ~azure.core.polling.AsyncLROPoller[None] + :return: An instance of AsyncLROPoller that returns GalleryInVMAccessControlProfileVersion. The + GalleryInVMAccessControlProfileVersion is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.GalleryInVMAccessControlProfileVersion] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -30565,28 +31264,37 @@ async def begin_create_or_update( async def begin_create_or_update( self, resource_group_name: str, - snapshot_name: str, - snapshot: IO[bytes], + gallery_name: str, + in_vm_access_control_profile_name: str, + in_vm_access_control_profile_version_name: str, + gallery_in_vm_access_control_profile_version: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[None]: - """Creates or updates a snapshot. + ) -> AsyncLROPoller[_models.GalleryInVMAccessControlProfileVersion]: + """Create or update a gallery inVMAccessControlProfile version. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param snapshot_name: The name of the snapshot that is being created. The name can't be changed - after the snapshot is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. - The max name length is 80 characters. Required. - :type snapshot_name: str - :param snapshot: Snapshot object supplied in the body of the Put disk operation. Required. - :type snapshot: IO[bytes] + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param in_vm_access_control_profile_name: The name of the gallery inVMAccessControlProfile to + be retrieved. Required. + :type in_vm_access_control_profile_name: str + :param in_vm_access_control_profile_version_name: The name of the gallery + inVMAccessControlProfile version to be retrieved. Required. + :type in_vm_access_control_profile_version_name: str + :param gallery_in_vm_access_control_profile_version: Parameters supplied to the create or + update gallery inVMAccessControlProfile version operation. Required. + :type gallery_in_vm_access_control_profile_version: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns None - :rtype: ~azure.core.polling.AsyncLROPoller[None] + :return: An instance of AsyncLROPoller that returns GalleryInVMAccessControlProfileVersion. The + GalleryInVMAccessControlProfileVersion is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.GalleryInVMAccessControlProfileVersion] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -30594,39 +31302,53 @@ async def begin_create_or_update( async def begin_create_or_update( self, resource_group_name: str, - snapshot_name: str, - snapshot: Union[_models.Snapshot, JSON, IO[bytes]], + gallery_name: str, + in_vm_access_control_profile_name: str, + in_vm_access_control_profile_version_name: str, + gallery_in_vm_access_control_profile_version: Union[ + _models.GalleryInVMAccessControlProfileVersion, JSON, IO[bytes] + ], **kwargs: Any - ) -> AsyncLROPoller[None]: - """Creates or updates a snapshot. + ) -> AsyncLROPoller[_models.GalleryInVMAccessControlProfileVersion]: + """Create or update a gallery inVMAccessControlProfile version. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param snapshot_name: The name of the snapshot that is being created. The name can't be changed - after the snapshot is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. - The max name length is 80 characters. Required. - :type snapshot_name: str - :param snapshot: Snapshot object supplied in the body of the Put disk operation. Is one of the - following types: Snapshot, JSON, IO[bytes] Required. - :type snapshot: ~azure.mgmt.compute.models.Snapshot or JSON or IO[bytes] - :return: An instance of AsyncLROPoller that returns None - :rtype: ~azure.core.polling.AsyncLROPoller[None] + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param in_vm_access_control_profile_name: The name of the gallery inVMAccessControlProfile to + be retrieved. Required. + :type in_vm_access_control_profile_name: str + :param in_vm_access_control_profile_version_name: The name of the gallery + inVMAccessControlProfile version to be retrieved. Required. + :type in_vm_access_control_profile_version_name: str + :param gallery_in_vm_access_control_profile_version: Parameters supplied to the create or + update gallery inVMAccessControlProfile version operation. Is one of the following types: + GalleryInVMAccessControlProfileVersion, JSON, IO[bytes] Required. + :type gallery_in_vm_access_control_profile_version: + ~azure.mgmt.compute.models.GalleryInVMAccessControlProfileVersion or JSON or IO[bytes] + :return: An instance of AsyncLROPoller that returns GalleryInVMAccessControlProfileVersion. The + GalleryInVMAccessControlProfileVersion is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.GalleryInVMAccessControlProfileVersion] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[_models.GalleryInVMAccessControlProfileVersion] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = await self._create_or_update_initial( resource_group_name=resource_group_name, - snapshot_name=snapshot_name, - snapshot=snapshot, + gallery_name=gallery_name, + in_vm_access_control_profile_name=in_vm_access_control_profile_name, + in_vm_access_control_profile_version_name=in_vm_access_control_profile_version_name, + gallery_in_vm_access_control_profile_version=gallery_in_vm_access_control_profile_version, content_type=content_type, cls=lambda x, y, z: x, headers=_headers, @@ -30636,9 +31358,12 @@ async def begin_create_or_update( await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.GalleryInVMAccessControlProfileVersion, response.json()) if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized path_format_arguments = { "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), @@ -30653,19 +31378,25 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return AsyncLROPoller[None].from_continuation_token( + return AsyncLROPoller[_models.GalleryInVMAccessControlProfileVersion].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + return AsyncLROPoller[_models.GalleryInVMAccessControlProfileVersion]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) async def _update_initial( self, resource_group_name: str, - snapshot_name: str, - snapshot: Union[_models.SnapshotUpdate, JSON, IO[bytes]], + gallery_name: str, + in_vm_access_control_profile_name: str, + in_vm_access_control_profile_version_name: str, + gallery_in_vm_access_control_profile_version: Union[ + _models.GalleryInVMAccessControlProfileVersionUpdate, JSON, IO[bytes] + ], **kwargs: Any ) -> AsyncIterator[bytes]: error_map: MutableMapping = { @@ -30684,14 +31415,16 @@ async def _update_initial( content_type = content_type or "application/json" _content = None - if isinstance(snapshot, (IOBase, bytes)): - _content = snapshot + if isinstance(gallery_in_vm_access_control_profile_version, (IOBase, bytes)): + _content = gallery_in_vm_access_control_profile_version else: - _content = json.dumps(snapshot, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(gallery_in_vm_access_control_profile_version, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - _request = build_snapshots_update_request( + _request = build_gallery_in_vm_access_control_profile_versions_update_request( resource_group_name=resource_group_name, - snapshot_name=snapshot_name, + gallery_name=gallery_name, + in_vm_access_control_profile_name=in_vm_access_control_profile_name, + in_vm_access_control_profile_version_name=in_vm_access_control_profile_version_name, subscription_id=self._config.subscription_id, content_type=content_type, api_version=self._config.api_version, @@ -30711,7 +31444,7 @@ async def _update_initial( response = pipeline_response.http_response - if response.status_code not in [200, 202]: + if response.status_code not in [200]: try: await response.read() # Load the body in memory and close the socket except (StreamConsumedError, StreamClosedError): @@ -30721,9 +31454,8 @@ async def _update_initial( raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) deserialized = response.iter_bytes() @@ -30736,29 +31468,38 @@ async def _update_initial( async def begin_update( self, resource_group_name: str, - snapshot_name: str, - snapshot: _models.SnapshotUpdate, + gallery_name: str, + in_vm_access_control_profile_name: str, + in_vm_access_control_profile_version_name: str, + gallery_in_vm_access_control_profile_version: _models.GalleryInVMAccessControlProfileVersionUpdate, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[None]: - """Updates (patches) a snapshot. + ) -> AsyncLROPoller[_models.GalleryInVMAccessControlProfileVersion]: + """Update a gallery inVMAccessControlProfile version. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param snapshot_name: The name of the snapshot that is being created. The name can't be changed - after the snapshot is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. - The max name length is 80 characters. Required. - :type snapshot_name: str - :param snapshot: Snapshot object supplied in the body of the Patch snapshot operation. - Required. - :type snapshot: ~azure.mgmt.compute.models.SnapshotUpdate + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param in_vm_access_control_profile_name: The name of the gallery inVMAccessControlProfile to + be retrieved. Required. + :type in_vm_access_control_profile_name: str + :param in_vm_access_control_profile_version_name: The name of the gallery + inVMAccessControlProfile version to be retrieved. Required. + :type in_vm_access_control_profile_version_name: str + :param gallery_in_vm_access_control_profile_version: Parameters supplied to the update gallery + inVMAccessControlProfile version operation. Required. + :type gallery_in_vm_access_control_profile_version: + ~azure.mgmt.compute.models.GalleryInVMAccessControlProfileVersionUpdate :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns None - :rtype: ~azure.core.polling.AsyncLROPoller[None] + :return: An instance of AsyncLROPoller that returns GalleryInVMAccessControlProfileVersion. The + GalleryInVMAccessControlProfileVersion is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.GalleryInVMAccessControlProfileVersion] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -30766,29 +31507,37 @@ async def begin_update( async def begin_update( self, resource_group_name: str, - snapshot_name: str, - snapshot: JSON, + gallery_name: str, + in_vm_access_control_profile_name: str, + in_vm_access_control_profile_version_name: str, + gallery_in_vm_access_control_profile_version: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[None]: - """Updates (patches) a snapshot. + ) -> AsyncLROPoller[_models.GalleryInVMAccessControlProfileVersion]: + """Update a gallery inVMAccessControlProfile version. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param snapshot_name: The name of the snapshot that is being created. The name can't be changed - after the snapshot is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. - The max name length is 80 characters. Required. - :type snapshot_name: str - :param snapshot: Snapshot object supplied in the body of the Patch snapshot operation. - Required. - :type snapshot: JSON + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param in_vm_access_control_profile_name: The name of the gallery inVMAccessControlProfile to + be retrieved. Required. + :type in_vm_access_control_profile_name: str + :param in_vm_access_control_profile_version_name: The name of the gallery + inVMAccessControlProfile version to be retrieved. Required. + :type in_vm_access_control_profile_version_name: str + :param gallery_in_vm_access_control_profile_version: Parameters supplied to the update gallery + inVMAccessControlProfile version operation. Required. + :type gallery_in_vm_access_control_profile_version: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns None - :rtype: ~azure.core.polling.AsyncLROPoller[None] + :return: An instance of AsyncLROPoller that returns GalleryInVMAccessControlProfileVersion. The + GalleryInVMAccessControlProfileVersion is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.GalleryInVMAccessControlProfileVersion] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -30796,29 +31545,37 @@ async def begin_update( async def begin_update( self, resource_group_name: str, - snapshot_name: str, - snapshot: IO[bytes], + gallery_name: str, + in_vm_access_control_profile_name: str, + in_vm_access_control_profile_version_name: str, + gallery_in_vm_access_control_profile_version: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[None]: - """Updates (patches) a snapshot. + ) -> AsyncLROPoller[_models.GalleryInVMAccessControlProfileVersion]: + """Update a gallery inVMAccessControlProfile version. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param snapshot_name: The name of the snapshot that is being created. The name can't be changed - after the snapshot is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. - The max name length is 80 characters. Required. - :type snapshot_name: str - :param snapshot: Snapshot object supplied in the body of the Patch snapshot operation. - Required. - :type snapshot: IO[bytes] + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param in_vm_access_control_profile_name: The name of the gallery inVMAccessControlProfile to + be retrieved. Required. + :type in_vm_access_control_profile_name: str + :param in_vm_access_control_profile_version_name: The name of the gallery + inVMAccessControlProfile version to be retrieved. Required. + :type in_vm_access_control_profile_version_name: str + :param gallery_in_vm_access_control_profile_version: Parameters supplied to the update gallery + inVMAccessControlProfile version operation. Required. + :type gallery_in_vm_access_control_profile_version: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns None - :rtype: ~azure.core.polling.AsyncLROPoller[None] + :return: An instance of AsyncLROPoller that returns GalleryInVMAccessControlProfileVersion. The + GalleryInVMAccessControlProfileVersion is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.GalleryInVMAccessControlProfileVersion] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -30826,39 +31583,53 @@ async def begin_update( async def begin_update( self, resource_group_name: str, - snapshot_name: str, - snapshot: Union[_models.SnapshotUpdate, JSON, IO[bytes]], + gallery_name: str, + in_vm_access_control_profile_name: str, + in_vm_access_control_profile_version_name: str, + gallery_in_vm_access_control_profile_version: Union[ + _models.GalleryInVMAccessControlProfileVersionUpdate, JSON, IO[bytes] + ], **kwargs: Any - ) -> AsyncLROPoller[None]: - """Updates (patches) a snapshot. + ) -> AsyncLROPoller[_models.GalleryInVMAccessControlProfileVersion]: + """Update a gallery inVMAccessControlProfile version. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param snapshot_name: The name of the snapshot that is being created. The name can't be changed - after the snapshot is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. - The max name length is 80 characters. Required. - :type snapshot_name: str - :param snapshot: Snapshot object supplied in the body of the Patch snapshot operation. Is one - of the following types: SnapshotUpdate, JSON, IO[bytes] Required. - :type snapshot: ~azure.mgmt.compute.models.SnapshotUpdate or JSON or IO[bytes] - :return: An instance of AsyncLROPoller that returns None - :rtype: ~azure.core.polling.AsyncLROPoller[None] + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param in_vm_access_control_profile_name: The name of the gallery inVMAccessControlProfile to + be retrieved. Required. + :type in_vm_access_control_profile_name: str + :param in_vm_access_control_profile_version_name: The name of the gallery + inVMAccessControlProfile version to be retrieved. Required. + :type in_vm_access_control_profile_version_name: str + :param gallery_in_vm_access_control_profile_version: Parameters supplied to the update gallery + inVMAccessControlProfile version operation. Is one of the following types: + GalleryInVMAccessControlProfileVersionUpdate, JSON, IO[bytes] Required. + :type gallery_in_vm_access_control_profile_version: + ~azure.mgmt.compute.models.GalleryInVMAccessControlProfileVersionUpdate or JSON or IO[bytes] + :return: An instance of AsyncLROPoller that returns GalleryInVMAccessControlProfileVersion. The + GalleryInVMAccessControlProfileVersion is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.GalleryInVMAccessControlProfileVersion] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[_models.GalleryInVMAccessControlProfileVersion] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = await self._update_initial( resource_group_name=resource_group_name, - snapshot_name=snapshot_name, - snapshot=snapshot, + gallery_name=gallery_name, + in_vm_access_control_profile_name=in_vm_access_control_profile_name, + in_vm_access_control_profile_version_name=in_vm_access_control_profile_version_name, + gallery_in_vm_access_control_profile_version=gallery_in_vm_access_control_profile_version, content_type=content_type, cls=lambda x, y, z: x, headers=_headers, @@ -30868,9 +31639,16 @@ async def begin_update( await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = _deserialize(_models.GalleryInVMAccessControlProfileVersion, response.json()) if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore + return deserialized path_format_arguments = { "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), @@ -30885,16 +31663,23 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return AsyncLROPoller[None].from_continuation_token( + return AsyncLROPoller[_models.GalleryInVMAccessControlProfileVersion].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + return AsyncLROPoller[_models.GalleryInVMAccessControlProfileVersion]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) async def _delete_initial( - self, resource_group_name: str, snapshot_name: str, **kwargs: Any + self, + resource_group_name: str, + gallery_name: str, + in_vm_access_control_profile_name: str, + in_vm_access_control_profile_version_name: str, + **kwargs: Any ) -> AsyncIterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -30909,9 +31694,11 @@ async def _delete_initial( cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - _request = build_snapshots_delete_request( + _request = build_gallery_in_vm_access_control_profile_versions_delete_request( resource_group_name=resource_group_name, - snapshot_name=snapshot_name, + gallery_name=gallery_name, + in_vm_access_control_profile_name=in_vm_access_control_profile_name, + in_vm_access_control_profile_version_name=in_vm_access_control_profile_version_name, subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -30929,7 +31716,7 @@ async def _delete_initial( response = pipeline_response.http_response - if response.status_code not in [200, 202, 204]: + if response.status_code not in [202, 204]: try: await response.read() # Load the body in memory and close the socket except (StreamConsumedError, StreamClosedError): @@ -30941,7 +31728,9 @@ async def _delete_initial( response_headers = {} if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) deserialized = response.iter_bytes() @@ -30951,16 +31740,27 @@ async def _delete_initial( return deserialized # type: ignore @distributed_trace_async - async def begin_delete(self, resource_group_name: str, snapshot_name: str, **kwargs: Any) -> AsyncLROPoller[None]: - """Deletes a snapshot. + async def begin_delete( + self, + resource_group_name: str, + gallery_name: str, + in_vm_access_control_profile_name: str, + in_vm_access_control_profile_version_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Delete a gallery inVMAccessControlProfile version. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param snapshot_name: The name of the snapshot that is being created. The name can't be changed - after the snapshot is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. - The max name length is 80 characters. Required. - :type snapshot_name: str + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param in_vm_access_control_profile_name: The name of the gallery inVMAccessControlProfile to + be retrieved. Required. + :type in_vm_access_control_profile_name: str + :param in_vm_access_control_profile_version_name: The name of the gallery + inVMAccessControlProfile version to be retrieved. Required. + :type in_vm_access_control_profile_version_name: str :return: An instance of AsyncLROPoller that returns None :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -30975,7 +31775,9 @@ async def begin_delete(self, resource_group_name: str, snapshot_name: str, **kwa if cont_token is None: raw_result = await self._delete_initial( resource_group_name=resource_group_name, - snapshot_name=snapshot_name, + gallery_name=gallery_name, + in_vm_access_control_profile_name=in_vm_access_control_profile_name, + in_vm_access_control_profile_version_name=in_vm_access_control_profile_version_name, cls=lambda x, y, z: x, headers=_headers, params=_params, @@ -31010,20 +31812,28 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore @distributed_trace - def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> AsyncItemPaged["_models.Snapshot"]: - """Lists snapshots under a resource group. + def list_by_gallery_in_vm_access_control_profile( # pylint: disable=name-too-long + self, resource_group_name: str, gallery_name: str, in_vm_access_control_profile_name: str, **kwargs: Any + ) -> AsyncItemPaged["_models.GalleryInVMAccessControlProfileVersion"]: + """List gallery inVMAccessControlProfile versions in a gallery inVMAccessControlProfile. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :return: An iterator like instance of Snapshot - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.models.Snapshot] + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param in_vm_access_control_profile_name: The name of the gallery inVMAccessControlProfile to + be retrieved. Required. + :type in_vm_access_control_profile_name: str + :return: An iterator like instance of GalleryInVMAccessControlProfileVersion + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.models.GalleryInVMAccessControlProfileVersion] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.Snapshot]] = kwargs.pop("cls", None) + cls: ClsType[List[_models.GalleryInVMAccessControlProfileVersion]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -31036,8 +31846,10 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Asy def prepare_request(next_link=None): if not next_link: - _request = build_snapshots_list_by_resource_group_request( + _request = build_gallery_in_vm_access_control_profile_versions_list_by_gallery_in_vm_access_control_profile_request( resource_group_name=resource_group_name, + gallery_name=gallery_name, + in_vm_access_control_profile_name=in_vm_access_control_profile_name, subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -31074,7 +31886,9 @@ def prepare_request(next_link=None): async def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.Snapshot], deserialized.get("value", [])) + list_of_elem = _deserialize( + List[_models.GalleryInVMAccessControlProfileVersion], deserialized.get("value", []) + ) if cls: list_of_elem = cls(list_of_elem) # type: ignore return deserialized.get("nextLink") or None, AsyncList(list_of_elem) @@ -31097,18 +31911,108 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) + +class SharedGalleriesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.compute.aio.ComputeClient`'s + :attr:`shared_galleries` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace_async + async def get(self, location: str, gallery_unique_name: str, **kwargs: Any) -> _models.SharedGallery: + """Get a shared gallery by subscription id or tenant id. + + :param location: The name of the Azure region. Required. + :type location: str + :param gallery_unique_name: The unique name of the Shared Gallery. Required. + :type gallery_unique_name: str + :return: SharedGallery. The SharedGallery is compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.SharedGallery + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.SharedGallery] = kwargs.pop("cls", None) + + _request = build_shared_galleries_get_request( + location=location, + gallery_unique_name=gallery_unique_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.SharedGallery, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + @distributed_trace - def list(self, **kwargs: Any) -> AsyncItemPaged["_models.Snapshot"]: - """Lists snapshots under a subscription. + def list( + self, location: str, *, shared_to: Optional[Union[str, _models.SharedToValues]] = None, **kwargs: Any + ) -> AsyncItemPaged["_models.SharedGallery"]: + """List shared galleries by subscription id or tenant id. - :return: An iterator like instance of Snapshot - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.models.Snapshot] + :param location: The name of the Azure region. Required. + :type location: str + :keyword shared_to: The query parameter to decide what shared galleries to fetch when doing + listing operations. "tenant" Default value is None. + :paramtype shared_to: str or ~azure.mgmt.compute.models.SharedToValues + :return: An iterator like instance of SharedGallery + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.models.SharedGallery] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.Snapshot]] = kwargs.pop("cls", None) + cls: ClsType[List[_models.SharedGallery]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -31121,8 +32025,10 @@ def list(self, **kwargs: Any) -> AsyncItemPaged["_models.Snapshot"]: def prepare_request(next_link=None): if not next_link: - _request = build_snapshots_list_request( + _request = build_shared_galleries_list_request( + location=location, subscription_id=self._config.subscription_id, + shared_to=shared_to, api_version=self._config.api_version, headers=_headers, params=_params, @@ -31158,7 +32064,7 @@ def prepare_request(next_link=None): async def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.Snapshot], deserialized.get("value", [])) + list_of_elem = _deserialize(List[_models.SharedGallery], deserialized.get("value", [])) if cls: list_of_elem = cls(list_of_elem) # type: ignore return deserialized.get("nextLink") or None, AsyncList(list_of_elem) @@ -31181,13 +32087,41 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - async def _grant_access_initial( - self, - resource_group_name: str, - snapshot_name: str, - grant_access_data: Union[_models.GrantAccessData, JSON, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: + +class SharedGalleryImagesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.compute.aio.ComputeClient`'s + :attr:`shared_gallery_images` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace_async + async def get( + self, location: str, gallery_unique_name: str, gallery_image_name: str, **kwargs: Any + ) -> _models.SharedGalleryImage: + """Get a shared gallery image by subscription id or tenant id. + + :param location: The name of the Azure region. Required. + :type location: str + :param gallery_unique_name: The unique name of the Shared Gallery. Required. + :type gallery_unique_name: str + :param gallery_image_name: The name of the Shared Gallery Image Definition from which the Image + Versions are to be listed. Required. + :type gallery_image_name: str + :return: SharedGalleryImage. The SharedGalleryImage is compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.SharedGalleryImage + :raises ~azure.core.exceptions.HttpResponseError: + """ error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -31196,26 +32130,17 @@ async def _grant_access_initial( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _content = None - if isinstance(grant_access_data, (IOBase, bytes)): - _content = grant_access_data - else: - _content = json.dumps(grant_access_data, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + cls: ClsType[_models.SharedGalleryImage] = kwargs.pop("cls", None) - _request = build_snapshots_grant_access_request( - resource_group_name=resource_group_name, - snapshot_name=snapshot_name, + _request = build_shared_gallery_images_get_request( + location=location, + gallery_unique_name=gallery_unique_name, + gallery_image_name=gallery_image_name, subscription_id=self._config.subscription_id, - content_type=content_type, api_version=self._config.api_version, - content=_content, headers=_headers, params=_params, ) @@ -31224,211 +32149,60 @@ async def _grant_access_initial( } _request.url = self._client.format_url(_request.url, **path_format_arguments) - _stream = True + _stream = kwargs.pop("stream", False) pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200, 202]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = _failsafe_deserialize(_models.CloudError, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.iter_bytes() + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.SharedGalleryImage, response.json()) if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - @overload - async def begin_grant_access( - self, - resource_group_name: str, - snapshot_name: str, - grant_access_data: _models.GrantAccessData, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.AccessUri]: - """Grants access to a snapshot. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param snapshot_name: The name of the snapshot that is being created. The name can't be changed - after the snapshot is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. - The max name length is 80 characters. Required. - :type snapshot_name: str - :param grant_access_data: Access data object supplied in the body of the get snapshot access - operation. Required. - :type grant_access_data: ~azure.mgmt.compute.models.GrantAccessData - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns AccessUri. The AccessUri is compatible with - MutableMapping - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.AccessUri] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_grant_access( - self, - resource_group_name: str, - snapshot_name: str, - grant_access_data: JSON, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.AccessUri]: - """Grants access to a snapshot. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param snapshot_name: The name of the snapshot that is being created. The name can't be changed - after the snapshot is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. - The max name length is 80 characters. Required. - :type snapshot_name: str - :param grant_access_data: Access data object supplied in the body of the get snapshot access - operation. Required. - :type grant_access_data: JSON - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns AccessUri. The AccessUri is compatible with - MutableMapping - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.AccessUri] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_grant_access( + @distributed_trace + def list( self, - resource_group_name: str, - snapshot_name: str, - grant_access_data: IO[bytes], + location: str, + gallery_unique_name: str, *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.AccessUri]: - """Grants access to a snapshot. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param snapshot_name: The name of the snapshot that is being created. The name can't be changed - after the snapshot is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. - The max name length is 80 characters. Required. - :type snapshot_name: str - :param grant_access_data: Access data object supplied in the body of the get snapshot access - operation. Required. - :type grant_access_data: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns AccessUri. The AccessUri is compatible with - MutableMapping - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.AccessUri] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_grant_access( - self, - resource_group_name: str, - snapshot_name: str, - grant_access_data: Union[_models.GrantAccessData, JSON, IO[bytes]], + shared_to: Optional[Union[str, _models.SharedToValues]] = None, **kwargs: Any - ) -> AsyncLROPoller[_models.AccessUri]: - """Grants access to a snapshot. + ) -> AsyncItemPaged["_models.SharedGalleryImage"]: + """List shared gallery images by subscription id or tenant id. - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param snapshot_name: The name of the snapshot that is being created. The name can't be changed - after the snapshot is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. - The max name length is 80 characters. Required. - :type snapshot_name: str - :param grant_access_data: Access data object supplied in the body of the get snapshot access - operation. Is one of the following types: GrantAccessData, JSON, IO[bytes] Required. - :type grant_access_data: ~azure.mgmt.compute.models.GrantAccessData or JSON or IO[bytes] - :return: An instance of AsyncLROPoller that returns AccessUri. The AccessUri is compatible with - MutableMapping - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.AccessUri] + :param location: The name of the Azure region. Required. + :type location: str + :param gallery_unique_name: The unique name of the Shared Gallery. Required. + :type gallery_unique_name: str + :keyword shared_to: The query parameter to decide what shared galleries to fetch when doing + listing operations. "tenant" Default value is None. + :paramtype shared_to: str or ~azure.mgmt.compute.models.SharedToValues + :return: An iterator like instance of SharedGalleryImage + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.models.SharedGalleryImage] :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AccessUri] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._grant_access_initial( - resource_group_name=resource_group_name, - snapshot_name=snapshot_name, - grant_access_data=grant_access_data, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - response_headers = {} - response = pipeline_response.http_response - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = _deserialize(_models.AccessUri, response.json()) - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized - - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.AccessUri].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.AccessUri]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) + cls: ClsType[List[_models.SharedGalleryImage]] = kwargs.pop("cls", None) - async def _revoke_access_initial( - self, resource_group_name: str, snapshot_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -31437,132 +32211,81 @@ async def _revoke_access_initial( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_snapshots_revoke_access_request( - resource_group_name=resource_group_name, - snapshot_name=snapshot_name, - subscription_id=self._config.subscription_id, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.CloudError, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + def prepare_request(next_link=None): + if not next_link: - deserialized = response.iter_bytes() + _request = build_shared_gallery_images_list_request( + location=location, + gallery_unique_name=gallery_unique_name, + subscription_id=self._config.subscription_id, + shared_to=shared_to, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) - return deserialized # type: ignore + return _request - @distributed_trace_async - async def begin_revoke_access( - self, resource_group_name: str, snapshot_name: str, **kwargs: Any - ) -> AsyncLROPoller[_models.OkResponse]: - """Revokes access to a snapshot. + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.SharedGalleryImage], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param snapshot_name: The name of the snapshot that is being created. The name can't be changed - after the snapshot is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. - The max name length is 80 characters. Required. - :type snapshot_name: str - :return: An instance of AsyncLROPoller that returns OkResponse. The OkResponse is compatible - with MutableMapping - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.OkResponse] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} + async def get_next(next_link=None): + _request = prepare_request(next_link) - cls: ClsType[_models.OkResponse] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._revoke_access_initial( - resource_group_name=resource_group_name, - snapshot_name=snapshot_name, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - response_headers = {} response = pipeline_response.http_response - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - deserialized = _deserialize(_models.OkResponse, response.json()) - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } + return pipeline_response - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.OkResponse].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.OkResponse]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) + return AsyncItemPaged(get_next, extract_data) -class GalleriesOperations: +class SharedGalleryImageVersionsOperations: """ .. warning:: **DO NOT** instantiate this class directly. Instead, you should access the following operations through :class:`~azure.mgmt.compute.aio.ComputeClient`'s - :attr:`galleries` attribute. + :attr:`shared_gallery_image_versions` attribute. """ def __init__(self, *args, **kwargs) -> None: @@ -31575,28 +32298,29 @@ def __init__(self, *args, **kwargs) -> None: @distributed_trace_async async def get( self, - resource_group_name: str, - gallery_name: str, - *, - select: Optional[Union[str, _models.SelectPermissions]] = None, - expand: Optional[Union[str, _models.GalleryExpandParams]] = None, + location: str, + gallery_unique_name: str, + gallery_image_name: str, + gallery_image_version_name: str, **kwargs: Any - ) -> _models.Gallery: - """Retrieves information about a Shared Image Gallery. + ) -> _models.SharedGalleryImageVersion: + """Get a shared gallery image version by subscription id or tenant id. - :param resource_group_name: The name of the resource group. The name is case insensitive. + :param location: The name of the Azure region. Required. + :type location: str + :param gallery_unique_name: The unique name of the Shared Gallery. Required. + :type gallery_unique_name: str + :param gallery_image_name: The name of the Shared Gallery Image Definition from which the Image + Versions are to be listed. Required. + :type gallery_image_name: str + :param gallery_image_version_name: The name of the gallery image version to be created. Needs + to follow semantic version name pattern: The allowed characters are digit and period. Digits + must be within the range of a 32-bit integer. Format: ... Required. - :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :keyword select: The select expression to apply on the operation. "Permissions" Default value - is None. - :paramtype select: str or ~azure.mgmt.compute.models.SelectPermissions - :keyword expand: The expand query option to apply on the operation. "SharingProfile/Groups" - Default value is None. - :paramtype expand: str or ~azure.mgmt.compute.models.GalleryExpandParams - :return: Gallery. The Gallery is compatible with MutableMapping - :rtype: ~azure.mgmt.compute.models.Gallery + :type gallery_image_version_name: str + :return: SharedGalleryImageVersion. The SharedGalleryImageVersion is compatible with + MutableMapping + :rtype: ~azure.mgmt.compute.models.SharedGalleryImageVersion :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -31610,14 +32334,14 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.Gallery] = kwargs.pop("cls", None) + cls: ClsType[_models.SharedGalleryImageVersion] = kwargs.pop("cls", None) - _request = build_galleries_get_request( - resource_group_name=resource_group_name, - gallery_name=gallery_name, + _request = build_shared_gallery_image_versions_get_request( + location=location, + gallery_unique_name=gallery_unique_name, + gallery_image_name=gallery_image_name, + gallery_image_version_name=gallery_image_version_name, subscription_id=self._config.subscription_id, - select=select, - expand=expand, api_version=self._config.api_version, headers=_headers, params=_params, @@ -31647,20 +32371,45 @@ async def get( if _stream: deserialized = response.iter_bytes() else: - deserialized = _deserialize(_models.Gallery, response.json()) + deserialized = _deserialize(_models.SharedGalleryImageVersion, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - async def _create_or_update_initial( + @distributed_trace + def list( self, - resource_group_name: str, - gallery_name: str, - gallery: Union[_models.Gallery, JSON, IO[bytes]], + location: str, + gallery_unique_name: str, + gallery_image_name: str, + *, + shared_to: Optional[Union[str, _models.SharedToValues]] = None, **kwargs: Any - ) -> AsyncIterator[bytes]: + ) -> AsyncItemPaged["_models.SharedGalleryImageVersion"]: + """List shared gallery image versions by subscription id or tenant id. + + :param location: The name of the Azure region. Required. + :type location: str + :param gallery_unique_name: The unique name of the Shared Gallery. Required. + :type gallery_unique_name: str + :param gallery_image_name: The name of the Shared Gallery Image Definition from which the Image + Versions are to be listed. Required. + :type gallery_image_name: str + :keyword shared_to: The query parameter to decide what shared galleries to fetch when doing + listing operations. "tenant" Default value is None. + :paramtype shared_to: str or ~azure.mgmt.compute.models.SharedToValues + :return: An iterator like instance of SharedGalleryImageVersion + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.models.SharedGalleryImageVersion] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.SharedGalleryImageVersion]] = kwargs.pop("cls", None) + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -31669,226 +32418,103 @@ async def _create_or_update_initial( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} - - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _content = None - if isinstance(gallery, (IOBase, bytes)): - _content = gallery - else: - _content = json.dumps(gallery, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + def prepare_request(next_link=None): + if not next_link: - _request = build_galleries_create_or_update_request( - resource_group_name=resource_group_name, - gallery_name=gallery_name, - subscription_id=self._config.subscription_id, - content_type=content_type, - api_version=self._config.api_version, - content=_content, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) + _request = build_shared_gallery_image_versions_list_request( + location=location, + gallery_unique_name=gallery_unique_name, + gallery_image_name=gallery_image_name, + subscription_id=self._config.subscription_id, + shared_to=shared_to, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) - response = pipeline_response.http_response + return _request - if response.status_code not in [200, 201, 202]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.CloudError, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 201: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.SharedGalleryImageVersion], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) - deserialized = response.iter_bytes() + async def get_next(next_link=None): + _request = prepare_request(next_link) - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response - return deserialized # type: ignore + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - gallery_name: str, - gallery: _models.Gallery, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Create or update a Shared Image Gallery. + return pipeline_response - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :param gallery: Parameters supplied to the create or update Shared Image Gallery operation. - Required. - :type gallery: ~azure.mgmt.compute.models.Gallery - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns None - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ + return AsyncItemPaged(get_next, extract_data) - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - gallery_name: str, - gallery: JSON, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Create or update a Shared Image Gallery. - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :param gallery: Parameters supplied to the create or update Shared Image Gallery operation. - Required. - :type gallery: JSON - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns None - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ +class CommunityGalleriesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - gallery_name: str, - gallery: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Create or update a Shared Image Gallery. + Instead, you should access the following operations through + :class:`~azure.mgmt.compute.aio.ComputeClient`'s + :attr:`community_galleries` attribute. + """ - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :param gallery: Parameters supplied to the create or update Shared Image Gallery operation. - Required. - :type gallery: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns None - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - gallery_name: str, - gallery: Union[_models.Gallery, JSON, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Create or update a Shared Image Gallery. + async def get(self, location: str, public_gallery_name: str, **kwargs: Any) -> _models.CommunityGallery: + """Get a community gallery by gallery public name. - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :param gallery: Parameters supplied to the create or update Shared Image Gallery operation. Is - one of the following types: Gallery, JSON, IO[bytes] Required. - :type gallery: ~azure.mgmt.compute.models.Gallery or JSON or IO[bytes] - :return: An instance of AsyncLROPoller that returns None - :rtype: ~azure.core.polling.AsyncLROPoller[None] + :param location: The name of the Azure region. Required. + :type location: str + :param public_gallery_name: The public name of the community gallery. Required. + :type public_gallery_name: str + :return: CommunityGallery. The CommunityGallery is compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.CommunityGallery :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} - - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._create_or_update_initial( - resource_group_name=resource_group_name, - gallery_name=gallery_name, - gallery=gallery, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _update_initial( - self, - resource_group_name: str, - gallery_name: str, - gallery: Union[_models.GalleryUpdate, JSON, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -31897,26 +32523,16 @@ async def _update_initial( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _content = None - if isinstance(gallery, (IOBase, bytes)): - _content = gallery - else: - _content = json.dumps(gallery, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + cls: ClsType[_models.CommunityGallery] = kwargs.pop("cls", None) - _request = build_galleries_update_request( - resource_group_name=resource_group_name, - gallery_name=gallery_name, + _request = build_community_galleries_get_request( + location=location, + public_gallery_name=public_gallery_name, subscription_id=self._config.subscription_id, - content_type=content_type, api_version=self._config.api_version, - content=_content, headers=_headers, params=_params, ) @@ -31925,7 +32541,7 @@ async def _update_initial( } _request.url = self._client.format_url(_request.url, **path_format_arguments) - _stream = True + _stream = kwargs.pop("stream", False) pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -31933,176 +32549,59 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = _failsafe_deserialize(_models.CloudError, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - response_headers = {} - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.iter_bytes() + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.CommunityGallery, response.json()) if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - @overload - async def begin_update( - self, - resource_group_name: str, - gallery_name: str, - gallery: _models.GalleryUpdate, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Update a Shared Image Gallery. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :param gallery: Parameters supplied to the update Shared Image Gallery operation. Required. - :type gallery: ~azure.mgmt.compute.models.GalleryUpdate - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns None - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update( - self, - resource_group_name: str, - gallery_name: str, - gallery: JSON, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Update a Shared Image Gallery. - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :param gallery: Parameters supplied to the update Shared Image Gallery operation. Required. - :type gallery: JSON - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns None - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ +class CommunityGalleryImagesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - @overload - async def begin_update( - self, - resource_group_name: str, - gallery_name: str, - gallery: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Update a Shared Image Gallery. + Instead, you should access the following operations through + :class:`~azure.mgmt.compute.aio.ComputeClient`'s + :attr:`community_gallery_images` attribute. + """ - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :param gallery: Parameters supplied to the update Shared Image Gallery operation. Required. - :type gallery: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns None - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace_async - async def begin_update( - self, - resource_group_name: str, - gallery_name: str, - gallery: Union[_models.GalleryUpdate, JSON, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Update a Shared Image Gallery. + async def get( + self, location: str, public_gallery_name: str, gallery_image_name: str, **kwargs: Any + ) -> _models.CommunityGalleryImage: + """Get a community gallery image. - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :param gallery: Parameters supplied to the update Shared Image Gallery operation. Is one of the - following types: GalleryUpdate, JSON, IO[bytes] Required. - :type gallery: ~azure.mgmt.compute.models.GalleryUpdate or JSON or IO[bytes] - :return: An instance of AsyncLROPoller that returns None - :rtype: ~azure.core.polling.AsyncLROPoller[None] + :param location: The name of the Azure region. Required. + :type location: str + :param public_gallery_name: The public name of the community gallery. Required. + :type public_gallery_name: str + :param gallery_image_name: The name of the community gallery image definition. Required. + :type gallery_image_name: str + :return: CommunityGalleryImage. The CommunityGalleryImage is compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.CommunityGalleryImage :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} - - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._update_initial( - resource_group_name=resource_group_name, - gallery_name=gallery_name, - gallery=gallery, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _delete_initial(self, resource_group_name: str, gallery_name: str, **kwargs: Any) -> AsyncIterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -32114,11 +32613,12 @@ async def _delete_initial(self, resource_group_name: str, gallery_name: str, **k _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + cls: ClsType[_models.CommunityGalleryImage] = kwargs.pop("cls", None) - _request = build_galleries_delete_request( - resource_group_name=resource_group_name, - gallery_name=gallery_name, + _request = build_community_gallery_images_get_request( + location=location, + public_gallery_name=public_gallery_name, + gallery_image_name=gallery_image_name, subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -32129,120 +32629,67 @@ async def _delete_initial(self, resource_group_name: str, gallery_name: str, **k } _request.url = self._client.format_url(_request.url, **path_format_arguments) - _stream = True + _stream = kwargs.pop("stream", False) pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200, 202, 204]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = _failsafe_deserialize(_models.CloudError, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.iter_bytes() + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.CommunityGalleryImage, response.json()) if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - @distributed_trace_async - async def begin_delete(self, resource_group_name: str, gallery_name: str, **kwargs: Any) -> AsyncLROPoller[None]: - """Delete a Shared Image Gallery. + @distributed_trace + def list( + self, location: str, public_gallery_name: str, **kwargs: Any + ) -> AsyncItemPaged["_models.CommunityGalleryImage"]: + """List community gallery images inside a gallery. - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :return: An instance of AsyncLROPoller that returns None - :rtype: ~azure.core.polling.AsyncLROPoller[None] + :param location: The name of the Azure region. Required. + :type location: str + :param public_gallery_name: The public name of the community gallery. Required. + :type public_gallery_name: str + :return: An iterator like instance of CommunityGalleryImage + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.models.CommunityGalleryImage] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._delete_initial( - resource_group_name=resource_group_name, - gallery_name=gallery_name, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore + cls: ClsType[List[_models.CommunityGalleryImage]] = kwargs.pop("cls", None) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> AsyncItemPaged["_models.Gallery"]: - """List galleries under a resource group. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :return: An iterator like instance of Gallery - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.models.Gallery] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[List[_models.Gallery]] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): if not next_link: - _request = build_galleries_list_by_resource_group_request( - resource_group_name=resource_group_name, + _request = build_community_gallery_images_list_request( + location=location, + public_gallery_name=public_gallery_name, subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -32279,7 +32726,7 @@ def prepare_request(next_link=None): async def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.Gallery], deserialized.get("value", [])) + list_of_elem = _deserialize(List[_models.CommunityGalleryImage], deserialized.get("value", [])) if cls: list_of_elem = cls(list_of_elem) # type: ignore return deserialized.get("nextLink") or None, AsyncList(list_of_elem) @@ -32302,18 +32749,127 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) + +class CommunityGalleryImageVersionsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.compute.aio.ComputeClient`'s + :attr:`community_gallery_image_versions` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace_async + async def get( + self, + location: str, + public_gallery_name: str, + gallery_image_name: str, + gallery_image_version_name: str, + **kwargs: Any + ) -> _models.CommunityGalleryImageVersion: + """Get a community gallery image version. + + :param location: The name of the Azure region. Required. + :type location: str + :param public_gallery_name: The public name of the community gallery. Required. + :type public_gallery_name: str + :param gallery_image_name: The name of the community gallery image definition. Required. + :type gallery_image_name: str + :param gallery_image_version_name: The name of the community gallery image version. Needs to + follow semantic version name pattern: The allowed characters are digit and period. Digits must + be within the range of a 32-bit integer. Format: ... + Required. + :type gallery_image_version_name: str + :return: CommunityGalleryImageVersion. The CommunityGalleryImageVersion is compatible with + MutableMapping + :rtype: ~azure.mgmt.compute.models.CommunityGalleryImageVersion + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.CommunityGalleryImageVersion] = kwargs.pop("cls", None) + + _request = build_community_gallery_image_versions_get_request( + location=location, + public_gallery_name=public_gallery_name, + gallery_image_name=gallery_image_name, + gallery_image_version_name=gallery_image_version_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.CommunityGalleryImageVersion, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + @distributed_trace - def list(self, **kwargs: Any) -> AsyncItemPaged["_models.Gallery"]: - """List galleries under a subscription. + def list( + self, location: str, public_gallery_name: str, gallery_image_name: str, **kwargs: Any + ) -> AsyncItemPaged["_models.CommunityGalleryImageVersion"]: + """List community gallery image versions inside an image. - :return: An iterator like instance of Gallery - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.models.Gallery] + :param location: The name of the Azure region. Required. + :type location: str + :param public_gallery_name: The public name of the community gallery. Required. + :type public_gallery_name: str + :param gallery_image_name: The name of the community gallery image definition. Required. + :type gallery_image_name: str + :return: An iterator like instance of CommunityGalleryImageVersion + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.models.CommunityGalleryImageVersion] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.Gallery]] = kwargs.pop("cls", None) + cls: ClsType[List[_models.CommunityGalleryImageVersion]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -32326,7 +32882,10 @@ def list(self, **kwargs: Any) -> AsyncItemPaged["_models.Gallery"]: def prepare_request(next_link=None): if not next_link: - _request = build_galleries_list_request( + _request = build_community_gallery_image_versions_list_request( + location=location, + public_gallery_name=public_gallery_name, + gallery_image_name=gallery_image_name, subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -32363,7 +32922,7 @@ def prepare_request(next_link=None): async def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.Gallery], deserialized.get("value", [])) + list_of_elem = _deserialize(List[_models.CommunityGalleryImageVersion], deserialized.get("value", [])) if cls: list_of_elem = cls(list_of_elem) # type: ignore return deserialized.get("nextLink") or None, AsyncList(list_of_elem) @@ -32386,33 +32945,44 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) + +class ResourceSkusOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.compute.aio.ComputeClient`'s + :attr:`resource_skus` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace - def list_by_artifact_name( - self, resource_group_name: str, gallery_name: str, artifact_type: str, artifact_name: str, **kwargs: Any - ) -> AsyncItemPaged["_models.GallerySoftDeletedResource"]: - """List soft-deleted resources of an artifact in the gallery, such as soft-deleted gallery image - version of an image. + def list( + self, *, filter: Optional[str] = None, include_extended_locations: Optional[str] = None, **kwargs: Any + ) -> AsyncItemPaged["_models.ResourceSku"]: + """Gets the list of Microsoft.Compute SKUs available for your Subscription. - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :param artifact_type: The type of the artifact to be listed, such as gallery image version. - Required. - :type artifact_type: str - :param artifact_name: The artifact name to be listed. If artifact type is Images, then the - artifact name should be the gallery image name. Required. - :type artifact_name: str - :return: An iterator like instance of GallerySoftDeletedResource - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.models.GallerySoftDeletedResource] + :keyword filter: The filter to apply on the operation. Only **location** filter is supported + currently. Default value is None. + :paramtype filter: str + :keyword include_extended_locations: To Include Extended Locations information or not in the + response. Default value is None. + :paramtype include_extended_locations: str + :return: An iterator like instance of ResourceSku + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.models.ResourceSku] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.GallerySoftDeletedResource]] = kwargs.pop("cls", None) + cls: ClsType[List[_models.ResourceSku]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -32425,12 +32995,10 @@ def list_by_artifact_name( def prepare_request(next_link=None): if not next_link: - _request = build_galleries_list_by_artifact_name_request( - resource_group_name=resource_group_name, - gallery_name=gallery_name, - artifact_type=artifact_type, - artifact_name=artifact_name, + _request = build_resource_skus_list_request( subscription_id=self._config.subscription_id, + filter=filter, + include_extended_locations=include_extended_locations, api_version=self._config.api_version, headers=_headers, params=_params, @@ -32466,7 +33034,7 @@ def prepare_request(next_link=None): async def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.GallerySoftDeletedResource], deserialized.get("value", [])) + list_of_elem = _deserialize(List[_models.ResourceSku], deserialized.get("value", [])) if cls: list_of_elem = cls(list_of_elem) # type: ignore return deserialized.get("nextLink") or None, AsyncList(list_of_elem) @@ -32482,19 +33050,33 @@ async def get_next(next_link=None): if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.CloudError, response) + error = _failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response return AsyncItemPaged(get_next, extract_data) - async def _gallery_sharing_profile_update_initial( - self, - resource_group_name: str, - gallery_name: str, - sharing_update: Union[_models.SharingUpdate, JSON, IO[bytes]], - **kwargs: Any + +class VirtualMachineScaleSetRollingUpgradesOperations: # pylint: disable=name-too-long + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.compute.aio.ComputeClient`'s + :attr:`virtual_machine_scale_set_rolling_upgrades` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + async def _start_extension_upgrade_initial( + self, resource_group_name: str, vm_scale_set_name: str, **kwargs: Any ) -> AsyncIterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -32504,26 +33086,16 @@ async def _gallery_sharing_profile_update_initial( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - content_type = content_type or "application/json" - _content = None - if isinstance(sharing_update, (IOBase, bytes)): - _content = sharing_update - else: - _content = json.dumps(sharing_update, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - - _request = build_galleries_gallery_sharing_profile_update_request( + _request = build_virtual_machine_scale_set_rolling_upgrades_start_extension_upgrade_request( resource_group_name=resource_group_name, - gallery_name=gallery_name, + vm_scale_set_name=vm_scale_set_name, subscription_id=self._config.subscription_id, - content_type=content_type, api_version=self._config.api_version, - content=_content, headers=_headers, params=_params, ) @@ -32560,123 +33132,34 @@ async def _gallery_sharing_profile_update_initial( return deserialized # type: ignore - @overload - async def begin_gallery_sharing_profile_update( - self, - resource_group_name: str, - gallery_name: str, - sharing_update: _models.SharingUpdate, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Update sharing profile of a gallery. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :param sharing_update: Parameters supplied to the update gallery sharing profile. Required. - :type sharing_update: ~azure.mgmt.compute.models.SharingUpdate - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns None - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_gallery_sharing_profile_update( - self, - resource_group_name: str, - gallery_name: str, - sharing_update: JSON, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Update sharing profile of a gallery. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :param sharing_update: Parameters supplied to the update gallery sharing profile. Required. - :type sharing_update: JSON - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns None - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_gallery_sharing_profile_update( - self, - resource_group_name: str, - gallery_name: str, - sharing_update: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Update sharing profile of a gallery. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :param sharing_update: Parameters supplied to the update gallery sharing profile. Required. - :type sharing_update: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns None - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - @distributed_trace_async - async def begin_gallery_sharing_profile_update( - self, - resource_group_name: str, - gallery_name: str, - sharing_update: Union[_models.SharingUpdate, JSON, IO[bytes]], - **kwargs: Any + async def begin_start_extension_upgrade( + self, resource_group_name: str, vm_scale_set_name: str, **kwargs: Any ) -> AsyncLROPoller[None]: - """Update sharing profile of a gallery. + """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. The name is case insensitive. Required. :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :param sharing_update: Parameters supplied to the update gallery sharing profile. Is one of the - following types: SharingUpdate, JSON, IO[bytes] Required. - :type sharing_update: ~azure.mgmt.compute.models.SharingUpdate or JSON or IO[bytes] + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str :return: An instance of AsyncLROPoller that returns None :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._gallery_sharing_profile_update_initial( + raw_result = await self._start_extension_upgrade_initial( resource_group_name=resource_group_name, - gallery_name=gallery_name, - sharing_update=sharing_update, - content_type=content_type, + vm_scale_set_name=vm_scale_set_name, cls=lambda x, y, z: x, headers=_headers, params=_params, @@ -32710,102 +33193,8 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - -class GalleryImagesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.compute.aio.ComputeClient`'s - :attr:`gallery_images` attribute. - """ - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ComputeClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace_async - async def get( - self, resource_group_name: str, gallery_name: str, gallery_image_name: str, **kwargs: Any - ) -> _models.GalleryImage: - """Retrieves information about a gallery image definition. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :param gallery_image_name: The name of the gallery image definition to be retrieved. Required. - :type gallery_image_name: str - :return: GalleryImage. The GalleryImage is compatible with MutableMapping - :rtype: ~azure.mgmt.compute.models.GalleryImage - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[_models.GalleryImage] = kwargs.pop("cls", None) - - _request = build_gallery_images_get_request( - resource_group_name=resource_group_name, - gallery_name=gallery_name, - gallery_image_name=gallery_image_name, - subscription_id=self._config.subscription_id, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = kwargs.pop("stream", False) - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - if _stream: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.CloudError, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if _stream: - deserialized = response.iter_bytes() - else: - deserialized = _deserialize(_models.GalleryImage, response.json()) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - gallery_name: str, - gallery_image_name: str, - gallery_image: Union[_models.GalleryImage, JSON, IO[bytes]], - **kwargs: Any + async def _start_os_upgrade_initial( + self, resource_group_name: str, vm_scale_set_name: str, **kwargs: Any ) -> AsyncIterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -32815,27 +33204,16 @@ async def _create_or_update_initial( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - content_type = content_type or "application/json" - _content = None - if isinstance(gallery_image, (IOBase, bytes)): - _content = gallery_image - else: - _content = json.dumps(gallery_image, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - - _request = build_gallery_images_create_or_update_request( + _request = build_virtual_machine_scale_set_rolling_upgrades_start_os_upgrade_request( resource_group_name=resource_group_name, - gallery_name=gallery_name, - gallery_image_name=gallery_image_name, + vm_scale_set_name=vm_scale_set_name, subscription_id=self._config.subscription_id, - content_type=content_type, api_version=self._config.api_version, - content=_content, headers=_headers, params=_params, ) @@ -32851,7 +33229,7 @@ async def _create_or_update_initial( response = pipeline_response.http_response - if response.status_code not in [200, 201, 202]: + if response.status_code not in [200, 202]: try: await response.read() # Load the body in memory and close the socket except (StreamConsumedError, StreamClosedError): @@ -32861,10 +33239,6 @@ async def _create_or_update_initial( raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} - if response.status_code == 201: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) @@ -32876,139 +33250,34 @@ async def _create_or_update_initial( return deserialized # type: ignore - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - gallery_name: str, - gallery_image_name: str, - gallery_image: _models.GalleryImage, - *, - content_type: str = "application/json", - **kwargs: Any + @distributed_trace_async + async def begin_start_os_upgrade( + self, resource_group_name: str, vm_scale_set_name: str, **kwargs: Any ) -> AsyncLROPoller[None]: - """Create or update a gallery image definition. + """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. The name is case insensitive. Required. :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :param gallery_image_name: The name of the gallery image definition to be retrieved. Required. - :type gallery_image_name: str - :param gallery_image: Parameters supplied to the create or update gallery image operation. - Required. - :type gallery_image: ~azure.mgmt.compute.models.GalleryImage - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns None - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - gallery_name: str, - gallery_image_name: str, - gallery_image: JSON, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Create or update a gallery image definition. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :param gallery_image_name: The name of the gallery image definition to be retrieved. Required. - :type gallery_image_name: str - :param gallery_image: Parameters supplied to the create or update gallery image operation. - Required. - :type gallery_image: JSON - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns None - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - gallery_name: str, - gallery_image_name: str, - gallery_image: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Create or update a gallery image definition. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :param gallery_image_name: The name of the gallery image definition to be retrieved. Required. - :type gallery_image_name: str - :param gallery_image: Parameters supplied to the create or update gallery image operation. - Required. - :type gallery_image: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns None - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - gallery_name: str, - gallery_image_name: str, - gallery_image: Union[_models.GalleryImage, JSON, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Create or update a gallery image definition. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :param gallery_image_name: The name of the gallery image definition to be retrieved. Required. - :type gallery_image_name: str - :param gallery_image: Parameters supplied to the create or update gallery image operation. Is - one of the following types: GalleryImage, JSON, IO[bytes] Required. - :type gallery_image: ~azure.mgmt.compute.models.GalleryImage or JSON or IO[bytes] + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str :return: An instance of AsyncLROPoller that returns None :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._create_or_update_initial( + raw_result = await self._start_os_upgrade_initial( resource_group_name=resource_group_name, - gallery_name=gallery_name, - gallery_image_name=gallery_image_name, - gallery_image=gallery_image, - content_type=content_type, + vm_scale_set_name=vm_scale_set_name, cls=lambda x, y, z: x, headers=_headers, params=_params, @@ -33042,13 +33311,8 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - async def _update_initial( - self, - resource_group_name: str, - gallery_name: str, - gallery_image_name: str, - gallery_image: Union[_models.GalleryImageUpdate, JSON, IO[bytes]], - **kwargs: Any + async def _cancel_initial( + self, resource_group_name: str, vm_scale_set_name: str, **kwargs: Any ) -> AsyncIterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -33058,27 +33322,16 @@ async def _update_initial( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - content_type = content_type or "application/json" - _content = None - if isinstance(gallery_image, (IOBase, bytes)): - _content = gallery_image - else: - _content = json.dumps(gallery_image, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - - _request = build_gallery_images_update_request( + _request = build_virtual_machine_scale_set_rolling_upgrades_cancel_request( resource_group_name=resource_group_name, - gallery_name=gallery_name, - gallery_image_name=gallery_image_name, + vm_scale_set_name=vm_scale_set_name, subscription_id=self._config.subscription_id, - content_type=content_type, api_version=self._config.api_version, - content=_content, headers=_headers, params=_params, ) @@ -33094,7 +33347,7 @@ async def _update_initial( response = pipeline_response.http_response - if response.status_code not in [200]: + if response.status_code not in [200, 202]: try: await response.read() # Load the body in memory and close the socket except (StreamConsumedError, StreamClosedError): @@ -33104,8 +33357,9 @@ async def _update_initial( raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) deserialized = response.iter_bytes() @@ -33114,136 +33368,32 @@ async def _update_initial( return deserialized # type: ignore - @overload - async def begin_update( - self, - resource_group_name: str, - gallery_name: str, - gallery_image_name: str, - gallery_image: _models.GalleryImageUpdate, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Update a gallery image definition. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :param gallery_image_name: The name of the gallery image definition to be retrieved. Required. - :type gallery_image_name: str - :param gallery_image: Parameters supplied to the update gallery image operation. Required. - :type gallery_image: ~azure.mgmt.compute.models.GalleryImageUpdate - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns None - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update( - self, - resource_group_name: str, - gallery_name: str, - gallery_image_name: str, - gallery_image: JSON, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Update a gallery image definition. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :param gallery_image_name: The name of the gallery image definition to be retrieved. Required. - :type gallery_image_name: str - :param gallery_image: Parameters supplied to the update gallery image operation. Required. - :type gallery_image: JSON - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns None - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update( - self, - resource_group_name: str, - gallery_name: str, - gallery_image_name: str, - gallery_image: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Update a gallery image definition. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :param gallery_image_name: The name of the gallery image definition to be retrieved. Required. - :type gallery_image_name: str - :param gallery_image: Parameters supplied to the update gallery image operation. Required. - :type gallery_image: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns None - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - @distributed_trace_async - async def begin_update( - self, - resource_group_name: str, - gallery_name: str, - gallery_image_name: str, - gallery_image: Union[_models.GalleryImageUpdate, JSON, IO[bytes]], - **kwargs: Any + async def begin_cancel( + self, resource_group_name: str, vm_scale_set_name: str, **kwargs: Any ) -> AsyncLROPoller[None]: - """Update a gallery image definition. + """Cancels the current virtual machine scale set rolling upgrade. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :param gallery_image_name: The name of the gallery image definition to be retrieved. Required. - :type gallery_image_name: str - :param gallery_image: Parameters supplied to the update gallery image operation. Is one of the - following types: GalleryImageUpdate, JSON, IO[bytes] Required. - :type gallery_image: ~azure.mgmt.compute.models.GalleryImageUpdate or JSON or IO[bytes] + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str :return: An instance of AsyncLROPoller that returns None :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._update_initial( + raw_result = await self._cancel_initial( resource_group_name=resource_group_name, - gallery_name=gallery_name, - gallery_image_name=gallery_image_name, - gallery_image=gallery_image, - content_type=content_type, + vm_scale_set_name=vm_scale_set_name, cls=lambda x, y, z: x, headers=_headers, params=_params, @@ -33277,9 +33427,22 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - async def _delete_initial( - self, resource_group_name: str, gallery_name: str, gallery_image_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: + @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. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :return: RollingUpgradeStatusInfo. The RollingUpgradeStatusInfo is compatible with + MutableMapping + :rtype: ~azure.mgmt.compute.models.RollingUpgradeStatusInfo + :raises ~azure.core.exceptions.HttpResponseError: + """ error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -33291,12 +33454,11 @@ async def _delete_initial( _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + cls: ClsType[_models.RollingUpgradeStatusInfo] = kwargs.pop("cls", None) - _request = build_gallery_images_delete_request( + _request = build_virtual_machine_scale_set_rolling_upgrades_get_latest_request( resource_group_name=resource_group_name, - gallery_name=gallery_name, - gallery_image_name=gallery_image_name, + vm_scale_set_name=vm_scale_set_name, subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -33307,198 +33469,42 @@ async def _delete_initial( } _request.url = self._client.format_url(_request.url, **path_format_arguments) - _stream = True + _stream = kwargs.pop("stream", False) pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200, 202, 204]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = _failsafe_deserialize(_models.CloudError, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.iter_bytes() + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.RollingUpgradeStatusInfo, response.json()) if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - @distributed_trace_async - async def begin_delete( - self, resource_group_name: str, gallery_name: str, gallery_image_name: str, **kwargs: Any - ) -> AsyncLROPoller[None]: - """Delete a gallery image. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :param gallery_image_name: The name of the gallery image definition to be retrieved. Required. - :type gallery_image_name: str - :return: An instance of AsyncLROPoller that returns None - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._delete_initial( - resource_group_name=resource_group_name, - gallery_name=gallery_name, - gallery_image_name=gallery_image_name, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list_by_gallery( - self, resource_group_name: str, gallery_name: str, **kwargs: Any - ) -> AsyncItemPaged["_models.GalleryImage"]: - """List gallery image definitions in a gallery. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :return: An iterator like instance of GalleryImage - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.models.GalleryImage] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[List[_models.GalleryImage]] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_gallery_images_list_by_gallery_request( - resource_group_name=resource_group_name, - gallery_name=gallery_name, - subscription_id=self._config.subscription_id, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - return _request - - async def extract_data(pipeline_response): - deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.GalleryImage], deserialized.get("value", [])) - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.get("nextLink") or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.CloudError, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - return AsyncItemPaged(get_next, extract_data) - - -class GalleryImageVersionsOperations: +class VirtualMachineScaleSetVMsOperations: # pylint: disable=too-many-public-methods """ .. warning:: **DO NOT** instantiate this class directly. Instead, you should access the following operations through :class:`~azure.mgmt.compute.aio.ComputeClient`'s - :attr:`gallery_image_versions` attribute. + :attr:`virtual_machine_scale_set_vms` attribute. """ def __init__(self, *args, **kwargs) -> None: @@ -33512,30 +33518,29 @@ def __init__(self, *args, **kwargs) -> None: async def get( self, resource_group_name: str, - gallery_name: str, - gallery_image_name: str, - gallery_image_version_name: str, + vm_scale_set_name: str, + instance_id: str, *, - expand: Optional[Union[str, _models.ReplicationStatusTypes]] = None, + expand: Optional[Union[str, _models.InstanceViewTypes]] = None, **kwargs: Any - ) -> _models.GalleryImageVersion: - """Retrieves information about a gallery image version. + ) -> _models.VirtualMachineScaleSetVM: + """Gets a virtual machine from a VM scale set. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :param gallery_image_name: The name of the gallery image definition to be retrieved. Required. - :type gallery_image_name: str - :param gallery_image_version_name: The name of the gallery image version to be retrieved. - Required. - :type gallery_image_version_name: str - :keyword expand: The expand expression to apply on the operation. Known values are: - "ReplicationStatus" and "UefiSettings". Default value is None. - :paramtype expand: str or ~azure.mgmt.compute.models.ReplicationStatusTypes - :return: GalleryImageVersion. The GalleryImageVersion is compatible with MutableMapping - :rtype: ~azure.mgmt.compute.models.GalleryImageVersion + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. Required. + :type instance_id: str + :keyword 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. Known values are: "instanceView", "userData", and "resiliencyView". Default value is + None. + :paramtype expand: str or ~azure.mgmt.compute.models.InstanceViewTypes + :return: VirtualMachineScaleSetVM. The VirtualMachineScaleSetVM is compatible with + MutableMapping + :rtype: ~azure.mgmt.compute.models.VirtualMachineScaleSetVM :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -33549,13 +33554,12 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.GalleryImageVersion] = kwargs.pop("cls", None) + cls: ClsType[_models.VirtualMachineScaleSetVM] = kwargs.pop("cls", None) - _request = build_gallery_image_versions_get_request( + _request = build_virtual_machine_scale_set_vms_get_request( resource_group_name=resource_group_name, - gallery_name=gallery_name, - gallery_image_name=gallery_image_name, - gallery_image_version_name=gallery_image_version_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, subscription_id=self._config.subscription_id, expand=expand, api_version=self._config.api_version, @@ -33587,20 +33591,22 @@ async def get( if _stream: deserialized = response.iter_bytes() else: - deserialized = _deserialize(_models.GalleryImageVersion, response.json()) + deserialized = _deserialize(_models.VirtualMachineScaleSetVM, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - async def _create_or_update_initial( + async def _update_initial( self, resource_group_name: str, - gallery_name: str, - gallery_image_name: str, - gallery_image_version_name: str, - gallery_image_version: Union[_models.GalleryImageVersion, JSON, IO[bytes]], + vm_scale_set_name: str, + instance_id: str, + parameters: Union[_models.VirtualMachineScaleSetVM, JSON, IO[bytes]], + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, **kwargs: Any ) -> AsyncIterator[bytes]: error_map: MutableMapping = { @@ -33609,6 +33615,12 @@ async def _create_or_update_initial( 409: ResourceExistsError, 304: ResourceNotModifiedError, } + if match_condition == MatchConditions.IfNotModified: + error_map[412] = ResourceModifiedError + elif match_condition == MatchConditions.IfPresent: + error_map[412] = ResourceNotFoundError + elif match_condition == MatchConditions.IfMissing: + error_map[412] = ResourceExistsError error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -33619,17 +33631,18 @@ async def _create_or_update_initial( content_type = content_type or "application/json" _content = None - if isinstance(gallery_image_version, (IOBase, bytes)): - _content = gallery_image_version + if isinstance(parameters, (IOBase, bytes)): + _content = parameters else: - _content = json.dumps(gallery_image_version, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - _request = build_gallery_image_versions_create_or_update_request( + _request = build_virtual_machine_scale_set_vms_update_request( resource_group_name=resource_group_name, - gallery_name=gallery_name, - gallery_image_name=gallery_image_name, - gallery_image_version_name=gallery_image_version_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, subscription_id=self._config.subscription_id, + etag=etag, + match_condition=match_condition, content_type=content_type, api_version=self._config.api_version, content=_content, @@ -33648,7 +33661,7 @@ async def _create_or_update_initial( response = pipeline_response.http_response - if response.status_code not in [200, 201, 202]: + if response.status_code not in [200, 202]: try: await response.read() # Load the body in memory and close the socket except (StreamConsumedError, StreamClosedError): @@ -33658,10 +33671,6 @@ async def _create_or_update_initial( raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} - if response.status_code == 201: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) @@ -33674,155 +33683,172 @@ async def _create_or_update_initial( return deserialized # type: ignore @overload - async def begin_create_or_update( + async def begin_update( self, resource_group_name: str, - gallery_name: str, - gallery_image_name: str, - gallery_image_version_name: str, - gallery_image_version: _models.GalleryImageVersion, + vm_scale_set_name: str, + instance_id: str, + parameters: _models.VirtualMachineScaleSetVM, *, content_type: str = "application/json", + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, **kwargs: Any - ) -> AsyncLROPoller[None]: - """Create or update a gallery image version. + ) -> AsyncLROPoller[_models.VirtualMachineScaleSetVM]: + """Updates a virtual machine of a VM scale set. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :param gallery_image_name: The name of the gallery image definition to be retrieved. Required. - :type gallery_image_name: str - :param gallery_image_version_name: The name of the gallery image version to be retrieved. + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. Required. + :type instance_id: str + :param parameters: Parameters supplied to the Update Virtual Machine Scale Sets VM operation. Required. - :type gallery_image_version_name: str - :param gallery_image_version: Parameters supplied to the create or update gallery image version - operation. Required. - :type gallery_image_version: ~azure.mgmt.compute.models.GalleryImageVersion + :type parameters: ~azure.mgmt.compute.models.VirtualMachineScaleSetVM :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns None - :rtype: ~azure.core.polling.AsyncLROPoller[None] + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of AsyncLROPoller that returns VirtualMachineScaleSetVM. The + VirtualMachineScaleSetVM is compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.VirtualMachineScaleSetVM] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - async def begin_create_or_update( + async def begin_update( self, resource_group_name: str, - gallery_name: str, - gallery_image_name: str, - gallery_image_version_name: str, - gallery_image_version: JSON, + vm_scale_set_name: str, + instance_id: str, + parameters: JSON, *, content_type: str = "application/json", + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, **kwargs: Any - ) -> AsyncLROPoller[None]: - """Create or update a gallery image version. + ) -> AsyncLROPoller[_models.VirtualMachineScaleSetVM]: + """Updates a virtual machine of a VM scale set. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :param gallery_image_name: The name of the gallery image definition to be retrieved. Required. - :type gallery_image_name: str - :param gallery_image_version_name: The name of the gallery image version to be retrieved. + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. Required. + :type instance_id: str + :param parameters: Parameters supplied to the Update Virtual Machine Scale Sets VM operation. Required. - :type gallery_image_version_name: str - :param gallery_image_version: Parameters supplied to the create or update gallery image version - operation. Required. - :type gallery_image_version: JSON + :type parameters: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns None - :rtype: ~azure.core.polling.AsyncLROPoller[None] + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of AsyncLROPoller that returns VirtualMachineScaleSetVM. The + VirtualMachineScaleSetVM is compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.VirtualMachineScaleSetVM] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - async def begin_create_or_update( + async def begin_update( self, resource_group_name: str, - gallery_name: str, - gallery_image_name: str, - gallery_image_version_name: str, - gallery_image_version: IO[bytes], + vm_scale_set_name: str, + instance_id: str, + parameters: IO[bytes], *, content_type: str = "application/json", + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, **kwargs: Any - ) -> AsyncLROPoller[None]: - """Create or update a gallery image version. + ) -> AsyncLROPoller[_models.VirtualMachineScaleSetVM]: + """Updates a virtual machine of a VM scale set. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :param gallery_image_name: The name of the gallery image definition to be retrieved. Required. - :type gallery_image_name: str - :param gallery_image_version_name: The name of the gallery image version to be retrieved. + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. Required. + :type instance_id: str + :param parameters: Parameters supplied to the Update Virtual Machine Scale Sets VM operation. Required. - :type gallery_image_version_name: str - :param gallery_image_version: Parameters supplied to the create or update gallery image version - operation. Required. - :type gallery_image_version: IO[bytes] + :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns None - :rtype: ~azure.core.polling.AsyncLROPoller[None] + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of AsyncLROPoller that returns VirtualMachineScaleSetVM. The + VirtualMachineScaleSetVM is compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.VirtualMachineScaleSetVM] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace_async - async def begin_create_or_update( + async def begin_update( self, resource_group_name: str, - gallery_name: str, - gallery_image_name: str, - gallery_image_version_name: str, - gallery_image_version: Union[_models.GalleryImageVersion, JSON, IO[bytes]], + vm_scale_set_name: str, + instance_id: str, + parameters: Union[_models.VirtualMachineScaleSetVM, JSON, IO[bytes]], + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, **kwargs: Any - ) -> AsyncLROPoller[None]: - """Create or update a gallery image version. + ) -> AsyncLROPoller[_models.VirtualMachineScaleSetVM]: + """Updates a virtual machine of a VM scale set. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :param gallery_image_name: The name of the gallery image definition to be retrieved. Required. - :type gallery_image_name: str - :param gallery_image_version_name: The name of the gallery image version to be retrieved. - Required. - :type gallery_image_version_name: str - :param gallery_image_version: Parameters supplied to the create or update gallery image version - operation. Is one of the following types: GalleryImageVersion, JSON, IO[bytes] Required. - :type gallery_image_version: ~azure.mgmt.compute.models.GalleryImageVersion or JSON or - IO[bytes] - :return: An instance of AsyncLROPoller that returns None - :rtype: ~azure.core.polling.AsyncLROPoller[None] + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. Required. + :type instance_id: str + :param parameters: Parameters supplied to the Update Virtual Machine Scale Sets VM operation. + Is one of the following types: VirtualMachineScaleSetVM, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.compute.models.VirtualMachineScaleSetVM or JSON or IO[bytes] + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of AsyncLROPoller that returns VirtualMachineScaleSetVM. The + VirtualMachineScaleSetVM is compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.VirtualMachineScaleSetVM] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[_models.VirtualMachineScaleSetVM] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._create_or_update_initial( + raw_result = await self._update_initial( resource_group_name=resource_group_name, - gallery_name=gallery_name, - gallery_image_name=gallery_image_name, - gallery_image_version_name=gallery_image_version_name, - gallery_image_version=gallery_image_version, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + parameters=parameters, + etag=etag, + match_condition=match_condition, content_type=content_type, cls=lambda x, y, z: x, headers=_headers, @@ -33832,9 +33858,12 @@ async def begin_create_or_update( await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.VirtualMachineScaleSetVM, response.json()) if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized path_format_arguments = { "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), @@ -33849,21 +33878,23 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return AsyncLROPoller[None].from_continuation_token( + return AsyncLROPoller[_models.VirtualMachineScaleSetVM].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + return AsyncLROPoller[_models.VirtualMachineScaleSetVM]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) - async def _update_initial( + async def _delete_initial( self, resource_group_name: str, - gallery_name: str, - gallery_image_name: str, - gallery_image_version_name: str, - gallery_image_version: Union[_models.GalleryImageVersionUpdate, JSON, IO[bytes]], + vm_scale_set_name: str, + instance_id: str, + *, + force_deletion: Optional[bool] = None, **kwargs: Any ) -> AsyncIterator[bytes]: error_map: MutableMapping = { @@ -33874,28 +33905,18 @@ async def _update_initial( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - content_type = content_type or "application/json" - _content = None - if isinstance(gallery_image_version, (IOBase, bytes)): - _content = gallery_image_version - else: - _content = json.dumps(gallery_image_version, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - - _request = build_gallery_image_versions_update_request( + _request = build_virtual_machine_scale_set_vms_delete_request( resource_group_name=resource_group_name, - gallery_name=gallery_name, - gallery_image_name=gallery_image_name, - gallery_image_version_name=gallery_image_version_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, subscription_id=self._config.subscription_id, - content_type=content_type, + force_deletion=force_deletion, api_version=self._config.api_version, - content=_content, headers=_headers, params=_params, ) @@ -33911,7 +33932,7 @@ async def _update_initial( response = pipeline_response.http_response - if response.status_code not in [200]: + if response.status_code not in [200, 202, 204]: try: await response.read() # Load the body in memory and close the socket except (StreamConsumedError, StreamClosedError): @@ -33921,8 +33942,9 @@ async def _update_initial( raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) deserialized = response.iter_bytes() @@ -33931,157 +33953,45 @@ async def _update_initial( return deserialized # type: ignore - @overload - async def begin_update( - self, - resource_group_name: str, - gallery_name: str, - gallery_image_name: str, - gallery_image_version_name: str, - gallery_image_version: _models.GalleryImageVersionUpdate, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Update a gallery image version. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :param gallery_image_name: The name of the gallery image definition to be retrieved. Required. - :type gallery_image_name: str - :param gallery_image_version_name: The name of the gallery image version to be retrieved. - Required. - :type gallery_image_version_name: str - :param gallery_image_version: Parameters supplied to the update gallery image version - operation. Required. - :type gallery_image_version: ~azure.mgmt.compute.models.GalleryImageVersionUpdate - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns None - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update( - self, - resource_group_name: str, - gallery_name: str, - gallery_image_name: str, - gallery_image_version_name: str, - gallery_image_version: JSON, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Update a gallery image version. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :param gallery_image_name: The name of the gallery image definition to be retrieved. Required. - :type gallery_image_name: str - :param gallery_image_version_name: The name of the gallery image version to be retrieved. - Required. - :type gallery_image_version_name: str - :param gallery_image_version: Parameters supplied to the update gallery image version - operation. Required. - :type gallery_image_version: JSON - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns None - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update( - self, - resource_group_name: str, - gallery_name: str, - gallery_image_name: str, - gallery_image_version_name: str, - gallery_image_version: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Update a gallery image version. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :param gallery_image_name: The name of the gallery image definition to be retrieved. Required. - :type gallery_image_name: str - :param gallery_image_version_name: The name of the gallery image version to be retrieved. - Required. - :type gallery_image_version_name: str - :param gallery_image_version: Parameters supplied to the update gallery image version - operation. Required. - :type gallery_image_version: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns None - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - @distributed_trace_async - async def begin_update( + async def begin_delete( self, resource_group_name: str, - gallery_name: str, - gallery_image_name: str, - gallery_image_version_name: str, - gallery_image_version: Union[_models.GalleryImageVersionUpdate, JSON, IO[bytes]], + vm_scale_set_name: str, + instance_id: str, + *, + force_deletion: Optional[bool] = None, **kwargs: Any ) -> AsyncLROPoller[None]: - """Update a gallery image version. + """Deletes a virtual machine from a VM scale set. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :param gallery_image_name: The name of the gallery image definition to be retrieved. Required. - :type gallery_image_name: str - :param gallery_image_version_name: The name of the gallery image version to be retrieved. - Required. - :type gallery_image_version_name: str - :param gallery_image_version: Parameters supplied to the update gallery image version - operation. Is one of the following types: GalleryImageVersionUpdate, JSON, IO[bytes] Required. - :type gallery_image_version: ~azure.mgmt.compute.models.GalleryImageVersionUpdate or JSON or - IO[bytes] + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. Required. + :type instance_id: str + :keyword force_deletion: Optional parameter to force delete a virtual machine from a VM scale + set. (Feature in Preview). Default value is None. + :paramtype force_deletion: bool :return: An instance of AsyncLROPoller that returns None :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._update_initial( + raw_result = await self._delete_initial( resource_group_name=resource_group_name, - gallery_name=gallery_name, - gallery_image_name=gallery_image_name, - gallery_image_version_name=gallery_image_version_name, - gallery_image_version=gallery_image_version, - content_type=content_type, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + force_deletion=force_deletion, cls=lambda x, y, z: x, headers=_headers, params=_params, @@ -34115,14 +34025,44 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - async def _delete_initial( + @distributed_trace + def list( self, resource_group_name: str, - gallery_name: str, - gallery_image_name: str, - gallery_image_version_name: str, + virtual_machine_scale_set_name: str, + *, + filter: Optional[str] = None, + select: Optional[str] = None, + expand: Optional[str] = None, **kwargs: Any - ) -> AsyncIterator[bytes]: + ) -> AsyncItemPaged["_models.VirtualMachineScaleSetVM"]: + """Gets a list of all virtual machines in a VM scale sets. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param virtual_machine_scale_set_name: The name of the VirtualMachineScaleSet. Required. + :type virtual_machine_scale_set_name: str + :keyword 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. + :paramtype filter: str + :keyword select: The list parameters. Allowed values are 'instanceView', + 'instanceView/statuses'. Default value is None. + :paramtype select: str + :keyword expand: The expand expression to apply to the operation. Allowed values are + 'instanceView'. Default value is None. + :paramtype expand: str + :return: An iterator like instance of VirtualMachineScaleSetVM + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.models.VirtualMachineScaleSetVM] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.VirtualMachineScaleSetVM]] = kwargs.pop("cls", None) + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -34131,46 +34071,123 @@ async def _delete_initial( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + def prepare_request(next_link=None): + if not next_link: - _request = build_gallery_image_versions_delete_request( - resource_group_name=resource_group_name, - gallery_name=gallery_name, - gallery_image_name=gallery_image_name, - gallery_image_version_name=gallery_image_version_name, - subscription_id=self._config.subscription_id, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) + _request = build_virtual_machine_scale_set_vms_list_request( + resource_group_name=resource_group_name, + virtual_machine_scale_set_name=virtual_machine_scale_set_name, + subscription_id=self._config.subscription_id, + filter=filter, + select=select, + expand=expand, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) - response = pipeline_response.http_response + return _request - if response.status_code not in [200, 202, 204]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.CloudError, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.VirtualMachineScaleSetVM], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + async def _approve_rolling_upgrade_initial( + self, resource_group_name: str, vm_scale_set_name: str, instance_id: str, **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_virtual_machine_scale_set_vms_approve_rolling_upgrade_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) deserialized = response.iter_bytes() @@ -34180,26 +34197,18 @@ async def _delete_initial( return deserialized # type: ignore @distributed_trace_async - async def begin_delete( - self, - resource_group_name: str, - gallery_name: str, - gallery_image_name: str, - gallery_image_version_name: str, - **kwargs: Any + async def begin_approve_rolling_upgrade( + self, resource_group_name: str, vm_scale_set_name: str, instance_id: str, **kwargs: Any ) -> AsyncLROPoller[None]: - """Delete a gallery image version. + """Approve upgrade on deferred rolling upgrade for OS disk on a VM scale set instance. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :param gallery_image_name: The name of the gallery image definition to be retrieved. Required. - :type gallery_image_name: str - :param gallery_image_version_name: The name of the gallery image version to be retrieved. - Required. - :type gallery_image_version_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. Required. + :type instance_id: str :return: An instance of AsyncLROPoller that returns None :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -34212,11 +34221,10 @@ async def begin_delete( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._delete_initial( + raw_result = await self._approve_rolling_upgrade_initial( resource_group_name=resource_group_name, - gallery_name=gallery_name, - gallery_image_name=gallery_image_name, - gallery_image_version_name=gallery_image_version_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, cls=lambda x, y, z: x, headers=_headers, params=_params, @@ -34250,28 +34258,9 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - @distributed_trace - def list_by_gallery_image( - self, resource_group_name: str, gallery_name: str, gallery_image_name: str, **kwargs: Any - ) -> AsyncItemPaged["_models.GalleryImageVersion"]: - """List gallery image versions in a gallery image definition. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :param gallery_image_name: The name of the gallery image definition to be retrieved. Required. - :type gallery_image_name: str - :return: An iterator like instance of GalleryImageVersion - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.models.GalleryImageVersion] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[List[_models.GalleryImageVersion]] = kwargs.pop("cls", None) - + async def _deallocate_initial( + self, resource_group_name: str, vm_scale_set_name: str, instance_id: str, **kwargs: Any + ) -> AsyncIterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -34280,106 +34269,133 @@ def list_by_gallery_image( } error_map.update(kwargs.pop("error_map", {}) or {}) - def prepare_request(next_link=None): - if not next_link: + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} - _request = build_gallery_image_versions_list_by_gallery_image_request( - resource_group_name=resource_group_name, - gallery_name=gallery_name, - gallery_image_name=gallery_image_name, - subscription_id=self._config.subscription_id, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) + _request = build_virtual_machine_scale_set_vms_deallocate_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) - return _request + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) - async def extract_data(pipeline_response): - deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.GalleryImageVersion], deserialized.get("value", [])) - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + response = pipeline_response.http_response - async def get_next(next_link=None): - _request = prepare_request(next_link) + if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.CloudError, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.iter_bytes() - return pipeline_response + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore - return AsyncItemPaged(get_next, extract_data) + return deserialized # type: ignore + @distributed_trace_async + async def begin_deallocate( + 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. -class GalleryApplicationsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. Required. + :type instance_id: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} - Instead, you should access the following operations through - :class:`~azure.mgmt.compute.aio.ComputeClient`'s - :attr:`gallery_applications` attribute. - """ + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._deallocate_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ComputeClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore @distributed_trace_async - async def get( - self, resource_group_name: str, gallery_name: str, gallery_application_name: str, **kwargs: Any - ) -> _models.GalleryApplication: - """Retrieves information about a gallery Application Definition. + 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. The name is case insensitive. Required. :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :param gallery_application_name: The name of the gallery Application Definition to be - retrieved. Required. - :type gallery_application_name: str - :return: GalleryApplication. The GalleryApplication is compatible with MutableMapping - :rtype: ~azure.mgmt.compute.models.GalleryApplication + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. Required. + :type instance_id: str + :return: VirtualMachineScaleSetVMInstanceView. The VirtualMachineScaleSetVMInstanceView is + compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.VirtualMachineScaleSetVMInstanceView :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -34393,12 +34409,12 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.GalleryApplication] = kwargs.pop("cls", None) + cls: ClsType[_models.VirtualMachineScaleSetVMInstanceView] = kwargs.pop("cls", None) - _request = build_gallery_applications_get_request( + _request = build_virtual_machine_scale_set_vms_get_instance_view_request( resource_group_name=resource_group_name, - gallery_name=gallery_name, - gallery_application_name=gallery_application_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -34429,19 +34445,21 @@ async def get( if _stream: deserialized = response.iter_bytes() else: - deserialized = _deserialize(_models.GalleryApplication, response.json()) + deserialized = _deserialize(_models.VirtualMachineScaleSetVMInstanceView, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - async def _create_or_update_initial( + async def _reimage_initial( self, resource_group_name: str, - gallery_name: str, - gallery_application_name: str, - gallery_application: Union[_models.GalleryApplication, JSON, IO[bytes]], + vm_scale_set_name: str, + instance_id: str, + vm_scale_set_vm_reimage_input: Optional[ + Union[_models.VirtualMachineScaleSetVMReimageParameters, JSON, IO[bytes]] + ] = None, **kwargs: Any ) -> AsyncIterator[bytes]: error_map: MutableMapping = { @@ -34456,19 +34474,23 @@ async def _create_or_update_initial( _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + content_type = content_type if vm_scale_set_vm_reimage_input else None cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - content_type = content_type or "application/json" + content_type = content_type or "application/json" if vm_scale_set_vm_reimage_input else None _content = None - if isinstance(gallery_application, (IOBase, bytes)): - _content = gallery_application + if isinstance(vm_scale_set_vm_reimage_input, (IOBase, bytes)): + _content = vm_scale_set_vm_reimage_input else: - _content = json.dumps(gallery_application, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + if vm_scale_set_vm_reimage_input is not None: + _content = json.dumps(vm_scale_set_vm_reimage_input, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + else: + _content = None - _request = build_gallery_applications_create_or_update_request( + _request = build_virtual_machine_scale_set_vms_reimage_request( resource_group_name=resource_group_name, - gallery_name=gallery_name, - gallery_application_name=gallery_application_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, subscription_id=self._config.subscription_id, content_type=content_type, api_version=self._config.api_version, @@ -34488,7 +34510,7 @@ async def _create_or_update_initial( response = pipeline_response.http_response - if response.status_code not in [200, 201, 202]: + if response.status_code not in [200, 202]: try: await response.read() # Load the body in memory and close the socket except (StreamConsumedError, StreamClosedError): @@ -34498,10 +34520,6 @@ async def _create_or_update_initial( raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} - if response.status_code == 201: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) @@ -34514,29 +34532,29 @@ async def _create_or_update_initial( return deserialized # type: ignore @overload - async def begin_create_or_update( + async def begin_reimage( self, resource_group_name: str, - gallery_name: str, - gallery_application_name: str, - gallery_application: _models.GalleryApplication, + vm_scale_set_name: str, + instance_id: str, + vm_scale_set_vm_reimage_input: Optional[_models.VirtualMachineScaleSetVMReimageParameters] = None, *, content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[None]: - """Create or update a gallery Application Definition. + """Reimages (upgrade the operating system) a specific virtual machine in a VM scale set. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :param gallery_application_name: The name of the gallery Application Definition to be - retrieved. Required. - :type gallery_application_name: str - :param gallery_application: Parameters supplied to the create or update gallery Application - operation. Required. - :type gallery_application: ~azure.mgmt.compute.models.GalleryApplication + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. Required. + :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.models.VirtualMachineScaleSetVMReimageParameters :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -34546,29 +34564,28 @@ async def begin_create_or_update( """ @overload - async def begin_create_or_update( + async def begin_reimage( self, resource_group_name: str, - gallery_name: str, - gallery_application_name: str, - gallery_application: JSON, + vm_scale_set_name: str, + instance_id: str, + vm_scale_set_vm_reimage_input: Optional[JSON] = None, *, content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[None]: - """Create or update a gallery Application Definition. + """Reimages (upgrade the operating system) a specific virtual machine in a VM scale set. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :param gallery_application_name: The name of the gallery Application Definition to be - retrieved. Required. - :type gallery_application_name: str - :param gallery_application: Parameters supplied to the create or update gallery Application - operation. Required. - :type gallery_application: JSON + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. Required. + :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: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -34578,29 +34595,28 @@ async def begin_create_or_update( """ @overload - async def begin_create_or_update( + async def begin_reimage( self, resource_group_name: str, - gallery_name: str, - gallery_application_name: str, - gallery_application: IO[bytes], + vm_scale_set_name: str, + instance_id: str, + vm_scale_set_vm_reimage_input: Optional[IO[bytes]] = None, *, content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[None]: - """Create or update a gallery Application Definition. + """Reimages (upgrade the operating system) a specific virtual machine in a VM scale set. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :param gallery_application_name: The name of the gallery Application Definition to be - retrieved. Required. - :type gallery_application_name: str - :param gallery_application: Parameters supplied to the create or update gallery Application - operation. Required. - :type gallery_application: IO[bytes] + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. Required. + :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: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str @@ -34610,27 +34626,30 @@ async def begin_create_or_update( """ @distributed_trace_async - async def begin_create_or_update( + async def begin_reimage( self, resource_group_name: str, - gallery_name: str, - gallery_application_name: str, - gallery_application: Union[_models.GalleryApplication, JSON, IO[bytes]], + vm_scale_set_name: str, + instance_id: str, + vm_scale_set_vm_reimage_input: Optional[ + Union[_models.VirtualMachineScaleSetVMReimageParameters, JSON, IO[bytes]] + ] = None, **kwargs: Any ) -> AsyncLROPoller[None]: - """Create or update a gallery Application Definition. + """Reimages (upgrade the operating system) a specific virtual machine in a VM scale set. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :param gallery_application_name: The name of the gallery Application Definition to be - retrieved. Required. - :type gallery_application_name: str - :param gallery_application: Parameters supplied to the create or update gallery Application - operation. Is one of the following types: GalleryApplication, JSON, IO[bytes] Required. - :type gallery_application: ~azure.mgmt.compute.models.GalleryApplication or JSON or IO[bytes] + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. Required. + :type instance_id: str + :param vm_scale_set_vm_reimage_input: Parameters for the Reimaging Virtual machine in ScaleSet. + Is one of the following types: VirtualMachineScaleSetVMReimageParameters, JSON, IO[bytes] + Default value is None. + :type vm_scale_set_vm_reimage_input: + ~azure.mgmt.compute.models.VirtualMachineScaleSetVMReimageParameters or JSON or IO[bytes] :return: An instance of AsyncLROPoller that returns None :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -34639,16 +34658,17 @@ async def begin_create_or_update( _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + content_type = content_type if vm_scale_set_vm_reimage_input else None cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._create_or_update_initial( + raw_result = await self._reimage_initial( resource_group_name=resource_group_name, - gallery_name=gallery_name, - gallery_application_name=gallery_application_name, - gallery_application=gallery_application, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + vm_scale_set_vm_reimage_input=vm_scale_set_vm_reimage_input, content_type=content_type, cls=lambda x, y, z: x, headers=_headers, @@ -34683,13 +34703,8 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - async def _update_initial( - self, - resource_group_name: str, - gallery_name: str, - gallery_application_name: str, - gallery_application: Union[_models.GalleryApplicationUpdate, JSON, IO[bytes]], - **kwargs: Any + async def _reimage_all_initial( + self, resource_group_name: str, vm_scale_set_name: str, instance_id: str, **kwargs: Any ) -> AsyncIterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -34699,27 +34714,17 @@ async def _update_initial( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - content_type = content_type or "application/json" - _content = None - if isinstance(gallery_application, (IOBase, bytes)): - _content = gallery_application - else: - _content = json.dumps(gallery_application, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - - _request = build_gallery_applications_update_request( + _request = build_virtual_machine_scale_set_vms_reimage_all_request( resource_group_name=resource_group_name, - gallery_name=gallery_name, - gallery_application_name=gallery_application_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, subscription_id=self._config.subscription_id, - content_type=content_type, api_version=self._config.api_version, - content=_content, headers=_headers, params=_params, ) @@ -34735,7 +34740,7 @@ async def _update_initial( response = pipeline_response.http_response - if response.status_code not in [200]: + if response.status_code not in [200, 202]: try: await response.read() # Load the body in memory and close the socket except (StreamConsumedError, StreamClosedError): @@ -34745,8 +34750,9 @@ async def _update_initial( raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) deserialized = response.iter_bytes() @@ -34755,143 +34761,338 @@ async def _update_initial( return deserialized # type: ignore - @overload - async def begin_update( - self, - resource_group_name: str, - gallery_name: str, - gallery_application_name: str, - gallery_application: _models.GalleryApplicationUpdate, - *, - content_type: str = "application/json", - **kwargs: Any + @distributed_trace_async + async def begin_reimage_all( + self, resource_group_name: str, vm_scale_set_name: str, instance_id: str, **kwargs: Any ) -> AsyncLROPoller[None]: - """Update a gallery Application Definition. + """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. The name is case insensitive. Required. :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :param gallery_application_name: The name of the gallery Application Definition to be - retrieved. Required. - :type gallery_application_name: str - :param gallery_application: Parameters supplied to the update gallery Application operation. + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. Required. + :type instance_id: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._reimage_all_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace_async + async def simulate_eviction( + 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. The name is case insensitive. Required. - :type gallery_application: ~azure.mgmt.compute.models.GalleryApplicationUpdate + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. Required. + :type instance_id: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_virtual_machine_scale_set_vms_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=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + async def _attach_detach_data_disks_initial( + self, + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + parameters: Union[_models.AttachDetachDataDisksRequest, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_virtual_machine_scale_set_vms_attach_detach_data_disks_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_attach_detach_data_disks( + self, + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + parameters: _models.AttachDetachDataDisksRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.StorageProfile]: + """Attach and detach data disks to/from a virtual machine in a VM scale set. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. Required. + :type instance_id: str + :param parameters: Parameters supplied to the attach and detach data disks operation on a + Virtual Machine Scale Sets VM. Required. + :type parameters: ~azure.mgmt.compute.models.AttachDetachDataDisksRequest :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns None - :rtype: ~azure.core.polling.AsyncLROPoller[None] + :return: An instance of AsyncLROPoller that returns StorageProfile. The StorageProfile is + compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.StorageProfile] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - async def begin_update( + async def begin_attach_detach_data_disks( self, resource_group_name: str, - gallery_name: str, - gallery_application_name: str, - gallery_application: JSON, + vm_scale_set_name: str, + instance_id: str, + parameters: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[None]: - """Update a gallery Application Definition. + ) -> AsyncLROPoller[_models.StorageProfile]: + """Attach and detach data disks to/from a virtual machine in a VM scale set. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :param gallery_application_name: The name of the gallery Application Definition to be - retrieved. Required. - :type gallery_application_name: str - :param gallery_application: Parameters supplied to the update gallery Application operation. - Required. - :type gallery_application: JSON + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. Required. + :type instance_id: str + :param parameters: Parameters supplied to the attach and detach data disks operation on a + Virtual Machine Scale Sets VM. Required. + :type parameters: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns None - :rtype: ~azure.core.polling.AsyncLROPoller[None] + :return: An instance of AsyncLROPoller that returns StorageProfile. The StorageProfile is + compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.StorageProfile] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - async def begin_update( + async def begin_attach_detach_data_disks( self, resource_group_name: str, - gallery_name: str, - gallery_application_name: str, - gallery_application: IO[bytes], + vm_scale_set_name: str, + instance_id: str, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[None]: - """Update a gallery Application Definition. + ) -> AsyncLROPoller[_models.StorageProfile]: + """Attach and detach data disks to/from a virtual machine in a VM scale set. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :param gallery_application_name: The name of the gallery Application Definition to be - retrieved. Required. - :type gallery_application_name: str - :param gallery_application: Parameters supplied to the update gallery Application operation. - Required. - :type gallery_application: IO[bytes] + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. Required. + :type instance_id: str + :param parameters: Parameters supplied to the attach and detach data disks operation on a + Virtual Machine Scale Sets VM. Required. + :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns None - :rtype: ~azure.core.polling.AsyncLROPoller[None] + :return: An instance of AsyncLROPoller that returns StorageProfile. The StorageProfile is + compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.StorageProfile] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace_async - async def begin_update( + async def begin_attach_detach_data_disks( self, resource_group_name: str, - gallery_name: str, - gallery_application_name: str, - gallery_application: Union[_models.GalleryApplicationUpdate, JSON, IO[bytes]], + vm_scale_set_name: str, + instance_id: str, + parameters: Union[_models.AttachDetachDataDisksRequest, JSON, IO[bytes]], **kwargs: Any - ) -> AsyncLROPoller[None]: - """Update a gallery Application Definition. + ) -> AsyncLROPoller[_models.StorageProfile]: + """Attach and detach data disks to/from a virtual machine in a VM scale set. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :param gallery_application_name: The name of the gallery Application Definition to be - retrieved. Required. - :type gallery_application_name: str - :param gallery_application: Parameters supplied to the update gallery Application operation. Is - one of the following types: GalleryApplicationUpdate, JSON, IO[bytes] Required. - :type gallery_application: ~azure.mgmt.compute.models.GalleryApplicationUpdate or JSON or - IO[bytes] - :return: An instance of AsyncLROPoller that returns None - :rtype: ~azure.core.polling.AsyncLROPoller[None] + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. Required. + :type instance_id: str + :param parameters: Parameters supplied to the attach and detach data disks operation on a + Virtual Machine Scale Sets VM. Is one of the following types: AttachDetachDataDisksRequest, + JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.compute.models.AttachDetachDataDisksRequest or JSON or IO[bytes] + :return: An instance of AsyncLROPoller that returns StorageProfile. The StorageProfile is + compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.StorageProfile] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[_models.StorageProfile] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._update_initial( + raw_result = await self._attach_detach_data_disks_initial( resource_group_name=resource_group_name, - gallery_name=gallery_name, - gallery_application_name=gallery_application_name, - gallery_application=gallery_application, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + parameters=parameters, content_type=content_type, cls=lambda x, y, z: x, headers=_headers, @@ -34901,9 +35102,16 @@ async def begin_update( await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = _deserialize(_models.StorageProfile, response.json()) if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore + return deserialized path_format_arguments = { "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), @@ -34918,16 +35126,18 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return AsyncLROPoller[None].from_continuation_token( + return AsyncLROPoller[_models.StorageProfile].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + return AsyncLROPoller[_models.StorageProfile]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) - async def _delete_initial( - self, resource_group_name: str, gallery_name: str, gallery_application_name: str, **kwargs: Any + async def _perform_maintenance_initial( + self, resource_group_name: str, vm_scale_set_name: str, instance_id: str, **kwargs: Any ) -> AsyncIterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -34942,10 +35152,10 @@ async def _delete_initial( cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - _request = build_gallery_applications_delete_request( + _request = build_virtual_machine_scale_set_vms_perform_maintenance_request( resource_group_name=resource_group_name, - gallery_name=gallery_name, - gallery_application_name=gallery_application_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -34963,7 +35173,7 @@ async def _delete_initial( response = pipeline_response.http_response - if response.status_code not in [200, 202, 204]: + if response.status_code not in [200, 202]: try: await response.read() # Load the body in memory and close the socket except (StreamConsumedError, StreamClosedError): @@ -34985,19 +35195,18 @@ async def _delete_initial( return deserialized # type: ignore @distributed_trace_async - async def begin_delete( - self, resource_group_name: str, gallery_name: str, gallery_application_name: str, **kwargs: Any + async def begin_perform_maintenance( + self, resource_group_name: str, vm_scale_set_name: str, instance_id: str, **kwargs: Any ) -> AsyncLROPoller[None]: - """Delete a gallery Application. + """Performs maintenance on a virtual machine in a VM scale set. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :param gallery_application_name: The name of the gallery Application Definition to be - retrieved. Required. - :type gallery_application_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. Required. + :type instance_id: str :return: An instance of AsyncLROPoller that returns None :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -35010,10 +35219,10 @@ async def begin_delete( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._delete_initial( + raw_result = await self._perform_maintenance_initial( resource_group_name=resource_group_name, - gallery_name=gallery_name, - gallery_application_name=gallery_application_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, cls=lambda x, y, z: x, headers=_headers, params=_params, @@ -35047,26 +35256,15 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - @distributed_trace - def list_by_gallery( - self, resource_group_name: str, gallery_name: str, **kwargs: Any - ) -> AsyncItemPaged["_models.GalleryApplication"]: - """List gallery Application Definitions in a gallery. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :return: An iterator like instance of GalleryApplication - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.models.GalleryApplication] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[List[_models.GalleryApplication]] = kwargs.pop("cls", None) - + async def _power_off_initial( + self, + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + *, + skip_shutdown: Optional[bool] = None, + **kwargs: Any + ) -> AsyncIterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -35075,121 +35273,132 @@ def list_by_gallery( } error_map.update(kwargs.pop("error_map", {}) or {}) - def prepare_request(next_link=None): - if not next_link: - - _request = build_gallery_applications_list_by_gallery_request( - resource_group_name=resource_group_name, - gallery_name=gallery_name, - subscription_id=self._config.subscription_id, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - return _request + _request = build_virtual_machine_scale_set_vms_power_off_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + skip_shutdown=skip_shutdown, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) - async def extract_data(pipeline_response): - deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.GalleryApplication], deserialized.get("value", [])) - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) - async def get_next(next_link=None): - _request = prepare_request(next_link) + response = pipeline_response.http_response - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response + if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.CloudError, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - return pipeline_response + deserialized = response.iter_bytes() - return AsyncItemPaged(get_next, extract_data) + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore - -class GalleryApplicationVersionsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.compute.aio.ComputeClient`'s - :attr:`gallery_application_versions` attribute. - """ - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ComputeClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + return deserialized # type: ignore @distributed_trace_async - async def get( + async def begin_power_off( self, resource_group_name: str, - gallery_name: str, - gallery_application_name: str, - gallery_application_version_name: str, + vm_scale_set_name: str, + instance_id: str, *, - expand: Optional[Union[str, _models.ReplicationStatusTypes]] = None, + skip_shutdown: Optional[bool] = None, **kwargs: Any - ) -> _models.GalleryApplicationVersion: - """Retrieves information about a gallery Application Version. + ) -> 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. The name is case insensitive. Required. :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :param gallery_application_name: The name of the gallery Application Definition to be - retrieved. Required. - :type gallery_application_name: str - :param gallery_application_version_name: The name of the gallery Application Version to be - retrieved. Required. - :type gallery_application_version_name: str - :keyword expand: The expand expression to apply on the operation. Known values are: - "ReplicationStatus" and "UefiSettings". Default value is None. - :paramtype expand: str or ~azure.mgmt.compute.models.ReplicationStatusTypes - :return: GalleryApplicationVersion. The GalleryApplicationVersion is compatible with - MutableMapping - :rtype: ~azure.mgmt.compute.models.GalleryApplicationVersion + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. Required. + :type instance_id: str + :keyword 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 None. + :paramtype skip_shutdown: bool + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._power_off_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + skip_shutdown=skip_shutdown, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + async def _redeploy_initial( + self, resource_group_name: str, vm_scale_set_name: str, instance_id: str, **kwargs: Any + ) -> AsyncIterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -35201,15 +35410,13 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.GalleryApplicationVersion] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - _request = build_gallery_application_versions_get_request( + _request = build_virtual_machine_scale_set_vms_redeploy_request( resource_group_name=resource_group_name, - gallery_name=gallery_name, - gallery_application_name=gallery_application_name, - gallery_application_version_name=gallery_application_version_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, subscription_id=self._config.subscription_id, - expand=expand, api_version=self._config.api_version, headers=_headers, params=_params, @@ -35219,41 +35426,99 @@ async def get( } _request.url = self._client.format_url(_request.url, **path_format_arguments) - _stream = kwargs.pop("stream", False) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200]: - if _stream: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass + if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = _failsafe_deserialize(_models.CloudError, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if _stream: - deserialized = response.iter_bytes() - else: - deserialized = _deserialize(_models.GalleryApplicationVersion, response.json()) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore - async def _create_or_update_initial( - self, - resource_group_name: str, - gallery_name: str, - gallery_application_name: str, - gallery_application_version_name: str, - gallery_application_version: Union[_models.GalleryApplicationVersion, JSON, IO[bytes]], - **kwargs: Any + @distributed_trace_async + async def begin_redeploy( + 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. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. Required. + :type instance_id: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._redeploy_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + async def _restart_initial( + self, resource_group_name: str, vm_scale_set_name: str, instance_id: str, **kwargs: Any ) -> AsyncIterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -35263,28 +35528,17 @@ async def _create_or_update_initial( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - content_type = content_type or "application/json" - _content = None - if isinstance(gallery_application_version, (IOBase, bytes)): - _content = gallery_application_version - else: - _content = json.dumps(gallery_application_version, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - - _request = build_gallery_application_versions_create_or_update_request( + _request = build_virtual_machine_scale_set_vms_restart_request( resource_group_name=resource_group_name, - gallery_name=gallery_name, - gallery_application_name=gallery_application_name, - gallery_application_version_name=gallery_application_version_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, subscription_id=self._config.subscription_id, - content_type=content_type, api_version=self._config.api_version, - content=_content, headers=_headers, params=_params, ) @@ -35300,7 +35554,7 @@ async def _create_or_update_initial( response = pipeline_response.http_response - if response.status_code not in [200, 201, 202]: + if response.status_code not in [200, 202]: try: await response.read() # Load the body in memory and close the socket except (StreamConsumedError, StreamClosedError): @@ -35310,10 +35564,6 @@ async def _create_or_update_initial( raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} - if response.status_code == 201: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) @@ -35325,170 +35575,35 @@ async def _create_or_update_initial( return deserialized # type: ignore - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - gallery_name: str, - gallery_application_name: str, - gallery_application_version_name: str, - gallery_application_version: _models.GalleryApplicationVersion, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.GalleryApplicationVersion]: - """Create or update a gallery Application Version. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :param gallery_application_name: The name of the gallery Application Definition to be - retrieved. Required. - :type gallery_application_name: str - :param gallery_application_version_name: The name of the gallery Application Version to be - retrieved. Required. - :type gallery_application_version_name: str - :param gallery_application_version: Parameters supplied to the create or update gallery - Application Version operation. Required. - :type gallery_application_version: ~azure.mgmt.compute.models.GalleryApplicationVersion - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns GalleryApplicationVersion. The - GalleryApplicationVersion is compatible with MutableMapping - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.GalleryApplicationVersion] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - gallery_name: str, - gallery_application_name: str, - gallery_application_version_name: str, - gallery_application_version: JSON, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.GalleryApplicationVersion]: - """Create or update a gallery Application Version. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :param gallery_application_name: The name of the gallery Application Definition to be - retrieved. Required. - :type gallery_application_name: str - :param gallery_application_version_name: The name of the gallery Application Version to be - retrieved. Required. - :type gallery_application_version_name: str - :param gallery_application_version: Parameters supplied to the create or update gallery - Application Version operation. Required. - :type gallery_application_version: JSON - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns GalleryApplicationVersion. The - GalleryApplicationVersion is compatible with MutableMapping - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.GalleryApplicationVersion] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - gallery_name: str, - gallery_application_name: str, - gallery_application_version_name: str, - gallery_application_version: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.GalleryApplicationVersion]: - """Create or update a gallery Application Version. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :param gallery_application_name: The name of the gallery Application Definition to be - retrieved. Required. - :type gallery_application_name: str - :param gallery_application_version_name: The name of the gallery Application Version to be - retrieved. Required. - :type gallery_application_version_name: str - :param gallery_application_version: Parameters supplied to the create or update gallery - Application Version operation. Required. - :type gallery_application_version: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns GalleryApplicationVersion. The - GalleryApplicationVersion is compatible with MutableMapping - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.GalleryApplicationVersion] - :raises ~azure.core.exceptions.HttpResponseError: - """ - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - gallery_name: str, - gallery_application_name: str, - gallery_application_version_name: str, - gallery_application_version: Union[_models.GalleryApplicationVersion, JSON, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.GalleryApplicationVersion]: - """Create or update a gallery Application Version. + async def begin_restart( + 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. The name is case insensitive. Required. :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :param gallery_application_name: The name of the gallery Application Definition to be - retrieved. Required. - :type gallery_application_name: str - :param gallery_application_version_name: The name of the gallery Application Version to be - retrieved. Required. - :type gallery_application_version_name: str - :param gallery_application_version: Parameters supplied to the create or update gallery - Application Version operation. Is one of the following types: GalleryApplicationVersion, JSON, - IO[bytes] Required. - :type gallery_application_version: ~azure.mgmt.compute.models.GalleryApplicationVersion or JSON - or IO[bytes] - :return: An instance of AsyncLROPoller that returns GalleryApplicationVersion. The - GalleryApplicationVersion is compatible with MutableMapping - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.GalleryApplicationVersion] + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. Required. + :type instance_id: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.GalleryApplicationVersion] = kwargs.pop("cls", None) + cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._create_or_update_initial( + raw_result = await self._restart_initial( resource_group_name=resource_group_name, - gallery_name=gallery_name, - gallery_application_name=gallery_application_name, - gallery_application_version_name=gallery_application_version_name, - gallery_application_version=gallery_application_version, - content_type=content_type, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, cls=lambda x, y, z: x, headers=_headers, params=_params, @@ -35497,12 +35612,9 @@ async def begin_create_or_update( await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = _deserialize(_models.GalleryApplicationVersion, response.json()) + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return cls(pipeline_response, None, {}) # type: ignore path_format_arguments = { "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), @@ -35517,25 +35629,43 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller[_models.GalleryApplicationVersion].from_continuation_token( + return AsyncLROPoller[None].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller[_models.GalleryApplicationVersion]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - async def _update_initial( + @distributed_trace_async + async def retrieve_boot_diagnostics_data( self, resource_group_name: str, - gallery_name: str, - gallery_application_name: str, - gallery_application_version_name: str, - gallery_application_version: Union[_models.GalleryApplicationVersionUpdate, JSON, IO[bytes]], + vm_scale_set_name: str, + instance_id: str, + *, + sas_uri_expiration_time_in_minutes: Optional[int] = None, **kwargs: Any - ) -> AsyncIterator[bytes]: + ) -> _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. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. Required. + :type instance_id: str + :keyword sas_uri_expiration_time_in_minutes: Expiration duration in minutes for the SAS URIs + with a value between 1 to 1440 minutes. **Note:** If not specified, SAS URIs will be generated + with a default expiration duration of 120 minutes. Default value is None. + :paramtype sas_uri_expiration_time_in_minutes: int + :return: RetrieveBootDiagnosticsDataResult. The RetrieveBootDiagnosticsDataResult is compatible + with MutableMapping + :rtype: ~azure.mgmt.compute.models.RetrieveBootDiagnosticsDataResult + :raises ~azure.core.exceptions.HttpResponseError: + """ error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -35544,28 +35674,18 @@ async def _update_initial( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _content = None - if isinstance(gallery_application_version, (IOBase, bytes)): - _content = gallery_application_version - else: - _content = json.dumps(gallery_application_version, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + cls: ClsType[_models.RetrieveBootDiagnosticsDataResult] = kwargs.pop("cls", None) - _request = build_gallery_application_versions_update_request( + _request = build_virtual_machine_scale_set_vms_retrieve_boot_diagnostics_data_request( resource_group_name=resource_group_name, - gallery_name=gallery_name, - gallery_application_name=gallery_application_name, - gallery_application_version_name=gallery_application_version_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, subscription_id=self._config.subscription_id, - content_type=content_type, + sas_uri_expiration_time_in_minutes=sas_uri_expiration_time_in_minutes, api_version=self._config.api_version, - content=_content, headers=_headers, params=_params, ) @@ -35574,7 +35694,7 @@ async def _update_initial( } _request.url = self._client.format_url(_request.url, **path_format_arguments) - _stream = True + _stream = kwargs.pop("stream", False) pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -35582,181 +35702,112 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = _failsafe_deserialize(_models.CloudError, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - response_headers = {} - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.iter_bytes() + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.RetrieveBootDiagnosticsDataResult, response.json()) if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - @overload - async def begin_update( - self, - resource_group_name: str, - gallery_name: str, - gallery_application_name: str, - gallery_application_version_name: str, - gallery_application_version: _models.GalleryApplicationVersionUpdate, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Update a gallery Application Version. + async def _start_initial( + self, resource_group_name: str, vm_scale_set_name: str, instance_id: str, **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :param gallery_application_name: The name of the gallery Application Definition to be - retrieved. Required. - :type gallery_application_name: str - :param gallery_application_version_name: The name of the gallery Application Version to be - retrieved. Required. - :type gallery_application_version_name: str - :param gallery_application_version: Parameters supplied to the update gallery Application - Version operation. Required. - :type gallery_application_version: ~azure.mgmt.compute.models.GalleryApplicationVersionUpdate - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns None - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} - @overload - async def begin_update( - self, - resource_group_name: str, - gallery_name: str, - gallery_application_name: str, - gallery_application_version_name: str, - gallery_application_version: JSON, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Update a gallery Application Version. + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :param gallery_application_name: The name of the gallery Application Definition to be - retrieved. Required. - :type gallery_application_name: str - :param gallery_application_version_name: The name of the gallery Application Version to be - retrieved. Required. - :type gallery_application_version_name: str - :param gallery_application_version: Parameters supplied to the update gallery Application - Version operation. Required. - :type gallery_application_version: JSON - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns None - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ + _request = build_virtual_machine_scale_set_vms_start_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) - @overload - async def begin_update( - self, - resource_group_name: str, - gallery_name: str, - gallery_application_name: str, - gallery_application_version_name: str, - gallery_application_version: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Update a gallery Application Version. + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :param gallery_application_name: The name of the gallery Application Definition to be - retrieved. Required. - :type gallery_application_name: str - :param gallery_application_version_name: The name of the gallery Application Version to be - retrieved. Required. - :type gallery_application_version_name: str - :param gallery_application_version: Parameters supplied to the update gallery Application - Version operation. Required. - :type gallery_application_version: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns None - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore @distributed_trace_async - async def begin_update( - self, - resource_group_name: str, - gallery_name: str, - gallery_application_name: str, - gallery_application_version_name: str, - gallery_application_version: Union[_models.GalleryApplicationVersionUpdate, JSON, IO[bytes]], - **kwargs: Any + async def begin_start( + self, resource_group_name: str, vm_scale_set_name: str, instance_id: str, **kwargs: Any ) -> AsyncLROPoller[None]: - """Update a gallery Application Version. + """Starts a virtual machine in a VM scale set. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :param gallery_application_name: The name of the gallery Application Definition to be - retrieved. Required. - :type gallery_application_name: str - :param gallery_application_version_name: The name of the gallery Application Version to be - retrieved. Required. - :type gallery_application_version_name: str - :param gallery_application_version: Parameters supplied to the update gallery Application - Version operation. Is one of the following types: GalleryApplicationVersionUpdate, JSON, - IO[bytes] Required. - :type gallery_application_version: ~azure.mgmt.compute.models.GalleryApplicationVersionUpdate - or JSON or IO[bytes] + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. Required. + :type instance_id: str :return: An instance of AsyncLROPoller that returns None :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._update_initial( + raw_result = await self._start_initial( resource_group_name=resource_group_name, - gallery_name=gallery_name, - gallery_application_name=gallery_application_name, - gallery_application_version_name=gallery_application_version_name, - gallery_application_version=gallery_application_version, - content_type=content_type, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, cls=lambda x, y, z: x, headers=_headers, params=_params, @@ -35790,12 +35841,12 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - async def _delete_initial( + async def _run_command_initial( self, resource_group_name: str, - gallery_name: str, - gallery_application_name: str, - gallery_application_version_name: str, + vm_scale_set_name: str, + instance_id: str, + parameters: Union[_models.RunCommandInput, JSON, IO[bytes]], **kwargs: Any ) -> AsyncIterator[bytes]: error_map: MutableMapping = { @@ -35806,18 +35857,27 @@ async def _delete_initial( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - _request = build_gallery_application_versions_delete_request( + content_type = content_type or "application/json" + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_virtual_machine_scale_set_vms_run_command_request( resource_group_name=resource_group_name, - gallery_name=gallery_name, - gallery_application_name=gallery_application_name, - gallery_application_version_name=gallery_application_version_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, subscription_id=self._config.subscription_id, + content_type=content_type, api_version=self._config.api_version, + content=_content, headers=_headers, params=_params, ) @@ -35833,7 +35893,7 @@ async def _delete_initial( response = pipeline_response.http_response - if response.status_code not in [200, 202, 204]: + if response.status_code not in [200, 202]: try: await response.read() # Load the body in memory and close the socket except (StreamConsumedError, StreamClosedError): @@ -35854,45 +35914,140 @@ async def _delete_initial( return deserialized # type: ignore + @overload + async def begin_run_command( + self, + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + parameters: _models.RunCommandInput, + *, + content_type: 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. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. Required. + :type instance_id: str + :param parameters: Parameters supplied to the Run command operation. Required. + :type parameters: ~azure.mgmt.compute.models.RunCommandInput + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns RunCommandResult. The RunCommandResult is + compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.RunCommandResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_run_command( + self, + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + parameters: JSON, + *, + content_type: 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. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. Required. + :type instance_id: str + :param parameters: Parameters supplied to the Run command operation. Required. + :type parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns RunCommandResult. The RunCommandResult is + compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.RunCommandResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_run_command( + self, + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + parameters: IO[bytes], + *, + content_type: 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. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. Required. + :type instance_id: str + :param parameters: Parameters supplied to the Run command operation. Required. + :type parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns RunCommandResult. The RunCommandResult is + compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.RunCommandResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + @distributed_trace_async - async def begin_delete( + async def begin_run_command( self, resource_group_name: str, - gallery_name: str, - gallery_application_name: str, - gallery_application_version_name: str, + vm_scale_set_name: str, + instance_id: str, + parameters: Union[_models.RunCommandInput, JSON, IO[bytes]], **kwargs: Any - ) -> AsyncLROPoller[None]: - """Delete a gallery Application Version. + ) -> AsyncLROPoller[_models.RunCommandResult]: + """Run command on a virtual machine in a VM scale set. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :param gallery_application_name: The name of the gallery Application Definition to be - retrieved. Required. - :type gallery_application_name: str - :param gallery_application_version_name: The name of the gallery Application Version to be - retrieved. Required. - :type gallery_application_version_name: str - :return: An instance of AsyncLROPoller that returns None - :rtype: ~azure.core.polling.AsyncLROPoller[None] + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. Required. + :type instance_id: str + :param parameters: Parameters supplied to the Run command operation. Is one of the following + types: RunCommandInput, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.compute.models.RunCommandInput or JSON or IO[bytes] + :return: An instance of AsyncLROPoller that returns RunCommandResult. The RunCommandResult is + compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.RunCommandResult] :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = kwargs.pop("headers", {}) or {} + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - cls: ClsType[None] = kwargs.pop("cls", None) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.RunCommandResult] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._delete_initial( + raw_result = await self._run_command_initial( resource_group_name=resource_group_name, - gallery_name=gallery_name, - gallery_application_name=gallery_application_name, - gallery_application_version_name=gallery_application_version_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + parameters=parameters, + content_type=content_type, cls=lambda x, y, z: x, headers=_headers, params=_params, @@ -35901,9 +36056,16 @@ async def begin_delete( await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = _deserialize(_models.RunCommandResult, response.json()) if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore + return deserialized path_format_arguments = { "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), @@ -35918,121 +36080,25 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return AsyncLROPoller[None].from_continuation_token( + return AsyncLROPoller[_models.RunCommandResult].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list_by_gallery_application( - self, resource_group_name: str, gallery_name: str, gallery_application_name: str, **kwargs: Any - ) -> AsyncItemPaged["_models.GalleryApplicationVersion"]: - """List gallery Application Versions in a gallery Application Definition. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :param gallery_application_name: The name of the gallery Application Definition to be - retrieved. Required. - :type gallery_application_name: str - :return: An iterator like instance of GalleryApplicationVersion - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.models.GalleryApplicationVersion] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[List[_models.GalleryApplicationVersion]] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_gallery_application_versions_list_by_gallery_application_request( - resource_group_name=resource_group_name, - gallery_name=gallery_name, - gallery_application_name=gallery_application_name, - subscription_id=self._config.subscription_id, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - return _request - - async def extract_data(pipeline_response): - deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.GalleryApplicationVersion], deserialized.get("value", [])) - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.get("nextLink") or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.CloudError, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) + return AsyncLROPoller[_models.RunCommandResult]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) -class GalleryInVMAccessControlProfilesOperations: # pylint: disable=name-too-long +class SshPublicKeysOperations: """ .. warning:: **DO NOT** instantiate this class directly. Instead, you should access the following operations through :class:`~azure.mgmt.compute.aio.ComputeClient`'s - :attr:`gallery_in_vm_access_control_profiles` attribute. + :attr:`ssh_public_keys` attribute. """ def __init__(self, *args, **kwargs) -> None: @@ -36044,21 +36110,17 @@ def __init__(self, *args, **kwargs) -> None: @distributed_trace_async async def get( - self, resource_group_name: str, gallery_name: str, in_vm_access_control_profile_name: str, **kwargs: Any - ) -> _models.GalleryInVMAccessControlProfile: - """Retrieves information about a gallery inVMAccessControlProfile. + 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. The name is case insensitive. Required. :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :param in_vm_access_control_profile_name: The name of the gallery inVMAccessControlProfile to - be retrieved. Required. - :type in_vm_access_control_profile_name: str - :return: GalleryInVMAccessControlProfile. The GalleryInVMAccessControlProfile is compatible - with MutableMapping - :rtype: ~azure.mgmt.compute.models.GalleryInVMAccessControlProfile + :param ssh_public_key_name: The name of the SSH public key. Required. + :type ssh_public_key_name: str + :return: SshPublicKeyResource. The SshPublicKeyResource is compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.SshPublicKeyResource :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -36072,12 +36134,11 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.GalleryInVMAccessControlProfile] = kwargs.pop("cls", None) + cls: ClsType[_models.SshPublicKeyResource] = kwargs.pop("cls", None) - _request = build_gallery_in_vm_access_control_profiles_get_request( + _request = build_ssh_public_keys_get_request( resource_group_name=resource_group_name, - gallery_name=gallery_name, - in_vm_access_control_profile_name=in_vm_access_control_profile_name, + ssh_public_key_name=ssh_public_key_name, subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -36108,267 +36169,116 @@ async def get( if _stream: deserialized = response.iter_bytes() else: - deserialized = _deserialize(_models.GalleryInVMAccessControlProfile, response.json()) + deserialized = _deserialize(_models.SshPublicKeyResource, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - async def _create_or_update_initial( + @overload + async def create( self, resource_group_name: str, - gallery_name: str, - in_vm_access_control_profile_name: str, - gallery_in_vm_access_control_profile: Union[_models.GalleryInVMAccessControlProfile, JSON, IO[bytes]], + ssh_public_key_name: str, + parameters: _models.SshPublicKeyResource, + *, + content_type: str = "application/json", **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} - - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _content = None - if isinstance(gallery_in_vm_access_control_profile, (IOBase, bytes)): - _content = gallery_in_vm_access_control_profile - else: - _content = json.dumps(gallery_in_vm_access_control_profile, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - - _request = build_gallery_in_vm_access_control_profiles_create_or_update_request( - resource_group_name=resource_group_name, - gallery_name=gallery_name, - in_vm_access_control_profile_name=in_vm_access_control_profile_name, - subscription_id=self._config.subscription_id, - content_type=content_type, - api_version=self._config.api_version, - content=_content, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.CloudError, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 201: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.iter_bytes() - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - gallery_name: str, - in_vm_access_control_profile_name: str, - gallery_in_vm_access_control_profile: _models.GalleryInVMAccessControlProfile, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Create or update a gallery inVMAccessControlProfile. + ) -> _models.SshPublicKeyResource: + """Creates a new SSH public key resource. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :param in_vm_access_control_profile_name: The name of the gallery inVMAccessControlProfile to - be retrieved. Required. - :type in_vm_access_control_profile_name: str - :param gallery_in_vm_access_control_profile: Parameters supplied to the create or update - gallery inVMAccessControlProfile operation. Required. - :type gallery_in_vm_access_control_profile: - ~azure.mgmt.compute.models.GalleryInVMAccessControlProfile + :param ssh_public_key_name: The name of the SSH public key. Required. + :type ssh_public_key_name: str + :param parameters: Parameters supplied to create the SSH public key. Required. + :type parameters: ~azure.mgmt.compute.models.SshPublicKeyResource :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns None - :rtype: ~azure.core.polling.AsyncLROPoller[None] + :return: SshPublicKeyResource. The SshPublicKeyResource is compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.SshPublicKeyResource :raises ~azure.core.exceptions.HttpResponseError: """ @overload - async def begin_create_or_update( + async def create( self, resource_group_name: str, - gallery_name: str, - in_vm_access_control_profile_name: str, - gallery_in_vm_access_control_profile: JSON, + ssh_public_key_name: str, + parameters: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[None]: - """Create or update a gallery inVMAccessControlProfile. + ) -> _models.SshPublicKeyResource: + """Creates a new SSH public key resource. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :param in_vm_access_control_profile_name: The name of the gallery inVMAccessControlProfile to - be retrieved. Required. - :type in_vm_access_control_profile_name: str - :param gallery_in_vm_access_control_profile: Parameters supplied to the create or update - gallery inVMAccessControlProfile operation. Required. - :type gallery_in_vm_access_control_profile: JSON + :param ssh_public_key_name: The name of the SSH public key. Required. + :type ssh_public_key_name: str + :param parameters: Parameters supplied to create the SSH public key. Required. + :type parameters: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns None - :rtype: ~azure.core.polling.AsyncLROPoller[None] + :return: SshPublicKeyResource. The SshPublicKeyResource is compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.SshPublicKeyResource :raises ~azure.core.exceptions.HttpResponseError: """ @overload - async def begin_create_or_update( + async def create( self, resource_group_name: str, - gallery_name: str, - in_vm_access_control_profile_name: str, - gallery_in_vm_access_control_profile: IO[bytes], + ssh_public_key_name: str, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[None]: - """Create or update a gallery inVMAccessControlProfile. + ) -> _models.SshPublicKeyResource: + """Creates a new SSH public key resource. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :param in_vm_access_control_profile_name: The name of the gallery inVMAccessControlProfile to - be retrieved. Required. - :type in_vm_access_control_profile_name: str - :param gallery_in_vm_access_control_profile: Parameters supplied to the create or update - gallery inVMAccessControlProfile operation. Required. - :type gallery_in_vm_access_control_profile: IO[bytes] + :param ssh_public_key_name: The name of the SSH public key. Required. + :type ssh_public_key_name: str + :param parameters: Parameters supplied to create the SSH public key. Required. + :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns None - :rtype: ~azure.core.polling.AsyncLROPoller[None] + :return: SshPublicKeyResource. The SshPublicKeyResource is compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.SshPublicKeyResource :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace_async - async def begin_create_or_update( + async def create( self, resource_group_name: str, - gallery_name: str, - in_vm_access_control_profile_name: str, - gallery_in_vm_access_control_profile: Union[_models.GalleryInVMAccessControlProfile, JSON, IO[bytes]], + ssh_public_key_name: str, + parameters: Union[_models.SshPublicKeyResource, JSON, IO[bytes]], **kwargs: Any - ) -> AsyncLROPoller[None]: - """Create or update a gallery inVMAccessControlProfile. + ) -> _models.SshPublicKeyResource: + """Creates a new SSH public key resource. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :param in_vm_access_control_profile_name: The name of the gallery inVMAccessControlProfile to - be retrieved. Required. - :type in_vm_access_control_profile_name: str - :param gallery_in_vm_access_control_profile: Parameters supplied to the create or update - gallery inVMAccessControlProfile operation. Is one of the following types: - GalleryInVMAccessControlProfile, JSON, IO[bytes] Required. - :type gallery_in_vm_access_control_profile: - ~azure.mgmt.compute.models.GalleryInVMAccessControlProfile or JSON or IO[bytes] - :return: An instance of AsyncLROPoller that returns None - :rtype: ~azure.core.polling.AsyncLROPoller[None] + :param ssh_public_key_name: The name of the SSH public key. Required. + :type ssh_public_key_name: str + :param parameters: Parameters supplied to create the SSH public key. Is one of the following + types: SshPublicKeyResource, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.compute.models.SshPublicKeyResource or JSON or IO[bytes] + :return: SshPublicKeyResource. The SshPublicKeyResource is compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.SshPublicKeyResource :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} - - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._create_or_update_initial( - resource_group_name=resource_group_name, - gallery_name=gallery_name, - in_vm_access_control_profile_name=in_vm_access_control_profile_name, - gallery_in_vm_access_control_profile=gallery_in_vm_access_control_profile, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _update_initial( - self, - resource_group_name: str, - gallery_name: str, - in_vm_access_control_profile_name: str, - gallery_in_vm_access_control_profile: Union[_models.GalleryInVMAccessControlProfileUpdate, JSON, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -36381,19 +36291,18 @@ async def _update_initial( _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + cls: ClsType[_models.SshPublicKeyResource] = kwargs.pop("cls", None) content_type = content_type or "application/json" _content = None - if isinstance(gallery_in_vm_access_control_profile, (IOBase, bytes)): - _content = gallery_in_vm_access_control_profile + if isinstance(parameters, (IOBase, bytes)): + _content = parameters else: - _content = json.dumps(gallery_in_vm_access_control_profile, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - _request = build_gallery_in_vm_access_control_profiles_update_request( + _request = build_ssh_public_keys_create_request( resource_group_name=resource_group_name, - gallery_name=gallery_name, - in_vm_access_control_profile_name=in_vm_access_control_profile_name, + ssh_public_key_name=ssh_public_key_name, subscription_id=self._config.subscription_id, content_type=content_type, api_version=self._config.api_version, @@ -36406,209 +36315,136 @@ async def _update_initial( } _request.url = self._client.format_url(_request.url, **path_format_arguments) - _stream = True + _stream = kwargs.pop("stream", False) pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass + if response.status_code not in [200, 201]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = _failsafe_deserialize(_models.CloudError, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - response_headers = {} - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.iter_bytes() + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.SshPublicKeyResource, response.json()) if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore @overload - async def begin_update( + async def update( self, resource_group_name: str, - gallery_name: str, - in_vm_access_control_profile_name: str, - gallery_in_vm_access_control_profile: _models.GalleryInVMAccessControlProfileUpdate, + ssh_public_key_name: str, + parameters: _models.SshPublicKeyUpdateResource, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[None]: - """Update a gallery inVMAccessControlProfile. + ) -> _models.SshPublicKeyResource: + """Updates a new SSH public key resource. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :param in_vm_access_control_profile_name: The name of the gallery inVMAccessControlProfile to - be retrieved. Required. - :type in_vm_access_control_profile_name: str - :param gallery_in_vm_access_control_profile: Parameters supplied to the update gallery - inVMAccessControlProfile operation. Required. - :type gallery_in_vm_access_control_profile: - ~azure.mgmt.compute.models.GalleryInVMAccessControlProfileUpdate + :param ssh_public_key_name: The name of the SSH public key. Required. + :type ssh_public_key_name: str + :param parameters: Parameters supplied to update the SSH public key. Required. + :type parameters: ~azure.mgmt.compute.models.SshPublicKeyUpdateResource :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns None - :rtype: ~azure.core.polling.AsyncLROPoller[None] + :return: SshPublicKeyResource. The SshPublicKeyResource is compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.SshPublicKeyResource :raises ~azure.core.exceptions.HttpResponseError: """ @overload - async def begin_update( + async def update( self, resource_group_name: str, - gallery_name: str, - in_vm_access_control_profile_name: str, - gallery_in_vm_access_control_profile: JSON, + ssh_public_key_name: str, + parameters: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[None]: - """Update a gallery inVMAccessControlProfile. + ) -> _models.SshPublicKeyResource: + """Updates a new SSH public key resource. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :param in_vm_access_control_profile_name: The name of the gallery inVMAccessControlProfile to - be retrieved. Required. - :type in_vm_access_control_profile_name: str - :param gallery_in_vm_access_control_profile: Parameters supplied to the update gallery - inVMAccessControlProfile operation. Required. - :type gallery_in_vm_access_control_profile: JSON + :param ssh_public_key_name: The name of the SSH public key. Required. + :type ssh_public_key_name: str + :param parameters: Parameters supplied to update the SSH public key. Required. + :type parameters: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns None - :rtype: ~azure.core.polling.AsyncLROPoller[None] + :return: SshPublicKeyResource. The SshPublicKeyResource is compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.SshPublicKeyResource :raises ~azure.core.exceptions.HttpResponseError: """ @overload - async def begin_update( + async def update( self, resource_group_name: str, - gallery_name: str, - in_vm_access_control_profile_name: str, - gallery_in_vm_access_control_profile: IO[bytes], + ssh_public_key_name: str, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[None]: - """Update a gallery inVMAccessControlProfile. + ) -> _models.SshPublicKeyResource: + """Updates a new SSH public key resource. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :param in_vm_access_control_profile_name: The name of the gallery inVMAccessControlProfile to - be retrieved. Required. - :type in_vm_access_control_profile_name: str - :param gallery_in_vm_access_control_profile: Parameters supplied to the update gallery - inVMAccessControlProfile operation. Required. - :type gallery_in_vm_access_control_profile: IO[bytes] + :param ssh_public_key_name: The name of the SSH public key. Required. + :type ssh_public_key_name: str + :param parameters: Parameters supplied to update the SSH public key. Required. + :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns None - :rtype: ~azure.core.polling.AsyncLROPoller[None] + :return: SshPublicKeyResource. The SshPublicKeyResource is compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.SshPublicKeyResource :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace_async - async def begin_update( + async def update( self, resource_group_name: str, - gallery_name: str, - in_vm_access_control_profile_name: str, - gallery_in_vm_access_control_profile: Union[_models.GalleryInVMAccessControlProfileUpdate, JSON, IO[bytes]], + ssh_public_key_name: str, + parameters: Union[_models.SshPublicKeyUpdateResource, JSON, IO[bytes]], **kwargs: Any - ) -> AsyncLROPoller[None]: - """Update a gallery inVMAccessControlProfile. + ) -> _models.SshPublicKeyResource: + """Updates a new SSH public key resource. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :param in_vm_access_control_profile_name: The name of the gallery inVMAccessControlProfile to - be retrieved. Required. - :type in_vm_access_control_profile_name: str - :param gallery_in_vm_access_control_profile: Parameters supplied to the update gallery - inVMAccessControlProfile operation. Is one of the following types: - GalleryInVMAccessControlProfileUpdate, JSON, IO[bytes] Required. - :type gallery_in_vm_access_control_profile: - ~azure.mgmt.compute.models.GalleryInVMAccessControlProfileUpdate or JSON or IO[bytes] - :return: An instance of AsyncLROPoller that returns None - :rtype: ~azure.core.polling.AsyncLROPoller[None] + :param ssh_public_key_name: The name of the SSH public key. Required. + :type ssh_public_key_name: str + :param parameters: Parameters supplied to update the SSH public key. Is one of the following + types: SshPublicKeyUpdateResource, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.compute.models.SshPublicKeyUpdateResource or JSON or IO[bytes] + :return: SshPublicKeyResource. The SshPublicKeyResource is compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.SshPublicKeyResource :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} - - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._update_initial( - resource_group_name=resource_group_name, - gallery_name=gallery_name, - in_vm_access_control_profile_name=in_vm_access_control_profile_name, - gallery_in_vm_access_control_profile=gallery_in_vm_access_control_profile, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _delete_initial( - self, resource_group_name: str, gallery_name: str, in_vm_access_control_profile_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -36617,17 +36453,26 @@ async def _delete_initial( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SshPublicKeyResource] = kwargs.pop("cls", None) - _request = build_gallery_in_vm_access_control_profiles_delete_request( + content_type = content_type or "application/json" + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_ssh_public_keys_update_request( resource_group_name=resource_group_name, - gallery_name=gallery_name, - in_vm_access_control_profile_name=in_vm_access_control_profile_name, + ssh_public_key_name=ssh_public_key_name, subscription_id=self._config.subscription_id, + content_type=content_type, api_version=self._config.api_version, + content=_content, headers=_headers, params=_params, ) @@ -36636,119 +36481,106 @@ async def _delete_initial( } _request.url = self._client.format_url(_request.url, **path_format_arguments) - _stream = True + _stream = kwargs.pop("stream", False) pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [202, 204]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = _failsafe_deserialize(_models.CloudError, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - - deserialized = response.iter_bytes() + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.SshPublicKeyResource, response.json()) if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore @distributed_trace_async - async def begin_delete( - self, resource_group_name: str, gallery_name: str, in_vm_access_control_profile_name: str, **kwargs: Any - ) -> AsyncLROPoller[None]: - """Delete a gallery inVMAccessControlProfile. + async def delete(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. The name is case insensitive. Required. :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :param in_vm_access_control_profile_name: The name of the gallery inVMAccessControlProfile to - be retrieved. Required. - :type in_vm_access_control_profile_name: str - :return: An instance of AsyncLROPoller that returns None - :rtype: ~azure.core.polling.AsyncLROPoller[None] + :param ssh_public_key_name: The name of the SSH public key. Required. + :type ssh_public_key_name: str + :return: None + :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._delete_initial( - resource_group_name=resource_group_name, - gallery_name=gallery_name, - in_vm_access_control_profile_name=in_vm_access_control_profile_name, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore + _request = build_ssh_public_keys_delete_request( + resource_group_name=resource_group_name, + ssh_public_key_name=ssh_public_key_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) path_format_arguments = { "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), } + _request.url = self._client.format_url(_request.url, **path_format_arguments) - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore @distributed_trace - def list_by_gallery( - self, resource_group_name: str, gallery_name: str, **kwargs: Any - ) -> AsyncItemPaged["_models.GalleryInVMAccessControlProfile"]: - """List gallery inVMAccessControlProfiles in a gallery. + def list_by_resource_group( + self, resource_group_name: str, **kwargs: Any + ) -> AsyncItemPaged["_models.SshPublicKeyResource"]: + """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. The name is case insensitive. Required. :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :return: An iterator like instance of GalleryInVMAccessControlProfile + :return: An iterator like instance of SshPublicKeyResource :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.models.GalleryInVMAccessControlProfile] + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.models.SshPublicKeyResource] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.GalleryInVMAccessControlProfile]] = kwargs.pop("cls", None) + cls: ClsType[List[_models.SshPublicKeyResource]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -36761,9 +36593,8 @@ def list_by_gallery( def prepare_request(next_link=None): if not next_link: - _request = build_gallery_in_vm_access_control_profiles_list_by_gallery_request( + _request = build_ssh_public_keys_list_by_resource_group_request( resource_group_name=resource_group_name, - gallery_name=gallery_name, subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -36800,7 +36631,7 @@ def prepare_request(next_link=None): async def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.GalleryInVMAccessControlProfile], deserialized.get("value", [])) + list_of_elem = _deserialize(List[_models.SshPublicKeyResource], deserialized.get("value", [])) if cls: list_of_elem = cls(list_of_elem) # type: ignore return deserialized.get("nextLink") or None, AsyncList(list_of_elem) @@ -36823,117 +36654,21 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) + @distributed_trace + def list_by_subscription(self, **kwargs: Any) -> AsyncItemPaged["_models.SshPublicKeyResource"]: + """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. -class GalleryInVMAccessControlProfileVersionsOperations: # pylint: disable=name-too-long - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.compute.aio.ComputeClient`'s - :attr:`gallery_in_vm_access_control_profile_versions` attribute. - """ - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ComputeClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace_async - async def get( - self, - resource_group_name: str, - gallery_name: str, - in_vm_access_control_profile_name: str, - in_vm_access_control_profile_version_name: str, - **kwargs: Any - ) -> _models.GalleryInVMAccessControlProfileVersion: - """Retrieves information about a gallery inVMAccessControlProfile version. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :param in_vm_access_control_profile_name: The name of the gallery inVMAccessControlProfile to - be retrieved. Required. - :type in_vm_access_control_profile_name: str - :param in_vm_access_control_profile_version_name: The name of the gallery - inVMAccessControlProfile version to be retrieved. Required. - :type in_vm_access_control_profile_version_name: str - :return: GalleryInVMAccessControlProfileVersion. The GalleryInVMAccessControlProfileVersion is - compatible with MutableMapping - :rtype: ~azure.mgmt.compute.models.GalleryInVMAccessControlProfileVersion + :return: An iterator like instance of SshPublicKeyResource + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.models.SshPublicKeyResource] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.GalleryInVMAccessControlProfileVersion] = kwargs.pop("cls", None) - - _request = build_gallery_in_vm_access_control_profile_versions_get_request( - resource_group_name=resource_group_name, - gallery_name=gallery_name, - in_vm_access_control_profile_name=in_vm_access_control_profile_name, - in_vm_access_control_profile_version_name=in_vm_access_control_profile_version_name, - subscription_id=self._config.subscription_id, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = kwargs.pop("stream", False) - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - if _stream: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.CloudError, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if _stream: - deserialized = response.iter_bytes() - else: - deserialized = _deserialize(_models.GalleryInVMAccessControlProfileVersion, response.json()) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore + cls: ClsType[List[_models.SshPublicKeyResource]] = kwargs.pop("cls", None) - async def _create_or_update_initial( - self, - resource_group_name: str, - gallery_name: str, - in_vm_access_control_profile_name: str, - in_vm_access_control_profile_version_name: str, - gallery_in_vm_access_control_profile_version: Union[ - _models.GalleryInVMAccessControlProfileVersion, JSON, IO[bytes] - ], - **kwargs: Any - ) -> AsyncIterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -36942,267 +36677,185 @@ async def _create_or_update_initial( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} - - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + def prepare_request(next_link=None): + if not next_link: - content_type = content_type or "application/json" - _content = None - if isinstance(gallery_in_vm_access_control_profile_version, (IOBase, bytes)): - _content = gallery_in_vm_access_control_profile_version - else: - _content = json.dumps(gallery_in_vm_access_control_profile_version, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _request = build_ssh_public_keys_list_by_subscription_request( + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) - _request = build_gallery_in_vm_access_control_profile_versions_create_or_update_request( - resource_group_name=resource_group_name, - gallery_name=gallery_name, - in_vm_access_control_profile_name=in_vm_access_control_profile_name, - in_vm_access_control_profile_version_name=in_vm_access_control_profile_version_name, - subscription_id=self._config.subscription_id, - content_type=content_type, - api_version=self._config.api_version, - content=_content, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) + return _request - response = pipeline_response.http_response + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.SshPublicKeyResource], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) - if response.status_code not in [200, 201]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.CloudError, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + async def get_next(next_link=None): + _request = prepare_request(next_link) - response_headers = {} - if response.status_code == 201: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response - deserialized = response.iter_bytes() + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore + return pipeline_response - return deserialized # type: ignore + return AsyncItemPaged(get_next, extract_data) @overload - async def begin_create_or_update( + async def generate_key_pair( self, resource_group_name: str, - gallery_name: str, - in_vm_access_control_profile_name: str, - in_vm_access_control_profile_version_name: str, - gallery_in_vm_access_control_profile_version: _models.GalleryInVMAccessControlProfileVersion, + ssh_public_key_name: str, + parameters: Optional[_models.SshGenerateKeyPairInputParameters] = None, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[None]: - """Create or update a gallery inVMAccessControlProfile version. + ) -> _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. The name is case insensitive. Required. :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :param in_vm_access_control_profile_name: The name of the gallery inVMAccessControlProfile to - be retrieved. Required. - :type in_vm_access_control_profile_name: str - :param in_vm_access_control_profile_version_name: The name of the gallery - inVMAccessControlProfile version to be retrieved. Required. - :type in_vm_access_control_profile_version_name: str - :param gallery_in_vm_access_control_profile_version: Parameters supplied to the create or - update gallery inVMAccessControlProfile version operation. Required. - :type gallery_in_vm_access_control_profile_version: - ~azure.mgmt.compute.models.GalleryInVMAccessControlProfileVersion + :param ssh_public_key_name: The name of the SSH public key. Required. + :type ssh_public_key_name: str + :param parameters: Parameters supplied to generate the SSH public key. Default value is None. + :type parameters: ~azure.mgmt.compute.models.SshGenerateKeyPairInputParameters :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns None - :rtype: ~azure.core.polling.AsyncLROPoller[None] + :return: SshPublicKeyGenerateKeyPairResult. The SshPublicKeyGenerateKeyPairResult is compatible + with MutableMapping + :rtype: ~azure.mgmt.compute.models.SshPublicKeyGenerateKeyPairResult :raises ~azure.core.exceptions.HttpResponseError: """ @overload - async def begin_create_or_update( + async def generate_key_pair( self, resource_group_name: str, - gallery_name: str, - in_vm_access_control_profile_name: str, - in_vm_access_control_profile_version_name: str, - gallery_in_vm_access_control_profile_version: JSON, + ssh_public_key_name: str, + parameters: Optional[JSON] = None, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[None]: - """Create or update a gallery inVMAccessControlProfile version. + ) -> _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. The name is case insensitive. Required. :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :param in_vm_access_control_profile_name: The name of the gallery inVMAccessControlProfile to - be retrieved. Required. - :type in_vm_access_control_profile_name: str - :param in_vm_access_control_profile_version_name: The name of the gallery - inVMAccessControlProfile version to be retrieved. Required. - :type in_vm_access_control_profile_version_name: str - :param gallery_in_vm_access_control_profile_version: Parameters supplied to the create or - update gallery inVMAccessControlProfile version operation. Required. - :type gallery_in_vm_access_control_profile_version: JSON + :param ssh_public_key_name: The name of the SSH public key. Required. + :type ssh_public_key_name: str + :param parameters: Parameters supplied to generate the SSH public key. Default value is None. + :type parameters: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns None - :rtype: ~azure.core.polling.AsyncLROPoller[None] + :return: SshPublicKeyGenerateKeyPairResult. The SshPublicKeyGenerateKeyPairResult is compatible + with MutableMapping + :rtype: ~azure.mgmt.compute.models.SshPublicKeyGenerateKeyPairResult :raises ~azure.core.exceptions.HttpResponseError: """ @overload - async def begin_create_or_update( + async def generate_key_pair( self, resource_group_name: str, - gallery_name: str, - in_vm_access_control_profile_name: str, - in_vm_access_control_profile_version_name: str, - gallery_in_vm_access_control_profile_version: IO[bytes], + ssh_public_key_name: str, + parameters: Optional[IO[bytes]] = None, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[None]: - """Create or update a gallery inVMAccessControlProfile version. + ) -> _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. The name is case insensitive. Required. :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :param in_vm_access_control_profile_name: The name of the gallery inVMAccessControlProfile to - be retrieved. Required. - :type in_vm_access_control_profile_name: str - :param in_vm_access_control_profile_version_name: The name of the gallery - inVMAccessControlProfile version to be retrieved. Required. - :type in_vm_access_control_profile_version_name: str - :param gallery_in_vm_access_control_profile_version: Parameters supplied to the create or - update gallery inVMAccessControlProfile version operation. Required. - :type gallery_in_vm_access_control_profile_version: IO[bytes] + :param ssh_public_key_name: The name of the SSH public key. Required. + :type ssh_public_key_name: str + :param parameters: Parameters supplied to generate the SSH public key. Default value is None. + :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns None - :rtype: ~azure.core.polling.AsyncLROPoller[None] + :return: SshPublicKeyGenerateKeyPairResult. The SshPublicKeyGenerateKeyPairResult is compatible + with MutableMapping + :rtype: ~azure.mgmt.compute.models.SshPublicKeyGenerateKeyPairResult :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace_async - async def begin_create_or_update( + async def generate_key_pair( self, resource_group_name: str, - gallery_name: str, - in_vm_access_control_profile_name: str, - in_vm_access_control_profile_version_name: str, - gallery_in_vm_access_control_profile_version: Union[ - _models.GalleryInVMAccessControlProfileVersion, JSON, IO[bytes] - ], + ssh_public_key_name: str, + parameters: Optional[Union[_models.SshGenerateKeyPairInputParameters, JSON, IO[bytes]]] = None, **kwargs: Any - ) -> AsyncLROPoller[None]: - """Create or update a gallery inVMAccessControlProfile version. + ) -> _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. The name is case insensitive. Required. :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :param in_vm_access_control_profile_name: The name of the gallery inVMAccessControlProfile to - be retrieved. Required. - :type in_vm_access_control_profile_name: str - :param in_vm_access_control_profile_version_name: The name of the gallery - inVMAccessControlProfile version to be retrieved. Required. - :type in_vm_access_control_profile_version_name: str - :param gallery_in_vm_access_control_profile_version: Parameters supplied to the create or - update gallery inVMAccessControlProfile version operation. Is one of the following types: - GalleryInVMAccessControlProfileVersion, JSON, IO[bytes] Required. - :type gallery_in_vm_access_control_profile_version: - ~azure.mgmt.compute.models.GalleryInVMAccessControlProfileVersion or JSON or IO[bytes] - :return: An instance of AsyncLROPoller that returns None - :rtype: ~azure.core.polling.AsyncLROPoller[None] + :param ssh_public_key_name: The name of the SSH public key. Required. + :type ssh_public_key_name: str + :param parameters: Parameters supplied to generate the SSH public key. Is one of the following + types: SshGenerateKeyPairInputParameters, JSON, IO[bytes] Default value is None. + :type parameters: ~azure.mgmt.compute.models.SshGenerateKeyPairInputParameters or JSON or + IO[bytes] + :return: SshPublicKeyGenerateKeyPairResult. The SshPublicKeyGenerateKeyPairResult is compatible + with MutableMapping + :rtype: ~azure.mgmt.compute.models.SshPublicKeyGenerateKeyPairResult :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} - - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._create_or_update_initial( - resource_group_name=resource_group_name, - gallery_name=gallery_name, - in_vm_access_control_profile_name=in_vm_access_control_profile_name, - in_vm_access_control_profile_version_name=in_vm_access_control_profile_version_name, - gallery_in_vm_access_control_profile_version=gallery_in_vm_access_control_profile_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _update_initial( - self, - resource_group_name: str, - gallery_name: str, - in_vm_access_control_profile_name: str, - in_vm_access_control_profile_version_name: str, - gallery_in_vm_access_control_profile_version: Union[ - _models.GalleryInVMAccessControlProfileVersionUpdate, JSON, IO[bytes] - ], - **kwargs: Any - ) -> AsyncIterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -37215,20 +36868,22 @@ async def _update_initial( _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + content_type = content_type if parameters else None + cls: ClsType[_models.SshPublicKeyGenerateKeyPairResult] = kwargs.pop("cls", None) - content_type = content_type or "application/json" + content_type = content_type or "application/json" if parameters else None _content = None - if isinstance(gallery_in_vm_access_control_profile_version, (IOBase, bytes)): - _content = gallery_in_vm_access_control_profile_version + if isinstance(parameters, (IOBase, bytes)): + _content = parameters else: - _content = json.dumps(gallery_in_vm_access_control_profile_version, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + if parameters is not None: + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + else: + _content = None - _request = build_gallery_in_vm_access_control_profile_versions_update_request( + _request = build_ssh_public_keys_generate_key_pair_request( resource_group_name=resource_group_name, - gallery_name=gallery_name, - in_vm_access_control_profile_name=in_vm_access_control_profile_name, - in_vm_access_control_profile_version_name=in_vm_access_control_profile_version_name, + ssh_public_key_name=ssh_public_key_name, subscription_id=self._config.subscription_id, content_type=content_type, api_version=self._config.api_version, @@ -37241,7 +36896,7 @@ async def _update_initial( } _request.url = self._client.format_url(_request.url, **path_format_arguments) - _stream = True + _stream = kwargs.pop("stream", False) pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -37249,225 +36904,412 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = _failsafe_deserialize(_models.CloudError, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - response_headers = {} - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.iter_bytes() + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.SshPublicKeyGenerateKeyPairResult, response.json()) if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - @overload - async def begin_update( - self, - resource_group_name: str, - gallery_name: str, - in_vm_access_control_profile_name: str, - in_vm_access_control_profile_version_name: str, - gallery_in_vm_access_control_profile_version: _models.GalleryInVMAccessControlProfileVersionUpdate, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Update a gallery inVMAccessControlProfile version. - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :param in_vm_access_control_profile_name: The name of the gallery inVMAccessControlProfile to - be retrieved. Required. - :type in_vm_access_control_profile_name: str - :param in_vm_access_control_profile_version_name: The name of the gallery - inVMAccessControlProfile version to be retrieved. Required. - :type in_vm_access_control_profile_version_name: str - :param gallery_in_vm_access_control_profile_version: Parameters supplied to the update gallery - inVMAccessControlProfile version operation. Required. - :type gallery_in_vm_access_control_profile_version: - ~azure.mgmt.compute.models.GalleryInVMAccessControlProfileVersionUpdate - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns None - :rtype: ~azure.core.polling.AsyncLROPoller[None] +class UsageOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.compute.aio.ComputeClient`'s + :attr:`usage` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list(self, location: str, **kwargs: Any) -> AsyncItemPaged["_models.Usage"]: + """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 name. Required. + :type location: str + :return: An iterator like instance of Usage + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.models.Usage] :raises ~azure.core.exceptions.HttpResponseError: """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} - @overload - async def begin_update( - self, - resource_group_name: str, - gallery_name: str, - in_vm_access_control_profile_name: str, - in_vm_access_control_profile_version_name: str, - gallery_in_vm_access_control_profile_version: JSON, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Update a gallery inVMAccessControlProfile version. + cls: ClsType[List[_models.Usage]] = kwargs.pop("cls", None) - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :param in_vm_access_control_profile_name: The name of the gallery inVMAccessControlProfile to - be retrieved. Required. - :type in_vm_access_control_profile_name: str - :param in_vm_access_control_profile_version_name: The name of the gallery - inVMAccessControlProfile version to be retrieved. Required. - :type in_vm_access_control_profile_version_name: str - :param gallery_in_vm_access_control_profile_version: Parameters supplied to the update gallery - inVMAccessControlProfile version operation. Required. - :type gallery_in_vm_access_control_profile_version: JSON - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns None - :rtype: ~azure.core.polling.AsyncLROPoller[None] + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_usage_list_request( + location=location, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.Usage], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + +class VirtualMachineSizesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.compute.aio.ComputeClient`'s + :attr:`virtual_machine_sizes` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list(self, location: str, **kwargs: Any) -> AsyncItemPaged["_models.VirtualMachineSize"]: + """This API is deprecated. Use `Resources Skus + `_. + + :param location: The location name. Required. + :type location: str + :return: An iterator like instance of VirtualMachineSize + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.models.VirtualMachineSize] :raises ~azure.core.exceptions.HttpResponseError: """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} - @overload - async def begin_update( - self, - resource_group_name: str, - gallery_name: str, - in_vm_access_control_profile_name: str, - in_vm_access_control_profile_version_name: str, - gallery_in_vm_access_control_profile_version: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Update a gallery inVMAccessControlProfile version. + cls: ClsType[List[_models.VirtualMachineSize]] = kwargs.pop("cls", None) - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :param in_vm_access_control_profile_name: The name of the gallery inVMAccessControlProfile to - be retrieved. Required. - :type in_vm_access_control_profile_name: str - :param in_vm_access_control_profile_version_name: The name of the gallery - inVMAccessControlProfile version to be retrieved. Required. - :type in_vm_access_control_profile_version_name: str - :param gallery_in_vm_access_control_profile_version: Parameters supplied to the update gallery - inVMAccessControlProfile version operation. Required. - :type gallery_in_vm_access_control_profile_version: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns None - :rtype: ~azure.core.polling.AsyncLROPoller[None] + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_virtual_machine_sizes_list_request( + location=location, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.VirtualMachineSize], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + +class VirtualMachineImagesEdgeZoneOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.compute.aio.ComputeClient`'s + :attr:`virtual_machine_images_edge_zone` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @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 location name. Required. + :type location: str + :param edge_zone: The name of the edge zone. Required. + :type edge_zone: str + :return: list of VirtualMachineImageResource + :rtype: list[~azure.mgmt.compute.models.VirtualMachineImageResource] :raises ~azure.core.exceptions.HttpResponseError: """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) - @distributed_trace_async - async def begin_update( - self, - resource_group_name: str, - gallery_name: str, - in_vm_access_control_profile_name: str, - in_vm_access_control_profile_version_name: str, - gallery_in_vm_access_control_profile_version: Union[ - _models.GalleryInVMAccessControlProfileVersionUpdate, JSON, IO[bytes] - ], - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Update a gallery inVMAccessControlProfile version. + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :param in_vm_access_control_profile_name: The name of the gallery inVMAccessControlProfile to - be retrieved. Required. - :type in_vm_access_control_profile_name: str - :param in_vm_access_control_profile_version_name: The name of the gallery - inVMAccessControlProfile version to be retrieved. Required. - :type in_vm_access_control_profile_version_name: str - :param gallery_in_vm_access_control_profile_version: Parameters supplied to the update gallery - inVMAccessControlProfile version operation. Is one of the following types: - GalleryInVMAccessControlProfileVersionUpdate, JSON, IO[bytes] Required. - :type gallery_in_vm_access_control_profile_version: - ~azure.mgmt.compute.models.GalleryInVMAccessControlProfileVersionUpdate or JSON or IO[bytes] - :return: An instance of AsyncLROPoller that returns None - :rtype: ~azure.core.polling.AsyncLROPoller[None] + cls: ClsType[List[_models.VirtualMachineImageResource]] = kwargs.pop("cls", None) + + _request = build_virtual_machine_images_edge_zone_list_publishers_request( + location=location, + edge_zone=edge_zone, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(List[_models.VirtualMachineImageResource], response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # 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 location name. Required. + :type location: str + :param edge_zone: The name of the edge zone. Required. + :type edge_zone: str + :param publisher_name: A valid image publisher. Required. + :type publisher_name: str + :return: list of VirtualMachineImageResource + :rtype: list[~azure.mgmt.compute.models.VirtualMachineImageResource] :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._update_initial( - resource_group_name=resource_group_name, - gallery_name=gallery_name, - in_vm_access_control_profile_name=in_vm_access_control_profile_name, - in_vm_access_control_profile_version_name=in_vm_access_control_profile_version_name, - gallery_in_vm_access_control_profile_version=gallery_in_vm_access_control_profile_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore + cls: ClsType[List[_models.VirtualMachineImageResource]] = kwargs.pop("cls", None) + _request = build_virtual_machine_images_edge_zone_list_offers_request( + location=location, + edge_zone=edge_zone, + publisher_name=publisher_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) path_format_arguments = { "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), } + _request.url = self._client.format_url(_request.url, **path_format_arguments) - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + deserialized = _deserialize(List[_models.VirtualMachineImageResource], response.json()) - async def _delete_initial( - self, - resource_group_name: str, - gallery_name: str, - in_vm_access_control_profile_name: str, - in_vm_access_control_profile_version_name: str, - **kwargs: Any - ) -> AsyncIterator[bytes]: + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # 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 location name. Required. + :type location: str + :param edge_zone: The name of the edge zone. Required. + :type edge_zone: str + :param publisher_name: A valid image publisher. Required. + :type publisher_name: str + :param offer: A valid image publisher offer. Required. + :type offer: str + :return: list of VirtualMachineImageResource + :rtype: list[~azure.mgmt.compute.models.VirtualMachineImageResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -37479,13 +37321,13 @@ async def _delete_initial( _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + cls: ClsType[List[_models.VirtualMachineImageResource]] = kwargs.pop("cls", None) - _request = build_gallery_in_vm_access_control_profile_versions_delete_request( - resource_group_name=resource_group_name, - gallery_name=gallery_name, - in_vm_access_control_profile_name=in_vm_access_control_profile_name, - in_vm_access_control_profile_version_name=in_vm_access_control_profile_version_name, + _request = build_virtual_machine_images_edge_zone_list_skus_request( + location=location, + edge_zone=edge_zone, + publisher_name=publisher_name, + offer=offer, subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -37496,132 +37338,153 @@ async def _delete_initial( } _request.url = self._client.format_url(_request.url, **path_format_arguments) - _stream = True + _stream = kwargs.pop("stream", False) pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [202, 204]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = _failsafe_deserialize(_models.CloudError, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - - deserialized = response.iter_bytes() + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(List[_models.VirtualMachineImageResource], response.json()) if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore @distributed_trace_async - async def begin_delete( + async def list( self, - resource_group_name: str, - gallery_name: str, - in_vm_access_control_profile_name: str, - in_vm_access_control_profile_version_name: str, + 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 - ) -> AsyncLROPoller[None]: - """Delete a gallery inVMAccessControlProfile version. + ) -> List[_models.VirtualMachineImageResource]: + """Gets a list of all virtual machine image versions for the specified location, edge zone, + publisher, offer, and SKU. - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :param in_vm_access_control_profile_name: The name of the gallery inVMAccessControlProfile to - be retrieved. Required. - :type in_vm_access_control_profile_name: str - :param in_vm_access_control_profile_version_name: The name of the gallery - inVMAccessControlProfile version to be retrieved. Required. - :type in_vm_access_control_profile_version_name: str - :return: An instance of AsyncLROPoller that returns None - :rtype: ~azure.core.polling.AsyncLROPoller[None] + :param location: The location name. Required. + :type location: str + :param edge_zone: The name of the edge zone. Required. + :type edge_zone: str + :param publisher_name: A valid image publisher. Required. + :type publisher_name: str + :param offer: A valid image publisher offer. Required. + :type offer: str + :param skus: A valid image SKU. Required. + :type skus: str + :keyword expand: The expand expression to apply on the operation. Default value is None. + :paramtype expand: str + :keyword top: An integer value specifying the number of images to return that matches supplied + values. Default value is None. + :paramtype top: int + :keyword orderby: Specifies the order of the results returned. Formatted as an OData query. + Default value is None. + :paramtype orderby: str + :return: list of VirtualMachineImageResource + :rtype: list[~azure.mgmt.compute.models.VirtualMachineImageResource] :raises ~azure.core.exceptions.HttpResponseError: """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._delete_initial( - resource_group_name=resource_group_name, - gallery_name=gallery_name, - in_vm_access_control_profile_name=in_vm_access_control_profile_name, - in_vm_access_control_profile_version_name=in_vm_access_control_profile_version_name, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore + cls: ClsType[List[_models.VirtualMachineImageResource]] = kwargs.pop("cls", None) + _request = build_virtual_machine_images_edge_zone_list_request( + location=location, + edge_zone=edge_zone, + publisher_name=publisher_name, + offer=offer, + skus=skus, + subscription_id=self._config.subscription_id, + expand=expand, + top=top, + orderby=orderby, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) path_format_arguments = { "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), } + _request.url = self._client.format_url(_request.url, **path_format_arguments) - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + deserialized = _deserialize(List[_models.VirtualMachineImageResource], response.json()) - @distributed_trace - def list_by_gallery_in_vm_access_control_profile( # pylint: disable=name-too-long - self, resource_group_name: str, gallery_name: str, in_vm_access_control_profile_name: str, **kwargs: Any - ) -> AsyncItemPaged["_models.GalleryInVMAccessControlProfileVersion"]: - """List gallery inVMAccessControlProfile versions in a gallery inVMAccessControlProfile. + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :param in_vm_access_control_profile_name: The name of the gallery inVMAccessControlProfile to - be retrieved. Required. - :type in_vm_access_control_profile_name: str - :return: An iterator like instance of GalleryInVMAccessControlProfileVersion - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.models.GalleryInVMAccessControlProfileVersion] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} + return deserialized # type: ignore - cls: ClsType[List[_models.GalleryInVMAccessControlProfileVersion]] = kwargs.pop("cls", None) + @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 the Azure region. Required. + :type location: str + :param edge_zone: The name of the edge zone. Required. + :type edge_zone: str + :param publisher_name: A valid image publisher. Required. + :type publisher_name: str + :param offer: A valid image publisher offer. Required. + :type offer: str + :param skus: A valid image SKU. Required. + :type skus: str + :param version: A valid image SKU version. Required. + :type version: str + :return: VirtualMachineImage. The VirtualMachineImage is compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.VirtualMachineImage + :raises ~azure.core.exceptions.HttpResponseError: + """ error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -37630,83 +37493,64 @@ def list_by_gallery_in_vm_access_control_profile( # pylint: disable=name-too-lo } error_map.update(kwargs.pop("error_map", {}) or {}) - def prepare_request(next_link=None): - if not next_link: - - _request = build_gallery_in_vm_access_control_profile_versions_list_by_gallery_in_vm_access_control_profile_request( - resource_group_name=resource_group_name, - gallery_name=gallery_name, - in_vm_access_control_profile_name=in_vm_access_control_profile_name, - subscription_id=self._config.subscription_id, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) + cls: ClsType[_models.VirtualMachineImage] = kwargs.pop("cls", None) - return _request + _request = build_virtual_machine_images_edge_zone_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=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) - async def extract_data(pipeline_response): - deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize( - List[_models.GalleryInVMAccessControlProfileVersion], deserialized.get("value", []) - ) - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) - async def get_next(next_link=None): - _request = prepare_request(next_link) + response = pipeline_response.http_response - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.CloudError, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.VirtualMachineImage, response.json()) - return pipeline_response + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore - return AsyncItemPaged(get_next, extract_data) + return deserialized # type: ignore -class SharedGalleriesOperations: +class VirtualMachineImagesOperations: """ .. warning:: **DO NOT** instantiate this class directly. Instead, you should access the following operations through :class:`~azure.mgmt.compute.aio.ComputeClient`'s - :attr:`shared_galleries` attribute. + :attr:`virtual_machine_images` attribute. """ def __init__(self, *args, **kwargs) -> None: @@ -37717,15 +37561,81 @@ def __init__(self, *args, **kwargs) -> None: self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace_async - async def get(self, location: str, gallery_unique_name: str, **kwargs: Any) -> _models.SharedGallery: - """Get a shared gallery by subscription id or tenant id. + async def list_by_edge_zone( + self, location: str, edge_zone: str, **kwargs: Any + ) -> _models.VmImagesInEdgeZoneListResult: + """Gets a list of all virtual machine image versions for the specified edge zone. - :param location: The name of the Azure region. Required. + :param location: The location name. Required. + :type location: str + :param edge_zone: The name of the edge zone. Required. + :type edge_zone: str + :return: VmImagesInEdgeZoneListResult. The VmImagesInEdgeZoneListResult is compatible with + MutableMapping + :rtype: ~azure.mgmt.compute.models.VmImagesInEdgeZoneListResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.VmImagesInEdgeZoneListResult] = kwargs.pop("cls", None) + + _request = build_virtual_machine_images_list_by_edge_zone_request( + location=location, + edge_zone=edge_zone, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.VmImagesInEdgeZoneListResult, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # 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 location name. Required. :type location: str - :param gallery_unique_name: The unique name of the Shared Gallery. Required. - :type gallery_unique_name: str - :return: SharedGallery. The SharedGallery is compatible with MutableMapping - :rtype: ~azure.mgmt.compute.models.SharedGallery + :return: list of VirtualMachineImageResource + :rtype: list[~azure.mgmt.compute.models.VirtualMachineImageResource] :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -37739,11 +37649,10 @@ async def get(self, location: str, gallery_unique_name: str, **kwargs: Any) -> _ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.SharedGallery] = kwargs.pop("cls", None) + cls: ClsType[List[_models.VirtualMachineImageResource]] = kwargs.pop("cls", None) - _request = build_shared_galleries_get_request( + _request = build_virtual_machine_images_list_publishers_request( location=location, - gallery_unique_name=gallery_unique_name, subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -37774,139 +37683,25 @@ async def get(self, location: str, gallery_unique_name: str, **kwargs: Any) -> _ if _stream: deserialized = response.iter_bytes() else: - deserialized = _deserialize(_models.SharedGallery, response.json()) + deserialized = _deserialize(List[_models.VirtualMachineImageResource], response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - @distributed_trace - def list( - self, location: str, *, shared_to: Optional[Union[str, _models.SharedToValues]] = None, **kwargs: Any - ) -> AsyncItemPaged["_models.SharedGallery"]: - """List shared galleries by subscription id or tenant id. - - :param location: The name of the Azure region. Required. - :type location: str - :keyword shared_to: The query parameter to decide what shared galleries to fetch when doing - listing operations. "tenant" Default value is None. - :paramtype shared_to: str or ~azure.mgmt.compute.models.SharedToValues - :return: An iterator like instance of SharedGallery - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.models.SharedGallery] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[List[_models.SharedGallery]] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_shared_galleries_list_request( - location=location, - subscription_id=self._config.subscription_id, - shared_to=shared_to, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - return _request - - async def extract_data(pipeline_response): - deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.SharedGallery], deserialized.get("value", [])) - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.get("nextLink") or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.CloudError, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - -class SharedGalleryImagesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.compute.aio.ComputeClient`'s - :attr:`shared_gallery_images` attribute. - """ - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ComputeClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace_async - async def get( - self, location: str, gallery_unique_name: str, gallery_image_name: str, **kwargs: Any - ) -> _models.SharedGalleryImage: - """Get a shared gallery image by subscription id or tenant id. + 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 the Azure region. Required. + :param location: The location name. Required. :type location: str - :param gallery_unique_name: The unique name of the Shared Gallery. Required. - :type gallery_unique_name: str - :param gallery_image_name: The name of the Shared Gallery Image Definition from which the Image - Versions are to be listed. Required. - :type gallery_image_name: str - :return: SharedGalleryImage. The SharedGalleryImage is compatible with MutableMapping - :rtype: ~azure.mgmt.compute.models.SharedGalleryImage + :param publisher_name: A valid image publisher. Required. + :type publisher_name: str + :return: list of VirtualMachineImageResource + :rtype: list[~azure.mgmt.compute.models.VirtualMachineImageResource] :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -37920,12 +37715,11 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.SharedGalleryImage] = kwargs.pop("cls", None) + cls: ClsType[List[_models.VirtualMachineImageResource]] = kwargs.pop("cls", None) - _request = build_shared_gallery_images_get_request( + _request = build_virtual_machine_images_list_offers_request( location=location, - gallery_unique_name=gallery_unique_name, - gallery_image_name=gallery_image_name, + publisher_name=publisher_name, subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -37956,40 +37750,29 @@ async def get( if _stream: deserialized = response.iter_bytes() else: - deserialized = _deserialize(_models.SharedGalleryImage, response.json()) + deserialized = _deserialize(List[_models.VirtualMachineImageResource], response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - @distributed_trace - def list( - self, - location: str, - gallery_unique_name: str, - *, - shared_to: Optional[Union[str, _models.SharedToValues]] = None, - **kwargs: Any - ) -> AsyncItemPaged["_models.SharedGalleryImage"]: - """List shared gallery images by subscription id or tenant id. + @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 the Azure region. Required. + :param location: The location name. Required. :type location: str - :param gallery_unique_name: The unique name of the Shared Gallery. Required. - :type gallery_unique_name: str - :keyword shared_to: The query parameter to decide what shared galleries to fetch when doing - listing operations. "tenant" Default value is None. - :paramtype shared_to: str or ~azure.mgmt.compute.models.SharedToValues - :return: An iterator like instance of SharedGalleryImage - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.models.SharedGalleryImage] + :param publisher_name: A valid image publisher. Required. + :type publisher_name: str + :param offer: A valid image publisher offer. Required. + :type offer: str + :return: list of VirtualMachineImageResource + :rtype: list[~azure.mgmt.compute.models.VirtualMachineImageResource] :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[List[_models.SharedGalleryImage]] = kwargs.pop("cls", None) - error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -37998,116 +37781,84 @@ def list( } error_map.update(kwargs.pop("error_map", {}) or {}) - def prepare_request(next_link=None): - if not next_link: - - _request = build_shared_gallery_images_list_request( - location=location, - gallery_unique_name=gallery_unique_name, - subscription_id=self._config.subscription_id, - shared_to=shared_to, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - return _request - - async def extract_data(pipeline_response): - deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.SharedGalleryImage], deserialized.get("value", [])) - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.get("nextLink") or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response + cls: ClsType[List[_models.VirtualMachineImageResource]] = kwargs.pop("cls", None) - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.CloudError, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + _request = build_virtual_machine_images_list_skus_request( + location=location, + publisher_name=publisher_name, + offer=offer, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) - return pipeline_response + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) - return AsyncItemPaged(get_next, extract_data) + response = pipeline_response.http_response + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) -class SharedGalleryImageVersionsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(List[_models.VirtualMachineImageResource], response.json()) - Instead, you should access the following operations through - :class:`~azure.mgmt.compute.aio.ComputeClient`'s - :attr:`shared_gallery_image_versions` attribute. - """ + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ComputeClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + return deserialized # type: ignore @distributed_trace_async - async def get( + async def list( self, location: str, - gallery_unique_name: str, - gallery_image_name: str, - gallery_image_version_name: str, + publisher_name: str, + offer: str, + skus: str, + *, + expand: Optional[str] = None, + top: Optional[int] = None, + orderby: Optional[str] = None, **kwargs: Any - ) -> _models.SharedGalleryImageVersion: - """Get a shared gallery image version by subscription id or tenant id. + ) -> 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 the Azure region. Required. + :param location: The location name. Required. :type location: str - :param gallery_unique_name: The unique name of the Shared Gallery. Required. - :type gallery_unique_name: str - :param gallery_image_name: The name of the Shared Gallery Image Definition from which the Image - Versions are to be listed. Required. - :type gallery_image_name: str - :param gallery_image_version_name: The name of the gallery image version to be created. Needs - to follow semantic version name pattern: The allowed characters are digit and period. Digits - must be within the range of a 32-bit integer. Format: ... - Required. - :type gallery_image_version_name: str - :return: SharedGalleryImageVersion. The SharedGalleryImageVersion is compatible with - MutableMapping - :rtype: ~azure.mgmt.compute.models.SharedGalleryImageVersion + :param publisher_name: A valid image publisher. Required. + :type publisher_name: str + :param offer: A valid image publisher offer. Required. + :type offer: str + :param skus: A valid image SKU. Required. + :type skus: str + :keyword expand: The expand expression to apply on the operation. Default value is None. + :paramtype expand: str + :keyword top: Default value is None. + :paramtype top: int + :keyword orderby: Default value is None. + :paramtype orderby: str + :return: list of VirtualMachineImageResource + :rtype: list[~azure.mgmt.compute.models.VirtualMachineImageResource] :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -38121,14 +37872,17 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.SharedGalleryImageVersion] = kwargs.pop("cls", None) + cls: ClsType[List[_models.VirtualMachineImageResource]] = kwargs.pop("cls", None) - _request = build_shared_gallery_image_versions_get_request( + _request = build_virtual_machine_images_list_request( location=location, - gallery_unique_name=gallery_unique_name, - gallery_image_name=gallery_image_name, - gallery_image_version_name=gallery_image_version_name, + publisher_name=publisher_name, + offer=offer, + skus=skus, subscription_id=self._config.subscription_id, + expand=expand, + top=top, + orderby=orderby, api_version=self._config.api_version, headers=_headers, params=_params, @@ -38158,148 +37912,44 @@ async def get( if _stream: deserialized = response.iter_bytes() else: - deserialized = _deserialize(_models.SharedGalleryImageVersion, response.json()) + deserialized = _deserialize(List[_models.VirtualMachineImageResource], response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - @distributed_trace - def list( + @distributed_trace_async + async def list_with_properties( self, location: str, - gallery_unique_name: str, - gallery_image_name: str, + publisher_name: str, + offer: str, + skus: str, *, - shared_to: Optional[Union[str, _models.SharedToValues]] = None, + expand: str, + top: Optional[int] = None, + orderby: Optional[str] = None, **kwargs: Any - ) -> AsyncItemPaged["_models.SharedGalleryImageVersion"]: - """List shared gallery image versions by subscription id or tenant id. - - :param location: The name of the Azure region. Required. - :type location: str - :param gallery_unique_name: The unique name of the Shared Gallery. Required. - :type gallery_unique_name: str - :param gallery_image_name: The name of the Shared Gallery Image Definition from which the Image - Versions are to be listed. Required. - :type gallery_image_name: str - :keyword shared_to: The query parameter to decide what shared galleries to fetch when doing - listing operations. "tenant" Default value is None. - :paramtype shared_to: str or ~azure.mgmt.compute.models.SharedToValues - :return: An iterator like instance of SharedGalleryImageVersion - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.models.SharedGalleryImageVersion] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[List[_models.SharedGalleryImageVersion]] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_shared_gallery_image_versions_list_request( - location=location, - gallery_unique_name=gallery_unique_name, - gallery_image_name=gallery_image_name, - subscription_id=self._config.subscription_id, - shared_to=shared_to, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - return _request - - async def extract_data(pipeline_response): - deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.SharedGalleryImageVersion], deserialized.get("value", [])) - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.get("nextLink") or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.CloudError, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - -class CommunityGalleriesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.compute.aio.ComputeClient`'s - :attr:`community_galleries` attribute. - """ - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ComputeClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace_async - async def get(self, location: str, public_gallery_name: str, **kwargs: Any) -> _models.CommunityGallery: - """Get a community gallery by gallery public name. + ) -> List[_models.VirtualMachineImage]: + """list_with_properties. - :param location: The name of the Azure region. Required. + :param location: The location name. Required. :type location: str - :param public_gallery_name: The public name of the community gallery. Required. - :type public_gallery_name: str - :return: CommunityGallery. The CommunityGallery is compatible with MutableMapping - :rtype: ~azure.mgmt.compute.models.CommunityGallery + :param publisher_name: A valid image publisher. Required. + :type publisher_name: str + :param offer: A valid image publisher offer. Required. + :type offer: str + :param skus: A valid image SKU. Required. + :type skus: str + :keyword expand: The expand expression to apply on the operation. Required. + :paramtype expand: str + :keyword top: Default value is None. + :paramtype top: int + :keyword orderby: Default value is None. + :paramtype orderby: str + :return: list of VirtualMachineImage + :rtype: list[~azure.mgmt.compute.models.VirtualMachineImage] :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -38313,12 +37963,17 @@ async def get(self, location: str, public_gallery_name: str, **kwargs: Any) -> _ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.CommunityGallery] = kwargs.pop("cls", None) + cls: ClsType[List[_models.VirtualMachineImage]] = kwargs.pop("cls", None) - _request = build_community_galleries_get_request( + _request = build_virtual_machine_images_list_with_properties_request( location=location, - public_gallery_name=public_gallery_name, + publisher_name=publisher_name, + offer=offer, + skus=skus, subscription_id=self._config.subscription_id, + expand=expand, + top=top, + orderby=orderby, api_version=self._config.api_version, headers=_headers, params=_params, @@ -38348,45 +38003,31 @@ async def get(self, location: str, public_gallery_name: str, **kwargs: Any) -> _ if _stream: deserialized = response.iter_bytes() else: - deserialized = _deserialize(_models.CommunityGallery, response.json()) + deserialized = _deserialize(List[_models.VirtualMachineImage], response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - -class CommunityGalleryImagesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.compute.aio.ComputeClient`'s - :attr:`community_gallery_images` attribute. - """ - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ComputeClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace_async async def get( - self, location: str, public_gallery_name: str, gallery_image_name: str, **kwargs: Any - ) -> _models.CommunityGalleryImage: - """Get a community gallery image. + 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 the Azure region. Required. :type location: str - :param public_gallery_name: The public name of the community gallery. Required. - :type public_gallery_name: str - :param gallery_image_name: The name of the community gallery image definition. Required. - :type gallery_image_name: str - :return: CommunityGalleryImage. The CommunityGalleryImage is compatible with MutableMapping - :rtype: ~azure.mgmt.compute.models.CommunityGalleryImage + :param publisher_name: A valid image publisher. Required. + :type publisher_name: str + :param offer: A valid image publisher offer. Required. + :type offer: str + :param skus: A valid image SKU. Required. + :type skus: str + :param version: A valid image SKU version. Required. + :type version: str + :return: VirtualMachineImage. The VirtualMachineImage is compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.VirtualMachineImage :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -38400,12 +38041,14 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.CommunityGalleryImage] = kwargs.pop("cls", None) + cls: ClsType[_models.VirtualMachineImage] = kwargs.pop("cls", None) - _request = build_community_gallery_images_get_request( + _request = build_virtual_machine_images_get_request( location=location, - public_gallery_name=public_gallery_name, - gallery_image_name=gallery_image_name, + publisher_name=publisher_name, + offer=offer, + skus=skus, + version=version, subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -38436,115 +38079,22 @@ async def get( if _stream: deserialized = response.iter_bytes() else: - deserialized = _deserialize(_models.CommunityGalleryImage, response.json()) + deserialized = _deserialize(_models.VirtualMachineImage, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - @distributed_trace - def list( - self, location: str, public_gallery_name: str, **kwargs: Any - ) -> AsyncItemPaged["_models.CommunityGalleryImage"]: - """List community gallery images inside a gallery. - - :param location: The name of the Azure region. Required. - :type location: str - :param public_gallery_name: The public name of the community gallery. Required. - :type public_gallery_name: str - :return: An iterator like instance of CommunityGalleryImage - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.models.CommunityGalleryImage] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[List[_models.CommunityGalleryImage]] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_community_gallery_images_list_request( - location=location, - public_gallery_name=public_gallery_name, - subscription_id=self._config.subscription_id, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - return _request - - async def extract_data(pipeline_response): - deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.CommunityGalleryImage], deserialized.get("value", [])) - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.get("nextLink") or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.CloudError, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - -class CommunityGalleryImageVersionsOperations: +class LogAnalyticsOperations: """ .. warning:: **DO NOT** instantiate this class directly. Instead, you should access the following operations through :class:`~azure.mgmt.compute.aio.ComputeClient`'s - :attr:`community_gallery_image_versions` attribute. + :attr:`log_analytics` attribute. """ def __init__(self, *args, **kwargs) -> None: @@ -38554,33 +38104,9 @@ def __init__(self, *args, **kwargs) -> None: self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace_async - async def get( - self, - location: str, - public_gallery_name: str, - gallery_image_name: str, - gallery_image_version_name: str, - **kwargs: Any - ) -> _models.CommunityGalleryImageVersion: - """Get a community gallery image version. - - :param location: The name of the Azure region. Required. - :type location: str - :param public_gallery_name: The public name of the community gallery. Required. - :type public_gallery_name: str - :param gallery_image_name: The name of the community gallery image definition. Required. - :type gallery_image_name: str - :param gallery_image_version_name: The name of the community gallery image version. Needs to - follow semantic version name pattern: The allowed characters are digit and period. Digits must - be within the range of a 32-bit integer. Format: ... - Required. - :type gallery_image_version_name: str - :return: CommunityGalleryImageVersion. The CommunityGalleryImageVersion is compatible with - MutableMapping - :rtype: ~azure.mgmt.compute.models.CommunityGalleryImageVersion - :raises ~azure.core.exceptions.HttpResponseError: - """ + async def _export_request_rate_by_interval_initial( + self, location: str, parameters: Union[_models.RequestRateByIntervalInput, JSON, IO[bytes]], **kwargs: Any + ) -> AsyncIterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -38589,18 +38115,25 @@ async def get( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.CommunityGalleryImageVersion] = kwargs.pop("cls", None) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - _request = build_community_gallery_image_versions_get_request( + content_type = content_type or "application/json" + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_log_analytics_export_request_rate_by_interval_request( location=location, - public_gallery_name=public_gallery_name, - gallery_image_name=gallery_image_name, - gallery_image_version_name=gallery_image_version_name, subscription_id=self._config.subscription_id, + content_type=content_type, api_version=self._config.api_version, + content=_content, headers=_headers, params=_params, ) @@ -38609,55 +38142,185 @@ async def get( } _request.url = self._client.format_url(_request.url, **path_format_arguments) - _stream = kwargs.pop("stream", False) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200]: - if _stream: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass + if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = _failsafe_deserialize(_models.CloudError, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if _stream: - deserialized = response.iter_bytes() - else: - deserialized = _deserialize(_models.CommunityGalleryImageVersion, response.json()) + response_headers = {} + if response.status_code == 202: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore - @distributed_trace - def list( - self, location: str, public_gallery_name: str, gallery_image_name: str, **kwargs: Any - ) -> AsyncItemPaged["_models.CommunityGalleryImageVersion"]: - """List community gallery image versions inside an image. + @overload + async def begin_export_request_rate_by_interval( + self, + location: str, + parameters: _models.RequestRateByIntervalInput, + *, + content_type: str = "application/json", + **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 name of the Azure region. Required. + :param location: The location name. Required. :type location: str - :param public_gallery_name: The public name of the community gallery. Required. - :type public_gallery_name: str - :param gallery_image_name: The name of the community gallery image definition. Required. - :type gallery_image_name: str - :return: An iterator like instance of CommunityGalleryImageVersion + :param parameters: Parameters supplied to the LogAnalytics getRequestRateByInterval Api. + Required. + :type parameters: ~azure.mgmt.compute.models.RequestRateByIntervalInput + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns LogAnalyticsOperationResult. The + LogAnalyticsOperationResult is compatible with MutableMapping :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.models.CommunityGalleryImageVersion] + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.LogAnalyticsOperationResult] :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = kwargs.pop("headers", {}) or {} + + @overload + async def begin_export_request_rate_by_interval( + self, location: str, parameters: JSON, *, content_type: str = "application/json", **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 name. Required. + :type location: str + :param parameters: Parameters supplied to the LogAnalytics getRequestRateByInterval Api. + Required. + :type parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns LogAnalyticsOperationResult. The + LogAnalyticsOperationResult is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.LogAnalyticsOperationResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_export_request_rate_by_interval( + self, location: str, parameters: IO[bytes], *, content_type: str = "application/json", **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 name. Required. + :type location: str + :param parameters: Parameters supplied to the LogAnalytics getRequestRateByInterval Api. + Required. + :type parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns LogAnalyticsOperationResult. The + LogAnalyticsOperationResult is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.LogAnalyticsOperationResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_export_request_rate_by_interval( + self, location: str, parameters: Union[_models.RequestRateByIntervalInput, JSON, IO[bytes]], **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 name. Required. + :type location: str + :param parameters: Parameters supplied to the LogAnalytics getRequestRateByInterval Api. Is one + of the following types: RequestRateByIntervalInput, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.compute.models.RequestRateByIntervalInput or JSON or IO[bytes] + :return: An instance of AsyncLROPoller that returns LogAnalyticsOperationResult. The + LogAnalyticsOperationResult is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.LogAnalyticsOperationResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.CommunityGalleryImageVersion]] = kwargs.pop("cls", None) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.LogAnalyticsOperationResult] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._export_request_rate_by_interval_initial( + location=location, + parameters=parameters, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = _deserialize(_models.LogAnalyticsOperationResult, response.json()) + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.LogAnalyticsOperationResult].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.LogAnalyticsOperationResult]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + async def _export_throttled_requests_initial( + self, location: str, parameters: Union[_models.ThrottledRequestsInput, JSON, IO[bytes]], **kwargs: Any + ) -> AsyncIterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -38666,183 +38329,205 @@ def list( } error_map.update(kwargs.pop("error_map", {}) or {}) - def prepare_request(next_link=None): - if not next_link: - - _request = build_community_gallery_image_versions_list_request( - location=location, - public_gallery_name=public_gallery_name, - gallery_image_name=gallery_image_name, - subscription_id=self._config.subscription_id, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - return _request + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} - async def extract_data(pipeline_response): - deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.CommunityGalleryImageVersion], deserialized.get("value", [])) - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - async def get_next(next_link=None): - _request = prepare_request(next_link) + content_type = content_type or "application/json" + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response + _request = build_log_analytics_export_throttled_requests_request( + location=location, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.CloudError, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) - return pipeline_response + response = pipeline_response.http_response - return AsyncItemPaged(get_next, extract_data) + if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) -class ResourceSkusOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. + deserialized = response.iter_bytes() - Instead, you should access the following operations through - :class:`~azure.mgmt.compute.aio.ComputeClient`'s - :attr:`resource_skus` attribute. - """ + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ComputeClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + return deserialized # type: ignore - @distributed_trace - def list( - self, *, filter: Optional[str] = None, include_extended_locations: Optional[str] = None, **kwargs: Any - ) -> AsyncItemPaged["_models.ResourceSku"]: - """Gets the list of Microsoft.Compute SKUs available for your Subscription. + @overload + async def begin_export_throttled_requests( + self, + location: str, + parameters: _models.ThrottledRequestsInput, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.LogAnalyticsOperationResult]: + """Export logs that show total throttled Api requests for this subscription in the given time + window. - :keyword filter: The filter to apply on the operation. Only **location** filter is supported - currently. Default value is None. - :paramtype filter: str - :keyword include_extended_locations: To Include Extended Locations information or not in the - response. Default value is None. - :paramtype include_extended_locations: str - :return: An iterator like instance of ResourceSku - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.models.ResourceSku] + :param location: The location name. Required. + :type location: str + :param parameters: The request body. Required. + :type parameters: ~azure.mgmt.compute.models.ThrottledRequestsInput + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns LogAnalyticsOperationResult. The + LogAnalyticsOperationResult is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.LogAnalyticsOperationResult] :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[List[_models.ResourceSku]] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - def prepare_request(next_link=None): - if not next_link: + @overload + async def begin_export_throttled_requests( + self, location: str, parameters: JSON, *, content_type: str = "application/json", **kwargs: Any + ) -> AsyncLROPoller[_models.LogAnalyticsOperationResult]: + """Export logs that show total throttled Api requests for this subscription in the given time + window. - _request = build_resource_skus_list_request( - subscription_id=self._config.subscription_id, - filter=filter, - include_extended_locations=include_extended_locations, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) + :param location: The location name. Required. + :type location: str + :param parameters: The request body. Required. + :type parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns LogAnalyticsOperationResult. The + LogAnalyticsOperationResult is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.LogAnalyticsOperationResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) + @overload + async def begin_export_throttled_requests( + self, location: str, parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any + ) -> AsyncLROPoller[_models.LogAnalyticsOperationResult]: + """Export logs that show total throttled Api requests for this subscription in the given time + window. - return _request + :param location: The location name. Required. + :type location: str + :param parameters: The request body. Required. + :type parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns LogAnalyticsOperationResult. The + LogAnalyticsOperationResult is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.LogAnalyticsOperationResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ - async def extract_data(pipeline_response): - deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.ResourceSku], deserialized.get("value", [])) - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + @distributed_trace_async + async def begin_export_throttled_requests( + self, location: str, parameters: Union[_models.ThrottledRequestsInput, JSON, IO[bytes]], **kwargs: Any + ) -> AsyncLROPoller[_models.LogAnalyticsOperationResult]: + """Export logs that show total throttled Api requests for this subscription in the given time + window. - async def get_next(next_link=None): - _request = prepare_request(next_link) + :param location: The location name. Required. + :type location: str + :param parameters: The request body. Is one of the following types: ThrottledRequestsInput, + JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.compute.models.ThrottledRequestsInput or JSON or IO[bytes] + :return: An instance of AsyncLROPoller that returns LogAnalyticsOperationResult. The + LogAnalyticsOperationResult is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.LogAnalyticsOperationResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.LogAnalyticsOperationResult] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._export_throttled_requests_initial( + location=location, + parameters=parameters, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response_headers = {} response = pipeline_response.http_response + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = _deserialize(_models.LogAnalyticsOperationResult, response.json()) + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + return deserialized - return pipeline_response + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } - return AsyncItemPaged(get_next, extract_data) + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.LogAnalyticsOperationResult].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.LogAnalyticsOperationResult]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) class DiskRestorePointOperations: @@ -39388,7 +39073,7 @@ async def begin_revoke_access( vm_restore_point_name: str, disk_restore_point_name: str, **kwargs: Any - ) -> AsyncLROPoller[_models.OkResponse]: + ) -> AsyncLROPoller[None]: """Revokes access to a diskRestorePoint. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -39402,15 +39087,14 @@ async def begin_revoke_access( :type vm_restore_point_name: str :param disk_restore_point_name: The name of the DiskRestorePoint. Required. :type disk_restore_point_name: str - :return: An instance of AsyncLROPoller that returns OkResponse. The OkResponse is compatible - with MutableMapping - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.OkResponse] + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.OkResponse] = kwargs.pop("cls", None) + cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) @@ -39428,15 +39112,375 @@ async def begin_revoke_access( await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): - response_headers = {} + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + +class SoftDeletedResourceOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.compute.aio.ComputeClient`'s + :attr:`soft_deleted_resource` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list_by_artifact_name( + self, resource_group_name: str, gallery_name: str, artifact_type: str, artifact_name: str, **kwargs: Any + ) -> AsyncItemPaged["_models.GallerySoftDeletedResource"]: + """List soft-deleted resources of an artifact in the gallery, such as soft-deleted gallery image + version of an image. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param artifact_type: The type of the artifact to be listed, such as gallery image version. + Required. + :type artifact_type: str + :param artifact_name: The artifact name to be listed. If artifact type is Images, then the + artifact name should be the gallery image name. Required. + :type artifact_name: str + :return: An iterator like instance of GallerySoftDeletedResource + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.models.GallerySoftDeletedResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.GallerySoftDeletedResource]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_soft_deleted_resource_list_by_artifact_name_request( + resource_group_name=resource_group_name, + gallery_name=gallery_name, + artifact_type=artifact_type, + artifact_name=artifact_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.GallerySoftDeletedResource], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + +class GallerySharingProfileOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.compute.aio.ComputeClient`'s + :attr:`gallery_sharing_profile` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + async def _update_initial( + self, + resource_group_name: str, + gallery_name: str, + sharing_update: Union[_models.SharingUpdate, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(sharing_update, (IOBase, bytes)): + _content = sharing_update + else: + _content = json.dumps(sharing_update, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_gallery_sharing_profile_update_request( + resource_group_name=resource_group_name, + gallery_name=gallery_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - deserialized = _deserialize(_models.OkResponse, response.json()) + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_update( + self, + resource_group_name: str, + gallery_name: str, + sharing_update: _models.SharingUpdate, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.SharingUpdate]: + """Update sharing profile of a gallery. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param sharing_update: Parameters supplied to the update gallery sharing profile. Required. + :type sharing_update: ~azure.mgmt.compute.models.SharingUpdate + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns SharingUpdate. The SharingUpdate is + compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.SharingUpdate] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update( + self, + resource_group_name: str, + gallery_name: str, + sharing_update: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.SharingUpdate]: + """Update sharing profile of a gallery. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param sharing_update: Parameters supplied to the update gallery sharing profile. Required. + :type sharing_update: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns SharingUpdate. The SharingUpdate is + compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.SharingUpdate] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update( + self, + resource_group_name: str, + gallery_name: str, + sharing_update: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.SharingUpdate]: + """Update sharing profile of a gallery. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param sharing_update: Parameters supplied to the update gallery sharing profile. Required. + :type sharing_update: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns SharingUpdate. The SharingUpdate is + compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.SharingUpdate] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_update( + self, + resource_group_name: str, + gallery_name: str, + sharing_update: Union[_models.SharingUpdate, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.SharingUpdate]: + """Update sharing profile of a gallery. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param sharing_update: Parameters supplied to the update gallery sharing profile. Is one of the + following types: SharingUpdate, JSON, IO[bytes] Required. + :type sharing_update: ~azure.mgmt.compute.models.SharingUpdate or JSON or IO[bytes] + :return: An instance of AsyncLROPoller that returns SharingUpdate. The SharingUpdate is + compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.models.SharingUpdate] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SharingUpdate] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._update_initial( + resource_group_name=resource_group_name, + gallery_name=gallery_name, + sharing_update=sharing_update, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.SharingUpdate, response.json()) if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized path_format_arguments = { @@ -39452,12 +39496,12 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller[_models.OkResponse].from_continuation_token( + return AsyncLROPoller[_models.SharingUpdate].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller[_models.OkResponse]( + return AsyncLROPoller[_models.SharingUpdate]( self._client, raw_result, get_long_running_output, polling_method # type: ignore ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/models/__init__.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/models/__init__.py index 8c17bc4732c2..45f6fffc841d 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/models/__init__.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/models/__init__.py @@ -204,6 +204,8 @@ LinuxPatchSettings, LinuxVMGuestPatchAutomaticByPlatformSettings, LogAnalyticsInputBase, + LogAnalyticsOperationResult, + LogAnalyticsOutput, MaintenanceRedeployStatus, ManagedDiskParameters, MaxInstancePercentPerZonePolicy, @@ -220,7 +222,6 @@ OSImageNotificationProfile, OSProfile, OSProfileProvisioningData, - OkResponse, Operation, OperationDisplay, OrchestrationServiceStateInput, @@ -399,6 +400,7 @@ VirtualMachineExtensionProperties, VirtualMachineExtensionUpdate, VirtualMachineExtensionUpdateProperties, + VirtualMachineExtensionsListResult, VirtualMachineHealthStatus, VirtualMachineIdentity, VirtualMachineImage, @@ -470,6 +472,7 @@ VirtualMachineScaleSetVM, VirtualMachineScaleSetVMExtension, VirtualMachineScaleSetVMExtensionUpdate, + VirtualMachineScaleSetVMExtensionsListResult, VirtualMachineScaleSetVMExtensionsSummary, VirtualMachineScaleSetVMInstanceIDs, VirtualMachineScaleSetVMInstanceRequiredIDs, @@ -572,7 +575,6 @@ OrchestrationServiceState, OrchestrationServiceStateAction, Origin, - PassNames, PatchAssessmentState, PatchInstallationState, PatchOperationStatus, @@ -839,6 +841,8 @@ "LinuxPatchSettings", "LinuxVMGuestPatchAutomaticByPlatformSettings", "LogAnalyticsInputBase", + "LogAnalyticsOperationResult", + "LogAnalyticsOutput", "MaintenanceRedeployStatus", "ManagedDiskParameters", "MaxInstancePercentPerZonePolicy", @@ -855,7 +859,6 @@ "OSImageNotificationProfile", "OSProfile", "OSProfileProvisioningData", - "OkResponse", "Operation", "OperationDisplay", "OrchestrationServiceStateInput", @@ -1034,6 +1037,7 @@ "VirtualMachineExtensionProperties", "VirtualMachineExtensionUpdate", "VirtualMachineExtensionUpdateProperties", + "VirtualMachineExtensionsListResult", "VirtualMachineHealthStatus", "VirtualMachineIdentity", "VirtualMachineImage", @@ -1105,6 +1109,7 @@ "VirtualMachineScaleSetVM", "VirtualMachineScaleSetVMExtension", "VirtualMachineScaleSetVMExtensionUpdate", + "VirtualMachineScaleSetVMExtensionsListResult", "VirtualMachineScaleSetVMExtensionsSummary", "VirtualMachineScaleSetVMInstanceIDs", "VirtualMachineScaleSetVMInstanceRequiredIDs", @@ -1204,7 +1209,6 @@ "OrchestrationServiceState", "OrchestrationServiceStateAction", "Origin", - "PassNames", "PatchAssessmentState", "PatchInstallationState", "PatchOperationStatus", diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/models/_enums.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/models/_enums.py index 6d51b88a9255..3528b1b2b346 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/models/_enums.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/models/_enums.py @@ -825,12 +825,6 @@ class Origin(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Indicates the operation is initiated by a user or system.""" -class PassNames(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Type of PassNames.""" - - OOBE_SYSTEM = "OobeSystem" - - class PatchAssessmentState(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Describes the availability of a given patch.""" diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/models/_models.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/models/_models.py index 344a92d3b45c..e6e8239dbc90 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/models/_models.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/models/_models.py @@ -334,8 +334,9 @@ class AdditionalUnattendContent(_Model): 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. "OobeSystem" - :vartype pass_name: str or ~azure.mgmt.compute.models.PassNames + :ivar pass_name: The pass name. Currently, the only allowable value is OobeSystem. Default + value is "OobeSystem". + :vartype pass_name: str :ivar component_name: The component name. Currently, the only allowable value is Microsoft-Windows-Shell-Setup. Default value is "Microsoft-Windows-Shell-Setup". :vartype component_name: str @@ -349,10 +350,11 @@ class AdditionalUnattendContent(_Model): :vartype content: str """ - pass_name: Optional[Union[str, "_models.PassNames"]] = rest_field( + pass_name: Optional[Literal["OobeSystem"]] = rest_field( name="passName", visibility=["read", "create", "update", "delete", "query"] ) - """The pass name. Currently, the only allowable value is OobeSystem. \"OobeSystem\"""" + """The pass name. Currently, the only allowable value is OobeSystem. Default value is + \"OobeSystem\".""" component_name: Optional[Literal["Microsoft-Windows-Shell-Setup"]] = rest_field( name="componentName", visibility=["read", "create", "update", "delete", "query"] ) @@ -372,7 +374,7 @@ class AdditionalUnattendContent(_Model): def __init__( self, *, - pass_name: Optional[Union[str, "_models.PassNames"]] = None, + pass_name: Optional[Literal["OobeSystem"]] = None, component_name: Optional[Literal["Microsoft-Windows-Shell-Setup"]] = None, setting_name: Optional[Union[str, "_models.SettingNames"]] = None, content: Optional[str] = None, @@ -10922,6 +10924,28 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) +class LogAnalyticsOperationResult(_Model): + """LogAnalytics operation status response. + + :ivar properties: LogAnalyticsOutput. + :vartype properties: ~azure.mgmt.compute.models.LogAnalyticsOutput + """ + + properties: Optional["_models.LogAnalyticsOutput"] = rest_field(visibility=["read"]) + """LogAnalyticsOutput.""" + + +class LogAnalyticsOutput(_Model): + """LogAnalytics output properties. + + :ivar output: Output file Uri path to blob container. + :vartype output: str + """ + + output: Optional[str] = rest_field(visibility=["read"]) + """Output file Uri path to blob container.""" + + class MaintenanceRedeployStatus(_Model): """Maintenance Operation Status. @@ -11345,10 +11369,6 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class OkResponse(_Model): - """The request has succeeded.""" - - class Operation(_Model): """REST API Operation. @@ -13403,21 +13423,20 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: class ReimageParameterBody1(_Model): """ReimageParameterBody1. - :ivar vm_scale_set_vm_reimage_input: Parameters for the Reimaging Virtual machine in ScaleSet. - :vartype vm_scale_set_vm_reimage_input: - ~azure.mgmt.compute.models.VirtualMachineScaleSetVMReimageParameters + :ivar parameters: Parameters supplied to the Reimage Virtual Machine operation. + :vartype parameters: ~azure.mgmt.compute.models.VirtualMachineReimageParameters """ - vm_scale_set_vm_reimage_input: Optional["_models.VirtualMachineScaleSetVMReimageParameters"] = rest_field( - name="vmScaleSetVMReimageInput", visibility=["read", "create", "update", "delete", "query"] + parameters: Optional["_models.VirtualMachineReimageParameters"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] ) - """Parameters for the Reimaging Virtual machine in ScaleSet.""" + """Parameters supplied to the Reimage Virtual Machine operation.""" @overload def __init__( self, *, - vm_scale_set_vm_reimage_input: Optional["_models.VirtualMachineScaleSetVMReimageParameters"] = None, + parameters: Optional["_models.VirtualMachineReimageParameters"] = None, ) -> None: ... @overload @@ -13434,20 +13453,21 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: class ReimageParameterBody2(_Model): """ReimageParameterBody2. - :ivar parameters: Parameters supplied to the Reimage Virtual Machine operation. - :vartype parameters: ~azure.mgmt.compute.models.VirtualMachineReimageParameters + :ivar vm_scale_set_vm_reimage_input: Parameters for the Reimaging Virtual machine in ScaleSet. + :vartype vm_scale_set_vm_reimage_input: + ~azure.mgmt.compute.models.VirtualMachineScaleSetVMReimageParameters """ - parameters: Optional["_models.VirtualMachineReimageParameters"] = rest_field( - visibility=["read", "create", "update", "delete", "query"] + vm_scale_set_vm_reimage_input: Optional["_models.VirtualMachineScaleSetVMReimageParameters"] = rest_field( + name="vmScaleSetVMReimageInput", visibility=["read", "create", "update", "delete", "query"] ) - """Parameters supplied to the Reimage Virtual Machine operation.""" + """Parameters for the Reimaging Virtual machine in ScaleSet.""" @overload def __init__( self, *, - parameters: Optional["_models.VirtualMachineReimageParameters"] = None, + vm_scale_set_vm_reimage_input: Optional["_models.VirtualMachineScaleSetVMReimageParameters"] = None, ) -> None: ... @overload @@ -19441,6 +19461,36 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) +class VirtualMachineExtensionsListResult(_Model): + """The List Extension operation response. + + :ivar value: The list of extensions. + :vartype value: list[~azure.mgmt.compute.models.VirtualMachineExtension] + """ + + value: Optional[list["_models.VirtualMachineExtension"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The list of extensions.""" + + @overload + def __init__( + self, + *, + value: Optional[list["_models.VirtualMachineExtension"]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + class VirtualMachineExtensionUpdate(UpdateResource): """Describes a Virtual Machine Extension. @@ -25143,6 +25193,36 @@ def __setattr__(self, key: str, value: Any) -> None: super().__setattr__(key, value) +class VirtualMachineScaleSetVMExtensionsListResult(_Model): # pylint: disable=name-too-long + """The List VMSS VM Extension operation response. + + :ivar value: The list of VMSS VM extensions. + :vartype value: list[~azure.mgmt.compute.models.VirtualMachineScaleSetVMExtension] + """ + + value: Optional[list["_models.VirtualMachineScaleSetVMExtension"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The list of VMSS VM extensions.""" + + @overload + def __init__( + self, + *, + value: Optional[list["_models.VirtualMachineScaleSetVMExtension"]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + class VirtualMachineScaleSetVMExtensionsSummary(_Model): # pylint: disable=name-too-long """Extensions summary for virtual machines of a virtual machine scale set. diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/operations/__init__.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/operations/__init__.py index 1480dc504db2..21db92def68b 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/operations/__init__.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/operations/__init__.py @@ -14,9 +14,7 @@ from ._operations import Operations # type: ignore from ._operations import VirtualMachineScaleSetsOperations # type: ignore -from ._operations import RollingUpgradeStatusInfosOperations # type: ignore from ._operations import VirtualMachineScaleSetExtensionsOperations # type: ignore -from ._operations import VirtualMachineScaleSetVMSOperations # type: ignore from ._operations import VirtualMachineScaleSetVMExtensionsOperations # type: ignore from ._operations import VirtualMachinesOperations # type: ignore from ._operations import VirtualMachineExtensionsOperations # type: ignore @@ -25,7 +23,6 @@ from ._operations import ProximityPlacementGroupsOperations # type: ignore from ._operations import DedicatedHostGroupsOperations # type: ignore from ._operations import DedicatedHostsOperations # type: ignore -from ._operations import SshPublicKeyResourcesOperations # type: ignore from ._operations import ImagesOperations # type: ignore from ._operations import RestorePointCollectionsOperations # type: ignore from ._operations import RestorePointsOperations # type: ignore @@ -33,17 +30,8 @@ from ._operations import CapacityReservationsOperations # type: ignore from ._operations import VirtualMachineRunCommandsOperations # type: ignore from ._operations import VirtualMachineScaleSetVMRunCommandsOperations # type: ignore -from ._operations import UsageOperationGroupOperations # type: ignore -from ._operations import VirtualMachineSizesOperationGroupOperations # type: ignore -from ._operations import VirtualMachineScaleSetsOperationGroupOperations # type: ignore -from ._operations import VirtualMachinesOperationGroupOperations # type: ignore -from ._operations import VirtualMachineImagesEdgeZoneOperationGroupOperations # type: ignore -from ._operations import VirtualMachineImagesOperationGroupOperations # type: ignore -from ._operations import LogAnalyticsOperationGroupOperations # type: ignore -from ._operations import VirtualMachineRunCommandsOperationGroupOperations # type: ignore from ._operations import DisksOperations # type: ignore from ._operations import DiskAccessesOperations # type: ignore -from ._operations import PrivateEndpointConnectionsOperations # type: ignore from ._operations import DiskEncryptionSetsOperations # type: ignore from ._operations import SnapshotsOperations # type: ignore from ._operations import GalleriesOperations # type: ignore @@ -60,7 +48,17 @@ from ._operations import CommunityGalleryImagesOperations # type: ignore from ._operations import CommunityGalleryImageVersionsOperations # type: ignore from ._operations import ResourceSkusOperations # type: ignore +from ._operations import VirtualMachineScaleSetRollingUpgradesOperations # type: ignore +from ._operations import VirtualMachineScaleSetVMsOperations # type: ignore +from ._operations import SshPublicKeysOperations # type: ignore +from ._operations import UsageOperations # type: ignore +from ._operations import VirtualMachineSizesOperations # type: ignore +from ._operations import VirtualMachineImagesEdgeZoneOperations # type: ignore +from ._operations import VirtualMachineImagesOperations # type: ignore +from ._operations import LogAnalyticsOperations # type: ignore from ._operations import DiskRestorePointOperations # type: ignore +from ._operations import SoftDeletedResourceOperations # type: ignore +from ._operations import GallerySharingProfileOperations # type: ignore from ._patch import __all__ as _patch_all from ._patch import * @@ -69,9 +67,7 @@ __all__ = [ "Operations", "VirtualMachineScaleSetsOperations", - "RollingUpgradeStatusInfosOperations", "VirtualMachineScaleSetExtensionsOperations", - "VirtualMachineScaleSetVMSOperations", "VirtualMachineScaleSetVMExtensionsOperations", "VirtualMachinesOperations", "VirtualMachineExtensionsOperations", @@ -80,7 +76,6 @@ "ProximityPlacementGroupsOperations", "DedicatedHostGroupsOperations", "DedicatedHostsOperations", - "SshPublicKeyResourcesOperations", "ImagesOperations", "RestorePointCollectionsOperations", "RestorePointsOperations", @@ -88,17 +83,8 @@ "CapacityReservationsOperations", "VirtualMachineRunCommandsOperations", "VirtualMachineScaleSetVMRunCommandsOperations", - "UsageOperationGroupOperations", - "VirtualMachineSizesOperationGroupOperations", - "VirtualMachineScaleSetsOperationGroupOperations", - "VirtualMachinesOperationGroupOperations", - "VirtualMachineImagesEdgeZoneOperationGroupOperations", - "VirtualMachineImagesOperationGroupOperations", - "LogAnalyticsOperationGroupOperations", - "VirtualMachineRunCommandsOperationGroupOperations", "DisksOperations", "DiskAccessesOperations", - "PrivateEndpointConnectionsOperations", "DiskEncryptionSetsOperations", "SnapshotsOperations", "GalleriesOperations", @@ -115,7 +101,17 @@ "CommunityGalleryImagesOperations", "CommunityGalleryImageVersionsOperations", "ResourceSkusOperations", + "VirtualMachineScaleSetRollingUpgradesOperations", + "VirtualMachineScaleSetVMsOperations", + "SshPublicKeysOperations", + "UsageOperations", + "VirtualMachineSizesOperations", + "VirtualMachineImagesEdgeZoneOperations", + "VirtualMachineImagesOperations", + "LogAnalyticsOperations", "DiskRestorePointOperations", + "SoftDeletedResourceOperations", + "GallerySharingProfileOperations", ] __all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/operations/_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/operations/_operations.py index 171d3f1def5b..2043cb689a37 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/operations/_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/operations/_operations.py @@ -802,72 +802,6 @@ def build_virtual_machine_scale_sets_start_request( # pylint: disable=name-too- return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_virtual_machine_scale_sets_start_extension_upgrade_request( # pylint: disable=name-too-long - resource_group_name: str, vm_scale_set_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensionRollingUpgrade" - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - return HttpRequest(method="POST", url=_url, params=_params, **kwargs) - - -def build_virtual_machine_scale_sets_start_os_upgrade_request( # pylint: disable=name-too-long - resource_group_name: str, vm_scale_set_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/osRollingUpgrade" - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - return HttpRequest(method="POST", url=_url, params=_params, **kwargs) - - -def build_virtual_machine_scale_sets_cancel_request( # pylint: disable=name-too-long - resource_group_name: str, vm_scale_set_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/rollingUpgrades/cancel" - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - return HttpRequest(method="POST", url=_url, params=_params, **kwargs) - - def build_virtual_machine_scale_sets_scale_out_request( # pylint: disable=name-too-long resource_group_name: str, vm_scale_set_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: @@ -896,8 +830,8 @@ def build_virtual_machine_scale_sets_scale_out_request( # pylint: disable=name- return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_rolling_upgrade_status_infos_get_latest_request( # pylint: disable=name-too-long - resource_group_name: str, vm_scale_set_name: str, subscription_id: str, **kwargs: Any +def build_virtual_machine_scale_sets_list_by_location_request( # pylint: disable=name-too-long + location: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -906,11 +840,10 @@ def build_rolling_upgrade_status_infos_get_latest_request( # pylint: disable=na accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/rollingUpgrades/latest" + _url = "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/virtualMachineScaleSets" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), + "location": _SERIALIZER.url("location", location, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -1076,13 +1009,14 @@ def build_virtual_machine_scale_set_extensions_list_request( # pylint: disable= return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_virtual_machine_scale_set_vms_get_request( # pylint: disable=name-too-long +def build_virtual_machine_scale_set_vm_extensions_get_request( # pylint: disable=name-too-long resource_group_name: str, vm_scale_set_name: str, instance_id: str, + vm_extension_name: str, subscription_id: str, *, - expand: Optional[Union[str, _models.InstanceViewTypes]] = None, + expand: Optional[str] = None, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -1092,12 +1026,13 @@ def build_virtual_machine_scale_set_vms_get_request( # pylint: disable=name-too accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}" + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/extensions/{vmExtensionName}" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", 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"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -1113,14 +1048,12 @@ def build_virtual_machine_scale_set_vms_get_request( # pylint: disable=name-too return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_virtual_machine_scale_set_vms_update_request( # pylint: disable=name-too-long +def build_virtual_machine_scale_set_vm_extensions_create_or_update_request( # pylint: disable=name-too-long resource_group_name: str, vm_scale_set_name: str, instance_id: str, + vm_extension_name: str, subscription_id: str, - *, - etag: Optional[str] = None, - match_condition: Optional[MatchConditions] = None, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -1131,12 +1064,13 @@ def build_virtual_machine_scale_set_vms_update_request( # pylint: disable=name- accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}" + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/extensions/{vmExtensionName}" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", 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"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -1148,98 +1082,94 @@ def build_virtual_machine_scale_set_vms_update_request( # pylint: disable=name- if content_type is not None: _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - if_match = prep_if_match(etag, match_condition) - if if_match is not None: - _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") - if_none_match = prep_if_none_match(etag, match_condition) - if if_none_match is not None: - _headers["If-None-Match"] = _SERIALIZER.header("if_none_match", if_none_match, "str") return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) -def build_virtual_machine_scale_set_vms_delete_request( # pylint: disable=name-too-long +def build_virtual_machine_scale_set_vm_extensions_update_request( # pylint: disable=name-too-long resource_group_name: str, vm_scale_set_name: str, instance_id: str, + vm_extension_name: str, subscription_id: str, - *, - force_deletion: Optional[bool] = None, **kwargs: Any ) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + accept = _headers.pop("Accept", "application/json") + # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}" + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/extensions/{vmExtensionName}" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", 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"), } _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if force_deletion is not None: - _params["forceDeletion"] = _SERIALIZER.query("force_deletion", force_deletion, "bool") - return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) -def build_virtual_machine_scale_set_vms_list_request( # pylint: disable=name-too-long + +def build_virtual_machine_scale_set_vm_extensions_delete_request( # pylint: disable=name-too-long resource_group_name: str, - virtual_machine_scale_set_name: str, + vm_scale_set_name: str, + instance_id: str, + vm_extension_name: str, subscription_id: str, - *, - filter: Optional[str] = None, - select: Optional[str] = None, - expand: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - accept = _headers.pop("Accept", "application/json") - # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{virtualMachineScaleSetName}/virtualMachines" + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/extensions/{vmExtensionName}" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "virtualMachineScaleSetName": _SERIALIZER.url( - "virtual_machine_scale_set_name", virtual_machine_scale_set_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"), } _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if filter is not None: - _params["$filter"] = _SERIALIZER.query("filter", filter, "str") - if select is not None: - _params["$select"] = _SERIALIZER.query("select", select, "str") - if expand is not None: - _params["$expand"] = _SERIALIZER.query("expand", expand, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) -def build_virtual_machine_scale_set_vms_approve_rolling_upgrade_request( # pylint: disable=name-too-long - resource_group_name: str, vm_scale_set_name: str, instance_id: str, subscription_id: str, **kwargs: Any +def build_virtual_machine_scale_set_vm_extensions_list_request( # pylint: disable=name-too-long + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + subscription_id: str, + *, + expand: Optional[str] = None, + **kwargs: Any ) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + accept = _headers.pop("Accept", "application/json") + # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/approveRollingUpgrade" + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/extensions" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -1251,49 +1181,72 @@ def build_virtual_machine_scale_set_vms_approve_rolling_upgrade_request( # pyli # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if expand is not None: + _params["$expand"] = _SERIALIZER.query("expand", expand, "str") - return HttpRequest(method="POST", url=_url, params=_params, **kwargs) + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_virtual_machine_scale_set_vms_deallocate_request( # pylint: disable=name-too-long - resource_group_name: str, vm_scale_set_name: str, instance_id: str, subscription_id: str, **kwargs: Any + +def build_virtual_machines_get_request( + resource_group_name: str, + vm_name: str, + subscription_id: str, + *, + expand: Optional[Union[str, _models.InstanceViewTypes]] = None, + **kwargs: Any ) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + accept = _headers.pop("Accept", "application/json") + # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/deallocate" + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), - "instanceId": _SERIALIZER.url("instance_id", instance_id, "str"), + "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if expand is not None: + _params["$expand"] = _SERIALIZER.query("expand", expand, "str") - return HttpRequest(method="POST", url=_url, params=_params, **kwargs) + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_virtual_machine_scale_set_vms_get_instance_view_request( # pylint: disable=name-too-long - resource_group_name: str, vm_scale_set_name: str, instance_id: str, subscription_id: str, **kwargs: Any + +def build_virtual_machines_create_or_update_request( # pylint: disable=name-too-long + resource_group_name: str, + vm_name: str, + subscription_id: str, + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/instanceView" + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), - "instanceId": _SERIALIZER.url("instance_id", instance_id, "str"), + "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -1302,26 +1255,41 @@ def build_virtual_machine_scale_set_vms_get_instance_view_request( # pylint: di _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + if_match = prep_if_match(etag, match_condition) + if if_match is not None: + _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") + if_none_match = prep_if_none_match(etag, match_condition) + if if_none_match is not None: + _headers["If-None-Match"] = _SERIALIZER.header("if_none_match", if_none_match, "str") - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) -def build_virtual_machine_scale_set_vms_reimage_request( # pylint: disable=name-too-long - resource_group_name: str, vm_scale_set_name: str, instance_id: str, subscription_id: str, **kwargs: Any +def build_virtual_machines_update_request( + resource_group_name: str, + vm_name: str, + subscription_id: str, + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + accept = _headers.pop("Accept", "application/json") + # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/reimage" + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), - "instanceId": _SERIALIZER.url("instance_id", instance_id, "str"), + "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -1332,101 +1300,136 @@ def build_virtual_machine_scale_set_vms_reimage_request( # pylint: disable=name # Construct headers if content_type is not None: _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + if_match = prep_if_match(etag, match_condition) + if if_match is not None: + _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") + if_none_match = prep_if_none_match(etag, match_condition) + if if_none_match is not None: + _headers["If-None-Match"] = _SERIALIZER.header("if_none_match", if_none_match, "str") - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) -def build_virtual_machine_scale_set_vms_reimage_all_request( # pylint: disable=name-too-long - resource_group_name: str, vm_scale_set_name: str, instance_id: str, subscription_id: str, **kwargs: Any +def build_virtual_machines_delete_request( + resource_group_name: str, + vm_name: str, + subscription_id: str, + *, + force_deletion: Optional[bool] = None, + **kwargs: Any ) -> HttpRequest: _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/reimageall" + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), - "instanceId": _SERIALIZER.url("instance_id", instance_id, "str"), + "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if force_deletion is not None: + _params["forceDeletion"] = _SERIALIZER.query("force_deletion", force_deletion, "bool") - return HttpRequest(method="POST", url=_url, params=_params, **kwargs) + return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) -def build_virtual_machine_scale_set_vms_simulate_eviction_request( # pylint: disable=name-too-long - resource_group_name: str, vm_scale_set_name: str, instance_id: str, subscription_id: str, **kwargs: Any +def build_virtual_machines_list_request( + resource_group_name: str, + subscription_id: str, + *, + filter: Optional[str] = None, + expand: Optional[Union[str, _models.ExpandTypeForListVMs]] = None, + **kwargs: Any ) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + accept = _headers.pop("Accept", "application/json") + # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/simulateEviction" + _url = ( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines" + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), - "instanceId": _SERIALIZER.url("instance_id", instance_id, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if filter is not None: + _params["$filter"] = _SERIALIZER.query("filter", filter, "str") + if expand is not None: + _params["$expand"] = _SERIALIZER.query("expand", expand, "str") - return HttpRequest(method="POST", url=_url, params=_params, **kwargs) + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_virtual_machine_scale_set_vms_attach_detach_data_disks_request( # pylint: disable=name-too-long - resource_group_name: str, vm_scale_set_name: str, instance_id: str, subscription_id: str, **kwargs: Any +def build_virtual_machines_list_all_request( + subscription_id: str, + *, + status_only: Optional[str] = None, + filter: Optional[str] = None, + expand: Optional[Union[str, _models.ExpandTypesForListVMs]] = None, + **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/attachDetachDataDisks" + _url = "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/virtualMachines" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), - "instanceId": _SERIALIZER.url("instance_id", instance_id, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if status_only is not None: + _params["statusOnly"] = _SERIALIZER.query("status_only", status_only, "str") + if filter is not None: + _params["$filter"] = _SERIALIZER.query("filter", filter, "str") + if expand is not None: + _params["$expand"] = _SERIALIZER.query("expand", expand, "str") # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_virtual_machine_scale_set_vms_perform_maintenance_request( # pylint: disable=name-too-long - resource_group_name: str, vm_scale_set_name: str, instance_id: str, subscription_id: str, **kwargs: Any +def build_virtual_machines_assess_patches_request( # pylint: disable=name-too-long + resource_group_name: str, vm_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + accept = _headers.pop("Accept", "application/json") + # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/performMaintenance" + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/assessPatches" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), - "instanceId": _SERIALIZER.url("instance_id", instance_id, "str"), + "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -1434,53 +1437,59 @@ def build_virtual_machine_scale_set_vms_perform_maintenance_request( # pylint: # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - return HttpRequest(method="POST", url=_url, params=_params, **kwargs) + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_virtual_machine_scale_set_vms_power_off_request( # pylint: disable=name-too-long - resource_group_name: str, - vm_scale_set_name: str, - instance_id: str, - subscription_id: str, - *, - skip_shutdown: Optional[bool] = None, - **kwargs: Any + +def build_virtual_machines_attach_detach_data_disks_request( # pylint: disable=name-too-long + resource_group_name: str, vm_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + accept = _headers.pop("Accept", "application/json") + # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/powerOff" + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/attachDetachDataDisks" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), - "instanceId": _SERIALIZER.url("instance_id", instance_id, "str"), + "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if skip_shutdown is not None: - _params["skipShutdown"] = _SERIALIZER.query("skip_shutdown", skip_shutdown, "bool") - return HttpRequest(method="POST", url=_url, params=_params, **kwargs) + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_virtual_machine_scale_set_vms_redeploy_request( # pylint: disable=name-too-long - resource_group_name: str, vm_scale_set_name: str, instance_id: str, subscription_id: str, **kwargs: Any + +def build_virtual_machines_capture_request( + resource_group_name: str, vm_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + accept = _headers.pop("Accept", "application/json") + # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/redeploy" + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/capture" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), - "instanceId": _SERIALIZER.url("instance_id", instance_id, "str"), + "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -1488,22 +1497,26 @@ def build_virtual_machine_scale_set_vms_redeploy_request( # pylint: disable=nam # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - return HttpRequest(method="POST", url=_url, params=_params, **kwargs) + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_virtual_machine_scale_set_vms_restart_request( # pylint: disable=name-too-long - resource_group_name: str, vm_scale_set_name: str, instance_id: str, subscription_id: str, **kwargs: Any + +def build_virtual_machines_convert_to_managed_disks_request( # pylint: disable=name-too-long + resource_group_name: str, vm_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/restart" + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/convertToManagedDisks" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), - "instanceId": _SERIALIZER.url("instance_id", instance_id, "str"), + "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -1514,58 +1527,42 @@ def build_virtual_machine_scale_set_vms_restart_request( # pylint: disable=name return HttpRequest(method="POST", url=_url, params=_params, **kwargs) -def build_virtual_machine_scale_set_vms_retrieve_boot_diagnostics_data_request( # pylint: disable=name-too-long - 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 +def build_virtual_machines_deallocate_request( # pylint: disable=name-too-long + resource_group_name: str, vm_name: str, subscription_id: str, *, hibernate: Optional[bool] = None, **kwargs: Any ) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - accept = _headers.pop("Accept", "application/json") - # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/retrieveBootDiagnosticsData" + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/deallocate" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), - "instanceId": _SERIALIZER.url("instance_id", instance_id, "str"), + "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if sas_uri_expiration_time_in_minutes is not None: - _params["sasUriExpirationTimeInMinutes"] = _SERIALIZER.query( - "sas_uri_expiration_time_in_minutes", sas_uri_expiration_time_in_minutes, "int" - ) - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + if hibernate is not None: + _params["hibernate"] = _SERIALIZER.query("hibernate", hibernate, "bool") - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="POST", url=_url, params=_params, **kwargs) -def build_virtual_machine_scale_set_vms_start_request( # pylint: disable=name-too-long - resource_group_name: str, vm_scale_set_name: str, instance_id: str, subscription_id: str, **kwargs: Any +def build_virtual_machines_generalize_request( # pylint: disable=name-too-long + resource_group_name: str, vm_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/start" + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/generalize" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), - "instanceId": _SERIALIZER.url("instance_id", instance_id, "str"), + "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -1576,8 +1573,8 @@ def build_virtual_machine_scale_set_vms_start_request( # pylint: disable=name-t return HttpRequest(method="POST", url=_url, params=_params, **kwargs) -def build_virtual_machine_scale_set_vms_run_command_request( # pylint: disable=name-too-long - resource_group_name: str, vm_scale_set_name: str, instance_id: str, subscription_id: str, **kwargs: Any +def build_virtual_machines_install_patches_request( # pylint: disable=name-too-long + resource_group_name: str, vm_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -1587,12 +1584,11 @@ def build_virtual_machine_scale_set_vms_run_command_request( # pylint: disable= accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/runCommand" + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/installPatches" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), - "instanceId": _SERIALIZER.url("instance_id", instance_id, "str"), + "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -1608,15 +1604,8 @@ def build_virtual_machine_scale_set_vms_run_command_request( # pylint: disable= return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_virtual_machine_scale_set_vm_extensions_get_request( # pylint: disable=name-too-long - 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 +def build_virtual_machines_instance_view_request( # pylint: disable=name-too-long + resource_group_name: str, vm_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -1625,21 +1614,17 @@ def build_virtual_machine_scale_set_vm_extensions_get_request( # pylint: disabl accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/extensions/{vmExtensionName}" + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/instanceView" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", 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"), + "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if expand is not None: - _params["$expand"] = _SERIALIZER.query("expand", expand, "str") # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") @@ -1647,29 +1632,18 @@ def build_virtual_machine_scale_set_vm_extensions_get_request( # pylint: disabl return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_virtual_machine_scale_set_vm_extensions_create_or_update_request( # pylint: disable=name-too-long - resource_group_name: str, - vm_scale_set_name: str, - instance_id: str, - vm_extension_name: str, - subscription_id: str, - **kwargs: Any +def build_virtual_machines_perform_maintenance_request( # pylint: disable=name-too-long + resource_group_name: str, vm_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - accept = _headers.pop("Accept", "application/json") - # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/extensions/{vmExtensionName}" + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/performMaintenance" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", 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"), + "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -1677,71 +1651,67 @@ def build_virtual_machine_scale_set_vm_extensions_create_or_update_request( # p # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="POST", url=_url, params=_params, **kwargs) -def build_virtual_machine_scale_set_vm_extensions_update_request( # pylint: disable=name-too-long - resource_group_name: str, - vm_scale_set_name: str, - instance_id: str, - vm_extension_name: str, - subscription_id: str, - **kwargs: Any +def build_virtual_machines_power_off_request( + resource_group_name: str, vm_name: str, subscription_id: str, *, skip_shutdown: Optional[bool] = None, **kwargs: Any ) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - accept = _headers.pop("Accept", "application/json") - # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/extensions/{vmExtensionName}" + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/powerOff" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", 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"), + "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if skip_shutdown is not None: + _params["skipShutdown"] = _SERIALIZER.query("skip_shutdown", skip_shutdown, "bool") - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="POST", url=_url, params=_params, **kwargs) - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) +def build_virtual_machines_reapply_request( + resource_group_name: str, vm_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) -def build_virtual_machine_scale_set_vm_extensions_delete_request( # pylint: disable=name-too-long - resource_group_name: str, - vm_scale_set_name: str, - instance_id: str, - vm_extension_name: str, - subscription_id: str, - **kwargs: Any + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/reapply" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + return HttpRequest(method="POST", url=_url, params=_params, **kwargs) + + +def build_virtual_machines_redeploy_request( + resource_group_name: str, vm_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/extensions/{vmExtensionName}" + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/redeploy" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", 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"), + "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -1749,62 +1719,45 @@ def build_virtual_machine_scale_set_vm_extensions_delete_request( # pylint: dis # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) + return HttpRequest(method="POST", url=_url, params=_params, **kwargs) -def build_virtual_machine_scale_set_vm_extensions_list_request( # pylint: disable=name-too-long - resource_group_name: str, - vm_scale_set_name: str, - instance_id: str, - subscription_id: str, - *, - expand: Optional[str] = None, - **kwargs: Any +def build_virtual_machines_reimage_request( + resource_group_name: str, vm_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - accept = _headers.pop("Accept", "application/json") - # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/extensions" + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/reimage" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), - "instanceId": _SERIALIZER.url("instance_id", instance_id, "str"), + "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if expand is not None: - _params["$expand"] = _SERIALIZER.query("expand", expand, "str") # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_virtual_machines_get_request( - resource_group_name: str, - vm_name: str, - subscription_id: str, - *, - expand: Optional[Union[str, _models.InstanceViewTypes]] = None, - **kwargs: Any +def build_virtual_machines_restart_request( + resource_group_name: str, vm_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - accept = _headers.pop("Accept", "application/json") - # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}" + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/restart" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -1815,33 +1768,26 @@ def build_virtual_machines_get_request( # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if expand is not None: - _params["$expand"] = _SERIALIZER.query("expand", expand, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="POST", url=_url, params=_params, **kwargs) -def build_virtual_machines_create_or_update_request( # pylint: disable=name-too-long +def build_virtual_machines_retrieve_boot_diagnostics_data_request( # pylint: disable=name-too-long resource_group_name: str, vm_name: str, subscription_id: str, *, - etag: Optional[str] = None, - match_condition: Optional[MatchConditions] = None, + sas_uri_expiration_time_in_minutes: Optional[int] = None, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}" + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/retrieveBootDiagnosticsData" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -1852,39 +1798,25 @@ def build_virtual_machines_create_or_update_request( # pylint: disable=name-too # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if sas_uri_expiration_time_in_minutes is not None: + _params["sasUriExpirationTimeInMinutes"] = _SERIALIZER.query( + "sas_uri_expiration_time_in_minutes", sas_uri_expiration_time_in_minutes, "int" + ) # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - if_match = prep_if_match(etag, match_condition) - if if_match is not None: - _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") - if_none_match = prep_if_none_match(etag, match_condition) - if if_none_match is not None: - _headers["If-None-Match"] = _SERIALIZER.header("if_none_match", if_none_match, "str") - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_virtual_machines_update_request( - resource_group_name: str, - vm_name: str, - subscription_id: str, - *, - etag: Optional[str] = None, - match_condition: Optional[MatchConditions] = None, - **kwargs: Any +def build_virtual_machines_simulate_eviction_request( # pylint: disable=name-too-long + resource_group_name: str, vm_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - accept = _headers.pop("Accept", "application/json") - # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}" + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/simulateEviction" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -1896,33 +1828,17 @@ def build_virtual_machines_update_request( # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - if_match = prep_if_match(etag, match_condition) - if if_match is not None: - _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") - if_none_match = prep_if_none_match(etag, match_condition) - if if_none_match is not None: - _headers["If-None-Match"] = _SERIALIZER.header("if_none_match", if_none_match, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="POST", url=_url, params=_params, **kwargs) -def build_virtual_machines_delete_request( - resource_group_name: str, - vm_name: str, - subscription_id: str, - *, - force_deletion: Optional[bool] = None, - **kwargs: Any +def build_virtual_machines_start_request( + resource_group_name: str, vm_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}" + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/start" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -1933,19 +1849,12 @@ def build_virtual_machines_delete_request( # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if force_deletion is not None: - _params["forceDeletion"] = _SERIALIZER.query("force_deletion", force_deletion, "bool") - return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) + return HttpRequest(method="POST", url=_url, params=_params, **kwargs) -def build_virtual_machines_list_request( - resource_group_name: str, - subscription_id: str, - *, - filter: Optional[str] = None, - expand: Optional[Union[str, _models.ExpandTypeForListVMs]] = None, - **kwargs: Any +def build_virtual_machines_list_available_sizes_request( # pylint: disable=name-too-long + resource_group_name: str, vm_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -1954,22 +1863,17 @@ def build_virtual_machines_list_request( accept = _headers.pop("Accept", "application/json") # Construct URL - _url = ( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines" - ) + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/vmSizes" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if filter is not None: - _params["$filter"] = _SERIALIZER.query("filter", filter, "str") - if expand is not None: - _params["$expand"] = _SERIALIZER.query("expand", expand, "str") # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") @@ -1977,54 +1881,47 @@ def build_virtual_machines_list_request( return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_virtual_machines_list_all_request( - subscription_id: str, - *, - status_only: Optional[str] = None, - filter: Optional[str] = None, - expand: Optional[Union[str, _models.ExpandTypesForListVMs]] = None, - **kwargs: Any +def build_virtual_machines_run_command_request( # pylint: disable=name-too-long + resource_group_name: str, vm_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/virtualMachines" + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommand" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if status_only is not None: - _params["statusOnly"] = _SERIALIZER.query("status_only", status_only, "str") - if filter is not None: - _params["$filter"] = _SERIALIZER.query("filter", filter, "str") - if expand is not None: - _params["$expand"] = _SERIALIZER.query("expand", expand, "str") # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_virtual_machines_assess_patches_request( # pylint: disable=name-too-long +def build_virtual_machines_migrate_to_vm_scale_set_request( # pylint: disable=name-too-long resource_group_name: str, vm_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - accept = _headers.pop("Accept", "application/json") - # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/assessPatches" + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/migrateToVirtualMachineScaleSet" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -2037,27 +1934,26 @@ def build_virtual_machines_assess_patches_request( # pylint: disable=name-too-l _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_virtual_machines_attach_detach_data_disks_request( # pylint: disable=name-too-long - resource_group_name: str, vm_name: str, subscription_id: str, **kwargs: Any +def build_virtual_machines_list_by_location_request( # pylint: disable=name-too-long + location: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/attachDetachDataDisks" + _url = "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/virtualMachines" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), + "location": _SERIALIZER.url("location", location, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -2066,56 +1962,65 @@ def build_virtual_machines_attach_detach_data_disks_request( # pylint: disable= _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_virtual_machines_capture_request( - resource_group_name: str, vm_name: str, subscription_id: str, **kwargs: Any +def build_virtual_machine_extensions_get_request( # pylint: disable=name-too-long + resource_group_name: str, + vm_name: str, + vm_extension_name: str, + subscription_id: str, + *, + expand: Optional[str] = None, + **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/capture" + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "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"), } _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if expand is not None: + _params["$expand"] = _SERIALIZER.query("expand", expand, "str") # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_virtual_machines_convert_to_managed_disks_request( # pylint: disable=name-too-long - resource_group_name: str, vm_name: str, subscription_id: str, **kwargs: Any +def build_virtual_machine_extensions_create_or_update_request( # pylint: disable=name-too-long + resource_group_name: str, vm_name: str, vm_extension_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + accept = _headers.pop("Accept", "application/json") + # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/convertToManagedDisks" + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "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"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -2123,45 +2028,59 @@ def build_virtual_machines_convert_to_managed_disks_request( # pylint: disable= # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - return HttpRequest(method="POST", url=_url, params=_params, **kwargs) + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) -def build_virtual_machines_deallocate_request( # pylint: disable=name-too-long - resource_group_name: str, vm_name: str, subscription_id: str, *, hibernate: Optional[bool] = None, **kwargs: Any + +def build_virtual_machine_extensions_update_request( # pylint: disable=name-too-long + resource_group_name: str, vm_name: str, vm_extension_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + accept = _headers.pop("Accept", "application/json") + # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/deallocate" + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "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"), } _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if hibernate is not None: - _params["hibernate"] = _SERIALIZER.query("hibernate", hibernate, "bool") - return HttpRequest(method="POST", url=_url, params=_params, **kwargs) + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) -def build_virtual_machines_generalize_request( # pylint: disable=name-too-long - resource_group_name: str, vm_name: str, subscription_id: str, **kwargs: Any + +def build_virtual_machine_extensions_delete_request( # pylint: disable=name-too-long + resource_group_name: str, vm_name: str, vm_extension_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/generalize" + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "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"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -2169,21 +2088,20 @@ def build_virtual_machines_generalize_request( # pylint: disable=name-too-long # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - return HttpRequest(method="POST", url=_url, params=_params, **kwargs) + return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) -def build_virtual_machines_install_patches_request( # pylint: disable=name-too-long - resource_group_name: str, vm_name: str, subscription_id: str, **kwargs: Any +def build_virtual_machine_extensions_list_request( # pylint: disable=name-too-long + resource_group_name: str, vm_name: str, subscription_id: str, *, expand: Optional[str] = None, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/installPatches" + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -2194,17 +2112,17 @@ def build_virtual_machines_install_patches_request( # pylint: disable=name-too- # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if expand is not None: + _params["$expand"] = _SERIALIZER.query("expand", expand, "str") # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_virtual_machines_instance_view_request( # pylint: disable=name-too-long - resource_group_name: str, vm_name: str, subscription_id: str, **kwargs: Any +def build_virtual_machine_extension_images_get_request( # pylint: disable=name-too-long + location: str, publisher_name: str, type: str, version: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -2213,11 +2131,13 @@ def build_virtual_machines_instance_view_request( # pylint: disable=name-too-lo accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/instanceView" + _url = "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmextension/types/{type}/versions/{version}" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), + "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"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -2231,18 +2151,21 @@ def build_virtual_machines_instance_view_request( # pylint: disable=name-too-lo return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_virtual_machines_perform_maintenance_request( # pylint: disable=name-too-long - resource_group_name: str, vm_name: str, subscription_id: str, **kwargs: Any +def build_virtual_machine_extension_images_list_types_request( # pylint: disable=name-too-long + location: str, publisher_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + accept = _headers.pop("Accept", "application/json") + # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/performMaintenance" + _url = "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmextension/types" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), + "location": _SERIALIZER.url("location", location, "str"), + "publisherName": _SERIALIZER.url("publisher_name", publisher_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -2250,45 +2173,70 @@ def build_virtual_machines_perform_maintenance_request( # pylint: disable=name- # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - return HttpRequest(method="POST", url=_url, params=_params, **kwargs) + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_virtual_machines_power_off_request( - resource_group_name: str, vm_name: str, subscription_id: str, *, skip_shutdown: Optional[bool] = None, **kwargs: Any + +def build_virtual_machine_extension_images_list_versions_request( # pylint: disable=name-too-long + 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: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + accept = _headers.pop("Accept", "application/json") + # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/powerOff" + _url = "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmextension/types/{type}/versions" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), + "location": _SERIALIZER.url("location", location, "str"), + "publisherName": _SERIALIZER.url("publisher_name", publisher_name, "str"), + "type": _SERIALIZER.url("type", type, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if skip_shutdown is not None: - _params["skipShutdown"] = _SERIALIZER.query("skip_shutdown", skip_shutdown, "bool") + if filter is not None: + _params["$filter"] = _SERIALIZER.query("filter", filter, "str") + if top is not None: + _params["$top"] = _SERIALIZER.query("top", top, "int") + if orderby is not None: + _params["$orderby"] = _SERIALIZER.query("orderby", orderby, "str") - return HttpRequest(method="POST", url=_url, params=_params, **kwargs) + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_virtual_machines_reapply_request( - resource_group_name: str, vm_name: str, subscription_id: str, **kwargs: Any + +def build_availability_sets_get_request( + resource_group_name: str, availability_set_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + accept = _headers.pop("Accept", "application/json") + # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/reapply" + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), + "availabilitySetName": _SERIALIZER.url("availability_set_name", availability_set_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -2296,21 +2244,28 @@ def build_virtual_machines_reapply_request( # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - return HttpRequest(method="POST", url=_url, params=_params, **kwargs) + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_virtual_machines_redeploy_request( - resource_group_name: str, vm_name: str, subscription_id: str, **kwargs: Any + +def build_availability_sets_create_or_update_request( # pylint: disable=name-too-long + resource_group_name: str, availability_set_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + accept = _headers.pop("Accept", "application/json") + # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/redeploy" + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), + "availabilitySetName": _SERIALIZER.url("availability_set_name", availability_set_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -2318,23 +2273,30 @@ def build_virtual_machines_redeploy_request( # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - return HttpRequest(method="POST", url=_url, params=_params, **kwargs) + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) -def build_virtual_machines_reimage_request( - resource_group_name: str, vm_name: str, subscription_id: str, **kwargs: Any + +def build_availability_sets_update_request( + resource_group_name: str, availability_set_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + accept = _headers.pop("Accept", "application/json") + # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/reimage" + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), + "availabilitySetName": _SERIALIZER.url("availability_set_name", availability_set_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -2345,22 +2307,23 @@ def build_virtual_machines_reimage_request( # Construct headers if content_type is not None: _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) -def build_virtual_machines_restart_request( - resource_group_name: str, vm_name: str, subscription_id: str, **kwargs: Any +def build_availability_sets_delete_request( + resource_group_name: str, availability_set_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/restart" + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), + "availabilitySetName": _SERIALIZER.url("availability_set_name", availability_set_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -2368,17 +2331,10 @@ def build_virtual_machines_restart_request( # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - return HttpRequest(method="POST", url=_url, params=_params, **kwargs) + return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) -def build_virtual_machines_retrieve_boot_diagnostics_data_request( # pylint: disable=name-too-long - resource_group_name: str, - vm_name: str, - subscription_id: str, - *, - sas_uri_expiration_time_in_minutes: Optional[int] = None, - **kwargs: Any -) -> HttpRequest: +def build_availability_sets_list_request(resource_group_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -2386,62 +2342,66 @@ def build_virtual_machines_retrieve_boot_diagnostics_data_request( # pylint: di accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/retrieveBootDiagnosticsData" + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if sas_uri_expiration_time_in_minutes is not None: - _params["sasUriExpirationTimeInMinutes"] = _SERIALIZER.query( - "sas_uri_expiration_time_in_minutes", sas_uri_expiration_time_in_minutes, "int" - ) # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_virtual_machines_simulate_eviction_request( # pylint: disable=name-too-long - resource_group_name: str, vm_name: str, subscription_id: str, **kwargs: Any +def build_availability_sets_list_by_subscription_request( # pylint: disable=name-too-long + subscription_id: str, *, expand: Optional[str] = None, **kwargs: Any ) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + accept = _headers.pop("Accept", "application/json") + # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/simulateEviction" + _url = "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/availabilitySets" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if expand is not None: + _params["$expand"] = _SERIALIZER.query("expand", expand, "str") - return HttpRequest(method="POST", url=_url, params=_params, **kwargs) + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_virtual_machines_start_request( - resource_group_name: str, vm_name: str, subscription_id: str, **kwargs: Any +def build_availability_sets_list_available_sizes_request( # pylint: disable=name-too-long + resource_group_name: str, availability_set_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + accept = _headers.pop("Accept", "application/json") + # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/start" + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}/vmSizes" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), + "availabilitySetName": _SERIALIZER.url("availability_set_name", availability_set_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -2449,24 +2409,26 @@ def build_virtual_machines_start_request( # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - return HttpRequest(method="POST", url=_url, params=_params, **kwargs) + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_virtual_machines_list_available_sizes_request( # pylint: disable=name-too-long - resource_group_name: str, vm_name: str, subscription_id: str, **kwargs: Any +def build_availability_sets_start_migration_to_virtual_machine_scale_set_request( # pylint: disable=name-too-long + resource_group_name: str, availability_set_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - accept = _headers.pop("Accept", "application/json") - # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/vmSizes" + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}/startMigrationToVirtualMachineScaleSet" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), + "availabilitySetName": _SERIALIZER.url("availability_set_name", availability_set_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -2475,27 +2437,24 @@ def build_virtual_machines_list_available_sizes_request( # pylint: disable=name _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_virtual_machines_run_command_request( # pylint: disable=name-too-long - resource_group_name: str, vm_name: str, subscription_id: str, **kwargs: Any +def build_availability_sets_cancel_migration_to_virtual_machine_scale_set_request( # pylint: disable=name-too-long + resource_group_name: str, availability_set_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - accept = _headers.pop("Accept", "application/json") - # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommand" + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}/cancelMigrationToVirtualMachineScaleSet" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), + "availabilitySetName": _SERIALIZER.url("availability_set_name", availability_set_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -2503,16 +2462,11 @@ def build_virtual_machines_run_command_request( # pylint: disable=name-too-long # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="POST", url=_url, params=_params, **kwargs) -def build_virtual_machines_migrate_to_vm_scale_set_request( # pylint: disable=name-too-long - resource_group_name: str, vm_name: str, subscription_id: str, **kwargs: Any +def build_availability_sets_validate_migration_to_virtual_machine_scale_set_request( # pylint: disable=name-too-long + resource_group_name: str, availability_set_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -2520,11 +2474,11 @@ def build_virtual_machines_migrate_to_vm_scale_set_request( # pylint: disable=n content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/migrateToVirtualMachineScaleSet" + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}/validateMigrationToVirtualMachineScaleSet" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), + "availabilitySetName": _SERIALIZER.url("availability_set_name", availability_set_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -2539,13 +2493,40 @@ def build_virtual_machines_migrate_to_vm_scale_set_request( # pylint: disable=n return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_virtual_machine_extensions_get_request( # pylint: disable=name-too-long - resource_group_name: str, - vm_name: str, - vm_extension_name: str, +def build_availability_sets_convert_to_virtual_machine_scale_set_request( # pylint: disable=name-too-long + resource_group_name: str, availability_set_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}/convertToVirtualMachineScaleSet" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "availabilitySetName": _SERIALIZER.url("availability_set_name", availability_set_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_proximity_placement_groups_get_request( # pylint: disable=name-too-long + resource_group_name: str, + proximity_placement_group_name: str, subscription_id: str, *, - expand: Optional[str] = None, + include_colocation_status: Optional[str] = None, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -2555,20 +2536,23 @@ def build_virtual_machine_extensions_get_request( # pylint: disable=name-too-lo accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}" + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "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"), + "proximityPlacementGroupName": _SERIALIZER.url( + "proximity_placement_group_name", proximity_placement_group_name, "str" + ), } _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if expand is not None: - _params["$expand"] = _SERIALIZER.query("expand", expand, "str") + if include_colocation_status is not None: + _params["includeColocationStatus"] = _SERIALIZER.query( + "include_colocation_status", include_colocation_status, "str" + ) # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") @@ -2576,8 +2560,8 @@ def build_virtual_machine_extensions_get_request( # pylint: disable=name-too-lo return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_virtual_machine_extensions_create_or_update_request( # pylint: disable=name-too-long - resource_group_name: str, vm_name: str, vm_extension_name: str, subscription_id: str, **kwargs: Any +def build_proximity_placement_groups_create_or_update_request( # pylint: disable=name-too-long + resource_group_name: str, proximity_placement_group_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -2587,12 +2571,13 @@ def build_virtual_machine_extensions_create_or_update_request( # pylint: disabl accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}" + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "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"), + "proximityPlacementGroupName": _SERIALIZER.url( + "proximity_placement_group_name", proximity_placement_group_name, "str" + ), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -2608,8 +2593,8 @@ def build_virtual_machine_extensions_create_or_update_request( # pylint: disabl return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) -def build_virtual_machine_extensions_update_request( # pylint: disable=name-too-long - resource_group_name: str, vm_name: str, vm_extension_name: str, subscription_id: str, **kwargs: Any +def build_proximity_placement_groups_update_request( # pylint: disable=name-too-long + resource_group_name: str, proximity_placement_group_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -2619,12 +2604,13 @@ def build_virtual_machine_extensions_update_request( # pylint: disable=name-too accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}" + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "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"), + "proximityPlacementGroupName": _SERIALIZER.url( + "proximity_placement_group_name", proximity_placement_group_name, "str" + ), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -2640,19 +2626,20 @@ def build_virtual_machine_extensions_update_request( # pylint: disable=name-too return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) -def build_virtual_machine_extensions_delete_request( # pylint: disable=name-too-long - resource_group_name: str, vm_name: str, vm_extension_name: str, subscription_id: str, **kwargs: Any +def build_proximity_placement_groups_delete_request( # pylint: disable=name-too-long + resource_group_name: str, proximity_placement_group_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}" + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "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"), + "proximityPlacementGroupName": _SERIALIZER.url( + "proximity_placement_group_name", proximity_placement_group_name, "str" + ), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -2663,8 +2650,8 @@ def build_virtual_machine_extensions_delete_request( # pylint: disable=name-too return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) -def build_virtual_machine_extensions_list_request( # pylint: disable=name-too-long - resource_group_name: str, vm_name: str, subscription_id: str, *, expand: Optional[str] = None, **kwargs: Any +def build_proximity_placement_groups_list_by_resource_group_request( # pylint: disable=name-too-long + resource_group_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -2673,19 +2660,16 @@ def build_virtual_machine_extensions_list_request( # pylint: disable=name-too-l accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions" + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if expand is not None: - _params["$expand"] = _SERIALIZER.query("expand", expand, "str") # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") @@ -2693,8 +2677,8 @@ def build_virtual_machine_extensions_list_request( # pylint: disable=name-too-l return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_virtual_machine_extension_images_get_request( # pylint: disable=name-too-long - location: str, publisher_name: str, type: str, version: str, subscription_id: str, **kwargs: Any +def build_proximity_placement_groups_list_by_subscription_request( # pylint: disable=name-too-long + subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -2703,13 +2687,9 @@ def build_virtual_machine_extension_images_get_request( # pylint: disable=name- accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmextension/types/{type}/versions/{version}" + _url = "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/proximityPlacementGroups" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "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"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -2723,8 +2703,13 @@ def build_virtual_machine_extension_images_get_request( # pylint: disable=name- return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_virtual_machine_extension_images_list_types_request( # pylint: disable=name-too-long - location: str, publisher_name: str, subscription_id: str, **kwargs: Any +def build_dedicated_host_groups_get_request( + resource_group_name: str, + host_group_name: str, + subscription_id: str, + *, + expand: Optional[Union[str, _models.InstanceViewTypes]] = None, + **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -2733,17 +2718,19 @@ def build_virtual_machine_extension_images_list_types_request( # pylint: disabl accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmextension/types" + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "location": _SERIALIZER.url("location", location, "str"), - "publisherName": _SERIALIZER.url("publisher_name", publisher_name, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "hostGroupName": _SERIALIZER.url("host_group_name", host_group_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if expand is not None: + _params["$expand"] = _SERIALIZER.query("expand", expand, "str") # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") @@ -2751,64 +2738,53 @@ def build_virtual_machine_extension_images_list_types_request( # pylint: disabl return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_virtual_machine_extension_images_list_versions_request( # pylint: disable=name-too-long - location: str, - publisher_name: str, - type: str, - subscription_id: str, - *, - filter: Optional[str] = None, - top: Optional[int] = None, - orderby: Optional[str] = None, - **kwargs: Any +def build_dedicated_host_groups_create_or_update_request( # pylint: disable=name-too-long + resource_group_name: str, host_group_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmextension/types/{type}/versions" + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "location": _SERIALIZER.url("location", location, "str"), - "publisherName": _SERIALIZER.url("publisher_name", publisher_name, "str"), - "type": _SERIALIZER.url("type", type, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "hostGroupName": _SERIALIZER.url("host_group_name", host_group_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if filter is not None: - _params["$filter"] = _SERIALIZER.query("filter", filter, "str") - if top is not None: - _params["$top"] = _SERIALIZER.query("top", top, "int") - if orderby is not None: - _params["$orderby"] = _SERIALIZER.query("orderby", orderby, "str") # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) -def build_availability_sets_get_request( - resource_group_name: str, availability_set_name: str, subscription_id: str, **kwargs: Any +def build_dedicated_host_groups_update_request( # pylint: disable=name-too-long + resource_group_name: str, host_group_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}" + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "availabilitySetName": _SERIALIZER.url("availability_set_name", availability_set_name, "str"), + "hostGroupName": _SERIALIZER.url("host_group_name", host_group_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -2817,27 +2793,25 @@ def build_availability_sets_get_request( _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) -def build_availability_sets_create_or_update_request( # pylint: disable=name-too-long - resource_group_name: str, availability_set_name: str, subscription_id: str, **kwargs: Any +def build_dedicated_host_groups_delete_request( # pylint: disable=name-too-long + resource_group_name: str, host_group_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - accept = _headers.pop("Accept", "application/json") - # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}" + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "availabilitySetName": _SERIALIZER.url("availability_set_name", availability_set_name, "str"), + "hostGroupName": _SERIALIZER.url("host_group_name", host_group_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -2845,30 +2819,23 @@ def build_availability_sets_create_or_update_request( # pylint: disable=name-to # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) -def build_availability_sets_update_request( - resource_group_name: str, availability_set_name: str, subscription_id: str, **kwargs: Any +def build_dedicated_host_groups_list_by_resource_group_request( # pylint: disable=name-too-long + resource_group_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}" + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "availabilitySetName": _SERIALIZER.url("availability_set_name", availability_set_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -2877,25 +2844,24 @@ def build_availability_sets_update_request( _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_availability_sets_delete_request( - resource_group_name: str, availability_set_name: str, subscription_id: str, **kwargs: Any +def build_dedicated_host_groups_list_by_subscription_request( # pylint: disable=name-too-long + subscription_id: str, **kwargs: Any ) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + accept = _headers.pop("Accept", "application/json") + # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}" + _url = "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/hostGroups" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "availabilitySetName": _SERIALIZER.url("availability_set_name", availability_set_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -2903,10 +2869,21 @@ def build_availability_sets_delete_request( # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_availability_sets_list_request(resource_group_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: +def build_dedicated_hosts_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: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -2914,16 +2891,20 @@ def build_availability_sets_list_request(resource_group_name: str, subscription_ accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets" + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "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"), } _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if expand is not None: + _params["$expand"] = _SERIALIZER.query("expand", expand, "str") # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") @@ -2931,49 +2912,55 @@ def build_availability_sets_list_request(resource_group_name: str, subscription_ return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_availability_sets_list_by_subscription_request( # pylint: disable=name-too-long - subscription_id: str, *, expand: Optional[str] = None, **kwargs: Any +def build_dedicated_hosts_create_or_update_request( # pylint: disable=name-too-long + resource_group_name: str, host_group_name: str, host_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/availabilitySets" + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "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"), } _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if expand is not None: - _params["$expand"] = _SERIALIZER.query("expand", expand, "str") # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) -def build_availability_sets_list_available_sizes_request( # pylint: disable=name-too-long - resource_group_name: str, availability_set_name: str, subscription_id: str, **kwargs: Any +def build_dedicated_hosts_update_request( + resource_group_name: str, host_group_name: str, host_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}/vmSizes" + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "availabilitySetName": _SERIALIZER.url("availability_set_name", availability_set_name, "str"), + "hostGroupName": _SERIALIZER.url("host_group_name", host_group_name, "str"), + "hostName": _SERIALIZER.url("host_name", host_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -2982,25 +2969,26 @@ def build_availability_sets_list_available_sizes_request( # pylint: disable=nam _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) -def build_availability_sets_start_migration_to_virtual_machine_scale_set_request( # pylint: disable=name-too-long - resource_group_name: str, availability_set_name: str, subscription_id: str, **kwargs: Any +def build_dedicated_hosts_delete_request( + resource_group_name: str, host_group_name: str, host_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}/startMigrationToVirtualMachineScaleSet" + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "availabilitySetName": _SERIALIZER.url("availability_set_name", availability_set_name, "str"), + "hostGroupName": _SERIALIZER.url("host_group_name", host_group_name, "str"), + "hostName": _SERIALIZER.url("host_name", host_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -3008,25 +2996,24 @@ def build_availability_sets_start_migration_to_virtual_machine_scale_set_request # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) -def build_availability_sets_cancel_migration_to_virtual_machine_scale_set_request( # pylint: disable=name-too-long - resource_group_name: str, availability_set_name: str, subscription_id: str, **kwargs: Any +def build_dedicated_hosts_list_by_host_group_request( # pylint: disable=name-too-long + resource_group_name: str, host_group_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + accept = _headers.pop("Accept", "application/json") + # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}/cancelMigrationToVirtualMachineScaleSet" + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "availabilitySetName": _SERIALIZER.url("availability_set_name", availability_set_name, "str"), + "hostGroupName": _SERIALIZER.url("host_group_name", host_group_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -3034,23 +3021,28 @@ def build_availability_sets_cancel_migration_to_virtual_machine_scale_set_reques # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - return HttpRequest(method="POST", url=_url, params=_params, **kwargs) + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_availability_sets_validate_migration_to_virtual_machine_scale_set_request( # pylint: disable=name-too-long - resource_group_name: str, availability_set_name: str, subscription_id: str, **kwargs: Any + +def build_dedicated_hosts_list_available_sizes_request( # pylint: disable=name-too-long + resource_group_name: str, host_group_name: str, host_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + accept = _headers.pop("Accept", "application/json") + # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}/validateMigrationToVirtualMachineScaleSet" + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}/hostSizes" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "availabilitySetName": _SERIALIZER.url("availability_set_name", availability_set_name, "str"), + "hostGroupName": _SERIALIZER.url("host_group_name", host_group_name, "str"), + "hostName": _SERIALIZER.url("host_name", host_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -3059,26 +3051,24 @@ def build_availability_sets_validate_migration_to_virtual_machine_scale_set_requ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_availability_sets_convert_to_virtual_machine_scale_set_request( # pylint: disable=name-too-long - resource_group_name: str, availability_set_name: str, subscription_id: str, **kwargs: Any +def build_dedicated_hosts_redeploy_request( + resource_group_name: str, host_group_name: str, host_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}/convertToVirtualMachineScaleSet" + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}/redeploy" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "availabilitySetName": _SERIALIZER.url("availability_set_name", availability_set_name, "str"), + "hostGroupName": _SERIALIZER.url("host_group_name", host_group_name, "str"), + "hostName": _SERIALIZER.url("host_name", host_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -3086,20 +3076,34 @@ def build_availability_sets_convert_to_virtual_machine_scale_set_request( # pyl # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + return HttpRequest(method="POST", url=_url, params=_params, **kwargs) - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) +def build_dedicated_hosts_restart_request( + resource_group_name: str, host_group_name: str, host_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}/restart" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "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"), + } -def build_proximity_placement_groups_get_request( # pylint: disable=name-too-long - resource_group_name: str, - proximity_placement_group_name: str, - subscription_id: str, - *, - include_colocation_status: Optional[str] = None, - **kwargs: Any + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + return HttpRequest(method="POST", url=_url, params=_params, **kwargs) + + +def build_images_get_request( + resource_group_name: str, image_name: str, subscription_id: str, *, expand: Optional[str] = None, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -3108,23 +3112,19 @@ def build_proximity_placement_groups_get_request( # pylint: disable=name-too-lo accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}" + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "proximityPlacementGroupName": _SERIALIZER.url( - "proximity_placement_group_name", proximity_placement_group_name, "str" - ), + "imageName": _SERIALIZER.url("image_name", image_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if include_colocation_status is not None: - _params["includeColocationStatus"] = _SERIALIZER.query( - "include_colocation_status", include_colocation_status, "str" - ) + if expand is not None: + _params["$expand"] = _SERIALIZER.query("expand", expand, "str") # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") @@ -3132,8 +3132,8 @@ def build_proximity_placement_groups_get_request( # pylint: disable=name-too-lo return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_proximity_placement_groups_create_or_update_request( # pylint: disable=name-too-long - resource_group_name: str, proximity_placement_group_name: str, subscription_id: str, **kwargs: Any +def build_images_create_or_update_request( + resource_group_name: str, image_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -3143,13 +3143,11 @@ def build_proximity_placement_groups_create_or_update_request( # pylint: disabl accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}" + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "proximityPlacementGroupName": _SERIALIZER.url( - "proximity_placement_group_name", proximity_placement_group_name, "str" - ), + "imageName": _SERIALIZER.url("image_name", image_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -3165,8 +3163,8 @@ def build_proximity_placement_groups_create_or_update_request( # pylint: disabl return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) -def build_proximity_placement_groups_update_request( # pylint: disable=name-too-long - resource_group_name: str, proximity_placement_group_name: str, subscription_id: str, **kwargs: Any +def build_images_update_request( + resource_group_name: str, image_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -3176,13 +3174,11 @@ def build_proximity_placement_groups_update_request( # pylint: disable=name-too accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}" + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "proximityPlacementGroupName": _SERIALIZER.url( - "proximity_placement_group_name", proximity_placement_group_name, "str" - ), + "imageName": _SERIALIZER.url("image_name", image_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -3198,20 +3194,18 @@ def build_proximity_placement_groups_update_request( # pylint: disable=name-too return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) -def build_proximity_placement_groups_delete_request( # pylint: disable=name-too-long - resource_group_name: str, proximity_placement_group_name: str, subscription_id: str, **kwargs: Any +def build_images_delete_request( + resource_group_name: str, image_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}" + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "proximityPlacementGroupName": _SERIALIZER.url( - "proximity_placement_group_name", proximity_placement_group_name, "str" - ), + "imageName": _SERIALIZER.url("image_name", image_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -3222,7 +3216,7 @@ def build_proximity_placement_groups_delete_request( # pylint: disable=name-too return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) -def build_proximity_placement_groups_list_by_resource_group_request( # pylint: disable=name-too-long +def build_images_list_by_resource_group_request( # pylint: disable=name-too-long resource_group_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -3232,7 +3226,7 @@ def build_proximity_placement_groups_list_by_resource_group_request( # pylint: accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups" + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -3249,9 +3243,7 @@ def build_proximity_placement_groups_list_by_resource_group_request( # pylint: return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_proximity_placement_groups_list_by_subscription_request( # pylint: disable=name-too-long - subscription_id: str, **kwargs: Any -) -> HttpRequest: +def build_images_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -3259,7 +3251,7 @@ def build_proximity_placement_groups_list_by_subscription_request( # pylint: di accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/proximityPlacementGroups" + _url = "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/images" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } @@ -3275,12 +3267,12 @@ def build_proximity_placement_groups_list_by_subscription_request( # pylint: di return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_dedicated_host_groups_get_request( +def build_restore_point_collections_get_request( # pylint: disable=name-too-long resource_group_name: str, - host_group_name: str, + restore_point_collection_name: str, subscription_id: str, *, - expand: Optional[Union[str, _models.InstanceViewTypes]] = None, + expand: Optional[Union[str, _models.RestorePointCollectionExpandOptions]] = None, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -3290,11 +3282,13 @@ def build_dedicated_host_groups_get_request( accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}" + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "hostGroupName": _SERIALIZER.url("host_group_name", host_group_name, "str"), + "restorePointCollectionName": _SERIALIZER.url( + "restore_point_collection_name", restore_point_collection_name, "str" + ), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -3310,8 +3304,8 @@ def build_dedicated_host_groups_get_request( return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_dedicated_host_groups_create_or_update_request( # pylint: disable=name-too-long - resource_group_name: str, host_group_name: str, subscription_id: str, **kwargs: Any +def build_restore_point_collections_create_or_update_request( # pylint: disable=name-too-long + resource_group_name: str, restore_point_collection_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -3321,11 +3315,13 @@ def build_dedicated_host_groups_create_or_update_request( # pylint: disable=nam accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}" + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "hostGroupName": _SERIALIZER.url("host_group_name", host_group_name, "str"), + "restorePointCollectionName": _SERIALIZER.url( + "restore_point_collection_name", restore_point_collection_name, "str" + ), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -3341,8 +3337,8 @@ def build_dedicated_host_groups_create_or_update_request( # pylint: disable=nam return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) -def build_dedicated_host_groups_update_request( # pylint: disable=name-too-long - resource_group_name: str, host_group_name: str, subscription_id: str, **kwargs: Any +def build_restore_point_collections_update_request( # pylint: disable=name-too-long + resource_group_name: str, restore_point_collection_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -3352,11 +3348,13 @@ def build_dedicated_host_groups_update_request( # pylint: disable=name-too-long accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}" + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "hostGroupName": _SERIALIZER.url("host_group_name", host_group_name, "str"), + "restorePointCollectionName": _SERIALIZER.url( + "restore_point_collection_name", restore_point_collection_name, "str" + ), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -3372,18 +3370,20 @@ def build_dedicated_host_groups_update_request( # pylint: disable=name-too-long return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) -def build_dedicated_host_groups_delete_request( # pylint: disable=name-too-long - resource_group_name: str, host_group_name: str, subscription_id: str, **kwargs: Any +def build_restore_point_collections_delete_request( # pylint: disable=name-too-long + resource_group_name: str, restore_point_collection_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}" + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "hostGroupName": _SERIALIZER.url("host_group_name", host_group_name, "str"), + "restorePointCollectionName": _SERIALIZER.url( + "restore_point_collection_name", restore_point_collection_name, "str" + ), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -3394,7 +3394,7 @@ def build_dedicated_host_groups_delete_request( # pylint: disable=name-too-long return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) -def build_dedicated_host_groups_list_by_resource_group_request( # pylint: disable=name-too-long +def build_restore_point_collections_list_request( # pylint: disable=name-too-long resource_group_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -3404,7 +3404,7 @@ def build_dedicated_host_groups_list_by_resource_group_request( # pylint: disab accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups" + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -3421,7 +3421,7 @@ def build_dedicated_host_groups_list_by_resource_group_request( # pylint: disab return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_dedicated_host_groups_list_by_subscription_request( # pylint: disable=name-too-long +def build_restore_point_collections_list_all_request( # pylint: disable=name-too-long subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -3431,7 +3431,7 @@ def build_dedicated_host_groups_list_by_subscription_request( # pylint: disable accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/hostGroups" + _url = "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/restorePointCollections" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } @@ -3447,13 +3447,13 @@ def build_dedicated_host_groups_list_by_subscription_request( # pylint: disable return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_dedicated_hosts_get_request( +def build_restore_points_get_request( resource_group_name: str, - host_group_name: str, - host_name: str, + restore_point_collection_name: str, + restore_point_name: str, subscription_id: str, *, - expand: Optional[Union[str, _models.InstanceViewTypes]] = None, + expand: Optional[Union[str, _models.RestorePointExpandOptions]] = None, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -3463,12 +3463,14 @@ def build_dedicated_hosts_get_request( accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}" + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{restorePointName}" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "hostGroupName": _SERIALIZER.url("host_group_name", host_group_name, "str"), - "hostName": _SERIALIZER.url("host_name", host_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: str = _url.format(**path_format_arguments) # type: ignore @@ -3484,8 +3486,12 @@ def build_dedicated_hosts_get_request( return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_dedicated_hosts_create_or_update_request( # pylint: disable=name-too-long - resource_group_name: str, host_group_name: str, host_name: str, subscription_id: str, **kwargs: Any +def build_restore_points_create_request( + resource_group_name: str, + restore_point_collection_name: str, + restore_point_name: str, + subscription_id: str, + **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -3495,12 +3501,14 @@ def build_dedicated_hosts_create_or_update_request( # pylint: disable=name-too- accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}" + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{restorePointName}" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "hostGroupName": _SERIALIZER.url("host_group_name", host_group_name, "str"), - "hostName": _SERIALIZER.url("host_name", host_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: str = _url.format(**path_format_arguments) # type: ignore @@ -3516,23 +3524,25 @@ def build_dedicated_hosts_create_or_update_request( # pylint: disable=name-too- return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) -def build_dedicated_hosts_update_request( - resource_group_name: str, host_group_name: str, host_name: str, subscription_id: str, **kwargs: Any +def build_restore_points_delete_request( + resource_group_name: str, + restore_point_collection_name: str, + restore_point_name: str, + subscription_id: str, + **kwargs: Any ) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - accept = _headers.pop("Accept", "application/json") - # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}" + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{restorePointName}" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "hostGroupName": _SERIALIZER.url("host_group_name", host_group_name, "str"), - "hostName": _SERIALIZER.url("host_name", host_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: str = _url.format(**path_format_arguments) # type: ignore @@ -3540,52 +3550,64 @@ def build_dedicated_hosts_update_request( # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) -def build_dedicated_hosts_delete_request( - resource_group_name: str, host_group_name: str, host_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: +def build_capacity_reservation_groups_get_request( # pylint: disable=name-too-long + resource_group_name: str, + capacity_reservation_group_name: str, + subscription_id: str, + *, + expand: Optional[Union[str, _models.CapacityReservationGroupInstanceViewTypes]] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + accept = _headers.pop("Accept", "application/json") + # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}" + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "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"), + "capacityReservationGroupName": _SERIALIZER.url( + "capacity_reservation_group_name", capacity_reservation_group_name, "str" + ), } _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if expand is not None: + _params["$expand"] = _SERIALIZER.query("expand", expand, "str") - return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_dedicated_hosts_list_by_host_group_request( # pylint: disable=name-too-long - resource_group_name: str, host_group_name: str, subscription_id: str, **kwargs: Any +def build_capacity_reservation_groups_create_or_update_request( # pylint: disable=name-too-long + resource_group_name: str, capacity_reservation_group_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts" + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "hostGroupName": _SERIALIZER.url("host_group_name", host_group_name, "str"), + "capacityReservationGroupName": _SERIALIZER.url( + "capacity_reservation_group_name", capacity_reservation_group_name, "str" + ), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -3594,27 +3616,31 @@ def build_dedicated_hosts_list_by_host_group_request( # pylint: disable=name-to _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) -def build_dedicated_hosts_list_available_sizes_request( # pylint: disable=name-too-long - resource_group_name: str, host_group_name: str, host_name: str, subscription_id: str, **kwargs: Any +def build_capacity_reservation_groups_update_request( # pylint: disable=name-too-long + resource_group_name: str, capacity_reservation_group_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}/hostSizes" + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "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"), + "capacityReservationGroupName": _SERIALIZER.url( + "capacity_reservation_group_name", capacity_reservation_group_name, "str" + ), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -3623,24 +3649,27 @@ def build_dedicated_hosts_list_available_sizes_request( # pylint: disable=name- _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) -def build_dedicated_hosts_redeploy_request( - resource_group_name: str, host_group_name: str, host_name: str, subscription_id: str, **kwargs: Any +def build_capacity_reservation_groups_delete_request( # pylint: disable=name-too-long + resource_group_name: str, capacity_reservation_group_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}/redeploy" + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "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"), + "capacityReservationGroupName": _SERIALIZER.url( + "capacity_reservation_group_name", capacity_reservation_group_name, "str" + ), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -3648,34 +3677,48 @@ def build_dedicated_hosts_redeploy_request( # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - return HttpRequest(method="POST", url=_url, params=_params, **kwargs) + return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) -def build_dedicated_hosts_restart_request( - resource_group_name: str, host_group_name: str, host_name: str, subscription_id: str, **kwargs: Any +def build_capacity_reservation_groups_list_by_resource_group_request( # pylint: disable=name-too-long + resource_group_name: str, + subscription_id: str, + *, + expand: Optional[Union[str, _models.ExpandTypesForGetCapacityReservationGroups]] = None, + **kwargs: Any ) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + accept = _headers.pop("Accept", "application/json") + # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}/restart" + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "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"), } _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if expand is not None: + _params["$expand"] = _SERIALIZER.query("expand", expand, "str") - return HttpRequest(method="POST", url=_url, params=_params, **kwargs) + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_ssh_public_key_resources_get_request( # pylint: disable=name-too-long - resource_group_name: str, ssh_public_key_name: str, subscription_id: str, **kwargs: Any +def build_capacity_reservation_groups_list_by_subscription_request( # pylint: disable=name-too-long + subscription_id: str, + *, + expand: Optional[Union[str, _models.ExpandTypesForGetCapacityReservationGroups]] = None, + resource_ids_only: Optional[Union[str, _models.ResourceIdOptionsForGetCapacityReservationGroups]] = None, + **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -3684,17 +3727,19 @@ def build_ssh_public_key_resources_get_request( # pylint: disable=name-too-long accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{sshPublicKeyName}" + _url = "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/capacityReservationGroups" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "sshPublicKeyName": _SERIALIZER.url("ssh_public_key_name", ssh_public_key_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if expand is not None: + _params["$expand"] = _SERIALIZER.query("expand", expand, "str") + if resource_ids_only is not None: + _params["resourceIdsOnly"] = _SERIALIZER.query("resource_ids_only", resource_ids_only, "str") # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") @@ -3702,39 +3747,51 @@ def build_ssh_public_key_resources_get_request( # pylint: disable=name-too-long return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_ssh_public_key_resources_create_request( # pylint: disable=name-too-long - resource_group_name: str, ssh_public_key_name: str, subscription_id: str, **kwargs: Any +def build_capacity_reservations_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: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{sshPublicKeyName}" + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}/capacityReservations/{capacityReservationName}" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "sshPublicKeyName": _SERIALIZER.url("ssh_public_key_name", ssh_public_key_name, "str"), + "capacityReservationGroupName": _SERIALIZER.url( + "capacity_reservation_group_name", capacity_reservation_group_name, "str" + ), + "capacityReservationName": _SERIALIZER.url("capacity_reservation_name", capacity_reservation_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if expand is not None: + _params["$expand"] = _SERIALIZER.query("expand", expand, "str") # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_ssh_public_key_resources_update_request( # pylint: disable=name-too-long - resource_group_name: str, ssh_public_key_name: str, subscription_id: str, **kwargs: Any +def build_capacity_reservations_create_or_update_request( # pylint: disable=name-too-long + resource_group_name: str, + capacity_reservation_group_name: str, + capacity_reservation_name: str, + subscription_id: str, + **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -3744,11 +3801,14 @@ def build_ssh_public_key_resources_update_request( # pylint: disable=name-too-l accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{sshPublicKeyName}" + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}/capacityReservations/{capacityReservationName}" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "sshPublicKeyName": _SERIALIZER.url("ssh_public_key_name", ssh_public_key_name, "str"), + "capacityReservationGroupName": _SERIALIZER.url( + "capacity_reservation_group_name", capacity_reservation_group_name, "str" + ), + "capacityReservationName": _SERIALIZER.url("capacity_reservation_name", capacity_reservation_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -3761,21 +3821,32 @@ def build_ssh_public_key_resources_update_request( # pylint: disable=name-too-l _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) -def build_ssh_public_key_resources_delete_request( # pylint: disable=name-too-long - resource_group_name: str, ssh_public_key_name: str, subscription_id: str, **kwargs: Any +def build_capacity_reservations_update_request( # pylint: disable=name-too-long + resource_group_name: str, + capacity_reservation_group_name: str, + capacity_reservation_name: str, + subscription_id: str, + **kwargs: Any ) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + accept = _headers.pop("Accept", "application/json") + # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{sshPublicKeyName}" + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}/capacityReservations/{capacityReservationName}" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "sshPublicKeyName": _SERIALIZER.url("ssh_public_key_name", ssh_public_key_name, "str"), + "capacityReservationGroupName": _SERIALIZER.url( + "capacity_reservation_group_name", capacity_reservation_group_name, "str" + ), + "capacityReservationName": _SERIALIZER.url("capacity_reservation_name", capacity_reservation_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -3783,25 +3854,33 @@ def build_ssh_public_key_resources_delete_request( # pylint: disable=name-too-l # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) -def build_ssh_public_key_resources_list_by_resource_group_request( # pylint: disable=name-too-long - resource_group_name: str, subscription_id: str, **kwargs: Any + +def build_capacity_reservations_delete_request( # pylint: disable=name-too-long + resource_group_name: str, + capacity_reservation_group_name: str, + capacity_reservation_name: str, + subscription_id: str, + **kwargs: Any ) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - accept = _headers.pop("Accept", "application/json") - # Construct URL - _url = ( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/sshPublicKeys" - ) + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}/capacityReservations/{capacityReservationName}" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "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"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -3809,14 +3888,11 @@ def build_ssh_public_key_resources_list_by_resource_group_request( # pylint: di # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) -def build_ssh_public_key_resources_list_by_subscription_request( # pylint: disable=name-too-long - subscription_id: str, **kwargs: Any +def build_capacity_reservations_list_by_capacity_reservation_group_request( # pylint: disable=name-too-long + resource_group_name: str, capacity_reservation_group_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -3825,9 +3901,13 @@ def build_ssh_public_key_resources_list_by_subscription_request( # pylint: disa accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/sshPublicKeys" + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}/capacityReservations" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "capacityReservationGroupName": _SERIALIZER.url( + "capacity_reservation_group_name", capacity_reservation_group_name, "str" + ), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -3841,69 +3921,77 @@ def build_ssh_public_key_resources_list_by_subscription_request( # pylint: disa return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_ssh_public_key_resources_generate_key_pair_request( # pylint: disable=name-too-long - resource_group_name: str, ssh_public_key_name: str, subscription_id: str, **kwargs: Any +def build_virtual_machine_run_commands_get_by_virtual_machine_request( # pylint: disable=name-too-long + resource_group_name: str, + vm_name: str, + run_command_name: str, + subscription_id: str, + *, + expand: Optional[str] = None, + **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{sshPublicKeyName}/generateKeyPair" + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommands/{runCommandName}" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "sshPublicKeyName": _SERIALIZER.url("ssh_public_key_name", ssh_public_key_name, "str"), + "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), + "runCommandName": _SERIALIZER.url("run_command_name", run_command_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if expand is not None: + _params["$expand"] = _SERIALIZER.query("expand", expand, "str") # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_images_get_request( - resource_group_name: str, image_name: str, subscription_id: str, *, expand: Optional[str] = None, **kwargs: Any +def build_virtual_machine_run_commands_create_or_update_request( # pylint: disable=name-too-long + resource_group_name: str, vm_name: str, run_command_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}" + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommands/{runCommandName}" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "imageName": _SERIALIZER.url("image_name", image_name, "str"), + "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), + "runCommandName": _SERIALIZER.url("run_command_name", run_command_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if expand is not None: - _params["$expand"] = _SERIALIZER.query("expand", expand, "str") # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) -def build_images_create_or_update_request( - resource_group_name: str, image_name: str, subscription_id: str, **kwargs: Any +def build_virtual_machine_run_commands_update_request( # pylint: disable=name-too-long + resource_group_name: str, vm_name: str, run_command_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -3913,11 +4001,12 @@ def build_images_create_or_update_request( accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}" + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommands/{runCommandName}" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "imageName": _SERIALIZER.url("image_name", image_name, "str"), + "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), + "runCommandName": _SERIALIZER.url("run_command_name", run_command_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -3930,25 +4019,22 @@ def build_images_create_or_update_request( _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) -def build_images_update_request( - resource_group_name: str, image_name: str, subscription_id: str, **kwargs: Any +def build_virtual_machine_run_commands_delete_request( # pylint: disable=name-too-long + resource_group_name: str, vm_name: str, run_command_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - accept = _headers.pop("Accept", "application/json") - # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}" + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommands/{runCommandName}" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "imageName": _SERIALIZER.url("image_name", image_name, "str"), + "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), + "runCommandName": _SERIALIZER.url("run_command_name", run_command_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -3956,38 +4042,41 @@ def build_images_update_request( # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) -def build_images_delete_request( - resource_group_name: str, image_name: str, subscription_id: str, **kwargs: Any +def build_virtual_machine_run_commands_list_by_virtual_machine_request( # pylint: disable=name-too-long + resource_group_name: str, vm_name: str, subscription_id: str, *, expand: Optional[str] = None, **kwargs: Any ) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + accept = _headers.pop("Accept", "application/json") + # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}" + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommands" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "imageName": _SERIALIZER.url("image_name", image_name, "str"), + "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if expand is not None: + _params["$expand"] = _SERIALIZER.query("expand", expand, "str") - return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_images_list_by_resource_group_request( # pylint: disable=name-too-long - resource_group_name: str, subscription_id: str, **kwargs: Any + +def build_virtual_machine_run_commands_list_request( # pylint: disable=name-too-long + location: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -3996,10 +4085,10 @@ def build_images_list_by_resource_group_request( # pylint: disable=name-too-lon accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images" + _url = "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/runCommands" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "location": _SERIALIZER.url("location", location, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -4013,7 +4102,9 @@ def build_images_list_by_resource_group_request( # pylint: disable=name-too-lon return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_images_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: +def build_virtual_machine_run_commands_get_request( # pylint: disable=name-too-long + location: str, command_id: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -4021,8 +4112,10 @@ def build_images_list_request(subscription_id: str, **kwargs: Any) -> HttpReques accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/images" + _url = "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/runCommands/{commandId}" path_format_arguments = { + "location": _SERIALIZER.url("location", location, "str"), + "commandId": _SERIALIZER.url("command_id", command_id, "str"), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } @@ -4037,12 +4130,14 @@ def build_images_list_request(subscription_id: str, **kwargs: Any) -> HttpReques return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_restore_point_collections_get_request( # pylint: disable=name-too-long +def build_virtual_machine_scale_set_vm_run_commands_get_request( # pylint: disable=name-too-long resource_group_name: str, - restore_point_collection_name: str, + vm_scale_set_name: str, + instance_id: str, + run_command_name: str, subscription_id: str, *, - expand: Optional[Union[str, _models.RestorePointCollectionExpandOptions]] = None, + expand: Optional[str] = None, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -4052,13 +4147,13 @@ def build_restore_point_collections_get_request( # pylint: disable=name-too-lon accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}" + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/runCommands/{runCommandName}" 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" - ), + "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"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -4074,8 +4169,13 @@ def build_restore_point_collections_get_request( # pylint: disable=name-too-lon return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_restore_point_collections_create_or_update_request( # pylint: disable=name-too-long - resource_group_name: str, restore_point_collection_name: str, subscription_id: str, **kwargs: Any +def build_virtual_machine_scale_set_vm_run_commands_create_or_update_request( # pylint: disable=name-too-long + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + run_command_name: str, + subscription_id: str, + **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -4085,13 +4185,13 @@ def build_restore_point_collections_create_or_update_request( # pylint: disable accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}" + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/runCommands/{runCommandName}" 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" - ), + "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"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -4107,8 +4207,13 @@ def build_restore_point_collections_create_or_update_request( # pylint: disable return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) -def build_restore_point_collections_update_request( # pylint: disable=name-too-long - resource_group_name: str, restore_point_collection_name: str, subscription_id: str, **kwargs: Any +def build_virtual_machine_scale_set_vm_run_commands_update_request( # pylint: disable=name-too-long + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + run_command_name: str, + subscription_id: str, + **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -4118,13 +4223,13 @@ def build_restore_point_collections_update_request( # pylint: disable=name-too- accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}" + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/runCommands/{runCommandName}" 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" - ), + "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"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -4140,20 +4245,25 @@ def build_restore_point_collections_update_request( # pylint: disable=name-too- return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) -def build_restore_point_collections_delete_request( # pylint: disable=name-too-long - resource_group_name: str, restore_point_collection_name: str, subscription_id: str, **kwargs: Any +def build_virtual_machine_scale_set_vm_run_commands_delete_request( # pylint: disable=name-too-long + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + run_command_name: str, + subscription_id: str, + **kwargs: Any ) -> HttpRequest: _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}" + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/runCommands/{runCommandName}" 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" - ), + "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"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -4164,8 +4274,14 @@ def build_restore_point_collections_delete_request( # pylint: disable=name-too- return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) -def build_restore_point_collections_list_request( # pylint: disable=name-too-long - resource_group_name: str, subscription_id: str, **kwargs: Any +def build_virtual_machine_scale_set_vm_run_commands_list_request( # pylint: disable=name-too-long + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + subscription_id: str, + *, + expand: Optional[str] = None, + **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -4174,16 +4290,20 @@ def build_restore_point_collections_list_request( # pylint: disable=name-too-lo accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections" + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/runCommands" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), + "instanceId": _SERIALIZER.url("instance_id", instance_id, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if expand is not None: + _params["$expand"] = _SERIALIZER.query("expand", expand, "str") # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") @@ -4191,8 +4311,8 @@ def build_restore_point_collections_list_request( # pylint: disable=name-too-lo return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_restore_point_collections_list_all_request( # pylint: disable=name-too-long - subscription_id: str, **kwargs: Any +def build_disks_get_request( + resource_group_name: str, disk_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -4201,9 +4321,11 @@ def build_restore_point_collections_list_all_request( # pylint: disable=name-to accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/restorePointCollections" + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "diskName": _SERIALIZER.url("disk_name", disk_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -4217,51 +4339,39 @@ def build_restore_point_collections_list_all_request( # pylint: disable=name-to return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_restore_points_get_request( - resource_group_name: str, - restore_point_collection_name: str, - restore_point_name: str, - subscription_id: str, - *, - expand: Optional[Union[str, _models.RestorePointExpandOptions]] = None, - **kwargs: Any +def build_disks_create_or_update_request( + resource_group_name: str, disk_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{restorePointName}" + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "restorePointCollectionName": _SERIALIZER.url( - "restore_point_collection_name", restore_point_collection_name, "str" - ), - "restorePointName": _SERIALIZER.url("restore_point_name", restore_point_name, "str"), + "diskName": _SERIALIZER.url("disk_name", disk_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if expand is not None: - _params["$expand"] = _SERIALIZER.query("expand", expand, "str") # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) -def build_restore_points_create_request( - resource_group_name: str, - restore_point_collection_name: str, - restore_point_name: str, - subscription_id: str, - **kwargs: Any +def build_disks_update_request( + resource_group_name: str, disk_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -4271,14 +4381,11 @@ def build_restore_points_create_request( accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{restorePointName}" + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "restorePointCollectionName": _SERIALIZER.url( - "restore_point_collection_name", restore_point_collection_name, "str" - ), - "restorePointName": _SERIALIZER.url("restore_point_name", restore_point_name, "str"), + "diskName": _SERIALIZER.url("disk_name", disk_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -4291,28 +4398,21 @@ def build_restore_points_create_request( _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) -def build_restore_points_delete_request( - resource_group_name: str, - restore_point_collection_name: str, - restore_point_name: str, - subscription_id: str, - **kwargs: Any +def build_disks_delete_request( + resource_group_name: str, disk_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{restorePointName}" + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "restorePointCollectionName": _SERIALIZER.url( - "restore_point_collection_name", restore_point_collection_name, "str" - ), - "restorePointName": _SERIALIZER.url("restore_point_name", restore_point_name, "str"), + "diskName": _SERIALIZER.url("disk_name", disk_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -4323,13 +4423,8 @@ def build_restore_points_delete_request( return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) -def build_capacity_reservation_groups_get_request( # pylint: disable=name-too-long - resource_group_name: str, - capacity_reservation_group_name: str, - subscription_id: str, - *, - expand: Optional[Union[str, _models.CapacityReservationGroupInstanceViewTypes]] = None, - **kwargs: Any +def build_disks_list_by_resource_group_request( # pylint: disable=name-too-long + resource_group_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -4338,21 +4433,16 @@ def build_capacity_reservation_groups_get_request( # pylint: disable=name-too-l accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}" + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "capacityReservationGroupName": _SERIALIZER.url( - "capacity_reservation_group_name", capacity_reservation_group_name, "str" - ), } _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if expand is not None: - _params["$expand"] = _SERIALIZER.query("expand", expand, "str") # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") @@ -4360,24 +4450,17 @@ def build_capacity_reservation_groups_get_request( # pylint: disable=name-too-l return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_capacity_reservation_groups_create_or_update_request( # pylint: disable=name-too-long - resource_group_name: str, capacity_reservation_group_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: +def build_disks_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}" + _url = "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/disks" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "capacityReservationGroupName": _SERIALIZER.url( - "capacity_reservation_group_name", capacity_reservation_group_name, "str" - ), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -4386,15 +4469,13 @@ def build_capacity_reservation_groups_create_or_update_request( # pylint: disab _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_capacity_reservation_groups_update_request( # pylint: disable=name-too-long - resource_group_name: str, capacity_reservation_group_name: str, subscription_id: str, **kwargs: Any +def build_disks_grant_access_request( + resource_group_name: str, disk_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -4404,13 +4485,11 @@ def build_capacity_reservation_groups_update_request( # pylint: disable=name-to accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}" + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/beginGetAccess" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "capacityReservationGroupName": _SERIALIZER.url( - "capacity_reservation_group_name", capacity_reservation_group_name, "str" - ), + "diskName": _SERIALIZER.url("disk_name", disk_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -4423,23 +4502,21 @@ def build_capacity_reservation_groups_update_request( # pylint: disable=name-to _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_capacity_reservation_groups_delete_request( # pylint: disable=name-too-long - resource_group_name: str, capacity_reservation_group_name: str, subscription_id: str, **kwargs: Any +def build_disks_revoke_access_request( + resource_group_name: str, disk_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}" + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/endGetAccess" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "capacityReservationGroupName": _SERIALIZER.url( - "capacity_reservation_group_name", capacity_reservation_group_name, "str" - ), + "diskName": _SERIALIZER.url("disk_name", disk_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -4447,15 +4524,11 @@ def build_capacity_reservation_groups_delete_request( # pylint: disable=name-to # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) + return HttpRequest(method="POST", url=_url, params=_params, **kwargs) -def build_capacity_reservation_groups_list_by_resource_group_request( # pylint: disable=name-too-long - resource_group_name: str, - subscription_id: str, - *, - expand: Optional[Union[str, _models.ExpandTypesForGetCapacityReservationGroups]] = None, - **kwargs: Any +def build_disk_accesses_get_request( + resource_group_name: str, disk_access_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -4464,18 +4537,17 @@ def build_capacity_reservation_groups_list_by_resource_group_request( # pylint: accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups" + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "diskAccessName": _SERIALIZER.url("disk_access_name", disk_access_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if expand is not None: - _params["$expand"] = _SERIALIZER.query("expand", expand, "str") # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") @@ -4483,102 +4555,80 @@ def build_capacity_reservation_groups_list_by_resource_group_request( # pylint: return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_capacity_reservation_groups_list_by_subscription_request( # pylint: disable=name-too-long - subscription_id: str, - *, - expand: Optional[Union[str, _models.ExpandTypesForGetCapacityReservationGroups]] = None, - resource_ids_only: Optional[Union[str, _models.ResourceIdOptionsForGetCapacityReservationGroups]] = None, - **kwargs: Any +def build_disk_accesses_create_or_update_request( # pylint: disable=name-too-long + resource_group_name: str, disk_access_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/capacityReservationGroups" + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "diskAccessName": _SERIALIZER.url("disk_access_name", disk_access_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if expand is not None: - _params["$expand"] = _SERIALIZER.query("expand", expand, "str") - if resource_ids_only is not None: - _params["resourceIdsOnly"] = _SERIALIZER.query("resource_ids_only", resource_ids_only, "str") # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) -def build_capacity_reservations_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 +def build_disk_accesses_update_request( + resource_group_name: str, disk_access_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}/capacityReservations/{capacityReservationName}" + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "capacityReservationGroupName": _SERIALIZER.url( - "capacity_reservation_group_name", capacity_reservation_group_name, "str" - ), - "capacityReservationName": _SERIALIZER.url("capacity_reservation_name", capacity_reservation_name, "str"), + "diskAccessName": _SERIALIZER.url("disk_access_name", disk_access_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if expand is not None: - _params["$expand"] = _SERIALIZER.query("expand", expand, "str") # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) -def build_capacity_reservations_create_or_update_request( # pylint: disable=name-too-long - resource_group_name: str, - capacity_reservation_group_name: str, - capacity_reservation_name: str, - subscription_id: str, - **kwargs: Any +def build_disk_accesses_delete_request( + resource_group_name: str, disk_access_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - accept = _headers.pop("Accept", "application/json") - # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}/capacityReservations/{capacityReservationName}" + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "capacityReservationGroupName": _SERIALIZER.url( - "capacity_reservation_group_name", capacity_reservation_group_name, "str" - ), - "capacityReservationName": _SERIALIZER.url("capacity_reservation_name", capacity_reservation_name, "str"), + "diskAccessName": _SERIALIZER.url("disk_access_name", disk_access_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -4586,37 +4636,23 @@ def build_capacity_reservations_create_or_update_request( # pylint: disable=nam # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) -def build_capacity_reservations_update_request( # pylint: disable=name-too-long - resource_group_name: str, - capacity_reservation_group_name: str, - capacity_reservation_name: str, - subscription_id: str, - **kwargs: Any +def build_disk_accesses_list_by_resource_group_request( # pylint: disable=name-too-long + resource_group_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}/capacityReservations/{capacityReservationName}" + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "capacityReservationGroupName": _SERIALIZER.url( - "capacity_reservation_group_name", capacity_reservation_group_name, "str" - ), - "capacityReservationName": _SERIALIZER.url("capacity_reservation_name", capacity_reservation_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -4625,45 +4661,12 @@ def build_capacity_reservations_update_request( # pylint: disable=name-too-long _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_capacity_reservations_delete_request( # pylint: disable=name-too-long - resource_group_name: str, - capacity_reservation_group_name: str, - capacity_reservation_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}/capacityReservations/{capacityReservationName}" - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "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"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_capacity_reservations_list_by_capacity_reservation_group_request( # pylint: disable=name-too-long - resource_group_name: str, capacity_reservation_group_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: +def build_disk_accesses_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -4671,13 +4674,9 @@ def build_capacity_reservations_list_by_capacity_reservation_group_request( # p accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}/capacityReservations" + _url = "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/diskAccesses" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "capacityReservationGroupName": _SERIALIZER.url( - "capacity_reservation_group_name", capacity_reservation_group_name, "str" - ), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -4691,14 +4690,8 @@ def build_capacity_reservations_list_by_capacity_reservation_group_request( # p return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_virtual_machine_run_commands_get_by_virtual_machine_request( # pylint: disable=name-too-long - resource_group_name: str, - vm_name: str, - run_command_name: str, - subscription_id: str, - *, - expand: Optional[str] = None, - **kwargs: Any +def build_disk_accesses_get_private_link_resources_request( # pylint: disable=name-too-long + resource_group_name: str, disk_access_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -4707,20 +4700,17 @@ def build_virtual_machine_run_commands_get_by_virtual_machine_request( # pylint accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommands/{runCommandName}" + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privatelinkresources" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), - "runCommandName": _SERIALIZER.url("run_command_name", run_command_name, "str"), + "diskAccessName": _SERIALIZER.url("disk_access_name", disk_access_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if expand is not None: - _params["$expand"] = _SERIALIZER.query("expand", expand, "str") # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") @@ -4728,23 +4718,28 @@ def build_virtual_machine_run_commands_get_by_virtual_machine_request( # pylint return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_virtual_machine_run_commands_create_or_update_request( # pylint: disable=name-too-long - resource_group_name: str, vm_name: str, run_command_name: str, subscription_id: str, **kwargs: Any +def build_disk_accesses_get_a_private_endpoint_connection_request( # pylint: disable=name-too-long + resource_group_name: str, + disk_access_name: str, + private_endpoint_connection_name: str, + subscription_id: str, + **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommands/{runCommandName}" + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateEndpointConnections/{privateEndpointConnectionName}" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), - "runCommandName": _SERIALIZER.url("run_command_name", run_command_name, "str"), + "diskAccessName": _SERIALIZER.url("disk_access_name", disk_access_name, "str"), + "privateEndpointConnectionName": _SERIALIZER.url( + "private_endpoint_connection_name", private_endpoint_connection_name, "str" + ), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -4753,15 +4748,17 @@ def build_virtual_machine_run_commands_create_or_update_request( # pylint: disa _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_virtual_machine_run_commands_update_request( # pylint: disable=name-too-long - resource_group_name: str, vm_name: str, run_command_name: str, subscription_id: str, **kwargs: Any +def build_disk_accesses_update_a_private_endpoint_connection_request( # pylint: disable=name-too-long + resource_group_name: str, + disk_access_name: str, + private_endpoint_connection_name: str, + subscription_id: str, + **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -4771,12 +4768,14 @@ def build_virtual_machine_run_commands_update_request( # pylint: disable=name-t accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommands/{runCommandName}" + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateEndpointConnections/{privateEndpointConnectionName}" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), - "runCommandName": _SERIALIZER.url("run_command_name", run_command_name, "str"), + "diskAccessName": _SERIALIZER.url("disk_access_name", disk_access_name, "str"), + "privateEndpointConnectionName": _SERIALIZER.url( + "private_endpoint_connection_name", private_endpoint_connection_name, "str" + ), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -4789,22 +4788,28 @@ def build_virtual_machine_run_commands_update_request( # pylint: disable=name-t _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) -def build_virtual_machine_run_commands_delete_request( # pylint: disable=name-too-long - resource_group_name: str, vm_name: str, run_command_name: str, subscription_id: str, **kwargs: Any +def build_disk_accesses_delete_a_private_endpoint_connection_request( # pylint: disable=name-too-long + resource_group_name: str, + disk_access_name: str, + private_endpoint_connection_name: str, + subscription_id: str, + **kwargs: Any ) -> HttpRequest: _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommands/{runCommandName}" + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateEndpointConnections/{privateEndpointConnectionName}" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), - "runCommandName": _SERIALIZER.url("run_command_name", run_command_name, "str"), + "diskAccessName": _SERIALIZER.url("disk_access_name", disk_access_name, "str"), + "privateEndpointConnectionName": _SERIALIZER.url( + "private_endpoint_connection_name", private_endpoint_connection_name, "str" + ), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -4815,8 +4820,8 @@ def build_virtual_machine_run_commands_delete_request( # pylint: disable=name-t return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) -def build_virtual_machine_run_commands_list_by_virtual_machine_request( # pylint: disable=name-too-long - resource_group_name: str, vm_name: str, subscription_id: str, *, expand: Optional[str] = None, **kwargs: Any +def build_disk_accesses_list_private_endpoint_connections_request( # pylint: disable=name-too-long + resource_group_name: str, disk_access_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -4825,19 +4830,17 @@ def build_virtual_machine_run_commands_list_by_virtual_machine_request( # pylin accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommands" + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateEndpointConnections" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), + "diskAccessName": _SERIALIZER.url("disk_access_name", disk_access_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if expand is not None: - _params["$expand"] = _SERIALIZER.query("expand", expand, "str") # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") @@ -4845,15 +4848,8 @@ def build_virtual_machine_run_commands_list_by_virtual_machine_request( # pylin return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_virtual_machine_scale_set_vm_run_commands_get_request( # pylint: disable=name-too-long - 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 +def build_disk_encryption_sets_get_request( + resource_group_name: str, disk_encryption_set_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -4862,21 +4858,17 @@ def build_virtual_machine_scale_set_vm_run_commands_get_request( # pylint: disa accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/runCommands/{runCommandName}" + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "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"), + "diskEncryptionSetName": _SERIALIZER.url("disk_encryption_set_name", disk_encryption_set_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if expand is not None: - _params["$expand"] = _SERIALIZER.query("expand", expand, "str") # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") @@ -4884,13 +4876,8 @@ def build_virtual_machine_scale_set_vm_run_commands_get_request( # pylint: disa return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_virtual_machine_scale_set_vm_run_commands_create_or_update_request( # pylint: disable=name-too-long - resource_group_name: str, - vm_scale_set_name: str, - instance_id: str, - run_command_name: str, - subscription_id: str, - **kwargs: Any +def build_disk_encryption_sets_create_or_update_request( # pylint: disable=name-too-long + resource_group_name: str, disk_encryption_set_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -4900,13 +4887,11 @@ def build_virtual_machine_scale_set_vm_run_commands_create_or_update_request( # accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/runCommands/{runCommandName}" + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "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"), + "diskEncryptionSetName": _SERIALIZER.url("disk_encryption_set_name", disk_encryption_set_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -4922,13 +4907,8 @@ def build_virtual_machine_scale_set_vm_run_commands_create_or_update_request( # return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) -def build_virtual_machine_scale_set_vm_run_commands_update_request( # pylint: disable=name-too-long - resource_group_name: str, - vm_scale_set_name: str, - instance_id: str, - run_command_name: str, - subscription_id: str, - **kwargs: Any +def build_disk_encryption_sets_update_request( # pylint: disable=name-too-long + resource_group_name: str, disk_encryption_set_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -4938,13 +4918,11 @@ def build_virtual_machine_scale_set_vm_run_commands_update_request( # pylint: d accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/runCommands/{runCommandName}" + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "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"), + "diskEncryptionSetName": _SERIALIZER.url("disk_encryption_set_name", disk_encryption_set_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -4960,25 +4938,18 @@ def build_virtual_machine_scale_set_vm_run_commands_update_request( # pylint: d return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) -def build_virtual_machine_scale_set_vm_run_commands_delete_request( # pylint: disable=name-too-long - resource_group_name: str, - vm_scale_set_name: str, - instance_id: str, - run_command_name: str, - subscription_id: str, - **kwargs: Any +def build_disk_encryption_sets_delete_request( # pylint: disable=name-too-long + resource_group_name: str, disk_encryption_set_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/runCommands/{runCommandName}" + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "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"), + "diskEncryptionSetName": _SERIALIZER.url("disk_encryption_set_name", disk_encryption_set_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -4989,14 +4960,8 @@ def build_virtual_machine_scale_set_vm_run_commands_delete_request( # pylint: d return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) -def build_virtual_machine_scale_set_vm_run_commands_list_request( # pylint: disable=name-too-long - resource_group_name: str, - vm_scale_set_name: str, - instance_id: str, - subscription_id: str, - *, - expand: Optional[str] = None, - **kwargs: Any +def build_disk_encryption_sets_list_by_resource_group_request( # pylint: disable=name-too-long + resource_group_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -5005,20 +4970,16 @@ def build_virtual_machine_scale_set_vm_run_commands_list_request( # pylint: dis accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/runCommands" + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), - "instanceId": _SERIALIZER.url("instance_id", instance_id, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if expand is not None: - _params["$expand"] = _SERIALIZER.query("expand", expand, "str") # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") @@ -5026,7 +4987,7 @@ def build_virtual_machine_scale_set_vm_run_commands_list_request( # pylint: dis return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_usage_operation_group_list_request(location: str, subscription_id: str, **kwargs: Any) -> HttpRequest: +def build_disk_encryption_sets_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -5034,10 +4995,9 @@ def build_usage_operation_group_list_request(location: str, subscription_id: str accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/usages" + _url = "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/diskEncryptionSets" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "location": _SERIALIZER.url("location", location, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -5051,8 +5011,8 @@ def build_usage_operation_group_list_request(location: str, subscription_id: str return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_virtual_machine_sizes_operation_group_list_request( # pylint: disable=name-too-long - location: str, subscription_id: str, **kwargs: Any +def build_disk_encryption_sets_list_associated_resources_request( # pylint: disable=name-too-long + resource_group_name: str, disk_encryption_set_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -5061,10 +5021,11 @@ def build_virtual_machine_sizes_operation_group_list_request( # pylint: disable accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/vmSizes" + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}/associatedResources" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "location": _SERIALIZER.url("location", location, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "diskEncryptionSetName": _SERIALIZER.url("disk_encryption_set_name", disk_encryption_set_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -5078,8 +5039,8 @@ def build_virtual_machine_sizes_operation_group_list_request( # pylint: disable return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_virtual_machine_scale_sets_operation_group_list_by_location_request( # pylint: disable=name-too-long - location: str, subscription_id: str, **kwargs: Any +def build_snapshots_get_request( + resource_group_name: str, snapshot_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -5088,10 +5049,11 @@ def build_virtual_machine_scale_sets_operation_group_list_by_location_request( accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/virtualMachineScaleSets" + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "location": _SERIALIZER.url("location", location, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "snapshotName": _SERIALIZER.url("snapshot_name", snapshot_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -5105,20 +5067,22 @@ def build_virtual_machine_scale_sets_operation_group_list_by_location_request( return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_virtual_machines_operation_group_list_by_location_request( # pylint: disable=name-too-long - location: str, subscription_id: str, **kwargs: Any +def build_snapshots_create_or_update_request( + resource_group_name: str, snapshot_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/virtualMachines" + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "location": _SERIALIZER.url("location", location, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "snapshotName": _SERIALIZER.url("snapshot_name", snapshot_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -5127,26 +5091,29 @@ def build_virtual_machines_operation_group_list_by_location_request( # pylint: _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) -def build_virtual_machine_images_edge_zone_operation_group_list_publishers_request( # pylint: disable=name-too-long - location: str, edge_zone: str, subscription_id: str, **kwargs: Any +def build_snapshots_update_request( + resource_group_name: str, snapshot_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/edgeZones/{edgeZone}/publishers" + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "location": _SERIALIZER.url("location", location, "str"), - "edgeZone": _SERIALIZER.url("edge_zone", edge_zone, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "snapshotName": _SERIALIZER.url("snapshot_name", snapshot_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -5155,27 +5122,25 @@ def build_virtual_machine_images_edge_zone_operation_group_list_publishers_reque _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) -def build_virtual_machine_images_edge_zone_operation_group_list_offers_request( # pylint: disable=name-too-long - location: str, edge_zone: str, publisher_name: str, subscription_id: str, **kwargs: Any +def build_snapshots_delete_request( + resource_group_name: str, snapshot_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - accept = _headers.pop("Accept", "application/json") - # Construct URL - _url = "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/edgeZones/{edgeZone}/publishers/{publisherName}/artifacttypes/vmimage/offers" + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "location": _SERIALIZER.url("location", location, "str"), - "edgeZone": _SERIALIZER.url("edge_zone", edge_zone, "str"), - "publisherName": _SERIALIZER.url("publisher_name", publisher_name, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "snapshotName": _SERIALIZER.url("snapshot_name", snapshot_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -5183,14 +5148,11 @@ def build_virtual_machine_images_edge_zone_operation_group_list_offers_request( # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) -def build_virtual_machine_images_edge_zone_operation_group_list_skus_request( # pylint: disable=name-too-long - location: str, edge_zone: str, publisher_name: str, offer: str, subscription_id: str, **kwargs: Any +def build_snapshots_list_by_resource_group_request( # pylint: disable=name-too-long + resource_group_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -5199,13 +5161,10 @@ def build_virtual_machine_images_edge_zone_operation_group_list_skus_request( # accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/edgeZones/{edgeZone}/publishers/{publisherName}/artifacttypes/vmimage/offers/{offer}/skus" + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "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"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -5219,19 +5178,7 @@ def build_virtual_machine_images_edge_zone_operation_group_list_skus_request( # return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_virtual_machine_images_edge_zone_operation_group_list_request( # pylint: disable=name-too-long - 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: +def build_snapshots_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -5239,26 +5186,15 @@ def build_virtual_machine_images_edge_zone_operation_group_list_request( # pyli accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/edgeZones/{edgeZone}/publishers/{publisherName}/artifacttypes/vmimage/offers/{offer}/skus/{skus}/versions" + _url = "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/snapshots" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "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"), } _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if expand is not None: - _params["$expand"] = _SERIALIZER.query("expand", expand, "str") - if top is not None: - _params["$top"] = _SERIALIZER.query("top", top, "int") - if orderby is not None: - _params["$orderby"] = _SERIALIZER.query("orderby", orderby, "str") # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") @@ -5266,32 +5202,22 @@ def build_virtual_machine_images_edge_zone_operation_group_list_request( # pyli return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_virtual_machine_images_edge_zone_operation_group_get_request( # pylint: disable=name-too-long - location: str, - edge_zone: str, - publisher_name: str, - offer: str, - skus: str, - version: str, - subscription_id: str, - **kwargs: Any +def build_snapshots_grant_access_request( + resource_group_name: str, snapshot_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/edgeZones/{edgeZone}/publishers/{publisherName}/artifacttypes/vmimage/offers/{offer}/skus/{skus}/versions/{version}" + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/beginGetAccess" 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"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "snapshotName": _SERIALIZER.url("snapshot_name", snapshot_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -5300,28 +5226,25 @@ def build_virtual_machine_images_edge_zone_operation_group_get_request( # pylin _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_virtual_machine_images_operation_group_list_by_edge_zone_request( # pylint: disable=name-too-long - location: str, edge_zone: str, subscription_id: str, **kwargs: Any +def build_snapshots_revoke_access_request( + resource_group_name: str, snapshot_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - accept = _headers.pop("Accept", "application/json") - # Construct URL - _url = ( - "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/edgeZones/{edgeZone}/vmimages" - ) + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/endGetAccess" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "location": _SERIALIZER.url("location", location, "str"), - "edgeZone": _SERIALIZER.url("edge_zone", edge_zone, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "snapshotName": _SERIALIZER.url("snapshot_name", snapshot_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -5329,14 +5252,17 @@ def build_virtual_machine_images_operation_group_list_by_edge_zone_request( # p # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="POST", url=_url, params=_params, **kwargs) -def build_virtual_machine_images_operation_group_list_publishers_request( # pylint: disable=name-too-long - location: str, subscription_id: str, **kwargs: Any +def build_galleries_get_request( + resource_group_name: str, + gallery_name: str, + subscription_id: str, + *, + select: Optional[Union[str, _models.SelectPermissions]] = None, + expand: Optional[Union[str, _models.GalleryExpandParams]] = None, + **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -5345,16 +5271,21 @@ def build_virtual_machine_images_operation_group_list_publishers_request( # pyl accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers" + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "location": _SERIALIZER.url("location", location, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "galleryName": _SERIALIZER.url("gallery_name", gallery_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if select is not None: + _params["$select"] = _SERIALIZER.query("select", select, "str") + if expand is not None: + _params["$expand"] = _SERIALIZER.query("expand", expand, "str") # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") @@ -5362,21 +5293,22 @@ def build_virtual_machine_images_operation_group_list_publishers_request( # pyl return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_virtual_machine_images_operation_group_list_offers_request( # pylint: disable=name-too-long - location: str, publisher_name: str, subscription_id: str, **kwargs: Any +def build_galleries_create_or_update_request( + resource_group_name: str, gallery_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmimage/offers" + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "location": _SERIALIZER.url("location", location, "str"), - "publisherName": _SERIALIZER.url("publisher_name", publisher_name, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "galleryName": _SERIALIZER.url("gallery_name", gallery_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -5385,27 +5317,29 @@ def build_virtual_machine_images_operation_group_list_offers_request( # pylint: _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) -def build_virtual_machine_images_operation_group_list_skus_request( # pylint: disable=name-too-long - location: str, publisher_name: str, offer: str, subscription_id: str, **kwargs: Any +def build_galleries_update_request( + resource_group_name: str, gallery_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmimage/offers/{offer}/skus" + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "location": _SERIALIZER.url("location", location, "str"), - "publisherName": _SERIALIZER.url("publisher_name", publisher_name, "str"), - "offer": _SERIALIZER.url("offer", offer, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "galleryName": _SERIALIZER.url("gallery_name", gallery_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -5414,49 +5348,55 @@ def build_virtual_machine_images_operation_group_list_skus_request( # pylint: d _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) -def build_virtual_machine_images_operation_group_list_request( # pylint: disable=name-too-long - 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 +def build_galleries_delete_request( + resource_group_name: str, gallery_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - accept = _headers.pop("Accept", "application/json") - # Construct URL - _url = "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmimage/offers/{offer}/skus/{skus}/versions" + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "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"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "galleryName": _SERIALIZER.url("gallery_name", gallery_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) + + +def build_galleries_list_by_resource_group_request( # pylint: disable=name-too-long + resource_group_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if expand is not None: - _params["$expand"] = _SERIALIZER.query("expand", expand, "str") - if top is not None: - _params["$top"] = _SERIALIZER.query("top", top, "int") - if orderby is not None: - _params["$orderby"] = _SERIALIZER.query("orderby", orderby, "str") # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") @@ -5464,18 +5404,7 @@ def build_virtual_machine_images_operation_group_list_request( # pylint: disabl return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_virtual_machine_images_operation_group_list_with_properties_request( # pylint: disable=name-too-long - location: str, - publisher_name: str, - offer: str, - skus: str, - subscription_id: str, - *, - expand: str, - top: Optional[int] = None, - orderby: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: +def build_galleries_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -5483,24 +5412,15 @@ def build_virtual_machine_images_operation_group_list_with_properties_request( accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmimage/offers/{offer}/skus/{skus}/versions?$expand=Properties" + _url = "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/galleries" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "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"), } _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - _params["$expand"] = _SERIALIZER.query("expand", expand, "str") - if top is not None: - _params["$top"] = _SERIALIZER.query("top", top, "int") - if orderby is not None: - _params["$orderby"] = _SERIALIZER.query("orderby", orderby, "str") # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") @@ -5508,8 +5428,8 @@ def build_virtual_machine_images_operation_group_list_with_properties_request( return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_virtual_machine_images_operation_group_get_request( # pylint: disable=name-too-long - location: str, publisher_name: str, offer: str, skus: str, version: str, subscription_id: str, **kwargs: Any +def build_gallery_images_get_request( + resource_group_name: str, gallery_name: str, gallery_image_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -5518,14 +5438,12 @@ def build_virtual_machine_images_operation_group_get_request( # pylint: disable accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmimage/offers/{offer}/skus/{skus}/versions/{version}" + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}" 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"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "galleryName": _SERIALIZER.url("gallery_name", gallery_name, "str"), + "galleryImageName": _SERIALIZER.url("gallery_image_name", gallery_image_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -5539,8 +5457,8 @@ def build_virtual_machine_images_operation_group_get_request( # pylint: disable return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_log_analytics_operation_group_export_request_rate_by_interval_request( # pylint: disable=name-too-long - location: str, subscription_id: str, **kwargs: Any +def build_gallery_images_create_or_update_request( # pylint: disable=name-too-long + resource_group_name: str, gallery_name: str, gallery_image_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -5550,10 +5468,12 @@ def build_log_analytics_operation_group_export_request_rate_by_interval_request( accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/logAnalytics/apiAccess/getRequestRateByInterval" + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "location": _SERIALIZER.url("location", location, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "galleryName": _SERIALIZER.url("gallery_name", gallery_name, "str"), + "galleryImageName": _SERIALIZER.url("gallery_image_name", gallery_image_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -5566,11 +5486,11 @@ def build_log_analytics_operation_group_export_request_rate_by_interval_request( _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) -def build_log_analytics_operation_group_export_throttled_requests_request( # pylint: disable=name-too-long - location: str, subscription_id: str, **kwargs: Any +def build_gallery_images_update_request( + resource_group_name: str, gallery_name: str, gallery_image_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -5580,10 +5500,12 @@ def build_log_analytics_operation_group_export_throttled_requests_request( # py accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/logAnalytics/apiAccess/getThrottledRequests" + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "location": _SERIALIZER.url("location", location, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "galleryName": _SERIALIZER.url("gallery_name", gallery_name, "str"), + "galleryImageName": _SERIALIZER.url("gallery_image_name", gallery_image_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -5596,23 +5518,22 @@ def build_log_analytics_operation_group_export_throttled_requests_request( # py _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) -def build_virtual_machine_run_commands_operation_group_list_request( # pylint: disable=name-too-long - location: str, subscription_id: str, **kwargs: Any +def build_gallery_images_delete_request( + resource_group_name: str, gallery_name: str, gallery_image_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - accept = _headers.pop("Accept", None) - # Construct URL - _url = "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/runCommands" + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "location": _SERIALIZER.url("location", location, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "galleryName": _SERIALIZER.url("gallery_name", gallery_name, "str"), + "galleryImageName": _SERIALIZER.url("gallery_image_name", gallery_image_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -5620,28 +5541,24 @@ def build_virtual_machine_run_commands_operation_group_list_request( # pylint: # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - # Construct headers - if accept is not None: - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) -def build_virtual_machine_run_commands_operation_group_get_request( # pylint: disable=name-too-long - location: str, command_id: str, subscription_id: str, **kwargs: Any +def build_gallery_images_list_by_gallery_request( # pylint: disable=name-too-long + resource_group_name: str, gallery_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - accept = _headers.pop("Accept", None) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/runCommands/{commandId}" + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images" path_format_arguments = { - "location": _SERIALIZER.url("location", location, "str"), - "commandId": _SERIALIZER.url("command_id", command_id, "str"), "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: str = _url.format(**path_format_arguments) # type: ignore @@ -5650,14 +5567,20 @@ def build_virtual_machine_run_commands_operation_group_get_request( # pylint: d _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - if accept is not None: - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_disks_get_request( - resource_group_name: str, disk_name: str, subscription_id: str, **kwargs: Any +def build_gallery_image_versions_get_request( + resource_group_name: str, + gallery_name: str, + gallery_image_name: str, + gallery_image_version_name: str, + subscription_id: str, + *, + expand: Optional[Union[str, _models.ReplicationStatusTypes]] = None, + **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -5666,17 +5589,21 @@ def build_disks_get_request( accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}" + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "diskName": _SERIALIZER.url("disk_name", disk_name, "str"), + "galleryName": _SERIALIZER.url("gallery_name", gallery_name, "str"), + "galleryImageName": _SERIALIZER.url("gallery_image_name", gallery_image_name, "str"), + "galleryImageVersionName": _SERIALIZER.url("gallery_image_version_name", gallery_image_version_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if expand is not None: + _params["$expand"] = _SERIALIZER.query("expand", expand, "str") # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") @@ -5684,8 +5611,13 @@ def build_disks_get_request( return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_disks_create_or_update_request( - resource_group_name: str, disk_name: str, subscription_id: str, **kwargs: Any +def build_gallery_image_versions_create_or_update_request( # pylint: disable=name-too-long + resource_group_name: str, + gallery_name: str, + gallery_image_name: str, + gallery_image_version_name: str, + subscription_id: str, + **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -5695,11 +5627,13 @@ def build_disks_create_or_update_request( accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}" + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "diskName": _SERIALIZER.url("disk_name", disk_name, "str"), + "galleryName": _SERIALIZER.url("gallery_name", gallery_name, "str"), + "galleryImageName": _SERIALIZER.url("gallery_image_name", gallery_image_name, "str"), + "galleryImageVersionName": _SERIALIZER.url("gallery_image_version_name", gallery_image_version_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -5715,8 +5649,13 @@ def build_disks_create_or_update_request( return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) -def build_disks_update_request( - resource_group_name: str, disk_name: str, subscription_id: str, **kwargs: Any +def build_gallery_image_versions_update_request( # pylint: disable=name-too-long + resource_group_name: str, + gallery_name: str, + gallery_image_name: str, + gallery_image_version_name: str, + subscription_id: str, + **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -5726,11 +5665,13 @@ def build_disks_update_request( accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}" + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "diskName": _SERIALIZER.url("disk_name", disk_name, "str"), + "galleryName": _SERIALIZER.url("gallery_name", gallery_name, "str"), + "galleryImageName": _SERIALIZER.url("gallery_image_name", gallery_image_name, "str"), + "galleryImageVersionName": _SERIALIZER.url("gallery_image_version_name", gallery_image_version_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -5746,18 +5687,25 @@ def build_disks_update_request( return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) -def build_disks_delete_request( - resource_group_name: str, disk_name: str, subscription_id: str, **kwargs: Any +def build_gallery_image_versions_delete_request( # pylint: disable=name-too-long + resource_group_name: str, + gallery_name: str, + gallery_image_name: str, + gallery_image_version_name: str, + subscription_id: str, + **kwargs: Any ) -> HttpRequest: _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}" + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "diskName": _SERIALIZER.url("disk_name", disk_name, "str"), + "galleryName": _SERIALIZER.url("gallery_name", gallery_name, "str"), + "galleryImageName": _SERIALIZER.url("gallery_image_name", gallery_image_name, "str"), + "galleryImageVersionName": _SERIALIZER.url("gallery_image_version_name", gallery_image_version_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -5768,8 +5716,8 @@ def build_disks_delete_request( return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) -def build_disks_list_by_resource_group_request( # pylint: disable=name-too-long - resource_group_name: str, subscription_id: str, **kwargs: Any +def build_gallery_image_versions_list_by_gallery_image_request( # pylint: disable=name-too-long + resource_group_name: str, gallery_name: str, gallery_image_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -5778,10 +5726,12 @@ def build_disks_list_by_resource_group_request( # pylint: disable=name-too-long accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks" + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}/versions" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "galleryName": _SERIALIZER.url("gallery_name", gallery_name, "str"), + "galleryImageName": _SERIALIZER.url("gallery_image_name", gallery_image_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -5795,7 +5745,9 @@ def build_disks_list_by_resource_group_request( # pylint: disable=name-too-long return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_disks_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: +def build_gallery_applications_get_request( + resource_group_name: str, gallery_name: str, gallery_application_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -5803,9 +5755,12 @@ def build_disks_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/disks" + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "galleryName": _SERIALIZER.url("gallery_name", gallery_name, "str"), + "galleryApplicationName": _SERIALIZER.url("gallery_application_name", gallery_application_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -5819,8 +5774,8 @@ def build_disks_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_disks_grant_access_request( - resource_group_name: str, disk_name: str, subscription_id: str, **kwargs: Any +def build_gallery_applications_create_or_update_request( # pylint: disable=name-too-long + resource_group_name: str, gallery_name: str, gallery_application_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -5830,11 +5785,12 @@ def build_disks_grant_access_request( accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/beginGetAccess" + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "diskName": _SERIALIZER.url("disk_name", disk_name, "str"), + "galleryName": _SERIALIZER.url("gallery_name", gallery_name, "str"), + "galleryApplicationName": _SERIALIZER.url("gallery_application_name", gallery_application_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -5847,21 +5803,26 @@ def build_disks_grant_access_request( _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) -def build_disks_revoke_access_request( - resource_group_name: str, disk_name: str, subscription_id: str, **kwargs: Any +def build_gallery_applications_update_request( # pylint: disable=name-too-long + resource_group_name: str, gallery_name: str, gallery_application_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + accept = _headers.pop("Accept", "application/json") + # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/endGetAccess" + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "diskName": _SERIALIZER.url("disk_name", disk_name, "str"), + "galleryName": _SERIALIZER.url("gallery_name", gallery_name, "str"), + "galleryApplicationName": _SERIALIZER.url("gallery_application_name", gallery_application_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -5869,11 +5830,39 @@ def build_disks_revoke_access_request( # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - return HttpRequest(method="POST", url=_url, params=_params, **kwargs) + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) -def build_disk_accesses_get_request( - resource_group_name: str, disk_access_name: str, subscription_id: str, **kwargs: Any +def build_gallery_applications_delete_request( # pylint: disable=name-too-long + resource_group_name: str, gallery_name: str, gallery_application_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "galleryName": _SERIALIZER.url("gallery_name", gallery_name, "str"), + "galleryApplicationName": _SERIALIZER.url("gallery_application_name", gallery_application_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) + + +def build_gallery_applications_list_by_gallery_request( # pylint: disable=name-too-long + resource_group_name: str, gallery_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -5882,11 +5871,11 @@ def build_disk_accesses_get_request( accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}" + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "diskAccessName": _SERIALIZER.url("disk_access_name", disk_access_name, "str"), + "galleryName": _SERIALIZER.url("gallery_name", gallery_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -5900,39 +5889,54 @@ def build_disk_accesses_get_request( return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_disk_accesses_create_or_update_request( # pylint: disable=name-too-long - resource_group_name: str, disk_access_name: str, subscription_id: str, **kwargs: Any +def build_gallery_application_versions_get_request( # pylint: disable=name-too-long + resource_group_name: str, + gallery_name: str, + gallery_application_name: str, + gallery_application_version_name: str, + subscription_id: str, + *, + expand: Optional[Union[str, _models.ReplicationStatusTypes]] = None, + **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}" + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}/versions/{galleryApplicationVersionName}" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "diskAccessName": _SERIALIZER.url("disk_access_name", disk_access_name, "str"), + "galleryName": _SERIALIZER.url("gallery_name", gallery_name, "str"), + "galleryApplicationName": _SERIALIZER.url("gallery_application_name", gallery_application_name, "str"), + "galleryApplicationVersionName": _SERIALIZER.url( + "gallery_application_version_name", gallery_application_version_name, "str" + ), } _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if expand is not None: + _params["$expand"] = _SERIALIZER.query("expand", expand, "str") # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_disk_accesses_update_request( - resource_group_name: str, disk_access_name: str, subscription_id: str, **kwargs: Any +def build_gallery_application_versions_create_or_update_request( # pylint: disable=name-too-long + resource_group_name: str, + gallery_name: str, + gallery_application_name: str, + gallery_application_version_name: str, + subscription_id: str, + **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -5942,11 +5946,15 @@ def build_disk_accesses_update_request( accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}" + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}/versions/{galleryApplicationVersionName}" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "diskAccessName": _SERIALIZER.url("disk_access_name", disk_access_name, "str"), + "galleryName": _SERIALIZER.url("gallery_name", gallery_name, "str"), + "galleryApplicationName": _SERIALIZER.url("gallery_application_name", gallery_application_name, "str"), + "galleryApplicationVersionName": _SERIALIZER.url( + "gallery_application_version_name", gallery_application_version_name, "str" + ), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -5959,21 +5967,34 @@ def build_disk_accesses_update_request( _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) -def build_disk_accesses_delete_request( - resource_group_name: str, disk_access_name: str, subscription_id: str, **kwargs: Any +def build_gallery_application_versions_update_request( # pylint: disable=name-too-long + resource_group_name: str, + gallery_name: str, + gallery_application_name: str, + gallery_application_version_name: str, + subscription_id: str, + **kwargs: Any ) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + accept = _headers.pop("Accept", "application/json") + # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}" + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}/versions/{galleryApplicationVersionName}" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "diskAccessName": _SERIALIZER.url("disk_access_name", disk_access_name, "str"), + "galleryName": _SERIALIZER.url("gallery_name", gallery_name, "str"), + "galleryApplicationName": _SERIALIZER.url("gallery_application_name", gallery_application_name, "str"), + "galleryApplicationVersionName": _SERIALIZER.url( + "gallery_application_version_name", gallery_application_version_name, "str" + ), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -5981,23 +6002,35 @@ def build_disk_accesses_delete_request( # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) -def build_disk_accesses_list_by_resource_group_request( # pylint: disable=name-too-long - resource_group_name: str, subscription_id: str, **kwargs: Any +def build_gallery_application_versions_delete_request( # pylint: disable=name-too-long + resource_group_name: str, + gallery_name: str, + gallery_application_name: str, + gallery_application_version_name: str, + subscription_id: str, + **kwargs: Any ) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - accept = _headers.pop("Accept", "application/json") - # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses" + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}/versions/{galleryApplicationVersionName}" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "galleryName": _SERIALIZER.url("gallery_name", gallery_name, "str"), + "galleryApplicationName": _SERIALIZER.url("gallery_application_name", gallery_application_name, "str"), + "galleryApplicationVersionName": _SERIALIZER.url( + "gallery_application_version_name", gallery_application_version_name, "str" + ), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -6005,13 +6038,12 @@ def build_disk_accesses_list_by_resource_group_request( # pylint: disable=name- # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) -def build_disk_accesses_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: +def build_gallery_application_versions_list_by_gallery_application_request( # pylint: disable=name-too-long + resource_group_name: str, gallery_name: str, gallery_application_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -6019,9 +6051,12 @@ def build_disk_accesses_list_request(subscription_id: str, **kwargs: Any) -> Htt accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/diskAccesses" + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}/versions" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "galleryName": _SERIALIZER.url("gallery_name", gallery_name, "str"), + "galleryApplicationName": _SERIALIZER.url("gallery_application_name", gallery_application_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -6035,8 +6070,12 @@ def build_disk_accesses_list_request(subscription_id: str, **kwargs: Any) -> Htt return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_disk_accesses_get_private_link_resources_request( # pylint: disable=name-too-long - resource_group_name: str, disk_access_name: str, subscription_id: str, **kwargs: Any +def build_gallery_in_vm_access_control_profiles_get_request( # pylint: disable=name-too-long + resource_group_name: str, + gallery_name: str, + in_vm_access_control_profile_name: str, + subscription_id: str, + **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -6045,11 +6084,14 @@ def build_disk_accesses_get_private_link_resources_request( # pylint: disable=n accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privatelinkresources" + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/inVMAccessControlProfiles/{inVMAccessControlProfileName}" 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"), + "galleryName": _SERIALIZER.url("gallery_name", gallery_name, "str"), + "inVMAccessControlProfileName": _SERIALIZER.url( + "in_vm_access_control_profile_name", in_vm_access_control_profile_name, "str" + ), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -6063,27 +6105,28 @@ def build_disk_accesses_get_private_link_resources_request( # pylint: disable=n return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_private_endpoint_connections_get_a_private_endpoint_connection_request( # pylint: disable=name-too-long +def build_gallery_in_vm_access_control_profiles_create_or_update_request( # pylint: disable=name-too-long resource_group_name: str, - disk_access_name: str, - private_endpoint_connection_name: str, + gallery_name: str, + in_vm_access_control_profile_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateEndpointConnections/{privateEndpointConnectionName}" + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/inVMAccessControlProfiles/{inVMAccessControlProfileName}" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "diskAccessName": _SERIALIZER.url("disk_access_name", disk_access_name, "str"), - "privateEndpointConnectionName": _SERIALIZER.url( - "private_endpoint_connection_name", private_endpoint_connection_name, "str" + "galleryName": _SERIALIZER.url("gallery_name", gallery_name, "str"), + "inVMAccessControlProfileName": _SERIALIZER.url( + "in_vm_access_control_profile_name", in_vm_access_control_profile_name, "str" ), } @@ -6093,15 +6136,17 @@ def build_private_endpoint_connections_get_a_private_endpoint_connection_request _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) -def build_private_endpoint_connections_update_a_private_endpoint_connection_request( # pylint: disable=name-too-long +def build_gallery_in_vm_access_control_profiles_update_request( # pylint: disable=name-too-long resource_group_name: str, - disk_access_name: str, - private_endpoint_connection_name: str, + gallery_name: str, + in_vm_access_control_profile_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: @@ -6113,13 +6158,13 @@ def build_private_endpoint_connections_update_a_private_endpoint_connection_requ accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateEndpointConnections/{privateEndpointConnectionName}" + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/inVMAccessControlProfiles/{inVMAccessControlProfileName}" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "diskAccessName": _SERIALIZER.url("disk_access_name", disk_access_name, "str"), - "privateEndpointConnectionName": _SERIALIZER.url( - "private_endpoint_connection_name", private_endpoint_connection_name, "str" + "galleryName": _SERIALIZER.url("gallery_name", gallery_name, "str"), + "inVMAccessControlProfileName": _SERIALIZER.url( + "in_vm_access_control_profile_name", in_vm_access_control_profile_name, "str" ), } @@ -6133,13 +6178,13 @@ def build_private_endpoint_connections_update_a_private_endpoint_connection_requ _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) -def build_private_endpoint_connections_delete_a_private_endpoint_connection_request( # pylint: disable=name-too-long +def build_gallery_in_vm_access_control_profiles_delete_request( # pylint: disable=name-too-long resource_group_name: str, - disk_access_name: str, - private_endpoint_connection_name: str, + gallery_name: str, + in_vm_access_control_profile_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: @@ -6147,13 +6192,13 @@ def build_private_endpoint_connections_delete_a_private_endpoint_connection_requ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateEndpointConnections/{privateEndpointConnectionName}" + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/inVMAccessControlProfiles/{inVMAccessControlProfileName}" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "diskAccessName": _SERIALIZER.url("disk_access_name", disk_access_name, "str"), - "privateEndpointConnectionName": _SERIALIZER.url( - "private_endpoint_connection_name", private_endpoint_connection_name, "str" + "galleryName": _SERIALIZER.url("gallery_name", gallery_name, "str"), + "inVMAccessControlProfileName": _SERIALIZER.url( + "in_vm_access_control_profile_name", in_vm_access_control_profile_name, "str" ), } @@ -6165,8 +6210,8 @@ def build_private_endpoint_connections_delete_a_private_endpoint_connection_requ return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) -def build_private_endpoint_connections_list_private_endpoint_connections_request( # pylint: disable=name-too-long - resource_group_name: str, disk_access_name: str, subscription_id: str, **kwargs: Any +def build_gallery_in_vm_access_control_profiles_list_by_gallery_request( # pylint: disable=name-too-long + resource_group_name: str, gallery_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -6175,11 +6220,11 @@ def build_private_endpoint_connections_list_private_endpoint_connections_request accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateEndpointConnections" + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/inVMAccessControlProfiles" 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"), + "galleryName": _SERIALIZER.url("gallery_name", gallery_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -6193,8 +6238,13 @@ def build_private_endpoint_connections_list_private_endpoint_connections_request return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_disk_encryption_sets_get_request( - resource_group_name: str, disk_encryption_set_name: str, subscription_id: str, **kwargs: Any +def build_gallery_in_vm_access_control_profile_versions_get_request( # pylint: disable=name-too-long + resource_group_name: str, + gallery_name: str, + in_vm_access_control_profile_name: str, + in_vm_access_control_profile_version_name: str, + subscription_id: str, + **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -6203,11 +6253,17 @@ def build_disk_encryption_sets_get_request( accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}" + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/inVMAccessControlProfiles/{inVMAccessControlProfileName}/versions/{inVMAccessControlProfileVersionName}" 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"), + "galleryName": _SERIALIZER.url("gallery_name", gallery_name, "str"), + "inVMAccessControlProfileName": _SERIALIZER.url( + "in_vm_access_control_profile_name", in_vm_access_control_profile_name, "str" + ), + "inVMAccessControlProfileVersionName": _SERIALIZER.url( + "in_vm_access_control_profile_version_name", in_vm_access_control_profile_version_name, "str" + ), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -6221,8 +6277,13 @@ def build_disk_encryption_sets_get_request( return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_disk_encryption_sets_create_or_update_request( # pylint: disable=name-too-long - resource_group_name: str, disk_encryption_set_name: str, subscription_id: str, **kwargs: Any +def build_gallery_in_vm_access_control_profile_versions_create_or_update_request( # pylint: disable=name-too-long + resource_group_name: str, + gallery_name: str, + in_vm_access_control_profile_name: str, + in_vm_access_control_profile_version_name: str, + subscription_id: str, + **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -6232,11 +6293,17 @@ def build_disk_encryption_sets_create_or_update_request( # pylint: disable=name accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}" + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/inVMAccessControlProfiles/{inVMAccessControlProfileName}/versions/{inVMAccessControlProfileVersionName}" 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"), + "galleryName": _SERIALIZER.url("gallery_name", gallery_name, "str"), + "inVMAccessControlProfileName": _SERIALIZER.url( + "in_vm_access_control_profile_name", in_vm_access_control_profile_name, "str" + ), + "inVMAccessControlProfileVersionName": _SERIALIZER.url( + "in_vm_access_control_profile_version_name", in_vm_access_control_profile_version_name, "str" + ), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -6252,8 +6319,13 @@ def build_disk_encryption_sets_create_or_update_request( # pylint: disable=name return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) -def build_disk_encryption_sets_update_request( # pylint: disable=name-too-long - resource_group_name: str, disk_encryption_set_name: str, subscription_id: str, **kwargs: Any +def build_gallery_in_vm_access_control_profile_versions_update_request( # pylint: disable=name-too-long + resource_group_name: str, + gallery_name: str, + in_vm_access_control_profile_name: str, + in_vm_access_control_profile_version_name: str, + subscription_id: str, + **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -6263,11 +6335,17 @@ def build_disk_encryption_sets_update_request( # pylint: disable=name-too-long accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}" + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/inVMAccessControlProfiles/{inVMAccessControlProfileName}/versions/{inVMAccessControlProfileVersionName}" 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"), + "galleryName": _SERIALIZER.url("gallery_name", gallery_name, "str"), + "inVMAccessControlProfileName": _SERIALIZER.url( + "in_vm_access_control_profile_name", in_vm_access_control_profile_name, "str" + ), + "inVMAccessControlProfileVersionName": _SERIALIZER.url( + "in_vm_access_control_profile_version_name", in_vm_access_control_profile_version_name, "str" + ), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -6283,18 +6361,29 @@ def build_disk_encryption_sets_update_request( # pylint: disable=name-too-long return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) -def build_disk_encryption_sets_delete_request( # pylint: disable=name-too-long - resource_group_name: str, disk_encryption_set_name: str, subscription_id: str, **kwargs: Any +def build_gallery_in_vm_access_control_profile_versions_delete_request( # pylint: disable=name-too-long + resource_group_name: str, + gallery_name: str, + in_vm_access_control_profile_name: str, + in_vm_access_control_profile_version_name: str, + subscription_id: str, + **kwargs: Any ) -> HttpRequest: _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}" + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/inVMAccessControlProfiles/{inVMAccessControlProfileName}/versions/{inVMAccessControlProfileVersionName}" 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"), + "galleryName": _SERIALIZER.url("gallery_name", gallery_name, "str"), + "inVMAccessControlProfileName": _SERIALIZER.url( + "in_vm_access_control_profile_name", in_vm_access_control_profile_name, "str" + ), + "inVMAccessControlProfileVersionName": _SERIALIZER.url( + "in_vm_access_control_profile_version_name", in_vm_access_control_profile_version_name, "str" + ), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -6305,8 +6394,12 @@ def build_disk_encryption_sets_delete_request( # pylint: disable=name-too-long return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) -def build_disk_encryption_sets_list_by_resource_group_request( # pylint: disable=name-too-long - resource_group_name: str, subscription_id: str, **kwargs: Any +def build_gallery_in_vm_access_control_profile_versions_list_by_gallery_in_vm_access_control_profile_request( # pylint: disable=name-too-long + resource_group_name: str, + gallery_name: str, + in_vm_access_control_profile_name: str, + subscription_id: str, + **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -6315,10 +6408,14 @@ def build_disk_encryption_sets_list_by_resource_group_request( # pylint: disabl accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets" + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/inVMAccessControlProfiles/{inVMAccessControlProfileName}/versions" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "galleryName": _SERIALIZER.url("gallery_name", gallery_name, "str"), + "inVMAccessControlProfileName": _SERIALIZER.url( + "in_vm_access_control_profile_name", in_vm_access_control_profile_name, "str" + ), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -6332,7 +6429,9 @@ def build_disk_encryption_sets_list_by_resource_group_request( # pylint: disabl return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_disk_encryption_sets_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: +def build_shared_galleries_get_request( + location: str, gallery_unique_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -6340,9 +6439,11 @@ def build_disk_encryption_sets_list_request(subscription_id: str, **kwargs: Any) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/diskEncryptionSets" + _url = "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/sharedGalleries/{galleryUniqueName}" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "location": _SERIALIZER.url("location", location, "str"), + "galleryUniqueName": _SERIALIZER.url("gallery_unique_name", gallery_unique_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -6356,8 +6457,12 @@ def build_disk_encryption_sets_list_request(subscription_id: str, **kwargs: Any) return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_disk_encryption_sets_list_associated_resources_request( # pylint: disable=name-too-long - resource_group_name: str, disk_encryption_set_name: str, subscription_id: str, **kwargs: Any +def build_shared_galleries_list_request( + location: str, + subscription_id: str, + *, + shared_to: Optional[Union[str, _models.SharedToValues]] = None, + **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -6366,17 +6471,18 @@ def build_disk_encryption_sets_list_associated_resources_request( # pylint: dis accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}/associatedResources" + _url = "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/sharedGalleries" 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"), + "location": _SERIALIZER.url("location", location, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if shared_to is not None: + _params["sharedTo"] = _SERIALIZER.query("shared_to", shared_to, "str") # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") @@ -6384,8 +6490,8 @@ def build_disk_encryption_sets_list_associated_resources_request( # pylint: dis return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_snapshots_get_request( - resource_group_name: str, snapshot_name: str, subscription_id: str, **kwargs: Any +def build_shared_gallery_images_get_request( + location: str, gallery_unique_name: str, gallery_image_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -6394,11 +6500,12 @@ def build_snapshots_get_request( accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}" + _url = "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/sharedGalleries/{galleryUniqueName}/images/{galleryImageName}" 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"), + "location": _SERIALIZER.url("location", location, "str"), + "galleryUniqueName": _SERIALIZER.url("gallery_unique_name", gallery_unique_name, "str"), + "galleryImageName": _SERIALIZER.url("gallery_image_name", gallery_image_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -6412,53 +6519,63 @@ def build_snapshots_get_request( return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_snapshots_create_or_update_request( - resource_group_name: str, snapshot_name: str, subscription_id: str, **kwargs: Any +def build_shared_gallery_images_list_request( + location: str, + gallery_unique_name: str, + subscription_id: str, + *, + shared_to: Optional[Union[str, _models.SharedToValues]] = None, + **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}" + _url = "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/sharedGalleries/{galleryUniqueName}/images" 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"), + "location": _SERIALIZER.url("location", location, "str"), + "galleryUniqueName": _SERIALIZER.url("gallery_unique_name", gallery_unique_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if shared_to is not None: + _params["sharedTo"] = _SERIALIZER.query("shared_to", shared_to, "str") # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_snapshots_update_request( - resource_group_name: str, snapshot_name: str, subscription_id: str, **kwargs: Any +def build_shared_gallery_image_versions_get_request( # pylint: disable=name-too-long + location: str, + gallery_unique_name: str, + gallery_image_name: str, + gallery_image_version_name: str, + subscription_id: str, + **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}" + _url = "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/sharedGalleries/{galleryUniqueName}/images/{galleryImageName}/versions/{galleryImageVersionName}" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "snapshotName": _SERIALIZER.url("snapshot_name", snapshot_name, "str"), + "location": _SERIALIZER.url("location", location, "str"), + "galleryUniqueName": _SERIALIZER.url("gallery_unique_name", gallery_unique_name, "str"), + "galleryImageName": _SERIALIZER.url("gallery_image_name", gallery_image_name, "str"), + "galleryImageVersionName": _SERIALIZER.url("gallery_image_version_name", gallery_image_version_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -6467,37 +6584,50 @@ def build_snapshots_update_request( _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_snapshots_delete_request( - resource_group_name: str, snapshot_name: str, subscription_id: str, **kwargs: Any +def build_shared_gallery_image_versions_list_request( # pylint: disable=name-too-long + location: str, + gallery_unique_name: str, + gallery_image_name: str, + subscription_id: str, + *, + shared_to: Optional[Union[str, _models.SharedToValues]] = None, + **kwargs: Any ) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + accept = _headers.pop("Accept", "application/json") + # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}" + _url = "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/sharedGalleries/{galleryUniqueName}/images/{galleryImageName}/versions" 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"), + "location": _SERIALIZER.url("location", location, "str"), + "galleryUniqueName": _SERIALIZER.url("gallery_unique_name", gallery_unique_name, "str"), + "galleryImageName": _SERIALIZER.url("gallery_image_name", gallery_image_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if shared_to is not None: + _params["sharedTo"] = _SERIALIZER.query("shared_to", shared_to, "str") - return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_snapshots_list_by_resource_group_request( # pylint: disable=name-too-long - resource_group_name: str, subscription_id: str, **kwargs: Any +def build_community_galleries_get_request( + location: str, public_gallery_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -6506,10 +6636,11 @@ def build_snapshots_list_by_resource_group_request( # pylint: disable=name-too- accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots" + _url = "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/communityGalleries/{publicGalleryName}" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "location": _SERIALIZER.url("location", location, "str"), + "publicGalleryName": _SERIALIZER.url("public_gallery_name", public_gallery_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -6523,7 +6654,9 @@ def build_snapshots_list_by_resource_group_request( # pylint: disable=name-too- return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_snapshots_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: +def build_community_gallery_images_get_request( # pylint: disable=name-too-long + location: str, public_gallery_name: str, gallery_image_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -6531,9 +6664,12 @@ def build_snapshots_list_request(subscription_id: str, **kwargs: Any) -> HttpReq accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/snapshots" + _url = "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/communityGalleries/{publicGalleryName}/images/{galleryImageName}" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "location": _SERIALIZER.url("location", location, "str"), + "publicGalleryName": _SERIALIZER.url("public_gallery_name", public_gallery_name, "str"), + "galleryImageName": _SERIALIZER.url("gallery_image_name", gallery_image_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -6547,22 +6683,21 @@ def build_snapshots_list_request(subscription_id: str, **kwargs: Any) -> HttpReq return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_snapshots_grant_access_request( - resource_group_name: str, snapshot_name: str, subscription_id: str, **kwargs: Any +def build_community_gallery_images_list_request( # pylint: disable=name-too-long + location: str, public_gallery_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/beginGetAccess" + _url = "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/communityGalleries/{publicGalleryName}/images" 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"), + "location": _SERIALIZER.url("location", location, "str"), + "publicGalleryName": _SERIALIZER.url("public_gallery_name", public_gallery_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -6571,25 +6706,33 @@ def build_snapshots_grant_access_request( _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_snapshots_revoke_access_request( - resource_group_name: str, snapshot_name: str, subscription_id: str, **kwargs: Any +def build_community_gallery_image_versions_get_request( # pylint: disable=name-too-long + location: str, + public_gallery_name: str, + gallery_image_name: str, + gallery_image_version_name: str, + subscription_id: str, + **kwargs: Any ) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + accept = _headers.pop("Accept", "application/json") + # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/endGetAccess" + _url = "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/communityGalleries/{publicGalleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "snapshotName": _SERIALIZER.url("snapshot_name", snapshot_name, "str"), + "location": _SERIALIZER.url("location", location, "str"), + "publicGalleryName": _SERIALIZER.url("public_gallery_name", public_gallery_name, "str"), + "galleryImageName": _SERIALIZER.url("gallery_image_name", gallery_image_name, "str"), + "galleryImageVersionName": _SERIALIZER.url("gallery_image_version_name", gallery_image_version_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -6597,17 +6740,14 @@ def build_snapshots_revoke_access_request( # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - return HttpRequest(method="POST", url=_url, params=_params, **kwargs) + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_galleries_get_request( - resource_group_name: str, - gallery_name: str, - subscription_id: str, - *, - select: Optional[Union[str, _models.SelectPermissions]] = None, - expand: Optional[Union[str, _models.GalleryExpandParams]] = None, - **kwargs: Any + +def build_community_gallery_image_versions_list_request( # pylint: disable=name-too-long + location: str, public_gallery_name: str, gallery_image_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -6616,21 +6756,18 @@ def build_galleries_get_request( accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}" + _url = "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/communityGalleries/{publicGalleryName}/images/{galleryImageName}/versions" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "galleryName": _SERIALIZER.url("gallery_name", gallery_name, "str"), + "location": _SERIALIZER.url("location", location, "str"), + "publicGalleryName": _SERIALIZER.url("public_gallery_name", public_gallery_name, "str"), + "galleryImageName": _SERIALIZER.url("gallery_image_name", gallery_image_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if select is not None: - _params["$select"] = _SERIALIZER.query("select", select, "str") - if expand is not None: - _params["$expand"] = _SERIALIZER.query("expand", expand, "str") # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") @@ -6638,53 +6775,54 @@ def build_galleries_get_request( return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_galleries_create_or_update_request( - resource_group_name: str, gallery_name: str, subscription_id: str, **kwargs: Any +def build_resource_skus_list_request( + subscription_id: str, + *, + filter: Optional[str] = None, + include_extended_locations: Optional[str] = None, + **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}" + _url = "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/skus" 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: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if filter is not None: + _params["$filter"] = _SERIALIZER.query("filter", filter, "str") + if include_extended_locations is not None: + _params["includeExtendedLocations"] = _SERIALIZER.query( + "include_extended_locations", include_extended_locations, "str" + ) # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_galleries_update_request( - resource_group_name: str, gallery_name: str, subscription_id: str, **kwargs: Any +def build_virtual_machine_scale_set_rolling_upgrades_start_extension_upgrade_request( # pylint: disable=name-too-long + resource_group_name: str, vm_scale_set_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - accept = _headers.pop("Accept", "application/json") - # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}" + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensionRollingUpgrade" 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"), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -6692,26 +6830,21 @@ def build_galleries_update_request( # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="POST", url=_url, params=_params, **kwargs) -def build_galleries_delete_request( - resource_group_name: str, gallery_name: str, subscription_id: str, **kwargs: Any +def build_virtual_machine_scale_set_rolling_upgrades_start_os_upgrade_request( # pylint: disable=name-too-long + resource_group_name: str, vm_scale_set_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}" + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/osRollingUpgrade" 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"), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -6719,23 +6852,21 @@ def build_galleries_delete_request( # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) + return HttpRequest(method="POST", url=_url, params=_params, **kwargs) -def build_galleries_list_by_resource_group_request( # pylint: disable=name-too-long - resource_group_name: str, subscription_id: str, **kwargs: Any +def build_virtual_machine_scale_set_rolling_upgrades_cancel_request( # pylint: disable=name-too-long + resource_group_name: str, vm_scale_set_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - accept = _headers.pop("Accept", "application/json") - # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries" + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/rollingUpgrades/cancel" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -6743,13 +6874,12 @@ def build_galleries_list_by_resource_group_request( # pylint: disable=name-too- # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="POST", url=_url, params=_params, **kwargs) -def build_galleries_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: +def build_virtual_machine_scale_set_rolling_upgrades_get_latest_request( # pylint: disable=name-too-long + resource_group_name: str, vm_scale_set_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -6757,9 +6887,11 @@ def build_galleries_list_request(subscription_id: str, **kwargs: Any) -> HttpReq accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/galleries" + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/rollingUpgrades/latest" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -6773,12 +6905,13 @@ def build_galleries_list_request(subscription_id: str, **kwargs: Any) -> HttpReq return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_galleries_list_by_artifact_name_request( # pylint: disable=name-too-long +def build_virtual_machine_scale_set_vms_get_request( # pylint: disable=name-too-long resource_group_name: str, - gallery_name: str, - artifact_type: str, - artifact_name: str, + vm_scale_set_name: str, + instance_id: str, subscription_id: str, + *, + expand: Optional[Union[str, _models.InstanceViewTypes]] = None, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -6788,19 +6921,20 @@ def build_galleries_list_by_artifact_name_request( # pylint: disable=name-too-l accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/softdeletedartifacttypes/{artifactType}/artifacts/{artifactName}/versions" + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}" 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"), - "artifactType": _SERIALIZER.url("artifact_type", artifact_type, "str"), - "artifactName": _SERIALIZER.url("artifact_name", artifact_name, "str"), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), + "instanceId": _SERIALIZER.url("instance_id", instance_id, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if expand is not None: + _params["$expand"] = _SERIALIZER.query("expand", expand, "str") # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") @@ -6808,8 +6942,15 @@ def build_galleries_list_by_artifact_name_request( # pylint: disable=name-too-l return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_galleries_gallery_sharing_profile_update_request( # pylint: disable=name-too-long - resource_group_name: str, gallery_name: str, subscription_id: str, **kwargs: Any +def build_virtual_machine_scale_set_vms_update_request( # pylint: disable=name-too-long + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + subscription_id: str, + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -6819,11 +6960,12 @@ def build_galleries_gallery_sharing_profile_update_request( # pylint: disable=n accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/share" + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}" 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"), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), + "instanceId": _SERIALIZER.url("instance_id", instance_id, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -6835,88 +6977,103 @@ def build_galleries_gallery_sharing_profile_update_request( # pylint: disable=n if content_type is not None: _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + if_match = prep_if_match(etag, match_condition) + if if_match is not None: + _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") + if_none_match = prep_if_none_match(etag, match_condition) + if if_none_match is not None: + _headers["If-None-Match"] = _SERIALIZER.header("if_none_match", if_none_match, "str") - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) -def build_gallery_images_get_request( - resource_group_name: str, gallery_name: str, gallery_image_name: str, subscription_id: str, **kwargs: Any +def build_virtual_machine_scale_set_vms_delete_request( # pylint: disable=name-too-long + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + subscription_id: str, + *, + force_deletion: Optional[bool] = None, + **kwargs: Any ) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - accept = _headers.pop("Accept", "application/json") - # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}" + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "galleryName": _SERIALIZER.url("gallery_name", gallery_name, "str"), - "galleryImageName": _SERIALIZER.url("gallery_image_name", gallery_image_name, "str"), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), + "instanceId": _SERIALIZER.url("instance_id", instance_id, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if force_deletion is not None: + _params["forceDeletion"] = _SERIALIZER.query("force_deletion", force_deletion, "bool") - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) -def build_gallery_images_create_or_update_request( # pylint: disable=name-too-long - resource_group_name: str, gallery_name: str, gallery_image_name: str, subscription_id: str, **kwargs: Any +def build_virtual_machine_scale_set_vms_list_request( # pylint: disable=name-too-long + 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: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}" + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{virtualMachineScaleSetName}/virtualMachines" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "galleryName": _SERIALIZER.url("gallery_name", gallery_name, "str"), - "galleryImageName": _SERIALIZER.url("gallery_image_name", gallery_image_name, "str"), + "virtualMachineScaleSetName": _SERIALIZER.url( + "virtual_machine_scale_set_name", virtual_machine_scale_set_name, "str" + ), } _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if filter is not None: + _params["$filter"] = _SERIALIZER.query("filter", filter, "str") + if select is not None: + _params["$select"] = _SERIALIZER.query("select", select, "str") + if expand is not None: + _params["$expand"] = _SERIALIZER.query("expand", expand, "str") # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_gallery_images_update_request( - resource_group_name: str, gallery_name: str, gallery_image_name: str, subscription_id: str, **kwargs: Any +def build_virtual_machine_scale_set_vms_approve_rolling_upgrade_request( # pylint: disable=name-too-long + resource_group_name: str, vm_scale_set_name: str, instance_id: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - accept = _headers.pop("Accept", "application/json") - # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}" + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/approveRollingUpgrade" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "galleryName": _SERIALIZER.url("gallery_name", gallery_name, "str"), - "galleryImageName": _SERIALIZER.url("gallery_image_name", gallery_image_name, "str"), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), + "instanceId": _SERIALIZER.url("instance_id", instance_id, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -6924,27 +7081,22 @@ def build_gallery_images_update_request( # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="POST", url=_url, params=_params, **kwargs) -def build_gallery_images_delete_request( - resource_group_name: str, gallery_name: str, gallery_image_name: str, subscription_id: str, **kwargs: Any +def build_virtual_machine_scale_set_vms_deallocate_request( # pylint: disable=name-too-long + resource_group_name: str, vm_scale_set_name: str, instance_id: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}" + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/deallocate" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "galleryName": _SERIALIZER.url("gallery_name", gallery_name, "str"), - "galleryImageName": _SERIALIZER.url("gallery_image_name", gallery_image_name, "str"), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), + "instanceId": _SERIALIZER.url("instance_id", instance_id, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -6952,11 +7104,11 @@ def build_gallery_images_delete_request( # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) + return HttpRequest(method="POST", url=_url, params=_params, **kwargs) -def build_gallery_images_list_by_gallery_request( # pylint: disable=name-too-long - resource_group_name: str, gallery_name: str, subscription_id: str, **kwargs: Any +def build_virtual_machine_scale_set_vms_get_instance_view_request( # pylint: disable=name-too-long + resource_group_name: str, vm_scale_set_name: str, instance_id: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -6965,11 +7117,12 @@ def build_gallery_images_list_by_gallery_request( # pylint: disable=name-too-lo accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images" + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/instanceView" 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"), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), + "instanceId": _SERIALIZER.url("instance_id", instance_id, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -6983,68 +7136,48 @@ def build_gallery_images_list_by_gallery_request( # pylint: disable=name-too-lo return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_gallery_image_versions_get_request( - resource_group_name: str, - gallery_name: str, - gallery_image_name: str, - gallery_image_version_name: str, - subscription_id: str, - *, - expand: Optional[Union[str, _models.ReplicationStatusTypes]] = None, - **kwargs: Any +def build_virtual_machine_scale_set_vms_reimage_request( # pylint: disable=name-too-long + resource_group_name: str, vm_scale_set_name: str, instance_id: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - accept = _headers.pop("Accept", "application/json") - # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}" + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/reimage" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "galleryName": _SERIALIZER.url("gallery_name", gallery_name, "str"), - "galleryImageName": _SERIALIZER.url("gallery_image_name", gallery_image_name, "str"), - "galleryImageVersionName": _SERIALIZER.url("gallery_image_version_name", gallery_image_version_name, "str"), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), + "instanceId": _SERIALIZER.url("instance_id", instance_id, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if expand is not None: - _params["$expand"] = _SERIALIZER.query("expand", expand, "str") # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_gallery_image_versions_create_or_update_request( # pylint: disable=name-too-long - resource_group_name: str, - gallery_name: str, - gallery_image_name: str, - gallery_image_version_name: str, - subscription_id: str, - **kwargs: Any +def build_virtual_machine_scale_set_vms_reimage_all_request( # pylint: disable=name-too-long + resource_group_name: str, vm_scale_set_name: str, instance_id: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - accept = _headers.pop("Accept", "application/json") - # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}" + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/reimageall" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "galleryName": _SERIALIZER.url("gallery_name", gallery_name, "str"), - "galleryImageName": _SERIALIZER.url("gallery_image_name", gallery_image_name, "str"), - "galleryImageVersionName": _SERIALIZER.url("gallery_image_version_name", gallery_image_version_name, "str"), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), + "instanceId": _SERIALIZER.url("instance_id", instance_id, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -7052,21 +7185,34 @@ def build_gallery_image_versions_create_or_update_request( # pylint: disable=na # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="POST", url=_url, params=_params, **kwargs) - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) +def build_virtual_machine_scale_set_vms_simulate_eviction_request( # pylint: disable=name-too-long + resource_group_name: str, vm_scale_set_name: str, instance_id: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) -def build_gallery_image_versions_update_request( # pylint: disable=name-too-long - resource_group_name: str, - gallery_name: str, - gallery_image_name: str, - gallery_image_version_name: str, - subscription_id: str, - **kwargs: Any + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/simulateEviction" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), + "instanceId": _SERIALIZER.url("instance_id", instance_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + return HttpRequest(method="POST", url=_url, params=_params, **kwargs) + + +def build_virtual_machine_scale_set_vms_attach_detach_data_disks_request( # pylint: disable=name-too-long + resource_group_name: str, vm_scale_set_name: str, instance_id: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -7076,13 +7222,12 @@ def build_gallery_image_versions_update_request( # pylint: disable=name-too-lon accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}" + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/attachDetachDataDisks" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "galleryName": _SERIALIZER.url("gallery_name", gallery_name, "str"), - "galleryImageName": _SERIALIZER.url("gallery_image_name", gallery_image_name, "str"), - "galleryImageVersionName": _SERIALIZER.url("gallery_image_version_name", gallery_image_version_name, "str"), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), + "instanceId": _SERIALIZER.url("instance_id", instance_id, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -7095,28 +7240,22 @@ def build_gallery_image_versions_update_request( # pylint: disable=name-too-lon _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_gallery_image_versions_delete_request( # pylint: disable=name-too-long - resource_group_name: str, - gallery_name: str, - gallery_image_name: str, - gallery_image_version_name: str, - subscription_id: str, - **kwargs: Any +def build_virtual_machine_scale_set_vms_perform_maintenance_request( # pylint: disable=name-too-long + resource_group_name: str, vm_scale_set_name: str, instance_id: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}" + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/performMaintenance" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "galleryName": _SERIALIZER.url("gallery_name", gallery_name, "str"), - "galleryImageName": _SERIALIZER.url("gallery_image_name", gallery_image_name, "str"), - "galleryImageVersionName": _SERIALIZER.url("gallery_image_version_name", gallery_image_version_name, "str"), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), + "instanceId": _SERIALIZER.url("instance_id", instance_id, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -7124,54 +7263,53 @@ def build_gallery_image_versions_delete_request( # pylint: disable=name-too-lon # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) + return HttpRequest(method="POST", url=_url, params=_params, **kwargs) -def build_gallery_image_versions_list_by_gallery_image_request( # pylint: disable=name-too-long - resource_group_name: str, gallery_name: str, gallery_image_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) +def build_virtual_machine_scale_set_vms_power_off_request( # pylint: disable=name-too-long + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + subscription_id: str, + *, + skip_shutdown: Optional[bool] = None, + **kwargs: Any +) -> HttpRequest: _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - accept = _headers.pop("Accept", "application/json") - # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}/versions" + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/powerOff" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "galleryName": _SERIALIZER.url("gallery_name", gallery_name, "str"), - "galleryImageName": _SERIALIZER.url("gallery_image_name", gallery_image_name, "str"), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), + "instanceId": _SERIALIZER.url("instance_id", instance_id, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if skip_shutdown is not None: + _params["skipShutdown"] = _SERIALIZER.query("skip_shutdown", skip_shutdown, "bool") - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="POST", url=_url, params=_params, **kwargs) -def build_gallery_applications_get_request( - resource_group_name: str, gallery_name: str, gallery_application_name: str, subscription_id: str, **kwargs: Any +def build_virtual_machine_scale_set_vms_redeploy_request( # pylint: disable=name-too-long + resource_group_name: str, vm_scale_set_name: str, instance_id: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - accept = _headers.pop("Accept", "application/json") - # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}" + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/redeploy" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "galleryName": _SERIALIZER.url("gallery_name", gallery_name, "str"), - "galleryApplicationName": _SERIALIZER.url("gallery_application_name", gallery_application_name, "str"), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), + "instanceId": _SERIALIZER.url("instance_id", instance_id, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -7179,29 +7317,22 @@ def build_gallery_applications_get_request( # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="POST", url=_url, params=_params, **kwargs) -def build_gallery_applications_create_or_update_request( # pylint: disable=name-too-long - resource_group_name: str, gallery_name: str, gallery_application_name: str, subscription_id: str, **kwargs: Any +def build_virtual_machine_scale_set_vms_restart_request( # pylint: disable=name-too-long + resource_group_name: str, vm_scale_set_name: str, instance_id: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - accept = _headers.pop("Accept", "application/json") - # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}" + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/restart" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "galleryName": _SERIALIZER.url("gallery_name", gallery_name, "str"), - "galleryApplicationName": _SERIALIZER.url("gallery_application_name", gallery_application_name, "str"), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), + "instanceId": _SERIALIZER.url("instance_id", instance_id, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -7209,59 +7340,61 @@ def build_gallery_applications_create_or_update_request( # pylint: disable=name # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="POST", url=_url, params=_params, **kwargs) -def build_gallery_applications_update_request( # pylint: disable=name-too-long - resource_group_name: str, gallery_name: str, gallery_application_name: str, subscription_id: str, **kwargs: Any +def build_virtual_machine_scale_set_vms_retrieve_boot_diagnostics_data_request( # pylint: disable=name-too-long + 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: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}" + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/retrieveBootDiagnosticsData" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "galleryName": _SERIALIZER.url("gallery_name", gallery_name, "str"), - "galleryApplicationName": _SERIALIZER.url("gallery_application_name", gallery_application_name, "str"), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), + "instanceId": _SERIALIZER.url("instance_id", instance_id, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if sas_uri_expiration_time_in_minutes is not None: + _params["sasUriExpirationTimeInMinutes"] = _SERIALIZER.query( + "sas_uri_expiration_time_in_minutes", sas_uri_expiration_time_in_minutes, "int" + ) # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_gallery_applications_delete_request( # pylint: disable=name-too-long - resource_group_name: str, gallery_name: str, gallery_application_name: str, subscription_id: str, **kwargs: Any +def build_virtual_machine_scale_set_vms_start_request( # pylint: disable=name-too-long + resource_group_name: str, vm_scale_set_name: str, instance_id: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}" + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/start" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "galleryName": _SERIALIZER.url("gallery_name", gallery_name, "str"), - "galleryApplicationName": _SERIALIZER.url("gallery_application_name", gallery_application_name, "str"), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), + "instanceId": _SERIALIZER.url("instance_id", instance_id, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -7269,24 +7402,26 @@ def build_gallery_applications_delete_request( # pylint: disable=name-too-long # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) + return HttpRequest(method="POST", url=_url, params=_params, **kwargs) -def build_gallery_applications_list_by_gallery_request( # pylint: disable=name-too-long - resource_group_name: str, gallery_name: str, subscription_id: str, **kwargs: Any +def build_virtual_machine_scale_set_vms_run_command_request( # pylint: disable=name-too-long + resource_group_name: str, vm_scale_set_name: str, instance_id: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications" + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/runCommand" 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"), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), + "instanceId": _SERIALIZER.url("instance_id", instance_id, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -7295,20 +7430,15 @@ def build_gallery_applications_list_by_gallery_request( # pylint: disable=name- _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_gallery_application_versions_get_request( # pylint: disable=name-too-long - resource_group_name: str, - gallery_name: str, - gallery_application_name: str, - gallery_application_version_name: str, - subscription_id: str, - *, - expand: Optional[Union[str, _models.ReplicationStatusTypes]] = None, - **kwargs: Any +def build_ssh_public_keys_get_request( + resource_group_name: str, ssh_public_key_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -7317,23 +7447,17 @@ def build_gallery_application_versions_get_request( # pylint: disable=name-too- accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}/versions/{galleryApplicationVersionName}" + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{sshPublicKeyName}" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "galleryName": _SERIALIZER.url("gallery_name", gallery_name, "str"), - "galleryApplicationName": _SERIALIZER.url("gallery_application_name", gallery_application_name, "str"), - "galleryApplicationVersionName": _SERIALIZER.url( - "gallery_application_version_name", gallery_application_version_name, "str" - ), + "sshPublicKeyName": _SERIALIZER.url("ssh_public_key_name", ssh_public_key_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if expand is not None: - _params["$expand"] = _SERIALIZER.query("expand", expand, "str") # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") @@ -7341,13 +7465,8 @@ def build_gallery_application_versions_get_request( # pylint: disable=name-too- return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_gallery_application_versions_create_or_update_request( # pylint: disable=name-too-long - resource_group_name: str, - gallery_name: str, - gallery_application_name: str, - gallery_application_version_name: str, - subscription_id: str, - **kwargs: Any +def build_ssh_public_keys_create_request( + resource_group_name: str, ssh_public_key_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -7357,15 +7476,11 @@ def build_gallery_application_versions_create_or_update_request( # pylint: disa accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}/versions/{galleryApplicationVersionName}" + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{sshPublicKeyName}" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "galleryName": _SERIALIZER.url("gallery_name", gallery_name, "str"), - "galleryApplicationName": _SERIALIZER.url("gallery_application_name", gallery_application_name, "str"), - "galleryApplicationVersionName": _SERIALIZER.url( - "gallery_application_version_name", gallery_application_version_name, "str" - ), + "sshPublicKeyName": _SERIALIZER.url("ssh_public_key_name", ssh_public_key_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -7381,13 +7496,8 @@ def build_gallery_application_versions_create_or_update_request( # pylint: disa return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) -def build_gallery_application_versions_update_request( # pylint: disable=name-too-long - resource_group_name: str, - gallery_name: str, - gallery_application_name: str, - gallery_application_version_name: str, - subscription_id: str, - **kwargs: Any +def build_ssh_public_keys_update_request( + resource_group_name: str, ssh_public_key_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -7397,15 +7507,11 @@ def build_gallery_application_versions_update_request( # pylint: disable=name-t accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}/versions/{galleryApplicationVersionName}" + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{sshPublicKeyName}" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "galleryName": _SERIALIZER.url("gallery_name", gallery_name, "str"), - "galleryApplicationName": _SERIALIZER.url("gallery_application_name", gallery_application_name, "str"), - "galleryApplicationVersionName": _SERIALIZER.url( - "gallery_application_version_name", gallery_application_version_name, "str" - ), + "sshPublicKeyName": _SERIALIZER.url("ssh_public_key_name", ssh_public_key_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -7421,27 +7527,18 @@ def build_gallery_application_versions_update_request( # pylint: disable=name-t return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) -def build_gallery_application_versions_delete_request( # pylint: disable=name-too-long - resource_group_name: str, - gallery_name: str, - gallery_application_name: str, - gallery_application_version_name: str, - subscription_id: str, - **kwargs: Any +def build_ssh_public_keys_delete_request( + resource_group_name: str, ssh_public_key_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}/versions/{galleryApplicationVersionName}" + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{sshPublicKeyName}" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "galleryName": _SERIALIZER.url("gallery_name", gallery_name, "str"), - "galleryApplicationName": _SERIALIZER.url("gallery_application_name", gallery_application_name, "str"), - "galleryApplicationVersionName": _SERIALIZER.url( - "gallery_application_version_name", gallery_application_version_name, "str" - ), + "sshPublicKeyName": _SERIALIZER.url("ssh_public_key_name", ssh_public_key_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -7452,8 +7549,8 @@ def build_gallery_application_versions_delete_request( # pylint: disable=name-t return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) -def build_gallery_application_versions_list_by_gallery_application_request( # pylint: disable=name-too-long - resource_group_name: str, gallery_name: str, gallery_application_name: str, subscription_id: str, **kwargs: Any +def build_ssh_public_keys_list_by_resource_group_request( # pylint: disable=name-too-long + resource_group_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -7462,12 +7559,12 @@ def build_gallery_application_versions_list_by_gallery_application_request( # p accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}/versions" + _url = ( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/sshPublicKeys" + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "galleryName": _SERIALIZER.url("gallery_name", gallery_name, "str"), - "galleryApplicationName": _SERIALIZER.url("gallery_application_name", gallery_application_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -7481,12 +7578,8 @@ def build_gallery_application_versions_list_by_gallery_application_request( # p return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_gallery_in_vm_access_control_profiles_get_request( # pylint: disable=name-too-long - resource_group_name: str, - gallery_name: str, - in_vm_access_control_profile_name: str, - subscription_id: str, - **kwargs: Any +def build_ssh_public_keys_list_by_subscription_request( # pylint: disable=name-too-long + subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -7495,14 +7588,9 @@ def build_gallery_in_vm_access_control_profiles_get_request( # pylint: disable= accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/inVMAccessControlProfiles/{inVMAccessControlProfileName}" + _url = "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/sshPublicKeys" 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"), - "inVMAccessControlProfileName": _SERIALIZER.url( - "in_vm_access_control_profile_name", in_vm_access_control_profile_name, "str" - ), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -7516,12 +7604,8 @@ def build_gallery_in_vm_access_control_profiles_get_request( # pylint: disable= return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_gallery_in_vm_access_control_profiles_create_or_update_request( # pylint: disable=name-too-long - resource_group_name: str, - gallery_name: str, - in_vm_access_control_profile_name: str, - subscription_id: str, - **kwargs: Any +def build_ssh_public_keys_generate_key_pair_request( # pylint: disable=name-too-long + resource_group_name: str, ssh_public_key_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -7531,14 +7615,11 @@ def build_gallery_in_vm_access_control_profiles_create_or_update_request( # pyl accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/inVMAccessControlProfiles/{inVMAccessControlProfileName}" + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{sshPublicKeyName}/generateKeyPair" 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"), - "inVMAccessControlProfileName": _SERIALIZER.url( - "in_vm_access_control_profile_name", in_vm_access_control_profile_name, "str" - ), + "sshPublicKeyName": _SERIALIZER.url("ssh_public_key_name", ssh_public_key_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -7551,32 +7632,21 @@ def build_gallery_in_vm_access_control_profiles_create_or_update_request( # pyl _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_gallery_in_vm_access_control_profiles_update_request( # pylint: disable=name-too-long - resource_group_name: str, - gallery_name: str, - in_vm_access_control_profile_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: +def build_usage_list_request(location: str, subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/inVMAccessControlProfiles/{inVMAccessControlProfileName}" + _url = "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/usages" 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"), - "inVMAccessControlProfileName": _SERIALIZER.url( - "in_vm_access_control_profile_name", in_vm_access_control_profile_name, "str" - ), + "location": _SERIALIZER.url("location", location, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -7585,32 +7655,23 @@ def build_gallery_in_vm_access_control_profiles_update_request( # pylint: disab _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_gallery_in_vm_access_control_profiles_delete_request( # pylint: disable=name-too-long - resource_group_name: str, - gallery_name: str, - in_vm_access_control_profile_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: +def build_virtual_machine_sizes_list_request(location: str, subscription_id: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + accept = _headers.pop("Accept", "application/json") + # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/inVMAccessControlProfiles/{inVMAccessControlProfileName}" + _url = "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/vmSizes" 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"), - "inVMAccessControlProfileName": _SERIALIZER.url( - "in_vm_access_control_profile_name", in_vm_access_control_profile_name, "str" - ), + "location": _SERIALIZER.url("location", location, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -7618,11 +7679,14 @@ def build_gallery_in_vm_access_control_profiles_delete_request( # pylint: disab # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_gallery_in_vm_access_control_profiles_list_by_gallery_request( # pylint: disable=name-too-long - resource_group_name: str, gallery_name: str, subscription_id: str, **kwargs: Any + +def build_virtual_machine_images_edge_zone_list_publishers_request( # pylint: disable=name-too-long + location: str, edge_zone: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -7631,11 +7695,11 @@ def build_gallery_in_vm_access_control_profiles_list_by_gallery_request( # pyli accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/inVMAccessControlProfiles" + _url = "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/edgeZones/{edgeZone}/publishers" 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"), + "location": _SERIALIZER.url("location", location, "str"), + "edgeZone": _SERIALIZER.url("edge_zone", edge_zone, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -7649,13 +7713,8 @@ def build_gallery_in_vm_access_control_profiles_list_by_gallery_request( # pyli return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_gallery_in_vm_access_control_profile_versions_get_request( # pylint: disable=name-too-long - resource_group_name: str, - gallery_name: str, - in_vm_access_control_profile_name: str, - in_vm_access_control_profile_version_name: str, - subscription_id: str, - **kwargs: Any +def build_virtual_machine_images_edge_zone_list_offers_request( # pylint: disable=name-too-long + location: str, edge_zone: str, publisher_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -7664,17 +7723,12 @@ def build_gallery_in_vm_access_control_profile_versions_get_request( # pylint: accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/inVMAccessControlProfiles/{inVMAccessControlProfileName}/versions/{inVMAccessControlProfileVersionName}" + _url = "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/edgeZones/{edgeZone}/publishers/{publisherName}/artifacttypes/vmimage/offers" 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"), - "inVMAccessControlProfileName": _SERIALIZER.url( - "in_vm_access_control_profile_name", in_vm_access_control_profile_name, "str" - ), - "inVMAccessControlProfileVersionName": _SERIALIZER.url( - "in_vm_access_control_profile_version_name", in_vm_access_control_profile_version_name, "str" - ), + "location": _SERIALIZER.url("location", location, "str"), + "edgeZone": _SERIALIZER.url("edge_zone", edge_zone, "str"), + "publisherName": _SERIALIZER.url("publisher_name", publisher_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -7688,33 +7742,23 @@ def build_gallery_in_vm_access_control_profile_versions_get_request( # pylint: return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_gallery_in_vm_access_control_profile_versions_create_or_update_request( # pylint: disable=name-too-long - resource_group_name: str, - gallery_name: str, - in_vm_access_control_profile_name: str, - in_vm_access_control_profile_version_name: str, - subscription_id: str, - **kwargs: Any +def build_virtual_machine_images_edge_zone_list_skus_request( # pylint: disable=name-too-long + location: str, edge_zone: str, publisher_name: str, offer: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/inVMAccessControlProfiles/{inVMAccessControlProfileName}/versions/{inVMAccessControlProfileVersionName}" + _url = "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/edgeZones/{edgeZone}/publishers/{publisherName}/artifacttypes/vmimage/offers/{offer}/skus" 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"), - "inVMAccessControlProfileName": _SERIALIZER.url( - "in_vm_access_control_profile_name", in_vm_access_control_profile_name, "str" - ), - "inVMAccessControlProfileVersionName": _SERIALIZER.url( - "in_vm_access_control_profile_version_name", in_vm_access_control_profile_version_name, "str" - ), + "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"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -7723,78 +7767,84 @@ def build_gallery_in_vm_access_control_profile_versions_create_or_update_request _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_gallery_in_vm_access_control_profile_versions_update_request( # pylint: disable=name-too-long - resource_group_name: str, - gallery_name: str, - in_vm_access_control_profile_name: str, - in_vm_access_control_profile_version_name: str, +def build_virtual_machine_images_edge_zone_list_request( # pylint: disable=name-too-long + 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: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/inVMAccessControlProfiles/{inVMAccessControlProfileName}/versions/{inVMAccessControlProfileVersionName}" + _url = "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/edgeZones/{edgeZone}/publishers/{publisherName}/artifacttypes/vmimage/offers/{offer}/skus/{skus}/versions" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "galleryName": _SERIALIZER.url("gallery_name", gallery_name, "str"), - "inVMAccessControlProfileName": _SERIALIZER.url( - "in_vm_access_control_profile_name", in_vm_access_control_profile_name, "str" - ), - "inVMAccessControlProfileVersionName": _SERIALIZER.url( - "in_vm_access_control_profile_version_name", in_vm_access_control_profile_version_name, "str" - ), + "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"), } _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if expand is not None: + _params["$expand"] = _SERIALIZER.query("expand", expand, "str") + if top is not None: + _params["$top"] = _SERIALIZER.query("top", top, "int") + if orderby is not None: + _params["$orderby"] = _SERIALIZER.query("orderby", orderby, "str") # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_gallery_in_vm_access_control_profile_versions_delete_request( # pylint: disable=name-too-long - resource_group_name: str, - gallery_name: str, - in_vm_access_control_profile_name: str, - in_vm_access_control_profile_version_name: str, +def build_virtual_machine_images_edge_zone_get_request( # pylint: disable=name-too-long + location: str, + edge_zone: str, + publisher_name: str, + offer: str, + skus: str, + version: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) + accept = _headers.pop("Accept", "application/json") + # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/inVMAccessControlProfiles/{inVMAccessControlProfileName}/versions/{inVMAccessControlProfileVersionName}" + _url = "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/edgeZones/{edgeZone}/publishers/{publisherName}/artifacttypes/vmimage/offers/{offer}/skus/{skus}/versions/{version}" path_format_arguments = { + "location": _SERIALIZER.url("location", location, "str"), + "edgeZone": _SERIALIZER.url("edge_zone", edge_zone, "str"), + "publisherName": _SERIALIZER.url("publisher_name", publisher_name, "str"), + "offer": _SERIALIZER.url("offer", offer, "str"), + "skus": _SERIALIZER.url("skus", skus, "str"), + "version": _SERIALIZER.url("version", version, "str"), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "galleryName": _SERIALIZER.url("gallery_name", gallery_name, "str"), - "inVMAccessControlProfileName": _SERIALIZER.url( - "in_vm_access_control_profile_name", in_vm_access_control_profile_name, "str" - ), - "inVMAccessControlProfileVersionName": _SERIALIZER.url( - "in_vm_access_control_profile_version_name", in_vm_access_control_profile_version_name, "str" - ), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -7802,15 +7852,14 @@ def build_gallery_in_vm_access_control_profile_versions_delete_request( # pylin # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_gallery_in_vm_access_control_profile_versions_list_by_gallery_in_vm_access_control_profile_request( # pylint: disable=name-too-long - resource_group_name: str, - gallery_name: str, - in_vm_access_control_profile_name: str, - subscription_id: str, - **kwargs: Any + +def build_virtual_machine_images_list_by_edge_zone_request( # pylint: disable=name-too-long + location: str, edge_zone: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -7819,14 +7868,13 @@ def build_gallery_in_vm_access_control_profile_versions_list_by_gallery_in_vm_ac accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/inVMAccessControlProfiles/{inVMAccessControlProfileName}/versions" + _url = ( + "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/edgeZones/{edgeZone}/vmimages" + ) 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"), - "inVMAccessControlProfileName": _SERIALIZER.url( - "in_vm_access_control_profile_name", in_vm_access_control_profile_name, "str" - ), + "location": _SERIALIZER.url("location", location, "str"), + "edgeZone": _SERIALIZER.url("edge_zone", edge_zone, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -7840,8 +7888,8 @@ def build_gallery_in_vm_access_control_profile_versions_list_by_gallery_in_vm_ac return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_shared_galleries_get_request( - location: str, gallery_unique_name: str, subscription_id: str, **kwargs: Any +def build_virtual_machine_images_list_publishers_request( # pylint: disable=name-too-long + location: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -7850,11 +7898,10 @@ def build_shared_galleries_get_request( accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/sharedGalleries/{galleryUniqueName}" + _url = "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers" 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: str = _url.format(**path_format_arguments) # type: ignore @@ -7868,12 +7915,8 @@ def build_shared_galleries_get_request( return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_shared_galleries_list_request( - location: str, - subscription_id: str, - *, - shared_to: Optional[Union[str, _models.SharedToValues]] = None, - **kwargs: Any +def build_virtual_machine_images_list_offers_request( # pylint: disable=name-too-long + location: str, publisher_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -7882,18 +7925,17 @@ def build_shared_galleries_list_request( accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/sharedGalleries" + _url = "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmimage/offers" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "location": _SERIALIZER.url("location", location, "str"), + "publisherName": _SERIALIZER.url("publisher_name", publisher_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if shared_to is not None: - _params["sharedTo"] = _SERIALIZER.query("shared_to", shared_to, "str") # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") @@ -7901,8 +7943,8 @@ def build_shared_galleries_list_request( return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_shared_gallery_images_get_request( - location: str, gallery_unique_name: str, gallery_image_name: str, subscription_id: str, **kwargs: Any +def build_virtual_machine_images_list_skus_request( # pylint: disable=name-too-long + location: str, publisher_name: str, offer: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -7911,12 +7953,12 @@ def build_shared_gallery_images_get_request( accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/sharedGalleries/{galleryUniqueName}/images/{galleryImageName}" + _url = "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmimage/offers/{offer}/skus" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "location": _SERIALIZER.url("location", location, "str"), - "galleryUniqueName": _SERIALIZER.url("gallery_unique_name", gallery_unique_name, "str"), - "galleryImageName": _SERIALIZER.url("gallery_image_name", gallery_image_name, "str"), + "publisherName": _SERIALIZER.url("publisher_name", publisher_name, "str"), + "offer": _SERIALIZER.url("offer", offer, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -7930,12 +7972,16 @@ def build_shared_gallery_images_get_request( return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_shared_gallery_images_list_request( +def build_virtual_machine_images_list_request( # pylint: disable=name-too-long location: str, - gallery_unique_name: str, + publisher_name: str, + offer: str, + skus: str, subscription_id: str, *, - shared_to: Optional[Union[str, _models.SharedToValues]] = None, + expand: Optional[str] = None, + top: Optional[int] = None, + orderby: Optional[str] = None, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -7945,19 +7991,25 @@ def build_shared_gallery_images_list_request( accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/sharedGalleries/{galleryUniqueName}/images" + _url = "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmimage/offers/{offer}/skus/{skus}/versions" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "location": _SERIALIZER.url("location", location, "str"), - "galleryUniqueName": _SERIALIZER.url("gallery_unique_name", gallery_unique_name, "str"), + "publisherName": _SERIALIZER.url("publisher_name", publisher_name, "str"), + "offer": _SERIALIZER.url("offer", offer, "str"), + "skus": _SERIALIZER.url("skus", skus, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if shared_to is not None: - _params["sharedTo"] = _SERIALIZER.query("shared_to", shared_to, "str") + if expand is not None: + _params["$expand"] = _SERIALIZER.query("expand", expand, "str") + if top is not None: + _params["$top"] = _SERIALIZER.query("top", top, "int") + if orderby is not None: + _params["$orderby"] = _SERIALIZER.query("orderby", orderby, "str") # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") @@ -7965,12 +8017,16 @@ def build_shared_gallery_images_list_request( return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_shared_gallery_image_versions_get_request( # pylint: disable=name-too-long +def build_virtual_machine_images_list_with_properties_request( # pylint: disable=name-too-long location: str, - gallery_unique_name: str, - gallery_image_name: str, - gallery_image_version_name: str, + publisher_name: str, + offer: str, + skus: str, subscription_id: str, + *, + expand: str, + top: Optional[int] = None, + orderby: Optional[str] = None, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -7980,19 +8036,24 @@ def build_shared_gallery_image_versions_get_request( # pylint: disable=name-too accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/sharedGalleries/{galleryUniqueName}/images/{galleryImageName}/versions/{galleryImageVersionName}" + _url = "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmimage/offers/{offer}/skus/{skus}/versions?$expand=Properties" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "location": _SERIALIZER.url("location", location, "str"), - "galleryUniqueName": _SERIALIZER.url("gallery_unique_name", gallery_unique_name, "str"), - "galleryImageName": _SERIALIZER.url("gallery_image_name", gallery_image_name, "str"), - "galleryImageVersionName": _SERIALIZER.url("gallery_image_version_name", gallery_image_version_name, "str"), + "publisherName": _SERIALIZER.url("publisher_name", publisher_name, "str"), + "offer": _SERIALIZER.url("offer", offer, "str"), + "skus": _SERIALIZER.url("skus", skus, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + _params["$expand"] = _SERIALIZER.query("expand", expand, "str") + if top is not None: + _params["$top"] = _SERIALIZER.query("top", top, "int") + if orderby is not None: + _params["$orderby"] = _SERIALIZER.query("orderby", orderby, "str") # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") @@ -8000,14 +8061,8 @@ def build_shared_gallery_image_versions_get_request( # pylint: disable=name-too return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_shared_gallery_image_versions_list_request( # pylint: disable=name-too-long - location: str, - gallery_unique_name: str, - gallery_image_name: str, - subscription_id: str, - *, - shared_to: Optional[Union[str, _models.SharedToValues]] = None, - **kwargs: Any +def build_virtual_machine_images_get_request( + location: str, publisher_name: str, offer: str, skus: str, version: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -8016,20 +8071,20 @@ def build_shared_gallery_image_versions_list_request( # pylint: disable=name-to accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/sharedGalleries/{galleryUniqueName}/images/{galleryImageName}/versions" + _url = "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmimage/offers/{offer}/skus/{skus}/versions/{version}" path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "location": _SERIALIZER.url("location", location, "str"), - "galleryUniqueName": _SERIALIZER.url("gallery_unique_name", gallery_unique_name, "str"), - "galleryImageName": _SERIALIZER.url("gallery_image_name", gallery_image_name, "str"), + "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: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if shared_to is not None: - _params["sharedTo"] = _SERIALIZER.query("shared_to", shared_to, "str") # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") @@ -8037,50 +8092,21 @@ def build_shared_gallery_image_versions_list_request( # pylint: disable=name-to return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_community_galleries_get_request( - location: str, public_gallery_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/communityGalleries/{publicGalleryName}" - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "location": _SERIALIZER.url("location", location, "str"), - "publicGalleryName": _SERIALIZER.url("public_gallery_name", public_gallery_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_community_gallery_images_get_request( # pylint: disable=name-too-long - location: str, public_gallery_name: str, gallery_image_name: str, subscription_id: str, **kwargs: Any +def build_log_analytics_export_request_rate_by_interval_request( # pylint: disable=name-too-long + location: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/communityGalleries/{publicGalleryName}/images/{galleryImageName}" + _url = "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/logAnalytics/apiAccess/getRequestRateByInterval" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "location": _SERIALIZER.url("location", location, "str"), - "publicGalleryName": _SERIALIZER.url("public_gallery_name", public_gallery_name, "str"), - "galleryImageName": _SERIALIZER.url("gallery_image_name", gallery_image_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -8089,26 +8115,28 @@ def build_community_gallery_images_get_request( # pylint: disable=name-too-long _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_community_gallery_images_list_request( # pylint: disable=name-too-long - location: str, public_gallery_name: str, subscription_id: str, **kwargs: Any +def build_log_analytics_export_throttled_requests_request( # pylint: disable=name-too-long + location: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/communityGalleries/{publicGalleryName}/images" + _url = "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/logAnalytics/apiAccess/getThrottledRequests" 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: str = _url.format(**path_format_arguments) # type: ignore @@ -8117,16 +8145,18 @@ def build_community_gallery_images_list_request( # pylint: disable=name-too-lon _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_community_gallery_image_versions_get_request( # pylint: disable=name-too-long - location: str, - public_gallery_name: str, - gallery_image_name: str, - gallery_image_version_name: str, +def build_disk_restore_point_get_request( + resource_group_name: str, + restore_point_collection_name: str, + vm_restore_point_name: str, + disk_restore_point_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: @@ -8137,13 +8167,15 @@ def build_community_gallery_image_versions_get_request( # pylint: disable=name- accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/communityGalleries/{publicGalleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}" + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{vmRestorePointName}/diskRestorePoints/{diskRestorePointName}" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "location": _SERIALIZER.url("location", location, "str"), - "publicGalleryName": _SERIALIZER.url("public_gallery_name", public_gallery_name, "str"), - "galleryImageName": _SERIALIZER.url("gallery_image_name", gallery_image_name, "str"), - "galleryImageVersionName": _SERIALIZER.url("gallery_image_version_name", gallery_image_version_name, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "restorePointCollectionName": _SERIALIZER.url( + "restore_point_collection_name", restore_point_collection_name, "str" + ), + "vmRestorePointName": _SERIALIZER.url("vm_restore_point_name", vm_restore_point_name, "str"), + "diskRestorePointName": _SERIALIZER.url("disk_restore_point_name", disk_restore_point_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -8157,8 +8189,12 @@ def build_community_gallery_image_versions_get_request( # pylint: disable=name- return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_community_gallery_image_versions_list_request( # pylint: disable=name-too-long - location: str, public_gallery_name: str, gallery_image_name: str, subscription_id: str, **kwargs: Any +def build_disk_restore_point_list_by_restore_point_request( # pylint: disable=name-too-long + resource_group_name: str, + restore_point_collection_name: str, + vm_restore_point_name: str, + subscription_id: str, + **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -8167,12 +8203,14 @@ def build_community_gallery_image_versions_list_request( # pylint: disable=name accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/communityGalleries/{publicGalleryName}/images/{galleryImageName}/versions" + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{vmRestorePointName}/diskRestorePoints" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "location": _SERIALIZER.url("location", location, "str"), - "publicGalleryName": _SERIALIZER.url("public_gallery_name", public_gallery_name, "str"), - "galleryImageName": _SERIALIZER.url("gallery_image_name", gallery_image_name, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "restorePointCollectionName": _SERIALIZER.url( + "restore_point_collection_name", restore_point_collection_name, "str" + ), + "vmRestorePointName": _SERIALIZER.url("vm_restore_point_name", vm_restore_point_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -8186,43 +8224,47 @@ def build_community_gallery_image_versions_list_request( # pylint: disable=name return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_resource_skus_list_request( +def build_disk_restore_point_grant_access_request( # pylint: disable=name-too-long + resource_group_name: str, + restore_point_collection_name: str, + vm_restore_point_name: str, + disk_restore_point_name: str, subscription_id: str, - *, - filter: Optional[str] = None, - include_extended_locations: Optional[str] = None, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/skus" + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{vmRestorePointName}/diskRestorePoints/{diskRestorePointName}/beginGetAccess" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "restorePointCollectionName": _SERIALIZER.url( + "restore_point_collection_name", restore_point_collection_name, "str" + ), + "vmRestorePointName": _SERIALIZER.url("vm_restore_point_name", vm_restore_point_name, "str"), + "diskRestorePointName": _SERIALIZER.url("disk_restore_point_name", disk_restore_point_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if filter is not None: - _params["$filter"] = _SERIALIZER.query("filter", filter, "str") - if include_extended_locations is not None: - _params["includeExtendedLocations"] = _SERIALIZER.query( - "include_extended_locations", include_extended_locations, "str" - ) # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_disk_restore_point_get_request( +def build_disk_restore_point_revoke_access_request( # pylint: disable=name-too-long resource_group_name: str, restore_point_collection_name: str, vm_restore_point_name: str, @@ -8230,14 +8272,11 @@ def build_disk_restore_point_get_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - accept = _headers.pop("Accept", "application/json") - # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{vmRestorePointName}/diskRestorePoints/{diskRestorePointName}" + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{vmRestorePointName}/diskRestorePoints/{diskRestorePointName}/endGetAccess" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -8253,16 +8292,14 @@ def build_disk_restore_point_get_request( # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="POST", url=_url, params=_params, **kwargs) -def build_disk_restore_point_list_by_restore_point_request( # pylint: disable=name-too-long +def build_soft_deleted_resource_list_by_artifact_name_request( # pylint: disable=name-too-long resource_group_name: str, - restore_point_collection_name: str, - vm_restore_point_name: str, + gallery_name: str, + artifact_type: str, + artifact_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: @@ -8273,14 +8310,13 @@ def build_disk_restore_point_list_by_restore_point_request( # pylint: disable=n accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{vmRestorePointName}/diskRestorePoints" + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/softdeletedartifacttypes/{artifactType}/artifacts/{artifactName}/versions" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "restorePointCollectionName": _SERIALIZER.url( - "restore_point_collection_name", restore_point_collection_name, "str" - ), - "vmRestorePointName": _SERIALIZER.url("vm_restore_point_name", vm_restore_point_name, "str"), + "galleryName": _SERIALIZER.url("gallery_name", gallery_name, "str"), + "artifactType": _SERIALIZER.url("artifact_type", artifact_type, "str"), + "artifactName": _SERIALIZER.url("artifact_name", artifact_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -8294,13 +8330,8 @@ def build_disk_restore_point_list_by_restore_point_request( # pylint: disable=n return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_disk_restore_point_grant_access_request( # pylint: disable=name-too-long - resource_group_name: str, - restore_point_collection_name: str, - vm_restore_point_name: str, - disk_restore_point_name: str, - subscription_id: str, - **kwargs: Any +def build_gallery_sharing_profile_update_request( # pylint: disable=name-too-long + resource_group_name: str, gallery_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -8310,15 +8341,11 @@ def build_disk_restore_point_grant_access_request( # pylint: disable=name-too-l accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{vmRestorePointName}/diskRestorePoints/{diskRestorePointName}/beginGetAccess" + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/share" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "restorePointCollectionName": _SERIALIZER.url( - "restore_point_collection_name", restore_point_collection_name, "str" - ), - "vmRestorePointName": _SERIALIZER.url("vm_restore_point_name", vm_restore_point_name, "str"), - "diskRestorePointName": _SERIALIZER.url("disk_restore_point_name", disk_restore_point_name, "str"), + "galleryName": _SERIALIZER.url("gallery_name", gallery_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -8334,37 +8361,6 @@ def build_disk_restore_point_grant_access_request( # pylint: disable=name-too-l return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_disk_restore_point_revoke_access_request( # pylint: disable=name-too-long - resource_group_name: str, - restore_point_collection_name: str, - vm_restore_point_name: str, - disk_restore_point_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) - # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{vmRestorePointName}/diskRestorePoints/{diskRestorePointName}/endGetAccess" - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "restorePointCollectionName": _SERIALIZER.url( - "restore_point_collection_name", restore_point_collection_name, "str" - ), - "vmRestorePointName": _SERIALIZER.url("vm_restore_point_name", vm_restore_point_name, "str"), - "diskRestorePointName": _SERIALIZER.url("disk_restore_point_name", disk_restore_point_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - return HttpRequest(method="POST", url=_url, params=_params, **kwargs) - - class Operations: """ .. warning:: @@ -8654,7 +8650,7 @@ def begin_create_or_update( etag: Optional[str] = None, match_condition: Optional[MatchConditions] = None, **kwargs: Any - ) -> LROPoller[None]: + ) -> LROPoller[_models.VirtualMachineScaleSet]: """Create or update a VM scale set. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -8672,8 +8668,9 @@ def begin_create_or_update( :paramtype etag: str :keyword match_condition: The match condition to use upon the etag. Default value is None. :paramtype match_condition: ~azure.core.MatchConditions - :return: An instance of LROPoller that returns None - :rtype: ~azure.core.polling.LROPoller[None] + :return: An instance of LROPoller that returns VirtualMachineScaleSet. The + VirtualMachineScaleSet is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.VirtualMachineScaleSet] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -8688,7 +8685,7 @@ def begin_create_or_update( etag: Optional[str] = None, match_condition: Optional[MatchConditions] = None, **kwargs: Any - ) -> LROPoller[None]: + ) -> LROPoller[_models.VirtualMachineScaleSet]: """Create or update a VM scale set. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -8706,8 +8703,9 @@ def begin_create_or_update( :paramtype etag: str :keyword match_condition: The match condition to use upon the etag. Default value is None. :paramtype match_condition: ~azure.core.MatchConditions - :return: An instance of LROPoller that returns None - :rtype: ~azure.core.polling.LROPoller[None] + :return: An instance of LROPoller that returns VirtualMachineScaleSet. The + VirtualMachineScaleSet is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.VirtualMachineScaleSet] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -8722,7 +8720,7 @@ def begin_create_or_update( etag: Optional[str] = None, match_condition: Optional[MatchConditions] = None, **kwargs: Any - ) -> LROPoller[None]: + ) -> LROPoller[_models.VirtualMachineScaleSet]: """Create or update a VM scale set. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -8740,8 +8738,9 @@ def begin_create_or_update( :paramtype etag: str :keyword match_condition: The match condition to use upon the etag. Default value is None. :paramtype match_condition: ~azure.core.MatchConditions - :return: An instance of LROPoller that returns None - :rtype: ~azure.core.polling.LROPoller[None] + :return: An instance of LROPoller that returns VirtualMachineScaleSet. The + VirtualMachineScaleSet is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.VirtualMachineScaleSet] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -8755,7 +8754,7 @@ def begin_create_or_update( etag: Optional[str] = None, match_condition: Optional[MatchConditions] = None, **kwargs: Any - ) -> LROPoller[None]: + ) -> LROPoller[_models.VirtualMachineScaleSet]: """Create or update a VM scale set. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -8771,15 +8770,16 @@ def begin_create_or_update( :paramtype etag: str :keyword match_condition: The match condition to use upon the etag. Default value is None. :paramtype match_condition: ~azure.core.MatchConditions - :return: An instance of LROPoller that returns None - :rtype: ~azure.core.polling.LROPoller[None] + :return: An instance of LROPoller that returns VirtualMachineScaleSet. The + VirtualMachineScaleSet is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.VirtualMachineScaleSet] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[_models.VirtualMachineScaleSet] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) @@ -8799,9 +8799,12 @@ def begin_create_or_update( raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.VirtualMachineScaleSet, response.json()) if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized path_format_arguments = { "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), @@ -8816,13 +8819,15 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return LROPoller[None].from_continuation_token( + return LROPoller[_models.VirtualMachineScaleSet].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + return LROPoller[_models.VirtualMachineScaleSet]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) def _update_initial( self, @@ -8916,7 +8921,7 @@ def begin_update( etag: Optional[str] = None, match_condition: Optional[MatchConditions] = None, **kwargs: Any - ) -> LROPoller[None]: + ) -> LROPoller[_models.VirtualMachineScaleSet]: """Update a VM scale set. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -8934,8 +8939,9 @@ def begin_update( :paramtype etag: str :keyword match_condition: The match condition to use upon the etag. Default value is None. :paramtype match_condition: ~azure.core.MatchConditions - :return: An instance of LROPoller that returns None - :rtype: ~azure.core.polling.LROPoller[None] + :return: An instance of LROPoller that returns VirtualMachineScaleSet. The + VirtualMachineScaleSet is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.VirtualMachineScaleSet] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -8950,7 +8956,7 @@ def begin_update( etag: Optional[str] = None, match_condition: Optional[MatchConditions] = None, **kwargs: Any - ) -> LROPoller[None]: + ) -> LROPoller[_models.VirtualMachineScaleSet]: """Update a VM scale set. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -8968,8 +8974,9 @@ def begin_update( :paramtype etag: str :keyword match_condition: The match condition to use upon the etag. Default value is None. :paramtype match_condition: ~azure.core.MatchConditions - :return: An instance of LROPoller that returns None - :rtype: ~azure.core.polling.LROPoller[None] + :return: An instance of LROPoller that returns VirtualMachineScaleSet. The + VirtualMachineScaleSet is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.VirtualMachineScaleSet] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -8984,7 +8991,7 @@ def begin_update( etag: Optional[str] = None, match_condition: Optional[MatchConditions] = None, **kwargs: Any - ) -> LROPoller[None]: + ) -> LROPoller[_models.VirtualMachineScaleSet]: """Update a VM scale set. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -9002,8 +9009,9 @@ def begin_update( :paramtype etag: str :keyword match_condition: The match condition to use upon the etag. Default value is None. :paramtype match_condition: ~azure.core.MatchConditions - :return: An instance of LROPoller that returns None - :rtype: ~azure.core.polling.LROPoller[None] + :return: An instance of LROPoller that returns VirtualMachineScaleSet. The + VirtualMachineScaleSet is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.VirtualMachineScaleSet] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -9017,7 +9025,7 @@ def begin_update( etag: Optional[str] = None, match_condition: Optional[MatchConditions] = None, **kwargs: Any - ) -> LROPoller[None]: + ) -> LROPoller[_models.VirtualMachineScaleSet]: """Update a VM scale set. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -9033,15 +9041,16 @@ def begin_update( :paramtype etag: str :keyword match_condition: The match condition to use upon the etag. Default value is None. :paramtype match_condition: ~azure.core.MatchConditions - :return: An instance of LROPoller that returns None - :rtype: ~azure.core.polling.LROPoller[None] + :return: An instance of LROPoller that returns VirtualMachineScaleSet. The + VirtualMachineScaleSet is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.VirtualMachineScaleSet] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[_models.VirtualMachineScaleSet] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) @@ -9061,9 +9070,16 @@ def begin_update( raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = _deserialize(_models.VirtualMachineScaleSet, response.json()) if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore + return deserialized path_format_arguments = { "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), @@ -9078,13 +9094,15 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return LROPoller[None].from_continuation_token( + return LROPoller[_models.VirtualMachineScaleSet].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + return LROPoller[_models.VirtualMachineScaleSet]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) def _delete_initial( self, resource_group_name: str, vm_scale_set_name: str, *, force_deletion: Optional[bool] = None, **kwargs: Any @@ -9858,7 +9876,7 @@ def begin_deallocate( hibernate: Optional[bool] = None, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.OkResponse]: + ) -> 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. @@ -9878,9 +9896,8 @@ def begin_deallocate( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns OkResponse. The OkResponse is compatible with - MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.OkResponse] + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -9894,7 +9911,7 @@ def begin_deallocate( hibernate: Optional[bool] = None, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.OkResponse]: + ) -> 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. @@ -9914,9 +9931,8 @@ def begin_deallocate( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns OkResponse. The OkResponse is compatible with - MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.OkResponse] + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -9930,7 +9946,7 @@ def begin_deallocate( hibernate: Optional[bool] = None, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.OkResponse]: + ) -> 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. @@ -9950,9 +9966,8 @@ def begin_deallocate( :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns OkResponse. The OkResponse is compatible with - MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.OkResponse] + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -9965,7 +9980,7 @@ def begin_deallocate( *, hibernate: Optional[bool] = None, **kwargs: Any - ) -> LROPoller[_models.OkResponse]: + ) -> 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. @@ -9984,9 +9999,8 @@ def begin_deallocate( (This feature is available for VMSS with Flexible OrchestrationMode only). Default value is None. :paramtype hibernate: bool - :return: An instance of LROPoller that returns OkResponse. The OkResponse is compatible with - MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.OkResponse] + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -9994,7 +10008,7 @@ def begin_deallocate( content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) content_type = content_type if vm_instance_i_ds else None - cls: ClsType[_models.OkResponse] = kwargs.pop("cls", None) + cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) @@ -10013,16 +10027,9 @@ def begin_deallocate( raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): - response_headers = {} - response = pipeline_response.http_response - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = _deserialize(_models.OkResponse, response.json()) + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized + return cls(pipeline_response, None, {}) # type: ignore path_format_arguments = { "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), @@ -10037,15 +10044,13 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller[_models.OkResponse].from_continuation_token( + return LROPoller[None].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller[_models.OkResponse]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore def _delete_instances_initial( self, @@ -10131,7 +10136,7 @@ def begin_delete_instances( force_deletion: Optional[bool] = None, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.OkResponse]: + ) -> LROPoller[None]: """Deletes virtual machines in a VM scale set. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -10148,9 +10153,8 @@ def begin_delete_instances( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns OkResponse. The OkResponse is compatible with - MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.OkResponse] + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -10164,7 +10168,7 @@ def begin_delete_instances( force_deletion: Optional[bool] = None, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.OkResponse]: + ) -> LROPoller[None]: """Deletes virtual machines in a VM scale set. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -10181,9 +10185,8 @@ def begin_delete_instances( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns OkResponse. The OkResponse is compatible with - MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.OkResponse] + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -10197,7 +10200,7 @@ def begin_delete_instances( force_deletion: Optional[bool] = None, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.OkResponse]: + ) -> LROPoller[None]: """Deletes virtual machines in a VM scale set. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -10214,9 +10217,8 @@ def begin_delete_instances( :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns OkResponse. The OkResponse is compatible with - MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.OkResponse] + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -10229,7 +10231,7 @@ def begin_delete_instances( *, force_deletion: Optional[bool] = None, **kwargs: Any - ) -> LROPoller[_models.OkResponse]: + ) -> LROPoller[None]: """Deletes virtual machines in a VM scale set. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -10244,16 +10246,15 @@ def begin_delete_instances( :keyword force_deletion: Optional parameter to force delete virtual machines from the VM scale set. (Feature in Preview). Default value is None. :paramtype force_deletion: bool - :return: An instance of LROPoller that returns OkResponse. The OkResponse is compatible with - MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.OkResponse] + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.OkResponse] = kwargs.pop("cls", None) + cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) @@ -10272,16 +10273,9 @@ def begin_delete_instances( raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): - response_headers = {} - response = pipeline_response.http_response - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = _deserialize(_models.OkResponse, response.json()) + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized + return cls(pipeline_response, None, {}) # type: ignore path_format_arguments = { "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), @@ -10296,15 +10290,13 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller[_models.OkResponse].from_continuation_token( + return LROPoller[None].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller[_models.OkResponse]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore @distributed_trace def force_recovery_service_fabric_platform_update_domain_walk( # pylint: disable=name-too-long @@ -10543,7 +10535,7 @@ def begin_update_instances( *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.OkResponse]: + ) -> 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. The name is case insensitive. @@ -10557,9 +10549,8 @@ def begin_update_instances( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns OkResponse. The OkResponse is compatible with - MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.OkResponse] + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -10572,7 +10563,7 @@ def begin_update_instances( *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.OkResponse]: + ) -> 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. The name is case insensitive. @@ -10586,9 +10577,8 @@ def begin_update_instances( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns OkResponse. The OkResponse is compatible with - MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.OkResponse] + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -10601,7 +10591,7 @@ def begin_update_instances( *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.OkResponse]: + ) -> 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. The name is case insensitive. @@ -10615,9 +10605,8 @@ def begin_update_instances( :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns OkResponse. The OkResponse is compatible with - MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.OkResponse] + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -10628,7 +10617,7 @@ def begin_update_instances( vm_scale_set_name: str, vm_instance_i_ds: Union[_models.VirtualMachineScaleSetVMInstanceRequiredIDs, JSON, IO[bytes]], **kwargs: Any - ) -> LROPoller[_models.OkResponse]: + ) -> 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. The name is case insensitive. @@ -10640,16 +10629,15 @@ def begin_update_instances( of the following types: VirtualMachineScaleSetVMInstanceRequiredIDs, JSON, IO[bytes] Required. :type vm_instance_i_ds: ~azure.mgmt.compute.models.VirtualMachineScaleSetVMInstanceRequiredIDs or JSON or IO[bytes] - :return: An instance of LROPoller that returns OkResponse. The OkResponse is compatible with - MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.OkResponse] + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.OkResponse] = kwargs.pop("cls", None) + cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) @@ -10667,16 +10655,9 @@ def begin_update_instances( raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): - response_headers = {} - response = pipeline_response.http_response - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = _deserialize(_models.OkResponse, response.json()) + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized + return cls(pipeline_response, None, {}) # type: ignore path_format_arguments = { "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), @@ -10691,15 +10672,13 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller[_models.OkResponse].from_continuation_token( + return LROPoller[None].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller[_models.OkResponse]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore @distributed_trace def get_os_upgrade_history( @@ -10881,7 +10860,7 @@ def begin_perform_maintenance( *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.OkResponse]: + ) -> 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: @@ -10899,9 +10878,8 @@ def begin_perform_maintenance( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns OkResponse. The OkResponse is compatible with - MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.OkResponse] + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -10914,7 +10892,7 @@ def begin_perform_maintenance( *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.OkResponse]: + ) -> 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: @@ -10932,9 +10910,8 @@ def begin_perform_maintenance( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns OkResponse. The OkResponse is compatible with - MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.OkResponse] + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -10947,7 +10924,7 @@ def begin_perform_maintenance( *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.OkResponse]: + ) -> 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: @@ -10965,9 +10942,8 @@ def begin_perform_maintenance( :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns OkResponse. The OkResponse is compatible with - MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.OkResponse] + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -10978,7 +10954,7 @@ def begin_perform_maintenance( vm_scale_set_name: str, vm_instance_i_ds: Optional[Union[_models.VirtualMachineScaleSetVMInstanceIDs, JSON, IO[bytes]]] = None, **kwargs: Any - ) -> LROPoller[_models.OkResponse]: + ) -> 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: @@ -10995,9 +10971,8 @@ def begin_perform_maintenance( None. :type vm_instance_i_ds: ~azure.mgmt.compute.models.VirtualMachineScaleSetVMInstanceIDs or JSON or IO[bytes] - :return: An instance of LROPoller that returns OkResponse. The OkResponse is compatible with - MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.OkResponse] + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -11005,7 +10980,7 @@ def begin_perform_maintenance( content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) content_type = content_type if vm_instance_i_ds else None - cls: ClsType[_models.OkResponse] = kwargs.pop("cls", None) + cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) @@ -11023,16 +10998,9 @@ def begin_perform_maintenance( raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): - response_headers = {} - response = pipeline_response.http_response - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = _deserialize(_models.OkResponse, response.json()) + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized + return cls(pipeline_response, None, {}) # type: ignore path_format_arguments = { "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), @@ -11047,15 +11015,13 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller[_models.OkResponse].from_continuation_token( + return LROPoller[None].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller[_models.OkResponse]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore def _power_off_initial( self, @@ -11145,7 +11111,7 @@ def begin_power_off( skip_shutdown: Optional[bool] = None, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.OkResponse]: + ) -> 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. @@ -11165,9 +11131,8 @@ def begin_power_off( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns OkResponse. The OkResponse is compatible with - MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.OkResponse] + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -11181,7 +11146,7 @@ def begin_power_off( skip_shutdown: Optional[bool] = None, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.OkResponse]: + ) -> 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. @@ -11201,9 +11166,8 @@ def begin_power_off( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns OkResponse. The OkResponse is compatible with - MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.OkResponse] + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -11217,7 +11181,7 @@ def begin_power_off( skip_shutdown: Optional[bool] = None, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.OkResponse]: + ) -> 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. @@ -11237,9 +11201,8 @@ def begin_power_off( :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns OkResponse. The OkResponse is compatible with - MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.OkResponse] + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -11252,7 +11215,7 @@ def begin_power_off( *, skip_shutdown: Optional[bool] = None, **kwargs: Any - ) -> LROPoller[_models.OkResponse]: + ) -> 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. @@ -11271,9 +11234,8 @@ def begin_power_off( flag indicates non-graceful shutdown whereas false indicates otherwise. Default value for this flag is false if not specified. Default value is None. :paramtype skip_shutdown: bool - :return: An instance of LROPoller that returns OkResponse. The OkResponse is compatible with - MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.OkResponse] + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -11281,7 +11243,7 @@ def begin_power_off( content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) content_type = content_type if vm_instance_i_ds else None - cls: ClsType[_models.OkResponse] = kwargs.pop("cls", None) + cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) @@ -11300,16 +11262,9 @@ def begin_power_off( raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): - response_headers = {} - response = pipeline_response.http_response - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = _deserialize(_models.OkResponse, response.json()) + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized + return cls(pipeline_response, None, {}) # type: ignore path_format_arguments = { "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), @@ -11324,15 +11279,13 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller[_models.OkResponse].from_continuation_token( + return LROPoller[None].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller[_models.OkResponse]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore def _reapply_initial(self, resource_group_name: str, vm_scale_set_name: str, **kwargs: Any) -> Iterator[bytes]: error_map: MutableMapping = { @@ -11390,9 +11343,7 @@ def _reapply_initial(self, resource_group_name: str, vm_scale_set_name: str, **k return deserialized # type: ignore @distributed_trace - def begin_reapply( - self, resource_group_name: str, vm_scale_set_name: str, **kwargs: Any - ) -> LROPoller[_models.OkResponse]: + def begin_reapply(self, resource_group_name: str, vm_scale_set_name: str, **kwargs: Any) -> LROPoller[None]: """Reapplies the Virtual Machine Scale Set Virtual Machine Profile to the Virtual Machine Instances. @@ -11401,15 +11352,14 @@ def begin_reapply( :type resource_group_name: str :param vm_scale_set_name: The name of the VM scale set. Required. :type vm_scale_set_name: str - :return: An instance of LROPoller that returns OkResponse. The OkResponse is compatible with - MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.OkResponse] + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.OkResponse] = kwargs.pop("cls", None) + cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) @@ -11425,16 +11375,9 @@ def begin_reapply( raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): - response_headers = {} - response = pipeline_response.http_response - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = _deserialize(_models.OkResponse, response.json()) + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized + return cls(pipeline_response, None, {}) # type: ignore path_format_arguments = { "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), @@ -11449,15 +11392,13 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller[_models.OkResponse].from_continuation_token( + return LROPoller[None].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller[_models.OkResponse]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore def _redeploy_initial( self, @@ -11543,7 +11484,7 @@ def begin_redeploy( *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.OkResponse]: + ) -> 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. @@ -11558,9 +11499,8 @@ def begin_redeploy( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns OkResponse. The OkResponse is compatible with - MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.OkResponse] + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -11573,7 +11513,7 @@ def begin_redeploy( *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.OkResponse]: + ) -> 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. @@ -11588,9 +11528,8 @@ def begin_redeploy( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns OkResponse. The OkResponse is compatible with - MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.OkResponse] + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -11603,7 +11542,7 @@ def begin_redeploy( *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.OkResponse]: + ) -> 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. @@ -11618,9 +11557,8 @@ def begin_redeploy( :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns OkResponse. The OkResponse is compatible with - MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.OkResponse] + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -11631,7 +11569,7 @@ def begin_redeploy( vm_scale_set_name: str, vm_instance_i_ds: Optional[Union[_models.VirtualMachineScaleSetVMInstanceIDs, JSON, IO[bytes]]] = None, **kwargs: Any - ) -> LROPoller[_models.OkResponse]: + ) -> 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. @@ -11645,9 +11583,8 @@ def begin_redeploy( None. :type vm_instance_i_ds: ~azure.mgmt.compute.models.VirtualMachineScaleSetVMInstanceIDs or JSON or IO[bytes] - :return: An instance of LROPoller that returns OkResponse. The OkResponse is compatible with - MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.OkResponse] + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -11655,7 +11592,7 @@ def begin_redeploy( content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) content_type = content_type if vm_instance_i_ds else None - cls: ClsType[_models.OkResponse] = kwargs.pop("cls", None) + cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) @@ -11673,16 +11610,9 @@ def begin_redeploy( raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): - response_headers = {} - response = pipeline_response.http_response - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = _deserialize(_models.OkResponse, response.json()) + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized + return cls(pipeline_response, None, {}) # type: ignore path_format_arguments = { "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), @@ -11697,15 +11627,13 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller[_models.OkResponse].from_continuation_token( + return LROPoller[None].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller[_models.OkResponse]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore def _reimage_initial( self, @@ -11793,7 +11721,7 @@ def begin_reimage( *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.OkResponse]: + ) -> 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. @@ -11809,9 +11737,8 @@ def begin_reimage( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns OkResponse. The OkResponse is compatible with - MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.OkResponse] + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -11824,7 +11751,7 @@ def begin_reimage( *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.OkResponse]: + ) -> 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. @@ -11839,9 +11766,8 @@ def begin_reimage( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns OkResponse. The OkResponse is compatible with - MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.OkResponse] + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -11854,7 +11780,7 @@ def begin_reimage( *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.OkResponse]: + ) -> 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. @@ -11869,9 +11795,8 @@ def begin_reimage( :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns OkResponse. The OkResponse is compatible with - MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.OkResponse] + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -11884,7 +11809,7 @@ def begin_reimage( Union[_models.VirtualMachineScaleSetReimageParameters, JSON, IO[bytes]] ] = None, **kwargs: Any - ) -> LROPoller[_models.OkResponse]: + ) -> 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. @@ -11899,9 +11824,8 @@ def begin_reimage( None. :type vm_scale_set_reimage_input: ~azure.mgmt.compute.models.VirtualMachineScaleSetReimageParameters or JSON or IO[bytes] - :return: An instance of LROPoller that returns OkResponse. The OkResponse is compatible with - MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.OkResponse] + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -11909,7 +11833,7 @@ def begin_reimage( content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) content_type = content_type if vm_scale_set_reimage_input else None - cls: ClsType[_models.OkResponse] = kwargs.pop("cls", None) + cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) @@ -11927,16 +11851,9 @@ def begin_reimage( raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): - response_headers = {} - response = pipeline_response.http_response - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = _deserialize(_models.OkResponse, response.json()) + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized + return cls(pipeline_response, None, {}) # type: ignore path_format_arguments = { "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), @@ -11951,15 +11868,13 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller[_models.OkResponse].from_continuation_token( + return LROPoller[None].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller[_models.OkResponse]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore def _reimage_all_initial( self, @@ -12045,7 +11960,7 @@ def begin_reimage_all( *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.OkResponse]: + ) -> 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. @@ -12060,9 +11975,8 @@ def begin_reimage_all( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns OkResponse. The OkResponse is compatible with - MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.OkResponse] + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -12075,7 +11989,7 @@ def begin_reimage_all( *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.OkResponse]: + ) -> 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. @@ -12090,9 +12004,8 @@ def begin_reimage_all( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns OkResponse. The OkResponse is compatible with - MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.OkResponse] + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -12105,7 +12018,7 @@ def begin_reimage_all( *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.OkResponse]: + ) -> 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. @@ -12120,9 +12033,8 @@ def begin_reimage_all( :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns OkResponse. The OkResponse is compatible with - MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.OkResponse] + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -12133,7 +12045,7 @@ def begin_reimage_all( vm_scale_set_name: str, vm_instance_i_ds: Optional[Union[_models.VirtualMachineScaleSetVMInstanceIDs, JSON, IO[bytes]]] = None, **kwargs: Any - ) -> LROPoller[_models.OkResponse]: + ) -> 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. @@ -12147,9 +12059,8 @@ def begin_reimage_all( None. :type vm_instance_i_ds: ~azure.mgmt.compute.models.VirtualMachineScaleSetVMInstanceIDs or JSON or IO[bytes] - :return: An instance of LROPoller that returns OkResponse. The OkResponse is compatible with - MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.OkResponse] + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -12157,7 +12068,7 @@ def begin_reimage_all( content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) content_type = content_type if vm_instance_i_ds else None - cls: ClsType[_models.OkResponse] = kwargs.pop("cls", None) + cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) @@ -12175,16 +12086,9 @@ def begin_reimage_all( raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): - response_headers = {} - response = pipeline_response.http_response - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = _deserialize(_models.OkResponse, response.json()) + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized + return cls(pipeline_response, None, {}) # type: ignore path_format_arguments = { "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), @@ -12199,15 +12103,13 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller[_models.OkResponse].from_continuation_token( + return LROPoller[None].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller[_models.OkResponse]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore def _restart_initial( self, @@ -12293,7 +12195,7 @@ def begin_restart( *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.OkResponse]: + ) -> LROPoller[None]: """Restarts one or more virtual machines in a VM scale set. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -12307,9 +12209,8 @@ def begin_restart( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns OkResponse. The OkResponse is compatible with - MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.OkResponse] + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -12322,7 +12223,7 @@ def begin_restart( *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.OkResponse]: + ) -> LROPoller[None]: """Restarts one or more virtual machines in a VM scale set. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -12336,9 +12237,8 @@ def begin_restart( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns OkResponse. The OkResponse is compatible with - MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.OkResponse] + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -12351,7 +12251,7 @@ def begin_restart( *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.OkResponse]: + ) -> LROPoller[None]: """Restarts one or more virtual machines in a VM scale set. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -12365,9 +12265,8 @@ def begin_restart( :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns OkResponse. The OkResponse is compatible with - MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.OkResponse] + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -12378,7 +12277,7 @@ def begin_restart( vm_scale_set_name: str, vm_instance_i_ds: Optional[Union[_models.VirtualMachineScaleSetVMInstanceIDs, JSON, IO[bytes]]] = None, **kwargs: Any - ) -> LROPoller[_models.OkResponse]: + ) -> LROPoller[None]: """Restarts one or more virtual machines in a VM scale set. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -12391,9 +12290,8 @@ def begin_restart( None. :type vm_instance_i_ds: ~azure.mgmt.compute.models.VirtualMachineScaleSetVMInstanceIDs or JSON or IO[bytes] - :return: An instance of LROPoller that returns OkResponse. The OkResponse is compatible with - MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.OkResponse] + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -12401,7 +12299,7 @@ def begin_restart( content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) content_type = content_type if vm_instance_i_ds else None - cls: ClsType[_models.OkResponse] = kwargs.pop("cls", None) + cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) @@ -12419,16 +12317,9 @@ def begin_restart( raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): - response_headers = {} - response = pipeline_response.http_response - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = _deserialize(_models.OkResponse, response.json()) + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized + return cls(pipeline_response, None, {}) # type: ignore path_format_arguments = { "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), @@ -12443,15 +12334,13 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller[_models.OkResponse].from_continuation_token( + return LROPoller[None].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller[_models.OkResponse]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore def _set_orchestration_service_state_initial( self, @@ -12533,7 +12422,7 @@ def begin_set_orchestration_service_state( *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.OkResponse]: + ) -> LROPoller[None]: """Changes ServiceState property for a given service. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -12546,9 +12435,8 @@ def begin_set_orchestration_service_state( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns OkResponse. The OkResponse is compatible with - MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.OkResponse] + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -12561,7 +12449,7 @@ def begin_set_orchestration_service_state( *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.OkResponse]: + ) -> LROPoller[None]: """Changes ServiceState property for a given service. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -12574,9 +12462,8 @@ def begin_set_orchestration_service_state( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns OkResponse. The OkResponse is compatible with - MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.OkResponse] + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -12589,7 +12476,7 @@ def begin_set_orchestration_service_state( *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.OkResponse]: + ) -> LROPoller[None]: """Changes ServiceState property for a given service. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -12602,9 +12489,8 @@ def begin_set_orchestration_service_state( :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns OkResponse. The OkResponse is compatible with - MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.OkResponse] + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -12615,7 +12501,7 @@ def begin_set_orchestration_service_state( vm_scale_set_name: str, parameters: Union[_models.OrchestrationServiceStateInput, JSON, IO[bytes]], **kwargs: Any - ) -> LROPoller[_models.OkResponse]: + ) -> LROPoller[None]: """Changes ServiceState property for a given service. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -12627,16 +12513,15 @@ def begin_set_orchestration_service_state( following types: OrchestrationServiceStateInput, JSON, IO[bytes] Required. :type parameters: ~azure.mgmt.compute.models.OrchestrationServiceStateInput or JSON or IO[bytes] - :return: An instance of LROPoller that returns OkResponse. The OkResponse is compatible with - MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.OkResponse] + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.OkResponse] = kwargs.pop("cls", None) + cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) @@ -12654,16 +12539,9 @@ def begin_set_orchestration_service_state( raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): - response_headers = {} - response = pipeline_response.http_response - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = _deserialize(_models.OkResponse, response.json()) + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized + return cls(pipeline_response, None, {}) # type: ignore path_format_arguments = { "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), @@ -12678,15 +12556,13 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller[_models.OkResponse].from_continuation_token( + return LROPoller[None].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller[_models.OkResponse]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore @distributed_trace def list_skus( @@ -12866,7 +12742,7 @@ def begin_start( *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.OkResponse]: + ) -> LROPoller[None]: """Starts one or more virtual machines in a VM scale set. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -12880,9 +12756,8 @@ def begin_start( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns OkResponse. The OkResponse is compatible with - MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.OkResponse] + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -12895,7 +12770,7 @@ def begin_start( *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.OkResponse]: + ) -> LROPoller[None]: """Starts one or more virtual machines in a VM scale set. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -12909,9 +12784,8 @@ def begin_start( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns OkResponse. The OkResponse is compatible with - MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.OkResponse] + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -12924,7 +12798,7 @@ def begin_start( *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.OkResponse]: + ) -> LROPoller[None]: """Starts one or more virtual machines in a VM scale set. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -12938,9 +12812,8 @@ def begin_start( :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns OkResponse. The OkResponse is compatible with - MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.OkResponse] + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -12951,7 +12824,7 @@ def begin_start( vm_scale_set_name: str, vm_instance_i_ds: Optional[Union[_models.VirtualMachineScaleSetVMInstanceIDs, JSON, IO[bytes]]] = None, **kwargs: Any - ) -> LROPoller[_models.OkResponse]: + ) -> LROPoller[None]: """Starts one or more virtual machines in a VM scale set. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -12964,9 +12837,8 @@ def begin_start( None. :type vm_instance_i_ds: ~azure.mgmt.compute.models.VirtualMachineScaleSetVMInstanceIDs or JSON or IO[bytes] - :return: An instance of LROPoller that returns OkResponse. The OkResponse is compatible with - MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.OkResponse] + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -12974,7 +12846,7 @@ def begin_start( content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) content_type = content_type if vm_instance_i_ds else None - cls: ClsType[_models.OkResponse] = kwargs.pop("cls", None) + cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) @@ -12992,396 +12864,9 @@ def begin_start( raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): - response_headers = {} - response = pipeline_response.http_response - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = _deserialize(_models.OkResponse, response.json()) - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized - - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.OkResponse].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.OkResponse]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _start_extension_upgrade_initial( - self, resource_group_name: str, vm_scale_set_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_virtual_machine_scale_sets_start_extension_upgrade_request( - resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, - subscription_id=self._config.subscription_id, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.CloudError, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.iter_bytes() - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_start_extension_upgrade( - self, resource_group_name: str, vm_scale_set_name: str, **kwargs: Any - ) -> LROPoller[_models.OkResponse]: - """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. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :return: An instance of LROPoller that returns OkResponse. The OkResponse is compatible with - MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.OkResponse] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[_models.OkResponse] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._start_extension_upgrade_initial( - resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - response_headers = {} - response = pipeline_response.http_response - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = _deserialize(_models.OkResponse, response.json()) - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized - - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.OkResponse].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.OkResponse]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _start_os_upgrade_initial( - self, resource_group_name: str, vm_scale_set_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_virtual_machine_scale_sets_start_os_upgrade_request( - resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, - subscription_id=self._config.subscription_id, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.CloudError, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.iter_bytes() - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_start_os_upgrade( - self, resource_group_name: str, vm_scale_set_name: str, **kwargs: Any - ) -> LROPoller[_models.OkResponse]: - """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. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :return: An instance of LROPoller that returns OkResponse. The OkResponse is compatible with - MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.OkResponse] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[_models.OkResponse] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._start_os_upgrade_initial( - resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - response_headers = {} - response = pipeline_response.http_response - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = _deserialize(_models.OkResponse, response.json()) - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized - - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.OkResponse].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.OkResponse]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _cancel_initial(self, resource_group_name: str, vm_scale_set_name: str, **kwargs: Any) -> Iterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_virtual_machine_scale_sets_cancel_request( - resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, - subscription_id=self._config.subscription_id, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.CloudError, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.iter_bytes() - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_cancel( - self, resource_group_name: str, vm_scale_set_name: str, **kwargs: Any - ) -> LROPoller[_models.OkResponse]: - """Cancels the current virtual machine scale set rolling upgrade. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :return: An instance of LROPoller that returns OkResponse. The OkResponse is compatible with - MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.OkResponse] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[_models.OkResponse] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._cancel_initial( - resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - response_headers = {} - response = pipeline_response.http_response - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = _deserialize(_models.OkResponse, response.json()) + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized + return cls(pipeline_response, None, {}) # type: ignore path_format_arguments = { "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), @@ -13396,15 +12881,13 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller[_models.OkResponse].from_continuation_token( + return LROPoller[None].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller[_models.OkResponse]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore @api_version_validation( method_added_on="2025-04-01", @@ -13493,7 +12976,7 @@ def begin_scale_out( *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.OkResponse]: + ) -> LROPoller[None]: """Scales out one or more virtual machines in a VM scale set. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -13506,9 +12989,8 @@ def begin_scale_out( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns OkResponse. The OkResponse is compatible with - MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.OkResponse] + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -13521,7 +13003,7 @@ def begin_scale_out( *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.OkResponse]: + ) -> LROPoller[None]: """Scales out one or more virtual machines in a VM scale set. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -13534,9 +13016,8 @@ def begin_scale_out( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns OkResponse. The OkResponse is compatible with - MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.OkResponse] + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -13549,7 +13030,7 @@ def begin_scale_out( *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.OkResponse]: + ) -> LROPoller[None]: """Scales out one or more virtual machines in a VM scale set. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -13562,9 +13043,8 @@ def begin_scale_out( :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns OkResponse. The OkResponse is compatible with - MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.OkResponse] + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -13582,7 +13062,7 @@ def begin_scale_out( vm_scale_set_name: str, parameters: Union[_models.VMScaleSetScaleOutInput, JSON, IO[bytes]], **kwargs: Any - ) -> LROPoller[_models.OkResponse]: + ) -> LROPoller[None]: """Scales out one or more virtual machines in a VM scale set. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -13593,16 +13073,15 @@ def begin_scale_out( :param parameters: The input object for ScaleOut API. Is one of the following types: VMScaleSetScaleOutInput, JSON, IO[bytes] Required. :type parameters: ~azure.mgmt.compute.models.VMScaleSetScaleOutInput or JSON or IO[bytes] - :return: An instance of LROPoller that returns OkResponse. The OkResponse is compatible with - MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.OkResponse] + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.OkResponse] = kwargs.pop("cls", None) + cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) @@ -13620,16 +13099,9 @@ def begin_scale_out( raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): - response_headers = {} - response = pipeline_response.http_response - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = _deserialize(_models.OkResponse, response.json()) + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized + return cls(pipeline_response, None, {}) # type: ignore path_format_arguments = { "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), @@ -13644,50 +13116,29 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller[_models.OkResponse].from_continuation_token( + return LROPoller[None].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller[_models.OkResponse]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - -class RollingUpgradeStatusInfosOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.compute.ComputeClient`'s - :attr:`rolling_upgrade_status_infos` attribute. - """ - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ComputeClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # 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. + def list_by_location(self, location: str, **kwargs: Any) -> ItemPaged["_models.VirtualMachineScaleSet"]: + """Gets all the VM scale sets under the specified subscription for the specified location. - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :return: RollingUpgradeStatusInfo. The RollingUpgradeStatusInfo is compatible with - MutableMapping - :rtype: ~azure.mgmt.compute.models.RollingUpgradeStatusInfo + :param location: The location name. Required. + :type location: str + :return: An iterator like instance of VirtualMachineScaleSet + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.models.VirtualMachineScaleSet] :raises ~azure.core.exceptions.HttpResponseError: """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.VirtualMachineScaleSet]] = kwargs.pop("cls", None) + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -13696,50 +13147,69 @@ def get_latest( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} + def prepare_request(next_link=None): + if not next_link: - cls: ClsType[_models.RollingUpgradeStatusInfo] = kwargs.pop("cls", None) + _request = build_virtual_machine_scale_sets_list_by_location_request( + location=location, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) - _request = build_rolling_upgrade_status_infos_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=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) - _stream = kwargs.pop("stream", False) - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) + return _request - response = pipeline_response.http_response + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.VirtualMachineScaleSet], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) - if response.status_code not in [200]: - if _stream: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.CloudError, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + def get_next(next_link=None): + _request = prepare_request(next_link) - if _stream: - deserialized = response.iter_bytes() - else: - deserialized = _deserialize(_models.RollingUpgradeStatusInfo, response.json()) + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - return deserialized # type: ignore + return pipeline_response + + return ItemPaged(get_next, extract_data) class VirtualMachineScaleSetExtensionsOperations: # pylint: disable=name-too-long @@ -13923,7 +13393,7 @@ def begin_create_or_update( *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[None]: + ) -> LROPoller[_models.VirtualMachineScaleSetExtension]: """The operation to create or update an extension. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -13939,8 +13409,10 @@ def begin_create_or_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns None - :rtype: ~azure.core.polling.LROPoller[None] + :return: An instance of LROPoller that returns VirtualMachineScaleSetExtension. The + VirtualMachineScaleSetExtension is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.VirtualMachineScaleSetExtension] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -13954,7 +13426,7 @@ def begin_create_or_update( *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[None]: + ) -> LROPoller[_models.VirtualMachineScaleSetExtension]: """The operation to create or update an extension. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -13970,8 +13442,10 @@ def begin_create_or_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns None - :rtype: ~azure.core.polling.LROPoller[None] + :return: An instance of LROPoller that returns VirtualMachineScaleSetExtension. The + VirtualMachineScaleSetExtension is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.VirtualMachineScaleSetExtension] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -13985,7 +13459,7 @@ def begin_create_or_update( *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[None]: + ) -> LROPoller[_models.VirtualMachineScaleSetExtension]: """The operation to create or update an extension. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -14001,8 +13475,10 @@ def begin_create_or_update( :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns None - :rtype: ~azure.core.polling.LROPoller[None] + :return: An instance of LROPoller that returns VirtualMachineScaleSetExtension. The + VirtualMachineScaleSetExtension is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.VirtualMachineScaleSetExtension] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -14014,7 +13490,7 @@ def begin_create_or_update( vmss_extension_name: str, extension_parameters: Union[_models.VirtualMachineScaleSetExtension, JSON, IO[bytes]], **kwargs: Any - ) -> LROPoller[None]: + ) -> LROPoller[_models.VirtualMachineScaleSetExtension]: """The operation to create or update an extension. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -14029,15 +13505,17 @@ def begin_create_or_update( Required. :type extension_parameters: ~azure.mgmt.compute.models.VirtualMachineScaleSetExtension or JSON or IO[bytes] - :return: An instance of LROPoller that returns None - :rtype: ~azure.core.polling.LROPoller[None] + :return: An instance of LROPoller that returns VirtualMachineScaleSetExtension. The + VirtualMachineScaleSetExtension is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.VirtualMachineScaleSetExtension] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[_models.VirtualMachineScaleSetExtension] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) @@ -14056,9 +13534,12 @@ def begin_create_or_update( raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.VirtualMachineScaleSetExtension, response.json()) if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized path_format_arguments = { "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), @@ -14073,13 +13554,15 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return LROPoller[None].from_continuation_token( + return LROPoller[_models.VirtualMachineScaleSetExtension].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + return LROPoller[_models.VirtualMachineScaleSetExtension]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) def _update_initial( self, @@ -14164,7 +13647,7 @@ def begin_update( *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[None]: + ) -> LROPoller[_models.VirtualMachineScaleSetExtension]: """The operation to update an extension. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -14180,8 +13663,10 @@ def begin_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns None - :rtype: ~azure.core.polling.LROPoller[None] + :return: An instance of LROPoller that returns VirtualMachineScaleSetExtension. The + VirtualMachineScaleSetExtension is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.VirtualMachineScaleSetExtension] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -14195,7 +13680,7 @@ def begin_update( *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[None]: + ) -> LROPoller[_models.VirtualMachineScaleSetExtension]: """The operation to update an extension. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -14211,8 +13696,10 @@ def begin_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns None - :rtype: ~azure.core.polling.LROPoller[None] + :return: An instance of LROPoller that returns VirtualMachineScaleSetExtension. The + VirtualMachineScaleSetExtension is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.VirtualMachineScaleSetExtension] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -14226,7 +13713,7 @@ def begin_update( *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[None]: + ) -> LROPoller[_models.VirtualMachineScaleSetExtension]: """The operation to update an extension. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -14242,8 +13729,10 @@ def begin_update( :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns None - :rtype: ~azure.core.polling.LROPoller[None] + :return: An instance of LROPoller that returns VirtualMachineScaleSetExtension. The + VirtualMachineScaleSetExtension is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.VirtualMachineScaleSetExtension] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -14255,7 +13744,7 @@ def begin_update( vmss_extension_name: str, extension_parameters: Union[_models.VirtualMachineScaleSetExtensionUpdate, JSON, IO[bytes]], **kwargs: Any - ) -> LROPoller[None]: + ) -> LROPoller[_models.VirtualMachineScaleSetExtension]: """The operation to update an extension. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -14270,15 +13759,17 @@ def begin_update( IO[bytes] Required. :type extension_parameters: ~azure.mgmt.compute.models.VirtualMachineScaleSetExtensionUpdate or JSON or IO[bytes] - :return: An instance of LROPoller that returns None - :rtype: ~azure.core.polling.LROPoller[None] + :return: An instance of LROPoller that returns VirtualMachineScaleSetExtension. The + VirtualMachineScaleSetExtension is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.VirtualMachineScaleSetExtension] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[_models.VirtualMachineScaleSetExtension] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) @@ -14297,9 +13788,12 @@ def begin_update( raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.VirtualMachineScaleSetExtension, response.json()) if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized path_format_arguments = { "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), @@ -14314,13 +13808,15 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return LROPoller[None].from_continuation_token( + return LROPoller[_models.VirtualMachineScaleSetExtension].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + return LROPoller[_models.VirtualMachineScaleSetExtension]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) def _delete_initial( self, resource_group_name: str, vm_scale_set_name: str, vmss_extension_name: str, **kwargs: Any @@ -14537,14 +14033,14 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) -class VirtualMachineScaleSetVMSOperations: # pylint: disable=too-many-public-methods +class VirtualMachineScaleSetVMExtensionsOperations: # pylint: disable=name-too-long """ .. warning:: **DO NOT** instantiate this class directly. Instead, you should access the following operations through :class:`~azure.mgmt.compute.ComputeClient`'s - :attr:`virtual_machine_scale_set_vms` attribute. + :attr:`virtual_machine_scale_set_vm_extensions` attribute. """ def __init__(self, *args, **kwargs) -> None: @@ -14560,11 +14056,12 @@ def get( resource_group_name: str, vm_scale_set_name: str, instance_id: str, + vm_extension_name: str, *, - expand: Optional[Union[str, _models.InstanceViewTypes]] = None, + expand: Optional[str] = None, **kwargs: Any - ) -> _models.VirtualMachineScaleSetVM: - """Gets a virtual machine from a VM scale set. + ) -> _models.VirtualMachineScaleSetVMExtension: + """The operation to get the VMSS VM extension. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -14573,14 +14070,13 @@ def get( :type vm_scale_set_name: str :param instance_id: The instance ID of the virtual machine. Required. :type instance_id: str - :keyword 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. Known values are: "instanceView", "userData", and "resiliencyView". Default value is - None. - :paramtype expand: str or ~azure.mgmt.compute.models.InstanceViewTypes - :return: VirtualMachineScaleSetVM. The VirtualMachineScaleSetVM is compatible with - MutableMapping - :rtype: ~azure.mgmt.compute.models.VirtualMachineScaleSetVM + :param vm_extension_name: The name of the virtual machine extension. Required. + :type vm_extension_name: str + :keyword expand: The expand expression to apply on the operation. Default value is None. + :paramtype expand: str + :return: VirtualMachineScaleSetVMExtension. The VirtualMachineScaleSetVMExtension is compatible + with MutableMapping + :rtype: ~azure.mgmt.compute.models.VirtualMachineScaleSetVMExtension :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -14594,12 +14090,13 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.VirtualMachineScaleSetVM] = kwargs.pop("cls", None) + cls: ClsType[_models.VirtualMachineScaleSetVMExtension] = kwargs.pop("cls", None) - _request = build_virtual_machine_scale_set_vms_get_request( + _request = build_virtual_machine_scale_set_vm_extensions_get_request( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, + vm_extension_name=vm_extension_name, subscription_id=self._config.subscription_id, expand=expand, api_version=self._config.api_version, @@ -14631,22 +14128,20 @@ def get( if _stream: deserialized = response.iter_bytes() else: - deserialized = _deserialize(_models.VirtualMachineScaleSetVM, response.json()) + deserialized = _deserialize(_models.VirtualMachineScaleSetVMExtension, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - def _update_initial( + def _create_or_update_initial( self, resource_group_name: str, vm_scale_set_name: str, instance_id: str, - parameters: Union[_models.VirtualMachineScaleSetVM, JSON, IO[bytes]], - *, - etag: Optional[str] = None, - match_condition: Optional[MatchConditions] = None, + vm_extension_name: str, + extension_parameters: Union[_models.VirtualMachineScaleSetVMExtension, JSON, IO[bytes]], **kwargs: Any ) -> Iterator[bytes]: error_map: MutableMapping = { @@ -14655,12 +14150,6 @@ def _update_initial( 409: ResourceExistsError, 304: ResourceNotModifiedError, } - if match_condition == MatchConditions.IfNotModified: - error_map[412] = ResourceModifiedError - elif match_condition == MatchConditions.IfPresent: - error_map[412] = ResourceNotFoundError - elif match_condition == MatchConditions.IfMissing: - error_map[412] = ResourceExistsError error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -14671,18 +14160,17 @@ def _update_initial( content_type = content_type or "application/json" _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters + if isinstance(extension_parameters, (IOBase, bytes)): + _content = extension_parameters else: - _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(extension_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - _request = build_virtual_machine_scale_set_vms_update_request( + _request = build_virtual_machine_scale_set_vm_extensions_create_or_update_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, - etag=etag, - match_condition=match_condition, content_type=content_type, api_version=self._config.api_version, content=_content, @@ -14701,7 +14189,7 @@ def _update_initial( response = pipeline_response.http_response - if response.status_code not in [200, 202]: + if response.status_code not in [200, 201]: try: response.read() # Load the body in memory and close the socket except (StreamConsumedError, StreamClosedError): @@ -14711,7 +14199,7 @@ def _update_initial( raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} - if response.status_code == 202: + if response.status_code == 201: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) @@ -14723,19 +14211,18 @@ def _update_initial( return deserialized # type: ignore @overload - def begin_update( + def begin_create_or_update( self, resource_group_name: str, vm_scale_set_name: str, instance_id: str, - parameters: _models.VirtualMachineScaleSetVM, + vm_extension_name: str, + extension_parameters: _models.VirtualMachineScaleSetVMExtension, *, content_type: str = "application/json", - etag: Optional[str] = None, - match_condition: Optional[MatchConditions] = None, **kwargs: Any - ) -> LROPoller[None]: - """Updates a virtual machine of a VM scale set. + ) -> LROPoller[_models.VirtualMachineScaleSetVMExtension]: + """The operation to create or update the VMSS VM extension. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -14744,36 +14231,34 @@ def begin_update( :type vm_scale_set_name: str :param instance_id: The instance ID of the virtual machine. Required. :type instance_id: str - :param parameters: Parameters supplied to the Update Virtual Machine Scale Sets VM operation. - Required. - :type parameters: ~azure.mgmt.compute.models.VirtualMachineScaleSetVM + :param vm_extension_name: The name of the virtual machine extension. Required. + :type vm_extension_name: str + :param extension_parameters: Parameters supplied to the Create Virtual Machine Extension + operation. Required. + :type extension_parameters: ~azure.mgmt.compute.models.VirtualMachineScaleSetVMExtension :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is - None. - :paramtype etag: str - :keyword match_condition: The match condition to use upon the etag. Default value is None. - :paramtype match_condition: ~azure.core.MatchConditions - :return: An instance of LROPoller that returns None - :rtype: ~azure.core.polling.LROPoller[None] + :return: An instance of LROPoller that returns VirtualMachineScaleSetVMExtension. The + VirtualMachineScaleSetVMExtension is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.VirtualMachineScaleSetVMExtension] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def begin_update( + def begin_create_or_update( self, resource_group_name: str, vm_scale_set_name: str, instance_id: str, - parameters: JSON, + vm_extension_name: str, + extension_parameters: JSON, *, content_type: str = "application/json", - etag: Optional[str] = None, - match_condition: Optional[MatchConditions] = None, **kwargs: Any - ) -> LROPoller[None]: - """Updates a virtual machine of a VM scale set. + ) -> LROPoller[_models.VirtualMachineScaleSetVMExtension]: + """The operation to create or update the VMSS VM extension. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -14782,36 +14267,34 @@ def begin_update( :type vm_scale_set_name: str :param instance_id: The instance ID of the virtual machine. Required. :type instance_id: str - :param parameters: Parameters supplied to the Update Virtual Machine Scale Sets VM operation. - Required. - :type parameters: JSON + :param vm_extension_name: The name of the virtual machine extension. Required. + :type vm_extension_name: str + :param extension_parameters: Parameters supplied to the Create Virtual Machine Extension + operation. Required. + :type extension_parameters: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is - None. - :paramtype etag: str - :keyword match_condition: The match condition to use upon the etag. Default value is None. - :paramtype match_condition: ~azure.core.MatchConditions - :return: An instance of LROPoller that returns None - :rtype: ~azure.core.polling.LROPoller[None] + :return: An instance of LROPoller that returns VirtualMachineScaleSetVMExtension. The + VirtualMachineScaleSetVMExtension is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.VirtualMachineScaleSetVMExtension] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def begin_update( + def begin_create_or_update( self, resource_group_name: str, vm_scale_set_name: str, instance_id: str, - parameters: IO[bytes], + vm_extension_name: str, + extension_parameters: IO[bytes], *, content_type: str = "application/json", - etag: Optional[str] = None, - match_condition: Optional[MatchConditions] = None, **kwargs: Any - ) -> LROPoller[None]: - """Updates a virtual machine of a VM scale set. + ) -> LROPoller[_models.VirtualMachineScaleSetVMExtension]: + """The operation to create or update the VMSS VM extension. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -14820,35 +14303,32 @@ def begin_update( :type vm_scale_set_name: str :param instance_id: The instance ID of the virtual machine. Required. :type instance_id: str - :param parameters: Parameters supplied to the Update Virtual Machine Scale Sets VM operation. - Required. - :type parameters: IO[bytes] + :param vm_extension_name: The name of the virtual machine extension. Required. + :type vm_extension_name: str + :param extension_parameters: Parameters supplied to the Create Virtual Machine Extension + operation. Required. + :type extension_parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is - None. - :paramtype etag: str - :keyword match_condition: The match condition to use upon the etag. Default value is None. - :paramtype match_condition: ~azure.core.MatchConditions - :return: An instance of LROPoller that returns None - :rtype: ~azure.core.polling.LROPoller[None] + :return: An instance of LROPoller that returns VirtualMachineScaleSetVMExtension. The + VirtualMachineScaleSetVMExtension is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.VirtualMachineScaleSetVMExtension] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace - def begin_update( + def begin_create_or_update( self, resource_group_name: str, vm_scale_set_name: str, instance_id: str, - parameters: Union[_models.VirtualMachineScaleSetVM, JSON, IO[bytes]], - *, - etag: Optional[str] = None, - match_condition: Optional[MatchConditions] = None, + vm_extension_name: str, + extension_parameters: Union[_models.VirtualMachineScaleSetVMExtension, JSON, IO[bytes]], **kwargs: Any - ) -> LROPoller[None]: - """Updates a virtual machine of a VM scale set. + ) -> LROPoller[_models.VirtualMachineScaleSetVMExtension]: + """The operation to create or update the VMSS VM extension. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -14857,34 +14337,34 @@ def begin_update( :type vm_scale_set_name: str :param instance_id: The instance ID of the virtual machine. Required. :type instance_id: str - :param parameters: Parameters supplied to the Update Virtual Machine Scale Sets VM operation. - Is one of the following types: VirtualMachineScaleSetVM, JSON, IO[bytes] Required. - :type parameters: ~azure.mgmt.compute.models.VirtualMachineScaleSetVM or JSON or IO[bytes] - :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is - None. - :paramtype etag: str - :keyword match_condition: The match condition to use upon the etag. Default value is None. - :paramtype match_condition: ~azure.core.MatchConditions - :return: An instance of LROPoller that returns None - :rtype: ~azure.core.polling.LROPoller[None] + :param vm_extension_name: The name of the virtual machine extension. Required. + :type vm_extension_name: str + :param extension_parameters: Parameters supplied to the Create Virtual Machine Extension + operation. Is one of the following types: VirtualMachineScaleSetVMExtension, JSON, IO[bytes] + Required. + :type extension_parameters: ~azure.mgmt.compute.models.VirtualMachineScaleSetVMExtension or + JSON or IO[bytes] + :return: An instance of LROPoller that returns VirtualMachineScaleSetVMExtension. The + VirtualMachineScaleSetVMExtension is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.VirtualMachineScaleSetVMExtension] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[_models.VirtualMachineScaleSetVMExtension] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._update_initial( + 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, - parameters=parameters, - etag=etag, - match_condition=match_condition, + vm_extension_name=vm_extension_name, + extension_parameters=extension_parameters, content_type=content_type, cls=lambda x, y, z: x, headers=_headers, @@ -14894,9 +14374,12 @@ def begin_update( raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.VirtualMachineScaleSetVMExtension, response.json()) if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized path_format_arguments = { "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), @@ -14911,21 +14394,23 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return LROPoller[None].from_continuation_token( + return LROPoller[_models.VirtualMachineScaleSetVMExtension].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + return LROPoller[_models.VirtualMachineScaleSetVMExtension]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) - def _delete_initial( + def _update_initial( self, resource_group_name: str, vm_scale_set_name: str, instance_id: str, - *, - force_deletion: Optional[bool] = None, + vm_extension_name: str, + extension_parameters: Union[_models.VirtualMachineScaleSetVMExtensionUpdate, JSON, IO[bytes]], **kwargs: Any ) -> Iterator[bytes]: error_map: MutableMapping = { @@ -14936,18 +14421,28 @@ def _delete_initial( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - _request = build_virtual_machine_scale_set_vms_delete_request( + content_type = content_type or "application/json" + _content = None + if isinstance(extension_parameters, (IOBase, bytes)): + _content = extension_parameters + else: + _content = json.dumps(extension_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_virtual_machine_scale_set_vm_extensions_update_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, - force_deletion=force_deletion, + content_type=content_type, api_version=self._config.api_version, + content=_content, headers=_headers, params=_params, ) @@ -14963,7 +14458,7 @@ def _delete_initial( response = pipeline_response.http_response - if response.status_code not in [200, 202, 204]: + if response.status_code not in [200]: try: response.read() # Load the body in memory and close the socket except (StreamConsumedError, StreamClosedError): @@ -14973,9 +14468,8 @@ def _delete_initial( raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) deserialized = response.iter_bytes() @@ -14984,17 +14478,19 @@ def _delete_initial( return deserialized # type: ignore - @distributed_trace - def begin_delete( + @overload + def begin_update( self, resource_group_name: str, vm_scale_set_name: str, instance_id: str, + vm_extension_name: str, + extension_parameters: _models.VirtualMachineScaleSetVMExtensionUpdate, *, - force_deletion: Optional[bool] = None, + content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[None]: - """Deletes a virtual machine from a VM scale set. + ) -> LROPoller[_models.VirtualMachineScaleSetVMExtension]: + """The operation to update the VMSS VM extension. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -15003,26 +14499,141 @@ def begin_delete( :type vm_scale_set_name: str :param instance_id: The instance ID of the virtual machine. Required. :type instance_id: str - :keyword force_deletion: Optional parameter to force delete a virtual machine from a VM scale - set. (Feature in Preview). Default value is None. - :paramtype force_deletion: bool - :return: An instance of LROPoller that returns None - :rtype: ~azure.core.polling.LROPoller[None] + :param vm_extension_name: The name of the virtual machine extension. Required. + :type vm_extension_name: str + :param extension_parameters: Parameters supplied to the Update Virtual Machine Extension + operation. Required. + :type extension_parameters: ~azure.mgmt.compute.models.VirtualMachineScaleSetVMExtensionUpdate + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns VirtualMachineScaleSetVMExtension. The + VirtualMachineScaleSetVMExtension is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.VirtualMachineScaleSetVMExtension] :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = kwargs.pop("headers", {}) or {} + + @overload + def begin_update( + self, + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + vm_extension_name: str, + extension_parameters: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.VirtualMachineScaleSetVMExtension]: + """The operation to update the VMSS VM extension. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. Required. + :type instance_id: str + :param vm_extension_name: The name of the virtual machine extension. Required. + :type vm_extension_name: str + :param extension_parameters: Parameters supplied to the Update Virtual Machine Extension + operation. Required. + :type extension_parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns VirtualMachineScaleSetVMExtension. The + VirtualMachineScaleSetVMExtension is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.VirtualMachineScaleSetVMExtension] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update( + self, + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + vm_extension_name: str, + extension_parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.VirtualMachineScaleSetVMExtension]: + """The operation to update the VMSS VM extension. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. Required. + :type instance_id: str + :param vm_extension_name: The name of the virtual machine extension. Required. + :type vm_extension_name: str + :param extension_parameters: Parameters supplied to the Update Virtual Machine Extension + operation. Required. + :type extension_parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns VirtualMachineScaleSetVMExtension. The + VirtualMachineScaleSetVMExtension is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.VirtualMachineScaleSetVMExtension] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update( + self, + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + vm_extension_name: str, + extension_parameters: Union[_models.VirtualMachineScaleSetVMExtensionUpdate, JSON, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.VirtualMachineScaleSetVMExtension]: + """The operation to update the VMSS VM extension. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. Required. + :type instance_id: str + :param vm_extension_name: The name of the virtual machine extension. Required. + :type vm_extension_name: str + :param extension_parameters: Parameters supplied to the Update Virtual Machine Extension + operation. Is one of the following types: VirtualMachineScaleSetVMExtensionUpdate, JSON, + IO[bytes] Required. + :type extension_parameters: ~azure.mgmt.compute.models.VirtualMachineScaleSetVMExtensionUpdate + or JSON or IO[bytes] + :return: An instance of LROPoller that returns VirtualMachineScaleSetVMExtension. The + VirtualMachineScaleSetVMExtension is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.VirtualMachineScaleSetVMExtension] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - cls: ClsType[None] = kwargs.pop("cls", None) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.VirtualMachineScaleSetVMExtension] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._delete_initial( + raw_result = self._update_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, - force_deletion=force_deletion, + vm_extension_name=vm_extension_name, + extension_parameters=extension_parameters, + content_type=content_type, cls=lambda x, y, z: x, headers=_headers, params=_params, @@ -15031,9 +14642,16 @@ def begin_delete( raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = _deserialize(_models.VirtualMachineScaleSetVMExtension, response.json()) if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore + return deserialized path_format_arguments = { "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), @@ -15048,147 +14666,37 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return LROPoller[None].from_continuation_token( + return LROPoller[_models.VirtualMachineScaleSetVMExtension].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + return LROPoller[_models.VirtualMachineScaleSetVMExtension]( + self._client, raw_result, get_long_running_output, polling_method # 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 - ) -> ItemPaged["_models.VirtualMachineScaleSetVM"]: - """Gets a list of all virtual machines in a VM scale sets. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param virtual_machine_scale_set_name: The name of the VirtualMachineScaleSet. Required. - :type virtual_machine_scale_set_name: str - :keyword 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. - :paramtype filter: str - :keyword select: The list parameters. Allowed values are 'instanceView', - 'instanceView/statuses'. Default value is None. - :paramtype select: str - :keyword expand: The expand expression to apply to the operation. Allowed values are - 'instanceView'. Default value is None. - :paramtype expand: str - :return: An iterator like instance of VirtualMachineScaleSetVM - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.models.VirtualMachineScaleSetVM] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[List[_models.VirtualMachineScaleSetVM]] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_virtual_machine_scale_set_vms_list_request( - resource_group_name=resource_group_name, - virtual_machine_scale_set_name=virtual_machine_scale_set_name, - subscription_id=self._config.subscription_id, - filter=filter, - select=select, - expand=expand, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - return _request - - def extract_data(pipeline_response): - deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.VirtualMachineScaleSetVM], deserialized.get("value", [])) - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.get("nextLink") or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.CloudError, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - def _approve_rolling_upgrade_initial( - self, resource_group_name: str, vm_scale_set_name: str, instance_id: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) + def _delete_initial( + self, resource_group_name: str, vm_scale_set_name: str, instance_id: str, vm_extension_name: str, **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - _request = build_virtual_machine_scale_set_vms_approve_rolling_upgrade_request( + _request = build_virtual_machine_scale_set_vm_extensions_delete_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=self._config.api_version, headers=_headers, @@ -15206,7 +14714,7 @@ def _approve_rolling_upgrade_initial( response = pipeline_response.http_response - if response.status_code not in [202]: + if response.status_code not in [200, 202, 204]: try: response.read() # Load the body in memory and close the socket except (StreamConsumedError, StreamClosedError): @@ -15216,8 +14724,9 @@ def _approve_rolling_upgrade_initial( raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) deserialized = response.iter_bytes() @@ -15227,10 +14736,10 @@ def _approve_rolling_upgrade_initial( return deserialized # type: ignore @distributed_trace - def begin_approve_rolling_upgrade( - self, resource_group_name: str, vm_scale_set_name: str, instance_id: str, **kwargs: Any + def begin_delete( + self, resource_group_name: str, vm_scale_set_name: str, instance_id: str, vm_extension_name: str, **kwargs: Any ) -> LROPoller[None]: - """Approve upgrade on deferred rolling upgrade for OS disk on a VM scale set instance. + """The operation to delete the VMSS VM extension. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -15239,6 +14748,8 @@ def begin_approve_rolling_upgrade( :type vm_scale_set_name: str :param instance_id: The instance ID of the virtual machine. Required. :type instance_id: str + :param vm_extension_name: The name of the virtual machine extension. Required. + :type vm_extension_name: str :return: An instance of LROPoller that returns None :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -15251,10 +14762,11 @@ def begin_approve_rolling_upgrade( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._approve_rolling_upgrade_initial( + raw_result = self._delete_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, + vm_extension_name=vm_extension_name, cls=lambda x, y, z: x, headers=_headers, params=_params, @@ -15288,9 +14800,32 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - def _deallocate_initial( - self, resource_group_name: str, vm_scale_set_name: str, instance_id: str, **kwargs: Any - ) -> Iterator[bytes]: + @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. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. Required. + :type instance_id: str + :keyword expand: The expand expression to apply on the operation. Default value is None. + :paramtype expand: str + :return: VirtualMachineScaleSetVMExtensionsListResult. The + VirtualMachineScaleSetVMExtensionsListResult is compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.VirtualMachineScaleSetVMExtensionsListResult + :raises ~azure.core.exceptions.HttpResponseError: + """ error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -15302,13 +14837,14 @@ def _deallocate_initial( _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + cls: ClsType[_models.VirtualMachineScaleSetVMExtensionsListResult] = kwargs.pop("cls", None) - _request = build_virtual_machine_scale_set_vms_deallocate_request( + _request = build_virtual_machine_scale_set_vm_extensions_list_request( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, subscription_id=self._config.subscription_id, + expand=expand, api_version=self._config.api_version, headers=_headers, params=_params, @@ -15318,124 +14854,75 @@ def _deallocate_initial( } _request.url = self._client.format_url(_request.url, **path_format_arguments) - _stream = True + _stream = kwargs.pop("stream", False) pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200, 202]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = _failsafe_deserialize(_models.CloudError, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.iter_bytes() + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.VirtualMachineScaleSetVMExtensionsListResult, response.json()) if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - @distributed_trace - def begin_deallocate( - self, resource_group_name: str, vm_scale_set_name: str, instance_id: str, **kwargs: Any - ) -> LROPoller[_models.OkResponse]: - """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. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param instance_id: The instance ID of the virtual machine. Required. - :type instance_id: str - :return: An instance of LROPoller that returns OkResponse. The OkResponse is compatible with - MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.OkResponse] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[_models.OkResponse] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._deallocate_initial( - resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, - instance_id=instance_id, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - response_headers = {} - response = pipeline_response.http_response - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - deserialized = _deserialize(_models.OkResponse, response.json()) - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized +class VirtualMachinesOperations: # pylint: disable=too-many-public-methods + """ + .. warning:: + **DO NOT** instantiate this class directly. - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } + Instead, you should access the following operations through + :class:`~azure.mgmt.compute.ComputeClient`'s + :attr:`virtual_machines` attribute. + """ - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.OkResponse].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.OkResponse]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @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. + 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. The name is case insensitive. Required. :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param instance_id: The instance ID of the virtual machine. Required. - :type instance_id: str - :return: VirtualMachineScaleSetVMInstanceView. The VirtualMachineScaleSetVMInstanceView is - compatible with MutableMapping - :rtype: ~azure.mgmt.compute.models.VirtualMachineScaleSetVMInstanceView + :param vm_name: The name of the virtual machine. Required. + :type vm_name: str + :keyword 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. + Known values are: "instanceView", "userData", and "resiliencyView". Default value is None. + :paramtype expand: str or ~azure.mgmt.compute.models.InstanceViewTypes + :return: VirtualMachine. The VirtualMachine is compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.VirtualMachine :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -15449,13 +14936,13 @@ def get_instance_view( _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.VirtualMachineScaleSetVMInstanceView] = kwargs.pop("cls", None) + cls: ClsType[_models.VirtualMachine] = kwargs.pop("cls", None) - _request = build_virtual_machine_scale_set_vms_get_instance_view_request( + _request = build_virtual_machines_get_request( resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, - instance_id=instance_id, + vm_name=vm_name, subscription_id=self._config.subscription_id, + expand=expand, api_version=self._config.api_version, headers=_headers, params=_params, @@ -15485,21 +14972,21 @@ def get_instance_view( if _stream: deserialized = response.iter_bytes() else: - deserialized = _deserialize(_models.VirtualMachineScaleSetVMInstanceView, response.json()) + deserialized = _deserialize(_models.VirtualMachine, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - def _reimage_initial( + def _create_or_update_initial( self, resource_group_name: str, - vm_scale_set_name: str, - instance_id: str, - vm_scale_set_vm_reimage_input: Optional[ - Union[_models.VirtualMachineScaleSetVMReimageParameters, JSON, IO[bytes]] - ] = None, + vm_name: str, + parameters: Union[_models.VirtualMachine, JSON, IO[bytes]], + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, **kwargs: Any ) -> Iterator[bytes]: error_map: MutableMapping = { @@ -15508,30 +14995,33 @@ def _reimage_initial( 409: ResourceExistsError, 304: ResourceNotModifiedError, } + if match_condition == MatchConditions.IfNotModified: + error_map[412] = ResourceModifiedError + elif match_condition == MatchConditions.IfPresent: + error_map[412] = ResourceNotFoundError + elif match_condition == MatchConditions.IfMissing: + error_map[412] = ResourceExistsError error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - content_type = content_type if vm_scale_set_vm_reimage_input else None cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - content_type = content_type or "application/json" if vm_scale_set_vm_reimage_input else None + content_type = content_type or "application/json" _content = None - if isinstance(vm_scale_set_vm_reimage_input, (IOBase, bytes)): - _content = vm_scale_set_vm_reimage_input + if isinstance(parameters, (IOBase, bytes)): + _content = parameters else: - if vm_scale_set_vm_reimage_input is not None: - _content = json.dumps(vm_scale_set_vm_reimage_input, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - else: - _content = None + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - _request = build_virtual_machine_scale_set_vms_reimage_request( + _request = build_virtual_machines_create_or_update_request( resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, - instance_id=instance_id, + vm_name=vm_name, subscription_id=self._config.subscription_id, + etag=etag, + match_condition=match_condition, content_type=content_type, api_version=self._config.api_version, content=_content, @@ -15550,7 +15040,7 @@ def _reimage_initial( response = pipeline_response.http_response - if response.status_code not in [200, 202]: + if response.status_code not in [200, 201]: try: response.read() # Load the body in memory and close the socket except (StreamConsumedError, StreamClosedError): @@ -15560,7 +15050,7 @@ def _reimage_initial( raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} - if response.status_code == 202: + if response.status_code == 201: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) @@ -15572,147 +15062,160 @@ def _reimage_initial( return deserialized # type: ignore @overload - def begin_reimage( + def begin_create_or_update( self, resource_group_name: str, - vm_scale_set_name: str, - instance_id: str, - vm_scale_set_vm_reimage_input: Optional[_models.VirtualMachineScaleSetVMReimageParameters] = None, + vm_name: str, + parameters: _models.VirtualMachine, *, content_type: str = "application/json", + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, **kwargs: Any - ) -> LROPoller[_models.OkResponse]: - """Reimages (upgrade the operating system) a specific virtual machine in a VM scale set. + ) -> 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. The name is case insensitive. Required. :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param instance_id: The instance ID of the virtual machine. Required. - :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.models.VirtualMachineScaleSetVMReimageParameters + :param vm_name: The name of the virtual machine. Required. + :type vm_name: str + :param parameters: Parameters supplied to the Create Virtual Machine operation. Required. + :type parameters: ~azure.mgmt.compute.models.VirtualMachine :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns OkResponse. The OkResponse is compatible with - MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.OkResponse] + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of LROPoller that returns VirtualMachine. The VirtualMachine is compatible + with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.VirtualMachine] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def begin_reimage( + def begin_create_or_update( self, resource_group_name: str, - vm_scale_set_name: str, - instance_id: str, - vm_scale_set_vm_reimage_input: Optional[JSON] = None, + vm_name: str, + parameters: JSON, *, content_type: str = "application/json", + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, **kwargs: Any - ) -> LROPoller[_models.OkResponse]: - """Reimages (upgrade the operating system) a specific virtual machine in a VM scale set. + ) -> 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. The name is case insensitive. Required. :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param instance_id: The instance ID of the virtual machine. Required. - :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: JSON + :param vm_name: The name of the virtual machine. Required. + :type vm_name: str + :param parameters: Parameters supplied to the Create Virtual Machine operation. Required. + :type parameters: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns OkResponse. The OkResponse is compatible with - MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.OkResponse] + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of LROPoller that returns VirtualMachine. The VirtualMachine is compatible + with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.VirtualMachine] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def begin_reimage( + def begin_create_or_update( self, resource_group_name: str, - vm_scale_set_name: str, - instance_id: str, - vm_scale_set_vm_reimage_input: Optional[IO[bytes]] = None, + vm_name: str, + parameters: IO[bytes], *, content_type: str = "application/json", + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, **kwargs: Any - ) -> LROPoller[_models.OkResponse]: - """Reimages (upgrade the operating system) a specific virtual machine in a VM scale set. + ) -> 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. The name is case insensitive. Required. :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param instance_id: The instance ID of the virtual machine. Required. - :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: IO[bytes] + :param vm_name: The name of the virtual machine. Required. + :type vm_name: str + :param parameters: Parameters supplied to the Create Virtual Machine operation. Required. + :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns OkResponse. The OkResponse is compatible with - MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.OkResponse] + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of LROPoller that returns VirtualMachine. The VirtualMachine is compatible + with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.VirtualMachine] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace - def begin_reimage( + def begin_create_or_update( self, resource_group_name: str, - vm_scale_set_name: str, - instance_id: str, - vm_scale_set_vm_reimage_input: Optional[ - Union[_models.VirtualMachineScaleSetVMReimageParameters, JSON, IO[bytes]] - ] = None, + vm_name: str, + parameters: Union[_models.VirtualMachine, JSON, IO[bytes]], + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, **kwargs: Any - ) -> LROPoller[_models.OkResponse]: - """Reimages (upgrade the operating system) a specific virtual machine in a VM scale set. + ) -> 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. The name is case insensitive. Required. :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param instance_id: The instance ID of the virtual machine. Required. - :type instance_id: str - :param vm_scale_set_vm_reimage_input: Parameters for the Reimaging Virtual machine in ScaleSet. - Is one of the following types: VirtualMachineScaleSetVMReimageParameters, JSON, IO[bytes] - Default value is None. - :type vm_scale_set_vm_reimage_input: - ~azure.mgmt.compute.models.VirtualMachineScaleSetVMReimageParameters or JSON or IO[bytes] - :return: An instance of LROPoller that returns OkResponse. The OkResponse is compatible with - MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.OkResponse] + :param vm_name: The name of the virtual machine. Required. + :type vm_name: str + :param parameters: Parameters supplied to the Create Virtual Machine operation. Is one of the + following types: VirtualMachine, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.compute.models.VirtualMachine or JSON or IO[bytes] + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of LROPoller that returns VirtualMachine. The VirtualMachine is compatible + with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.VirtualMachine] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - content_type = content_type if vm_scale_set_vm_reimage_input else None - cls: ClsType[_models.OkResponse] = kwargs.pop("cls", None) + cls: ClsType[_models.VirtualMachine] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._reimage_initial( + 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_scale_set_vm_reimage_input=vm_scale_set_vm_reimage_input, + vm_name=vm_name, + parameters=parameters, + etag=etag, + match_condition=match_condition, content_type=content_type, cls=lambda x, y, z: x, headers=_headers, @@ -15723,14 +15226,10 @@ def begin_reimage( kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - response_headers = {} response = pipeline_response.http_response - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = _deserialize(_models.OkResponse, response.json()) + deserialized = _deserialize(_models.VirtualMachine, response.json()) if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized path_format_arguments = { @@ -15746,18 +15245,25 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller[_models.OkResponse].from_continuation_token( + return LROPoller[_models.VirtualMachine].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller[_models.OkResponse]( + return LROPoller[_models.VirtualMachine]( self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - def _reimage_all_initial( - self, resource_group_name: str, vm_scale_set_name: str, instance_id: str, **kwargs: Any + def _update_initial( + self, + resource_group_name: str, + vm_name: str, + parameters: Union[_models.VirtualMachineUpdate, JSON, IO[bytes]], + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any ) -> Iterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -15765,221 +15271,33 @@ def _reimage_all_initial( 409: ResourceExistsError, 304: ResourceNotModifiedError, } + if match_condition == MatchConditions.IfNotModified: + error_map[412] = ResourceModifiedError + elif match_condition == MatchConditions.IfPresent: + error_map[412] = ResourceNotFoundError + elif match_condition == MatchConditions.IfMissing: + error_map[412] = ResourceExistsError error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - _request = build_virtual_machine_scale_set_vms_reimage_all_request( + content_type = content_type or "application/json" + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_virtual_machines_update_request( resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, - instance_id=instance_id, - subscription_id=self._config.subscription_id, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.CloudError, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.iter_bytes() - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_reimage_all( - self, resource_group_name: str, vm_scale_set_name: str, instance_id: str, **kwargs: Any - ) -> LROPoller[_models.OkResponse]: - """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. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param instance_id: The instance ID of the virtual machine. Required. - :type instance_id: str - :return: An instance of LROPoller that returns OkResponse. The OkResponse is compatible with - MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.OkResponse] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[_models.OkResponse] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._reimage_all_initial( - resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, - instance_id=instance_id, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - response_headers = {} - response = pipeline_response.http_response - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = _deserialize(_models.OkResponse, response.json()) - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized - - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.OkResponse].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.OkResponse]( - self._client, raw_result, get_long_running_output, polling_method # 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. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param instance_id: The instance ID of the virtual machine. Required. - :type instance_id: str - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_virtual_machine_scale_set_vms_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=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.CloudError, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - def _attach_detach_data_disks_initial( - self, - resource_group_name: str, - vm_scale_set_name: str, - instance_id: str, - parameters: Union[_models.AttachDetachDataDisksRequest, JSON, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} - - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - - _request = build_virtual_machine_scale_set_vms_attach_detach_data_disks_request( - resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, - instance_id=instance_id, + vm_name=vm_name, subscription_id=self._config.subscription_id, + etag=etag, + match_condition=match_condition, content_type=content_type, api_version=self._config.api_version, content=_content, @@ -15998,7 +15316,7 @@ def _attach_detach_data_disks_initial( response = pipeline_response.http_response - if response.status_code not in [200, 202]: + if response.status_code not in [200]: try: response.read() # Load the body in memory and close the socket except (StreamConsumedError, StreamClosedError): @@ -16008,9 +15326,8 @@ def _attach_detach_data_disks_initial( raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) deserialized = response.iter_bytes() @@ -16020,142 +15337,156 @@ def _attach_detach_data_disks_initial( return deserialized # type: ignore @overload - def begin_attach_detach_data_disks( + def begin_update( self, resource_group_name: str, - vm_scale_set_name: str, - instance_id: str, - parameters: _models.AttachDetachDataDisksRequest, + vm_name: str, + parameters: _models.VirtualMachineUpdate, *, content_type: str = "application/json", + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, **kwargs: Any - ) -> LROPoller[_models.StorageProfile]: - """Attach and detach data disks to/from a virtual machine in a VM scale set. + ) -> LROPoller[_models.VirtualMachine]: + """The operation to update a virtual machine. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param instance_id: The instance ID of the virtual machine. Required. - :type instance_id: str - :param parameters: Parameters supplied to the attach and detach data disks operation on a - Virtual Machine Scale Sets VM. Required. - :type parameters: ~azure.mgmt.compute.models.AttachDetachDataDisksRequest + :param vm_name: The name of the virtual machine. Required. + :type vm_name: str + :param parameters: Parameters supplied to the Update Virtual Machine operation. Required. + :type parameters: ~azure.mgmt.compute.models.VirtualMachineUpdate :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns StorageProfile. The StorageProfile is compatible + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of LROPoller that returns VirtualMachine. The VirtualMachine is compatible with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.StorageProfile] + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.VirtualMachine] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def begin_attach_detach_data_disks( + def begin_update( self, resource_group_name: str, - vm_scale_set_name: str, - instance_id: str, + vm_name: str, parameters: JSON, *, content_type: str = "application/json", + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, **kwargs: Any - ) -> LROPoller[_models.StorageProfile]: - """Attach and detach data disks to/from a virtual machine in a VM scale set. + ) -> LROPoller[_models.VirtualMachine]: + """The operation to update a virtual machine. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param instance_id: The instance ID of the virtual machine. Required. - :type instance_id: str - :param parameters: Parameters supplied to the attach and detach data disks operation on a - Virtual Machine Scale Sets VM. Required. + :param vm_name: The name of the virtual machine. Required. + :type vm_name: str + :param parameters: Parameters supplied to the Update Virtual Machine operation. Required. :type parameters: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns StorageProfile. The StorageProfile is compatible + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of LROPoller that returns VirtualMachine. The VirtualMachine is compatible with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.StorageProfile] + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.VirtualMachine] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def begin_attach_detach_data_disks( + def begin_update( self, resource_group_name: str, - vm_scale_set_name: str, - instance_id: str, + vm_name: str, parameters: IO[bytes], *, content_type: str = "application/json", + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, **kwargs: Any - ) -> LROPoller[_models.StorageProfile]: - """Attach and detach data disks to/from a virtual machine in a VM scale set. + ) -> LROPoller[_models.VirtualMachine]: + """The operation to update a virtual machine. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param instance_id: The instance ID of the virtual machine. Required. - :type instance_id: str - :param parameters: Parameters supplied to the attach and detach data disks operation on a - Virtual Machine Scale Sets VM. Required. + :param vm_name: The name of the virtual machine. Required. + :type vm_name: str + :param parameters: Parameters supplied to the Update Virtual Machine operation. Required. :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns StorageProfile. The StorageProfile is compatible + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of LROPoller that returns VirtualMachine. The VirtualMachine is compatible with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.StorageProfile] + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.VirtualMachine] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace - def begin_attach_detach_data_disks( + def begin_update( self, resource_group_name: str, - vm_scale_set_name: str, - instance_id: str, - parameters: Union[_models.AttachDetachDataDisksRequest, JSON, IO[bytes]], + vm_name: str, + parameters: Union[_models.VirtualMachineUpdate, JSON, IO[bytes]], + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, **kwargs: Any - ) -> LROPoller[_models.StorageProfile]: - """Attach and detach data disks to/from a virtual machine in a VM scale set. + ) -> LROPoller[_models.VirtualMachine]: + """The operation to update a virtual machine. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param instance_id: The instance ID of the virtual machine. Required. - :type instance_id: str - :param parameters: Parameters supplied to the attach and detach data disks operation on a - Virtual Machine Scale Sets VM. Is one of the following types: AttachDetachDataDisksRequest, - JSON, IO[bytes] Required. - :type parameters: ~azure.mgmt.compute.models.AttachDetachDataDisksRequest or JSON or IO[bytes] - :return: An instance of LROPoller that returns StorageProfile. The StorageProfile is compatible + :param vm_name: The name of the virtual machine. Required. + :type vm_name: str + :param parameters: Parameters supplied to the Update Virtual Machine operation. Is one of the + following types: VirtualMachineUpdate, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.compute.models.VirtualMachineUpdate or JSON or IO[bytes] + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of LROPoller that returns VirtualMachine. The VirtualMachine is compatible with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.StorageProfile] + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.VirtualMachine] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.StorageProfile] = kwargs.pop("cls", None) + cls: ClsType[_models.VirtualMachine] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._attach_detach_data_disks_initial( + raw_result = self._update_initial( resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, - instance_id=instance_id, + vm_name=vm_name, parameters=parameters, + etag=etag, + match_condition=match_condition, content_type=content_type, cls=lambda x, y, z: x, headers=_headers, @@ -16171,7 +15502,7 @@ def get_long_running_output(pipeline_response): response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - deserialized = _deserialize(_models.StorageProfile, response.json()) + deserialized = _deserialize(_models.VirtualMachine, response.json()) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized @@ -16189,18 +15520,18 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller[_models.StorageProfile].from_continuation_token( + return LROPoller[_models.VirtualMachine].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller[_models.StorageProfile]( + return LROPoller[_models.VirtualMachine]( self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - def _perform_maintenance_initial( - self, resource_group_name: str, vm_scale_set_name: str, instance_id: str, **kwargs: Any + def _delete_initial( + self, resource_group_name: str, vm_name: str, *, force_deletion: Optional[bool] = None, **kwargs: Any ) -> Iterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -16215,11 +15546,11 @@ def _perform_maintenance_initial( cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - _request = build_virtual_machine_scale_set_vms_perform_maintenance_request( + _request = build_virtual_machines_delete_request( resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, - instance_id=instance_id, + vm_name=vm_name, subscription_id=self._config.subscription_id, + force_deletion=force_deletion, api_version=self._config.api_version, headers=_headers, params=_params, @@ -16236,7 +15567,7 @@ def _perform_maintenance_initial( response = pipeline_response.http_response - if response.status_code not in [200, 202]: + if response.status_code not in [200, 202, 204]: try: response.read() # Load the body in memory and close the socket except (StreamConsumedError, StreamClosedError): @@ -16258,35 +15589,35 @@ def _perform_maintenance_initial( return deserialized # type: ignore @distributed_trace - def begin_perform_maintenance( - self, resource_group_name: str, vm_scale_set_name: str, instance_id: str, **kwargs: Any - ) -> LROPoller[_models.OkResponse]: - """Performs maintenance on a virtual machine in a VM scale set. + def begin_delete( + 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. The name is case insensitive. Required. :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param instance_id: The instance ID of the virtual machine. Required. - :type instance_id: str - :return: An instance of LROPoller that returns OkResponse. The OkResponse is compatible with - MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.OkResponse] + :param vm_name: The name of the virtual machine. Required. + :type vm_name: str + :keyword force_deletion: Optional parameter to force delete virtual machines. Default value is + None. + :paramtype force_deletion: bool + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.OkResponse] = kwargs.pop("cls", None) + cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._perform_maintenance_initial( + raw_result = self._delete_initial( resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, - instance_id=instance_id, + vm_name=vm_name, + force_deletion=force_deletion, cls=lambda x, y, z: x, headers=_headers, params=_params, @@ -16295,16 +15626,9 @@ def begin_perform_maintenance( raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): - response_headers = {} - response = pipeline_response.http_response - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = _deserialize(_models.OkResponse, response.json()) + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized + return cls(pipeline_response, None, {}) # type: ignore path_format_arguments = { "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), @@ -16319,25 +15643,47 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller[_models.OkResponse].from_continuation_token( + return LROPoller[None].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller[_models.OkResponse]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - def _power_off_initial( + @distributed_trace + def list( self, resource_group_name: str, - vm_scale_set_name: str, - instance_id: str, *, - skip_shutdown: Optional[bool] = None, + filter: Optional[str] = None, + expand: Optional[Union[str, _models.ExpandTypeForListVMs]] = None, **kwargs: Any - ) -> Iterator[bytes]: + ) -> ItemPaged["_models.VirtualMachine"]: + """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. The name is case insensitive. + Required. + :type resource_group_name: str + :keyword 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. + :paramtype filter: str + :keyword expand: The expand expression to apply on operation. 'instanceView' enables fetching + run time status of all Virtual Machines, this can only be specified if a valid $filter option + is specified. "instanceView" Default value is None. + :paramtype expand: str or ~azure.mgmt.compute.models.ExpandTypeForListVMs + :return: An iterator like instance of VirtualMachine + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.models.VirtualMachine] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.VirtualMachine]] = kwargs.pop("cls", None) + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -16346,142 +15692,180 @@ def _power_off_initial( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} + def prepare_request(next_link=None): + if not next_link: - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + _request = build_virtual_machines_list_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + filter=filter, + expand=expand, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) - _request = build_virtual_machine_scale_set_vms_power_off_request( - resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, - instance_id=instance_id, - subscription_id=self._config.subscription_id, - skip_shutdown=skip_shutdown, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) + return _request - response = pipeline_response.http_response + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.VirtualMachine], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) - if response.status_code not in [200, 202]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.CloudError, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + def get_next(next_link=None): + _request = prepare_request(next_link) - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response - deserialized = response.iter_bytes() + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore + return pipeline_response - return deserialized # type: ignore + return ItemPaged(get_next, extract_data) @distributed_trace - def begin_power_off( + def list_all( self, - resource_group_name: str, - vm_scale_set_name: str, - instance_id: str, *, - skip_shutdown: Optional[bool] = None, + status_only: Optional[str] = None, + filter: Optional[str] = None, + expand: Optional[Union[str, _models.ExpandTypesForListVMs]] = None, **kwargs: Any - ) -> LROPoller[_models.OkResponse]: - """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. + ) -> ItemPaged["_models.VirtualMachine"]: + """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 resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param instance_id: The instance ID of the virtual machine. Required. - :type instance_id: str - :keyword 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 None. - :paramtype skip_shutdown: bool - :return: An instance of LROPoller that returns OkResponse. The OkResponse is compatible with - MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.OkResponse] + :keyword status_only: statusOnly=true enables fetching run time status of all Virtual Machines + in the subscription. Default value is None. + :paramtype status_only: str + :keyword 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. + :paramtype filter: str + :keyword expand: The expand expression to apply on operation. 'instanceView' enables fetching + run time status of all Virtual Machines, this can only be specified if a valid $filter option + is specified. "instanceView" Default value is None. + :paramtype expand: str or ~azure.mgmt.compute.models.ExpandTypesForListVMs + :return: An iterator like instance of VirtualMachine + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.models.VirtualMachine] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.OkResponse] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._power_off_initial( - resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, - instance_id=instance_id, - skip_shutdown=skip_shutdown, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) + cls: ClsType[List[_models.VirtualMachine]] = kwargs.pop("cls", None) - def get_long_running_output(pipeline_response): - response_headers = {} - response = pipeline_response.http_response - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_virtual_machines_list_all_request( + subscription_id=self._config.subscription_id, + status_only=status_only, + filter=filter, + expand=expand, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request - deserialized = _deserialize(_models.OkResponse, response.json()) + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.VirtualMachine], deserialized.get("value", [])) if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } + def get_next(next_link=None): + _request = prepare_request(next_link) - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.OkResponse].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs ) - return LROPoller[_models.OkResponse]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) + response = pipeline_response.http_response - def _redeploy_initial( - self, resource_group_name: str, vm_scale_set_name: str, instance_id: str, **kwargs: Any - ) -> Iterator[bytes]: + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + def _assess_patches_initial(self, resource_group_name: str, vm_name: str, **kwargs: Any) -> Iterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -16495,10 +15879,9 @@ def _redeploy_initial( cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - _request = build_virtual_machine_scale_set_vms_redeploy_request( + _request = build_virtual_machines_assess_patches_request( resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, - instance_id=instance_id, + vm_name=vm_name, subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -16538,36 +15921,33 @@ def _redeploy_initial( return deserialized # type: ignore @distributed_trace - def begin_redeploy( - self, resource_group_name: str, vm_scale_set_name: str, instance_id: str, **kwargs: Any - ) -> LROPoller[_models.OkResponse]: - """Shuts down the virtual machine in the virtual machine scale set, moves it to a new node, and - powers it back on. + 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. The name is case insensitive. Required. :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param instance_id: The instance ID of the virtual machine. Required. - :type instance_id: str - :return: An instance of LROPoller that returns OkResponse. The OkResponse is compatible with - MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.OkResponse] + :param vm_name: The name of the virtual machine. Required. + :type vm_name: str + :return: An instance of LROPoller that returns VirtualMachineAssessPatchesResult. The + VirtualMachineAssessPatchesResult is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.VirtualMachineAssessPatchesResult] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.OkResponse] = kwargs.pop("cls", None) + cls: ClsType[_models.VirtualMachineAssessPatchesResult] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._redeploy_initial( + raw_result = self._assess_patches_initial( resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, - instance_id=instance_id, + vm_name=vm_name, cls=lambda x, y, z: x, headers=_headers, params=_params, @@ -16582,7 +15962,7 @@ def get_long_running_output(pipeline_response): response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - deserialized = _deserialize(_models.OkResponse, response.json()) + deserialized = _deserialize(_models.VirtualMachineAssessPatchesResult, response.json()) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized @@ -16600,18 +15980,22 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller[_models.OkResponse].from_continuation_token( + return LROPoller[_models.VirtualMachineAssessPatchesResult].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller[_models.OkResponse]( + return LROPoller[_models.VirtualMachineAssessPatchesResult]( self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - def _restart_initial( - self, resource_group_name: str, vm_scale_set_name: str, instance_id: str, **kwargs: Any + def _attach_detach_data_disks_initial( + self, + resource_group_name: str, + vm_name: str, + parameters: Union[_models.AttachDetachDataDisksRequest, JSON, IO[bytes]], + **kwargs: Any ) -> Iterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -16621,17 +16005,26 @@ def _restart_initial( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - _request = build_virtual_machine_scale_set_vms_restart_request( + content_type = content_type or "application/json" + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_virtual_machines_attach_detach_data_disks_request( resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, - instance_id=instance_id, + vm_name=vm_name, subscription_id=self._config.subscription_id, + content_type=content_type, api_version=self._config.api_version, + content=_content, headers=_headers, params=_params, ) @@ -16668,36 +16061,131 @@ def _restart_initial( return deserialized # type: ignore + @overload + def begin_attach_detach_data_disks( + self, + resource_group_name: str, + vm_name: str, + parameters: _models.AttachDetachDataDisksRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.StorageProfile]: + """Attach and detach data disks to/from the virtual machine. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_name: The name of the virtual machine. Required. + :type vm_name: str + :param parameters: Parameters supplied to the attach and detach data disks operation on the + virtual machine. Required. + :type parameters: ~azure.mgmt.compute.models.AttachDetachDataDisksRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns StorageProfile. The StorageProfile is compatible + with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.StorageProfile] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_attach_detach_data_disks( + self, + resource_group_name: str, + vm_name: str, + parameters: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.StorageProfile]: + """Attach and detach data disks to/from the virtual machine. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_name: The name of the virtual machine. Required. + :type vm_name: str + :param parameters: Parameters supplied to the attach and detach data disks operation on the + virtual machine. Required. + :type parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns StorageProfile. The StorageProfile is compatible + with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.StorageProfile] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_attach_detach_data_disks( + self, + resource_group_name: str, + vm_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.StorageProfile]: + """Attach and detach data disks to/from the virtual machine. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_name: The name of the virtual machine. Required. + :type vm_name: str + :param parameters: Parameters supplied to the attach and detach data disks operation on the + virtual machine. Required. + :type parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns StorageProfile. The StorageProfile is compatible + with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.StorageProfile] + :raises ~azure.core.exceptions.HttpResponseError: + """ + @distributed_trace - def begin_restart( - self, resource_group_name: str, vm_scale_set_name: str, instance_id: str, **kwargs: Any - ) -> LROPoller[_models.OkResponse]: - """Restarts a virtual machine in a VM scale set. + def begin_attach_detach_data_disks( + self, + resource_group_name: str, + vm_name: str, + parameters: Union[_models.AttachDetachDataDisksRequest, JSON, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.StorageProfile]: + """Attach and detach data disks to/from the virtual machine. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param instance_id: The instance ID of the virtual machine. Required. - :type instance_id: str - :return: An instance of LROPoller that returns OkResponse. The OkResponse is compatible with - MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.OkResponse] + :param vm_name: The name of the virtual machine. Required. + :type vm_name: str + :param parameters: Parameters supplied to the attach and detach data disks operation on the + virtual machine. Is one of the following types: AttachDetachDataDisksRequest, JSON, IO[bytes] + Required. + :type parameters: ~azure.mgmt.compute.models.AttachDetachDataDisksRequest or JSON or IO[bytes] + :return: An instance of LROPoller that returns StorageProfile. The StorageProfile is compatible + with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.StorageProfile] :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = kwargs.pop("headers", {}) or {} + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.OkResponse] = kwargs.pop("cls", None) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.StorageProfile] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._restart_initial( + raw_result = self._attach_detach_data_disks_initial( resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, - instance_id=instance_id, + vm_name=vm_name, + parameters=parameters, + content_type=content_type, cls=lambda x, y, z: x, headers=_headers, params=_params, @@ -16712,7 +16200,7 @@ def get_long_running_output(pipeline_response): response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - deserialized = _deserialize(_models.OkResponse, response.json()) + deserialized = _deserialize(_models.StorageProfile, response.json()) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized @@ -16730,102 +16218,22 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller[_models.OkResponse].from_continuation_token( + return LROPoller[_models.StorageProfile].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller[_models.OkResponse]( + return LROPoller[_models.StorageProfile]( self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - @distributed_trace - def retrieve_boot_diagnostics_data( + def _capture_initial( self, resource_group_name: str, - vm_scale_set_name: str, - instance_id: str, - *, - sas_uri_expiration_time_in_minutes: Optional[int] = None, + vm_name: str, + parameters: Union[_models.VirtualMachineCaptureParameters, JSON, IO[bytes]], **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. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param instance_id: The instance ID of the virtual machine. Required. - :type instance_id: str - :keyword sas_uri_expiration_time_in_minutes: Expiration duration in minutes for the SAS URIs - with a value between 1 to 1440 minutes. **Note:** If not specified, SAS URIs will be generated - with a default expiration duration of 120 minutes. Default value is None. - :paramtype sas_uri_expiration_time_in_minutes: int - :return: RetrieveBootDiagnosticsDataResult. The RetrieveBootDiagnosticsDataResult is compatible - with MutableMapping - :rtype: ~azure.mgmt.compute.models.RetrieveBootDiagnosticsDataResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[_models.RetrieveBootDiagnosticsDataResult] = kwargs.pop("cls", None) - - _request = build_virtual_machine_scale_set_vms_retrieve_boot_diagnostics_data_request( - resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, - instance_id=instance_id, - subscription_id=self._config.subscription_id, - sas_uri_expiration_time_in_minutes=sas_uri_expiration_time_in_minutes, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = kwargs.pop("stream", False) - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - if _stream: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.CloudError, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if _stream: - deserialized = response.iter_bytes() - else: - deserialized = _deserialize(_models.RetrieveBootDiagnosticsDataResult, response.json()) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _start_initial( - self, resource_group_name: str, vm_scale_set_name: str, instance_id: str, **kwargs: Any ) -> Iterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -16835,17 +16243,26 @@ def _start_initial( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - _request = build_virtual_machine_scale_set_vms_start_request( + content_type = content_type or "application/json" + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_virtual_machines_capture_request( resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, - instance_id=instance_id, + vm_name=vm_name, subscription_id=self._config.subscription_id, + content_type=content_type, api_version=self._config.api_version, + content=_content, headers=_headers, params=_params, ) @@ -16882,54 +16299,150 @@ def _start_initial( return deserialized # type: ignore - @distributed_trace - def begin_start( - self, resource_group_name: str, vm_scale_set_name: str, instance_id: str, **kwargs: Any - ) -> LROPoller[_models.OkResponse]: - """Starts a virtual machine in a VM scale set. + @overload + def begin_capture( + self, + resource_group_name: str, + vm_name: str, + parameters: _models.VirtualMachineCaptureParameters, + *, + content_type: str = "application/json", + **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. The name is case insensitive. Required. :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param instance_id: The instance ID of the virtual machine. Required. - :type instance_id: str - :return: An instance of LROPoller that returns OkResponse. The OkResponse is compatible with - MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.OkResponse] + :param vm_name: The name of the virtual machine. Required. + :type vm_name: str + :param parameters: Parameters supplied to the Capture Virtual Machine operation. Required. + :type parameters: ~azure.mgmt.compute.models.VirtualMachineCaptureParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns VirtualMachineCaptureResult. The + VirtualMachineCaptureResult is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.VirtualMachineCaptureResult] :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[_models.OkResponse] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._start_initial( - resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, - instance_id=instance_id, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): - response_headers = {} - response = pipeline_response.http_response - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + @overload + def begin_capture( + self, + resource_group_name: str, + vm_name: str, + parameters: JSON, + *, + content_type: str = "application/json", + **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. - deserialized = _deserialize(_models.OkResponse, response.json()) - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_name: The name of the virtual machine. Required. + :type vm_name: str + :param parameters: Parameters supplied to the Capture Virtual Machine operation. Required. + :type parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns VirtualMachineCaptureResult. The + VirtualMachineCaptureResult is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.VirtualMachineCaptureResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_capture( + self, + resource_group_name: str, + vm_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **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. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_name: The name of the virtual machine. Required. + :type vm_name: str + :param parameters: Parameters supplied to the Capture Virtual Machine operation. Required. + :type parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns VirtualMachineCaptureResult. The + VirtualMachineCaptureResult is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.VirtualMachineCaptureResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_capture( + self, + resource_group_name: str, + vm_name: str, + parameters: Union[_models.VirtualMachineCaptureParameters, JSON, IO[bytes]], + **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. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_name: The name of the virtual machine. Required. + :type vm_name: str + :param parameters: Parameters supplied to the Capture Virtual Machine operation. Is one of the + following types: VirtualMachineCaptureParameters, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.compute.models.VirtualMachineCaptureParameters or JSON or + IO[bytes] + :return: An instance of LROPoller that returns VirtualMachineCaptureResult. The + VirtualMachineCaptureResult is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.VirtualMachineCaptureResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.VirtualMachineCaptureResult] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._capture_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + parameters=parameters, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = _deserialize(_models.VirtualMachineCaptureResult, response.json()) + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + return deserialized path_format_arguments = { "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), @@ -16944,23 +16457,18 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller[_models.OkResponse].from_continuation_token( + return LROPoller[_models.VirtualMachineCaptureResult].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller[_models.OkResponse]( + return LROPoller[_models.VirtualMachineCaptureResult]( self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - def _run_command_initial( - self, - resource_group_name: str, - vm_scale_set_name: str, - instance_id: str, - parameters: Union[_models.RunCommandInput, JSON, IO[bytes]], - **kwargs: Any + def _convert_to_managed_disks_initial( + self, resource_group_name: str, vm_name: str, **kwargs: Any ) -> Iterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -16970,27 +16478,16 @@ def _run_command_initial( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - content_type = content_type or "application/json" - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - - _request = build_virtual_machine_scale_set_vms_run_command_request( + _request = build_virtual_machines_convert_to_managed_disks_request( resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, - instance_id=instance_id, + vm_name=vm_name, subscription_id=self._config.subscription_id, - content_type=content_type, api_version=self._config.api_version, - content=_content, headers=_headers, params=_params, ) @@ -17027,140 +16524,152 @@ def _run_command_initial( return deserialized # type: ignore - @overload - def begin_run_command( - self, - resource_group_name: str, - vm_scale_set_name: str, - instance_id: str, - parameters: _models.RunCommandInput, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.RunCommandResult]: - """Run command on a virtual machine in a VM scale set. + @distributed_trace + def begin_convert_to_managed_disks(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. The name is case insensitive. Required. :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param instance_id: The instance ID of the virtual machine. Required. - :type instance_id: str - :param parameters: Parameters supplied to the Run command operation. Required. - :type parameters: ~azure.mgmt.compute.models.RunCommandInput - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns RunCommandResult. The RunCommandResult is - compatible with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.RunCommandResult] + :param vm_name: The name of the virtual machine. Required. + :type vm_name: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} - @overload - def begin_run_command( - self, - resource_group_name: str, - vm_scale_set_name: str, - instance_id: str, - parameters: JSON, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.RunCommandResult]: - """Run command on a virtual machine in a VM scale set. + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._convert_to_managed_disks_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param instance_id: The instance ID of the virtual machine. Required. - :type instance_id: str - :param parameters: Parameters supplied to the Run command operation. Required. - :type parameters: JSON - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns RunCommandResult. The RunCommandResult is - compatible with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.RunCommandResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore - @overload - def begin_run_command( - self, - resource_group_name: str, - vm_scale_set_name: str, - instance_id: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.RunCommandResult]: - """Run command on a virtual machine in a VM scale set. + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param instance_id: The instance ID of the virtual machine. Required. - :type instance_id: str - :param parameters: Parameters supplied to the Run command operation. Required. - :type parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns RunCommandResult. The RunCommandResult is - compatible with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.RunCommandResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + def _deallocate_initial( + self, resource_group_name: str, vm_name: str, *, hibernate: Optional[bool] = None, **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_virtual_machines_deallocate_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + hibernate=hibernate, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore @distributed_trace - def begin_run_command( - self, - resource_group_name: str, - vm_scale_set_name: str, - instance_id: str, - parameters: Union[_models.RunCommandInput, JSON, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.RunCommandResult]: - """Run command on a virtual machine in a VM scale set. + def begin_deallocate( + 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. The name is case insensitive. Required. :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param instance_id: The instance ID of the virtual machine. Required. - :type instance_id: str - :param parameters: Parameters supplied to the Run command operation. Is one of the following - types: RunCommandInput, JSON, IO[bytes] Required. - :type parameters: ~azure.mgmt.compute.models.RunCommandInput or JSON or IO[bytes] - :return: An instance of LROPoller that returns RunCommandResult. The RunCommandResult is - compatible with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.RunCommandResult] + :param vm_name: The name of the virtual machine. Required. + :type vm_name: str + :keyword hibernate: Optional parameter to hibernate a virtual machine. Default value is None. + :paramtype hibernate: bool + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.RunCommandResult] = kwargs.pop("cls", None) + cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._run_command_initial( + raw_result = self._deallocate_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, + vm_name=vm_name, + hibernate=hibernate, cls=lambda x, y, z: x, headers=_headers, params=_params, @@ -17169,16 +16678,9 @@ def begin_run_command( raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): - response_headers = {} - response = pipeline_response.http_response - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = _deserialize(_models.RunCommandResult, response.json()) + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized + return cls(pipeline_response, None, {}) # type: ignore path_format_arguments = { "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), @@ -17193,61 +16695,32 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller[_models.RunCommandResult].from_continuation_token( + return LROPoller[None].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller[_models.RunCommandResult]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - -class VirtualMachineScaleSetVMExtensionsOperations: # pylint: disable=name-too-long - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.compute.ComputeClient`'s - :attr:`virtual_machine_scale_set_vm_extensions` attribute. - """ - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ComputeClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # 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. + 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. For Windows, please refer to `Create a + managed image of a generalized VM in Azure + `_. 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. The name is case insensitive. Required. :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param instance_id: The instance ID of the virtual machine. Required. - :type instance_id: str - :param vm_extension_name: The name of the virtual machine extension. Required. - :type vm_extension_name: str - :keyword expand: The expand expression to apply on the operation. Default value is None. - :paramtype expand: str - :return: VirtualMachineScaleSetVMExtension. The VirtualMachineScaleSetVMExtension is compatible - with MutableMapping - :rtype: ~azure.mgmt.compute.models.VirtualMachineScaleSetVMExtension + :param vm_name: The name of the virtual machine. Required. + :type vm_name: str + :return: None + :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -17261,15 +16734,12 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.VirtualMachineScaleSetVMExtension] = kwargs.pop("cls", None) + cls: ClsType[None] = kwargs.pop("cls", None) - _request = build_virtual_machine_scale_set_vm_extensions_get_request( + _request = build_virtual_machines_generalize_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, + vm_name=vm_name, subscription_id=self._config.subscription_id, - expand=expand, api_version=self._config.api_version, headers=_headers, params=_params, @@ -17279,7 +16749,7 @@ def get( } _request.url = self._client.format_url(_request.url, **path_format_arguments) - _stream = kwargs.pop("stream", False) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -17287,32 +16757,18 @@ def get( response = pipeline_response.http_response if response.status_code not in [200]: - if _stream: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = _failsafe_deserialize(_models.CloudError, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if _stream: - deserialized = response.iter_bytes() - else: - deserialized = _deserialize(_models.VirtualMachineScaleSetVMExtension, response.json()) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore + return cls(pipeline_response, None, {}) # type: ignore - def _create_or_update_initial( + def _install_patches_initial( self, resource_group_name: str, - vm_scale_set_name: str, - instance_id: str, - vm_extension_name: str, - extension_parameters: Union[_models.VirtualMachineScaleSetVMExtension, JSON, IO[bytes]], + vm_name: str, + install_patches_input: Union[_models.VirtualMachineInstallPatchesParameters, JSON, IO[bytes]], **kwargs: Any ) -> Iterator[bytes]: error_map: MutableMapping = { @@ -17331,16 +16787,14 @@ def _create_or_update_initial( content_type = content_type or "application/json" _content = None - if isinstance(extension_parameters, (IOBase, bytes)): - _content = extension_parameters + if isinstance(install_patches_input, (IOBase, bytes)): + _content = install_patches_input else: - _content = json.dumps(extension_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(install_patches_input, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - _request = build_virtual_machine_scale_set_vm_extensions_create_or_update_request( + _request = build_virtual_machines_install_patches_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, + vm_name=vm_name, subscription_id=self._config.subscription_id, content_type=content_type, api_version=self._config.api_version, @@ -17360,7 +16814,7 @@ def _create_or_update_initial( response = pipeline_response.http_response - if response.status_code not in [200, 201]: + if response.status_code not in [200, 202]: try: response.read() # Load the body in memory and close the socket except (StreamConsumedError, StreamClosedError): @@ -17370,7 +16824,7 @@ def _create_or_update_initial( raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} - if response.status_code == 201: + if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) @@ -17382,152 +16836,133 @@ def _create_or_update_initial( return deserialized # type: ignore @overload - def begin_create_or_update( + def begin_install_patches( self, resource_group_name: str, - vm_scale_set_name: str, - instance_id: str, - vm_extension_name: str, - extension_parameters: _models.VirtualMachineScaleSetVMExtension, + vm_name: str, + install_patches_input: _models.VirtualMachineInstallPatchesParameters, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[None]: - """The operation to create or update the VMSS VM extension. + ) -> LROPoller[_models.VirtualMachineInstallPatchesResult]: + """Installs patches on the VM. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param instance_id: The instance ID of the virtual machine. Required. - :type instance_id: str - :param vm_extension_name: The name of the virtual machine extension. Required. - :type vm_extension_name: str - :param extension_parameters: Parameters supplied to the Create Virtual Machine Extension - operation. Required. - :type extension_parameters: ~azure.mgmt.compute.models.VirtualMachineScaleSetVMExtension + :param vm_name: The name of the virtual machine. Required. + :type vm_name: str + :param install_patches_input: Input for InstallPatches as directly received by the API. + Required. + :type install_patches_input: ~azure.mgmt.compute.models.VirtualMachineInstallPatchesParameters :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns None - :rtype: ~azure.core.polling.LROPoller[None] + :return: An instance of LROPoller that returns VirtualMachineInstallPatchesResult. The + VirtualMachineInstallPatchesResult is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.VirtualMachineInstallPatchesResult] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def begin_create_or_update( + def begin_install_patches( self, resource_group_name: str, - vm_scale_set_name: str, - instance_id: str, - vm_extension_name: str, - extension_parameters: JSON, + vm_name: str, + install_patches_input: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[None]: - """The operation to create or update the VMSS VM extension. + ) -> LROPoller[_models.VirtualMachineInstallPatchesResult]: + """Installs patches on the VM. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param instance_id: The instance ID of the virtual machine. Required. - :type instance_id: str - :param vm_extension_name: The name of the virtual machine extension. Required. - :type vm_extension_name: str - :param extension_parameters: Parameters supplied to the Create Virtual Machine Extension - operation. Required. - :type extension_parameters: JSON + :param vm_name: The name of the virtual machine. Required. + :type vm_name: str + :param install_patches_input: Input for InstallPatches as directly received by the API. + Required. + :type install_patches_input: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns None - :rtype: ~azure.core.polling.LROPoller[None] + :return: An instance of LROPoller that returns VirtualMachineInstallPatchesResult. The + VirtualMachineInstallPatchesResult is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.VirtualMachineInstallPatchesResult] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def begin_create_or_update( + def begin_install_patches( self, resource_group_name: str, - vm_scale_set_name: str, - instance_id: str, - vm_extension_name: str, - extension_parameters: IO[bytes], + vm_name: str, + install_patches_input: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[None]: - """The operation to create or update the VMSS VM extension. + ) -> LROPoller[_models.VirtualMachineInstallPatchesResult]: + """Installs patches on the VM. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param instance_id: The instance ID of the virtual machine. Required. - :type instance_id: str - :param vm_extension_name: The name of the virtual machine extension. Required. - :type vm_extension_name: str - :param extension_parameters: Parameters supplied to the Create Virtual Machine Extension - operation. Required. - :type extension_parameters: IO[bytes] + :param vm_name: The name of the virtual machine. Required. + :type vm_name: str + :param install_patches_input: Input for InstallPatches as directly received by the API. + Required. + :type install_patches_input: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns None - :rtype: ~azure.core.polling.LROPoller[None] + :return: An instance of LROPoller that returns VirtualMachineInstallPatchesResult. The + VirtualMachineInstallPatchesResult is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.VirtualMachineInstallPatchesResult] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace - def begin_create_or_update( + def begin_install_patches( self, resource_group_name: str, - vm_scale_set_name: str, - instance_id: str, - vm_extension_name: str, - extension_parameters: Union[_models.VirtualMachineScaleSetVMExtension, JSON, IO[bytes]], + vm_name: str, + install_patches_input: Union[_models.VirtualMachineInstallPatchesParameters, JSON, IO[bytes]], **kwargs: Any - ) -> LROPoller[None]: - """The operation to create or update the VMSS VM extension. + ) -> LROPoller[_models.VirtualMachineInstallPatchesResult]: + """Installs patches on the VM. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param instance_id: The instance ID of the virtual machine. Required. - :type instance_id: str - :param vm_extension_name: The name of the virtual machine extension. Required. - :type vm_extension_name: str - :param extension_parameters: Parameters supplied to the Create Virtual Machine Extension - operation. Is one of the following types: VirtualMachineScaleSetVMExtension, JSON, IO[bytes] - Required. - :type extension_parameters: ~azure.mgmt.compute.models.VirtualMachineScaleSetVMExtension or - JSON or IO[bytes] - :return: An instance of LROPoller that returns None - :rtype: ~azure.core.polling.LROPoller[None] + :param vm_name: The name of the virtual machine. Required. + :type vm_name: str + :param install_patches_input: Input for InstallPatches as directly received by the API. Is one + of the following types: VirtualMachineInstallPatchesParameters, JSON, IO[bytes] Required. + :type install_patches_input: ~azure.mgmt.compute.models.VirtualMachineInstallPatchesParameters + or JSON or IO[bytes] + :return: An instance of LROPoller that returns VirtualMachineInstallPatchesResult. The + VirtualMachineInstallPatchesResult is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.VirtualMachineInstallPatchesResult] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[_models.VirtualMachineInstallPatchesResult] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._create_or_update_initial( + raw_result = self._install_patches_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, + vm_name=vm_name, + install_patches_input=install_patches_input, content_type=content_type, cls=lambda x, y, z: x, headers=_headers, @@ -17537,9 +16972,16 @@ def begin_create_or_update( raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = _deserialize(_models.VirtualMachineInstallPatchesResult, response.json()) if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore + return deserialized path_format_arguments = { "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), @@ -17554,23 +16996,32 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return LROPoller[None].from_continuation_token( + return LROPoller[_models.VirtualMachineInstallPatchesResult].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + return LROPoller[_models.VirtualMachineInstallPatchesResult]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) - def _update_initial( - self, - resource_group_name: str, - vm_scale_set_name: str, - instance_id: str, - vm_extension_name: str, - extension_parameters: Union[_models.VirtualMachineScaleSetVMExtensionUpdate, JSON, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: + @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. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_name: The name of the virtual machine. Required. + :type vm_name: str + :return: VirtualMachineInstanceView. The VirtualMachineInstanceView is compatible with + MutableMapping + :rtype: ~azure.mgmt.compute.models.VirtualMachineInstanceView + :raises ~azure.core.exceptions.HttpResponseError: + """ error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -17579,28 +17030,70 @@ def _update_initial( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + cls: ClsType[_models.VirtualMachineInstanceView] = kwargs.pop("cls", None) - content_type = content_type or "application/json" - _content = None - if isinstance(extension_parameters, (IOBase, bytes)): - _content = extension_parameters + _request = build_virtual_machines_instance_view_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() else: - _content = json.dumps(extension_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + deserialized = _deserialize(_models.VirtualMachineInstanceView, response.json()) - _request = build_virtual_machine_scale_set_vm_extensions_update_request( + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _perform_maintenance_initial(self, resource_group_name: str, vm_name: str, **kwargs: Any) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_virtual_machines_perform_maintenance_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, + vm_name=vm_name, subscription_id=self._config.subscription_id, - content_type=content_type, api_version=self._config.api_version, - content=_content, headers=_headers, params=_params, ) @@ -17616,7 +17109,7 @@ def _update_initial( response = pipeline_response.http_response - if response.status_code not in [200]: + if response.status_code not in [200, 202]: try: response.read() # Load the body in memory and close the socket except (StreamConsumedError, StreamClosedError): @@ -17626,8 +17119,9 @@ def _update_initial( raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) deserialized = response.iter_bytes() @@ -17636,154 +17130,30 @@ def _update_initial( return deserialized # type: ignore - @overload - def begin_update( - self, - resource_group_name: str, - vm_scale_set_name: str, - instance_id: str, - vm_extension_name: str, - extension_parameters: _models.VirtualMachineScaleSetVMExtensionUpdate, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[None]: - """The operation to update the VMSS VM extension. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param instance_id: The instance ID of the virtual machine. Required. - :type instance_id: str - :param vm_extension_name: The name of the virtual machine extension. Required. - :type vm_extension_name: str - :param extension_parameters: Parameters supplied to the Update Virtual Machine Extension - operation. Required. - :type extension_parameters: ~azure.mgmt.compute.models.VirtualMachineScaleSetVMExtensionUpdate - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns None - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update( - self, - resource_group_name: str, - vm_scale_set_name: str, - instance_id: str, - vm_extension_name: str, - extension_parameters: JSON, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[None]: - """The operation to update the VMSS VM extension. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param instance_id: The instance ID of the virtual machine. Required. - :type instance_id: str - :param vm_extension_name: The name of the virtual machine extension. Required. - :type vm_extension_name: str - :param extension_parameters: Parameters supplied to the Update Virtual Machine Extension - operation. Required. - :type extension_parameters: JSON - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns None - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update( - self, - resource_group_name: str, - vm_scale_set_name: str, - instance_id: str, - vm_extension_name: str, - extension_parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[None]: - """The operation to update the VMSS VM extension. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param instance_id: The instance ID of the virtual machine. Required. - :type instance_id: str - :param vm_extension_name: The name of the virtual machine extension. Required. - :type vm_extension_name: str - :param extension_parameters: Parameters supplied to the Update Virtual Machine Extension - operation. Required. - :type extension_parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns None - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - @distributed_trace - def begin_update( - self, - resource_group_name: str, - vm_scale_set_name: str, - instance_id: str, - vm_extension_name: str, - extension_parameters: Union[_models.VirtualMachineScaleSetVMExtensionUpdate, JSON, IO[bytes]], - **kwargs: Any - ) -> LROPoller[None]: - """The operation to update the VMSS VM extension. + def begin_perform_maintenance(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. The name is case insensitive. Required. :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param instance_id: The instance ID of the virtual machine. Required. - :type instance_id: str - :param vm_extension_name: The name of the virtual machine extension. Required. - :type vm_extension_name: str - :param extension_parameters: Parameters supplied to the Update Virtual Machine Extension - operation. Is one of the following types: VirtualMachineScaleSetVMExtensionUpdate, JSON, - IO[bytes] Required. - :type extension_parameters: ~azure.mgmt.compute.models.VirtualMachineScaleSetVMExtensionUpdate - or JSON or IO[bytes] + :param vm_name: The name of the virtual machine. Required. + :type vm_name: str :return: An instance of LROPoller that returns None :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._update_initial( + raw_result = self._perform_maintenance_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, - content_type=content_type, + vm_name=vm_name, cls=lambda x, y, z: x, headers=_headers, params=_params, @@ -17817,8 +17187,8 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - def _delete_initial( - self, resource_group_name: str, vm_scale_set_name: str, instance_id: str, vm_extension_name: str, **kwargs: Any + def _power_off_initial( + self, resource_group_name: str, vm_name: str, *, skip_shutdown: Optional[bool] = None, **kwargs: Any ) -> Iterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -17833,12 +17203,11 @@ def _delete_initial( cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - _request = build_virtual_machine_scale_set_vm_extensions_delete_request( + _request = build_virtual_machines_power_off_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, + vm_name=vm_name, subscription_id=self._config.subscription_id, + skip_shutdown=skip_shutdown, api_version=self._config.api_version, headers=_headers, params=_params, @@ -17855,7 +17224,7 @@ def _delete_initial( response = pipeline_response.http_response - if response.status_code not in [200, 202, 204]: + if response.status_code not in [200, 202]: try: response.read() # Load the body in memory and close the socket except (StreamConsumedError, StreamClosedError): @@ -17877,20 +17246,21 @@ def _delete_initial( return deserialized # type: ignore @distributed_trace - def begin_delete( - self, resource_group_name: str, vm_scale_set_name: str, instance_id: str, vm_extension_name: str, **kwargs: Any + def begin_power_off( + self, resource_group_name: str, vm_name: str, *, skip_shutdown: Optional[bool] = None, **kwargs: Any ) -> LROPoller[None]: - """The operation to delete the VMSS VM extension. + """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. The name is case insensitive. Required. :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param instance_id: The instance ID of the virtual machine. Required. - :type instance_id: str - :param vm_extension_name: The name of the virtual machine extension. Required. - :type vm_extension_name: str + :param vm_name: The name of the virtual machine. Required. + :type vm_name: str + :keyword 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 None. + :paramtype skip_shutdown: bool :return: An instance of LROPoller that returns None :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -17903,11 +17273,10 @@ def begin_delete( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._delete_initial( + raw_result = self._power_off_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, + vm_name=vm_name, + skip_shutdown=skip_shutdown, cls=lambda x, y, z: x, headers=_headers, params=_params, @@ -17941,37 +17310,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # 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 - ) -> ItemPaged["_models.VirtualMachineScaleSetVMExtension"]: - """The operation to get all extensions of an instance in Virtual Machine Scaleset. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param instance_id: The instance ID of the virtual machine. Required. - :type instance_id: str - :keyword expand: The expand expression to apply on the operation. Default value is None. - :paramtype expand: str - :return: An iterator like instance of VirtualMachineScaleSetVMExtension - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.compute.models.VirtualMachineScaleSetVMExtension] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[List[_models.VirtualMachineScaleSetVMExtension]] = kwargs.pop("cls", None) - + def _reapply_initial(self, resource_group_name: str, vm_name: str, **kwargs: Any) -> Iterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -17980,217 +17319,128 @@ def list( } error_map.update(kwargs.pop("error_map", {}) or {}) - def prepare_request(next_link=None): - if not next_link: + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} - _request = build_virtual_machine_scale_set_vm_extensions_list_request( - resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, - instance_id=instance_id, - subscription_id=self._config.subscription_id, - expand=expand, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) + _request = build_virtual_machines_reapply_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) - return _request + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) - def extract_data(pipeline_response): - deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.VirtualMachineScaleSetVMExtension], deserialized.get("value", [])) - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return None, iter(list_of_elem) + response = pipeline_response.http_response - def get_next(next_link=None): - _request = prepare_request(next_link) + if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.CloudError, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - -class VirtualMachinesOperations: # pylint: disable=too-many-public-methods - """ - .. warning:: - **DO NOT** instantiate this class directly. + deserialized = response.iter_bytes() - Instead, you should access the following operations through - :class:`~azure.mgmt.compute.ComputeClient`'s - :attr:`virtual_machines` attribute. - """ + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ComputeClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + return deserialized # 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. + def begin_reapply(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. The name is case insensitive. Required. :type resource_group_name: str :param vm_name: The name of the virtual machine. Required. :type vm_name: str - :keyword 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. - Known values are: "instanceView", "userData", and "resiliencyView". Default value is None. - :paramtype expand: str or ~azure.mgmt.compute.models.InstanceViewTypes - :return: VirtualMachine. The VirtualMachine is compatible with MutableMapping - :rtype: ~azure.mgmt.compute.models.VirtualMachine + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.VirtualMachine] = kwargs.pop("cls", None) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._reapply_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore - _request = build_virtual_machines_get_request( - resource_group_name=resource_group_name, - vm_name=vm_name, - subscription_id=self._config.subscription_id, - expand=expand, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) path_format_arguments = { "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = kwargs.pop("stream", False) - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - if _stream: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.CloudError, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if _stream: - deserialized = response.iter_bytes() + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) else: - deserialized = _deserialize(_models.VirtualMachine, response.json()) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - def _create_or_update_initial( - self, - resource_group_name: str, - vm_name: str, - parameters: Union[_models.VirtualMachine, JSON, IO[bytes]], - *, - etag: Optional[str] = None, - match_condition: Optional[MatchConditions] = None, - **kwargs: Any - ) -> Iterator[bytes]: + def _redeploy_initial(self, resource_group_name: str, vm_name: str, **kwargs: Any) -> Iterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, 304: ResourceNotModifiedError, } - if match_condition == MatchConditions.IfNotModified: - error_map[412] = ResourceModifiedError - elif match_condition == MatchConditions.IfPresent: - error_map[412] = ResourceNotFoundError - elif match_condition == MatchConditions.IfMissing: - error_map[412] = ResourceExistsError error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - content_type = content_type or "application/json" - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - - _request = build_virtual_machines_create_or_update_request( + _request = build_virtual_machines_redeploy_request( resource_group_name=resource_group_name, vm_name=vm_name, subscription_id=self._config.subscription_id, - etag=etag, - match_condition=match_condition, - content_type=content_type, api_version=self._config.api_version, - content=_content, headers=_headers, params=_params, ) @@ -18206,7 +17456,7 @@ def _create_or_update_initial( response = pipeline_response.http_response - if response.status_code not in [200, 201]: + if response.status_code not in [200, 202]: try: response.read() # Load the body in memory and close the socket except (StreamConsumedError, StreamClosedError): @@ -18216,7 +17466,7 @@ def _create_or_update_initial( raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} - if response.status_code == 201: + if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) @@ -18227,158 +17477,30 @@ def _create_or_update_initial( return deserialized # type: ignore - @overload - def begin_create_or_update( - self, - resource_group_name: str, - vm_name: str, - parameters: _models.VirtualMachine, - *, - content_type: str = "application/json", - etag: Optional[str] = None, - match_condition: Optional[MatchConditions] = None, - **kwargs: Any - ) -> LROPoller[None]: - """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. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_name: The name of the virtual machine. Required. - :type vm_name: str - :param parameters: Parameters supplied to the Create Virtual Machine operation. Required. - :type parameters: ~azure.mgmt.compute.models.VirtualMachine - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is - None. - :paramtype etag: str - :keyword match_condition: The match condition to use upon the etag. Default value is None. - :paramtype match_condition: ~azure.core.MatchConditions - :return: An instance of LROPoller that returns None - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - vm_name: str, - parameters: JSON, - *, - content_type: str = "application/json", - etag: Optional[str] = None, - match_condition: Optional[MatchConditions] = None, - **kwargs: Any - ) -> LROPoller[None]: - """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. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_name: The name of the virtual machine. Required. - :type vm_name: str - :param parameters: Parameters supplied to the Create Virtual Machine operation. Required. - :type parameters: JSON - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is - None. - :paramtype etag: str - :keyword match_condition: The match condition to use upon the etag. Default value is None. - :paramtype match_condition: ~azure.core.MatchConditions - :return: An instance of LROPoller that returns None - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - vm_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - etag: Optional[str] = None, - match_condition: Optional[MatchConditions] = None, - **kwargs: Any - ) -> LROPoller[None]: - """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. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_name: The name of the virtual machine. Required. - :type vm_name: str - :param parameters: Parameters supplied to the Create Virtual Machine operation. Required. - :type parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is - None. - :paramtype etag: str - :keyword match_condition: The match condition to use upon the etag. Default value is None. - :paramtype match_condition: ~azure.core.MatchConditions - :return: An instance of LROPoller that returns None - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - vm_name: str, - parameters: Union[_models.VirtualMachine, JSON, IO[bytes]], - *, - etag: Optional[str] = None, - match_condition: Optional[MatchConditions] = None, - **kwargs: Any - ) -> LROPoller[None]: - """The operation to create or update a virtual machine. Please note some properties can be set - only during virtual machine creation. + def begin_redeploy(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. The name is case insensitive. Required. :type resource_group_name: str :param vm_name: The name of the virtual machine. Required. :type vm_name: str - :param parameters: Parameters supplied to the Create Virtual Machine operation. Is one of the - following types: VirtualMachine, JSON, IO[bytes] Required. - :type parameters: ~azure.mgmt.compute.models.VirtualMachine or JSON or IO[bytes] - :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is - None. - :paramtype etag: str - :keyword match_condition: The match condition to use upon the etag. Default value is None. - :paramtype match_condition: ~azure.core.MatchConditions :return: An instance of LROPoller that returns None :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._create_or_update_initial( + raw_result = self._redeploy_initial( resource_group_name=resource_group_name, vm_name=vm_name, - parameters=parameters, - etag=etag, - match_condition=match_condition, - content_type=content_type, cls=lambda x, y, z: x, headers=_headers, params=_params, @@ -18412,14 +17534,11 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - def _update_initial( + def _reimage_initial( self, resource_group_name: str, vm_name: str, - parameters: Union[_models.VirtualMachineUpdate, JSON, IO[bytes]], - *, - etag: Optional[str] = None, - match_condition: Optional[MatchConditions] = None, + parameters: Optional[Union[_models.VirtualMachineReimageParameters, JSON, IO[bytes]]] = None, **kwargs: Any ) -> Iterator[bytes]: error_map: MutableMapping = { @@ -18428,33 +17547,29 @@ def _update_initial( 409: ResourceExistsError, 304: ResourceNotModifiedError, } - if match_condition == MatchConditions.IfNotModified: - error_map[412] = ResourceModifiedError - elif match_condition == MatchConditions.IfPresent: - error_map[412] = ResourceNotFoundError - elif match_condition == MatchConditions.IfMissing: - error_map[412] = ResourceExistsError error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + content_type = content_type if parameters else None cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - content_type = content_type or "application/json" + content_type = content_type or "application/json" if parameters else None _content = None if isinstance(parameters, (IOBase, bytes)): _content = parameters else: - _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + if parameters is not None: + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + else: + _content = None - _request = build_virtual_machines_update_request( + _request = build_virtual_machines_reimage_request( resource_group_name=resource_group_name, vm_name=vm_name, subscription_id=self._config.subscription_id, - etag=etag, - match_condition=match_condition, content_type=content_type, api_version=self._config.api_version, content=_content, @@ -18473,7 +17588,7 @@ def _update_initial( response = pipeline_response.http_response - if response.status_code not in [200]: + if response.status_code not in [200, 202]: try: response.read() # Load the body in memory and close the socket except (StreamConsumedError, StreamClosedError): @@ -18483,8 +17598,9 @@ def _update_initial( raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) deserialized = response.iter_bytes() @@ -18494,133 +17610,128 @@ def _update_initial( return deserialized # type: ignore @overload - def begin_update( + def begin_reimage( self, resource_group_name: str, vm_name: str, - parameters: _models.VirtualMachineUpdate, + parameters: Optional[_models.VirtualMachineReimageParameters] = None, *, content_type: str = "application/json", - etag: Optional[str] = None, - match_condition: Optional[MatchConditions] = None, **kwargs: Any ) -> LROPoller[None]: - """The operation to update a virtual machine. + """Reimages (upgrade the operating system) a virtual machine 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. NOTE: The retaining of old OS disk depends on the value of deleteOption of OS disk. If + deleteOption is detach, the old OS disk will be preserved after reimage. If deleteOption is + delete, the old OS disk will be deleted after reimage. The deleteOption of the OS disk should + be updated accordingly before performing the reimage. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param vm_name: The name of the virtual machine. Required. :type vm_name: str - :param parameters: Parameters supplied to the Update Virtual Machine operation. Required. - :type parameters: ~azure.mgmt.compute.models.VirtualMachineUpdate + :param parameters: Parameters supplied to the Reimage Virtual Machine operation. Default value + is None. + :type parameters: ~azure.mgmt.compute.models.VirtualMachineReimageParameters :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is - None. - :paramtype etag: str - :keyword match_condition: The match condition to use upon the etag. Default value is None. - :paramtype match_condition: ~azure.core.MatchConditions :return: An instance of LROPoller that returns None :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def begin_update( + def begin_reimage( self, resource_group_name: str, vm_name: str, - parameters: JSON, + parameters: Optional[JSON] = None, *, content_type: str = "application/json", - etag: Optional[str] = None, - match_condition: Optional[MatchConditions] = None, **kwargs: Any ) -> LROPoller[None]: - """The operation to update a virtual machine. + """Reimages (upgrade the operating system) a virtual machine 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. NOTE: The retaining of old OS disk depends on the value of deleteOption of OS disk. If + deleteOption is detach, the old OS disk will be preserved after reimage. If deleteOption is + delete, the old OS disk will be deleted after reimage. The deleteOption of the OS disk should + be updated accordingly before performing the reimage. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param vm_name: The name of the virtual machine. Required. :type vm_name: str - :param parameters: Parameters supplied to the Update Virtual Machine operation. Required. + :param parameters: Parameters supplied to the Reimage Virtual Machine operation. Default value + is None. :type parameters: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is - None. - :paramtype etag: str - :keyword match_condition: The match condition to use upon the etag. Default value is None. - :paramtype match_condition: ~azure.core.MatchConditions :return: An instance of LROPoller that returns None :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def begin_update( + def begin_reimage( self, resource_group_name: str, vm_name: str, - parameters: IO[bytes], + parameters: Optional[IO[bytes]] = None, *, content_type: str = "application/json", - etag: Optional[str] = None, - match_condition: Optional[MatchConditions] = None, **kwargs: Any ) -> LROPoller[None]: - """The operation to update a virtual machine. + """Reimages (upgrade the operating system) a virtual machine 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. NOTE: The retaining of old OS disk depends on the value of deleteOption of OS disk. If + deleteOption is detach, the old OS disk will be preserved after reimage. If deleteOption is + delete, the old OS disk will be deleted after reimage. The deleteOption of the OS disk should + be updated accordingly before performing the reimage. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param vm_name: The name of the virtual machine. Required. :type vm_name: str - :param parameters: Parameters supplied to the Update Virtual Machine operation. Required. + :param parameters: Parameters supplied to the Reimage Virtual Machine operation. Default value + is None. :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is - None. - :paramtype etag: str - :keyword match_condition: The match condition to use upon the etag. Default value is None. - :paramtype match_condition: ~azure.core.MatchConditions :return: An instance of LROPoller that returns None :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace - def begin_update( + def begin_reimage( self, resource_group_name: str, vm_name: str, - parameters: Union[_models.VirtualMachineUpdate, JSON, IO[bytes]], - *, - etag: Optional[str] = None, - match_condition: Optional[MatchConditions] = None, + parameters: Optional[Union[_models.VirtualMachineReimageParameters, JSON, IO[bytes]]] = None, **kwargs: Any ) -> LROPoller[None]: - """The operation to update a virtual machine. + """Reimages (upgrade the operating system) a virtual machine 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. NOTE: The retaining of old OS disk depends on the value of deleteOption of OS disk. If + deleteOption is detach, the old OS disk will be preserved after reimage. If deleteOption is + delete, the old OS disk will be deleted after reimage. The deleteOption of the OS disk should + be updated accordingly before performing the reimage. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param vm_name: The name of the virtual machine. Required. :type vm_name: str - :param parameters: Parameters supplied to the Update Virtual Machine operation. Is one of the - following types: VirtualMachineUpdate, JSON, IO[bytes] Required. - :type parameters: ~azure.mgmt.compute.models.VirtualMachineUpdate or JSON or IO[bytes] - :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is - None. - :paramtype etag: str - :keyword match_condition: The match condition to use upon the etag. Default value is None. - :paramtype match_condition: ~azure.core.MatchConditions + :param parameters: Parameters supplied to the Reimage Virtual Machine operation. Is one of the + following types: VirtualMachineReimageParameters, JSON, IO[bytes] Default value is None. + :type parameters: ~azure.mgmt.compute.models.VirtualMachineReimageParameters or JSON or + IO[bytes] :return: An instance of LROPoller that returns None :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -18629,17 +17740,16 @@ def begin_update( _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + content_type = content_type if parameters else None cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._update_initial( + raw_result = self._reimage_initial( resource_group_name=resource_group_name, vm_name=vm_name, parameters=parameters, - etag=etag, - match_condition=match_condition, content_type=content_type, cls=lambda x, y, z: x, headers=_headers, @@ -18674,9 +17784,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - def _delete_initial( - self, resource_group_name: str, vm_name: str, *, force_deletion: Optional[bool] = None, **kwargs: Any - ) -> Iterator[bytes]: + def _restart_initial(self, resource_group_name: str, vm_name: str, **kwargs: Any) -> Iterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -18690,11 +17798,10 @@ def _delete_initial( cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - _request = build_virtual_machines_delete_request( + _request = build_virtual_machines_restart_request( resource_group_name=resource_group_name, vm_name=vm_name, subscription_id=self._config.subscription_id, - force_deletion=force_deletion, api_version=self._config.api_version, headers=_headers, params=_params, @@ -18711,7 +17818,7 @@ def _delete_initial( response = pipeline_response.http_response - if response.status_code not in [200, 202, 204]: + if response.status_code not in [200, 202]: try: response.read() # Load the body in memory and close the socket except (StreamConsumedError, StreamClosedError): @@ -18733,19 +17840,14 @@ def _delete_initial( return deserialized # type: ignore @distributed_trace - def begin_delete( - self, resource_group_name: str, vm_name: str, *, force_deletion: Optional[bool] = None, **kwargs: Any - ) -> LROPoller[None]: - """The operation to delete a virtual machine. + def begin_restart(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. The name is case insensitive. Required. :type resource_group_name: str :param vm_name: The name of the virtual machine. Required. :type vm_name: str - :keyword force_deletion: Optional parameter to force delete virtual machines. Default value is - None. - :paramtype force_deletion: bool :return: An instance of LROPoller that returns None :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -18758,10 +17860,9 @@ def begin_delete( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._delete_initial( + raw_result = self._restart_initial( resource_group_name=resource_group_name, vm_name=vm_name, - force_deletion=force_deletion, cls=lambda x, y, z: x, headers=_headers, params=_params, @@ -18796,38 +17897,30 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore @distributed_trace - def list( + def retrieve_boot_diagnostics_data( self, resource_group_name: str, + vm_name: str, *, - filter: Optional[str] = None, - expand: Optional[Union[str, _models.ExpandTypeForListVMs]] = None, + sas_uri_expiration_time_in_minutes: Optional[int] = None, **kwargs: Any - ) -> ItemPaged["_models.VirtualMachine"]: - """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. + ) -> _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. The name is case insensitive. Required. :type resource_group_name: str - :keyword 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. - :paramtype filter: str - :keyword expand: The expand expression to apply on operation. 'instanceView' enables fetching - run time status of all Virtual Machines, this can only be specified if a valid $filter option - is specified. "instanceView" Default value is None. - :paramtype expand: str or ~azure.mgmt.compute.models.ExpandTypeForListVMs - :return: An iterator like instance of VirtualMachine - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.models.VirtualMachine] + :param vm_name: The name of the virtual machine. Required. + :type vm_name: str + :keyword sas_uri_expiration_time_in_minutes: Expiration duration in minutes for the SAS URIs + with a value between 1 to 1440 minutes. **Note:** If not specified, SAS URIs will be generated + with a default expiration duration of 120 minutes. Default value is None. + :paramtype sas_uri_expiration_time_in_minutes: int + :return: RetrieveBootDiagnosticsDataResult. The RetrieveBootDiagnosticsDataResult is compatible + with MutableMapping + :rtype: ~azure.mgmt.compute.models.RetrieveBootDiagnosticsDataResult :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[List[_models.VirtualMachine]] = kwargs.pop("cls", None) - error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -18836,105 +17929,67 @@ def list( } error_map.update(kwargs.pop("error_map", {}) or {}) - def prepare_request(next_link=None): - if not next_link: + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} - _request = build_virtual_machines_list_request( - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - filter=filter, - expand=expand, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) + cls: ClsType[_models.RetrieveBootDiagnosticsDataResult] = kwargs.pop("cls", None) - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - return _request + _request = build_virtual_machines_retrieve_boot_diagnostics_data_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + sas_uri_expiration_time_in_minutes=sas_uri_expiration_time_in_minutes, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) - def extract_data(pipeline_response): - deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.VirtualMachine], deserialized.get("value", [])) - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.get("nextLink") or None, iter(list_of_elem) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) - def get_next(next_link=None): - _request = prepare_request(next_link) + response = pipeline_response.http_response - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.CloudError, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.RetrieveBootDiagnosticsDataResult, response.json()) - return pipeline_response + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore - return ItemPaged(get_next, extract_data) + return deserialized # type: ignore @distributed_trace - def list_all( - self, - *, - status_only: Optional[str] = None, - filter: Optional[str] = None, - expand: Optional[Union[str, _models.ExpandTypesForListVMs]] = None, - **kwargs: Any - ) -> ItemPaged["_models.VirtualMachine"]: - """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. + 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. - :keyword status_only: statusOnly=true enables fetching run time status of all Virtual Machines - in the subscription. Default value is None. - :paramtype status_only: str - :keyword 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. - :paramtype filter: str - :keyword expand: The expand expression to apply on operation. 'instanceView' enables fetching - run time status of all Virtual Machines, this can only be specified if a valid $filter option - is specified. "instanceView" Default value is None. - :paramtype expand: str or ~azure.mgmt.compute.models.ExpandTypesForListVMs - :return: An iterator like instance of VirtualMachine - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.models.VirtualMachine] + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_name: The name of the virtual machine. Required. + :type vm_name: str + :return: None + :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[List[_models.VirtualMachine]] = kwargs.pop("cls", None) - error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -18943,73 +17998,40 @@ def list_all( } error_map.update(kwargs.pop("error_map", {}) or {}) - def prepare_request(next_link=None): - if not next_link: - - _request = build_virtual_machines_list_all_request( - subscription_id=self._config.subscription_id, - status_only=status_only, - filter=filter, - expand=expand, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - return _request + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} - def extract_data(pipeline_response): - deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.VirtualMachine], deserialized.get("value", [])) - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.get("nextLink") or None, iter(list_of_elem) + cls: ClsType[None] = kwargs.pop("cls", None) - def get_next(next_link=None): - _request = prepare_request(next_link) + _request = build_virtual_machines_simulate_eviction_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.CloudError, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response = pipeline_response.http_response - return pipeline_response + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - return ItemPaged(get_next, extract_data) + if cls: + return cls(pipeline_response, None, {}) # type: ignore - def _assess_patches_initial(self, resource_group_name: str, vm_name: str, **kwargs: Any) -> Iterator[bytes]: + def _start_initial(self, resource_group_name: str, vm_name: str, **kwargs: Any) -> Iterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -19023,7 +18045,7 @@ def _assess_patches_initial(self, resource_group_name: str, vm_name: str, **kwar cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - _request = build_virtual_machines_assess_patches_request( + _request = build_virtual_machines_start_request( resource_group_name=resource_group_name, vm_name=vm_name, subscription_id=self._config.subscription_id, @@ -19065,31 +18087,27 @@ def _assess_patches_initial(self, resource_group_name: str, vm_name: str, **kwar return deserialized # 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. + def begin_start(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. The name is case insensitive. Required. :type resource_group_name: str :param vm_name: The name of the virtual machine. Required. :type vm_name: str - :return: An instance of LROPoller that returns VirtualMachineAssessPatchesResult. The - VirtualMachineAssessPatchesResult is compatible with MutableMapping - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.VirtualMachineAssessPatchesResult] + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.VirtualMachineAssessPatchesResult] = kwargs.pop("cls", None) + cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._assess_patches_initial( + raw_result = self._start_initial( resource_group_name=resource_group_name, vm_name=vm_name, cls=lambda x, y, z: x, @@ -19100,16 +18118,9 @@ def begin_assess_patches( raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): - response_headers = {} - response = pipeline_response.http_response - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = _deserialize(_models.VirtualMachineAssessPatchesResult, response.json()) + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized + return cls(pipeline_response, None, {}) # type: ignore path_format_arguments = { "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), @@ -19124,21 +18135,113 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller[_models.VirtualMachineAssessPatchesResult].from_continuation_token( + return LROPoller[None].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller[_models.VirtualMachineAssessPatchesResult]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - def _attach_detach_data_disks_initial( + @distributed_trace + def list_available_sizes( + self, resource_group_name: str, vm_name: str, **kwargs: Any + ) -> ItemPaged["_models.VirtualMachineSize"]: + """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. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_name: The name of the virtual machine. Required. + :type vm_name: str + :return: An iterator like instance of VirtualMachineSize + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.models.VirtualMachineSize] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.VirtualMachineSize]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_virtual_machines_list_available_sizes_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.VirtualMachineSize], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + def _run_command_initial( self, resource_group_name: str, vm_name: str, - parameters: Union[_models.AttachDetachDataDisksRequest, JSON, IO[bytes]], + parameters: Union[_models.RunCommandInput, JSON, IO[bytes]], **kwargs: Any ) -> Iterator[bytes]: error_map: MutableMapping = { @@ -19162,7 +18265,7 @@ def _attach_detach_data_disks_initial( else: _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - _request = build_virtual_machines_attach_detach_data_disks_request( + _request = build_virtual_machines_run_command_request( resource_group_name=resource_group_name, vm_name=vm_name, subscription_id=self._config.subscription_id, @@ -19206,36 +18309,35 @@ def _attach_detach_data_disks_initial( return deserialized # type: ignore @overload - def begin_attach_detach_data_disks( + def begin_run_command( self, resource_group_name: str, vm_name: str, - parameters: _models.AttachDetachDataDisksRequest, + parameters: _models.RunCommandInput, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.StorageProfile]: - """Attach and detach data disks to/from the virtual machine. + ) -> LROPoller[_models.RunCommandResult]: + """Run command on the VM. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param vm_name: The name of the virtual machine. Required. :type vm_name: str - :param parameters: Parameters supplied to the attach and detach data disks operation on the - virtual machine. Required. - :type parameters: ~azure.mgmt.compute.models.AttachDetachDataDisksRequest + :param parameters: Parameters supplied to the Run command operation. Required. + :type parameters: ~azure.mgmt.compute.models.RunCommandInput :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns StorageProfile. The StorageProfile is compatible - with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.StorageProfile] + :return: An instance of LROPoller that returns RunCommandResult. The RunCommandResult is + compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.RunCommandResult] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def begin_attach_detach_data_disks( + def begin_run_command( self, resource_group_name: str, vm_name: str, @@ -19243,28 +18345,27 @@ def begin_attach_detach_data_disks( *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.StorageProfile]: - """Attach and detach data disks to/from the virtual machine. + ) -> LROPoller[_models.RunCommandResult]: + """Run command on the VM. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param vm_name: The name of the virtual machine. Required. :type vm_name: str - :param parameters: Parameters supplied to the attach and detach data disks operation on the - virtual machine. Required. + :param parameters: Parameters supplied to the Run command operation. Required. :type parameters: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns StorageProfile. The StorageProfile is compatible - with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.StorageProfile] + :return: An instance of LROPoller that returns RunCommandResult. The RunCommandResult is + compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.RunCommandResult] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def begin_attach_detach_data_disks( + def begin_run_command( self, resource_group_name: str, vm_name: str, @@ -19272,60 +18373,58 @@ def begin_attach_detach_data_disks( *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.StorageProfile]: - """Attach and detach data disks to/from the virtual machine. + ) -> LROPoller[_models.RunCommandResult]: + """Run command on the VM. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param vm_name: The name of the virtual machine. Required. :type vm_name: str - :param parameters: Parameters supplied to the attach and detach data disks operation on the - virtual machine. Required. + :param parameters: Parameters supplied to the Run command operation. Required. :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns StorageProfile. The StorageProfile is compatible - with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.StorageProfile] + :return: An instance of LROPoller that returns RunCommandResult. The RunCommandResult is + compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.RunCommandResult] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace - def begin_attach_detach_data_disks( + def begin_run_command( self, resource_group_name: str, vm_name: str, - parameters: Union[_models.AttachDetachDataDisksRequest, JSON, IO[bytes]], + parameters: Union[_models.RunCommandInput, JSON, IO[bytes]], **kwargs: Any - ) -> LROPoller[_models.StorageProfile]: - """Attach and detach data disks to/from the virtual machine. + ) -> LROPoller[_models.RunCommandResult]: + """Run command on the VM. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param vm_name: The name of the virtual machine. Required. :type vm_name: str - :param parameters: Parameters supplied to the attach and detach data disks operation on the - virtual machine. Is one of the following types: AttachDetachDataDisksRequest, JSON, IO[bytes] - Required. - :type parameters: ~azure.mgmt.compute.models.AttachDetachDataDisksRequest or JSON or IO[bytes] - :return: An instance of LROPoller that returns StorageProfile. The StorageProfile is compatible - with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.StorageProfile] + :param parameters: Parameters supplied to the Run command operation. Is one of the following + types: RunCommandInput, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.compute.models.RunCommandInput or JSON or IO[bytes] + :return: An instance of LROPoller that returns RunCommandResult. The RunCommandResult is + compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.RunCommandResult] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.StorageProfile] = kwargs.pop("cls", None) + cls: ClsType[_models.RunCommandResult] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._attach_detach_data_disks_initial( + raw_result = self._run_command_initial( resource_group_name=resource_group_name, vm_name=vm_name, parameters=parameters, @@ -19344,7 +18443,7 @@ def get_long_running_output(pipeline_response): response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - deserialized = _deserialize(_models.StorageProfile, response.json()) + deserialized = _deserialize(_models.RunCommandResult, response.json()) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized @@ -19362,21 +18461,21 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller[_models.StorageProfile].from_continuation_token( + return LROPoller[_models.RunCommandResult].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller[_models.StorageProfile]( + return LROPoller[_models.RunCommandResult]( self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - def _capture_initial( + def _migrate_to_vm_scale_set_initial( self, resource_group_name: str, vm_name: str, - parameters: Union[_models.VirtualMachineCaptureParameters, JSON, IO[bytes]], + parameters: Optional[Union[_models.MigrateVMToVirtualMachineScaleSetInput, JSON, IO[bytes]]] = None, **kwargs: Any ) -> Iterator[bytes]: error_map: MutableMapping = { @@ -19391,16 +18490,20 @@ def _capture_initial( _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + content_type = content_type if parameters else None cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - content_type = content_type or "application/json" + content_type = content_type or "application/json" if parameters else None _content = None if isinstance(parameters, (IOBase, bytes)): _content = parameters else: - _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + if parameters is not None: + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + else: + _content = None - _request = build_virtual_machines_capture_request( + _request = build_virtual_machines_migrate_to_vm_scale_set_request( resource_group_name=resource_group_name, vm_name=vm_name, subscription_id=self._config.subscription_id, @@ -19422,7 +18525,7 @@ def _capture_initial( response = pipeline_response.http_response - if response.status_code not in [200, 202]: + if response.status_code not in [202]: try: response.read() # Load the body in memory and close the socket except (StreamConsumedError, StreamClosedError): @@ -19432,9 +18535,8 @@ def _capture_initial( raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) deserialized = response.iter_bytes() @@ -19444,127 +18546,123 @@ def _capture_initial( return deserialized # type: ignore @overload - def begin_capture( + def begin_migrate_to_vm_scale_set( self, resource_group_name: str, vm_name: str, - parameters: _models.VirtualMachineCaptureParameters, + parameters: Optional[_models.MigrateVMToVirtualMachineScaleSetInput] = None, *, content_type: str = "application/json", **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. + ) -> LROPoller[None]: + """Migrate a virtual machine from availability set to Flexible Virtual Machine Scale Set. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param vm_name: The name of the virtual machine. Required. :type vm_name: str - :param parameters: Parameters supplied to the Capture Virtual Machine operation. Required. - :type parameters: ~azure.mgmt.compute.models.VirtualMachineCaptureParameters + :param parameters: Parameters supplied to the Migrate Virtual Machine operation. Default value + is None. + :type parameters: ~azure.mgmt.compute.models.MigrateVMToVirtualMachineScaleSetInput :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns VirtualMachineCaptureResult. The - VirtualMachineCaptureResult is compatible with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.VirtualMachineCaptureResult] + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def begin_capture( + def begin_migrate_to_vm_scale_set( self, resource_group_name: str, vm_name: str, - parameters: JSON, + parameters: Optional[JSON] = None, *, content_type: str = "application/json", **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. + ) -> LROPoller[None]: + """Migrate a virtual machine from availability set to Flexible Virtual Machine Scale Set. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param vm_name: The name of the virtual machine. Required. :type vm_name: str - :param parameters: Parameters supplied to the Capture Virtual Machine operation. Required. + :param parameters: Parameters supplied to the Migrate Virtual Machine operation. Default value + is None. :type parameters: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns VirtualMachineCaptureResult. The - VirtualMachineCaptureResult is compatible with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.VirtualMachineCaptureResult] + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def begin_capture( + def begin_migrate_to_vm_scale_set( self, resource_group_name: str, vm_name: str, - parameters: IO[bytes], + parameters: Optional[IO[bytes]] = None, *, content_type: str = "application/json", **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. + ) -> LROPoller[None]: + """Migrate a virtual machine from availability set to Flexible Virtual Machine Scale Set. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param vm_name: The name of the virtual machine. Required. :type vm_name: str - :param parameters: Parameters supplied to the Capture Virtual Machine operation. Required. + :param parameters: Parameters supplied to the Migrate Virtual Machine operation. Default value + is None. :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns VirtualMachineCaptureResult. The - VirtualMachineCaptureResult is compatible with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.VirtualMachineCaptureResult] + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace - def begin_capture( + def begin_migrate_to_vm_scale_set( self, resource_group_name: str, vm_name: str, - parameters: Union[_models.VirtualMachineCaptureParameters, JSON, IO[bytes]], + parameters: Optional[Union[_models.MigrateVMToVirtualMachineScaleSetInput, JSON, IO[bytes]]] = None, **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. + ) -> LROPoller[None]: + """Migrate a virtual machine from availability set to Flexible Virtual Machine Scale Set. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param vm_name: The name of the virtual machine. Required. :type vm_name: str - :param parameters: Parameters supplied to the Capture Virtual Machine operation. Is one of the - following types: VirtualMachineCaptureParameters, JSON, IO[bytes] Required. - :type parameters: ~azure.mgmt.compute.models.VirtualMachineCaptureParameters or JSON or + :param parameters: Parameters supplied to the Migrate Virtual Machine operation. Is one of the + following types: MigrateVMToVirtualMachineScaleSetInput, JSON, IO[bytes] Default value is None. + :type parameters: ~azure.mgmt.compute.models.MigrateVMToVirtualMachineScaleSetInput or JSON or IO[bytes] - :return: An instance of LROPoller that returns VirtualMachineCaptureResult. The - VirtualMachineCaptureResult is compatible with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.VirtualMachineCaptureResult] + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.VirtualMachineCaptureResult] = kwargs.pop("cls", None) + content_type = content_type if parameters else None + cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._capture_initial( + raw_result = self._migrate_to_vm_scale_set_initial( resource_group_name=resource_group_name, vm_name=vm_name, parameters=parameters, @@ -19577,16 +18675,9 @@ def begin_capture( raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): - response_headers = {} - response = pipeline_response.http_response - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = _deserialize(_models.VirtualMachineCaptureResult, response.json()) + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized + return cls(pipeline_response, None, {}) # type: ignore path_format_arguments = { "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), @@ -19601,146 +18692,29 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller[_models.VirtualMachineCaptureResult].from_continuation_token( + return LROPoller[None].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller[_models.VirtualMachineCaptureResult]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _convert_to_managed_disks_initial( - self, resource_group_name: str, vm_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_virtual_machines_convert_to_managed_disks_request( - resource_group_name=resource_group_name, - vm_name=vm_name, - subscription_id=self._config.subscription_id, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.CloudError, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.iter_bytes() - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore @distributed_trace - def begin_convert_to_managed_disks( - self, resource_group_name: str, vm_name: str, **kwargs: Any - ) -> LROPoller[_models.OkResponse]: - """Converts virtual machine disks from blob-based to managed disks. Virtual machine must be - stop-deallocated before invoking this operation. + def list_by_location(self, location: str, **kwargs: Any) -> ItemPaged["_models.VirtualMachine"]: + """Gets all the virtual machines under the specified subscription for the specified location. - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_name: The name of the virtual machine. Required. - :type vm_name: str - :return: An instance of LROPoller that returns OkResponse. The OkResponse is compatible with - MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.OkResponse] + :param location: The location name. Required. + :type location: str + :return: An iterator like instance of VirtualMachine + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.models.VirtualMachine] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.OkResponse] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._convert_to_managed_disks_initial( - resource_group_name=resource_group_name, - vm_name=vm_name, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - response_headers = {} - response = pipeline_response.http_response - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = _deserialize(_models.OkResponse, response.json()) - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized - - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.OkResponse].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.OkResponse]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) + cls: ClsType[List[_models.VirtualMachine]] = kwargs.pop("cls", None) - def _deallocate_initial( - self, resource_group_name: str, vm_name: str, *, hibernate: Optional[bool] = None, **kwargs: Any - ) -> Iterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -19749,144 +18723,111 @@ def _deallocate_initial( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_virtual_machines_deallocate_request( - resource_group_name=resource_group_name, - vm_name=vm_name, - subscription_id=self._config.subscription_id, - hibernate=hibernate, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) + def prepare_request(next_link=None): + if not next_link: - response = pipeline_response.http_response + _request = build_virtual_machines_list_by_location_request( + location=location, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) - if response.status_code not in [200, 202]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.CloudError, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + return _request - deserialized = response.iter_bytes() + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.VirtualMachine], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore + def get_next(next_link=None): + _request = prepare_request(next_link) - return deserialized # type: ignore + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response - @distributed_trace - def begin_deallocate( - self, resource_group_name: str, vm_name: str, *, hibernate: Optional[bool] = None, **kwargs: Any - ) -> LROPoller[_models.OkResponse]: - """Shuts down the virtual machine and releases the compute resources. You are not billed for the - compute resources that this virtual machine uses. + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_name: The name of the virtual machine. Required. - :type vm_name: str - :keyword hibernate: Optional parameter to hibernate a virtual machine. Default value is None. - :paramtype hibernate: bool - :return: An instance of LROPoller that returns OkResponse. The OkResponse is compatible with - MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.OkResponse] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} + return pipeline_response - cls: ClsType[_models.OkResponse] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._deallocate_initial( - resource_group_name=resource_group_name, - vm_name=vm_name, - hibernate=hibernate, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) + return ItemPaged(get_next, extract_data) - def get_long_running_output(pipeline_response): - response_headers = {} - response = pipeline_response.http_response - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - deserialized = _deserialize(_models.OkResponse, response.json()) - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized +class VirtualMachineExtensionsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } + Instead, you should access the following operations through + :class:`~azure.mgmt.compute.ComputeClient`'s + :attr:`virtual_machine_extensions` attribute. + """ - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.OkResponse].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.OkResponse]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @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. For Windows, please refer to `Create a - managed image of a generalized VM in Azure - `_. For - Linux, please refer to `How to create an image of a virtual machine or VHD - `_. + 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. The name is case insensitive. Required. :type resource_group_name: str :param vm_name: The name of the virtual machine. Required. :type vm_name: str - :return: None - :rtype: None + :param vm_extension_name: The name of the virtual machine extension. Required. + :type vm_extension_name: str + :keyword expand: The expand expression to apply on the operation. Default value is None. + :paramtype expand: str + :return: VirtualMachineExtension. The VirtualMachineExtension is compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.VirtualMachineExtension :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -19900,12 +18841,14 @@ def generalize( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[_models.VirtualMachineExtension] = kwargs.pop("cls", None) - _request = build_virtual_machines_generalize_request( + _request = build_virtual_machine_extensions_get_request( resource_group_name=resource_group_name, vm_name=vm_name, + vm_extension_name=vm_extension_name, subscription_id=self._config.subscription_id, + expand=expand, api_version=self._config.api_version, headers=_headers, params=_params, @@ -19915,7 +18858,7 @@ def generalize( # pylint: disable=inconsistent-return-statements } _request.url = self._client.format_url(_request.url, **path_format_arguments) - _stream = False + _stream = kwargs.pop("stream", False) pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -19923,18 +18866,31 @@ def generalize( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = _failsafe_deserialize(_models.CloudError, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.VirtualMachineExtension, response.json()) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore - def _install_patches_initial( + return deserialized # type: ignore + + def _create_or_update_initial( self, resource_group_name: str, vm_name: str, - install_patches_input: Union[_models.VirtualMachineInstallPatchesParameters, JSON, IO[bytes]], + vm_extension_name: str, + extension_parameters: Union[_models.VirtualMachineExtension, JSON, IO[bytes]], **kwargs: Any ) -> Iterator[bytes]: error_map: MutableMapping = { @@ -19953,14 +18909,15 @@ def _install_patches_initial( content_type = content_type or "application/json" _content = None - if isinstance(install_patches_input, (IOBase, bytes)): - _content = install_patches_input + if isinstance(extension_parameters, (IOBase, bytes)): + _content = extension_parameters else: - _content = json.dumps(install_patches_input, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(extension_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - _request = build_virtual_machines_install_patches_request( + _request = build_virtual_machine_extensions_create_or_update_request( resource_group_name=resource_group_name, vm_name=vm_name, + vm_extension_name=vm_extension_name, subscription_id=self._config.subscription_id, content_type=content_type, api_version=self._config.api_version, @@ -19980,7 +18937,7 @@ def _install_patches_initial( response = pipeline_response.http_response - if response.status_code not in [200, 202]: + if response.status_code not in [200, 201]: try: response.read() # Load the body in memory and close the socket except (StreamConsumedError, StreamClosedError): @@ -19990,7 +18947,7 @@ def _install_patches_initial( raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} - if response.status_code == 202: + if response.status_code == 201: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) @@ -20002,133 +18959,142 @@ def _install_patches_initial( return deserialized # type: ignore @overload - def begin_install_patches( + def begin_create_or_update( self, resource_group_name: str, vm_name: str, - install_patches_input: _models.VirtualMachineInstallPatchesParameters, + vm_extension_name: str, + extension_parameters: _models.VirtualMachineExtension, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.VirtualMachineInstallPatchesResult]: - """Installs patches on the VM. + ) -> LROPoller[_models.VirtualMachineExtension]: + """The operation to create or update the extension. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param vm_name: The name of the virtual machine. Required. :type vm_name: str - :param install_patches_input: Input for InstallPatches as directly received by the API. - Required. - :type install_patches_input: ~azure.mgmt.compute.models.VirtualMachineInstallPatchesParameters + :param vm_extension_name: The name of the virtual machine extension. Required. + :type vm_extension_name: str + :param extension_parameters: Parameters supplied to the Create Virtual Machine Extension + operation. Required. + :type extension_parameters: ~azure.mgmt.compute.models.VirtualMachineExtension :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns VirtualMachineInstallPatchesResult. The - VirtualMachineInstallPatchesResult is compatible with MutableMapping - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.VirtualMachineInstallPatchesResult] + :return: An instance of LROPoller that returns VirtualMachineExtension. The + VirtualMachineExtension is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.VirtualMachineExtension] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def begin_install_patches( + def begin_create_or_update( self, resource_group_name: str, vm_name: str, - install_patches_input: JSON, + vm_extension_name: str, + extension_parameters: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.VirtualMachineInstallPatchesResult]: - """Installs patches on the VM. + ) -> LROPoller[_models.VirtualMachineExtension]: + """The operation to create or update the extension. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param vm_name: The name of the virtual machine. Required. :type vm_name: str - :param install_patches_input: Input for InstallPatches as directly received by the API. - Required. - :type install_patches_input: JSON + :param vm_extension_name: The name of the virtual machine extension. Required. + :type vm_extension_name: str + :param extension_parameters: Parameters supplied to the Create Virtual Machine Extension + operation. Required. + :type extension_parameters: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns VirtualMachineInstallPatchesResult. The - VirtualMachineInstallPatchesResult is compatible with MutableMapping - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.VirtualMachineInstallPatchesResult] + :return: An instance of LROPoller that returns VirtualMachineExtension. The + VirtualMachineExtension is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.VirtualMachineExtension] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def begin_install_patches( + def begin_create_or_update( self, resource_group_name: str, vm_name: str, - install_patches_input: IO[bytes], + vm_extension_name: str, + extension_parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.VirtualMachineInstallPatchesResult]: - """Installs patches on the VM. + ) -> LROPoller[_models.VirtualMachineExtension]: + """The operation to create or update the extension. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param vm_name: The name of the virtual machine. Required. :type vm_name: str - :param install_patches_input: Input for InstallPatches as directly received by the API. - Required. - :type install_patches_input: IO[bytes] + :param vm_extension_name: The name of the virtual machine extension. Required. + :type vm_extension_name: str + :param extension_parameters: Parameters supplied to the Create Virtual Machine Extension + operation. Required. + :type extension_parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns VirtualMachineInstallPatchesResult. The - VirtualMachineInstallPatchesResult is compatible with MutableMapping - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.VirtualMachineInstallPatchesResult] + :return: An instance of LROPoller that returns VirtualMachineExtension. The + VirtualMachineExtension is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.VirtualMachineExtension] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace - def begin_install_patches( + def begin_create_or_update( self, resource_group_name: str, vm_name: str, - install_patches_input: Union[_models.VirtualMachineInstallPatchesParameters, JSON, IO[bytes]], + vm_extension_name: str, + extension_parameters: Union[_models.VirtualMachineExtension, JSON, IO[bytes]], **kwargs: Any - ) -> LROPoller[_models.VirtualMachineInstallPatchesResult]: - """Installs patches on the VM. + ) -> LROPoller[_models.VirtualMachineExtension]: + """The operation to create or update the extension. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param vm_name: The name of the virtual machine. Required. :type vm_name: str - :param install_patches_input: Input for InstallPatches as directly received by the API. Is one - of the following types: VirtualMachineInstallPatchesParameters, JSON, IO[bytes] Required. - :type install_patches_input: ~azure.mgmt.compute.models.VirtualMachineInstallPatchesParameters - or JSON or IO[bytes] - :return: An instance of LROPoller that returns VirtualMachineInstallPatchesResult. The - VirtualMachineInstallPatchesResult is compatible with MutableMapping - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.VirtualMachineInstallPatchesResult] + :param vm_extension_name: The name of the virtual machine extension. Required. + :type vm_extension_name: str + :param extension_parameters: Parameters supplied to the Create Virtual Machine Extension + operation. Is one of the following types: VirtualMachineExtension, JSON, IO[bytes] Required. + :type extension_parameters: ~azure.mgmt.compute.models.VirtualMachineExtension or JSON or + IO[bytes] + :return: An instance of LROPoller that returns VirtualMachineExtension. The + VirtualMachineExtension is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.VirtualMachineExtension] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.VirtualMachineInstallPatchesResult] = kwargs.pop("cls", None) + cls: ClsType[_models.VirtualMachineExtension] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._install_patches_initial( + raw_result = self._create_or_update_initial( resource_group_name=resource_group_name, vm_name=vm_name, - install_patches_input=install_patches_input, + vm_extension_name=vm_extension_name, + extension_parameters=extension_parameters, content_type=content_type, cls=lambda x, y, z: x, headers=_headers, @@ -20139,14 +19105,10 @@ def begin_install_patches( kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - response_headers = {} response = pipeline_response.http_response - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = _deserialize(_models.VirtualMachineInstallPatchesResult, response.json()) + deserialized = _deserialize(_models.VirtualMachineExtension, response.json()) if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized path_format_arguments = { @@ -20162,32 +19124,24 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller[_models.VirtualMachineInstallPatchesResult].from_continuation_token( + return LROPoller[_models.VirtualMachineExtension].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller[_models.VirtualMachineInstallPatchesResult]( + return LROPoller[_models.VirtualMachineExtension]( self._client, raw_result, get_long_running_output, polling_method # 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. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_name: The name of the virtual machine. Required. - :type vm_name: str - :return: VirtualMachineInstanceView. The VirtualMachineInstanceView is compatible with - MutableMapping - :rtype: ~azure.mgmt.compute.models.VirtualMachineInstanceView - :raises ~azure.core.exceptions.HttpResponseError: - """ + def _update_initial( + self, + resource_group_name: str, + vm_name: str, + vm_extension_name: str, + extension_parameters: Union[_models.VirtualMachineExtensionUpdate, JSON, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -20196,16 +19150,27 @@ def instance_view( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.VirtualMachineInstanceView] = kwargs.pop("cls", None) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - _request = build_virtual_machines_instance_view_request( + content_type = content_type or "application/json" + _content = None + if isinstance(extension_parameters, (IOBase, bytes)): + _content = extension_parameters + else: + _content = json.dumps(extension_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_virtual_machine_extensions_update_request( resource_group_name=resource_group_name, vm_name=vm_name, + vm_extension_name=vm_extension_name, subscription_id=self._config.subscription_id, + content_type=content_type, api_version=self._config.api_version, + content=_content, headers=_headers, params=_params, ) @@ -20214,7 +19179,7 @@ def instance_view( } _request.url = self._client.format_url(_request.url, **path_format_arguments) - _stream = kwargs.pop("stream", False) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -20222,107 +19187,164 @@ def instance_view( response = pipeline_response.http_response if response.status_code not in [200]: - if _stream: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = _failsafe_deserialize(_models.CloudError, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if _stream: - deserialized = response.iter_bytes() - else: - deserialized = _deserialize(_models.VirtualMachineInstanceView, response.json()) + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore - def _perform_maintenance_initial(self, resource_group_name: str, vm_name: str, **kwargs: Any) -> Iterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_virtual_machines_perform_maintenance_request( - resource_group_name=resource_group_name, - vm_name=vm_name, - subscription_id=self._config.subscription_id, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response + @overload + def begin_update( + self, + resource_group_name: str, + vm_name: str, + vm_extension_name: str, + extension_parameters: _models.VirtualMachineExtensionUpdate, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.VirtualMachineExtension]: + """The operation to update the extension. - if response.status_code not in [200, 202]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.CloudError, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_name: The name of the virtual machine. Required. + :type vm_name: str + :param vm_extension_name: The name of the virtual machine extension. Required. + :type vm_extension_name: str + :param extension_parameters: Parameters supplied to the Update Virtual Machine Extension + operation. Required. + :type extension_parameters: ~azure.mgmt.compute.models.VirtualMachineExtensionUpdate + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns VirtualMachineExtension. The + VirtualMachineExtension is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.VirtualMachineExtension] + :raises ~azure.core.exceptions.HttpResponseError: + """ - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + @overload + def begin_update( + self, + resource_group_name: str, + vm_name: str, + vm_extension_name: str, + extension_parameters: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.VirtualMachineExtension]: + """The operation to update the extension. - deserialized = response.iter_bytes() + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_name: The name of the virtual machine. Required. + :type vm_name: str + :param vm_extension_name: The name of the virtual machine extension. Required. + :type vm_extension_name: str + :param extension_parameters: Parameters supplied to the Update Virtual Machine Extension + operation. Required. + :type extension_parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns VirtualMachineExtension. The + VirtualMachineExtension is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.VirtualMachineExtension] + :raises ~azure.core.exceptions.HttpResponseError: + """ - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore + @overload + def begin_update( + self, + resource_group_name: str, + vm_name: str, + vm_extension_name: str, + extension_parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.VirtualMachineExtension]: + """The operation to update the extension. - return deserialized # type: ignore + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_name: The name of the virtual machine. Required. + :type vm_name: str + :param vm_extension_name: The name of the virtual machine extension. Required. + :type vm_extension_name: str + :param extension_parameters: Parameters supplied to the Update Virtual Machine Extension + operation. Required. + :type extension_parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns VirtualMachineExtension. The + VirtualMachineExtension is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.VirtualMachineExtension] + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace - def begin_perform_maintenance( - self, resource_group_name: str, vm_name: str, **kwargs: Any - ) -> LROPoller[_models.OkResponse]: - """The operation to perform maintenance on a virtual machine. + def begin_update( + self, + resource_group_name: str, + vm_name: str, + vm_extension_name: str, + extension_parameters: Union[_models.VirtualMachineExtensionUpdate, JSON, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.VirtualMachineExtension]: + """The operation to update the extension. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param vm_name: The name of the virtual machine. Required. :type vm_name: str - :return: An instance of LROPoller that returns OkResponse. The OkResponse is compatible with - MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.OkResponse] + :param vm_extension_name: The name of the virtual machine extension. Required. + :type vm_extension_name: str + :param extension_parameters: Parameters supplied to the Update Virtual Machine Extension + operation. Is one of the following types: VirtualMachineExtensionUpdate, JSON, IO[bytes] + Required. + :type extension_parameters: ~azure.mgmt.compute.models.VirtualMachineExtensionUpdate or JSON or + IO[bytes] + :return: An instance of LROPoller that returns VirtualMachineExtension. The + VirtualMachineExtension is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.VirtualMachineExtension] :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = kwargs.pop("headers", {}) or {} + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.OkResponse] = kwargs.pop("cls", None) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.VirtualMachineExtension] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._perform_maintenance_initial( + 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, + content_type=content_type, cls=lambda x, y, z: x, headers=_headers, params=_params, @@ -20337,7 +19359,7 @@ def get_long_running_output(pipeline_response): response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - deserialized = _deserialize(_models.OkResponse, response.json()) + deserialized = _deserialize(_models.VirtualMachineExtension, response.json()) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized @@ -20355,18 +19377,18 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller[_models.OkResponse].from_continuation_token( + return LROPoller[_models.VirtualMachineExtension].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller[_models.OkResponse]( + return LROPoller[_models.VirtualMachineExtension]( self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - def _power_off_initial( - self, resource_group_name: str, vm_name: str, *, skip_shutdown: Optional[bool] = None, **kwargs: Any + def _delete_initial( + self, resource_group_name: str, vm_name: str, vm_extension_name: str, **kwargs: Any ) -> Iterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -20381,11 +19403,11 @@ def _power_off_initial( cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - _request = build_virtual_machines_power_off_request( + _request = build_virtual_machine_extensions_delete_request( resource_group_name=resource_group_name, vm_name=vm_name, + vm_extension_name=vm_extension_name, subscription_id=self._config.subscription_id, - skip_shutdown=skip_shutdown, api_version=self._config.api_version, headers=_headers, params=_params, @@ -20402,7 +19424,7 @@ def _power_off_initial( response = pipeline_response.http_response - if response.status_code not in [200, 202]: + if response.status_code not in [200, 202, 204]: try: response.read() # Load the body in memory and close the socket except (StreamConsumedError, StreamClosedError): @@ -20424,38 +19446,34 @@ def _power_off_initial( return deserialized # type: ignore @distributed_trace - def begin_power_off( - self, resource_group_name: str, vm_name: str, *, skip_shutdown: Optional[bool] = None, **kwargs: Any - ) -> LROPoller[_models.OkResponse]: - """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. + def begin_delete( + 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. The name is case insensitive. Required. :type resource_group_name: str :param vm_name: The name of the virtual machine. Required. :type vm_name: str - :keyword 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 None. - :paramtype skip_shutdown: bool - :return: An instance of LROPoller that returns OkResponse. The OkResponse is compatible with - MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.OkResponse] + :param vm_extension_name: The name of the virtual machine extension. Required. + :type vm_extension_name: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.OkResponse] = kwargs.pop("cls", None) + cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._power_off_initial( + raw_result = self._delete_initial( resource_group_name=resource_group_name, vm_name=vm_name, - skip_shutdown=skip_shutdown, + vm_extension_name=vm_extension_name, cls=lambda x, y, z: x, headers=_headers, params=_params, @@ -20464,16 +19482,9 @@ def begin_power_off( raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): - response_headers = {} - response = pipeline_response.http_response - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = _deserialize(_models.OkResponse, response.json()) + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized + return cls(pipeline_response, None, {}) # type: ignore path_format_arguments = { "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), @@ -20488,17 +19499,32 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller[_models.OkResponse].from_continuation_token( + return LROPoller[None].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller[_models.OkResponse]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - def _reapply_initial(self, resource_group_name: str, vm_name: str, **kwargs: Any) -> Iterator[bytes]: + @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. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_name: The name of the virtual machine. Required. + :type vm_name: str + :keyword expand: The expand expression to apply on the operation. Default value is None. + :paramtype expand: str + :return: VirtualMachineExtensionsListResult. The VirtualMachineExtensionsListResult is + compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.VirtualMachineExtensionsListResult + :raises ~azure.core.exceptions.HttpResponseError: + """ error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -20510,12 +19536,13 @@ def _reapply_initial(self, resource_group_name: str, vm_name: str, **kwargs: Any _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + cls: ClsType[_models.VirtualMachineExtensionsListResult] = kwargs.pop("cls", None) - _request = build_virtual_machines_reapply_request( + _request = build_virtual_machine_extensions_list_request( resource_group_name=resource_group_name, vm_name=vm_name, subscription_id=self._config.subscription_id, + expand=expand, api_version=self._config.api_version, headers=_headers, params=_params, @@ -20525,102 +19552,70 @@ def _reapply_initial(self, resource_group_name: str, vm_name: str, **kwargs: Any } _request.url = self._client.format_url(_request.url, **path_format_arguments) - _stream = True + _stream = kwargs.pop("stream", False) pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200, 202]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = _failsafe_deserialize(_models.CloudError, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.iter_bytes() + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.VirtualMachineExtensionsListResult, response.json()) if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - @distributed_trace - def begin_reapply(self, resource_group_name: str, vm_name: str, **kwargs: Any) -> LROPoller[_models.OkResponse]: - """The operation to reapply a virtual machine's state. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_name: The name of the virtual machine. Required. - :type vm_name: str - :return: An instance of LROPoller that returns OkResponse. The OkResponse is compatible with - MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.OkResponse] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[_models.OkResponse] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._reapply_initial( - resource_group_name=resource_group_name, - vm_name=vm_name, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): - response_headers = {} - response = pipeline_response.http_response - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) +class VirtualMachineExtensionImagesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - deserialized = _deserialize(_models.OkResponse, response.json()) - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized + Instead, you should access the following operations through + :class:`~azure.mgmt.compute.ComputeClient`'s + :attr:`virtual_machine_extension_images` attribute. + """ - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.OkResponse].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.OkResponse]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) + @distributed_trace + def get( + self, location: str, publisher_name: str, type: str, version: str, **kwargs: Any + ) -> _models.VirtualMachineExtensionImage: + """Gets a virtual machine extension image. - def _redeploy_initial(self, resource_group_name: str, vm_name: str, **kwargs: Any) -> Iterator[bytes]: + :param location: The location name. Required. + :type location: str + :param publisher_name: Required. + :type publisher_name: str + :param type: Required. + :type type: str + :param version: Required. + :type version: str + :return: VirtualMachineExtensionImage. The VirtualMachineExtensionImage is compatible with + MutableMapping + :rtype: ~azure.mgmt.compute.models.VirtualMachineExtensionImage + :raises ~azure.core.exceptions.HttpResponseError: + """ error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -20632,11 +19627,13 @@ def _redeploy_initial(self, resource_group_name: str, vm_name: str, **kwargs: An _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + cls: ClsType[_models.VirtualMachineExtensionImage] = kwargs.pop("cls", None) - _request = build_virtual_machines_redeploy_request( - resource_group_name=resource_group_name, - vm_name=vm_name, + _request = build_virtual_machine_extension_images_get_request( + location=location, + publisher_name=publisher_name, + type=type, + version=version, subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -20647,108 +19644,47 @@ def _redeploy_initial(self, resource_group_name: str, vm_name: str, **kwargs: An } _request.url = self._client.format_url(_request.url, **path_format_arguments) - _stream = True + _stream = kwargs.pop("stream", False) pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200, 202]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = _failsafe_deserialize(_models.CloudError, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.iter_bytes() + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.VirtualMachineExtensionImage, response.json()) if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore @distributed_trace - def begin_redeploy(self, resource_group_name: str, vm_name: str, **kwargs: Any) -> LROPoller[_models.OkResponse]: - """Shuts down the virtual machine, moves it to a new node, and powers it back on. + def list_types( + self, location: str, publisher_name: str, **kwargs: Any + ) -> List[_models.VirtualMachineExtensionImage]: + """Gets a list of virtual machine extension image types. - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_name: The name of the virtual machine. Required. - :type vm_name: str - :return: An instance of LROPoller that returns OkResponse. The OkResponse is compatible with - MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.OkResponse] + :param location: The location name. Required. + :type location: str + :param publisher_name: Required. + :type publisher_name: str + :return: list of VirtualMachineExtensionImage + :rtype: list[~azure.mgmt.compute.models.VirtualMachineExtensionImage] :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[_models.OkResponse] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._redeploy_initial( - resource_group_name=resource_group_name, - vm_name=vm_name, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - response_headers = {} - response = pipeline_response.http_response - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = _deserialize(_models.OkResponse, response.json()) - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized - - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.OkResponse].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.OkResponse]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _reimage_initial( - self, - resource_group_name: str, - vm_name: str, - parameters: Optional[Union[_models.VirtualMachineReimageParameters, JSON, IO[bytes]]] = None, - **kwargs: Any - ) -> Iterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -20757,30 +19693,16 @@ def _reimage_initial( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - content_type = content_type if parameters else None - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" if parameters else None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - if parameters is not None: - _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - else: - _content = None + cls: ClsType[List[_models.VirtualMachineExtensionImage]] = kwargs.pop("cls", None) - _request = build_virtual_machines_reimage_request( - resource_group_name=resource_group_name, - vm_name=vm_name, + _request = build_virtual_machine_extension_images_list_types_request( + location=location, + publisher_name=publisher_name, subscription_id=self._config.subscription_id, - content_type=content_type, api_version=self._config.api_version, - content=_content, headers=_headers, params=_params, ) @@ -20789,223 +19711,63 @@ def _reimage_initial( } _request.url = self._client.format_url(_request.url, **path_format_arguments) - _stream = True + _stream = kwargs.pop("stream", False) pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200, 202]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = _failsafe_deserialize(_models.CloudError, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.iter_bytes() + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(List[_models.VirtualMachineExtensionImage], response.json()) if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - @overload - def begin_reimage( + @distributed_trace + def list_versions( self, - resource_group_name: str, - vm_name: str, - parameters: Optional[_models.VirtualMachineReimageParameters] = None, + location: str, + publisher_name: str, + type: str, *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.OkResponse]: - """Reimages (upgrade the operating system) a virtual machine 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. NOTE: The retaining of old OS disk depends on the value of deleteOption of OS disk. If - deleteOption is detach, the old OS disk will be preserved after reimage. If deleteOption is - delete, the old OS disk will be deleted after reimage. The deleteOption of the OS disk should - be updated accordingly before performing the reimage. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_name: The name of the virtual machine. Required. - :type vm_name: str - :param parameters: Parameters supplied to the Reimage Virtual Machine operation. Default value - is None. - :type parameters: ~azure.mgmt.compute.models.VirtualMachineReimageParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns OkResponse. The OkResponse is compatible with - MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.OkResponse] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_reimage( - self, - resource_group_name: str, - vm_name: str, - parameters: Optional[JSON] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.OkResponse]: - """Reimages (upgrade the operating system) a virtual machine 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. NOTE: The retaining of old OS disk depends on the value of deleteOption of OS disk. If - deleteOption is detach, the old OS disk will be preserved after reimage. If deleteOption is - delete, the old OS disk will be deleted after reimage. The deleteOption of the OS disk should - be updated accordingly before performing the reimage. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_name: The name of the virtual machine. Required. - :type vm_name: str - :param parameters: Parameters supplied to the Reimage Virtual Machine operation. Default value - is None. - :type parameters: JSON - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns OkResponse. The OkResponse is compatible with - MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.OkResponse] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_reimage( - self, - resource_group_name: str, - vm_name: str, - parameters: Optional[IO[bytes]] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.OkResponse]: - """Reimages (upgrade the operating system) a virtual machine 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. NOTE: The retaining of old OS disk depends on the value of deleteOption of OS disk. If - deleteOption is detach, the old OS disk will be preserved after reimage. If deleteOption is - delete, the old OS disk will be deleted after reimage. The deleteOption of the OS disk should - be updated accordingly before performing the reimage. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_name: The name of the virtual machine. Required. - :type vm_name: str - :param parameters: Parameters supplied to the Reimage Virtual Machine operation. Default value - is None. - :type parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns OkResponse. The OkResponse is compatible with - MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.OkResponse] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_reimage( - self, - resource_group_name: str, - vm_name: str, - parameters: Optional[Union[_models.VirtualMachineReimageParameters, JSON, IO[bytes]]] = None, + filter: Optional[str] = None, + top: Optional[int] = None, + orderby: Optional[str] = None, **kwargs: Any - ) -> LROPoller[_models.OkResponse]: - """Reimages (upgrade the operating system) a virtual machine 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. NOTE: The retaining of old OS disk depends on the value of deleteOption of OS disk. If - deleteOption is detach, the old OS disk will be preserved after reimage. If deleteOption is - delete, the old OS disk will be deleted after reimage. The deleteOption of the OS disk should - be updated accordingly before performing the reimage. + ) -> List[_models.VirtualMachineExtensionImage]: + """Gets a list of virtual machine extension image versions. - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_name: The name of the virtual machine. Required. - :type vm_name: str - :param parameters: Parameters supplied to the Reimage Virtual Machine operation. Is one of the - following types: VirtualMachineReimageParameters, JSON, IO[bytes] Default value is None. - :type parameters: ~azure.mgmt.compute.models.VirtualMachineReimageParameters or JSON or - IO[bytes] - :return: An instance of LROPoller that returns OkResponse. The OkResponse is compatible with - MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.OkResponse] + :param location: The location name. Required. + :type location: str + :param publisher_name: Required. + :type publisher_name: str + :param type: Required. + :type type: str + :keyword filter: The filter to apply on the operation. Default value is None. + :paramtype filter: str + :keyword top: Default value is None. + :paramtype top: int + :keyword orderby: Default value is None. + :paramtype orderby: str + :return: list of VirtualMachineExtensionImage + :rtype: list[~azure.mgmt.compute.models.VirtualMachineExtensionImage] :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} - - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - content_type = content_type if parameters else None - cls: ClsType[_models.OkResponse] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._reimage_initial( - resource_group_name=resource_group_name, - vm_name=vm_name, - parameters=parameters, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - response_headers = {} - response = pipeline_response.http_response - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = _deserialize(_models.OkResponse, response.json()) - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized - - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.OkResponse].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.OkResponse]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _restart_initial(self, resource_group_name: str, vm_name: str, **kwargs: Any) -> Iterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -21017,12 +19779,16 @@ def _restart_initial(self, resource_group_name: str, vm_name: str, **kwargs: Any _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + cls: ClsType[List[_models.VirtualMachineExtensionImage]] = kwargs.pop("cls", None) - _request = build_virtual_machines_restart_request( - resource_group_name=resource_group_name, - vm_name=vm_name, + _request = build_virtual_machine_extension_images_list_versions_request( + location=location, + publisher_name=publisher_name, + type=type, subscription_id=self._config.subscription_id, + filter=filter, + top=top, + orderby=orderby, api_version=self._config.api_version, headers=_headers, params=_params, @@ -21032,124 +19798,62 @@ def _restart_initial(self, resource_group_name: str, vm_name: str, **kwargs: Any } _request.url = self._client.format_url(_request.url, **path_format_arguments) - _stream = True + _stream = kwargs.pop("stream", False) pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200, 202]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = _failsafe_deserialize(_models.CloudError, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.iter_bytes() + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(List[_models.VirtualMachineExtensionImage], response.json()) if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - @distributed_trace - def begin_restart(self, resource_group_name: str, vm_name: str, **kwargs: Any) -> LROPoller[_models.OkResponse]: - """The operation to restart a virtual machine. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_name: The name of the virtual machine. Required. - :type vm_name: str - :return: An instance of LROPoller that returns OkResponse. The OkResponse is compatible with - MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.OkResponse] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[_models.OkResponse] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._restart_initial( - resource_group_name=resource_group_name, - vm_name=vm_name, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - response_headers = {} - response = pipeline_response.http_response - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - deserialized = _deserialize(_models.OkResponse, response.json()) - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized +class AvailabilitySetsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } + Instead, you should access the following operations through + :class:`~azure.mgmt.compute.ComputeClient`'s + :attr:`availability_sets` attribute. + """ - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.OkResponse].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.OkResponse]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @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. + 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. The name is case insensitive. Required. :type resource_group_name: str - :param vm_name: The name of the virtual machine. Required. - :type vm_name: str - :keyword sas_uri_expiration_time_in_minutes: Expiration duration in minutes for the SAS URIs - with a value between 1 to 1440 minutes. **Note:** If not specified, SAS URIs will be generated - with a default expiration duration of 120 minutes. Default value is None. - :paramtype sas_uri_expiration_time_in_minutes: int - :return: RetrieveBootDiagnosticsDataResult. The RetrieveBootDiagnosticsDataResult is compatible - with MutableMapping - :rtype: ~azure.mgmt.compute.models.RetrieveBootDiagnosticsDataResult + :param availability_set_name: The name of the availability set. Required. + :type availability_set_name: str + :return: AvailabilitySet. The AvailabilitySet is compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.AvailabilitySet :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -21163,13 +19867,12 @@ def retrieve_boot_diagnostics_data( _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.RetrieveBootDiagnosticsDataResult] = kwargs.pop("cls", None) + cls: ClsType[_models.AvailabilitySet] = kwargs.pop("cls", None) - _request = build_virtual_machines_retrieve_boot_diagnostics_data_request( + _request = build_availability_sets_get_request( resource_group_name=resource_group_name, - vm_name=vm_name, + availability_set_name=availability_set_name, subscription_id=self._config.subscription_id, - sas_uri_expiration_time_in_minutes=sas_uri_expiration_time_in_minutes, api_version=self._config.api_version, headers=_headers, params=_params, @@ -21199,70 +19902,116 @@ def retrieve_boot_diagnostics_data( if _stream: deserialized = response.iter_bytes() else: - deserialized = _deserialize(_models.RetrieveBootDiagnosticsDataResult, response.json()) + deserialized = _deserialize(_models.AvailabilitySet, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # 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. + @overload + def create_or_update( + self, + resource_group_name: str, + availability_set_name: str, + parameters: _models.AvailabilitySet, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.AvailabilitySet: + """Create or update an availability set. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param vm_name: The name of the virtual machine. Required. - :type vm_name: str - :return: None - :rtype: None + :param availability_set_name: The name of the availability set. Required. + :type availability_set_name: str + :param parameters: Parameters supplied to the Create Availability Set operation. Required. + :type parameters: ~azure.mgmt.compute.models.AvailabilitySet + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: AvailabilitySet. The AvailabilitySet is compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.AvailabilitySet :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[None] = kwargs.pop("cls", None) - _request = build_virtual_machines_simulate_eviction_request( - resource_group_name=resource_group_name, - vm_name=vm_name, - subscription_id=self._config.subscription_id, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) + @overload + def create_or_update( + self, + resource_group_name: str, + availability_set_name: str, + parameters: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.AvailabilitySet: + """Create or update an availability set. - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param availability_set_name: The name of the availability set. Required. + :type availability_set_name: str + :param parameters: Parameters supplied to the Create Availability Set operation. Required. + :type parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: AvailabilitySet. The AvailabilitySet is compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.AvailabilitySet + :raises ~azure.core.exceptions.HttpResponseError: + """ - response = pipeline_response.http_response + @overload + def create_or_update( + self, + resource_group_name: str, + availability_set_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.AvailabilitySet: + """Create or update an availability set. - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.CloudError, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param availability_set_name: The name of the availability set. Required. + :type availability_set_name: str + :param parameters: Parameters supplied to the Create Availability Set operation. Required. + :type parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: AvailabilitySet. The AvailabilitySet is compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.AvailabilitySet + :raises ~azure.core.exceptions.HttpResponseError: + """ - if cls: - return cls(pipeline_response, None, {}) # type: ignore + @distributed_trace + def create_or_update( + self, + resource_group_name: str, + availability_set_name: str, + parameters: Union[_models.AvailabilitySet, JSON, IO[bytes]], + **kwargs: Any + ) -> _models.AvailabilitySet: + """Create or update an availability set. - def _start_initial(self, resource_group_name: str, vm_name: str, **kwargs: Any) -> Iterator[bytes]: + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param availability_set_name: The name of the availability set. Required. + :type availability_set_name: str + :param parameters: Parameters supplied to the Create Availability Set operation. Is one of the + following types: AvailabilitySet, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.compute.models.AvailabilitySet or JSON or IO[bytes] + :return: AvailabilitySet. The AvailabilitySet is compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.AvailabilitySet + :raises ~azure.core.exceptions.HttpResponseError: + """ error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -21271,16 +20020,26 @@ def _start_initial(self, resource_group_name: str, vm_name: str, **kwargs: Any) } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AvailabilitySet] = kwargs.pop("cls", None) - _request = build_virtual_machines_start_request( + content_type = content_type or "application/json" + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_availability_sets_create_or_update_request( resource_group_name=resource_group_name, - vm_name=vm_name, + availability_set_name=availability_set_name, subscription_id=self._config.subscription_id, + content_type=content_type, api_version=self._config.api_version, + content=_content, headers=_headers, params=_params, ) @@ -21289,121 +20048,270 @@ def _start_initial(self, resource_group_name: str, vm_name: str, **kwargs: Any) } _request.url = self._client.format_url(_request.url, **path_format_arguments) - _stream = True + _stream = kwargs.pop("stream", False) pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200, 202]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = _failsafe_deserialize(_models.CloudError, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.iter_bytes() + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.AvailabilitySet, response.json()) if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - @distributed_trace - def begin_start(self, resource_group_name: str, vm_name: str, **kwargs: Any) -> LROPoller[_models.OkResponse]: - """The operation to start a virtual machine. + @overload + def update( + self, + resource_group_name: str, + availability_set_name: str, + parameters: _models.AvailabilitySetUpdate, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.AvailabilitySet: + """Update an availability set. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param vm_name: The name of the virtual machine. Required. - :type vm_name: str - :return: An instance of LROPoller that returns OkResponse. The OkResponse is compatible with - MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.OkResponse] + :param availability_set_name: The name of the availability set. Required. + :type availability_set_name: str + :param parameters: Parameters supplied to the Update Availability Set operation. Required. + :type parameters: ~azure.mgmt.compute.models.AvailabilitySetUpdate + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: AvailabilitySet. The AvailabilitySet is compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.AvailabilitySet :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.OkResponse] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._start_initial( - resource_group_name=resource_group_name, - vm_name=vm_name, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) + @overload + def update( + self, + resource_group_name: str, + availability_set_name: str, + parameters: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.AvailabilitySet: + """Update an availability set. - def get_long_running_output(pipeline_response): - response_headers = {} - response = pipeline_response.http_response - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param availability_set_name: The name of the availability set. Required. + :type availability_set_name: str + :param parameters: Parameters supplied to the Update Availability Set operation. Required. + :type parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: AvailabilitySet. The AvailabilitySet is compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.AvailabilitySet + :raises ~azure.core.exceptions.HttpResponseError: + """ - deserialized = _deserialize(_models.OkResponse, response.json()) - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized + @overload + def update( + self, + resource_group_name: str, + availability_set_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.AvailabilitySet: + """Update an availability set. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param availability_set_name: The name of the availability set. Required. + :type availability_set_name: str + :param parameters: Parameters supplied to the Update Availability Set operation. Required. + :type parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: AvailabilitySet. The AvailabilitySet is compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.AvailabilitySet + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def update( + self, + resource_group_name: str, + availability_set_name: str, + parameters: Union[_models.AvailabilitySetUpdate, JSON, IO[bytes]], + **kwargs: Any + ) -> _models.AvailabilitySet: + """Update an availability set. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param availability_set_name: The name of the availability set. Required. + :type availability_set_name: str + :param parameters: Parameters supplied to the Update Availability Set operation. Is one of the + following types: AvailabilitySetUpdate, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.compute.models.AvailabilitySetUpdate or JSON or IO[bytes] + :return: AvailabilitySet. The AvailabilitySet is compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.AvailabilitySet + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AvailabilitySet] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _request = build_availability_sets_update_request( + resource_group_name=resource_group_name, + availability_set_name=availability_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) path_format_arguments = { "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), } + _request.url = self._client.format_url(_request.url, **path_format_arguments) - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() else: - polling_method = polling - if cont_token: - return LROPoller[_models.OkResponse].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.OkResponse]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore + deserialized = _deserialize(_models.AvailabilitySet, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # 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. The name is case insensitive. + Required. + :type resource_group_name: str + :param availability_set_name: The name of the availability set. Required. + :type availability_set_name: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_availability_sets_delete_request( + resource_group_name=resource_group_name, + availability_set_name=availability_set_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs ) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + @distributed_trace - def list_available_sizes( - self, resource_group_name: str, vm_name: str, **kwargs: Any - ) -> ItemPaged["_models.VirtualMachineSize"]: - """Lists all available virtual machine sizes to which the specified virtual machine can be - resized. + def list(self, resource_group_name: str, **kwargs: Any) -> ItemPaged["_models.AvailabilitySet"]: + """Lists all availability sets in a resource group. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param vm_name: The name of the virtual machine. Required. - :type vm_name: str - :return: An iterator like instance of VirtualMachineSize - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.models.VirtualMachineSize] + :return: An iterator like instance of AvailabilitySet + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.models.AvailabilitySet] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.VirtualMachineSize]] = kwargs.pop("cls", None) + cls: ClsType[List[_models.AvailabilitySet]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -21416,9 +20324,8 @@ def list_available_sizes( def prepare_request(next_link=None): if not next_link: - _request = build_virtual_machines_list_available_sizes_request( + _request = build_availability_sets_list_request( resource_group_name=resource_group_name, - vm_name=vm_name, subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -21455,7 +20362,7 @@ def prepare_request(next_link=None): def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.VirtualMachineSize], deserialized.get("value", [])) + list_of_elem = _deserialize(List[_models.AvailabilitySet], deserialized.get("value", [])) if cls: list_of_elem = cls(list_of_elem) # type: ignore return deserialized.get("nextLink") or None, iter(list_of_elem) @@ -21478,13 +20385,24 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - def _run_command_initial( - self, - resource_group_name: str, - vm_name: str, - parameters: Union[_models.RunCommandInput, JSON, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: + @distributed_trace + def list_by_subscription( + self, *, expand: Optional[str] = None, **kwargs: Any + ) -> ItemPaged["_models.AvailabilitySet"]: + """Lists all availability sets in a subscription. + + :keyword expand: The expand expression to apply to the operation. Allowed values are + 'instanceView'. Default value is None. + :paramtype expand: str + :return: An iterator like instance of AvailabilitySet + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.models.AvailabilitySet] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.AvailabilitySet]] = kwargs.pop("cls", None) + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -21493,230 +20411,553 @@ def _run_command_initial( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} + def prepare_request(next_link=None): + if not next_link: - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + _request = build_availability_sets_list_by_subscription_request( + subscription_id=self._config.subscription_id, + expand=expand, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) - content_type = content_type or "application/json" - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) - _request = build_virtual_machines_run_command_request( - resource_group_name=resource_group_name, - vm_name=vm_name, - subscription_id=self._config.subscription_id, - content_type=content_type, - api_version=self._config.api_version, - content=_content, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.AvailabilitySet], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + @distributed_trace + def list_available_sizes( + self, resource_group_name: str, availability_set_name: str, **kwargs: Any + ) -> ItemPaged["_models.VirtualMachineSize"]: + """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. The name is case insensitive. + Required. + :type resource_group_name: str + :param availability_set_name: The name of the availability set. Required. + :type availability_set_name: str + :return: An iterator like instance of VirtualMachineSize + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.models.VirtualMachineSize] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.VirtualMachineSize]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - _request.url = self._client.format_url(_request.url, **path_format_arguments) + error_map.update(kwargs.pop("error_map", {}) or {}) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) + def prepare_request(next_link=None): + if not next_link: - response = pipeline_response.http_response + _request = build_availability_sets_list_available_sizes_request( + resource_group_name=resource_group_name, + availability_set_name=availability_set_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) - if response.status_code not in [200, 202]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.CloudError, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + return _request - deserialized = response.iter_bytes() + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.VirtualMachineSize], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore + def get_next(next_link=None): + _request = prepare_request(next_link) - return deserialized # type: ignore + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) @overload - def begin_run_command( + def start_migration_to_virtual_machine_scale_set( # pylint: disable=name-too-long self, resource_group_name: str, - vm_name: str, - parameters: _models.RunCommandInput, + availability_set_name: str, + parameters: _models.MigrateToVirtualMachineScaleSetInput, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.RunCommandResult]: - """Run command on the VM. + ) -> None: + """Start migration operation on an Availability Set to move its Virtual Machines to a Virtual + Machine Scale Set. This should be followed by a migrate operation on each Virtual Machine that + triggers a downtime on the Virtual Machine. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param vm_name: The name of the virtual machine. Required. - :type vm_name: str - :param parameters: Parameters supplied to the Run command operation. Required. - :type parameters: ~azure.mgmt.compute.models.RunCommandInput + :param availability_set_name: The name of the availability set. Required. + :type availability_set_name: str + :param parameters: Parameters supplied to the migrate operation on the availability set. + Required. + :type parameters: ~azure.mgmt.compute.models.MigrateToVirtualMachineScaleSetInput :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns RunCommandResult. The RunCommandResult is - compatible with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.RunCommandResult] + :return: None + :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def begin_run_command( + def start_migration_to_virtual_machine_scale_set( # pylint: disable=name-too-long self, resource_group_name: str, - vm_name: str, + availability_set_name: str, parameters: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.RunCommandResult]: - """Run command on the VM. + ) -> None: + """Start migration operation on an Availability Set to move its Virtual Machines to a Virtual + Machine Scale Set. This should be followed by a migrate operation on each Virtual Machine that + triggers a downtime on the Virtual Machine. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param vm_name: The name of the virtual machine. Required. - :type vm_name: str - :param parameters: Parameters supplied to the Run command operation. Required. - :type parameters: JSON - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". + :param availability_set_name: The name of the availability set. Required. + :type availability_set_name: str + :param parameters: Parameters supplied to the migrate operation on the availability set. + Required. + :type parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns RunCommandResult. The RunCommandResult is - compatible with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.RunCommandResult] + :return: None + :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def begin_run_command( + def start_migration_to_virtual_machine_scale_set( # pylint: disable=name-too-long self, resource_group_name: str, - vm_name: str, + availability_set_name: str, parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.RunCommandResult]: - """Run command on the VM. + ) -> None: + """Start migration operation on an Availability Set to move its Virtual Machines to a Virtual + Machine Scale Set. This should be followed by a migrate operation on each Virtual Machine that + triggers a downtime on the Virtual Machine. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param vm_name: The name of the virtual machine. Required. - :type vm_name: str - :param parameters: Parameters supplied to the Run command operation. Required. + :param availability_set_name: The name of the availability set. Required. + :type availability_set_name: str + :param parameters: Parameters supplied to the migrate operation on the availability set. + Required. :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns RunCommandResult. The RunCommandResult is - compatible with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.RunCommandResult] + :return: None + :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace - def begin_run_command( + def start_migration_to_virtual_machine_scale_set( # pylint: disable=inconsistent-return-statements,name-too-long self, resource_group_name: str, - vm_name: str, - parameters: Union[_models.RunCommandInput, JSON, IO[bytes]], + availability_set_name: str, + parameters: Union[_models.MigrateToVirtualMachineScaleSetInput, JSON, IO[bytes]], **kwargs: Any - ) -> LROPoller[_models.RunCommandResult]: - """Run command on the VM. + ) -> None: + """Start migration operation on an Availability Set to move its Virtual Machines to a Virtual + Machine Scale Set. This should be followed by a migrate operation on each Virtual Machine that + triggers a downtime on the Virtual Machine. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param vm_name: The name of the virtual machine. Required. - :type vm_name: str - :param parameters: Parameters supplied to the Run command operation. Is one of the following - types: RunCommandInput, JSON, IO[bytes] Required. - :type parameters: ~azure.mgmt.compute.models.RunCommandInput or JSON or IO[bytes] - :return: An instance of LROPoller that returns RunCommandResult. The RunCommandResult is - compatible with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.RunCommandResult] + :param availability_set_name: The name of the availability set. Required. + :type availability_set_name: str + :param parameters: Parameters supplied to the migrate operation on the availability set. Is one + of the following types: MigrateToVirtualMachineScaleSetInput, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.compute.models.MigrateToVirtualMachineScaleSetInput or JSON or + IO[bytes] + :return: None + :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.RunCommandResult] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._run_command_initial( - resource_group_name=resource_group_name, - vm_name=vm_name, - parameters=parameters, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) + cls: ClsType[None] = kwargs.pop("cls", None) - def get_long_running_output(pipeline_response): - response_headers = {} - response = pipeline_response.http_response - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + content_type = content_type or "application/json" + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - deserialized = _deserialize(_models.RunCommandResult, response.json()) - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized + _request = build_availability_sets_start_migration_to_virtual_machine_scale_set_request( + resource_group_name=resource_group_name, + availability_set_name=availability_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace + def cancel_migration_to_virtual_machine_scale_set( # pylint: disable=inconsistent-return-statements,name-too-long + self, resource_group_name: str, availability_set_name: str, **kwargs: Any + ) -> None: + """Cancel the migration operation on an Availability Set. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param availability_set_name: The name of the availability set. Required. + :type availability_set_name: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + _request = build_availability_sets_cancel_migration_to_virtual_machine_scale_set_request( + resource_group_name=resource_group_name, + availability_set_name=availability_set_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) path_format_arguments = { "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), } + _request.url = self._client.format_url(_request.url, **path_format_arguments) - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @overload + def validate_migration_to_virtual_machine_scale_set( # pylint: disable=name-too-long + self, + resource_group_name: str, + availability_set_name: str, + parameters: _models.MigrateToVirtualMachineScaleSetInput, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> None: + """Validates that the Virtual Machines in the Availability Set can be migrated to the provided + Virtual Machine Scale Set. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param availability_set_name: The name of the availability set. Required. + :type availability_set_name: str + :param parameters: Parameters supplied to the migrate operation on the availability set. + Required. + :type parameters: ~azure.mgmt.compute.models.MigrateToVirtualMachineScaleSetInput + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def validate_migration_to_virtual_machine_scale_set( # pylint: disable=name-too-long + self, + resource_group_name: str, + availability_set_name: str, + parameters: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> None: + """Validates that the Virtual Machines in the Availability Set can be migrated to the provided + Virtual Machine Scale Set. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param availability_set_name: The name of the availability set. Required. + :type availability_set_name: str + :param parameters: Parameters supplied to the migrate operation on the availability set. + Required. + :type parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def validate_migration_to_virtual_machine_scale_set( # pylint: disable=name-too-long + self, + resource_group_name: str, + availability_set_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> None: + """Validates that the Virtual Machines in the Availability Set can be migrated to the provided + Virtual Machine Scale Set. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param availability_set_name: The name of the availability set. Required. + :type availability_set_name: str + :param parameters: Parameters supplied to the migrate operation on the availability set. + Required. + :type parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def validate_migration_to_virtual_machine_scale_set( # pylint: disable=inconsistent-return-statements,name-too-long + self, + resource_group_name: str, + availability_set_name: str, + parameters: Union[_models.MigrateToVirtualMachineScaleSetInput, JSON, IO[bytes]], + **kwargs: Any + ) -> None: + """Validates that the Virtual Machines in the Availability Set can be migrated to the provided + Virtual Machine Scale Set. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param availability_set_name: The name of the availability set. Required. + :type availability_set_name: str + :param parameters: Parameters supplied to the migrate operation on the availability set. Is one + of the following types: MigrateToVirtualMachineScaleSetInput, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.compute.models.MigrateToVirtualMachineScaleSetInput or JSON or + IO[bytes] + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters else: - polling_method = polling - if cont_token: - return LROPoller[_models.RunCommandResult].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.RunCommandResult]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_availability_sets_validate_migration_to_virtual_machine_scale_set_request( + resource_group_name=resource_group_name, + availability_set_name=availability_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs ) - def _migrate_to_vm_scale_set_initial( + 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) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + def _convert_to_virtual_machine_scale_set_initial( # pylint: disable=name-too-long self, resource_group_name: str, - vm_name: str, - parameters: Optional[Union[_models.MigrateVMToVirtualMachineScaleSetInput, JSON, IO[bytes]]] = None, + availability_set_name: str, + parameters: Optional[Union[_models.ConvertToVirtualMachineScaleSetInput, JSON, IO[bytes]]] = None, **kwargs: Any ) -> Iterator[bytes]: error_map: MutableMapping = { @@ -21744,9 +20985,9 @@ def _migrate_to_vm_scale_set_initial( else: _content = None - _request = build_virtual_machines_migrate_to_vm_scale_set_request( + _request = build_availability_sets_convert_to_virtual_machine_scale_set_request( resource_group_name=resource_group_name, - vm_name=vm_name, + availability_set_name=availability_set_name, subscription_id=self._config.subscription_id, content_type=content_type, api_version=self._config.api_version, @@ -21787,25 +21028,26 @@ def _migrate_to_vm_scale_set_initial( return deserialized # type: ignore @overload - def begin_migrate_to_vm_scale_set( + def begin_convert_to_virtual_machine_scale_set( # pylint: disable=name-too-long self, resource_group_name: str, - vm_name: str, - parameters: Optional[_models.MigrateVMToVirtualMachineScaleSetInput] = None, + availability_set_name: str, + parameters: Optional[_models.ConvertToVirtualMachineScaleSetInput] = None, *, content_type: str = "application/json", **kwargs: Any ) -> LROPoller[None]: - """Migrate a virtual machine from availability set to Flexible Virtual Machine Scale Set. + """Create a new Flexible Virtual Machine Scale Set and migrate all the Virtual Machines in the + Availability Set. This does not trigger a downtime on the Virtual Machines. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param vm_name: The name of the virtual machine. Required. - :type vm_name: str - :param parameters: Parameters supplied to the Migrate Virtual Machine operation. Default value - is None. - :type parameters: ~azure.mgmt.compute.models.MigrateVMToVirtualMachineScaleSetInput + :param availability_set_name: The name of the availability set. Required. + :type availability_set_name: str + :param parameters: Parameters supplied to the migrate operation on the availability set. + Default value is None. + :type parameters: ~azure.mgmt.compute.models.ConvertToVirtualMachineScaleSetInput :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -21815,24 +21057,25 @@ def begin_migrate_to_vm_scale_set( """ @overload - def begin_migrate_to_vm_scale_set( + def begin_convert_to_virtual_machine_scale_set( # pylint: disable=name-too-long self, resource_group_name: str, - vm_name: str, + availability_set_name: str, parameters: Optional[JSON] = None, *, content_type: str = "application/json", **kwargs: Any ) -> LROPoller[None]: - """Migrate a virtual machine from availability set to Flexible Virtual Machine Scale Set. + """Create a new Flexible Virtual Machine Scale Set and migrate all the Virtual Machines in the + Availability Set. This does not trigger a downtime on the Virtual Machines. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param vm_name: The name of the virtual machine. Required. - :type vm_name: str - :param parameters: Parameters supplied to the Migrate Virtual Machine operation. Default value - is None. + :param availability_set_name: The name of the availability set. Required. + :type availability_set_name: str + :param parameters: Parameters supplied to the migrate operation on the availability set. + Default value is None. :type parameters: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". @@ -21843,24 +21086,25 @@ def begin_migrate_to_vm_scale_set( """ @overload - def begin_migrate_to_vm_scale_set( + def begin_convert_to_virtual_machine_scale_set( # pylint: disable=name-too-long self, resource_group_name: str, - vm_name: str, + availability_set_name: str, parameters: Optional[IO[bytes]] = None, *, content_type: str = "application/json", **kwargs: Any ) -> LROPoller[None]: - """Migrate a virtual machine from availability set to Flexible Virtual Machine Scale Set. + """Create a new Flexible Virtual Machine Scale Set and migrate all the Virtual Machines in the + Availability Set. This does not trigger a downtime on the Virtual Machines. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param vm_name: The name of the virtual machine. Required. - :type vm_name: str - :param parameters: Parameters supplied to the Migrate Virtual Machine operation. Default value - is None. + :param availability_set_name: The name of the availability set. Required. + :type availability_set_name: str + :param parameters: Parameters supplied to the migrate operation on the availability set. + Default value is None. :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". @@ -21871,23 +21115,25 @@ def begin_migrate_to_vm_scale_set( """ @distributed_trace - def begin_migrate_to_vm_scale_set( + def begin_convert_to_virtual_machine_scale_set( # pylint: disable=name-too-long self, resource_group_name: str, - vm_name: str, - parameters: Optional[Union[_models.MigrateVMToVirtualMachineScaleSetInput, JSON, IO[bytes]]] = None, + availability_set_name: str, + parameters: Optional[Union[_models.ConvertToVirtualMachineScaleSetInput, JSON, IO[bytes]]] = None, **kwargs: Any ) -> LROPoller[None]: - """Migrate a virtual machine from availability set to Flexible Virtual Machine Scale Set. + """Create a new Flexible Virtual Machine Scale Set and migrate all the Virtual Machines in the + Availability Set. This does not trigger a downtime on the Virtual Machines. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param vm_name: The name of the virtual machine. Required. - :type vm_name: str - :param parameters: Parameters supplied to the Migrate Virtual Machine operation. Is one of the - following types: MigrateVMToVirtualMachineScaleSetInput, JSON, IO[bytes] Default value is None. - :type parameters: ~azure.mgmt.compute.models.MigrateVMToVirtualMachineScaleSetInput or JSON or + :param availability_set_name: The name of the availability set. Required. + :type availability_set_name: str + :param parameters: Parameters supplied to the migrate operation on the availability set. Is one + of the following types: ConvertToVirtualMachineScaleSetInput, JSON, IO[bytes] Default value is + None. + :type parameters: ~azure.mgmt.compute.models.ConvertToVirtualMachineScaleSetInput or JSON or IO[bytes] :return: An instance of LROPoller that returns None :rtype: ~azure.core.polling.LROPoller[None] @@ -21903,9 +21149,9 @@ def begin_migrate_to_vm_scale_set( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._migrate_to_vm_scale_set_initial( + raw_result = self._convert_to_virtual_machine_scale_set_initial( resource_group_name=resource_group_name, - vm_name=vm_name, + availability_set_name=availability_set_name, parameters=parameters, content_type=content_type, cls=lambda x, y, z: x, @@ -21942,14 +21188,14 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore -class VirtualMachineExtensionsOperations: +class ProximityPlacementGroupsOperations: """ .. warning:: **DO NOT** instantiate this class directly. Instead, you should access the following operations through :class:`~azure.mgmt.compute.ComputeClient`'s - :attr:`virtual_machine_extensions` attribute. + :attr:`proximity_placement_groups` attribute. """ def __init__(self, *args, **kwargs) -> None: @@ -21963,25 +21209,23 @@ def __init__(self, *args, **kwargs) -> None: def get( self, resource_group_name: str, - vm_name: str, - vm_extension_name: str, + proximity_placement_group_name: str, *, - expand: Optional[str] = None, + include_colocation_status: Optional[str] = None, **kwargs: Any - ) -> _models.VirtualMachineExtension: - """The operation to get the extension. + ) -> _models.ProximityPlacementGroup: + """Retrieves information about a proximity placement group . :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param vm_name: The name of the virtual machine. Required. - :type vm_name: str - :param vm_extension_name: The name of the virtual machine extension. Required. - :type vm_extension_name: str - :keyword expand: The expand expression to apply on the operation. Default value is None. - :paramtype expand: str - :return: VirtualMachineExtension. The VirtualMachineExtension is compatible with MutableMapping - :rtype: ~azure.mgmt.compute.models.VirtualMachineExtension + :param proximity_placement_group_name: The name of the proximity placement group. Required. + :type proximity_placement_group_name: str + :keyword include_colocation_status: includeColocationStatus=true enables fetching the + colocation status of all the resources in the proximity placement group. Default value is None. + :paramtype include_colocation_status: str + :return: ProximityPlacementGroup. The ProximityPlacementGroup is compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.ProximityPlacementGroup :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -21995,14 +21239,13 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.VirtualMachineExtension] = kwargs.pop("cls", None) + cls: ClsType[_models.ProximityPlacementGroup] = kwargs.pop("cls", None) - _request = build_virtual_machine_extensions_get_request( + _request = build_proximity_placement_groups_get_request( resource_group_name=resource_group_name, - vm_name=vm_name, - vm_extension_name=vm_extension_name, + proximity_placement_group_name=proximity_placement_group_name, subscription_id=self._config.subscription_id, - expand=expand, + include_colocation_status=include_colocation_status, api_version=self._config.api_version, headers=_headers, params=_params, @@ -22032,261 +21275,119 @@ def get( if _stream: deserialized = response.iter_bytes() else: - deserialized = _deserialize(_models.VirtualMachineExtension, response.json()) + deserialized = _deserialize(_models.ProximityPlacementGroup, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - def _create_or_update_initial( + @overload + def create_or_update( self, resource_group_name: str, - vm_name: str, - vm_extension_name: str, - extension_parameters: Union[_models.VirtualMachineExtension, JSON, IO[bytes]], + proximity_placement_group_name: str, + parameters: _models.ProximityPlacementGroup, + *, + content_type: str = "application/json", **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} - - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _content = None - if isinstance(extension_parameters, (IOBase, bytes)): - _content = extension_parameters - else: - _content = json.dumps(extension_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - - _request = build_virtual_machine_extensions_create_or_update_request( - resource_group_name=resource_group_name, - vm_name=vm_name, - vm_extension_name=vm_extension_name, - subscription_id=self._config.subscription_id, - content_type=content_type, - api_version=self._config.api_version, - content=_content, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.CloudError, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 201: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.iter_bytes() - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - vm_name: str, - vm_extension_name: str, - extension_parameters: _models.VirtualMachineExtension, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[None]: - """The operation to create or update the extension. + ) -> _models.ProximityPlacementGroup: + """Create or update a proximity placement group. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param vm_name: The name of the virtual machine. Required. - :type vm_name: str - :param vm_extension_name: The name of the virtual machine extension. Required. - :type vm_extension_name: str - :param extension_parameters: Parameters supplied to the Create Virtual Machine Extension - operation. Required. - :type extension_parameters: ~azure.mgmt.compute.models.VirtualMachineExtension + :param proximity_placement_group_name: The name of the proximity placement group. Required. + :type proximity_placement_group_name: str + :param parameters: Parameters supplied to the Create Proximity Placement Group operation. + Required. + :type parameters: ~azure.mgmt.compute.models.ProximityPlacementGroup :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns None - :rtype: ~azure.core.polling.LROPoller[None] + :return: ProximityPlacementGroup. The ProximityPlacementGroup is compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.ProximityPlacementGroup :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def begin_create_or_update( + def create_or_update( self, resource_group_name: str, - vm_name: str, - vm_extension_name: str, - extension_parameters: JSON, + proximity_placement_group_name: str, + parameters: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[None]: - """The operation to create or update the extension. + ) -> _models.ProximityPlacementGroup: + """Create or update a proximity placement group. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param vm_name: The name of the virtual machine. Required. - :type vm_name: str - :param vm_extension_name: The name of the virtual machine extension. Required. - :type vm_extension_name: str - :param extension_parameters: Parameters supplied to the Create Virtual Machine Extension - operation. Required. - :type extension_parameters: JSON + :param proximity_placement_group_name: The name of the proximity placement group. Required. + :type proximity_placement_group_name: str + :param parameters: Parameters supplied to the Create Proximity Placement Group operation. + Required. + :type parameters: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns None - :rtype: ~azure.core.polling.LROPoller[None] + :return: ProximityPlacementGroup. The ProximityPlacementGroup is compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.ProximityPlacementGroup :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def begin_create_or_update( + def create_or_update( self, resource_group_name: str, - vm_name: str, - vm_extension_name: str, - extension_parameters: IO[bytes], + proximity_placement_group_name: str, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[None]: - """The operation to create or update the extension. + ) -> _models.ProximityPlacementGroup: + """Create or update a proximity placement group. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param vm_name: The name of the virtual machine. Required. - :type vm_name: str - :param vm_extension_name: The name of the virtual machine extension. Required. - :type vm_extension_name: str - :param extension_parameters: Parameters supplied to the Create Virtual Machine Extension - operation. Required. - :type extension_parameters: IO[bytes] + :param proximity_placement_group_name: The name of the proximity placement group. Required. + :type proximity_placement_group_name: str + :param parameters: Parameters supplied to the Create Proximity Placement Group operation. + Required. + :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns None - :rtype: ~azure.core.polling.LROPoller[None] + :return: ProximityPlacementGroup. The ProximityPlacementGroup is compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.ProximityPlacementGroup :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace - def begin_create_or_update( + def create_or_update( self, resource_group_name: str, - vm_name: str, - vm_extension_name: str, - extension_parameters: Union[_models.VirtualMachineExtension, JSON, IO[bytes]], + proximity_placement_group_name: str, + parameters: Union[_models.ProximityPlacementGroup, JSON, IO[bytes]], **kwargs: Any - ) -> LROPoller[None]: - """The operation to create or update the extension. + ) -> _models.ProximityPlacementGroup: + """Create or update a proximity placement group. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param vm_name: The name of the virtual machine. Required. - :type vm_name: str - :param vm_extension_name: The name of the virtual machine extension. Required. - :type vm_extension_name: str - :param extension_parameters: Parameters supplied to the Create Virtual Machine Extension - operation. Is one of the following types: VirtualMachineExtension, JSON, IO[bytes] Required. - :type extension_parameters: ~azure.mgmt.compute.models.VirtualMachineExtension or JSON or - IO[bytes] - :return: An instance of LROPoller that returns None - :rtype: ~azure.core.polling.LROPoller[None] + :param proximity_placement_group_name: The name of the proximity placement group. Required. + :type proximity_placement_group_name: str + :param parameters: Parameters supplied to the Create Proximity Placement Group operation. Is + one of the following types: ProximityPlacementGroup, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.compute.models.ProximityPlacementGroup or JSON or IO[bytes] + :return: ProximityPlacementGroup. The ProximityPlacementGroup is compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.ProximityPlacementGroup :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} - - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._create_or_update_initial( - resource_group_name=resource_group_name, - vm_name=vm_name, - vm_extension_name=vm_extension_name, - extension_parameters=extension_parameters, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _update_initial( - self, - resource_group_name: str, - vm_name: str, - vm_extension_name: str, - extension_parameters: Union[_models.VirtualMachineExtensionUpdate, JSON, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -22299,19 +21400,18 @@ def _update_initial( _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + cls: ClsType[_models.ProximityPlacementGroup] = kwargs.pop("cls", None) content_type = content_type or "application/json" _content = None - if isinstance(extension_parameters, (IOBase, bytes)): - _content = extension_parameters + if isinstance(parameters, (IOBase, bytes)): + _content = parameters else: - _content = json.dumps(extension_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - _request = build_virtual_machine_extensions_update_request( + _request = build_proximity_placement_groups_create_or_update_request( resource_group_name=resource_group_name, - vm_name=vm_name, - vm_extension_name=vm_extension_name, + proximity_placement_group_name=proximity_placement_group_name, subscription_id=self._config.subscription_id, content_type=content_type, api_version=self._config.api_version, @@ -22324,204 +21424,217 @@ def _update_initial( } _request.url = self._client.format_url(_request.url, **path_format_arguments) - _stream = True + _stream = kwargs.pop("stream", False) pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass + if response.status_code not in [200, 201]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = _failsafe_deserialize(_models.CloudError, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - response_headers = {} - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.iter_bytes() + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.ProximityPlacementGroup, response.json()) if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore @overload - def begin_update( + def update( self, resource_group_name: str, - vm_name: str, - vm_extension_name: str, - extension_parameters: _models.VirtualMachineExtensionUpdate, + proximity_placement_group_name: str, + parameters: _models.ProximityPlacementGroupUpdate, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[None]: - """The operation to update the extension. + ) -> _models.ProximityPlacementGroup: + """Update a proximity placement group. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param vm_name: The name of the virtual machine. Required. - :type vm_name: str - :param vm_extension_name: The name of the virtual machine extension. Required. - :type vm_extension_name: str - :param extension_parameters: Parameters supplied to the Update Virtual Machine Extension - operation. Required. - :type extension_parameters: ~azure.mgmt.compute.models.VirtualMachineExtensionUpdate + :param proximity_placement_group_name: The name of the proximity placement group. Required. + :type proximity_placement_group_name: str + :param parameters: Parameters supplied to the Update Proximity Placement Group operation. + Required. + :type parameters: ~azure.mgmt.compute.models.ProximityPlacementGroupUpdate :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns None - :rtype: ~azure.core.polling.LROPoller[None] + :return: ProximityPlacementGroup. The ProximityPlacementGroup is compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.ProximityPlacementGroup :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def begin_update( + def update( self, resource_group_name: str, - vm_name: str, - vm_extension_name: str, - extension_parameters: JSON, + proximity_placement_group_name: str, + parameters: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[None]: - """The operation to update the extension. + ) -> _models.ProximityPlacementGroup: + """Update a proximity placement group. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param vm_name: The name of the virtual machine. Required. - :type vm_name: str - :param vm_extension_name: The name of the virtual machine extension. Required. - :type vm_extension_name: str - :param extension_parameters: Parameters supplied to the Update Virtual Machine Extension - operation. Required. - :type extension_parameters: JSON + :param proximity_placement_group_name: The name of the proximity placement group. Required. + :type proximity_placement_group_name: str + :param parameters: Parameters supplied to the Update Proximity Placement Group operation. + Required. + :type parameters: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns None - :rtype: ~azure.core.polling.LROPoller[None] + :return: ProximityPlacementGroup. The ProximityPlacementGroup is compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.ProximityPlacementGroup :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def begin_update( + def update( self, resource_group_name: str, - vm_name: str, - vm_extension_name: str, - extension_parameters: IO[bytes], + proximity_placement_group_name: str, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[None]: - """The operation to update the extension. + ) -> _models.ProximityPlacementGroup: + """Update a proximity placement group. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param vm_name: The name of the virtual machine. Required. - :type vm_name: str - :param vm_extension_name: The name of the virtual machine extension. Required. - :type vm_extension_name: str - :param extension_parameters: Parameters supplied to the Update Virtual Machine Extension - operation. Required. - :type extension_parameters: IO[bytes] + :param proximity_placement_group_name: The name of the proximity placement group. Required. + :type proximity_placement_group_name: str + :param parameters: Parameters supplied to the Update Proximity Placement Group operation. + Required. + :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns None - :rtype: ~azure.core.polling.LROPoller[None] + :return: ProximityPlacementGroup. The ProximityPlacementGroup is compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.ProximityPlacementGroup :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace - def begin_update( + def update( self, resource_group_name: str, - vm_name: str, - vm_extension_name: str, - extension_parameters: Union[_models.VirtualMachineExtensionUpdate, JSON, IO[bytes]], + proximity_placement_group_name: str, + parameters: Union[_models.ProximityPlacementGroupUpdate, JSON, IO[bytes]], **kwargs: Any - ) -> LROPoller[None]: - """The operation to update the extension. + ) -> _models.ProximityPlacementGroup: + """Update a proximity placement group. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param vm_name: The name of the virtual machine. Required. - :type vm_name: str - :param vm_extension_name: The name of the virtual machine extension. Required. - :type vm_extension_name: str - :param extension_parameters: Parameters supplied to the Update Virtual Machine Extension - operation. Is one of the following types: VirtualMachineExtensionUpdate, JSON, IO[bytes] - Required. - :type extension_parameters: ~azure.mgmt.compute.models.VirtualMachineExtensionUpdate or JSON or - IO[bytes] - :return: An instance of LROPoller that returns None - :rtype: ~azure.core.polling.LROPoller[None] + :param proximity_placement_group_name: The name of the proximity placement group. Required. + :type proximity_placement_group_name: str + :param parameters: Parameters supplied to the Update Proximity Placement Group operation. Is + one of the following types: ProximityPlacementGroupUpdate, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.compute.models.ProximityPlacementGroupUpdate or JSON or IO[bytes] + :return: ProximityPlacementGroup. The ProximityPlacementGroup is compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.ProximityPlacementGroup :raises ~azure.core.exceptions.HttpResponseError: """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._update_initial( - resource_group_name=resource_group_name, - vm_name=vm_name, - vm_extension_name=vm_extension_name, - extension_parameters=extension_parameters, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) + cls: ClsType[_models.ProximityPlacementGroup] = kwargs.pop("cls", None) - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore + content_type = content_type or "application/json" + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _request = build_proximity_placement_groups_update_request( + resource_group_name=resource_group_name, + proximity_placement_group_name=proximity_placement_group_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) path_format_arguments = { "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), } + _request.url = self._client.format_url(_request.url, **path_format_arguments) - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + deserialized = _deserialize(_models.ProximityPlacementGroup, response.json()) - def _delete_initial( - self, resource_group_name: str, vm_name: str, vm_extension_name: str, **kwargs: Any - ) -> Iterator[bytes]: + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # 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. The name is case insensitive. + Required. + :type resource_group_name: str + :param proximity_placement_group_name: The name of the proximity placement group. Required. + :type proximity_placement_group_name: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -22533,12 +21646,11 @@ def _delete_initial( _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + cls: ClsType[None] = kwargs.pop("cls", None) - _request = build_virtual_machine_extensions_delete_request( + _request = build_proximity_placement_groups_delete_request( resource_group_name=resource_group_name, - vm_name=vm_name, - vm_extension_name=vm_extension_name, + proximity_placement_group_name=proximity_placement_group_name, subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -22549,117 +21661,38 @@ def _delete_initial( } _request.url = self._client.format_url(_request.url, **path_format_arguments) - _stream = True + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200, 202, 204]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass + if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) error = _failsafe_deserialize(_models.CloudError, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.iter_bytes() - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore + return cls(pipeline_response, None, {}) # type: ignore @distributed_trace - def begin_delete( - self, resource_group_name: str, vm_name: str, vm_extension_name: str, **kwargs: Any - ) -> LROPoller[None]: - """The operation to delete the extension. + def list_by_resource_group( + self, resource_group_name: str, **kwargs: Any + ) -> ItemPaged["_models.ProximityPlacementGroup"]: + """Lists all proximity placement groups in a resource group. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param vm_name: The name of the virtual machine. Required. - :type vm_name: str - :param vm_extension_name: The name of the virtual machine extension. Required. - :type vm_extension_name: str - :return: An instance of LROPoller that returns None - :rtype: ~azure.core.polling.LROPoller[None] + :return: An iterator like instance of ProximityPlacementGroup + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.models.ProximityPlacementGroup] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - vm_name=vm_name, - vm_extension_name=vm_extension_name, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, vm_name: str, *, expand: Optional[str] = None, **kwargs: Any - ) -> ItemPaged["_models.VirtualMachineExtension"]: - """The operation to get all extensions of a Virtual Machine. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_name: The name of the virtual machine. Required. - :type vm_name: str - :keyword expand: The expand expression to apply on the operation. Default value is None. - :paramtype expand: str - :return: An iterator like instance of VirtualMachineExtension - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.models.VirtualMachineExtension] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[List[_models.VirtualMachineExtension]] = kwargs.pop("cls", None) + cls: ClsType[List[_models.ProximityPlacementGroup]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -22672,11 +21705,9 @@ def list( def prepare_request(next_link=None): if not next_link: - _request = build_virtual_machine_extensions_list_request( + _request = build_proximity_placement_groups_list_by_resource_group_request( resource_group_name=resource_group_name, - vm_name=vm_name, subscription_id=self._config.subscription_id, - expand=expand, api_version=self._config.api_version, headers=_headers, params=_params, @@ -22712,10 +21743,10 @@ def prepare_request(next_link=None): def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.VirtualMachineExtension], deserialized.get("value", [])) + list_of_elem = _deserialize(List[_models.ProximityPlacementGroup], deserialized.get("value", [])) if cls: list_of_elem = cls(list_of_elem) # type: ignore - return None, iter(list_of_elem) + return deserialized.get("nextLink") or None, iter(list_of_elem) def get_next(next_link=None): _request = prepare_request(next_link) @@ -22735,112 +21766,19 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - -class VirtualMachineExtensionImagesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.compute.ComputeClient`'s - :attr:`virtual_machine_extension_images` attribute. - """ - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ComputeClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def get( - self, location: str, publisher_name: str, type: str, version: str, **kwargs: Any - ) -> _models.VirtualMachineExtensionImage: - """Gets a virtual machine extension image. + def list_by_subscription(self, **kwargs: Any) -> ItemPaged["_models.ProximityPlacementGroup"]: + """Lists all proximity placement groups in a subscription. - :param location: The location name. Required. - :type location: str - :param publisher_name: Required. - :type publisher_name: str - :param type: Required. - :type type: str - :param version: Required. - :type version: str - :return: VirtualMachineExtensionImage. The VirtualMachineExtensionImage is compatible with - MutableMapping - :rtype: ~azure.mgmt.compute.models.VirtualMachineExtensionImage + :return: An iterator like instance of ProximityPlacementGroup + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.models.ProximityPlacementGroup] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.VirtualMachineExtensionImage] = kwargs.pop("cls", None) - - _request = build_virtual_machine_extension_images_get_request( - location=location, - publisher_name=publisher_name, - type=type, - version=version, - subscription_id=self._config.subscription_id, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = kwargs.pop("stream", False) - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - if _stream: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.CloudError, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if _stream: - deserialized = response.iter_bytes() - else: - deserialized = _deserialize(_models.VirtualMachineExtensionImage, response.json()) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. + cls: ClsType[List[_models.ProximityPlacementGroup]] = kwargs.pop("cls", None) - :param location: The location name. Required. - :type location: str - :param publisher_name: Required. - :type publisher_name: str - :return: list of VirtualMachineExtensionImage - :rtype: list[~azure.mgmt.compute.models.VirtualMachineExtensionImage] - :raises ~azure.core.exceptions.HttpResponseError: - """ error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -22849,147 +21787,78 @@ def list_types( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[List[_models.VirtualMachineExtensionImage]] = kwargs.pop("cls", None) - - _request = build_virtual_machine_extension_images_list_types_request( - location=location, - publisher_name=publisher_name, - subscription_id=self._config.subscription_id, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = kwargs.pop("stream", False) - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - if _stream: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.CloudError, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if _stream: - deserialized = response.iter_bytes() - else: - deserialized = _deserialize(List[_models.VirtualMachineExtensionImage], response.json()) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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 location name. Required. - :type location: str - :param publisher_name: Required. - :type publisher_name: str - :param type: Required. - :type type: str - :keyword filter: The filter to apply on the operation. Default value is None. - :paramtype filter: str - :keyword top: Default value is None. - :paramtype top: int - :keyword orderby: Default value is None. - :paramtype orderby: str - :return: list of VirtualMachineExtensionImage - :rtype: list[~azure.mgmt.compute.models.VirtualMachineExtensionImage] - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): + if not next_link: - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} + _request = build_proximity_placement_groups_list_by_subscription_request( + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) - cls: ClsType[List[_models.VirtualMachineExtensionImage]] = kwargs.pop("cls", None) + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) - _request = build_virtual_machine_extension_images_list_versions_request( - location=location, - publisher_name=publisher_name, - type=type, - subscription_id=self._config.subscription_id, - filter=filter, - top=top, - orderby=orderby, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) + return _request - _stream = kwargs.pop("stream", False) - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.ProximityPlacementGroup], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) - response = pipeline_response.http_response + def get_next(next_link=None): + _request = prepare_request(next_link) - if response.status_code not in [200]: - if _stream: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.CloudError, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response - if _stream: - deserialized = response.iter_bytes() - else: - deserialized = _deserialize(List[_models.VirtualMachineExtensionImage], response.json()) + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return pipeline_response - return deserialized # type: ignore + return ItemPaged(get_next, extract_data) -class AvailabilitySetsOperations: +class DedicatedHostGroupsOperations: """ .. warning:: **DO NOT** instantiate this class directly. Instead, you should access the following operations through :class:`~azure.mgmt.compute.ComputeClient`'s - :attr:`availability_sets` attribute. + :attr:`dedicated_host_groups` attribute. """ def __init__(self, *args, **kwargs) -> None: @@ -23000,16 +21869,28 @@ def __init__(self, *args, **kwargs) -> None: self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace - def get(self, resource_group_name: str, availability_set_name: str, **kwargs: Any) -> _models.AvailabilitySet: - """Retrieves information about an availability set. + 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. The name is case insensitive. Required. :type resource_group_name: str - :param availability_set_name: The name of the availability set. Required. - :type availability_set_name: str - :return: AvailabilitySet. The AvailabilitySet is compatible with MutableMapping - :rtype: ~azure.mgmt.compute.models.AvailabilitySet + :param host_group_name: The name of the dedicated host group. Required. + :type host_group_name: str + :keyword 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. Known values are: "instanceView", "userData", and + "resiliencyView". Default value is None. + :paramtype expand: str or ~azure.mgmt.compute.models.InstanceViewTypes + :return: DedicatedHostGroup. The DedicatedHostGroup is compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.DedicatedHostGroup :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -23023,12 +21904,13 @@ def get(self, resource_group_name: str, availability_set_name: str, **kwargs: An _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.AvailabilitySet] = kwargs.pop("cls", None) + cls: ClsType[_models.DedicatedHostGroup] = kwargs.pop("cls", None) - _request = build_availability_sets_get_request( + _request = build_dedicated_host_groups_get_request( resource_group_name=resource_group_name, - availability_set_name=availability_set_name, + host_group_name=host_group_name, subscription_id=self._config.subscription_id, + expand=expand, api_version=self._config.api_version, headers=_headers, params=_params, @@ -23058,7 +21940,7 @@ def get(self, resource_group_name: str, availability_set_name: str, **kwargs: An if _stream: deserialized = response.iter_bytes() else: - deserialized = _deserialize(_models.AvailabilitySet, response.json()) + deserialized = _deserialize(_models.DedicatedHostGroup, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -23069,26 +21951,29 @@ def get(self, resource_group_name: str, availability_set_name: str, **kwargs: An def create_or_update( self, resource_group_name: str, - availability_set_name: str, - parameters: _models.AvailabilitySet, + host_group_name: str, + parameters: _models.DedicatedHostGroup, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.AvailabilitySet: - """Create or update an availability set. + ) -> _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. The name is case insensitive. Required. :type resource_group_name: str - :param availability_set_name: The name of the availability set. Required. - :type availability_set_name: str - :param parameters: Parameters supplied to the Create Availability Set operation. Required. - :type parameters: ~azure.mgmt.compute.models.AvailabilitySet + :param host_group_name: The name of the dedicated host group. Required. + :type host_group_name: str + :param parameters: Parameters supplied to the Create Dedicated Host Group. Required. + :type parameters: ~azure.mgmt.compute.models.DedicatedHostGroup :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: AvailabilitySet. The AvailabilitySet is compatible with MutableMapping - :rtype: ~azure.mgmt.compute.models.AvailabilitySet + :return: DedicatedHostGroup. The DedicatedHostGroup is compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.DedicatedHostGroup :raises ~azure.core.exceptions.HttpResponseError: """ @@ -23096,26 +21981,29 @@ def create_or_update( def create_or_update( self, resource_group_name: str, - availability_set_name: str, + host_group_name: str, parameters: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.AvailabilitySet: - """Create or update an availability set. + ) -> _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. The name is case insensitive. Required. :type resource_group_name: str - :param availability_set_name: The name of the availability set. Required. - :type availability_set_name: str - :param parameters: Parameters supplied to the Create Availability Set operation. Required. + :param host_group_name: The name of the dedicated host group. Required. + :type host_group_name: str + :param parameters: Parameters supplied to the Create Dedicated Host Group. Required. :type parameters: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: AvailabilitySet. The AvailabilitySet is compatible with MutableMapping - :rtype: ~azure.mgmt.compute.models.AvailabilitySet + :return: DedicatedHostGroup. The DedicatedHostGroup is compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.DedicatedHostGroup :raises ~azure.core.exceptions.HttpResponseError: """ @@ -23123,26 +22011,29 @@ def create_or_update( def create_or_update( self, resource_group_name: str, - availability_set_name: str, + host_group_name: str, parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> _models.AvailabilitySet: - """Create or update an availability set. + ) -> _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. The name is case insensitive. Required. :type resource_group_name: str - :param availability_set_name: The name of the availability set. Required. - :type availability_set_name: str - :param parameters: Parameters supplied to the Create Availability Set operation. Required. + :param host_group_name: The name of the dedicated host group. Required. + :type host_group_name: str + :param parameters: Parameters supplied to the Create Dedicated Host Group. Required. :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: AvailabilitySet. The AvailabilitySet is compatible with MutableMapping - :rtype: ~azure.mgmt.compute.models.AvailabilitySet + :return: DedicatedHostGroup. The DedicatedHostGroup is compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.DedicatedHostGroup :raises ~azure.core.exceptions.HttpResponseError: """ @@ -23150,22 +22041,25 @@ def create_or_update( def create_or_update( self, resource_group_name: str, - availability_set_name: str, - parameters: Union[_models.AvailabilitySet, JSON, IO[bytes]], + host_group_name: str, + parameters: Union[_models.DedicatedHostGroup, JSON, IO[bytes]], **kwargs: Any - ) -> _models.AvailabilitySet: - """Create or update an availability set. + ) -> _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. The name is case insensitive. Required. :type resource_group_name: str - :param availability_set_name: The name of the availability set. Required. - :type availability_set_name: str - :param parameters: Parameters supplied to the Create Availability Set operation. Is one of the - following types: AvailabilitySet, JSON, IO[bytes] Required. - :type parameters: ~azure.mgmt.compute.models.AvailabilitySet or JSON or IO[bytes] - :return: AvailabilitySet. The AvailabilitySet is compatible with MutableMapping - :rtype: ~azure.mgmt.compute.models.AvailabilitySet + :param host_group_name: The name of the dedicated host group. Required. + :type host_group_name: str + :param parameters: Parameters supplied to the Create Dedicated Host Group. Is one of the + following types: DedicatedHostGroup, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.compute.models.DedicatedHostGroup or JSON or IO[bytes] + :return: DedicatedHostGroup. The DedicatedHostGroup is compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.DedicatedHostGroup :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -23180,7 +22074,7 @@ def create_or_update( _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AvailabilitySet] = kwargs.pop("cls", None) + cls: ClsType[_models.DedicatedHostGroup] = kwargs.pop("cls", None) content_type = content_type or "application/json" _content = None @@ -23189,9 +22083,9 @@ def create_or_update( else: _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - _request = build_availability_sets_create_or_update_request( + _request = build_dedicated_host_groups_create_or_update_request( resource_group_name=resource_group_name, - availability_set_name=availability_set_name, + host_group_name=host_group_name, subscription_id=self._config.subscription_id, content_type=content_type, api_version=self._config.api_version, @@ -23211,7 +22105,7 @@ def create_or_update( response = pipeline_response.http_response - if response.status_code not in [200]: + if response.status_code not in [200, 201]: if _stream: try: response.read() # Load the body in memory and close the socket @@ -23224,7 +22118,7 @@ def create_or_update( if _stream: deserialized = response.iter_bytes() else: - deserialized = _deserialize(_models.AvailabilitySet, response.json()) + deserialized = _deserialize(_models.DedicatedHostGroup, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -23235,26 +22129,26 @@ def create_or_update( def update( self, resource_group_name: str, - availability_set_name: str, - parameters: _models.AvailabilitySetUpdate, + host_group_name: str, + parameters: _models.DedicatedHostGroupUpdate, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.AvailabilitySet: - """Update an availability set. + ) -> _models.DedicatedHostGroup: + """Update an dedicated host group. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param availability_set_name: The name of the availability set. Required. - :type availability_set_name: str - :param parameters: Parameters supplied to the Update Availability Set operation. Required. - :type parameters: ~azure.mgmt.compute.models.AvailabilitySetUpdate + :param host_group_name: The name of the dedicated host group. Required. + :type host_group_name: str + :param parameters: Parameters supplied to the Update Dedicated Host Group operation. Required. + :type parameters: ~azure.mgmt.compute.models.DedicatedHostGroupUpdate :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: AvailabilitySet. The AvailabilitySet is compatible with MutableMapping - :rtype: ~azure.mgmt.compute.models.AvailabilitySet + :return: DedicatedHostGroup. The DedicatedHostGroup is compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.DedicatedHostGroup :raises ~azure.core.exceptions.HttpResponseError: """ @@ -23262,26 +22156,26 @@ def update( def update( self, resource_group_name: str, - availability_set_name: str, + host_group_name: str, parameters: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.AvailabilitySet: - """Update an availability set. + ) -> _models.DedicatedHostGroup: + """Update an dedicated host group. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param availability_set_name: The name of the availability set. Required. - :type availability_set_name: str - :param parameters: Parameters supplied to the Update Availability Set operation. Required. + :param host_group_name: The name of the dedicated host group. Required. + :type host_group_name: str + :param parameters: Parameters supplied to the Update Dedicated Host Group operation. Required. :type parameters: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: AvailabilitySet. The AvailabilitySet is compatible with MutableMapping - :rtype: ~azure.mgmt.compute.models.AvailabilitySet + :return: DedicatedHostGroup. The DedicatedHostGroup is compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.DedicatedHostGroup :raises ~azure.core.exceptions.HttpResponseError: """ @@ -23289,26 +22183,26 @@ def update( def update( self, resource_group_name: str, - availability_set_name: str, + host_group_name: str, parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> _models.AvailabilitySet: - """Update an availability set. - + ) -> _models.DedicatedHostGroup: + """Update an dedicated host group. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param availability_set_name: The name of the availability set. Required. - :type availability_set_name: str - :param parameters: Parameters supplied to the Update Availability Set operation. Required. + :param host_group_name: The name of the dedicated host group. Required. + :type host_group_name: str + :param parameters: Parameters supplied to the Update Dedicated Host Group operation. Required. :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: AvailabilitySet. The AvailabilitySet is compatible with MutableMapping - :rtype: ~azure.mgmt.compute.models.AvailabilitySet + :return: DedicatedHostGroup. The DedicatedHostGroup is compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.DedicatedHostGroup :raises ~azure.core.exceptions.HttpResponseError: """ @@ -23316,22 +22210,22 @@ def update( def update( self, resource_group_name: str, - availability_set_name: str, - parameters: Union[_models.AvailabilitySetUpdate, JSON, IO[bytes]], + host_group_name: str, + parameters: Union[_models.DedicatedHostGroupUpdate, JSON, IO[bytes]], **kwargs: Any - ) -> _models.AvailabilitySet: - """Update an availability set. + ) -> _models.DedicatedHostGroup: + """Update an dedicated host group. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param availability_set_name: The name of the availability set. Required. - :type availability_set_name: str - :param parameters: Parameters supplied to the Update Availability Set operation. Is one of the - following types: AvailabilitySetUpdate, JSON, IO[bytes] Required. - :type parameters: ~azure.mgmt.compute.models.AvailabilitySetUpdate or JSON or IO[bytes] - :return: AvailabilitySet. The AvailabilitySet is compatible with MutableMapping - :rtype: ~azure.mgmt.compute.models.AvailabilitySet + :param host_group_name: The name of the dedicated host group. Required. + :type host_group_name: str + :param parameters: Parameters supplied to the Update Dedicated Host Group operation. Is one of + the following types: DedicatedHostGroupUpdate, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.compute.models.DedicatedHostGroupUpdate or JSON or IO[bytes] + :return: DedicatedHostGroup. The DedicatedHostGroup is compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.DedicatedHostGroup :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -23346,7 +22240,7 @@ def update( _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AvailabilitySet] = kwargs.pop("cls", None) + cls: ClsType[_models.DedicatedHostGroup] = kwargs.pop("cls", None) content_type = content_type or "application/json" _content = None @@ -23355,9 +22249,9 @@ def update( else: _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - _request = build_availability_sets_update_request( + _request = build_dedicated_host_groups_update_request( resource_group_name=resource_group_name, - availability_set_name=availability_set_name, + host_group_name=host_group_name, subscription_id=self._config.subscription_id, content_type=content_type, api_version=self._config.api_version, @@ -23390,7 +22284,7 @@ def update( if _stream: deserialized = response.iter_bytes() else: - deserialized = _deserialize(_models.AvailabilitySet, response.json()) + deserialized = _deserialize(_models.DedicatedHostGroup, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -23399,15 +22293,15 @@ def update( @distributed_trace def delete( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, availability_set_name: str, **kwargs: Any + self, resource_group_name: str, host_group_name: str, **kwargs: Any ) -> None: - """Delete an availability set. + """Delete a dedicated host group. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param availability_set_name: The name of the availability set. Required. - :type availability_set_name: str + :param host_group_name: The name of the dedicated host group. Required. + :type host_group_name: str :return: None :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -23425,9 +22319,9 @@ def delete( # pylint: disable=inconsistent-return-statements cls: ClsType[None] = kwargs.pop("cls", None) - _request = build_availability_sets_delete_request( + _request = build_dedicated_host_groups_delete_request( resource_group_name=resource_group_name, - availability_set_name=availability_set_name, + host_group_name=host_group_name, subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -23454,20 +22348,23 @@ def delete( # pylint: disable=inconsistent-return-statements return cls(pipeline_response, None, {}) # type: ignore @distributed_trace - def list(self, resource_group_name: str, **kwargs: Any) -> ItemPaged["_models.AvailabilitySet"]: - """Lists all availability sets in a resource group. + def list_by_resource_group( + self, resource_group_name: str, **kwargs: Any + ) -> ItemPaged["_models.DedicatedHostGroup"]: + """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. The name is case insensitive. Required. :type resource_group_name: str - :return: An iterator like instance of AvailabilitySet - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.models.AvailabilitySet] + :return: An iterator like instance of DedicatedHostGroup + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.models.DedicatedHostGroup] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.AvailabilitySet]] = kwargs.pop("cls", None) + cls: ClsType[List[_models.DedicatedHostGroup]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -23480,7 +22377,7 @@ def list(self, resource_group_name: str, **kwargs: Any) -> ItemPaged["_models.Av def prepare_request(next_link=None): if not next_link: - _request = build_availability_sets_list_request( + _request = build_dedicated_host_groups_list_by_resource_group_request( resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, api_version=self._config.api_version, @@ -23518,97 +22415,7 @@ def prepare_request(next_link=None): def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.AvailabilitySet], deserialized.get("value", [])) - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.get("nextLink") or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.CloudError, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @distributed_trace - def list_by_subscription( - self, *, expand: Optional[str] = None, **kwargs: Any - ) -> ItemPaged["_models.AvailabilitySet"]: - """Lists all availability sets in a subscription. - - :keyword expand: The expand expression to apply to the operation. Allowed values are - 'instanceView'. Default value is None. - :paramtype expand: str - :return: An iterator like instance of AvailabilitySet - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.models.AvailabilitySet] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[List[_models.AvailabilitySet]] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_availability_sets_list_by_subscription_request( - subscription_id=self._config.subscription_id, - expand=expand, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - return _request - - def extract_data(pipeline_response): - deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.AvailabilitySet], deserialized.get("value", [])) + list_of_elem = _deserialize(List[_models.DedicatedHostGroup], deserialized.get("value", [])) if cls: list_of_elem = cls(list_of_elem) # type: ignore return deserialized.get("nextLink") or None, iter(list_of_elem) @@ -23632,25 +22439,18 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) @distributed_trace - def list_available_sizes( - self, resource_group_name: str, availability_set_name: str, **kwargs: Any - ) -> ItemPaged["_models.VirtualMachineSize"]: - """Lists all available virtual machine sizes that can be used to create a new virtual machine in - an existing availability set. + def list_by_subscription(self, **kwargs: Any) -> ItemPaged["_models.DedicatedHostGroup"]: + """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. - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param availability_set_name: The name of the availability set. Required. - :type availability_set_name: str - :return: An iterator like instance of VirtualMachineSize - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.models.VirtualMachineSize] + :return: An iterator like instance of DedicatedHostGroup + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.models.DedicatedHostGroup] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.VirtualMachineSize]] = kwargs.pop("cls", None) + cls: ClsType[List[_models.DedicatedHostGroup]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -23663,9 +22463,7 @@ def list_available_sizes( def prepare_request(next_link=None): if not next_link: - _request = build_availability_sets_list_available_sizes_request( - resource_group_name=resource_group_name, - availability_set_name=availability_set_name, + _request = build_dedicated_host_groups_list_by_subscription_request( subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -23702,7 +22500,7 @@ def prepare_request(next_link=None): def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.VirtualMachineSize], deserialized.get("value", [])) + list_of_elem = _deserialize(List[_models.DedicatedHostGroup], deserialized.get("value", [])) if cls: list_of_elem = cls(list_of_elem) # type: ignore return deserialized.get("nextLink") or None, iter(list_of_elem) @@ -23725,119 +22523,50 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - @overload - def start_migration_to_virtual_machine_scale_set( # pylint: disable=name-too-long - self, - resource_group_name: str, - availability_set_name: str, - parameters: _models.MigrateToVirtualMachineScaleSetInput, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> None: - """Start migration operation on an Availability Set to move its Virtual Machines to a Virtual - Machine Scale Set. This should be followed by a migrate operation on each Virtual Machine that - triggers a downtime on the Virtual Machine. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param availability_set_name: The name of the availability set. Required. - :type availability_set_name: str - :param parameters: Parameters supplied to the migrate operation on the availability set. - Required. - :type parameters: ~azure.mgmt.compute.models.MigrateToVirtualMachineScaleSetInput - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def start_migration_to_virtual_machine_scale_set( # pylint: disable=name-too-long - self, - resource_group_name: str, - availability_set_name: str, - parameters: JSON, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> None: - """Start migration operation on an Availability Set to move its Virtual Machines to a Virtual - Machine Scale Set. This should be followed by a migrate operation on each Virtual Machine that - triggers a downtime on the Virtual Machine. - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param availability_set_name: The name of the availability set. Required. - :type availability_set_name: str - :param parameters: Parameters supplied to the migrate operation on the availability set. - Required. - :type parameters: JSON - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ +class DedicatedHostsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - @overload - def start_migration_to_virtual_machine_scale_set( # pylint: disable=name-too-long - self, - resource_group_name: str, - availability_set_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> None: - """Start migration operation on an Availability Set to move its Virtual Machines to a Virtual - Machine Scale Set. This should be followed by a migrate operation on each Virtual Machine that - triggers a downtime on the Virtual Machine. + Instead, you should access the following operations through + :class:`~azure.mgmt.compute.ComputeClient`'s + :attr:`dedicated_hosts` attribute. + """ - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param availability_set_name: The name of the availability set. Required. - :type availability_set_name: str - :param parameters: Parameters supplied to the migrate operation on the availability set. - Required. - :type parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace - def start_migration_to_virtual_machine_scale_set( # pylint: disable=inconsistent-return-statements,name-too-long + def get( self, resource_group_name: str, - availability_set_name: str, - parameters: Union[_models.MigrateToVirtualMachineScaleSetInput, JSON, IO[bytes]], + host_group_name: str, + host_name: str, + *, + expand: Optional[Union[str, _models.InstanceViewTypes]] = None, **kwargs: Any - ) -> None: - """Start migration operation on an Availability Set to move its Virtual Machines to a Virtual - Machine Scale Set. This should be followed by a migrate operation on each Virtual Machine that - triggers a downtime on the Virtual Machine. + ) -> _models.DedicatedHost: + """Retrieves information about a dedicated host. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param availability_set_name: The name of the availability set. Required. - :type availability_set_name: str - :param parameters: Parameters supplied to the migrate operation on the availability set. Is one - of the following types: MigrateToVirtualMachineScaleSetInput, JSON, IO[bytes] Required. - :type parameters: ~azure.mgmt.compute.models.MigrateToVirtualMachineScaleSetInput or JSON or - IO[bytes] - :return: None - :rtype: None + :param host_group_name: The name of the dedicated host group. Required. + :type host_group_name: str + :param host_name: The name of the dedicated host. Required. + :type host_name: str + :keyword 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. Known values are: "instanceView", "userData", and "resiliencyView". Default value is + None. + :paramtype expand: str or ~azure.mgmt.compute.models.InstanceViewTypes + :return: DedicatedHost. The DedicatedHost is compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.DedicatedHost :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -23848,26 +22577,18 @@ def start_migration_to_virtual_machine_scale_set( # pylint: disable=inconsisten } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + cls: ClsType[_models.DedicatedHost] = kwargs.pop("cls", None) - _request = build_availability_sets_start_migration_to_virtual_machine_scale_set_request( + _request = build_dedicated_hosts_get_request( resource_group_name=resource_group_name, - availability_set_name=availability_set_name, + host_group_name=host_group_name, + host_name=host_name, subscription_id=self._config.subscription_id, - content_type=content_type, + expand=expand, api_version=self._config.api_version, - content=_content, headers=_headers, params=_params, ) @@ -23876,36 +22597,41 @@ def start_migration_to_virtual_machine_scale_set( # pylint: disable=inconsisten } _request.url = self._client.format_url(_request.url, **path_format_arguments) - _stream = False + _stream = kwargs.pop("stream", False) pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [204]: + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = _failsafe_deserialize(_models.CloudError, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.DedicatedHost, response.json()) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore - @distributed_trace - def cancel_migration_to_virtual_machine_scale_set( # pylint: disable=inconsistent-return-statements,name-too-long - self, resource_group_name: str, availability_set_name: str, **kwargs: Any - ) -> None: - """Cancel the migration operation on an Availability Set. + return deserialized # type: ignore - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param availability_set_name: The name of the availability set. Required. - :type availability_set_name: str - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ + def _create_or_update_initial( + self, + resource_group_name: str, + host_group_name: str, + host_name: str, + parameters: Union[_models.DedicatedHost, JSON, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -23914,16 +22640,27 @@ def cancel_migration_to_virtual_machine_scale_set( # pylint: disable=inconsiste } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - cls: ClsType[None] = kwargs.pop("cls", None) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - _request = build_availability_sets_cancel_migration_to_virtual_machine_scale_set_request( + content_type = content_type or "application/json" + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_dedicated_hosts_create_or_update_request( resource_group_name=resource_group_name, - availability_set_name=availability_set_name, + host_group_name=host_group_name, + host_name=host_name, subscription_id=self._config.subscription_id, + content_type=content_type, api_version=self._config.api_version, + content=_content, headers=_headers, params=_params, ) @@ -23932,188 +22669,212 @@ def cancel_migration_to_virtual_machine_scale_set( # pylint: disable=inconsiste } _request.url = self._client.format_url(_request.url, **path_format_arguments) - _stream = False + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [204]: + if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = _failsafe_deserialize(_models.CloudError, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 201: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore @overload - def validate_migration_to_virtual_machine_scale_set( # pylint: disable=name-too-long + def begin_create_or_update( self, resource_group_name: str, - availability_set_name: str, - parameters: _models.MigrateToVirtualMachineScaleSetInput, + host_group_name: str, + host_name: str, + parameters: _models.DedicatedHost, *, content_type: str = "application/json", **kwargs: Any - ) -> None: - """Validates that the Virtual Machines in the Availability Set can be migrated to the provided - Virtual Machine Scale Set. + ) -> LROPoller[_models.DedicatedHost]: + """Create or update a dedicated host . :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param availability_set_name: The name of the availability set. Required. - :type availability_set_name: str - :param parameters: Parameters supplied to the migrate operation on the availability set. - Required. - :type parameters: ~azure.mgmt.compute.models.MigrateToVirtualMachineScaleSetInput + :param host_group_name: The name of the dedicated host group. Required. + :type host_group_name: str + :param host_name: The name of the dedicated host. Required. + :type host_name: str + :param parameters: Parameters supplied to the Create Dedicated Host. Required. + :type parameters: ~azure.mgmt.compute.models.DedicatedHost :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: None - :rtype: None + :return: An instance of LROPoller that returns DedicatedHost. The DedicatedHost is compatible + with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.DedicatedHost] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def validate_migration_to_virtual_machine_scale_set( # pylint: disable=name-too-long + def begin_create_or_update( self, resource_group_name: str, - availability_set_name: str, + host_group_name: str, + host_name: str, parameters: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> None: - """Validates that the Virtual Machines in the Availability Set can be migrated to the provided - Virtual Machine Scale Set. + ) -> LROPoller[_models.DedicatedHost]: + """Create or update a dedicated host . :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param availability_set_name: The name of the availability set. Required. - :type availability_set_name: str - :param parameters: Parameters supplied to the migrate operation on the availability set. - Required. + :param host_group_name: The name of the dedicated host group. Required. + :type host_group_name: str + :param host_name: The name of the dedicated host. Required. + :type host_name: str + :param parameters: Parameters supplied to the Create Dedicated Host. Required. :type parameters: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: None - :rtype: None + :return: An instance of LROPoller that returns DedicatedHost. The DedicatedHost is compatible + with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.DedicatedHost] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def validate_migration_to_virtual_machine_scale_set( # pylint: disable=name-too-long + def begin_create_or_update( self, resource_group_name: str, - availability_set_name: str, + host_group_name: str, + host_name: str, parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> None: - """Validates that the Virtual Machines in the Availability Set can be migrated to the provided - Virtual Machine Scale Set. + ) -> LROPoller[_models.DedicatedHost]: + """Create or update a dedicated host . :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param availability_set_name: The name of the availability set. Required. - :type availability_set_name: str - :param parameters: Parameters supplied to the migrate operation on the availability set. - Required. + :param host_group_name: The name of the dedicated host group. Required. + :type host_group_name: str + :param host_name: The name of the dedicated host. Required. + :type host_name: str + :param parameters: Parameters supplied to the Create Dedicated Host. Required. :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: None - :rtype: None + :return: An instance of LROPoller that returns DedicatedHost. The DedicatedHost is compatible + with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.DedicatedHost] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace - def validate_migration_to_virtual_machine_scale_set( # pylint: disable=inconsistent-return-statements,name-too-long + def begin_create_or_update( self, resource_group_name: str, - availability_set_name: str, - parameters: Union[_models.MigrateToVirtualMachineScaleSetInput, JSON, IO[bytes]], + host_group_name: str, + host_name: str, + parameters: Union[_models.DedicatedHost, JSON, IO[bytes]], **kwargs: Any - ) -> None: - """Validates that the Virtual Machines in the Availability Set can be migrated to the provided - Virtual Machine Scale Set. + ) -> LROPoller[_models.DedicatedHost]: + """Create or update a dedicated host . :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param availability_set_name: The name of the availability set. Required. - :type availability_set_name: str - :param parameters: Parameters supplied to the migrate operation on the availability set. Is one - of the following types: MigrateToVirtualMachineScaleSetInput, JSON, IO[bytes] Required. - :type parameters: ~azure.mgmt.compute.models.MigrateToVirtualMachineScaleSetInput or JSON or - IO[bytes] - :return: None - :rtype: None + :param host_group_name: The name of the dedicated host group. Required. + :type host_group_name: str + :param host_name: The name of the dedicated host. Required. + :type host_name: str + :param parameters: Parameters supplied to the Create Dedicated Host. Is one of the following + types: DedicatedHost, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.compute.models.DedicatedHost or JSON or IO[bytes] + :return: An instance of LROPoller that returns DedicatedHost. The DedicatedHost is compatible + with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.DedicatedHost] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[_models.DedicatedHost] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + host_group_name=host_group_name, + host_name=host_name, + parameters=parameters, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) - content_type = content_type or "application/json" - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.DedicatedHost, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized - _request = build_availability_sets_validate_migration_to_virtual_machine_scale_set_request( - resource_group_name=resource_group_name, - availability_set_name=availability_set_name, - subscription_id=self._config.subscription_id, - content_type=content_type, - api_version=self._config.api_version, - content=_content, - headers=_headers, - params=_params, - ) path_format_arguments = { "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.DedicatedHost].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.DedicatedHost]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - 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) - error = _failsafe_deserialize(_models.CloudError, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - def _convert_to_virtual_machine_scale_set_initial( # pylint: disable=name-too-long + def _update_initial( self, resource_group_name: str, - availability_set_name: str, - parameters: Optional[Union[_models.ConvertToVirtualMachineScaleSetInput, JSON, IO[bytes]]] = None, + host_group_name: str, + host_name: str, + parameters: Union[_models.DedicatedHostUpdate, JSON, IO[bytes]], **kwargs: Any ) -> Iterator[bytes]: error_map: MutableMapping = { @@ -24128,22 +22889,19 @@ def _convert_to_virtual_machine_scale_set_initial( # pylint: disable=name-too-l _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - content_type = content_type if parameters else None cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - content_type = content_type or "application/json" if parameters else None + content_type = content_type or "application/json" _content = None if isinstance(parameters, (IOBase, bytes)): _content = parameters else: - if parameters is not None: - _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - else: - _content = None + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - _request = build_availability_sets_convert_to_virtual_machine_scale_set_request( + _request = build_dedicated_hosts_update_request( resource_group_name=resource_group_name, - availability_set_name=availability_set_name, + host_group_name=host_group_name, + host_name=host_name, subscription_id=self._config.subscription_id, content_type=content_type, api_version=self._config.api_version, @@ -24163,7 +22921,7 @@ def _convert_to_virtual_machine_scale_set_initial( # pylint: disable=name-too-l response = pipeline_response.http_response - if response.status_code not in [202]: + if response.status_code not in [200]: try: response.read() # Load the body in memory and close the socket except (StreamConsumedError, StreamClosedError): @@ -24184,130 +22942,137 @@ def _convert_to_virtual_machine_scale_set_initial( # pylint: disable=name-too-l return deserialized # type: ignore @overload - def begin_convert_to_virtual_machine_scale_set( # pylint: disable=name-too-long + def begin_update( self, resource_group_name: str, - availability_set_name: str, - parameters: Optional[_models.ConvertToVirtualMachineScaleSetInput] = None, + host_group_name: str, + host_name: str, + parameters: _models.DedicatedHostUpdate, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[None]: - """Create a new Flexible Virtual Machine Scale Set and migrate all the Virtual Machines in the - Availability Set. This does not trigger a downtime on the Virtual Machines. + ) -> LROPoller[_models.DedicatedHost]: + """Update a dedicated host . :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param availability_set_name: The name of the availability set. Required. - :type availability_set_name: str - :param parameters: Parameters supplied to the migrate operation on the availability set. - Default value is None. - :type parameters: ~azure.mgmt.compute.models.ConvertToVirtualMachineScaleSetInput + :param host_group_name: The name of the dedicated host group. Required. + :type host_group_name: str + :param host_name: The name of the dedicated host. Required. + :type host_name: str + :param parameters: Parameters supplied to the Update Dedicated Host operation. Required. + :type parameters: ~azure.mgmt.compute.models.DedicatedHostUpdate :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns None - :rtype: ~azure.core.polling.LROPoller[None] + :return: An instance of LROPoller that returns DedicatedHost. The DedicatedHost is compatible + with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.DedicatedHost] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def begin_convert_to_virtual_machine_scale_set( # pylint: disable=name-too-long + def begin_update( self, resource_group_name: str, - availability_set_name: str, - parameters: Optional[JSON] = None, + host_group_name: str, + host_name: str, + parameters: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[None]: - """Create a new Flexible Virtual Machine Scale Set and migrate all the Virtual Machines in the - Availability Set. This does not trigger a downtime on the Virtual Machines. + ) -> LROPoller[_models.DedicatedHost]: + """Update a dedicated host . :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param availability_set_name: The name of the availability set. Required. - :type availability_set_name: str - :param parameters: Parameters supplied to the migrate operation on the availability set. - Default value is None. + :param host_group_name: The name of the dedicated host group. Required. + :type host_group_name: str + :param host_name: The name of the dedicated host. Required. + :type host_name: str + :param parameters: Parameters supplied to the Update Dedicated Host operation. Required. :type parameters: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns None - :rtype: ~azure.core.polling.LROPoller[None] + :return: An instance of LROPoller that returns DedicatedHost. The DedicatedHost is compatible + with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.DedicatedHost] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def begin_convert_to_virtual_machine_scale_set( # pylint: disable=name-too-long + def begin_update( self, resource_group_name: str, - availability_set_name: str, - parameters: Optional[IO[bytes]] = None, + host_group_name: str, + host_name: str, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[None]: - """Create a new Flexible Virtual Machine Scale Set and migrate all the Virtual Machines in the - Availability Set. This does not trigger a downtime on the Virtual Machines. + ) -> LROPoller[_models.DedicatedHost]: + """Update a dedicated host . :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param availability_set_name: The name of the availability set. Required. - :type availability_set_name: str - :param parameters: Parameters supplied to the migrate operation on the availability set. - Default value is None. + :param host_group_name: The name of the dedicated host group. Required. + :type host_group_name: str + :param host_name: The name of the dedicated host. Required. + :type host_name: str + :param parameters: Parameters supplied to the Update Dedicated Host operation. Required. :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns None - :rtype: ~azure.core.polling.LROPoller[None] + :return: An instance of LROPoller that returns DedicatedHost. The DedicatedHost is compatible + with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.DedicatedHost] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace - def begin_convert_to_virtual_machine_scale_set( # pylint: disable=name-too-long + def begin_update( self, resource_group_name: str, - availability_set_name: str, - parameters: Optional[Union[_models.ConvertToVirtualMachineScaleSetInput, JSON, IO[bytes]]] = None, + host_group_name: str, + host_name: str, + parameters: Union[_models.DedicatedHostUpdate, JSON, IO[bytes]], **kwargs: Any - ) -> LROPoller[None]: - """Create a new Flexible Virtual Machine Scale Set and migrate all the Virtual Machines in the - Availability Set. This does not trigger a downtime on the Virtual Machines. + ) -> LROPoller[_models.DedicatedHost]: + """Update a dedicated host . :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param availability_set_name: The name of the availability set. Required. - :type availability_set_name: str - :param parameters: Parameters supplied to the migrate operation on the availability set. Is one - of the following types: ConvertToVirtualMachineScaleSetInput, JSON, IO[bytes] Default value is - None. - :type parameters: ~azure.mgmt.compute.models.ConvertToVirtualMachineScaleSetInput or JSON or - IO[bytes] - :return: An instance of LROPoller that returns None - :rtype: ~azure.core.polling.LROPoller[None] + :param host_group_name: The name of the dedicated host group. Required. + :type host_group_name: str + :param host_name: The name of the dedicated host. Required. + :type host_name: str + :param parameters: Parameters supplied to the Update Dedicated Host operation. Is one of the + following types: DedicatedHostUpdate, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.compute.models.DedicatedHostUpdate or JSON or IO[bytes] + :return: An instance of LROPoller that returns DedicatedHost. The DedicatedHost is compatible + with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.DedicatedHost] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - content_type = content_type if parameters else None - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[_models.DedicatedHost] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._convert_to_virtual_machine_scale_set_initial( + raw_result = self._update_initial( resource_group_name=resource_group_name, - availability_set_name=availability_set_name, + host_group_name=host_group_name, + host_name=host_name, parameters=parameters, content_type=content_type, cls=lambda x, y, z: x, @@ -24318,9 +23083,16 @@ def begin_convert_to_virtual_machine_scale_set( # pylint: disable=name-too-long raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = _deserialize(_models.DedicatedHost, response.json()) if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore + return deserialized path_format_arguments = { "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), @@ -24335,55 +23107,19 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return LROPoller[None].from_continuation_token( + return LROPoller[_models.DedicatedHost].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - -class ProximityPlacementGroupsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.compute.ComputeClient`'s - :attr:`proximity_placement_groups` attribute. - """ - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ComputeClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @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 . + return LROPoller[_models.DedicatedHost]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param proximity_placement_group_name: The name of the proximity placement group. Required. - :type proximity_placement_group_name: str - :keyword include_colocation_status: includeColocationStatus=true enables fetching the - colocation status of all the resources in the proximity placement group. Default value is None. - :paramtype include_colocation_status: str - :return: ProximityPlacementGroup. The ProximityPlacementGroup is compatible with MutableMapping - :rtype: ~azure.mgmt.compute.models.ProximityPlacementGroup - :raises ~azure.core.exceptions.HttpResponseError: - """ + def _delete_initial( + self, resource_group_name: str, host_group_name: str, host_name: str, **kwargs: Any + ) -> Iterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -24395,13 +23131,13 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.ProximityPlacementGroup] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - _request = build_proximity_placement_groups_get_request( + _request = build_dedicated_hosts_delete_request( resource_group_name=resource_group_name, - proximity_placement_group_name=proximity_placement_group_name, + host_group_name=host_group_name, + host_name=host_name, subscription_id=self._config.subscription_id, - include_colocation_status=include_colocation_status, api_version=self._config.api_version, headers=_headers, params=_params, @@ -24411,139 +23147,117 @@ def get( } _request.url = self._client.format_url(_request.url, **path_format_arguments) - _stream = kwargs.pop("stream", False) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200]: - if _stream: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass + if response.status_code not in [200, 202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = _failsafe_deserialize(_models.CloudError, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if _stream: - deserialized = response.iter_bytes() - else: - deserialized = _deserialize(_models.ProximityPlacementGroup, response.json()) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore - @overload - def create_or_update( - self, - resource_group_name: str, - proximity_placement_group_name: str, - parameters: _models.ProximityPlacementGroup, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.ProximityPlacementGroup: - """Create or update a proximity placement group. + @distributed_trace + def begin_delete( + 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. The name is case insensitive. Required. :type resource_group_name: str - :param proximity_placement_group_name: The name of the proximity placement group. Required. - :type proximity_placement_group_name: str - :param parameters: Parameters supplied to the Create Proximity Placement Group operation. - Required. - :type parameters: ~azure.mgmt.compute.models.ProximityPlacementGroup - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: ProximityPlacementGroup. The ProximityPlacementGroup is compatible with MutableMapping - :rtype: ~azure.mgmt.compute.models.ProximityPlacementGroup + :param host_group_name: The name of the dedicated host group. Required. + :type host_group_name: str + :param host_name: The name of the dedicated host. Required. + :type host_name: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} - @overload - def create_or_update( - self, - resource_group_name: str, - proximity_placement_group_name: str, - parameters: JSON, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.ProximityPlacementGroup: - """Create or update a proximity placement group. + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + host_group_name=host_group_name, + host_name=host_name, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param proximity_placement_group_name: The name of the proximity placement group. Required. - :type proximity_placement_group_name: str - :param parameters: Parameters supplied to the Create Proximity Placement Group operation. - Required. - :type parameters: JSON - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: ProximityPlacementGroup. The ProximityPlacementGroup is compatible with MutableMapping - :rtype: ~azure.mgmt.compute.models.ProximityPlacementGroup - :raises ~azure.core.exceptions.HttpResponseError: - """ + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore - @overload - def create_or_update( - self, - resource_group_name: str, - proximity_placement_group_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.ProximityPlacementGroup: - """Create or update a proximity placement group. + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param proximity_placement_group_name: The name of the proximity placement group. Required. - :type proximity_placement_group_name: str - :param parameters: Parameters supplied to the Create Proximity Placement Group operation. - Required. - :type parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: ProximityPlacementGroup. The ProximityPlacementGroup is compatible with MutableMapping - :rtype: ~azure.mgmt.compute.models.ProximityPlacementGroup - :raises ~azure.core.exceptions.HttpResponseError: - """ + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore @distributed_trace - def create_or_update( - self, - resource_group_name: str, - proximity_placement_group_name: str, - parameters: Union[_models.ProximityPlacementGroup, JSON, IO[bytes]], - **kwargs: Any - ) -> _models.ProximityPlacementGroup: - """Create or update a proximity placement group. + def list_by_host_group( + self, resource_group_name: str, host_group_name: str, **kwargs: Any + ) -> ItemPaged["_models.DedicatedHost"]: + """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. The name is case insensitive. Required. :type resource_group_name: str - :param proximity_placement_group_name: The name of the proximity placement group. Required. - :type proximity_placement_group_name: str - :param parameters: Parameters supplied to the Create Proximity Placement Group operation. Is - one of the following types: ProximityPlacementGroup, JSON, IO[bytes] Required. - :type parameters: ~azure.mgmt.compute.models.ProximityPlacementGroup or JSON or IO[bytes] - :return: ProximityPlacementGroup. The ProximityPlacementGroup is compatible with MutableMapping - :rtype: ~azure.mgmt.compute.models.ProximityPlacementGroup + :param host_group_name: The name of the dedicated host group. Required. + :type host_group_name: str + :return: An iterator like instance of DedicatedHost + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.models.DedicatedHost] :raises ~azure.core.exceptions.HttpResponseError: """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.DedicatedHost]] = kwargs.pop("cls", None) + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -24552,354 +23266,49 @@ def create_or_update( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} + def prepare_request(next_link=None): + if not next_link: - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ProximityPlacementGroup] = kwargs.pop("cls", None) + _request = build_dedicated_hosts_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=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) - content_type = content_type or "application/json" - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) - _request = build_proximity_placement_groups_create_or_update_request( - resource_group_name=resource_group_name, - proximity_placement_group_name=proximity_placement_group_name, - subscription_id=self._config.subscription_id, - content_type=content_type, - api_version=self._config.api_version, - content=_content, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = kwargs.pop("stream", False) - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - if _stream: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.CloudError, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if _stream: - deserialized = response.iter_bytes() - else: - deserialized = _deserialize(_models.ProximityPlacementGroup, response.json()) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def update( - self, - resource_group_name: str, - proximity_placement_group_name: str, - parameters: _models.ProximityPlacementGroupUpdate, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.ProximityPlacementGroup: - """Update a proximity placement group. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param proximity_placement_group_name: The name of the proximity placement group. Required. - :type proximity_placement_group_name: str - :param parameters: Parameters supplied to the Update Proximity Placement Group operation. - Required. - :type parameters: ~azure.mgmt.compute.models.ProximityPlacementGroupUpdate - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: ProximityPlacementGroup. The ProximityPlacementGroup is compatible with MutableMapping - :rtype: ~azure.mgmt.compute.models.ProximityPlacementGroup - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def update( - self, - resource_group_name: str, - proximity_placement_group_name: str, - parameters: JSON, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.ProximityPlacementGroup: - """Update a proximity placement group. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param proximity_placement_group_name: The name of the proximity placement group. Required. - :type proximity_placement_group_name: str - :param parameters: Parameters supplied to the Update Proximity Placement Group operation. - Required. - :type parameters: JSON - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: ProximityPlacementGroup. The ProximityPlacementGroup is compatible with MutableMapping - :rtype: ~azure.mgmt.compute.models.ProximityPlacementGroup - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def update( - self, - resource_group_name: str, - proximity_placement_group_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.ProximityPlacementGroup: - """Update a proximity placement group. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param proximity_placement_group_name: The name of the proximity placement group. Required. - :type proximity_placement_group_name: str - :param parameters: Parameters supplied to the Update Proximity Placement Group operation. - Required. - :type parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: ProximityPlacementGroup. The ProximityPlacementGroup is compatible with MutableMapping - :rtype: ~azure.mgmt.compute.models.ProximityPlacementGroup - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def update( - self, - resource_group_name: str, - proximity_placement_group_name: str, - parameters: Union[_models.ProximityPlacementGroupUpdate, JSON, IO[bytes]], - **kwargs: Any - ) -> _models.ProximityPlacementGroup: - """Update a proximity placement group. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param proximity_placement_group_name: The name of the proximity placement group. Required. - :type proximity_placement_group_name: str - :param parameters: Parameters supplied to the Update Proximity Placement Group operation. Is - one of the following types: ProximityPlacementGroupUpdate, JSON, IO[bytes] Required. - :type parameters: ~azure.mgmt.compute.models.ProximityPlacementGroupUpdate or JSON or IO[bytes] - :return: ProximityPlacementGroup. The ProximityPlacementGroup is compatible with MutableMapping - :rtype: ~azure.mgmt.compute.models.ProximityPlacementGroup - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} - - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ProximityPlacementGroup] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - - _request = build_proximity_placement_groups_update_request( - resource_group_name=resource_group_name, - proximity_placement_group_name=proximity_placement_group_name, - subscription_id=self._config.subscription_id, - content_type=content_type, - api_version=self._config.api_version, - content=_content, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = kwargs.pop("stream", False) - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - if _stream: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.CloudError, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if _stream: - deserialized = response.iter_bytes() - else: - deserialized = _deserialize(_models.ProximityPlacementGroup, response.json()) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. The name is case insensitive. - Required. - :type resource_group_name: str - :param proximity_placement_group_name: The name of the proximity placement group. Required. - :type proximity_placement_group_name: str - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_proximity_placement_groups_delete_request( - resource_group_name=resource_group_name, - proximity_placement_group_name=proximity_placement_group_name, - subscription_id=self._config.subscription_id, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.CloudError, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @distributed_trace - def list_by_resource_group( - self, resource_group_name: str, **kwargs: Any - ) -> ItemPaged["_models.ProximityPlacementGroup"]: - """Lists all proximity placement groups in a resource group. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :return: An iterator like instance of ProximityPlacementGroup - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.models.ProximityPlacementGroup] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[List[_models.ProximityPlacementGroup]] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_proximity_placement_groups_list_by_resource_group_request( - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - return _request + return _request def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.ProximityPlacementGroup], deserialized.get("value", [])) + list_of_elem = _deserialize(List[_models.DedicatedHost], deserialized.get("value", [])) if cls: list_of_elem = cls(list_of_elem) # type: ignore return deserialized.get("nextLink") or None, iter(list_of_elem) @@ -24923,17 +23332,28 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) @distributed_trace - def list_by_subscription(self, **kwargs: Any) -> ItemPaged["_models.ProximityPlacementGroup"]: - """Lists all proximity placement groups in a subscription. + def list_available_sizes( + self, resource_group_name: str, host_group_name: str, host_name: str, **kwargs: Any + ) -> ItemPaged[str]: + """Lists all available dedicated host sizes to which the specified dedicated host can be resized. + NOTE: The dedicated host sizes provided can be used to only scale up the existing dedicated + host. - :return: An iterator like instance of ProximityPlacementGroup - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.models.ProximityPlacementGroup] + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param host_group_name: The name of the dedicated host group. Required. + :type host_group_name: str + :param host_name: The name of the dedicated host. Required. + :type host_name: str + :return: An iterator like instance of str + :rtype: ~azure.core.paging.ItemPaged[str] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.ProximityPlacementGroup]] = kwargs.pop("cls", None) + cls: ClsType[List[str]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -24946,7 +23366,10 @@ def list_by_subscription(self, **kwargs: Any) -> ItemPaged["_models.ProximityPla def prepare_request(next_link=None): if not next_link: - _request = build_proximity_placement_groups_list_by_subscription_request( + _request = build_dedicated_hosts_list_available_sizes_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=self._config.api_version, headers=_headers, @@ -24983,7 +23406,7 @@ def prepare_request(next_link=None): def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.ProximityPlacementGroup], deserialized.get("value", [])) + list_of_elem = _deserialize(List[str], deserialized.get("value", [])) if cls: list_of_elem = cls(list_of_elem) # type: ignore return deserialized.get("nextLink") or None, iter(list_of_elem) @@ -25006,49 +23429,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - -class DedicatedHostGroupsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.compute.ComputeClient`'s - :attr:`dedicated_host_groups` attribute. - """ - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ComputeClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @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. The name is case insensitive. - Required. - :type resource_group_name: str - :param host_group_name: The name of the dedicated host group. Required. - :type host_group_name: str - :keyword 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. Known values are: "instanceView", "userData", and - "resiliencyView". Default value is None. - :paramtype expand: str or ~azure.mgmt.compute.models.InstanceViewTypes - :return: DedicatedHostGroup. The DedicatedHostGroup is compatible with MutableMapping - :rtype: ~azure.mgmt.compute.models.DedicatedHostGroup - :raises ~azure.core.exceptions.HttpResponseError: - """ + def _redeploy_initial( + self, resource_group_name: str, host_group_name: str, host_name: str, **kwargs: Any + ) -> Iterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -25060,13 +23443,13 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.DedicatedHostGroup] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - _request = build_dedicated_host_groups_get_request( + _request = build_dedicated_hosts_redeploy_request( resource_group_name=resource_group_name, host_group_name=host_group_name, + host_name=host_name, subscription_id=self._config.subscription_id, - expand=expand, api_version=self._config.api_version, headers=_headers, params=_params, @@ -25076,146 +23459,255 @@ def get( } _request.url = self._client.format_url(_request.url, **path_format_arguments) - _stream = kwargs.pop("stream", False) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200]: - if _stream: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass + if response.status_code not in [202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = _failsafe_deserialize(_models.CloudError, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if _stream: - deserialized = response.iter_bytes() - else: - deserialized = _deserialize(_models.DedicatedHostGroup, response.json()) + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore - @overload - def create_or_update( - self, - resource_group_name: str, - host_group_name: str, - parameters: _models.DedicatedHostGroup, - *, - content_type: str = "application/json", - **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 - `_). + @distributed_trace + def begin_redeploy( + self, resource_group_name: str, host_group_name: str, host_name: str, **kwargs: Any + ) -> LROPoller[None]: + """Redeploy the dedicated host. The operation will complete successfully once the dedicated host + has migrated to a new node and is running. To determine the health of VMs deployed on the + dedicated host after the redeploy check the Resource Health Center in the Azure Portal. Please + refer to `https://docs.microsoft.com/azure/service-health/resource-health-overview + `_ for more details. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param host_group_name: The name of the dedicated host group. Required. :type host_group_name: str - :param parameters: Parameters supplied to the Create Dedicated Host Group. Required. - :type parameters: ~azure.mgmt.compute.models.DedicatedHostGroup - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: DedicatedHostGroup. The DedicatedHostGroup is compatible with MutableMapping - :rtype: ~azure.mgmt.compute.models.DedicatedHostGroup + :param host_name: The name of the dedicated host. Required. + :type host_name: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} - @overload - def create_or_update( - self, - resource_group_name: str, - host_group_name: str, - parameters: JSON, - *, - content_type: str = "application/json", - **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 - `_). + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._redeploy_initial( + resource_group_name=resource_group_name, + host_group_name=host_group_name, + host_name=host_name, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param host_group_name: The name of the dedicated host group. Required. - :type host_group_name: str - :param parameters: Parameters supplied to the Create Dedicated Host Group. Required. - :type parameters: JSON - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: DedicatedHostGroup. The DedicatedHostGroup is compatible with MutableMapping - :rtype: ~azure.mgmt.compute.models.DedicatedHostGroup - :raises ~azure.core.exceptions.HttpResponseError: - """ + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore - @overload - def create_or_update( - self, - resource_group_name: str, - host_group_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **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 - `_). + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + def _restart_initial( + self, resource_group_name: str, host_group_name: str, host_name: str, **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_dedicated_hosts_restart_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=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_restart( + 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/azure/service-health/resource-health-overview + `_ for more details. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param host_group_name: The name of the dedicated host group. Required. :type host_group_name: str - :param parameters: Parameters supplied to the Create Dedicated Host Group. Required. - :type parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: DedicatedHostGroup. The DedicatedHostGroup is compatible with MutableMapping - :rtype: ~azure.mgmt.compute.models.DedicatedHostGroup + :param host_name: The name of the dedicated host. Required. + :type host_name: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._restart_initial( + resource_group_name=resource_group_name, + host_group_name=host_group_name, + host_name=host_name, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + +class ImagesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.compute.ComputeClient`'s + :attr:`images` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace - def create_or_update( - self, - resource_group_name: str, - host_group_name: str, - parameters: Union[_models.DedicatedHostGroup, JSON, IO[bytes]], - **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 - `_). + 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. The name is case insensitive. Required. :type resource_group_name: str - :param host_group_name: The name of the dedicated host group. Required. - :type host_group_name: str - :param parameters: Parameters supplied to the Create Dedicated Host Group. Is one of the - following types: DedicatedHostGroup, JSON, IO[bytes] Required. - :type parameters: ~azure.mgmt.compute.models.DedicatedHostGroup or JSON or IO[bytes] - :return: DedicatedHostGroup. The DedicatedHostGroup is compatible with MutableMapping - :rtype: ~azure.mgmt.compute.models.DedicatedHostGroup + :param image_name: The name of the image. Required. + :type image_name: str + :keyword expand: The expand expression to apply on the operation. Default value is None. + :paramtype expand: str + :return: Image. The Image is compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.Image :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -25226,11 +23718,72 @@ def create_or_update( } error_map.update(kwargs.pop("error_map", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.Image] = kwargs.pop("cls", None) + + _request = build_images_get_request( + resource_group_name=resource_group_name, + image_name=image_name, + subscription_id=self._config.subscription_id, + expand=expand, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.Image, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _create_or_update_initial( + self, + resource_group_name: str, + image_name: str, + parameters: Union[_models.Image, JSON, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.DedicatedHostGroup] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _content = None @@ -25239,9 +23792,9 @@ def create_or_update( else: _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - _request = build_dedicated_host_groups_create_or_update_request( + _request = build_images_create_or_update_request( resource_group_name=resource_group_name, - host_group_name=host_group_name, + image_name=image_name, subscription_id=self._config.subscription_id, content_type=content_type, api_version=self._config.api_version, @@ -25254,7 +23807,7 @@ def create_or_update( } _request.url = self._client.format_url(_request.url, **path_format_arguments) - _stream = kwargs.pop("stream", False) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -25262,128 +23815,192 @@ def create_or_update( response = pipeline_response.http_response if response.status_code not in [200, 201]: - if _stream: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = _failsafe_deserialize(_models.CloudError, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if _stream: - deserialized = response.iter_bytes() - else: - deserialized = _deserialize(_models.DedicatedHostGroup, response.json()) + response_headers = {} + if response.status_code == 201: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore @overload - def update( + def begin_create_or_update( self, resource_group_name: str, - host_group_name: str, - parameters: _models.DedicatedHostGroupUpdate, + image_name: str, + parameters: _models.Image, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.DedicatedHostGroup: - """Update an dedicated host group. + ) -> LROPoller[_models.Image]: + """Create or update an image. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param host_group_name: The name of the dedicated host group. Required. - :type host_group_name: str - :param parameters: Parameters supplied to the Update Dedicated Host Group operation. Required. - :type parameters: ~azure.mgmt.compute.models.DedicatedHostGroupUpdate + :param image_name: The name of the image. Required. + :type image_name: str + :param parameters: Parameters supplied to the Create Image operation. Required. + :type parameters: ~azure.mgmt.compute.models.Image :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: DedicatedHostGroup. The DedicatedHostGroup is compatible with MutableMapping - :rtype: ~azure.mgmt.compute.models.DedicatedHostGroup + :return: An instance of LROPoller that returns Image. The Image is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.Image] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def update( + def begin_create_or_update( self, resource_group_name: str, - host_group_name: str, + image_name: str, parameters: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.DedicatedHostGroup: - """Update an dedicated host group. + ) -> LROPoller[_models.Image]: + """Create or update an image. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param host_group_name: The name of the dedicated host group. Required. - :type host_group_name: str - :param parameters: Parameters supplied to the Update Dedicated Host Group operation. Required. + :param image_name: The name of the image. Required. + :type image_name: str + :param parameters: Parameters supplied to the Create Image operation. Required. :type parameters: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: DedicatedHostGroup. The DedicatedHostGroup is compatible with MutableMapping - :rtype: ~azure.mgmt.compute.models.DedicatedHostGroup + :return: An instance of LROPoller that returns Image. The Image is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.Image] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def update( + def begin_create_or_update( self, resource_group_name: str, - host_group_name: str, + image_name: str, parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> _models.DedicatedHostGroup: - """Update an dedicated host group. + ) -> LROPoller[_models.Image]: + """Create or update an image. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param host_group_name: The name of the dedicated host group. Required. - :type host_group_name: str - :param parameters: Parameters supplied to the Update Dedicated Host Group operation. Required. + :param image_name: The name of the image. Required. + :type image_name: str + :param parameters: Parameters supplied to the Create Image operation. Required. :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: DedicatedHostGroup. The DedicatedHostGroup is compatible with MutableMapping - :rtype: ~azure.mgmt.compute.models.DedicatedHostGroup + :return: An instance of LROPoller that returns Image. The Image is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.Image] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace - def update( + def begin_create_or_update( self, resource_group_name: str, - host_group_name: str, - parameters: Union[_models.DedicatedHostGroupUpdate, JSON, IO[bytes]], + image_name: str, + parameters: Union[_models.Image, JSON, IO[bytes]], **kwargs: Any - ) -> _models.DedicatedHostGroup: - """Update an dedicated host group. + ) -> LROPoller[_models.Image]: + """Create or update an image. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param host_group_name: The name of the dedicated host group. Required. - :type host_group_name: str - :param parameters: Parameters supplied to the Update Dedicated Host Group operation. Is one of - the following types: DedicatedHostGroupUpdate, JSON, IO[bytes] Required. - :type parameters: ~azure.mgmt.compute.models.DedicatedHostGroupUpdate or JSON or IO[bytes] - :return: DedicatedHostGroup. The DedicatedHostGroup is compatible with MutableMapping - :rtype: ~azure.mgmt.compute.models.DedicatedHostGroup + :param image_name: The name of the image. Required. + :type image_name: str + :param parameters: Parameters supplied to the Create Image operation. Is one of the following + types: Image, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.compute.models.Image or JSON or IO[bytes] + :return: An instance of LROPoller that returns Image. The Image is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.Image] :raises ~azure.core.exceptions.HttpResponseError: """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Image] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + image_name=image_name, + parameters=parameters, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.Image, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.Image].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.Image]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _update_initial( + self, + resource_group_name: str, + image_name: str, + parameters: Union[_models.ImageUpdate, JSON, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -25396,7 +24013,7 @@ def update( _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.DedicatedHostGroup] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _content = None @@ -25405,9 +24022,9 @@ def update( else: _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - _request = build_dedicated_host_groups_update_request( + _request = build_images_update_request( resource_group_name=resource_group_name, - host_group_name=host_group_name, + image_name=image_name, subscription_id=self._config.subscription_id, content_type=content_type, api_version=self._config.api_version, @@ -25420,66 +24037,212 @@ def update( } _request.url = self._client.format_url(_request.url, **path_format_arguments) - _stream = kwargs.pop("stream", False) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200]: - if _stream: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass + if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = _failsafe_deserialize(_models.CloudError, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if _stream: - deserialized = response.iter_bytes() - else: - deserialized = _deserialize(_models.DedicatedHostGroup, response.json()) + response_headers = {} + if response.status_code == 201: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # 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. + @overload + def begin_update( + self, + resource_group_name: str, + image_name: str, + parameters: _models.ImageUpdate, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.Image]: + """Update an image. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param host_group_name: The name of the dedicated host group. Required. - :type host_group_name: str - :return: None - :rtype: None + :param image_name: The name of the image. Required. + :type image_name: str + :param parameters: Parameters supplied to the Update Image operation. Required. + :type parameters: ~azure.mgmt.compute.models.ImageUpdate + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns Image. The Image is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.Image] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} + @overload + def begin_update( + self, + resource_group_name: str, + image_name: str, + parameters: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.Image]: + """Update an image. - cls: ClsType[None] = kwargs.pop("cls", None) + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param image_name: The name of the image. Required. + :type image_name: str + :param parameters: Parameters supplied to the Update Image operation. Required. + :type parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns Image. The Image is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.Image] + :raises ~azure.core.exceptions.HttpResponseError: + """ - _request = build_dedicated_host_groups_delete_request( - resource_group_name=resource_group_name, - host_group_name=host_group_name, - subscription_id=self._config.subscription_id, - api_version=self._config.api_version, + @overload + def begin_update( + self, + resource_group_name: str, + image_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.Image]: + """Update an image. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param image_name: The name of the image. Required. + :type image_name: str + :param parameters: Parameters supplied to the Update Image operation. Required. + :type parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns Image. The Image is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.Image] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update( + self, + resource_group_name: str, + image_name: str, + parameters: Union[_models.ImageUpdate, JSON, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.Image]: + """Update an image. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param image_name: The name of the image. Required. + :type image_name: str + :param parameters: Parameters supplied to the Update Image operation. Is one of the following + types: ImageUpdate, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.compute.models.ImageUpdate or JSON or IO[bytes] + :return: An instance of LROPoller that returns Image. The Image is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.Image] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Image] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._update_initial( + resource_group_name=resource_group_name, + image_name=image_name, + parameters=parameters, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.Image, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.Image].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.Image]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _delete_initial(self, resource_group_name: str, image_name: str, **kwargs: Any) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_images_delete_request( + resource_group_name=resource_group_name, + image_name=image_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, headers=_headers, params=_params, ) @@ -25488,39 +24251,107 @@ def delete( # pylint: disable=inconsistent-return-statements } _request.url = self._client.format_url(_request.url, **path_format_arguments) - _stream = False + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200, 204]: + if response.status_code not in [200, 202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = _failsafe_deserialize(_models.CloudError, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore @distributed_trace - def list_by_resource_group( - self, resource_group_name: str, **kwargs: Any - ) -> ItemPaged["_models.DedicatedHostGroup"]: - """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. + def begin_delete(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. The name is case insensitive. Required. :type resource_group_name: str - :return: An iterator like instance of DedicatedHostGroup - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.models.DedicatedHostGroup] + :param image_name: The name of the image. Required. + :type image_name: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.DedicatedHostGroup]] = kwargs.pop("cls", None) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + image_name=image_name, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace + def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> ItemPaged["_models.Image"]: + """Gets the list of images under a resource group. Use nextLink property in the response to get + the next page of Images. Do this till nextLink is null to fetch all the Images. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :return: An iterator like instance of Image + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.models.Image] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.Image]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -25533,7 +24364,7 @@ def list_by_resource_group( def prepare_request(next_link=None): if not next_link: - _request = build_dedicated_host_groups_list_by_resource_group_request( + _request = build_images_list_by_resource_group_request( resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, api_version=self._config.api_version, @@ -25571,7 +24402,7 @@ def prepare_request(next_link=None): def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.DedicatedHostGroup], deserialized.get("value", [])) + list_of_elem = _deserialize(List[_models.Image], deserialized.get("value", [])) if cls: list_of_elem = cls(list_of_elem) # type: ignore return deserialized.get("nextLink") or None, iter(list_of_elem) @@ -25595,18 +24426,18 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) @distributed_trace - def list_by_subscription(self, **kwargs: Any) -> ItemPaged["_models.DedicatedHostGroup"]: - """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. + def list(self, **kwargs: Any) -> ItemPaged["_models.Image"]: + """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. - :return: An iterator like instance of DedicatedHostGroup - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.models.DedicatedHostGroup] + :return: An iterator like instance of Image + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.models.Image] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.DedicatedHostGroup]] = kwargs.pop("cls", None) + cls: ClsType[List[_models.Image]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -25619,7 +24450,7 @@ def list_by_subscription(self, **kwargs: Any) -> ItemPaged["_models.DedicatedHos def prepare_request(next_link=None): if not next_link: - _request = build_dedicated_host_groups_list_by_subscription_request( + _request = build_images_list_request( subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -25656,7 +24487,7 @@ def prepare_request(next_link=None): def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.DedicatedHostGroup], deserialized.get("value", [])) + list_of_elem = _deserialize(List[_models.Image], deserialized.get("value", [])) if cls: list_of_elem = cls(list_of_elem) # type: ignore return deserialized.get("nextLink") or None, iter(list_of_elem) @@ -25680,14 +24511,14 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) -class DedicatedHostsOperations: +class RestorePointCollectionsOperations: """ .. warning:: **DO NOT** instantiate this class directly. Instead, you should access the following operations through :class:`~azure.mgmt.compute.ComputeClient`'s - :attr:`dedicated_hosts` attribute. + :attr:`restore_point_collections` attribute. """ def __init__(self, *args, **kwargs) -> None: @@ -25701,28 +24532,24 @@ def __init__(self, *args, **kwargs) -> None: def get( self, resource_group_name: str, - host_group_name: str, - host_name: str, + restore_point_collection_name: str, *, - expand: Optional[Union[str, _models.InstanceViewTypes]] = None, + expand: Optional[Union[str, _models.RestorePointCollectionExpandOptions]] = None, **kwargs: Any - ) -> _models.DedicatedHost: - """Retrieves information about a dedicated host. + ) -> _models.RestorePointCollection: + """The operation to get the restore point collection. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param host_group_name: The name of the dedicated host group. Required. - :type host_group_name: str - :param host_name: The name of the dedicated host. Required. - :type host_name: str - :keyword 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. Known values are: "instanceView", "userData", and "resiliencyView". Default value is - None. - :paramtype expand: str or ~azure.mgmt.compute.models.InstanceViewTypes - :return: DedicatedHost. The DedicatedHost is compatible with MutableMapping - :rtype: ~azure.mgmt.compute.models.DedicatedHost + :param restore_point_collection_name: The name of the restore point collection. Required. + :type restore_point_collection_name: str + :keyword expand: The expand expression to apply on the operation. If expand=restorePoints, + server will return all contained restore points in the restorePointCollection. "restorePoints" + Default value is None. + :paramtype expand: str or ~azure.mgmt.compute.models.RestorePointCollectionExpandOptions + :return: RestorePointCollection. The RestorePointCollection is compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.RestorePointCollection :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -25736,12 +24563,11 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.DedicatedHost] = kwargs.pop("cls", None) + cls: ClsType[_models.RestorePointCollection] = kwargs.pop("cls", None) - _request = build_dedicated_hosts_get_request( + _request = build_restore_point_collections_get_request( resource_group_name=resource_group_name, - host_group_name=host_group_name, - host_name=host_name, + restore_point_collection_name=restore_point_collection_name, subscription_id=self._config.subscription_id, expand=expand, api_version=self._config.api_version, @@ -25773,21 +24599,127 @@ def get( if _stream: deserialized = response.iter_bytes() else: - deserialized = _deserialize(_models.DedicatedHost, response.json()) + deserialized = _deserialize(_models.RestorePointCollection, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - def _create_or_update_initial( + @overload + def create_or_update( self, resource_group_name: str, - host_group_name: str, - host_name: str, - parameters: Union[_models.DedicatedHost, JSON, IO[bytes]], + restore_point_collection_name: str, + parameters: _models.RestorePointCollection, + *, + content_type: str = "application/json", **kwargs: Any - ) -> Iterator[bytes]: + ) -> _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. The name is case insensitive. + Required. + :type resource_group_name: str + :param restore_point_collection_name: The name of the restore point collection. Required. + :type restore_point_collection_name: str + :param parameters: Parameters supplied to the Create or Update restore point collection + operation. Required. + :type parameters: ~azure.mgmt.compute.models.RestorePointCollection + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: RestorePointCollection. The RestorePointCollection is compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.RestorePointCollection + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update( + self, + resource_group_name: str, + restore_point_collection_name: str, + parameters: JSON, + *, + content_type: str = "application/json", + **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. The name is case insensitive. + Required. + :type resource_group_name: str + :param restore_point_collection_name: The name of the restore point collection. Required. + :type restore_point_collection_name: str + :param parameters: Parameters supplied to the Create or Update restore point collection + operation. Required. + :type parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: RestorePointCollection. The RestorePointCollection is compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.RestorePointCollection + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update( + self, + resource_group_name: str, + restore_point_collection_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **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. The name is case insensitive. + Required. + :type resource_group_name: str + :param restore_point_collection_name: The name of the restore point collection. Required. + :type restore_point_collection_name: str + :param parameters: Parameters supplied to the Create or Update restore point collection + operation. Required. + :type parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: RestorePointCollection. The RestorePointCollection is compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.RestorePointCollection + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create_or_update( + self, + resource_group_name: str, + restore_point_collection_name: str, + parameters: Union[_models.RestorePointCollection, JSON, IO[bytes]], + **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. The name is case insensitive. + Required. + :type resource_group_name: str + :param restore_point_collection_name: The name of the restore point collection. Required. + :type restore_point_collection_name: str + :param parameters: Parameters supplied to the Create or Update restore point collection + operation. Is one of the following types: RestorePointCollection, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.compute.models.RestorePointCollection or JSON or IO[bytes] + :return: RestorePointCollection. The RestorePointCollection is compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.RestorePointCollection + :raises ~azure.core.exceptions.HttpResponseError: + """ error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -25800,7 +24732,7 @@ def _create_or_update_initial( _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + cls: ClsType[_models.RestorePointCollection] = kwargs.pop("cls", None) content_type = content_type or "application/json" _content = None @@ -25809,10 +24741,9 @@ def _create_or_update_initial( else: _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - _request = build_dedicated_hosts_create_or_update_request( + _request = build_restore_point_collections_create_or_update_request( resource_group_name=resource_group_name, - host_group_name=host_group_name, - host_name=host_name, + restore_point_collection_name=restore_point_collection_name, subscription_id=self._config.subscription_id, content_type=content_type, api_version=self._config.api_version, @@ -25825,7 +24756,7 @@ def _create_or_update_initial( } _request.url = self._client.format_url(_request.url, **path_format_arguments) - _stream = True + _stream = kwargs.pop("stream", False) pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -25833,197 +24764,131 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = _failsafe_deserialize(_models.CloudError, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - response_headers = {} - if response.status_code == 201: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.iter_bytes() + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.RestorePointCollection, response.json()) if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore @overload - def begin_create_or_update( + def update( self, resource_group_name: str, - host_group_name: str, - host_name: str, - parameters: _models.DedicatedHost, + restore_point_collection_name: str, + parameters: _models.RestorePointCollectionUpdate, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[None]: - """Create or update a dedicated host . + ) -> _models.RestorePointCollection: + """The operation to update the restore point collection. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param host_group_name: The name of the dedicated host group. Required. - :type host_group_name: str - :param host_name: The name of the dedicated host. Required. - :type host_name: str - :param parameters: Parameters supplied to the Create Dedicated Host. Required. - :type parameters: ~azure.mgmt.compute.models.DedicatedHost + :param restore_point_collection_name: The name of the restore point collection. Required. + :type restore_point_collection_name: str + :param parameters: Parameters supplied to the Update restore point collection operation. + Required. + :type parameters: ~azure.mgmt.compute.models.RestorePointCollectionUpdate :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns None - :rtype: ~azure.core.polling.LROPoller[None] + :return: RestorePointCollection. The RestorePointCollection is compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.RestorePointCollection :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def begin_create_or_update( + def update( self, resource_group_name: str, - host_group_name: str, - host_name: str, + restore_point_collection_name: str, parameters: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[None]: - """Create or update a dedicated host . + ) -> _models.RestorePointCollection: + """The operation to update the restore point collection. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param host_group_name: The name of the dedicated host group. Required. - :type host_group_name: str - :param host_name: The name of the dedicated host. Required. - :type host_name: str - :param parameters: Parameters supplied to the Create Dedicated Host. Required. + :param restore_point_collection_name: The name of the restore point collection. Required. + :type restore_point_collection_name: str + :param parameters: Parameters supplied to the Update restore point collection operation. + Required. :type parameters: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns None - :rtype: ~azure.core.polling.LROPoller[None] + :return: RestorePointCollection. The RestorePointCollection is compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.RestorePointCollection :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def begin_create_or_update( + def update( self, resource_group_name: str, - host_group_name: str, - host_name: str, + restore_point_collection_name: str, parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[None]: - """Create or update a dedicated host . + ) -> _models.RestorePointCollection: + """The operation to update the restore point collection. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param host_group_name: The name of the dedicated host group. Required. - :type host_group_name: str - :param host_name: The name of the dedicated host. Required. - :type host_name: str - :param parameters: Parameters supplied to the Create Dedicated Host. Required. + :param restore_point_collection_name: The name of the restore point collection. Required. + :type restore_point_collection_name: str + :param parameters: Parameters supplied to the Update restore point collection operation. + Required. :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns None - :rtype: ~azure.core.polling.LROPoller[None] + :return: RestorePointCollection. The RestorePointCollection is compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.RestorePointCollection :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace - def begin_create_or_update( + def update( self, resource_group_name: str, - host_group_name: str, - host_name: str, - parameters: Union[_models.DedicatedHost, JSON, IO[bytes]], + restore_point_collection_name: str, + parameters: Union[_models.RestorePointCollectionUpdate, JSON, IO[bytes]], **kwargs: Any - ) -> LROPoller[None]: - """Create or update a dedicated host . + ) -> _models.RestorePointCollection: + """The operation to update the restore point collection. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param host_group_name: The name of the dedicated host group. Required. - :type host_group_name: str - :param host_name: The name of the dedicated host. Required. - :type host_name: str - :param parameters: Parameters supplied to the Create Dedicated Host. Is one of the following - types: DedicatedHost, JSON, IO[bytes] Required. - :type parameters: ~azure.mgmt.compute.models.DedicatedHost or JSON or IO[bytes] - :return: An instance of LROPoller that returns None - :rtype: ~azure.core.polling.LROPoller[None] + :param restore_point_collection_name: The name of the restore point collection. Required. + :type restore_point_collection_name: str + :param parameters: Parameters supplied to the Update restore point collection operation. Is one + of the following types: RestorePointCollectionUpdate, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.compute.models.RestorePointCollectionUpdate or JSON or IO[bytes] + :return: RestorePointCollection. The RestorePointCollection is compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.RestorePointCollection :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} - - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._create_or_update_initial( - resource_group_name=resource_group_name, - host_group_name=host_group_name, - host_name=host_name, - parameters=parameters, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _update_initial( - self, - resource_group_name: str, - host_group_name: str, - host_name: str, - parameters: Union[_models.DedicatedHostUpdate, JSON, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -26036,7 +24901,7 @@ def _update_initial( _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + cls: ClsType[_models.RestorePointCollection] = kwargs.pop("cls", None) content_type = content_type or "application/json" _content = None @@ -26045,10 +24910,9 @@ def _update_initial( else: _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - _request = build_dedicated_hosts_update_request( + _request = build_restore_point_collections_update_request( resource_group_name=resource_group_name, - host_group_name=host_group_name, - host_name=host_name, + restore_point_collection_name=restore_point_collection_name, subscription_id=self._config.subscription_id, content_type=content_type, api_version=self._config.api_version, @@ -26061,7 +24925,7 @@ def _update_initial( } _request.url = self._client.format_url(_request.url, **path_format_arguments) - _stream = True + _stream = kwargs.pop("stream", False) pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -26069,190 +24933,27 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = _failsafe_deserialize(_models.CloudError, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - response_headers = {} - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.iter_bytes() + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.RestorePointCollection, response.json()) if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - @overload - def begin_update( - self, - resource_group_name: str, - host_group_name: str, - host_name: str, - parameters: _models.DedicatedHostUpdate, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[None]: - """Update a dedicated host . - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param host_group_name: The name of the dedicated host group. Required. - :type host_group_name: str - :param host_name: The name of the dedicated host. Required. - :type host_name: str - :param parameters: Parameters supplied to the Update Dedicated Host operation. Required. - :type parameters: ~azure.mgmt.compute.models.DedicatedHostUpdate - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns None - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update( - self, - resource_group_name: str, - host_group_name: str, - host_name: str, - parameters: JSON, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[None]: - """Update a dedicated host . - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param host_group_name: The name of the dedicated host group. Required. - :type host_group_name: str - :param host_name: The name of the dedicated host. Required. - :type host_name: str - :param parameters: Parameters supplied to the Update Dedicated Host operation. Required. - :type parameters: JSON - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns None - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update( - self, - resource_group_name: str, - host_group_name: str, - host_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[None]: - """Update a dedicated host . - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param host_group_name: The name of the dedicated host group. Required. - :type host_group_name: str - :param host_name: The name of the dedicated host. Required. - :type host_name: str - :param parameters: Parameters supplied to the Update Dedicated Host operation. Required. - :type parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns None - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_update( - self, - resource_group_name: str, - host_group_name: str, - host_name: str, - parameters: Union[_models.DedicatedHostUpdate, JSON, IO[bytes]], - **kwargs: Any - ) -> LROPoller[None]: - """Update a dedicated host . - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param host_group_name: The name of the dedicated host group. Required. - :type host_group_name: str - :param host_name: The name of the dedicated host. Required. - :type host_name: str - :param parameters: Parameters supplied to the Update Dedicated Host operation. Is one of the - following types: DedicatedHostUpdate, JSON, IO[bytes] Required. - :type parameters: ~azure.mgmt.compute.models.DedicatedHostUpdate or JSON or IO[bytes] - :return: An instance of LROPoller that returns None - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} - - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._update_initial( - resource_group_name=resource_group_name, - host_group_name=host_group_name, - host_name=host_name, - parameters=parameters, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - def _delete_initial( - self, resource_group_name: str, host_group_name: str, host_name: str, **kwargs: Any + self, resource_group_name: str, restore_point_collection_name: str, **kwargs: Any ) -> Iterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -26267,10 +24968,9 @@ def _delete_initial( cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - _request = build_dedicated_hosts_delete_request( + _request = build_restore_point_collections_delete_request( resource_group_name=resource_group_name, - host_group_name=host_group_name, - host_name=host_name, + restore_point_collection_name=restore_point_collection_name, subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -26311,17 +25011,16 @@ def _delete_initial( @distributed_trace def begin_delete( - self, resource_group_name: str, host_group_name: str, host_name: str, **kwargs: Any + self, resource_group_name: str, restore_point_collection_name: str, **kwargs: Any ) -> LROPoller[None]: - """Delete a dedicated host. + """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. The name is case insensitive. Required. :type resource_group_name: str - :param host_group_name: The name of the dedicated host group. Required. - :type host_group_name: str - :param host_name: The name of the dedicated host. Required. - :type host_name: str + :param restore_point_collection_name: The name of the restore point collection. Required. + :type restore_point_collection_name: str :return: An instance of LROPoller that returns None :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -26336,8 +25035,7 @@ def begin_delete( 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, + restore_point_collection_name=restore_point_collection_name, cls=lambda x, y, z: x, headers=_headers, params=_params, @@ -26372,25 +25070,20 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore @distributed_trace - def list_by_host_group( - self, resource_group_name: str, host_group_name: str, **kwargs: Any - ) -> ItemPaged["_models.DedicatedHost"]: - """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. + def list(self, resource_group_name: str, **kwargs: Any) -> ItemPaged["_models.RestorePointCollection"]: + """Gets the list of restore point collections in a resource group. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param host_group_name: The name of the dedicated host group. Required. - :type host_group_name: str - :return: An iterator like instance of DedicatedHost - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.models.DedicatedHost] + :return: An iterator like instance of RestorePointCollection + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.models.RestorePointCollection] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.DedicatedHost]] = kwargs.pop("cls", None) + cls: ClsType[List[_models.RestorePointCollection]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -26403,9 +25096,8 @@ def list_by_host_group( def prepare_request(next_link=None): if not next_link: - _request = build_dedicated_hosts_list_by_host_group_request( + _request = build_restore_point_collections_list_request( resource_group_name=resource_group_name, - host_group_name=host_group_name, subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -26442,7 +25134,7 @@ def prepare_request(next_link=None): def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.DedicatedHost], deserialized.get("value", [])) + list_of_elem = _deserialize(List[_models.RestorePointCollection], deserialized.get("value", [])) if cls: list_of_elem = cls(list_of_elem) # type: ignore return deserialized.get("nextLink") or None, iter(list_of_elem) @@ -26466,28 +25158,19 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) @distributed_trace - def list_available_sizes( - self, resource_group_name: str, host_group_name: str, host_name: str, **kwargs: Any - ) -> ItemPaged[str]: - """Lists all available dedicated host sizes to which the specified dedicated host can be resized. - NOTE: The dedicated host sizes provided can be used to only scale up the existing dedicated - host. + def list_all(self, **kwargs: Any) -> ItemPaged["_models.RestorePointCollection"]: + """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. - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param host_group_name: The name of the dedicated host group. Required. - :type host_group_name: str - :param host_name: The name of the dedicated host. Required. - :type host_name: str - :return: An iterator like instance of str - :rtype: ~azure.core.paging.ItemPaged[str] + :return: An iterator like instance of RestorePointCollection + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.models.RestorePointCollection] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[str]] = kwargs.pop("cls", None) + cls: ClsType[List[_models.RestorePointCollection]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -26500,10 +25183,7 @@ def list_available_sizes( def prepare_request(next_link=None): if not next_link: - _request = build_dedicated_hosts_list_available_sizes_request( - resource_group_name=resource_group_name, - host_group_name=host_group_name, - host_name=host_name, + _request = build_restore_point_collections_list_all_request( subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -26540,7 +25220,7 @@ def prepare_request(next_link=None): def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[str], deserialized.get("value", [])) + list_of_elem = _deserialize(List[_models.RestorePointCollection], deserialized.get("value", [])) if cls: list_of_elem = cls(list_of_elem) # type: ignore return deserialized.get("nextLink") or None, iter(list_of_elem) @@ -26563,9 +25243,50 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - def _redeploy_initial( - self, resource_group_name: str, host_group_name: str, host_name: str, **kwargs: Any - ) -> Iterator[bytes]: + +class RestorePointsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.compute.ComputeClient`'s + :attr:`restore_points` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @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. The name is case insensitive. + Required. + :type resource_group_name: str + :param restore_point_collection_name: The name of the restore point collection. Required. + :type restore_point_collection_name: str + :param restore_point_name: The name of the restore point. Required. + :type restore_point_name: str + :keyword expand: The expand expression to apply on the operation. 'InstanceView' retrieves + information about the run-time state of a restore point. "instanceView" Default value is None. + :paramtype expand: str or ~azure.mgmt.compute.models.RestorePointExpandOptions + :return: RestorePoint. The RestorePoint is compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.RestorePoint + :raises ~azure.core.exceptions.HttpResponseError: + """ error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -26577,13 +25298,14 @@ def _redeploy_initial( _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + cls: ClsType[_models.RestorePoint] = kwargs.pop("cls", None) - _request = build_dedicated_hosts_redeploy_request( + _request = build_restore_points_get_request( resource_group_name=resource_group_name, - host_group_name=host_group_name, - host_name=host_name, + restore_point_collection_name=restore_point_collection_name, + restore_point_name=restore_point_name, subscription_id=self._config.subscription_id, + expand=expand, api_version=self._config.api_version, headers=_headers, params=_params, @@ -26593,101 +25315,40 @@ def _redeploy_initial( } _request.url = self._client.format_url(_request.url, **path_format_arguments) - _stream = True + _stream = kwargs.pop("stream", False) pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [202]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = _failsafe_deserialize(_models.CloudError, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - response_headers = {} - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.iter_bytes() + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.RestorePoint, response.json()) if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - @distributed_trace - def begin_redeploy( - self, resource_group_name: str, host_group_name: str, host_name: str, **kwargs: Any - ) -> LROPoller[None]: - """Redeploy the dedicated host. The operation will complete successfully once the dedicated host - has migrated to a new node and is running. To determine the health of VMs deployed on the - dedicated host after the redeploy check the Resource Health Center in the Azure Portal. Please - refer to `https://docs.microsoft.com/azure/service-health/resource-health-overview - `_ for more details. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param host_group_name: The name of the dedicated host group. Required. - :type host_group_name: str - :param host_name: The name of the dedicated host. Required. - :type host_name: str - :return: An instance of LROPoller that returns None - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._redeploy_initial( - resource_group_name=resource_group_name, - host_group_name=host_group_name, - host_name=host_name, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _restart_initial( - self, resource_group_name: str, host_group_name: str, host_name: str, **kwargs: Any + def _create_initial( + self, + resource_group_name: str, + restore_point_collection_name: str, + restore_point_name: str, + parameters: Union[_models.RestorePoint, JSON, IO[bytes]], + **kwargs: Any ) -> Iterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -26697,17 +25358,27 @@ def _restart_initial( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - _request = build_dedicated_hosts_restart_request( + content_type = content_type or "application/json" + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_restore_points_create_request( resource_group_name=resource_group_name, - host_group_name=host_group_name, - host_name=host_name, + restore_point_collection_name=restore_point_collection_name, + restore_point_name=restore_point_name, subscription_id=self._config.subscription_id, + content_type=content_type, api_version=self._config.api_version, + content=_content, headers=_headers, params=_params, ) @@ -26723,7 +25394,7 @@ def _restart_initial( response = pipeline_response.http_response - if response.status_code not in [200]: + if response.status_code not in [201]: try: response.read() # Load the body in memory and close the socket except (StreamConsumedError, StreamClosedError): @@ -26743,23 +25414,257 @@ def _restart_initial( return deserialized # type: ignore - @distributed_trace - def begin_restart( - 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/azure/service-health/resource-health-overview - `_ for more details. + @overload + def begin_create( + self, + resource_group_name: str, + restore_point_collection_name: str, + restore_point_name: str, + parameters: _models.RestorePoint, + *, + content_type: str = "application/json", + **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. The name is case insensitive. Required. :type resource_group_name: str - :param host_group_name: The name of the dedicated host group. Required. - :type host_group_name: str - :param host_name: The name of the dedicated host. Required. - :type host_name: str + :param restore_point_collection_name: The name of the restore point collection. Required. + :type restore_point_collection_name: str + :param restore_point_name: The name of the restore point. Required. + :type restore_point_name: str + :param parameters: Parameters supplied to the Create restore point operation. Required. + :type parameters: ~azure.mgmt.compute.models.RestorePoint + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns RestorePoint. The RestorePoint is compatible + with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.RestorePoint] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create( + self, + resource_group_name: str, + restore_point_collection_name: str, + restore_point_name: str, + parameters: JSON, + *, + content_type: str = "application/json", + **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. The name is case insensitive. + Required. + :type resource_group_name: str + :param restore_point_collection_name: The name of the restore point collection. Required. + :type restore_point_collection_name: str + :param restore_point_name: The name of the restore point. Required. + :type restore_point_name: str + :param parameters: Parameters supplied to the Create restore point operation. Required. + :type parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns RestorePoint. The RestorePoint is compatible + with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.RestorePoint] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create( + self, + resource_group_name: str, + restore_point_collection_name: str, + restore_point_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **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. The name is case insensitive. + Required. + :type resource_group_name: str + :param restore_point_collection_name: The name of the restore point collection. Required. + :type restore_point_collection_name: str + :param restore_point_name: The name of the restore point. Required. + :type restore_point_name: str + :param parameters: Parameters supplied to the Create restore point operation. Required. + :type parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns RestorePoint. The RestorePoint is compatible + with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.RestorePoint] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create( + self, + resource_group_name: str, + restore_point_collection_name: str, + restore_point_name: str, + parameters: Union[_models.RestorePoint, JSON, IO[bytes]], + **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. The name is case insensitive. + Required. + :type resource_group_name: str + :param restore_point_collection_name: The name of the restore point collection. Required. + :type restore_point_collection_name: str + :param restore_point_name: The name of the restore point. Required. + :type restore_point_name: str + :param parameters: Parameters supplied to the Create restore point operation. Is one of the + following types: RestorePoint, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.compute.models.RestorePoint or JSON or IO[bytes] + :return: An instance of LROPoller that returns RestorePoint. The RestorePoint is compatible + with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.RestorePoint] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.RestorePoint] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._create_initial( + resource_group_name=resource_group_name, + restore_point_collection_name=restore_point_collection_name, + restore_point_name=restore_point_name, + parameters=parameters, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = _deserialize(_models.RestorePoint, response.json()) + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.RestorePoint].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.RestorePoint]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _delete_initial( + self, resource_group_name: str, restore_point_collection_name: str, restore_point_name: str, **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_restore_points_delete_request( + resource_group_name=resource_group_name, + restore_point_collection_name=restore_point_collection_name, + restore_point_name=restore_point_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_delete( + 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. The name is case insensitive. + Required. + :type resource_group_name: str + :param restore_point_collection_name: The name of the restore point collection. Required. + :type restore_point_collection_name: str + :param restore_point_name: The name of the restore point. Required. + :type restore_point_name: str :return: An instance of LROPoller that returns None :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -26772,10 +25677,10 @@ def begin_restart( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._restart_initial( + raw_result = self._delete_initial( resource_group_name=resource_group_name, - host_group_name=host_group_name, - host_name=host_name, + restore_point_collection_name=restore_point_collection_name, + restore_point_name=restore_point_name, cls=lambda x, y, z: x, headers=_headers, params=_params, @@ -26810,14 +25715,14 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore -class SshPublicKeyResourcesOperations: +class CapacityReservationGroupsOperations: """ .. warning:: **DO NOT** instantiate this class directly. Instead, you should access the following operations through :class:`~azure.mgmt.compute.ComputeClient`'s - :attr:`ssh_public_key_resources` attribute. + :attr:`capacity_reservation_groups` attribute. """ def __init__(self, *args, **kwargs) -> None: @@ -26828,16 +25733,30 @@ def __init__(self, *args, **kwargs) -> None: self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @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. + 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. The name is case insensitive. Required. :type resource_group_name: str - :param ssh_public_key_name: The name of the SSH public key. Required. - :type ssh_public_key_name: str - :return: SshPublicKeyResource. The SshPublicKeyResource is compatible with MutableMapping - :rtype: ~azure.mgmt.compute.models.SshPublicKeyResource + :param capacity_reservation_group_name: The name of the capacity reservation group. Required. + :type capacity_reservation_group_name: str + :keyword 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. "instanceView" Default value is + None. + :paramtype expand: str or ~azure.mgmt.compute.models.CapacityReservationGroupInstanceViewTypes + :return: CapacityReservationGroup. The CapacityReservationGroup is compatible with + MutableMapping + :rtype: ~azure.mgmt.compute.models.CapacityReservationGroup :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -26851,12 +25770,13 @@ def get(self, resource_group_name: str, ssh_public_key_name: str, **kwargs: Any) _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.SshPublicKeyResource] = kwargs.pop("cls", None) + cls: ClsType[_models.CapacityReservationGroup] = kwargs.pop("cls", None) - _request = build_ssh_public_key_resources_get_request( + _request = build_capacity_reservation_groups_get_request( resource_group_name=resource_group_name, - ssh_public_key_name=ssh_public_key_name, + capacity_reservation_group_name=capacity_reservation_group_name, subscription_id=self._config.subscription_id, + expand=expand, api_version=self._config.api_version, headers=_headers, params=_params, @@ -26886,7 +25806,7 @@ def get(self, resource_group_name: str, ssh_public_key_name: str, **kwargs: Any) if _stream: deserialized = response.iter_bytes() else: - deserialized = _deserialize(_models.SshPublicKeyResource, response.json()) + deserialized = _deserialize(_models.CapacityReservationGroup, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -26894,106 +25814,118 @@ def get(self, resource_group_name: str, ssh_public_key_name: str, **kwargs: Any) return deserialized # type: ignore @overload - def create( + def create_or_update( self, resource_group_name: str, - ssh_public_key_name: str, - parameters: _models.SshPublicKeyResource, + capacity_reservation_group_name: str, + parameters: _models.CapacityReservationGroup, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.SshPublicKeyResource: - """Creates a new SSH public key resource. + ) -> _models.CapacityReservationGroup: + """The operation to create or update a capacity reservation group. When updating a capacity + reservation group, only tags and sharing profile may be modified. Please refer to + `https://aka.ms/CapacityReservation `_ for more details. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param ssh_public_key_name: The name of the SSH public key. Required. - :type ssh_public_key_name: str - :param parameters: Parameters supplied to create the SSH public key. Required. - :type parameters: ~azure.mgmt.compute.models.SshPublicKeyResource + :param capacity_reservation_group_name: The name of the capacity reservation group. Required. + :type capacity_reservation_group_name: str + :param parameters: Parameters supplied to the Create capacity reservation Group. Required. + :type parameters: ~azure.mgmt.compute.models.CapacityReservationGroup :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: SshPublicKeyResource. The SshPublicKeyResource is compatible with MutableMapping - :rtype: ~azure.mgmt.compute.models.SshPublicKeyResource + :return: CapacityReservationGroup. The CapacityReservationGroup is compatible with + MutableMapping + :rtype: ~azure.mgmt.compute.models.CapacityReservationGroup :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def create( + def create_or_update( self, resource_group_name: str, - ssh_public_key_name: str, + capacity_reservation_group_name: str, parameters: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.SshPublicKeyResource: - """Creates a new SSH public key resource. + ) -> _models.CapacityReservationGroup: + """The operation to create or update a capacity reservation group. When updating a capacity + reservation group, only tags and sharing profile may be modified. Please refer to + `https://aka.ms/CapacityReservation `_ for more details. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param ssh_public_key_name: The name of the SSH public key. Required. - :type ssh_public_key_name: str - :param parameters: Parameters supplied to create the SSH public key. Required. + :param capacity_reservation_group_name: The name of the capacity reservation group. Required. + :type capacity_reservation_group_name: str + :param parameters: Parameters supplied to the Create capacity reservation Group. Required. :type parameters: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: SshPublicKeyResource. The SshPublicKeyResource is compatible with MutableMapping - :rtype: ~azure.mgmt.compute.models.SshPublicKeyResource + :return: CapacityReservationGroup. The CapacityReservationGroup is compatible with + MutableMapping + :rtype: ~azure.mgmt.compute.models.CapacityReservationGroup :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def create( + def create_or_update( self, resource_group_name: str, - ssh_public_key_name: str, + capacity_reservation_group_name: str, parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> _models.SshPublicKeyResource: - """Creates a new SSH public key resource. + ) -> _models.CapacityReservationGroup: + """The operation to create or update a capacity reservation group. When updating a capacity + reservation group, only tags and sharing profile may be modified. Please refer to + `https://aka.ms/CapacityReservation `_ for more details. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param ssh_public_key_name: The name of the SSH public key. Required. - :type ssh_public_key_name: str - :param parameters: Parameters supplied to create the SSH public key. Required. + :param capacity_reservation_group_name: The name of the capacity reservation group. Required. + :type capacity_reservation_group_name: str + :param parameters: Parameters supplied to the Create capacity reservation Group. Required. :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: SshPublicKeyResource. The SshPublicKeyResource is compatible with MutableMapping - :rtype: ~azure.mgmt.compute.models.SshPublicKeyResource + :return: CapacityReservationGroup. The CapacityReservationGroup is compatible with + MutableMapping + :rtype: ~azure.mgmt.compute.models.CapacityReservationGroup :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace - def create( + def create_or_update( self, resource_group_name: str, - ssh_public_key_name: str, - parameters: Union[_models.SshPublicKeyResource, JSON, IO[bytes]], + capacity_reservation_group_name: str, + parameters: Union[_models.CapacityReservationGroup, JSON, IO[bytes]], **kwargs: Any - ) -> _models.SshPublicKeyResource: - """Creates a new SSH public key resource. + ) -> _models.CapacityReservationGroup: + """The operation to create or update a capacity reservation group. When updating a capacity + reservation group, only tags and sharing profile may be modified. Please refer to + `https://aka.ms/CapacityReservation `_ for more details. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param ssh_public_key_name: The name of the SSH public key. Required. - :type ssh_public_key_name: str - :param parameters: Parameters supplied to create the SSH public key. Is one of the following - types: SshPublicKeyResource, JSON, IO[bytes] Required. - :type parameters: ~azure.mgmt.compute.models.SshPublicKeyResource or JSON or IO[bytes] - :return: SshPublicKeyResource. The SshPublicKeyResource is compatible with MutableMapping - :rtype: ~azure.mgmt.compute.models.SshPublicKeyResource + :param capacity_reservation_group_name: The name of the capacity reservation group. Required. + :type capacity_reservation_group_name: str + :param parameters: Parameters supplied to the Create capacity reservation Group. Is one of the + following types: CapacityReservationGroup, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.compute.models.CapacityReservationGroup or JSON or IO[bytes] + :return: CapacityReservationGroup. The CapacityReservationGroup is compatible with + MutableMapping + :rtype: ~azure.mgmt.compute.models.CapacityReservationGroup :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -27008,7 +25940,7 @@ def create( _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.SshPublicKeyResource] = kwargs.pop("cls", None) + cls: ClsType[_models.CapacityReservationGroup] = kwargs.pop("cls", None) content_type = content_type or "application/json" _content = None @@ -27017,9 +25949,9 @@ def create( else: _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - _request = build_ssh_public_key_resources_create_request( + _request = build_capacity_reservation_groups_create_or_update_request( resource_group_name=resource_group_name, - ssh_public_key_name=ssh_public_key_name, + capacity_reservation_group_name=capacity_reservation_group_name, subscription_id=self._config.subscription_id, content_type=content_type, api_version=self._config.api_version, @@ -27052,7 +25984,7 @@ def create( if _stream: deserialized = response.iter_bytes() else: - deserialized = _deserialize(_models.SshPublicKeyResource, response.json()) + deserialized = _deserialize(_models.CapacityReservationGroup, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -27063,26 +25995,29 @@ def create( def update( self, resource_group_name: str, - ssh_public_key_name: str, - parameters: _models.SshPublicKeyUpdateResource, + capacity_reservation_group_name: str, + parameters: _models.CapacityReservationGroupUpdate, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.SshPublicKeyResource: - """Updates a new SSH public key resource. + ) -> _models.CapacityReservationGroup: + """The operation to update a capacity reservation group. When updating a capacity reservation + group, only tags and sharing profile may be modified. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param ssh_public_key_name: The name of the SSH public key. Required. - :type ssh_public_key_name: str - :param parameters: Parameters supplied to update the SSH public key. Required. - :type parameters: ~azure.mgmt.compute.models.SshPublicKeyUpdateResource + :param capacity_reservation_group_name: The name of the capacity reservation group. Required. + :type capacity_reservation_group_name: str + :param parameters: Parameters supplied to the Update capacity reservation Group operation. + Required. + :type parameters: ~azure.mgmt.compute.models.CapacityReservationGroupUpdate :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: SshPublicKeyResource. The SshPublicKeyResource is compatible with MutableMapping - :rtype: ~azure.mgmt.compute.models.SshPublicKeyResource + :return: CapacityReservationGroup. The CapacityReservationGroup is compatible with + MutableMapping + :rtype: ~azure.mgmt.compute.models.CapacityReservationGroup :raises ~azure.core.exceptions.HttpResponseError: """ @@ -27090,26 +26025,29 @@ def update( def update( self, resource_group_name: str, - ssh_public_key_name: str, + capacity_reservation_group_name: str, parameters: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.SshPublicKeyResource: - """Updates a new SSH public key resource. + ) -> _models.CapacityReservationGroup: + """The operation to update a capacity reservation group. When updating a capacity reservation + group, only tags and sharing profile may be modified. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param ssh_public_key_name: The name of the SSH public key. Required. - :type ssh_public_key_name: str - :param parameters: Parameters supplied to update the SSH public key. Required. + :param capacity_reservation_group_name: The name of the capacity reservation group. Required. + :type capacity_reservation_group_name: str + :param parameters: Parameters supplied to the Update capacity reservation Group operation. + Required. :type parameters: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: SshPublicKeyResource. The SshPublicKeyResource is compatible with MutableMapping - :rtype: ~azure.mgmt.compute.models.SshPublicKeyResource + :return: CapacityReservationGroup. The CapacityReservationGroup is compatible with + MutableMapping + :rtype: ~azure.mgmt.compute.models.CapacityReservationGroup :raises ~azure.core.exceptions.HttpResponseError: """ @@ -27117,26 +26055,29 @@ def update( def update( self, resource_group_name: str, - ssh_public_key_name: str, + capacity_reservation_group_name: str, parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> _models.SshPublicKeyResource: - """Updates a new SSH public key resource. + ) -> _models.CapacityReservationGroup: + """The operation to update a capacity reservation group. When updating a capacity reservation + group, only tags and sharing profile may be modified. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param ssh_public_key_name: The name of the SSH public key. Required. - :type ssh_public_key_name: str - :param parameters: Parameters supplied to update the SSH public key. Required. + :param capacity_reservation_group_name: The name of the capacity reservation group. Required. + :type capacity_reservation_group_name: str + :param parameters: Parameters supplied to the Update capacity reservation Group operation. + Required. :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: SshPublicKeyResource. The SshPublicKeyResource is compatible with MutableMapping - :rtype: ~azure.mgmt.compute.models.SshPublicKeyResource + :return: CapacityReservationGroup. The CapacityReservationGroup is compatible with + MutableMapping + :rtype: ~azure.mgmt.compute.models.CapacityReservationGroup :raises ~azure.core.exceptions.HttpResponseError: """ @@ -27144,22 +26085,25 @@ def update( def update( self, resource_group_name: str, - ssh_public_key_name: str, - parameters: Union[_models.SshPublicKeyUpdateResource, JSON, IO[bytes]], + capacity_reservation_group_name: str, + parameters: Union[_models.CapacityReservationGroupUpdate, JSON, IO[bytes]], **kwargs: Any - ) -> _models.SshPublicKeyResource: - """Updates a new SSH public key resource. + ) -> _models.CapacityReservationGroup: + """The operation to update a capacity reservation group. When updating a capacity reservation + group, only tags and sharing profile may be modified. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param ssh_public_key_name: The name of the SSH public key. Required. - :type ssh_public_key_name: str - :param parameters: Parameters supplied to update the SSH public key. Is one of the following - types: SshPublicKeyUpdateResource, JSON, IO[bytes] Required. - :type parameters: ~azure.mgmt.compute.models.SshPublicKeyUpdateResource or JSON or IO[bytes] - :return: SshPublicKeyResource. The SshPublicKeyResource is compatible with MutableMapping - :rtype: ~azure.mgmt.compute.models.SshPublicKeyResource + :param capacity_reservation_group_name: The name of the capacity reservation group. Required. + :type capacity_reservation_group_name: str + :param parameters: Parameters supplied to the Update capacity reservation Group operation. Is + one of the following types: CapacityReservationGroupUpdate, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.compute.models.CapacityReservationGroupUpdate or JSON or + IO[bytes] + :return: CapacityReservationGroup. The CapacityReservationGroup is compatible with + MutableMapping + :rtype: ~azure.mgmt.compute.models.CapacityReservationGroup :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -27174,7 +26118,7 @@ def update( _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.SshPublicKeyResource] = kwargs.pop("cls", None) + cls: ClsType[_models.CapacityReservationGroup] = kwargs.pop("cls", None) content_type = content_type or "application/json" _content = None @@ -27183,9 +26127,9 @@ def update( else: _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - _request = build_ssh_public_key_resources_update_request( + _request = build_capacity_reservation_groups_update_request( resource_group_name=resource_group_name, - ssh_public_key_name=ssh_public_key_name, + capacity_reservation_group_name=capacity_reservation_group_name, subscription_id=self._config.subscription_id, content_type=content_type, api_version=self._config.api_version, @@ -27218,7 +26162,7 @@ def update( if _stream: deserialized = response.iter_bytes() else: - deserialized = _deserialize(_models.SshPublicKeyResource, response.json()) + deserialized = _deserialize(_models.CapacityReservationGroup, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -27227,15 +26171,18 @@ def update( @distributed_trace def delete( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, ssh_public_key_name: str, **kwargs: Any + self, resource_group_name: str, capacity_reservation_group_name: str, **kwargs: Any ) -> None: - """Delete an SSH public key. + """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. The name is case insensitive. Required. :type resource_group_name: str - :param ssh_public_key_name: The name of the SSH public key. Required. - :type ssh_public_key_name: str + :param capacity_reservation_group_name: The name of the capacity reservation group. Required. + :type capacity_reservation_group_name: str :return: None :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -27253,9 +26200,9 @@ def delete( # pylint: disable=inconsistent-return-statements cls: ClsType[None] = kwargs.pop("cls", None) - _request = build_ssh_public_key_resources_delete_request( + _request = build_capacity_reservation_groups_delete_request( resource_group_name=resource_group_name, - ssh_public_key_name=ssh_public_key_name, + capacity_reservation_group_name=capacity_reservation_group_name, subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -27283,22 +26230,31 @@ def delete( # pylint: disable=inconsistent-return-statements @distributed_trace def list_by_resource_group( - self, resource_group_name: str, **kwargs: Any - ) -> ItemPaged["_models.SshPublicKeyResource"]: - """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. + self, + resource_group_name: str, + *, + expand: Optional[Union[str, _models.ExpandTypesForGetCapacityReservationGroups]] = None, + **kwargs: Any + ) -> ItemPaged["_models.CapacityReservationGroup"]: + """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. The name is case insensitive. Required. :type resource_group_name: str - :return: An iterator like instance of SshPublicKeyResource - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.models.SshPublicKeyResource] + :keyword 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. Known values are: + "virtualMachineScaleSetVMs/$ref" and "virtualMachines/$ref". Default value is None. + :paramtype expand: str or ~azure.mgmt.compute.models.ExpandTypesForGetCapacityReservationGroups + :return: An iterator like instance of CapacityReservationGroup + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.models.CapacityReservationGroup] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.SshPublicKeyResource]] = kwargs.pop("cls", None) + cls: ClsType[List[_models.CapacityReservationGroup]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -27311,9 +26267,10 @@ def list_by_resource_group( def prepare_request(next_link=None): if not next_link: - _request = build_ssh_public_key_resources_list_by_resource_group_request( + _request = build_capacity_reservation_groups_list_by_resource_group_request( resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, + expand=expand, api_version=self._config.api_version, headers=_headers, params=_params, @@ -27349,7 +26306,7 @@ def prepare_request(next_link=None): def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.SshPublicKeyResource], deserialized.get("value", [])) + list_of_elem = _deserialize(List[_models.CapacityReservationGroup], deserialized.get("value", [])) if cls: list_of_elem = cls(list_of_elem) # type: ignore return deserialized.get("nextLink") or None, iter(list_of_elem) @@ -27373,18 +26330,38 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) @distributed_trace - def list_by_subscription(self, **kwargs: Any) -> ItemPaged["_models.SshPublicKeyResource"]: - """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. - - :return: An iterator like instance of SshPublicKeyResource - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.models.SshPublicKeyResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[List[_models.SshPublicKeyResource]] = kwargs.pop("cls", None) + def list_by_subscription( + self, + *, + expand: Optional[Union[str, _models.ExpandTypesForGetCapacityReservationGroups]] = None, + resource_ids_only: Optional[Union[str, _models.ResourceIdOptionsForGetCapacityReservationGroups]] = None, + **kwargs: Any + ) -> ItemPaged["_models.CapacityReservationGroup"]: + """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. + + :keyword 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. Known values are: + "virtualMachineScaleSetVMs/$ref" and "virtualMachines/$ref". Default value is None. + :paramtype expand: str or ~azure.mgmt.compute.models.ExpandTypesForGetCapacityReservationGroups + :keyword resource_ids_only: The query option to fetch Capacity Reservation Group Resource Ids. +
'CreatedInSubscription' enables fetching Resource Ids for all capacity reservation group + resources created in the subscription.
'SharedWithSubscription' enables fetching Resource + Ids for all capacity reservation group resources shared with the subscription.
'All' + enables fetching Resource Ids for all capacity reservation group resources shared with the + subscription and created in the subscription. Known values are: "CreatedInSubscription", + "SharedWithSubscription", and "All". Default value is None. + :paramtype resource_ids_only: str or + ~azure.mgmt.compute.models.ResourceIdOptionsForGetCapacityReservationGroups + :return: An iterator like instance of CapacityReservationGroup + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.models.CapacityReservationGroup] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.CapacityReservationGroup]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -27397,8 +26374,10 @@ def list_by_subscription(self, **kwargs: Any) -> ItemPaged["_models.SshPublicKey def prepare_request(next_link=None): if not next_link: - _request = build_ssh_public_key_resources_list_by_subscription_request( + _request = build_capacity_reservation_groups_list_by_subscription_request( subscription_id=self._config.subscription_id, + expand=expand, + resource_ids_only=resource_ids_only, api_version=self._config.api_version, headers=_headers, params=_params, @@ -27434,7 +26413,7 @@ def prepare_request(next_link=None): def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.SshPublicKeyResource], deserialized.get("value", [])) + list_of_elem = _deserialize(List[_models.CapacityReservationGroup], deserialized.get("value", [])) if cls: list_of_elem = cls(list_of_elem) # type: ignore return deserialized.get("nextLink") or None, iter(list_of_elem) @@ -27457,198 +26436,15 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - @overload - def generate_key_pair( - self, - resource_group_name: str, - ssh_public_key_name: str, - parameters: Optional[_models.SshGenerateKeyPairInputParameters] = None, - *, - content_type: str = "application/json", - **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. The name is case insensitive. - Required. - :type resource_group_name: str - :param ssh_public_key_name: The name of the SSH public key. Required. - :type ssh_public_key_name: str - :param parameters: Parameters supplied to generate the SSH public key. Default value is None. - :type parameters: ~azure.mgmt.compute.models.SshGenerateKeyPairInputParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: SshPublicKeyGenerateKeyPairResult. The SshPublicKeyGenerateKeyPairResult is compatible - with MutableMapping - :rtype: ~azure.mgmt.compute.models.SshPublicKeyGenerateKeyPairResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def generate_key_pair( - self, - resource_group_name: str, - ssh_public_key_name: str, - parameters: Optional[JSON] = None, - *, - content_type: str = "application/json", - **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. The name is case insensitive. - Required. - :type resource_group_name: str - :param ssh_public_key_name: The name of the SSH public key. Required. - :type ssh_public_key_name: str - :param parameters: Parameters supplied to generate the SSH public key. Default value is None. - :type parameters: JSON - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: SshPublicKeyGenerateKeyPairResult. The SshPublicKeyGenerateKeyPairResult is compatible - with MutableMapping - :rtype: ~azure.mgmt.compute.models.SshPublicKeyGenerateKeyPairResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def generate_key_pair( - self, - resource_group_name: str, - ssh_public_key_name: str, - parameters: Optional[IO[bytes]] = None, - *, - content_type: str = "application/json", - **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. The name is case insensitive. - Required. - :type resource_group_name: str - :param ssh_public_key_name: The name of the SSH public key. Required. - :type ssh_public_key_name: str - :param parameters: Parameters supplied to generate the SSH public key. Default value is None. - :type parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: SshPublicKeyGenerateKeyPairResult. The SshPublicKeyGenerateKeyPairResult is compatible - with MutableMapping - :rtype: ~azure.mgmt.compute.models.SshPublicKeyGenerateKeyPairResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def generate_key_pair( - self, - resource_group_name: str, - ssh_public_key_name: str, - parameters: Optional[Union[_models.SshGenerateKeyPairInputParameters, JSON, IO[bytes]]] = None, - **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. The name is case insensitive. - Required. - :type resource_group_name: str - :param ssh_public_key_name: The name of the SSH public key. Required. - :type ssh_public_key_name: str - :param parameters: Parameters supplied to generate the SSH public key. Is one of the following - types: SshGenerateKeyPairInputParameters, JSON, IO[bytes] Default value is None. - :type parameters: ~azure.mgmt.compute.models.SshGenerateKeyPairInputParameters or JSON or - IO[bytes] - :return: SshPublicKeyGenerateKeyPairResult. The SshPublicKeyGenerateKeyPairResult is compatible - with MutableMapping - :rtype: ~azure.mgmt.compute.models.SshPublicKeyGenerateKeyPairResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} - - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - content_type = content_type if parameters else None - cls: ClsType[_models.SshPublicKeyGenerateKeyPairResult] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" if parameters else None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - if parameters is not None: - _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - else: - _content = None - - _request = build_ssh_public_key_resources_generate_key_pair_request( - resource_group_name=resource_group_name, - ssh_public_key_name=ssh_public_key_name, - subscription_id=self._config.subscription_id, - content_type=content_type, - api_version=self._config.api_version, - content=_content, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - _stream = kwargs.pop("stream", False) - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - if _stream: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.CloudError, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if _stream: - deserialized = response.iter_bytes() - else: - deserialized = _deserialize(_models.SshPublicKeyGenerateKeyPairResult, response.json()) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - -class ImagesOperations: +class CapacityReservationsOperations: """ .. warning:: **DO NOT** instantiate this class directly. Instead, you should access the following operations through :class:`~azure.mgmt.compute.ComputeClient`'s - :attr:`images` attribute. + :attr:`capacity_reservations` attribute. """ def __init__(self, *args, **kwargs) -> None: @@ -27660,19 +26456,29 @@ def __init__(self, *args, **kwargs) -> None: @distributed_trace def get( - self, resource_group_name: str, image_name: str, *, expand: Optional[str] = None, **kwargs: Any - ) -> _models.Image: - """Gets an image. + 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. The name is case insensitive. Required. :type resource_group_name: str - :param image_name: The name of the image. Required. - :type image_name: str - :keyword expand: The expand expression to apply on the operation. Default value is None. - :paramtype expand: str - :return: Image. The Image is compatible with MutableMapping - :rtype: ~azure.mgmt.compute.models.Image + :param capacity_reservation_group_name: The name of the capacity reservation group. Required. + :type capacity_reservation_group_name: str + :param capacity_reservation_name: The name of the capacity reservation. Required. + :type capacity_reservation_name: str + :keyword 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. "instanceView" Default value is None. + :paramtype expand: str or ~azure.mgmt.compute.models.CapacityReservationInstanceViewTypes + :return: CapacityReservation. The CapacityReservation is compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.CapacityReservation :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -27686,11 +26492,12 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.Image] = kwargs.pop("cls", None) + cls: ClsType[_models.CapacityReservation] = kwargs.pop("cls", None) - _request = build_images_get_request( + _request = build_capacity_reservations_get_request( resource_group_name=resource_group_name, - image_name=image_name, + capacity_reservation_group_name=capacity_reservation_group_name, + capacity_reservation_name=capacity_reservation_name, subscription_id=self._config.subscription_id, expand=expand, api_version=self._config.api_version, @@ -27722,7 +26529,7 @@ def get( if _stream: deserialized = response.iter_bytes() else: - deserialized = _deserialize(_models.Image, response.json()) + deserialized = _deserialize(_models.CapacityReservation, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -27732,8 +26539,9 @@ def get( def _create_or_update_initial( self, resource_group_name: str, - image_name: str, - parameters: Union[_models.Image, JSON, IO[bytes]], + capacity_reservation_group_name: str, + capacity_reservation_name: str, + parameters: Union[_models.CapacityReservation, JSON, IO[bytes]], **kwargs: Any ) -> Iterator[bytes]: error_map: MutableMapping = { @@ -27757,9 +26565,10 @@ def _create_or_update_initial( else: _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - _request = build_images_create_or_update_request( + _request = build_capacity_reservations_create_or_update_request( resource_group_name=resource_group_name, - image_name=image_name, + capacity_reservation_group_name=capacity_reservation_group_name, + capacity_reservation_name=capacity_reservation_name, subscription_id=self._config.subscription_id, content_type=content_type, api_version=self._config.api_version, @@ -27804,26 +26613,32 @@ def _create_or_update_initial( def begin_create_or_update( self, resource_group_name: str, - image_name: str, - parameters: _models.Image, + capacity_reservation_group_name: str, + capacity_reservation_name: str, + parameters: _models.CapacityReservation, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[None]: - """Create or update an image. + ) -> 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. The name is case insensitive. Required. :type resource_group_name: str - :param image_name: The name of the image. Required. - :type image_name: str - :param parameters: Parameters supplied to the Create Image operation. Required. - :type parameters: ~azure.mgmt.compute.models.Image + :param capacity_reservation_group_name: The name of the capacity reservation group. Required. + :type capacity_reservation_group_name: str + :param capacity_reservation_name: The name of the capacity reservation. Required. + :type capacity_reservation_name: str + :param parameters: Parameters supplied to the Create capacity reservation. Required. + :type parameters: ~azure.mgmt.compute.models.CapacityReservation :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns None - :rtype: ~azure.core.polling.LROPoller[None] + :return: An instance of LROPoller that returns CapacityReservation. The CapacityReservation is + compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.CapacityReservation] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -27831,26 +26646,32 @@ def begin_create_or_update( def begin_create_or_update( self, resource_group_name: str, - image_name: str, + capacity_reservation_group_name: str, + capacity_reservation_name: str, parameters: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[None]: - """Create or update an image. + ) -> 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. The name is case insensitive. Required. :type resource_group_name: str - :param image_name: The name of the image. Required. - :type image_name: str - :param parameters: Parameters supplied to the Create Image operation. Required. + :param capacity_reservation_group_name: The name of the capacity reservation group. Required. + :type capacity_reservation_group_name: str + :param capacity_reservation_name: The name of the capacity reservation. Required. + :type capacity_reservation_name: str + :param parameters: Parameters supplied to the Create capacity reservation. Required. :type parameters: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns None - :rtype: ~azure.core.polling.LROPoller[None] + :return: An instance of LROPoller that returns CapacityReservation. The CapacityReservation is + compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.CapacityReservation] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -27858,26 +26679,32 @@ def begin_create_or_update( def begin_create_or_update( self, resource_group_name: str, - image_name: str, + capacity_reservation_group_name: str, + capacity_reservation_name: str, parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[None]: - """Create or update an image. + ) -> 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. The name is case insensitive. Required. :type resource_group_name: str - :param image_name: The name of the image. Required. - :type image_name: str - :param parameters: Parameters supplied to the Create Image operation. Required. + :param capacity_reservation_group_name: The name of the capacity reservation group. Required. + :type capacity_reservation_group_name: str + :param capacity_reservation_name: The name of the capacity reservation. Required. + :type capacity_reservation_name: str + :param parameters: Parameters supplied to the Create capacity reservation. Required. :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns None - :rtype: ~azure.core.polling.LROPoller[None] + :return: An instance of LROPoller that returns CapacityReservation. The CapacityReservation is + compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.CapacityReservation] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -27885,36 +26712,43 @@ def begin_create_or_update( def begin_create_or_update( self, resource_group_name: str, - image_name: str, - parameters: Union[_models.Image, JSON, IO[bytes]], + capacity_reservation_group_name: str, + capacity_reservation_name: str, + parameters: Union[_models.CapacityReservation, JSON, IO[bytes]], **kwargs: Any - ) -> LROPoller[None]: - """Create or update an image. + ) -> 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. The name is case insensitive. Required. :type resource_group_name: str - :param image_name: The name of the image. Required. - :type image_name: str - :param parameters: Parameters supplied to the Create Image operation. Is one of the following - types: Image, JSON, IO[bytes] Required. - :type parameters: ~azure.mgmt.compute.models.Image or JSON or IO[bytes] - :return: An instance of LROPoller that returns None - :rtype: ~azure.core.polling.LROPoller[None] + :param capacity_reservation_group_name: The name of the capacity reservation group. Required. + :type capacity_reservation_group_name: str + :param capacity_reservation_name: The name of the capacity reservation. Required. + :type capacity_reservation_name: str + :param parameters: Parameters supplied to the Create capacity reservation. Is one of the + following types: CapacityReservation, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.compute.models.CapacityReservation or JSON or IO[bytes] + :return: An instance of LROPoller that returns CapacityReservation. The CapacityReservation is + compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.CapacityReservation] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[_models.CapacityReservation] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = self._create_or_update_initial( resource_group_name=resource_group_name, - image_name=image_name, + capacity_reservation_group_name=capacity_reservation_group_name, + capacity_reservation_name=capacity_reservation_name, parameters=parameters, content_type=content_type, cls=lambda x, y, z: x, @@ -27925,9 +26759,12 @@ def begin_create_or_update( raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.CapacityReservation, response.json()) if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized path_format_arguments = { "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), @@ -27942,19 +26779,22 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return LROPoller[None].from_continuation_token( + return LROPoller[_models.CapacityReservation].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + return LROPoller[_models.CapacityReservation]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) def _update_initial( self, resource_group_name: str, - image_name: str, - parameters: Union[_models.ImageUpdate, JSON, IO[bytes]], + capacity_reservation_group_name: str, + capacity_reservation_name: str, + parameters: Union[_models.CapacityReservationUpdate, JSON, IO[bytes]], **kwargs: Any ) -> Iterator[bytes]: error_map: MutableMapping = { @@ -27978,9 +26818,10 @@ def _update_initial( else: _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - _request = build_images_update_request( + _request = build_capacity_reservations_update_request( resource_group_name=resource_group_name, - image_name=image_name, + capacity_reservation_group_name=capacity_reservation_group_name, + capacity_reservation_name=capacity_reservation_name, subscription_id=self._config.subscription_id, content_type=content_type, api_version=self._config.api_version, @@ -28000,7 +26841,7 @@ def _update_initial( response = pipeline_response.http_response - if response.status_code not in [200, 201]: + if response.status_code not in [200, 202]: try: response.read() # Load the body in memory and close the socket except (StreamConsumedError, StreamClosedError): @@ -28010,7 +26851,7 @@ def _update_initial( raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} - if response.status_code == 201: + if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) @@ -28025,26 +26866,30 @@ def _update_initial( def begin_update( self, resource_group_name: str, - image_name: str, - parameters: _models.ImageUpdate, + capacity_reservation_group_name: str, + capacity_reservation_name: str, + parameters: _models.CapacityReservationUpdate, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[None]: - """Update an image. + ) -> LROPoller[_models.CapacityReservation]: + """The operation to update a capacity reservation. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param image_name: The name of the image. Required. - :type image_name: str - :param parameters: Parameters supplied to the Update Image operation. Required. - :type parameters: ~azure.mgmt.compute.models.ImageUpdate + :param capacity_reservation_group_name: The name of the capacity reservation group. Required. + :type capacity_reservation_group_name: str + :param capacity_reservation_name: The name of the capacity reservation. Required. + :type capacity_reservation_name: str + :param parameters: Parameters supplied to the Update capacity reservation operation. Required. + :type parameters: ~azure.mgmt.compute.models.CapacityReservationUpdate :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns None - :rtype: ~azure.core.polling.LROPoller[None] + :return: An instance of LROPoller that returns CapacityReservation. The CapacityReservation is + compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.CapacityReservation] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -28052,26 +26897,30 @@ def begin_update( def begin_update( self, resource_group_name: str, - image_name: str, + capacity_reservation_group_name: str, + capacity_reservation_name: str, parameters: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[None]: - """Update an image. + ) -> LROPoller[_models.CapacityReservation]: + """The operation to update a capacity reservation. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param image_name: The name of the image. Required. - :type image_name: str - :param parameters: Parameters supplied to the Update Image operation. Required. + :param capacity_reservation_group_name: The name of the capacity reservation group. Required. + :type capacity_reservation_group_name: str + :param capacity_reservation_name: The name of the capacity reservation. Required. + :type capacity_reservation_name: str + :param parameters: Parameters supplied to the Update capacity reservation operation. Required. :type parameters: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns None - :rtype: ~azure.core.polling.LROPoller[None] + :return: An instance of LROPoller that returns CapacityReservation. The CapacityReservation is + compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.CapacityReservation] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -28079,26 +26928,30 @@ def begin_update( def begin_update( self, resource_group_name: str, - image_name: str, + capacity_reservation_group_name: str, + capacity_reservation_name: str, parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[None]: - """Update an image. + ) -> LROPoller[_models.CapacityReservation]: + """The operation to update a capacity reservation. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param image_name: The name of the image. Required. - :type image_name: str - :param parameters: Parameters supplied to the Update Image operation. Required. + :param capacity_reservation_group_name: The name of the capacity reservation group. Required. + :type capacity_reservation_group_name: str + :param capacity_reservation_name: The name of the capacity reservation. Required. + :type capacity_reservation_name: str + :param parameters: Parameters supplied to the Update capacity reservation operation. Required. :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns None - :rtype: ~azure.core.polling.LROPoller[None] + :return: An instance of LROPoller that returns CapacityReservation. The CapacityReservation is + compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.CapacityReservation] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -28106,36 +26959,41 @@ def begin_update( def begin_update( self, resource_group_name: str, - image_name: str, - parameters: Union[_models.ImageUpdate, JSON, IO[bytes]], + capacity_reservation_group_name: str, + capacity_reservation_name: str, + parameters: Union[_models.CapacityReservationUpdate, JSON, IO[bytes]], **kwargs: Any - ) -> LROPoller[None]: - """Update an image. + ) -> LROPoller[_models.CapacityReservation]: + """The operation to update a capacity reservation. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param image_name: The name of the image. Required. - :type image_name: str - :param parameters: Parameters supplied to the Update Image operation. Is one of the following - types: ImageUpdate, JSON, IO[bytes] Required. - :type parameters: ~azure.mgmt.compute.models.ImageUpdate or JSON or IO[bytes] - :return: An instance of LROPoller that returns None - :rtype: ~azure.core.polling.LROPoller[None] + :param capacity_reservation_group_name: The name of the capacity reservation group. Required. + :type capacity_reservation_group_name: str + :param capacity_reservation_name: The name of the capacity reservation. Required. + :type capacity_reservation_name: str + :param parameters: Parameters supplied to the Update capacity reservation operation. Is one of + the following types: CapacityReservationUpdate, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.compute.models.CapacityReservationUpdate or JSON or IO[bytes] + :return: An instance of LROPoller that returns CapacityReservation. The CapacityReservation is + compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.CapacityReservation] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[_models.CapacityReservation] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = self._update_initial( resource_group_name=resource_group_name, - image_name=image_name, + capacity_reservation_group_name=capacity_reservation_group_name, + capacity_reservation_name=capacity_reservation_name, parameters=parameters, content_type=content_type, cls=lambda x, y, z: x, @@ -28146,9 +27004,12 @@ def begin_update( raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.CapacityReservation, response.json()) if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized path_format_arguments = { "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), @@ -28163,15 +27024,23 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return LROPoller[None].from_continuation_token( + return LROPoller[_models.CapacityReservation].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + return LROPoller[_models.CapacityReservation]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) - def _delete_initial(self, resource_group_name: str, image_name: str, **kwargs: Any) -> Iterator[bytes]: + def _delete_initial( + self, + resource_group_name: str, + capacity_reservation_group_name: str, + capacity_reservation_name: str, + **kwargs: Any + ) -> Iterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -28185,9 +27054,10 @@ def _delete_initial(self, resource_group_name: str, image_name: str, **kwargs: A cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - _request = build_images_delete_request( + _request = build_capacity_reservations_delete_request( resource_group_name=resource_group_name, - image_name=image_name, + capacity_reservation_group_name=capacity_reservation_group_name, + capacity_reservation_name=capacity_reservation_name, subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -28227,16 +27097,28 @@ def _delete_initial(self, resource_group_name: str, image_name: str, **kwargs: A return deserialized # type: ignore @distributed_trace - def begin_delete(self, resource_group_name: str, image_name: str, **kwargs: Any) -> LROPoller[None]: - """Deletes an Image. + def begin_delete( + 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. + Note: Block capacity reservations cannot be deleted after it has been successfully allocated + until the schedule end time. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param image_name: The name of the image. Required. - :type image_name: str - :return: An instance of LROPoller that returns None - :rtype: ~azure.core.polling.LROPoller[None] + :param capacity_reservation_group_name: The name of the capacity reservation group. Required. + :type capacity_reservation_group_name: str + :param capacity_reservation_name: The name of the capacity reservation. Required. + :type capacity_reservation_name: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} @@ -28249,7 +27131,8 @@ def begin_delete(self, resource_group_name: str, image_name: str, **kwargs: Any) if cont_token is None: raw_result = self._delete_initial( resource_group_name=resource_group_name, - image_name=image_name, + capacity_reservation_group_name=capacity_reservation_group_name, + capacity_reservation_name=capacity_reservation_name, cls=lambda x, y, z: x, headers=_headers, params=_params, @@ -28284,21 +27167,25 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore @distributed_trace - def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> ItemPaged["_models.Image"]: - """Gets the list of images under a resource group. Use nextLink property in the response to get - the next page of Images. Do this till nextLink is null to fetch all the Images. + def list_by_capacity_reservation_group( + self, resource_group_name: str, capacity_reservation_group_name: str, **kwargs: Any + ) -> ItemPaged["_models.CapacityReservation"]: + """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. The name is case insensitive. Required. :type resource_group_name: str - :return: An iterator like instance of Image - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.models.Image] + :param capacity_reservation_group_name: The name of the capacity reservation group. Required. + :type capacity_reservation_group_name: str + :return: An iterator like instance of CapacityReservation + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.models.CapacityReservation] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.Image]] = kwargs.pop("cls", None) + cls: ClsType[List[_models.CapacityReservation]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -28311,8 +27198,9 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Ite def prepare_request(next_link=None): if not next_link: - _request = build_images_list_by_resource_group_request( + _request = build_capacity_reservations_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=self._config.api_version, headers=_headers, @@ -28349,92 +27237,7 @@ def prepare_request(next_link=None): def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.Image], deserialized.get("value", [])) - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.get("nextLink") or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.CloudError, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @distributed_trace - def list(self, **kwargs: Any) -> ItemPaged["_models.Image"]: - """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. - - :return: An iterator like instance of Image - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.models.Image] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[List[_models.Image]] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_images_list_request( - subscription_id=self._config.subscription_id, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - return _request - - def extract_data(pipeline_response): - deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.Image], deserialized.get("value", [])) + list_of_elem = _deserialize(List[_models.CapacityReservation], deserialized.get("value", [])) if cls: list_of_elem = cls(list_of_elem) # type: ignore return deserialized.get("nextLink") or None, iter(list_of_elem) @@ -28458,14 +27261,14 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) -class RestorePointCollectionsOperations: +class VirtualMachineRunCommandsOperations: """ .. warning:: **DO NOT** instantiate this class directly. Instead, you should access the following operations through :class:`~azure.mgmt.compute.ComputeClient`'s - :attr:`restore_point_collections` attribute. + :attr:`virtual_machine_run_commands` attribute. """ def __init__(self, *args, **kwargs) -> None: @@ -28476,27 +27279,29 @@ def __init__(self, *args, **kwargs) -> None: self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace - def get( + def get_by_virtual_machine( self, resource_group_name: str, - restore_point_collection_name: str, + vm_name: str, + run_command_name: str, *, - expand: Optional[Union[str, _models.RestorePointCollectionExpandOptions]] = None, + expand: Optional[str] = None, **kwargs: Any - ) -> _models.RestorePointCollection: - """The operation to get the restore point collection. + ) -> _models.VirtualMachineRunCommand: + """The operation to get the run command. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param restore_point_collection_name: The name of the restore point collection. Required. - :type restore_point_collection_name: str - :keyword expand: The expand expression to apply on the operation. If expand=restorePoints, - server will return all contained restore points in the restorePointCollection. "restorePoints" - Default value is None. - :paramtype expand: str or ~azure.mgmt.compute.models.RestorePointCollectionExpandOptions - :return: RestorePointCollection. The RestorePointCollection is compatible with MutableMapping - :rtype: ~azure.mgmt.compute.models.RestorePointCollection + :param vm_name: The name of the VirtualMachine. Required. + :type vm_name: str + :param run_command_name: The name of the VirtualMachineRunCommand. Required. + :type run_command_name: str + :keyword expand: The expand expression to apply on the operation. Default value is None. + :paramtype expand: str + :return: VirtualMachineRunCommand. The VirtualMachineRunCommand is compatible with + MutableMapping + :rtype: ~azure.mgmt.compute.models.VirtualMachineRunCommand :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -28510,11 +27315,12 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.RestorePointCollection] = kwargs.pop("cls", None) + cls: ClsType[_models.VirtualMachineRunCommand] = kwargs.pop("cls", None) - _request = build_restore_point_collections_get_request( + _request = build_virtual_machine_run_commands_get_by_virtual_machine_request( resource_group_name=resource_group_name, - restore_point_collection_name=restore_point_collection_name, + vm_name=vm_name, + run_command_name=run_command_name, subscription_id=self._config.subscription_id, expand=expand, api_version=self._config.api_version, @@ -28546,127 +27352,269 @@ def get( if _stream: deserialized = response.iter_bytes() else: - deserialized = _deserialize(_models.RestorePointCollection, response.json()) + deserialized = _deserialize(_models.VirtualMachineRunCommand, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore + def _create_or_update_initial( + self, + resource_group_name: str, + vm_name: str, + run_command_name: str, + run_command: Union[_models.VirtualMachineRunCommand, JSON, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(run_command, (IOBase, bytes)): + _content = run_command + else: + _content = json.dumps(run_command, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_virtual_machine_run_commands_create_or_update_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + run_command_name=run_command_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 201: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + @overload - def create_or_update( + def begin_create_or_update( self, resource_group_name: str, - restore_point_collection_name: str, - parameters: _models.RestorePointCollection, + vm_name: str, + run_command_name: str, + run_command: _models.VirtualMachineRunCommand, *, content_type: str = "application/json", **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. + ) -> LROPoller[_models.VirtualMachineRunCommand]: + """The operation to create or update the run command. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param restore_point_collection_name: The name of the restore point collection. Required. - :type restore_point_collection_name: str - :param parameters: Parameters supplied to the Create or Update restore point collection - operation. Required. - :type parameters: ~azure.mgmt.compute.models.RestorePointCollection + :param vm_name: The name of the VirtualMachine. Required. + :type vm_name: str + :param run_command_name: The name of the VirtualMachineRunCommand. Required. + :type run_command_name: str + :param run_command: Parameters supplied to the Create Virtual Machine RunCommand operation. + Required. + :type run_command: ~azure.mgmt.compute.models.VirtualMachineRunCommand :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: RestorePointCollection. The RestorePointCollection is compatible with MutableMapping - :rtype: ~azure.mgmt.compute.models.RestorePointCollection + :return: An instance of LROPoller that returns VirtualMachineRunCommand. The + VirtualMachineRunCommand is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.VirtualMachineRunCommand] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def create_or_update( + def begin_create_or_update( self, resource_group_name: str, - restore_point_collection_name: str, - parameters: JSON, + vm_name: str, + run_command_name: str, + run_command: JSON, *, content_type: str = "application/json", **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. + ) -> LROPoller[_models.VirtualMachineRunCommand]: + """The operation to create or update the run command. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param restore_point_collection_name: The name of the restore point collection. Required. - :type restore_point_collection_name: str - :param parameters: Parameters supplied to the Create or Update restore point collection - operation. Required. - :type parameters: JSON + :param vm_name: The name of the VirtualMachine. Required. + :type vm_name: str + :param run_command_name: The name of the VirtualMachineRunCommand. Required. + :type run_command_name: str + :param run_command: Parameters supplied to the Create Virtual Machine RunCommand operation. + Required. + :type run_command: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: RestorePointCollection. The RestorePointCollection is compatible with MutableMapping - :rtype: ~azure.mgmt.compute.models.RestorePointCollection + :return: An instance of LROPoller that returns VirtualMachineRunCommand. The + VirtualMachineRunCommand is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.VirtualMachineRunCommand] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def create_or_update( + def begin_create_or_update( self, resource_group_name: str, - restore_point_collection_name: str, - parameters: IO[bytes], + vm_name: str, + run_command_name: str, + run_command: IO[bytes], *, content_type: str = "application/json", **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. + ) -> LROPoller[_models.VirtualMachineRunCommand]: + """The operation to create or update the run command. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param restore_point_collection_name: The name of the restore point collection. Required. - :type restore_point_collection_name: str - :param parameters: Parameters supplied to the Create or Update restore point collection - operation. Required. - :type parameters: IO[bytes] + :param vm_name: The name of the VirtualMachine. Required. + :type vm_name: str + :param run_command_name: The name of the VirtualMachineRunCommand. Required. + :type run_command_name: str + :param run_command: Parameters supplied to the Create Virtual Machine RunCommand operation. + Required. + :type run_command: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: RestorePointCollection. The RestorePointCollection is compatible with MutableMapping - :rtype: ~azure.mgmt.compute.models.RestorePointCollection + :return: An instance of LROPoller that returns VirtualMachineRunCommand. The + VirtualMachineRunCommand is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.VirtualMachineRunCommand] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace - def create_or_update( + def begin_create_or_update( self, resource_group_name: str, - restore_point_collection_name: str, - parameters: Union[_models.RestorePointCollection, JSON, IO[bytes]], + vm_name: str, + run_command_name: str, + run_command: Union[_models.VirtualMachineRunCommand, JSON, IO[bytes]], **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. + ) -> LROPoller[_models.VirtualMachineRunCommand]: + """The operation to create or update the run command. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param restore_point_collection_name: The name of the restore point collection. Required. - :type restore_point_collection_name: str - :param parameters: Parameters supplied to the Create or Update restore point collection - operation. Is one of the following types: RestorePointCollection, JSON, IO[bytes] Required. - :type parameters: ~azure.mgmt.compute.models.RestorePointCollection or JSON or IO[bytes] - :return: RestorePointCollection. The RestorePointCollection is compatible with MutableMapping - :rtype: ~azure.mgmt.compute.models.RestorePointCollection + :param vm_name: The name of the VirtualMachine. Required. + :type vm_name: str + :param run_command_name: The name of the VirtualMachineRunCommand. Required. + :type run_command_name: str + :param run_command: Parameters supplied to the Create Virtual Machine RunCommand operation. Is + one of the following types: VirtualMachineRunCommand, JSON, IO[bytes] Required. + :type run_command: ~azure.mgmt.compute.models.VirtualMachineRunCommand or JSON or IO[bytes] + :return: An instance of LROPoller that returns VirtualMachineRunCommand. The + VirtualMachineRunCommand is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.VirtualMachineRunCommand] :raises ~azure.core.exceptions.HttpResponseError: """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.VirtualMachineRunCommand] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + run_command_name=run_command_name, + run_command=run_command, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.VirtualMachineRunCommand, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.VirtualMachineRunCommand].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.VirtualMachineRunCommand]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _update_initial( + self, + resource_group_name: str, + vm_name: str, + run_command_name: str, + run_command: Union[_models.VirtualMachineRunCommandUpdate, JSON, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -28679,18 +27627,19 @@ def create_or_update( _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.RestorePointCollection] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters + if isinstance(run_command, (IOBase, bytes)): + _content = run_command else: - _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(run_command, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - _request = build_restore_point_collections_create_or_update_request( + _request = build_virtual_machine_run_commands_update_request( resource_group_name=resource_group_name, - restore_point_collection_name=restore_point_collection_name, + vm_name=vm_name, + run_command_name=run_command_name, subscription_id=self._config.subscription_id, content_type=content_type, api_version=self._config.api_version, @@ -28703,204 +27652,215 @@ def create_or_update( } _request.url = self._client.format_url(_request.url, **path_format_arguments) - _stream = kwargs.pop("stream", False) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200, 201]: - if _stream: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass + if response.status_code not in [200]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = _failsafe_deserialize(_models.CloudError, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if _stream: - deserialized = response.iter_bytes() - else: - deserialized = _deserialize(_models.RestorePointCollection, response.json()) + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore @overload - def update( + def begin_update( self, resource_group_name: str, - restore_point_collection_name: str, - parameters: _models.RestorePointCollectionUpdate, + vm_name: str, + run_command_name: str, + run_command: _models.VirtualMachineRunCommandUpdate, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.RestorePointCollection: - """The operation to update the restore point collection. + ) -> LROPoller[_models.VirtualMachineRunCommand]: + """The operation to update the run command. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param restore_point_collection_name: The name of the restore point collection. Required. - :type restore_point_collection_name: str - :param parameters: Parameters supplied to the Update restore point collection operation. + :param vm_name: The name of the VirtualMachine. Required. + :type vm_name: str + :param run_command_name: The name of the VirtualMachineRunCommand. Required. + :type run_command_name: str + :param run_command: Parameters supplied to the Update Virtual Machine RunCommand operation. Required. - :type parameters: ~azure.mgmt.compute.models.RestorePointCollectionUpdate + :type run_command: ~azure.mgmt.compute.models.VirtualMachineRunCommandUpdate :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: RestorePointCollection. The RestorePointCollection is compatible with MutableMapping - :rtype: ~azure.mgmt.compute.models.RestorePointCollection + :return: An instance of LROPoller that returns VirtualMachineRunCommand. The + VirtualMachineRunCommand is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.VirtualMachineRunCommand] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def update( + def begin_update( self, resource_group_name: str, - restore_point_collection_name: str, - parameters: JSON, + vm_name: str, + run_command_name: str, + run_command: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.RestorePointCollection: - """The operation to update the restore point collection. + ) -> LROPoller[_models.VirtualMachineRunCommand]: + """The operation to update the run command. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param restore_point_collection_name: The name of the restore point collection. Required. - :type restore_point_collection_name: str - :param parameters: Parameters supplied to the Update restore point collection operation. + :param vm_name: The name of the VirtualMachine. Required. + :type vm_name: str + :param run_command_name: The name of the VirtualMachineRunCommand. Required. + :type run_command_name: str + :param run_command: Parameters supplied to the Update Virtual Machine RunCommand operation. Required. - :type parameters: JSON + :type run_command: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: RestorePointCollection. The RestorePointCollection is compatible with MutableMapping - :rtype: ~azure.mgmt.compute.models.RestorePointCollection + :return: An instance of LROPoller that returns VirtualMachineRunCommand. The + VirtualMachineRunCommand is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.VirtualMachineRunCommand] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def update( + def begin_update( self, resource_group_name: str, - restore_point_collection_name: str, - parameters: IO[bytes], + vm_name: str, + run_command_name: str, + run_command: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> _models.RestorePointCollection: - """The operation to update the restore point collection. + ) -> LROPoller[_models.VirtualMachineRunCommand]: + """The operation to update the run command. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param restore_point_collection_name: The name of the restore point collection. Required. - :type restore_point_collection_name: str - :param parameters: Parameters supplied to the Update restore point collection operation. + :param vm_name: The name of the VirtualMachine. Required. + :type vm_name: str + :param run_command_name: The name of the VirtualMachineRunCommand. Required. + :type run_command_name: str + :param run_command: Parameters supplied to the Update Virtual Machine RunCommand operation. Required. - :type parameters: IO[bytes] + :type run_command: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: RestorePointCollection. The RestorePointCollection is compatible with MutableMapping - :rtype: ~azure.mgmt.compute.models.RestorePointCollection + :return: An instance of LROPoller that returns VirtualMachineRunCommand. The + VirtualMachineRunCommand is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.VirtualMachineRunCommand] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace - def update( + def begin_update( self, resource_group_name: str, - restore_point_collection_name: str, - parameters: Union[_models.RestorePointCollectionUpdate, JSON, IO[bytes]], + vm_name: str, + run_command_name: str, + run_command: Union[_models.VirtualMachineRunCommandUpdate, JSON, IO[bytes]], **kwargs: Any - ) -> _models.RestorePointCollection: - """The operation to update the restore point collection. + ) -> LROPoller[_models.VirtualMachineRunCommand]: + """The operation to update the run command. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param restore_point_collection_name: The name of the restore point collection. Required. - :type restore_point_collection_name: str - :param parameters: Parameters supplied to the Update restore point collection operation. Is one - of the following types: RestorePointCollectionUpdate, JSON, IO[bytes] Required. - :type parameters: ~azure.mgmt.compute.models.RestorePointCollectionUpdate or JSON or IO[bytes] - :return: RestorePointCollection. The RestorePointCollection is compatible with MutableMapping - :rtype: ~azure.mgmt.compute.models.RestorePointCollection + :param vm_name: The name of the VirtualMachine. Required. + :type vm_name: str + :param run_command_name: The name of the VirtualMachineRunCommand. Required. + :type run_command_name: str + :param run_command: Parameters supplied to the Update Virtual Machine RunCommand operation. Is + one of the following types: VirtualMachineRunCommandUpdate, JSON, IO[bytes] Required. + :type run_command: ~azure.mgmt.compute.models.VirtualMachineRunCommandUpdate or JSON or + IO[bytes] + :return: An instance of LROPoller that returns VirtualMachineRunCommand. The + VirtualMachineRunCommand is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.VirtualMachineRunCommand] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.RestorePointCollection] = kwargs.pop("cls", None) + cls: ClsType[_models.VirtualMachineRunCommand] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._update_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + run_command_name=run_command_name, + run_command=run_command, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) - content_type = content_type or "application/json" - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = _deserialize(_models.VirtualMachineRunCommand, response.json()) + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + return deserialized - _request = build_restore_point_collections_update_request( - resource_group_name=resource_group_name, - restore_point_collection_name=restore_point_collection_name, - subscription_id=self._config.subscription_id, - content_type=content_type, - api_version=self._config.api_version, - content=_content, - headers=_headers, - params=_params, - ) path_format_arguments = { "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = kwargs.pop("stream", False) - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - if _stream: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.CloudError, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if _stream: - deserialized = response.iter_bytes() + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) else: - deserialized = _deserialize(_models.RestorePointCollection, response.json()) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore + polling_method = polling + if cont_token: + return LROPoller[_models.VirtualMachineRunCommand].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.VirtualMachineRunCommand]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) def _delete_initial( - self, resource_group_name: str, restore_point_collection_name: str, **kwargs: Any + self, resource_group_name: str, vm_name: str, run_command_name: str, **kwargs: Any ) -> Iterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -28915,9 +27875,10 @@ def _delete_initial( cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - _request = build_restore_point_collections_delete_request( + _request = build_virtual_machine_run_commands_delete_request( resource_group_name=resource_group_name, - restore_point_collection_name=restore_point_collection_name, + vm_name=vm_name, + run_command_name=run_command_name, subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -28958,16 +27919,17 @@ def _delete_initial( @distributed_trace def begin_delete( - self, resource_group_name: str, restore_point_collection_name: str, **kwargs: Any + self, resource_group_name: str, vm_name: str, run_command_name: str, **kwargs: Any ) -> LROPoller[None]: - """The operation to delete the restore point collection. This operation will also delete all the - contained restore points. + """The operation to delete the run command. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param restore_point_collection_name: The name of the restore point collection. Required. - :type restore_point_collection_name: str + :param vm_name: The name of the VirtualMachine. Required. + :type vm_name: str + :param run_command_name: The name of the VirtualMachineRunCommand. Required. + :type run_command_name: str :return: An instance of LROPoller that returns None :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -28982,7 +27944,8 @@ def begin_delete( if cont_token is None: raw_result = self._delete_initial( resource_group_name=resource_group_name, - restore_point_collection_name=restore_point_collection_name, + vm_name=vm_name, + run_command_name=run_command_name, cls=lambda x, y, z: x, headers=_headers, params=_params, @@ -29017,20 +27980,26 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore @distributed_trace - def list(self, resource_group_name: str, **kwargs: Any) -> ItemPaged["_models.RestorePointCollection"]: - """Gets the list of restore point collections in a resource group. + def list_by_virtual_machine( + self, resource_group_name: str, vm_name: str, *, expand: Optional[str] = None, **kwargs: Any + ) -> ItemPaged["_models.VirtualMachineRunCommand"]: + """The operation to get all run commands of a Virtual Machine. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :return: An iterator like instance of RestorePointCollection - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.models.RestorePointCollection] + :param vm_name: The name of the VirtualMachine. Required. + :type vm_name: str + :keyword expand: The expand expression to apply on the operation. Default value is None. + :paramtype expand: str + :return: An iterator like instance of VirtualMachineRunCommand + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.models.VirtualMachineRunCommand] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.RestorePointCollection]] = kwargs.pop("cls", None) + cls: ClsType[List[_models.VirtualMachineRunCommand]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -29043,9 +28012,11 @@ def list(self, resource_group_name: str, **kwargs: Any) -> ItemPaged["_models.Re def prepare_request(next_link=None): if not next_link: - _request = build_restore_point_collections_list_request( + _request = build_virtual_machine_run_commands_list_by_virtual_machine_request( resource_group_name=resource_group_name, + vm_name=vm_name, subscription_id=self._config.subscription_id, + expand=expand, api_version=self._config.api_version, headers=_headers, params=_params, @@ -29081,7 +28052,7 @@ def prepare_request(next_link=None): def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.RestorePointCollection], deserialized.get("value", [])) + list_of_elem = _deserialize(List[_models.VirtualMachineRunCommand], deserialized.get("value", [])) if cls: list_of_elem = cls(list_of_elem) # type: ignore return deserialized.get("nextLink") or None, iter(list_of_elem) @@ -29105,19 +28076,19 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) @distributed_trace - def list_all(self, **kwargs: Any) -> ItemPaged["_models.RestorePointCollection"]: - """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. + def list(self, location: str, **kwargs: Any) -> ItemPaged["_models.RunCommandDocumentBase"]: + """Lists all available run commands for a subscription in a location. - :return: An iterator like instance of RestorePointCollection - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.models.RestorePointCollection] + :param location: The location name. Required. + :type location: str + :return: An iterator like instance of RunCommandDocumentBase + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.models.RunCommandDocumentBase] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.RestorePointCollection]] = kwargs.pop("cls", None) + cls: ClsType[List[_models.RunCommandDocumentBase]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -29130,7 +28101,8 @@ def list_all(self, **kwargs: Any) -> ItemPaged["_models.RestorePointCollection"] def prepare_request(next_link=None): if not next_link: - _request = build_restore_point_collections_list_all_request( + _request = build_virtual_machine_run_commands_list_request( + location=location, subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -29167,7 +28139,7 @@ def prepare_request(next_link=None): def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.RestorePointCollection], deserialized.get("value", [])) + list_of_elem = _deserialize(List[_models.RunCommandDocumentBase], deserialized.get("value", [])) if cls: list_of_elem = cls(list_of_elem) # type: ignore return deserialized.get("nextLink") or None, iter(list_of_elem) @@ -29190,15 +28162,84 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) + @distributed_trace + def get(self, location: str, command_id: str, **kwargs: Any) -> _models.RunCommandDocument: + """Gets specific run command for a subscription in a location. -class RestorePointsOperations: + :param location: The name of the Azure region. Required. + :type location: str + :param command_id: Specifies a commandId of predefined built-in script. Command IDs available + for Linux are listed at `https://aka.ms/RunCommandManagedLinux#available-commands + `_, Windows at + `https://aka.ms/RunCommandManagedWindows#available-commands + `_. Required. + :type command_id: str + :return: RunCommandDocument. The RunCommandDocument is compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.RunCommandDocument + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.RunCommandDocument] = kwargs.pop("cls", None) + + _request = build_virtual_machine_run_commands_get_request( + location=location, + command_id=command_id, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.RunCommandDocument, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + +class VirtualMachineScaleSetVMRunCommandsOperations: # pylint: disable=name-too-long """ .. warning:: **DO NOT** instantiate this class directly. Instead, you should access the following operations through :class:`~azure.mgmt.compute.ComputeClient`'s - :attr:`restore_points` attribute. + :attr:`virtual_machine_scale_set_vm_run_commands` attribute. """ def __init__(self, *args, **kwargs) -> None: @@ -29212,26 +28253,29 @@ def __init__(self, *args, **kwargs) -> None: def get( self, resource_group_name: str, - restore_point_collection_name: str, - restore_point_name: str, + vm_scale_set_name: str, + instance_id: str, + run_command_name: str, *, - expand: Optional[Union[str, _models.RestorePointExpandOptions]] = None, + expand: Optional[str] = None, **kwargs: Any - ) -> _models.RestorePoint: - """The operation to get the restore point. + ) -> _models.VirtualMachineRunCommand: + """The operation to get the VMSS VM run command. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param restore_point_collection_name: The name of the restore point collection. Required. - :type restore_point_collection_name: str - :param restore_point_name: The name of the restore point. Required. - :type restore_point_name: str - :keyword expand: The expand expression to apply on the operation. 'InstanceView' retrieves - information about the run-time state of a restore point. "instanceView" Default value is None. - :paramtype expand: str or ~azure.mgmt.compute.models.RestorePointExpandOptions - :return: RestorePoint. The RestorePoint is compatible with MutableMapping - :rtype: ~azure.mgmt.compute.models.RestorePoint + :param vm_scale_set_name: The name of the VirtualMachineScaleSet. Required. + :type vm_scale_set_name: str + :param instance_id: The name of the VirtualMachineScaleSetVM. Required. + :type instance_id: str + :param run_command_name: The name of the VirtualMachineRunCommand. Required. + :type run_command_name: str + :keyword expand: The expand expression to apply on the operation. Default value is None. + :paramtype expand: str + :return: VirtualMachineRunCommand. The VirtualMachineRunCommand is compatible with + MutableMapping + :rtype: ~azure.mgmt.compute.models.VirtualMachineRunCommand :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -29245,12 +28289,13 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.RestorePoint] = kwargs.pop("cls", None) + cls: ClsType[_models.VirtualMachineRunCommand] = kwargs.pop("cls", None) - _request = build_restore_points_get_request( + _request = build_virtual_machine_scale_set_vm_run_commands_get_request( resource_group_name=resource_group_name, - restore_point_collection_name=restore_point_collection_name, - restore_point_name=restore_point_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + run_command_name=run_command_name, subscription_id=self._config.subscription_id, expand=expand, api_version=self._config.api_version, @@ -29282,19 +28327,20 @@ def get( if _stream: deserialized = response.iter_bytes() else: - deserialized = _deserialize(_models.RestorePoint, response.json()) + deserialized = _deserialize(_models.VirtualMachineRunCommand, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - def _create_initial( + def _create_or_update_initial( self, resource_group_name: str, - restore_point_collection_name: str, - restore_point_name: str, - parameters: Union[_models.RestorePoint, JSON, IO[bytes]], + vm_scale_set_name: str, + instance_id: str, + run_command_name: str, + run_command: Union[_models.VirtualMachineRunCommand, JSON, IO[bytes]], **kwargs: Any ) -> Iterator[bytes]: error_map: MutableMapping = { @@ -29313,15 +28359,16 @@ def _create_initial( content_type = content_type or "application/json" _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters + if isinstance(run_command, (IOBase, bytes)): + _content = run_command else: - _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(run_command, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - _request = build_restore_points_create_request( + _request = build_virtual_machine_scale_set_vm_run_commands_create_or_update_request( resource_group_name=resource_group_name, - restore_point_collection_name=restore_point_collection_name, - restore_point_name=restore_point_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + run_command_name=run_command_name, subscription_id=self._config.subscription_id, content_type=content_type, api_version=self._config.api_version, @@ -29341,7 +28388,7 @@ def _create_initial( response = pipeline_response.http_response - if response.status_code not in [201]: + if response.status_code not in [200, 201]: try: response.read() # Load the body in memory and close the socket except (StreamConsumedError, StreamClosedError): @@ -29351,8 +28398,9 @@ def _create_initial( raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + if response.status_code == 201: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) deserialized = response.iter_bytes() @@ -29362,138 +28410,154 @@ def _create_initial( return deserialized # type: ignore @overload - def begin_create( + def begin_create_or_update( self, resource_group_name: str, - restore_point_collection_name: str, - restore_point_name: str, - parameters: _models.RestorePoint, + vm_scale_set_name: str, + instance_id: str, + run_command_name: str, + run_command: _models.VirtualMachineRunCommand, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[None]: - """The operation to create the restore point. Updating properties of an existing restore point is - not allowed. + ) -> LROPoller[_models.VirtualMachineRunCommand]: + """The operation to create or update the VMSS VM run command. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param restore_point_collection_name: The name of the restore point collection. Required. - :type restore_point_collection_name: str - :param restore_point_name: The name of the restore point. Required. - :type restore_point_name: str - :param parameters: Parameters supplied to the Create restore point operation. Required. - :type parameters: ~azure.mgmt.compute.models.RestorePoint + :param vm_scale_set_name: The name of the VirtualMachineScaleSet. Required. + :type vm_scale_set_name: str + :param instance_id: The name of the VirtualMachineScaleSetVM. Required. + :type instance_id: str + :param run_command_name: The name of the VirtualMachineRunCommand. Required. + :type run_command_name: str + :param run_command: Parameters supplied to the Create Virtual Machine RunCommand operation. + Required. + :type run_command: ~azure.mgmt.compute.models.VirtualMachineRunCommand :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns None - :rtype: ~azure.core.polling.LROPoller[None] + :return: An instance of LROPoller that returns VirtualMachineRunCommand. The + VirtualMachineRunCommand is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.VirtualMachineRunCommand] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def begin_create( + def begin_create_or_update( self, resource_group_name: str, - restore_point_collection_name: str, - restore_point_name: str, - parameters: JSON, + vm_scale_set_name: str, + instance_id: str, + run_command_name: str, + run_command: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[None]: - """The operation to create the restore point. Updating properties of an existing restore point is - not allowed. + ) -> LROPoller[_models.VirtualMachineRunCommand]: + """The operation to create or update the VMSS VM run command. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param restore_point_collection_name: The name of the restore point collection. Required. - :type restore_point_collection_name: str - :param restore_point_name: The name of the restore point. Required. - :type restore_point_name: str - :param parameters: Parameters supplied to the Create restore point operation. Required. - :type parameters: JSON + :param vm_scale_set_name: The name of the VirtualMachineScaleSet. Required. + :type vm_scale_set_name: str + :param instance_id: The name of the VirtualMachineScaleSetVM. Required. + :type instance_id: str + :param run_command_name: The name of the VirtualMachineRunCommand. Required. + :type run_command_name: str + :param run_command: Parameters supplied to the Create Virtual Machine RunCommand operation. + Required. + :type run_command: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns None - :rtype: ~azure.core.polling.LROPoller[None] + :return: An instance of LROPoller that returns VirtualMachineRunCommand. The + VirtualMachineRunCommand is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.VirtualMachineRunCommand] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def begin_create( + def begin_create_or_update( self, resource_group_name: str, - restore_point_collection_name: str, - restore_point_name: str, - parameters: IO[bytes], + vm_scale_set_name: str, + instance_id: str, + run_command_name: str, + run_command: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[None]: - """The operation to create the restore point. Updating properties of an existing restore point is - not allowed. + ) -> LROPoller[_models.VirtualMachineRunCommand]: + """The operation to create or update the VMSS VM run command. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param restore_point_collection_name: The name of the restore point collection. Required. - :type restore_point_collection_name: str - :param restore_point_name: The name of the restore point. Required. - :type restore_point_name: str - :param parameters: Parameters supplied to the Create restore point operation. Required. - :type parameters: IO[bytes] + :param vm_scale_set_name: The name of the VirtualMachineScaleSet. Required. + :type vm_scale_set_name: str + :param instance_id: The name of the VirtualMachineScaleSetVM. Required. + :type instance_id: str + :param run_command_name: The name of the VirtualMachineRunCommand. Required. + :type run_command_name: str + :param run_command: Parameters supplied to the Create Virtual Machine RunCommand operation. + Required. + :type run_command: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns None - :rtype: ~azure.core.polling.LROPoller[None] + :return: An instance of LROPoller that returns VirtualMachineRunCommand. The + VirtualMachineRunCommand is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.VirtualMachineRunCommand] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace - def begin_create( + def begin_create_or_update( self, resource_group_name: str, - restore_point_collection_name: str, - restore_point_name: str, - parameters: Union[_models.RestorePoint, JSON, IO[bytes]], + vm_scale_set_name: str, + instance_id: str, + run_command_name: str, + run_command: Union[_models.VirtualMachineRunCommand, JSON, IO[bytes]], **kwargs: Any - ) -> LROPoller[None]: - """The operation to create the restore point. Updating properties of an existing restore point is - not allowed. + ) -> LROPoller[_models.VirtualMachineRunCommand]: + """The operation to create or update the VMSS VM run command. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param restore_point_collection_name: The name of the restore point collection. Required. - :type restore_point_collection_name: str - :param restore_point_name: The name of the restore point. Required. - :type restore_point_name: str - :param parameters: Parameters supplied to the Create restore point operation. Is one of the - following types: RestorePoint, JSON, IO[bytes] Required. - :type parameters: ~azure.mgmt.compute.models.RestorePoint or JSON or IO[bytes] - :return: An instance of LROPoller that returns None - :rtype: ~azure.core.polling.LROPoller[None] + :param vm_scale_set_name: The name of the VirtualMachineScaleSet. Required. + :type vm_scale_set_name: str + :param instance_id: The name of the VirtualMachineScaleSetVM. Required. + :type instance_id: str + :param run_command_name: The name of the VirtualMachineRunCommand. Required. + :type run_command_name: str + :param run_command: Parameters supplied to the Create Virtual Machine RunCommand operation. Is + one of the following types: VirtualMachineRunCommand, JSON, IO[bytes] Required. + :type run_command: ~azure.mgmt.compute.models.VirtualMachineRunCommand or JSON or IO[bytes] + :return: An instance of LROPoller that returns VirtualMachineRunCommand. The + VirtualMachineRunCommand is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.VirtualMachineRunCommand] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[_models.VirtualMachineRunCommand] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._create_initial( + raw_result = self._create_or_update_initial( resource_group_name=resource_group_name, - restore_point_collection_name=restore_point_collection_name, - restore_point_name=restore_point_name, - parameters=parameters, + 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, cls=lambda x, y, z: x, headers=_headers, @@ -29503,9 +28567,12 @@ def begin_create( raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.VirtualMachineRunCommand, response.json()) if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized path_format_arguments = { "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), @@ -29520,16 +28587,24 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return LROPoller[None].from_continuation_token( + return LROPoller[_models.VirtualMachineRunCommand].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + return LROPoller[_models.VirtualMachineRunCommand]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) - def _delete_initial( - self, resource_group_name: str, restore_point_collection_name: str, restore_point_name: str, **kwargs: Any + def _update_initial( + self, + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + run_command_name: str, + run_command: Union[_models.VirtualMachineRunCommandUpdate, JSON, IO[bytes]], + **kwargs: Any ) -> Iterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -29539,17 +28614,28 @@ def _delete_initial( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - _request = build_restore_points_delete_request( + content_type = content_type or "application/json" + _content = None + if isinstance(run_command, (IOBase, bytes)): + _content = run_command + else: + _content = json.dumps(run_command, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_virtual_machine_scale_set_vm_run_commands_update_request( resource_group_name=resource_group_name, - restore_point_collection_name=restore_point_collection_name, - restore_point_name=restore_point_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + run_command_name=run_command_name, subscription_id=self._config.subscription_id, + content_type=content_type, api_version=self._config.api_version, + content=_content, headers=_headers, params=_params, ) @@ -29565,7 +28651,7 @@ def _delete_initial( response = pipeline_response.http_response - if response.status_code not in [200, 202, 204]: + if response.status_code not in [200]: try: response.read() # Load the body in memory and close the socket except (StreamConsumedError, StreamClosedError): @@ -29575,9 +28661,8 @@ def _delete_initial( raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) deserialized = response.iter_bytes() @@ -29586,25 +28671,276 @@ def _delete_initial( return deserialized # type: ignore - @distributed_trace - def begin_delete( - 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. + @overload + 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: 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. The name is case insensitive. Required. :type resource_group_name: str - :param restore_point_collection_name: The name of the restore point collection. Required. - :type restore_point_collection_name: str - :param restore_point_name: The name of the restore point. Required. - :type restore_point_name: str - :return: An instance of LROPoller that returns None - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} + :param vm_scale_set_name: The name of the VirtualMachineScaleSet. Required. + :type vm_scale_set_name: str + :param instance_id: The name of the VirtualMachineScaleSetVM. Required. + :type instance_id: str + :param run_command_name: The name of the VirtualMachineRunCommand. Required. + :type run_command_name: str + :param run_command: Resource create parameters. Required. + :type run_command: ~azure.mgmt.compute.models.VirtualMachineRunCommandUpdate + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns VirtualMachineRunCommand. The + VirtualMachineRunCommand is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.VirtualMachineRunCommand] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update( + self, + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + run_command_name: str, + run_command: JSON, + *, + content_type: 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. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VirtualMachineScaleSet. Required. + :type vm_scale_set_name: str + :param instance_id: The name of the VirtualMachineScaleSetVM. Required. + :type instance_id: str + :param run_command_name: The name of the VirtualMachineRunCommand. Required. + :type run_command_name: str + :param run_command: Resource create parameters. Required. + :type run_command: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns VirtualMachineRunCommand. The + VirtualMachineRunCommand is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.VirtualMachineRunCommand] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update( + self, + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + run_command_name: str, + run_command: IO[bytes], + *, + content_type: 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. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VirtualMachineScaleSet. Required. + :type vm_scale_set_name: str + :param instance_id: The name of the VirtualMachineScaleSetVM. Required. + :type instance_id: str + :param run_command_name: The name of the VirtualMachineRunCommand. Required. + :type run_command_name: str + :param run_command: Resource create parameters. Required. + :type run_command: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns VirtualMachineRunCommand. The + VirtualMachineRunCommand is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.VirtualMachineRunCommand] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update( + self, + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + run_command_name: str, + run_command: Union[_models.VirtualMachineRunCommandUpdate, JSON, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.VirtualMachineRunCommand]: + """The operation to update the VMSS VM run command. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VirtualMachineScaleSet. Required. + :type vm_scale_set_name: str + :param instance_id: The name of the VirtualMachineScaleSetVM. Required. + :type instance_id: str + :param run_command_name: The name of the VirtualMachineRunCommand. Required. + :type run_command_name: str + :param run_command: Resource create parameters. Is one of the following types: + VirtualMachineRunCommandUpdate, JSON, IO[bytes] Required. + :type run_command: ~azure.mgmt.compute.models.VirtualMachineRunCommandUpdate or JSON or + IO[bytes] + :return: An instance of LROPoller that returns VirtualMachineRunCommand. The + VirtualMachineRunCommand is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.VirtualMachineRunCommand] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.VirtualMachineRunCommand] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._update_initial( + resource_group_name=resource_group_name, + 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, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = _deserialize(_models.VirtualMachineRunCommand, response.json()) + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.VirtualMachineRunCommand].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.VirtualMachineRunCommand]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _delete_initial( + self, resource_group_name: str, vm_scale_set_name: str, instance_id: str, run_command_name: str, **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_virtual_machine_scale_set_vm_run_commands_delete_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=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_delete( + 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. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VirtualMachineScaleSet. Required. + :type vm_scale_set_name: str + :param instance_id: The name of the VirtualMachineScaleSetVM. Required. + :type instance_id: str + :param run_command_name: The name of the VirtualMachineRunCommand. Required. + :type run_command_name: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -29613,8 +28949,9 @@ def begin_delete( 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, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + run_command_name=run_command_name, cls=lambda x, y, z: x, headers=_headers, params=_params, @@ -29648,15 +28985,120 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # 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 + ) -> ItemPaged["_models.VirtualMachineRunCommand"]: + """The operation to get all run commands of an instance in Virtual Machine Scaleset. -class CapacityReservationGroupsOperations: + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VirtualMachineScaleSet. Required. + :type vm_scale_set_name: str + :param instance_id: The name of the VirtualMachineScaleSetVM. Required. + :type instance_id: str + :keyword expand: The expand expression to apply on the operation. Default value is None. + :paramtype expand: str + :return: An iterator like instance of VirtualMachineRunCommand + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.models.VirtualMachineRunCommand] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.VirtualMachineRunCommand]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_virtual_machine_scale_set_vm_run_commands_list_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + expand=expand, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.VirtualMachineRunCommand], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + +class DisksOperations: """ .. warning:: **DO NOT** instantiate this class directly. Instead, you should access the following operations through :class:`~azure.mgmt.compute.ComputeClient`'s - :attr:`capacity_reservation_groups` attribute. + :attr:`disks` attribute. """ def __init__(self, *args, **kwargs) -> None: @@ -29667,30 +29109,18 @@ def __init__(self, *args, **kwargs) -> None: self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @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. + def get(self, resource_group_name: str, disk_name: str, **kwargs: Any) -> _models.Disk: + """Gets information about a disk. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param capacity_reservation_group_name: The name of the capacity reservation group. Required. - :type capacity_reservation_group_name: str - :keyword 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. "instanceView" Default value is - None. - :paramtype expand: str or ~azure.mgmt.compute.models.CapacityReservationGroupInstanceViewTypes - :return: CapacityReservationGroup. The CapacityReservationGroup is compatible with - MutableMapping - :rtype: ~azure.mgmt.compute.models.CapacityReservationGroup + :param disk_name: The name of the managed disk that is being created. The name can't be changed + after the disk is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The + maximum name length is 80 characters. Required. + :type disk_name: str + :return: Disk. The Disk is compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.Disk :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -29704,13 +29134,12 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.CapacityReservationGroup] = kwargs.pop("cls", None) + cls: ClsType[_models.Disk] = kwargs.pop("cls", None) - _request = build_capacity_reservation_groups_get_request( + _request = build_disks_get_request( resource_group_name=resource_group_name, - capacity_reservation_group_name=capacity_reservation_group_name, + disk_name=disk_name, subscription_id=self._config.subscription_id, - expand=expand, api_version=self._config.api_version, headers=_headers, params=_params, @@ -29740,128 +29169,242 @@ def get( if _stream: deserialized = response.iter_bytes() else: - deserialized = _deserialize(_models.CapacityReservationGroup, response.json()) + deserialized = _deserialize(_models.Disk, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore + def _create_or_update_initial( + self, resource_group_name: str, disk_name: str, disk: Union[_models.Disk, JSON, IO[bytes]], **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(disk, (IOBase, bytes)): + _content = disk + else: + _content = json.dumps(disk, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_disks_create_or_update_request( + resource_group_name=resource_group_name, + disk_name=disk_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + @overload - def create_or_update( + def begin_create_or_update( self, resource_group_name: str, - capacity_reservation_group_name: str, - parameters: _models.CapacityReservationGroup, + disk_name: str, + disk: _models.Disk, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.CapacityReservationGroup: - """The operation to create or update a capacity reservation group. When updating a capacity - reservation group, only tags and sharing profile may be modified. Please refer to - `https://aka.ms/CapacityReservation `_ for more details. + ) -> LROPoller[_models.Disk]: + """Creates or updates a disk. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param capacity_reservation_group_name: The name of the capacity reservation group. Required. - :type capacity_reservation_group_name: str - :param parameters: Parameters supplied to the Create capacity reservation Group. Required. - :type parameters: ~azure.mgmt.compute.models.CapacityReservationGroup + :param disk_name: The name of the managed disk that is being created. The name can't be changed + after the disk is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The + maximum name length is 80 characters. Required. + :type disk_name: str + :param disk: Disk object supplied in the body of the Put disk operation. Required. + :type disk: ~azure.mgmt.compute.models.Disk :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: CapacityReservationGroup. The CapacityReservationGroup is compatible with - MutableMapping - :rtype: ~azure.mgmt.compute.models.CapacityReservationGroup + :return: An instance of LROPoller that returns Disk. The Disk is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.Disk] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def create_or_update( + def begin_create_or_update( self, resource_group_name: str, - capacity_reservation_group_name: str, - parameters: JSON, + disk_name: str, + disk: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.CapacityReservationGroup: - """The operation to create or update a capacity reservation group. When updating a capacity - reservation group, only tags and sharing profile may be modified. Please refer to - `https://aka.ms/CapacityReservation `_ for more details. + ) -> LROPoller[_models.Disk]: + """Creates or updates a disk. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param capacity_reservation_group_name: The name of the capacity reservation group. Required. - :type capacity_reservation_group_name: str - :param parameters: Parameters supplied to the Create capacity reservation Group. Required. - :type parameters: JSON + :param disk_name: The name of the managed disk that is being created. The name can't be changed + after the disk is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The + maximum name length is 80 characters. Required. + :type disk_name: str + :param disk: Disk object supplied in the body of the Put disk operation. Required. + :type disk: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: CapacityReservationGroup. The CapacityReservationGroup is compatible with - MutableMapping - :rtype: ~azure.mgmt.compute.models.CapacityReservationGroup + :return: An instance of LROPoller that returns Disk. The Disk is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.Disk] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def create_or_update( + def begin_create_or_update( self, resource_group_name: str, - capacity_reservation_group_name: str, - parameters: IO[bytes], + disk_name: str, + disk: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> _models.CapacityReservationGroup: - """The operation to create or update a capacity reservation group. When updating a capacity - reservation group, only tags and sharing profile may be modified. Please refer to - `https://aka.ms/CapacityReservation `_ for more details. + ) -> LROPoller[_models.Disk]: + """Creates or updates a disk. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param capacity_reservation_group_name: The name of the capacity reservation group. Required. - :type capacity_reservation_group_name: str - :param parameters: Parameters supplied to the Create capacity reservation Group. Required. - :type parameters: IO[bytes] + :param disk_name: The name of the managed disk that is being created. The name can't be changed + after the disk is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The + maximum name length is 80 characters. Required. + :type disk_name: str + :param disk: Disk object supplied in the body of the Put disk operation. Required. + :type disk: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: CapacityReservationGroup. The CapacityReservationGroup is compatible with - MutableMapping - :rtype: ~azure.mgmt.compute.models.CapacityReservationGroup + :return: An instance of LROPoller that returns Disk. The Disk is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.Disk] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace - def create_or_update( - self, - resource_group_name: str, - capacity_reservation_group_name: str, - parameters: Union[_models.CapacityReservationGroup, JSON, IO[bytes]], - **kwargs: Any - ) -> _models.CapacityReservationGroup: - """The operation to create or update a capacity reservation group. When updating a capacity - reservation group, only tags and sharing profile may be modified. Please refer to - `https://aka.ms/CapacityReservation `_ for more details. + def begin_create_or_update( + self, resource_group_name: str, disk_name: str, disk: Union[_models.Disk, JSON, IO[bytes]], **kwargs: Any + ) -> LROPoller[_models.Disk]: + """Creates or updates a disk. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param capacity_reservation_group_name: The name of the capacity reservation group. Required. - :type capacity_reservation_group_name: str - :param parameters: Parameters supplied to the Create capacity reservation Group. Is one of the - following types: CapacityReservationGroup, JSON, IO[bytes] Required. - :type parameters: ~azure.mgmt.compute.models.CapacityReservationGroup or JSON or IO[bytes] - :return: CapacityReservationGroup. The CapacityReservationGroup is compatible with - MutableMapping - :rtype: ~azure.mgmt.compute.models.CapacityReservationGroup + :param disk_name: The name of the managed disk that is being created. The name can't be changed + after the disk is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The + maximum name length is 80 characters. Required. + :type disk_name: str + :param disk: Disk object supplied in the body of the Put disk operation. Is one of the + following types: Disk, JSON, IO[bytes] Required. + :type disk: ~azure.mgmt.compute.models.Disk or JSON or IO[bytes] + :return: An instance of LROPoller that returns Disk. The Disk is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.Disk] :raises ~azure.core.exceptions.HttpResponseError: """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Disk] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + disk_name=disk_name, + disk=disk, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.Disk, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.Disk].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.Disk]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _update_initial( + self, resource_group_name: str, disk_name: str, disk: Union[_models.DiskUpdate, JSON, IO[bytes]], **kwargs: Any + ) -> Iterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -29874,18 +29417,18 @@ def create_or_update( _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CapacityReservationGroup] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters + if isinstance(disk, (IOBase, bytes)): + _content = disk else: - _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(disk, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - _request = build_capacity_reservation_groups_create_or_update_request( + _request = build_disks_update_request( resource_group_name=resource_group_name, - capacity_reservation_group_name=capacity_reservation_group_name, + disk_name=disk_name, subscription_id=self._config.subscription_id, content_type=content_type, api_version=self._config.api_version, @@ -29898,148 +29441,194 @@ def create_or_update( } _request.url = self._client.format_url(_request.url, **path_format_arguments) - _stream = kwargs.pop("stream", False) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200, 201]: - if _stream: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass + if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = _failsafe_deserialize(_models.CloudError, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if _stream: - deserialized = response.iter_bytes() - else: - deserialized = _deserialize(_models.CapacityReservationGroup, response.json()) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore @overload - def update( + def begin_update( self, resource_group_name: str, - capacity_reservation_group_name: str, - parameters: _models.CapacityReservationGroupUpdate, + disk_name: str, + disk: _models.DiskUpdate, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.CapacityReservationGroup: - """The operation to update a capacity reservation group. When updating a capacity reservation - group, only tags and sharing profile may be modified. + ) -> LROPoller[_models.Disk]: + """Updates (patches) a disk. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param capacity_reservation_group_name: The name of the capacity reservation group. Required. - :type capacity_reservation_group_name: str - :param parameters: Parameters supplied to the Update capacity reservation Group operation. - Required. - :type parameters: ~azure.mgmt.compute.models.CapacityReservationGroupUpdate + :param disk_name: The name of the managed disk that is being created. The name can't be changed + after the disk is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The + maximum name length is 80 characters. Required. + :type disk_name: str + :param disk: Disk object supplied in the body of the Patch disk operation. Required. + :type disk: ~azure.mgmt.compute.models.DiskUpdate :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: CapacityReservationGroup. The CapacityReservationGroup is compatible with - MutableMapping - :rtype: ~azure.mgmt.compute.models.CapacityReservationGroup + :return: An instance of LROPoller that returns Disk. The Disk is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.Disk] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def update( + def begin_update( self, resource_group_name: str, - capacity_reservation_group_name: str, - parameters: JSON, + disk_name: str, + disk: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.CapacityReservationGroup: - """The operation to update a capacity reservation group. When updating a capacity reservation - group, only tags and sharing profile may be modified. + ) -> LROPoller[_models.Disk]: + """Updates (patches) a disk. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param capacity_reservation_group_name: The name of the capacity reservation group. Required. - :type capacity_reservation_group_name: str - :param parameters: Parameters supplied to the Update capacity reservation Group operation. - Required. - :type parameters: JSON + :param disk_name: The name of the managed disk that is being created. The name can't be changed + after the disk is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The + maximum name length is 80 characters. Required. + :type disk_name: str + :param disk: Disk object supplied in the body of the Patch disk operation. Required. + :type disk: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: CapacityReservationGroup. The CapacityReservationGroup is compatible with - MutableMapping - :rtype: ~azure.mgmt.compute.models.CapacityReservationGroup + :return: An instance of LROPoller that returns Disk. The Disk is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.Disk] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def update( + def begin_update( self, resource_group_name: str, - capacity_reservation_group_name: str, - parameters: IO[bytes], + disk_name: str, + disk: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> _models.CapacityReservationGroup: - """The operation to update a capacity reservation group. When updating a capacity reservation - group, only tags and sharing profile may be modified. + ) -> LROPoller[_models.Disk]: + """Updates (patches) a disk. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param capacity_reservation_group_name: The name of the capacity reservation group. Required. - :type capacity_reservation_group_name: str - :param parameters: Parameters supplied to the Update capacity reservation Group operation. - Required. - :type parameters: IO[bytes] + :param disk_name: The name of the managed disk that is being created. The name can't be changed + after the disk is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The + maximum name length is 80 characters. Required. + :type disk_name: str + :param disk: Disk object supplied in the body of the Patch disk operation. Required. + :type disk: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: CapacityReservationGroup. The CapacityReservationGroup is compatible with - MutableMapping - :rtype: ~azure.mgmt.compute.models.CapacityReservationGroup + :return: An instance of LROPoller that returns Disk. The Disk is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.Disk] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace - def update( - self, - resource_group_name: str, - capacity_reservation_group_name: str, - parameters: Union[_models.CapacityReservationGroupUpdate, JSON, IO[bytes]], - **kwargs: Any - ) -> _models.CapacityReservationGroup: - """The operation to update a capacity reservation group. When updating a capacity reservation - group, only tags and sharing profile may be modified. + def begin_update( + self, resource_group_name: str, disk_name: str, disk: Union[_models.DiskUpdate, JSON, IO[bytes]], **kwargs: Any + ) -> LROPoller[_models.Disk]: + """Updates (patches) a disk. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param capacity_reservation_group_name: The name of the capacity reservation group. Required. - :type capacity_reservation_group_name: str - :param parameters: Parameters supplied to the Update capacity reservation Group operation. Is - one of the following types: CapacityReservationGroupUpdate, JSON, IO[bytes] Required. - :type parameters: ~azure.mgmt.compute.models.CapacityReservationGroupUpdate or JSON or - IO[bytes] - :return: CapacityReservationGroup. The CapacityReservationGroup is compatible with - MutableMapping - :rtype: ~azure.mgmt.compute.models.CapacityReservationGroup + :param disk_name: The name of the managed disk that is being created. The name can't be changed + after the disk is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The + maximum name length is 80 characters. Required. + :type disk_name: str + :param disk: Disk object supplied in the body of the Patch disk operation. Is one of the + following types: DiskUpdate, JSON, IO[bytes] Required. + :type disk: ~azure.mgmt.compute.models.DiskUpdate or JSON or IO[bytes] + :return: An instance of LROPoller that returns Disk. The Disk is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.Disk] :raises ~azure.core.exceptions.HttpResponseError: """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Disk] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._update_initial( + resource_group_name=resource_group_name, + disk_name=disk_name, + disk=disk, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.Disk, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.Disk].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.Disk]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _delete_initial(self, resource_group_name: str, disk_name: str, **kwargs: Any) -> Iterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -30048,26 +29637,16 @@ def update( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CapacityReservationGroup] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - _request = build_capacity_reservation_groups_update_request( + _request = build_disks_delete_request( resource_group_name=resource_group_name, - capacity_reservation_group_name=capacity_reservation_group_name, + disk_name=disk_name, subscription_id=self._config.subscription_id, - content_type=content_type, api_version=self._config.api_version, - content=_content, headers=_headers, params=_params, ) @@ -30076,119 +29655,108 @@ def update( } _request.url = self._client.format_url(_request.url, **path_format_arguments) - _stream = kwargs.pop("stream", False) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200]: - if _stream: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass + if response.status_code not in [200, 202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = _failsafe_deserialize(_models.CloudError, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if _stream: - deserialized = response.iter_bytes() - else: - deserialized = _deserialize(_models.CapacityReservationGroup, response.json()) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # 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. + def begin_delete(self, resource_group_name: str, disk_name: str, **kwargs: Any) -> LROPoller[None]: + """Deletes a disk. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param capacity_reservation_group_name: The name of the capacity reservation group. Required. - :type capacity_reservation_group_name: str - :return: None - :rtype: None + :param disk_name: The name of the managed disk that is being created. The name can't be changed + after the disk is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The + maximum name length is 80 characters. Required. + :type disk_name: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + disk_name=disk_name, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore - _request = build_capacity_reservation_groups_delete_request( - resource_group_name=resource_group_name, - capacity_reservation_group_name=capacity_reservation_group_name, - subscription_id=self._config.subscription_id, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) path_format_arguments = { "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.CloudError, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if cls: - return cls(pipeline_response, None, {}) # type: ignore + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore @distributed_trace - def list_by_resource_group( - self, - resource_group_name: str, - *, - expand: Optional[Union[str, _models.ExpandTypesForGetCapacityReservationGroups]] = None, - **kwargs: Any - ) -> ItemPaged["_models.CapacityReservationGroup"]: - """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. + def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> ItemPaged["_models.Disk"]: + """Lists all the disks under a resource group. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :keyword 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. Known values are: - "virtualMachineScaleSetVMs/$ref" and "virtualMachines/$ref". Default value is None. - :paramtype expand: str or ~azure.mgmt.compute.models.ExpandTypesForGetCapacityReservationGroups - :return: An iterator like instance of CapacityReservationGroup - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.models.CapacityReservationGroup] + :return: An iterator like instance of Disk + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.models.Disk] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.CapacityReservationGroup]] = kwargs.pop("cls", None) + cls: ClsType[List[_models.Disk]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -30201,10 +29769,9 @@ def list_by_resource_group( def prepare_request(next_link=None): if not next_link: - _request = build_capacity_reservation_groups_list_by_resource_group_request( + _request = build_disks_list_by_resource_group_request( resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, - expand=expand, api_version=self._config.api_version, headers=_headers, params=_params, @@ -30240,7 +29807,7 @@ def prepare_request(next_link=None): def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.CapacityReservationGroup], deserialized.get("value", [])) + list_of_elem = _deserialize(List[_models.Disk], deserialized.get("value", [])) if cls: list_of_elem = cls(list_of_elem) # type: ignore return deserialized.get("nextLink") or None, iter(list_of_elem) @@ -30264,38 +29831,17 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) @distributed_trace - def list_by_subscription( - self, - *, - expand: Optional[Union[str, _models.ExpandTypesForGetCapacityReservationGroups]] = None, - resource_ids_only: Optional[Union[str, _models.ResourceIdOptionsForGetCapacityReservationGroups]] = None, - **kwargs: Any - ) -> ItemPaged["_models.CapacityReservationGroup"]: - """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. + def list(self, **kwargs: Any) -> ItemPaged["_models.Disk"]: + """Lists all the disks under a subscription. - :keyword 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. Known values are: - "virtualMachineScaleSetVMs/$ref" and "virtualMachines/$ref". Default value is None. - :paramtype expand: str or ~azure.mgmt.compute.models.ExpandTypesForGetCapacityReservationGroups - :keyword resource_ids_only: The query option to fetch Capacity Reservation Group Resource Ids. -
'CreatedInSubscription' enables fetching Resource Ids for all capacity reservation group - resources created in the subscription.
'SharedWithSubscription' enables fetching Resource - Ids for all capacity reservation group resources shared with the subscription.
'All' - enables fetching Resource Ids for all capacity reservation group resources shared with the - subscription and created in the subscription. Known values are: "CreatedInSubscription", - "SharedWithSubscription", and "All". Default value is None. - :paramtype resource_ids_only: str or - ~azure.mgmt.compute.models.ResourceIdOptionsForGetCapacityReservationGroups - :return: An iterator like instance of CapacityReservationGroup - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.models.CapacityReservationGroup] + :return: An iterator like instance of Disk + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.models.Disk] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.CapacityReservationGroup]] = kwargs.pop("cls", None) + cls: ClsType[List[_models.Disk]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -30308,10 +29854,8 @@ def list_by_subscription( def prepare_request(next_link=None): if not next_link: - _request = build_capacity_reservation_groups_list_by_subscription_request( + _request = build_disks_list_request( subscription_id=self._config.subscription_id, - expand=expand, - resource_ids_only=resource_ids_only, api_version=self._config.api_version, headers=_headers, params=_params, @@ -30347,7 +29891,7 @@ def prepare_request(next_link=None): def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.CapacityReservationGroup], deserialized.get("value", [])) + list_of_elem = _deserialize(List[_models.Disk], deserialized.get("value", [])) if cls: list_of_elem = cls(list_of_elem) # type: ignore return deserialized.get("nextLink") or None, iter(list_of_elem) @@ -30370,121 +29914,20 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - -class CapacityReservationsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.compute.ComputeClient`'s - :attr:`capacity_reservations` attribute. - """ - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ComputeClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def get( + def _grant_access_initial( self, resource_group_name: str, - capacity_reservation_group_name: str, - capacity_reservation_name: str, - *, - expand: Optional[Union[str, _models.CapacityReservationInstanceViewTypes]] = None, + disk_name: str, + grant_access_data: Union[_models.GrantAccessData, JSON, IO[bytes]], **kwargs: Any - ) -> _models.CapacityReservation: - """The operation that retrieves information about the capacity reservation. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param capacity_reservation_group_name: The name of the capacity reservation group. Required. - :type capacity_reservation_group_name: str - :param capacity_reservation_name: The name of the capacity reservation. Required. - :type capacity_reservation_name: str - :keyword 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. "instanceView" Default value is None. - :paramtype expand: str or ~azure.mgmt.compute.models.CapacityReservationInstanceViewTypes - :return: CapacityReservation. The CapacityReservation is compatible with MutableMapping - :rtype: ~azure.mgmt.compute.models.CapacityReservation - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[_models.CapacityReservation] = kwargs.pop("cls", None) - - _request = build_capacity_reservations_get_request( - resource_group_name=resource_group_name, - capacity_reservation_group_name=capacity_reservation_group_name, - capacity_reservation_name=capacity_reservation_name, - subscription_id=self._config.subscription_id, - expand=expand, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = kwargs.pop("stream", False) - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - if _stream: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.CloudError, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if _stream: - deserialized = response.iter_bytes() - else: - deserialized = _deserialize(_models.CapacityReservation, response.json()) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - capacity_reservation_group_name: str, - capacity_reservation_name: str, - parameters: Union[_models.CapacityReservation, JSON, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} @@ -30494,15 +29937,14 @@ def _create_or_update_initial( content_type = content_type or "application/json" _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters + if isinstance(grant_access_data, (IOBase, bytes)): + _content = grant_access_data else: - _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(grant_access_data, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - _request = build_capacity_reservations_create_or_update_request( + _request = build_disks_grant_access_request( resource_group_name=resource_group_name, - capacity_reservation_group_name=capacity_reservation_group_name, - capacity_reservation_name=capacity_reservation_name, + disk_name=disk_name, subscription_id=self._config.subscription_id, content_type=content_type, api_version=self._config.api_version, @@ -30522,7 +29964,7 @@ def _create_or_update_initial( response = pipeline_response.http_response - if response.status_code not in [200, 201]: + if response.status_code not in [200, 202]: try: response.read() # Load the body in memory and close the socket except (StreamConsumedError, StreamClosedError): @@ -30532,7 +29974,7 @@ def _create_or_update_initial( raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} - if response.status_code == 201: + if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) @@ -30544,142 +29986,136 @@ def _create_or_update_initial( return deserialized # type: ignore @overload - def begin_create_or_update( + def begin_grant_access( self, resource_group_name: str, - capacity_reservation_group_name: str, - capacity_reservation_name: str, - parameters: _models.CapacityReservation, + disk_name: str, + grant_access_data: _models.GrantAccessData, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[None]: - """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. + ) -> LROPoller[_models.AccessUri]: + """Grants access to a disk. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param capacity_reservation_group_name: The name of the capacity reservation group. Required. - :type capacity_reservation_group_name: str - :param capacity_reservation_name: The name of the capacity reservation. Required. - :type capacity_reservation_name: str - :param parameters: Parameters supplied to the Create capacity reservation. Required. - :type parameters: ~azure.mgmt.compute.models.CapacityReservation + :param disk_name: The name of the managed disk that is being created. The name can't be changed + after the disk is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The + maximum name length is 80 characters. Required. + :type disk_name: str + :param grant_access_data: Access data object supplied in the body of the get disk access + operation. Required. + :type grant_access_data: ~azure.mgmt.compute.models.GrantAccessData :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns None - :rtype: ~azure.core.polling.LROPoller[None] + :return: An instance of LROPoller that returns AccessUri. The AccessUri is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.AccessUri] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def begin_create_or_update( + def begin_grant_access( self, resource_group_name: str, - capacity_reservation_group_name: str, - capacity_reservation_name: str, - parameters: JSON, + disk_name: str, + grant_access_data: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[None]: - """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. + ) -> LROPoller[_models.AccessUri]: + """Grants access to a disk. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param capacity_reservation_group_name: The name of the capacity reservation group. Required. - :type capacity_reservation_group_name: str - :param capacity_reservation_name: The name of the capacity reservation. Required. - :type capacity_reservation_name: str - :param parameters: Parameters supplied to the Create capacity reservation. Required. - :type parameters: JSON + :param disk_name: The name of the managed disk that is being created. The name can't be changed + after the disk is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The + maximum name length is 80 characters. Required. + :type disk_name: str + :param grant_access_data: Access data object supplied in the body of the get disk access + operation. Required. + :type grant_access_data: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns None - :rtype: ~azure.core.polling.LROPoller[None] + :return: An instance of LROPoller that returns AccessUri. The AccessUri is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.AccessUri] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def begin_create_or_update( + def begin_grant_access( self, resource_group_name: str, - capacity_reservation_group_name: str, - capacity_reservation_name: str, - parameters: IO[bytes], + disk_name: str, + grant_access_data: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[None]: - """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. + ) -> LROPoller[_models.AccessUri]: + """Grants access to a disk. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param capacity_reservation_group_name: The name of the capacity reservation group. Required. - :type capacity_reservation_group_name: str - :param capacity_reservation_name: The name of the capacity reservation. Required. - :type capacity_reservation_name: str - :param parameters: Parameters supplied to the Create capacity reservation. Required. - :type parameters: IO[bytes] + :param disk_name: The name of the managed disk that is being created. The name can't be changed + after the disk is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The + maximum name length is 80 characters. Required. + :type disk_name: str + :param grant_access_data: Access data object supplied in the body of the get disk access + operation. Required. + :type grant_access_data: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns None - :rtype: ~azure.core.polling.LROPoller[None] + :return: An instance of LROPoller that returns AccessUri. The AccessUri is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.AccessUri] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace - def begin_create_or_update( + def begin_grant_access( self, resource_group_name: str, - capacity_reservation_group_name: str, - capacity_reservation_name: str, - parameters: Union[_models.CapacityReservation, JSON, IO[bytes]], + disk_name: str, + grant_access_data: Union[_models.GrantAccessData, JSON, IO[bytes]], **kwargs: Any - ) -> LROPoller[None]: - """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. + ) -> LROPoller[_models.AccessUri]: + """Grants access to a disk. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param capacity_reservation_group_name: The name of the capacity reservation group. Required. - :type capacity_reservation_group_name: str - :param capacity_reservation_name: The name of the capacity reservation. Required. - :type capacity_reservation_name: str - :param parameters: Parameters supplied to the Create capacity reservation. Is one of the - following types: CapacityReservation, JSON, IO[bytes] Required. - :type parameters: ~azure.mgmt.compute.models.CapacityReservation or JSON or IO[bytes] - :return: An instance of LROPoller that returns None - :rtype: ~azure.core.polling.LROPoller[None] + :param disk_name: The name of the managed disk that is being created. The name can't be changed + after the disk is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The + maximum name length is 80 characters. Required. + :type disk_name: str + :param grant_access_data: Access data object supplied in the body of the get disk access + operation. Is one of the following types: GrantAccessData, JSON, IO[bytes] Required. + :type grant_access_data: ~azure.mgmt.compute.models.GrantAccessData or JSON or IO[bytes] + :return: An instance of LROPoller that returns AccessUri. The AccessUri is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.AccessUri] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[_models.AccessUri] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._create_or_update_initial( + raw_result = self._grant_access_initial( resource_group_name=resource_group_name, - capacity_reservation_group_name=capacity_reservation_group_name, - capacity_reservation_name=capacity_reservation_name, - parameters=parameters, + disk_name=disk_name, + grant_access_data=grant_access_data, content_type=content_type, cls=lambda x, y, z: x, headers=_headers, @@ -30689,9 +30125,16 @@ def begin_create_or_update( raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = _deserialize(_models.AccessUri, response.json()) if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore + return deserialized path_format_arguments = { "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), @@ -30706,22 +30149,17 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return LROPoller[None].from_continuation_token( + return LROPoller[_models.AccessUri].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + return LROPoller[_models.AccessUri]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) - def _update_initial( - self, - resource_group_name: str, - capacity_reservation_group_name: str, - capacity_reservation_name: str, - parameters: Union[_models.CapacityReservationUpdate, JSON, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: + def _revoke_access_initial(self, resource_group_name: str, disk_name: str, **kwargs: Any) -> Iterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -30730,27 +30168,16 @@ def _update_initial( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - content_type = content_type or "application/json" - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - - _request = build_capacity_reservations_update_request( + _request = build_disks_revoke_access_request( resource_group_name=resource_group_name, - capacity_reservation_group_name=capacity_reservation_group_name, - capacity_reservation_name=capacity_reservation_name, + disk_name=disk_name, subscription_id=self._config.subscription_id, - content_type=content_type, api_version=self._config.api_version, - content=_content, headers=_headers, params=_params, ) @@ -30787,136 +30214,32 @@ def _update_initial( return deserialized # type: ignore - @overload - def begin_update( - self, - resource_group_name: str, - capacity_reservation_group_name: str, - capacity_reservation_name: str, - parameters: _models.CapacityReservationUpdate, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[None]: - """The operation to update a capacity reservation. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param capacity_reservation_group_name: The name of the capacity reservation group. Required. - :type capacity_reservation_group_name: str - :param capacity_reservation_name: The name of the capacity reservation. Required. - :type capacity_reservation_name: str - :param parameters: Parameters supplied to the Update capacity reservation operation. Required. - :type parameters: ~azure.mgmt.compute.models.CapacityReservationUpdate - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns None - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update( - self, - resource_group_name: str, - capacity_reservation_group_name: str, - capacity_reservation_name: str, - parameters: JSON, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[None]: - """The operation to update a capacity reservation. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param capacity_reservation_group_name: The name of the capacity reservation group. Required. - :type capacity_reservation_group_name: str - :param capacity_reservation_name: The name of the capacity reservation. Required. - :type capacity_reservation_name: str - :param parameters: Parameters supplied to the Update capacity reservation operation. Required. - :type parameters: JSON - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns None - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update( - self, - resource_group_name: str, - capacity_reservation_group_name: str, - capacity_reservation_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[None]: - """The operation to update a capacity reservation. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param capacity_reservation_group_name: The name of the capacity reservation group. Required. - :type capacity_reservation_group_name: str - :param capacity_reservation_name: The name of the capacity reservation. Required. - :type capacity_reservation_name: str - :param parameters: Parameters supplied to the Update capacity reservation operation. Required. - :type parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns None - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - @distributed_trace - def begin_update( - self, - resource_group_name: str, - capacity_reservation_group_name: str, - capacity_reservation_name: str, - parameters: Union[_models.CapacityReservationUpdate, JSON, IO[bytes]], - **kwargs: Any - ) -> LROPoller[None]: - """The operation to update a capacity reservation. + def begin_revoke_access(self, resource_group_name: str, disk_name: str, **kwargs: Any) -> LROPoller[None]: + """Revokes access to a disk. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param capacity_reservation_group_name: The name of the capacity reservation group. Required. - :type capacity_reservation_group_name: str - :param capacity_reservation_name: The name of the capacity reservation. Required. - :type capacity_reservation_name: str - :param parameters: Parameters supplied to the Update capacity reservation operation. Is one of - the following types: CapacityReservationUpdate, JSON, IO[bytes] Required. - :type parameters: ~azure.mgmt.compute.models.CapacityReservationUpdate or JSON or IO[bytes] + :param disk_name: The name of the managed disk that is being created. The name can't be changed + after the disk is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The + maximum name length is 80 characters. Required. + :type disk_name: str :return: An instance of LROPoller that returns None :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._update_initial( + raw_result = self._revoke_access_initial( resource_group_name=resource_group_name, - capacity_reservation_group_name=capacity_reservation_group_name, - capacity_reservation_name=capacity_reservation_name, - parameters=parameters, - content_type=content_type, + disk_name=disk_name, cls=lambda x, y, z: x, headers=_headers, params=_params, @@ -30950,11 +30273,97 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - def _delete_initial( + +class DiskAccessesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.compute.ComputeClient`'s + :attr:`disk_accesses` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def get(self, resource_group_name: str, disk_access_name: str, **kwargs: Any) -> _models.DiskAccess: + """Gets information about a disk access resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param disk_access_name: The name of the disk access resource that is being created. The name + can't be changed after the disk encryption set is created. Supported characters for the name + are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. + :type disk_access_name: str + :return: DiskAccess. The DiskAccess is compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.DiskAccess + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.DiskAccess] = kwargs.pop("cls", None) + + _request = build_disk_accesses_get_request( + resource_group_name=resource_group_name, + disk_access_name=disk_access_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.DiskAccess, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _create_or_update_initial( self, resource_group_name: str, - capacity_reservation_group_name: str, - capacity_reservation_name: str, + disk_access_name: str, + disk_access: Union[_models.DiskAccess, JSON, IO[bytes]], **kwargs: Any ) -> Iterator[bytes]: error_map: MutableMapping = { @@ -30965,17 +30374,26 @@ def _delete_initial( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - _request = build_capacity_reservations_delete_request( + content_type = content_type or "application/json" + _content = None + if isinstance(disk_access, (IOBase, bytes)): + _content = disk_access + else: + _content = json.dumps(disk_access, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_disk_accesses_create_or_update_request( resource_group_name=resource_group_name, - capacity_reservation_group_name=capacity_reservation_group_name, - capacity_reservation_name=capacity_reservation_name, + disk_access_name=disk_access_name, subscription_id=self._config.subscription_id, + content_type=content_type, api_version=self._config.api_version, + content=_content, headers=_headers, params=_params, ) @@ -30991,7 +30409,7 @@ def _delete_initial( response = pipeline_response.http_response - if response.status_code not in [200, 202, 204]: + if response.status_code not in [200, 202]: try: response.read() # Load the body in memory and close the socket except (StreamConsumedError, StreamClosedError): @@ -31012,43 +30430,138 @@ def _delete_initial( return deserialized # type: ignore - @distributed_trace - def begin_delete( - self, + @overload + def begin_create_or_update( + self, resource_group_name: str, - capacity_reservation_group_name: str, - capacity_reservation_name: str, + disk_access_name: str, + disk_access: _models.DiskAccess, + *, + content_type: str = "application/json", **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. - Note: Block capacity reservations cannot be deleted after it has been successfully allocated - until the schedule end time. + ) -> LROPoller[_models.DiskAccess]: + """Creates or updates a disk access resource. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param capacity_reservation_group_name: The name of the capacity reservation group. Required. - :type capacity_reservation_group_name: str - :param capacity_reservation_name: The name of the capacity reservation. Required. - :type capacity_reservation_name: str - :return: An instance of LROPoller that returns None - :rtype: ~azure.core.polling.LROPoller[None] + :param disk_access_name: The name of the disk access resource that is being created. The name + can't be changed after the disk encryption set is created. Supported characters for the name + are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. + :type disk_access_name: str + :param disk_access: disk access object supplied in the body of the Put disk access operation. + Required. + :type disk_access: ~azure.mgmt.compute.models.DiskAccess + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns DiskAccess. The DiskAccess is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.DiskAccess] :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = kwargs.pop("headers", {}) or {} + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + disk_access_name: str, + disk_access: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.DiskAccess]: + """Creates or updates a disk access resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param disk_access_name: The name of the disk access resource that is being created. The name + can't be changed after the disk encryption set is created. Supported characters for the name + are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. + :type disk_access_name: str + :param disk_access: disk access object supplied in the body of the Put disk access operation. + Required. + :type disk_access: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns DiskAccess. The DiskAccess is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.DiskAccess] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + disk_access_name: str, + disk_access: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.DiskAccess]: + """Creates or updates a disk access resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param disk_access_name: The name of the disk access resource that is being created. The name + can't be changed after the disk encryption set is created. Supported characters for the name + are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. + :type disk_access_name: str + :param disk_access: disk access object supplied in the body of the Put disk access operation. + Required. + :type disk_access: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns DiskAccess. The DiskAccess is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.DiskAccess] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + disk_access_name: str, + disk_access: Union[_models.DiskAccess, JSON, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.DiskAccess]: + """Creates or updates a disk access resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param disk_access_name: The name of the disk access resource that is being created. The name + can't be changed after the disk encryption set is created. Supported characters for the name + are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. + :type disk_access_name: str + :param disk_access: disk access object supplied in the body of the Put disk access operation. + Is one of the following types: DiskAccess, JSON, IO[bytes] Required. + :type disk_access: ~azure.mgmt.compute.models.DiskAccess or JSON or IO[bytes] + :return: An instance of LROPoller that returns DiskAccess. The DiskAccess is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.DiskAccess] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - cls: ClsType[None] = kwargs.pop("cls", None) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.DiskAccess] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._delete_initial( + 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, + disk_access_name=disk_access_name, + disk_access=disk_access, + content_type=content_type, cls=lambda x, y, z: x, headers=_headers, params=_params, @@ -31057,9 +30570,12 @@ def begin_delete( raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.DiskAccess, response.json()) if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized path_format_arguments = { "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), @@ -31074,213 +30590,21 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return LROPoller[None].from_continuation_token( + return LROPoller[_models.DiskAccess].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list_by_capacity_reservation_group( - self, resource_group_name: str, capacity_reservation_group_name: str, **kwargs: Any - ) -> ItemPaged["_models.CapacityReservation"]: - """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. The name is case insensitive. - Required. - :type resource_group_name: str - :param capacity_reservation_group_name: The name of the capacity reservation group. Required. - :type capacity_reservation_group_name: str - :return: An iterator like instance of CapacityReservation - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.models.CapacityReservation] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[List[_models.CapacityReservation]] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_capacity_reservations_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=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - return _request - - def extract_data(pipeline_response): - deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.CapacityReservation], deserialized.get("value", [])) - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.get("nextLink") or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.CloudError, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - -class VirtualMachineRunCommandsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.compute.ComputeClient`'s - :attr:`virtual_machine_run_commands` attribute. - """ - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ComputeClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @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. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_name: The name of the VirtualMachine. Required. - :type vm_name: str - :param run_command_name: The name of the VirtualMachineRunCommand. Required. - :type run_command_name: str - :keyword expand: The expand expression to apply on the operation. Default value is None. - :paramtype expand: str - :return: VirtualMachineRunCommand. The VirtualMachineRunCommand is compatible with - MutableMapping - :rtype: ~azure.mgmt.compute.models.VirtualMachineRunCommand - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[_models.VirtualMachineRunCommand] = kwargs.pop("cls", None) - - _request = build_virtual_machine_run_commands_get_by_virtual_machine_request( - resource_group_name=resource_group_name, - vm_name=vm_name, - run_command_name=run_command_name, - subscription_id=self._config.subscription_id, - expand=expand, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = kwargs.pop("stream", False) - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs + return LROPoller[_models.DiskAccess]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - if _stream: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.CloudError, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if _stream: - deserialized = response.iter_bytes() - else: - deserialized = _deserialize(_models.VirtualMachineRunCommand, response.json()) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( + def _update_initial( self, resource_group_name: str, - vm_name: str, - run_command_name: str, - run_command: Union[_models.VirtualMachineRunCommand, JSON, IO[bytes]], + disk_access_name: str, + disk_access: Union[_models.DiskAccessUpdate, JSON, IO[bytes]], **kwargs: Any ) -> Iterator[bytes]: error_map: MutableMapping = { @@ -31299,15 +30623,14 @@ def _create_or_update_initial( content_type = content_type or "application/json" _content = None - if isinstance(run_command, (IOBase, bytes)): - _content = run_command + if isinstance(disk_access, (IOBase, bytes)): + _content = disk_access else: - _content = json.dumps(run_command, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(disk_access, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - _request = build_virtual_machine_run_commands_create_or_update_request( + _request = build_disk_accesses_update_request( resource_group_name=resource_group_name, - vm_name=vm_name, - run_command_name=run_command_name, + disk_access_name=disk_access_name, subscription_id=self._config.subscription_id, content_type=content_type, api_version=self._config.api_version, @@ -31327,7 +30650,7 @@ def _create_or_update_initial( response = pipeline_response.http_response - if response.status_code not in [200, 201]: + if response.status_code not in [200, 202]: try: response.read() # Load the body in memory and close the socket except (StreamConsumedError, StreamClosedError): @@ -31337,7 +30660,7 @@ def _create_or_update_initial( raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} - if response.status_code == 201: + if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) @@ -31349,137 +30672,136 @@ def _create_or_update_initial( return deserialized # type: ignore @overload - def begin_create_or_update( + def begin_update( self, resource_group_name: str, - vm_name: str, - run_command_name: str, - run_command: _models.VirtualMachineRunCommand, + disk_access_name: str, + disk_access: _models.DiskAccessUpdate, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[None]: - """The operation to create or update the run command. + ) -> LROPoller[_models.DiskAccess]: + """Updates (patches) a disk access resource. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param vm_name: The name of the VirtualMachine. Required. - :type vm_name: str - :param run_command_name: The name of the VirtualMachineRunCommand. Required. - :type run_command_name: str - :param run_command: Parameters supplied to the Create Virtual Machine RunCommand operation. + :param disk_access_name: The name of the disk access resource that is being created. The name + can't be changed after the disk encryption set is created. Supported characters for the name + are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. + :type disk_access_name: str + :param disk_access: disk access object supplied in the body of the Patch disk access operation. Required. - :type run_command: ~azure.mgmt.compute.models.VirtualMachineRunCommand + :type disk_access: ~azure.mgmt.compute.models.DiskAccessUpdate :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns None - :rtype: ~azure.core.polling.LROPoller[None] + :return: An instance of LROPoller that returns DiskAccess. The DiskAccess is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.DiskAccess] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def begin_create_or_update( + def begin_update( self, resource_group_name: str, - vm_name: str, - run_command_name: str, - run_command: JSON, + disk_access_name: str, + disk_access: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[None]: - """The operation to create or update the run command. + ) -> LROPoller[_models.DiskAccess]: + """Updates (patches) a disk access resource. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param vm_name: The name of the VirtualMachine. Required. - :type vm_name: str - :param run_command_name: The name of the VirtualMachineRunCommand. Required. - :type run_command_name: str - :param run_command: Parameters supplied to the Create Virtual Machine RunCommand operation. + :param disk_access_name: The name of the disk access resource that is being created. The name + can't be changed after the disk encryption set is created. Supported characters for the name + are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. + :type disk_access_name: str + :param disk_access: disk access object supplied in the body of the Patch disk access operation. Required. - :type run_command: JSON + :type disk_access: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns None - :rtype: ~azure.core.polling.LROPoller[None] + :return: An instance of LROPoller that returns DiskAccess. The DiskAccess is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.DiskAccess] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def begin_create_or_update( + def begin_update( self, resource_group_name: str, - vm_name: str, - run_command_name: str, - run_command: IO[bytes], + disk_access_name: str, + disk_access: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[None]: - """The operation to create or update the run command. + ) -> LROPoller[_models.DiskAccess]: + """Updates (patches) a disk access resource. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param vm_name: The name of the VirtualMachine. Required. - :type vm_name: str - :param run_command_name: The name of the VirtualMachineRunCommand. Required. - :type run_command_name: str - :param run_command: Parameters supplied to the Create Virtual Machine RunCommand operation. + :param disk_access_name: The name of the disk access resource that is being created. The name + can't be changed after the disk encryption set is created. Supported characters for the name + are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. + :type disk_access_name: str + :param disk_access: disk access object supplied in the body of the Patch disk access operation. Required. - :type run_command: IO[bytes] + :type disk_access: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns None - :rtype: ~azure.core.polling.LROPoller[None] + :return: An instance of LROPoller that returns DiskAccess. The DiskAccess is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.DiskAccess] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace - def begin_create_or_update( + def begin_update( self, resource_group_name: str, - vm_name: str, - run_command_name: str, - run_command: Union[_models.VirtualMachineRunCommand, JSON, IO[bytes]], + disk_access_name: str, + disk_access: Union[_models.DiskAccessUpdate, JSON, IO[bytes]], **kwargs: Any - ) -> LROPoller[None]: - """The operation to create or update the run command. + ) -> LROPoller[_models.DiskAccess]: + """Updates (patches) a disk access resource. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param vm_name: The name of the VirtualMachine. Required. - :type vm_name: str - :param run_command_name: The name of the VirtualMachineRunCommand. Required. - :type run_command_name: str - :param run_command: Parameters supplied to the Create Virtual Machine RunCommand operation. Is - one of the following types: VirtualMachineRunCommand, JSON, IO[bytes] Required. - :type run_command: ~azure.mgmt.compute.models.VirtualMachineRunCommand or JSON or IO[bytes] - :return: An instance of LROPoller that returns None - :rtype: ~azure.core.polling.LROPoller[None] + :param disk_access_name: The name of the disk access resource that is being created. The name + can't be changed after the disk encryption set is created. Supported characters for the name + are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. + :type disk_access_name: str + :param disk_access: disk access object supplied in the body of the Patch disk access operation. + Is one of the following types: DiskAccessUpdate, JSON, IO[bytes] Required. + :type disk_access: ~azure.mgmt.compute.models.DiskAccessUpdate or JSON or IO[bytes] + :return: An instance of LROPoller that returns DiskAccess. The DiskAccess is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.DiskAccess] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[_models.DiskAccess] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._create_or_update_initial( + 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, + disk_access_name=disk_access_name, + disk_access=disk_access, content_type=content_type, cls=lambda x, y, z: x, headers=_headers, @@ -31489,9 +30811,12 @@ def begin_create_or_update( raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.DiskAccess, response.json()) if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized path_format_arguments = { "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), @@ -31506,22 +30831,17 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return LROPoller[None].from_continuation_token( + return LROPoller[_models.DiskAccess].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + return LROPoller[_models.DiskAccess]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) - def _update_initial( - self, - resource_group_name: str, - vm_name: str, - run_command_name: str, - run_command: Union[_models.VirtualMachineRunCommandUpdate, JSON, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: + def _delete_initial(self, resource_group_name: str, disk_access_name: str, **kwargs: Any) -> Iterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -31530,27 +30850,16 @@ def _update_initial( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - content_type = content_type or "application/json" - _content = None - if isinstance(run_command, (IOBase, bytes)): - _content = run_command - else: - _content = json.dumps(run_command, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - - _request = build_virtual_machine_run_commands_update_request( + _request = build_disk_accesses_delete_request( resource_group_name=resource_group_name, - vm_name=vm_name, - run_command_name=run_command_name, + disk_access_name=disk_access_name, subscription_id=self._config.subscription_id, - content_type=content_type, api_version=self._config.api_version, - content=_content, headers=_headers, params=_params, ) @@ -31566,7 +30875,7 @@ def _update_initial( response = pipeline_response.http_response - if response.status_code not in [200]: + if response.status_code not in [200, 202, 204]: try: response.read() # Load the body in memory and close the socket except (StreamConsumedError, StreamClosedError): @@ -31576,8 +30885,9 @@ def _update_initial( raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) deserialized = response.iter_bytes() @@ -31586,140 +30896,32 @@ def _update_initial( return deserialized # type: ignore - @overload - def begin_update( - self, - resource_group_name: str, - vm_name: str, - run_command_name: str, - run_command: _models.VirtualMachineRunCommandUpdate, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[None]: - """The operation to update the run command. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_name: The name of the VirtualMachine. Required. - :type vm_name: str - :param run_command_name: The name of the VirtualMachineRunCommand. Required. - :type run_command_name: str - :param run_command: Parameters supplied to the Update Virtual Machine RunCommand operation. - Required. - :type run_command: ~azure.mgmt.compute.models.VirtualMachineRunCommandUpdate - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns None - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update( - self, - resource_group_name: str, - vm_name: str, - run_command_name: str, - run_command: JSON, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[None]: - """The operation to update the run command. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_name: The name of the VirtualMachine. Required. - :type vm_name: str - :param run_command_name: The name of the VirtualMachineRunCommand. Required. - :type run_command_name: str - :param run_command: Parameters supplied to the Update Virtual Machine RunCommand operation. - Required. - :type run_command: JSON - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns None - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update( - self, - resource_group_name: str, - vm_name: str, - run_command_name: str, - run_command: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[None]: - """The operation to update the run command. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_name: The name of the VirtualMachine. Required. - :type vm_name: str - :param run_command_name: The name of the VirtualMachineRunCommand. Required. - :type run_command_name: str - :param run_command: Parameters supplied to the Update Virtual Machine RunCommand operation. - Required. - :type run_command: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns None - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - @distributed_trace - def begin_update( - self, - resource_group_name: str, - vm_name: str, - run_command_name: str, - run_command: Union[_models.VirtualMachineRunCommandUpdate, JSON, IO[bytes]], - **kwargs: Any - ) -> LROPoller[None]: - """The operation to update the run command. + def begin_delete(self, resource_group_name: str, disk_access_name: str, **kwargs: Any) -> LROPoller[None]: + """Deletes a disk access resource. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param vm_name: The name of the VirtualMachine. Required. - :type vm_name: str - :param run_command_name: The name of the VirtualMachineRunCommand. Required. - :type run_command_name: str - :param run_command: Parameters supplied to the Update Virtual Machine RunCommand operation. Is - one of the following types: VirtualMachineRunCommandUpdate, JSON, IO[bytes] Required. - :type run_command: ~azure.mgmt.compute.models.VirtualMachineRunCommandUpdate or JSON or - IO[bytes] + :param disk_access_name: The name of the disk access resource that is being created. The name + can't be changed after the disk encryption set is created. Supported characters for the name + are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. + :type disk_access_name: str :return: An instance of LROPoller that returns None :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._update_initial( + raw_result = self._delete_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, + disk_access_name=disk_access_name, cls=lambda x, y, z: x, headers=_headers, params=_params, @@ -31753,9 +30955,22 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - def _delete_initial( - self, resource_group_name: str, vm_name: str, run_command_name: str, **kwargs: Any - ) -> Iterator[bytes]: + @distributed_trace + def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> ItemPaged["_models.DiskAccess"]: + """Lists all the disk access resources under a resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :return: An iterator like instance of DiskAccess + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.models.DiskAccess] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.DiskAccess]] = kwargs.pop("cls", None) + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -31764,136 +30979,82 @@ def _delete_initial( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_virtual_machine_run_commands_delete_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=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.CloudError, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + def prepare_request(next_link=None): + if not next_link: - deserialized = response.iter_bytes() + _request = build_disk_accesses_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) - return deserialized # type: ignore + return _request - @distributed_trace - def begin_delete( - self, resource_group_name: str, vm_name: str, run_command_name: str, **kwargs: Any - ) -> LROPoller[None]: - """The operation to delete the run command. + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.DiskAccess], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_name: The name of the VirtualMachine. Required. - :type vm_name: str - :param run_command_name: The name of the VirtualMachineRunCommand. Required. - :type run_command_name: str - :return: An instance of LROPoller that returns None - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} + def get_next(next_link=None): + _request = prepare_request(next_link) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - vm_name=vm_name, - run_command_name=run_command_name, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) + response = pipeline_response.http_response - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } + return pipeline_response - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + return ItemPaged(get_next, extract_data) @distributed_trace - def list_by_virtual_machine( - self, resource_group_name: str, vm_name: str, *, expand: Optional[str] = None, **kwargs: Any - ) -> ItemPaged["_models.VirtualMachineRunCommand"]: - """The operation to get all run commands of a Virtual Machine. + def list(self, **kwargs: Any) -> ItemPaged["_models.DiskAccess"]: + """Lists all the disk access resources under a subscription. - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_name: The name of the VirtualMachine. Required. - :type vm_name: str - :keyword expand: The expand expression to apply on the operation. Default value is None. - :paramtype expand: str - :return: An iterator like instance of VirtualMachineRunCommand - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.models.VirtualMachineRunCommand] + :return: An iterator like instance of DiskAccess + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.models.DiskAccess] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.VirtualMachineRunCommand]] = kwargs.pop("cls", None) + cls: ClsType[List[_models.DiskAccess]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -31906,11 +31067,8 @@ def list_by_virtual_machine( def prepare_request(next_link=None): if not next_link: - _request = build_virtual_machine_run_commands_list_by_virtual_machine_request( - resource_group_name=resource_group_name, - vm_name=vm_name, + _request = build_disk_accesses_list_request( subscription_id=self._config.subscription_id, - expand=expand, api_version=self._config.api_version, headers=_headers, params=_params, @@ -31946,7 +31104,7 @@ def prepare_request(next_link=None): def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.VirtualMachineRunCommand], deserialized.get("value", [])) + list_of_elem = _deserialize(List[_models.DiskAccess], deserialized.get("value", [])) if cls: list_of_elem = cls(list_of_elem) # type: ignore return deserialized.get("nextLink") or None, iter(list_of_elem) @@ -31969,51 +31127,95 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) + @distributed_trace + def get_private_link_resources( + self, resource_group_name: str, disk_access_name: str, **kwargs: Any + ) -> _models.PrivateLinkResourceListResult: + """Gets the private link resources possible under disk access resource. -class VirtualMachineScaleSetVMRunCommandsOperations: # pylint: disable=name-too-long - """ - .. warning:: - **DO NOT** instantiate this class directly. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param disk_access_name: The name of the disk access resource that is being created. The name + can't be changed after the disk encryption set is created. Supported characters for the name + are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. + :type disk_access_name: str + :return: PrivateLinkResourceListResult. The PrivateLinkResourceListResult is compatible with + MutableMapping + :rtype: ~azure.mgmt.compute.models.PrivateLinkResourceListResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) - Instead, you should access the following operations through - :class:`~azure.mgmt.compute.ComputeClient`'s - :attr:`virtual_machine_scale_set_vm_run_commands` attribute. - """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ComputeClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + cls: ClsType[_models.PrivateLinkResourceListResult] = kwargs.pop("cls", None) + + _request = build_disk_accesses_get_private_link_resources_request( + resource_group_name=resource_group_name, + disk_access_name=disk_access_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.PrivateLinkResourceListResult, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # 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. + def get_a_private_endpoint_connection( + self, resource_group_name: str, disk_access_name: str, private_endpoint_connection_name: str, **kwargs: Any + ) -> _models.PrivateEndpointConnection: + """Gets information about a private endpoint connection under a disk access resource. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param vm_scale_set_name: The name of the VirtualMachineScaleSet. Required. - :type vm_scale_set_name: str - :param instance_id: The name of the VirtualMachineScaleSetVM. Required. - :type instance_id: str - :param run_command_name: The name of the VirtualMachineRunCommand. Required. - :type run_command_name: str - :keyword expand: The expand expression to apply on the operation. Default value is None. - :paramtype expand: str - :return: VirtualMachineRunCommand. The VirtualMachineRunCommand is compatible with + :param disk_access_name: The name of the disk access resource that is being created. The name + can't be changed after the disk encryption set is created. Supported characters for the name + are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. + :type disk_access_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. + :type private_endpoint_connection_name: str + :return: PrivateEndpointConnection. The PrivateEndpointConnection is compatible with MutableMapping - :rtype: ~azure.mgmt.compute.models.VirtualMachineRunCommand + :rtype: ~azure.mgmt.compute.models.PrivateEndpointConnection :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -32027,15 +31229,13 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.VirtualMachineRunCommand] = kwargs.pop("cls", None) + cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) - _request = build_virtual_machine_scale_set_vm_run_commands_get_request( + _request = build_disk_accesses_get_a_private_endpoint_connection_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, + disk_access_name=disk_access_name, + private_endpoint_connection_name=private_endpoint_connection_name, subscription_id=self._config.subscription_id, - expand=expand, api_version=self._config.api_version, headers=_headers, params=_params, @@ -32065,20 +31265,19 @@ def get( if _stream: deserialized = response.iter_bytes() else: - deserialized = _deserialize(_models.VirtualMachineRunCommand, response.json()) + deserialized = _deserialize(_models.PrivateEndpointConnection, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - def _create_or_update_initial( + def _update_a_private_endpoint_connection_initial( # pylint: disable=name-too-long self, resource_group_name: str, - vm_scale_set_name: str, - instance_id: str, - run_command_name: str, - run_command: Union[_models.VirtualMachineRunCommand, JSON, IO[bytes]], + disk_access_name: str, + private_endpoint_connection_name: str, + private_endpoint_connection: Union[_models.PrivateEndpointConnection, JSON, IO[bytes]], **kwargs: Any ) -> Iterator[bytes]: error_map: MutableMapping = { @@ -32097,16 +31296,15 @@ def _create_or_update_initial( content_type = content_type or "application/json" _content = None - if isinstance(run_command, (IOBase, bytes)): - _content = run_command + if isinstance(private_endpoint_connection, (IOBase, bytes)): + _content = private_endpoint_connection else: - _content = json.dumps(run_command, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(private_endpoint_connection, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - _request = build_virtual_machine_scale_set_vm_run_commands_create_or_update_request( + _request = build_disk_accesses_update_a_private_endpoint_connection_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, + disk_access_name=disk_access_name, + private_endpoint_connection_name=private_endpoint_connection_name, subscription_id=self._config.subscription_id, content_type=content_type, api_version=self._config.api_version, @@ -32126,7 +31324,7 @@ def _create_or_update_initial( response = pipeline_response.http_response - if response.status_code not in [200, 201]: + if response.status_code not in [200, 202]: try: response.read() # Load the body in memory and close the socket except (StreamConsumedError, StreamClosedError): @@ -32136,7 +31334,7 @@ def _create_or_update_initial( raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} - if response.status_code == 201: + if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) @@ -32148,150 +31346,155 @@ def _create_or_update_initial( return deserialized # type: ignore @overload - def begin_create_or_update( + def begin_update_a_private_endpoint_connection( # pylint: disable=name-too-long self, resource_group_name: str, - vm_scale_set_name: str, - instance_id: str, - run_command_name: str, - run_command: _models.VirtualMachineRunCommand, + disk_access_name: str, + private_endpoint_connection_name: str, + private_endpoint_connection: _models.PrivateEndpointConnection, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[None]: - """The operation to create or update the VMSS VM run command. + ) -> LROPoller[_models.PrivateEndpointConnection]: + """Approve or reject a private endpoint connection under disk access resource, this can't be used + to create a new private endpoint connection. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param vm_scale_set_name: The name of the VirtualMachineScaleSet. Required. - :type vm_scale_set_name: str - :param instance_id: The name of the VirtualMachineScaleSetVM. Required. - :type instance_id: str - :param run_command_name: The name of the VirtualMachineRunCommand. Required. - :type run_command_name: str - :param run_command: Parameters supplied to the Create Virtual Machine RunCommand operation. - Required. - :type run_command: ~azure.mgmt.compute.models.VirtualMachineRunCommand + :param disk_access_name: The name of the disk access resource that is being created. The name + can't be changed after the disk encryption set is created. Supported characters for the name + are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. + :type disk_access_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. + :type private_endpoint_connection_name: str + :param private_endpoint_connection: private endpoint connection object supplied in the body of + the Put private endpoint connection operation. Required. + :type private_endpoint_connection: ~azure.mgmt.compute.models.PrivateEndpointConnection :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns None - :rtype: ~azure.core.polling.LROPoller[None] + :return: An instance of LROPoller that returns PrivateEndpointConnection. The + PrivateEndpointConnection is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.PrivateEndpointConnection] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def begin_create_or_update( + def begin_update_a_private_endpoint_connection( # pylint: disable=name-too-long self, resource_group_name: str, - vm_scale_set_name: str, - instance_id: str, - run_command_name: str, - run_command: JSON, + disk_access_name: str, + private_endpoint_connection_name: str, + private_endpoint_connection: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[None]: - """The operation to create or update the VMSS VM run command. + ) -> LROPoller[_models.PrivateEndpointConnection]: + """Approve or reject a private endpoint connection under disk access resource, this can't be used + to create a new private endpoint connection. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param vm_scale_set_name: The name of the VirtualMachineScaleSet. Required. - :type vm_scale_set_name: str - :param instance_id: The name of the VirtualMachineScaleSetVM. Required. - :type instance_id: str - :param run_command_name: The name of the VirtualMachineRunCommand. Required. - :type run_command_name: str - :param run_command: Parameters supplied to the Create Virtual Machine RunCommand operation. - Required. - :type run_command: JSON + :param disk_access_name: The name of the disk access resource that is being created. The name + can't be changed after the disk encryption set is created. Supported characters for the name + are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. + :type disk_access_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. + :type private_endpoint_connection_name: str + :param private_endpoint_connection: private endpoint connection object supplied in the body of + the Put private endpoint connection operation. Required. + :type private_endpoint_connection: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns None - :rtype: ~azure.core.polling.LROPoller[None] + :return: An instance of LROPoller that returns PrivateEndpointConnection. The + PrivateEndpointConnection is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.PrivateEndpointConnection] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def begin_create_or_update( + def begin_update_a_private_endpoint_connection( # pylint: disable=name-too-long self, resource_group_name: str, - vm_scale_set_name: str, - instance_id: str, - run_command_name: str, - run_command: IO[bytes], + disk_access_name: str, + private_endpoint_connection_name: str, + private_endpoint_connection: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[None]: - """The operation to create or update the VMSS VM run command. + ) -> LROPoller[_models.PrivateEndpointConnection]: + """Approve or reject a private endpoint connection under disk access resource, this can't be used + to create a new private endpoint connection. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param vm_scale_set_name: The name of the VirtualMachineScaleSet. Required. - :type vm_scale_set_name: str - :param instance_id: The name of the VirtualMachineScaleSetVM. Required. - :type instance_id: str - :param run_command_name: The name of the VirtualMachineRunCommand. Required. - :type run_command_name: str - :param run_command: Parameters supplied to the Create Virtual Machine RunCommand operation. - Required. - :type run_command: IO[bytes] + :param disk_access_name: The name of the disk access resource that is being created. The name + can't be changed after the disk encryption set is created. Supported characters for the name + are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. + :type disk_access_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. + :type private_endpoint_connection_name: str + :param private_endpoint_connection: private endpoint connection object supplied in the body of + the Put private endpoint connection operation. Required. + :type private_endpoint_connection: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns None - :rtype: ~azure.core.polling.LROPoller[None] + :return: An instance of LROPoller that returns PrivateEndpointConnection. The + PrivateEndpointConnection is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.PrivateEndpointConnection] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace - def begin_create_or_update( + def begin_update_a_private_endpoint_connection( # pylint: disable=name-too-long self, resource_group_name: str, - vm_scale_set_name: str, - instance_id: str, - run_command_name: str, - run_command: Union[_models.VirtualMachineRunCommand, JSON, IO[bytes]], + disk_access_name: str, + private_endpoint_connection_name: str, + private_endpoint_connection: Union[_models.PrivateEndpointConnection, JSON, IO[bytes]], **kwargs: Any - ) -> LROPoller[None]: - """The operation to create or update the VMSS VM run command. + ) -> LROPoller[_models.PrivateEndpointConnection]: + """Approve or reject a private endpoint connection under disk access resource, this can't be used + to create a new private endpoint connection. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param vm_scale_set_name: The name of the VirtualMachineScaleSet. Required. - :type vm_scale_set_name: str - :param instance_id: The name of the VirtualMachineScaleSetVM. Required. - :type instance_id: str - :param run_command_name: The name of the VirtualMachineRunCommand. Required. - :type run_command_name: str - :param run_command: Parameters supplied to the Create Virtual Machine RunCommand operation. Is - one of the following types: VirtualMachineRunCommand, JSON, IO[bytes] Required. - :type run_command: ~azure.mgmt.compute.models.VirtualMachineRunCommand or JSON or IO[bytes] - :return: An instance of LROPoller that returns None - :rtype: ~azure.core.polling.LROPoller[None] + :param disk_access_name: The name of the disk access resource that is being created. The name + can't be changed after the disk encryption set is created. Supported characters for the name + are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. + :type disk_access_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. + :type private_endpoint_connection_name: str + :param private_endpoint_connection: private endpoint connection object supplied in the body of + the Put private endpoint connection operation. Is one of the following types: + PrivateEndpointConnection, JSON, IO[bytes] Required. + :type private_endpoint_connection: ~azure.mgmt.compute.models.PrivateEndpointConnection or JSON + or IO[bytes] + :return: An instance of LROPoller that returns PrivateEndpointConnection. The + PrivateEndpointConnection is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.PrivateEndpointConnection] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._create_or_update_initial( + raw_result = self._update_a_private_endpoint_connection_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, + disk_access_name=disk_access_name, + private_endpoint_connection_name=private_endpoint_connection_name, + private_endpoint_connection=private_endpoint_connection, content_type=content_type, cls=lambda x, y, z: x, headers=_headers, @@ -32301,9 +31504,12 @@ def begin_create_or_update( raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.PrivateEndpointConnection, response.json()) if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized path_format_arguments = { "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), @@ -32318,267 +31524,18 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return LROPoller[None].from_continuation_token( + return LROPoller[_models.PrivateEndpointConnection].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _update_initial( - self, - resource_group_name: str, - vm_scale_set_name: str, - instance_id: str, - run_command_name: str, - run_command: Union[_models.VirtualMachineRunCommandUpdate, JSON, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} - - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _content = None - if isinstance(run_command, (IOBase, bytes)): - _content = run_command - else: - _content = json.dumps(run_command, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - - _request = build_virtual_machine_scale_set_vm_run_commands_update_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, - content_type=content_type, - api_version=self._config.api_version, - content=_content, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs + return LROPoller[_models.PrivateEndpointConnection]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.CloudError, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.iter_bytes() - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - 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: str = "application/json", - **kwargs: Any - ) -> LROPoller[None]: - """The operation to update the VMSS VM run command. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VirtualMachineScaleSet. Required. - :type vm_scale_set_name: str - :param instance_id: The name of the VirtualMachineScaleSetVM. Required. - :type instance_id: str - :param run_command_name: The name of the VirtualMachineRunCommand. Required. - :type run_command_name: str - :param run_command: Resource create parameters. Required. - :type run_command: ~azure.mgmt.compute.models.VirtualMachineRunCommandUpdate - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns None - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update( - self, - resource_group_name: str, - vm_scale_set_name: str, - instance_id: str, - run_command_name: str, - run_command: JSON, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[None]: - """The operation to update the VMSS VM run command. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VirtualMachineScaleSet. Required. - :type vm_scale_set_name: str - :param instance_id: The name of the VirtualMachineScaleSetVM. Required. - :type instance_id: str - :param run_command_name: The name of the VirtualMachineRunCommand. Required. - :type run_command_name: str - :param run_command: Resource create parameters. Required. - :type run_command: JSON - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns None - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update( - self, - resource_group_name: str, - vm_scale_set_name: str, - instance_id: str, - run_command_name: str, - run_command: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[None]: - """The operation to update the VMSS VM run command. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VirtualMachineScaleSet. Required. - :type vm_scale_set_name: str - :param instance_id: The name of the VirtualMachineScaleSetVM. Required. - :type instance_id: str - :param run_command_name: The name of the VirtualMachineRunCommand. Required. - :type run_command_name: str - :param run_command: Resource create parameters. Required. - :type run_command: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns None - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_update( - self, - resource_group_name: str, - vm_scale_set_name: str, - instance_id: str, - run_command_name: str, - run_command: Union[_models.VirtualMachineRunCommandUpdate, JSON, IO[bytes]], - **kwargs: Any - ) -> LROPoller[None]: - """The operation to update the VMSS VM run command. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VirtualMachineScaleSet. Required. - :type vm_scale_set_name: str - :param instance_id: The name of the VirtualMachineScaleSetVM. Required. - :type instance_id: str - :param run_command_name: The name of the VirtualMachineRunCommand. Required. - :type run_command_name: str - :param run_command: Resource create parameters. Is one of the following types: - VirtualMachineRunCommandUpdate, JSON, IO[bytes] Required. - :type run_command: ~azure.mgmt.compute.models.VirtualMachineRunCommandUpdate or JSON or - IO[bytes] - :return: An instance of LROPoller that returns None - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} - - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._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, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _delete_initial( - self, resource_group_name: str, vm_scale_set_name: str, instance_id: str, run_command_name: str, **kwargs: Any + def _delete_a_private_endpoint_connection_initial( # pylint: disable=name-too-long + self, resource_group_name: str, disk_access_name: str, private_endpoint_connection_name: str, **kwargs: Any ) -> Iterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -32593,11 +31550,10 @@ def _delete_initial( cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - _request = build_virtual_machine_scale_set_vm_run_commands_delete_request( + _request = build_disk_accesses_delete_a_private_endpoint_connection_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, + disk_access_name=disk_access_name, + private_endpoint_connection_name=private_endpoint_connection_name, subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -32637,20 +31593,20 @@ def _delete_initial( return deserialized # type: ignore @distributed_trace - def begin_delete( - self, resource_group_name: str, vm_scale_set_name: str, instance_id: str, run_command_name: str, **kwargs: Any + def begin_delete_a_private_endpoint_connection( # pylint: disable=name-too-long + self, resource_group_name: str, disk_access_name: str, private_endpoint_connection_name: str, **kwargs: Any ) -> LROPoller[None]: - """The operation to delete the VMSS VM run command. + """Deletes a private endpoint connection under a disk access resource. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param vm_scale_set_name: The name of the VirtualMachineScaleSet. Required. - :type vm_scale_set_name: str - :param instance_id: The name of the VirtualMachineScaleSetVM. Required. - :type instance_id: str - :param run_command_name: The name of the VirtualMachineRunCommand. Required. - :type run_command_name: str + :param disk_access_name: The name of the disk access resource that is being created. The name + can't be changed after the disk encryption set is created. Supported characters for the name + are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. + :type disk_access_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. + :type private_endpoint_connection_name: str :return: An instance of LROPoller that returns None :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -32663,11 +31619,10 @@ def begin_delete( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._delete_initial( + raw_result = self._delete_a_private_endpoint_connection_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, + disk_access_name=disk_access_name, + private_endpoint_connection_name=private_endpoint_connection_name, cls=lambda x, y, z: x, headers=_headers, params=_params, @@ -32702,34 +31657,26 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # 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 - ) -> ItemPaged["_models.VirtualMachineRunCommand"]: - """The operation to get all run commands of an instance in Virtual Machine Scaleset. + def list_private_endpoint_connections( + self, resource_group_name: str, disk_access_name: str, **kwargs: Any + ) -> ItemPaged["_models.PrivateEndpointConnection"]: + """List information about private endpoint connections under a disk access resource. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param vm_scale_set_name: The name of the VirtualMachineScaleSet. Required. - :type vm_scale_set_name: str - :param instance_id: The name of the VirtualMachineScaleSetVM. Required. - :type instance_id: str - :keyword expand: The expand expression to apply on the operation. Default value is None. - :paramtype expand: str - :return: An iterator like instance of VirtualMachineRunCommand - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.models.VirtualMachineRunCommand] + :param disk_access_name: The name of the disk access resource that is being created. The name + can't be changed after the disk encryption set is created. Supported characters for the name + are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. + :type disk_access_name: str + :return: An iterator like instance of PrivateEndpointConnection + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.models.PrivateEndpointConnection] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.VirtualMachineRunCommand]] = kwargs.pop("cls", None) + cls: ClsType[List[_models.PrivateEndpointConnection]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -32742,12 +31689,10 @@ def list( def prepare_request(next_link=None): if not next_link: - _request = build_virtual_machine_scale_set_vm_run_commands_list_request( + _request = build_disk_accesses_list_private_endpoint_connections_request( resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, - instance_id=instance_id, + disk_access_name=disk_access_name, subscription_id=self._config.subscription_id, - expand=expand, api_version=self._config.api_version, headers=_headers, params=_params, @@ -32783,7 +31728,7 @@ def prepare_request(next_link=None): def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.VirtualMachineRunCommand], deserialized.get("value", [])) + list_of_elem = _deserialize(List[_models.PrivateEndpointConnection], deserialized.get("value", [])) if cls: list_of_elem = cls(list_of_elem) # type: ignore return deserialized.get("nextLink") or None, iter(list_of_elem) @@ -32807,14 +31752,14 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) -class UsageOperationGroupOperations: +class DiskEncryptionSetsOperations: """ .. warning:: **DO NOT** instantiate this class directly. Instead, you should access the following operations through :class:`~azure.mgmt.compute.ComputeClient`'s - :attr:`usage_operation_group` attribute. + :attr:`disk_encryption_sets` attribute. """ def __init__(self, *args, **kwargs) -> None: @@ -32825,21 +31770,80 @@ def __init__(self, *args, **kwargs) -> None: self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace - def list(self, location: str, **kwargs: Any) -> ItemPaged["_models.Usage"]: - """Gets, for the specified location, the current compute resource usage information as well as the - limits for compute resources under the subscription. + def get(self, resource_group_name: str, disk_encryption_set_name: str, **kwargs: Any) -> _models.DiskEncryptionSet: + """Gets information about a disk encryption set. - :param location: The location name. Required. - :type location: str - :return: An iterator like instance of Usage - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.models.Usage] + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param disk_encryption_set_name: The name of the disk encryption set that is being created. The + name can't be changed after the disk encryption set is created. Supported characters for the + name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. + :type disk_encryption_set_name: str + :return: DiskEncryptionSet. The DiskEncryptionSet is compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.DiskEncryptionSet :raises ~azure.core.exceptions.HttpResponseError: """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.Usage]] = kwargs.pop("cls", None) + cls: ClsType[_models.DiskEncryptionSet] = kwargs.pop("cls", None) + + _request = build_disk_encryption_sets_get_request( + resource_group_name=resource_group_name, + disk_encryption_set_name=disk_encryption_set_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.DiskEncryptionSet, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized # type: ignore + + def _create_or_update_initial( + self, + resource_group_name: str, + disk_encryption_set_name: str, + disk_encryption_set: Union[_models.DiskEncryptionSet, JSON, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -32848,103 +31852,607 @@ def list(self, location: str, **kwargs: Any) -> ItemPaged["_models.Usage"]: } error_map.update(kwargs.pop("error_map", {}) or {}) - def prepare_request(next_link=None): - if not next_link: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} - _request = build_usage_operation_group_list_request( - location=location, - subscription_id=self._config.subscription_id, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) + content_type = content_type or "application/json" + _content = None + if isinstance(disk_encryption_set, (IOBase, bytes)): + _content = disk_encryption_set + else: + _content = json.dumps(disk_encryption_set, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - return _request + _request = build_disk_encryption_sets_create_or_update_request( + resource_group_name=resource_group_name, + disk_encryption_set_name=disk_encryption_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) - def extract_data(pipeline_response): - deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.Usage], deserialized.get("value", [])) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + disk_encryption_set_name: str, + disk_encryption_set: _models.DiskEncryptionSet, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.DiskEncryptionSet]: + """Creates or updates a disk encryption set. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param disk_encryption_set_name: The name of the disk encryption set that is being created. The + name can't be changed after the disk encryption set is created. Supported characters for the + name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. + :type disk_encryption_set_name: str + :param disk_encryption_set: disk encryption set object supplied in the body of the Put disk + encryption set operation. Required. + :type disk_encryption_set: ~azure.mgmt.compute.models.DiskEncryptionSet + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns DiskEncryptionSet. The DiskEncryptionSet is + compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.DiskEncryptionSet] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + disk_encryption_set_name: str, + disk_encryption_set: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.DiskEncryptionSet]: + """Creates or updates a disk encryption set. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param disk_encryption_set_name: The name of the disk encryption set that is being created. The + name can't be changed after the disk encryption set is created. Supported characters for the + name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. + :type disk_encryption_set_name: str + :param disk_encryption_set: disk encryption set object supplied in the body of the Put disk + encryption set operation. Required. + :type disk_encryption_set: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns DiskEncryptionSet. The DiskEncryptionSet is + compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.DiskEncryptionSet] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + disk_encryption_set_name: str, + disk_encryption_set: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.DiskEncryptionSet]: + """Creates or updates a disk encryption set. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param disk_encryption_set_name: The name of the disk encryption set that is being created. The + name can't be changed after the disk encryption set is created. Supported characters for the + name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. + :type disk_encryption_set_name: str + :param disk_encryption_set: disk encryption set object supplied in the body of the Put disk + encryption set operation. Required. + :type disk_encryption_set: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns DiskEncryptionSet. The DiskEncryptionSet is + compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.DiskEncryptionSet] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + disk_encryption_set_name: str, + disk_encryption_set: Union[_models.DiskEncryptionSet, JSON, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.DiskEncryptionSet]: + """Creates or updates a disk encryption set. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param disk_encryption_set_name: The name of the disk encryption set that is being created. The + name can't be changed after the disk encryption set is created. Supported characters for the + name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. + :type disk_encryption_set_name: str + :param disk_encryption_set: disk encryption set object supplied in the body of the Put disk + encryption set operation. Is one of the following types: DiskEncryptionSet, JSON, IO[bytes] + Required. + :type disk_encryption_set: ~azure.mgmt.compute.models.DiskEncryptionSet or JSON or IO[bytes] + :return: An instance of LROPoller that returns DiskEncryptionSet. The DiskEncryptionSet is + compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.DiskEncryptionSet] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.DiskEncryptionSet] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + disk_encryption_set_name=disk_encryption_set_name, + disk_encryption_set=disk_encryption_set, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.DiskEncryptionSet, response.json()) if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.get("nextLink") or None, iter(list_of_elem) + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized - def get_next(next_link=None): - _request = prepare_request(next_link) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.DiskEncryptionSet].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.DiskEncryptionSet]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _update_initial( + self, + resource_group_name: str, + disk_encryption_set_name: str, + disk_encryption_set: Union[_models.DiskEncryptionSetUpdate, JSON, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(disk_encryption_set, (IOBase, bytes)): + _content = disk_encryption_set + else: + _content = json.dumps(disk_encryption_set, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_disk_encryption_sets_update_request( + resource_group_name=resource_group_name, + disk_encryption_set_name=disk_encryption_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_update( + self, + resource_group_name: str, + disk_encryption_set_name: str, + disk_encryption_set: _models.DiskEncryptionSetUpdate, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.DiskEncryptionSet]: + """Updates (patches) a disk encryption set. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param disk_encryption_set_name: The name of the disk encryption set that is being created. The + name can't be changed after the disk encryption set is created. Supported characters for the + name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. + :type disk_encryption_set_name: str + :param disk_encryption_set: disk encryption set object supplied in the body of the Patch disk + encryption set operation. Required. + :type disk_encryption_set: ~azure.mgmt.compute.models.DiskEncryptionSetUpdate + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns DiskEncryptionSet. The DiskEncryptionSet is + compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.DiskEncryptionSet] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update( + self, + resource_group_name: str, + disk_encryption_set_name: str, + disk_encryption_set: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.DiskEncryptionSet]: + """Updates (patches) a disk encryption set. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param disk_encryption_set_name: The name of the disk encryption set that is being created. The + name can't be changed after the disk encryption set is created. Supported characters for the + name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. + :type disk_encryption_set_name: str + :param disk_encryption_set: disk encryption set object supplied in the body of the Patch disk + encryption set operation. Required. + :type disk_encryption_set: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns DiskEncryptionSet. The DiskEncryptionSet is + compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.DiskEncryptionSet] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update( + self, + resource_group_name: str, + disk_encryption_set_name: str, + disk_encryption_set: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.DiskEncryptionSet]: + """Updates (patches) a disk encryption set. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param disk_encryption_set_name: The name of the disk encryption set that is being created. The + name can't be changed after the disk encryption set is created. Supported characters for the + name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. + :type disk_encryption_set_name: str + :param disk_encryption_set: disk encryption set object supplied in the body of the Patch disk + encryption set operation. Required. + :type disk_encryption_set: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns DiskEncryptionSet. The DiskEncryptionSet is + compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.DiskEncryptionSet] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update( + self, + resource_group_name: str, + disk_encryption_set_name: str, + disk_encryption_set: Union[_models.DiskEncryptionSetUpdate, JSON, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.DiskEncryptionSet]: + """Updates (patches) a disk encryption set. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param disk_encryption_set_name: The name of the disk encryption set that is being created. The + name can't be changed after the disk encryption set is created. Supported characters for the + name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. + :type disk_encryption_set_name: str + :param disk_encryption_set: disk encryption set object supplied in the body of the Patch disk + encryption set operation. Is one of the following types: DiskEncryptionSetUpdate, JSON, + IO[bytes] Required. + :type disk_encryption_set: ~azure.mgmt.compute.models.DiskEncryptionSetUpdate or JSON or + IO[bytes] + :return: An instance of LROPoller that returns DiskEncryptionSet. The DiskEncryptionSet is + compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.DiskEncryptionSet] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.DiskEncryptionSet] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._update_initial( + resource_group_name=resource_group_name, + disk_encryption_set_name=disk_encryption_set_name, + disk_encryption_set=disk_encryption_set, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): response = pipeline_response.http_response + deserialized = _deserialize(_models.DiskEncryptionSet, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.CloudError, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } - return pipeline_response + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.DiskEncryptionSet].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.DiskEncryptionSet]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) - return ItemPaged(get_next, extract_data) + def _delete_initial( + self, resource_group_name: str, disk_encryption_set_name: str, **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} -class VirtualMachineSizesOperationGroupOperations: # pylint: disable=name-too-long - """ - .. warning:: - **DO NOT** instantiate this class directly. + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - Instead, you should access the following operations through - :class:`~azure.mgmt.compute.ComputeClient`'s - :attr:`virtual_machine_sizes_operation_group` attribute. - """ + _request = build_disk_encryption_sets_delete_request( + resource_group_name=resource_group_name, + disk_encryption_set_name=disk_encryption_set_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ComputeClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_delete(self, resource_group_name: str, disk_encryption_set_name: str, **kwargs: Any) -> LROPoller[None]: + """Deletes a disk encryption set. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param disk_encryption_set_name: The name of the disk encryption set that is being created. The + name can't be changed after the disk encryption set is created. Supported characters for the + name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. + :type disk_encryption_set_name: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + disk_encryption_set_name=disk_encryption_set_name, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore @distributed_trace - def list(self, location: str, **kwargs: Any) -> ItemPaged["_models.VirtualMachineSize"]: - """This API is deprecated. Use `Resources Skus - `_. + def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> ItemPaged["_models.DiskEncryptionSet"]: + """Lists all the disk encryption sets under a resource group. - :param location: The location name. Required. - :type location: str - :return: An iterator like instance of VirtualMachineSize - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.models.VirtualMachineSize] + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :return: An iterator like instance of DiskEncryptionSet + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.models.DiskEncryptionSet] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.VirtualMachineSize]] = kwargs.pop("cls", None) + cls: ClsType[List[_models.DiskEncryptionSet]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -32957,8 +32465,8 @@ def list(self, location: str, **kwargs: Any) -> ItemPaged["_models.VirtualMachin def prepare_request(next_link=None): if not next_link: - _request = build_virtual_machine_sizes_operation_group_list_request( - location=location, + _request = build_disk_encryption_sets_list_by_resource_group_request( + resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -32995,7 +32503,7 @@ def prepare_request(next_link=None): def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.VirtualMachineSize], deserialized.get("value", [])) + list_of_elem = _deserialize(List[_models.DiskEncryptionSet], deserialized.get("value", [])) if cls: list_of_elem = cls(list_of_elem) # type: ignore return deserialized.get("nextLink") or None, iter(list_of_elem) @@ -33018,38 +32526,18 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - -class VirtualMachineScaleSetsOperationGroupOperations: # pylint: disable=name-too-long - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.compute.ComputeClient`'s - :attr:`virtual_machine_scale_sets_operation_group` attribute. - """ - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ComputeClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list_by_location(self, location: str, **kwargs: Any) -> ItemPaged["_models.VirtualMachineScaleSet"]: - """Gets all the VM scale sets under the specified subscription for the specified location. + def list(self, **kwargs: Any) -> ItemPaged["_models.DiskEncryptionSet"]: + """Lists all the disk encryption sets under a subscription. - :param location: The location name. Required. - :type location: str - :return: An iterator like instance of VirtualMachineScaleSet - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.models.VirtualMachineScaleSet] + :return: An iterator like instance of DiskEncryptionSet + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.models.DiskEncryptionSet] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.VirtualMachineScaleSet]] = kwargs.pop("cls", None) + cls: ClsType[List[_models.DiskEncryptionSet]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -33062,8 +32550,7 @@ def list_by_location(self, location: str, **kwargs: Any) -> ItemPaged["_models.V def prepare_request(next_link=None): if not next_link: - _request = build_virtual_machine_scale_sets_operation_group_list_by_location_request( - location=location, + _request = build_disk_encryption_sets_list_request( subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -33100,7 +32587,7 @@ def prepare_request(next_link=None): def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.VirtualMachineScaleSet], deserialized.get("value", [])) + list_of_elem = _deserialize(List[_models.DiskEncryptionSet], deserialized.get("value", [])) if cls: list_of_elem = cls(list_of_elem) # type: ignore return deserialized.get("nextLink") or None, iter(list_of_elem) @@ -33123,38 +32610,27 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - -class VirtualMachinesOperationGroupOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.compute.ComputeClient`'s - :attr:`virtual_machines_operation_group` attribute. - """ - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ComputeClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list_by_location(self, location: str, **kwargs: Any) -> ItemPaged["_models.VirtualMachine"]: - """Gets all the virtual machines under the specified subscription for the specified location. + def list_associated_resources( + self, resource_group_name: str, disk_encryption_set_name: str, **kwargs: Any + ) -> ItemPaged[str]: + """Lists all resources that are encrypted with this disk encryption set. - :param location: The location name. Required. - :type location: str - :return: An iterator like instance of VirtualMachine - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.models.VirtualMachine] + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param disk_encryption_set_name: The name of the disk encryption set that is being created. The + name can't be changed after the disk encryption set is created. Supported characters for the + name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. + :type disk_encryption_set_name: str + :return: An iterator like instance of str + :rtype: ~azure.core.paging.ItemPaged[str] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.VirtualMachine]] = kwargs.pop("cls", None) + cls: ClsType[List[str]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -33167,8 +32643,9 @@ def list_by_location(self, location: str, **kwargs: Any) -> ItemPaged["_models.V def prepare_request(next_link=None): if not next_link: - _request = build_virtual_machines_operation_group_list_by_location_request( - location=location, + _request = build_disk_encryption_sets_list_associated_resources_request( + resource_group_name=resource_group_name, + disk_encryption_set_name=disk_encryption_set_name, subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -33205,7 +32682,7 @@ def prepare_request(next_link=None): def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.VirtualMachine], deserialized.get("value", [])) + list_of_elem = _deserialize(List[str], deserialized.get("value", [])) if cls: list_of_elem = cls(list_of_elem) # type: ignore return deserialized.get("nextLink") or None, iter(list_of_elem) @@ -33229,14 +32706,14 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) -class VirtualMachineImagesEdgeZoneOperationGroupOperations: # pylint: disable=name-too-long +class SnapshotsOperations: """ .. warning:: **DO NOT** instantiate this class directly. Instead, you should access the following operations through :class:`~azure.mgmt.compute.ComputeClient`'s - :attr:`virtual_machine_images_edge_zone_operation_group` attribute. + :attr:`snapshots` attribute. """ def __init__(self, *args, **kwargs) -> None: @@ -33247,17 +32724,18 @@ def __init__(self, *args, **kwargs) -> None: self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @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. + def get(self, resource_group_name: str, snapshot_name: str, **kwargs: Any) -> _models.Snapshot: + """Gets information about a snapshot. - :param location: The location name. Required. - :type location: str - :param edge_zone: The name of the edge zone. Required. - :type edge_zone: str - :return: list of VirtualMachineImageResource - :rtype: list[~azure.mgmt.compute.models.VirtualMachineImageResource] + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param snapshot_name: The name of the snapshot that is being created. The name can't be changed + after the snapshot is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. + The max name length is 80 characters. Required. + :type snapshot_name: str + :return: Snapshot. The Snapshot is compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.Snapshot :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -33271,11 +32749,11 @@ def list_publishers( _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.VirtualMachineImageResource]] = kwargs.pop("cls", None) + cls: ClsType[_models.Snapshot] = kwargs.pop("cls", None) - _request = build_virtual_machine_images_edge_zone_operation_group_list_publishers_request( - location=location, - edge_zone=edge_zone, + _request = build_snapshots_get_request( + resource_group_name=resource_group_name, + snapshot_name=snapshot_name, subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -33306,30 +32784,20 @@ def list_publishers( if _stream: deserialized = response.iter_bytes() else: - deserialized = _deserialize(List[_models.VirtualMachineImageResource], response.json()) + deserialized = _deserialize(_models.Snapshot, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # 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 location name. Required. - :type location: str - :param edge_zone: The name of the edge zone. Required. - :type edge_zone: str - :param publisher_name: A valid image publisher. Required. - :type publisher_name: str - :return: list of VirtualMachineImageResource - :rtype: list[~azure.mgmt.compute.models.VirtualMachineImageResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ + def _create_or_update_initial( + self, + resource_group_name: str, + snapshot_name: str, + snapshot: Union[_models.Snapshot, JSON, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -33338,17 +32806,26 @@ def list_offers( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.VirtualMachineImageResource]] = kwargs.pop("cls", None) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - _request = build_virtual_machine_images_edge_zone_operation_group_list_offers_request( - location=location, - edge_zone=edge_zone, - publisher_name=publisher_name, + content_type = content_type or "application/json" + _content = None + if isinstance(snapshot, (IOBase, bytes)): + _content = snapshot + else: + _content = json.dumps(snapshot, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_snapshots_create_or_update_request( + resource_group_name=resource_group_name, + snapshot_name=snapshot_name, subscription_id=self._config.subscription_id, + content_type=content_type, api_version=self._config.api_version, + content=_content, headers=_headers, params=_params, ) @@ -33357,227 +32834,208 @@ def list_offers( } _request.url = self._client.format_url(_request.url, **path_format_arguments) - _stream = kwargs.pop("stream", False) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200]: - if _stream: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass + if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = _failsafe_deserialize(_models.CloudError, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if _stream: - deserialized = response.iter_bytes() - else: - deserialized = _deserialize(List[_models.VirtualMachineImageResource], response.json()) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # 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. + @overload + def begin_create_or_update( + self, + resource_group_name: str, + snapshot_name: str, + snapshot: _models.Snapshot, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.Snapshot]: + """Creates or updates a snapshot. - :param location: The location name. Required. - :type location: str - :param edge_zone: The name of the edge zone. Required. - :type edge_zone: str - :param publisher_name: A valid image publisher. Required. - :type publisher_name: str - :param offer: A valid image publisher offer. Required. - :type offer: str - :return: list of VirtualMachineImageResource - :rtype: list[~azure.mgmt.compute.models.VirtualMachineImageResource] + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param snapshot_name: The name of the snapshot that is being created. The name can't be changed + after the snapshot is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. + The max name length is 80 characters. Required. + :type snapshot_name: str + :param snapshot: Snapshot object supplied in the body of the Put disk operation. Required. + :type snapshot: ~azure.mgmt.compute.models.Snapshot + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns Snapshot. The Snapshot is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.Snapshot] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[List[_models.VirtualMachineImageResource]] = kwargs.pop("cls", None) - - _request = build_virtual_machine_images_edge_zone_operation_group_list_skus_request( - location=location, - edge_zone=edge_zone, - publisher_name=publisher_name, - offer=offer, - subscription_id=self._config.subscription_id, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - _stream = kwargs.pop("stream", False) - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - if _stream: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.CloudError, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + @overload + def begin_create_or_update( + self, + resource_group_name: str, + snapshot_name: str, + snapshot: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.Snapshot]: + """Creates or updates a snapshot. - if _stream: - deserialized = response.iter_bytes() - else: - deserialized = _deserialize(List[_models.VirtualMachineImageResource], response.json()) + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param snapshot_name: The name of the snapshot that is being created. The name can't be changed + after the snapshot is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. + The max name length is 80 characters. Required. + :type snapshot_name: str + :param snapshot: Snapshot object supplied in the body of the Put disk operation. Required. + :type snapshot: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns Snapshot. The Snapshot is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.Snapshot] + :raises ~azure.core.exceptions.HttpResponseError: + """ - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + @overload + def begin_create_or_update( + self, + resource_group_name: str, + snapshot_name: str, + snapshot: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.Snapshot]: + """Creates or updates a snapshot. - return deserialized # type: ignore + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param snapshot_name: The name of the snapshot that is being created. The name can't be changed + after the snapshot is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. + The max name length is 80 characters. Required. + :type snapshot_name: str + :param snapshot: Snapshot object supplied in the body of the Put disk operation. Required. + :type snapshot: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns Snapshot. The Snapshot is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.Snapshot] + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace - def list( + def begin_create_or_update( 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, + resource_group_name: str, + snapshot_name: str, + snapshot: Union[_models.Snapshot, JSON, IO[bytes]], **kwargs: Any - ) -> List[_models.VirtualMachineImageResource]: - """Gets a list of all virtual machine image versions for the specified location, edge zone, - publisher, offer, and SKU. + ) -> LROPoller[_models.Snapshot]: + """Creates or updates a snapshot. - :param location: The location name. Required. - :type location: str - :param edge_zone: The name of the edge zone. Required. - :type edge_zone: str - :param publisher_name: A valid image publisher. Required. - :type publisher_name: str - :param offer: A valid image publisher offer. Required. - :type offer: str - :param skus: A valid image SKU. Required. - :type skus: str - :keyword expand: The expand expression to apply on the operation. Default value is None. - :paramtype expand: str - :keyword top: An integer value specifying the number of images to return that matches supplied - values. Default value is None. - :paramtype top: int - :keyword orderby: Specifies the order of the results returned. Formatted as an OData query. - Default value is None. - :paramtype orderby: str - :return: list of VirtualMachineImageResource - :rtype: list[~azure.mgmt.compute.models.VirtualMachineImageResource] + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param snapshot_name: The name of the snapshot that is being created. The name can't be changed + after the snapshot is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. + The max name length is 80 characters. Required. + :type snapshot_name: str + :param snapshot: Snapshot object supplied in the body of the Put disk operation. Is one of the + following types: Snapshot, JSON, IO[bytes] Required. + :type snapshot: ~azure.mgmt.compute.models.Snapshot or JSON or IO[bytes] + :return: An instance of LROPoller that returns Snapshot. The Snapshot is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.Snapshot] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.VirtualMachineImageResource]] = kwargs.pop("cls", None) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Snapshot] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + snapshot_name=snapshot_name, + snapshot=snapshot, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.Snapshot, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized - _request = build_virtual_machine_images_edge_zone_operation_group_list_request( - location=location, - edge_zone=edge_zone, - publisher_name=publisher_name, - offer=offer, - skus=skus, - subscription_id=self._config.subscription_id, - expand=expand, - top=top, - orderby=orderby, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) path_format_arguments = { "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = kwargs.pop("stream", False) - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - if _stream: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.CloudError, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if _stream: - deserialized = response.iter_bytes() + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) else: - deserialized = _deserialize(List[_models.VirtualMachineImageResource], response.json()) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @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. + polling_method = polling + if cont_token: + return LROPoller[_models.Snapshot].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.Snapshot]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) - :param location: The name of the Azure region. Required. - :type location: str - :param edge_zone: The name of the edge zone. Required. - :type edge_zone: str - :param publisher_name: A valid image publisher. Required. - :type publisher_name: str - :param offer: A valid image publisher offer. Required. - :type offer: str - :param skus: A valid image SKU. Required. - :type skus: str - :param version: A valid image SKU version. Required. - :type version: str - :return: VirtualMachineImage. The VirtualMachineImage is compatible with MutableMapping - :rtype: ~azure.mgmt.compute.models.VirtualMachineImage - :raises ~azure.core.exceptions.HttpResponseError: - """ + def _update_initial( + self, + resource_group_name: str, + snapshot_name: str, + snapshot: Union[_models.SnapshotUpdate, JSON, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -33586,20 +33044,26 @@ def get( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.VirtualMachineImage] = kwargs.pop("cls", None) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(snapshot, (IOBase, bytes)): + _content = snapshot + else: + _content = json.dumps(snapshot, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - _request = build_virtual_machine_images_edge_zone_operation_group_get_request( - location=location, - edge_zone=edge_zone, - publisher_name=publisher_name, - offer=offer, - skus=skus, - version=version, + _request = build_snapshots_update_request( + resource_group_name=resource_group_name, + snapshot_name=snapshot_name, subscription_id=self._config.subscription_id, + content_type=content_type, api_version=self._config.api_version, + content=_content, headers=_headers, params=_params, ) @@ -33608,64 +33072,205 @@ def get( } _request.url = self._client.format_url(_request.url, **path_format_arguments) - _stream = kwargs.pop("stream", False) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200]: - if _stream: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass + if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = _failsafe_deserialize(_models.CloudError, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if _stream: - deserialized = response.iter_bytes() - else: - deserialized = _deserialize(_models.VirtualMachineImage, response.json()) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore + @overload + def begin_update( + self, + resource_group_name: str, + snapshot_name: str, + snapshot: _models.SnapshotUpdate, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.Snapshot]: + """Updates (patches) a snapshot. -class VirtualMachineImagesOperationGroupOperations: # pylint: disable=name-too-long - """ - .. warning:: - **DO NOT** instantiate this class directly. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param snapshot_name: The name of the snapshot that is being created. The name can't be changed + after the snapshot is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. + The max name length is 80 characters. Required. + :type snapshot_name: str + :param snapshot: Snapshot object supplied in the body of the Patch snapshot operation. + Required. + :type snapshot: ~azure.mgmt.compute.models.SnapshotUpdate + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns Snapshot. The Snapshot is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.Snapshot] + :raises ~azure.core.exceptions.HttpResponseError: + """ - Instead, you should access the following operations through - :class:`~azure.mgmt.compute.ComputeClient`'s - :attr:`virtual_machine_images_operation_group` attribute. - """ + @overload + def begin_update( + self, + resource_group_name: str, + snapshot_name: str, + snapshot: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.Snapshot]: + """Updates (patches) a snapshot. - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ComputeClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param snapshot_name: The name of the snapshot that is being created. The name can't be changed + after the snapshot is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. + The max name length is 80 characters. Required. + :type snapshot_name: str + :param snapshot: Snapshot object supplied in the body of the Patch snapshot operation. + Required. + :type snapshot: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns Snapshot. The Snapshot is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.Snapshot] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update( + self, + resource_group_name: str, + snapshot_name: str, + snapshot: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.Snapshot]: + """Updates (patches) a snapshot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param snapshot_name: The name of the snapshot that is being created. The name can't be changed + after the snapshot is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. + The max name length is 80 characters. Required. + :type snapshot_name: str + :param snapshot: Snapshot object supplied in the body of the Patch snapshot operation. + Required. + :type snapshot: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns Snapshot. The Snapshot is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.Snapshot] + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace - def list_by_edge_zone(self, location: str, edge_zone: str, **kwargs: Any) -> _models.VmImagesInEdgeZoneListResult: - """Gets a list of all virtual machine image versions for the specified edge zone. + def begin_update( + self, + resource_group_name: str, + snapshot_name: str, + snapshot: Union[_models.SnapshotUpdate, JSON, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.Snapshot]: + """Updates (patches) a snapshot. - :param location: The location name. Required. - :type location: str - :param edge_zone: The name of the edge zone. Required. - :type edge_zone: str - :return: VmImagesInEdgeZoneListResult. The VmImagesInEdgeZoneListResult is compatible with + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param snapshot_name: The name of the snapshot that is being created. The name can't be changed + after the snapshot is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. + The max name length is 80 characters. Required. + :type snapshot_name: str + :param snapshot: Snapshot object supplied in the body of the Patch snapshot operation. Is one + of the following types: SnapshotUpdate, JSON, IO[bytes] Required. + :type snapshot: ~azure.mgmt.compute.models.SnapshotUpdate or JSON or IO[bytes] + :return: An instance of LROPoller that returns Snapshot. The Snapshot is compatible with MutableMapping - :rtype: ~azure.mgmt.compute.models.VmImagesInEdgeZoneListResult + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.Snapshot] :raises ~azure.core.exceptions.HttpResponseError: """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Snapshot] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._update_initial( + resource_group_name=resource_group_name, + snapshot_name=snapshot_name, + snapshot=snapshot, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.Snapshot, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.Snapshot].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.Snapshot]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _delete_initial(self, resource_group_name: str, snapshot_name: str, **kwargs: Any) -> Iterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -33677,11 +33282,11 @@ def list_by_edge_zone(self, location: str, edge_zone: str, **kwargs: Any) -> _mo _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.VmImagesInEdgeZoneListResult] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - _request = build_virtual_machine_images_operation_group_list_by_edge_zone_request( - location=location, - edge_zone=edge_zone, + _request = build_snapshots_delete_request( + resource_group_name=resource_group_name, + snapshot_name=snapshot_name, subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -33692,43 +33297,109 @@ def list_by_edge_zone(self, location: str, edge_zone: str, **kwargs: Any) -> _mo } _request.url = self._client.format_url(_request.url, **path_format_arguments) - _stream = kwargs.pop("stream", False) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200]: - if _stream: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass + if response.status_code not in [200, 202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = _failsafe_deserialize(_models.CloudError, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if _stream: - deserialized = response.iter_bytes() - else: - deserialized = _deserialize(_models.VmImagesInEdgeZoneListResult, response.json()) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # 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. + def begin_delete(self, resource_group_name: str, snapshot_name: str, **kwargs: Any) -> LROPoller[None]: + """Deletes a snapshot. - :param location: The location name. Required. - :type location: str - :return: list of VirtualMachineImageResource - :rtype: list[~azure.mgmt.compute.models.VirtualMachineImageResource] + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param snapshot_name: The name of the snapshot that is being created. The name can't be changed + after the snapshot is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. + The max name length is 80 characters. Required. + :type snapshot_name: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + snapshot_name=snapshot_name, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace + def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> ItemPaged["_models.Snapshot"]: + """Lists snapshots under a resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :return: An iterator like instance of Snapshot + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.models.Snapshot] :raises ~azure.core.exceptions.HttpResponseError: """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.Snapshot]] = kwargs.pop("cls", None) + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -33737,64 +33408,83 @@ def list_publishers(self, location: str, **kwargs: Any) -> List[_models.VirtualM } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} + def prepare_request(next_link=None): + if not next_link: - cls: ClsType[List[_models.VirtualMachineImageResource]] = kwargs.pop("cls", None) + _request = build_snapshots_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) - _request = build_virtual_machine_images_operation_group_list_publishers_request( - location=location, - subscription_id=self._config.subscription_id, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) - _stream = kwargs.pop("stream", False) - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) + return _request - response = pipeline_response.http_response + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.Snapshot], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) - if response.status_code not in [200]: - if _stream: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.CloudError, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + def get_next(next_link=None): + _request = prepare_request(next_link) - if _stream: - deserialized = response.iter_bytes() - else: - deserialized = _deserialize(List[_models.VirtualMachineImageResource], response.json()) + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - return deserialized # type: ignore + return pipeline_response + + return ItemPaged(get_next, extract_data) @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. + def list(self, **kwargs: Any) -> ItemPaged["_models.Snapshot"]: + """Lists snapshots under a subscription. - :param location: The location name. Required. - :type location: str - :param publisher_name: A valid image publisher. Required. - :type publisher_name: str - :return: list of VirtualMachineImageResource - :rtype: list[~azure.mgmt.compute.models.VirtualMachineImageResource] + :return: An iterator like instance of Snapshot + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.models.Snapshot] :raises ~azure.core.exceptions.HttpResponseError: """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.Snapshot]] = kwargs.pop("cls", None) + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -33803,67 +33493,76 @@ def list_offers( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} + def prepare_request(next_link=None): + if not next_link: - cls: ClsType[List[_models.VirtualMachineImageResource]] = kwargs.pop("cls", None) + _request = build_snapshots_list_request( + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) - _request = build_virtual_machine_images_operation_group_list_offers_request( - location=location, - publisher_name=publisher_name, - subscription_id=self._config.subscription_id, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) - _stream = kwargs.pop("stream", False) - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) + return _request - response = pipeline_response.http_response + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.Snapshot], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) - if response.status_code not in [200]: - if _stream: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.CloudError, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + def get_next(next_link=None): + _request = prepare_request(next_link) - if _stream: - deserialized = response.iter_bytes() - else: - deserialized = _deserialize(List[_models.VirtualMachineImageResource], response.json()) + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - return deserialized # type: ignore + return pipeline_response - @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. + return ItemPaged(get_next, extract_data) - :param location: The location name. Required. - :type location: str - :param publisher_name: A valid image publisher. Required. - :type publisher_name: str - :param offer: A valid image publisher offer. Required. - :type offer: str - :return: list of VirtualMachineImageResource - :rtype: list[~azure.mgmt.compute.models.VirtualMachineImageResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ + def _grant_access_initial( + self, + resource_group_name: str, + snapshot_name: str, + grant_access_data: Union[_models.GrantAccessData, JSON, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -33872,17 +33571,26 @@ def list_skus( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.VirtualMachineImageResource]] = kwargs.pop("cls", None) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - _request = build_virtual_machine_images_operation_group_list_skus_request( - location=location, - publisher_name=publisher_name, - offer=offer, + content_type = content_type or "application/json" + _content = None + if isinstance(grant_access_data, (IOBase, bytes)): + _content = grant_access_data + else: + _content = json.dumps(grant_access_data, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_snapshots_grant_access_request( + resource_group_name=resource_group_name, + snapshot_name=snapshot_name, subscription_id=self._config.subscription_id, + content_type=content_type, api_version=self._config.api_version, + content=_content, headers=_headers, params=_params, ) @@ -33891,67 +33599,209 @@ def list_skus( } _request.url = self._client.format_url(_request.url, **path_format_arguments) - _stream = kwargs.pop("stream", False) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200]: - if _stream: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass + if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = _failsafe_deserialize(_models.CloudError, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if _stream: - deserialized = response.iter_bytes() - else: - deserialized = _deserialize(List[_models.VirtualMachineImageResource], response.json()) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore - @distributed_trace - def list( + @overload + def begin_grant_access( self, - location: str, - publisher_name: str, - offer: str, - skus: str, + resource_group_name: str, + snapshot_name: str, + grant_access_data: _models.GrantAccessData, *, - expand: Optional[str] = None, - top: Optional[int] = None, - orderby: Optional[str] = None, + content_type: str = "application/json", **kwargs: Any - ) -> List[_models.VirtualMachineImageResource]: - """Gets a list of all virtual machine image versions for the specified location, publisher, offer, - and SKU. + ) -> LROPoller[_models.AccessUri]: + """Grants access to a snapshot. - :param location: The location name. Required. - :type location: str - :param publisher_name: A valid image publisher. Required. - :type publisher_name: str - :param offer: A valid image publisher offer. Required. - :type offer: str - :param skus: A valid image SKU. Required. - :type skus: str - :keyword expand: The expand expression to apply on the operation. Default value is None. - :paramtype expand: str - :keyword top: Default value is None. - :paramtype top: int - :keyword orderby: Default value is None. - :paramtype orderby: str - :return: list of VirtualMachineImageResource - :rtype: list[~azure.mgmt.compute.models.VirtualMachineImageResource] + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param snapshot_name: The name of the snapshot that is being created. The name can't be changed + after the snapshot is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. + The max name length is 80 characters. Required. + :type snapshot_name: str + :param grant_access_data: Access data object supplied in the body of the get snapshot access + operation. Required. + :type grant_access_data: ~azure.mgmt.compute.models.GrantAccessData + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns AccessUri. The AccessUri is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.AccessUri] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_grant_access( + self, + resource_group_name: str, + snapshot_name: str, + grant_access_data: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.AccessUri]: + """Grants access to a snapshot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param snapshot_name: The name of the snapshot that is being created. The name can't be changed + after the snapshot is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. + The max name length is 80 characters. Required. + :type snapshot_name: str + :param grant_access_data: Access data object supplied in the body of the get snapshot access + operation. Required. + :type grant_access_data: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns AccessUri. The AccessUri is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.AccessUri] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_grant_access( + self, + resource_group_name: str, + snapshot_name: str, + grant_access_data: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.AccessUri]: + """Grants access to a snapshot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param snapshot_name: The name of the snapshot that is being created. The name can't be changed + after the snapshot is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. + The max name length is 80 characters. Required. + :type snapshot_name: str + :param grant_access_data: Access data object supplied in the body of the get snapshot access + operation. Required. + :type grant_access_data: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns AccessUri. The AccessUri is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.AccessUri] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_grant_access( + self, + resource_group_name: str, + snapshot_name: str, + grant_access_data: Union[_models.GrantAccessData, JSON, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.AccessUri]: + """Grants access to a snapshot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param snapshot_name: The name of the snapshot that is being created. The name can't be changed + after the snapshot is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. + The max name length is 80 characters. Required. + :type snapshot_name: str + :param grant_access_data: Access data object supplied in the body of the get snapshot access + operation. Is one of the following types: GrantAccessData, JSON, IO[bytes] Required. + :type grant_access_data: ~azure.mgmt.compute.models.GrantAccessData or JSON or IO[bytes] + :return: An instance of LROPoller that returns AccessUri. The AccessUri is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.AccessUri] :raises ~azure.core.exceptions.HttpResponseError: """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AccessUri] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._grant_access_initial( + resource_group_name=resource_group_name, + snapshot_name=snapshot_name, + grant_access_data=grant_access_data, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = _deserialize(_models.AccessUri, response.json()) + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.AccessUri].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.AccessUri]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _revoke_access_initial(self, resource_group_name: str, snapshot_name: str, **kwargs: Any) -> Iterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -33963,17 +33813,12 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.VirtualMachineImageResource]] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - _request = build_virtual_machine_images_operation_group_list_request( - location=location, - publisher_name=publisher_name, - offer=offer, - skus=skus, + _request = build_snapshots_revoke_access_request( + resource_group_name=resource_group_name, + snapshot_name=snapshot_name, subscription_id=self._config.subscription_id, - expand=expand, - top=top, - orderby=orderby, api_version=self._config.api_version, headers=_headers, params=_params, @@ -33983,142 +33828,136 @@ def list( } _request.url = self._client.format_url(_request.url, **path_format_arguments) - _stream = kwargs.pop("stream", False) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200]: - if _stream: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass + if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = _failsafe_deserialize(_models.CloudError, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if _stream: - deserialized = response.iter_bytes() - else: - deserialized = _deserialize(List[_models.VirtualMachineImageResource], response.json()) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore @distributed_trace - def list_with_properties( - self, - location: str, - publisher_name: str, - offer: str, - skus: str, - *, - expand: str, - top: Optional[int] = None, - orderby: Optional[str] = None, - **kwargs: Any - ) -> List[_models.VirtualMachineImage]: - """list_with_properties. + def begin_revoke_access(self, resource_group_name: str, snapshot_name: str, **kwargs: Any) -> LROPoller[None]: + """Revokes access to a snapshot. - :param location: The location name. Required. - :type location: str - :param publisher_name: A valid image publisher. Required. - :type publisher_name: str - :param offer: A valid image publisher offer. Required. - :type offer: str - :param skus: A valid image SKU. Required. - :type skus: str - :keyword expand: The expand expression to apply on the operation. Required. - :paramtype expand: str - :keyword top: Default value is None. - :paramtype top: int - :keyword orderby: Default value is None. - :paramtype orderby: str - :return: list of VirtualMachineImage - :rtype: list[~azure.mgmt.compute.models.VirtualMachineImage] + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param snapshot_name: The name of the snapshot that is being created. The name can't be changed + after the snapshot is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. + The max name length is 80 characters. Required. + :type snapshot_name: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.VirtualMachineImage]] = kwargs.pop("cls", None) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._revoke_access_initial( + resource_group_name=resource_group_name, + snapshot_name=snapshot_name, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore - _request = build_virtual_machine_images_operation_group_list_with_properties_request( - location=location, - publisher_name=publisher_name, - offer=offer, - skus=skus, - subscription_id=self._config.subscription_id, - expand=expand, - top=top, - orderby=orderby, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) path_format_arguments = { "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = kwargs.pop("stream", False) - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - if response.status_code not in [200]: - if _stream: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.CloudError, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if _stream: - deserialized = response.iter_bytes() - else: - deserialized = _deserialize(List[_models.VirtualMachineImage], response.json()) +class GalleriesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + Instead, you should access the following operations through + :class:`~azure.mgmt.compute.ComputeClient`'s + :attr:`galleries` attribute. + """ - return deserialized # type: ignore + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @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. + self, + resource_group_name: str, + gallery_name: str, + *, + select: Optional[Union[str, _models.SelectPermissions]] = None, + expand: Optional[Union[str, _models.GalleryExpandParams]] = None, + **kwargs: Any + ) -> _models.Gallery: + """Retrieves information about a Shared Image Gallery. - :param location: The name of the Azure region. Required. - :type location: str - :param publisher_name: A valid image publisher. Required. - :type publisher_name: str - :param offer: A valid image publisher offer. Required. - :type offer: str - :param skus: A valid image SKU. Required. - :type skus: str - :param version: A valid image SKU version. Required. - :type version: str - :return: VirtualMachineImage. The VirtualMachineImage is compatible with MutableMapping - :rtype: ~azure.mgmt.compute.models.VirtualMachineImage + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :keyword select: The select expression to apply on the operation. "Permissions" Default value + is None. + :paramtype select: str or ~azure.mgmt.compute.models.SelectPermissions + :keyword expand: The expand query option to apply on the operation. "SharingProfile/Groups" + Default value is None. + :paramtype expand: str or ~azure.mgmt.compute.models.GalleryExpandParams + :return: Gallery. The Gallery is compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.Gallery :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -34132,15 +33971,14 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.VirtualMachineImage] = kwargs.pop("cls", None) + cls: ClsType[_models.Gallery] = kwargs.pop("cls", None) - _request = build_virtual_machine_images_operation_group_get_request( - location=location, - publisher_name=publisher_name, - offer=offer, - skus=skus, - version=version, + _request = build_galleries_get_request( + resource_group_name=resource_group_name, + gallery_name=gallery_name, subscription_id=self._config.subscription_id, + select=select, + expand=expand, api_version=self._config.api_version, headers=_headers, params=_params, @@ -34170,33 +34008,19 @@ def get( if _stream: deserialized = response.iter_bytes() else: - deserialized = _deserialize(_models.VirtualMachineImage, response.json()) + deserialized = _deserialize(_models.Gallery, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - -class LogAnalyticsOperationGroupOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.compute.ComputeClient`'s - :attr:`log_analytics_operation_group` attribute. - """ - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ComputeClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - def _export_request_rate_by_interval_initial( - self, location: str, parameters: Union[_models.RequestRateByIntervalInput, JSON, IO[bytes]], **kwargs: Any + def _create_or_update_initial( + self, + resource_group_name: str, + gallery_name: str, + gallery: Union[_models.Gallery, JSON, IO[bytes]], + **kwargs: Any ) -> Iterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -34214,13 +34038,14 @@ def _export_request_rate_by_interval_initial( content_type = content_type or "application/json" _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters + if isinstance(gallery, (IOBase, bytes)): + _content = gallery else: - _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(gallery, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - _request = build_log_analytics_operation_group_export_request_rate_by_interval_request( - location=location, + _request = build_galleries_create_or_update_request( + resource_group_name=resource_group_name, + gallery_name=gallery_name, subscription_id=self._config.subscription_id, content_type=content_type, api_version=self._config.api_version, @@ -34240,7 +34065,7 @@ def _export_request_rate_by_interval_initial( response = pipeline_response.http_response - if response.status_code not in [200, 202]: + if response.status_code not in [200, 201, 202]: try: response.read() # Load the body in memory and close the socket except (StreamConsumedError, StreamClosedError): @@ -34250,10 +34075,12 @@ def _export_request_rate_by_interval_initial( raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} + if response.status_code == 201: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + if response.status_code == 202: - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) deserialized = response.iter_bytes() @@ -34264,98 +34091,128 @@ def _export_request_rate_by_interval_initial( return deserialized # type: ignore @overload - def begin_export_request_rate_by_interval( + def begin_create_or_update( self, - location: str, - parameters: _models.RequestRateByIntervalInput, + resource_group_name: str, + gallery_name: str, + gallery: _models.Gallery, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[None]: - """Export logs that show Api requests made by this subscription in the given time window to show - throttling activities. + ) -> LROPoller[_models.Gallery]: + """Create or update a Shared Image Gallery. - :param location: The location name. Required. - :type location: str - :param parameters: Parameters supplied to the LogAnalytics getRequestRateByInterval Api. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. - :type parameters: ~azure.mgmt.compute.models.RequestRateByIntervalInput + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param gallery: Parameters supplied to the create or update Shared Image Gallery operation. + Required. + :type gallery: ~azure.mgmt.compute.models.Gallery :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns None - :rtype: ~azure.core.polling.LROPoller[None] + :return: An instance of LROPoller that returns Gallery. The Gallery is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.Gallery] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def begin_export_request_rate_by_interval( - self, location: str, parameters: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[None]: - """Export logs that show Api requests made by this subscription in the given time window to show - throttling activities. + def begin_create_or_update( + self, + resource_group_name: str, + gallery_name: str, + gallery: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.Gallery]: + """Create or update a Shared Image Gallery. - :param location: The location name. Required. - :type location: str - :param parameters: Parameters supplied to the LogAnalytics getRequestRateByInterval Api. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. - :type parameters: JSON + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param gallery: Parameters supplied to the create or update Shared Image Gallery operation. + Required. + :type gallery: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns None - :rtype: ~azure.core.polling.LROPoller[None] + :return: An instance of LROPoller that returns Gallery. The Gallery is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.Gallery] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def begin_export_request_rate_by_interval( - self, location: str, parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[None]: - """Export logs that show Api requests made by this subscription in the given time window to show - throttling activities. + def begin_create_or_update( + self, + resource_group_name: str, + gallery_name: str, + gallery: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.Gallery]: + """Create or update a Shared Image Gallery. - :param location: The location name. Required. - :type location: str - :param parameters: Parameters supplied to the LogAnalytics getRequestRateByInterval Api. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. - :type parameters: IO[bytes] + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param gallery: Parameters supplied to the create or update Shared Image Gallery operation. + Required. + :type gallery: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns None - :rtype: ~azure.core.polling.LROPoller[None] + :return: An instance of LROPoller that returns Gallery. The Gallery is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.Gallery] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace - def begin_export_request_rate_by_interval( - self, location: str, parameters: Union[_models.RequestRateByIntervalInput, JSON, IO[bytes]], **kwargs: Any - ) -> LROPoller[None]: - """Export logs that show Api requests made by this subscription in the given time window to show - throttling activities. + def begin_create_or_update( + self, + resource_group_name: str, + gallery_name: str, + gallery: Union[_models.Gallery, JSON, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.Gallery]: + """Create or update a Shared Image Gallery. - :param location: The location name. Required. - :type location: str - :param parameters: Parameters supplied to the LogAnalytics getRequestRateByInterval Api. Is one - of the following types: RequestRateByIntervalInput, JSON, IO[bytes] Required. - :type parameters: ~azure.mgmt.compute.models.RequestRateByIntervalInput or JSON or IO[bytes] - :return: An instance of LROPoller that returns None - :rtype: ~azure.core.polling.LROPoller[None] + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param gallery: Parameters supplied to the create or update Shared Image Gallery operation. Is + one of the following types: Gallery, JSON, IO[bytes] Required. + :type gallery: ~azure.mgmt.compute.models.Gallery or JSON or IO[bytes] + :return: An instance of LROPoller that returns Gallery. The Gallery is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.Gallery] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[_models.Gallery] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._export_request_rate_by_interval_initial( - location=location, - parameters=parameters, + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery=gallery, content_type=content_type, cls=lambda x, y, z: x, headers=_headers, @@ -34365,9 +34222,12 @@ def begin_export_request_rate_by_interval( raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.Gallery, response.json()) if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized path_format_arguments = { "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), @@ -34382,16 +34242,22 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return LROPoller[None].from_continuation_token( + return LROPoller[_models.Gallery].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + return LROPoller[_models.Gallery]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) - def _export_throttled_requests_initial( - self, location: str, parameters: Union[_models.ThrottledRequestsInput, JSON, IO[bytes]], **kwargs: Any + def _update_initial( + self, + resource_group_name: str, + gallery_name: str, + gallery: Union[_models.GalleryUpdate, JSON, IO[bytes]], + **kwargs: Any ) -> Iterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -34409,13 +34275,14 @@ def _export_throttled_requests_initial( content_type = content_type or "application/json" _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters + if isinstance(gallery, (IOBase, bytes)): + _content = gallery else: - _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(gallery, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - _request = build_log_analytics_operation_group_export_throttled_requests_request( - location=location, + _request = build_galleries_update_request( + resource_group_name=resource_group_name, + gallery_name=gallery_name, subscription_id=self._config.subscription_id, content_type=content_type, api_version=self._config.api_version, @@ -34435,7 +34302,7 @@ def _export_throttled_requests_initial( response = pipeline_response.http_response - if response.status_code not in [200, 202]: + if response.status_code not in [200]: try: response.read() # Load the body in memory and close the socket except (StreamConsumedError, StreamClosedError): @@ -34445,11 +34312,8 @@ def _export_throttled_requests_initial( raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} - if response.status_code == 202: - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) deserialized = response.iter_bytes() @@ -34459,95 +34323,125 @@ def _export_throttled_requests_initial( return deserialized # type: ignore @overload - def begin_export_throttled_requests( + def begin_update( self, - location: str, - parameters: _models.ThrottledRequestsInput, + resource_group_name: str, + gallery_name: str, + gallery: _models.GalleryUpdate, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[None]: - """Export logs that show total throttled Api requests for this subscription in the given time - window. + ) -> LROPoller[_models.Gallery]: + """Update a Shared Image Gallery. - :param location: The location name. Required. - :type location: str - :param parameters: The request body. Required. - :type parameters: ~azure.mgmt.compute.models.ThrottledRequestsInput + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param gallery: Parameters supplied to the update Shared Image Gallery operation. Required. + :type gallery: ~azure.mgmt.compute.models.GalleryUpdate :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns None - :rtype: ~azure.core.polling.LROPoller[None] + :return: An instance of LROPoller that returns Gallery. The Gallery is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.Gallery] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def begin_export_throttled_requests( - self, location: str, parameters: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[None]: - """Export logs that show total throttled Api requests for this subscription in the given time - window. + def begin_update( + self, + resource_group_name: str, + gallery_name: str, + gallery: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.Gallery]: + """Update a Shared Image Gallery. - :param location: The location name. Required. - :type location: str - :param parameters: The request body. Required. - :type parameters: JSON + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param gallery: Parameters supplied to the update Shared Image Gallery operation. Required. + :type gallery: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns None - :rtype: ~azure.core.polling.LROPoller[None] + :return: An instance of LROPoller that returns Gallery. The Gallery is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.Gallery] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def begin_export_throttled_requests( - self, location: str, parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[None]: - """Export logs that show total throttled Api requests for this subscription in the given time - window. + def begin_update( + self, + resource_group_name: str, + gallery_name: str, + gallery: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.Gallery]: + """Update a Shared Image Gallery. - :param location: The location name. Required. - :type location: str - :param parameters: The request body. Required. - :type parameters: IO[bytes] + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param gallery: Parameters supplied to the update Shared Image Gallery operation. Required. + :type gallery: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns None - :rtype: ~azure.core.polling.LROPoller[None] + :return: An instance of LROPoller that returns Gallery. The Gallery is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.Gallery] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace - def begin_export_throttled_requests( - self, location: str, parameters: Union[_models.ThrottledRequestsInput, JSON, IO[bytes]], **kwargs: Any - ) -> LROPoller[None]: - """Export logs that show total throttled Api requests for this subscription in the given time - window. + def begin_update( + self, + resource_group_name: str, + gallery_name: str, + gallery: Union[_models.GalleryUpdate, JSON, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.Gallery]: + """Update a Shared Image Gallery. - :param location: The location name. Required. - :type location: str - :param parameters: The request body. Is one of the following types: ThrottledRequestsInput, - JSON, IO[bytes] Required. - :type parameters: ~azure.mgmt.compute.models.ThrottledRequestsInput or JSON or IO[bytes] - :return: An instance of LROPoller that returns None - :rtype: ~azure.core.polling.LROPoller[None] + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param gallery: Parameters supplied to the update Shared Image Gallery operation. Is one of the + following types: GalleryUpdate, JSON, IO[bytes] Required. + :type gallery: ~azure.mgmt.compute.models.GalleryUpdate or JSON or IO[bytes] + :return: An instance of LROPoller that returns Gallery. The Gallery is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.Gallery] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[_models.Gallery] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._export_throttled_requests_initial( - location=location, - parameters=parameters, + raw_result = self._update_initial( + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery=gallery, content_type=content_type, cls=lambda x, y, z: x, headers=_headers, @@ -34557,9 +34451,16 @@ def begin_export_throttled_requests( raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = _deserialize(_models.Gallery, response.json()) if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore + return deserialized path_format_arguments = { "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), @@ -34574,46 +34475,143 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return LROPoller[None].from_continuation_token( + return LROPoller[_models.Gallery].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + return LROPoller[_models.Gallery]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + def _delete_initial(self, resource_group_name: str, gallery_name: str, **kwargs: Any) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) -class VirtualMachineRunCommandsOperationGroupOperations: # pylint: disable=name-too-long - """ - .. warning:: - **DO NOT** instantiate this class directly. + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} - Instead, you should access the following operations through - :class:`~azure.mgmt.compute.ComputeClient`'s - :attr:`virtual_machine_run_commands_operation_group` attribute. - """ + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ComputeClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + _request = build_galleries_delete_request( + resource_group_name=resource_group_name, + gallery_name=gallery_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore @distributed_trace - def list(self, location: str, **kwargs: Any) -> ItemPaged["_models.RunCommandDocumentBase"]: - """Lists all available run commands for a subscription in a location. + def begin_delete(self, resource_group_name: str, gallery_name: str, **kwargs: Any) -> LROPoller[None]: + """Delete a Shared Image Gallery. - :param location: The location name. Required. - :type location: str - :return: An iterator like instance of RunCommandDocumentBase - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.models.RunCommandDocumentBase] + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.RunCommandDocumentBase]] = kwargs.pop("cls", None) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + gallery_name=gallery_name, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace + def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> ItemPaged["_models.Gallery"]: + """List galleries under a resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :return: An iterator like instance of Gallery + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.models.Gallery] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.Gallery]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -34626,8 +34624,8 @@ def list(self, location: str, **kwargs: Any) -> ItemPaged["_models.RunCommandDoc def prepare_request(next_link=None): if not next_link: - _request = build_virtual_machine_run_commands_operation_group_list_request( - location=location, + _request = build_galleries_list_by_resource_group_request( + resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -34664,7 +34662,7 @@ def prepare_request(next_link=None): def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.RunCommandDocumentBase], deserialized.get("value", [])) + list_of_elem = _deserialize(List[_models.Gallery], deserialized.get("value", [])) if cls: list_of_elem = cls(list_of_elem) # type: ignore return deserialized.get("nextLink") or None, iter(list_of_elem) @@ -34688,21 +34686,18 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) @distributed_trace - def get(self, location: str, command_id: str, **kwargs: Any) -> _models.RunCommandDocument: - """Gets specific run command for a subscription in a location. + def list(self, **kwargs: Any) -> ItemPaged["_models.Gallery"]: + """List galleries under a subscription. - :param location: The name of the Azure region. Required. - :type location: str - :param command_id: Specifies a commandId of predefined built-in script. Command IDs available - for Linux are listed at `https://aka.ms/RunCommandManagedLinux#available-commands - `_, Windows at - `https://aka.ms/RunCommandManagedWindows#available-commands - `_. Required. - :type command_id: str - :return: RunCommandDocument. The RunCommandDocument is compatible with MutableMapping - :rtype: ~azure.mgmt.compute.models.RunCommandDocument + :return: An iterator like instance of Gallery + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.models.Gallery] :raises ~azure.core.exceptions.HttpResponseError: """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.Gallery]] = kwargs.pop("cls", None) + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -34711,63 +34706,78 @@ def get(self, location: str, command_id: str, **kwargs: Any) -> _models.RunComma } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} + def prepare_request(next_link=None): + if not next_link: - cls: ClsType[_models.RunCommandDocument] = kwargs.pop("cls", None) + _request = build_galleries_list_request( + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) - _request = build_virtual_machine_run_commands_operation_group_get_request( - location=location, - command_id=command_id, - subscription_id=self._config.subscription_id, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) - _stream = kwargs.pop("stream", False) - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) + return _request - response = pipeline_response.http_response + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.Gallery], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) - if response.status_code not in [200]: - if _stream: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.CloudError, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + def get_next(next_link=None): + _request = prepare_request(next_link) - response_headers = {} - response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response - if _stream: - deserialized = response.iter_bytes() - else: - deserialized = _deserialize(_models.RunCommandDocument, response.json()) + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore + return pipeline_response - return deserialized # type: ignore + return ItemPaged(get_next, extract_data) -class DisksOperations: +class GalleryImagesOperations: """ .. warning:: **DO NOT** instantiate this class directly. Instead, you should access the following operations through :class:`~azure.mgmt.compute.ComputeClient`'s - :attr:`disks` attribute. + :attr:`gallery_images` attribute. """ def __init__(self, *args, **kwargs) -> None: @@ -34778,18 +34788,20 @@ def __init__(self, *args, **kwargs) -> None: self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace - def get(self, resource_group_name: str, disk_name: str, **kwargs: Any) -> _models.Disk: - """Gets information about a disk. + def get( + self, resource_group_name: str, gallery_name: str, gallery_image_name: str, **kwargs: Any + ) -> _models.GalleryImage: + """Retrieves information about a gallery image definition. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param disk_name: The name of the managed disk that is being created. The name can't be changed - after the disk is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The - maximum name length is 80 characters. Required. - :type disk_name: str - :return: Disk. The Disk is compatible with MutableMapping - :rtype: ~azure.mgmt.compute.models.Disk + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param gallery_image_name: The name of the gallery image definition to be retrieved. Required. + :type gallery_image_name: str + :return: GalleryImage. The GalleryImage is compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.GalleryImage :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -34803,11 +34815,12 @@ def get(self, resource_group_name: str, disk_name: str, **kwargs: Any) -> _model _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.Disk] = kwargs.pop("cls", None) + cls: ClsType[_models.GalleryImage] = kwargs.pop("cls", None) - _request = build_disks_get_request( + _request = build_gallery_images_get_request( resource_group_name=resource_group_name, - disk_name=disk_name, + gallery_name=gallery_name, + gallery_image_name=gallery_image_name, subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -34838,7 +34851,7 @@ def get(self, resource_group_name: str, disk_name: str, **kwargs: Any) -> _model if _stream: deserialized = response.iter_bytes() else: - deserialized = _deserialize(_models.Disk, response.json()) + deserialized = _deserialize(_models.GalleryImage, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -34846,7 +34859,12 @@ def get(self, resource_group_name: str, disk_name: str, **kwargs: Any) -> _model return deserialized # type: ignore def _create_or_update_initial( - self, resource_group_name: str, disk_name: str, disk: Union[_models.Disk, JSON, IO[bytes]], **kwargs: Any + self, + resource_group_name: str, + gallery_name: str, + gallery_image_name: str, + gallery_image: Union[_models.GalleryImage, JSON, IO[bytes]], + **kwargs: Any ) -> Iterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -34864,14 +34882,15 @@ def _create_or_update_initial( content_type = content_type or "application/json" _content = None - if isinstance(disk, (IOBase, bytes)): - _content = disk + if isinstance(gallery_image, (IOBase, bytes)): + _content = gallery_image else: - _content = json.dumps(disk, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(gallery_image, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - _request = build_disks_create_or_update_request( + _request = build_gallery_images_create_or_update_request( resource_group_name=resource_group_name, - disk_name=disk_name, + gallery_name=gallery_name, + gallery_image_name=gallery_image_name, subscription_id=self._config.subscription_id, content_type=content_type, api_version=self._config.api_version, @@ -34891,7 +34910,7 @@ def _create_or_update_initial( response = pipeline_response.http_response - if response.status_code not in [200, 202]: + if response.status_code not in [200, 201, 202]: try: response.read() # Load the body in memory and close the socket except (StreamConsumedError, StreamClosedError): @@ -34901,6 +34920,10 @@ def _create_or_update_initial( raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} + if response.status_code == 201: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) @@ -34916,57 +34939,31 @@ def _create_or_update_initial( def begin_create_or_update( self, resource_group_name: str, - disk_name: str, - disk: _models.Disk, + gallery_name: str, + gallery_image_name: str, + gallery_image: _models.GalleryImage, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[None]: - """Creates or updates a disk. + ) -> LROPoller[_models.GalleryImage]: + """Create or update a gallery image definition. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param disk_name: The name of the managed disk that is being created. The name can't be changed - after the disk is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The - maximum name length is 80 characters. Required. - :type disk_name: str - :param disk: Disk object supplied in the body of the Put disk operation. Required. - :type disk: ~azure.mgmt.compute.models.Disk - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns None - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - disk_name: str, - disk: JSON, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[None]: - """Creates or updates a disk. - - :param resource_group_name: The name of the resource group. The name is case insensitive. + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param gallery_image_name: The name of the gallery image definition to be retrieved. Required. + :type gallery_image_name: str + :param gallery_image: Parameters supplied to the create or update gallery image operation. Required. - :type resource_group_name: str - :param disk_name: The name of the managed disk that is being created. The name can't be changed - after the disk is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The - maximum name length is 80 characters. Required. - :type disk_name: str - :param disk: Disk object supplied in the body of the Put disk operation. Required. - :type disk: JSON + :type gallery_image: ~azure.mgmt.compute.models.GalleryImage :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns None - :rtype: ~azure.core.polling.LROPoller[None] + :return: An instance of LROPoller that returns GalleryImage. The GalleryImage is compatible + with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.GalleryImage] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -34974,400 +34971,107 @@ def begin_create_or_update( def begin_create_or_update( self, resource_group_name: str, - disk_name: str, - disk: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[None]: - """Creates or updates a disk. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param disk_name: The name of the managed disk that is being created. The name can't be changed - after the disk is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The - maximum name length is 80 characters. Required. - :type disk_name: str - :param disk: Disk object supplied in the body of the Put disk operation. Required. - :type disk: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns None - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, resource_group_name: str, disk_name: str, disk: Union[_models.Disk, JSON, IO[bytes]], **kwargs: Any - ) -> LROPoller[None]: - """Creates or updates a disk. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param disk_name: The name of the managed disk that is being created. The name can't be changed - after the disk is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The - maximum name length is 80 characters. Required. - :type disk_name: str - :param disk: Disk object supplied in the body of the Put disk operation. Is one of the - following types: Disk, JSON, IO[bytes] Required. - :type disk: ~azure.mgmt.compute.models.Disk or JSON or IO[bytes] - :return: An instance of LROPoller that returns None - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} - - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._create_or_update_initial( - resource_group_name=resource_group_name, - disk_name=disk_name, - disk=disk, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _update_initial( - self, resource_group_name: str, disk_name: str, disk: Union[_models.DiskUpdate, JSON, IO[bytes]], **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} - - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _content = None - if isinstance(disk, (IOBase, bytes)): - _content = disk - else: - _content = json.dumps(disk, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - - _request = build_disks_update_request( - resource_group_name=resource_group_name, - disk_name=disk_name, - subscription_id=self._config.subscription_id, - content_type=content_type, - api_version=self._config.api_version, - content=_content, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.CloudError, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.iter_bytes() - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update( - self, - resource_group_name: str, - disk_name: str, - disk: _models.DiskUpdate, + gallery_name: str, + gallery_image_name: str, + gallery_image: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[None]: - """Updates (patches) a disk. + ) -> LROPoller[_models.GalleryImage]: + """Create or update a gallery image definition. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param disk_name: The name of the managed disk that is being created. The name can't be changed - after the disk is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The - maximum name length is 80 characters. Required. - :type disk_name: str - :param disk: Disk object supplied in the body of the Patch disk operation. Required. - :type disk: ~azure.mgmt.compute.models.DiskUpdate - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns None - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update( - self, - resource_group_name: str, - disk_name: str, - disk: JSON, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[None]: - """Updates (patches) a disk. - - :param resource_group_name: The name of the resource group. The name is case insensitive. + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param gallery_image_name: The name of the gallery image definition to be retrieved. Required. + :type gallery_image_name: str + :param gallery_image: Parameters supplied to the create or update gallery image operation. Required. - :type resource_group_name: str - :param disk_name: The name of the managed disk that is being created. The name can't be changed - after the disk is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The - maximum name length is 80 characters. Required. - :type disk_name: str - :param disk: Disk object supplied in the body of the Patch disk operation. Required. - :type disk: JSON + :type gallery_image: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns None - :rtype: ~azure.core.polling.LROPoller[None] + :return: An instance of LROPoller that returns GalleryImage. The GalleryImage is compatible + with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.GalleryImage] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def begin_update( + def begin_create_or_update( self, resource_group_name: str, - disk_name: str, - disk: IO[bytes], + gallery_name: str, + gallery_image_name: str, + gallery_image: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[None]: - """Updates (patches) a disk. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param disk_name: The name of the managed disk that is being created. The name can't be changed - after the disk is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The - maximum name length is 80 characters. Required. - :type disk_name: str - :param disk: Disk object supplied in the body of the Patch disk operation. Required. - :type disk: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns None - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_update( - self, resource_group_name: str, disk_name: str, disk: Union[_models.DiskUpdate, JSON, IO[bytes]], **kwargs: Any - ) -> LROPoller[None]: - """Updates (patches) a disk. + ) -> LROPoller[_models.GalleryImage]: + """Create or update a gallery image definition. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param disk_name: The name of the managed disk that is being created. The name can't be changed - after the disk is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The - maximum name length is 80 characters. Required. - :type disk_name: str - :param disk: Disk object supplied in the body of the Patch disk operation. Is one of the - following types: DiskUpdate, JSON, IO[bytes] Required. - :type disk: ~azure.mgmt.compute.models.DiskUpdate or JSON or IO[bytes] - :return: An instance of LROPoller that returns None - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} - - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._update_initial( - resource_group_name=resource_group_name, - disk_name=disk_name, - disk=disk, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _delete_initial(self, resource_group_name: str, disk_name: str, **kwargs: Any) -> Iterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_disks_delete_request( - resource_group_name=resource_group_name, - disk_name=disk_name, - subscription_id=self._config.subscription_id, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.CloudError, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.iter_bytes() - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param gallery_image_name: The name of the gallery image definition to be retrieved. Required. + :type gallery_image_name: str + :param gallery_image: Parameters supplied to the create or update gallery image operation. + Required. + :type gallery_image: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns GalleryImage. The GalleryImage is compatible + with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.GalleryImage] + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace - def begin_delete(self, resource_group_name: str, disk_name: str, **kwargs: Any) -> LROPoller[None]: - """Deletes a disk. + def begin_create_or_update( + self, + resource_group_name: str, + gallery_name: str, + gallery_image_name: str, + gallery_image: Union[_models.GalleryImage, JSON, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.GalleryImage]: + """Create or update a gallery image definition. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param disk_name: The name of the managed disk that is being created. The name can't be changed - after the disk is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The - maximum name length is 80 characters. Required. - :type disk_name: str - :return: An instance of LROPoller that returns None - :rtype: ~azure.core.polling.LROPoller[None] + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param gallery_image_name: The name of the gallery image definition to be retrieved. Required. + :type gallery_image_name: str + :param gallery_image: Parameters supplied to the create or update gallery image operation. Is + one of the following types: GalleryImage, JSON, IO[bytes] Required. + :type gallery_image: ~azure.mgmt.compute.models.GalleryImage or JSON or IO[bytes] + :return: An instance of LROPoller that returns GalleryImage. The GalleryImage is compatible + with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.GalleryImage] :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = kwargs.pop("headers", {}) or {} + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - cls: ClsType[None] = kwargs.pop("cls", None) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.GalleryImage] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._delete_initial( + raw_result = self._create_or_update_initial( resource_group_name=resource_group_name, - disk_name=disk_name, + gallery_name=gallery_name, + gallery_image_name=gallery_image_name, + gallery_image=gallery_image, + content_type=content_type, cls=lambda x, y, z: x, headers=_headers, params=_params, @@ -35376,9 +35080,12 @@ def begin_delete(self, resource_group_name: str, disk_name: str, **kwargs: Any) raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.GalleryImage, response.json()) if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized path_format_arguments = { "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), @@ -35393,191 +35100,22 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return LROPoller[None].from_continuation_token( + return LROPoller[_models.GalleryImage].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> ItemPaged["_models.Disk"]: - """Lists all the disks under a resource group. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :return: An iterator like instance of Disk - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.models.Disk] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[List[_models.Disk]] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_disks_list_by_resource_group_request( - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - return _request - - def extract_data(pipeline_response): - deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.Disk], deserialized.get("value", [])) - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.get("nextLink") or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.CloudError, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @distributed_trace - def list(self, **kwargs: Any) -> ItemPaged["_models.Disk"]: - """Lists all the disks under a subscription. - - :return: An iterator like instance of Disk - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.models.Disk] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[List[_models.Disk]] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_disks_list_request( - subscription_id=self._config.subscription_id, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - return _request - - def extract_data(pipeline_response): - deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.Disk], deserialized.get("value", [])) - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.get("nextLink") or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.CloudError, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) + return LROPoller[_models.GalleryImage]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) - def _grant_access_initial( + def _update_initial( self, resource_group_name: str, - disk_name: str, - grant_access_data: Union[_models.GrantAccessData, JSON, IO[bytes]], + gallery_name: str, + gallery_image_name: str, + gallery_image: Union[_models.GalleryImageUpdate, JSON, IO[bytes]], **kwargs: Any ) -> Iterator[bytes]: error_map: MutableMapping = { @@ -35596,14 +35134,15 @@ def _grant_access_initial( content_type = content_type or "application/json" _content = None - if isinstance(grant_access_data, (IOBase, bytes)): - _content = grant_access_data + if isinstance(gallery_image, (IOBase, bytes)): + _content = gallery_image else: - _content = json.dumps(grant_access_data, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(gallery_image, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - _request = build_disks_grant_access_request( + _request = build_gallery_images_update_request( resource_group_name=resource_group_name, - disk_name=disk_name, + gallery_name=gallery_name, + gallery_image_name=gallery_image_name, subscription_id=self._config.subscription_id, content_type=content_type, api_version=self._config.api_version, @@ -35623,7 +35162,7 @@ def _grant_access_initial( response = pipeline_response.http_response - if response.status_code not in [200, 202]: + if response.status_code not in [200]: try: response.read() # Load the body in memory and close the socket except (StreamConsumedError, StreamClosedError): @@ -35633,9 +35172,8 @@ def _grant_access_initial( raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) deserialized = response.iter_bytes() @@ -35645,136 +35183,138 @@ def _grant_access_initial( return deserialized # type: ignore @overload - def begin_grant_access( + def begin_update( self, resource_group_name: str, - disk_name: str, - grant_access_data: _models.GrantAccessData, + gallery_name: str, + gallery_image_name: str, + gallery_image: _models.GalleryImageUpdate, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.AccessUri]: - """Grants access to a disk. + ) -> LROPoller[_models.GalleryImage]: + """Update a gallery image definition. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param disk_name: The name of the managed disk that is being created. The name can't be changed - after the disk is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The - maximum name length is 80 characters. Required. - :type disk_name: str - :param grant_access_data: Access data object supplied in the body of the get disk access - operation. Required. - :type grant_access_data: ~azure.mgmt.compute.models.GrantAccessData + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param gallery_image_name: The name of the gallery image definition to be retrieved. Required. + :type gallery_image_name: str + :param gallery_image: Parameters supplied to the update gallery image operation. Required. + :type gallery_image: ~azure.mgmt.compute.models.GalleryImageUpdate :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns AccessUri. The AccessUri is compatible with - MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.AccessUri] + :return: An instance of LROPoller that returns GalleryImage. The GalleryImage is compatible + with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.GalleryImage] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def begin_grant_access( + def begin_update( self, resource_group_name: str, - disk_name: str, - grant_access_data: JSON, + gallery_name: str, + gallery_image_name: str, + gallery_image: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.AccessUri]: - """Grants access to a disk. + ) -> LROPoller[_models.GalleryImage]: + """Update a gallery image definition. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param disk_name: The name of the managed disk that is being created. The name can't be changed - after the disk is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The - maximum name length is 80 characters. Required. - :type disk_name: str - :param grant_access_data: Access data object supplied in the body of the get disk access - operation. Required. - :type grant_access_data: JSON + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param gallery_image_name: The name of the gallery image definition to be retrieved. Required. + :type gallery_image_name: str + :param gallery_image: Parameters supplied to the update gallery image operation. Required. + :type gallery_image: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns AccessUri. The AccessUri is compatible with - MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.AccessUri] + :return: An instance of LROPoller that returns GalleryImage. The GalleryImage is compatible + with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.GalleryImage] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def begin_grant_access( + def begin_update( self, resource_group_name: str, - disk_name: str, - grant_access_data: IO[bytes], + gallery_name: str, + gallery_image_name: str, + gallery_image: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.AccessUri]: - """Grants access to a disk. + ) -> LROPoller[_models.GalleryImage]: + """Update a gallery image definition. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param disk_name: The name of the managed disk that is being created. The name can't be changed - after the disk is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The - maximum name length is 80 characters. Required. - :type disk_name: str - :param grant_access_data: Access data object supplied in the body of the get disk access - operation. Required. - :type grant_access_data: IO[bytes] + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param gallery_image_name: The name of the gallery image definition to be retrieved. Required. + :type gallery_image_name: str + :param gallery_image: Parameters supplied to the update gallery image operation. Required. + :type gallery_image: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns AccessUri. The AccessUri is compatible with - MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.AccessUri] + :return: An instance of LROPoller that returns GalleryImage. The GalleryImage is compatible + with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.GalleryImage] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace - def begin_grant_access( + def begin_update( self, resource_group_name: str, - disk_name: str, - grant_access_data: Union[_models.GrantAccessData, JSON, IO[bytes]], + gallery_name: str, + gallery_image_name: str, + gallery_image: Union[_models.GalleryImageUpdate, JSON, IO[bytes]], **kwargs: Any - ) -> LROPoller[_models.AccessUri]: - """Grants access to a disk. + ) -> LROPoller[_models.GalleryImage]: + """Update a gallery image definition. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param disk_name: The name of the managed disk that is being created. The name can't be changed - after the disk is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The - maximum name length is 80 characters. Required. - :type disk_name: str - :param grant_access_data: Access data object supplied in the body of the get disk access - operation. Is one of the following types: GrantAccessData, JSON, IO[bytes] Required. - :type grant_access_data: ~azure.mgmt.compute.models.GrantAccessData or JSON or IO[bytes] - :return: An instance of LROPoller that returns AccessUri. The AccessUri is compatible with - MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.AccessUri] + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param gallery_image_name: The name of the gallery image definition to be retrieved. Required. + :type gallery_image_name: str + :param gallery_image: Parameters supplied to the update gallery image operation. Is one of the + following types: GalleryImageUpdate, JSON, IO[bytes] Required. + :type gallery_image: ~azure.mgmt.compute.models.GalleryImageUpdate or JSON or IO[bytes] + :return: An instance of LROPoller that returns GalleryImage. The GalleryImage is compatible + with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.GalleryImage] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AccessUri] = kwargs.pop("cls", None) + cls: ClsType[_models.GalleryImage] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._grant_access_initial( + raw_result = self._update_initial( resource_group_name=resource_group_name, - disk_name=disk_name, - grant_access_data=grant_access_data, + gallery_name=gallery_name, + gallery_image_name=gallery_image_name, + gallery_image=gallery_image, content_type=content_type, cls=lambda x, y, z: x, headers=_headers, @@ -35790,7 +35330,7 @@ def get_long_running_output(pipeline_response): response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - deserialized = _deserialize(_models.AccessUri, response.json()) + deserialized = _deserialize(_models.GalleryImage, response.json()) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized @@ -35808,17 +35348,19 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller[_models.AccessUri].from_continuation_token( + return LROPoller[_models.GalleryImage].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller[_models.AccessUri]( + return LROPoller[_models.GalleryImage]( self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - def _revoke_access_initial(self, resource_group_name: str, disk_name: str, **kwargs: Any) -> Iterator[bytes]: + def _delete_initial( + self, resource_group_name: str, gallery_name: str, gallery_image_name: str, **kwargs: Any + ) -> Iterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -35832,9 +35374,10 @@ def _revoke_access_initial(self, resource_group_name: str, disk_name: str, **kwa cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - _request = build_disks_revoke_access_request( + _request = build_gallery_images_delete_request( resource_group_name=resource_group_name, - disk_name=disk_name, + gallery_name=gallery_name, + gallery_image_name=gallery_image_name, subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -35852,7 +35395,7 @@ def _revoke_access_initial(self, resource_group_name: str, disk_name: str, **kwa response = pipeline_response.http_response - if response.status_code not in [200, 202]: + if response.status_code not in [200, 202, 204]: try: response.read() # Load the body in memory and close the socket except (StreamConsumedError, StreamClosedError): @@ -35874,34 +35417,34 @@ def _revoke_access_initial(self, resource_group_name: str, disk_name: str, **kwa return deserialized # type: ignore @distributed_trace - def begin_revoke_access( - self, resource_group_name: str, disk_name: str, **kwargs: Any - ) -> LROPoller[_models.OkResponse]: - """Revokes access to a disk. + def begin_delete( + self, resource_group_name: str, gallery_name: str, gallery_image_name: str, **kwargs: Any + ) -> LROPoller[None]: + """Delete a gallery image. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param disk_name: The name of the managed disk that is being created. The name can't be changed - after the disk is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The - maximum name length is 80 characters. Required. - :type disk_name: str - :return: An instance of LROPoller that returns OkResponse. The OkResponse is compatible with - MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.OkResponse] + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param gallery_image_name: The name of the gallery image definition to be retrieved. Required. + :type gallery_image_name: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.OkResponse] = kwargs.pop("cls", None) + cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._revoke_access_initial( + raw_result = self._delete_initial( resource_group_name=resource_group_name, - disk_name=disk_name, + gallery_name=gallery_name, + gallery_image_name=gallery_image_name, cls=lambda x, y, z: x, headers=_headers, params=_params, @@ -35910,16 +35453,9 @@ def begin_revoke_access( raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): - response_headers = {} - response = pipeline_response.http_response - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = _deserialize(_models.OkResponse, response.json()) + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized + return cls(pipeline_response, None, {}) # type: ignore path_format_arguments = { "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), @@ -35934,25 +35470,116 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller[_models.OkResponse].from_continuation_token( + return LROPoller[None].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller[_models.OkResponse]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace + def list_by_gallery( + self, resource_group_name: str, gallery_name: str, **kwargs: Any + ) -> ItemPaged["_models.GalleryImage"]: + """List gallery image definitions in a gallery. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :return: An iterator like instance of GalleryImage + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.models.GalleryImage] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.GalleryImage]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_gallery_images_list_by_gallery_request( + resource_group_name=resource_group_name, + gallery_name=gallery_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.GalleryImage], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + return pipeline_response -class DiskAccessesOperations: + return ItemPaged(get_next, extract_data) + + +class GalleryImageVersionsOperations: """ .. warning:: **DO NOT** instantiate this class directly. Instead, you should access the following operations through :class:`~azure.mgmt.compute.ComputeClient`'s - :attr:`disk_accesses` attribute. + :attr:`gallery_image_versions` attribute. """ def __init__(self, *args, **kwargs) -> None: @@ -35963,18 +35590,33 @@ def __init__(self, *args, **kwargs) -> None: self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace - def get(self, resource_group_name: str, disk_access_name: str, **kwargs: Any) -> _models.DiskAccess: - """Gets information about a disk access resource. + def get( + self, + resource_group_name: str, + gallery_name: str, + gallery_image_name: str, + gallery_image_version_name: str, + *, + expand: Optional[Union[str, _models.ReplicationStatusTypes]] = None, + **kwargs: Any + ) -> _models.GalleryImageVersion: + """Retrieves information about a gallery image version. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param disk_access_name: The name of the disk access resource that is being created. The name - can't be changed after the disk encryption set is created. Supported characters for the name - are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. - :type disk_access_name: str - :return: DiskAccess. The DiskAccess is compatible with MutableMapping - :rtype: ~azure.mgmt.compute.models.DiskAccess + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param gallery_image_name: The name of the gallery image definition to be retrieved. Required. + :type gallery_image_name: str + :param gallery_image_version_name: The name of the gallery image version to be retrieved. + Required. + :type gallery_image_version_name: str + :keyword expand: The expand expression to apply on the operation. Known values are: + "ReplicationStatus" and "UefiSettings". Default value is None. + :paramtype expand: str or ~azure.mgmt.compute.models.ReplicationStatusTypes + :return: GalleryImageVersion. The GalleryImageVersion is compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.GalleryImageVersion :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -35988,12 +35630,15 @@ def get(self, resource_group_name: str, disk_access_name: str, **kwargs: Any) -> _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.DiskAccess] = kwargs.pop("cls", None) + cls: ClsType[_models.GalleryImageVersion] = kwargs.pop("cls", None) - _request = build_disk_accesses_get_request( + _request = build_gallery_image_versions_get_request( resource_group_name=resource_group_name, - disk_access_name=disk_access_name, + gallery_name=gallery_name, + gallery_image_name=gallery_image_name, + gallery_image_version_name=gallery_image_version_name, subscription_id=self._config.subscription_id, + expand=expand, api_version=self._config.api_version, headers=_headers, params=_params, @@ -36023,7 +35668,7 @@ def get(self, resource_group_name: str, disk_access_name: str, **kwargs: Any) -> if _stream: deserialized = response.iter_bytes() else: - deserialized = _deserialize(_models.DiskAccess, response.json()) + deserialized = _deserialize(_models.GalleryImageVersion, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -36033,8 +35678,10 @@ def get(self, resource_group_name: str, disk_access_name: str, **kwargs: Any) -> def _create_or_update_initial( self, resource_group_name: str, - disk_access_name: str, - disk_access: Union[_models.DiskAccess, JSON, IO[bytes]], + gallery_name: str, + gallery_image_name: str, + gallery_image_version_name: str, + gallery_image_version: Union[_models.GalleryImageVersion, JSON, IO[bytes]], **kwargs: Any ) -> Iterator[bytes]: error_map: MutableMapping = { @@ -36053,14 +35700,16 @@ def _create_or_update_initial( content_type = content_type or "application/json" _content = None - if isinstance(disk_access, (IOBase, bytes)): - _content = disk_access + if isinstance(gallery_image_version, (IOBase, bytes)): + _content = gallery_image_version else: - _content = json.dumps(disk_access, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(gallery_image_version, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - _request = build_disk_accesses_create_or_update_request( + _request = build_gallery_image_versions_create_or_update_request( resource_group_name=resource_group_name, - disk_access_name=disk_access_name, + gallery_name=gallery_name, + gallery_image_name=gallery_image_name, + gallery_image_version_name=gallery_image_version_name, subscription_id=self._config.subscription_id, content_type=content_type, api_version=self._config.api_version, @@ -36080,7 +35729,7 @@ def _create_or_update_initial( response = pipeline_response.http_response - if response.status_code not in [200, 202]: + if response.status_code not in [200, 201, 202]: try: response.read() # Load the body in memory and close the socket except (StreamConsumedError, StreamClosedError): @@ -36090,6 +35739,10 @@ def _create_or_update_initial( raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} + if response.status_code == 201: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) @@ -36105,29 +35758,35 @@ def _create_or_update_initial( def begin_create_or_update( self, resource_group_name: str, - disk_access_name: str, - disk_access: _models.DiskAccess, + gallery_name: str, + gallery_image_name: str, + gallery_image_version_name: str, + gallery_image_version: _models.GalleryImageVersion, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[None]: - """Creates or updates a disk access resource. + ) -> LROPoller[_models.GalleryImageVersion]: + """Create or update a gallery image version. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param disk_access_name: The name of the disk access resource that is being created. The name - can't be changed after the disk encryption set is created. Supported characters for the name - are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. - :type disk_access_name: str - :param disk_access: disk access object supplied in the body of the Put disk access operation. + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param gallery_image_name: The name of the gallery image definition to be retrieved. Required. + :type gallery_image_name: str + :param gallery_image_version_name: The name of the gallery image version to be retrieved. Required. - :type disk_access: ~azure.mgmt.compute.models.DiskAccess + :type gallery_image_version_name: str + :param gallery_image_version: Parameters supplied to the create or update gallery image version + operation. Required. + :type gallery_image_version: ~azure.mgmt.compute.models.GalleryImageVersion :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns None - :rtype: ~azure.core.polling.LROPoller[None] + :return: An instance of LROPoller that returns GalleryImageVersion. The GalleryImageVersion is + compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.GalleryImageVersion] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -36135,29 +35794,35 @@ def begin_create_or_update( def begin_create_or_update( self, resource_group_name: str, - disk_access_name: str, - disk_access: JSON, + gallery_name: str, + gallery_image_name: str, + gallery_image_version_name: str, + gallery_image_version: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[None]: - """Creates or updates a disk access resource. + ) -> LROPoller[_models.GalleryImageVersion]: + """Create or update a gallery image version. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param disk_access_name: The name of the disk access resource that is being created. The name - can't be changed after the disk encryption set is created. Supported characters for the name - are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. - :type disk_access_name: str - :param disk_access: disk access object supplied in the body of the Put disk access operation. + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param gallery_image_name: The name of the gallery image definition to be retrieved. Required. + :type gallery_image_name: str + :param gallery_image_version_name: The name of the gallery image version to be retrieved. Required. - :type disk_access: JSON + :type gallery_image_version_name: str + :param gallery_image_version: Parameters supplied to the create or update gallery image version + operation. Required. + :type gallery_image_version: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns None - :rtype: ~azure.core.polling.LROPoller[None] + :return: An instance of LROPoller that returns GalleryImageVersion. The GalleryImageVersion is + compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.GalleryImageVersion] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -36165,29 +35830,35 @@ def begin_create_or_update( def begin_create_or_update( self, resource_group_name: str, - disk_access_name: str, - disk_access: IO[bytes], + gallery_name: str, + gallery_image_name: str, + gallery_image_version_name: str, + gallery_image_version: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[None]: - """Creates or updates a disk access resource. + ) -> LROPoller[_models.GalleryImageVersion]: + """Create or update a gallery image version. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param disk_access_name: The name of the disk access resource that is being created. The name - can't be changed after the disk encryption set is created. Supported characters for the name - are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. - :type disk_access_name: str - :param disk_access: disk access object supplied in the body of the Put disk access operation. + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param gallery_image_name: The name of the gallery image definition to be retrieved. Required. + :type gallery_image_name: str + :param gallery_image_version_name: The name of the gallery image version to be retrieved. Required. - :type disk_access: IO[bytes] + :type gallery_image_version_name: str + :param gallery_image_version: Parameters supplied to the create or update gallery image version + operation. Required. + :type gallery_image_version: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns None - :rtype: ~azure.core.polling.LROPoller[None] + :return: An instance of LROPoller that returns GalleryImageVersion. The GalleryImageVersion is + compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.GalleryImageVersion] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -36195,39 +35866,48 @@ def begin_create_or_update( def begin_create_or_update( self, resource_group_name: str, - disk_access_name: str, - disk_access: Union[_models.DiskAccess, JSON, IO[bytes]], + gallery_name: str, + gallery_image_name: str, + gallery_image_version_name: str, + gallery_image_version: Union[_models.GalleryImageVersion, JSON, IO[bytes]], **kwargs: Any - ) -> LROPoller[None]: - """Creates or updates a disk access resource. + ) -> LROPoller[_models.GalleryImageVersion]: + """Create or update a gallery image version. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param disk_access_name: The name of the disk access resource that is being created. The name - can't be changed after the disk encryption set is created. Supported characters for the name - are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. - :type disk_access_name: str - :param disk_access: disk access object supplied in the body of the Put disk access operation. - Is one of the following types: DiskAccess, JSON, IO[bytes] Required. - :type disk_access: ~azure.mgmt.compute.models.DiskAccess or JSON or IO[bytes] - :return: An instance of LROPoller that returns None - :rtype: ~azure.core.polling.LROPoller[None] + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param gallery_image_name: The name of the gallery image definition to be retrieved. Required. + :type gallery_image_name: str + :param gallery_image_version_name: The name of the gallery image version to be retrieved. + Required. + :type gallery_image_version_name: str + :param gallery_image_version: Parameters supplied to the create or update gallery image version + operation. Is one of the following types: GalleryImageVersion, JSON, IO[bytes] Required. + :type gallery_image_version: ~azure.mgmt.compute.models.GalleryImageVersion or JSON or + IO[bytes] + :return: An instance of LROPoller that returns GalleryImageVersion. The GalleryImageVersion is + compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.GalleryImageVersion] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[_models.GalleryImageVersion] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = self._create_or_update_initial( resource_group_name=resource_group_name, - disk_access_name=disk_access_name, - disk_access=disk_access, + gallery_name=gallery_name, + gallery_image_name=gallery_image_name, + gallery_image_version_name=gallery_image_version_name, + gallery_image_version=gallery_image_version, content_type=content_type, cls=lambda x, y, z: x, headers=_headers, @@ -36237,9 +35917,12 @@ def begin_create_or_update( raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.GalleryImageVersion, response.json()) if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized path_format_arguments = { "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), @@ -36254,19 +35937,23 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return LROPoller[None].from_continuation_token( + return LROPoller[_models.GalleryImageVersion].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + return LROPoller[_models.GalleryImageVersion]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) def _update_initial( self, resource_group_name: str, - disk_access_name: str, - disk_access: Union[_models.DiskAccessUpdate, JSON, IO[bytes]], + gallery_name: str, + gallery_image_name: str, + gallery_image_version_name: str, + gallery_image_version: Union[_models.GalleryImageVersionUpdate, JSON, IO[bytes]], **kwargs: Any ) -> Iterator[bytes]: error_map: MutableMapping = { @@ -36285,14 +35972,16 @@ def _update_initial( content_type = content_type or "application/json" _content = None - if isinstance(disk_access, (IOBase, bytes)): - _content = disk_access + if isinstance(gallery_image_version, (IOBase, bytes)): + _content = gallery_image_version else: - _content = json.dumps(disk_access, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(gallery_image_version, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - _request = build_disk_accesses_update_request( + _request = build_gallery_image_versions_update_request( resource_group_name=resource_group_name, - disk_access_name=disk_access_name, + gallery_name=gallery_name, + gallery_image_name=gallery_image_name, + gallery_image_version_name=gallery_image_version_name, subscription_id=self._config.subscription_id, content_type=content_type, api_version=self._config.api_version, @@ -36312,7 +36001,7 @@ def _update_initial( response = pipeline_response.http_response - if response.status_code not in [200, 202]: + if response.status_code not in [200]: try: response.read() # Load the body in memory and close the socket except (StreamConsumedError, StreamClosedError): @@ -36322,9 +36011,8 @@ def _update_initial( raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) deserialized = response.iter_bytes() @@ -36337,29 +36025,35 @@ def _update_initial( def begin_update( self, resource_group_name: str, - disk_access_name: str, - disk_access: _models.DiskAccessUpdate, + gallery_name: str, + gallery_image_name: str, + gallery_image_version_name: str, + gallery_image_version: _models.GalleryImageVersionUpdate, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[None]: - """Updates (patches) a disk access resource. + ) -> LROPoller[_models.GalleryImageVersion]: + """Update a gallery image version. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param disk_access_name: The name of the disk access resource that is being created. The name - can't be changed after the disk encryption set is created. Supported characters for the name - are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. - :type disk_access_name: str - :param disk_access: disk access object supplied in the body of the Patch disk access operation. + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param gallery_image_name: The name of the gallery image definition to be retrieved. Required. + :type gallery_image_name: str + :param gallery_image_version_name: The name of the gallery image version to be retrieved. Required. - :type disk_access: ~azure.mgmt.compute.models.DiskAccessUpdate + :type gallery_image_version_name: str + :param gallery_image_version: Parameters supplied to the update gallery image version + operation. Required. + :type gallery_image_version: ~azure.mgmt.compute.models.GalleryImageVersionUpdate :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns None - :rtype: ~azure.core.polling.LROPoller[None] + :return: An instance of LROPoller that returns GalleryImageVersion. The GalleryImageVersion is + compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.GalleryImageVersion] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -36367,29 +36061,35 @@ def begin_update( def begin_update( self, resource_group_name: str, - disk_access_name: str, - disk_access: JSON, + gallery_name: str, + gallery_image_name: str, + gallery_image_version_name: str, + gallery_image_version: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[None]: - """Updates (patches) a disk access resource. + ) -> LROPoller[_models.GalleryImageVersion]: + """Update a gallery image version. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param disk_access_name: The name of the disk access resource that is being created. The name - can't be changed after the disk encryption set is created. Supported characters for the name - are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. - :type disk_access_name: str - :param disk_access: disk access object supplied in the body of the Patch disk access operation. + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param gallery_image_name: The name of the gallery image definition to be retrieved. Required. + :type gallery_image_name: str + :param gallery_image_version_name: The name of the gallery image version to be retrieved. Required. - :type disk_access: JSON + :type gallery_image_version_name: str + :param gallery_image_version: Parameters supplied to the update gallery image version + operation. Required. + :type gallery_image_version: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns None - :rtype: ~azure.core.polling.LROPoller[None] + :return: An instance of LROPoller that returns GalleryImageVersion. The GalleryImageVersion is + compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.GalleryImageVersion] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -36397,29 +36097,35 @@ def begin_update( def begin_update( self, resource_group_name: str, - disk_access_name: str, - disk_access: IO[bytes], + gallery_name: str, + gallery_image_name: str, + gallery_image_version_name: str, + gallery_image_version: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[None]: - """Updates (patches) a disk access resource. + ) -> LROPoller[_models.GalleryImageVersion]: + """Update a gallery image version. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param disk_access_name: The name of the disk access resource that is being created. The name - can't be changed after the disk encryption set is created. Supported characters for the name - are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. - :type disk_access_name: str - :param disk_access: disk access object supplied in the body of the Patch disk access operation. + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param gallery_image_name: The name of the gallery image definition to be retrieved. Required. + :type gallery_image_name: str + :param gallery_image_version_name: The name of the gallery image version to be retrieved. Required. - :type disk_access: IO[bytes] + :type gallery_image_version_name: str + :param gallery_image_version: Parameters supplied to the update gallery image version + operation. Required. + :type gallery_image_version: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns None - :rtype: ~azure.core.polling.LROPoller[None] + :return: An instance of LROPoller that returns GalleryImageVersion. The GalleryImageVersion is + compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.GalleryImageVersion] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -36427,39 +36133,48 @@ def begin_update( def begin_update( self, resource_group_name: str, - disk_access_name: str, - disk_access: Union[_models.DiskAccessUpdate, JSON, IO[bytes]], + gallery_name: str, + gallery_image_name: str, + gallery_image_version_name: str, + gallery_image_version: Union[_models.GalleryImageVersionUpdate, JSON, IO[bytes]], **kwargs: Any - ) -> LROPoller[None]: - """Updates (patches) a disk access resource. + ) -> LROPoller[_models.GalleryImageVersion]: + """Update a gallery image version. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param disk_access_name: The name of the disk access resource that is being created. The name - can't be changed after the disk encryption set is created. Supported characters for the name - are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. - :type disk_access_name: str - :param disk_access: disk access object supplied in the body of the Patch disk access operation. - Is one of the following types: DiskAccessUpdate, JSON, IO[bytes] Required. - :type disk_access: ~azure.mgmt.compute.models.DiskAccessUpdate or JSON or IO[bytes] - :return: An instance of LROPoller that returns None - :rtype: ~azure.core.polling.LROPoller[None] + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param gallery_image_name: The name of the gallery image definition to be retrieved. Required. + :type gallery_image_name: str + :param gallery_image_version_name: The name of the gallery image version to be retrieved. + Required. + :type gallery_image_version_name: str + :param gallery_image_version: Parameters supplied to the update gallery image version + operation. Is one of the following types: GalleryImageVersionUpdate, JSON, IO[bytes] Required. + :type gallery_image_version: ~azure.mgmt.compute.models.GalleryImageVersionUpdate or JSON or + IO[bytes] + :return: An instance of LROPoller that returns GalleryImageVersion. The GalleryImageVersion is + compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.GalleryImageVersion] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[_models.GalleryImageVersion] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = self._update_initial( resource_group_name=resource_group_name, - disk_access_name=disk_access_name, - disk_access=disk_access, + gallery_name=gallery_name, + gallery_image_name=gallery_image_name, + gallery_image_version_name=gallery_image_version_name, + gallery_image_version=gallery_image_version, content_type=content_type, cls=lambda x, y, z: x, headers=_headers, @@ -36469,9 +36184,16 @@ def begin_update( raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = _deserialize(_models.GalleryImageVersion, response.json()) if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore + return deserialized path_format_arguments = { "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), @@ -36486,15 +36208,24 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return LROPoller[None].from_continuation_token( + return LROPoller[_models.GalleryImageVersion].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + return LROPoller[_models.GalleryImageVersion]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) - def _delete_initial(self, resource_group_name: str, disk_access_name: str, **kwargs: Any) -> Iterator[bytes]: + def _delete_initial( + self, + resource_group_name: str, + gallery_name: str, + gallery_image_name: str, + gallery_image_version_name: str, + **kwargs: Any + ) -> Iterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -36508,9 +36239,11 @@ def _delete_initial(self, resource_group_name: str, disk_access_name: str, **kwa cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - _request = build_disk_accesses_delete_request( + _request = build_gallery_image_versions_delete_request( resource_group_name=resource_group_name, - disk_access_name=disk_access_name, + gallery_name=gallery_name, + gallery_image_name=gallery_image_name, + gallery_image_version_name=gallery_image_version_name, subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -36550,16 +36283,26 @@ def _delete_initial(self, resource_group_name: str, disk_access_name: str, **kwa return deserialized # type: ignore @distributed_trace - def begin_delete(self, resource_group_name: str, disk_access_name: str, **kwargs: Any) -> LROPoller[None]: - """Deletes a disk access resource. + def begin_delete( + self, + resource_group_name: str, + gallery_name: str, + gallery_image_name: str, + gallery_image_version_name: str, + **kwargs: Any + ) -> LROPoller[None]: + """Delete a gallery image version. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param disk_access_name: The name of the disk access resource that is being created. The name - can't be changed after the disk encryption set is created. Supported characters for the name - are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. - :type disk_access_name: str + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param gallery_image_name: The name of the gallery image definition to be retrieved. Required. + :type gallery_image_name: str + :param gallery_image_version_name: The name of the gallery image version to be retrieved. + Required. + :type gallery_image_version_name: str :return: An instance of LROPoller that returns None :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -36574,140 +36317,63 @@ def begin_delete(self, resource_group_name: str, disk_access_name: str, **kwargs if cont_token is None: raw_result = self._delete_initial( resource_group_name=resource_group_name, - disk_access_name=disk_access_name, + gallery_name=gallery_name, + gallery_image_name=gallery_image_name, + gallery_image_version_name=gallery_image_version_name, cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> ItemPaged["_models.DiskAccess"]: - """Lists all the disk access resources under a resource group. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :return: An iterator like instance of DiskAccess - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.models.DiskAccess] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[List[_models.DiskAccess]] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_disk_accesses_list_by_resource_group_request( - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - return _request - - def extract_data(pipeline_response): - deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.DiskAccess], deserialized.get("value", [])) - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.get("nextLink") or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.CloudError, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore - return pipeline_response + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } - return ItemPaged(get_next, extract_data) + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore @distributed_trace - def list(self, **kwargs: Any) -> ItemPaged["_models.DiskAccess"]: - """Lists all the disk access resources under a subscription. + def list_by_gallery_image( + self, resource_group_name: str, gallery_name: str, gallery_image_name: str, **kwargs: Any + ) -> ItemPaged["_models.GalleryImageVersion"]: + """List gallery image versions in a gallery image definition. - :return: An iterator like instance of DiskAccess - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.models.DiskAccess] + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param gallery_image_name: The name of the gallery image definition to be retrieved. Required. + :type gallery_image_name: str + :return: An iterator like instance of GalleryImageVersion + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.models.GalleryImageVersion] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.DiskAccess]] = kwargs.pop("cls", None) + cls: ClsType[List[_models.GalleryImageVersion]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -36720,7 +36386,10 @@ def list(self, **kwargs: Any) -> ItemPaged["_models.DiskAccess"]: def prepare_request(next_link=None): if not next_link: - _request = build_disk_accesses_list_request( + _request = build_gallery_image_versions_list_by_gallery_image_request( + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_image_name=gallery_image_name, subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -36757,7 +36426,7 @@ def prepare_request(next_link=None): def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.DiskAccess], deserialized.get("value", [])) + list_of_elem = _deserialize(List[_models.GalleryImageVersion], deserialized.get("value", [])) if cls: list_of_elem = cls(list_of_elem) # type: ignore return deserialized.get("nextLink") or None, iter(list_of_elem) @@ -36780,22 +36449,40 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) + +class GalleryApplicationsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.compute.ComputeClient`'s + :attr:`gallery_applications` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace - def get_private_link_resources( - self, resource_group_name: str, disk_access_name: str, **kwargs: Any - ) -> _models.PrivateLinkResourceListResult: - """Gets the private link resources possible under disk access resource. + def get( + self, resource_group_name: str, gallery_name: str, gallery_application_name: str, **kwargs: Any + ) -> _models.GalleryApplication: + """Retrieves information about a gallery Application Definition. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param disk_access_name: The name of the disk access resource that is being created. The name - can't be changed after the disk encryption set is created. Supported characters for the name - are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. - :type disk_access_name: str - :return: PrivateLinkResourceListResult. The PrivateLinkResourceListResult is compatible with - MutableMapping - :rtype: ~azure.mgmt.compute.models.PrivateLinkResourceListResult + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param gallery_application_name: The name of the gallery Application Definition to be + retrieved. Required. + :type gallery_application_name: str + :return: GalleryApplication. The GalleryApplication is compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.GalleryApplication :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -36809,11 +36496,12 @@ def get_private_link_resources( _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.PrivateLinkResourceListResult] = kwargs.pop("cls", None) + cls: ClsType[_models.GalleryApplication] = kwargs.pop("cls", None) - _request = build_disk_accesses_get_private_link_resources_request( + _request = build_gallery_applications_get_request( resource_group_name=resource_group_name, - disk_access_name=disk_access_name, + gallery_name=gallery_name, + gallery_application_name=gallery_application_name, subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -36844,51 +36532,21 @@ def get_private_link_resources( if _stream: deserialized = response.iter_bytes() else: - deserialized = _deserialize(_models.PrivateLinkResourceListResult, response.json()) + deserialized = _deserialize(_models.GalleryApplication, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - -class PrivateEndpointConnectionsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.compute.ComputeClient`'s - :attr:`private_endpoint_connections` attribute. - """ - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ComputeClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def get_a_private_endpoint_connection( - self, resource_group_name: str, disk_access_name: str, private_endpoint_connection_name: str, **kwargs: Any - ) -> _models.PrivateEndpointConnection: - """Gets information about a private endpoint connection under a disk access resource. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param disk_access_name: The name of the disk access resource that is being created. The name - can't be changed after the disk encryption set is created. Supported characters for the name - are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. - :type disk_access_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection. Required. - :type private_endpoint_connection_name: str - :return: PrivateEndpointConnection. The PrivateEndpointConnection is compatible with - MutableMapping - :rtype: ~azure.mgmt.compute.models.PrivateEndpointConnection - :raises ~azure.core.exceptions.HttpResponseError: - """ + def _create_or_update_initial( + self, + resource_group_name: str, + gallery_name: str, + gallery_application_name: str, + gallery_application: Union[_models.GalleryApplication, JSON, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -36897,17 +36555,27 @@ def get_a_private_endpoint_connection( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(gallery_application, (IOBase, bytes)): + _content = gallery_application + else: + _content = json.dumps(gallery_application, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - _request = build_private_endpoint_connections_get_a_private_endpoint_connection_request( + _request = build_gallery_applications_create_or_update_request( resource_group_name=resource_group_name, - disk_access_name=disk_access_name, - private_endpoint_connection_name=private_endpoint_connection_name, + gallery_name=gallery_name, + gallery_application_name=gallery_application_name, subscription_id=self._config.subscription_id, + content_type=content_type, api_version=self._config.api_version, + content=_content, headers=_headers, params=_params, ) @@ -36916,39 +36584,223 @@ def get_a_private_endpoint_connection( } _request.url = self._client.format_url(_request.url, **path_format_arguments) - _stream = kwargs.pop("stream", False) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200]: - if _stream: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass + if response.status_code not in [200, 201, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = _failsafe_deserialize(_models.CloudError, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if _stream: - deserialized = response.iter_bytes() - else: - deserialized = _deserialize(_models.PrivateEndpointConnection, response.json()) + response_headers = {} + if response.status_code == 201: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore - def _update_a_private_endpoint_connection_initial( # pylint: disable=name-too-long + @overload + def begin_create_or_update( self, resource_group_name: str, - disk_access_name: str, - private_endpoint_connection_name: str, - private_endpoint_connection: Union[_models.PrivateEndpointConnection, JSON, IO[bytes]], + gallery_name: str, + gallery_application_name: str, + gallery_application: _models.GalleryApplication, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.GalleryApplication]: + """Create or update a gallery Application Definition. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param gallery_application_name: The name of the gallery Application Definition to be + retrieved. Required. + :type gallery_application_name: str + :param gallery_application: Parameters supplied to the create or update gallery Application + operation. Required. + :type gallery_application: ~azure.mgmt.compute.models.GalleryApplication + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns GalleryApplication. The GalleryApplication is + compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.GalleryApplication] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + gallery_name: str, + gallery_application_name: str, + gallery_application: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.GalleryApplication]: + """Create or update a gallery Application Definition. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param gallery_application_name: The name of the gallery Application Definition to be + retrieved. Required. + :type gallery_application_name: str + :param gallery_application: Parameters supplied to the create or update gallery Application + operation. Required. + :type gallery_application: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns GalleryApplication. The GalleryApplication is + compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.GalleryApplication] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + gallery_name: str, + gallery_application_name: str, + gallery_application: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.GalleryApplication]: + """Create or update a gallery Application Definition. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param gallery_application_name: The name of the gallery Application Definition to be + retrieved. Required. + :type gallery_application_name: str + :param gallery_application: Parameters supplied to the create or update gallery Application + operation. Required. + :type gallery_application: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns GalleryApplication. The GalleryApplication is + compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.GalleryApplication] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + gallery_name: str, + gallery_application_name: str, + gallery_application: Union[_models.GalleryApplication, JSON, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.GalleryApplication]: + """Create or update a gallery Application Definition. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param gallery_application_name: The name of the gallery Application Definition to be + retrieved. Required. + :type gallery_application_name: str + :param gallery_application: Parameters supplied to the create or update gallery Application + operation. Is one of the following types: GalleryApplication, JSON, IO[bytes] Required. + :type gallery_application: ~azure.mgmt.compute.models.GalleryApplication or JSON or IO[bytes] + :return: An instance of LROPoller that returns GalleryApplication. The GalleryApplication is + compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.GalleryApplication] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.GalleryApplication] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_application_name=gallery_application_name, + gallery_application=gallery_application, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.GalleryApplication, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.GalleryApplication].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.GalleryApplication]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _update_initial( + self, + resource_group_name: str, + gallery_name: str, + gallery_application_name: str, + gallery_application: Union[_models.GalleryApplicationUpdate, JSON, IO[bytes]], **kwargs: Any ) -> Iterator[bytes]: error_map: MutableMapping = { @@ -36967,15 +36819,15 @@ def _update_a_private_endpoint_connection_initial( # pylint: disable=name-too-l content_type = content_type or "application/json" _content = None - if isinstance(private_endpoint_connection, (IOBase, bytes)): - _content = private_endpoint_connection + if isinstance(gallery_application, (IOBase, bytes)): + _content = gallery_application else: - _content = json.dumps(private_endpoint_connection, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(gallery_application, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - _request = build_private_endpoint_connections_update_a_private_endpoint_connection_request( + _request = build_gallery_applications_update_request( resource_group_name=resource_group_name, - disk_access_name=disk_access_name, - private_endpoint_connection_name=private_endpoint_connection_name, + gallery_name=gallery_name, + gallery_application_name=gallery_application_name, subscription_id=self._config.subscription_id, content_type=content_type, api_version=self._config.api_version, @@ -36995,7 +36847,7 @@ def _update_a_private_endpoint_connection_initial( # pylint: disable=name-too-l response = pipeline_response.http_response - if response.status_code not in [200, 202]: + if response.status_code not in [200]: try: response.read() # Load the body in memory and close the socket except (StreamConsumedError, StreamClosedError): @@ -37005,9 +36857,8 @@ def _update_a_private_endpoint_connection_initial( # pylint: disable=name-too-l raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) deserialized = response.iter_bytes() @@ -37017,151 +36868,146 @@ def _update_a_private_endpoint_connection_initial( # pylint: disable=name-too-l return deserialized # type: ignore @overload - def begin_update_a_private_endpoint_connection( # pylint: disable=name-too-long + def begin_update( self, resource_group_name: str, - disk_access_name: str, - private_endpoint_connection_name: str, - private_endpoint_connection: _models.PrivateEndpointConnection, + gallery_name: str, + gallery_application_name: str, + gallery_application: _models.GalleryApplicationUpdate, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[None]: - """Approve or reject a private endpoint connection under disk access resource, this can't be used - to create a new private endpoint connection. + ) -> LROPoller[_models.GalleryApplication]: + """Update a gallery Application Definition. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param disk_access_name: The name of the disk access resource that is being created. The name - can't be changed after the disk encryption set is created. Supported characters for the name - are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. - :type disk_access_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection. Required. - :type private_endpoint_connection_name: str - :param private_endpoint_connection: private endpoint connection object supplied in the body of - the Put private endpoint connection operation. Required. - :type private_endpoint_connection: ~azure.mgmt.compute.models.PrivateEndpointConnection + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param gallery_application_name: The name of the gallery Application Definition to be + retrieved. Required. + :type gallery_application_name: str + :param gallery_application: Parameters supplied to the update gallery Application operation. + Required. + :type gallery_application: ~azure.mgmt.compute.models.GalleryApplicationUpdate :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns None - :rtype: ~azure.core.polling.LROPoller[None] + :return: An instance of LROPoller that returns GalleryApplication. The GalleryApplication is + compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.GalleryApplication] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def begin_update_a_private_endpoint_connection( # pylint: disable=name-too-long + def begin_update( self, resource_group_name: str, - disk_access_name: str, - private_endpoint_connection_name: str, - private_endpoint_connection: JSON, + gallery_name: str, + gallery_application_name: str, + gallery_application: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[None]: - """Approve or reject a private endpoint connection under disk access resource, this can't be used - to create a new private endpoint connection. + ) -> LROPoller[_models.GalleryApplication]: + """Update a gallery Application Definition. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param disk_access_name: The name of the disk access resource that is being created. The name - can't be changed after the disk encryption set is created. Supported characters for the name - are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. - :type disk_access_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection. Required. - :type private_endpoint_connection_name: str - :param private_endpoint_connection: private endpoint connection object supplied in the body of - the Put private endpoint connection operation. Required. - :type private_endpoint_connection: JSON + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param gallery_application_name: The name of the gallery Application Definition to be + retrieved. Required. + :type gallery_application_name: str + :param gallery_application: Parameters supplied to the update gallery Application operation. + Required. + :type gallery_application: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns None - :rtype: ~azure.core.polling.LROPoller[None] + :return: An instance of LROPoller that returns GalleryApplication. The GalleryApplication is + compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.GalleryApplication] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def begin_update_a_private_endpoint_connection( # pylint: disable=name-too-long + def begin_update( self, resource_group_name: str, - disk_access_name: str, - private_endpoint_connection_name: str, - private_endpoint_connection: IO[bytes], + gallery_name: str, + gallery_application_name: str, + gallery_application: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[None]: - """Approve or reject a private endpoint connection under disk access resource, this can't be used - to create a new private endpoint connection. + ) -> LROPoller[_models.GalleryApplication]: + """Update a gallery Application Definition. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param disk_access_name: The name of the disk access resource that is being created. The name - can't be changed after the disk encryption set is created. Supported characters for the name - are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. - :type disk_access_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection. Required. - :type private_endpoint_connection_name: str - :param private_endpoint_connection: private endpoint connection object supplied in the body of - the Put private endpoint connection operation. Required. - :type private_endpoint_connection: IO[bytes] + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param gallery_application_name: The name of the gallery Application Definition to be + retrieved. Required. + :type gallery_application_name: str + :param gallery_application: Parameters supplied to the update gallery Application operation. + Required. + :type gallery_application: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns None - :rtype: ~azure.core.polling.LROPoller[None] + :return: An instance of LROPoller that returns GalleryApplication. The GalleryApplication is + compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.GalleryApplication] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace - def begin_update_a_private_endpoint_connection( # pylint: disable=name-too-long + def begin_update( self, resource_group_name: str, - disk_access_name: str, - private_endpoint_connection_name: str, - private_endpoint_connection: Union[_models.PrivateEndpointConnection, JSON, IO[bytes]], - **kwargs: Any - ) -> LROPoller[None]: - """Approve or reject a private endpoint connection under disk access resource, this can't be used - to create a new private endpoint connection. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param disk_access_name: The name of the disk access resource that is being created. The name - can't be changed after the disk encryption set is created. Supported characters for the name - are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. - :type disk_access_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection. Required. - :type private_endpoint_connection_name: str - :param private_endpoint_connection: private endpoint connection object supplied in the body of - the Put private endpoint connection operation. Is one of the following types: - PrivateEndpointConnection, JSON, IO[bytes] Required. - :type private_endpoint_connection: ~azure.mgmt.compute.models.PrivateEndpointConnection or JSON - or IO[bytes] - :return: An instance of LROPoller that returns None - :rtype: ~azure.core.polling.LROPoller[None] + gallery_name: str, + gallery_application_name: str, + gallery_application: Union[_models.GalleryApplicationUpdate, JSON, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.GalleryApplication]: + """Update a gallery Application Definition. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param gallery_application_name: The name of the gallery Application Definition to be + retrieved. Required. + :type gallery_application_name: str + :param gallery_application: Parameters supplied to the update gallery Application operation. Is + one of the following types: GalleryApplicationUpdate, JSON, IO[bytes] Required. + :type gallery_application: ~azure.mgmt.compute.models.GalleryApplicationUpdate or JSON or + IO[bytes] + :return: An instance of LROPoller that returns GalleryApplication. The GalleryApplication is + compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.GalleryApplication] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[_models.GalleryApplication] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._update_a_private_endpoint_connection_initial( + raw_result = self._update_initial( resource_group_name=resource_group_name, - disk_access_name=disk_access_name, - private_endpoint_connection_name=private_endpoint_connection_name, - private_endpoint_connection=private_endpoint_connection, + gallery_name=gallery_name, + gallery_application_name=gallery_application_name, + gallery_application=gallery_application, content_type=content_type, cls=lambda x, y, z: x, headers=_headers, @@ -37171,9 +37017,16 @@ def begin_update_a_private_endpoint_connection( # pylint: disable=name-too-long raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = _deserialize(_models.GalleryApplication, response.json()) if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore + return deserialized path_format_arguments = { "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), @@ -37188,16 +37041,18 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return LROPoller[None].from_continuation_token( + return LROPoller[_models.GalleryApplication].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + return LROPoller[_models.GalleryApplication]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) - def _delete_a_private_endpoint_connection_initial( # pylint: disable=name-too-long - self, resource_group_name: str, disk_access_name: str, private_endpoint_connection_name: str, **kwargs: Any + def _delete_initial( + self, resource_group_name: str, gallery_name: str, gallery_application_name: str, **kwargs: Any ) -> Iterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -37212,10 +37067,10 @@ def _delete_a_private_endpoint_connection_initial( # pylint: disable=name-too-l cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - _request = build_private_endpoint_connections_delete_a_private_endpoint_connection_request( + _request = build_gallery_applications_delete_request( resource_group_name=resource_group_name, - disk_access_name=disk_access_name, - private_endpoint_connection_name=private_endpoint_connection_name, + gallery_name=gallery_name, + gallery_application_name=gallery_application_name, subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -37255,20 +37110,19 @@ def _delete_a_private_endpoint_connection_initial( # pylint: disable=name-too-l return deserialized # type: ignore @distributed_trace - def begin_delete_a_private_endpoint_connection( # pylint: disable=name-too-long - self, resource_group_name: str, disk_access_name: str, private_endpoint_connection_name: str, **kwargs: Any + def begin_delete( + self, resource_group_name: str, gallery_name: str, gallery_application_name: str, **kwargs: Any ) -> LROPoller[None]: - """Deletes a private endpoint connection under a disk access resource. + """Delete a gallery Application. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param disk_access_name: The name of the disk access resource that is being created. The name - can't be changed after the disk encryption set is created. Supported characters for the name - are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. - :type disk_access_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection. Required. - :type private_endpoint_connection_name: str + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param gallery_application_name: The name of the gallery Application Definition to be + retrieved. Required. + :type gallery_application_name: str :return: An instance of LROPoller that returns None :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -37281,10 +37135,10 @@ def begin_delete_a_private_endpoint_connection( # pylint: disable=name-too-long lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._delete_a_private_endpoint_connection_initial( + raw_result = self._delete_initial( resource_group_name=resource_group_name, - disk_access_name=disk_access_name, - private_endpoint_connection_name=private_endpoint_connection_name, + gallery_name=gallery_name, + gallery_application_name=gallery_application_name, cls=lambda x, y, z: x, headers=_headers, params=_params, @@ -37319,26 +37173,24 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore @distributed_trace - def list_private_endpoint_connections( - self, resource_group_name: str, disk_access_name: str, **kwargs: Any - ) -> ItemPaged["_models.PrivateEndpointConnection"]: - """List information about private endpoint connections under a disk access resource. + def list_by_gallery( + self, resource_group_name: str, gallery_name: str, **kwargs: Any + ) -> ItemPaged["_models.GalleryApplication"]: + """List gallery Application Definitions in a gallery. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param disk_access_name: The name of the disk access resource that is being created. The name - can't be changed after the disk encryption set is created. Supported characters for the name - are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. - :type disk_access_name: str - :return: An iterator like instance of PrivateEndpointConnection - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.models.PrivateEndpointConnection] + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :return: An iterator like instance of GalleryApplication + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.models.GalleryApplication] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.PrivateEndpointConnection]] = kwargs.pop("cls", None) + cls: ClsType[List[_models.GalleryApplication]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -37351,9 +37203,9 @@ def list_private_endpoint_connections( def prepare_request(next_link=None): if not next_link: - _request = build_private_endpoint_connections_list_private_endpoint_connections_request( + _request = build_gallery_applications_list_by_gallery_request( resource_group_name=resource_group_name, - disk_access_name=disk_access_name, + gallery_name=gallery_name, subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -37390,7 +37242,7 @@ def prepare_request(next_link=None): def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.PrivateEndpointConnection], deserialized.get("value", [])) + list_of_elem = _deserialize(List[_models.GalleryApplication], deserialized.get("value", [])) if cls: list_of_elem = cls(list_of_elem) # type: ignore return deserialized.get("nextLink") or None, iter(list_of_elem) @@ -37414,14 +37266,14 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) -class DiskEncryptionSetsOperations: +class GalleryApplicationVersionsOperations: """ .. warning:: **DO NOT** instantiate this class directly. Instead, you should access the following operations through :class:`~azure.mgmt.compute.ComputeClient`'s - :attr:`disk_encryption_sets` attribute. + :attr:`gallery_application_versions` attribute. """ def __init__(self, *args, **kwargs) -> None: @@ -37432,18 +37284,35 @@ def __init__(self, *args, **kwargs) -> None: self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace - def get(self, resource_group_name: str, disk_encryption_set_name: str, **kwargs: Any) -> _models.DiskEncryptionSet: - """Gets information about a disk encryption set. + def get( + self, + resource_group_name: str, + gallery_name: str, + gallery_application_name: str, + gallery_application_version_name: str, + *, + expand: Optional[Union[str, _models.ReplicationStatusTypes]] = None, + **kwargs: Any + ) -> _models.GalleryApplicationVersion: + """Retrieves information about a gallery Application Version. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param disk_encryption_set_name: The name of the disk encryption set that is being created. The - name can't be changed after the disk encryption set is created. Supported characters for the - name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. - :type disk_encryption_set_name: str - :return: DiskEncryptionSet. The DiskEncryptionSet is compatible with MutableMapping - :rtype: ~azure.mgmt.compute.models.DiskEncryptionSet + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param gallery_application_name: The name of the gallery Application Definition to be + retrieved. Required. + :type gallery_application_name: str + :param gallery_application_version_name: The name of the gallery Application Version to be + retrieved. Required. + :type gallery_application_version_name: str + :keyword expand: The expand expression to apply on the operation. Known values are: + "ReplicationStatus" and "UefiSettings". Default value is None. + :paramtype expand: str or ~azure.mgmt.compute.models.ReplicationStatusTypes + :return: GalleryApplicationVersion. The GalleryApplicationVersion is compatible with + MutableMapping + :rtype: ~azure.mgmt.compute.models.GalleryApplicationVersion :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -37457,12 +37326,15 @@ def get(self, resource_group_name: str, disk_encryption_set_name: str, **kwargs: _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.DiskEncryptionSet] = kwargs.pop("cls", None) + cls: ClsType[_models.GalleryApplicationVersion] = kwargs.pop("cls", None) - _request = build_disk_encryption_sets_get_request( + _request = build_gallery_application_versions_get_request( resource_group_name=resource_group_name, - disk_encryption_set_name=disk_encryption_set_name, + gallery_name=gallery_name, + gallery_application_name=gallery_application_name, + gallery_application_version_name=gallery_application_version_name, subscription_id=self._config.subscription_id, + expand=expand, api_version=self._config.api_version, headers=_headers, params=_params, @@ -37492,7 +37364,7 @@ def get(self, resource_group_name: str, disk_encryption_set_name: str, **kwargs: if _stream: deserialized = response.iter_bytes() else: - deserialized = _deserialize(_models.DiskEncryptionSet, response.json()) + deserialized = _deserialize(_models.GalleryApplicationVersion, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -37502,8 +37374,10 @@ def get(self, resource_group_name: str, disk_encryption_set_name: str, **kwargs: def _create_or_update_initial( self, resource_group_name: str, - disk_encryption_set_name: str, - disk_encryption_set: Union[_models.DiskEncryptionSet, JSON, IO[bytes]], + gallery_name: str, + gallery_application_name: str, + gallery_application_version_name: str, + gallery_application_version: Union[_models.GalleryApplicationVersion, JSON, IO[bytes]], **kwargs: Any ) -> Iterator[bytes]: error_map: MutableMapping = { @@ -37522,14 +37396,16 @@ def _create_or_update_initial( content_type = content_type or "application/json" _content = None - if isinstance(disk_encryption_set, (IOBase, bytes)): - _content = disk_encryption_set + if isinstance(gallery_application_version, (IOBase, bytes)): + _content = gallery_application_version else: - _content = json.dumps(disk_encryption_set, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(gallery_application_version, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - _request = build_disk_encryption_sets_create_or_update_request( + _request = build_gallery_application_versions_create_or_update_request( resource_group_name=resource_group_name, - disk_encryption_set_name=disk_encryption_set_name, + gallery_name=gallery_name, + gallery_application_name=gallery_application_name, + gallery_application_version_name=gallery_application_version_name, subscription_id=self._config.subscription_id, content_type=content_type, api_version=self._config.api_version, @@ -37549,7 +37425,7 @@ def _create_or_update_initial( response = pipeline_response.http_response - if response.status_code not in [200, 202]: + if response.status_code not in [200, 201, 202]: try: response.read() # Load the body in memory and close the socket except (StreamConsumedError, StreamClosedError): @@ -37559,6 +37435,10 @@ def _create_or_update_initial( raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} + if response.status_code == 201: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) @@ -37574,29 +37454,36 @@ def _create_or_update_initial( def begin_create_or_update( self, resource_group_name: str, - disk_encryption_set_name: str, - disk_encryption_set: _models.DiskEncryptionSet, + gallery_name: str, + gallery_application_name: str, + gallery_application_version_name: str, + gallery_application_version: _models.GalleryApplicationVersion, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[None]: - """Creates or updates a disk encryption set. + ) -> LROPoller[_models.GalleryApplicationVersion]: + """Create or update a gallery Application Version. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param disk_encryption_set_name: The name of the disk encryption set that is being created. The - name can't be changed after the disk encryption set is created. Supported characters for the - name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. - :type disk_encryption_set_name: str - :param disk_encryption_set: disk encryption set object supplied in the body of the Put disk - encryption set operation. Required. - :type disk_encryption_set: ~azure.mgmt.compute.models.DiskEncryptionSet + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param gallery_application_name: The name of the gallery Application Definition to be + retrieved. Required. + :type gallery_application_name: str + :param gallery_application_version_name: The name of the gallery Application Version to be + retrieved. Required. + :type gallery_application_version_name: str + :param gallery_application_version: Parameters supplied to the create or update gallery + Application Version operation. Required. + :type gallery_application_version: ~azure.mgmt.compute.models.GalleryApplicationVersion :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns None - :rtype: ~azure.core.polling.LROPoller[None] + :return: An instance of LROPoller that returns GalleryApplicationVersion. The + GalleryApplicationVersion is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.GalleryApplicationVersion] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -37604,29 +37491,36 @@ def begin_create_or_update( def begin_create_or_update( self, resource_group_name: str, - disk_encryption_set_name: str, - disk_encryption_set: JSON, + gallery_name: str, + gallery_application_name: str, + gallery_application_version_name: str, + gallery_application_version: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[None]: - """Creates or updates a disk encryption set. + ) -> LROPoller[_models.GalleryApplicationVersion]: + """Create or update a gallery Application Version. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param disk_encryption_set_name: The name of the disk encryption set that is being created. The - name can't be changed after the disk encryption set is created. Supported characters for the - name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. - :type disk_encryption_set_name: str - :param disk_encryption_set: disk encryption set object supplied in the body of the Put disk - encryption set operation. Required. - :type disk_encryption_set: JSON + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param gallery_application_name: The name of the gallery Application Definition to be + retrieved. Required. + :type gallery_application_name: str + :param gallery_application_version_name: The name of the gallery Application Version to be + retrieved. Required. + :type gallery_application_version_name: str + :param gallery_application_version: Parameters supplied to the create or update gallery + Application Version operation. Required. + :type gallery_application_version: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns None - :rtype: ~azure.core.polling.LROPoller[None] + :return: An instance of LROPoller that returns GalleryApplicationVersion. The + GalleryApplicationVersion is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.GalleryApplicationVersion] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -37634,29 +37528,36 @@ def begin_create_or_update( def begin_create_or_update( self, resource_group_name: str, - disk_encryption_set_name: str, - disk_encryption_set: IO[bytes], + gallery_name: str, + gallery_application_name: str, + gallery_application_version_name: str, + gallery_application_version: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[None]: - """Creates or updates a disk encryption set. + ) -> LROPoller[_models.GalleryApplicationVersion]: + """Create or update a gallery Application Version. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param disk_encryption_set_name: The name of the disk encryption set that is being created. The - name can't be changed after the disk encryption set is created. Supported characters for the - name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. - :type disk_encryption_set_name: str - :param disk_encryption_set: disk encryption set object supplied in the body of the Put disk - encryption set operation. Required. - :type disk_encryption_set: IO[bytes] + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param gallery_application_name: The name of the gallery Application Definition to be + retrieved. Required. + :type gallery_application_name: str + :param gallery_application_version_name: The name of the gallery Application Version to be + retrieved. Required. + :type gallery_application_version_name: str + :param gallery_application_version: Parameters supplied to the create or update gallery + Application Version operation. Required. + :type gallery_application_version: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns None - :rtype: ~azure.core.polling.LROPoller[None] + :return: An instance of LROPoller that returns GalleryApplicationVersion. The + GalleryApplicationVersion is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.GalleryApplicationVersion] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -37664,40 +37565,50 @@ def begin_create_or_update( def begin_create_or_update( self, resource_group_name: str, - disk_encryption_set_name: str, - disk_encryption_set: Union[_models.DiskEncryptionSet, JSON, IO[bytes]], + gallery_name: str, + gallery_application_name: str, + gallery_application_version_name: str, + gallery_application_version: Union[_models.GalleryApplicationVersion, JSON, IO[bytes]], **kwargs: Any - ) -> LROPoller[None]: - """Creates or updates a disk encryption set. + ) -> LROPoller[_models.GalleryApplicationVersion]: + """Create or update a gallery Application Version. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param disk_encryption_set_name: The name of the disk encryption set that is being created. The - name can't be changed after the disk encryption set is created. Supported characters for the - name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. - :type disk_encryption_set_name: str - :param disk_encryption_set: disk encryption set object supplied in the body of the Put disk - encryption set operation. Is one of the following types: DiskEncryptionSet, JSON, IO[bytes] - Required. - :type disk_encryption_set: ~azure.mgmt.compute.models.DiskEncryptionSet or JSON or IO[bytes] - :return: An instance of LROPoller that returns None - :rtype: ~azure.core.polling.LROPoller[None] + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param gallery_application_name: The name of the gallery Application Definition to be + retrieved. Required. + :type gallery_application_name: str + :param gallery_application_version_name: The name of the gallery Application Version to be + retrieved. Required. + :type gallery_application_version_name: str + :param gallery_application_version: Parameters supplied to the create or update gallery + Application Version operation. Is one of the following types: GalleryApplicationVersion, JSON, + IO[bytes] Required. + :type gallery_application_version: ~azure.mgmt.compute.models.GalleryApplicationVersion or JSON + or IO[bytes] + :return: An instance of LROPoller that returns GalleryApplicationVersion. The + GalleryApplicationVersion is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.GalleryApplicationVersion] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[_models.GalleryApplicationVersion] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = self._create_or_update_initial( resource_group_name=resource_group_name, - disk_encryption_set_name=disk_encryption_set_name, - disk_encryption_set=disk_encryption_set, + gallery_name=gallery_name, + gallery_application_name=gallery_application_name, + gallery_application_version_name=gallery_application_version_name, + gallery_application_version=gallery_application_version, content_type=content_type, cls=lambda x, y, z: x, headers=_headers, @@ -37707,9 +37618,12 @@ def begin_create_or_update( raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.GalleryApplicationVersion, response.json()) if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized path_format_arguments = { "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), @@ -37724,19 +37638,23 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return LROPoller[None].from_continuation_token( + return LROPoller[_models.GalleryApplicationVersion].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + return LROPoller[_models.GalleryApplicationVersion]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) def _update_initial( self, resource_group_name: str, - disk_encryption_set_name: str, - disk_encryption_set: Union[_models.DiskEncryptionSetUpdate, JSON, IO[bytes]], + gallery_name: str, + gallery_application_name: str, + gallery_application_version_name: str, + gallery_application_version: Union[_models.GalleryApplicationVersionUpdate, JSON, IO[bytes]], **kwargs: Any ) -> Iterator[bytes]: error_map: MutableMapping = { @@ -37755,14 +37673,16 @@ def _update_initial( content_type = content_type or "application/json" _content = None - if isinstance(disk_encryption_set, (IOBase, bytes)): - _content = disk_encryption_set + if isinstance(gallery_application_version, (IOBase, bytes)): + _content = gallery_application_version else: - _content = json.dumps(disk_encryption_set, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(gallery_application_version, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - _request = build_disk_encryption_sets_update_request( + _request = build_gallery_application_versions_update_request( resource_group_name=resource_group_name, - disk_encryption_set_name=disk_encryption_set_name, + gallery_name=gallery_name, + gallery_application_name=gallery_application_name, + gallery_application_version_name=gallery_application_version_name, subscription_id=self._config.subscription_id, content_type=content_type, api_version=self._config.api_version, @@ -37782,7 +37702,7 @@ def _update_initial( response = pipeline_response.http_response - if response.status_code not in [200, 202]: + if response.status_code not in [200]: try: response.read() # Load the body in memory and close the socket except (StreamConsumedError, StreamClosedError): @@ -37792,9 +37712,8 @@ def _update_initial( raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) deserialized = response.iter_bytes() @@ -37807,29 +37726,36 @@ def _update_initial( def begin_update( self, resource_group_name: str, - disk_encryption_set_name: str, - disk_encryption_set: _models.DiskEncryptionSetUpdate, + gallery_name: str, + gallery_application_name: str, + gallery_application_version_name: str, + gallery_application_version: _models.GalleryApplicationVersionUpdate, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[None]: - """Updates (patches) a disk encryption set. + ) -> LROPoller[_models.GalleryApplicationVersion]: + """Update a gallery Application Version. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param disk_encryption_set_name: The name of the disk encryption set that is being created. The - name can't be changed after the disk encryption set is created. Supported characters for the - name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. - :type disk_encryption_set_name: str - :param disk_encryption_set: disk encryption set object supplied in the body of the Patch disk - encryption set operation. Required. - :type disk_encryption_set: ~azure.mgmt.compute.models.DiskEncryptionSetUpdate + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param gallery_application_name: The name of the gallery Application Definition to be + retrieved. Required. + :type gallery_application_name: str + :param gallery_application_version_name: The name of the gallery Application Version to be + retrieved. Required. + :type gallery_application_version_name: str + :param gallery_application_version: Parameters supplied to the update gallery Application + Version operation. Required. + :type gallery_application_version: ~azure.mgmt.compute.models.GalleryApplicationVersionUpdate :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns None - :rtype: ~azure.core.polling.LROPoller[None] + :return: An instance of LROPoller that returns GalleryApplicationVersion. The + GalleryApplicationVersion is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.GalleryApplicationVersion] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -37837,29 +37763,36 @@ def begin_update( def begin_update( self, resource_group_name: str, - disk_encryption_set_name: str, - disk_encryption_set: JSON, + gallery_name: str, + gallery_application_name: str, + gallery_application_version_name: str, + gallery_application_version: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[None]: - """Updates (patches) a disk encryption set. + ) -> LROPoller[_models.GalleryApplicationVersion]: + """Update a gallery Application Version. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param disk_encryption_set_name: The name of the disk encryption set that is being created. The - name can't be changed after the disk encryption set is created. Supported characters for the - name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. - :type disk_encryption_set_name: str - :param disk_encryption_set: disk encryption set object supplied in the body of the Patch disk - encryption set operation. Required. - :type disk_encryption_set: JSON + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param gallery_application_name: The name of the gallery Application Definition to be + retrieved. Required. + :type gallery_application_name: str + :param gallery_application_version_name: The name of the gallery Application Version to be + retrieved. Required. + :type gallery_application_version_name: str + :param gallery_application_version: Parameters supplied to the update gallery Application + Version operation. Required. + :type gallery_application_version: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns None - :rtype: ~azure.core.polling.LROPoller[None] + :return: An instance of LROPoller that returns GalleryApplicationVersion. The + GalleryApplicationVersion is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.GalleryApplicationVersion] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -37867,29 +37800,36 @@ def begin_update( def begin_update( self, resource_group_name: str, - disk_encryption_set_name: str, - disk_encryption_set: IO[bytes], + gallery_name: str, + gallery_application_name: str, + gallery_application_version_name: str, + gallery_application_version: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[None]: - """Updates (patches) a disk encryption set. + ) -> LROPoller[_models.GalleryApplicationVersion]: + """Update a gallery Application Version. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param disk_encryption_set_name: The name of the disk encryption set that is being created. The - name can't be changed after the disk encryption set is created. Supported characters for the - name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. - :type disk_encryption_set_name: str - :param disk_encryption_set: disk encryption set object supplied in the body of the Patch disk - encryption set operation. Required. - :type disk_encryption_set: IO[bytes] + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param gallery_application_name: The name of the gallery Application Definition to be + retrieved. Required. + :type gallery_application_name: str + :param gallery_application_version_name: The name of the gallery Application Version to be + retrieved. Required. + :type gallery_application_version_name: str + :param gallery_application_version: Parameters supplied to the update gallery Application + Version operation. Required. + :type gallery_application_version: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns None - :rtype: ~azure.core.polling.LROPoller[None] + :return: An instance of LROPoller that returns GalleryApplicationVersion. The + GalleryApplicationVersion is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.GalleryApplicationVersion] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -37897,41 +37837,50 @@ def begin_update( def begin_update( self, resource_group_name: str, - disk_encryption_set_name: str, - disk_encryption_set: Union[_models.DiskEncryptionSetUpdate, JSON, IO[bytes]], + gallery_name: str, + gallery_application_name: str, + gallery_application_version_name: str, + gallery_application_version: Union[_models.GalleryApplicationVersionUpdate, JSON, IO[bytes]], **kwargs: Any - ) -> LROPoller[None]: - """Updates (patches) a disk encryption set. + ) -> LROPoller[_models.GalleryApplicationVersion]: + """Update a gallery Application Version. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param disk_encryption_set_name: The name of the disk encryption set that is being created. The - name can't be changed after the disk encryption set is created. Supported characters for the - name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. - :type disk_encryption_set_name: str - :param disk_encryption_set: disk encryption set object supplied in the body of the Patch disk - encryption set operation. Is one of the following types: DiskEncryptionSetUpdate, JSON, + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param gallery_application_name: The name of the gallery Application Definition to be + retrieved. Required. + :type gallery_application_name: str + :param gallery_application_version_name: The name of the gallery Application Version to be + retrieved. Required. + :type gallery_application_version_name: str + :param gallery_application_version: Parameters supplied to the update gallery Application + Version operation. Is one of the following types: GalleryApplicationVersionUpdate, JSON, IO[bytes] Required. - :type disk_encryption_set: ~azure.mgmt.compute.models.DiskEncryptionSetUpdate or JSON or - IO[bytes] - :return: An instance of LROPoller that returns None - :rtype: ~azure.core.polling.LROPoller[None] + :type gallery_application_version: ~azure.mgmt.compute.models.GalleryApplicationVersionUpdate + or JSON or IO[bytes] + :return: An instance of LROPoller that returns GalleryApplicationVersion. The + GalleryApplicationVersion is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.GalleryApplicationVersion] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[_models.GalleryApplicationVersion] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = self._update_initial( resource_group_name=resource_group_name, - disk_encryption_set_name=disk_encryption_set_name, - disk_encryption_set=disk_encryption_set, + gallery_name=gallery_name, + gallery_application_name=gallery_application_name, + gallery_application_version_name=gallery_application_version_name, + gallery_application_version=gallery_application_version, content_type=content_type, cls=lambda x, y, z: x, headers=_headers, @@ -37941,9 +37890,16 @@ def begin_update( raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = _deserialize(_models.GalleryApplicationVersion, response.json()) if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore + return deserialized path_format_arguments = { "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), @@ -37958,16 +37914,23 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return LROPoller[None].from_continuation_token( + return LROPoller[_models.GalleryApplicationVersion].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + return LROPoller[_models.GalleryApplicationVersion]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) def _delete_initial( - self, resource_group_name: str, disk_encryption_set_name: str, **kwargs: Any + self, + resource_group_name: str, + gallery_name: str, + gallery_application_name: str, + gallery_application_version_name: str, + **kwargs: Any ) -> Iterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -37982,9 +37945,11 @@ def _delete_initial( cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - _request = build_disk_encryption_sets_delete_request( + _request = build_gallery_application_versions_delete_request( resource_group_name=resource_group_name, - disk_encryption_set_name=disk_encryption_set_name, + gallery_name=gallery_name, + gallery_application_name=gallery_application_name, + gallery_application_version_name=gallery_application_version_name, subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -38024,16 +37989,27 @@ def _delete_initial( return deserialized # type: ignore @distributed_trace - def begin_delete(self, resource_group_name: str, disk_encryption_set_name: str, **kwargs: Any) -> LROPoller[None]: - """Deletes a disk encryption set. + def begin_delete( + self, + resource_group_name: str, + gallery_name: str, + gallery_application_name: str, + gallery_application_version_name: str, + **kwargs: Any + ) -> LROPoller[None]: + """Delete a gallery Application Version. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param disk_encryption_set_name: The name of the disk encryption set that is being created. The - name can't be changed after the disk encryption set is created. Supported characters for the - name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. - :type disk_encryption_set_name: str + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param gallery_application_name: The name of the gallery Application Definition to be + retrieved. Required. + :type gallery_application_name: str + :param gallery_application_version_name: The name of the gallery Application Version to be + retrieved. Required. + :type gallery_application_version_name: str :return: An instance of LROPoller that returns None :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -38048,7 +38024,9 @@ def begin_delete(self, resource_group_name: str, disk_encryption_set_name: str, if cont_token is None: raw_result = self._delete_initial( resource_group_name=resource_group_name, - disk_encryption_set_name=disk_encryption_set_name, + gallery_name=gallery_name, + gallery_application_name=gallery_application_name, + gallery_application_version_name=gallery_application_version_name, cls=lambda x, y, z: x, headers=_headers, params=_params, @@ -38083,198 +38061,27 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore @distributed_trace - def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> ItemPaged["_models.DiskEncryptionSet"]: - """Lists all the disk encryption sets under a resource group. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :return: An iterator like instance of DiskEncryptionSet - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.models.DiskEncryptionSet] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[List[_models.DiskEncryptionSet]] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_disk_encryption_sets_list_by_resource_group_request( - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - return _request - - def extract_data(pipeline_response): - deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.DiskEncryptionSet], deserialized.get("value", [])) - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.get("nextLink") or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.CloudError, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @distributed_trace - def list(self, **kwargs: Any) -> ItemPaged["_models.DiskEncryptionSet"]: - """Lists all the disk encryption sets under a subscription. - - :return: An iterator like instance of DiskEncryptionSet - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.models.DiskEncryptionSet] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[List[_models.DiskEncryptionSet]] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_disk_encryption_sets_list_request( - subscription_id=self._config.subscription_id, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - return _request - - def extract_data(pipeline_response): - deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.DiskEncryptionSet], deserialized.get("value", [])) - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.get("nextLink") or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.CloudError, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @distributed_trace - def list_associated_resources( - self, resource_group_name: str, disk_encryption_set_name: str, **kwargs: Any - ) -> ItemPaged[str]: - """Lists all resources that are encrypted with this disk encryption set. + def list_by_gallery_application( + self, resource_group_name: str, gallery_name: str, gallery_application_name: str, **kwargs: Any + ) -> ItemPaged["_models.GalleryApplicationVersion"]: + """List gallery Application Versions in a gallery Application Definition. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param disk_encryption_set_name: The name of the disk encryption set that is being created. The - name can't be changed after the disk encryption set is created. Supported characters for the - name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. - :type disk_encryption_set_name: str - :return: An iterator like instance of str - :rtype: ~azure.core.paging.ItemPaged[str] + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param gallery_application_name: The name of the gallery Application Definition to be + retrieved. Required. + :type gallery_application_name: str + :return: An iterator like instance of GalleryApplicationVersion + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.models.GalleryApplicationVersion] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[str]] = kwargs.pop("cls", None) + cls: ClsType[List[_models.GalleryApplicationVersion]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -38287,9 +38094,10 @@ def list_associated_resources( def prepare_request(next_link=None): if not next_link: - _request = build_disk_encryption_sets_list_associated_resources_request( + _request = build_gallery_application_versions_list_by_gallery_application_request( resource_group_name=resource_group_name, - disk_encryption_set_name=disk_encryption_set_name, + gallery_name=gallery_name, + gallery_application_name=gallery_application_name, subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -38326,7 +38134,7 @@ def prepare_request(next_link=None): def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[str], deserialized.get("value", [])) + list_of_elem = _deserialize(List[_models.GalleryApplicationVersion], deserialized.get("value", [])) if cls: list_of_elem = cls(list_of_elem) # type: ignore return deserialized.get("nextLink") or None, iter(list_of_elem) @@ -38350,14 +38158,14 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) -class SnapshotsOperations: +class GalleryInVMAccessControlProfilesOperations: # pylint: disable=name-too-long """ .. warning:: **DO NOT** instantiate this class directly. Instead, you should access the following operations through :class:`~azure.mgmt.compute.ComputeClient`'s - :attr:`snapshots` attribute. + :attr:`gallery_in_vm_access_control_profiles` attribute. """ def __init__(self, *args, **kwargs) -> None: @@ -38368,18 +38176,22 @@ def __init__(self, *args, **kwargs) -> None: self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace - def get(self, resource_group_name: str, snapshot_name: str, **kwargs: Any) -> _models.Snapshot: - """Gets information about a snapshot. + def get( + self, resource_group_name: str, gallery_name: str, in_vm_access_control_profile_name: str, **kwargs: Any + ) -> _models.GalleryInVMAccessControlProfile: + """Retrieves information about a gallery inVMAccessControlProfile. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param snapshot_name: The name of the snapshot that is being created. The name can't be changed - after the snapshot is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. - The max name length is 80 characters. Required. - :type snapshot_name: str - :return: Snapshot. The Snapshot is compatible with MutableMapping - :rtype: ~azure.mgmt.compute.models.Snapshot + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param in_vm_access_control_profile_name: The name of the gallery inVMAccessControlProfile to + be retrieved. Required. + :type in_vm_access_control_profile_name: str + :return: GalleryInVMAccessControlProfile. The GalleryInVMAccessControlProfile is compatible + with MutableMapping + :rtype: ~azure.mgmt.compute.models.GalleryInVMAccessControlProfile :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -38393,11 +38205,12 @@ def get(self, resource_group_name: str, snapshot_name: str, **kwargs: Any) -> _m _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.Snapshot] = kwargs.pop("cls", None) + cls: ClsType[_models.GalleryInVMAccessControlProfile] = kwargs.pop("cls", None) - _request = build_snapshots_get_request( + _request = build_gallery_in_vm_access_control_profiles_get_request( resource_group_name=resource_group_name, - snapshot_name=snapshot_name, + gallery_name=gallery_name, + in_vm_access_control_profile_name=in_vm_access_control_profile_name, subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -38428,18 +38241,278 @@ def get(self, resource_group_name: str, snapshot_name: str, **kwargs: Any) -> _m if _stream: deserialized = response.iter_bytes() else: - deserialized = _deserialize(_models.Snapshot, response.json()) + deserialized = _deserialize(_models.GalleryInVMAccessControlProfile, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - def _create_or_update_initial( + def _create_or_update_initial( + self, + resource_group_name: str, + gallery_name: str, + in_vm_access_control_profile_name: str, + gallery_in_vm_access_control_profile: Union[_models.GalleryInVMAccessControlProfile, JSON, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(gallery_in_vm_access_control_profile, (IOBase, bytes)): + _content = gallery_in_vm_access_control_profile + else: + _content = json.dumps(gallery_in_vm_access_control_profile, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_gallery_in_vm_access_control_profiles_create_or_update_request( + resource_group_name=resource_group_name, + gallery_name=gallery_name, + in_vm_access_control_profile_name=in_vm_access_control_profile_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 201: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + gallery_name: str, + in_vm_access_control_profile_name: str, + gallery_in_vm_access_control_profile: _models.GalleryInVMAccessControlProfile, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.GalleryInVMAccessControlProfile]: + """Create or update a gallery inVMAccessControlProfile. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param in_vm_access_control_profile_name: The name of the gallery inVMAccessControlProfile to + be retrieved. Required. + :type in_vm_access_control_profile_name: str + :param gallery_in_vm_access_control_profile: Parameters supplied to the create or update + gallery inVMAccessControlProfile operation. Required. + :type gallery_in_vm_access_control_profile: + ~azure.mgmt.compute.models.GalleryInVMAccessControlProfile + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns GalleryInVMAccessControlProfile. The + GalleryInVMAccessControlProfile is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.GalleryInVMAccessControlProfile] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + gallery_name: str, + in_vm_access_control_profile_name: str, + gallery_in_vm_access_control_profile: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.GalleryInVMAccessControlProfile]: + """Create or update a gallery inVMAccessControlProfile. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param in_vm_access_control_profile_name: The name of the gallery inVMAccessControlProfile to + be retrieved. Required. + :type in_vm_access_control_profile_name: str + :param gallery_in_vm_access_control_profile: Parameters supplied to the create or update + gallery inVMAccessControlProfile operation. Required. + :type gallery_in_vm_access_control_profile: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns GalleryInVMAccessControlProfile. The + GalleryInVMAccessControlProfile is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.GalleryInVMAccessControlProfile] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + gallery_name: str, + in_vm_access_control_profile_name: str, + gallery_in_vm_access_control_profile: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.GalleryInVMAccessControlProfile]: + """Create or update a gallery inVMAccessControlProfile. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param in_vm_access_control_profile_name: The name of the gallery inVMAccessControlProfile to + be retrieved. Required. + :type in_vm_access_control_profile_name: str + :param gallery_in_vm_access_control_profile: Parameters supplied to the create or update + gallery inVMAccessControlProfile operation. Required. + :type gallery_in_vm_access_control_profile: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns GalleryInVMAccessControlProfile. The + GalleryInVMAccessControlProfile is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.GalleryInVMAccessControlProfile] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + gallery_name: str, + in_vm_access_control_profile_name: str, + gallery_in_vm_access_control_profile: Union[_models.GalleryInVMAccessControlProfile, JSON, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.GalleryInVMAccessControlProfile]: + """Create or update a gallery inVMAccessControlProfile. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param in_vm_access_control_profile_name: The name of the gallery inVMAccessControlProfile to + be retrieved. Required. + :type in_vm_access_control_profile_name: str + :param gallery_in_vm_access_control_profile: Parameters supplied to the create or update + gallery inVMAccessControlProfile operation. Is one of the following types: + GalleryInVMAccessControlProfile, JSON, IO[bytes] Required. + :type gallery_in_vm_access_control_profile: + ~azure.mgmt.compute.models.GalleryInVMAccessControlProfile or JSON or IO[bytes] + :return: An instance of LROPoller that returns GalleryInVMAccessControlProfile. The + GalleryInVMAccessControlProfile is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.GalleryInVMAccessControlProfile] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.GalleryInVMAccessControlProfile] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + gallery_name=gallery_name, + in_vm_access_control_profile_name=in_vm_access_control_profile_name, + gallery_in_vm_access_control_profile=gallery_in_vm_access_control_profile, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.GalleryInVMAccessControlProfile, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.GalleryInVMAccessControlProfile].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.GalleryInVMAccessControlProfile]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _update_initial( self, resource_group_name: str, - snapshot_name: str, - snapshot: Union[_models.Snapshot, JSON, IO[bytes]], + gallery_name: str, + in_vm_access_control_profile_name: str, + gallery_in_vm_access_control_profile: Union[_models.GalleryInVMAccessControlProfileUpdate, JSON, IO[bytes]], **kwargs: Any ) -> Iterator[bytes]: error_map: MutableMapping = { @@ -38458,14 +38531,15 @@ def _create_or_update_initial( content_type = content_type or "application/json" _content = None - if isinstance(snapshot, (IOBase, bytes)): - _content = snapshot + if isinstance(gallery_in_vm_access_control_profile, (IOBase, bytes)): + _content = gallery_in_vm_access_control_profile else: - _content = json.dumps(snapshot, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(gallery_in_vm_access_control_profile, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - _request = build_snapshots_create_or_update_request( + _request = build_gallery_in_vm_access_control_profiles_update_request( resource_group_name=resource_group_name, - snapshot_name=snapshot_name, + gallery_name=gallery_name, + in_vm_access_control_profile_name=in_vm_access_control_profile_name, subscription_id=self._config.subscription_id, content_type=content_type, api_version=self._config.api_version, @@ -38485,7 +38559,7 @@ def _create_or_update_initial( response = pipeline_response.http_response - if response.status_code not in [200, 202]: + if response.status_code not in [200]: try: response.read() # Load the body in memory and close the socket except (StreamConsumedError, StreamClosedError): @@ -38495,9 +38569,8 @@ def _create_or_update_initial( raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) deserialized = response.iter_bytes() @@ -38507,129 +38580,152 @@ def _create_or_update_initial( return deserialized # type: ignore @overload - def begin_create_or_update( + def begin_update( self, resource_group_name: str, - snapshot_name: str, - snapshot: _models.Snapshot, + gallery_name: str, + in_vm_access_control_profile_name: str, + gallery_in_vm_access_control_profile: _models.GalleryInVMAccessControlProfileUpdate, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[None]: - """Creates or updates a snapshot. + ) -> LROPoller[_models.GalleryInVMAccessControlProfile]: + """Update a gallery inVMAccessControlProfile. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param snapshot_name: The name of the snapshot that is being created. The name can't be changed - after the snapshot is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. - The max name length is 80 characters. Required. - :type snapshot_name: str - :param snapshot: Snapshot object supplied in the body of the Put disk operation. Required. - :type snapshot: ~azure.mgmt.compute.models.Snapshot + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param in_vm_access_control_profile_name: The name of the gallery inVMAccessControlProfile to + be retrieved. Required. + :type in_vm_access_control_profile_name: str + :param gallery_in_vm_access_control_profile: Parameters supplied to the update gallery + inVMAccessControlProfile operation. Required. + :type gallery_in_vm_access_control_profile: + ~azure.mgmt.compute.models.GalleryInVMAccessControlProfileUpdate :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns None - :rtype: ~azure.core.polling.LROPoller[None] + :return: An instance of LROPoller that returns GalleryInVMAccessControlProfile. The + GalleryInVMAccessControlProfile is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.GalleryInVMAccessControlProfile] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def begin_create_or_update( + def begin_update( self, resource_group_name: str, - snapshot_name: str, - snapshot: JSON, + gallery_name: str, + in_vm_access_control_profile_name: str, + gallery_in_vm_access_control_profile: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[None]: - """Creates or updates a snapshot. + ) -> LROPoller[_models.GalleryInVMAccessControlProfile]: + """Update a gallery inVMAccessControlProfile. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param snapshot_name: The name of the snapshot that is being created. The name can't be changed - after the snapshot is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. - The max name length is 80 characters. Required. - :type snapshot_name: str - :param snapshot: Snapshot object supplied in the body of the Put disk operation. Required. - :type snapshot: JSON + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param in_vm_access_control_profile_name: The name of the gallery inVMAccessControlProfile to + be retrieved. Required. + :type in_vm_access_control_profile_name: str + :param gallery_in_vm_access_control_profile: Parameters supplied to the update gallery + inVMAccessControlProfile operation. Required. + :type gallery_in_vm_access_control_profile: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns None - :rtype: ~azure.core.polling.LROPoller[None] + :return: An instance of LROPoller that returns GalleryInVMAccessControlProfile. The + GalleryInVMAccessControlProfile is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.GalleryInVMAccessControlProfile] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def begin_create_or_update( + def begin_update( self, resource_group_name: str, - snapshot_name: str, - snapshot: IO[bytes], + gallery_name: str, + in_vm_access_control_profile_name: str, + gallery_in_vm_access_control_profile: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[None]: - """Creates or updates a snapshot. + ) -> LROPoller[_models.GalleryInVMAccessControlProfile]: + """Update a gallery inVMAccessControlProfile. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param snapshot_name: The name of the snapshot that is being created. The name can't be changed - after the snapshot is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. - The max name length is 80 characters. Required. - :type snapshot_name: str - :param snapshot: Snapshot object supplied in the body of the Put disk operation. Required. - :type snapshot: IO[bytes] + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param in_vm_access_control_profile_name: The name of the gallery inVMAccessControlProfile to + be retrieved. Required. + :type in_vm_access_control_profile_name: str + :param gallery_in_vm_access_control_profile: Parameters supplied to the update gallery + inVMAccessControlProfile operation. Required. + :type gallery_in_vm_access_control_profile: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns None - :rtype: ~azure.core.polling.LROPoller[None] + :return: An instance of LROPoller that returns GalleryInVMAccessControlProfile. The + GalleryInVMAccessControlProfile is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.GalleryInVMAccessControlProfile] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace - def begin_create_or_update( + def begin_update( self, resource_group_name: str, - snapshot_name: str, - snapshot: Union[_models.Snapshot, JSON, IO[bytes]], + gallery_name: str, + in_vm_access_control_profile_name: str, + gallery_in_vm_access_control_profile: Union[_models.GalleryInVMAccessControlProfileUpdate, JSON, IO[bytes]], **kwargs: Any - ) -> LROPoller[None]: - """Creates or updates a snapshot. + ) -> LROPoller[_models.GalleryInVMAccessControlProfile]: + """Update a gallery inVMAccessControlProfile. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param snapshot_name: The name of the snapshot that is being created. The name can't be changed - after the snapshot is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. - The max name length is 80 characters. Required. - :type snapshot_name: str - :param snapshot: Snapshot object supplied in the body of the Put disk operation. Is one of the - following types: Snapshot, JSON, IO[bytes] Required. - :type snapshot: ~azure.mgmt.compute.models.Snapshot or JSON or IO[bytes] - :return: An instance of LROPoller that returns None - :rtype: ~azure.core.polling.LROPoller[None] + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param in_vm_access_control_profile_name: The name of the gallery inVMAccessControlProfile to + be retrieved. Required. + :type in_vm_access_control_profile_name: str + :param gallery_in_vm_access_control_profile: Parameters supplied to the update gallery + inVMAccessControlProfile operation. Is one of the following types: + GalleryInVMAccessControlProfileUpdate, JSON, IO[bytes] Required. + :type gallery_in_vm_access_control_profile: + ~azure.mgmt.compute.models.GalleryInVMAccessControlProfileUpdate or JSON or IO[bytes] + :return: An instance of LROPoller that returns GalleryInVMAccessControlProfile. The + GalleryInVMAccessControlProfile is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.GalleryInVMAccessControlProfile] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[_models.GalleryInVMAccessControlProfile] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._create_or_update_initial( + raw_result = self._update_initial( resource_group_name=resource_group_name, - snapshot_name=snapshot_name, - snapshot=snapshot, + gallery_name=gallery_name, + in_vm_access_control_profile_name=in_vm_access_control_profile_name, + gallery_in_vm_access_control_profile=gallery_in_vm_access_control_profile, content_type=content_type, cls=lambda x, y, z: x, headers=_headers, @@ -38639,9 +38735,16 @@ def begin_create_or_update( raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = _deserialize(_models.GalleryInVMAccessControlProfile, response.json()) if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore + return deserialized path_format_arguments = { "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), @@ -38656,20 +38759,18 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return LROPoller[None].from_continuation_token( + return LROPoller[_models.GalleryInVMAccessControlProfile].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + return LROPoller[_models.GalleryInVMAccessControlProfile]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) - def _update_initial( - self, - resource_group_name: str, - snapshot_name: str, - snapshot: Union[_models.SnapshotUpdate, JSON, IO[bytes]], - **kwargs: Any + def _delete_initial( + self, resource_group_name: str, gallery_name: str, in_vm_access_control_profile_name: str, **kwargs: Any ) -> Iterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -38679,26 +38780,17 @@ def _update_initial( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - content_type = content_type or "application/json" - _content = None - if isinstance(snapshot, (IOBase, bytes)): - _content = snapshot - else: - _content = json.dumps(snapshot, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - - _request = build_snapshots_update_request( + _request = build_gallery_in_vm_access_control_profiles_delete_request( resource_group_name=resource_group_name, - snapshot_name=snapshot_name, + gallery_name=gallery_name, + in_vm_access_control_profile_name=in_vm_access_control_profile_name, subscription_id=self._config.subscription_id, - content_type=content_type, api_version=self._config.api_version, - content=_content, headers=_headers, params=_params, ) @@ -38714,7 +38806,7 @@ def _update_initial( response = pipeline_response.http_response - if response.status_code not in [200, 202]: + if response.status_code not in [202, 204]: try: response.read() # Load the body in memory and close the socket except (StreamConsumedError, StreamClosedError): @@ -38726,7 +38818,9 @@ def _update_initial( response_headers = {} if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) deserialized = response.iter_bytes() @@ -38735,134 +38829,36 @@ def _update_initial( return deserialized # type: ignore - @overload - def begin_update( - self, - resource_group_name: str, - snapshot_name: str, - snapshot: _models.SnapshotUpdate, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[None]: - """Updates (patches) a snapshot. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param snapshot_name: The name of the snapshot that is being created. The name can't be changed - after the snapshot is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. - The max name length is 80 characters. Required. - :type snapshot_name: str - :param snapshot: Snapshot object supplied in the body of the Patch snapshot operation. - Required. - :type snapshot: ~azure.mgmt.compute.models.SnapshotUpdate - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns None - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update( - self, - resource_group_name: str, - snapshot_name: str, - snapshot: JSON, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[None]: - """Updates (patches) a snapshot. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param snapshot_name: The name of the snapshot that is being created. The name can't be changed - after the snapshot is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. - The max name length is 80 characters. Required. - :type snapshot_name: str - :param snapshot: Snapshot object supplied in the body of the Patch snapshot operation. - Required. - :type snapshot: JSON - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns None - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update( - self, - resource_group_name: str, - snapshot_name: str, - snapshot: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[None]: - """Updates (patches) a snapshot. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param snapshot_name: The name of the snapshot that is being created. The name can't be changed - after the snapshot is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. - The max name length is 80 characters. Required. - :type snapshot_name: str - :param snapshot: Snapshot object supplied in the body of the Patch snapshot operation. - Required. - :type snapshot: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns None - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - @distributed_trace - def begin_update( - self, - resource_group_name: str, - snapshot_name: str, - snapshot: Union[_models.SnapshotUpdate, JSON, IO[bytes]], - **kwargs: Any + def begin_delete( + self, resource_group_name: str, gallery_name: str, in_vm_access_control_profile_name: str, **kwargs: Any ) -> LROPoller[None]: - """Updates (patches) a snapshot. + """Delete a gallery inVMAccessControlProfile. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param snapshot_name: The name of the snapshot that is being created. The name can't be changed - after the snapshot is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. - The max name length is 80 characters. Required. - :type snapshot_name: str - :param snapshot: Snapshot object supplied in the body of the Patch snapshot operation. Is one - of the following types: SnapshotUpdate, JSON, IO[bytes] Required. - :type snapshot: ~azure.mgmt.compute.models.SnapshotUpdate or JSON or IO[bytes] + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param in_vm_access_control_profile_name: The name of the gallery inVMAccessControlProfile to + be retrieved. Required. + :type in_vm_access_control_profile_name: str :return: An instance of LROPoller that returns None :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._update_initial( + raw_result = self._delete_initial( resource_group_name=resource_group_name, - snapshot_name=snapshot_name, - snapshot=snapshot, - content_type=content_type, + gallery_name=gallery_name, + in_vm_access_control_profile_name=in_vm_access_control_profile_name, cls=lambda x, y, z: x, headers=_headers, params=_params, @@ -38886,17 +38882,221 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace + def list_by_gallery( + self, resource_group_name: str, gallery_name: str, **kwargs: Any + ) -> ItemPaged["_models.GalleryInVMAccessControlProfile"]: + """List gallery inVMAccessControlProfiles in a gallery. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :return: An iterator like instance of GalleryInVMAccessControlProfile + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.models.GalleryInVMAccessControlProfile] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.GalleryInVMAccessControlProfile]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_gallery_in_vm_access_control_profiles_list_by_gallery_request( + resource_group_name=resource_group_name, + gallery_name=gallery_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.GalleryInVMAccessControlProfile], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + +class GalleryInVMAccessControlProfileVersionsOperations: # pylint: disable=name-too-long + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.compute.ComputeClient`'s + :attr:`gallery_in_vm_access_control_profile_versions` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def get( + self, + resource_group_name: str, + gallery_name: str, + in_vm_access_control_profile_name: str, + in_vm_access_control_profile_version_name: str, + **kwargs: Any + ) -> _models.GalleryInVMAccessControlProfileVersion: + """Retrieves information about a gallery inVMAccessControlProfile version. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param in_vm_access_control_profile_name: The name of the gallery inVMAccessControlProfile to + be retrieved. Required. + :type in_vm_access_control_profile_name: str + :param in_vm_access_control_profile_version_name: The name of the gallery + inVMAccessControlProfile version to be retrieved. Required. + :type in_vm_access_control_profile_version_name: str + :return: GalleryInVMAccessControlProfileVersion. The GalleryInVMAccessControlProfileVersion is + compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.GalleryInVMAccessControlProfileVersion + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.GalleryInVMAccessControlProfileVersion] = kwargs.pop("cls", None) + + _request = build_gallery_in_vm_access_control_profile_versions_get_request( + resource_group_name=resource_group_name, + gallery_name=gallery_name, + in_vm_access_control_profile_name=in_vm_access_control_profile_name, + in_vm_access_control_profile_version_name=in_vm_access_control_profile_version_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.GalleryInVMAccessControlProfileVersion, response.json()) - def _delete_initial(self, resource_group_name: str, snapshot_name: str, **kwargs: Any) -> Iterator[bytes]: + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _create_or_update_initial( + self, + resource_group_name: str, + gallery_name: str, + in_vm_access_control_profile_name: str, + in_vm_access_control_profile_version_name: str, + gallery_in_vm_access_control_profile_version: Union[ + _models.GalleryInVMAccessControlProfileVersion, JSON, IO[bytes] + ], + **kwargs: Any + ) -> Iterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -38905,16 +39105,28 @@ def _delete_initial(self, resource_group_name: str, snapshot_name: str, **kwargs } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - _request = build_snapshots_delete_request( + content_type = content_type or "application/json" + _content = None + if isinstance(gallery_in_vm_access_control_profile_version, (IOBase, bytes)): + _content = gallery_in_vm_access_control_profile_version + else: + _content = json.dumps(gallery_in_vm_access_control_profile_version, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_gallery_in_vm_access_control_profile_versions_create_or_update_request( resource_group_name=resource_group_name, - snapshot_name=snapshot_name, + gallery_name=gallery_name, + in_vm_access_control_profile_name=in_vm_access_control_profile_name, + in_vm_access_control_profile_version_name=in_vm_access_control_profile_version_name, subscription_id=self._config.subscription_id, + content_type=content_type, api_version=self._config.api_version, + content=_content, headers=_headers, params=_params, ) @@ -38930,7 +39142,7 @@ def _delete_initial(self, resource_group_name: str, snapshot_name: str, **kwargs response = pipeline_response.http_response - if response.status_code not in [200, 202, 204]: + if response.status_code not in [200, 201]: try: response.read() # Load the body in memory and close the socket except (StreamConsumedError, StreamClosedError): @@ -38940,7 +39152,7 @@ def _delete_initial(self, resource_group_name: str, snapshot_name: str, **kwargs raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} - if response.status_code == 202: + if response.status_code == 201: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) @@ -38951,32 +39163,173 @@ def _delete_initial(self, resource_group_name: str, snapshot_name: str, **kwargs return deserialized # type: ignore + @overload + def begin_create_or_update( + self, + resource_group_name: str, + gallery_name: str, + in_vm_access_control_profile_name: str, + in_vm_access_control_profile_version_name: str, + gallery_in_vm_access_control_profile_version: _models.GalleryInVMAccessControlProfileVersion, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.GalleryInVMAccessControlProfileVersion]: + """Create or update a gallery inVMAccessControlProfile version. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param in_vm_access_control_profile_name: The name of the gallery inVMAccessControlProfile to + be retrieved. Required. + :type in_vm_access_control_profile_name: str + :param in_vm_access_control_profile_version_name: The name of the gallery + inVMAccessControlProfile version to be retrieved. Required. + :type in_vm_access_control_profile_version_name: str + :param gallery_in_vm_access_control_profile_version: Parameters supplied to the create or + update gallery inVMAccessControlProfile version operation. Required. + :type gallery_in_vm_access_control_profile_version: + ~azure.mgmt.compute.models.GalleryInVMAccessControlProfileVersion + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns GalleryInVMAccessControlProfileVersion. The + GalleryInVMAccessControlProfileVersion is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.GalleryInVMAccessControlProfileVersion] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + gallery_name: str, + in_vm_access_control_profile_name: str, + in_vm_access_control_profile_version_name: str, + gallery_in_vm_access_control_profile_version: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.GalleryInVMAccessControlProfileVersion]: + """Create or update a gallery inVMAccessControlProfile version. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param in_vm_access_control_profile_name: The name of the gallery inVMAccessControlProfile to + be retrieved. Required. + :type in_vm_access_control_profile_name: str + :param in_vm_access_control_profile_version_name: The name of the gallery + inVMAccessControlProfile version to be retrieved. Required. + :type in_vm_access_control_profile_version_name: str + :param gallery_in_vm_access_control_profile_version: Parameters supplied to the create or + update gallery inVMAccessControlProfile version operation. Required. + :type gallery_in_vm_access_control_profile_version: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns GalleryInVMAccessControlProfileVersion. The + GalleryInVMAccessControlProfileVersion is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.GalleryInVMAccessControlProfileVersion] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + gallery_name: str, + in_vm_access_control_profile_name: str, + in_vm_access_control_profile_version_name: str, + gallery_in_vm_access_control_profile_version: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.GalleryInVMAccessControlProfileVersion]: + """Create or update a gallery inVMAccessControlProfile version. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param in_vm_access_control_profile_name: The name of the gallery inVMAccessControlProfile to + be retrieved. Required. + :type in_vm_access_control_profile_name: str + :param in_vm_access_control_profile_version_name: The name of the gallery + inVMAccessControlProfile version to be retrieved. Required. + :type in_vm_access_control_profile_version_name: str + :param gallery_in_vm_access_control_profile_version: Parameters supplied to the create or + update gallery inVMAccessControlProfile version operation. Required. + :type gallery_in_vm_access_control_profile_version: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns GalleryInVMAccessControlProfileVersion. The + GalleryInVMAccessControlProfileVersion is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.GalleryInVMAccessControlProfileVersion] + :raises ~azure.core.exceptions.HttpResponseError: + """ + @distributed_trace - def begin_delete(self, resource_group_name: str, snapshot_name: str, **kwargs: Any) -> LROPoller[None]: - """Deletes a snapshot. + def begin_create_or_update( + self, + resource_group_name: str, + gallery_name: str, + in_vm_access_control_profile_name: str, + in_vm_access_control_profile_version_name: str, + gallery_in_vm_access_control_profile_version: Union[ + _models.GalleryInVMAccessControlProfileVersion, JSON, IO[bytes] + ], + **kwargs: Any + ) -> LROPoller[_models.GalleryInVMAccessControlProfileVersion]: + """Create or update a gallery inVMAccessControlProfile version. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param snapshot_name: The name of the snapshot that is being created. The name can't be changed - after the snapshot is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. - The max name length is 80 characters. Required. - :type snapshot_name: str - :return: An instance of LROPoller that returns None - :rtype: ~azure.core.polling.LROPoller[None] + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param in_vm_access_control_profile_name: The name of the gallery inVMAccessControlProfile to + be retrieved. Required. + :type in_vm_access_control_profile_name: str + :param in_vm_access_control_profile_version_name: The name of the gallery + inVMAccessControlProfile version to be retrieved. Required. + :type in_vm_access_control_profile_version_name: str + :param gallery_in_vm_access_control_profile_version: Parameters supplied to the create or + update gallery inVMAccessControlProfile version operation. Is one of the following types: + GalleryInVMAccessControlProfileVersion, JSON, IO[bytes] Required. + :type gallery_in_vm_access_control_profile_version: + ~azure.mgmt.compute.models.GalleryInVMAccessControlProfileVersion or JSON or IO[bytes] + :return: An instance of LROPoller that returns GalleryInVMAccessControlProfileVersion. The + GalleryInVMAccessControlProfileVersion is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.GalleryInVMAccessControlProfileVersion] :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = kwargs.pop("headers", {}) or {} + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - cls: ClsType[None] = kwargs.pop("cls", None) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.GalleryInVMAccessControlProfileVersion] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._delete_initial( + raw_result = self._create_or_update_initial( resource_group_name=resource_group_name, - snapshot_name=snapshot_name, + gallery_name=gallery_name, + in_vm_access_control_profile_name=in_vm_access_control_profile_name, + in_vm_access_control_profile_version_name=in_vm_access_control_profile_version_name, + gallery_in_vm_access_control_profile_version=gallery_in_vm_access_control_profile_version, + content_type=content_type, cls=lambda x, y, z: x, headers=_headers, params=_params, @@ -38985,9 +39338,12 @@ def begin_delete(self, resource_group_name: str, snapshot_name: str, **kwargs: A raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.GalleryInVMAccessControlProfileVersion, response.json()) if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized path_format_arguments = { "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), @@ -39002,191 +39358,25 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return LROPoller[None].from_continuation_token( + return LROPoller[_models.GalleryInVMAccessControlProfileVersion].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> ItemPaged["_models.Snapshot"]: - """Lists snapshots under a resource group. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :return: An iterator like instance of Snapshot - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.models.Snapshot] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[List[_models.Snapshot]] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_snapshots_list_by_resource_group_request( - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - return _request - - def extract_data(pipeline_response): - deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.Snapshot], deserialized.get("value", [])) - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.get("nextLink") or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.CloudError, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @distributed_trace - def list(self, **kwargs: Any) -> ItemPaged["_models.Snapshot"]: - """Lists snapshots under a subscription. - - :return: An iterator like instance of Snapshot - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.models.Snapshot] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[List[_models.Snapshot]] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_snapshots_list_request( - subscription_id=self._config.subscription_id, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - return _request - - def extract_data(pipeline_response): - deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.Snapshot], deserialized.get("value", [])) - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.get("nextLink") or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.CloudError, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) + return LROPoller[_models.GalleryInVMAccessControlProfileVersion]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) - def _grant_access_initial( + def _update_initial( self, resource_group_name: str, - snapshot_name: str, - grant_access_data: Union[_models.GrantAccessData, JSON, IO[bytes]], + gallery_name: str, + in_vm_access_control_profile_name: str, + in_vm_access_control_profile_version_name: str, + gallery_in_vm_access_control_profile_version: Union[ + _models.GalleryInVMAccessControlProfileVersionUpdate, JSON, IO[bytes] + ], **kwargs: Any ) -> Iterator[bytes]: error_map: MutableMapping = { @@ -39205,14 +39395,16 @@ def _grant_access_initial( content_type = content_type or "application/json" _content = None - if isinstance(grant_access_data, (IOBase, bytes)): - _content = grant_access_data + if isinstance(gallery_in_vm_access_control_profile_version, (IOBase, bytes)): + _content = gallery_in_vm_access_control_profile_version else: - _content = json.dumps(grant_access_data, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(gallery_in_vm_access_control_profile_version, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - _request = build_snapshots_grant_access_request( + _request = build_gallery_in_vm_access_control_profile_versions_update_request( resource_group_name=resource_group_name, - snapshot_name=snapshot_name, + gallery_name=gallery_name, + in_vm_access_control_profile_name=in_vm_access_control_profile_name, + in_vm_access_control_profile_version_name=in_vm_access_control_profile_version_name, subscription_id=self._config.subscription_id, content_type=content_type, api_version=self._config.api_version, @@ -39232,7 +39424,7 @@ def _grant_access_initial( response = pipeline_response.http_response - if response.status_code not in [200, 202]: + if response.status_code not in [200]: try: response.read() # Load the body in memory and close the socket except (StreamConsumedError, StreamClosedError): @@ -39242,9 +39434,8 @@ def _grant_access_initial( raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) deserialized = response.iter_bytes() @@ -39254,136 +39445,171 @@ def _grant_access_initial( return deserialized # type: ignore @overload - def begin_grant_access( + def begin_update( self, resource_group_name: str, - snapshot_name: str, - grant_access_data: _models.GrantAccessData, + gallery_name: str, + in_vm_access_control_profile_name: str, + in_vm_access_control_profile_version_name: str, + gallery_in_vm_access_control_profile_version: _models.GalleryInVMAccessControlProfileVersionUpdate, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.AccessUri]: - """Grants access to a snapshot. + ) -> LROPoller[_models.GalleryInVMAccessControlProfileVersion]: + """Update a gallery inVMAccessControlProfile version. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param snapshot_name: The name of the snapshot that is being created. The name can't be changed - after the snapshot is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. - The max name length is 80 characters. Required. - :type snapshot_name: str - :param grant_access_data: Access data object supplied in the body of the get snapshot access - operation. Required. - :type grant_access_data: ~azure.mgmt.compute.models.GrantAccessData + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param in_vm_access_control_profile_name: The name of the gallery inVMAccessControlProfile to + be retrieved. Required. + :type in_vm_access_control_profile_name: str + :param in_vm_access_control_profile_version_name: The name of the gallery + inVMAccessControlProfile version to be retrieved. Required. + :type in_vm_access_control_profile_version_name: str + :param gallery_in_vm_access_control_profile_version: Parameters supplied to the update gallery + inVMAccessControlProfile version operation. Required. + :type gallery_in_vm_access_control_profile_version: + ~azure.mgmt.compute.models.GalleryInVMAccessControlProfileVersionUpdate :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns AccessUri. The AccessUri is compatible with - MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.AccessUri] + :return: An instance of LROPoller that returns GalleryInVMAccessControlProfileVersion. The + GalleryInVMAccessControlProfileVersion is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.GalleryInVMAccessControlProfileVersion] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def begin_grant_access( + def begin_update( self, resource_group_name: str, - snapshot_name: str, - grant_access_data: JSON, + gallery_name: str, + in_vm_access_control_profile_name: str, + in_vm_access_control_profile_version_name: str, + gallery_in_vm_access_control_profile_version: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.AccessUri]: - """Grants access to a snapshot. + ) -> LROPoller[_models.GalleryInVMAccessControlProfileVersion]: + """Update a gallery inVMAccessControlProfile version. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param snapshot_name: The name of the snapshot that is being created. The name can't be changed - after the snapshot is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. - The max name length is 80 characters. Required. - :type snapshot_name: str - :param grant_access_data: Access data object supplied in the body of the get snapshot access - operation. Required. - :type grant_access_data: JSON + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param in_vm_access_control_profile_name: The name of the gallery inVMAccessControlProfile to + be retrieved. Required. + :type in_vm_access_control_profile_name: str + :param in_vm_access_control_profile_version_name: The name of the gallery + inVMAccessControlProfile version to be retrieved. Required. + :type in_vm_access_control_profile_version_name: str + :param gallery_in_vm_access_control_profile_version: Parameters supplied to the update gallery + inVMAccessControlProfile version operation. Required. + :type gallery_in_vm_access_control_profile_version: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns AccessUri. The AccessUri is compatible with - MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.AccessUri] + :return: An instance of LROPoller that returns GalleryInVMAccessControlProfileVersion. The + GalleryInVMAccessControlProfileVersion is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.GalleryInVMAccessControlProfileVersion] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def begin_grant_access( + def begin_update( self, resource_group_name: str, - snapshot_name: str, - grant_access_data: IO[bytes], + gallery_name: str, + in_vm_access_control_profile_name: str, + in_vm_access_control_profile_version_name: str, + gallery_in_vm_access_control_profile_version: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.AccessUri]: - """Grants access to a snapshot. + ) -> LROPoller[_models.GalleryInVMAccessControlProfileVersion]: + """Update a gallery inVMAccessControlProfile version. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param snapshot_name: The name of the snapshot that is being created. The name can't be changed - after the snapshot is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. - The max name length is 80 characters. Required. - :type snapshot_name: str - :param grant_access_data: Access data object supplied in the body of the get snapshot access - operation. Required. - :type grant_access_data: IO[bytes] + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param in_vm_access_control_profile_name: The name of the gallery inVMAccessControlProfile to + be retrieved. Required. + :type in_vm_access_control_profile_name: str + :param in_vm_access_control_profile_version_name: The name of the gallery + inVMAccessControlProfile version to be retrieved. Required. + :type in_vm_access_control_profile_version_name: str + :param gallery_in_vm_access_control_profile_version: Parameters supplied to the update gallery + inVMAccessControlProfile version operation. Required. + :type gallery_in_vm_access_control_profile_version: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns AccessUri. The AccessUri is compatible with - MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.AccessUri] + :paramtype content_type: str + :return: An instance of LROPoller that returns GalleryInVMAccessControlProfileVersion. The + GalleryInVMAccessControlProfileVersion is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.GalleryInVMAccessControlProfileVersion] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace - def begin_grant_access( + def begin_update( self, resource_group_name: str, - snapshot_name: str, - grant_access_data: Union[_models.GrantAccessData, JSON, IO[bytes]], + gallery_name: str, + in_vm_access_control_profile_name: str, + in_vm_access_control_profile_version_name: str, + gallery_in_vm_access_control_profile_version: Union[ + _models.GalleryInVMAccessControlProfileVersionUpdate, JSON, IO[bytes] + ], **kwargs: Any - ) -> LROPoller[_models.AccessUri]: - """Grants access to a snapshot. + ) -> LROPoller[_models.GalleryInVMAccessControlProfileVersion]: + """Update a gallery inVMAccessControlProfile version. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param snapshot_name: The name of the snapshot that is being created. The name can't be changed - after the snapshot is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. - The max name length is 80 characters. Required. - :type snapshot_name: str - :param grant_access_data: Access data object supplied in the body of the get snapshot access - operation. Is one of the following types: GrantAccessData, JSON, IO[bytes] Required. - :type grant_access_data: ~azure.mgmt.compute.models.GrantAccessData or JSON or IO[bytes] - :return: An instance of LROPoller that returns AccessUri. The AccessUri is compatible with - MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.AccessUri] + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param in_vm_access_control_profile_name: The name of the gallery inVMAccessControlProfile to + be retrieved. Required. + :type in_vm_access_control_profile_name: str + :param in_vm_access_control_profile_version_name: The name of the gallery + inVMAccessControlProfile version to be retrieved. Required. + :type in_vm_access_control_profile_version_name: str + :param gallery_in_vm_access_control_profile_version: Parameters supplied to the update gallery + inVMAccessControlProfile version operation. Is one of the following types: + GalleryInVMAccessControlProfileVersionUpdate, JSON, IO[bytes] Required. + :type gallery_in_vm_access_control_profile_version: + ~azure.mgmt.compute.models.GalleryInVMAccessControlProfileVersionUpdate or JSON or IO[bytes] + :return: An instance of LROPoller that returns GalleryInVMAccessControlProfileVersion. The + GalleryInVMAccessControlProfileVersion is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.GalleryInVMAccessControlProfileVersion] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AccessUri] = kwargs.pop("cls", None) + cls: ClsType[_models.GalleryInVMAccessControlProfileVersion] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._grant_access_initial( + raw_result = self._update_initial( resource_group_name=resource_group_name, - snapshot_name=snapshot_name, - grant_access_data=grant_access_data, + gallery_name=gallery_name, + in_vm_access_control_profile_name=in_vm_access_control_profile_name, + in_vm_access_control_profile_version_name=in_vm_access_control_profile_version_name, + gallery_in_vm_access_control_profile_version=gallery_in_vm_access_control_profile_version, content_type=content_type, cls=lambda x, y, z: x, headers=_headers, @@ -39399,7 +39625,7 @@ def get_long_running_output(pipeline_response): response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - deserialized = _deserialize(_models.AccessUri, response.json()) + deserialized = _deserialize(_models.GalleryInVMAccessControlProfileVersion, response.json()) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized @@ -39417,17 +39643,24 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller[_models.AccessUri].from_continuation_token( + return LROPoller[_models.GalleryInVMAccessControlProfileVersion].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller[_models.AccessUri]( + return LROPoller[_models.GalleryInVMAccessControlProfileVersion]( self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - def _revoke_access_initial(self, resource_group_name: str, snapshot_name: str, **kwargs: Any) -> Iterator[bytes]: + def _delete_initial( + self, + resource_group_name: str, + gallery_name: str, + in_vm_access_control_profile_name: str, + in_vm_access_control_profile_version_name: str, + **kwargs: Any + ) -> Iterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -39441,9 +39674,11 @@ def _revoke_access_initial(self, resource_group_name: str, snapshot_name: str, * cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - _request = build_snapshots_revoke_access_request( + _request = build_gallery_in_vm_access_control_profile_versions_delete_request( resource_group_name=resource_group_name, - snapshot_name=snapshot_name, + gallery_name=gallery_name, + in_vm_access_control_profile_name=in_vm_access_control_profile_name, + in_vm_access_control_profile_version_name=in_vm_access_control_profile_version_name, subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -39461,7 +39696,7 @@ def _revoke_access_initial(self, resource_group_name: str, snapshot_name: str, * response = pipeline_response.http_response - if response.status_code not in [200, 202]: + if response.status_code not in [202, 204]: try: response.read() # Load the body in memory and close the socket except (StreamConsumedError, StreamClosedError): @@ -39473,7 +39708,9 @@ def _revoke_access_initial(self, resource_group_name: str, snapshot_name: str, * response_headers = {} if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) deserialized = response.iter_bytes() @@ -39483,34 +39720,44 @@ def _revoke_access_initial(self, resource_group_name: str, snapshot_name: str, * return deserialized # type: ignore @distributed_trace - def begin_revoke_access( - self, resource_group_name: str, snapshot_name: str, **kwargs: Any - ) -> LROPoller[_models.OkResponse]: - """Revokes access to a snapshot. + def begin_delete( + self, + resource_group_name: str, + gallery_name: str, + in_vm_access_control_profile_name: str, + in_vm_access_control_profile_version_name: str, + **kwargs: Any + ) -> LROPoller[None]: + """Delete a gallery inVMAccessControlProfile version. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param snapshot_name: The name of the snapshot that is being created. The name can't be changed - after the snapshot is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. - The max name length is 80 characters. Required. - :type snapshot_name: str - :return: An instance of LROPoller that returns OkResponse. The OkResponse is compatible with - MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.OkResponse] + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param in_vm_access_control_profile_name: The name of the gallery inVMAccessControlProfile to + be retrieved. Required. + :type in_vm_access_control_profile_name: str + :param in_vm_access_control_profile_version_name: The name of the gallery + inVMAccessControlProfile version to be retrieved. Required. + :type in_vm_access_control_profile_version_name: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.OkResponse] = kwargs.pop("cls", None) + cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._revoke_access_initial( + raw_result = self._delete_initial( resource_group_name=resource_group_name, - snapshot_name=snapshot_name, + gallery_name=gallery_name, + in_vm_access_control_profile_name=in_vm_access_control_profile_name, + in_vm_access_control_profile_version_name=in_vm_access_control_profile_version_name, cls=lambda x, y, z: x, headers=_headers, params=_params, @@ -39519,16 +39766,9 @@ def begin_revoke_access( raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): - response_headers = {} - response = pipeline_response.http_response - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = _deserialize(_models.OkResponse, response.json()) + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized + return cls(pipeline_response, None, {}) # type: ignore path_format_arguments = { "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), @@ -39543,25 +39783,123 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller[_models.OkResponse].from_continuation_token( + return LROPoller[None].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller[_models.OkResponse]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + @distributed_trace + def list_by_gallery_in_vm_access_control_profile( # pylint: disable=name-too-long + self, resource_group_name: str, gallery_name: str, in_vm_access_control_profile_name: str, **kwargs: Any + ) -> ItemPaged["_models.GalleryInVMAccessControlProfileVersion"]: + """List gallery inVMAccessControlProfile versions in a gallery inVMAccessControlProfile. -class GalleriesOperations: + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param in_vm_access_control_profile_name: The name of the gallery inVMAccessControlProfile to + be retrieved. Required. + :type in_vm_access_control_profile_name: str + :return: An iterator like instance of GalleryInVMAccessControlProfileVersion + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.models.GalleryInVMAccessControlProfileVersion] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.GalleryInVMAccessControlProfileVersion]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_gallery_in_vm_access_control_profile_versions_list_by_gallery_in_vm_access_control_profile_request( + resource_group_name=resource_group_name, + gallery_name=gallery_name, + in_vm_access_control_profile_name=in_vm_access_control_profile_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.GalleryInVMAccessControlProfileVersion], deserialized.get("value", []) + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + +class SharedGalleriesOperations: """ .. warning:: **DO NOT** instantiate this class directly. Instead, you should access the following operations through :class:`~azure.mgmt.compute.ComputeClient`'s - :attr:`galleries` attribute. + :attr:`shared_galleries` attribute. """ def __init__(self, *args, **kwargs) -> None: @@ -39572,30 +39910,15 @@ def __init__(self, *args, **kwargs) -> None: self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace - def get( - self, - resource_group_name: str, - gallery_name: str, - *, - select: Optional[Union[str, _models.SelectPermissions]] = None, - expand: Optional[Union[str, _models.GalleryExpandParams]] = None, - **kwargs: Any - ) -> _models.Gallery: - """Retrieves information about a Shared Image Gallery. + def get(self, location: str, gallery_unique_name: str, **kwargs: Any) -> _models.SharedGallery: + """Get a shared gallery by subscription id or tenant id. - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :keyword select: The select expression to apply on the operation. "Permissions" Default value - is None. - :paramtype select: str or ~azure.mgmt.compute.models.SelectPermissions - :keyword expand: The expand query option to apply on the operation. "SharingProfile/Groups" - Default value is None. - :paramtype expand: str or ~azure.mgmt.compute.models.GalleryExpandParams - :return: Gallery. The Gallery is compatible with MutableMapping - :rtype: ~azure.mgmt.compute.models.Gallery + :param location: The name of the Azure region. Required. + :type location: str + :param gallery_unique_name: The unique name of the Shared Gallery. Required. + :type gallery_unique_name: str + :return: SharedGallery. The SharedGallery is compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.SharedGallery :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -39609,14 +39932,12 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.Gallery] = kwargs.pop("cls", None) + cls: ClsType[_models.SharedGallery] = kwargs.pop("cls", None) - _request = build_galleries_get_request( - resource_group_name=resource_group_name, - gallery_name=gallery_name, + _request = build_shared_galleries_get_request( + location=location, + gallery_unique_name=gallery_unique_name, subscription_id=self._config.subscription_id, - select=select, - expand=expand, api_version=self._config.api_version, headers=_headers, params=_params, @@ -39646,20 +39967,33 @@ def get( if _stream: deserialized = response.iter_bytes() else: - deserialized = _deserialize(_models.Gallery, response.json()) + deserialized = _deserialize(_models.SharedGallery, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - def _create_or_update_initial( - self, - resource_group_name: str, - gallery_name: str, - gallery: Union[_models.Gallery, JSON, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: + @distributed_trace + def list( + self, location: str, *, shared_to: Optional[Union[str, _models.SharedToValues]] = None, **kwargs: Any + ) -> ItemPaged["_models.SharedGallery"]: + """List shared galleries by subscription id or tenant id. + + :param location: The name of the Azure region. Required. + :type location: str + :keyword shared_to: The query parameter to decide what shared galleries to fetch when doing + listing operations. "tenant" Default value is None. + :paramtype shared_to: str or ~azure.mgmt.compute.models.SharedToValues + :return: An iterator like instance of SharedGallery + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.models.SharedGallery] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.SharedGallery]] = kwargs.pop("cls", None) + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -39668,26 +40002,125 @@ def _create_or_update_initial( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} + def prepare_request(next_link=None): + if not next_link: - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + _request = build_shared_galleries_list_request( + location=location, + subscription_id=self._config.subscription_id, + shared_to=shared_to, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) - content_type = content_type or "application/json" - _content = None - if isinstance(gallery, (IOBase, bytes)): - _content = gallery - else: - _content = json.dumps(gallery, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) - _request = build_galleries_create_or_update_request( - resource_group_name=resource_group_name, - gallery_name=gallery_name, + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.SharedGallery], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + +class SharedGalleryImagesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.compute.ComputeClient`'s + :attr:`shared_gallery_images` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def get( + self, location: str, gallery_unique_name: str, gallery_image_name: str, **kwargs: Any + ) -> _models.SharedGalleryImage: + """Get a shared gallery image by subscription id or tenant id. + + :param location: The name of the Azure region. Required. + :type location: str + :param gallery_unique_name: The unique name of the Shared Gallery. Required. + :type gallery_unique_name: str + :param gallery_image_name: The name of the Shared Gallery Image Definition from which the Image + Versions are to be listed. Required. + :type gallery_image_name: str + :return: SharedGalleryImage. The SharedGalleryImage is compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.SharedGalleryImage + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.SharedGalleryImage] = kwargs.pop("cls", None) + + _request = build_shared_gallery_images_get_request( + location=location, + gallery_unique_name=gallery_unique_name, + gallery_image_name=gallery_image_name, subscription_id=self._config.subscription_id, - content_type=content_type, api_version=self._config.api_version, - content=_content, headers=_headers, params=_params, ) @@ -39696,198 +40129,180 @@ def _create_or_update_initial( } _request.url = self._client.format_url(_request.url, **path_format_arguments) - _stream = True + _stream = kwargs.pop("stream", False) pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200, 201, 202]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.CloudError, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 201: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.iter_bytes() - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - gallery_name: str, - gallery: _models.Gallery, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[None]: - """Create or update a Shared Image Gallery. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :param gallery: Parameters supplied to the create or update Shared Image Gallery operation. - Required. - :type gallery: ~azure.mgmt.compute.models.Gallery - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns None - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - gallery_name: str, - gallery: JSON, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[None]: - """Create or update a Shared Image Gallery. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :param gallery: Parameters supplied to the create or update Shared Image Gallery operation. - Required. - :type gallery: JSON - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns None - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - @overload - def begin_create_or_update( - self, - resource_group_name: str, - gallery_name: str, - gallery: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[None]: - """Create or update a Shared Image Gallery. + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.SharedGalleryImage, response.json()) - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :param gallery: Parameters supplied to the create or update Shared Image Gallery operation. - Required. - :type gallery: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns None - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace - def begin_create_or_update( + def list( self, - resource_group_name: str, - gallery_name: str, - gallery: Union[_models.Gallery, JSON, IO[bytes]], + location: str, + gallery_unique_name: str, + *, + shared_to: Optional[Union[str, _models.SharedToValues]] = None, **kwargs: Any - ) -> LROPoller[None]: - """Create or update a Shared Image Gallery. + ) -> ItemPaged["_models.SharedGalleryImage"]: + """List shared gallery images by subscription id or tenant id. - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :param gallery: Parameters supplied to the create or update Shared Image Gallery operation. Is - one of the following types: Gallery, JSON, IO[bytes] Required. - :type gallery: ~azure.mgmt.compute.models.Gallery or JSON or IO[bytes] - :return: An instance of LROPoller that returns None - :rtype: ~azure.core.polling.LROPoller[None] + :param location: The name of the Azure region. Required. + :type location: str + :param gallery_unique_name: The unique name of the Shared Gallery. Required. + :type gallery_unique_name: str + :keyword shared_to: The query parameter to decide what shared galleries to fetch when doing + listing operations. "tenant" Default value is None. + :paramtype shared_to: str or ~azure.mgmt.compute.models.SharedToValues + :return: An iterator like instance of SharedGalleryImage + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.models.SharedGalleryImage] :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._create_or_update_initial( - resource_group_name=resource_group_name, - gallery_name=gallery_name, - gallery=gallery, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) + cls: ClsType[List[_models.SharedGalleryImage]] = kwargs.pop("cls", None) - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_shared_gallery_images_list_request( + location=location, + gallery_unique_name=gallery_unique_name, + subscription_id=self._config.subscription_id, + shared_to=shared_to, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.SharedGalleryImage], deserialized.get("value", [])) if cls: - return cls(pipeline_response, None, {}) # type: ignore + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } + def get_next(next_link=None): + _request = prepare_request(next_link) - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + response = pipeline_response.http_response - def _update_initial( + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + +class SharedGalleryImageVersionsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.compute.ComputeClient`'s + :attr:`shared_gallery_image_versions` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def get( self, - resource_group_name: str, - gallery_name: str, - gallery: Union[_models.GalleryUpdate, JSON, IO[bytes]], + location: str, + gallery_unique_name: str, + gallery_image_name: str, + gallery_image_version_name: str, **kwargs: Any - ) -> Iterator[bytes]: + ) -> _models.SharedGalleryImageVersion: + """Get a shared gallery image version by subscription id or tenant id. + + :param location: The name of the Azure region. Required. + :type location: str + :param gallery_unique_name: The unique name of the Shared Gallery. Required. + :type gallery_unique_name: str + :param gallery_image_name: The name of the Shared Gallery Image Definition from which the Image + Versions are to be listed. Required. + :type gallery_image_name: str + :param gallery_image_version_name: The name of the gallery image version to be created. Needs + to follow semantic version name pattern: The allowed characters are digit and period. Digits + must be within the range of a 32-bit integer. Format: ... + Required. + :type gallery_image_version_name: str + :return: SharedGalleryImageVersion. The SharedGalleryImageVersion is compatible with + MutableMapping + :rtype: ~azure.mgmt.compute.models.SharedGalleryImageVersion + :raises ~azure.core.exceptions.HttpResponseError: + """ error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -39896,26 +40311,18 @@ def _update_initial( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _content = None - if isinstance(gallery, (IOBase, bytes)): - _content = gallery - else: - _content = json.dumps(gallery, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + cls: ClsType[_models.SharedGalleryImageVersion] = kwargs.pop("cls", None) - _request = build_galleries_update_request( - resource_group_name=resource_group_name, - gallery_name=gallery_name, + _request = build_shared_gallery_image_versions_get_request( + location=location, + gallery_unique_name=gallery_unique_name, + gallery_image_name=gallery_image_name, + gallery_image_version_name=gallery_image_version_name, subscription_id=self._config.subscription_id, - content_type=content_type, api_version=self._config.api_version, - content=_content, headers=_headers, params=_params, ) @@ -39924,7 +40331,7 @@ def _update_initial( } _request.url = self._client.format_url(_request.url, **path_format_arguments) - _stream = True + _stream = kwargs.pop("stream", False) pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -39932,176 +40339,161 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = _failsafe_deserialize(_models.CloudError, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - response_headers = {} - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.iter_bytes() + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.SharedGalleryImageVersion, response.json()) if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - @overload - def begin_update( + @distributed_trace + def list( self, - resource_group_name: str, - gallery_name: str, - gallery: _models.GalleryUpdate, + location: str, + gallery_unique_name: str, + gallery_image_name: str, *, - content_type: str = "application/json", + shared_to: Optional[Union[str, _models.SharedToValues]] = None, **kwargs: Any - ) -> LROPoller[None]: - """Update a Shared Image Gallery. + ) -> ItemPaged["_models.SharedGalleryImageVersion"]: + """List shared gallery image versions by subscription id or tenant id. - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :param gallery: Parameters supplied to the update Shared Image Gallery operation. Required. - :type gallery: ~azure.mgmt.compute.models.GalleryUpdate - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns None - :rtype: ~azure.core.polling.LROPoller[None] + :param location: The name of the Azure region. Required. + :type location: str + :param gallery_unique_name: The unique name of the Shared Gallery. Required. + :type gallery_unique_name: str + :param gallery_image_name: The name of the Shared Gallery Image Definition from which the Image + Versions are to be listed. Required. + :type gallery_image_name: str + :keyword shared_to: The query parameter to decide what shared galleries to fetch when doing + listing operations. "tenant" Default value is None. + :paramtype shared_to: str or ~azure.mgmt.compute.models.SharedToValues + :return: An iterator like instance of SharedGalleryImageVersion + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.models.SharedGalleryImageVersion] :raises ~azure.core.exceptions.HttpResponseError: """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} - @overload - def begin_update( - self, - resource_group_name: str, - gallery_name: str, - gallery: JSON, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[None]: - """Update a Shared Image Gallery. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :param gallery: Parameters supplied to the update Shared Image Gallery operation. Required. - :type gallery: JSON - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns None - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ + cls: ClsType[List[_models.SharedGalleryImageVersion]] = kwargs.pop("cls", None) - @overload - def begin_update( - self, - resource_group_name: str, - gallery_name: str, - gallery: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[None]: - """Update a Shared Image Gallery. + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :param gallery: Parameters supplied to the update Shared Image Gallery operation. Required. - :type gallery: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns None - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ + def prepare_request(next_link=None): + if not next_link: - @distributed_trace - def begin_update( - self, - resource_group_name: str, - gallery_name: str, - gallery: Union[_models.GalleryUpdate, JSON, IO[bytes]], - **kwargs: Any - ) -> LROPoller[None]: - """Update a Shared Image Gallery. + _request = build_shared_gallery_image_versions_list_request( + location=location, + gallery_unique_name=gallery_unique_name, + gallery_image_name=gallery_image_name, + subscription_id=self._config.subscription_id, + shared_to=shared_to, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :param gallery: Parameters supplied to the update Shared Image Gallery operation. Is one of the - following types: GalleryUpdate, JSON, IO[bytes] Required. - :type gallery: ~azure.mgmt.compute.models.GalleryUpdate or JSON or IO[bytes] - :return: An instance of LROPoller that returns None - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._update_initial( - resource_group_name=resource_group_name, - gallery_name=gallery_name, - gallery=gallery, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) + return _request - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.SharedGalleryImageVersion], deserialized.get("value", [])) if cls: - return cls(pipeline_response, None, {}) # type: ignore + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } + def get_next(next_link=None): + _request = prepare_request(next_link) - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + +class CommunityGalleriesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.compute.ComputeClient`'s + :attr:`community_galleries` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def get(self, location: str, public_gallery_name: str, **kwargs: Any) -> _models.CommunityGallery: + """Get a community gallery by gallery public name. - def _delete_initial(self, resource_group_name: str, gallery_name: str, **kwargs: Any) -> Iterator[bytes]: + :param location: The name of the Azure region. Required. + :type location: str + :param public_gallery_name: The public name of the community gallery. Required. + :type public_gallery_name: str + :return: CommunityGallery. The CommunityGallery is compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.CommunityGallery + :raises ~azure.core.exceptions.HttpResponseError: + """ error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -40113,11 +40505,11 @@ def _delete_initial(self, resource_group_name: str, gallery_name: str, **kwargs: _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + cls: ClsType[_models.CommunityGallery] = kwargs.pop("cls", None) - _request = build_galleries_delete_request( - resource_group_name=resource_group_name, - gallery_name=gallery_name, + _request = build_community_galleries_get_request( + location=location, + public_gallery_name=public_gallery_name, subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -40128,106 +40520,139 @@ def _delete_initial(self, resource_group_name: str, gallery_name: str, **kwargs: } _request.url = self._client.format_url(_request.url, **path_format_arguments) - _stream = True + _stream = kwargs.pop("stream", False) pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200, 202, 204]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = _failsafe_deserialize(_models.CloudError, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.iter_bytes() + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.CommunityGallery, response.json()) if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore + +class CommunityGalleryImagesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.compute.ComputeClient`'s + :attr:`community_gallery_images` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace - def begin_delete(self, resource_group_name: str, gallery_name: str, **kwargs: Any) -> LROPoller[None]: - """Delete a Shared Image Gallery. + def get( + self, location: str, public_gallery_name: str, gallery_image_name: str, **kwargs: Any + ) -> _models.CommunityGalleryImage: + """Get a community gallery image. - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :return: An instance of LROPoller that returns None - :rtype: ~azure.core.polling.LROPoller[None] + :param location: The name of the Azure region. Required. + :type location: str + :param public_gallery_name: The public name of the community gallery. Required. + :type public_gallery_name: str + :param gallery_image_name: The name of the community gallery image definition. Required. + :type gallery_image_name: str + :return: CommunityGalleryImage. The CommunityGalleryImage is compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.CommunityGalleryImage :raises ~azure.core.exceptions.HttpResponseError: """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - gallery_name=gallery_name, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore + cls: ClsType[_models.CommunityGalleryImage] = kwargs.pop("cls", None) + _request = build_community_gallery_images_get_request( + location=location, + public_gallery_name=public_gallery_name, + gallery_image_name=gallery_image_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) path_format_arguments = { "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), } + _request.url = self._client.format_url(_request.url, **path_format_arguments) - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + deserialized = _deserialize(_models.CommunityGalleryImage, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace - def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> ItemPaged["_models.Gallery"]: - """List galleries under a resource group. + def list( + self, location: str, public_gallery_name: str, **kwargs: Any + ) -> ItemPaged["_models.CommunityGalleryImage"]: + """List community gallery images inside a gallery. - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :return: An iterator like instance of Gallery - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.models.Gallery] + :param location: The name of the Azure region. Required. + :type location: str + :param public_gallery_name: The public name of the community gallery. Required. + :type public_gallery_name: str + :return: An iterator like instance of CommunityGalleryImage + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.models.CommunityGalleryImage] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.Gallery]] = kwargs.pop("cls", None) + cls: ClsType[List[_models.CommunityGalleryImage]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -40240,8 +40665,9 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Ite def prepare_request(next_link=None): if not next_link: - _request = build_galleries_list_by_resource_group_request( - resource_group_name=resource_group_name, + _request = build_community_gallery_images_list_request( + location=location, + public_gallery_name=public_gallery_name, subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -40278,7 +40704,7 @@ def prepare_request(next_link=None): def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.Gallery], deserialized.get("value", [])) + list_of_elem = _deserialize(List[_models.CommunityGalleryImage], deserialized.get("value", [])) if cls: list_of_elem = cls(list_of_elem) # type: ignore return deserialized.get("nextLink") or None, iter(list_of_elem) @@ -40301,18 +40727,126 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) + +class CommunityGalleryImageVersionsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.compute.ComputeClient`'s + :attr:`community_gallery_image_versions` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace - def list(self, **kwargs: Any) -> ItemPaged["_models.Gallery"]: - """List galleries under a subscription. + def get( + self, + location: str, + public_gallery_name: str, + gallery_image_name: str, + gallery_image_version_name: str, + **kwargs: Any + ) -> _models.CommunityGalleryImageVersion: + """Get a community gallery image version. - :return: An iterator like instance of Gallery - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.models.Gallery] + :param location: The name of the Azure region. Required. + :type location: str + :param public_gallery_name: The public name of the community gallery. Required. + :type public_gallery_name: str + :param gallery_image_name: The name of the community gallery image definition. Required. + :type gallery_image_name: str + :param gallery_image_version_name: The name of the community gallery image version. Needs to + follow semantic version name pattern: The allowed characters are digit and period. Digits must + be within the range of a 32-bit integer. Format: ... + Required. + :type gallery_image_version_name: str + :return: CommunityGalleryImageVersion. The CommunityGalleryImageVersion is compatible with + MutableMapping + :rtype: ~azure.mgmt.compute.models.CommunityGalleryImageVersion :raises ~azure.core.exceptions.HttpResponseError: """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.Gallery]] = kwargs.pop("cls", None) + cls: ClsType[_models.CommunityGalleryImageVersion] = kwargs.pop("cls", None) + + _request = build_community_gallery_image_versions_get_request( + location=location, + public_gallery_name=public_gallery_name, + gallery_image_name=gallery_image_name, + gallery_image_version_name=gallery_image_version_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.CommunityGalleryImageVersion, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list( + self, location: str, public_gallery_name: str, gallery_image_name: str, **kwargs: Any + ) -> ItemPaged["_models.CommunityGalleryImageVersion"]: + """List community gallery image versions inside an image. + + :param location: The name of the Azure region. Required. + :type location: str + :param public_gallery_name: The public name of the community gallery. Required. + :type public_gallery_name: str + :param gallery_image_name: The name of the community gallery image definition. Required. + :type gallery_image_name: str + :return: An iterator like instance of CommunityGalleryImageVersion + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.models.CommunityGalleryImageVersion] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.CommunityGalleryImageVersion]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -40325,7 +40859,10 @@ def list(self, **kwargs: Any) -> ItemPaged["_models.Gallery"]: def prepare_request(next_link=None): if not next_link: - _request = build_galleries_list_request( + _request = build_community_gallery_image_versions_list_request( + location=location, + public_gallery_name=public_gallery_name, + gallery_image_name=gallery_image_name, subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -40362,7 +40899,7 @@ def prepare_request(next_link=None): def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.Gallery], deserialized.get("value", [])) + list_of_elem = _deserialize(List[_models.CommunityGalleryImageVersion], deserialized.get("value", [])) if cls: list_of_elem = cls(list_of_elem) # type: ignore return deserialized.get("nextLink") or None, iter(list_of_elem) @@ -40385,32 +40922,44 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) + +class ResourceSkusOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.compute.ComputeClient`'s + :attr:`resource_skus` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace - def list_by_artifact_name( - self, resource_group_name: str, gallery_name: str, artifact_type: str, artifact_name: str, **kwargs: Any - ) -> ItemPaged["_models.GallerySoftDeletedResource"]: - """List soft-deleted resources of an artifact in the gallery, such as soft-deleted gallery image - version of an image. + def list( + self, *, filter: Optional[str] = None, include_extended_locations: Optional[str] = None, **kwargs: Any + ) -> ItemPaged["_models.ResourceSku"]: + """Gets the list of Microsoft.Compute SKUs available for your Subscription. - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :param artifact_type: The type of the artifact to be listed, such as gallery image version. - Required. - :type artifact_type: str - :param artifact_name: The artifact name to be listed. If artifact type is Images, then the - artifact name should be the gallery image name. Required. - :type artifact_name: str - :return: An iterator like instance of GallerySoftDeletedResource - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.models.GallerySoftDeletedResource] + :keyword filter: The filter to apply on the operation. Only **location** filter is supported + currently. Default value is None. + :paramtype filter: str + :keyword include_extended_locations: To Include Extended Locations information or not in the + response. Default value is None. + :paramtype include_extended_locations: str + :return: An iterator like instance of ResourceSku + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.models.ResourceSku] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.GallerySoftDeletedResource]] = kwargs.pop("cls", None) + cls: ClsType[List[_models.ResourceSku]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -40423,12 +40972,10 @@ def list_by_artifact_name( def prepare_request(next_link=None): if not next_link: - _request = build_galleries_list_by_artifact_name_request( - resource_group_name=resource_group_name, - gallery_name=gallery_name, - artifact_type=artifact_type, - artifact_name=artifact_name, + _request = build_resource_skus_list_request( subscription_id=self._config.subscription_id, + filter=filter, + include_extended_locations=include_extended_locations, api_version=self._config.api_version, headers=_headers, params=_params, @@ -40464,7 +41011,7 @@ def prepare_request(next_link=None): def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.GallerySoftDeletedResource], deserialized.get("value", [])) + list_of_elem = _deserialize(List[_models.ResourceSku], deserialized.get("value", [])) if cls: list_of_elem = cls(list_of_elem) # type: ignore return deserialized.get("nextLink") or None, iter(list_of_elem) @@ -40480,19 +41027,151 @@ def get_next(next_link=None): if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.CloudError, response) + error = _failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response return ItemPaged(get_next, extract_data) - def _gallery_sharing_profile_update_initial( - self, - resource_group_name: str, - gallery_name: str, - sharing_update: Union[_models.SharingUpdate, JSON, IO[bytes]], - **kwargs: Any + +class VirtualMachineScaleSetRollingUpgradesOperations: # pylint: disable=name-too-long + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.compute.ComputeClient`'s + :attr:`virtual_machine_scale_set_rolling_upgrades` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + def _start_extension_upgrade_initial( + self, resource_group_name: str, vm_scale_set_name: str, **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_virtual_machine_scale_set_rolling_upgrades_start_extension_upgrade_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_start_extension_upgrade( + 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. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._start_extension_upgrade_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + def _start_os_upgrade_initial( + self, resource_group_name: str, vm_scale_set_name: str, **kwargs: Any ) -> Iterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -40502,26 +41181,16 @@ def _gallery_sharing_profile_update_initial( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - content_type = content_type or "application/json" - _content = None - if isinstance(sharing_update, (IOBase, bytes)): - _content = sharing_update - else: - _content = json.dumps(sharing_update, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - - _request = build_galleries_gallery_sharing_profile_update_request( + _request = build_virtual_machine_scale_set_rolling_upgrades_start_os_upgrade_request( resource_group_name=resource_group_name, - gallery_name=gallery_name, + vm_scale_set_name=vm_scale_set_name, subscription_id=self._config.subscription_id, - content_type=content_type, api_version=self._config.api_version, - content=_content, headers=_headers, params=_params, ) @@ -40558,123 +41227,146 @@ def _gallery_sharing_profile_update_initial( return deserialized # type: ignore - @overload - def begin_gallery_sharing_profile_update( - self, - resource_group_name: str, - gallery_name: str, - sharing_update: _models.SharingUpdate, - *, - content_type: str = "application/json", - **kwargs: Any + @distributed_trace + def begin_start_os_upgrade( + self, resource_group_name: str, vm_scale_set_name: str, **kwargs: Any ) -> LROPoller[None]: - """Update sharing profile of a gallery. + """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. The name is case insensitive. Required. :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :param sharing_update: Parameters supplied to the update gallery sharing profile. Required. - :type sharing_update: ~azure.mgmt.compute.models.SharingUpdate - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str :return: An instance of LROPoller that returns None :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} - @overload - def begin_gallery_sharing_profile_update( - self, - resource_group_name: str, - gallery_name: str, - sharing_update: JSON, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[None]: - """Update sharing profile of a gallery. + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._start_os_upgrade_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :param sharing_update: Parameters supplied to the update gallery sharing profile. Required. - :type sharing_update: JSON - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns None - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore - @overload - def begin_gallery_sharing_profile_update( - self, - resource_group_name: str, - gallery_name: str, - sharing_update: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[None]: - """Update sharing profile of a gallery. + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :param sharing_update: Parameters supplied to the update gallery sharing profile. Required. - :type sharing_update: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns None - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + def _cancel_initial(self, resource_group_name: str, vm_scale_set_name: str, **kwargs: Any) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_virtual_machine_scale_set_rolling_upgrades_cancel_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore @distributed_trace - def begin_gallery_sharing_profile_update( - self, - resource_group_name: str, - gallery_name: str, - sharing_update: Union[_models.SharingUpdate, JSON, IO[bytes]], - **kwargs: Any - ) -> LROPoller[None]: - """Update sharing profile of a gallery. + def begin_cancel(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. The name is case insensitive. Required. :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :param sharing_update: Parameters supplied to the update gallery sharing profile. Is one of the - following types: SharingUpdate, JSON, IO[bytes] Required. - :type sharing_update: ~azure.mgmt.compute.models.SharingUpdate or JSON or IO[bytes] + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str :return: An instance of LROPoller that returns None :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._gallery_sharing_profile_update_initial( + raw_result = self._cancel_initial( resource_group_name=resource_group_name, - gallery_name=gallery_name, - sharing_update=sharing_update, - content_type=content_type, + vm_scale_set_name=vm_scale_set_name, cls=lambda x, y, z: x, headers=_headers, params=_params, @@ -40708,39 +41400,20 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - -class GalleryImagesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.compute.ComputeClient`'s - :attr:`gallery_images` attribute. - """ - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ComputeClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def get( - self, resource_group_name: str, gallery_name: str, gallery_image_name: str, **kwargs: Any - ) -> _models.GalleryImage: - """Retrieves information about a gallery image definition. + 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. The name is case insensitive. Required. :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :param gallery_image_name: The name of the gallery image definition to be retrieved. Required. - :type gallery_image_name: str - :return: GalleryImage. The GalleryImage is compatible with MutableMapping - :rtype: ~azure.mgmt.compute.models.GalleryImage + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :return: RollingUpgradeStatusInfo. The RollingUpgradeStatusInfo is compatible with + MutableMapping + :rtype: ~azure.mgmt.compute.models.RollingUpgradeStatusInfo :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -40754,12 +41427,11 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.GalleryImage] = kwargs.pop("cls", None) + cls: ClsType[_models.RollingUpgradeStatusInfo] = kwargs.pop("cls", None) - _request = build_gallery_images_get_request( + _request = build_virtual_machine_scale_set_rolling_upgrades_get_latest_request( resource_group_name=resource_group_name, - gallery_name=gallery_name, - gallery_image_name=gallery_image_name, + vm_scale_set_name=vm_scale_set_name, subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -40790,21 +41462,60 @@ def get( if _stream: deserialized = response.iter_bytes() else: - deserialized = _deserialize(_models.GalleryImage, response.json()) + deserialized = _deserialize(_models.RollingUpgradeStatusInfo, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - def _create_or_update_initial( + +class VirtualMachineScaleSetVMsOperations: # pylint: disable=too-many-public-methods + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.compute.ComputeClient`'s + :attr:`virtual_machine_scale_set_vms` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def get( self, resource_group_name: str, - gallery_name: str, - gallery_image_name: str, - gallery_image: Union[_models.GalleryImage, JSON, IO[bytes]], + vm_scale_set_name: str, + instance_id: str, + *, + expand: Optional[Union[str, _models.InstanceViewTypes]] = None, **kwargs: Any - ) -> Iterator[bytes]: + ) -> _models.VirtualMachineScaleSetVM: + """Gets a virtual machine from a VM scale set. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. Required. + :type instance_id: str + :keyword 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. Known values are: "instanceView", "userData", and "resiliencyView". Default value is + None. + :paramtype expand: str or ~azure.mgmt.compute.models.InstanceViewTypes + :return: VirtualMachineScaleSetVM. The VirtualMachineScaleSetVM is compatible with + MutableMapping + :rtype: ~azure.mgmt.compute.models.VirtualMachineScaleSetVM + :raises ~azure.core.exceptions.HttpResponseError: + """ error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -40813,27 +41524,18 @@ def _create_or_update_initial( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _content = None - if isinstance(gallery_image, (IOBase, bytes)): - _content = gallery_image - else: - _content = json.dumps(gallery_image, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + cls: ClsType[_models.VirtualMachineScaleSetVM] = kwargs.pop("cls", None) - _request = build_gallery_images_create_or_update_request( + _request = build_virtual_machine_scale_set_vms_get_request( resource_group_name=resource_group_name, - gallery_name=gallery_name, - gallery_image_name=gallery_image_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, subscription_id=self._config.subscription_id, - content_type=content_type, + expand=expand, api_version=self._config.api_version, - content=_content, headers=_headers, params=_params, ) @@ -40842,210 +41544,42 @@ def _create_or_update_initial( } _request.url = self._client.format_url(_request.url, **path_format_arguments) - _stream = True + _stream = kwargs.pop("stream", False) pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200, 201, 202]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = _failsafe_deserialize(_models.CloudError, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - response_headers = {} - if response.status_code == 201: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.iter_bytes() - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - gallery_name: str, - gallery_image_name: str, - gallery_image: _models.GalleryImage, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[None]: - """Create or update a gallery image definition. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :param gallery_image_name: The name of the gallery image definition to be retrieved. Required. - :type gallery_image_name: str - :param gallery_image: Parameters supplied to the create or update gallery image operation. - Required. - :type gallery_image: ~azure.mgmt.compute.models.GalleryImage - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns None - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - gallery_name: str, - gallery_image_name: str, - gallery_image: JSON, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[None]: - """Create or update a gallery image definition. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :param gallery_image_name: The name of the gallery image definition to be retrieved. Required. - :type gallery_image_name: str - :param gallery_image: Parameters supplied to the create or update gallery image operation. - Required. - :type gallery_image: JSON - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns None - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - gallery_name: str, - gallery_image_name: str, - gallery_image: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[None]: - """Create or update a gallery image definition. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :param gallery_image_name: The name of the gallery image definition to be retrieved. Required. - :type gallery_image_name: str - :param gallery_image: Parameters supplied to the create or update gallery image operation. - Required. - :type gallery_image: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns None - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - gallery_name: str, - gallery_image_name: str, - gallery_image: Union[_models.GalleryImage, JSON, IO[bytes]], - **kwargs: Any - ) -> LROPoller[None]: - """Create or update a gallery image definition. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :param gallery_image_name: The name of the gallery image definition to be retrieved. Required. - :type gallery_image_name: str - :param gallery_image: Parameters supplied to the create or update gallery image operation. Is - one of the following types: GalleryImage, JSON, IO[bytes] Required. - :type gallery_image: ~azure.mgmt.compute.models.GalleryImage or JSON or IO[bytes] - :return: An instance of LROPoller that returns None - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} - - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._create_or_update_initial( - resource_group_name=resource_group_name, - gallery_name=gallery_name, - gallery_image_name=gallery_image_name, - gallery_image=gallery_image, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) + if _stream: + deserialized = response.iter_bytes() else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + deserialized = _deserialize(_models.VirtualMachineScaleSetVM, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore def _update_initial( self, resource_group_name: str, - gallery_name: str, - gallery_image_name: str, - gallery_image: Union[_models.GalleryImageUpdate, JSON, IO[bytes]], + vm_scale_set_name: str, + instance_id: str, + parameters: Union[_models.VirtualMachineScaleSetVM, JSON, IO[bytes]], + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, **kwargs: Any ) -> Iterator[bytes]: error_map: MutableMapping = { @@ -41054,6 +41588,12 @@ def _update_initial( 409: ResourceExistsError, 304: ResourceNotModifiedError, } + if match_condition == MatchConditions.IfNotModified: + error_map[412] = ResourceModifiedError + elif match_condition == MatchConditions.IfPresent: + error_map[412] = ResourceNotFoundError + elif match_condition == MatchConditions.IfMissing: + error_map[412] = ResourceExistsError error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -41064,16 +41604,18 @@ def _update_initial( content_type = content_type or "application/json" _content = None - if isinstance(gallery_image, (IOBase, bytes)): - _content = gallery_image + if isinstance(parameters, (IOBase, bytes)): + _content = parameters else: - _content = json.dumps(gallery_image, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - _request = build_gallery_images_update_request( + _request = build_virtual_machine_scale_set_vms_update_request( resource_group_name=resource_group_name, - gallery_name=gallery_name, - gallery_image_name=gallery_image_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, subscription_id=self._config.subscription_id, + etag=etag, + match_condition=match_condition, content_type=content_type, api_version=self._config.api_version, content=_content, @@ -41092,7 +41634,7 @@ def _update_initial( response = pipeline_response.http_response - if response.status_code not in [200]: + if response.status_code not in [200, 202]: try: response.read() # Load the body in memory and close the socket except (StreamConsumedError, StreamClosedError): @@ -41102,8 +41644,9 @@ def _update_initial( raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) deserialized = response.iter_bytes() @@ -41116,29 +41659,38 @@ def _update_initial( def begin_update( self, resource_group_name: str, - gallery_name: str, - gallery_image_name: str, - gallery_image: _models.GalleryImageUpdate, + vm_scale_set_name: str, + instance_id: str, + parameters: _models.VirtualMachineScaleSetVM, *, content_type: str = "application/json", + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, **kwargs: Any - ) -> LROPoller[None]: - """Update a gallery image definition. + ) -> LROPoller[_models.VirtualMachineScaleSetVM]: + """Updates a virtual machine of a VM scale set. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :param gallery_image_name: The name of the gallery image definition to be retrieved. Required. - :type gallery_image_name: str - :param gallery_image: Parameters supplied to the update gallery image operation. Required. - :type gallery_image: ~azure.mgmt.compute.models.GalleryImageUpdate + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. Required. + :type instance_id: str + :param parameters: Parameters supplied to the Update Virtual Machine Scale Sets VM operation. + Required. + :type parameters: ~azure.mgmt.compute.models.VirtualMachineScaleSetVM :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns None - :rtype: ~azure.core.polling.LROPoller[None] + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of LROPoller that returns VirtualMachineScaleSetVM. The + VirtualMachineScaleSetVM is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.VirtualMachineScaleSetVM] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -41146,29 +41698,38 @@ def begin_update( def begin_update( self, resource_group_name: str, - gallery_name: str, - gallery_image_name: str, - gallery_image: JSON, + vm_scale_set_name: str, + instance_id: str, + parameters: JSON, *, content_type: str = "application/json", + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, **kwargs: Any - ) -> LROPoller[None]: - """Update a gallery image definition. + ) -> LROPoller[_models.VirtualMachineScaleSetVM]: + """Updates a virtual machine of a VM scale set. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :param gallery_image_name: The name of the gallery image definition to be retrieved. Required. - :type gallery_image_name: str - :param gallery_image: Parameters supplied to the update gallery image operation. Required. - :type gallery_image: JSON + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. Required. + :type instance_id: str + :param parameters: Parameters supplied to the Update Virtual Machine Scale Sets VM operation. + Required. + :type parameters: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns None - :rtype: ~azure.core.polling.LROPoller[None] + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of LROPoller that returns VirtualMachineScaleSetVM. The + VirtualMachineScaleSetVM is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.VirtualMachineScaleSetVM] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -41176,29 +41737,38 @@ def begin_update( def begin_update( self, resource_group_name: str, - gallery_name: str, - gallery_image_name: str, - gallery_image: IO[bytes], + vm_scale_set_name: str, + instance_id: str, + parameters: IO[bytes], *, content_type: str = "application/json", + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, **kwargs: Any - ) -> LROPoller[None]: - """Update a gallery image definition. + ) -> LROPoller[_models.VirtualMachineScaleSetVM]: + """Updates a virtual machine of a VM scale set. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :param gallery_image_name: The name of the gallery image definition to be retrieved. Required. - :type gallery_image_name: str - :param gallery_image: Parameters supplied to the update gallery image operation. Required. - :type gallery_image: IO[bytes] + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. Required. + :type instance_id: str + :param parameters: Parameters supplied to the Update Virtual Machine Scale Sets VM operation. + Required. + :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns None - :rtype: ~azure.core.polling.LROPoller[None] + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of LROPoller that returns VirtualMachineScaleSetVM. The + VirtualMachineScaleSetVM is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.VirtualMachineScaleSetVM] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -41206,41 +41776,52 @@ def begin_update( def begin_update( self, resource_group_name: str, - gallery_name: str, - gallery_image_name: str, - gallery_image: Union[_models.GalleryImageUpdate, JSON, IO[bytes]], + vm_scale_set_name: str, + instance_id: str, + parameters: Union[_models.VirtualMachineScaleSetVM, JSON, IO[bytes]], + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, **kwargs: Any - ) -> LROPoller[None]: - """Update a gallery image definition. + ) -> LROPoller[_models.VirtualMachineScaleSetVM]: + """Updates a virtual machine of a VM scale set. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :param gallery_image_name: The name of the gallery image definition to be retrieved. Required. - :type gallery_image_name: str - :param gallery_image: Parameters supplied to the update gallery image operation. Is one of the - following types: GalleryImageUpdate, JSON, IO[bytes] Required. - :type gallery_image: ~azure.mgmt.compute.models.GalleryImageUpdate or JSON or IO[bytes] - :return: An instance of LROPoller that returns None - :rtype: ~azure.core.polling.LROPoller[None] + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. Required. + :type instance_id: str + :param parameters: Parameters supplied to the Update Virtual Machine Scale Sets VM operation. + Is one of the following types: VirtualMachineScaleSetVM, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.compute.models.VirtualMachineScaleSetVM or JSON or IO[bytes] + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of LROPoller that returns VirtualMachineScaleSetVM. The + VirtualMachineScaleSetVM is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.VirtualMachineScaleSetVM] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[_models.VirtualMachineScaleSetVM] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = self._update_initial( resource_group_name=resource_group_name, - gallery_name=gallery_name, - gallery_image_name=gallery_image_name, - gallery_image=gallery_image, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + parameters=parameters, + etag=etag, + match_condition=match_condition, content_type=content_type, cls=lambda x, y, z: x, headers=_headers, @@ -41250,9 +41831,12 @@ def begin_update( raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.VirtualMachineScaleSetVM, response.json()) if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized path_format_arguments = { "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), @@ -41267,16 +41851,24 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return LROPoller[None].from_continuation_token( + return LROPoller[_models.VirtualMachineScaleSetVM].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + return LROPoller[_models.VirtualMachineScaleSetVM]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) def _delete_initial( - self, resource_group_name: str, gallery_name: str, gallery_image_name: str, **kwargs: Any + self, + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + *, + force_deletion: Optional[bool] = None, + **kwargs: Any ) -> Iterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -41291,11 +41883,12 @@ def _delete_initial( cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - _request = build_gallery_images_delete_request( + _request = build_virtual_machine_scale_set_vms_delete_request( resource_group_name=resource_group_name, - gallery_name=gallery_name, - gallery_image_name=gallery_image_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, subscription_id=self._config.subscription_id, + force_deletion=force_deletion, api_version=self._config.api_version, headers=_headers, params=_params, @@ -41335,17 +41928,26 @@ def _delete_initial( @distributed_trace def begin_delete( - self, resource_group_name: str, gallery_name: str, gallery_image_name: str, **kwargs: Any + self, + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + *, + force_deletion: Optional[bool] = None, + **kwargs: Any ) -> LROPoller[None]: - """Delete a gallery image. + """Deletes a virtual machine from a VM scale set. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :param gallery_image_name: The name of the gallery image definition to be retrieved. Required. - :type gallery_image_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. Required. + :type instance_id: str + :keyword force_deletion: Optional parameter to force delete a virtual machine from a VM scale + set. (Feature in Preview). Default value is None. + :paramtype force_deletion: bool :return: An instance of LROPoller that returns None :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -41360,8 +41962,9 @@ def begin_delete( if cont_token is None: raw_result = self._delete_initial( resource_group_name=resource_group_name, - gallery_name=gallery_name, - gallery_image_name=gallery_image_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + force_deletion=force_deletion, cls=lambda x, y, z: x, headers=_headers, params=_params, @@ -41396,24 +41999,41 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore @distributed_trace - def list_by_gallery( - self, resource_group_name: str, gallery_name: str, **kwargs: Any - ) -> ItemPaged["_models.GalleryImage"]: - """List gallery image definitions in a gallery. + 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 + ) -> ItemPaged["_models.VirtualMachineScaleSetVM"]: + """Gets a list of all virtual machines in a VM scale sets. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :return: An iterator like instance of GalleryImage - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.models.GalleryImage] + :param virtual_machine_scale_set_name: The name of the VirtualMachineScaleSet. Required. + :type virtual_machine_scale_set_name: str + :keyword 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. + :paramtype filter: str + :keyword select: The list parameters. Allowed values are 'instanceView', + 'instanceView/statuses'. Default value is None. + :paramtype select: str + :keyword expand: The expand expression to apply to the operation. Allowed values are + 'instanceView'. Default value is None. + :paramtype expand: str + :return: An iterator like instance of VirtualMachineScaleSetVM + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.models.VirtualMachineScaleSetVM] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.GalleryImage]] = kwargs.pop("cls", None) + cls: ClsType[List[_models.VirtualMachineScaleSetVM]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -41426,10 +42046,13 @@ def list_by_gallery( def prepare_request(next_link=None): if not next_link: - _request = build_gallery_images_list_by_gallery_request( + _request = build_virtual_machine_scale_set_vms_list_request( resource_group_name=resource_group_name, - gallery_name=gallery_name, + virtual_machine_scale_set_name=virtual_machine_scale_set_name, subscription_id=self._config.subscription_id, + filter=filter, + select=select, + expand=expand, api_version=self._config.api_version, headers=_headers, params=_params, @@ -41465,7 +42088,7 @@ def prepare_request(next_link=None): def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.GalleryImage], deserialized.get("value", [])) + list_of_elem = _deserialize(List[_models.VirtualMachineScaleSetVM], deserialized.get("value", [])) if cls: list_of_elem = cls(list_of_elem) # type: ignore return deserialized.get("nextLink") or None, iter(list_of_elem) @@ -41488,54 +42111,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - -class GalleryImageVersionsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.compute.ComputeClient`'s - :attr:`gallery_image_versions` attribute. - """ - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ComputeClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def get( - self, - resource_group_name: str, - gallery_name: str, - gallery_image_name: str, - gallery_image_version_name: str, - *, - expand: Optional[Union[str, _models.ReplicationStatusTypes]] = None, - **kwargs: Any - ) -> _models.GalleryImageVersion: - """Retrieves information about a gallery image version. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :param gallery_image_name: The name of the gallery image definition to be retrieved. Required. - :type gallery_image_name: str - :param gallery_image_version_name: The name of the gallery image version to be retrieved. - Required. - :type gallery_image_version_name: str - :keyword expand: The expand expression to apply on the operation. Known values are: - "ReplicationStatus" and "UefiSettings". Default value is None. - :paramtype expand: str or ~azure.mgmt.compute.models.ReplicationStatusTypes - :return: GalleryImageVersion. The GalleryImageVersion is compatible with MutableMapping - :rtype: ~azure.mgmt.compute.models.GalleryImageVersion - :raises ~azure.core.exceptions.HttpResponseError: - """ + def _approve_rolling_upgrade_initial( + self, resource_group_name: str, vm_scale_set_name: str, instance_id: str, **kwargs: Any + ) -> Iterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -41547,15 +42125,13 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.GalleryImageVersion] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - _request = build_gallery_image_versions_get_request( + _request = build_virtual_machine_scale_set_vms_approve_rolling_upgrade_request( resource_group_name=resource_group_name, - gallery_name=gallery_name, - gallery_image_name=gallery_image_name, - gallery_image_version_name=gallery_image_version_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, subscription_id=self._config.subscription_id, - expand=expand, api_version=self._config.api_version, headers=_headers, params=_params, @@ -41565,41 +42141,97 @@ def get( } _request.url = self._client.format_url(_request.url, **path_format_arguments) - _stream = kwargs.pop("stream", False) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200]: - if _stream: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass + if response.status_code not in [202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = _failsafe_deserialize(_models.CloudError, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if _stream: - deserialized = response.iter_bytes() - else: - deserialized = _deserialize(_models.GalleryImageVersion, response.json()) + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore - def _create_or_update_initial( - self, - resource_group_name: str, - gallery_name: str, - gallery_image_name: str, - gallery_image_version_name: str, - gallery_image_version: Union[_models.GalleryImageVersion, JSON, IO[bytes]], - **kwargs: Any + @distributed_trace + def begin_approve_rolling_upgrade( + self, resource_group_name: str, vm_scale_set_name: str, instance_id: str, **kwargs: Any + ) -> LROPoller[None]: + """Approve upgrade on deferred rolling upgrade for OS disk on a VM scale set instance. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. Required. + :type instance_id: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._approve_rolling_upgrade_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + def _deallocate_initial( + self, resource_group_name: str, vm_scale_set_name: str, instance_id: str, **kwargs: Any ) -> Iterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -41609,28 +42241,17 @@ def _create_or_update_initial( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - content_type = content_type or "application/json" - _content = None - if isinstance(gallery_image_version, (IOBase, bytes)): - _content = gallery_image_version - else: - _content = json.dumps(gallery_image_version, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - - _request = build_gallery_image_versions_create_or_update_request( + _request = build_virtual_machine_scale_set_vms_deallocate_request( resource_group_name=resource_group_name, - gallery_name=gallery_name, - gallery_image_name=gallery_image_name, - gallery_image_version_name=gallery_image_version_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, subscription_id=self._config.subscription_id, - content_type=content_type, api_version=self._config.api_version, - content=_content, headers=_headers, params=_params, ) @@ -41646,7 +42267,7 @@ def _create_or_update_initial( response = pipeline_response.http_response - if response.status_code not in [200, 201, 202]: + if response.status_code not in [200, 202]: try: response.read() # Load the body in memory and close the socket except (StreamConsumedError, StreamClosedError): @@ -41656,172 +42277,48 @@ def _create_or_update_initial( raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} - if response.status_code == 201: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - deserialized = response.iter_bytes() - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - gallery_name: str, - gallery_image_name: str, - gallery_image_version_name: str, - gallery_image_version: _models.GalleryImageVersion, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[None]: - """Create or update a gallery image version. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :param gallery_image_name: The name of the gallery image definition to be retrieved. Required. - :type gallery_image_name: str - :param gallery_image_version_name: The name of the gallery image version to be retrieved. - Required. - :type gallery_image_version_name: str - :param gallery_image_version: Parameters supplied to the create or update gallery image version - operation. Required. - :type gallery_image_version: ~azure.mgmt.compute.models.GalleryImageVersion - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns None - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - gallery_name: str, - gallery_image_name: str, - gallery_image_version_name: str, - gallery_image_version: JSON, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[None]: - """Create or update a gallery image version. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :param gallery_image_name: The name of the gallery image definition to be retrieved. Required. - :type gallery_image_name: str - :param gallery_image_version_name: The name of the gallery image version to be retrieved. - Required. - :type gallery_image_version_name: str - :param gallery_image_version: Parameters supplied to the create or update gallery image version - operation. Required. - :type gallery_image_version: JSON - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns None - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ + deserialized = response.iter_bytes() - @overload - def begin_create_or_update( - self, - resource_group_name: str, - gallery_name: str, - gallery_image_name: str, - gallery_image_version_name: str, - gallery_image_version: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[None]: - """Create or update a gallery image version. + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :param gallery_image_name: The name of the gallery image definition to be retrieved. Required. - :type gallery_image_name: str - :param gallery_image_version_name: The name of the gallery image version to be retrieved. - Required. - :type gallery_image_version_name: str - :param gallery_image_version: Parameters supplied to the create or update gallery image version - operation. Required. - :type gallery_image_version: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns None - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ + return deserialized # type: ignore @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - gallery_name: str, - gallery_image_name: str, - gallery_image_version_name: str, - gallery_image_version: Union[_models.GalleryImageVersion, JSON, IO[bytes]], - **kwargs: Any + def begin_deallocate( + self, resource_group_name: str, vm_scale_set_name: str, instance_id: str, **kwargs: Any ) -> LROPoller[None]: - """Create or update a gallery image version. + """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. The name is case insensitive. Required. :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :param gallery_image_name: The name of the gallery image definition to be retrieved. Required. - :type gallery_image_name: str - :param gallery_image_version_name: The name of the gallery image version to be retrieved. - Required. - :type gallery_image_version_name: str - :param gallery_image_version: Parameters supplied to the create or update gallery image version - operation. Is one of the following types: GalleryImageVersion, JSON, IO[bytes] Required. - :type gallery_image_version: ~azure.mgmt.compute.models.GalleryImageVersion or JSON or - IO[bytes] + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. Required. + :type instance_id: str :return: An instance of LROPoller that returns None :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._create_or_update_initial( + raw_result = self._deallocate_initial( resource_group_name=resource_group_name, - gallery_name=gallery_name, - gallery_image_name=gallery_image_name, - gallery_image_version_name=gallery_image_version_name, - gallery_image_version=gallery_image_version, - content_type=content_type, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, cls=lambda x, y, z: x, headers=_headers, params=_params, @@ -41855,13 +42352,86 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - def _update_initial( + @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. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. Required. + :type instance_id: str + :return: VirtualMachineScaleSetVMInstanceView. The VirtualMachineScaleSetVMInstanceView is + compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.VirtualMachineScaleSetVMInstanceView + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.VirtualMachineScaleSetVMInstanceView] = kwargs.pop("cls", None) + + _request = build_virtual_machine_scale_set_vms_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=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.VirtualMachineScaleSetVMInstanceView, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _reimage_initial( self, resource_group_name: str, - gallery_name: str, - gallery_image_name: str, - gallery_image_version_name: str, - gallery_image_version: Union[_models.GalleryImageVersionUpdate, JSON, IO[bytes]], + vm_scale_set_name: str, + instance_id: str, + vm_scale_set_vm_reimage_input: Optional[ + Union[_models.VirtualMachineScaleSetVMReimageParameters, JSON, IO[bytes]] + ] = None, **kwargs: Any ) -> Iterator[bytes]: error_map: MutableMapping = { @@ -41876,20 +42446,23 @@ def _update_initial( _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + content_type = content_type if vm_scale_set_vm_reimage_input else None cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - content_type = content_type or "application/json" + content_type = content_type or "application/json" if vm_scale_set_vm_reimage_input else None _content = None - if isinstance(gallery_image_version, (IOBase, bytes)): - _content = gallery_image_version + if isinstance(vm_scale_set_vm_reimage_input, (IOBase, bytes)): + _content = vm_scale_set_vm_reimage_input else: - _content = json.dumps(gallery_image_version, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + if vm_scale_set_vm_reimage_input is not None: + _content = json.dumps(vm_scale_set_vm_reimage_input, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + else: + _content = None - _request = build_gallery_image_versions_update_request( + _request = build_virtual_machine_scale_set_vms_reimage_request( resource_group_name=resource_group_name, - gallery_name=gallery_name, - gallery_image_name=gallery_image_name, - gallery_image_version_name=gallery_image_version_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, subscription_id=self._config.subscription_id, content_type=content_type, api_version=self._config.api_version, @@ -41909,7 +42482,7 @@ def _update_initial( response = pipeline_response.http_response - if response.status_code not in [200]: + if response.status_code not in [200, 202]: try: response.read() # Load the body in memory and close the socket except (StreamConsumedError, StreamClosedError): @@ -41919,8 +42492,9 @@ def _update_initial( raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) deserialized = response.iter_bytes() @@ -41930,32 +42504,29 @@ def _update_initial( return deserialized # type: ignore @overload - def begin_update( + def begin_reimage( self, resource_group_name: str, - gallery_name: str, - gallery_image_name: str, - gallery_image_version_name: str, - gallery_image_version: _models.GalleryImageVersionUpdate, + vm_scale_set_name: str, + instance_id: str, + vm_scale_set_vm_reimage_input: Optional[_models.VirtualMachineScaleSetVMReimageParameters] = None, *, content_type: str = "application/json", **kwargs: Any ) -> LROPoller[None]: - """Update a gallery image version. + """Reimages (upgrade the operating system) a specific virtual machine in a VM scale set. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :param gallery_image_name: The name of the gallery image definition to be retrieved. Required. - :type gallery_image_name: str - :param gallery_image_version_name: The name of the gallery image version to be retrieved. - Required. - :type gallery_image_version_name: str - :param gallery_image_version: Parameters supplied to the update gallery image version - operation. Required. - :type gallery_image_version: ~azure.mgmt.compute.models.GalleryImageVersionUpdate + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. Required. + :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.models.VirtualMachineScaleSetVMReimageParameters :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -41965,32 +42536,28 @@ def begin_update( """ @overload - def begin_update( + def begin_reimage( self, resource_group_name: str, - gallery_name: str, - gallery_image_name: str, - gallery_image_version_name: str, - gallery_image_version: JSON, + vm_scale_set_name: str, + instance_id: str, + vm_scale_set_vm_reimage_input: Optional[JSON] = None, *, content_type: str = "application/json", **kwargs: Any ) -> LROPoller[None]: - """Update a gallery image version. + """Reimages (upgrade the operating system) a specific virtual machine in a VM scale set. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :param gallery_image_name: The name of the gallery image definition to be retrieved. Required. - :type gallery_image_name: str - :param gallery_image_version_name: The name of the gallery image version to be retrieved. - Required. - :type gallery_image_version_name: str - :param gallery_image_version: Parameters supplied to the update gallery image version - operation. Required. - :type gallery_image_version: JSON + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. Required. + :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: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -42000,32 +42567,28 @@ def begin_update( """ @overload - def begin_update( + def begin_reimage( self, resource_group_name: str, - gallery_name: str, - gallery_image_name: str, - gallery_image_version_name: str, - gallery_image_version: IO[bytes], + vm_scale_set_name: str, + instance_id: str, + vm_scale_set_vm_reimage_input: Optional[IO[bytes]] = None, *, content_type: str = "application/json", **kwargs: Any ) -> LROPoller[None]: - """Update a gallery image version. + """Reimages (upgrade the operating system) a specific virtual machine in a VM scale set. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :param gallery_image_name: The name of the gallery image definition to be retrieved. Required. - :type gallery_image_name: str - :param gallery_image_version_name: The name of the gallery image version to be retrieved. - Required. - :type gallery_image_version_name: str - :param gallery_image_version: Parameters supplied to the update gallery image version - operation. Required. - :type gallery_image_version: IO[bytes] + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. Required. + :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: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str @@ -42035,31 +42598,30 @@ def begin_update( """ @distributed_trace - def begin_update( + def begin_reimage( self, resource_group_name: str, - gallery_name: str, - gallery_image_name: str, - gallery_image_version_name: str, - gallery_image_version: Union[_models.GalleryImageVersionUpdate, JSON, IO[bytes]], + vm_scale_set_name: str, + instance_id: str, + vm_scale_set_vm_reimage_input: Optional[ + Union[_models.VirtualMachineScaleSetVMReimageParameters, JSON, IO[bytes]] + ] = None, **kwargs: Any ) -> LROPoller[None]: - """Update a gallery image version. + """Reimages (upgrade the operating system) a specific virtual machine in a VM scale set. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :param gallery_image_name: The name of the gallery image definition to be retrieved. Required. - :type gallery_image_name: str - :param gallery_image_version_name: The name of the gallery image version to be retrieved. - Required. - :type gallery_image_version_name: str - :param gallery_image_version: Parameters supplied to the update gallery image version - operation. Is one of the following types: GalleryImageVersionUpdate, JSON, IO[bytes] Required. - :type gallery_image_version: ~azure.mgmt.compute.models.GalleryImageVersionUpdate or JSON or - IO[bytes] + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. Required. + :type instance_id: str + :param vm_scale_set_vm_reimage_input: Parameters for the Reimaging Virtual machine in ScaleSet. + Is one of the following types: VirtualMachineScaleSetVMReimageParameters, JSON, IO[bytes] + Default value is None. + :type vm_scale_set_vm_reimage_input: + ~azure.mgmt.compute.models.VirtualMachineScaleSetVMReimageParameters or JSON or IO[bytes] :return: An instance of LROPoller that returns None :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -42068,17 +42630,17 @@ def begin_update( _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + content_type = content_type if vm_scale_set_vm_reimage_input else None cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._update_initial( + raw_result = self._reimage_initial( resource_group_name=resource_group_name, - gallery_name=gallery_name, - gallery_image_name=gallery_image_name, - gallery_image_version_name=gallery_image_version_name, - gallery_image_version=gallery_image_version, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + vm_scale_set_vm_reimage_input=vm_scale_set_vm_reimage_input, content_type=content_type, cls=lambda x, y, z: x, headers=_headers, @@ -42113,13 +42675,8 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - def _delete_initial( - self, - resource_group_name: str, - gallery_name: str, - gallery_image_name: str, - gallery_image_version_name: str, - **kwargs: Any + def _reimage_all_initial( + self, resource_group_name: str, vm_scale_set_name: str, instance_id: str, **kwargs: Any ) -> Iterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -42134,11 +42691,10 @@ def _delete_initial( cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - _request = build_gallery_image_versions_delete_request( + _request = build_virtual_machine_scale_set_vms_reimage_all_request( resource_group_name=resource_group_name, - gallery_name=gallery_name, - gallery_image_name=gallery_image_name, - gallery_image_version_name=gallery_image_version_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -42156,7 +42712,7 @@ def _delete_initial( response = pipeline_response.http_response - if response.status_code not in [200, 202, 204]: + if response.status_code not in [200, 202]: try: response.read() # Load the body in memory and close the socket except (StreamConsumedError, StreamClosedError): @@ -42178,26 +42734,19 @@ def _delete_initial( return deserialized # type: ignore @distributed_trace - def begin_delete( - self, - resource_group_name: str, - gallery_name: str, - gallery_image_name: str, - gallery_image_version_name: str, - **kwargs: Any + def begin_reimage_all( + self, resource_group_name: str, vm_scale_set_name: str, instance_id: str, **kwargs: Any ) -> LROPoller[None]: - """Delete a gallery image version. + """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. The name is case insensitive. Required. :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :param gallery_image_name: The name of the gallery image definition to be retrieved. Required. - :type gallery_image_name: str - :param gallery_image_version_name: The name of the gallery image version to be retrieved. - Required. - :type gallery_image_version_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. Required. + :type instance_id: str :return: An instance of LROPoller that returns None :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -42210,11 +42759,10 @@ def begin_delete( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._delete_initial( + raw_result = self._reimage_all_initial( resource_group_name=resource_group_name, - gallery_name=gallery_name, - gallery_image_name=gallery_image_name, - gallery_image_version_name=gallery_image_version_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, cls=lambda x, y, z: x, headers=_headers, params=_params, @@ -42225,159 +42773,44 @@ def begin_delete( def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, None, {}) # type: ignore - - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list_by_gallery_image( - self, resource_group_name: str, gallery_name: str, gallery_image_name: str, **kwargs: Any - ) -> ItemPaged["_models.GalleryImageVersion"]: - """List gallery image versions in a gallery image definition. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :param gallery_image_name: The name of the gallery image definition to be retrieved. Required. - :type gallery_image_name: str - :return: An iterator like instance of GalleryImageVersion - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.models.GalleryImageVersion] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[List[_models.GalleryImageVersion]] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_gallery_image_versions_list_by_gallery_image_request( - resource_group_name=resource_group_name, - gallery_name=gallery_name, - gallery_image_name=gallery_image_name, - subscription_id=self._config.subscription_id, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - return _request - - def extract_data(pipeline_response): - deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.GalleryImageVersion], deserialized.get("value", [])) - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.get("nextLink") or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.CloudError, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - -class GalleryApplicationsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.compute.ComputeClient`'s - :attr:`gallery_applications` attribute. - """ + return cls(pipeline_response, None, {}) # type: ignore - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ComputeClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore @distributed_trace - def get( - self, resource_group_name: str, gallery_name: str, gallery_application_name: str, **kwargs: Any - ) -> _models.GalleryApplication: - """Retrieves information about a gallery Application Definition. + 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. The name is case insensitive. Required. :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :param gallery_application_name: The name of the gallery Application Definition to be - retrieved. Required. - :type gallery_application_name: str - :return: GalleryApplication. The GalleryApplication is compatible with MutableMapping - :rtype: ~azure.mgmt.compute.models.GalleryApplication + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. Required. + :type instance_id: str + :return: None + :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -42391,12 +42824,12 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.GalleryApplication] = kwargs.pop("cls", None) + cls: ClsType[None] = kwargs.pop("cls", None) - _request = build_gallery_applications_get_request( + _request = build_virtual_machine_scale_set_vms_simulate_eviction_request( resource_group_name=resource_group_name, - gallery_name=gallery_name, - gallery_application_name=gallery_application_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -42407,39 +42840,27 @@ def get( } _request.url = self._client.format_url(_request.url, **path_format_arguments) - _stream = kwargs.pop("stream", False) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200]: - if _stream: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass + if response.status_code not in [204]: map_error(status_code=response.status_code, response=response, error_map=error_map) error = _failsafe_deserialize(_models.CloudError, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if _stream: - deserialized = response.iter_bytes() - else: - deserialized = _deserialize(_models.GalleryApplication, response.json()) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore + return cls(pipeline_response, None, {}) # type: ignore - def _create_or_update_initial( + def _attach_detach_data_disks_initial( self, resource_group_name: str, - gallery_name: str, - gallery_application_name: str, - gallery_application: Union[_models.GalleryApplication, JSON, IO[bytes]], + vm_scale_set_name: str, + instance_id: str, + parameters: Union[_models.AttachDetachDataDisksRequest, JSON, IO[bytes]], **kwargs: Any ) -> Iterator[bytes]: error_map: MutableMapping = { @@ -42458,15 +42879,15 @@ def _create_or_update_initial( content_type = content_type or "application/json" _content = None - if isinstance(gallery_application, (IOBase, bytes)): - _content = gallery_application + if isinstance(parameters, (IOBase, bytes)): + _content = parameters else: - _content = json.dumps(gallery_application, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - _request = build_gallery_applications_create_or_update_request( + _request = build_virtual_machine_scale_set_vms_attach_detach_data_disks_request( resource_group_name=resource_group_name, - gallery_name=gallery_name, - gallery_application_name=gallery_application_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, subscription_id=self._config.subscription_id, content_type=content_type, api_version=self._config.api_version, @@ -42486,7 +42907,7 @@ def _create_or_update_initial( response = pipeline_response.http_response - if response.status_code not in [200, 201, 202]: + if response.status_code not in [200, 202]: try: response.read() # Load the body in memory and close the socket except (StreamConsumedError, StreamClosedError): @@ -42496,10 +42917,6 @@ def _create_or_update_initial( raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} - if response.status_code == 201: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) @@ -42512,141 +42929,142 @@ def _create_or_update_initial( return deserialized # type: ignore @overload - def begin_create_or_update( + def begin_attach_detach_data_disks( self, resource_group_name: str, - gallery_name: str, - gallery_application_name: str, - gallery_application: _models.GalleryApplication, + vm_scale_set_name: str, + instance_id: str, + parameters: _models.AttachDetachDataDisksRequest, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[None]: - """Create or update a gallery Application Definition. + ) -> LROPoller[_models.StorageProfile]: + """Attach and detach data disks to/from a virtual machine in a VM scale set. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :param gallery_application_name: The name of the gallery Application Definition to be - retrieved. Required. - :type gallery_application_name: str - :param gallery_application: Parameters supplied to the create or update gallery Application - operation. Required. - :type gallery_application: ~azure.mgmt.compute.models.GalleryApplication + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. Required. + :type instance_id: str + :param parameters: Parameters supplied to the attach and detach data disks operation on a + Virtual Machine Scale Sets VM. Required. + :type parameters: ~azure.mgmt.compute.models.AttachDetachDataDisksRequest :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns None - :rtype: ~azure.core.polling.LROPoller[None] + :return: An instance of LROPoller that returns StorageProfile. The StorageProfile is compatible + with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.StorageProfile] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def begin_create_or_update( + def begin_attach_detach_data_disks( self, resource_group_name: str, - gallery_name: str, - gallery_application_name: str, - gallery_application: JSON, + vm_scale_set_name: str, + instance_id: str, + parameters: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[None]: - """Create or update a gallery Application Definition. + ) -> LROPoller[_models.StorageProfile]: + """Attach and detach data disks to/from a virtual machine in a VM scale set. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :param gallery_application_name: The name of the gallery Application Definition to be - retrieved. Required. - :type gallery_application_name: str - :param gallery_application: Parameters supplied to the create or update gallery Application - operation. Required. - :type gallery_application: JSON + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. Required. + :type instance_id: str + :param parameters: Parameters supplied to the attach and detach data disks operation on a + Virtual Machine Scale Sets VM. Required. + :type parameters: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns None - :rtype: ~azure.core.polling.LROPoller[None] + :return: An instance of LROPoller that returns StorageProfile. The StorageProfile is compatible + with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.StorageProfile] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def begin_create_or_update( + def begin_attach_detach_data_disks( self, resource_group_name: str, - gallery_name: str, - gallery_application_name: str, - gallery_application: IO[bytes], + vm_scale_set_name: str, + instance_id: str, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[None]: - """Create or update a gallery Application Definition. + ) -> LROPoller[_models.StorageProfile]: + """Attach and detach data disks to/from a virtual machine in a VM scale set. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :param gallery_application_name: The name of the gallery Application Definition to be - retrieved. Required. - :type gallery_application_name: str - :param gallery_application: Parameters supplied to the create or update gallery Application - operation. Required. - :type gallery_application: IO[bytes] + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. Required. + :type instance_id: str + :param parameters: Parameters supplied to the attach and detach data disks operation on a + Virtual Machine Scale Sets VM. Required. + :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns None - :rtype: ~azure.core.polling.LROPoller[None] + :return: An instance of LROPoller that returns StorageProfile. The StorageProfile is compatible + with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.StorageProfile] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace - def begin_create_or_update( + def begin_attach_detach_data_disks( self, resource_group_name: str, - gallery_name: str, - gallery_application_name: str, - gallery_application: Union[_models.GalleryApplication, JSON, IO[bytes]], + vm_scale_set_name: str, + instance_id: str, + parameters: Union[_models.AttachDetachDataDisksRequest, JSON, IO[bytes]], **kwargs: Any - ) -> LROPoller[None]: - """Create or update a gallery Application Definition. + ) -> LROPoller[_models.StorageProfile]: + """Attach and detach data disks to/from a virtual machine in a VM scale set. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :param gallery_application_name: The name of the gallery Application Definition to be - retrieved. Required. - :type gallery_application_name: str - :param gallery_application: Parameters supplied to the create or update gallery Application - operation. Is one of the following types: GalleryApplication, JSON, IO[bytes] Required. - :type gallery_application: ~azure.mgmt.compute.models.GalleryApplication or JSON or IO[bytes] - :return: An instance of LROPoller that returns None - :rtype: ~azure.core.polling.LROPoller[None] + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. Required. + :type instance_id: str + :param parameters: Parameters supplied to the attach and detach data disks operation on a + Virtual Machine Scale Sets VM. Is one of the following types: AttachDetachDataDisksRequest, + JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.compute.models.AttachDetachDataDisksRequest or JSON or IO[bytes] + :return: An instance of LROPoller that returns StorageProfile. The StorageProfile is compatible + with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.StorageProfile] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[_models.StorageProfile] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._create_or_update_initial( + raw_result = self._attach_detach_data_disks_initial( resource_group_name=resource_group_name, - gallery_name=gallery_name, - gallery_application_name=gallery_application_name, - gallery_application=gallery_application, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + parameters=parameters, content_type=content_type, cls=lambda x, y, z: x, headers=_headers, @@ -42656,9 +43074,16 @@ def begin_create_or_update( raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = _deserialize(_models.StorageProfile, response.json()) if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore + return deserialized path_format_arguments = { "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), @@ -42673,21 +43098,18 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return LROPoller[None].from_continuation_token( + return LROPoller[_models.StorageProfile].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + return LROPoller[_models.StorageProfile]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) - def _update_initial( - self, - resource_group_name: str, - gallery_name: str, - gallery_application_name: str, - gallery_application: Union[_models.GalleryApplicationUpdate, JSON, IO[bytes]], - **kwargs: Any + def _perform_maintenance_initial( + self, resource_group_name: str, vm_scale_set_name: str, instance_id: str, **kwargs: Any ) -> Iterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -42697,27 +43119,17 @@ def _update_initial( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - content_type = content_type or "application/json" - _content = None - if isinstance(gallery_application, (IOBase, bytes)): - _content = gallery_application - else: - _content = json.dumps(gallery_application, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - - _request = build_gallery_applications_update_request( + _request = build_virtual_machine_scale_set_vms_perform_maintenance_request( resource_group_name=resource_group_name, - gallery_name=gallery_name, - gallery_application_name=gallery_application_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, subscription_id=self._config.subscription_id, - content_type=content_type, api_version=self._config.api_version, - content=_content, headers=_headers, params=_params, ) @@ -42733,7 +43145,7 @@ def _update_initial( response = pipeline_response.http_response - if response.status_code not in [200]: + if response.status_code not in [200, 202]: try: response.read() # Load the body in memory and close the socket except (StreamConsumedError, StreamClosedError): @@ -42743,8 +43155,9 @@ def _update_initial( raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) deserialized = response.iter_bytes() @@ -42753,144 +43166,175 @@ def _update_initial( return deserialized # type: ignore - @overload - def begin_update( - self, - resource_group_name: str, - gallery_name: str, - gallery_application_name: str, - gallery_application: _models.GalleryApplicationUpdate, - *, - content_type: str = "application/json", - **kwargs: Any + @distributed_trace + def begin_perform_maintenance( + self, resource_group_name: str, vm_scale_set_name: str, instance_id: str, **kwargs: Any ) -> LROPoller[None]: - """Update a gallery Application Definition. + """Performs maintenance on a virtual machine in a VM scale set. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :param gallery_application_name: The name of the gallery Application Definition to be - retrieved. Required. - :type gallery_application_name: str - :param gallery_application: Parameters supplied to the update gallery Application operation. - Required. - :type gallery_application: ~azure.mgmt.compute.models.GalleryApplicationUpdate - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. Required. + :type instance_id: str :return: An instance of LROPoller that returns None :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} - @overload - def begin_update( - self, - resource_group_name: str, - gallery_name: str, - gallery_application_name: str, - gallery_application: JSON, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[None]: - """Update a gallery Application Definition. + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._perform_maintenance_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :param gallery_application_name: The name of the gallery Application Definition to be - retrieved. Required. - :type gallery_application_name: str - :param gallery_application: Parameters supplied to the update gallery Application operation. - Required. - :type gallery_application: JSON - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns None - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore - @overload - def begin_update( + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + def _power_off_initial( self, resource_group_name: str, - gallery_name: str, - gallery_application_name: str, - gallery_application: IO[bytes], + vm_scale_set_name: str, + instance_id: str, *, - content_type: str = "application/json", + skip_shutdown: Optional[bool] = None, **kwargs: Any - ) -> LROPoller[None]: - """Update a gallery Application Definition. + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :param gallery_application_name: The name of the gallery Application Definition to be - retrieved. Required. - :type gallery_application_name: str - :param gallery_application: Parameters supplied to the update gallery Application operation. - Required. - :type gallery_application: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns None - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_virtual_machine_scale_set_vms_power_off_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + skip_shutdown=skip_shutdown, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore @distributed_trace - def begin_update( + def begin_power_off( self, resource_group_name: str, - gallery_name: str, - gallery_application_name: str, - gallery_application: Union[_models.GalleryApplicationUpdate, JSON, IO[bytes]], + vm_scale_set_name: str, + instance_id: str, + *, + skip_shutdown: Optional[bool] = None, **kwargs: Any ) -> LROPoller[None]: - """Update a gallery Application Definition. + """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. The name is case insensitive. Required. :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :param gallery_application_name: The name of the gallery Application Definition to be - retrieved. Required. - :type gallery_application_name: str - :param gallery_application: Parameters supplied to the update gallery Application operation. Is - one of the following types: GalleryApplicationUpdate, JSON, IO[bytes] Required. - :type gallery_application: ~azure.mgmt.compute.models.GalleryApplicationUpdate or JSON or - IO[bytes] + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. Required. + :type instance_id: str + :keyword 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 None. + :paramtype skip_shutdown: bool :return: An instance of LROPoller that returns None :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._update_initial( + raw_result = self._power_off_initial( resource_group_name=resource_group_name, - gallery_name=gallery_name, - gallery_application_name=gallery_application_name, - gallery_application=gallery_application, - content_type=content_type, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + skip_shutdown=skip_shutdown, cls=lambda x, y, z: x, headers=_headers, params=_params, @@ -42924,8 +43368,8 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - def _delete_initial( - self, resource_group_name: str, gallery_name: str, gallery_application_name: str, **kwargs: Any + def _redeploy_initial( + self, resource_group_name: str, vm_scale_set_name: str, instance_id: str, **kwargs: Any ) -> Iterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -42940,10 +43384,10 @@ def _delete_initial( cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - _request = build_gallery_applications_delete_request( + _request = build_virtual_machine_scale_set_vms_redeploy_request( resource_group_name=resource_group_name, - gallery_name=gallery_name, - gallery_application_name=gallery_application_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -42961,7 +43405,7 @@ def _delete_initial( response = pipeline_response.http_response - if response.status_code not in [200, 202, 204]: + if response.status_code not in [200, 202]: try: response.read() # Load the body in memory and close the socket except (StreamConsumedError, StreamClosedError): @@ -42983,19 +43427,19 @@ def _delete_initial( return deserialized # type: ignore @distributed_trace - def begin_delete( - self, resource_group_name: str, gallery_name: str, gallery_application_name: str, **kwargs: Any + def begin_redeploy( + self, resource_group_name: str, vm_scale_set_name: str, instance_id: str, **kwargs: Any ) -> LROPoller[None]: - """Delete a gallery Application. + """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. The name is case insensitive. Required. :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :param gallery_application_name: The name of the gallery Application Definition to be - retrieved. Required. - :type gallery_application_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. Required. + :type instance_id: str :return: An instance of LROPoller that returns None :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -43008,10 +43452,10 @@ def begin_delete( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._delete_initial( + raw_result = self._redeploy_initial( resource_group_name=resource_group_name, - gallery_name=gallery_name, - gallery_application_name=gallery_application_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, cls=lambda x, y, z: x, headers=_headers, params=_params, @@ -43045,213 +43489,8 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - @distributed_trace - def list_by_gallery( - self, resource_group_name: str, gallery_name: str, **kwargs: Any - ) -> ItemPaged["_models.GalleryApplication"]: - """List gallery Application Definitions in a gallery. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :return: An iterator like instance of GalleryApplication - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.models.GalleryApplication] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[List[_models.GalleryApplication]] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_gallery_applications_list_by_gallery_request( - resource_group_name=resource_group_name, - gallery_name=gallery_name, - subscription_id=self._config.subscription_id, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - return _request - - def extract_data(pipeline_response): - deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.GalleryApplication], deserialized.get("value", [])) - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.get("nextLink") or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.CloudError, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - -class GalleryApplicationVersionsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.compute.ComputeClient`'s - :attr:`gallery_application_versions` attribute. - """ - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ComputeClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def get( - self, - resource_group_name: str, - gallery_name: str, - gallery_application_name: str, - gallery_application_version_name: str, - *, - expand: Optional[Union[str, _models.ReplicationStatusTypes]] = None, - **kwargs: Any - ) -> _models.GalleryApplicationVersion: - """Retrieves information about a gallery Application Version. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :param gallery_application_name: The name of the gallery Application Definition to be - retrieved. Required. - :type gallery_application_name: str - :param gallery_application_version_name: The name of the gallery Application Version to be - retrieved. Required. - :type gallery_application_version_name: str - :keyword expand: The expand expression to apply on the operation. Known values are: - "ReplicationStatus" and "UefiSettings". Default value is None. - :paramtype expand: str or ~azure.mgmt.compute.models.ReplicationStatusTypes - :return: GalleryApplicationVersion. The GalleryApplicationVersion is compatible with - MutableMapping - :rtype: ~azure.mgmt.compute.models.GalleryApplicationVersion - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[_models.GalleryApplicationVersion] = kwargs.pop("cls", None) - - _request = build_gallery_application_versions_get_request( - resource_group_name=resource_group_name, - gallery_name=gallery_name, - gallery_application_name=gallery_application_name, - gallery_application_version_name=gallery_application_version_name, - subscription_id=self._config.subscription_id, - expand=expand, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = kwargs.pop("stream", False) - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - if _stream: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.CloudError, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if _stream: - deserialized = response.iter_bytes() - else: - deserialized = _deserialize(_models.GalleryApplicationVersion, response.json()) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - gallery_name: str, - gallery_application_name: str, - gallery_application_version_name: str, - gallery_application_version: Union[_models.GalleryApplicationVersion, JSON, IO[bytes]], - **kwargs: Any + def _restart_initial( + self, resource_group_name: str, vm_scale_set_name: str, instance_id: str, **kwargs: Any ) -> Iterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -43261,28 +43500,17 @@ def _create_or_update_initial( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - content_type = content_type or "application/json" - _content = None - if isinstance(gallery_application_version, (IOBase, bytes)): - _content = gallery_application_version - else: - _content = json.dumps(gallery_application_version, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - - _request = build_gallery_application_versions_create_or_update_request( + _request = build_virtual_machine_scale_set_vms_restart_request( resource_group_name=resource_group_name, - gallery_name=gallery_name, - gallery_application_name=gallery_application_name, - gallery_application_version_name=gallery_application_version_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, subscription_id=self._config.subscription_id, - content_type=content_type, api_version=self._config.api_version, - content=_content, headers=_headers, params=_params, ) @@ -43298,7 +43526,7 @@ def _create_or_update_initial( response = pipeline_response.http_response - if response.status_code not in [200, 201, 202]: + if response.status_code not in [200, 202]: try: response.read() # Load the body in memory and close the socket except (StreamConsumedError, StreamClosedError): @@ -43308,10 +43536,6 @@ def _create_or_update_initial( raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} - if response.status_code == 201: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) @@ -43323,166 +43547,35 @@ def _create_or_update_initial( return deserialized # type: ignore - @overload - def begin_create_or_update( - self, - resource_group_name: str, - gallery_name: str, - gallery_application_name: str, - gallery_application_version_name: str, - gallery_application_version: _models.GalleryApplicationVersion, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.GalleryApplicationVersion]: - """Create or update a gallery Application Version. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :param gallery_application_name: The name of the gallery Application Definition to be - retrieved. Required. - :type gallery_application_name: str - :param gallery_application_version_name: The name of the gallery Application Version to be - retrieved. Required. - :type gallery_application_version_name: str - :param gallery_application_version: Parameters supplied to the create or update gallery - Application Version operation. Required. - :type gallery_application_version: ~azure.mgmt.compute.models.GalleryApplicationVersion - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns GalleryApplicationVersion. The - GalleryApplicationVersion is compatible with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.GalleryApplicationVersion] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - gallery_name: str, - gallery_application_name: str, - gallery_application_version_name: str, - gallery_application_version: JSON, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.GalleryApplicationVersion]: - """Create or update a gallery Application Version. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :param gallery_application_name: The name of the gallery Application Definition to be - retrieved. Required. - :type gallery_application_name: str - :param gallery_application_version_name: The name of the gallery Application Version to be - retrieved. Required. - :type gallery_application_version_name: str - :param gallery_application_version: Parameters supplied to the create or update gallery - Application Version operation. Required. - :type gallery_application_version: JSON - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns GalleryApplicationVersion. The - GalleryApplicationVersion is compatible with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.GalleryApplicationVersion] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - gallery_name: str, - gallery_application_name: str, - gallery_application_version_name: str, - gallery_application_version: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.GalleryApplicationVersion]: - """Create or update a gallery Application Version. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :param gallery_application_name: The name of the gallery Application Definition to be - retrieved. Required. - :type gallery_application_name: str - :param gallery_application_version_name: The name of the gallery Application Version to be - retrieved. Required. - :type gallery_application_version_name: str - :param gallery_application_version: Parameters supplied to the create or update gallery - Application Version operation. Required. - :type gallery_application_version: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns GalleryApplicationVersion. The - GalleryApplicationVersion is compatible with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.GalleryApplicationVersion] - :raises ~azure.core.exceptions.HttpResponseError: - """ - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - gallery_name: str, - gallery_application_name: str, - gallery_application_version_name: str, - gallery_application_version: Union[_models.GalleryApplicationVersion, JSON, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.GalleryApplicationVersion]: - """Create or update a gallery Application Version. + def begin_restart( + 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. The name is case insensitive. Required. :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :param gallery_application_name: The name of the gallery Application Definition to be - retrieved. Required. - :type gallery_application_name: str - :param gallery_application_version_name: The name of the gallery Application Version to be - retrieved. Required. - :type gallery_application_version_name: str - :param gallery_application_version: Parameters supplied to the create or update gallery - Application Version operation. Is one of the following types: GalleryApplicationVersion, JSON, - IO[bytes] Required. - :type gallery_application_version: ~azure.mgmt.compute.models.GalleryApplicationVersion or JSON - or IO[bytes] - :return: An instance of LROPoller that returns GalleryApplicationVersion. The - GalleryApplicationVersion is compatible with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.GalleryApplicationVersion] + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. Required. + :type instance_id: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.GalleryApplicationVersion] = kwargs.pop("cls", None) + cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._create_or_update_initial( + raw_result = self._restart_initial( resource_group_name=resource_group_name, - gallery_name=gallery_name, - gallery_application_name=gallery_application_name, - gallery_application_version_name=gallery_application_version_name, - gallery_application_version=gallery_application_version, - content_type=content_type, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, cls=lambda x, y, z: x, headers=_headers, params=_params, @@ -43491,44 +43584,117 @@ def begin_create_or_update( raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = _deserialize(_models.GalleryApplicationVersion, response.json()) + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # 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. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. Required. + :type instance_id: str + :keyword sas_uri_expiration_time_in_minutes: Expiration duration in minutes for the SAS URIs + with a value between 1 to 1440 minutes. **Note:** If not specified, SAS URIs will be generated + with a default expiration duration of 120 minutes. Default value is None. + :paramtype sas_uri_expiration_time_in_minutes: int + :return: RetrieveBootDiagnosticsDataResult. The RetrieveBootDiagnosticsDataResult is compatible + with MutableMapping + :rtype: ~azure.mgmt.compute.models.RetrieveBootDiagnosticsDataResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + cls: ClsType[_models.RetrieveBootDiagnosticsDataResult] = kwargs.pop("cls", None) + + _request = build_virtual_machine_scale_set_vms_retrieve_boot_diagnostics_data_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + sas_uri_expiration_time_in_minutes=sas_uri_expiration_time_in_minutes, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) path_format_arguments = { "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), } + _request.url = self._client.format_url(_request.url, **path_format_arguments) - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.GalleryApplicationVersion].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.GalleryApplicationVersion]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs ) - def _update_initial( - self, - resource_group_name: str, - gallery_name: str, - gallery_application_name: str, - gallery_application_version_name: str, - gallery_application_version: Union[_models.GalleryApplicationVersionUpdate, JSON, IO[bytes]], - **kwargs: Any + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.RetrieveBootDiagnosticsDataResult, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _start_initial( + self, resource_group_name: str, vm_scale_set_name: str, instance_id: str, **kwargs: Any ) -> Iterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -43538,28 +43704,17 @@ def _update_initial( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - content_type = content_type or "application/json" - _content = None - if isinstance(gallery_application_version, (IOBase, bytes)): - _content = gallery_application_version - else: - _content = json.dumps(gallery_application_version, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - - _request = build_gallery_application_versions_update_request( + _request = build_virtual_machine_scale_set_vms_start_request( resource_group_name=resource_group_name, - gallery_name=gallery_name, - gallery_application_name=gallery_application_name, - gallery_application_version_name=gallery_application_version_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, subscription_id=self._config.subscription_id, - content_type=content_type, api_version=self._config.api_version, - content=_content, headers=_headers, params=_params, ) @@ -43575,7 +43730,7 @@ def _update_initial( response = pipeline_response.http_response - if response.status_code not in [200]: + if response.status_code not in [200, 202]: try: response.read() # Load the body in memory and close the socket except (StreamConsumedError, StreamClosedError): @@ -43585,8 +43740,9 @@ def _update_initial( raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) deserialized = response.iter_bytes() @@ -43595,162 +43751,35 @@ def _update_initial( return deserialized # type: ignore - @overload - def begin_update( - self, - resource_group_name: str, - gallery_name: str, - gallery_application_name: str, - gallery_application_version_name: str, - gallery_application_version: _models.GalleryApplicationVersionUpdate, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[None]: - """Update a gallery Application Version. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :param gallery_application_name: The name of the gallery Application Definition to be - retrieved. Required. - :type gallery_application_name: str - :param gallery_application_version_name: The name of the gallery Application Version to be - retrieved. Required. - :type gallery_application_version_name: str - :param gallery_application_version: Parameters supplied to the update gallery Application - Version operation. Required. - :type gallery_application_version: ~azure.mgmt.compute.models.GalleryApplicationVersionUpdate - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns None - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update( - self, - resource_group_name: str, - gallery_name: str, - gallery_application_name: str, - gallery_application_version_name: str, - gallery_application_version: JSON, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[None]: - """Update a gallery Application Version. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :param gallery_application_name: The name of the gallery Application Definition to be - retrieved. Required. - :type gallery_application_name: str - :param gallery_application_version_name: The name of the gallery Application Version to be - retrieved. Required. - :type gallery_application_version_name: str - :param gallery_application_version: Parameters supplied to the update gallery Application - Version operation. Required. - :type gallery_application_version: JSON - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns None - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update( - self, - resource_group_name: str, - gallery_name: str, - gallery_application_name: str, - gallery_application_version_name: str, - gallery_application_version: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[None]: - """Update a gallery Application Version. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :param gallery_application_name: The name of the gallery Application Definition to be - retrieved. Required. - :type gallery_application_name: str - :param gallery_application_version_name: The name of the gallery Application Version to be - retrieved. Required. - :type gallery_application_version_name: str - :param gallery_application_version: Parameters supplied to the update gallery Application - Version operation. Required. - :type gallery_application_version: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns None - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - @distributed_trace - def begin_update( - self, - resource_group_name: str, - gallery_name: str, - gallery_application_name: str, - gallery_application_version_name: str, - gallery_application_version: Union[_models.GalleryApplicationVersionUpdate, JSON, IO[bytes]], - **kwargs: Any + def begin_start( + self, resource_group_name: str, vm_scale_set_name: str, instance_id: str, **kwargs: Any ) -> LROPoller[None]: - """Update a gallery Application Version. + """Starts a virtual machine in a VM scale set. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :param gallery_application_name: The name of the gallery Application Definition to be - retrieved. Required. - :type gallery_application_name: str - :param gallery_application_version_name: The name of the gallery Application Version to be - retrieved. Required. - :type gallery_application_version_name: str - :param gallery_application_version: Parameters supplied to the update gallery Application - Version operation. Is one of the following types: GalleryApplicationVersionUpdate, JSON, - IO[bytes] Required. - :type gallery_application_version: ~azure.mgmt.compute.models.GalleryApplicationVersionUpdate - or JSON or IO[bytes] + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. Required. + :type instance_id: str :return: An instance of LROPoller that returns None :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._update_initial( + raw_result = self._start_initial( resource_group_name=resource_group_name, - gallery_name=gallery_name, - gallery_application_name=gallery_application_name, - gallery_application_version_name=gallery_application_version_name, - gallery_application_version=gallery_application_version, - content_type=content_type, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, cls=lambda x, y, z: x, headers=_headers, params=_params, @@ -43784,12 +43813,12 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - def _delete_initial( + def _run_command_initial( self, resource_group_name: str, - gallery_name: str, - gallery_application_name: str, - gallery_application_version_name: str, + vm_scale_set_name: str, + instance_id: str, + parameters: Union[_models.RunCommandInput, JSON, IO[bytes]], **kwargs: Any ) -> Iterator[bytes]: error_map: MutableMapping = { @@ -43800,18 +43829,27 @@ def _delete_initial( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - _request = build_gallery_application_versions_delete_request( + content_type = content_type or "application/json" + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_virtual_machine_scale_set_vms_run_command_request( resource_group_name=resource_group_name, - gallery_name=gallery_name, - gallery_application_name=gallery_application_name, - gallery_application_version_name=gallery_application_version_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, subscription_id=self._config.subscription_id, + content_type=content_type, api_version=self._config.api_version, + content=_content, headers=_headers, params=_params, ) @@ -43827,7 +43865,7 @@ def _delete_initial( response = pipeline_response.http_response - if response.status_code not in [200, 202, 204]: + if response.status_code not in [200, 202]: try: response.read() # Load the body in memory and close the socket except (StreamConsumedError, StreamClosedError): @@ -43848,45 +43886,140 @@ def _delete_initial( return deserialized # type: ignore + @overload + def begin_run_command( + self, + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + parameters: _models.RunCommandInput, + *, + content_type: 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. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. Required. + :type instance_id: str + :param parameters: Parameters supplied to the Run command operation. Required. + :type parameters: ~azure.mgmt.compute.models.RunCommandInput + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns RunCommandResult. The RunCommandResult is + compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.RunCommandResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_run_command( + self, + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + parameters: JSON, + *, + content_type: 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. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. Required. + :type instance_id: str + :param parameters: Parameters supplied to the Run command operation. Required. + :type parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns RunCommandResult. The RunCommandResult is + compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.RunCommandResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_run_command( + self, + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + parameters: IO[bytes], + *, + content_type: 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. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. Required. + :type instance_id: str + :param parameters: Parameters supplied to the Run command operation. Required. + :type parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns RunCommandResult. The RunCommandResult is + compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.RunCommandResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + @distributed_trace - def begin_delete( + def begin_run_command( self, resource_group_name: str, - gallery_name: str, - gallery_application_name: str, - gallery_application_version_name: str, + vm_scale_set_name: str, + instance_id: str, + parameters: Union[_models.RunCommandInput, JSON, IO[bytes]], **kwargs: Any - ) -> LROPoller[None]: - """Delete a gallery Application Version. + ) -> LROPoller[_models.RunCommandResult]: + """Run command on a virtual machine in a VM scale set. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :param gallery_application_name: The name of the gallery Application Definition to be - retrieved. Required. - :type gallery_application_name: str - :param gallery_application_version_name: The name of the gallery Application Version to be - retrieved. Required. - :type gallery_application_version_name: str - :return: An instance of LROPoller that returns None - :rtype: ~azure.core.polling.LROPoller[None] + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. Required. + :type instance_id: str + :param parameters: Parameters supplied to the Run command operation. Is one of the following + types: RunCommandInput, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.compute.models.RunCommandInput or JSON or IO[bytes] + :return: An instance of LROPoller that returns RunCommandResult. The RunCommandResult is + compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.RunCommandResult] :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = kwargs.pop("headers", {}) or {} + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - cls: ClsType[None] = kwargs.pop("cls", None) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.RunCommandResult] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._delete_initial( + raw_result = self._run_command_initial( resource_group_name=resource_group_name, - gallery_name=gallery_name, - gallery_application_name=gallery_application_name, - gallery_application_version_name=gallery_application_version_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + parameters=parameters, + content_type=content_type, cls=lambda x, y, z: x, headers=_headers, params=_params, @@ -43895,9 +44028,16 @@ def begin_delete( raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = _deserialize(_models.RunCommandResult, response.json()) if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore + return deserialized path_format_arguments = { "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), @@ -43912,120 +44052,25 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return LROPoller[None].from_continuation_token( + return LROPoller[_models.RunCommandResult].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list_by_gallery_application( - self, resource_group_name: str, gallery_name: str, gallery_application_name: str, **kwargs: Any - ) -> ItemPaged["_models.GalleryApplicationVersion"]: - """List gallery Application Versions in a gallery Application Definition. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :param gallery_application_name: The name of the gallery Application Definition to be - retrieved. Required. - :type gallery_application_name: str - :return: An iterator like instance of GalleryApplicationVersion - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.models.GalleryApplicationVersion] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[List[_models.GalleryApplicationVersion]] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_gallery_application_versions_list_by_gallery_application_request( - resource_group_name=resource_group_name, - gallery_name=gallery_name, - gallery_application_name=gallery_application_name, - subscription_id=self._config.subscription_id, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - return _request - - def extract_data(pipeline_response): - deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.GalleryApplicationVersion], deserialized.get("value", [])) - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.get("nextLink") or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.CloudError, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) + ) + return LROPoller[_models.RunCommandResult]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) -class GalleryInVMAccessControlProfilesOperations: # pylint: disable=name-too-long +class SshPublicKeysOperations: """ .. warning:: **DO NOT** instantiate this class directly. Instead, you should access the following operations through :class:`~azure.mgmt.compute.ComputeClient`'s - :attr:`gallery_in_vm_access_control_profiles` attribute. + :attr:`ssh_public_keys` attribute. """ def __init__(self, *args, **kwargs) -> None: @@ -44036,22 +44081,16 @@ def __init__(self, *args, **kwargs) -> None: self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace - def get( - self, resource_group_name: str, gallery_name: str, in_vm_access_control_profile_name: str, **kwargs: Any - ) -> _models.GalleryInVMAccessControlProfile: - """Retrieves information about a gallery inVMAccessControlProfile. + 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. The name is case insensitive. Required. :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :param in_vm_access_control_profile_name: The name of the gallery inVMAccessControlProfile to - be retrieved. Required. - :type in_vm_access_control_profile_name: str - :return: GalleryInVMAccessControlProfile. The GalleryInVMAccessControlProfile is compatible - with MutableMapping - :rtype: ~azure.mgmt.compute.models.GalleryInVMAccessControlProfile + :param ssh_public_key_name: The name of the SSH public key. Required. + :type ssh_public_key_name: str + :return: SshPublicKeyResource. The SshPublicKeyResource is compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.SshPublicKeyResource :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -44065,12 +44104,11 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.GalleryInVMAccessControlProfile] = kwargs.pop("cls", None) + cls: ClsType[_models.SshPublicKeyResource] = kwargs.pop("cls", None) - _request = build_gallery_in_vm_access_control_profiles_get_request( + _request = build_ssh_public_keys_get_request( resource_group_name=resource_group_name, - gallery_name=gallery_name, - in_vm_access_control_profile_name=in_vm_access_control_profile_name, + ssh_public_key_name=ssh_public_key_name, subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -44101,21 +44139,116 @@ def get( if _stream: deserialized = response.iter_bytes() else: - deserialized = _deserialize(_models.GalleryInVMAccessControlProfile, response.json()) + deserialized = _deserialize(_models.SshPublicKeyResource, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - def _create_or_update_initial( + @overload + def create( self, resource_group_name: str, - gallery_name: str, - in_vm_access_control_profile_name: str, - gallery_in_vm_access_control_profile: Union[_models.GalleryInVMAccessControlProfile, JSON, IO[bytes]], + ssh_public_key_name: str, + parameters: _models.SshPublicKeyResource, + *, + content_type: str = "application/json", **kwargs: Any - ) -> Iterator[bytes]: + ) -> _models.SshPublicKeyResource: + """Creates a new SSH public key resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param ssh_public_key_name: The name of the SSH public key. Required. + :type ssh_public_key_name: str + :param parameters: Parameters supplied to create the SSH public key. Required. + :type parameters: ~azure.mgmt.compute.models.SshPublicKeyResource + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: SshPublicKeyResource. The SshPublicKeyResource is compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.SshPublicKeyResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create( + self, + resource_group_name: str, + ssh_public_key_name: str, + parameters: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SshPublicKeyResource: + """Creates a new SSH public key resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param ssh_public_key_name: The name of the SSH public key. Required. + :type ssh_public_key_name: str + :param parameters: Parameters supplied to create the SSH public key. Required. + :type parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: SshPublicKeyResource. The SshPublicKeyResource is compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.SshPublicKeyResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create( + self, + resource_group_name: str, + ssh_public_key_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SshPublicKeyResource: + """Creates a new SSH public key resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param ssh_public_key_name: The name of the SSH public key. Required. + :type ssh_public_key_name: str + :param parameters: Parameters supplied to create the SSH public key. Required. + :type parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: SshPublicKeyResource. The SshPublicKeyResource is compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.SshPublicKeyResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create( + self, + resource_group_name: str, + ssh_public_key_name: str, + parameters: Union[_models.SshPublicKeyResource, JSON, IO[bytes]], + **kwargs: Any + ) -> _models.SshPublicKeyResource: + """Creates a new SSH public key resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param ssh_public_key_name: The name of the SSH public key. Required. + :type ssh_public_key_name: str + :param parameters: Parameters supplied to create the SSH public key. Is one of the following + types: SshPublicKeyResource, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.compute.models.SshPublicKeyResource or JSON or IO[bytes] + :return: SshPublicKeyResource. The SshPublicKeyResource is compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.SshPublicKeyResource + :raises ~azure.core.exceptions.HttpResponseError: + """ error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -44128,19 +44261,18 @@ def _create_or_update_initial( _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + cls: ClsType[_models.SshPublicKeyResource] = kwargs.pop("cls", None) content_type = content_type or "application/json" _content = None - if isinstance(gallery_in_vm_access_control_profile, (IOBase, bytes)): - _content = gallery_in_vm_access_control_profile + if isinstance(parameters, (IOBase, bytes)): + _content = parameters else: - _content = json.dumps(gallery_in_vm_access_control_profile, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - _request = build_gallery_in_vm_access_control_profiles_create_or_update_request( + _request = build_ssh_public_keys_create_request( resource_group_name=resource_group_name, - gallery_name=gallery_name, - in_vm_access_control_profile_name=in_vm_access_control_profile_name, + ssh_public_key_name=ssh_public_key_name, subscription_id=self._config.subscription_id, content_type=content_type, api_version=self._config.api_version, @@ -44153,7 +44285,7 @@ def _create_or_update_initial( } _request.url = self._client.format_url(_request.url, **path_format_arguments) - _stream = True + _stream = kwargs.pop("stream", False) pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -44161,207 +44293,352 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = _failsafe_deserialize(_models.CloudError, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - response_headers = {} - if response.status_code == 201: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.iter_bytes() + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.SshPublicKeyResource, response.json()) if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore @overload - def begin_create_or_update( + def update( self, resource_group_name: str, - gallery_name: str, - in_vm_access_control_profile_name: str, - gallery_in_vm_access_control_profile: _models.GalleryInVMAccessControlProfile, + ssh_public_key_name: str, + parameters: _models.SshPublicKeyUpdateResource, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[None]: - """Create or update a gallery inVMAccessControlProfile. + ) -> _models.SshPublicKeyResource: + """Updates a new SSH public key resource. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :param in_vm_access_control_profile_name: The name of the gallery inVMAccessControlProfile to - be retrieved. Required. - :type in_vm_access_control_profile_name: str - :param gallery_in_vm_access_control_profile: Parameters supplied to the create or update - gallery inVMAccessControlProfile operation. Required. - :type gallery_in_vm_access_control_profile: - ~azure.mgmt.compute.models.GalleryInVMAccessControlProfile + :param ssh_public_key_name: The name of the SSH public key. Required. + :type ssh_public_key_name: str + :param parameters: Parameters supplied to update the SSH public key. Required. + :type parameters: ~azure.mgmt.compute.models.SshPublicKeyUpdateResource :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns None - :rtype: ~azure.core.polling.LROPoller[None] + :return: SshPublicKeyResource. The SshPublicKeyResource is compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.SshPublicKeyResource :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def begin_create_or_update( + def update( self, resource_group_name: str, - gallery_name: str, - in_vm_access_control_profile_name: str, - gallery_in_vm_access_control_profile: JSON, + ssh_public_key_name: str, + parameters: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[None]: - """Create or update a gallery inVMAccessControlProfile. + ) -> _models.SshPublicKeyResource: + """Updates a new SSH public key resource. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :param in_vm_access_control_profile_name: The name of the gallery inVMAccessControlProfile to - be retrieved. Required. - :type in_vm_access_control_profile_name: str - :param gallery_in_vm_access_control_profile: Parameters supplied to the create or update - gallery inVMAccessControlProfile operation. Required. - :type gallery_in_vm_access_control_profile: JSON + :param ssh_public_key_name: The name of the SSH public key. Required. + :type ssh_public_key_name: str + :param parameters: Parameters supplied to update the SSH public key. Required. + :type parameters: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns None - :rtype: ~azure.core.polling.LROPoller[None] + :return: SshPublicKeyResource. The SshPublicKeyResource is compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.SshPublicKeyResource :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def begin_create_or_update( + def update( self, resource_group_name: str, - gallery_name: str, - in_vm_access_control_profile_name: str, - gallery_in_vm_access_control_profile: IO[bytes], + ssh_public_key_name: str, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[None]: - """Create or update a gallery inVMAccessControlProfile. + ) -> _models.SshPublicKeyResource: + """Updates a new SSH public key resource. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :param in_vm_access_control_profile_name: The name of the gallery inVMAccessControlProfile to - be retrieved. Required. - :type in_vm_access_control_profile_name: str - :param gallery_in_vm_access_control_profile: Parameters supplied to the create or update - gallery inVMAccessControlProfile operation. Required. - :type gallery_in_vm_access_control_profile: IO[bytes] + :param ssh_public_key_name: The name of the SSH public key. Required. + :type ssh_public_key_name: str + :param parameters: Parameters supplied to update the SSH public key. Required. + :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns None - :rtype: ~azure.core.polling.LROPoller[None] + :return: SshPublicKeyResource. The SshPublicKeyResource is compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.SshPublicKeyResource :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace - def begin_create_or_update( + def update( self, resource_group_name: str, - gallery_name: str, - in_vm_access_control_profile_name: str, - gallery_in_vm_access_control_profile: Union[_models.GalleryInVMAccessControlProfile, JSON, IO[bytes]], + ssh_public_key_name: str, + parameters: Union[_models.SshPublicKeyUpdateResource, JSON, IO[bytes]], **kwargs: Any - ) -> LROPoller[None]: - """Create or update a gallery inVMAccessControlProfile. + ) -> _models.SshPublicKeyResource: + """Updates a new SSH public key resource. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :param in_vm_access_control_profile_name: The name of the gallery inVMAccessControlProfile to - be retrieved. Required. - :type in_vm_access_control_profile_name: str - :param gallery_in_vm_access_control_profile: Parameters supplied to the create or update - gallery inVMAccessControlProfile operation. Is one of the following types: - GalleryInVMAccessControlProfile, JSON, IO[bytes] Required. - :type gallery_in_vm_access_control_profile: - ~azure.mgmt.compute.models.GalleryInVMAccessControlProfile or JSON or IO[bytes] - :return: An instance of LROPoller that returns None - :rtype: ~azure.core.polling.LROPoller[None] + :param ssh_public_key_name: The name of the SSH public key. Required. + :type ssh_public_key_name: str + :param parameters: Parameters supplied to update the SSH public key. Is one of the following + types: SshPublicKeyUpdateResource, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.compute.models.SshPublicKeyUpdateResource or JSON or IO[bytes] + :return: SshPublicKeyResource. The SshPublicKeyResource is compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.SshPublicKeyResource :raises ~azure.core.exceptions.HttpResponseError: """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._create_or_update_initial( - resource_group_name=resource_group_name, - gallery_name=gallery_name, - in_vm_access_control_profile_name=in_vm_access_control_profile_name, - gallery_in_vm_access_control_profile=gallery_in_vm_access_control_profile, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) + cls: ClsType[_models.SshPublicKeyResource] = kwargs.pop("cls", None) - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore + content_type = content_type or "application/json" + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_ssh_public_keys_update_request( + resource_group_name=resource_group_name, + ssh_public_key_name=ssh_public_key_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.SshPublicKeyResource, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # 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. The name is case insensitive. + Required. + :type resource_group_name: str + :param ssh_public_key_name: The name of the SSH public key. Required. + :type ssh_public_key_name: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_ssh_public_keys_delete_request( + resource_group_name=resource_group_name, + ssh_public_key_name=ssh_public_key_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) path_format_arguments = { "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace + def list_by_resource_group( + self, resource_group_name: str, **kwargs: Any + ) -> ItemPaged["_models.SshPublicKeyResource"]: + """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. The name is case insensitive. + Required. + :type resource_group_name: str + :return: An iterator like instance of SshPublicKeyResource + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.models.SshPublicKeyResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.SshPublicKeyResource]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_ssh_public_keys_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.SshPublicKeyResource], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + @distributed_trace + def list_by_subscription(self, **kwargs: Any) -> ItemPaged["_models.SshPublicKeyResource"]: + """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. + + :return: An iterator like instance of SshPublicKeyResource + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.models.SshPublicKeyResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + cls: ClsType[List[_models.SshPublicKeyResource]] = kwargs.pop("cls", None) - def _update_initial( - self, - resource_group_name: str, - gallery_name: str, - in_vm_access_control_profile_name: str, - gallery_in_vm_access_control_profile: Union[_models.GalleryInVMAccessControlProfileUpdate, JSON, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -44370,238 +44647,185 @@ def _update_initial( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} - - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + def prepare_request(next_link=None): + if not next_link: - content_type = content_type or "application/json" - _content = None - if isinstance(gallery_in_vm_access_control_profile, (IOBase, bytes)): - _content = gallery_in_vm_access_control_profile - else: - _content = json.dumps(gallery_in_vm_access_control_profile, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _request = build_ssh_public_keys_list_by_subscription_request( + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) - _request = build_gallery_in_vm_access_control_profiles_update_request( - resource_group_name=resource_group_name, - gallery_name=gallery_name, - in_vm_access_control_profile_name=in_vm_access_control_profile_name, - subscription_id=self._config.subscription_id, - content_type=content_type, - api_version=self._config.api_version, - content=_content, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) + return _request - response = pipeline_response.http_response + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.SshPublicKeyResource], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) - if response.status_code not in [200]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.CloudError, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + def get_next(next_link=None): + _request = prepare_request(next_link) - response_headers = {} - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response - deserialized = response.iter_bytes() + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore + return pipeline_response - return deserialized # type: ignore + return ItemPaged(get_next, extract_data) @overload - def begin_update( + def generate_key_pair( self, resource_group_name: str, - gallery_name: str, - in_vm_access_control_profile_name: str, - gallery_in_vm_access_control_profile: _models.GalleryInVMAccessControlProfileUpdate, + ssh_public_key_name: str, + parameters: Optional[_models.SshGenerateKeyPairInputParameters] = None, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[None]: - """Update a gallery inVMAccessControlProfile. + ) -> _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. The name is case insensitive. Required. :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :param in_vm_access_control_profile_name: The name of the gallery inVMAccessControlProfile to - be retrieved. Required. - :type in_vm_access_control_profile_name: str - :param gallery_in_vm_access_control_profile: Parameters supplied to the update gallery - inVMAccessControlProfile operation. Required. - :type gallery_in_vm_access_control_profile: - ~azure.mgmt.compute.models.GalleryInVMAccessControlProfileUpdate + :param ssh_public_key_name: The name of the SSH public key. Required. + :type ssh_public_key_name: str + :param parameters: Parameters supplied to generate the SSH public key. Default value is None. + :type parameters: ~azure.mgmt.compute.models.SshGenerateKeyPairInputParameters :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns None - :rtype: ~azure.core.polling.LROPoller[None] + :return: SshPublicKeyGenerateKeyPairResult. The SshPublicKeyGenerateKeyPairResult is compatible + with MutableMapping + :rtype: ~azure.mgmt.compute.models.SshPublicKeyGenerateKeyPairResult :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def begin_update( + def generate_key_pair( self, resource_group_name: str, - gallery_name: str, - in_vm_access_control_profile_name: str, - gallery_in_vm_access_control_profile: JSON, + ssh_public_key_name: str, + parameters: Optional[JSON] = None, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[None]: - """Update a gallery inVMAccessControlProfile. + ) -> _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. The name is case insensitive. Required. :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :param in_vm_access_control_profile_name: The name of the gallery inVMAccessControlProfile to - be retrieved. Required. - :type in_vm_access_control_profile_name: str - :param gallery_in_vm_access_control_profile: Parameters supplied to the update gallery - inVMAccessControlProfile operation. Required. - :type gallery_in_vm_access_control_profile: JSON + :param ssh_public_key_name: The name of the SSH public key. Required. + :type ssh_public_key_name: str + :param parameters: Parameters supplied to generate the SSH public key. Default value is None. + :type parameters: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns None - :rtype: ~azure.core.polling.LROPoller[None] + :return: SshPublicKeyGenerateKeyPairResult. The SshPublicKeyGenerateKeyPairResult is compatible + with MutableMapping + :rtype: ~azure.mgmt.compute.models.SshPublicKeyGenerateKeyPairResult :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def begin_update( + def generate_key_pair( self, resource_group_name: str, - gallery_name: str, - in_vm_access_control_profile_name: str, - gallery_in_vm_access_control_profile: IO[bytes], + ssh_public_key_name: str, + parameters: Optional[IO[bytes]] = None, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[None]: - """Update a gallery inVMAccessControlProfile. + ) -> _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. The name is case insensitive. Required. :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :param in_vm_access_control_profile_name: The name of the gallery inVMAccessControlProfile to - be retrieved. Required. - :type in_vm_access_control_profile_name: str - :param gallery_in_vm_access_control_profile: Parameters supplied to the update gallery - inVMAccessControlProfile operation. Required. - :type gallery_in_vm_access_control_profile: IO[bytes] + :param ssh_public_key_name: The name of the SSH public key. Required. + :type ssh_public_key_name: str + :param parameters: Parameters supplied to generate the SSH public key. Default value is None. + :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns None - :rtype: ~azure.core.polling.LROPoller[None] + :return: SshPublicKeyGenerateKeyPairResult. The SshPublicKeyGenerateKeyPairResult is compatible + with MutableMapping + :rtype: ~azure.mgmt.compute.models.SshPublicKeyGenerateKeyPairResult :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace - def begin_update( + def generate_key_pair( self, resource_group_name: str, - gallery_name: str, - in_vm_access_control_profile_name: str, - gallery_in_vm_access_control_profile: Union[_models.GalleryInVMAccessControlProfileUpdate, JSON, IO[bytes]], + ssh_public_key_name: str, + parameters: Optional[Union[_models.SshGenerateKeyPairInputParameters, JSON, IO[bytes]]] = None, **kwargs: Any - ) -> LROPoller[None]: - """Update a gallery inVMAccessControlProfile. + ) -> _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. The name is case insensitive. Required. :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :param in_vm_access_control_profile_name: The name of the gallery inVMAccessControlProfile to - be retrieved. Required. - :type in_vm_access_control_profile_name: str - :param gallery_in_vm_access_control_profile: Parameters supplied to the update gallery - inVMAccessControlProfile operation. Is one of the following types: - GalleryInVMAccessControlProfileUpdate, JSON, IO[bytes] Required. - :type gallery_in_vm_access_control_profile: - ~azure.mgmt.compute.models.GalleryInVMAccessControlProfileUpdate or JSON or IO[bytes] - :return: An instance of LROPoller that returns None - :rtype: ~azure.core.polling.LROPoller[None] + :param ssh_public_key_name: The name of the SSH public key. Required. + :type ssh_public_key_name: str + :param parameters: Parameters supplied to generate the SSH public key. Is one of the following + types: SshGenerateKeyPairInputParameters, JSON, IO[bytes] Default value is None. + :type parameters: ~azure.mgmt.compute.models.SshGenerateKeyPairInputParameters or JSON or + IO[bytes] + :return: SshPublicKeyGenerateKeyPairResult. The SshPublicKeyGenerateKeyPairResult is compatible + with MutableMapping + :rtype: ~azure.mgmt.compute.models.SshPublicKeyGenerateKeyPairResult :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} - - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._update_initial( - resource_group_name=resource_group_name, - gallery_name=gallery_name, - in_vm_access_control_profile_name=in_vm_access_control_profile_name, - gallery_in_vm_access_control_profile=gallery_in_vm_access_control_profile, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _delete_initial( - self, resource_group_name: str, gallery_name: str, in_vm_access_control_profile_name: str, **kwargs: Any - ) -> Iterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -44610,17 +44834,30 @@ def _delete_initial( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + content_type = content_type if parameters else None + cls: ClsType[_models.SshPublicKeyGenerateKeyPairResult] = kwargs.pop("cls", None) - _request = build_gallery_in_vm_access_control_profiles_delete_request( + content_type = content_type or "application/json" if parameters else None + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + if parameters is not None: + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + else: + _content = None + + _request = build_ssh_public_keys_generate_key_pair_request( resource_group_name=resource_group_name, - gallery_name=gallery_name, - in_vm_access_control_profile_name=in_vm_access_control_profile_name, + ssh_public_key_name=ssh_public_key_name, subscription_id=self._config.subscription_id, + content_type=content_type, api_version=self._config.api_version, + content=_content, headers=_headers, params=_params, ) @@ -44629,119 +44866,172 @@ def _delete_initial( } _request.url = self._client.format_url(_request.url, **path_format_arguments) - _stream = True + _stream = kwargs.pop("stream", False) pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [202, 204]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = _failsafe_deserialize(_models.CloudError, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - - deserialized = response.iter_bytes() + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.SshPublicKeyGenerateKeyPairResult, response.json()) if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore + +class UsageOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.compute.ComputeClient`'s + :attr:`usage` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace - def begin_delete( - self, resource_group_name: str, gallery_name: str, in_vm_access_control_profile_name: str, **kwargs: Any - ) -> LROPoller[None]: - """Delete a gallery inVMAccessControlProfile. + def list(self, location: str, **kwargs: Any) -> ItemPaged["_models.Usage"]: + """Gets, for the specified location, the current compute resource usage information as well as the + limits for compute resources under the subscription. - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :param in_vm_access_control_profile_name: The name of the gallery inVMAccessControlProfile to - be retrieved. Required. - :type in_vm_access_control_profile_name: str - :return: An instance of LROPoller that returns None - :rtype: ~azure.core.polling.LROPoller[None] + :param location: The location name. Required. + :type location: str + :return: An iterator like instance of Usage + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.models.Usage] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - gallery_name=gallery_name, - in_vm_access_control_profile_name=in_vm_access_control_profile_name, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) + cls: ClsType[List[_models.Usage]] = kwargs.pop("cls", None) - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_usage_list_request( + location=location, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.Usage], deserialized.get("value", [])) if cls: - return cls(pipeline_response, None, {}) # type: ignore + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } + def get_next(next_link=None): + _request = prepare_request(next_link) - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + +class VirtualMachineSizesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.compute.ComputeClient`'s + :attr:`virtual_machine_sizes` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace - def list_by_gallery( - self, resource_group_name: str, gallery_name: str, **kwargs: Any - ) -> ItemPaged["_models.GalleryInVMAccessControlProfile"]: - """List gallery inVMAccessControlProfiles in a gallery. + def list(self, location: str, **kwargs: Any) -> ItemPaged["_models.VirtualMachineSize"]: + """This API is deprecated. Use `Resources Skus + `_. - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :return: An iterator like instance of GalleryInVMAccessControlProfile - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.compute.models.GalleryInVMAccessControlProfile] + :param location: The location name. Required. + :type location: str + :return: An iterator like instance of VirtualMachineSize + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.models.VirtualMachineSize] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.GalleryInVMAccessControlProfile]] = kwargs.pop("cls", None) + cls: ClsType[List[_models.VirtualMachineSize]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -44754,9 +45044,8 @@ def list_by_gallery( def prepare_request(next_link=None): if not next_link: - _request = build_gallery_in_vm_access_control_profiles_list_by_gallery_request( - resource_group_name=resource_group_name, - gallery_name=gallery_name, + _request = build_virtual_machine_sizes_list_request( + location=location, subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -44793,7 +45082,7 @@ def prepare_request(next_link=None): def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.GalleryInVMAccessControlProfile], deserialized.get("value", [])) + list_of_elem = _deserialize(List[_models.VirtualMachineSize], deserialized.get("value", [])) if cls: list_of_elem = cls(list_of_elem) # type: ignore return deserialized.get("nextLink") or None, iter(list_of_elem) @@ -44817,14 +45106,14 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) -class GalleryInVMAccessControlProfileVersionsOperations: # pylint: disable=name-too-long +class VirtualMachineImagesEdgeZoneOperations: """ .. warning:: **DO NOT** instantiate this class directly. Instead, you should access the following operations through :class:`~azure.mgmt.compute.ComputeClient`'s - :attr:`gallery_in_vm_access_control_profile_versions` attribute. + :attr:`virtual_machine_images_edge_zone` attribute. """ def __init__(self, *args, **kwargs) -> None: @@ -44835,30 +45124,17 @@ def __init__(self, *args, **kwargs) -> None: self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace - def get( - self, - resource_group_name: str, - gallery_name: str, - in_vm_access_control_profile_name: str, - in_vm_access_control_profile_version_name: str, - **kwargs: Any - ) -> _models.GalleryInVMAccessControlProfileVersion: - """Retrieves information about a gallery inVMAccessControlProfile version. + 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 resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :param in_vm_access_control_profile_name: The name of the gallery inVMAccessControlProfile to - be retrieved. Required. - :type in_vm_access_control_profile_name: str - :param in_vm_access_control_profile_version_name: The name of the gallery - inVMAccessControlProfile version to be retrieved. Required. - :type in_vm_access_control_profile_version_name: str - :return: GalleryInVMAccessControlProfileVersion. The GalleryInVMAccessControlProfileVersion is - compatible with MutableMapping - :rtype: ~azure.mgmt.compute.models.GalleryInVMAccessControlProfileVersion + :param location: The location name. Required. + :type location: str + :param edge_zone: The name of the edge zone. Required. + :type edge_zone: str + :return: list of VirtualMachineImageResource + :rtype: list[~azure.mgmt.compute.models.VirtualMachineImageResource] :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -44872,13 +45148,11 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.GalleryInVMAccessControlProfileVersion] = kwargs.pop("cls", None) + cls: ClsType[List[_models.VirtualMachineImageResource]] = kwargs.pop("cls", None) - _request = build_gallery_in_vm_access_control_profile_versions_get_request( - resource_group_name=resource_group_name, - gallery_name=gallery_name, - in_vm_access_control_profile_name=in_vm_access_control_profile_name, - in_vm_access_control_profile_version_name=in_vm_access_control_profile_version_name, + _request = build_virtual_machine_images_edge_zone_list_publishers_request( + location=location, + edge_zone=edge_zone, subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -44900,567 +45174,112 @@ def get( if _stream: try: response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.CloudError, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if _stream: - deserialized = response.iter_bytes() - else: - deserialized = _deserialize(_models.GalleryInVMAccessControlProfileVersion, response.json()) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - gallery_name: str, - in_vm_access_control_profile_name: str, - in_vm_access_control_profile_version_name: str, - gallery_in_vm_access_control_profile_version: Union[ - _models.GalleryInVMAccessControlProfileVersion, JSON, IO[bytes] - ], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} - - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _content = None - if isinstance(gallery_in_vm_access_control_profile_version, (IOBase, bytes)): - _content = gallery_in_vm_access_control_profile_version - else: - _content = json.dumps(gallery_in_vm_access_control_profile_version, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - - _request = build_gallery_in_vm_access_control_profile_versions_create_or_update_request( - resource_group_name=resource_group_name, - gallery_name=gallery_name, - in_vm_access_control_profile_name=in_vm_access_control_profile_name, - in_vm_access_control_profile_version_name=in_vm_access_control_profile_version_name, - subscription_id=self._config.subscription_id, - content_type=content_type, - api_version=self._config.api_version, - content=_content, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.CloudError, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 201: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.iter_bytes() - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - gallery_name: str, - in_vm_access_control_profile_name: str, - in_vm_access_control_profile_version_name: str, - gallery_in_vm_access_control_profile_version: _models.GalleryInVMAccessControlProfileVersion, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[None]: - """Create or update a gallery inVMAccessControlProfile version. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :param in_vm_access_control_profile_name: The name of the gallery inVMAccessControlProfile to - be retrieved. Required. - :type in_vm_access_control_profile_name: str - :param in_vm_access_control_profile_version_name: The name of the gallery - inVMAccessControlProfile version to be retrieved. Required. - :type in_vm_access_control_profile_version_name: str - :param gallery_in_vm_access_control_profile_version: Parameters supplied to the create or - update gallery inVMAccessControlProfile version operation. Required. - :type gallery_in_vm_access_control_profile_version: - ~azure.mgmt.compute.models.GalleryInVMAccessControlProfileVersion - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns None - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - gallery_name: str, - in_vm_access_control_profile_name: str, - in_vm_access_control_profile_version_name: str, - gallery_in_vm_access_control_profile_version: JSON, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[None]: - """Create or update a gallery inVMAccessControlProfile version. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :param in_vm_access_control_profile_name: The name of the gallery inVMAccessControlProfile to - be retrieved. Required. - :type in_vm_access_control_profile_name: str - :param in_vm_access_control_profile_version_name: The name of the gallery - inVMAccessControlProfile version to be retrieved. Required. - :type in_vm_access_control_profile_version_name: str - :param gallery_in_vm_access_control_profile_version: Parameters supplied to the create or - update gallery inVMAccessControlProfile version operation. Required. - :type gallery_in_vm_access_control_profile_version: JSON - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns None - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - gallery_name: str, - in_vm_access_control_profile_name: str, - in_vm_access_control_profile_version_name: str, - gallery_in_vm_access_control_profile_version: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[None]: - """Create or update a gallery inVMAccessControlProfile version. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :param in_vm_access_control_profile_name: The name of the gallery inVMAccessControlProfile to - be retrieved. Required. - :type in_vm_access_control_profile_name: str - :param in_vm_access_control_profile_version_name: The name of the gallery - inVMAccessControlProfile version to be retrieved. Required. - :type in_vm_access_control_profile_version_name: str - :param gallery_in_vm_access_control_profile_version: Parameters supplied to the create or - update gallery inVMAccessControlProfile version operation. Required. - :type gallery_in_vm_access_control_profile_version: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns None - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - gallery_name: str, - in_vm_access_control_profile_name: str, - in_vm_access_control_profile_version_name: str, - gallery_in_vm_access_control_profile_version: Union[ - _models.GalleryInVMAccessControlProfileVersion, JSON, IO[bytes] - ], - **kwargs: Any - ) -> LROPoller[None]: - """Create or update a gallery inVMAccessControlProfile version. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :param in_vm_access_control_profile_name: The name of the gallery inVMAccessControlProfile to - be retrieved. Required. - :type in_vm_access_control_profile_name: str - :param in_vm_access_control_profile_version_name: The name of the gallery - inVMAccessControlProfile version to be retrieved. Required. - :type in_vm_access_control_profile_version_name: str - :param gallery_in_vm_access_control_profile_version: Parameters supplied to the create or - update gallery inVMAccessControlProfile version operation. Is one of the following types: - GalleryInVMAccessControlProfileVersion, JSON, IO[bytes] Required. - :type gallery_in_vm_access_control_profile_version: - ~azure.mgmt.compute.models.GalleryInVMAccessControlProfileVersion or JSON or IO[bytes] - :return: An instance of LROPoller that returns None - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} - - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._create_or_update_initial( - resource_group_name=resource_group_name, - gallery_name=gallery_name, - in_vm_access_control_profile_name=in_vm_access_control_profile_name, - in_vm_access_control_profile_version_name=in_vm_access_control_profile_version_name, - gallery_in_vm_access_control_profile_version=gallery_in_vm_access_control_profile_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _update_initial( - self, - resource_group_name: str, - gallery_name: str, - in_vm_access_control_profile_name: str, - in_vm_access_control_profile_version_name: str, - gallery_in_vm_access_control_profile_version: Union[ - _models.GalleryInVMAccessControlProfileVersionUpdate, JSON, IO[bytes] - ], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} - - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _content = None - if isinstance(gallery_in_vm_access_control_profile_version, (IOBase, bytes)): - _content = gallery_in_vm_access_control_profile_version - else: - _content = json.dumps(gallery_in_vm_access_control_profile_version, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - - _request = build_gallery_in_vm_access_control_profile_versions_update_request( - resource_group_name=resource_group_name, - gallery_name=gallery_name, - in_vm_access_control_profile_name=in_vm_access_control_profile_name, - in_vm_access_control_profile_version_name=in_vm_access_control_profile_version_name, - subscription_id=self._config.subscription_id, - content_type=content_type, - api_version=self._config.api_version, - content=_content, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.CloudError, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.iter_bytes() - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update( - self, - resource_group_name: str, - gallery_name: str, - in_vm_access_control_profile_name: str, - in_vm_access_control_profile_version_name: str, - gallery_in_vm_access_control_profile_version: _models.GalleryInVMAccessControlProfileVersionUpdate, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[None]: - """Update a gallery inVMAccessControlProfile version. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :param in_vm_access_control_profile_name: The name of the gallery inVMAccessControlProfile to - be retrieved. Required. - :type in_vm_access_control_profile_name: str - :param in_vm_access_control_profile_version_name: The name of the gallery - inVMAccessControlProfile version to be retrieved. Required. - :type in_vm_access_control_profile_version_name: str - :param gallery_in_vm_access_control_profile_version: Parameters supplied to the update gallery - inVMAccessControlProfile version operation. Required. - :type gallery_in_vm_access_control_profile_version: - ~azure.mgmt.compute.models.GalleryInVMAccessControlProfileVersionUpdate - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns None - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update( - self, - resource_group_name: str, - gallery_name: str, - in_vm_access_control_profile_name: str, - in_vm_access_control_profile_version_name: str, - gallery_in_vm_access_control_profile_version: JSON, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[None]: - """Update a gallery inVMAccessControlProfile version. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :param in_vm_access_control_profile_name: The name of the gallery inVMAccessControlProfile to - be retrieved. Required. - :type in_vm_access_control_profile_name: str - :param in_vm_access_control_profile_version_name: The name of the gallery - inVMAccessControlProfile version to be retrieved. Required. - :type in_vm_access_control_profile_version_name: str - :param gallery_in_vm_access_control_profile_version: Parameters supplied to the update gallery - inVMAccessControlProfile version operation. Required. - :type gallery_in_vm_access_control_profile_version: JSON - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns None - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update( - self, - resource_group_name: str, - gallery_name: str, - in_vm_access_control_profile_name: str, - in_vm_access_control_profile_version_name: str, - gallery_in_vm_access_control_profile_version: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[None]: - """Update a gallery inVMAccessControlProfile version. + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :param in_vm_access_control_profile_name: The name of the gallery inVMAccessControlProfile to - be retrieved. Required. - :type in_vm_access_control_profile_name: str - :param in_vm_access_control_profile_version_name: The name of the gallery - inVMAccessControlProfile version to be retrieved. Required. - :type in_vm_access_control_profile_version_name: str - :param gallery_in_vm_access_control_profile_version: Parameters supplied to the update gallery - inVMAccessControlProfile version operation. Required. - :type gallery_in_vm_access_control_profile_version: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns None - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(List[_models.VirtualMachineImageResource], response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace - def begin_update( - self, - resource_group_name: str, - gallery_name: str, - in_vm_access_control_profile_name: str, - in_vm_access_control_profile_version_name: str, - gallery_in_vm_access_control_profile_version: Union[ - _models.GalleryInVMAccessControlProfileVersionUpdate, JSON, IO[bytes] - ], - **kwargs: Any - ) -> LROPoller[None]: - """Update a gallery inVMAccessControlProfile version. + 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 resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :param in_vm_access_control_profile_name: The name of the gallery inVMAccessControlProfile to - be retrieved. Required. - :type in_vm_access_control_profile_name: str - :param in_vm_access_control_profile_version_name: The name of the gallery - inVMAccessControlProfile version to be retrieved. Required. - :type in_vm_access_control_profile_version_name: str - :param gallery_in_vm_access_control_profile_version: Parameters supplied to the update gallery - inVMAccessControlProfile version operation. Is one of the following types: - GalleryInVMAccessControlProfileVersionUpdate, JSON, IO[bytes] Required. - :type gallery_in_vm_access_control_profile_version: - ~azure.mgmt.compute.models.GalleryInVMAccessControlProfileVersionUpdate or JSON or IO[bytes] - :return: An instance of LROPoller that returns None - :rtype: ~azure.core.polling.LROPoller[None] + :param location: The location name. Required. + :type location: str + :param edge_zone: The name of the edge zone. Required. + :type edge_zone: str + :param publisher_name: A valid image publisher. Required. + :type publisher_name: str + :return: list of VirtualMachineImageResource + :rtype: list[~azure.mgmt.compute.models.VirtualMachineImageResource] :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._update_initial( - resource_group_name=resource_group_name, - gallery_name=gallery_name, - in_vm_access_control_profile_name=in_vm_access_control_profile_name, - in_vm_access_control_profile_version_name=in_vm_access_control_profile_version_name, - gallery_in_vm_access_control_profile_version=gallery_in_vm_access_control_profile_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore + cls: ClsType[List[_models.VirtualMachineImageResource]] = kwargs.pop("cls", None) + _request = build_virtual_machine_images_edge_zone_list_offers_request( + location=location, + edge_zone=edge_zone, + publisher_name=publisher_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) path_format_arguments = { "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), } + _request.url = self._client.format_url(_request.url, **path_format_arguments) - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + deserialized = _deserialize(List[_models.VirtualMachineImageResource], response.json()) - def _delete_initial( - self, - resource_group_name: str, - gallery_name: str, - in_vm_access_control_profile_name: str, - in_vm_access_control_profile_version_name: str, - **kwargs: Any - ) -> Iterator[bytes]: + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # 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 location name. Required. + :type location: str + :param edge_zone: The name of the edge zone. Required. + :type edge_zone: str + :param publisher_name: A valid image publisher. Required. + :type publisher_name: str + :param offer: A valid image publisher offer. Required. + :type offer: str + :return: list of VirtualMachineImageResource + :rtype: list[~azure.mgmt.compute.models.VirtualMachineImageResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -45472,13 +45291,13 @@ def _delete_initial( _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + cls: ClsType[List[_models.VirtualMachineImageResource]] = kwargs.pop("cls", None) - _request = build_gallery_in_vm_access_control_profile_versions_delete_request( - resource_group_name=resource_group_name, - gallery_name=gallery_name, - in_vm_access_control_profile_name=in_vm_access_control_profile_name, - in_vm_access_control_profile_version_name=in_vm_access_control_profile_version_name, + _request = build_virtual_machine_images_edge_zone_list_skus_request( + location=location, + edge_zone=edge_zone, + publisher_name=publisher_name, + offer=offer, subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -45489,132 +45308,153 @@ def _delete_initial( } _request.url = self._client.format_url(_request.url, **path_format_arguments) - _stream = True + _stream = kwargs.pop("stream", False) pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [202, 204]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = _failsafe_deserialize(_models.CloudError, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - - deserialized = response.iter_bytes() + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(List[_models.VirtualMachineImageResource], response.json()) if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore @distributed_trace - def begin_delete( + def list( self, - resource_group_name: str, - gallery_name: str, - in_vm_access_control_profile_name: str, - in_vm_access_control_profile_version_name: str, + 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 - ) -> LROPoller[None]: - """Delete a gallery inVMAccessControlProfile version. + ) -> List[_models.VirtualMachineImageResource]: + """Gets a list of all virtual machine image versions for the specified location, edge zone, + publisher, offer, and SKU. - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :param in_vm_access_control_profile_name: The name of the gallery inVMAccessControlProfile to - be retrieved. Required. - :type in_vm_access_control_profile_name: str - :param in_vm_access_control_profile_version_name: The name of the gallery - inVMAccessControlProfile version to be retrieved. Required. - :type in_vm_access_control_profile_version_name: str - :return: An instance of LROPoller that returns None - :rtype: ~azure.core.polling.LROPoller[None] + :param location: The location name. Required. + :type location: str + :param edge_zone: The name of the edge zone. Required. + :type edge_zone: str + :param publisher_name: A valid image publisher. Required. + :type publisher_name: str + :param offer: A valid image publisher offer. Required. + :type offer: str + :param skus: A valid image SKU. Required. + :type skus: str + :keyword expand: The expand expression to apply on the operation. Default value is None. + :paramtype expand: str + :keyword top: An integer value specifying the number of images to return that matches supplied + values. Default value is None. + :paramtype top: int + :keyword orderby: Specifies the order of the results returned. Formatted as an OData query. + Default value is None. + :paramtype orderby: str + :return: list of VirtualMachineImageResource + :rtype: list[~azure.mgmt.compute.models.VirtualMachineImageResource] :raises ~azure.core.exceptions.HttpResponseError: """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - gallery_name=gallery_name, - in_vm_access_control_profile_name=in_vm_access_control_profile_name, - in_vm_access_control_profile_version_name=in_vm_access_control_profile_version_name, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore + cls: ClsType[List[_models.VirtualMachineImageResource]] = kwargs.pop("cls", None) + _request = build_virtual_machine_images_edge_zone_list_request( + location=location, + edge_zone=edge_zone, + publisher_name=publisher_name, + offer=offer, + skus=skus, + subscription_id=self._config.subscription_id, + expand=expand, + top=top, + orderby=orderby, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) path_format_arguments = { "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), } + _request.url = self._client.format_url(_request.url, **path_format_arguments) - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + deserialized = _deserialize(List[_models.VirtualMachineImageResource], response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace - def list_by_gallery_in_vm_access_control_profile( # pylint: disable=name-too-long - self, resource_group_name: str, gallery_name: str, in_vm_access_control_profile_name: str, **kwargs: Any - ) -> ItemPaged["_models.GalleryInVMAccessControlProfileVersion"]: - """List gallery inVMAccessControlProfile versions in a gallery inVMAccessControlProfile. + 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 resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param gallery_name: The name of the Shared Image Gallery. Required. - :type gallery_name: str - :param in_vm_access_control_profile_name: The name of the gallery inVMAccessControlProfile to - be retrieved. Required. - :type in_vm_access_control_profile_name: str - :return: An iterator like instance of GalleryInVMAccessControlProfileVersion - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.compute.models.GalleryInVMAccessControlProfileVersion] + :param location: The name of the Azure region. Required. + :type location: str + :param edge_zone: The name of the edge zone. Required. + :type edge_zone: str + :param publisher_name: A valid image publisher. Required. + :type publisher_name: str + :param offer: A valid image publisher offer. Required. + :type offer: str + :param skus: A valid image SKU. Required. + :type skus: str + :param version: A valid image SKU version. Required. + :type version: str + :return: VirtualMachineImage. The VirtualMachineImage is compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.VirtualMachineImage :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[List[_models.GalleryInVMAccessControlProfileVersion]] = kwargs.pop("cls", None) - error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -45623,83 +45463,64 @@ def list_by_gallery_in_vm_access_control_profile( # pylint: disable=name-too-lo } error_map.update(kwargs.pop("error_map", {}) or {}) - def prepare_request(next_link=None): - if not next_link: - - _request = build_gallery_in_vm_access_control_profile_versions_list_by_gallery_in_vm_access_control_profile_request( - resource_group_name=resource_group_name, - gallery_name=gallery_name, - in_vm_access_control_profile_name=in_vm_access_control_profile_name, - subscription_id=self._config.subscription_id, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) + cls: ClsType[_models.VirtualMachineImage] = kwargs.pop("cls", None) - return _request + _request = build_virtual_machine_images_edge_zone_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=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) - def extract_data(pipeline_response): - deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize( - List[_models.GalleryInVMAccessControlProfileVersion], deserialized.get("value", []) - ) - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.get("nextLink") or None, iter(list_of_elem) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) - def get_next(next_link=None): - _request = prepare_request(next_link) + response = pipeline_response.http_response - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.CloudError, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.VirtualMachineImage, response.json()) - return pipeline_response + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore - return ItemPaged(get_next, extract_data) + return deserialized # type: ignore -class SharedGalleriesOperations: +class VirtualMachineImagesOperations: """ .. warning:: **DO NOT** instantiate this class directly. Instead, you should access the following operations through :class:`~azure.mgmt.compute.ComputeClient`'s - :attr:`shared_galleries` attribute. + :attr:`virtual_machine_images` attribute. """ def __init__(self, *args, **kwargs) -> None: @@ -45710,15 +45531,16 @@ def __init__(self, *args, **kwargs) -> None: self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace - def get(self, location: str, gallery_unique_name: str, **kwargs: Any) -> _models.SharedGallery: - """Get a shared gallery by subscription id or tenant id. + def list_by_edge_zone(self, location: str, edge_zone: str, **kwargs: Any) -> _models.VmImagesInEdgeZoneListResult: + """Gets a list of all virtual machine image versions for the specified edge zone. - :param location: The name of the Azure region. Required. - :type location: str - :param gallery_unique_name: The unique name of the Shared Gallery. Required. - :type gallery_unique_name: str - :return: SharedGallery. The SharedGallery is compatible with MutableMapping - :rtype: ~azure.mgmt.compute.models.SharedGallery + :param location: The location name. Required. + :type location: str + :param edge_zone: The name of the edge zone. Required. + :type edge_zone: str + :return: VmImagesInEdgeZoneListResult. The VmImagesInEdgeZoneListResult is compatible with + MutableMapping + :rtype: ~azure.mgmt.compute.models.VmImagesInEdgeZoneListResult :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -45732,11 +45554,11 @@ def get(self, location: str, gallery_unique_name: str, **kwargs: Any) -> _models _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.SharedGallery] = kwargs.pop("cls", None) + cls: ClsType[_models.VmImagesInEdgeZoneListResult] = kwargs.pop("cls", None) - _request = build_shared_galleries_get_request( + _request = build_virtual_machine_images_list_by_edge_zone_request( location=location, - gallery_unique_name=gallery_unique_name, + edge_zone=edge_zone, subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -45767,7 +45589,7 @@ def get(self, location: str, gallery_unique_name: str, **kwargs: Any) -> _models if _stream: deserialized = response.iter_bytes() else: - deserialized = _deserialize(_models.SharedGallery, response.json()) + deserialized = _deserialize(_models.VmImagesInEdgeZoneListResult, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -45775,25 +45597,15 @@ def get(self, location: str, gallery_unique_name: str, **kwargs: Any) -> _models return deserialized # type: ignore @distributed_trace - def list( - self, location: str, *, shared_to: Optional[Union[str, _models.SharedToValues]] = None, **kwargs: Any - ) -> ItemPaged["_models.SharedGallery"]: - """List shared galleries by subscription id or tenant id. + 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 the Azure region. Required. + :param location: The location name. Required. :type location: str - :keyword shared_to: The query parameter to decide what shared galleries to fetch when doing - listing operations. "tenant" Default value is None. - :paramtype shared_to: str or ~azure.mgmt.compute.models.SharedToValues - :return: An iterator like instance of SharedGallery - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.models.SharedGallery] + :return: list of VirtualMachineImageResource + :rtype: list[~azure.mgmt.compute.models.VirtualMachineImageResource] :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[List[_models.SharedGallery]] = kwargs.pop("cls", None) - error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -45802,104 +45614,62 @@ def list( } error_map.update(kwargs.pop("error_map", {}) or {}) - def prepare_request(next_link=None): - if not next_link: - - _request = build_shared_galleries_list_request( - location=location, - subscription_id=self._config.subscription_id, - shared_to=shared_to, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - return _request - - def extract_data(pipeline_response): - deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.SharedGallery], deserialized.get("value", [])) - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.get("nextLink") or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response + cls: ClsType[List[_models.VirtualMachineImageResource]] = kwargs.pop("cls", None) - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.CloudError, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + _request = build_virtual_machine_images_list_publishers_request( + location=location, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) - return pipeline_response + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) - return ItemPaged(get_next, extract_data) + response = pipeline_response.http_response + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) -class SharedGalleryImagesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(List[_models.VirtualMachineImageResource], response.json()) - Instead, you should access the following operations through - :class:`~azure.mgmt.compute.ComputeClient`'s - :attr:`shared_gallery_images` attribute. - """ + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ComputeClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + return deserialized # type: ignore @distributed_trace - def get( - self, location: str, gallery_unique_name: str, gallery_image_name: str, **kwargs: Any - ) -> _models.SharedGalleryImage: - """Get a shared gallery image by subscription id or tenant id. + 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 the Azure region. Required. + :param location: The location name. Required. :type location: str - :param gallery_unique_name: The unique name of the Shared Gallery. Required. - :type gallery_unique_name: str - :param gallery_image_name: The name of the Shared Gallery Image Definition from which the Image - Versions are to be listed. Required. - :type gallery_image_name: str - :return: SharedGalleryImage. The SharedGalleryImage is compatible with MutableMapping - :rtype: ~azure.mgmt.compute.models.SharedGalleryImage + :param publisher_name: A valid image publisher. Required. + :type publisher_name: str + :return: list of VirtualMachineImageResource + :rtype: list[~azure.mgmt.compute.models.VirtualMachineImageResource] :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -45913,12 +45683,11 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.SharedGalleryImage] = kwargs.pop("cls", None) + cls: ClsType[List[_models.VirtualMachineImageResource]] = kwargs.pop("cls", None) - _request = build_shared_gallery_images_get_request( + _request = build_virtual_machine_images_list_offers_request( location=location, - gallery_unique_name=gallery_unique_name, - gallery_image_name=gallery_image_name, + publisher_name=publisher_name, subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -45949,7 +45718,7 @@ def get( if _stream: deserialized = response.iter_bytes() else: - deserialized = _deserialize(_models.SharedGalleryImage, response.json()) + deserialized = _deserialize(List[_models.VirtualMachineImageResource], response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -45957,32 +45726,21 @@ def get( return deserialized # type: ignore @distributed_trace - def list( - self, - location: str, - gallery_unique_name: str, - *, - shared_to: Optional[Union[str, _models.SharedToValues]] = None, - **kwargs: Any - ) -> ItemPaged["_models.SharedGalleryImage"]: - """List shared gallery images by subscription id or tenant id. + 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 the Azure region. Required. + :param location: The location name. Required. :type location: str - :param gallery_unique_name: The unique name of the Shared Gallery. Required. - :type gallery_unique_name: str - :keyword shared_to: The query parameter to decide what shared galleries to fetch when doing - listing operations. "tenant" Default value is None. - :paramtype shared_to: str or ~azure.mgmt.compute.models.SharedToValues - :return: An iterator like instance of SharedGalleryImage - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.models.SharedGalleryImage] + :param publisher_name: A valid image publisher. Required. + :type publisher_name: str + :param offer: A valid image publisher offer. Required. + :type offer: str + :return: list of VirtualMachineImageResource + :rtype: list[~azure.mgmt.compute.models.VirtualMachineImageResource] :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[List[_models.SharedGalleryImage]] = kwargs.pop("cls", None) - error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -45991,116 +45749,84 @@ def list( } error_map.update(kwargs.pop("error_map", {}) or {}) - def prepare_request(next_link=None): - if not next_link: - - _request = build_shared_gallery_images_list_request( - location=location, - gallery_unique_name=gallery_unique_name, - subscription_id=self._config.subscription_id, - shared_to=shared_to, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - return _request - - def extract_data(pipeline_response): - deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.SharedGalleryImage], deserialized.get("value", [])) - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.get("nextLink") or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response + cls: ClsType[List[_models.VirtualMachineImageResource]] = kwargs.pop("cls", None) - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.CloudError, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + _request = build_virtual_machine_images_list_skus_request( + location=location, + publisher_name=publisher_name, + offer=offer, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) - return pipeline_response + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) - return ItemPaged(get_next, extract_data) + response = pipeline_response.http_response + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) -class SharedGalleryImageVersionsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(List[_models.VirtualMachineImageResource], response.json()) - Instead, you should access the following operations through - :class:`~azure.mgmt.compute.ComputeClient`'s - :attr:`shared_gallery_image_versions` attribute. - """ + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ComputeClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + return deserialized # type: ignore @distributed_trace - def get( + def list( self, location: str, - gallery_unique_name: str, - gallery_image_name: str, - gallery_image_version_name: str, + publisher_name: str, + offer: str, + skus: str, + *, + expand: Optional[str] = None, + top: Optional[int] = None, + orderby: Optional[str] = None, **kwargs: Any - ) -> _models.SharedGalleryImageVersion: - """Get a shared gallery image version by subscription id or tenant id. + ) -> 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 the Azure region. Required. + :param location: The location name. Required. :type location: str - :param gallery_unique_name: The unique name of the Shared Gallery. Required. - :type gallery_unique_name: str - :param gallery_image_name: The name of the Shared Gallery Image Definition from which the Image - Versions are to be listed. Required. - :type gallery_image_name: str - :param gallery_image_version_name: The name of the gallery image version to be created. Needs - to follow semantic version name pattern: The allowed characters are digit and period. Digits - must be within the range of a 32-bit integer. Format: ... - Required. - :type gallery_image_version_name: str - :return: SharedGalleryImageVersion. The SharedGalleryImageVersion is compatible with - MutableMapping - :rtype: ~azure.mgmt.compute.models.SharedGalleryImageVersion + :param publisher_name: A valid image publisher. Required. + :type publisher_name: str + :param offer: A valid image publisher offer. Required. + :type offer: str + :param skus: A valid image SKU. Required. + :type skus: str + :keyword expand: The expand expression to apply on the operation. Default value is None. + :paramtype expand: str + :keyword top: Default value is None. + :paramtype top: int + :keyword orderby: Default value is None. + :paramtype orderby: str + :return: list of VirtualMachineImageResource + :rtype: list[~azure.mgmt.compute.models.VirtualMachineImageResource] :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -46114,14 +45840,17 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.SharedGalleryImageVersion] = kwargs.pop("cls", None) + cls: ClsType[List[_models.VirtualMachineImageResource]] = kwargs.pop("cls", None) - _request = build_shared_gallery_image_versions_get_request( + _request = build_virtual_machine_images_list_request( location=location, - gallery_unique_name=gallery_unique_name, - gallery_image_name=gallery_image_name, - gallery_image_version_name=gallery_image_version_name, + publisher_name=publisher_name, + offer=offer, + skus=skus, subscription_id=self._config.subscription_id, + expand=expand, + top=top, + orderby=orderby, api_version=self._config.api_version, headers=_headers, params=_params, @@ -46151,7 +45880,7 @@ def get( if _stream: deserialized = response.iter_bytes() else: - deserialized = _deserialize(_models.SharedGalleryImageVersion, response.json()) + deserialized = _deserialize(List[_models.VirtualMachineImageResource], response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -46159,139 +45888,36 @@ def get( return deserialized # type: ignore @distributed_trace - def list( + def list_with_properties( self, location: str, - gallery_unique_name: str, - gallery_image_name: str, + publisher_name: str, + offer: str, + skus: str, *, - shared_to: Optional[Union[str, _models.SharedToValues]] = None, + expand: str, + top: Optional[int] = None, + orderby: Optional[str] = None, **kwargs: Any - ) -> ItemPaged["_models.SharedGalleryImageVersion"]: - """List shared gallery image versions by subscription id or tenant id. - - :param location: The name of the Azure region. Required. - :type location: str - :param gallery_unique_name: The unique name of the Shared Gallery. Required. - :type gallery_unique_name: str - :param gallery_image_name: The name of the Shared Gallery Image Definition from which the Image - Versions are to be listed. Required. - :type gallery_image_name: str - :keyword shared_to: The query parameter to decide what shared galleries to fetch when doing - listing operations. "tenant" Default value is None. - :paramtype shared_to: str or ~azure.mgmt.compute.models.SharedToValues - :return: An iterator like instance of SharedGalleryImageVersion - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.models.SharedGalleryImageVersion] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[List[_models.SharedGalleryImageVersion]] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_shared_gallery_image_versions_list_request( - location=location, - gallery_unique_name=gallery_unique_name, - gallery_image_name=gallery_image_name, - subscription_id=self._config.subscription_id, - shared_to=shared_to, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - return _request - - def extract_data(pipeline_response): - deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.SharedGalleryImageVersion], deserialized.get("value", [])) - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.get("nextLink") or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.CloudError, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - -class CommunityGalleriesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.compute.ComputeClient`'s - :attr:`community_galleries` attribute. - """ - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ComputeClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def get(self, location: str, public_gallery_name: str, **kwargs: Any) -> _models.CommunityGallery: - """Get a community gallery by gallery public name. + ) -> List[_models.VirtualMachineImage]: + """list_with_properties. - :param location: The name of the Azure region. Required. + :param location: The location name. Required. :type location: str - :param public_gallery_name: The public name of the community gallery. Required. - :type public_gallery_name: str - :return: CommunityGallery. The CommunityGallery is compatible with MutableMapping - :rtype: ~azure.mgmt.compute.models.CommunityGallery + :param publisher_name: A valid image publisher. Required. + :type publisher_name: str + :param offer: A valid image publisher offer. Required. + :type offer: str + :param skus: A valid image SKU. Required. + :type skus: str + :keyword expand: The expand expression to apply on the operation. Required. + :paramtype expand: str + :keyword top: Default value is None. + :paramtype top: int + :keyword orderby: Default value is None. + :paramtype orderby: str + :return: list of VirtualMachineImage + :rtype: list[~azure.mgmt.compute.models.VirtualMachineImage] :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -46305,12 +45931,17 @@ def get(self, location: str, public_gallery_name: str, **kwargs: Any) -> _models _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.CommunityGallery] = kwargs.pop("cls", None) + cls: ClsType[List[_models.VirtualMachineImage]] = kwargs.pop("cls", None) - _request = build_community_galleries_get_request( + _request = build_virtual_machine_images_list_with_properties_request( location=location, - public_gallery_name=public_gallery_name, + publisher_name=publisher_name, + offer=offer, + skus=skus, subscription_id=self._config.subscription_id, + expand=expand, + top=top, + orderby=orderby, api_version=self._config.api_version, headers=_headers, params=_params, @@ -46340,45 +45971,31 @@ def get(self, location: str, public_gallery_name: str, **kwargs: Any) -> _models if _stream: deserialized = response.iter_bytes() else: - deserialized = _deserialize(_models.CommunityGallery, response.json()) + deserialized = _deserialize(List[_models.VirtualMachineImage], response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - -class CommunityGalleryImagesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.compute.ComputeClient`'s - :attr:`community_gallery_images` attribute. - """ - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ComputeClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace def get( - self, location: str, public_gallery_name: str, gallery_image_name: str, **kwargs: Any - ) -> _models.CommunityGalleryImage: - """Get a community gallery image. + 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 the Azure region. Required. :type location: str - :param public_gallery_name: The public name of the community gallery. Required. - :type public_gallery_name: str - :param gallery_image_name: The name of the community gallery image definition. Required. - :type gallery_image_name: str - :return: CommunityGalleryImage. The CommunityGalleryImage is compatible with MutableMapping - :rtype: ~azure.mgmt.compute.models.CommunityGalleryImage + :param publisher_name: A valid image publisher. Required. + :type publisher_name: str + :param offer: A valid image publisher offer. Required. + :type offer: str + :param skus: A valid image SKU. Required. + :type skus: str + :param version: A valid image SKU version. Required. + :type version: str + :return: VirtualMachineImage. The VirtualMachineImage is compatible with MutableMapping + :rtype: ~azure.mgmt.compute.models.VirtualMachineImage :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -46392,12 +46009,14 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.CommunityGalleryImage] = kwargs.pop("cls", None) + cls: ClsType[_models.VirtualMachineImage] = kwargs.pop("cls", None) - _request = build_community_gallery_images_get_request( + _request = build_virtual_machine_images_get_request( location=location, - public_gallery_name=public_gallery_name, - gallery_image_name=gallery_image_name, + publisher_name=publisher_name, + offer=offer, + skus=skus, + version=version, subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -46428,114 +46047,22 @@ def get( if _stream: deserialized = response.iter_bytes() else: - deserialized = _deserialize(_models.CommunityGalleryImage, response.json()) + deserialized = _deserialize(_models.VirtualMachineImage, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - @distributed_trace - def list( - self, location: str, public_gallery_name: str, **kwargs: Any - ) -> ItemPaged["_models.CommunityGalleryImage"]: - """List community gallery images inside a gallery. - - :param location: The name of the Azure region. Required. - :type location: str - :param public_gallery_name: The public name of the community gallery. Required. - :type public_gallery_name: str - :return: An iterator like instance of CommunityGalleryImage - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.models.CommunityGalleryImage] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[List[_models.CommunityGalleryImage]] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_community_gallery_images_list_request( - location=location, - public_gallery_name=public_gallery_name, - subscription_id=self._config.subscription_id, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - return _request - - def extract_data(pipeline_response): - deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.CommunityGalleryImage], deserialized.get("value", [])) - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.get("nextLink") or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.CloudError, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - -class CommunityGalleryImageVersionsOperations: +class LogAnalyticsOperations: """ .. warning:: **DO NOT** instantiate this class directly. Instead, you should access the following operations through :class:`~azure.mgmt.compute.ComputeClient`'s - :attr:`community_gallery_image_versions` attribute. + :attr:`log_analytics` attribute. """ def __init__(self, *args, **kwargs) -> None: @@ -46545,33 +46072,9 @@ def __init__(self, *args, **kwargs) -> None: self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def get( - self, - location: str, - public_gallery_name: str, - gallery_image_name: str, - gallery_image_version_name: str, - **kwargs: Any - ) -> _models.CommunityGalleryImageVersion: - """Get a community gallery image version. - - :param location: The name of the Azure region. Required. - :type location: str - :param public_gallery_name: The public name of the community gallery. Required. - :type public_gallery_name: str - :param gallery_image_name: The name of the community gallery image definition. Required. - :type gallery_image_name: str - :param gallery_image_version_name: The name of the community gallery image version. Needs to - follow semantic version name pattern: The allowed characters are digit and period. Digits must - be within the range of a 32-bit integer. Format: ... - Required. - :type gallery_image_version_name: str - :return: CommunityGalleryImageVersion. The CommunityGalleryImageVersion is compatible with - MutableMapping - :rtype: ~azure.mgmt.compute.models.CommunityGalleryImageVersion - :raises ~azure.core.exceptions.HttpResponseError: - """ + def _export_request_rate_by_interval_initial( + self, location: str, parameters: Union[_models.RequestRateByIntervalInput, JSON, IO[bytes]], **kwargs: Any + ) -> Iterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -46580,18 +46083,25 @@ def get( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.CommunityGalleryImageVersion] = kwargs.pop("cls", None) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - _request = build_community_gallery_image_versions_get_request( + content_type = content_type or "application/json" + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_log_analytics_export_request_rate_by_interval_request( location=location, - public_gallery_name=public_gallery_name, - gallery_image_name=gallery_image_name, - gallery_image_version_name=gallery_image_version_name, subscription_id=self._config.subscription_id, + content_type=content_type, api_version=self._config.api_version, + content=_content, headers=_headers, params=_params, ) @@ -46600,54 +46110,181 @@ def get( } _request.url = self._client.format_url(_request.url, **path_format_arguments) - _stream = kwargs.pop("stream", False) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200]: - if _stream: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass + if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = _failsafe_deserialize(_models.CloudError, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if _stream: - deserialized = response.iter_bytes() - else: - deserialized = _deserialize(_models.CommunityGalleryImageVersion, response.json()) + response_headers = {} + if response.status_code == 202: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore + @overload + def begin_export_request_rate_by_interval( + self, + location: str, + parameters: _models.RequestRateByIntervalInput, + *, + content_type: str = "application/json", + **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 name. Required. + :type location: str + :param parameters: Parameters supplied to the LogAnalytics getRequestRateByInterval Api. + Required. + :type parameters: ~azure.mgmt.compute.models.RequestRateByIntervalInput + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns LogAnalyticsOperationResult. The + LogAnalyticsOperationResult is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.LogAnalyticsOperationResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_export_request_rate_by_interval( + self, location: str, parameters: JSON, *, content_type: str = "application/json", **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 name. Required. + :type location: str + :param parameters: Parameters supplied to the LogAnalytics getRequestRateByInterval Api. + Required. + :type parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns LogAnalyticsOperationResult. The + LogAnalyticsOperationResult is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.LogAnalyticsOperationResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_export_request_rate_by_interval( + self, location: str, parameters: IO[bytes], *, content_type: str = "application/json", **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 name. Required. + :type location: str + :param parameters: Parameters supplied to the LogAnalytics getRequestRateByInterval Api. + Required. + :type parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns LogAnalyticsOperationResult. The + LogAnalyticsOperationResult is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.LogAnalyticsOperationResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + @distributed_trace - def list( - self, location: str, public_gallery_name: str, gallery_image_name: str, **kwargs: Any - ) -> ItemPaged["_models.CommunityGalleryImageVersion"]: - """List community gallery image versions inside an image. + def begin_export_request_rate_by_interval( + self, location: str, parameters: Union[_models.RequestRateByIntervalInput, JSON, IO[bytes]], **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 name of the Azure region. Required. + :param location: The location name. Required. :type location: str - :param public_gallery_name: The public name of the community gallery. Required. - :type public_gallery_name: str - :param gallery_image_name: The name of the community gallery image definition. Required. - :type gallery_image_name: str - :return: An iterator like instance of CommunityGalleryImageVersion - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.models.CommunityGalleryImageVersion] + :param parameters: Parameters supplied to the LogAnalytics getRequestRateByInterval Api. Is one + of the following types: RequestRateByIntervalInput, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.compute.models.RequestRateByIntervalInput or JSON or IO[bytes] + :return: An instance of LROPoller that returns LogAnalyticsOperationResult. The + LogAnalyticsOperationResult is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.LogAnalyticsOperationResult] :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = kwargs.pop("headers", {}) or {} + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.CommunityGalleryImageVersion]] = kwargs.pop("cls", None) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.LogAnalyticsOperationResult] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._export_request_rate_by_interval_initial( + location=location, + parameters=parameters, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = _deserialize(_models.LogAnalyticsOperationResult, response.json()) + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + return deserialized + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.LogAnalyticsOperationResult].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.LogAnalyticsOperationResult]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _export_throttled_requests_initial( + self, location: str, parameters: Union[_models.ThrottledRequestsInput, JSON, IO[bytes]], **kwargs: Any + ) -> Iterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -46656,183 +46293,201 @@ def list( } error_map.update(kwargs.pop("error_map", {}) or {}) - def prepare_request(next_link=None): - if not next_link: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} - _request = build_community_gallery_image_versions_list_request( - location=location, - public_gallery_name=public_gallery_name, - gallery_image_name=gallery_image_name, - subscription_id=self._config.subscription_id, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) + content_type = content_type or "application/json" + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - return _request + _request = build_log_analytics_export_throttled_requests_request( + location=location, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) - def extract_data(pipeline_response): - deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.CommunityGalleryImageVersion], deserialized.get("value", [])) - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.get("nextLink") or None, iter(list_of_elem) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) - def get_next(next_link=None): - _request = prepare_request(next_link) + response = pipeline_response.http_response - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs + if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") ) - response = pipeline_response.http_response + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.CloudError, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.iter_bytes() - return pipeline_response + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore - return ItemPaged(get_next, extract_data) + return deserialized # type: ignore + + @overload + def begin_export_throttled_requests( + self, + location: str, + parameters: _models.ThrottledRequestsInput, + *, + content_type: str = "application/json", + **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 name. Required. + :type location: str + :param parameters: The request body. Required. + :type parameters: ~azure.mgmt.compute.models.ThrottledRequestsInput + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns LogAnalyticsOperationResult. The + LogAnalyticsOperationResult is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.LogAnalyticsOperationResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + @overload + def begin_export_throttled_requests( + self, location: str, parameters: JSON, *, content_type: str = "application/json", **kwargs: Any + ) -> LROPoller[_models.LogAnalyticsOperationResult]: + """Export logs that show total throttled Api requests for this subscription in the given time + window. -class ResourceSkusOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. + :param location: The location name. Required. + :type location: str + :param parameters: The request body. Required. + :type parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns LogAnalyticsOperationResult. The + LogAnalyticsOperationResult is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.LogAnalyticsOperationResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ - Instead, you should access the following operations through - :class:`~azure.mgmt.compute.ComputeClient`'s - :attr:`resource_skus` attribute. - """ + @overload + def begin_export_throttled_requests( + self, location: str, parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any + ) -> LROPoller[_models.LogAnalyticsOperationResult]: + """Export logs that show total throttled Api requests for this subscription in the given time + window. - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ComputeClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + :param location: The location name. Required. + :type location: str + :param parameters: The request body. Required. + :type parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns LogAnalyticsOperationResult. The + LogAnalyticsOperationResult is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.LogAnalyticsOperationResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace - def list( - self, *, filter: Optional[str] = None, include_extended_locations: Optional[str] = None, **kwargs: Any - ) -> ItemPaged["_models.ResourceSku"]: - """Gets the list of Microsoft.Compute SKUs available for your Subscription. + def begin_export_throttled_requests( + self, location: str, parameters: Union[_models.ThrottledRequestsInput, JSON, IO[bytes]], **kwargs: Any + ) -> LROPoller[_models.LogAnalyticsOperationResult]: + """Export logs that show total throttled Api requests for this subscription in the given time + window. - :keyword filter: The filter to apply on the operation. Only **location** filter is supported - currently. Default value is None. - :paramtype filter: str - :keyword include_extended_locations: To Include Extended Locations information or not in the - response. Default value is None. - :paramtype include_extended_locations: str - :return: An iterator like instance of ResourceSku - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.models.ResourceSku] + :param location: The location name. Required. + :type location: str + :param parameters: The request body. Is one of the following types: ThrottledRequestsInput, + JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.compute.models.ThrottledRequestsInput or JSON or IO[bytes] + :return: An instance of LROPoller that returns LogAnalyticsOperationResult. The + LogAnalyticsOperationResult is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.LogAnalyticsOperationResult] :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = kwargs.pop("headers", {}) or {} + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.ResourceSku]] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_resource_skus_list_request( - subscription_id=self._config.subscription_id, - filter=filter, - include_extended_locations=include_extended_locations, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.LogAnalyticsOperationResult] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._export_throttled_requests_initial( + location=location, + parameters=parameters, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) - return _request + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - def extract_data(pipeline_response): - deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.ResourceSku], deserialized.get("value", [])) + deserialized = _deserialize(_models.LogAnalyticsOperationResult, response.json()) if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.get("nextLink") or None, iter(list_of_elem) + return cls(pipeline_response, deserialized, response_headers) # type: ignore + return deserialized - def get_next(next_link=None): - _request = prepare_request(next_link) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.LogAnalyticsOperationResult].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.LogAnalyticsOperationResult]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) class DiskRestorePointOperations: @@ -47378,7 +47033,7 @@ def begin_revoke_access( vm_restore_point_name: str, disk_restore_point_name: str, **kwargs: Any - ) -> LROPoller[_models.OkResponse]: + ) -> LROPoller[None]: """Revokes access to a diskRestorePoint. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -47392,15 +47047,14 @@ def begin_revoke_access( :type vm_restore_point_name: str :param disk_restore_point_name: The name of the DiskRestorePoint. Required. :type disk_restore_point_name: str - :return: An instance of LROPoller that returns OkResponse. The OkResponse is compatible with - MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.OkResponse] + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.OkResponse] = kwargs.pop("cls", None) + cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) @@ -47418,15 +47072,374 @@ def begin_revoke_access( raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): - response_headers = {} + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + +class SoftDeletedResourceOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.compute.ComputeClient`'s + :attr:`soft_deleted_resource` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list_by_artifact_name( + self, resource_group_name: str, gallery_name: str, artifact_type: str, artifact_name: str, **kwargs: Any + ) -> ItemPaged["_models.GallerySoftDeletedResource"]: + """List soft-deleted resources of an artifact in the gallery, such as soft-deleted gallery image + version of an image. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param artifact_type: The type of the artifact to be listed, such as gallery image version. + Required. + :type artifact_type: str + :param artifact_name: The artifact name to be listed. If artifact type is Images, then the + artifact name should be the gallery image name. Required. + :type artifact_name: str + :return: An iterator like instance of GallerySoftDeletedResource + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.models.GallerySoftDeletedResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.GallerySoftDeletedResource]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_soft_deleted_resource_list_by_artifact_name_request( + resource_group_name=resource_group_name, + gallery_name=gallery_name, + artifact_type=artifact_type, + artifact_name=artifact_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.GallerySoftDeletedResource], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + +class GallerySharingProfileOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.compute.ComputeClient`'s + :attr:`gallery_sharing_profile` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + def _update_initial( + self, + resource_group_name: str, + gallery_name: str, + sharing_update: Union[_models.SharingUpdate, JSON, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(sharing_update, (IOBase, bytes)): + _content = sharing_update + else: + _content = json.dumps(sharing_update, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_gallery_sharing_profile_update_request( + resource_group_name=resource_group_name, + gallery_name=gallery_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - deserialized = _deserialize(_models.OkResponse, response.json()) + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_update( + self, + resource_group_name: str, + gallery_name: str, + sharing_update: _models.SharingUpdate, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.SharingUpdate]: + """Update sharing profile of a gallery. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param sharing_update: Parameters supplied to the update gallery sharing profile. Required. + :type sharing_update: ~azure.mgmt.compute.models.SharingUpdate + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns SharingUpdate. The SharingUpdate is compatible + with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.SharingUpdate] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update( + self, + resource_group_name: str, + gallery_name: str, + sharing_update: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.SharingUpdate]: + """Update sharing profile of a gallery. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param sharing_update: Parameters supplied to the update gallery sharing profile. Required. + :type sharing_update: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns SharingUpdate. The SharingUpdate is compatible + with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.SharingUpdate] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update( + self, + resource_group_name: str, + gallery_name: str, + sharing_update: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.SharingUpdate]: + """Update sharing profile of a gallery. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param sharing_update: Parameters supplied to the update gallery sharing profile. Required. + :type sharing_update: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns SharingUpdate. The SharingUpdate is compatible + with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.SharingUpdate] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update( + self, + resource_group_name: str, + gallery_name: str, + sharing_update: Union[_models.SharingUpdate, JSON, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.SharingUpdate]: + """Update sharing profile of a gallery. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param sharing_update: Parameters supplied to the update gallery sharing profile. Is one of the + following types: SharingUpdate, JSON, IO[bytes] Required. + :type sharing_update: ~azure.mgmt.compute.models.SharingUpdate or JSON or IO[bytes] + :return: An instance of LROPoller that returns SharingUpdate. The SharingUpdate is compatible + with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.models.SharingUpdate] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SharingUpdate] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._update_initial( + resource_group_name=resource_group_name, + gallery_name=gallery_name, + sharing_update=sharing_update, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.SharingUpdate, response.json()) if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized path_format_arguments = { @@ -47442,12 +47455,12 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller[_models.OkResponse].from_continuation_token( + return LROPoller[_models.SharingUpdate].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller[_models.OkResponse]( + return LROPoller[_models.SharingUpdate]( self._client, raw_result, get_long_running_output, polling_method # type: ignore ) diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_disk_accesses_operations.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_disk_accesses_operations.py index 03a2237818ac..79846cc7f3bc 100644 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_disk_accesses_operations.py +++ b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_disk_accesses_operations.py @@ -135,3 +135,72 @@ def test_disk_accesses_get_private_link_resources(self, resource_group): # please add some check logic here by yourself # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_disk_accesses_get_a_private_endpoint_connection(self, resource_group): + response = self.client.disk_accesses.get_a_private_endpoint_connection( + resource_group_name=resource_group.name, + disk_access_name="str", + private_endpoint_connection_name="str", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_disk_accesses_begin_update_a_private_endpoint_connection(self, resource_group): + response = self.client.disk_accesses.begin_update_a_private_endpoint_connection( + resource_group_name=resource_group.name, + disk_access_name="str", + private_endpoint_connection_name="str", + private_endpoint_connection={ + "id": "str", + "name": "str", + "properties": { + "privateLinkServiceConnectionState": { + "actionsRequired": "str", + "description": "str", + "status": "str", + }, + "privateEndpoint": {"id": "str"}, + "provisioningState": "str", + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_disk_accesses_begin_delete_a_private_endpoint_connection(self, resource_group): + response = self.client.disk_accesses.begin_delete_a_private_endpoint_connection( + resource_group_name=resource_group.name, + disk_access_name="str", + private_endpoint_connection_name="str", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_disk_accesses_list_private_endpoint_connections(self, resource_group): + response = self.client.disk_accesses.list_private_endpoint_connections( + resource_group_name=resource_group.name, + disk_access_name="str", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_disk_accesses_operations_async.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_disk_accesses_operations_async.py index 9877f632d46b..eacd578ed821 100644 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_disk_accesses_operations_async.py +++ b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_disk_accesses_operations_async.py @@ -142,3 +142,76 @@ async def test_disk_accesses_get_private_link_resources(self, resource_group): # please add some check logic here by yourself # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_disk_accesses_get_a_private_endpoint_connection(self, resource_group): + response = await self.client.disk_accesses.get_a_private_endpoint_connection( + resource_group_name=resource_group.name, + disk_access_name="str", + private_endpoint_connection_name="str", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_disk_accesses_begin_update_a_private_endpoint_connection(self, resource_group): + response = await ( + await self.client.disk_accesses.begin_update_a_private_endpoint_connection( + resource_group_name=resource_group.name, + disk_access_name="str", + private_endpoint_connection_name="str", + private_endpoint_connection={ + "id": "str", + "name": "str", + "properties": { + "privateLinkServiceConnectionState": { + "actionsRequired": "str", + "description": "str", + "status": "str", + }, + "privateEndpoint": {"id": "str"}, + "provisioningState": "str", + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_disk_accesses_begin_delete_a_private_endpoint_connection(self, resource_group): + response = await ( + await self.client.disk_accesses.begin_delete_a_private_endpoint_connection( + resource_group_name=resource_group.name, + disk_access_name="str", + private_endpoint_connection_name="str", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_disk_accesses_list_private_endpoint_connections(self, resource_group): + response = self.client.disk_accesses.list_private_endpoint_connections( + resource_group_name=resource_group.name, + disk_access_name="str", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_galleries_operations.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_galleries_operations.py index 47e32d8f9482..5ff8f99dfd13 100644 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_galleries_operations.py +++ b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_galleries_operations.py @@ -156,28 +156,3 @@ def test_galleries_list(self, resource_group): result = [r for r in response] # please add some check logic here by yourself # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_galleries_list_by_artifact_name(self, resource_group): - response = self.client.galleries.list_by_artifact_name( - resource_group_name=resource_group.name, - gallery_name="str", - artifact_type="str", - artifact_name="str", - ) - result = [r for r in response] - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_galleries_begin_gallery_sharing_profile_update(self, resource_group): - response = self.client.galleries.begin_gallery_sharing_profile_update( - resource_group_name=resource_group.name, - gallery_name="str", - sharing_update={"operationType": "str", "groups": [{"ids": ["str"], "type": "str"}]}, - ).result() # call '.result()' to poll until service return final result - - # please add some check logic here by yourself - # ... diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_galleries_operations_async.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_galleries_operations_async.py index d2c3b8954e17..c3b9dca99827 100644 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_galleries_operations_async.py +++ b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_galleries_operations_async.py @@ -163,30 +163,3 @@ async def test_galleries_list(self, resource_group): result = [r async for r in response] # please add some check logic here by yourself # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_galleries_list_by_artifact_name(self, resource_group): - response = self.client.galleries.list_by_artifact_name( - resource_group_name=resource_group.name, - gallery_name="str", - artifact_type="str", - artifact_name="str", - ) - result = [r async for r in response] - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_galleries_begin_gallery_sharing_profile_update(self, resource_group): - response = await ( - await self.client.galleries.begin_gallery_sharing_profile_update( - resource_group_name=resource_group.name, - gallery_name="str", - sharing_update={"operationType": "str", "groups": [{"ids": ["str"], "type": "str"}]}, - ) - ).result() # call '.result()' to poll until service return final result - - # please add some check logic here by yourself - # ... diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machine_scale_sets_operation_group_operations.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_gallery_sharing_profile_operations.py similarity index 67% rename from sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machine_scale_sets_operation_group_operations.py rename to sdk/compute/azure-mgmt-compute/generated_tests/test_compute_gallery_sharing_profile_operations.py index dc9a5882e001..d01101c8197f 100644 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machine_scale_sets_operation_group_operations.py +++ b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_gallery_sharing_profile_operations.py @@ -14,16 +14,18 @@ @pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestComputeVirtualMachineScaleSetsOperationGroupOperations(AzureMgmtRecordedTestCase): +class TestComputeGallerySharingProfileOperations(AzureMgmtRecordedTestCase): def setup_method(self, method): self.client = self.create_mgmt_client(ComputeClient) @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_virtual_machine_scale_sets_operation_group_list_by_location(self, resource_group): - response = self.client.virtual_machine_scale_sets_operation_group.list_by_location( - location="str", - ) - result = [r for r in response] + def test_gallery_sharing_profile_begin_update(self, resource_group): + response = self.client.gallery_sharing_profile.begin_update( + resource_group_name=resource_group.name, + gallery_name="str", + sharing_update={"operationType": "str", "groups": [{"ids": ["str"], "type": "str"}]}, + ).result() # call '.result()' to poll until service return final result + # please add some check logic here by yourself # ... diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machine_scale_sets_operation_group_operations_async.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_gallery_sharing_profile_operations_async.py similarity index 66% rename from sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machine_scale_sets_operation_group_operations_async.py rename to sdk/compute/azure-mgmt-compute/generated_tests/test_compute_gallery_sharing_profile_operations_async.py index 4b8dcb689f14..eeb91763421a 100644 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machine_scale_sets_operation_group_operations_async.py +++ b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_gallery_sharing_profile_operations_async.py @@ -15,16 +15,20 @@ @pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestComputeVirtualMachineScaleSetsOperationGroupOperationsAsync(AzureMgmtRecordedTestCase): +class TestComputeGallerySharingProfileOperationsAsync(AzureMgmtRecordedTestCase): def setup_method(self, method): self.client = self.create_mgmt_client(ComputeClient, is_async=True) @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_virtual_machine_scale_sets_operation_group_list_by_location(self, resource_group): - response = self.client.virtual_machine_scale_sets_operation_group.list_by_location( - location="str", - ) - result = [r async for r in response] + async def test_gallery_sharing_profile_begin_update(self, resource_group): + response = await ( + await self.client.gallery_sharing_profile.begin_update( + resource_group_name=resource_group.name, + gallery_name="str", + sharing_update={"operationType": "str", "groups": [{"ids": ["str"], "type": "str"}]}, + ) + ).result() # call '.result()' to poll until service return final result + # please add some check logic here by yourself # ... diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_log_analytics_operation_group_operations.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_log_analytics_operations.py similarity index 82% rename from sdk/compute/azure-mgmt-compute/generated_tests/test_compute_log_analytics_operation_group_operations.py rename to sdk/compute/azure-mgmt-compute/generated_tests/test_compute_log_analytics_operations.py index 3858422d3c5b..871f110784c5 100644 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_log_analytics_operation_group_operations.py +++ b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_log_analytics_operations.py @@ -14,14 +14,14 @@ @pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestComputeLogAnalyticsOperationGroupOperations(AzureMgmtRecordedTestCase): +class TestComputeLogAnalyticsOperations(AzureMgmtRecordedTestCase): def setup_method(self, method): self.client = self.create_mgmt_client(ComputeClient) @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_log_analytics_operation_group_begin_export_request_rate_by_interval(self, resource_group): - response = self.client.log_analytics_operation_group.begin_export_request_rate_by_interval( + def test_log_analytics_begin_export_request_rate_by_interval(self, resource_group): + response = self.client.log_analytics.begin_export_request_rate_by_interval( location="str", parameters={ "blobContainerSasUri": "str", @@ -41,8 +41,8 @@ def test_log_analytics_operation_group_begin_export_request_rate_by_interval(sel @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_log_analytics_operation_group_begin_export_throttled_requests(self, resource_group): - response = self.client.log_analytics_operation_group.begin_export_throttled_requests( + def test_log_analytics_begin_export_throttled_requests(self, resource_group): + response = self.client.log_analytics.begin_export_throttled_requests( location="str", parameters={ "blobContainerSasUri": "str", diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_log_analytics_operation_group_operations_async.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_log_analytics_operations_async.py similarity index 83% rename from sdk/compute/azure-mgmt-compute/generated_tests/test_compute_log_analytics_operation_group_operations_async.py rename to sdk/compute/azure-mgmt-compute/generated_tests/test_compute_log_analytics_operations_async.py index 16b6307e078b..7c900034af93 100644 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_log_analytics_operation_group_operations_async.py +++ b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_log_analytics_operations_async.py @@ -15,15 +15,15 @@ @pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestComputeLogAnalyticsOperationGroupOperationsAsync(AzureMgmtRecordedTestCase): +class TestComputeLogAnalyticsOperationsAsync(AzureMgmtRecordedTestCase): def setup_method(self, method): self.client = self.create_mgmt_client(ComputeClient, is_async=True) @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_log_analytics_operation_group_begin_export_request_rate_by_interval(self, resource_group): + async def test_log_analytics_begin_export_request_rate_by_interval(self, resource_group): response = await ( - await self.client.log_analytics_operation_group.begin_export_request_rate_by_interval( + await self.client.log_analytics.begin_export_request_rate_by_interval( location="str", parameters={ "blobContainerSasUri": "str", @@ -44,9 +44,9 @@ async def test_log_analytics_operation_group_begin_export_request_rate_by_interv @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_log_analytics_operation_group_begin_export_throttled_requests(self, resource_group): + async def test_log_analytics_begin_export_throttled_requests(self, resource_group): response = await ( - await self.client.log_analytics_operation_group.begin_export_throttled_requests( + await self.client.log_analytics.begin_export_throttled_requests( location="str", parameters={ "blobContainerSasUri": "str", diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_private_endpoint_connections_operations.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_private_endpoint_connections_operations.py deleted file mode 100644 index b092ad4d3b3b..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_private_endpoint_connections_operations.py +++ /dev/null @@ -1,88 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import pytest -from azure.mgmt.compute import ComputeClient - -from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy - -AZURE_LOCATION = "eastus" - - -@pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestComputePrivateEndpointConnectionsOperations(AzureMgmtRecordedTestCase): - def setup_method(self, method): - self.client = self.create_mgmt_client(ComputeClient) - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_private_endpoint_connections_get_a_private_endpoint_connection(self, resource_group): - response = self.client.private_endpoint_connections.get_a_private_endpoint_connection( - resource_group_name=resource_group.name, - disk_access_name="str", - private_endpoint_connection_name="str", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_private_endpoint_connections_begin_update_a_private_endpoint_connection(self, resource_group): - response = self.client.private_endpoint_connections.begin_update_a_private_endpoint_connection( - resource_group_name=resource_group.name, - disk_access_name="str", - private_endpoint_connection_name="str", - private_endpoint_connection={ - "id": "str", - "name": "str", - "properties": { - "privateLinkServiceConnectionState": { - "actionsRequired": "str", - "description": "str", - "status": "str", - }, - "privateEndpoint": {"id": "str"}, - "provisioningState": "str", - }, - "systemData": { - "createdAt": "2020-02-20 00:00:00", - "createdBy": "str", - "createdByType": "str", - "lastModifiedAt": "2020-02-20 00:00:00", - "lastModifiedBy": "str", - "lastModifiedByType": "str", - }, - "type": "str", - }, - ).result() # call '.result()' to poll until service return final result - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_private_endpoint_connections_begin_delete_a_private_endpoint_connection(self, resource_group): - response = self.client.private_endpoint_connections.begin_delete_a_private_endpoint_connection( - resource_group_name=resource_group.name, - disk_access_name="str", - private_endpoint_connection_name="str", - ).result() # call '.result()' to poll until service return final result - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_private_endpoint_connections_list_private_endpoint_connections(self, resource_group): - response = self.client.private_endpoint_connections.list_private_endpoint_connections( - resource_group_name=resource_group.name, - disk_access_name="str", - ) - result = [r for r in response] - # please add some check logic here by yourself - # ... diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_private_endpoint_connections_operations_async.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_private_endpoint_connections_operations_async.py deleted file mode 100644 index 9496bbe6f061..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_private_endpoint_connections_operations_async.py +++ /dev/null @@ -1,93 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import pytest -from azure.mgmt.compute.aio import ComputeClient - -from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer -from devtools_testutils.aio import recorded_by_proxy_async - -AZURE_LOCATION = "eastus" - - -@pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestComputePrivateEndpointConnectionsOperationsAsync(AzureMgmtRecordedTestCase): - def setup_method(self, method): - self.client = self.create_mgmt_client(ComputeClient, is_async=True) - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_private_endpoint_connections_get_a_private_endpoint_connection(self, resource_group): - response = await self.client.private_endpoint_connections.get_a_private_endpoint_connection( - resource_group_name=resource_group.name, - disk_access_name="str", - private_endpoint_connection_name="str", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_private_endpoint_connections_begin_update_a_private_endpoint_connection(self, resource_group): - response = await ( - await self.client.private_endpoint_connections.begin_update_a_private_endpoint_connection( - resource_group_name=resource_group.name, - disk_access_name="str", - private_endpoint_connection_name="str", - private_endpoint_connection={ - "id": "str", - "name": "str", - "properties": { - "privateLinkServiceConnectionState": { - "actionsRequired": "str", - "description": "str", - "status": "str", - }, - "privateEndpoint": {"id": "str"}, - "provisioningState": "str", - }, - "systemData": { - "createdAt": "2020-02-20 00:00:00", - "createdBy": "str", - "createdByType": "str", - "lastModifiedAt": "2020-02-20 00:00:00", - "lastModifiedBy": "str", - "lastModifiedByType": "str", - }, - "type": "str", - }, - ) - ).result() # call '.result()' to poll until service return final result - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_private_endpoint_connections_begin_delete_a_private_endpoint_connection(self, resource_group): - response = await ( - await self.client.private_endpoint_connections.begin_delete_a_private_endpoint_connection( - resource_group_name=resource_group.name, - disk_access_name="str", - private_endpoint_connection_name="str", - ) - ).result() # call '.result()' to poll until service return final result - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_private_endpoint_connections_list_private_endpoint_connections(self, resource_group): - response = self.client.private_endpoint_connections.list_private_endpoint_connections( - resource_group_name=resource_group.name, - disk_access_name="str", - ) - result = [r async for r in response] - # please add some check logic here by yourself - # ... diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_restore_point_collections_operations.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_restore_point_collections_operations.py index 96b0159ccdc8..bcb219af803a 100644 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_restore_point_collections_operations.py +++ b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_restore_point_collections_operations.py @@ -119,7 +119,7 @@ def test_restore_point_collections_create_or_update(self, resource_group): { "componentName": "Microsoft-Windows-Shell-Setup", "content": "str", - "passName": "str", + "passName": "OobeSystem", "settingName": "str", } ], @@ -327,7 +327,7 @@ def test_restore_point_collections_update(self, resource_group): { "componentName": "Microsoft-Windows-Shell-Setup", "content": "str", - "passName": "str", + "passName": "OobeSystem", "settingName": "str", } ], diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_restore_point_collections_operations_async.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_restore_point_collections_operations_async.py index f1631dc4c732..8c4c9dede91c 100644 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_restore_point_collections_operations_async.py +++ b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_restore_point_collections_operations_async.py @@ -120,7 +120,7 @@ async def test_restore_point_collections_create_or_update(self, resource_group): { "componentName": "Microsoft-Windows-Shell-Setup", "content": "str", - "passName": "str", + "passName": "OobeSystem", "settingName": "str", } ], @@ -328,7 +328,7 @@ async def test_restore_point_collections_update(self, resource_group): { "componentName": "Microsoft-Windows-Shell-Setup", "content": "str", - "passName": "str", + "passName": "OobeSystem", "settingName": "str", } ], diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_restore_points_operations.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_restore_points_operations.py index 6c2982973fbe..92bf5b954fac 100644 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_restore_points_operations.py +++ b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_restore_points_operations.py @@ -111,7 +111,7 @@ def test_restore_points_begin_create(self, resource_group): { "componentName": "Microsoft-Windows-Shell-Setup", "content": "str", - "passName": "str", + "passName": "OobeSystem", "settingName": "str", } ], diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_restore_points_operations_async.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_restore_points_operations_async.py index a634c6865f86..bae0ab70cebb 100644 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_restore_points_operations_async.py +++ b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_restore_points_operations_async.py @@ -113,7 +113,7 @@ async def test_restore_points_begin_create(self, resource_group): { "componentName": "Microsoft-Windows-Shell-Setup", "content": "str", - "passName": "str", + "passName": "OobeSystem", "settingName": "str", } ], diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_rolling_upgrade_status_infos_operations.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_soft_deleted_resource_operations.py similarity index 74% rename from sdk/compute/azure-mgmt-compute/generated_tests/test_compute_rolling_upgrade_status_infos_operations.py rename to sdk/compute/azure-mgmt-compute/generated_tests/test_compute_soft_deleted_resource_operations.py index b1292020ccc4..e249f0d85438 100644 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_rolling_upgrade_status_infos_operations.py +++ b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_soft_deleted_resource_operations.py @@ -14,17 +14,19 @@ @pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestComputeRollingUpgradeStatusInfosOperations(AzureMgmtRecordedTestCase): +class TestComputeSoftDeletedResourceOperations(AzureMgmtRecordedTestCase): def setup_method(self, method): self.client = self.create_mgmt_client(ComputeClient) @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_rolling_upgrade_status_infos_get_latest(self, resource_group): - response = self.client.rolling_upgrade_status_infos.get_latest( + def test_soft_deleted_resource_list_by_artifact_name(self, resource_group): + response = self.client.soft_deleted_resource.list_by_artifact_name( resource_group_name=resource_group.name, - vm_scale_set_name="str", + gallery_name="str", + artifact_type="str", + artifact_name="str", ) - + result = [r for r in response] # please add some check logic here by yourself # ... diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_rolling_upgrade_status_infos_operations_async.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_soft_deleted_resource_operations_async.py similarity index 74% rename from sdk/compute/azure-mgmt-compute/generated_tests/test_compute_rolling_upgrade_status_infos_operations_async.py rename to sdk/compute/azure-mgmt-compute/generated_tests/test_compute_soft_deleted_resource_operations_async.py index 443790999cef..e7ea0a7a7a2d 100644 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_rolling_upgrade_status_infos_operations_async.py +++ b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_soft_deleted_resource_operations_async.py @@ -15,17 +15,19 @@ @pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestComputeRollingUpgradeStatusInfosOperationsAsync(AzureMgmtRecordedTestCase): +class TestComputeSoftDeletedResourceOperationsAsync(AzureMgmtRecordedTestCase): def setup_method(self, method): self.client = self.create_mgmt_client(ComputeClient, is_async=True) @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_rolling_upgrade_status_infos_get_latest(self, resource_group): - response = await self.client.rolling_upgrade_status_infos.get_latest( + async def test_soft_deleted_resource_list_by_artifact_name(self, resource_group): + response = self.client.soft_deleted_resource.list_by_artifact_name( resource_group_name=resource_group.name, - vm_scale_set_name="str", + gallery_name="str", + artifact_type="str", + artifact_name="str", ) - + result = [r async for r in response] # please add some check logic here by yourself # ... diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_ssh_public_key_resources_operations.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_ssh_public_keys_operations.py similarity index 75% rename from sdk/compute/azure-mgmt-compute/generated_tests/test_compute_ssh_public_key_resources_operations.py rename to sdk/compute/azure-mgmt-compute/generated_tests/test_compute_ssh_public_keys_operations.py index 4a988250eb4c..a7c3f75b0b75 100644 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_ssh_public_key_resources_operations.py +++ b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_ssh_public_keys_operations.py @@ -14,14 +14,14 @@ @pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestComputeSshPublicKeyResourcesOperations(AzureMgmtRecordedTestCase): +class TestComputeSshPublicKeysOperations(AzureMgmtRecordedTestCase): def setup_method(self, method): self.client = self.create_mgmt_client(ComputeClient) @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_ssh_public_key_resources_get(self, resource_group): - response = self.client.ssh_public_key_resources.get( + def test_ssh_public_keys_get(self, resource_group): + response = self.client.ssh_public_keys.get( resource_group_name=resource_group.name, ssh_public_key_name="str", ) @@ -31,8 +31,8 @@ def test_ssh_public_key_resources_get(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_ssh_public_key_resources_create(self, resource_group): - response = self.client.ssh_public_key_resources.create( + def test_ssh_public_keys_create(self, resource_group): + response = self.client.ssh_public_keys.create( resource_group_name=resource_group.name, ssh_public_key_name="str", parameters={ @@ -58,8 +58,8 @@ def test_ssh_public_key_resources_create(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_ssh_public_key_resources_update(self, resource_group): - response = self.client.ssh_public_key_resources.update( + def test_ssh_public_keys_update(self, resource_group): + response = self.client.ssh_public_keys.update( resource_group_name=resource_group.name, ssh_public_key_name="str", parameters={"properties": {"publicKey": "str"}, "tags": {"str": "str"}}, @@ -70,8 +70,8 @@ def test_ssh_public_key_resources_update(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_ssh_public_key_resources_delete(self, resource_group): - response = self.client.ssh_public_key_resources.delete( + def test_ssh_public_keys_delete(self, resource_group): + response = self.client.ssh_public_keys.delete( resource_group_name=resource_group.name, ssh_public_key_name="str", ) @@ -81,8 +81,8 @@ def test_ssh_public_key_resources_delete(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_ssh_public_key_resources_list_by_resource_group(self, resource_group): - response = self.client.ssh_public_key_resources.list_by_resource_group( + def test_ssh_public_keys_list_by_resource_group(self, resource_group): + response = self.client.ssh_public_keys.list_by_resource_group( resource_group_name=resource_group.name, ) result = [r for r in response] @@ -91,16 +91,16 @@ def test_ssh_public_key_resources_list_by_resource_group(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_ssh_public_key_resources_list_by_subscription(self, resource_group): - response = self.client.ssh_public_key_resources.list_by_subscription() + def test_ssh_public_keys_list_by_subscription(self, resource_group): + response = self.client.ssh_public_keys.list_by_subscription() result = [r for r in response] # please add some check logic here by yourself # ... @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_ssh_public_key_resources_generate_key_pair(self, resource_group): - response = self.client.ssh_public_key_resources.generate_key_pair( + def test_ssh_public_keys_generate_key_pair(self, resource_group): + response = self.client.ssh_public_keys.generate_key_pair( resource_group_name=resource_group.name, ssh_public_key_name="str", ) diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_ssh_public_key_resources_operations_async.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_ssh_public_keys_operations_async.py similarity index 74% rename from sdk/compute/azure-mgmt-compute/generated_tests/test_compute_ssh_public_key_resources_operations_async.py rename to sdk/compute/azure-mgmt-compute/generated_tests/test_compute_ssh_public_keys_operations_async.py index 7b2f92af4e7a..a75bc0e412d2 100644 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_ssh_public_key_resources_operations_async.py +++ b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_ssh_public_keys_operations_async.py @@ -15,14 +15,14 @@ @pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestComputeSshPublicKeyResourcesOperationsAsync(AzureMgmtRecordedTestCase): +class TestComputeSshPublicKeysOperationsAsync(AzureMgmtRecordedTestCase): def setup_method(self, method): self.client = self.create_mgmt_client(ComputeClient, is_async=True) @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_ssh_public_key_resources_get(self, resource_group): - response = await self.client.ssh_public_key_resources.get( + async def test_ssh_public_keys_get(self, resource_group): + response = await self.client.ssh_public_keys.get( resource_group_name=resource_group.name, ssh_public_key_name="str", ) @@ -32,8 +32,8 @@ async def test_ssh_public_key_resources_get(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_ssh_public_key_resources_create(self, resource_group): - response = await self.client.ssh_public_key_resources.create( + async def test_ssh_public_keys_create(self, resource_group): + response = await self.client.ssh_public_keys.create( resource_group_name=resource_group.name, ssh_public_key_name="str", parameters={ @@ -59,8 +59,8 @@ async def test_ssh_public_key_resources_create(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_ssh_public_key_resources_update(self, resource_group): - response = await self.client.ssh_public_key_resources.update( + async def test_ssh_public_keys_update(self, resource_group): + response = await self.client.ssh_public_keys.update( resource_group_name=resource_group.name, ssh_public_key_name="str", parameters={"properties": {"publicKey": "str"}, "tags": {"str": "str"}}, @@ -71,8 +71,8 @@ async def test_ssh_public_key_resources_update(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_ssh_public_key_resources_delete(self, resource_group): - response = await self.client.ssh_public_key_resources.delete( + async def test_ssh_public_keys_delete(self, resource_group): + response = await self.client.ssh_public_keys.delete( resource_group_name=resource_group.name, ssh_public_key_name="str", ) @@ -82,8 +82,8 @@ async def test_ssh_public_key_resources_delete(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_ssh_public_key_resources_list_by_resource_group(self, resource_group): - response = self.client.ssh_public_key_resources.list_by_resource_group( + async def test_ssh_public_keys_list_by_resource_group(self, resource_group): + response = self.client.ssh_public_keys.list_by_resource_group( resource_group_name=resource_group.name, ) result = [r async for r in response] @@ -92,16 +92,16 @@ async def test_ssh_public_key_resources_list_by_resource_group(self, resource_gr @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_ssh_public_key_resources_list_by_subscription(self, resource_group): - response = self.client.ssh_public_key_resources.list_by_subscription() + async def test_ssh_public_keys_list_by_subscription(self, resource_group): + response = self.client.ssh_public_keys.list_by_subscription() result = [r async for r in response] # please add some check logic here by yourself # ... @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_ssh_public_key_resources_generate_key_pair(self, resource_group): - response = await self.client.ssh_public_key_resources.generate_key_pair( + async def test_ssh_public_keys_generate_key_pair(self, resource_group): + response = await self.client.ssh_public_keys.generate_key_pair( resource_group_name=resource_group.name, ssh_public_key_name="str", ) diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machine_sizes_operation_group_operations.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_usage_operations.py similarity index 81% rename from sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machine_sizes_operation_group_operations.py rename to sdk/compute/azure-mgmt-compute/generated_tests/test_compute_usage_operations.py index c7e09fa0dab6..110ccae96c83 100644 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machine_sizes_operation_group_operations.py +++ b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_usage_operations.py @@ -14,14 +14,14 @@ @pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestComputeVirtualMachineSizesOperationGroupOperations(AzureMgmtRecordedTestCase): +class TestComputeUsageOperations(AzureMgmtRecordedTestCase): def setup_method(self, method): self.client = self.create_mgmt_client(ComputeClient) @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_virtual_machine_sizes_operation_group_list(self, resource_group): - response = self.client.virtual_machine_sizes_operation_group.list( + def test_usage_list(self, resource_group): + response = self.client.usage.list( location="str", ) result = [r for r in response] diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machine_sizes_operation_group_operations_async.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_usage_operations_async.py similarity index 81% rename from sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machine_sizes_operation_group_operations_async.py rename to sdk/compute/azure-mgmt-compute/generated_tests/test_compute_usage_operations_async.py index 7f97374cbf7c..35beae168361 100644 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machine_sizes_operation_group_operations_async.py +++ b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_usage_operations_async.py @@ -15,14 +15,14 @@ @pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestComputeVirtualMachineSizesOperationGroupOperationsAsync(AzureMgmtRecordedTestCase): +class TestComputeUsageOperationsAsync(AzureMgmtRecordedTestCase): def setup_method(self, method): self.client = self.create_mgmt_client(ComputeClient, is_async=True) @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_virtual_machine_sizes_operation_group_list(self, resource_group): - response = self.client.virtual_machine_sizes_operation_group.list( + async def test_usage_list(self, resource_group): + response = self.client.usage.list( location="str", ) result = [r async for r in response] diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machine_extensions_operations.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machine_extensions_operations.py index 70434023f515..52fd92f4a848 100644 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machine_extensions_operations.py +++ b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machine_extensions_operations.py @@ -140,6 +140,6 @@ def test_virtual_machine_extensions_list(self, resource_group): resource_group_name=resource_group.name, vm_name="str", ) - result = [r for r in response] + # please add some check logic here by yourself # ... diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machine_extensions_operations_async.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machine_extensions_operations_async.py index 77065474532a..d20a0d48b7af 100644 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machine_extensions_operations_async.py +++ b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machine_extensions_operations_async.py @@ -143,10 +143,10 @@ async def test_virtual_machine_extensions_begin_delete(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async async def test_virtual_machine_extensions_list(self, resource_group): - response = self.client.virtual_machine_extensions.list( + response = await self.client.virtual_machine_extensions.list( resource_group_name=resource_group.name, vm_name="str", ) - result = [r async for r in response] + # please add some check logic here by yourself # ... diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machine_images_edge_zone_operation_group_operations.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machine_images_edge_zone_operations.py similarity index 68% rename from sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machine_images_edge_zone_operation_group_operations.py rename to sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machine_images_edge_zone_operations.py index 94d56dc585e9..e8ceb2d41990 100644 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machine_images_edge_zone_operation_group_operations.py +++ b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machine_images_edge_zone_operations.py @@ -14,14 +14,14 @@ @pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestComputeVirtualMachineImagesEdgeZoneOperationGroupOperations(AzureMgmtRecordedTestCase): +class TestComputeVirtualMachineImagesEdgeZoneOperations(AzureMgmtRecordedTestCase): def setup_method(self, method): self.client = self.create_mgmt_client(ComputeClient) @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_virtual_machine_images_edge_zone_operation_group_list_publishers(self, resource_group): - response = self.client.virtual_machine_images_edge_zone_operation_group.list_publishers( + def test_virtual_machine_images_edge_zone_list_publishers(self, resource_group): + response = self.client.virtual_machine_images_edge_zone.list_publishers( location="str", edge_zone="str", ) @@ -31,8 +31,8 @@ def test_virtual_machine_images_edge_zone_operation_group_list_publishers(self, @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_virtual_machine_images_edge_zone_operation_group_list_offers(self, resource_group): - response = self.client.virtual_machine_images_edge_zone_operation_group.list_offers( + def test_virtual_machine_images_edge_zone_list_offers(self, resource_group): + response = self.client.virtual_machine_images_edge_zone.list_offers( location="str", edge_zone="str", publisher_name="str", @@ -43,8 +43,8 @@ def test_virtual_machine_images_edge_zone_operation_group_list_offers(self, reso @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_virtual_machine_images_edge_zone_operation_group_list_skus(self, resource_group): - response = self.client.virtual_machine_images_edge_zone_operation_group.list_skus( + def test_virtual_machine_images_edge_zone_list_skus(self, resource_group): + response = self.client.virtual_machine_images_edge_zone.list_skus( location="str", edge_zone="str", publisher_name="str", @@ -56,8 +56,8 @@ def test_virtual_machine_images_edge_zone_operation_group_list_skus(self, resour @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_virtual_machine_images_edge_zone_operation_group_list(self, resource_group): - response = self.client.virtual_machine_images_edge_zone_operation_group.list( + def test_virtual_machine_images_edge_zone_list(self, resource_group): + response = self.client.virtual_machine_images_edge_zone.list( location="str", edge_zone="str", publisher_name="str", @@ -70,8 +70,8 @@ def test_virtual_machine_images_edge_zone_operation_group_list(self, resource_gr @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_virtual_machine_images_edge_zone_operation_group_get(self, resource_group): - response = self.client.virtual_machine_images_edge_zone_operation_group.get( + def test_virtual_machine_images_edge_zone_get(self, resource_group): + response = self.client.virtual_machine_images_edge_zone.get( location="str", edge_zone="str", publisher_name="str", diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machine_images_edge_zone_operation_group_operations_async.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machine_images_edge_zone_operations_async.py similarity index 77% rename from sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machine_images_edge_zone_operation_group_operations_async.py rename to sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machine_images_edge_zone_operations_async.py index dcd17089afd3..2b377172a51d 100644 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machine_images_edge_zone_operation_group_operations_async.py +++ b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machine_images_edge_zone_operations_async.py @@ -15,14 +15,14 @@ @pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestComputeVirtualMachineImagesEdgeZoneOperationGroupOperationsAsync(AzureMgmtRecordedTestCase): +class TestComputeVirtualMachineImagesEdgeZoneOperationsAsync(AzureMgmtRecordedTestCase): def setup_method(self, method): self.client = self.create_mgmt_client(ComputeClient, is_async=True) @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_virtual_machine_images_edge_zone_operation_group_list_publishers(self, resource_group): - response = await self.client.virtual_machine_images_edge_zone_operation_group.list_publishers( + async def test_virtual_machine_images_edge_zone_list_publishers(self, resource_group): + response = await self.client.virtual_machine_images_edge_zone.list_publishers( location="str", edge_zone="str", ) @@ -32,8 +32,8 @@ async def test_virtual_machine_images_edge_zone_operation_group_list_publishers( @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_virtual_machine_images_edge_zone_operation_group_list_offers(self, resource_group): - response = await self.client.virtual_machine_images_edge_zone_operation_group.list_offers( + async def test_virtual_machine_images_edge_zone_list_offers(self, resource_group): + response = await self.client.virtual_machine_images_edge_zone.list_offers( location="str", edge_zone="str", publisher_name="str", @@ -44,8 +44,8 @@ async def test_virtual_machine_images_edge_zone_operation_group_list_offers(self @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_virtual_machine_images_edge_zone_operation_group_list_skus(self, resource_group): - response = await self.client.virtual_machine_images_edge_zone_operation_group.list_skus( + async def test_virtual_machine_images_edge_zone_list_skus(self, resource_group): + response = await self.client.virtual_machine_images_edge_zone.list_skus( location="str", edge_zone="str", publisher_name="str", @@ -57,8 +57,8 @@ async def test_virtual_machine_images_edge_zone_operation_group_list_skus(self, @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_virtual_machine_images_edge_zone_operation_group_list(self, resource_group): - response = await self.client.virtual_machine_images_edge_zone_operation_group.list( + async def test_virtual_machine_images_edge_zone_list(self, resource_group): + response = await self.client.virtual_machine_images_edge_zone.list( location="str", edge_zone="str", publisher_name="str", @@ -71,8 +71,8 @@ async def test_virtual_machine_images_edge_zone_operation_group_list(self, resou @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_virtual_machine_images_edge_zone_operation_group_get(self, resource_group): - response = await self.client.virtual_machine_images_edge_zone_operation_group.get( + async def test_virtual_machine_images_edge_zone_get(self, resource_group): + response = await self.client.virtual_machine_images_edge_zone.get( location="str", edge_zone="str", publisher_name="str", diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machine_images_operation_group_operations.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machine_images_operations.py similarity index 67% rename from sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machine_images_operation_group_operations.py rename to sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machine_images_operations.py index 1d99b65f8732..23cdc26f6e78 100644 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machine_images_operation_group_operations.py +++ b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machine_images_operations.py @@ -14,14 +14,14 @@ @pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestComputeVirtualMachineImagesOperationGroupOperations(AzureMgmtRecordedTestCase): +class TestComputeVirtualMachineImagesOperations(AzureMgmtRecordedTestCase): def setup_method(self, method): self.client = self.create_mgmt_client(ComputeClient) @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_virtual_machine_images_operation_group_list_by_edge_zone(self, resource_group): - response = self.client.virtual_machine_images_operation_group.list_by_edge_zone( + def test_virtual_machine_images_list_by_edge_zone(self, resource_group): + response = self.client.virtual_machine_images.list_by_edge_zone( location="str", edge_zone="str", ) @@ -31,8 +31,8 @@ def test_virtual_machine_images_operation_group_list_by_edge_zone(self, resource @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_virtual_machine_images_operation_group_list_publishers(self, resource_group): - response = self.client.virtual_machine_images_operation_group.list_publishers( + def test_virtual_machine_images_list_publishers(self, resource_group): + response = self.client.virtual_machine_images.list_publishers( location="str", ) @@ -41,8 +41,8 @@ def test_virtual_machine_images_operation_group_list_publishers(self, resource_g @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_virtual_machine_images_operation_group_list_offers(self, resource_group): - response = self.client.virtual_machine_images_operation_group.list_offers( + def test_virtual_machine_images_list_offers(self, resource_group): + response = self.client.virtual_machine_images.list_offers( location="str", publisher_name="str", ) @@ -52,8 +52,8 @@ def test_virtual_machine_images_operation_group_list_offers(self, resource_group @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_virtual_machine_images_operation_group_list_skus(self, resource_group): - response = self.client.virtual_machine_images_operation_group.list_skus( + def test_virtual_machine_images_list_skus(self, resource_group): + response = self.client.virtual_machine_images.list_skus( location="str", publisher_name="str", offer="str", @@ -64,8 +64,8 @@ def test_virtual_machine_images_operation_group_list_skus(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_virtual_machine_images_operation_group_list(self, resource_group): - response = self.client.virtual_machine_images_operation_group.list( + def test_virtual_machine_images_list(self, resource_group): + response = self.client.virtual_machine_images.list( location="str", publisher_name="str", offer="str", @@ -77,8 +77,8 @@ def test_virtual_machine_images_operation_group_list(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_virtual_machine_images_operation_group_list_with_properties(self, resource_group): - response = self.client.virtual_machine_images_operation_group.list_with_properties( + def test_virtual_machine_images_list_with_properties(self, resource_group): + response = self.client.virtual_machine_images.list_with_properties( location="str", publisher_name="str", offer="str", @@ -91,8 +91,8 @@ def test_virtual_machine_images_operation_group_list_with_properties(self, resou @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_virtual_machine_images_operation_group_get(self, resource_group): - response = self.client.virtual_machine_images_operation_group.get( + def test_virtual_machine_images_get(self, resource_group): + response = self.client.virtual_machine_images.get( location="str", publisher_name="str", offer="str", diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machine_images_operation_group_operations_async.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machine_images_operations_async.py similarity index 67% rename from sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machine_images_operation_group_operations_async.py rename to sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machine_images_operations_async.py index 1e33d773dffd..2c59ed353555 100644 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machine_images_operation_group_operations_async.py +++ b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machine_images_operations_async.py @@ -15,14 +15,14 @@ @pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestComputeVirtualMachineImagesOperationGroupOperationsAsync(AzureMgmtRecordedTestCase): +class TestComputeVirtualMachineImagesOperationsAsync(AzureMgmtRecordedTestCase): def setup_method(self, method): self.client = self.create_mgmt_client(ComputeClient, is_async=True) @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_virtual_machine_images_operation_group_list_by_edge_zone(self, resource_group): - response = await self.client.virtual_machine_images_operation_group.list_by_edge_zone( + async def test_virtual_machine_images_list_by_edge_zone(self, resource_group): + response = await self.client.virtual_machine_images.list_by_edge_zone( location="str", edge_zone="str", ) @@ -32,8 +32,8 @@ async def test_virtual_machine_images_operation_group_list_by_edge_zone(self, re @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_virtual_machine_images_operation_group_list_publishers(self, resource_group): - response = await self.client.virtual_machine_images_operation_group.list_publishers( + async def test_virtual_machine_images_list_publishers(self, resource_group): + response = await self.client.virtual_machine_images.list_publishers( location="str", ) @@ -42,8 +42,8 @@ async def test_virtual_machine_images_operation_group_list_publishers(self, reso @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_virtual_machine_images_operation_group_list_offers(self, resource_group): - response = await self.client.virtual_machine_images_operation_group.list_offers( + async def test_virtual_machine_images_list_offers(self, resource_group): + response = await self.client.virtual_machine_images.list_offers( location="str", publisher_name="str", ) @@ -53,8 +53,8 @@ async def test_virtual_machine_images_operation_group_list_offers(self, resource @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_virtual_machine_images_operation_group_list_skus(self, resource_group): - response = await self.client.virtual_machine_images_operation_group.list_skus( + async def test_virtual_machine_images_list_skus(self, resource_group): + response = await self.client.virtual_machine_images.list_skus( location="str", publisher_name="str", offer="str", @@ -65,8 +65,8 @@ async def test_virtual_machine_images_operation_group_list_skus(self, resource_g @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_virtual_machine_images_operation_group_list(self, resource_group): - response = await self.client.virtual_machine_images_operation_group.list( + async def test_virtual_machine_images_list(self, resource_group): + response = await self.client.virtual_machine_images.list( location="str", publisher_name="str", offer="str", @@ -78,8 +78,8 @@ async def test_virtual_machine_images_operation_group_list(self, resource_group) @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_virtual_machine_images_operation_group_list_with_properties(self, resource_group): - response = await self.client.virtual_machine_images_operation_group.list_with_properties( + async def test_virtual_machine_images_list_with_properties(self, resource_group): + response = await self.client.virtual_machine_images.list_with_properties( location="str", publisher_name="str", offer="str", @@ -92,8 +92,8 @@ async def test_virtual_machine_images_operation_group_list_with_properties(self, @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_virtual_machine_images_operation_group_get(self, resource_group): - response = await self.client.virtual_machine_images_operation_group.get( + async def test_virtual_machine_images_get(self, resource_group): + response = await self.client.virtual_machine_images.get( location="str", publisher_name="str", offer="str", diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machine_run_commands_operation_group_operations.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machine_run_commands_operation_group_operations.py deleted file mode 100644 index 36103ad0e459..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machine_run_commands_operation_group_operations.py +++ /dev/null @@ -1,40 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import pytest -from azure.mgmt.compute import ComputeClient - -from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy - -AZURE_LOCATION = "eastus" - - -@pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestComputeVirtualMachineRunCommandsOperationGroupOperations(AzureMgmtRecordedTestCase): - def setup_method(self, method): - self.client = self.create_mgmt_client(ComputeClient) - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_virtual_machine_run_commands_operation_group_list(self, resource_group): - response = self.client.virtual_machine_run_commands_operation_group.list( - location="str", - ) - result = [r for r in response] - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_virtual_machine_run_commands_operation_group_get(self, resource_group): - response = self.client.virtual_machine_run_commands_operation_group.get( - location="str", - command_id="str", - ) - - # please add some check logic here by yourself - # ... diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machine_run_commands_operation_group_operations_async.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machine_run_commands_operation_group_operations_async.py deleted file mode 100644 index e6eb328daa3d..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machine_run_commands_operation_group_operations_async.py +++ /dev/null @@ -1,41 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import pytest -from azure.mgmt.compute.aio import ComputeClient - -from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer -from devtools_testutils.aio import recorded_by_proxy_async - -AZURE_LOCATION = "eastus" - - -@pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestComputeVirtualMachineRunCommandsOperationGroupOperationsAsync(AzureMgmtRecordedTestCase): - def setup_method(self, method): - self.client = self.create_mgmt_client(ComputeClient, is_async=True) - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_virtual_machine_run_commands_operation_group_list(self, resource_group): - response = self.client.virtual_machine_run_commands_operation_group.list( - location="str", - ) - result = [r async for r in response] - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_virtual_machine_run_commands_operation_group_get(self, resource_group): - response = await self.client.virtual_machine_run_commands_operation_group.get( - location="str", - command_id="str", - ) - - # please add some check logic here by yourself - # ... diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machine_run_commands_operations.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machine_run_commands_operations.py index 9c16d9025664..944d9f98105d 100644 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machine_run_commands_operations.py +++ b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machine_run_commands_operations.py @@ -174,3 +174,24 @@ def test_virtual_machine_run_commands_list_by_virtual_machine(self, resource_gro result = [r for r in response] # please add some check logic here by yourself # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_virtual_machine_run_commands_list(self, resource_group): + response = self.client.virtual_machine_run_commands.list( + location="str", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_virtual_machine_run_commands_get(self, resource_group): + response = self.client.virtual_machine_run_commands.get( + location="str", + command_id="str", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machine_run_commands_operations_async.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machine_run_commands_operations_async.py index 9209dc67938e..3a946f121c26 100644 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machine_run_commands_operations_async.py +++ b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machine_run_commands_operations_async.py @@ -181,3 +181,24 @@ async def test_virtual_machine_run_commands_list_by_virtual_machine(self, resour result = [r async for r in response] # please add some check logic here by yourself # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_virtual_machine_run_commands_list(self, resource_group): + response = self.client.virtual_machine_run_commands.list( + location="str", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_virtual_machine_run_commands_get(self, resource_group): + response = await self.client.virtual_machine_run_commands.get( + location="str", + command_id="str", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machine_scale_set_rolling_upgrades_operations.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machine_scale_set_rolling_upgrades_operations.py new file mode 100644 index 000000000000..059bab007f62 --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machine_scale_set_rolling_upgrades_operations.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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.compute import ComputeClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestComputeVirtualMachineScaleSetRollingUpgradesOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ComputeClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_virtual_machine_scale_set_rolling_upgrades_begin_start_extension_upgrade(self, resource_group): + response = self.client.virtual_machine_scale_set_rolling_upgrades.begin_start_extension_upgrade( + resource_group_name=resource_group.name, + vm_scale_set_name="str", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_virtual_machine_scale_set_rolling_upgrades_begin_start_os_upgrade(self, resource_group): + response = self.client.virtual_machine_scale_set_rolling_upgrades.begin_start_os_upgrade( + resource_group_name=resource_group.name, + vm_scale_set_name="str", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_virtual_machine_scale_set_rolling_upgrades_begin_cancel(self, resource_group): + response = self.client.virtual_machine_scale_set_rolling_upgrades.begin_cancel( + resource_group_name=resource_group.name, + vm_scale_set_name="str", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_virtual_machine_scale_set_rolling_upgrades_get_latest(self, resource_group): + response = self.client.virtual_machine_scale_set_rolling_upgrades.get_latest( + resource_group_name=resource_group.name, + vm_scale_set_name="str", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machine_scale_set_rolling_upgrades_operations_async.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machine_scale_set_rolling_upgrades_operations_async.py new file mode 100644 index 000000000000..9976ce687b17 --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machine_scale_set_rolling_upgrades_operations_async.py @@ -0,0 +1,70 @@ +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.compute.aio import ComputeClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestComputeVirtualMachineScaleSetRollingUpgradesOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ComputeClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_virtual_machine_scale_set_rolling_upgrades_begin_start_extension_upgrade(self, resource_group): + response = await ( + await self.client.virtual_machine_scale_set_rolling_upgrades.begin_start_extension_upgrade( + resource_group_name=resource_group.name, + vm_scale_set_name="str", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_virtual_machine_scale_set_rolling_upgrades_begin_start_os_upgrade(self, resource_group): + response = await ( + await self.client.virtual_machine_scale_set_rolling_upgrades.begin_start_os_upgrade( + resource_group_name=resource_group.name, + vm_scale_set_name="str", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_virtual_machine_scale_set_rolling_upgrades_begin_cancel(self, resource_group): + response = await ( + await self.client.virtual_machine_scale_set_rolling_upgrades.begin_cancel( + resource_group_name=resource_group.name, + vm_scale_set_name="str", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_virtual_machine_scale_set_rolling_upgrades_get_latest(self, resource_group): + response = await self.client.virtual_machine_scale_set_rolling_upgrades.get_latest( + resource_group_name=resource_group.name, + vm_scale_set_name="str", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machine_scale_set_vm_extensions_operations.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machine_scale_set_vm_extensions_operations.py index db5fc313a170..476a90072d37 100644 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machine_scale_set_vm_extensions_operations.py +++ b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machine_scale_set_vm_extensions_operations.py @@ -138,6 +138,6 @@ def test_virtual_machine_scale_set_vm_extensions_list(self, resource_group): vm_scale_set_name="str", instance_id="str", ) - result = [r for r in response] + # please add some check logic here by yourself # ... diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machine_scale_set_vm_extensions_operations_async.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machine_scale_set_vm_extensions_operations_async.py index 258b17cda4f4..ec6eb84c18a1 100644 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machine_scale_set_vm_extensions_operations_async.py +++ b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machine_scale_set_vm_extensions_operations_async.py @@ -140,11 +140,11 @@ async def test_virtual_machine_scale_set_vm_extensions_begin_delete(self, resour @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async async def test_virtual_machine_scale_set_vm_extensions_list(self, resource_group): - response = self.client.virtual_machine_scale_set_vm_extensions.list( + response = await self.client.virtual_machine_scale_set_vm_extensions.list( resource_group_name=resource_group.name, vm_scale_set_name="str", instance_id="str", ) - result = [r async for r in response] + # please add some check logic here by yourself # ... diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machine_scale_set_vms_operations.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machine_scale_set_vms_operations.py index 189edacfc795..3153d1a92286 100644 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machine_scale_set_vms_operations.py +++ b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machine_scale_set_vms_operations.py @@ -14,7 +14,7 @@ @pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestComputeVirtualMachineScaleSetVMSOperations(AzureMgmtRecordedTestCase): +class TestComputeVirtualMachineScaleSetVMsOperations(AzureMgmtRecordedTestCase): def setup_method(self, method): self.client = self.create_mgmt_client(ComputeClient) @@ -313,7 +313,7 @@ def test_virtual_machine_scale_set_vms_begin_update(self, resource_group): { "componentName": "Microsoft-Windows-Shell-Setup", "content": "str", - "passName": "str", + "passName": "OobeSystem", "settingName": "str", } ], diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machine_scale_set_vms_operations_async.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machine_scale_set_vms_operations_async.py index e39b1023ea13..f75e2d862f3c 100644 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machine_scale_set_vms_operations_async.py +++ b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machine_scale_set_vms_operations_async.py @@ -15,7 +15,7 @@ @pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestComputeVirtualMachineScaleSetVMSOperationsAsync(AzureMgmtRecordedTestCase): +class TestComputeVirtualMachineScaleSetVMsOperationsAsync(AzureMgmtRecordedTestCase): def setup_method(self, method): self.client = self.create_mgmt_client(ComputeClient, is_async=True) @@ -320,7 +320,7 @@ async def test_virtual_machine_scale_set_vms_begin_update(self, resource_group): { "componentName": "Microsoft-Windows-Shell-Setup", "content": "str", - "passName": "str", + "passName": "OobeSystem", "settingName": "str", } ], diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machine_scale_sets_operations.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machine_scale_sets_operations.py index 2d0779747902..0263fe379b1a 100644 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machine_scale_sets_operations.py +++ b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machine_scale_sets_operations.py @@ -238,7 +238,7 @@ def test_virtual_machine_scale_sets_begin_create_or_update(self, resource_group) { "componentName": "Microsoft-Windows-Shell-Setup", "content": "str", - "passName": "str", + "passName": "OobeSystem", "settingName": "str", } ], @@ -522,7 +522,7 @@ def test_virtual_machine_scale_sets_begin_update(self, resource_group): { "componentName": "Microsoft-Windows-Shell-Setup", "content": "str", - "passName": "str", + "passName": "OobeSystem", "settingName": "str", } ], @@ -859,32 +859,11 @@ def test_virtual_machine_scale_sets_begin_start(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_virtual_machine_scale_sets_begin_start_extension_upgrade(self, resource_group): - response = self.client.virtual_machine_scale_sets.begin_start_extension_upgrade( - resource_group_name=resource_group.name, - vm_scale_set_name="str", - ).result() # call '.result()' to poll until service return final result - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_virtual_machine_scale_sets_begin_start_os_upgrade(self, resource_group): - response = self.client.virtual_machine_scale_sets.begin_start_os_upgrade( - resource_group_name=resource_group.name, - vm_scale_set_name="str", - ).result() # call '.result()' to poll until service return final result - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_virtual_machine_scale_sets_begin_cancel(self, resource_group): - response = self.client.virtual_machine_scale_sets.begin_cancel( + def test_virtual_machine_scale_sets_begin_scale_out(self, resource_group): + response = self.client.virtual_machine_scale_sets.begin_scale_out( resource_group_name=resource_group.name, vm_scale_set_name="str", + parameters={"capacity": 0, "properties": {"zone": "str"}}, ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -892,12 +871,10 @@ def test_virtual_machine_scale_sets_begin_cancel(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_virtual_machine_scale_sets_begin_scale_out(self, resource_group): - response = self.client.virtual_machine_scale_sets.begin_scale_out( - resource_group_name=resource_group.name, - vm_scale_set_name="str", - parameters={"capacity": 0, "properties": {"zone": "str"}}, - ).result() # call '.result()' to poll until service return final result - + def test_virtual_machine_scale_sets_list_by_location(self, resource_group): + response = self.client.virtual_machine_scale_sets.list_by_location( + location="str", + ) + result = [r for r in response] # please add some check logic here by yourself # ... diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machine_scale_sets_operations_async.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machine_scale_sets_operations_async.py index c6064be7f30a..8683141ada58 100644 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machine_scale_sets_operations_async.py +++ b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machine_scale_sets_operations_async.py @@ -240,7 +240,7 @@ async def test_virtual_machine_scale_sets_begin_create_or_update(self, resource_ { "componentName": "Microsoft-Windows-Shell-Setup", "content": "str", - "passName": "str", + "passName": "OobeSystem", "settingName": "str", } ], @@ -530,7 +530,7 @@ async def test_virtual_machine_scale_sets_begin_update(self, resource_group): { "componentName": "Microsoft-Windows-Shell-Setup", "content": "str", - "passName": "str", + "passName": "OobeSystem", "settingName": "str", } ], @@ -904,37 +904,12 @@ async def test_virtual_machine_scale_sets_begin_start(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_virtual_machine_scale_sets_begin_start_extension_upgrade(self, resource_group): - response = await ( - await self.client.virtual_machine_scale_sets.begin_start_extension_upgrade( - resource_group_name=resource_group.name, - vm_scale_set_name="str", - ) - ).result() # call '.result()' to poll until service return final result - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_virtual_machine_scale_sets_begin_start_os_upgrade(self, resource_group): - response = await ( - await self.client.virtual_machine_scale_sets.begin_start_os_upgrade( - resource_group_name=resource_group.name, - vm_scale_set_name="str", - ) - ).result() # call '.result()' to poll until service return final result - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_virtual_machine_scale_sets_begin_cancel(self, resource_group): + async def test_virtual_machine_scale_sets_begin_scale_out(self, resource_group): response = await ( - await self.client.virtual_machine_scale_sets.begin_cancel( + await self.client.virtual_machine_scale_sets.begin_scale_out( resource_group_name=resource_group.name, vm_scale_set_name="str", + parameters={"capacity": 0, "properties": {"zone": "str"}}, ) ).result() # call '.result()' to poll until service return final result @@ -943,14 +918,10 @@ async def test_virtual_machine_scale_sets_begin_cancel(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_virtual_machine_scale_sets_begin_scale_out(self, resource_group): - response = await ( - await self.client.virtual_machine_scale_sets.begin_scale_out( - resource_group_name=resource_group.name, - vm_scale_set_name="str", - parameters={"capacity": 0, "properties": {"zone": "str"}}, - ) - ).result() # call '.result()' to poll until service return final result - + async def test_virtual_machine_scale_sets_list_by_location(self, resource_group): + response = self.client.virtual_machine_scale_sets.list_by_location( + location="str", + ) + result = [r async for r in response] # please add some check logic here by yourself # ... diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_usage_operation_group_operations.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machine_sizes_operations.py similarity index 85% rename from sdk/compute/azure-mgmt-compute/generated_tests/test_compute_usage_operation_group_operations.py rename to sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machine_sizes_operations.py index b6b947cdacb4..e9ccc98893eb 100644 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_usage_operation_group_operations.py +++ b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machine_sizes_operations.py @@ -14,14 +14,14 @@ @pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestComputeUsageOperationGroupOperations(AzureMgmtRecordedTestCase): +class TestComputeVirtualMachineSizesOperations(AzureMgmtRecordedTestCase): def setup_method(self, method): self.client = self.create_mgmt_client(ComputeClient) @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_usage_operation_group_list(self, resource_group): - response = self.client.usage_operation_group.list( + def test_virtual_machine_sizes_list(self, resource_group): + response = self.client.virtual_machine_sizes.list( location="str", ) result = [r for r in response] diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_usage_operation_group_operations_async.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machine_sizes_operations_async.py similarity index 86% rename from sdk/compute/azure-mgmt-compute/generated_tests/test_compute_usage_operation_group_operations_async.py rename to sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machine_sizes_operations_async.py index eea19701d43e..fb8cb5527134 100644 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_usage_operation_group_operations_async.py +++ b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machine_sizes_operations_async.py @@ -15,14 +15,14 @@ @pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestComputeUsageOperationGroupOperationsAsync(AzureMgmtRecordedTestCase): +class TestComputeVirtualMachineSizesOperationsAsync(AzureMgmtRecordedTestCase): def setup_method(self, method): self.client = self.create_mgmt_client(ComputeClient, is_async=True) @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_usage_operation_group_list(self, resource_group): - response = self.client.usage_operation_group.list( + async def test_virtual_machine_sizes_list(self, resource_group): + response = self.client.virtual_machine_sizes.list( location="str", ) result = [r async for r in response] diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machines_operation_group_operations.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machines_operation_group_operations.py deleted file mode 100644 index 76b8792fc771..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machines_operation_group_operations.py +++ /dev/null @@ -1,29 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import pytest -from azure.mgmt.compute import ComputeClient - -from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy - -AZURE_LOCATION = "eastus" - - -@pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestComputeVirtualMachinesOperationGroupOperations(AzureMgmtRecordedTestCase): - def setup_method(self, method): - self.client = self.create_mgmt_client(ComputeClient) - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_virtual_machines_operation_group_list_by_location(self, resource_group): - response = self.client.virtual_machines_operation_group.list_by_location( - location="str", - ) - result = [r for r in response] - # please add some check logic here by yourself - # ... diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machines_operation_group_operations_async.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machines_operation_group_operations_async.py deleted file mode 100644 index f4eb6d1542e0..000000000000 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machines_operation_group_operations_async.py +++ /dev/null @@ -1,30 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import pytest -from azure.mgmt.compute.aio import ComputeClient - -from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer -from devtools_testutils.aio import recorded_by_proxy_async - -AZURE_LOCATION = "eastus" - - -@pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestComputeVirtualMachinesOperationGroupOperationsAsync(AzureMgmtRecordedTestCase): - def setup_method(self, method): - self.client = self.create_mgmt_client(ComputeClient, is_async=True) - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_virtual_machines_operation_group_list_by_location(self, resource_group): - response = self.client.virtual_machines_operation_group.list_by_location( - location="str", - ) - result = [r async for r in response] - # please add some check logic here by yourself - # ... diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machines_operations.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machines_operations.py index faab5e5e4e1c..82a97efc03c0 100644 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machines_operations.py +++ b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machines_operations.py @@ -326,7 +326,7 @@ def test_virtual_machines_begin_create_or_update(self, resource_group): { "componentName": "Microsoft-Windows-Shell-Setup", "content": "str", - "passName": "str", + "passName": "OobeSystem", "settingName": "str", } ], @@ -808,7 +808,7 @@ def test_virtual_machines_begin_update(self, resource_group): { "componentName": "Microsoft-Windows-Shell-Setup", "content": "str", - "passName": "str", + "passName": "OobeSystem", "settingName": "str", } ], @@ -1220,3 +1220,13 @@ def test_virtual_machines_begin_migrate_to_vm_scale_set(self, resource_group): # please add some check logic here by yourself # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_virtual_machines_list_by_location(self, resource_group): + response = self.client.virtual_machines.list_by_location( + location="str", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machines_operations_async.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machines_operations_async.py index 5a362c13afab..84148d1911aa 100644 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machines_operations_async.py +++ b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_virtual_machines_operations_async.py @@ -333,7 +333,7 @@ async def test_virtual_machines_begin_create_or_update(self, resource_group): { "componentName": "Microsoft-Windows-Shell-Setup", "content": "str", - "passName": "str", + "passName": "OobeSystem", "settingName": "str", } ], @@ -822,7 +822,7 @@ async def test_virtual_machines_begin_update(self, resource_group): { "componentName": "Microsoft-Windows-Shell-Setup", "content": "str", - "passName": "str", + "passName": "OobeSystem", "settingName": "str", } ], @@ -1267,3 +1267,13 @@ async def test_virtual_machines_begin_migrate_to_vm_scale_set(self, resource_gro # please add some check logic here by yourself # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_virtual_machines_list_by_location(self, resource_group): + response = self.client.virtual_machines.list_by_location( + location="str", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... From 443b5f573cb66a06c129f5e66b9f700467f31f22 Mon Sep 17 00:00:00 2001 From: Yuchao Yan Date: Tue, 11 Nov 2025 15:00:55 +0800 Subject: [PATCH 4/4] Update CHANGELOG.md --- sdk/compute/azure-mgmt-compute/CHANGELOG.md | 598 +++++++------------- 1 file changed, 203 insertions(+), 395 deletions(-) diff --git a/sdk/compute/azure-mgmt-compute/CHANGELOG.md b/sdk/compute/azure-mgmt-compute/CHANGELOG.md index 47e6260ea0ff..a95753af0c33 100644 --- a/sdk/compute/azure-mgmt-compute/CHANGELOG.md +++ b/sdk/compute/azure-mgmt-compute/CHANGELOG.md @@ -4,404 +4,212 @@ ### Features Added - - Model `AvailabilitySetUpdate` added property `properties` - - Model `CapacityReservationGroupUpdate` added property `properties` - - Model `CapacityReservationUpdate` added property `properties` - - Model `CommunityGallery` added property `identifier` - - Model `CommunityGalleryImageVersion` added property `identifier` - - Model `DedicatedHostGroupUpdate` added property `properties` - - Model `DedicatedHostUpdate` added property `properties` - - Model `DiskEncryptionSet` added property `properties` - - Model `GalleryApplicationUpdate` added property `properties` - - Model `GalleryApplicationVersionUpdate` added property `properties` - - Model `GalleryImageUpdate` added property `properties` - - Model `GalleryImageVersionUpdate` added property `properties` - - Model `GalleryInVMAccessControlProfileVersion` added property `properties` - - Model `GalleryInVMAccessControlProfileVersionUpdate` added property `properties` - - Model `GalleryUpdate` added property `properties` - - Model `ImageUpdate` added property `properties` - - Enum `NetworkApiVersion` added member `ENUM_2020_11_01` - - Enum `NetworkApiVersion` added member `ENUM_2022_11_01` - - Model `PirCommunityGalleryResource` added property `identifier` - - Model `PirSharedGalleryResource` added property `identifier` - - Model `ResourceSkuRestrictions` added property `values_property` - - Model `RestorePointCollectionUpdate` added property `properties` - - Model `SharedGallery` added property `identifier` - - Model `SharedGalleryImageVersion` added property `identifier` - - Model `SshPublicKeyUpdateResource` added property `properties` - - Model `Usage` added property `unit` - - Model `UserArtifactManage` added property `update_property` - - Model `VirtualMachineRunCommandUpdate` added property `properties` - - Model `VirtualMachineScaleSetExtensionUpdate` added property `properties` - - Model `VirtualMachineScaleSetVMExtension` added property `properties` - - Model `VirtualMachineScaleSetVMExtensionUpdate` added property `properties` - - Model `VirtualMachineUpdate` added property `properties` - - Added model `ApproveRollingUpgradeParameterBody` - - Added model `CloudError` - - Added model `CommunityGalleryIdentifier` - - Added model `ConvertToVirtualMachineScaleSetParameterBody` - - Added model `DeallocateParameterBody` - - Added model `EncryptionSetProperties` - - Added model `GenerateKeyPairParameterBody` - - Added model `MigrateToVmScaleSetParameterBody` - - Added model `PerformMaintenanceParameterBody` - - Added model `PowerOffParameterBody` - - Added model `RedeployParameterBody` - - Added model `ReimageAllParameterBody` - - Added model `ReimageParameterBody` - - Added model `ReimageParameterBody1` - - Added model `ReimageParameterBody2` - - Added model `RestartParameterBody` - - Added model `SharedGalleryIdentifier` - - Added model `StartParameterBody` - - Model `VirtualMachineScaleSetVMsOperations` added parameter `etag` in method `begin_update` - - Model `VirtualMachineScaleSetVMsOperations` added parameter `match_condition` in method `begin_update` - - Model `VirtualMachineScaleSetsOperations` added parameter `etag` in method `begin_create_or_update` - - Model `VirtualMachineScaleSetsOperations` added parameter `match_condition` in method `begin_create_or_update` - - Model `VirtualMachineScaleSetsOperations` added parameter `etag` in method `begin_update` - - Model `VirtualMachineScaleSetsOperations` added parameter `match_condition` in method `begin_update` - - Model `VirtualMachinesOperations` added parameter `etag` in method `begin_create_or_update` - - Model `VirtualMachinesOperations` added parameter `match_condition` in method `begin_create_or_update` - - Model `VirtualMachinesOperations` added parameter `etag` in method `begin_update` - - Model `VirtualMachinesOperations` added parameter `match_condition` in method `begin_update` + - Model `AvailabilitySetUpdate` added property `properties` + - Model `CapacityReservationGroupUpdate` added property `properties` + - Model `CapacityReservationUpdate` added property `properties` + - Model `CommunityGallery` added property `identifier` + - Model `CommunityGalleryImageVersion` added property `identifier` + - Model `DedicatedHostGroupUpdate` added property `properties` + - Model `DedicatedHostUpdate` added property `properties` + - Model `DiskEncryptionSet` added property `properties` + - Model `GalleryApplicationUpdate` added property `properties` + - Model `GalleryApplicationVersionUpdate` added property `properties` + - Model `GalleryImageUpdate` added property `properties` + - Model `GalleryImageVersionUpdate` added property `properties` + - Model `GalleryInVMAccessControlProfileVersion` added property `properties` + - Model `GalleryInVMAccessControlProfileVersionUpdate` added property `properties` + - Model `GalleryUpdate` added property `properties` + - Model `ImageUpdate` added property `properties` + - Enum `NetworkApiVersion` added member `ENUM_2020_11_01` + - Enum `NetworkApiVersion` added member `ENUM_2022_11_01` + - Model `PirCommunityGalleryResource` added property `identifier` + - Model `PirSharedGalleryResource` added property `identifier` + - Model `ResourceSkuRestrictions` added property `values_property` + - Model `RestorePointCollectionUpdate` added property `properties` + - Model `SharedGallery` added property `identifier` + - Model `SharedGalleryImageVersion` added property `identifier` + - Model `SshPublicKeyUpdateResource` added property `properties` + - Model `Usage` added property `unit` + - Model `UserArtifactManage` added property `update_property` + - Model `VirtualMachineRunCommandUpdate` added property `properties` + - Model `VirtualMachineScaleSetExtensionUpdate` added property `properties` + - Model `VirtualMachineScaleSetVMExtension` added property `properties` + - Model `VirtualMachineScaleSetVMExtensionUpdate` added property `properties` + - Model `VirtualMachineUpdate` added property `properties` + - Added model `ApproveRollingUpgradeParameterBody` + - Added model `CloudError` + - Added model `CommunityGalleryIdentifier` + - Added model `ConvertToVirtualMachineScaleSetParameterBody` + - Added model `DeallocateParameterBody` + - Added model `EncryptionSetProperties` + - Added model `GenerateKeyPairParameterBody` + - Added model `MigrateToVmScaleSetParameterBody` + - Added model `PerformMaintenanceParameterBody` + - Added model `PowerOffParameterBody` + - Added model `RedeployParameterBody` + - Added model `ReimageAllParameterBody` + - Added model `ReimageParameterBody` + - Added model `ReimageParameterBody1` + - Added model `ReimageParameterBody2` + - Added model `RestartParameterBody` + - Added model `SharedGalleryIdentifier` + - Added model `StartParameterBody` ### Breaking Changes - - Deleted or renamed client `ComputeManagementClient` - - Model `AvailabilitySetUpdate` deleted or renamed its instance variable `platform_update_domain_count` - - Model `AvailabilitySetUpdate` deleted or renamed its instance variable `platform_fault_domain_count` - - Model `AvailabilitySetUpdate` deleted or renamed its instance variable `virtual_machines` - - Model `AvailabilitySetUpdate` deleted or renamed its instance variable `proximity_placement_group` - - Model `AvailabilitySetUpdate` deleted or renamed its instance variable `statuses` - - Model `AvailabilitySetUpdate` deleted or renamed its instance variable `scheduled_events_policy` - - Model `AvailabilitySetUpdate` deleted or renamed its instance variable `virtual_machine_scale_set_migration_info` - - Model `CapacityReservationGroupUpdate` deleted or renamed its instance variable `capacity_reservations` - - Model `CapacityReservationGroupUpdate` deleted or renamed its instance variable `virtual_machines_associated` - - Model `CapacityReservationGroupUpdate` deleted or renamed its instance variable `instance_view` - - Model `CapacityReservationGroupUpdate` deleted or renamed its instance variable `sharing_profile` - - Model `CapacityReservationGroupUpdate` deleted or renamed its instance variable `reservation_type` - - Model `CapacityReservationUpdate` deleted or renamed its instance variable `reservation_id` - - Model `CapacityReservationUpdate` deleted or renamed its instance variable `platform_fault_domain_count` - - Model `CapacityReservationUpdate` deleted or renamed its instance variable `virtual_machines_associated` - - Model `CapacityReservationUpdate` deleted or renamed its instance variable `provisioning_time` - - Model `CapacityReservationUpdate` deleted or renamed its instance variable `provisioning_state` - - Model `CapacityReservationUpdate` deleted or renamed its instance variable `instance_view` - - Model `CapacityReservationUpdate` deleted or renamed its instance variable `time_created` - - Model `CapacityReservationUpdate` deleted or renamed its instance variable `schedule_profile` - - Model `DedicatedHostGroupUpdate` deleted or renamed its instance variable `platform_fault_domain_count` - - Model `DedicatedHostGroupUpdate` deleted or renamed its instance variable `hosts` - - Model `DedicatedHostGroupUpdate` deleted or renamed its instance variable `instance_view` - - Model `DedicatedHostGroupUpdate` deleted or renamed its instance variable `support_automatic_placement` - - Model `DedicatedHostGroupUpdate` deleted or renamed its instance variable `additional_capabilities` - - Model `DedicatedHostUpdate` deleted or renamed its instance variable `platform_fault_domain` - - Model `DedicatedHostUpdate` deleted or renamed its instance variable `auto_replace_on_failure` - - Model `DedicatedHostUpdate` deleted or renamed its instance variable `host_id` - - Model `DedicatedHostUpdate` deleted or renamed its instance variable `virtual_machines` - - Model `DedicatedHostUpdate` deleted or renamed its instance variable `license_type` - - Model `DedicatedHostUpdate` deleted or renamed its instance variable `provisioning_time` - - Model `DedicatedHostUpdate` deleted or renamed its instance variable `provisioning_state` - - Model `DedicatedHostUpdate` deleted or renamed its instance variable `instance_view` - - Model `DedicatedHostUpdate` deleted or renamed its instance variable `time_created` - - Model `DiskEncryptionSet` deleted or renamed its instance variable `encryption_type` - - Model `DiskEncryptionSet` deleted or renamed its instance variable `active_key` - - Model `DiskEncryptionSet` deleted or renamed its instance variable `previous_keys` - - Model `DiskEncryptionSet` deleted or renamed its instance variable `provisioning_state` - - Model `DiskEncryptionSet` deleted or renamed its instance variable `rotation_to_latest_key_version_enabled` - - Model `DiskEncryptionSet` deleted or renamed its instance variable `last_key_rotation_timestamp` - - Model `DiskEncryptionSet` deleted or renamed its instance variable `auto_key_rotation_error` - - Model `DiskEncryptionSet` deleted or renamed its instance variable `federated_client_id` - - Model `GalleryApplicationUpdate` deleted or renamed its instance variable `description` - - Model `GalleryApplicationUpdate` deleted or renamed its instance variable `eula` - - Model `GalleryApplicationUpdate` deleted or renamed its instance variable `privacy_statement_uri` - - Model `GalleryApplicationUpdate` deleted or renamed its instance variable `release_note_uri` - - Model `GalleryApplicationUpdate` deleted or renamed its instance variable `end_of_life_date` - - Model `GalleryApplicationUpdate` deleted or renamed its instance variable `supported_os_type` - - Model `GalleryApplicationUpdate` deleted or renamed its instance variable `custom_actions` - - Model `GalleryApplicationVersionUpdate` deleted or renamed its instance variable `publishing_profile` - - Model `GalleryApplicationVersionUpdate` deleted or renamed its instance variable `safety_profile` - - Model `GalleryApplicationVersionUpdate` deleted or renamed its instance variable `provisioning_state` - - Model `GalleryApplicationVersionUpdate` deleted or renamed its instance variable `replication_status` - - Model `GalleryImageUpdate` deleted or renamed its instance variable `description` - - Model `GalleryImageUpdate` deleted or renamed its instance variable `eula` - - Model `GalleryImageUpdate` deleted or renamed its instance variable `privacy_statement_uri` - - Model `GalleryImageUpdate` deleted or renamed its instance variable `release_note_uri` - - Model `GalleryImageUpdate` deleted or renamed its instance variable `os_type` - - Model `GalleryImageUpdate` deleted or renamed its instance variable `os_state` - - Model `GalleryImageUpdate` deleted or renamed its instance variable `hyper_v_generation` - - Model `GalleryImageUpdate` deleted or renamed its instance variable `end_of_life_date` - - Model `GalleryImageUpdate` deleted or renamed its instance variable `identifier` - - Model `GalleryImageUpdate` deleted or renamed its instance variable `recommended` - - Model `GalleryImageUpdate` deleted or renamed its instance variable `disallowed` - - Model `GalleryImageUpdate` deleted or renamed its instance variable `purchase_plan` - - Model `GalleryImageUpdate` deleted or renamed its instance variable `provisioning_state` - - Model `GalleryImageUpdate` deleted or renamed its instance variable `features` - - Model `GalleryImageUpdate` deleted or renamed its instance variable `architecture` - - Model `GalleryImageUpdate` deleted or renamed its instance variable `allow_update_image` - - Model `GalleryImageVersionUpdate` deleted or renamed its instance variable `publishing_profile` - - Model `GalleryImageVersionUpdate` deleted or renamed its instance variable `provisioning_state` - - Model `GalleryImageVersionUpdate` deleted or renamed its instance variable `storage_profile` - - Model `GalleryImageVersionUpdate` deleted or renamed its instance variable `safety_profile` - - Model `GalleryImageVersionUpdate` deleted or renamed its instance variable `replication_status` - - Model `GalleryImageVersionUpdate` deleted or renamed its instance variable `security_profile` - - Model `GalleryImageVersionUpdate` deleted or renamed its instance variable `restore` - - Model `GalleryImageVersionUpdate` deleted or renamed its instance variable `validations_profile` - - Model `GalleryInVMAccessControlProfileVersion` deleted or renamed its instance variable `target_locations` - - Model `GalleryInVMAccessControlProfileVersion` deleted or renamed its instance variable `exclude_from_latest` - - Model `GalleryInVMAccessControlProfileVersion` deleted or renamed its instance variable `published_date` - - Model `GalleryInVMAccessControlProfileVersion` deleted or renamed its instance variable `provisioning_state` - - Model `GalleryInVMAccessControlProfileVersion` deleted or renamed its instance variable `replication_status` - - Model `GalleryInVMAccessControlProfileVersion` deleted or renamed its instance variable `mode` - - Model `GalleryInVMAccessControlProfileVersion` deleted or renamed its instance variable `default_access` - - Model `GalleryInVMAccessControlProfileVersion` deleted or renamed its instance variable `rules` - - Model `GalleryInVMAccessControlProfileVersionUpdate` deleted or renamed its instance variable `target_locations` - - Model `GalleryInVMAccessControlProfileVersionUpdate` deleted or renamed its instance variable `exclude_from_latest` - - Model `GalleryInVMAccessControlProfileVersionUpdate` deleted or renamed its instance variable `published_date` - - Model `GalleryInVMAccessControlProfileVersionUpdate` deleted or renamed its instance variable `provisioning_state` - - Model `GalleryInVMAccessControlProfileVersionUpdate` deleted or renamed its instance variable `replication_status` - - Model `GalleryInVMAccessControlProfileVersionUpdate` deleted or renamed its instance variable `mode` - - Model `GalleryInVMAccessControlProfileVersionUpdate` deleted or renamed its instance variable `default_access` - - Model `GalleryInVMAccessControlProfileVersionUpdate` deleted or renamed its instance variable `rules` - - Model `GalleryUpdate` deleted or renamed its instance variable `description` - - Model `GalleryUpdate` deleted or renamed its instance variable `identifier` - - Model `GalleryUpdate` deleted or renamed its instance variable `provisioning_state` - - Model `GalleryUpdate` deleted or renamed its instance variable `sharing_profile` - - Model `GalleryUpdate` deleted or renamed its instance variable `soft_delete_policy` - - Model `GalleryUpdate` deleted or renamed its instance variable `sharing_status` - - Model `ImageUpdate` deleted or renamed its instance variable `source_virtual_machine` - - Model `ImageUpdate` deleted or renamed its instance variable `storage_profile` - - Model `ImageUpdate` deleted or renamed its instance variable `provisioning_state` - - Model `ImageUpdate` deleted or renamed its instance variable `hyper_v_generation` - - Deleted or renamed enum value `NetworkApiVersion.TWO_THOUSAND_TWENTY11_01` - - Deleted or renamed enum value `NetworkApiVersion.TWO_THOUSAND_TWENTY_TWO11_01` - - Model `PirCommunityGalleryResource` deleted or renamed its instance variable `unique_id` - - Model `PirSharedGalleryResource` deleted or renamed its instance variable `unique_id` - - Model `ResourceSkuRestrictions` deleted or renamed its instance variable `values` - - Model `RestorePointCollectionUpdate` deleted or renamed its instance variable `source` - - Model `RestorePointCollectionUpdate` deleted or renamed its instance variable `provisioning_state` - - Model `RestorePointCollectionUpdate` deleted or renamed its instance variable `restore_point_collection_id` - - Model `RestorePointCollectionUpdate` deleted or renamed its instance variable `restore_points` - - Model `SshPublicKeyUpdateResource` deleted or renamed its instance variable `public_key` - - Model `UserArtifactManage` deleted or renamed its instance variable `update` - - Model `VirtualMachineRunCommandUpdate` deleted or renamed its instance variable `source` - - Model `VirtualMachineRunCommandUpdate` deleted or renamed its instance variable `parameters` - - Model `VirtualMachineRunCommandUpdate` deleted or renamed its instance variable `protected_parameters` - - Model `VirtualMachineRunCommandUpdate` deleted or renamed its instance variable `async_execution` - - Model `VirtualMachineRunCommandUpdate` deleted or renamed its instance variable `run_as_user` - - Model `VirtualMachineRunCommandUpdate` deleted or renamed its instance variable `run_as_password` - - Model `VirtualMachineRunCommandUpdate` deleted or renamed its instance variable `timeout_in_seconds` - - Model `VirtualMachineRunCommandUpdate` deleted or renamed its instance variable `output_blob_uri` - - Model `VirtualMachineRunCommandUpdate` deleted or renamed its instance variable `error_blob_uri` - - Model `VirtualMachineRunCommandUpdate` deleted or renamed its instance variable `output_blob_managed_identity` - - Model `VirtualMachineRunCommandUpdate` deleted or renamed its instance variable `error_blob_managed_identity` - - Model `VirtualMachineRunCommandUpdate` deleted or renamed its instance variable `provisioning_state` - - Model `VirtualMachineRunCommandUpdate` deleted or renamed its instance variable `instance_view` - - Model `VirtualMachineRunCommandUpdate` deleted or renamed its instance variable `treat_failure_as_deployment_failure` - - Model `VirtualMachineScaleSetExtensionUpdate` deleted or renamed its instance variable `force_update_tag` - - Model `VirtualMachineScaleSetExtensionUpdate` deleted or renamed its instance variable `publisher` - - Model `VirtualMachineScaleSetExtensionUpdate` deleted or renamed its instance variable `type_properties_type` - - Model `VirtualMachineScaleSetExtensionUpdate` deleted or renamed its instance variable `type_handler_version` - - Model `VirtualMachineScaleSetExtensionUpdate` deleted or renamed its instance variable `auto_upgrade_minor_version` - - Model `VirtualMachineScaleSetExtensionUpdate` deleted or renamed its instance variable `enable_automatic_upgrade` - - Model `VirtualMachineScaleSetExtensionUpdate` deleted or renamed its instance variable `settings` - - Model `VirtualMachineScaleSetExtensionUpdate` deleted or renamed its instance variable `protected_settings` - - Model `VirtualMachineScaleSetExtensionUpdate` deleted or renamed its instance variable `provisioning_state` - - Model `VirtualMachineScaleSetExtensionUpdate` deleted or renamed its instance variable `provision_after_extensions` - - Model `VirtualMachineScaleSetExtensionUpdate` deleted or renamed its instance variable `suppress_failures` - - Model `VirtualMachineScaleSetExtensionUpdate` deleted or renamed its instance variable `protected_settings_from_key_vault` - - Model `VirtualMachineScaleSetVMExtension` deleted or renamed its instance variable `force_update_tag` - - Model `VirtualMachineScaleSetVMExtension` deleted or renamed its instance variable `publisher` - - Model `VirtualMachineScaleSetVMExtension` deleted or renamed its instance variable `type_properties_type` - - Model `VirtualMachineScaleSetVMExtension` deleted or renamed its instance variable `type_handler_version` - - Model `VirtualMachineScaleSetVMExtension` deleted or renamed its instance variable `auto_upgrade_minor_version` - - Model `VirtualMachineScaleSetVMExtension` deleted or renamed its instance variable `enable_automatic_upgrade` - - Model `VirtualMachineScaleSetVMExtension` deleted or renamed its instance variable `settings` - - Model `VirtualMachineScaleSetVMExtension` deleted or renamed its instance variable `protected_settings` - - Model `VirtualMachineScaleSetVMExtension` deleted or renamed its instance variable `provisioning_state` - - Model `VirtualMachineScaleSetVMExtension` deleted or renamed its instance variable `instance_view` - - Model `VirtualMachineScaleSetVMExtension` deleted or renamed its instance variable `suppress_failures` - - Model `VirtualMachineScaleSetVMExtension` deleted or renamed its instance variable `protected_settings_from_key_vault` - - Model `VirtualMachineScaleSetVMExtension` deleted or renamed its instance variable `provision_after_extensions` - - Model `VirtualMachineScaleSetVMExtensionUpdate` deleted or renamed its instance variable `force_update_tag` - - Model `VirtualMachineScaleSetVMExtensionUpdate` deleted or renamed its instance variable `publisher` - - Model `VirtualMachineScaleSetVMExtensionUpdate` deleted or renamed its instance variable `type_properties_type` - - Model `VirtualMachineScaleSetVMExtensionUpdate` deleted or renamed its instance variable `type_handler_version` - - Model `VirtualMachineScaleSetVMExtensionUpdate` deleted or renamed its instance variable `auto_upgrade_minor_version` - - Model `VirtualMachineScaleSetVMExtensionUpdate` deleted or renamed its instance variable `enable_automatic_upgrade` - - Model `VirtualMachineScaleSetVMExtensionUpdate` deleted or renamed its instance variable `settings` - - Model `VirtualMachineScaleSetVMExtensionUpdate` deleted or renamed its instance variable `protected_settings` - - Model `VirtualMachineScaleSetVMExtensionUpdate` deleted or renamed its instance variable `suppress_failures` - - Model `VirtualMachineScaleSetVMExtensionUpdate` deleted or renamed its instance variable `protected_settings_from_key_vault` - - Model `VirtualMachineUpdate` deleted or renamed its instance variable `hardware_profile` - - Model `VirtualMachineUpdate` deleted or renamed its instance variable `scheduled_events_policy` - - Model `VirtualMachineUpdate` deleted or renamed its instance variable `storage_profile` - - Model `VirtualMachineUpdate` deleted or renamed its instance variable `additional_capabilities` - - Model `VirtualMachineUpdate` deleted or renamed its instance variable `os_profile` - - Model `VirtualMachineUpdate` deleted or renamed its instance variable `network_profile` - - Model `VirtualMachineUpdate` deleted or renamed its instance variable `security_profile` - - Model `VirtualMachineUpdate` deleted or renamed its instance variable `diagnostics_profile` - - Model `VirtualMachineUpdate` deleted or renamed its instance variable `availability_set` - - Model `VirtualMachineUpdate` deleted or renamed its instance variable `virtual_machine_scale_set` - - Model `VirtualMachineUpdate` deleted or renamed its instance variable `proximity_placement_group` - - Model `VirtualMachineUpdate` deleted or renamed its instance variable `priority` - - Model `VirtualMachineUpdate` deleted or renamed its instance variable `eviction_policy` - - Model `VirtualMachineUpdate` deleted or renamed its instance variable `billing_profile` - - Model `VirtualMachineUpdate` deleted or renamed its instance variable `host` - - Model `VirtualMachineUpdate` deleted or renamed its instance variable `host_group` - - Model `VirtualMachineUpdate` deleted or renamed its instance variable `provisioning_state` - - Model `VirtualMachineUpdate` deleted or renamed its instance variable `instance_view` - - Model `VirtualMachineUpdate` deleted or renamed its instance variable `license_type` - - Model `VirtualMachineUpdate` deleted or renamed its instance variable `vm_id` - - Model `VirtualMachineUpdate` deleted or renamed its instance variable `extensions_time_budget` - - Model `VirtualMachineUpdate` deleted or renamed its instance variable `platform_fault_domain` - - Model `VirtualMachineUpdate` deleted or renamed its instance variable `scheduled_events_profile` - - Model `VirtualMachineUpdate` deleted or renamed its instance variable `user_data` - - Model `VirtualMachineUpdate` deleted or renamed its instance variable `capacity_reservation` - - Model `VirtualMachineUpdate` deleted or renamed its instance variable `application_profile` - - Model `VirtualMachineUpdate` deleted or renamed its instance variable `time_created` - - Deleted or renamed model `AvailabilitySetSkuTypes` - - Deleted or renamed model `CloudService` - - Deleted or renamed model `CloudServiceExtensionProfile` - - Deleted or renamed model `CloudServiceExtensionProperties` - - Deleted or renamed model `CloudServiceInstanceView` - - Deleted or renamed model `CloudServiceNetworkProfile` - - Deleted or renamed model `CloudServiceOsProfile` - - Deleted or renamed model `CloudServiceProperties` - - Deleted or renamed model `CloudServiceRole` - - Deleted or renamed model `CloudServiceRoleProfile` - - Deleted or renamed model `CloudServiceRoleProfileProperties` - - Deleted or renamed model `CloudServiceRoleProperties` - - Deleted or renamed model `CloudServiceRoleSku` - - Deleted or renamed model `CloudServiceSlotType` - - Deleted or renamed model `CloudServiceUpdate` - - Deleted or renamed model `CloudServiceUpgradeMode` - - Deleted or renamed model `CloudServiceVaultAndSecretReference` - - Deleted or renamed model `CloudServiceVaultCertificate` - - Deleted or renamed model `CloudServiceVaultSecretGroup` - - Deleted or renamed model `CommunityGalleryImageList` - - Deleted or renamed model `CommunityGalleryImageVersionList` - - Deleted or renamed model `DiskAccessList` - - Deleted or renamed model `DiskEncryptionSetList` - - Deleted or renamed model `DiskList` - - Deleted or renamed model `DiskRestorePointList` - - Deleted or renamed model `Extension` - - Deleted or renamed model `GalleryApplicationList` - - Deleted or renamed model `GalleryApplicationVersionList` - - Deleted or renamed model `GalleryImageList` - - Deleted or renamed model `GalleryImageVersionList` - - Deleted or renamed model `GalleryInVMAccessControlProfileList` - - Deleted or renamed model `GalleryInVMAccessControlProfileVersionList` - - Deleted or renamed model `GalleryList` - - Deleted or renamed model `GallerySoftDeletedResourceList` - - Deleted or renamed model `InstanceSku` - - Deleted or renamed model `InstanceViewStatusesSummary` - - Deleted or renamed model `ListUsagesResult` - - Deleted or renamed model `LoadBalancerConfiguration` - - Deleted or renamed model `LoadBalancerConfigurationProperties` - - Deleted or renamed model `LoadBalancerFrontendIpConfiguration` - - Deleted or renamed model `LoadBalancerFrontendIpConfigurationProperties` - - Deleted or renamed model `OSFamily` - - Deleted or renamed model `OSFamilyProperties` - - Deleted or renamed model `OSVersion` - - Deleted or renamed model `OSVersionProperties` - - Deleted or renamed model `OSVersionPropertiesBase` - - Deleted or renamed model `ResourceInstanceViewStatus` - - Deleted or renamed model `ResourceSkusResult` - - Deleted or renamed model `ResourceUriList` - - Deleted or renamed model `ResourceWithOptionalLocation` - - Deleted or renamed model `RoleInstance` - - Deleted or renamed model `RoleInstanceNetworkProfile` - - Deleted or renamed model `RoleInstanceProperties` - - Deleted or renamed model `RoleInstanceView` - - Deleted or renamed model `RoleInstances` - - Deleted or renamed model `SharedGalleryImageList` - - Deleted or renamed model `SharedGalleryImageVersionList` - - Deleted or renamed model `SharedGalleryList` - - Deleted or renamed model `SnapshotList` - - Deleted or renamed model `StatusCodeCount` - - Deleted or renamed model `UpdateDomain` - - Deleted or renamed model `VirtualMachineScaleSetListOSUpgradeHistory` - - Deleted or renamed model `VirtualMachineScaleSetListSkusResult` - - Deleted or renamed model `VirtualMachineScaleSetListWithLinkResult` - - Method `AvailabilitySetsOperations.list_by_subscription` changed its parameter `expand` from `positional_or_keyword` to `keyword_only` - - Method `CapacityReservationGroupsOperations.get` changed its parameter `expand` from `positional_or_keyword` to `keyword_only` - - Method `CapacityReservationGroupsOperations.list_by_resource_group` changed its parameter `expand` from `positional_or_keyword` to `keyword_only` - - Method `CapacityReservationGroupsOperations.list_by_subscription` changed its parameter `expand` from `positional_or_keyword` to `keyword_only` - - Method `CapacityReservationGroupsOperations.list_by_subscription` changed its parameter `resource_ids_only` from `positional_or_keyword` to `keyword_only` - - Method `CapacityReservationsOperations.get` changed its parameter `expand` from `positional_or_keyword` to `keyword_only` - - Method `DedicatedHostGroupsOperations.get` changed its parameter `expand` from `positional_or_keyword` to `keyword_only` - - Method `DedicatedHostsOperations.get` changed its parameter `expand` from `positional_or_keyword` to `keyword_only` - - Method `GalleriesOperations.get` changed its parameter `select` from `positional_or_keyword` to `keyword_only` - - Method `GalleriesOperations.get` changed its parameter `expand` from `positional_or_keyword` to `keyword_only` - - Method `GalleryApplicationVersionsOperations.get` changed its parameter `expand` from `positional_or_keyword` to `keyword_only` - - Method `GalleryImageVersionsOperations.get` changed its parameter `expand` from `positional_or_keyword` to `keyword_only` - - Method `ImagesOperations.get` changed its parameter `expand` from `positional_or_keyword` to `keyword_only` - - Method `ProximityPlacementGroupsOperations.get` changed its parameter `include_colocation_status` from `positional_or_keyword` to `keyword_only` - - Method `ResourceSkusOperations.list` changed its parameter `include_extended_locations` from `positional_or_keyword` to `keyword_only` - - Method `RestorePointCollectionsOperations.get` changed its parameter `expand` from `positional_or_keyword` to `keyword_only` - - Method `RestorePointsOperations.get` changed its parameter `expand` from `positional_or_keyword` to `keyword_only` - - Method `SharedGalleriesOperations.list` changed its parameter `shared_to` from `positional_or_keyword` to `keyword_only` - - Method `SharedGalleryImageVersionsOperations.list` changed its parameter `shared_to` from `positional_or_keyword` to `keyword_only` - - Method `SharedGalleryImagesOperations.list` changed its parameter `shared_to` from `positional_or_keyword` to `keyword_only` - - Method `VirtualMachineExtensionImagesOperations.list_versions` changed its parameter `orderby` from `positional_or_keyword` to `keyword_only` - - Method `VirtualMachineExtensionsOperations.get` changed its parameter `expand` from `positional_or_keyword` to `keyword_only` - - Method `VirtualMachineExtensionsOperations.list` changed its parameter `expand` from `positional_or_keyword` to `keyword_only` - - Method `VirtualMachineImagesEdgeZoneOperations.list` changed its parameter `expand` from `positional_or_keyword` to `keyword_only` - - Method `VirtualMachineImagesEdgeZoneOperations.list` changed its parameter `orderby` from `positional_or_keyword` to `keyword_only` - - Method `VirtualMachineImagesOperations.list` changed its parameter `expand` from `positional_or_keyword` to `keyword_only` - - Method `VirtualMachineImagesOperations.list` changed its parameter `orderby` from `positional_or_keyword` to `keyword_only` - - Method `VirtualMachineImagesOperations.list_with_properties` changed its parameter `expand` from `positional_or_keyword` to `keyword_only` - - Method `VirtualMachineImagesOperations.list_with_properties` changed its parameter `orderby` from `positional_or_keyword` to `keyword_only` - - Method `VirtualMachineRunCommandsOperations.get_by_virtual_machine` changed its parameter `expand` from `positional_or_keyword` to `keyword_only` - - Method `VirtualMachineRunCommandsOperations.list_by_virtual_machine` changed its parameter `expand` from `positional_or_keyword` to `keyword_only` - - Method `VirtualMachineScaleSetExtensionsOperations.get` changed its parameter `expand` from `positional_or_keyword` to `keyword_only` - - Method `VirtualMachineScaleSetVMExtensionsOperations.get` changed its parameter `expand` from `positional_or_keyword` to `keyword_only` - - Method `VirtualMachineScaleSetVMExtensionsOperations.list` changed its parameter `expand` from `positional_or_keyword` to `keyword_only` - - Method `VirtualMachineScaleSetVMRunCommandsOperations.get` changed its parameter `expand` from `positional_or_keyword` to `keyword_only` - - Method `VirtualMachineScaleSetVMRunCommandsOperations.list` changed its parameter `expand` from `positional_or_keyword` to `keyword_only` - - Method `VirtualMachineScaleSetVMsOperations.begin_delete` changed its parameter `force_deletion` from `positional_or_keyword` to `keyword_only` - - Method `VirtualMachineScaleSetVMsOperations.begin_power_off` changed its parameter `skip_shutdown` from `positional_or_keyword` to `keyword_only` - - Method `VirtualMachineScaleSetVMsOperations.begin_update` deleted or renamed its parameter `if_match` of kind `positional_or_keyword` - - Method `VirtualMachineScaleSetVMsOperations.begin_update` deleted or renamed its parameter `if_none_match` of kind `positional_or_keyword` - - Method `VirtualMachineScaleSetVMsOperations.get` changed its parameter `expand` from `positional_or_keyword` to `keyword_only` - - Method `VirtualMachineScaleSetVMsOperations.list` changed its parameter `select` from `positional_or_keyword` to `keyword_only` - - Method `VirtualMachineScaleSetVMsOperations.list` changed its parameter `expand` from `positional_or_keyword` to `keyword_only` - - Method `VirtualMachineScaleSetVMsOperations.retrieve_boot_diagnostics_data` changed its parameter `sas_uri_expiration_time_in_minutes` from `positional_or_keyword` to `keyword_only` - - Method `VirtualMachineScaleSetsOperations.begin_create_or_update` deleted or renamed its parameter `if_match` of kind `positional_or_keyword` - - Method `VirtualMachineScaleSetsOperations.begin_create_or_update` deleted or renamed its parameter `if_none_match` of kind `positional_or_keyword` - - Method `VirtualMachineScaleSetsOperations.begin_deallocate` changed its parameter `hibernate` from `positional_or_keyword` to `keyword_only` - - Method `VirtualMachineScaleSetsOperations.begin_delete` changed its parameter `force_deletion` from `positional_or_keyword` to `keyword_only` - - Method `VirtualMachineScaleSetsOperations.begin_delete_instances` changed its parameter `force_deletion` from `positional_or_keyword` to `keyword_only` - - Method `VirtualMachineScaleSetsOperations.begin_power_off` changed its parameter `skip_shutdown` from `positional_or_keyword` to `keyword_only` - - Method `VirtualMachineScaleSetsOperations.begin_update` deleted or renamed its parameter `if_match` of kind `positional_or_keyword` - - Method `VirtualMachineScaleSetsOperations.begin_update` deleted or renamed its parameter `if_none_match` of kind `positional_or_keyword` - - Method `VirtualMachineScaleSetsOperations.force_recovery_service_fabric_platform_update_domain_walk` changed its parameter `platform_update_domain` from `positional_or_keyword` to `keyword_only` - - Method `VirtualMachineScaleSetsOperations.force_recovery_service_fabric_platform_update_domain_walk` changed its parameter `zone` from `positional_or_keyword` to `keyword_only` - - Method `VirtualMachineScaleSetsOperations.force_recovery_service_fabric_platform_update_domain_walk` changed its parameter `placement_group_id` from `positional_or_keyword` to `keyword_only` - - Method `VirtualMachineScaleSetsOperations.get` changed its parameter `expand` from `positional_or_keyword` to `keyword_only` - - Method `VirtualMachinesOperations.begin_create_or_update` deleted or renamed its parameter `if_match` of kind `positional_or_keyword` - - Method `VirtualMachinesOperations.begin_create_or_update` deleted or renamed its parameter `if_none_match` of kind `positional_or_keyword` - - Method `VirtualMachinesOperations.begin_deallocate` changed its parameter `hibernate` from `positional_or_keyword` to `keyword_only` - - Method `VirtualMachinesOperations.begin_delete` changed its parameter `force_deletion` from `positional_or_keyword` to `keyword_only` - - Method `VirtualMachinesOperations.begin_power_off` changed its parameter `skip_shutdown` from `positional_or_keyword` to `keyword_only` - - Method `VirtualMachinesOperations.begin_update` deleted or renamed its parameter `if_match` of kind `positional_or_keyword` - - Method `VirtualMachinesOperations.begin_update` deleted or renamed its parameter `if_none_match` of kind `positional_or_keyword` - - Method `VirtualMachinesOperations.get` changed its parameter `expand` from `positional_or_keyword` to `keyword_only` - - Method `VirtualMachinesOperations.list` changed its parameter `expand` from `positional_or_keyword` to `keyword_only` - - Method `VirtualMachinesOperations.list_all` changed its parameter `status_only` from `positional_or_keyword` to `keyword_only` - - Method `VirtualMachinesOperations.list_all` changed its parameter `expand` from `positional_or_keyword` to `keyword_only` - - Method `VirtualMachinesOperations.retrieve_boot_diagnostics_data` changed its parameter `sas_uri_expiration_time_in_minutes` from `positional_or_keyword` to `keyword_only` - - Deleted or renamed model `CloudServiceOperatingSystemsOperations` - - Deleted or renamed model `CloudServiceRoleInstancesOperations` - - Deleted or renamed model `CloudServiceRolesOperations` - - Deleted or renamed model `CloudServicesOperations` - - Deleted or renamed model `CloudServicesUpdateDomainOperations` - - Method `VirtualMachinesOperations.begin_create_or_update` re-ordered its parameters from `['self', 'resource_group_name', 'vm_name', 'parameters', 'if_match', 'if_none_match', 'kwargs']` to `['self', 'resource_group_name', 'vm_name', 'parameters', 'etag', 'match_condition', 'kwargs']` - - Method `VirtualMachinesOperations.begin_update` re-ordered its parameters from `['self', 'resource_group_name', 'vm_name', 'parameters', 'if_match', 'if_none_match', 'kwargs']` to `['self', 'resource_group_name', 'vm_name', 'parameters', 'etag', 'match_condition', 'kwargs']` - - Method `VirtualMachineScaleSetVMsOperations.begin_update` re-ordered its parameters from `['self', 'resource_group_name', 'vm_scale_set_name', 'instance_id', 'parameters', 'if_match', 'if_none_match', 'kwargs']` to `['self', 'resource_group_name', 'vm_scale_set_name', 'instance_id', 'parameters', 'etag', 'match_condition', 'kwargs']` - - Method `VirtualMachineScaleSetsOperations.begin_deallocate` re-ordered its parameters from `['self', 'resource_group_name', 'vm_scale_set_name', 'hibernate', 'vm_instance_i_ds', 'kwargs']` to `['self', 'resource_group_name', 'vm_scale_set_name', 'vm_instance_i_ds', 'hibernate', 'kwargs']` - - Method `VirtualMachineScaleSetsOperations.begin_create_or_update` re-ordered its parameters from `['self', 'resource_group_name', 'vm_scale_set_name', 'parameters', 'if_match', 'if_none_match', 'kwargs']` to `['self', 'resource_group_name', 'vm_scale_set_name', 'parameters', 'etag', 'match_condition', 'kwargs']` - - Method `VirtualMachineScaleSetsOperations.begin_update` re-ordered its parameters from `['self', 'resource_group_name', 'vm_scale_set_name', 'parameters', 'if_match', 'if_none_match', 'kwargs']` to `['self', 'resource_group_name', 'vm_scale_set_name', 'parameters', 'etag', 'match_condition', 'kwargs']` - - Method `VirtualMachineScaleSetsOperations.begin_power_off` re-ordered its parameters from `['self', 'resource_group_name', 'vm_scale_set_name', 'skip_shutdown', 'vm_instance_i_ds', 'kwargs']` to `['self', 'resource_group_name', 'vm_scale_set_name', 'vm_instance_i_ds', 'skip_shutdown', 'kwargs']` + - For the method breakings, please refer to https://aka.ms/azsdk/python/migrate/operations for migration. + - This version introduces new hybrid models which have dual dictionary and model nature. Please follow https://aka.ms/azsdk/python/migrate/hybrid-models for migration. + - Method `VirtualMachineScaleSetVMsOperations.begin_update` replaced positional_or_keyword `if_match`/`if_none_match` to keyword_only `etag`/`match_condition` + - Method `VirtualMachineScaleSetsOperations.begin_create_or_update` replaced positional_or_keyword `if_match`/`if_none_match` to keyword_only `etag`/`match_condition` + - Method `VirtualMachineScaleSetsOperations.begin_update` replaced positional_or_keyword `if_match`/`if_none_match` to keyword_only `etag`/`match_condition` + - Method `VirtualMachinesOperations.begin_create_or_update` replaced positional_or_keyword `if_match`/`if_none_match` to keyword_only `etag`/`match_condition` + - Method `VirtualMachinesOperations.begin_update` replaced positional_or_keyword `if_match`/`if_none_match` to keyword_only `etag`/`match_condition` + - Model `AvailabilitySetUpdate` moved instance variables `platform_update_domain_count`, `platform_fault_domain_count`, `virtual_machines`, `proximity_placement_group`, `statuses`, `scheduled_events_policy`, `virtual_machine_scale_set_migration_info` under property `properties` + - Model `CapacityReservationGroupUpdate` moved instance variables `capacity_reservations`, `virtual_machines_associated`, `instance_view`, `sharing_profile`, `reservation_type` under property `properties` + - Model `CapacityReservationUpdate` moved instance variables `reservation_id`, `platform_fault_domain_count`, `virtual_machines_associated`, `provisioning_time`, `provisioning_state`, `instance_view`, `time_created`, `schedule_profile` under property `properties` + - Model `DedicatedHostGroupUpdate` moved instance variables `platform_fault_domain_count`, `hosts`, `instance_view`, `support_automatic_placement`, `additional_capabilities` under property `properties` + - Model `DedicatedHostUpdate` moved instance variables `platform_fault_domain`, `auto_replace_on_failure`, `host_id`, `virtual_machines`, `license_type`, `provisioning_time`, `provisioning_state`, `instance_view`, `time_created` under property `properties` + - Model `DiskEncryptionSet` moved instance variables `encryption_type`, `active_key`, `previous_keys`, `provisioning_state`, `rotation_to_latest_key_version_enabled`, `last_key_rotation_timestamp`, `auto_key_rotation_error`, `federated_client_id` under property `properties` + - Model `GalleryApplicationUpdate` moved instance variables `description`, `eula`, `privacy_statement_uri`, `release_note_uri`, `end_of_life_date`, `supported_os_type`, `custom_actions` under property `properties` + - Model `GalleryApplicationVersionUpdate` moved instance variables `publishing_profile`, `safety_profile`, `provisioning_state`, `replication_status` under property `properties` + - Model `GalleryImageUpdate` moved instance variables `description`, `eula`, `privacy_statement_uri`, `release_note_uri`, `os_type`, `os_state`, `hyper_v_generation`, `end_of_life_date`, `identifier`, `recommended`, `disallowed`, `purchase_plan`, `provisioning_state`, `features`, `architecture`, `allow_update_image` under property `properties` + - Model `GalleryImageVersionUpdate` moved instance variables `publishing_profile`, `provisioning_state`, `storage_profile`, `safety_profile`, `replication_status`, `security_profile`, `restore`, `validations_profile` under property `properties` + - Model `GalleryInVMAccessControlProfileVersion` moved instance variables `target_locations`, `exclude_from_latest`, `published_date`, `provisioning_state`, `replication_status`, `mode`, `default_access`, `rules` under property `properties` + - Model `GalleryInVMAccessControlProfileVersionUpdate` moved instance variables `target_locations`, `exclude_from_latest`, `published_date`, `provisioning_state`, `replication_status`, `mode`, `default_access`, `rules` under property `properties` + - Model `GalleryUpdate` moved instance variables `description`, `identifier`, `provisioning_state`, `sharing_profile`, `soft_delete_policy`, `sharing_status` under property `properties` + - Model `ImageUpdate` moved instance variables `source_virtual_machine`, `storage_profile`, `provisioning_state`, `hyper_v_generation` under property `properties` + - Model `RestorePointCollectionUpdate` moved instance variables `source`, `provisioning_state`, `restore_point_collection_id`, `restore_points` under property `properties` + - Model `SshPublicKeyUpdateResource` moved instance variable `public_key` under property `properties` + - Model `VirtualMachineRunCommandUpdate` moved instance variables `source`, `parameters`, `protected_parameters`, `async_execution`, `run_as_user`, `run_as_password`, `timeout_in_seconds`, `output_blob_uri`, `error_blob_uri`, `output_blob_managed_identity`, `error_blob_managed_identity`, `provisioning_state`, `instance_view`, `treat_failure_as_deployment_failure` under property `properties` + - Model `VirtualMachineScaleSetExtensionUpdate` moved instance variables `force_update_tag`, `publisher`, `type_properties_type`, `type_handler_version`, `auto_upgrade_minor_version`, `enable_automatic_upgrade`, `settings`, `protected_settings`, `provisioning_state`, `provision_after_extensions`, `suppress_failures`, `protected_settings_from_key_vault` under property `properties` + - Model `VirtualMachineScaleSetVMExtension` moved instance variables `force_update_tag`, `publisher`, `type_properties_type`, `type_handler_version`, `auto_upgrade_minor_version`, `enable_automatic_upgrade`, `settings`, `protected_settings`, `provisioning_state`, `instance_view`, `suppress_failures`, `protected_settings_from_key_vault`, `provision_after_extensions` under property `properties` + - Model `VirtualMachineScaleSetVMExtensionUpdate` moved instance variables `force_update_tag`, `publisher`, `type_properties_type`, `type_handler_version`, `auto_upgrade_minor_version`, `enable_automatic_upgrade`, `settings`, `protected_settings`, `suppress_failures`, `protected_settings_from_key_vault` under property `properties` + - Model `VirtualMachineUpdate` moved instance variables `hardware_profile`, `scheduled_events_policy`, `storage_profile`, `additional_capabilities`, `os_profile`, `network_profile`, `security_profile`, `diagnostics_profile`, `availability_set`, `virtual_machine_scale_set`, `proximity_placement_group`, `priority`, `eviction_policy`, `billing_profile`, `host`, `host_group`, `provisioning_state`, `instance_view`, `license_type`, `vm_id`, `extensions_time_budget`, `platform_fault_domain`, `scheduled_events_profile`, `user_data`, `capacity_reservation`, `application_profile`, `time_created` under property `properties` + - Model `PirCommunityGalleryResource` deleted or renamed its instance variable `unique_id` + - Model `PirSharedGalleryResource` deleted or renamed its instance variable `unique_id` + - Model `ResourceSkuRestrictions` deleted or renamed its instance variable `values` + - Deleted or renamed model `AvailabilitySetSkuTypes` + - Deleted or renamed model `CloudService` + - Deleted or renamed model `CloudServiceExtensionProfile` + - Deleted or renamed model `CloudServiceExtensionProperties` + - Deleted or renamed model `CloudServiceInstanceView` + - Deleted or renamed model `CloudServiceNetworkProfile` + - Deleted or renamed model `CloudServiceOsProfile` + - Deleted or renamed model `CloudServiceProperties` + - Deleted or renamed model `CloudServiceRole` + - Deleted or renamed model `CloudServiceRoleProfile` + - Deleted or renamed model `CloudServiceRoleProfileProperties` + - Deleted or renamed model `CloudServiceRoleProperties` + - Deleted or renamed model `CloudServiceRoleSku` + - Deleted or renamed model `CloudServiceSlotType` + - Deleted or renamed model `CloudServiceUpdate` + - Deleted or renamed model `CloudServiceUpgradeMode` + - Deleted or renamed model `CloudServiceVaultAndSecretReference` + - Deleted or renamed model `CloudServiceVaultCertificate` + - Deleted or renamed model `CloudServiceVaultSecretGroup` + - Deleted or renamed model `CommunityGalleryImageList` + - Deleted or renamed model `CommunityGalleryImageVersionList` + - Deleted or renamed model `DiskAccessList` + - Deleted or renamed model `DiskEncryptionSetList` + - Deleted or renamed model `DiskList` + - Deleted or renamed model `DiskRestorePointList` + - Deleted or renamed model `Extension` + - Deleted or renamed model `GalleryApplicationList` + - Deleted or renamed model `GalleryApplicationVersionList` + - Deleted or renamed model `GalleryImageList` + - Deleted or renamed model `GalleryImageVersionList` + - Deleted or renamed model `GalleryInVMAccessControlProfileList` + - Deleted or renamed model `GalleryInVMAccessControlProfileVersionList` + - Deleted or renamed model `GalleryList` + - Deleted or renamed model `GallerySoftDeletedResourceList` + - Deleted or renamed model `InstanceSku` + - Deleted or renamed model `InstanceViewStatusesSummary` + - Deleted or renamed model `ListUsagesResult` + - Deleted or renamed model `LoadBalancerConfiguration` + - Deleted or renamed model `LoadBalancerConfigurationProperties` + - Deleted or renamed model `LoadBalancerFrontendIpConfiguration` + - Deleted or renamed model `LoadBalancerFrontendIpConfigurationProperties` + - Deleted or renamed model `OSFamily` + - Deleted or renamed model `OSFamilyProperties` + - Deleted or renamed model `OSVersion` + - Deleted or renamed model `OSVersionProperties` + - Deleted or renamed model `OSVersionPropertiesBase` + - Deleted or renamed model `ResourceInstanceViewStatus` + - Deleted or renamed model `ResourceSkusResult` + - Deleted or renamed model `ResourceUriList` + - Deleted or renamed model `ResourceWithOptionalLocation` + - Deleted or renamed model `RoleInstance` + - Deleted or renamed model `RoleInstanceNetworkProfile` + - Deleted or renamed model `RoleInstanceProperties` + - Deleted or renamed model `RoleInstanceView` + - Deleted or renamed model `RoleInstances` + - Deleted or renamed model `SharedGalleryImageList` + - Deleted or renamed model `SharedGalleryImageVersionList` + - Deleted or renamed model `SharedGalleryList` + - Deleted or renamed model `SnapshotList` + - Deleted or renamed model `StatusCodeCount` + - Deleted or renamed model `UpdateDomain` + - Deleted or renamed model `VirtualMachineScaleSetListOSUpgradeHistory` + - Deleted or renamed model `VirtualMachineScaleSetListSkusResult` + - Deleted or renamed model `VirtualMachineScaleSetListWithLinkResult` + - Method `AvailabilitySetsOperations.list_by_subscription` changed its parameter `expand` from `positional_or_keyword` to `keyword_only` + - Method `CapacityReservationGroupsOperations.get` changed its parameter `expand` from `positional_or_keyword` to `keyword_only` + - Method `CapacityReservationGroupsOperations.list_by_resource_group` changed its parameter `expand` from `positional_or_keyword` to `keyword_only` + - Method `CapacityReservationGroupsOperations.list_by_subscription` changed its parameter `expand` from `positional_or_keyword` to `keyword_only` + - Method `CapacityReservationGroupsOperations.list_by_subscription` changed its parameter `resource_ids_only` from `positional_or_keyword` to `keyword_only` + - Method `CapacityReservationsOperations.get` changed its parameter `expand` from `positional_or_keyword` to `keyword_only` + - Method `DedicatedHostGroupsOperations.get` changed its parameter `expand` from `positional_or_keyword` to `keyword_only` + - Method `DedicatedHostsOperations.get` changed its parameter `expand` from `positional_or_keyword` to `keyword_only` + - Method `GalleriesOperations.get` changed its parameter `select` from `positional_or_keyword` to `keyword_only` + - Method `GalleriesOperations.get` changed its parameter `expand` from `positional_or_keyword` to `keyword_only` + - Method `GalleryApplicationVersionsOperations.get` changed its parameter `expand` from `positional_or_keyword` to `keyword_only` + - Method `GalleryImageVersionsOperations.get` changed its parameter `expand` from `positional_or_keyword` to `keyword_only` + - Method `ImagesOperations.get` changed its parameter `expand` from `positional_or_keyword` to `keyword_only` + - Method `ProximityPlacementGroupsOperations.get` changed its parameter `include_colocation_status` from `positional_or_keyword` to `keyword_only` + - Method `ResourceSkusOperations.list` changed its parameter `include_extended_locations` from `positional_or_keyword` to `keyword_only` + - Method `RestorePointCollectionsOperations.get` changed its parameter `expand` from `positional_or_keyword` to `keyword_only` + - Method `RestorePointsOperations.get` changed its parameter `expand` from `positional_or_keyword` to `keyword_only` + - Method `SharedGalleriesOperations.list` changed its parameter `shared_to` from `positional_or_keyword` to `keyword_only` + - Method `SharedGalleryImageVersionsOperations.list` changed its parameter `shared_to` from `positional_or_keyword` to `keyword_only` + - Method `SharedGalleryImagesOperations.list` changed its parameter `shared_to` from `positional_or_keyword` to `keyword_only` + - Method `VirtualMachineExtensionImagesOperations.list_versions` changed its parameter `orderby` from `positional_or_keyword` to `keyword_only` + - Method `VirtualMachineExtensionsOperations.get` changed its parameter `expand` from `positional_or_keyword` to `keyword_only` + - Method `VirtualMachineExtensionsOperations.list` changed its parameter `expand` from `positional_or_keyword` to `keyword_only` + - Method `VirtualMachineImagesEdgeZoneOperations.list` changed its parameter `expand` from `positional_or_keyword` to `keyword_only` + - Method `VirtualMachineImagesEdgeZoneOperations.list` changed its parameter `orderby` from `positional_or_keyword` to `keyword_only` + - Method `VirtualMachineImagesOperations.list` changed its parameter `expand` from `positional_or_keyword` to `keyword_only` + - Method `VirtualMachineImagesOperations.list` changed its parameter `orderby` from `positional_or_keyword` to `keyword_only` + - Method `VirtualMachineImagesOperations.list_with_properties` changed its parameter `expand` from `positional_or_keyword` to `keyword_only` + - Method `VirtualMachineImagesOperations.list_with_properties` changed its parameter `orderby` from `positional_or_keyword` to `keyword_only` + - Method `VirtualMachineRunCommandsOperations.get_by_virtual_machine` changed its parameter `expand` from `positional_or_keyword` to `keyword_only` + - Method `VirtualMachineRunCommandsOperations.list_by_virtual_machine` changed its parameter `expand` from `positional_or_keyword` to `keyword_only` + - Method `VirtualMachineScaleSetExtensionsOperations.get` changed its parameter `expand` from `positional_or_keyword` to `keyword_only` + - Method `VirtualMachineScaleSetVMExtensionsOperations.get` changed its parameter `expand` from `positional_or_keyword` to `keyword_only` + - Method `VirtualMachineScaleSetVMExtensionsOperations.list` changed its parameter `expand` from `positional_or_keyword` to `keyword_only` + - Method `VirtualMachineScaleSetVMRunCommandsOperations.get` changed its parameter `expand` from `positional_or_keyword` to `keyword_only` + - Method `VirtualMachineScaleSetVMRunCommandsOperations.list` changed its parameter `expand` from `positional_or_keyword` to `keyword_only` + - Method `VirtualMachineScaleSetVMsOperations.begin_delete` changed its parameter `force_deletion` from `positional_or_keyword` to `keyword_only` + - Method `VirtualMachineScaleSetVMsOperations.begin_power_off` changed its parameter `skip_shutdown` from `positional_or_keyword` to `keyword_only` + - Method `VirtualMachineScaleSetVMsOperations.get` changed its parameter `expand` from `positional_or_keyword` to `keyword_only` + - Method `VirtualMachineScaleSetVMsOperations.list` changed its parameter `select` from `positional_or_keyword` to `keyword_only` + - Method `VirtualMachineScaleSetVMsOperations.list` changed its parameter `expand` from `positional_or_keyword` to `keyword_only` + - Method `VirtualMachineScaleSetVMsOperations.retrieve_boot_diagnostics_data` changed its parameter `sas_uri_expiration_time_in_minutes` from `positional_or_keyword` to `keyword_only` + - Method `VirtualMachineScaleSetsOperations.begin_deallocate` changed its parameter `hibernate` from `positional_or_keyword` to `keyword_only` + - Method `VirtualMachineScaleSetsOperations.begin_delete` changed its parameter `force_deletion` from `positional_or_keyword` to `keyword_only` + - Method `VirtualMachineScaleSetsOperations.begin_delete_instances` changed its parameter `force_deletion` from `positional_or_keyword` to `keyword_only` + - Method `VirtualMachineScaleSetsOperations.begin_power_off` changed its parameter `skip_shutdown` from `positional_or_keyword` to `keyword_only` + - Method `VirtualMachineScaleSetsOperations.force_recovery_service_fabric_platform_update_domain_walk` changed its parameter `platform_update_domain` from `positional_or_keyword` to `keyword_only` + - Method `VirtualMachineScaleSetsOperations.force_recovery_service_fabric_platform_update_domain_walk` changed its parameter `zone` from `positional_or_keyword` to `keyword_only` + - Method `VirtualMachineScaleSetsOperations.force_recovery_service_fabric_platform_update_domain_walk` changed its parameter `placement_group_id` from `positional_or_keyword` to `keyword_only` + - Method `VirtualMachineScaleSetsOperations.get` changed its parameter `expand` from `positional_or_keyword` to `keyword_only` + - Method `VirtualMachinesOperations.begin_deallocate` changed its parameter `hibernate` from `positional_or_keyword` to `keyword_only` + - Method `VirtualMachinesOperations.begin_delete` changed its parameter `force_deletion` from `positional_or_keyword` to `keyword_only` + - Method `VirtualMachinesOperations.begin_power_off` changed its parameter `skip_shutdown` from `positional_or_keyword` to `keyword_only` + - Method `VirtualMachinesOperations.get` changed its parameter `expand` from `positional_or_keyword` to `keyword_only` + - Method `VirtualMachinesOperations.list` changed its parameter `expand` from `positional_or_keyword` to `keyword_only` + - Method `VirtualMachinesOperations.list_all` changed its parameter `status_only` from `positional_or_keyword` to `keyword_only` + - Method `VirtualMachinesOperations.list_all` changed its parameter `expand` from `positional_or_keyword` to `keyword_only` + - Method `VirtualMachinesOperations.retrieve_boot_diagnostics_data` changed its parameter `sas_uri_expiration_time_in_minutes` from `positional_or_keyword` to `keyword_only` ## 37.0.1 (2025-10-09)